/** * SvDockLayout - a basic docking layout: nested resizable split groups and * tabbed leaves, with drag-to-dock. Drag a pane's tab onto another pane and * drop it on an edge (split) or the centre (add as a tab); drag the splitters * to resize; close panes. The whole layout is a plain `DockNode` tree you pass * in and bind - every gesture is a pure transform from `dock-model`, so state * is serializable and testable. Inspired by Smart's `smart-layout`. * * Usage: build a tree with `dockGroup` / `dockTabs` / `dockPane`, bind it, and * provide a `pane` snippet that renders each pane's content by id: * * let layout = $state(dockGroup('row', [ * dockTabs([dockPane('files', 'Files')]), * dockTabs([dockPane('editor', 'Editor')]), * ])) * * * {#snippet pane(p)} ...render by p.id... {/snippet} * */ import { type Snippet } from 'svelte'; import { type DockNode, type DockPane, type DockZone } from './dock-model'; type Props = { /** The layout tree. Bindable - every dock/resize/close writes a new tree. */ layout: DockNode; /** Renders each pane's content, keyed off the `DockPane`. */ pane: Snippet<[DockPane]>; /** Notified after any structural change (dock / resize / close). */ onLayoutChange?: (layout: DockNode) => void; /** Minimum pane size in px along the split axis. Default 80. */ minSize?: number; /** Surface id stamped on the root (`data-dock-surface`) - used by * SvDockManager to hit-test which layout a drag is over. Default 'main'. */ surface?: string; /** * Manager mode: when provided, SvDockLayout hands OFF tab-drag to the parent * (SvDockManager) instead of running its own drag-to-dock, so a drag can flow * across the main area, floating windows and edge strips. Return value is * ignored; the manager owns the gesture from here. */ onBeginDrag?: (event: PointerEvent, paneId: string, tabsId: string) => void; /** Manager mode: the externally-computed dock guide/highlight to paint. */ externalDrop?: { tabsId: string; zone: DockZone | null; centerOnly?: boolean; } | null; /** Manager mode: the externally-computed tab-reorder insertion indicator. */ externalReorder?: { tabsId: string; index: number; } | null; /** Stack-header controls for a leaf (maximize / float / pop-out), rendered * by the manager once per leaf at the right of its tab strip. */ leafActions?: Snippet<[import('./dock-model').DockTabs]>; /** Manager mode: route tab activation to the parent (controlled). */ onActivate?: (tabsId: string, index: number) => void; /** Manager mode: route pane close to the parent (controlled). */ onClose?: (paneId: string) => void; /** Manager mode: route splitter resize to the parent (controlled). */ onResize?: (groupId: string, sizes: number[]) => void; /** Which side of each leaf the tab strip sits on. Default `'top'`. */ headerPosition?: 'top' | 'bottom' | 'left' | 'right'; /** Manager mode: id of the focused leaf, for the active-panel highlight. */ focusedLeaf?: string | null; /** Keep inactive tabs mounted (hidden) so their content state persists. */ keepAlive?: boolean; /** In a single-pane leaf, hide the redundant tab button (auto-hide fly-out). */ hideSingleTab?: boolean; /** Locked / split mode: tabs cannot be dragged (no reorder / dock / float) and * panel action buttons are hidden - only splitter resize + tab switching remain. * Turns the layout into a fixed set of resizable panes. */ locked?: boolean; }; declare const SvDockLayout: import("svelte").Component; type SvDockLayout = ReturnType; export default SvDockLayout;