react-dockable-desktop 4.2.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -90,6 +90,8 @@ interface WindowManagerProps {
90
90
  taskbarVisibility?: TaskbarVisibility;
91
91
  /** Custom context menu renderer. Defaults to the built-in `DefaultContextMenuAdapter`. */
92
92
  contextMenuAdapter?: ContextMenuAdapter;
93
+ /** Enables the library's own transitions/animations (tab hover, dock preview, etc.). Never affects the consumer's own page. @default true */
94
+ animations?: boolean;
93
95
  }
94
96
  declare const WindowManager: React$1.FC<WindowManagerProps>;
95
97
 
@@ -142,6 +144,13 @@ interface WorkspaceClientConfig {
142
144
  * outer edge. Range 0.1–0.9. Default: 0.2.
143
145
  */
144
146
  defaultEdgeSplitRatio?: number;
147
+ /**
148
+ * Starting z-index for floating windows and the library's own chrome overlays
149
+ * (context menu, toolbar flyout, modal stack, toast, workspace edge zones),
150
+ * all of which shift together via `--rdd-z-base`. Set this above/below a host
151
+ * app's own modal z-index range to control stacking against it. Default: 1000.
152
+ */
153
+ zIndexBase?: number;
145
154
  }
146
155
  /**
147
156
  * WorkspaceClient is the central configuration and imperative API object for
@@ -181,7 +190,7 @@ declare class WorkspaceClient<TUserEvents extends Record<string, unknown> = Reco
181
190
  /** Serialised layout to restore on mount, or null to start with an empty canvas. */
182
191
  readonly initialState: string | null;
183
192
  /** Non-rendering configuration forwarded to the provider. */
184
- readonly config: Pick<WorkspaceClientConfig, 'formatMessage' | 'predefinedMessages' | 'dir' | 'defaultSplitRatio' | 'defaultEdgeSplitRatio'>;
193
+ readonly config: Pick<WorkspaceClientConfig, 'formatMessage' | 'predefinedMessages' | 'dir' | 'defaultSplitRatio' | 'defaultEdgeSplitRatio' | 'zIndexBase'>;
185
194
  private _actions;
186
195
  private _initialized;
187
196
  /** Calls queued before _connect() fires — replayed in order on first connect. */
@@ -222,6 +231,42 @@ declare class WorkspaceClient<TUserEvents extends Record<string, unknown> = Reco
222
231
  saveLayout(): string;
223
232
  loadLayout(json: string): boolean;
224
233
  setDirection(dir: 'ltr' | 'rtl'): void;
234
+ /** Updates the split-size fractions at the given grid path. */
235
+ updateSplitSizes(path: number[], sizes: number[]): void;
236
+ /** Updates position/size/anchor of a floating panel. */
237
+ updateFloatingPosition(id: string, updates: Partial<Pick<FloatingWindow, 'x' | 'y' | 'width' | 'height' | 'anchor'>>): void;
238
+ /** @internal Drives the drag-in-progress visual state; normally only the library's own drag UI calls this. */
239
+ setDraggedPanelId(id: string | null): void;
240
+ /** Docks a panel into an existing leaf group at the given drop position. */
241
+ dockPanelToGroup(id: string, targetLeafId: string, position: DropPosition): void;
242
+ /** Reorders a panel's tab within its leaf group. */
243
+ movePanelOrder(panelId: string, targetLeafId: string, targetIndex: number): void;
244
+ /** Closes an entire leaf group (all of its tabs) at once. */
245
+ closeLeafGroup(leafId: string): void;
246
+ /** Registers a guard that can veto closing the given panel. */
247
+ registerCloseGuard(id: string, guard: () => boolean | Promise<boolean>): void;
248
+ /** Removes a previously registered close guard. */
249
+ unregisterCloseGuard(id: string): void;
250
+ /** Sets/clears a panel's dirty (unsaved changes) flag. */
251
+ setPanelDirty(id: string, dirty: boolean, options?: DirtyStateOptions): void;
252
+ /** Updates a panel's displayed title. */
253
+ updatePanelTitle(id: string, title: string | ContextMenuPredefinedMessage): void;
254
+ /**
255
+ * Requests that a panel close, honoring its dirty flag and any registered close guard.
256
+ * Resolves once the close (or user cancellation) has been resolved.
257
+ *
258
+ * @remarks If called before the provider mounts, the request is queued and this
259
+ * returns an already-resolved promise immediately — the caller can't observe the
260
+ * eventual outcome of a queued call, only that the request was accepted.
261
+ */
262
+ requestClosePanel(id: string, options?: {
263
+ force?: boolean;
264
+ onConfirm?: (opts?: DirtyStateOptions) => Promise<boolean>;
265
+ }): Promise<void>;
266
+ /** Docks a panel to one of the workspace's outer edges. */
267
+ dockPanelToWorkspaceEdge(id: string, position: SplitDirection): void;
268
+ /** Shows a context menu using the app's configured ContextMenuAdapter. */
269
+ showContextMenu(options: ShowContextMenuOptions): void;
225
270
  publish<K extends keyof (TUserEvents & BuiltInPanelEvents)>(event: K, data: (TUserEvents & BuiltInPanelEvents)[K]): void;
