alt.hn

1/11/2025 at 3:31:03 PM

Show HN: TypeScript/React/Vue Window Layout Manager (Tabs, Floating, Popouts)

https://github.com/mathuo/dockview

by mathuo

1/11/2025 at 5:41:34 PM

Wow. Stellar work. The TS looks really proper on first glance. I think you're right on zeitgeist -- we're going to need a lot more fundamental tools like this to build AI apps.

Technically speaking, I've long wondered about mount/unmount of components as panels are dragged about and their visibility changed. Sometimes it's more costly to mount/unmount than to display:none.

Second, you have basically a declarative structure for these panels, are there plans to expose a Vite plugin for example that could export saved TS layouts, where functions (ie: TS imports) map to the panel contents? (trying to think outside of JSX and more vanilla TS)

Fantastic work!

by samradelie

1/11/2025 at 11:51:17 PM

I might have missed something -- how do AI apps come into this? Was this application written with AI, or for AI applications in particular? (I don't imagine it uses AI for the actual layout management or anything like that)

by achierius

1/12/2025 at 9:45:15 AM

I'm guessing because things like bolt.new, v0 etc work a lot better when they have high quality building blocks to work with? Still seems a bit of a stretch.

by ascorbic

1/12/2025 at 9:17:44 AM

no ai :) just a vanilla layout manager. I assume the above comment is by somebody building an ai project that could use a layout manager

by mathuo

1/12/2025 at 3:53:08 PM

It’s much intuitive to provide drag and drop support rather than the user asking AI to change the layout, which is hars bolt.new or v0 works at the moment.

by buremba

1/12/2025 at 2:32:07 AM

That's I am wondering too.. may be commenter itself is an AI?

by v3ss0n

1/11/2025 at 7:41:46 PM

In terms of rendering modes both approaches are supported

https://dockview.dev/docs/core/panels/rendering

There are options to maintain the panels content within the DOM at all times (using an approach like you mentioned with display: none) and options to remove content from the DOM.

In terms of vanilla TS the library is almost entire written in vanilla TS with small wrapper libraries for Vue and React.

In theory wrappers could be written for other frameworks such as Angular (which is something I would like to get done this year)

Loading and saving state is supported though

https://dockview.dev/docs/core/state/save

Let me know if that answers the question

by mathuo

1/11/2025 at 4:08:31 PM

This is really impressive. Can I also give you major props for the following:

- Zero dependencies: wow, this is really good for a js package.

- Documentation: nice, clear and with examples

- Transparent builds: this should be a standard

I wish more js packages were like yours

by bossyTeacher

1/11/2025 at 4:51:52 PM

> - Transparent builds: this should be a standard

Can you explain what "Transparent builds" means in this context?

From my understanding after a quick search, it is the standard. If any package requires me to figure out a manual build process after installing it, to get it to work, I simply do not use it.

by herpdyderp

1/11/2025 at 7:28:42 PM

This is in related to the publication of the package to npm. All of the publications are verified with provenance statements as supported by NPM directly; it's something I believe all NPM packages should be required to use but as of now it's optional; it simply provided verifiable signatures as to what was built and how it was built.

https://docs.npmjs.com/generating-provenance-statements

https://www.npmjs.com/package/dockview#provenance

by mathuo

1/11/2025 at 11:02:02 PM

[dead]

by fc417fc802

1/11/2025 at 7:37:40 PM

Attestation

by itsafarqueue

1/11/2025 at 11:15:02 PM

Dockview is phenomenal, and congrats to @mathuo on a great project - I've recently thoroughly tested 6-7 available libraries in this category, and dockview is certainly in the top. GH is also very active and well maintained.

