react-dockable-desktop 7.7.4 → 7.9.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/CHANGELOG.md +114 -1
- package/README.md +6 -3
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -2
- package/dist/index.d.ts +106 -2
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +7 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -135,6 +135,31 @@ interface DropTarget {
|
|
|
135
135
|
leafId: string;
|
|
136
136
|
position: DropPosition;
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Where a user is about to move a panel, as `canDrop` sees it (7.9.0). Positions are the ones the
|
|
140
|
+
* move applies: under RTL, a drop on the zone drawn on the screen's right is `'left'`.
|
|
141
|
+
* - `group`: into a group, on one side (a new split) or `'center'` (as a tab, also between tabs);
|
|
142
|
+
* - `edge`: along a workspace edge, as a full-width or full-height strip;
|
|
143
|
+
* - `float`: into a floating window, pinned to a corner, or free (`anchor: null`, a tab dropped
|
|
144
|
+
* on nothing).
|
|
145
|
+
*/
|
|
146
|
+
type PanelDropTarget = {
|
|
147
|
+
kind: 'group';
|
|
148
|
+
leafId: string;
|
|
149
|
+
position: DropPosition;
|
|
150
|
+
} | {
|
|
151
|
+
kind: 'edge';
|
|
152
|
+
side: SplitDirection;
|
|
153
|
+
} | {
|
|
154
|
+
kind: 'float';
|
|
155
|
+
anchor: FloatAnchor | null;
|
|
156
|
+
};
|
|
157
|
+
/** The argument `canDrop` receives: which panel, of which registered kind, is going where. (7.9.0) */
|
|
158
|
+
interface PanelDrop {
|
|
159
|
+
panelId: string;
|
|
160
|
+
component: string;
|
|
161
|
+
to: PanelDropTarget;
|
|
162
|
+
}
|
|
138
163
|
/**
|
|
139
164
|
* Grid layout branch node containing nested splits and relative flex sizes.
|
|
140
165
|
*/
|
|
@@ -274,6 +299,23 @@ interface OpenPanelOptions<P extends object = Record<string, unknown>> {
|
|
|
274
299
|
* for the document at this path"). See also {@link WorkspaceActions.findPanelId}.
|
|
275
300
|
*/
|
|
276
301
|
dedupeKey?: string;
|
|
302
|
+
/**
|
|
303
|
+
* Dock the new panel beside an open, docked panel: in that panel's group (`position: 'center'`,
|
|
304
|
+
* as a tab) or in a new group split off on one side of it. `size` is the new group's share of
|
|
305
|
+
* that split, from 0.1 to 0.9 (the workspace's default split ratio when omitted). Wins over
|
|
306
|
+
* `initialTarget`. If `panel` is not docked (not open, floating or minimized), the new panel is
|
|
307
|
+
* placed as usual and a development warning says why. Applies only to a newly opened panel. (7.8.0)
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```ts
|
|
311
|
+
* ws.openPanel('legend', 'legend', { dockTo: { panel: 'chart-1', position: 'right', size: 0.25 } });
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
dockTo?: {
|
|
315
|
+
panel: string;
|
|
316
|
+
position: DropPosition;
|
|
317
|
+
size?: number;
|
|
318
|
+
};
|
|
277
319
|
}
|
|
278
320
|
/**
|
|
279
321
|
* Global window manager state tree representing grid nodes, windows, and panels.
|
|
@@ -617,6 +659,8 @@ interface InternalWindowActions extends WorkspaceActions {
|
|
|
617
659
|
getPanelContextMenuItems: (panelId: string) => ContextMenuItem[];
|
|
618
660
|
/** @internal */
|
|
619
661
|
registerContextMenuFn: (fn: (options: ShowContextMenuOptions) => void) => () => void;
|
|
662
|
+
/** @internal Whether the user may move `panelId` to `to`: its type's rules, then `canDrop`. (7.9.0) */
|
|
663
|
+
isDropAllowed: (panelId: string, to: PanelDropTarget) => boolean;
|
|
620
664
|
}
|
|
621
665
|
/** Represents custom CSS classes injected into layout parts. */
|
|
622
666
|
interface HostClasses {
|
|
@@ -691,6 +735,19 @@ interface PanelRegistryEntry {
|
|
|
691
735
|
};
|
|
692
736
|
/** Enables/disables window drag interactions. */
|
|
693
737
|
canDrag?: boolean;
|
|
738
|
+
/**
|
|
739
|
+
* `false`: the user can't make this panel floating. A tab drag can't end in a floating window
|
|
740
|
+
* (dropped on nothing or on a corner, it stays where it was), and the "Float" and taskbar
|
|
741
|
+
* "Maximize" menu items are hidden. A window the app floated itself can still be moved. The
|
|
742
|
+
* app's own `floatPanel` always works. @default true (7.9.0)
|
|
743
|
+
*/
|
|
744
|
+
canFloat?: boolean;
|
|
745
|
+
/**
|
|
746
|
+
* `false`: the user can't dock this panel. Dragging it offers no group, tab or edge targets
|
|
747
|
+
* (corners still anchor a floating window), so it stays floating. The app's own docking calls
|
|
748
|
+
* always work; give the type `initialTarget: 'floating'` so it opens floating. @default true (7.9.0)
|
|
749
|
+
*/
|
|
750
|
+
canDock?: boolean;
|
|
694
751
|
/** Enables/disables minimizing of the panel instance. */
|
|
695
752
|
canMinimize?: boolean;
|
|
696
753
|
/** Enables/disables closing actions for the tab/window. */
|
|
@@ -701,6 +758,23 @@ interface PanelRegistryEntry {
|
|
|
701
758
|
disableLivePreview?: boolean;
|
|
702
759
|
/** Custom header actions renderer, placing custom components in the window/tab titlebar. */
|
|
703
760
|
renderHeaderActions?: (panelId: string) => React.ReactNode;
|
|
761
|
+
/**
|
|
762
|
+
* Class added to each panel of this type, on its own content element (`.rdd-panel-content`),
|
|
763
|
+
* which moves with the panel between groups, windows and the taskbar preview. (7.8.0)
|
|
764
|
+
*/
|
|
765
|
+
className?: string;
|
|
766
|
+
/** Class added to the tab of each panel of this type. (7.8.0) */
|
|
767
|
+
tabClassName?: string;
|
|
768
|
+
/**
|
|
769
|
+
* `false` unmounts the panel's component while it is hidden (an unselected tab, or minimized)
|
|
770
|
+
* and mounts it afresh when it is shown, to free what a heavy, rarely shown panel holds. Its
|
|
771
|
+
* own state is lost each time; its tab, title and lifecycle continue (`onClose` is not called),
|
|
772
|
+
* and the taskbar shows a placeholder instead of a live preview. While it is unmounted, a
|
|
773
|
+
* guard it registered with `useBeforeClose` is not active (its dirty flag still is), and
|
|
774
|
+
* `saveLayout()` saves its open-time props. @default true: panels stay mounted and keep their
|
|
775
|
+
* state, as they always have. (7.8.0)
|
|
776
|
+
*/
|
|
777
|
+
keepAlive?: boolean;
|
|
704
778
|
};
|
|
705
779
|
}
|
|
706
780
|
/**
|
|
@@ -1057,6 +1131,24 @@ interface WorkspaceClientConfig {
|
|
|
1057
1131
|
* app's own modal z-index range to control stacking against it. Default: 1000.
|
|
1058
1132
|
*/
|
|
1059
1133
|
zIndexBase?: number;
|
|
1134
|
+
/**
|
|
1135
|
+
* Veto where users can move panels (7.9.0). Called for each place a dragged panel could go, and
|
|
1136
|
+
* for the built-in "Float" and "Maximize" menu items: return `false` and that target isn't
|
|
1137
|
+
* offered (its drop zone doesn't appear) and the move doesn't happen. It runs after the panel
|
|
1138
|
+
* type's own `canFloat` / `canDock`, and only for what the user does: the app's own calls
|
|
1139
|
+
* (`floatPanel`, `dockPanelToGroup`, `openPanel`) always work. Keep it fast and pure; it runs
|
|
1140
|
+
* while the pointer moves.
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
* ```ts
|
|
1144
|
+
* createWorkspace({
|
|
1145
|
+
* panels,
|
|
1146
|
+
* // Nothing but tool panels in the left group.
|
|
1147
|
+
* canDrop: ({ component, to }) => !(to.kind === 'group' && to.leafId === 'tools' && component !== 'tool'),
|
|
1148
|
+
* });
|
|
1149
|
+
* ```
|
|
1150
|
+
*/
|
|
1151
|
+
canDrop?: (drop: PanelDrop) => boolean;
|
|
1060
1152
|
}
|
|
1061
1153
|
/**
|
|
1062
1154
|
* A workspace: the layout, every action on it, the panel registry and the event bus. Create one
|
|
@@ -1677,6 +1769,12 @@ interface RddDesktopProps {
|
|
|
1677
1769
|
taskbarVisibility?: TaskbarVisibility;
|
|
1678
1770
|
/** Enables the library's own transitions/animations (tab hover, dock preview, etc.). Never affects the consumer's own page. @default true */
|
|
1679
1771
|
animations?: boolean;
|
|
1772
|
+
/**
|
|
1773
|
+
* What the workspace shows while no panel is docked: a welcome screen, a "pick a file" prompt.
|
|
1774
|
+
* It fills the empty group in place of the built-in message; the group stays a drop target, so a
|
|
1775
|
+
* floating window can still be docked into it. Floating windows still show over it. (7.8.0)
|
|
1776
|
+
*/
|
|
1777
|
+
emptyWorkspace?: React$1.ReactNode;
|
|
1680
1778
|
}
|
|
1681
1779
|
/**
|
|
1682
1780
|
* The desktop itself: the docked grid of tab groups, the floating windows, the taskbar of
|
|
@@ -2679,6 +2777,11 @@ interface PointerDragConfig<TStart> {
|
|
|
2679
2777
|
onMove: (dx: number, dy: number, start: TStart) => void;
|
|
2680
2778
|
/** Called once when the drag ends (pointerup or pointercancel). */
|
|
2681
2779
|
onEnd?: (start: TStart) => void;
|
|
2780
|
+
/**
|
|
2781
|
+
* Called instead of `onEnd` when the drag is cut short: the window loses focus, or the pointer
|
|
2782
|
+
* capture is lost (the element was removed mid-drag). Without it, `onEnd` is called. (7.9.0)
|
|
2783
|
+
*/
|
|
2784
|
+
onCancel?: (start: TStart) => void;
|
|
2682
2785
|
/** Classes toggled on the given elements for the duration of the drag. */
|
|
2683
2786
|
activeClasses?: Array<{
|
|
2684
2787
|
el: HTMLElement;
|
|
@@ -2688,7 +2791,8 @@ interface PointerDragConfig<TStart> {
|
|
|
2688
2791
|
/**
|
|
2689
2792
|
* Starts a pointer-capture-based drag: captures the pointer on `element`, tracks
|
|
2690
2793
|
* movement via listeners scoped to that element's own lifetime (not `window`), and
|
|
2691
|
-
* cleans up automatically on release or cancel.
|
|
2794
|
+
* cleans up automatically on release or cancel, and (7.9.0) when the window loses focus
|
|
2795
|
+
* or the capture is lost, so a drag can never outlive its element or leave its classes behind.
|
|
2692
2796
|
*/
|
|
2693
2797
|
declare function startPointerDrag<TStart>(config: PointerDragConfig<TStart>): void;
|
|
2694
2798
|
type ResizeDir = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';
|
|
@@ -2749,4 +2853,4 @@ declare function isElementRtl(el: HTMLElement | null): boolean;
|
|
|
2749
2853
|
*/
|
|
2750
2854
|
declare function isComputedRtl(el: Element | null | undefined): boolean;
|
|
2751
2855
|
|
|
2752
|
-
export { type AlertOptions, type BuiltInEvents, type ButtonVariant, type CloseOptions, type ConfirmOptions, type ContainerType, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, type DirtyStateOptions, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWidgetsApi, type FloatingWindow, type HostClasses, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, type ManagedWidget, type MenuItemAction, type MessageDescriptor, type MessageFormatter, type MessageKey, type ModalOptions, type ModalsApi, type OpenPanelOptions, type OverlayId, type OverlayInstance, type OverlayState, type PanelContribution, type PanelDefinition, type PanelEvents, type PanelFloatPlacement, type PanelHandle, type PanelInfo, PanelRegistry, type PanelRegistryEntry, type PanelSidebarSection, type PanelState, type PanelTitle, type PanelTitleDescriptor, type PointerDragConfig, AlertForm as RddAlert, type RddAlertProps, ConfirmationForm as RddConfirm, type RddConfirmProps, RddContextMenu, type RddContextMenuProps, WindowManager as RddDesktop, type RddDesktopProps, PanelFloatingWindow as RddFloatingWidget, type RddFloatingWidgetProps, ModalStackRenderer as RddModals, PanelOverlayRoot as RddPanelOverlay, type RddPanelOverlayProps, PanelToolbar as RddPanelToolbar, type RddPanelToolbarProps, SecondarySidebar as RddSecondarySidebar, type RddSecondarySidebarProps, RddSidePanels, type RddSidePanelsProps, Sidebar as RddSidebar, type RddSidebarProps, ToastContainer as RddToasts, type RddToastsProps, Toolbar as RddToolbar, ToolbarButton as RddToolbarButton, type RddToolbarButtonProps, ToolbarCenter as RddToolbarCenter, ToolbarItem as RddToolbarItem, type RddToolbarProps, ToolbarSearchInput as RddToolbarSearch, type RddToolbarSearchProps, ToolbarSeparator as RddToolbarSeparator, ToolbarSpacer as RddToolbarSpacer, ToolbarToggle as RddToolbarToggle, type RddToolbarToggleProps, type ResizeConstraints, type ResizeDir, type ResizeRect, type ResolvedToastOptions, type SearchResult, type SerializedLayout, type ShowContextMenuOptions, type SidePanelOptions, type SidePanelsApi, type SidebarActionButton, type SidebarContextValue as SidebarContext, type SidebarCustomEntry, type SidebarHandle, type SidebarHeaderAction, type SidebarRailEntry, type SidebarTab, type SidebarTabContextValue as SidebarTabContext, type SplitDirection, type SplitOrientation, type Stretch, type TaskbarVisibility, type ToastAdapter, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, type ToolbarActionItem, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarRadioItem, type ToolbarSeparator$1 as ToolbarSeparator, type ToolbarToggleItem, type ToolbarVariant, type Workspace, type WorkspaceActions, type WorkspaceConfig, type WorkspaceState, computeResizedRect, createWorkspace, defaultPredefinedMessages as defaultMessages, formatLabel, isComputedRtl, isElementRtl, isSerializable, sidebarSectionToTab as sectionToTab, startPointerDrag, toast, useActivePanelContribution as useActiveContribution, useBeforeClose, useColorScheme, useShowContextMenu as useContextMenu, usePanelFloatingWindowManager as useFloatingWidgets, useFormatMessage, useStyleClasses as useHostClasses, useMergedSidebarTabs, useMergedToolbarItems, usePredefinedMessages as useMessages, useModals, usePanel, usePanelContextMenu, usePanelContribution, usePanelEvents, usePanelSize, useSaveState, useSidePanels, useSidebar, useSidebarTab, useToolbar, useWorkspace, useWindowManagerState as useWorkspaceState };
|
|
2856
|
+
export { type AlertOptions, type BuiltInEvents, type ButtonVariant, type CloseOptions, type ConfirmOptions, type ContainerType, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, type DirtyStateOptions, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWidgetsApi, type FloatingWindow, type HostClasses, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, type ManagedWidget, type MenuItemAction, type MessageDescriptor, type MessageFormatter, type MessageKey, type ModalOptions, type ModalsApi, type OpenPanelOptions, type OverlayId, type OverlayInstance, type OverlayState, type PanelContribution, type PanelDefinition, type PanelDrop, type PanelDropTarget, type PanelEvents, type PanelFloatPlacement, type PanelHandle, type PanelInfo, PanelRegistry, type PanelRegistryEntry, type PanelSidebarSection, type PanelState, type PanelTitle, type PanelTitleDescriptor, type PointerDragConfig, AlertForm as RddAlert, type RddAlertProps, ConfirmationForm as RddConfirm, type RddConfirmProps, RddContextMenu, type RddContextMenuProps, WindowManager as RddDesktop, type RddDesktopProps, PanelFloatingWindow as RddFloatingWidget, type RddFloatingWidgetProps, ModalStackRenderer as RddModals, PanelOverlayRoot as RddPanelOverlay, type RddPanelOverlayProps, PanelToolbar as RddPanelToolbar, type RddPanelToolbarProps, SecondarySidebar as RddSecondarySidebar, type RddSecondarySidebarProps, RddSidePanels, type RddSidePanelsProps, Sidebar as RddSidebar, type RddSidebarProps, ToastContainer as RddToasts, type RddToastsProps, Toolbar as RddToolbar, ToolbarButton as RddToolbarButton, type RddToolbarButtonProps, ToolbarCenter as RddToolbarCenter, ToolbarItem as RddToolbarItem, type RddToolbarProps, ToolbarSearchInput as RddToolbarSearch, type RddToolbarSearchProps, ToolbarSeparator as RddToolbarSeparator, ToolbarSpacer as RddToolbarSpacer, ToolbarToggle as RddToolbarToggle, type RddToolbarToggleProps, type ResizeConstraints, type ResizeDir, type ResizeRect, type ResolvedToastOptions, type SearchResult, type SerializedLayout, type ShowContextMenuOptions, type SidePanelOptions, type SidePanelsApi, type SidebarActionButton, type SidebarContextValue as SidebarContext, type SidebarCustomEntry, type SidebarHandle, type SidebarHeaderAction, type SidebarRailEntry, type SidebarTab, type SidebarTabContextValue as SidebarTabContext, type SplitDirection, type SplitOrientation, type Stretch, type TaskbarVisibility, type ToastAdapter, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, type ToolbarActionItem, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarRadioItem, type ToolbarSeparator$1 as ToolbarSeparator, type ToolbarToggleItem, type ToolbarVariant, type Workspace, type WorkspaceActions, type WorkspaceConfig, type WorkspaceState, computeResizedRect, createWorkspace, defaultPredefinedMessages as defaultMessages, formatLabel, isComputedRtl, isElementRtl, isSerializable, sidebarSectionToTab as sectionToTab, startPointerDrag, toast, useActivePanelContribution as useActiveContribution, useBeforeClose, useColorScheme, useShowContextMenu as useContextMenu, usePanelFloatingWindowManager as useFloatingWidgets, useFormatMessage, useStyleClasses as useHostClasses, useMergedSidebarTabs, useMergedToolbarItems, usePredefinedMessages as useMessages, useModals, usePanel, usePanelContextMenu, usePanelContribution, usePanelEvents, usePanelSize, useSaveState, useSidePanels, useSidebar, useSidebarTab, useToolbar, useWorkspace, useWindowManagerState as useWorkspaceState };
|
package/dist/index.d.ts
CHANGED
|
@@ -135,6 +135,31 @@ interface DropTarget {
|
|
|
135
135
|
leafId: string;
|
|
136
136
|
position: DropPosition;
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Where a user is about to move a panel, as `canDrop` sees it (7.9.0). Positions are the ones the
|
|
140
|
+
* move applies: under RTL, a drop on the zone drawn on the screen's right is `'left'`.
|
|
141
|
+
* - `group`: into a group, on one side (a new split) or `'center'` (as a tab, also between tabs);
|
|
142
|
+
* - `edge`: along a workspace edge, as a full-width or full-height strip;
|
|
143
|
+
* - `float`: into a floating window, pinned to a corner, or free (`anchor: null`, a tab dropped
|
|
144
|
+
* on nothing).
|
|
145
|
+
*/
|
|
146
|
+
type PanelDropTarget = {
|
|
147
|
+
kind: 'group';
|
|
148
|
+
leafId: string;
|
|
149
|
+
position: DropPosition;
|
|
150
|
+
} | {
|
|
151
|
+
kind: 'edge';
|
|
152
|
+
side: SplitDirection;
|
|
153
|
+
} | {
|
|
154
|
+
kind: 'float';
|
|
155
|
+
anchor: FloatAnchor | null;
|
|
156
|
+
};
|
|
157
|
+
/** The argument `canDrop` receives: which panel, of which registered kind, is going where. (7.9.0) */
|
|
158
|
+
interface PanelDrop {
|
|
159
|
+
panelId: string;
|
|
160
|
+
component: string;
|
|
161
|
+
to: PanelDropTarget;
|
|
162
|
+
}
|
|
138
163
|
/**
|
|
139
164
|
* Grid layout branch node containing nested splits and relative flex sizes.
|
|
140
165
|
*/
|
|
@@ -274,6 +299,23 @@ interface OpenPanelOptions<P extends object = Record<string, unknown>> {
|
|
|
274
299
|
* for the document at this path"). See also {@link WorkspaceActions.findPanelId}.
|
|
275
300
|
*/
|
|
276
301
|
dedupeKey?: string;
|
|
302
|
+
/**
|
|
303
|
+
* Dock the new panel beside an open, docked panel: in that panel's group (`position: 'center'`,
|
|
304
|
+
* as a tab) or in a new group split off on one side of it. `size` is the new group's share of
|
|
305
|
+
* that split, from 0.1 to 0.9 (the workspace's default split ratio when omitted). Wins over
|
|
306
|
+
* `initialTarget`. If `panel` is not docked (not open, floating or minimized), the new panel is
|
|
307
|
+
* placed as usual and a development warning says why. Applies only to a newly opened panel. (7.8.0)
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```ts
|
|
311
|
+
* ws.openPanel('legend', 'legend', { dockTo: { panel: 'chart-1', position: 'right', size: 0.25 } });
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
dockTo?: {
|
|
315
|
+
panel: string;
|
|
316
|
+
position: DropPosition;
|
|
317
|
+
size?: number;
|
|
318
|
+
};
|
|
277
319
|
}
|
|
278
320
|
/**
|
|
279
321
|
* Global window manager state tree representing grid nodes, windows, and panels.
|
|
@@ -617,6 +659,8 @@ interface InternalWindowActions extends WorkspaceActions {
|
|
|
617
659
|
getPanelContextMenuItems: (panelId: string) => ContextMenuItem[];
|
|
618
660
|
/** @internal */
|
|
619
661
|
registerContextMenuFn: (fn: (options: ShowContextMenuOptions) => void) => () => void;
|
|
662
|
+
/** @internal Whether the user may move `panelId` to `to`: its type's rules, then `canDrop`. (7.9.0) */
|
|
663
|
+
isDropAllowed: (panelId: string, to: PanelDropTarget) => boolean;
|
|
620
664
|
}
|
|
621
665
|
/** Represents custom CSS classes injected into layout parts. */
|
|
622
666
|
interface HostClasses {
|
|
@@ -691,6 +735,19 @@ interface PanelRegistryEntry {
|
|
|
691
735
|
};
|
|
692
736
|
/** Enables/disables window drag interactions. */
|
|
693
737
|
canDrag?: boolean;
|
|
738
|
+
/**
|
|
739
|
+
* `false`: the user can't make this panel floating. A tab drag can't end in a floating window
|
|
740
|
+
* (dropped on nothing or on a corner, it stays where it was), and the "Float" and taskbar
|
|
741
|
+
* "Maximize" menu items are hidden. A window the app floated itself can still be moved. The
|
|
742
|
+
* app's own `floatPanel` always works. @default true (7.9.0)
|
|
743
|
+
*/
|
|
744
|
+
canFloat?: boolean;
|
|
745
|
+
/**
|
|
746
|
+
* `false`: the user can't dock this panel. Dragging it offers no group, tab or edge targets
|
|
747
|
+
* (corners still anchor a floating window), so it stays floating. The app's own docking calls
|
|
748
|
+
* always work; give the type `initialTarget: 'floating'` so it opens floating. @default true (7.9.0)
|
|
749
|
+
*/
|
|
750
|
+
canDock?: boolean;
|
|
694
751
|
/** Enables/disables minimizing of the panel instance. */
|
|
695
752
|
canMinimize?: boolean;
|
|
696
753
|
/** Enables/disables closing actions for the tab/window. */
|
|
@@ -701,6 +758,23 @@ interface PanelRegistryEntry {
|
|
|
701
758
|
disableLivePreview?: boolean;
|
|
702
759
|
/** Custom header actions renderer, placing custom components in the window/tab titlebar. */
|
|
703
760
|
renderHeaderActions?: (panelId: string) => React.ReactNode;
|
|
761
|
+
/**
|
|
762
|
+
* Class added to each panel of this type, on its own content element (`.rdd-panel-content`),
|
|
763
|
+
* which moves with the panel between groups, windows and the taskbar preview. (7.8.0)
|
|
764
|
+
*/
|
|
765
|
+
className?: string;
|
|
766
|
+
/** Class added to the tab of each panel of this type. (7.8.0) */
|
|
767
|
+
tabClassName?: string;
|
|
768
|
+
/**
|
|
769
|
+
* `false` unmounts the panel's component while it is hidden (an unselected tab, or minimized)
|
|
770
|
+
* and mounts it afresh when it is shown, to free what a heavy, rarely shown panel holds. Its
|
|
771
|
+
* own state is lost each time; its tab, title and lifecycle continue (`onClose` is not called),
|
|
772
|
+
* and the taskbar shows a placeholder instead of a live preview. While it is unmounted, a
|
|
773
|
+
* guard it registered with `useBeforeClose` is not active (its dirty flag still is), and
|
|
774
|
+
* `saveLayout()` saves its open-time props. @default true: panels stay mounted and keep their
|
|
775
|
+
* state, as they always have. (7.8.0)
|
|
776
|
+
*/
|
|
777
|
+
keepAlive?: boolean;
|
|
704
778
|
};
|
|
705
779
|
}
|
|
706
780
|
/**
|
|
@@ -1057,6 +1131,24 @@ interface WorkspaceClientConfig {
|
|
|
1057
1131
|
* app's own modal z-index range to control stacking against it. Default: 1000.
|
|
1058
1132
|
*/
|
|
1059
1133
|
zIndexBase?: number;
|
|
1134
|
+
/**
|
|
1135
|
+
* Veto where users can move panels (7.9.0). Called for each place a dragged panel could go, and
|
|
1136
|
+
* for the built-in "Float" and "Maximize" menu items: return `false` and that target isn't
|
|
1137
|
+
* offered (its drop zone doesn't appear) and the move doesn't happen. It runs after the panel
|
|
1138
|
+
* type's own `canFloat` / `canDock`, and only for what the user does: the app's own calls
|
|
1139
|
+
* (`floatPanel`, `dockPanelToGroup`, `openPanel`) always work. Keep it fast and pure; it runs
|
|
1140
|
+
* while the pointer moves.
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
* ```ts
|
|
1144
|
+
* createWorkspace({
|
|
1145
|
+
* panels,
|
|
1146
|
+
* // Nothing but tool panels in the left group.
|
|
1147
|
+
* canDrop: ({ component, to }) => !(to.kind === 'group' && to.leafId === 'tools' && component !== 'tool'),
|
|
1148
|
+
* });
|
|
1149
|
+
* ```
|
|
1150
|
+
*/
|
|
1151
|
+
canDrop?: (drop: PanelDrop) => boolean;
|
|
1060
1152
|
}
|
|
1061
1153
|
/**
|
|
1062
1154
|
* A workspace: the layout, every action on it, the panel registry and the event bus. Create one
|
|
@@ -1677,6 +1769,12 @@ interface RddDesktopProps {
|
|
|
1677
1769
|
taskbarVisibility?: TaskbarVisibility;
|
|
1678
1770
|
/** Enables the library's own transitions/animations (tab hover, dock preview, etc.). Never affects the consumer's own page. @default true */
|
|
1679
1771
|
animations?: boolean;
|
|
1772
|
+
/**
|
|
1773
|
+
* What the workspace shows while no panel is docked: a welcome screen, a "pick a file" prompt.
|
|
1774
|
+
* It fills the empty group in place of the built-in message; the group stays a drop target, so a
|
|
1775
|
+
* floating window can still be docked into it. Floating windows still show over it. (7.8.0)
|
|
1776
|
+
*/
|
|
1777
|
+
emptyWorkspace?: React$1.ReactNode;
|
|
1680
1778
|
}
|
|
1681
1779
|
/**
|
|
1682
1780
|
* The desktop itself: the docked grid of tab groups, the floating windows, the taskbar of
|
|
@@ -2679,6 +2777,11 @@ interface PointerDragConfig<TStart> {
|
|
|
2679
2777
|
onMove: (dx: number, dy: number, start: TStart) => void;
|
|
2680
2778
|
/** Called once when the drag ends (pointerup or pointercancel). */
|
|
2681
2779
|
onEnd?: (start: TStart) => void;
|
|
2780
|
+
/**
|
|
2781
|
+
* Called instead of `onEnd` when the drag is cut short: the window loses focus, or the pointer
|
|
2782
|
+
* capture is lost (the element was removed mid-drag). Without it, `onEnd` is called. (7.9.0)
|
|
2783
|
+
*/
|
|
2784
|
+
onCancel?: (start: TStart) => void;
|
|
2682
2785
|
/** Classes toggled on the given elements for the duration of the drag. */
|
|
2683
2786
|
activeClasses?: Array<{
|
|
2684
2787
|
el: HTMLElement;
|
|
@@ -2688,7 +2791,8 @@ interface PointerDragConfig<TStart> {
|
|
|
2688
2791
|
/**
|
|
2689
2792
|
* Starts a pointer-capture-based drag: captures the pointer on `element`, tracks
|
|
2690
2793
|
* movement via listeners scoped to that element's own lifetime (not `window`), and
|
|
2691
|
-
* cleans up automatically on release or cancel.
|
|
2794
|
+
* cleans up automatically on release or cancel, and (7.9.0) when the window loses focus
|
|
2795
|
+
* or the capture is lost, so a drag can never outlive its element or leave its classes behind.
|
|
2692
2796
|
*/
|
|
2693
2797
|
declare function startPointerDrag<TStart>(config: PointerDragConfig<TStart>): void;
|
|
2694
2798
|
type ResizeDir = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';
|
|
@@ -2749,4 +2853,4 @@ declare function isElementRtl(el: HTMLElement | null): boolean;
|
|
|
2749
2853
|
*/
|
|
2750
2854
|
declare function isComputedRtl(el: Element | null | undefined): boolean;
|
|
2751
2855
|
|
|
2752
|
-
export { type AlertOptions, type BuiltInEvents, type ButtonVariant, type CloseOptions, type ConfirmOptions, type ContainerType, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, type DirtyStateOptions, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWidgetsApi, type FloatingWindow, type HostClasses, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, type ManagedWidget, type MenuItemAction, type MessageDescriptor, type MessageFormatter, type MessageKey, type ModalOptions, type ModalsApi, type OpenPanelOptions, type OverlayId, type OverlayInstance, type OverlayState, type PanelContribution, type PanelDefinition, type PanelEvents, type PanelFloatPlacement, type PanelHandle, type PanelInfo, PanelRegistry, type PanelRegistryEntry, type PanelSidebarSection, type PanelState, type PanelTitle, type PanelTitleDescriptor, type PointerDragConfig, AlertForm as RddAlert, type RddAlertProps, ConfirmationForm as RddConfirm, type RddConfirmProps, RddContextMenu, type RddContextMenuProps, WindowManager as RddDesktop, type RddDesktopProps, PanelFloatingWindow as RddFloatingWidget, type RddFloatingWidgetProps, ModalStackRenderer as RddModals, PanelOverlayRoot as RddPanelOverlay, type RddPanelOverlayProps, PanelToolbar as RddPanelToolbar, type RddPanelToolbarProps, SecondarySidebar as RddSecondarySidebar, type RddSecondarySidebarProps, RddSidePanels, type RddSidePanelsProps, Sidebar as RddSidebar, type RddSidebarProps, ToastContainer as RddToasts, type RddToastsProps, Toolbar as RddToolbar, ToolbarButton as RddToolbarButton, type RddToolbarButtonProps, ToolbarCenter as RddToolbarCenter, ToolbarItem as RddToolbarItem, type RddToolbarProps, ToolbarSearchInput as RddToolbarSearch, type RddToolbarSearchProps, ToolbarSeparator as RddToolbarSeparator, ToolbarSpacer as RddToolbarSpacer, ToolbarToggle as RddToolbarToggle, type RddToolbarToggleProps, type ResizeConstraints, type ResizeDir, type ResizeRect, type ResolvedToastOptions, type SearchResult, type SerializedLayout, type ShowContextMenuOptions, type SidePanelOptions, type SidePanelsApi, type SidebarActionButton, type SidebarContextValue as SidebarContext, type SidebarCustomEntry, type SidebarHandle, type SidebarHeaderAction, type SidebarRailEntry, type SidebarTab, type SidebarTabContextValue as SidebarTabContext, type SplitDirection, type SplitOrientation, type Stretch, type TaskbarVisibility, type ToastAdapter, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, type ToolbarActionItem, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarRadioItem, type ToolbarSeparator$1 as ToolbarSeparator, type ToolbarToggleItem, type ToolbarVariant, type Workspace, type WorkspaceActions, type WorkspaceConfig, type WorkspaceState, computeResizedRect, createWorkspace, defaultPredefinedMessages as defaultMessages, formatLabel, isComputedRtl, isElementRtl, isSerializable, sidebarSectionToTab as sectionToTab, startPointerDrag, toast, useActivePanelContribution as useActiveContribution, useBeforeClose, useColorScheme, useShowContextMenu as useContextMenu, usePanelFloatingWindowManager as useFloatingWidgets, useFormatMessage, useStyleClasses as useHostClasses, useMergedSidebarTabs, useMergedToolbarItems, usePredefinedMessages as useMessages, useModals, usePanel, usePanelContextMenu, usePanelContribution, usePanelEvents, usePanelSize, useSaveState, useSidePanels, useSidebar, useSidebarTab, useToolbar, useWorkspace, useWindowManagerState as useWorkspaceState };
|
|
2856
|
+
export { type AlertOptions, type BuiltInEvents, type ButtonVariant, type CloseOptions, type ConfirmOptions, type ContainerType, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, type DirtyStateOptions, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWidgetsApi, type FloatingWindow, type HostClasses, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, type ManagedWidget, type MenuItemAction, type MessageDescriptor, type MessageFormatter, type MessageKey, type ModalOptions, type ModalsApi, type OpenPanelOptions, type OverlayId, type OverlayInstance, type OverlayState, type PanelContribution, type PanelDefinition, type PanelDrop, type PanelDropTarget, type PanelEvents, type PanelFloatPlacement, type PanelHandle, type PanelInfo, PanelRegistry, type PanelRegistryEntry, type PanelSidebarSection, type PanelState, type PanelTitle, type PanelTitleDescriptor, type PointerDragConfig, AlertForm as RddAlert, type RddAlertProps, ConfirmationForm as RddConfirm, type RddConfirmProps, RddContextMenu, type RddContextMenuProps, WindowManager as RddDesktop, type RddDesktopProps, PanelFloatingWindow as RddFloatingWidget, type RddFloatingWidgetProps, ModalStackRenderer as RddModals, PanelOverlayRoot as RddPanelOverlay, type RddPanelOverlayProps, PanelToolbar as RddPanelToolbar, type RddPanelToolbarProps, SecondarySidebar as RddSecondarySidebar, type RddSecondarySidebarProps, RddSidePanels, type RddSidePanelsProps, Sidebar as RddSidebar, type RddSidebarProps, ToastContainer as RddToasts, type RddToastsProps, Toolbar as RddToolbar, ToolbarButton as RddToolbarButton, type RddToolbarButtonProps, ToolbarCenter as RddToolbarCenter, ToolbarItem as RddToolbarItem, type RddToolbarProps, ToolbarSearchInput as RddToolbarSearch, type RddToolbarSearchProps, ToolbarSeparator as RddToolbarSeparator, ToolbarSpacer as RddToolbarSpacer, ToolbarToggle as RddToolbarToggle, type RddToolbarToggleProps, type ResizeConstraints, type ResizeDir, type ResizeRect, type ResolvedToastOptions, type SearchResult, type SerializedLayout, type ShowContextMenuOptions, type SidePanelOptions, type SidePanelsApi, type SidebarActionButton, type SidebarContextValue as SidebarContext, type SidebarCustomEntry, type SidebarHandle, type SidebarHeaderAction, type SidebarRailEntry, type SidebarTab, type SidebarTabContextValue as SidebarTabContext, type SplitDirection, type SplitOrientation, type Stretch, type TaskbarVisibility, type ToastAdapter, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, type ToolbarActionItem, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarRadioItem, type ToolbarSeparator$1 as ToolbarSeparator, type ToolbarToggleItem, type ToolbarVariant, type Workspace, type WorkspaceActions, type WorkspaceConfig, type WorkspaceState, computeResizedRect, createWorkspace, defaultPredefinedMessages as defaultMessages, formatLabel, isComputedRtl, isElementRtl, isSerializable, sidebarSectionToTab as sectionToTab, startPointerDrag, toast, useActivePanelContribution as useActiveContribution, useBeforeClose, useColorScheme, useShowContextMenu as useContextMenu, usePanelFloatingWindowManager as useFloatingWidgets, useFormatMessage, useStyleClasses as useHostClasses, useMergedSidebarTabs, useMergedToolbarItems, usePredefinedMessages as useMessages, useModals, usePanel, usePanelContextMenu, usePanelContribution, usePanelEvents, usePanelSize, useSaveState, useSidePanels, useSidebar, useSidebarTab, useToolbar, useWorkspace, useWindowManagerState as useWorkspaceState };
|