226
271
  subscribe<K extends keyof (TUserEvents & BuiltInPanelEvents)>(event: K, callback: (data: (TUserEvents & BuiltInPanelEvents)[K]) => void): () => void;
227
272
  /** Subscribe to panel open events. Fires only for newly created panels. */
@@ -539,21 +584,28 @@ interface WindowActions {
539
584
  /**
540
585
  * Opens a registered panel into the workspace.
541
586
  * If the panel ID is already open, the panel is focused instead of duplicated.
587
+ * Becomes `state.activePanelId` by default — pass `options.focus: false` to open
588
+ * without stealing focus from whatever is currently active.
542
589
  * @param id - Unique instance identifier for this panel.
543
590
  * @param component - Component key registered in the panel catalog.
544
591
  * @param options.title - Override the panel tab/window title. Accepts a plain string or an i18n message descriptor.
545
592
  * @param options.initialTarget - Initial placement: `'floating'`, `'docked'` (default when a grid exists), or `'tabbed'`.
546
593
  * @param options.anchor - Pin the new floating window to a workspace corner on creation. Has no effect when `initialTarget` is `'docked'` or `'tabbed'`.
594
+ * @param options.focus - Set `state.activePanelId` to this panel. @default true
547
595
  * @example
548
596
  * ```ts
549
597
  * // Open floating and pin to the top-right corner:
550
598
  * actions.openPanel('layers', 'layertree', { initialTarget: 'floating', anchor: 'top-right' });
599
+ *
600
+ * // Open in the background without stealing focus:
601
+ * actions.openPanel('prefetch', 'report', { focus: false });
551
602
  * ```
552
603
  */
553
604
  openPanel: (id: string, component: string, options?: {
554
605
  title?: string | ContextMenuPredefinedMessage;
555
606
  initialTarget?: 'floating' | 'docked' | 'tabbed';
556
607
  anchor?: FloatAnchor | null;
608
+ focus?: boolean;
557
609
  }) => void;
558
610
  /**
559
611
  * Closes a panel immediately, bypassing dirty-state close guards.
@@ -775,6 +827,19 @@ declare const useStyleClasses: () => StyleClasses;
775
827
  * ```
776
828
  */
777
829
  declare const useRegistry: () => PanelRegistryClass;
830
+ /** The on-disk shape produced by `saveLayout()` and accepted by `loadLayout()`/`initialState`. */
831
+ interface SerializedLayout {
832
+ /** Schema version — absent on layouts saved before this field was introduced (treated as 0). */
833
+ version?: number;
834
+ gridRoot: LayoutNode;
835
+ floating: FloatingWindow[];
836
+ minimized: {
837
+ id: string;
838
+ title: string | ContextMenuPredefinedMessage;
839
+ component: string;
840
+ }[];
841
+ panels: Record<string, PanelInfo>;
842
+ }
778
843
  /**
779
844
  * Props for `<DockableDesktopProvider>` and `<WindowManagerProvider>`.
780
845
  * Also exported as `DockableDesktopProviderProps` for consumers who use
@@ -807,6 +872,13 @@ interface WindowManagerProviderProps {
807
872
  windowClass?: string;
808
873
  /** CSS class applied to the inner content area of floating panel windows. */
809
874
  windowBodyClass?: string;
875
+ /**
876
+ * Starting z-index for floating windows and the library's own chrome overlays
877
+ * (context menu, toolbar flyout, modal stack, toast, workspace edge zones),
878
+ * all of which shift together via `--rdd-z-base`. Set this above/below a host
879
+ * app's own modal z-index range to control stacking against it. @default 1000
880
+ */
881
+ zIndexBase?: number;
810
882
  }