The only reason I in the end went with FlexLayout (https://github.com/caplin/FlexLayout) for a recent project was lack of support for predefined/restricted dimensions, - which was since added in a very good way - and that I really liked how FL handles side panels, with vertical tabs, and their predefined behavior.

Looking very much forward to using Dockview in one of the next projects.

by alluro2

1/12/2025 at 9:09:55 AM

Both look great. The aesthetics of FlexLayout's drag box are _really_ nice, and the vertical tab handling is such a good touch. Dockview looks like a strong contender though, and the HN effect on stars may well give it momentum to integrate the relatively small edges that FlexLayout enjoys.

by popcorncowboy

1/11/2025 at 11:08:30 PM

I literally have been working on something like this for a spare-time project, and am so glad to find this. Now I can throw out my code and move to the next stage of the project.

by somytomy

1/11/2025 at 5:50:26 PM

How does this compare to golden layout? Inspired by it?

I really enjoyed that project back in the day, but unfortunately support completely stopped (it had some folks take over, but I didn't see a real feasible upgrade path despite their passionate work on updating it).

This looks great! I'd be interested in giving it a try.

by diob

1/11/2025 at 7:39:18 PM

golden layout is the OG JavaScript layout manager, used it for many years beforehand.

Orginally yes it was inspired by some of the other layout managers, include golden layout. The main goal here was to have zero depenedencies and to be written in Vanilla TypeScript with wrapper libraries for frameworks such as Vue and React.

Any feedback is appreicated, the website demo shows most of the current capabilities and there are many more planned in the Issues list.

by mathuo

1/11/2025 at 9:16:10 PM

I just tried using golden layout the other day. The demo on their website with react support is v1 and when I installed it, I got v2 which apparently drops react support and has no documentation or examples on the website. With v1, it only supported class based components. While in theory you could maintain your own adapter logic for golden layout, it seems somewhat defunct, there are other newer libs that may even have better feeling drag and drop like this one. I also recall about six years ago when I went to use Golden layout on another project I ended up implementing my own with vanilla type script because of some (perceived) issues with it. My experiences have always been that although it is ubiquitous it’s not that great.

by joshribakoff

1/11/2025 at 5:27:52 PM

Nice project. I would appreciate putting some common content in the demo, such as videos, dropdowns, large amount of text and large size text to show how they can be handled.

Also is there a version without window chrome, just panes?

by karol

1/11/2025 at 6:40:41 PM

Instead of content, put there webview/iframe – https://github.com/mlajtos/mosaic

by mlajtos

1/12/2025 at 4:38:43 AM

After tinking with some similar toy projects, I feel like iframes with a well-defined APi to use with postMessage() (and maybe a small library to provide frame-internal matching toolbars/controls) are definitely the way to go here, since they remove the need to tightly couple your "OS" with your "apps".

by crooked-v

1/12/2025 at 2:13:55 PM

What kind of apps?

by mlajtos

1/11/2025 at 6:40:14 PM

I maintain a tiling wm written in Rust, and I just cannot imagine having the patience to do this kind of work in JS/TS. My respect to mathuo! One of the coolest things I've seen on HN recently.

by bsnnkv

1/11/2025 at 7:36:02 PM

Appreciated :)

by mathuo

1/11/2025 at 7:53:37 PM

Brilliant.

Is anyone aware of any sort of similar sort of zero-dep vanilla libraries for common desktop controls beyond what HTML offers? E.g. menus etc?

by mattlondon

1/11/2025 at 8:07:21 PM

I use DaisyUI [0] for all kinds of controls; it's CSS only.

0: https://daisyui.com

by chris_st

1/11/2025 at 6:24:13 PM

Kept getting this error when navigating: This page crashed Try again Right side of assignment cannot be destructured

The video looks awesome, but I couldn’t get the demo to work using an iPad, so I assume mobile isn’t supported fully? I’d use it for my personal dashboard and for organizing llama.cpp chats if I could.

by dahdum

1/11/2025 at 7:35:49 PM

Most likely, touch devices are not officially supported however support is planed. Also the demo has some issues running on Safari which will be fixed.

by mathuo

1/11/2025 at 4:27:17 PM

it is great to say support for vanilla js & vue in addition to react, for other js framework to consume

by rk06

1/11/2025 at 6:57:23 PM

Looks like a very high quality library, great work! I wonder if it will eventually support auto truncating tab titles when the tabs fill up the horizontal space, just like how chrome display large number of tabs.

by low_tech_punk

1/12/2025 at 1:22:51 AM

Really nice. SolidJS support would be nice too. I lately have no preference between React and Solid but I have some projects that could use this that happens to be in SolidJS.

by therein

1/11/2025 at 7:48:51 PM

wow, very well thought out layout manager. I want to start a project just to use it :-)

