react-dockable-desktop 6.0.0 → 6.1.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/README.md +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +121 -8
- package/dist/index.d.ts +121 -8
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/styles.css +12 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -150,6 +150,10 @@ interface WorkspaceClientConfig {
|
|
|
150
150
|
/**
|
|
151
151
|
* Serialised layout produced by a previous saveLayout() call.
|
|
152
152
|
* Pass null or omit to start with an empty canvas.
|
|
153
|
+
*
|
|
154
|
+
* Parsed synchronously before the first render. The restored `activePanelId` is the one the
|
|
155
|
+
* snapshot recorded, or — for layouts saved before that was persisted — the selected tab of
|
|
156
|
+
* the first leaf in the grid.
|
|
153
157
|
*/
|
|
154
158
|
initialState?: string | null;
|
|
155
159
|
/** Custom i18n formatter for all internal strings. */
|
|
@@ -641,7 +645,15 @@ interface WindowState {
|
|
|
641
645
|
panels: Record<string, PanelInfo>;
|
|
642
646
|
/** The ID of the panel tab currently being dragged. */
|
|
643
647
|
draggedPanelId: string | null;
|
|
644
|
-
/**
|
|
648
|
+
/**
|
|
649
|
+
* The ID of the active/focused panel — the one contributions are read from
|
|
650
|
+
* (see `useActivePanelContribution`) and the one drawn with focused chrome.
|
|
651
|
+
*
|
|
652
|
+
* Always a panel the user can actually see: the selected tab of its leaf, or a floating
|
|
653
|
+
* window. Never a minimized panel, except when an app explicitly calls `focusPanel()` on
|
|
654
|
+
* one. Restored layouts resolve it from the saved snapshot's own `activePanelId`, falling
|
|
655
|
+
* back to the first leaf's selected tab — never to an arbitrary entry in `panels`.
|
|
656
|
+
*/
|
|
645
657
|
activePanelId: string | null;
|
|
646
658
|
/** Current layout direction ('ltr' or 'rtl') */
|
|
647
659
|
dir: 'ltr' | 'rtl';
|
|
@@ -793,7 +805,8 @@ interface WindowActions {
|
|
|
793
805
|
findPanelId: (component: string, dedupeKey: string) => string | null;
|
|
794
806
|
/**
|
|
795
807
|
* Serializes the entire workspace state to a JSON string.
|
|
796
|
-
* Includes grid layout, floating window positions, minimized panels,
|
|
808
|
+
* Includes grid layout, floating window positions, minimized panels, panel metadata, and the
|
|
809
|
+
* globally active panel (see {@link SerializedLayout.activePanelId}).
|
|
797
810
|
* @returns JSON string suitable for storage and later restoration via {@link loadLayout}.
|
|
798
811
|
* @example
|
|
799
812
|
* ```ts
|
|
@@ -804,6 +817,12 @@ interface WindowActions {
|
|
|
804
817
|
/**
|
|
805
818
|
* Restores a previously serialized workspace from a JSON string.
|
|
806
819
|
* Replaces the entire current layout — all panels not in the snapshot are closed.
|
|
820
|
+
*
|
|
821
|
+
* `state.activePanelId` is resolved from the snapshot's own `activePanelId` when that panel is
|
|
822
|
+
* still visible in it, and otherwise from the first leaf's selected tab (which is also the path
|
|
823
|
+
* layouts saved before that field existed take). It is never seeded from an arbitrary entry in
|
|
824
|
+
* `panels`.
|
|
825
|
+
*
|
|
807
826
|
* @param layoutJson - JSON string produced by {@link saveLayout}.
|
|
808
827
|
* @returns `true` if the layout was successfully parsed and applied, `false` otherwise.
|
|
809
828
|
*/
|
|
@@ -948,6 +967,18 @@ declare const useRegistry: () => PanelRegistryClass;
|
|
|
948
967
|
interface SerializedLayout {
|
|
949
968
|
/** Schema version — absent on layouts saved before this field was introduced (treated as 0). */
|
|
950
969
|
version?: number;
|
|
970
|
+
/**
|
|
971
|
+
* The globally active panel at save time — the one the user was actually looking at.
|
|
972
|
+
*
|
|
973
|
+
* Omitted when nothing was active, and when the active panel didn't survive this snapshot's
|
|
974
|
+
* serializability pruning (see {@link WindowActions.saveLayout}) — so it never names a panel
|
|
975
|
+
* absent from this payload's own `panels`. Absent on every layout saved before this field
|
|
976
|
+
* existed, in which case the restore derives it from `gridRoot`'s own per-leaf selection
|
|
977
|
+
* instead; a present-but-no-longer-valid value falls back to the same derivation. `version`
|
|
978
|
+
* is deliberately not bumped for this: the field is optional and its absence is a supported,
|
|
979
|
+
* fully-handled case rather than a schema a migration has to branch on.
|
|
980
|
+
*/
|
|
981
|
+
activePanelId?: string | null;
|
|
951
982
|
gridRoot: LayoutNode;
|
|
952
983
|
floating: FloatingWindow[];
|
|
953
984
|
minimized: {
|
|
@@ -2022,6 +2053,28 @@ declare function ToastContainer({ position, maxVisible, defaultDuration, default
|
|
|
2022
2053
|
|
|
2023
2054
|
/** Edge of a panel to which a `PanelToolbar` attaches. */
|
|
2024
2055
|
type ToolbarPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
2056
|
+
/**
|
|
2057
|
+
* Which of a docked widget's axes span the host panel instead of carrying a fixed size.
|
|
2058
|
+
*
|
|
2059
|
+
* A docked widget normally pins one end of each axis and carries an explicit size. A stretched
|
|
2060
|
+
* axis pins **both** ends and carries no size at all, so the widget tracks the panel as it
|
|
2061
|
+
* resizes — with no `ResizeObserver` and no JS, because CSS already does exactly this.
|
|
2062
|
+
*
|
|
2063
|
+
* - `'width'` — spans the panel's inline axis; height still fixed. A status or timeline strip.
|
|
2064
|
+
* - `'height'` — spans the block axis; width still fixed. A full-height side column.
|
|
2065
|
+
* - `'both'` — fills the panel, the inner-widget equivalent of maximizing a floating window.
|
|
2066
|
+
*/
|
|
2067
|
+
type Stretch = 'width' | 'height' | 'both';
|
|
2068
|
+
/**
|
|
2069
|
+
* Where a docked widget sits: which corner it is anchored to, plus which axes (if any) span the
|
|
2070
|
+
* panel. Reported as a unit because a single gesture can change both at once — dropping a
|
|
2071
|
+
* full-width bottom strip onto the left edge flips the anchor *and* the stretched axis together,
|
|
2072
|
+
* and reporting those separately would expose a state that is never actually valid.
|
|
2073
|
+
*/
|
|
2074
|
+
interface PanelFloatPlacement {
|
|
2075
|
+
anchor: FloatAnchor;
|
|
2076
|
+
stretch: Stretch | null;
|
|
2077
|
+
}
|
|
2025
2078
|
/**
|
|
2026
2079
|
* Configuration for a window spawned imperatively via `usePanelFloatingWindowManager().open()`.
|
|
2027
2080
|
* @see usePanelFloatingWindowManager
|
|
@@ -2039,6 +2092,12 @@ interface ManagedWindowConfig {
|
|
|
2039
2092
|
width?: number;
|
|
2040
2093
|
/** Initial height in pixels. */
|
|
2041
2094
|
height?: number;
|
|
2095
|
+
/**
|
|
2096
|
+
* Which axes span the panel instead of carrying a fixed size. `width`/`height` above still apply
|
|
2097
|
+
* to any axis that isn't spanning, and are what a spanning axis returns to when released.
|
|
2098
|
+
* @see Stretch
|
|
2099
|
+
*/
|
|
2100
|
+
stretch?: Stretch;
|
|
2042
2101
|
}
|
|
2043
2102
|
/** Props for `<PanelOverlayRoot>`. */
|
|
2044
2103
|
interface PanelOverlayRootProps {
|
|
@@ -2183,16 +2242,53 @@ interface PanelFloatingWindowProps {
|
|
|
2183
2242
|
onClose(): void;
|
|
2184
2243
|
/** Corner of the panel to dock to on first render. @see FloatAnchor */
|
|
2185
2244
|
defaultAnchor: FloatAnchor;
|
|
2186
|
-
/** Initial width in pixels.
|
|
2245
|
+
/** Initial width in pixels. Ignored on an axis that starts stretched, and restored to when that
|
|
2246
|
+
* axis is later released. */
|
|
2187
2247
|
defaultWidth: number;
|
|
2188
|
-
/** Initial height in pixels.
|
|
2248
|
+
/** Initial height in pixels. Ignored on an axis that starts stretched, and restored to when that
|
|
2249
|
+
* axis is later released. */
|
|
2189
2250
|
defaultHeight: number;
|
|
2251
|
+
/**
|
|
2252
|
+
* Which axes span the panel on first render. Uncontrolled: gestures update it from here.
|
|
2253
|
+
* @see Stretch
|
|
2254
|
+
*/
|
|
2255
|
+
defaultStretch?: Stretch;
|
|
2256
|
+
/**
|
|
2257
|
+
* Controlled stretch state. When provided — **including as `null`** — the caller is the single
|
|
2258
|
+
* source of truth: gestures report through {@link PanelFloatingWindowProps.onPlacementChange}
|
|
2259
|
+
* instead of updating internally, and the caller must echo the new value back. Omit entirely
|
|
2260
|
+
* (`undefined`) for uncontrolled behaviour, matching `ToolbarToggleItem.active` and
|
|
2261
|
+
* `Sidebar.activeTabId`.
|
|
2262
|
+
*/
|
|
2263
|
+
stretch?: Stretch | null;
|
|
2264
|
+
/**
|
|
2265
|
+
* Called whenever a gesture changes where the widget sits — a stretched axis released, a
|
|
2266
|
+
* re-dock, or a detach. Reports anchor and stretch **together**, because one gesture can change
|
|
2267
|
+
* both at once and reporting them separately would surface a state that is never valid.
|
|
2268
|
+
*
|
|
2269
|
+
* This is also the only way to persist placement: the library serialises nothing about inner
|
|
2270
|
+
* widgets, so store what you receive here and feed it back via `defaultAnchor`/`stretch`.
|
|
2271
|
+
*/
|
|
2272
|
+
onPlacementChange?: (placement: PanelFloatPlacement) => void;
|
|
2273
|
+
/**
|
|
2274
|
+
* Whether this widget may span the panel at all. `false` disables resize-to-stretch snapping,
|
|
2275
|
+
* for content that only makes sense at a bounded size. Default `true`.
|
|
2276
|
+
*/
|
|
2277
|
+
stretchable?: boolean;
|
|
2190
2278
|
children?: React$1.ReactNode;
|
|
2191
2279
|
}
|
|
2192
2280
|
/**
|
|
2193
2281
|
* Declarative floating window anchored inside a `PanelOverlayRoot`.
|
|
2194
|
-
*
|
|
2195
|
-
*
|
|
2282
|
+
*
|
|
2283
|
+
* Docks to any corner, drags free of it, and drops back onto one. Windows sharing a corner stack
|
|
2284
|
+
* along the block axis with animated offsets. An axis can also **span the panel** instead of
|
|
2285
|
+
* carrying a fixed size, so the window tracks the panel as it resizes — see
|
|
2286
|
+
* {@link PanelFloatingWindowProps.defaultStretch} and {@link Stretch}.
|
|
2287
|
+
*
|
|
2288
|
+
* Resize handles follow what is actually movable: a free-floating window is pinned by nothing and
|
|
2289
|
+
* offers all eight, while a docked one offers only its free edges — plus both ends of any spanning
|
|
2290
|
+
* axis, either of which releases it.
|
|
2291
|
+
*
|
|
2196
2292
|
* @example
|
|
2197
2293
|
* const info = usePanelFloatingWindow();
|
|
2198
2294
|
* <PanelFloatingWindow
|
|
@@ -2202,6 +2298,18 @@ interface PanelFloatingWindowProps {
|
|
|
2202
2298
|
* >
|
|
2203
2299
|
* <LayerInfoContent />
|
|
2204
2300
|
* </PanelFloatingWindow>
|
|
2301
|
+
*
|
|
2302
|
+
* @example
|
|
2303
|
+
* // A full-width status strip along the bottom, tracking the panel's width.
|
|
2304
|
+
* // defaultHeight still applies; defaultWidth is what the inline axis returns to if released.
|
|
2305
|
+
* <PanelFloatingWindow
|
|
2306
|
+
* id="timeline" title="Timeline"
|
|
2307
|
+
* open onClose={close}
|
|
2308
|
+
* defaultAnchor="bottom-left" defaultStretch="width"
|
|
2309
|
+
* defaultWidth={240} defaultHeight={120}
|
|
2310
|
+
* >
|
|
2311
|
+
* <TimelineContent />
|
|
2312
|
+
* </PanelFloatingWindow>
|
|
2205
2313
|
*/
|
|
2206
2314
|
declare function PanelFloatingWindow(props: PanelFloatingWindowProps): React$1.ReactElement | null;
|
|
2207
2315
|
/** Return type of `usePanelFloatingWindow`. @see usePanelFloatingWindow */
|
|
@@ -2240,13 +2348,18 @@ interface PanelFloatingWindowManagerHandle {
|
|
|
2240
2348
|
}
|
|
2241
2349
|
/**
|
|
2242
2350
|
* Imperative hook for spawning N named floating windows at runtime from data or event handlers.
|
|
2243
|
-
* All windows share z-ordering, drag, and corner-docking infrastructure of the `PanelOverlayRoot
|
|
2351
|
+
* All windows share z-ordering, drag, and corner-docking infrastructure of the `PanelOverlayRoot`,
|
|
2352
|
+
* and accept the same placement options — including {@link ManagedWindowConfig.stretch} to span an
|
|
2353
|
+
* axis of the panel.
|
|
2244
2354
|
*
|
|
2245
2355
|
* Must be called inside a **descendant** of `PanelOverlayRoot`, not in the component that renders the root.
|
|
2246
2356
|
* @returns A stable `PanelFloatingWindowManagerHandle`.
|
|
2247
2357
|
* @example
|
|
2248
2358
|
* const manager = usePanelFloatingWindowManager();
|
|
2249
2359
|
* manager.open('feature-42', { title: 'Feature 42', content: <FeatureDetail id={42} />, anchor: 'top-right' });
|
|
2360
|
+
*
|
|
2361
|
+
* // A full-width strip along the bottom edge:
|
|
2362
|
+
* manager.open('timeline', { title: 'Timeline', content: <Timeline />, anchor: 'bottom-left', stretch: 'width', height: 120 });
|
|
2250
2363
|
*/
|
|
2251
2364
|
declare function usePanelFloatingWindowManager(): PanelFloatingWindowManagerHandle;
|
|
2252
2365
|
|
|
@@ -2420,4 +2533,4 @@ declare function computeResizedRect(dir: ResizeDir, dx: number, dy: number, star
|
|
|
2420
2533
|
*/
|
|
2421
2534
|
declare function useColorScheme(): 'dark' | 'light';
|
|
2422
2535
|
|
|
2423
|
-
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 OpenPanelOptions, 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, SecondarySidebar, type SecondarySidebarProps, type SerializedLayout, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarHeaderAction, type SidebarHeaderActionButton, type SidebarHeaderActionCustom, 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, isSerializable, 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 };
|
|
2536
|
+
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 OpenPanelOptions, type PanelActions, type PanelContribution, PanelContributionProvider, type PanelDefinition, type PanelFloatPlacement, 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, SecondarySidebar, type SecondarySidebarProps, type SerializedLayout, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarHeaderAction, type SidebarHeaderActionButton, type SidebarHeaderActionCustom, type SidebarProps, type SidebarTab, type SidebarTabContextValue, type SplitDirection, type SplitOrientation, type Stretch, 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, isSerializable, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -150,6 +150,10 @@ interface WorkspaceClientConfig {
|
|
|
150
150
|
/**
|
|
151
151
|
* Serialised layout produced by a previous saveLayout() call.
|
|
152
152
|
* Pass null or omit to start with an empty canvas.
|
|
153
|
+
*
|
|
154
|
+
* Parsed synchronously before the first render. The restored `activePanelId` is the one the
|
|
155
|
+
* snapshot recorded, or — for layouts saved before that was persisted — the selected tab of
|
|
156
|
+
* the first leaf in the grid.
|
|
153
157
|
*/
|
|
154
158
|
initialState?: string | null;
|
|
155
159
|
/** Custom i18n formatter for all internal strings. */
|
|
@@ -641,7 +645,15 @@ interface WindowState {
|
|
|
641
645
|
panels: Record<string, PanelInfo>;
|
|
642
646
|
/** The ID of the panel tab currently being dragged. */
|
|
643
647
|
draggedPanelId: string | null;
|
|
644
|
-
/**
|
|
648
|
+
/**
|
|
649
|
+
* The ID of the active/focused panel — the one contributions are read from
|
|
650
|
+
* (see `useActivePanelContribution`) and the one drawn with focused chrome.
|
|
651
|
+
*
|
|
652
|
+
* Always a panel the user can actually see: the selected tab of its leaf, or a floating
|
|
653
|
+
* window. Never a minimized panel, except when an app explicitly calls `focusPanel()` on
|
|
654
|
+
* one. Restored layouts resolve it from the saved snapshot's own `activePanelId`, falling
|
|
655
|
+
* back to the first leaf's selected tab — never to an arbitrary entry in `panels`.
|
|
656
|
+
*/
|
|
645
657
|
activePanelId: string | null;
|
|
646
658
|
/** Current layout direction ('ltr' or 'rtl') */
|
|
647
659
|
dir: 'ltr' | 'rtl';
|
|
@@ -793,7 +805,8 @@ interface WindowActions {
|
|
|
793
805
|
findPanelId: (component: string, dedupeKey: string) => string | null;
|
|
794
806
|
/**
|
|
795
807
|
* Serializes the entire workspace state to a JSON string.
|
|
796
|
-
* Includes grid layout, floating window positions, minimized panels,
|
|
808
|
+
* Includes grid layout, floating window positions, minimized panels, panel metadata, and the
|
|
809
|
+
* globally active panel (see {@link SerializedLayout.activePanelId}).
|
|
797
810
|
* @returns JSON string suitable for storage and later restoration via {@link loadLayout}.
|
|
798
811
|
* @example
|
|
799
812
|
* ```ts
|
|
@@ -804,6 +817,12 @@ interface WindowActions {
|
|
|
804
817
|
/**
|
|
805
818
|
* Restores a previously serialized workspace from a JSON string.
|
|
806
819
|
* Replaces the entire current layout — all panels not in the snapshot are closed.
|
|
820
|
+
*
|
|
821
|
+
* `state.activePanelId` is resolved from the snapshot's own `activePanelId` when that panel is
|
|
822
|
+
* still visible in it, and otherwise from the first leaf's selected tab (which is also the path
|
|
823
|
+
* layouts saved before that field existed take). It is never seeded from an arbitrary entry in
|
|
824
|
+
* `panels`.
|
|
825
|
+
*
|
|
807
826
|
* @param layoutJson - JSON string produced by {@link saveLayout}.
|
|
808
827
|
* @returns `true` if the layout was successfully parsed and applied, `false` otherwise.
|
|
809
828
|
*/
|
|
@@ -948,6 +967,18 @@ declare const useRegistry: () => PanelRegistryClass;
|
|
|
948
967
|
interface SerializedLayout {
|
|
949
968
|
/** Schema version — absent on layouts saved before this field was introduced (treated as 0). */
|
|
950
969
|
version?: number;
|
|
970
|
+
/**
|
|
971
|
+
* The globally active panel at save time — the one the user was actually looking at.
|
|
972
|
+
*
|
|
973
|
+
* Omitted when nothing was active, and when the active panel didn't survive this snapshot's
|
|
974
|
+
* serializability pruning (see {@link WindowActions.saveLayout}) — so it never names a panel
|
|
975
|
+
* absent from this payload's own `panels`. Absent on every layout saved before this field
|
|
976
|
+
* existed, in which case the restore derives it from `gridRoot`'s own per-leaf selection
|
|
977
|
+
* instead; a present-but-no-longer-valid value falls back to the same derivation. `version`
|
|
978
|
+
* is deliberately not bumped for this: the field is optional and its absence is a supported,
|
|
979
|
+
* fully-handled case rather than a schema a migration has to branch on.
|
|
980
|
+
*/
|
|
981
|
+
activePanelId?: string | null;
|
|
951
982
|
gridRoot: LayoutNode;
|
|
952
983
|
floating: FloatingWindow[];
|
|
953
984
|
minimized: {
|
|
@@ -2022,6 +2053,28 @@ declare function ToastContainer({ position, maxVisible, defaultDuration, default
|
|
|
2022
2053
|
|
|
2023
2054
|
/** Edge of a panel to which a `PanelToolbar` attaches. */
|
|
2024
2055
|
type ToolbarPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
2056
|
+
/**
|
|
2057
|
+
* Which of a docked widget's axes span the host panel instead of carrying a fixed size.
|
|
2058
|
+
*
|
|
2059
|
+
* A docked widget normally pins one end of each axis and carries an explicit size. A stretched
|
|
2060
|
+
* axis pins **both** ends and carries no size at all, so the widget tracks the panel as it
|
|
2061
|
+
* resizes — with no `ResizeObserver` and no JS, because CSS already does exactly this.
|
|
2062
|
+
*
|
|
2063
|
+
* - `'width'` — spans the panel's inline axis; height still fixed. A status or timeline strip.
|
|
2064
|
+
* - `'height'` — spans the block axis; width still fixed. A full-height side column.
|
|
2065
|
+
* - `'both'` — fills the panel, the inner-widget equivalent of maximizing a floating window.
|
|
2066
|
+
*/
|
|
2067
|
+
type Stretch = 'width' | 'height' | 'both';
|
|
2068
|
+
/**
|
|
2069
|
+
* Where a docked widget sits: which corner it is anchored to, plus which axes (if any) span the
|
|
2070
|
+
* panel. Reported as a unit because a single gesture can change both at once — dropping a
|
|
2071
|
+
* full-width bottom strip onto the left edge flips the anchor *and* the stretched axis together,
|
|
2072
|
+
* and reporting those separately would expose a state that is never actually valid.
|
|
2073
|
+
*/
|
|
2074
|
+
interface PanelFloatPlacement {
|
|
2075
|
+
anchor: FloatAnchor;
|
|
2076
|
+
stretch: Stretch | null;
|
|
2077
|
+
}
|
|
2025
2078
|
/**
|
|
2026
2079
|
* Configuration for a window spawned imperatively via `usePanelFloatingWindowManager().open()`.
|
|
2027
2080
|
* @see usePanelFloatingWindowManager
|
|
@@ -2039,6 +2092,12 @@ interface ManagedWindowConfig {
|
|
|
2039
2092
|
width?: number;
|
|
2040
2093
|
/** Initial height in pixels. */
|
|
2041
2094
|
height?: number;
|
|
2095
|
+
/**
|
|
2096
|
+
* Which axes span the panel instead of carrying a fixed size. `width`/`height` above still apply
|
|
2097
|
+
* to any axis that isn't spanning, and are what a spanning axis returns to when released.
|
|
2098
|
+
* @see Stretch
|
|
2099
|
+
*/
|
|
2100
|
+
stretch?: Stretch;
|
|
2042
2101
|
}
|
|
2043
2102
|
/** Props for `<PanelOverlayRoot>`. */
|
|
2044
2103
|
interface PanelOverlayRootProps {
|
|
@@ -2183,16 +2242,53 @@ interface PanelFloatingWindowProps {
|
|
|
2183
2242
|
onClose(): void;
|
|
2184
2243
|
/** Corner of the panel to dock to on first render. @see FloatAnchor */
|
|
2185
2244
|
defaultAnchor: FloatAnchor;
|
|
2186
|
-
/** Initial width in pixels.
|
|
2245
|
+
/** Initial width in pixels. Ignored on an axis that starts stretched, and restored to when that
|
|
2246
|
+
* axis is later released. */
|
|
2187
2247
|
defaultWidth: number;
|
|
2188
|
-
/** Initial height in pixels.
|
|
2248
|
+
/** Initial height in pixels. Ignored on an axis that starts stretched, and restored to when that
|
|
2249
|
+
* axis is later released. */
|
|
2189
2250
|
defaultHeight: number;
|
|
2251
|
+
/**
|
|
2252
|
+
* Which axes span the panel on first render. Uncontrolled: gestures update it from here.
|
|
2253
|
+
* @see Stretch
|
|
2254
|
+
*/
|
|
2255
|
+
defaultStretch?: Stretch;
|
|
2256
|
+
/**
|
|
2257
|
+
* Controlled stretch state. When provided — **including as `null`** — the caller is the single
|
|
2258
|
+
* source of truth: gestures report through {@link PanelFloatingWindowProps.onPlacementChange}
|
|
2259
|
+
* instead of updating internally, and the caller must echo the new value back. Omit entirely
|
|
2260
|
+
* (`undefined`) for uncontrolled behaviour, matching `ToolbarToggleItem.active` and
|
|
2261
|
+
* `Sidebar.activeTabId`.
|
|
2262
|
+
*/
|
|
2263
|
+
stretch?: Stretch | null;
|
|
2264
|
+
/**
|
|
2265
|
+
* Called whenever a gesture changes where the widget sits — a stretched axis released, a
|
|
2266
|
+
* re-dock, or a detach. Reports anchor and stretch **together**, because one gesture can change
|
|
2267
|
+
* both at once and reporting them separately would surface a state that is never valid.
|
|
2268
|
+
*
|
|
2269
|
+
* This is also the only way to persist placement: the library serialises nothing about inner
|
|
2270
|
+
* widgets, so store what you receive here and feed it back via `defaultAnchor`/`stretch`.
|
|
2271
|
+
*/
|
|
2272
|
+
onPlacementChange?: (placement: PanelFloatPlacement) => void;
|
|
2273
|
+
/**
|
|
2274
|
+
* Whether this widget may span the panel at all. `false` disables resize-to-stretch snapping,
|
|
2275
|
+
* for content that only makes sense at a bounded size. Default `true`.
|
|
2276
|
+
*/
|
|
2277
|
+
stretchable?: boolean;
|
|
2190
2278
|
children?: React$1.ReactNode;
|
|
2191
2279
|
}
|
|
2192
2280
|
/**
|
|
2193
2281
|
* Declarative floating window anchored inside a `PanelOverlayRoot`.
|
|
2194
|
-
*
|
|
2195
|
-
*
|
|
2282
|
+
*
|
|
2283
|
+
* Docks to any corner, drags free of it, and drops back onto one. Windows sharing a corner stack
|
|
2284
|
+
* along the block axis with animated offsets. An axis can also **span the panel** instead of
|
|
2285
|
+
* carrying a fixed size, so the window tracks the panel as it resizes — see
|
|
2286
|
+
* {@link PanelFloatingWindowProps.defaultStretch} and {@link Stretch}.
|
|
2287
|
+
*
|
|
2288
|
+
* Resize handles follow what is actually movable: a free-floating window is pinned by nothing and
|
|
2289
|
+
* offers all eight, while a docked one offers only its free edges — plus both ends of any spanning
|
|
2290
|
+
* axis, either of which releases it.
|
|
2291
|
+
*
|
|
2196
2292
|
* @example
|
|
2197
2293
|
* const info = usePanelFloatingWindow();
|
|
2198
2294
|
* <PanelFloatingWindow
|
|
@@ -2202,6 +2298,18 @@ interface PanelFloatingWindowProps {
|
|
|
2202
2298
|
* >
|
|
2203
2299
|
* <LayerInfoContent />
|
|
2204
2300
|
* </PanelFloatingWindow>
|
|
2301
|
+
*
|
|
2302
|
+
* @example
|
|
2303
|
+
* // A full-width status strip along the bottom, tracking the panel's width.
|
|
2304
|
+
* // defaultHeight still applies; defaultWidth is what the inline axis returns to if released.
|
|
2305
|
+
* <PanelFloatingWindow
|
|
2306
|
+
* id="timeline" title="Timeline"
|
|
2307
|
+
* open onClose={close}
|
|
2308
|
+
* defaultAnchor="bottom-left" defaultStretch="width"
|
|
2309
|
+
* defaultWidth={240} defaultHeight={120}
|
|
2310
|
+
* >
|
|
2311
|
+
* <TimelineContent />
|
|
2312
|
+
* </PanelFloatingWindow>
|
|
2205
2313
|
*/
|
|
2206
2314
|
declare function PanelFloatingWindow(props: PanelFloatingWindowProps): React$1.ReactElement | null;
|
|
2207
2315
|
/** Return type of `usePanelFloatingWindow`. @see usePanelFloatingWindow */
|
|
@@ -2240,13 +2348,18 @@ interface PanelFloatingWindowManagerHandle {
|
|
|
2240
2348
|
}
|
|
2241
2349
|
/**
|
|
2242
2350
|
* Imperative hook for spawning N named floating windows at runtime from data or event handlers.
|
|
2243
|
-
* All windows share z-ordering, drag, and corner-docking infrastructure of the `PanelOverlayRoot
|
|
2351
|
+
* All windows share z-ordering, drag, and corner-docking infrastructure of the `PanelOverlayRoot`,
|
|
2352
|
+
* and accept the same placement options — including {@link ManagedWindowConfig.stretch} to span an
|
|
2353
|
+
* axis of the panel.
|
|
2244
2354
|
*
|
|
2245
2355
|
* Must be called inside a **descendant** of `PanelOverlayRoot`, not in the component that renders the root.
|
|
2246
2356
|
* @returns A stable `PanelFloatingWindowManagerHandle`.
|
|
2247
2357
|
* @example
|
|
2248
2358
|
* const manager = usePanelFloatingWindowManager();
|
|
2249
2359
|
* manager.open('feature-42', { title: 'Feature 42', content: <FeatureDetail id={42} />, anchor: 'top-right' });
|
|
2360
|
+
*
|
|
2361
|
+
* // A full-width strip along the bottom edge:
|
|
2362
|
+
* manager.open('timeline', { title: 'Timeline', content: <Timeline />, anchor: 'bottom-left', stretch: 'width', height: 120 });
|
|
2250
2363
|
*/
|
|
2251
2364
|
declare function usePanelFloatingWindowManager(): PanelFloatingWindowManagerHandle;
|
|
2252
2365
|
|
|
@@ -2420,4 +2533,4 @@ declare function computeResizedRect(dir: ResizeDir, dx: number, dy: number, star
|
|
|
2420
2533
|
*/
|
|
2421
2534
|
declare function useColorScheme(): 'dark' | 'light';
|
|
2422
2535
|
|
|
2423
|
-
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 OpenPanelOptions, 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, SecondarySidebar, type SecondarySidebarProps, type SerializedLayout, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarHeaderAction, type SidebarHeaderActionButton, type SidebarHeaderActionCustom, 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, isSerializable, 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 };
|
|
2536
|
+
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 OpenPanelOptions, type PanelActions, type PanelContribution, PanelContributionProvider, type PanelDefinition, type PanelFloatPlacement, 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, SecondarySidebar, type SecondarySidebarProps, type SerializedLayout, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarHeaderAction, type SidebarHeaderActionButton, type SidebarHeaderActionCustom, type SidebarProps, type SidebarTab, type SidebarTabContextValue, type SplitDirection, type SplitOrientation, type Stretch, 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, isSerializable, 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 };
|