811
883
  declare const WindowManagerProvider: React$1.FC<WindowManagerProviderProps>;
812
884
  declare function useWindowManagerState(): WindowState;
@@ -962,8 +1034,9 @@ interface DockableDesktopProviderProps extends WindowManagerProviderProps {
962
1034
  contextMenuAdapter?: ContextMenuAdapter;
963
1035
  }
964
1036
  /**
965
- * Composite provider that wraps `WindowManagerProvider`, `PanelProvider`, and `ToolbarProvider`
966
- * in the correct order, and mounts the workspace-level `ContextMenuProvider` so that
1037
+ * Composite provider that wraps `WindowManagerProvider`, `PanelProvider`, `ToolbarProvider`,
1038
+ * and `PanelContributionProvider` in the correct order, and mounts the workspace-level
1039
+ * `ContextMenuProvider` so that
967
1040
  * `showContextMenu()` and `useShowContextMenu()` work from any component in the tree —
968
1041
  * including siblings of `<WindowManager>` such as `<Sidebar>`, `<SidePanelRenderer>`,
969
1042
  * and `<ModalStackRenderer>`.
@@ -1065,6 +1138,17 @@ declare const FormContainerProvider: Provider<FormContainerContract>;
1065
1138
  * (resize, close, minimize, restore, activate, deactivate, container-type changes).
1066
1139
  */
1067
1140
  declare const useFormContainer: () => FormContainerContract;
1141
+ /**
1142
+ * Reactive alternative to calling {@link FormContainerContract.getDimensions} yourself.
1143
+ * Returns the panel's current `{ width, height }`, or `null` before it has been laid
1144
+ * out, and re-renders whenever the panel's rendered box changes — including resizes
1145
+ * caused by the workspace itself (a grid split being dragged, docking, floating, or
1146
+ * tab activation), not just resizes of an element the panel created.
1147
+ */
1148
+ declare const usePanelSize: () => {
1149
+ width: number;
1150
+ height: number;
1151
+ } | null;
1068
1152
 
1069
1153
  /** Unique string identifier for panel/modal instances. */
1070
1154
  type PanelInstanceId = string;
