react-dockable-desktop 7.7.3 → 7.8.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.cts CHANGED
@@ -140,7 +140,7 @@ interface DropTarget {
140
140
  */
141
141
  interface LayoutGridNode {
142
142
  type: 'branch';
143
- /** Split orientation orientation indicator. */
143
+ /** Split orientation: `horizontal` places the children side by side, `vertical` stacks them. */
144
144
  orientation: SplitOrientation;
145
145
  /** Children branches or leaf panels. */
146
146
  children: LayoutNode[];
@@ -274,6 +274,23 @@ interface OpenPanelOptions<P extends object = Record<string, unknown>> {
274
274
  * for the document at this path"). See also {@link WorkspaceActions.findPanelId}.
275
275
  */
276
276
  dedupeKey?: string;
277
+ /**
278
+ * Dock the new panel beside an open, docked panel: in that panel's group (`position: 'center'`,
279
+ * as a tab) or in a new group split off on one side of it. `size` is the new group's share of
280
+ * that split, from 0.1 to 0.9 (the workspace's default split ratio when omitted). Wins over
281
+ * `initialTarget`. If `panel` is not docked (not open, floating or minimized), the new panel is
282
+ * placed as usual and a development warning says why. Applies only to a newly opened panel. (7.8.0)
283
+ *
284
+ * @example
285
+ * ```ts
286
+ * ws.openPanel('legend', 'legend', { dockTo: { panel: 'chart-1', position: 'right', size: 0.25 } });
287
+ * ```
288
+ */
289
+ dockTo?: {
290
+ panel: string;
291
+ position: DropPosition;
292
+ size?: number;
293
+ };
277
294
  }
278
295
  /**
279
296
  * Global window manager state tree representing grid nodes, windows, and panels.
@@ -358,7 +375,7 @@ interface WorkspaceActions {
358
375
  openPanel: <P extends object = Record<string, unknown>>(id: string, component: string, options?: OpenPanelOptions<P>) => void;
359
376
  /**
360
377
  * Closes a panel immediately, bypassing dirty-state close guards.
361
- * For guarded close, use {@link requestClosePanel}.
378
+ * For guarded close, use {@link WorkspaceActions.requestClosePanel}.
362
379
  * @param id - Panel instance ID.
363
380
  */
364
381
  closePanel: (id: string) => void;
@@ -456,7 +473,7 @@ interface WorkspaceActions {
456
473
  * Serializes the entire workspace state to a JSON string.
457
474
  * Includes grid layout, floating window positions, minimized panels, panel metadata, and the
458
475
  * globally active panel (see {@link SerializedLayout.activePanelId}).
459
- * @returns JSON string suitable for storage and later restoration via {@link loadLayout}.
476
+ * @returns JSON string suitable for storage and later restoration via {@link WorkspaceActions.loadLayout}.
460
477
  * @example
461
478
  * ```ts
462
479
  * localStorage.setItem('layout', actions.saveLayout());
@@ -472,7 +489,7 @@ interface WorkspaceActions {
472
489
  * layouts saved before that field existed take). It is never seeded from an arbitrary entry in
473
490
  * `panels`.
474
491
  *
475
- * @param layoutJson - JSON string produced by {@link saveLayout}.
492
+ * @param layoutJson - JSON string produced by {@link WorkspaceActions.saveLayout}.
476
493
  * @returns `true` if the layout was successfully parsed and applied, `false` otherwise.
477
494
  */
478
495
  loadLayout: (layoutJson: string) => boolean;
@@ -701,6 +718,22 @@ interface PanelRegistryEntry {
701
718
  disableLivePreview?: boolean;
702
719
  /** Custom header actions renderer, placing custom components in the window/tab titlebar. */
703
720
  renderHeaderActions?: (panelId: string) => React.ReactNode;
721
+ /**
722
+ * Class added to each panel of this type, on its own content element (`.rdd-panel-content`),
723
+ * which moves with the panel between groups, windows and the taskbar preview. (7.8.0)
724
+ */
725
+ className?: string;
726
+ /** Class added to the tab of each panel of this type. (7.8.0) */
727
+ tabClassName?: string;
728
+ /**
729
+ * `false` unmounts the panel's component while it is hidden (an unselected tab, or minimized)
730
+ * and mounts it afresh when it is shown, to free what a heavy, rarely shown panel holds. Its
731
+ * own state is lost each time; its tab, title and lifecycle continue (`onClose` is not called),
732
+ * and the taskbar shows a placeholder instead of a live preview. While it is unmounted,
733
+ * `saveLayout()` saves its open-time props. @default true: panels stay mounted and keep their
734
+ * state, as they always have. (7.8.0)
735
+ */
736
+ keepAlive?: boolean;
704
737
  };
705
738
  }
706
739
  /**
@@ -1677,6 +1710,12 @@ interface RddDesktopProps {
1677
1710
  taskbarVisibility?: TaskbarVisibility;
1678
1711
  /** Enables the library's own transitions/animations (tab hover, dock preview, etc.). Never affects the consumer's own page. @default true */
1679
1712
  animations?: boolean;
1713
+ /**
1714
+ * What the workspace shows while no panel is docked: a welcome screen, a "pick a file" prompt.
1715
+ * It fills the empty group in place of the built-in message; the group stays a drop target, so a
1716
+ * floating window can still be docked into it. Floating windows still show over it. (7.8.0)
1717
+ */
1718
+ emptyWorkspace?: React$1.ReactNode;
1680
1719
  }
1681
1720
  /**
1682
1721
  * The desktop itself: the docked grid of tab groups, the floating windows, the taskbar of
@@ -1933,14 +1972,14 @@ declare const SecondarySidebar: React$1.ForwardRefExoticComponent<RddSecondarySi
1933
1972
  * Returns sidebar control functions from anywhere inside a `<RddSidebar>` tree,
1934
1973
  * including floating panels rendered via `{children}`.
1935
1974
  *
1936
- * @throws Error if used outside of a {@link Sidebar}.
1975
+ * @throws Error if used outside of an {@link RddSidebar}.
1937
1976
  */
1938
1977
  declare function useSidebar(): SidebarContextValue;
1939
1978
  /**
1940
1979
  * Returns tab-specific control functions for components rendered inside a
1941
1980
  * sidebar tab's `renderContent` tree.
1942
1981
  *
1943
- * @throws Error if used outside of a {@link Sidebar} tab's `renderContent` tree.
1982
+ * @throws Error if used outside of an {@link RddSidebar} tab's `renderContent` tree.
1944
1983
  */
1945
1984
  declare function useSidebarTab(): SidebarTabContextValue;
1946
1985
 
package/dist/index.d.ts CHANGED
@@ -140,7 +140,7 @@ interface DropTarget {
140
140
  */
141
141
  interface LayoutGridNode {
142
142
  type: 'branch';
143
- /** Split orientation orientation indicator. */
143
+ /** Split orientation: `horizontal` places the children side by side, `vertical` stacks them. */
144
144
  orientation: SplitOrientation;
145
145
  /** Children branches or leaf panels. */
146
146
  children: LayoutNode[];
@@ -274,6 +274,23 @@ interface OpenPanelOptions<P extends object = Record<string, unknown>> {
274
274
  * for the document at this path"). See also {@link WorkspaceActions.findPanelId}.
275
275
  */
276
276
  dedupeKey?: string;
277
+ /**
278
+ * Dock the new panel beside an open, docked panel: in that panel's group (`position: 'center'`,
279
+ * as a tab) or in a new group split off on one side of it. `size` is the new group's share of
280
+ * that split, from 0.1 to 0.9 (the workspace's default split ratio when omitted). Wins over
281
+ * `initialTarget`. If `panel` is not docked (not open, floating or minimized), the new panel is
282
+ * placed as usual and a development warning says why. Applies only to a newly opened panel. (7.8.0)
283
+ *
284
+ * @example
285
+ * ```ts
286
+ * ws.openPanel('legend', 'legend', { dockTo: { panel: 'chart-1', position: 'right', size: 0.25 } });
287
+ * ```
288
+ */
289
+ dockTo?: {
290
+ panel: string;
291
+ position: DropPosition;
292
+ size?: number;
293
+ };
277
294
  }
278
295
  /**
279
296
  * Global window manager state tree representing grid nodes, windows, and panels.
@@ -358,7 +375,7 @@ interface WorkspaceActions {
358
375
  openPanel: <P extends object = Record<string, unknown>>(id: string, component: string, options?: OpenPanelOptions<P>) => void;
359
376
  /**
360
377
  * Closes a panel immediately, bypassing dirty-state close guards.
361
- * For guarded close, use {@link requestClosePanel}.
378
+ * For guarded close, use {@link WorkspaceActions.requestClosePanel}.
362
379
  * @param id - Panel instance ID.
363
380
  */
364
381
  closePanel: (id: string) => void;
@@ -456,7 +473,7 @@ interface WorkspaceActions {
456
473
  * Serializes the entire workspace state to a JSON string.
457
474
  * Includes grid layout, floating window positions, minimized panels, panel metadata, and the
458
475
  * globally active panel (see {@link SerializedLayout.activePanelId}).
459
- * @returns JSON string suitable for storage and later restoration via {@link loadLayout}.
476
+ * @returns JSON string suitable for storage and later restoration via {@link WorkspaceActions.loadLayout}.
460
477
  * @example
461
478
  * ```ts
462
479
  * localStorage.setItem('layout', actions.saveLayout());
@@ -472,7 +489,7 @@ interface WorkspaceActions {
472
489
  * layouts saved before that field existed take). It is never seeded from an arbitrary entry in
473
490
  * `panels`.
474
491
  *
475
- * @param layoutJson - JSON string produced by {@link saveLayout}.
492
+ * @param layoutJson - JSON string produced by {@link WorkspaceActions.saveLayout}.
476
493
  * @returns `true` if the layout was successfully parsed and applied, `false` otherwise.
477
494
  */
478
495
  loadLayout: (layoutJson: string) => boolean;
@@ -701,6 +718,22 @@ interface PanelRegistryEntry {
701
718
  disableLivePreview?: boolean;
702
719
  /** Custom header actions renderer, placing custom components in the window/tab titlebar. */
703
720
  renderHeaderActions?: (panelId: string) => React.ReactNode;
721
+ /**
722
+ * Class added to each panel of this type, on its own content element (`.rdd-panel-content`),
723
+ * which moves with the panel between groups, windows and the taskbar preview. (7.8.0)
724
+ */
725
+ className?: string;
726
+ /** Class added to the tab of each panel of this type. (7.8.0) */
727
+ tabClassName?: string;
728
+ /**
729
+ * `false` unmounts the panel's component while it is hidden (an unselected tab, or minimized)
730
+ * and mounts it afresh when it is shown, to free what a heavy, rarely shown panel holds. Its
731
+ * own state is lost each time; its tab, title and lifecycle continue (`onClose` is not called),
732
+ * and the taskbar shows a placeholder instead of a live preview. While it is unmounted,
733
+ * `saveLayout()` saves its open-time props. @default true: panels stay mounted and keep their
734
+ * state, as they always have. (7.8.0)
735
+ */
736
+ keepAlive?: boolean;
704
737
  };
705
738
  }
706
739
  /**
@@ -1677,6 +1710,12 @@ interface RddDesktopProps {
1677
1710
  taskbarVisibility?: TaskbarVisibility;
1678
1711
  /** Enables the library's own transitions/animations (tab hover, dock preview, etc.). Never affects the consumer's own page. @default true */
1679
1712
  animations?: boolean;
1713
+ /**
1714
+ * What the workspace shows while no panel is docked: a welcome screen, a "pick a file" prompt.
1715
+ * It fills the empty group in place of the built-in message; the group stays a drop target, so a
1716
+ * floating window can still be docked into it. Floating windows still show over it. (7.8.0)
1717
+ */
1718
+ emptyWorkspace?: React$1.ReactNode;
1680
1719
  }
1681
1720
  /**
1682
1721
  * The desktop itself: the docked grid of tab groups, the floating windows, the taskbar of
@@ -1933,14 +1972,14 @@ declare const SecondarySidebar: React$1.ForwardRefExoticComponent<RddSecondarySi
1933
1972
  * Returns sidebar control functions from anywhere inside a `<RddSidebar>` tree,
1934
1973
  * including floating panels rendered via `{children}`.
1935
1974
  *
1936
- * @throws Error if used outside of a {@link Sidebar}.
1975
+ * @throws Error if used outside of an {@link RddSidebar}.
1937
1976
  */
1938
1977
  declare function useSidebar(): SidebarContextValue;
1939
1978
  /**
1940
1979
  * Returns tab-specific control functions for components rendered inside a
1941
1980
  * sidebar tab's `renderContent` tree.
1942
1981
  *
1943
- * @throws Error if used outside of a {@link Sidebar} tab's `renderContent` tree.
1982
+ * @throws Error if used outside of an {@link RddSidebar} tab's `renderContent` tree.
1944
1983
  */
1945
1984
  declare function useSidebarTab(): SidebarTabContextValue;
1946
1985