- Pointer moves never re-render React. During splitter drags, drop targeting and container resizes, the engine computes new rects, and an internal writer applies
left/top/width/heightdirectly to the elements. Components render the same positions from the current snapshot whenever React does render, so the two always agree. - Components re-render only for state they read. Each tab, tabset and splitter part subscribes to its own entry of the snapshot. Entries keep their identity until they change, so selecting a tab re-renders that tabset's parts and nothing else.
- The engine is created once per layout. Changing
minPanelSize,splitterSizeortabBarHeightupdates it. Changingtabsupdates it only when the set of ids changes.
- Inline
tabsarrays are fine. A new array with the same ids does no engine work, and a tab re-renders only if its owntitle,content,closableortargetchanged. Elements created inline (content: <Editor />) are new objects on every render, so that tab's content re-renders with its parent, as it would anywhere in React. Memoize heavy content, or keep thetabsarray in state, if that matters. - Content is never remounted when tabs move, and keeps its DOM position, so iframes don't reload. Changing a tab's
idremounts it. useLayoutStateselectors should return stable values: primitives, or objects from the snapshot. Derived arrays need anisEqual.resizeThrottleMslimits container updates during window resizes; the default0updates once per animation frame.- Hidden tab content stays mounted (inactive tabs, panels hidden behind a maximized one). To pause expensive work in hidden content, read
useTab(id).isActiveoruseLayoutState((s) => s.tabs.get(id)?.isVisible).
Minified and gzipped, measured on the 2.0 build:
| Package | Size |
|---|---|
@dynamix-layout/core |
9.5 kB |
@dynamix-layout/react |
9.5 kB, plus core (React is a peer dependency) |
@dynamix-layout/solid |
5.3 kB, plus core |
styles.css (React) |
1.3 kB |