Is there a way to add gaps between the elements so it looks like a dashboard rather than panel?

by pdyc

1/11/2025 at 4:50:14 PM

Does this use the new moveBefore API to move DOM elements while preserving their state? Or is it going to recreate the elements eitherway due to React/Vue?

by garbagepatch

1/11/2025 at 5:22:39 PM

I'd be surprised if it uses moveBefore for something that seems to have put so much thought into being portable. moveBefore doesn't even have an entry in MDN yet, the only references I can find to it suggest it's still only available behind a flag in Chrome canary.

by lolinder

1/11/2025 at 6:07:17 PM

It could support it as a progressive enhancement.

by samhh

1/11/2025 at 6:26:19 PM

I personally wouldn't even bother with that yet.

Once it's available in even one browser not behind a flag, sure, but while it's still entirely undocumented and only available to people who both use Chrome Canary and know to go turn on a specific flag?

by lolinder

1/11/2025 at 7:33:53 PM

There are multiple ways in which you can specify how the panel renders.

https://dockview.dev/docs/core/panels/rendering

Options exist for multiple cases:

1. Where you never want the elements DOM position to move (`always` rendering mode) and the HTMLElement is simply hidden (display: none) when not visible. 2. Where you only want the DOM element to exist when the panel is visible (`onlyWhenVisible` mode)

In the case of React the React Tree is always maintained in either mode.

by mathuo

1/12/2025 at 11:19:11 AM

Absolutely incredible! Everything is perfect. All dragging, resizing, moving, everything works without errors.

Even nested panels...

by qwertox

1/11/2025 at 6:08:24 PM

Demo doesn't load in macOS Safari.

by peppertree

1/11/2025 at 6:35:30 PM

Same issue on iPadOS (18.3) Safari.

by andix

1/11/2025 at 7:34:56 PM

will take a look https://github.com/mathuo/dockview/issues/826

by mathuo

1/11/2025 at 7:44:36 PM

Great. Sadly I can't provide any more details, I have no debugger connected to the iPad to investigate the issue, it's a bit tricky without a Mac.

by andix

1/11/2025 at 8:22:16 PM

Try this?

https://apps.apple.com/us/app/inspect-browser/id1203594958

by ukuina

1/11/2025 at 8:32:22 PM

I think there are also open source tools to get a Safari remote debugger working on Linux and Windows. I would prefer that over an app on the tiny iPad screen.

by andix

1/11/2025 at 9:14:09 PM

demo fixed on Safari. There is touch support for some the core features.

https://dockview.dev/demo/

by mathuo

1/11/2025 at 6:26:58 PM

Looks awesome! I want something like this for managing Electron base windows & Web contents views :)

by Jonovono

1/11/2025 at 6:37:49 PM

Do you plan to add touch device support? It doesn't work well on tablets and phones.

by Onavo

1/12/2025 at 2:25:38 PM

Does this support disabling the ability to have floating popout windows?

by MortyWaves

1/11/2025 at 4:20:31 PM

Neat. Any mobile touch plans?

by cyanydeez

1/11/2025 at 9:12:02 PM

small issue on website preventing demo working on Safari browsers is now fixed.

https://dockview.dev/demo/

by mathuo

1/11/2025 at 6:16:31 PM

SEXY!

by keb_

1/14/2025 at 2:25:32 AM

Oh hell yeah, dude!

by gavmor

1/12/2025 at 1:54:12 PM

[dead]

by T3RMINATED

1/12/2025 at 5:24:08 AM

[dead]

by urronglol

1/12/2025 at 11:15:05 AM

I have a look at SonarSource website, their homepage looks awful.

by todotask