@@ -1272,7 +1356,7 @@ interface SidebarProps {
1272
1356
  /** Which side the activity bar and drawer appear on. Default: 'right' */
1273
1357
  position?: 'left' | 'right';
1274
1358
  tabs: SidebarTab[];
1275
- /** Initial drawer width in pixels. Default: 220 */
1359
+ /** Initial drawer width in pixels. Default: 280 */
1276
1360
  defaultWidth?: number;
1277
1361
  /** Minimum drawer width in pixels during drag-resize. Default: 150 */
1278
1362
  minWidth?: number;
@@ -1294,8 +1378,6 @@ interface SidebarProps {
1294
1378
  onStripVisibilityChange?: (visible: boolean) => void;
1295
1379
  /** Main workspace content rendered alongside the sidebar. */
1296
1380
  children?: React$1.ReactNode;
1297
- /** @deprecated Use defaultWidth (number, pixels) instead. */
1298
- drawerWidth?: string;
1299
1381
  }
1300
1382
  /**
1301
1383
  * Imperative handle exposed by `<Sidebar ref={...}>`.
@@ -1336,14 +1418,14 @@ declare const Sidebar: React$1.ForwardRefExoticComponent<SidebarProps & React$1.
1336
1418
  * Returns sidebar control functions from anywhere inside a `<Sidebar>` tree,
1337
1419
  * including floating panels rendered via `{children}`.
1338
1420
  *
1339
- * Returns a no-op object with a console warning when called outside a Sidebar.
1421
+ * @throws Error if used outside of a {@link Sidebar}.
1340
1422
  */
1341
1423
  declare function useSidebar(): SidebarContextValue;
1342
1424
  /**
1343
1425
  * Returns tab-specific control functions for components rendered inside a
1344
1426
  * sidebar tab's `renderContent` tree.
1345
1427
  *
1346
- * Returns a no-op object with a console warning when called outside tab content.
1428
+ * @throws Error if used outside of a {@link Sidebar} tab's `renderContent` tree.
1347
1429
  */
1348
1430
  declare function useSidebarTab(): SidebarTabContextValue;
1349
1431
 
@@ -1372,7 +1454,7 @@ declare const ToolbarProvider: React$1.FC<{
1372
1454
  * Returns toolbar state and control functions from anywhere inside
1373
1455
  * a `<DockableDesktopProvider>` tree.
1374
1456
  *
1375
- * Returns a no-op object with a console warning when called outside the provider.
1457
+ * @throws Error if used outside of a {@link DockableDesktopProvider}.
1376
1458
  */
1377
1459
  declare function useToolbar(): ToolbarContextValue;
1378
1460
 
@@ -1406,7 +1488,16 @@ interface ToolbarRadioItem {
1406
1488
  onActivate?: (id: string) => void;
1407
1489
  disabled?: boolean;
1408
1490
  }
1409
- /** An independent on/off toggle modifier (e.g. snap-to-grid). */
1491
+ /**
1492
+ * An independent on/off toggle modifier (e.g. snap-to-grid).
1493
+ *
1494
+ * Supports both uncontrolled mode (omit `rdd-active` — state lives in
1495
+ * ToolbarContext, keyed by `id`) and controlled mode (provide `rdd-active` —
1496
+ * the caller is the single source of truth and must update the prop in
1497
+ * response to `onToggle`). Controlled mode is what lets independent
1498
+ * instances of the same panel type report independent active state
1499
+ * instead of colliding on a shared id.
1500
+ */
1410
1501
  interface ToolbarToggleItem {
1411
1502
  type: 'toggle';
1412
1503
  id: string;
@@ -1414,6 +1505,12 @@ interface ToolbarToggleItem {
1414
1505
  icon: React$1.ReactNode;
1415
1506
  /** Keyboard shortcut hint — reserved for future custom tooltip. */
1416
1507
  shortcut?: string;
1508
+ /**
1509
+ * Controlled active state. When provided (even as false), the component
1510
+ * reads this prop instead of ToolbarContext and does not update context
1511
+ * on click. Omit (undefined) for uncontrolled behaviour.
1512
+ */
1513
+ active?: boolean;
1417
1514
  /** Called after the toggle flips; receives the new active state. */
1418
1515
  onToggle?: (active: boolean) => void;
1419
1516
  disabled?: boolean;
@@ -1865,4 +1962,173 @@ interface PanelFloatingWindowManagerHandle {
1865
1962
  */
1866
1963
  declare function usePanelFloatingWindowManager(): PanelFloatingWindowManagerHandle;
1867
1964
 
1868
- export { type BuiltInPanelEvents, type ButtonVariant, type CloseOptions, ConfirmationForm, type ConfirmationFormProps, ContextMenu, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuPredefinedMessage, type ContextMenuProps, ContextMenuProvider, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, DefaultContextMenuAdapter, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWindow, FormContainerContext, type FormContainerContract, FormContainerProvider, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, LeftPanelRenderer, type ManagedWindowConfig, type MenuItemAction, type MessageFormatter, type ModalOptions, ModalStackRenderer, type PanelActions, type PanelDefinition, PanelFloatingWindow, type PanelFloatingWindowManagerHandle, type PanelFloatingWindowProps, type PanelInfo, type PanelInstance, type PanelInstanceId, PanelOverlayRoot, type PanelOverlayRootProps, PanelProvider, PanelRegistry, PanelRegistryClass, type PanelRegistryEntry, type PanelState, type PanelTitle, PanelToolbar, ToolbarItem as PanelToolbarItem, type PanelToolbarProps, ToolbarSeparator as PanelToolbarSeparator, type PredefinedMessageKey, type ResolvedToastOptions, RightPanelRenderer, type SearchResult, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarProps, type SidebarTab, type SidebarTabContextValue, type SplitDirection, type SplitOrientation, type StyleClasses, type TaskbarVisibility, type ToastAdapter, ToastContainer, type ToastContainerProps, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, Toolbar, type ToolbarActionItem, ToolbarButton, type ToolbarButtonProps, ToolbarCenter, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarProps, ToolbarProvider, type ToolbarRadioItem, ToolbarSearchInput, type ToolbarSearchInputProps, type ToolbarSeparator$1 as ToolbarSeparator, ToolbarSpacer, ToolbarToggle, type ToolbarToggleItem, type ToolbarToggleProps, type ToolbarVariant, type UsePanelFloatingWindowReturn, type WindowActions, WindowManager, type WindowManagerProps, WindowManagerProvider, type WindowManagerProviderProps, type WindowState, WorkspaceClient, type WorkspaceClientConfig, defaultPredefinedMessages, formatLabel, toast, useFormContainer, useFormatMessage, usePanelActions, usePanelContext, usePanelContextMenu, usePanelFloatingWindow, usePanelFloatingWindowManager, usePanelId, usePanelState, usePredefinedMessages, useRegistry, useShowContextMenu, useSidebar, useSidebarTab, useStyleClasses, useToolbar, useWindowManagerActions, useWindowManagerState };
1965
+ /**
1966
+ * @file PanelContributionContext.tsx
1967
+ * @description Lets any panel publish toolbar items and/or sidebar sections that
1968
+ * should only be surfaced while it is the globally active panel (`state.activePanelId`).
1969
+ * Optional, additive module — `DockableDesktopProvider` wires it up automatically.
1970
+ * Neither `<Toolbar>` nor `<Sidebar>` reads from this automatically; the app shell
1971
+ * merges `useActivePanelContribution()`'s result into its own `items`/`tabs` calls.
1972
+ */
1973
+
1974
+ /** A single named, labeled slot of content a panel contributes to the app's Sidebar while active. */
1975
+ interface PanelSidebarSection {
1976
+ id: string;
1977
+ label: string;
1978
+ icon?: React$1.ReactNode;
1979
+ content: React$1.ReactNode;
1980
+ }
1981
+ /**
1982
+ * What a panel publishes via `usePanelContribution()`. Both fields are optional and
1983
+ * independent — a panel may contribute only toolbar items, only sidebar sections,
1984
+ * both, or neither. The app decides what "toolbar items" and "sidebar sections" mean
1985
+ * for its own domain (map controls, document formatting, anything else).
1986
+ */
1987
+ interface PanelContribution {
1988
+ toolbarItems?: ToolbarItem$1[];
1989
+ sidebarSections?: PanelSidebarSection[];
1990
+ }
1991
+ /**
1992
+ * Provider enabling `usePanelContribution()` / `useActivePanelContribution()`.
1993
+ * Mounted automatically by `DockableDesktopProvider` — only needed manually when
1994
+ * composing `WindowManagerProvider` directly without it.
1995
+ */
1996
+ declare const PanelContributionProvider: React$1.FC<{
1997
+ children: React$1.ReactNode;
1998
+ }>;
1999
+ /**
2000
+ * Publish this panel's toolbar items and/or sidebar sections. Call on every render —
2001
+ * republishes automatically whenever `contribution` changes, and is cleared when the
2002
+ * panel unmounts. Memoize the object (and its array/callback contents, e.g. with
2003
+ * `useMemo`/`useCallback`) to avoid republishing on every unrelated re-render.
2004
+ *
2005
+ * Contributions are only ever surfaced while this panel is `state.activePanelId` —
2006
+ * see `useActivePanelContribution()`.
2007
+ *
2008
+ * @throws Error if used outside of a {@link PanelContributionProvider}.
2009
+ * @example
2010
+ * function MapPanel() {
2011
+ * const [controller, setController] = useState<'pan' | 'draw' | 'measure'>('pan');
2012
+ * usePanelContribution({
2013
+ * toolbarItems: (['pan', 'draw', 'measure'] as const).map(id => ({
2014
+ * type: 'toggle', id, label: id, icon: icons[id],
2015
+ * active: controller === id, onToggle: () => setController(id),
2016
+ * })),
2017
+ * sidebarSections: [{ id: 'layers', label: 'Layers', content: <LayerList /> }],
2018
+ * });
2019
+ * // ...
2020
+ * }
2021
+ */
2022
+ declare function usePanelContribution(contribution: PanelContribution): void;
2023
+ /**
2024
+ * Returns whatever the currently active panel (`state.activePanelId`) has published
2025
+ * via `usePanelContribution()`, or `null` if no panel is active or the active panel
2026
+ * hasn't contributed anything. Intended for the app shell to merge into its own
2027
+ * `<Toolbar items={...}>` / `<Sidebar tabs={...}>` calls.
2028
+ *
2029
+ * @throws Error if used outside of a {@link PanelContributionProvider}.
2030
+ */
2031
+ declare function useActivePanelContribution(): PanelContribution | null;
2032
+ /**
2033
+ * Converts a contributed sidebar section into a `SidebarTab` for `<Sidebar tabs={...}>`.
2034
+ * `SidebarTab.icon` is required, so supply `fallbackIcon` for sections that omit one.
2035
+ * `eagerMount`/`preserveState` have no contribution-side equivalent — a contribution
2036
+ * only exists while its owning panel is mounted and active, so both are left unset.
2037
+ */
2038
+ declare function sidebarSectionToTab(section: PanelSidebarSection, fallbackIcon?: React$1.ReactNode): SidebarTab;
2039
+ /**
2040
+ * Convenience wrapper around `useActivePanelContribution()` for the common case:
2041
+ * append the active panel's contributed toolbar items (behind a separator) to a
2042
+ * static list. Returns `staticItems` unchanged when there's nothing to add.
2043
+ * For manual control (a different merge position, no separator, etc.), call
2044
+ * `useActivePanelContribution()` directly instead.
2045
+ */
2046
+ declare function useMergedToolbarItems(staticItems: ToolbarItem$1[]): ToolbarItem$1[];
2047
+ /**
2048
+ * Convenience wrapper around `useActivePanelContribution()` for the common case:
2049
+ * append the active panel's contributed sidebar sections (via `sidebarSectionToTab`)
2050
+ * to a static tab list, as dynamic tabs that appear only while their panel is active.
2051
+ * Returns `staticTabs` unchanged when there's nothing to add.
2052
+ */
2053
+ declare function useMergedSidebarTabs(staticTabs: SidebarTab[], fallbackIcon?: React$1.ReactNode): SidebarTab[];
2054
+
2055
+ /**
2056
+ * Shared pointer-drag-resize primitives.
2057
+ *
2058
+ * Extracted from four previously-independent implementations (the workspace grid
2059
+ * split resizer, the sidebar drawer resizer, and two floating-window resize-handle
2060
+ * implementations) that had quietly drifted apart in exactly the kind of detail
2061
+ * (an inline-style property present in one and missing in the other) that once
2062
+ * caused a real, user-visible bug. This file is the single place that mechanic now
2063
+ * lives, so it can't drift again.
2064
+ */
2065
+ interface PointerDragConfig<TStart> {
2066
+ /** The element to capture the pointer on — normally the handle the user grabbed. */
2067
+ element: HTMLElement;
2068
+ pointerId: number;
2069
+ /** The pointerdown event's clientX/clientY, used as the delta origin. */
2070
+ startClientX: number;
2071
+ startClientY: number;
2072
+ /** Snapshot whatever state the caller needs at drag start (sizes, positions, ...). */
2073
+ captureStart: () => TStart;
2074
+ /** Called on every pointermove with the delta from the drag's start position. */
2075
+ onMove: (dx: number, dy: number, start: TStart) => void;
2076
+ /** Called once when the drag ends (pointerup or pointercancel). */
2077
+ onEnd?: (start: TStart) => void;
2078
+ /** Classes toggled on the given elements for the duration of the drag. */
2079
+ activeClasses?: Array<{
2080
+ el: HTMLElement;
2081
+ classes: string[];
2082
+ }>;
2083
+ }
2084
+ /**
2085
+ * Starts a pointer-capture-based drag: captures the pointer on `element`, tracks
2086
+ * movement via listeners scoped to that element's own lifetime (not `window`), and
2087
+ * cleans up automatically on release or cancel.
2088
+ */
2089
+ declare function startPointerDrag<TStart>(config: PointerDragConfig<TStart>): void;
2090
+ type ResizeDir = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';
2091
+ interface ResizeRect {
2092
+ x: number;
2093
+ y: number;
2094
+ w: number;
2095
+ h: number;
2096
+ }
2097
+ interface ResizeConstraints {
2098
+ minW: number;
2099
+ minH: number;
2100
+ /** Upper bound on width — only applies to eastward growth (dir includes 'e'). */
2101
+ maxW?: number;
2102
+ /** Upper bound on height — only applies to southward growth (dir includes 's'). */
2103
+ maxH?: number;
2104
+ /** Lower bound on the resulting x — only applies to westward growth (dir includes 'w'). */
2105
+ minX?: number;
2106
+ /** Lower bound on the resulting y — only applies to northward growth (dir includes 'n'). */
2107
+ minY?: number;
2108
+ }
2109
+ /**
2110
+ * Pure function computing the new rect for an 8-directional resize handle drag.
2111
+ *
2112
+ * `maxW`/`maxH` and `minX`/`minY` are independent, direction-scoped constraints
2113
+ * rather than one "container bound" — a resize toward the fixed edge (e/s) is
2114
+ * naturally bounded by a maximum dimension, while a resize toward the moving edge
2115
+ * (w/n) is naturally bounded by a minimum position, and the two calling sites this
2116
+ * was extracted from need different subsets of these (see WindowManager.tsx's
2117
+ * `startResize`, which omits all four and lets a window grow unbounded and be
2118
+ * dragged fully off-screen, vs. PanelOverlay.tsx's `handleResizePointerDown`, which
2119
+ * supplies all four to keep windows within their container).
2120
+ */
2121
+ declare function computeResizedRect(dir: ResizeDir, dx: number, dy: number, start: ResizeRect, constraints: ResizeConstraints): ResizeRect;
2122
+
2123
+ /**
2124
+ * Reactively reads the workspace's current `data-color-scheme` attribute
2125
+ * (set on `document.documentElement` by `<WindowManager />`), returning
2126
+ * `'dark'` or `'light'` and re-rendering whenever it changes.
2127
+ *
2128
+ * Useful for panel content that needs to react to the same scheme the
2129
+ * workspace itself is using — e.g. swapping a map's tile layer or an
2130
+ * embedded editor's theme to match.
2131
+ */
2132
+ declare function useColorScheme(): 'dark' | 'light';
2133
+
2134
+ export { type BuiltInPanelEvents, type ButtonVariant, type CloseOptions, ConfirmationForm, type ConfirmationFormProps, ContextMenu, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuPredefinedMessage, type ContextMenuProps, ContextMenuProvider, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, DefaultContextMenuAdapter, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWindow, FormContainerContext, type FormContainerContract, FormContainerProvider, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, LeftPanelRenderer, type ManagedWindowConfig, type MenuItemAction, type MessageFormatter, type ModalOptions, ModalStackRenderer, type PanelActions, type PanelContribution, PanelContributionProvider, type PanelDefinition, PanelFloatingWindow, type PanelFloatingWindowManagerHandle, type PanelFloatingWindowProps, type PanelInfo, type PanelInstance, type PanelInstanceId, PanelOverlayRoot, type PanelOverlayRootProps, PanelProvider, PanelRegistry, PanelRegistryClass, type PanelRegistryEntry, type PanelSidebarSection, type PanelState, type PanelTitle, PanelToolbar, ToolbarItem as PanelToolbarItem, type PanelToolbarProps, ToolbarSeparator as PanelToolbarSeparator, type PointerDragConfig, type PredefinedMessageKey, type ResizeConstraints, type ResizeDir, type ResizeRect, type ResolvedToastOptions, RightPanelRenderer, type SearchResult, type SerializedLayout, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarProps, type SidebarTab, type SidebarTabContextValue, type SplitDirection, type SplitOrientation, type StyleClasses, type TaskbarVisibility, type ToastAdapter, ToastContainer, type ToastContainerProps, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, Toolbar, type ToolbarActionItem, ToolbarButton, type ToolbarButtonProps, ToolbarCenter, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarProps, ToolbarProvider, type ToolbarRadioItem, ToolbarSearchInput, type ToolbarSearchInputProps, type ToolbarSeparator$1 as ToolbarSeparator, ToolbarSpacer, ToolbarToggle, type ToolbarToggleItem, type ToolbarToggleProps, type ToolbarVariant, type UsePanelFloatingWindowReturn, type WindowActions, WindowManager, type WindowManagerProps, WindowManagerProvider, type WindowManagerProviderProps, type WindowState, WorkspaceClient, type WorkspaceClientConfig, computeResizedRect, defaultPredefinedMessages, formatLabel, sidebarSectionToTab, startPointerDrag, toast, useActivePanelContribution, useColorScheme, useFormContainer, useFormatMessage, useMergedSidebarTabs, useMergedToolbarItems, usePanelActions, usePanelContext, usePanelContextMenu, usePanelContribution, usePanelFloatingWindow, usePanelFloatingWindowManager, usePanelId, usePanelSize, usePanelState, usePredefinedMessages, useRegistry, useShowContextMenu, useSidebar, useSidebarTab, useStyleClasses, useToolbar, useWindowManagerActions, useWindowManagerState };