react-dockable-desktop 7.5.0 → 7.6.1
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 +87 -1
- package/README.md +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +289 -236
- package/dist/index.d.ts +289 -236
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +13 -0
- package/package.json +5 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,179 +1,5 @@
|
|
|
1
1
|
import React$1, { ComponentType, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @file predefinedMessages.ts
|
|
5
|
-
* @description Provides the default localizable message catalogs and translation keys
|
|
6
|
-
* utilized by Dockable Desktop's context menus, headers, and tooltips.
|
|
7
|
-
*
|
|
8
|
-
* Each value's `id` is the react-intl message ID that the consumer should
|
|
9
|
-
* define in their IntlProvider messages table. The `defaultMessage` is used
|
|
10
|
-
* as a fallback when no external formatter is provided.
|
|
11
|
-
*
|
|
12
|
-
* Pass a partial or full override as `createWorkspace({ messages })` or
|
|
13
|
-
* `<DockableDesktopProvider messages={…}>` to customise labels without replacing the whole table.
|
|
14
|
-
*/
|
|
15
|
-
declare const defaultPredefinedMessages: {
|
|
16
|
-
readonly floatWindow: {
|
|
17
|
-
readonly id: "dockable-desktop-floatWindow";
|
|
18
|
-
readonly defaultMessage: "Float Window";
|
|
19
|
-
};
|
|
20
|
-
readonly minimizePanel: {
|
|
21
|
-
readonly id: "dockable-desktop-minimizePanel";
|
|
22
|
-
readonly defaultMessage: "Minimize Panel";
|
|
23
|
-
};
|
|
24
|
-
readonly closeTab: {
|
|
25
|
-
readonly id: "dockable-desktop-closeTab";
|
|
26
|
-
readonly defaultMessage: "Close Tab";
|
|
27
|
-
};
|
|
28
|
-
readonly restorePanel: {
|
|
29
|
-
readonly id: "dockable-desktop-restorePanel";
|
|
30
|
-
readonly defaultMessage: "Restore Panel";
|
|
31
|
-
};
|
|
32
|
-
readonly maximizePanel: {
|
|
33
|
-
readonly id: "dockable-desktop-maximizePanel";
|
|
34
|
-
readonly defaultMessage: "Maximize Panel";
|
|
35
|
-
};
|
|
36
|
-
readonly closePanel: {
|
|
37
|
-
readonly id: "dockable-desktop-closePanel";
|
|
38
|
-
readonly defaultMessage: "Close Panel";
|
|
39
|
-
};
|
|
40
|
-
readonly dockWindow: {
|
|
41
|
-
readonly id: "dockable-desktop-dockWindow";
|
|
42
|
-
readonly defaultMessage: "Dock Window";
|
|
43
|
-
};
|
|
44
|
-
readonly minimize: {
|
|
45
|
-
readonly id: "dockable-desktop-minimize";
|
|
46
|
-
readonly defaultMessage: "Minimize";
|
|
47
|
-
};
|
|
48
|
-
readonly maximize: {
|
|
49
|
-
readonly id: "dockable-desktop-maximize";
|
|
50
|
-
readonly defaultMessage: "Maximize";
|
|
51
|
-
};
|
|
52
|
-
readonly restoreSize: {
|
|
53
|
-
readonly id: "dockable-desktop-restoreSize";
|
|
54
|
-
readonly defaultMessage: "Restore Size";
|
|
55
|
-
};
|
|
56
|
-
readonly close: {
|
|
57
|
-
readonly id: "dockable-desktop-close";
|
|
58
|
-
readonly defaultMessage: "Close";
|
|
59
|
-
};
|
|
60
|
-
readonly closeEmptyGroup: {
|
|
61
|
-
readonly id: "dockable-desktop-closeEmptyGroup";
|
|
62
|
-
readonly defaultMessage: "Close empty split group";
|
|
63
|
-
};
|
|
64
|
-
readonly unsavedChangesTitle: {
|
|
65
|
-
readonly id: "dockable-desktop-unsavedChangesTitle";
|
|
66
|
-
readonly defaultMessage: "Unsaved Changes";
|
|
67
|
-
};
|
|
68
|
-
readonly unsavedChangesMessage: {
|
|
69
|
-
readonly id: "dockable-desktop-unsavedChangesMessage";
|
|
70
|
-
readonly defaultMessage: "\"{title}\" has unsaved changes. Do you want to discard your changes and close?";
|
|
71
|
-
};
|
|
72
|
-
readonly discardChanges: {
|
|
73
|
-
readonly id: "dockable-desktop-discardChanges";
|
|
74
|
-
readonly defaultMessage: "Discard Changes";
|
|
75
|
-
};
|
|
76
|
-
readonly cancel: {
|
|
77
|
-
readonly id: "dockable-desktop-cancel";
|
|
78
|
-
readonly defaultMessage: "Cancel";
|
|
79
|
-
};
|
|
80
|
-
readonly yes: {
|
|
81
|
-
readonly id: "dockable-desktop-yes";
|
|
82
|
-
readonly defaultMessage: "Yes";
|
|
83
|
-
};
|
|
84
|
-
readonly no: {
|
|
85
|
-
readonly id: "dockable-desktop-no";
|
|
86
|
-
readonly defaultMessage: "No";
|
|
87
|
-
};
|
|
88
|
-
readonly ok: {
|
|
89
|
-
readonly id: "dockable-desktop-ok";
|
|
90
|
-
readonly defaultMessage: "OK";
|
|
91
|
-
};
|
|
92
|
-
readonly closePanelTooltip: {
|
|
93
|
-
readonly id: "dockable-desktop-closePanelTooltip";
|
|
94
|
-
readonly defaultMessage: "Close panel";
|
|
95
|
-
};
|
|
96
|
-
readonly closeTooltip: {
|
|
97
|
-
readonly id: "dockable-desktop-closeTooltip";
|
|
98
|
-
readonly defaultMessage: "Close";
|
|
99
|
-
};
|
|
100
|
-
readonly notifications: {
|
|
101
|
-
readonly id: "dockable-desktop-notifications";
|
|
102
|
-
readonly defaultMessage: "Notifications";
|
|
103
|
-
};
|
|
104
|
-
readonly closeNotification: {
|
|
105
|
-
readonly id: "dockable-desktop-closeNotification";
|
|
106
|
-
readonly defaultMessage: "Close notification";
|
|
107
|
-
};
|
|
108
|
-
readonly scrollTabsLeft: {
|
|
109
|
-
readonly id: "dockable-desktop-scrollTabsLeft";
|
|
110
|
-
readonly defaultMessage: "Scroll tabs left";
|
|
111
|
-
};
|
|
112
|
-
readonly scrollTabsRight: {
|
|
113
|
-
readonly id: "dockable-desktop-scrollTabsRight";
|
|
114
|
-
readonly defaultMessage: "Scroll tabs right";
|
|
115
|
-
};
|
|
116
|
-
readonly scrollTaskbarLeft: {
|
|
117
|
-
readonly id: "dockable-desktop-scrollTaskbarLeft";
|
|
118
|
-
readonly defaultMessage: "Scroll taskbar left";
|
|
119
|
-
};
|
|
120
|
-
readonly scrollTaskbarRight: {
|
|
121
|
-
readonly id: "dockable-desktop-scrollTaskbarRight";
|
|
122
|
-
readonly defaultMessage: "Scroll taskbar right";
|
|
123
|
-
};
|
|
124
|
-
readonly moreActions: {
|
|
125
|
-
readonly id: "dockable-desktop-moreActions";
|
|
126
|
-
readonly defaultMessage: "More actions";
|
|
127
|
-
};
|
|
128
|
-
readonly search: {
|
|
129
|
-
readonly id: "dockable-desktop-search";
|
|
130
|
-
readonly defaultMessage: "Search";
|
|
131
|
-
};
|
|
132
|
-
readonly closeSearch: {
|
|
133
|
-
readonly id: "dockable-desktop-closeSearch";
|
|
134
|
-
readonly defaultMessage: "Close search";
|
|
135
|
-
};
|
|
136
|
-
readonly searchPlaceholder: {
|
|
137
|
-
readonly id: "dockable-desktop-searchPlaceholder";
|
|
138
|
-
readonly defaultMessage: "Search…";
|
|
139
|
-
};
|
|
140
|
-
readonly modalTitle: {
|
|
141
|
-
readonly id: "dockable-desktop-modalTitle";
|
|
142
|
-
readonly defaultMessage: "Confirmation";
|
|
143
|
-
};
|
|
144
|
-
readonly emptyGroup: {
|
|
145
|
-
readonly id: "dockable-desktop-emptyGroup";
|
|
146
|
-
readonly defaultMessage: "Empty Workspace Section";
|
|
147
|
-
};
|
|
148
|
-
readonly emptyGrid: {
|
|
149
|
-
readonly id: "dockable-desktop-emptyGrid";
|
|
150
|
-
readonly defaultMessage: "Grid Empty";
|
|
151
|
-
};
|
|
152
|
-
readonly componentUnregistered: {
|
|
153
|
-
readonly id: "dockable-desktop-componentUnregistered";
|
|
154
|
-
readonly defaultMessage: "Component Unregistered";
|
|
155
|
-
};
|
|
156
|
-
readonly componentKey: {
|
|
157
|
-
readonly id: "dockable-desktop-componentKey";
|
|
158
|
-
readonly defaultMessage: "Key: {key}";
|
|
159
|
-
};
|
|
160
|
-
readonly untitledPanel: {
|
|
161
|
-
readonly id: "dockable-desktop-untitledPanel";
|
|
162
|
-
readonly defaultMessage: "Panel";
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Union of every key in `defaultMessages`.
|
|
167
|
-
*
|
|
168
|
-
* Import this type in your i18n message tables to get a compile-time
|
|
169
|
-
* guarantee that all keys are present and no typos exist:
|
|
170
|
-
*
|
|
171
|
-
* import type { MessageKey } from 'react-dockable-desktop';
|
|
172
|
-
*
|
|
173
|
-
* const myMessages: Record<MessageKey, string> = { ... };
|
|
174
|
-
*/
|
|
175
|
-
type MessageKey = keyof typeof defaultPredefinedMessages;
|
|
176
|
-
|
|
177
3
|
/**
|
|
178
4
|
* @file dirtyOptions.ts
|
|
179
5
|
* @description Type definitions for customizing automatic close warning overlays.
|
|
@@ -251,6 +77,15 @@ interface ShowContextMenuOptions {
|
|
|
251
77
|
* opened without an event. The menu is portaled to `<body>`, so it can't inherit either.
|
|
252
78
|
*/
|
|
253
79
|
dir?: 'ltr' | 'rtl';
|
|
80
|
+
/**
|
|
81
|
+
* Where focus goes when the menu opens. `'menu'` (the default) focuses the menu itself, with no
|
|
82
|
+
* item highlighted: ArrowDown then reaches the first item and ArrowUp the last. `'first-item'`
|
|
83
|
+
* focuses the first enabled item, for a menu opened from the keyboard. When this is left out, a
|
|
84
|
+
* keyboard `contextmenu` event (the ContextMenu key or Shift+F10, which report no pointer
|
|
85
|
+
* position) opens on the first item and everything else, including a call with no event, on
|
|
86
|
+
* the menu: the same view every time, whatever the user did before.
|
|
87
|
+
*/
|
|
88
|
+
initialFocus?: 'menu' | 'first-item';
|
|
254
89
|
}
|
|
255
90
|
interface ContextMenuHandle {
|
|
256
91
|
show(options: ShowContextMenuOptions): void;
|
|
@@ -270,6 +105,12 @@ interface ContextMenuAdapter {
|
|
|
270
105
|
}
|
|
271
106
|
declare function useShowContextMenu(): (options: ShowContextMenuOptions) => void;
|
|
272
107
|
|
|
108
|
+
/**
|
|
109
|
+
* @file types.ts
|
|
110
|
+
* @description The workspace's data types: messages, the layout tree, floating windows, panels,
|
|
111
|
+
* the state snapshot, the actions, the serialized layout and the store's configuration.
|
|
112
|
+
*/
|
|
113
|
+
|
|
273
114
|
/**
|
|
274
115
|
* Structure representing localizable message descriptors used in context menus.
|
|
275
116
|
*/
|
|
@@ -786,8 +627,6 @@ interface HostClasses {
|
|
|
786
627
|
windowClass?: string;
|
|
787
628
|
windowBodyClass?: string;
|
|
788
629
|
}
|
|
789
|
-
/** Custom hook to read configured style class contexts. */
|
|
790
|
-
declare const useStyleClasses: () => HostClasses;
|
|
791
630
|
/** The on-disk shape produced by `saveLayout()` and accepted by `loadLayout()`/`initialState`. */
|
|
792
631
|
interface SerializedLayout {
|
|
793
632
|
/** Schema version — absent on layouts saved before this field was introduced (treated as 0). */
|
|
@@ -824,64 +663,6 @@ interface WorkspaceCore {
|
|
|
824
663
|
zIndexBase?: number;
|
|
825
664
|
}) => void;
|
|
826
665
|
}
|
|
827
|
-
/**
|
|
828
|
-
* The live workspace state. The component re-renders whenever it changes — or, given a selector,
|
|
829
|
-
* only when the selected value changes.
|
|
830
|
-
*
|
|
831
|
-
* For reads without a subscription, call the workspace's `isOpen()` or `getOpenPanelIds()`.
|
|
832
|
-
*
|
|
833
|
-
* The selector must return a value that stays the same while the state does — a primitive, or a
|
|
834
|
-
* part of the state as it is (`s => s.panels[id]`). A selector that builds a new object or array
|
|
835
|
-
* on each call (`s => ({ n: s.floating.length })`, `s => s.floating.map(...)`) is a new value
|
|
836
|
-
* every time React asks, and React stops with "Maximum update depth exceeded". Select the parts
|
|
837
|
-
* separately, or
|
|
838
|
-
* derive the object with `useMemo` from what you selected.
|
|
839
|
-
*
|
|
840
|
-
* @returns The current workspace state, or the selector's result.
|
|
841
|
-
* @throws Error if used outside `<DockableDesktopProvider>`.
|
|
842
|
-
* @example
|
|
843
|
-
* ```tsx
|
|
844
|
-
* function PanelCount() {
|
|
845
|
-
* const count = useWorkspaceState(s => Object.keys(s.panels).length);
|
|
846
|
-
* return <span>{count} open</span>;
|
|
847
|
-
* }
|
|
848
|
-
* ```
|
|
849
|
-
*/
|
|
850
|
-
declare function useWindowManagerState(): WorkspaceState;
|
|
851
|
-
declare function useWindowManagerState<T>(selector: (state: WorkspaceState) => T): T;
|
|
852
|
-
/**
|
|
853
|
-
* React hook to retrieve the active i18n formatter.
|
|
854
|
-
*/
|
|
855
|
-
declare const useFormatMessage: () => MessageFormatter;
|
|
856
|
-
/**
|
|
857
|
-
* Helper to resolve dynamic label strings or localizable descriptor objects into text.
|
|
858
|
-
*/
|
|
859
|
-
declare const formatLabel: (label: string | MessageDescriptor | (() => string) | undefined, formatter: MessageFormatter) => string;
|
|
860
|
-
/**
|
|
861
|
-
* React hook to fetch the localizable predefined message map catalog.
|
|
862
|
-
*/
|
|
863
|
-
declare const usePredefinedMessages: () => Record<MessageKey, MessageDescriptor>;
|
|
864
|
-
/**
|
|
865
|
-
* React hook for injecting custom context menu items into a panel's context menu from inside the panel component.
|
|
866
|
-
* Items are dynamic — the array is re-read each time the menu opens, so state-driven changes (enable/disable, add/remove) work automatically.
|
|
867
|
-
* The hook knows which panel it is in — no id needed.
|
|
868
|
-
*
|
|
869
|
-
* @param items - Array of `ContextMenuItem` entries (simple items, separators, submenus).
|
|
870
|
-
* @example
|
|
871
|
-
* ```tsx
|
|
872
|
-
* import { usePanelContextMenu } from 'dockable-windows';
|
|
873
|
-
*
|
|
874
|
-
* function MyPanel() {
|
|
875
|
-
* const [dirty, setDirty] = useState(false);
|
|
876
|
-
* usePanelContextMenu([
|
|
877
|
-
* { label: 'Save', action: () => save() },
|
|
878
|
-
* { label: 'Revert', action: () => revert() },
|
|
879
|
-
* ]);
|
|
880
|
-
* return <Editor onChange={() => setDirty(true)} />;
|
|
881
|
-
* }
|
|
882
|
-
* ```
|
|
883
|
-
*/
|
|
884
|
-
declare function usePanelContextMenu(items: ContextMenuItem[]): void;
|
|
885
666
|
|
|
886
667
|
/**
|
|
887
668
|
* Represents a registered component configuration template inside the panel catalog registry.
|
|
@@ -946,6 +727,247 @@ declare class PanelRegistry {
|
|
|
946
727
|
getRegisteredIds(): string[];
|
|
947
728
|
}
|
|
948
729
|
|
|
730
|
+
/**
|
|
731
|
+
* @file predefinedMessages.ts
|
|
732
|
+
* @description Provides the default localizable message catalogs and translation keys
|
|
733
|
+
* utilized by Dockable Desktop's context menus, headers, and tooltips.
|
|
734
|
+
*
|
|
735
|
+
* Each value's `id` is the react-intl message ID that the consumer should
|
|
736
|
+
* define in their IntlProvider messages table. The `defaultMessage` is used
|
|
737
|
+
* as a fallback when no external formatter is provided.
|
|
738
|
+
*
|
|
739
|
+
* Pass a partial or full override as `createWorkspace({ messages })` or
|
|
740
|
+
* `<DockableDesktopProvider messages={…}>` to customise labels without replacing the whole table.
|
|
741
|
+
*/
|
|
742
|
+
declare const defaultPredefinedMessages: {
|
|
743
|
+
readonly floatWindow: {
|
|
744
|
+
readonly id: "dockable-desktop-floatWindow";
|
|
745
|
+
readonly defaultMessage: "Float Window";
|
|
746
|
+
};
|
|
747
|
+
readonly minimizePanel: {
|
|
748
|
+
readonly id: "dockable-desktop-minimizePanel";
|
|
749
|
+
readonly defaultMessage: "Minimize Panel";
|
|
750
|
+
};
|
|
751
|
+
readonly closeTab: {
|
|
752
|
+
readonly id: "dockable-desktop-closeTab";
|
|
753
|
+
readonly defaultMessage: "Close Tab";
|
|
754
|
+
};
|
|
755
|
+
readonly restorePanel: {
|
|
756
|
+
readonly id: "dockable-desktop-restorePanel";
|
|
757
|
+
readonly defaultMessage: "Restore Panel";
|
|
758
|
+
};
|
|
759
|
+
readonly maximizePanel: {
|
|
760
|
+
readonly id: "dockable-desktop-maximizePanel";
|
|
761
|
+
readonly defaultMessage: "Maximize Panel";
|
|
762
|
+
};
|
|
763
|
+
readonly closePanel: {
|
|
764
|
+
readonly id: "dockable-desktop-closePanel";
|
|
765
|
+
readonly defaultMessage: "Close Panel";
|
|
766
|
+
};
|
|
767
|
+
readonly dockWindow: {
|
|
768
|
+
readonly id: "dockable-desktop-dockWindow";
|
|
769
|
+
readonly defaultMessage: "Dock Window";
|
|
770
|
+
};
|
|
771
|
+
readonly minimize: {
|
|
772
|
+
readonly id: "dockable-desktop-minimize";
|
|
773
|
+
readonly defaultMessage: "Minimize";
|
|
774
|
+
};
|
|
775
|
+
readonly maximize: {
|
|
776
|
+
readonly id: "dockable-desktop-maximize";
|
|
777
|
+
readonly defaultMessage: "Maximize";
|
|
778
|
+
};
|
|
779
|
+
readonly restoreSize: {
|
|
780
|
+
readonly id: "dockable-desktop-restoreSize";
|
|
781
|
+
readonly defaultMessage: "Restore Size";
|
|
782
|
+
};
|
|
783
|
+
readonly close: {
|
|
784
|
+
readonly id: "dockable-desktop-close";
|
|
785
|
+
readonly defaultMessage: "Close";
|
|
786
|
+
};
|
|
787
|
+
readonly closeEmptyGroup: {
|
|
788
|
+
readonly id: "dockable-desktop-closeEmptyGroup";
|
|
789
|
+
readonly defaultMessage: "Close empty split group";
|
|
790
|
+
};
|
|
791
|
+
readonly unsavedChangesTitle: {
|
|
792
|
+
readonly id: "dockable-desktop-unsavedChangesTitle";
|
|
793
|
+
readonly defaultMessage: "Unsaved Changes";
|
|
794
|
+
};
|
|
795
|
+
readonly unsavedChangesMessage: {
|
|
796
|
+
readonly id: "dockable-desktop-unsavedChangesMessage";
|
|
797
|
+
readonly defaultMessage: "\"{title}\" has unsaved changes. Do you want to discard your changes and close?";
|
|
798
|
+
};
|
|
799
|
+
readonly discardChanges: {
|
|
800
|
+
readonly id: "dockable-desktop-discardChanges";
|
|
801
|
+
readonly defaultMessage: "Discard Changes";
|
|
802
|
+
};
|
|
803
|
+
readonly cancel: {
|
|
804
|
+
readonly id: "dockable-desktop-cancel";
|
|
805
|
+
readonly defaultMessage: "Cancel";
|
|
806
|
+
};
|
|
807
|
+
readonly yes: {
|
|
808
|
+
readonly id: "dockable-desktop-yes";
|
|
809
|
+
readonly defaultMessage: "Yes";
|
|
810
|
+
};
|
|
811
|
+
readonly no: {
|
|
812
|
+
readonly id: "dockable-desktop-no";
|
|
813
|
+
readonly defaultMessage: "No";
|
|
814
|
+
};
|
|
815
|
+
readonly ok: {
|
|
816
|
+
readonly id: "dockable-desktop-ok";
|
|
817
|
+
readonly defaultMessage: "OK";
|
|
818
|
+
};
|
|
819
|
+
readonly closePanelTooltip: {
|
|
820
|
+
readonly id: "dockable-desktop-closePanelTooltip";
|
|
821
|
+
readonly defaultMessage: "Close panel";
|
|
822
|
+
};
|
|
823
|
+
readonly closeTooltip: {
|
|
824
|
+
readonly id: "dockable-desktop-closeTooltip";
|
|
825
|
+
readonly defaultMessage: "Close";
|
|
826
|
+
};
|
|
827
|
+
readonly notifications: {
|
|
828
|
+
readonly id: "dockable-desktop-notifications";
|
|
829
|
+
readonly defaultMessage: "Notifications";
|
|
830
|
+
};
|
|
831
|
+
readonly closeNotification: {
|
|
832
|
+
readonly id: "dockable-desktop-closeNotification";
|
|
833
|
+
readonly defaultMessage: "Close notification";
|
|
834
|
+
};
|
|
835
|
+
readonly scrollTabsLeft: {
|
|
836
|
+
readonly id: "dockable-desktop-scrollTabsLeft";
|
|
837
|
+
readonly defaultMessage: "Scroll tabs left";
|
|
838
|
+
};
|
|
839
|
+
readonly scrollTabsRight: {
|
|
840
|
+
readonly id: "dockable-desktop-scrollTabsRight";
|
|
841
|
+
readonly defaultMessage: "Scroll tabs right";
|
|
842
|
+
};
|
|
843
|
+
readonly scrollTaskbarLeft: {
|
|
844
|
+
readonly id: "dockable-desktop-scrollTaskbarLeft";
|
|
845
|
+
readonly defaultMessage: "Scroll taskbar left";
|
|
846
|
+
};
|
|
847
|
+
readonly scrollTaskbarRight: {
|
|
848
|
+
readonly id: "dockable-desktop-scrollTaskbarRight";
|
|
849
|
+
readonly defaultMessage: "Scroll taskbar right";
|
|
850
|
+
};
|
|
851
|
+
readonly moreActions: {
|
|
852
|
+
readonly id: "dockable-desktop-moreActions";
|
|
853
|
+
readonly defaultMessage: "More actions";
|
|
854
|
+
};
|
|
855
|
+
readonly search: {
|
|
856
|
+
readonly id: "dockable-desktop-search";
|
|
857
|
+
readonly defaultMessage: "Search";
|
|
858
|
+
};
|
|
859
|
+
readonly closeSearch: {
|
|
860
|
+
readonly id: "dockable-desktop-closeSearch";
|
|
861
|
+
readonly defaultMessage: "Close search";
|
|
862
|
+
};
|
|
863
|
+
readonly searchPlaceholder: {
|
|
864
|
+
readonly id: "dockable-desktop-searchPlaceholder";
|
|
865
|
+
readonly defaultMessage: "Search…";
|
|
866
|
+
};
|
|
867
|
+
readonly modalTitle: {
|
|
868
|
+
readonly id: "dockable-desktop-modalTitle";
|
|
869
|
+
readonly defaultMessage: "Confirmation";
|
|
870
|
+
};
|
|
871
|
+
readonly emptyGroup: {
|
|
872
|
+
readonly id: "dockable-desktop-emptyGroup";
|
|
873
|
+
readonly defaultMessage: "Empty Workspace Section";
|
|
874
|
+
};
|
|
875
|
+
readonly emptyGrid: {
|
|
876
|
+
readonly id: "dockable-desktop-emptyGrid";
|
|
877
|
+
readonly defaultMessage: "Grid Empty";
|
|
878
|
+
};
|
|
879
|
+
readonly componentUnregistered: {
|
|
880
|
+
readonly id: "dockable-desktop-componentUnregistered";
|
|
881
|
+
readonly defaultMessage: "Component Unregistered";
|
|
882
|
+
};
|
|
883
|
+
readonly componentKey: {
|
|
884
|
+
readonly id: "dockable-desktop-componentKey";
|
|
885
|
+
readonly defaultMessage: "Key: {key}";
|
|
886
|
+
};
|
|
887
|
+
readonly untitledPanel: {
|
|
888
|
+
readonly id: "dockable-desktop-untitledPanel";
|
|
889
|
+
readonly defaultMessage: "Panel";
|
|
890
|
+
};
|
|
891
|
+
};
|
|
892
|
+
/**
|
|
893
|
+
* Union of every key in `defaultMessages`.
|
|
894
|
+
*
|
|
895
|
+
* Import this type in your i18n message tables to get a compile-time
|
|
896
|
+
* guarantee that all keys are present and no typos exist:
|
|
897
|
+
*
|
|
898
|
+
* import type { MessageKey } from 'react-dockable-desktop';
|
|
899
|
+
*
|
|
900
|
+
* const myMessages: Record<MessageKey, string> = { ... };
|
|
901
|
+
*/
|
|
902
|
+
type MessageKey = keyof typeof defaultPredefinedMessages;
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* @file messages.ts
|
|
906
|
+
* @description Resolving a label — a string, a message descriptor or a thunk — to text.
|
|
907
|
+
*/
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Helper to resolve dynamic label strings or localizable descriptor objects into text.
|
|
911
|
+
*/
|
|
912
|
+
declare const formatLabel: (label: string | MessageDescriptor | (() => string) | undefined, formatter: MessageFormatter) => string;
|
|
913
|
+
|
|
914
|
+
/** Custom hook to read configured style class contexts. */
|
|
915
|
+
declare const useStyleClasses: () => HostClasses;
|
|
916
|
+
/**
|
|
917
|
+
* The live workspace state. The component re-renders whenever it changes — or, given a selector,
|
|
918
|
+
* only when the selected value changes.
|
|
919
|
+
*
|
|
920
|
+
* For reads without a subscription, call the workspace's `isOpen()` or `getOpenPanelIds()`.
|
|
921
|
+
*
|
|
922
|
+
* The selector must return a value that stays the same while the state does — a primitive, or a
|
|
923
|
+
* part of the state as it is (`s => s.panels[id]`). A selector that builds a new object or array
|
|
924
|
+
* on each call (`s => ({ n: s.floating.length })`, `s => s.floating.map(...)`) is a new value
|
|
925
|
+
* every time React asks, and React stops with "Maximum update depth exceeded". Select the parts
|
|
926
|
+
* separately, or
|
|
927
|
+
* derive the object with `useMemo` from what you selected.
|
|
928
|
+
*
|
|
929
|
+
* @returns The current workspace state, or the selector's result.
|
|
930
|
+
* @throws Error if used outside `<DockableDesktopProvider>`.
|
|
931
|
+
* @example
|
|
932
|
+
* ```tsx
|
|
933
|
+
* function PanelCount() {
|
|
934
|
+
* const count = useWorkspaceState(s => Object.keys(s.panels).length);
|
|
935
|
+
* return <span>{count} open</span>;
|
|
936
|
+
* }
|
|
937
|
+
* ```
|
|
938
|
+
*/
|
|
939
|
+
declare function useWindowManagerState(): WorkspaceState;
|
|
940
|
+
declare function useWindowManagerState<T>(selector: (state: WorkspaceState) => T): T;
|
|
941
|
+
/**
|
|
942
|
+
* React hook to retrieve the active i18n formatter.
|
|
943
|
+
*/
|
|
944
|
+
declare const useFormatMessage: () => MessageFormatter;
|
|
945
|
+
/**
|
|
946
|
+
* React hook to fetch the localizable predefined message map catalog.
|
|
947
|
+
*/
|
|
948
|
+
declare const usePredefinedMessages: () => Record<MessageKey, MessageDescriptor>;
|
|
949
|
+
/**
|
|
950
|
+
* React hook for injecting custom context menu items into a panel's context menu from inside the panel component.
|
|
951
|
+
* Items are dynamic — the array is re-read each time the menu opens, so state-driven changes (enable/disable, add/remove) work automatically.
|
|
952
|
+
* The hook knows which panel it is in — no id needed.
|
|
953
|
+
*
|
|
954
|
+
* @param items - Array of `ContextMenuItem` entries (simple items, separators, submenus).
|
|
955
|
+
* @example
|
|
956
|
+
* ```tsx
|
|
957
|
+
* import { usePanelContextMenu } from 'dockable-windows';
|
|
958
|
+
*
|
|
959
|
+
* function MyPanel() {
|
|
960
|
+
* const [dirty, setDirty] = useState(false);
|
|
961
|
+
* usePanelContextMenu([
|
|
962
|
+
* { label: 'Save', action: () => save() },
|
|
963
|
+
* { label: 'Revert', action: () => revert() },
|
|
964
|
+
* ]);
|
|
965
|
+
* return <Editor onChange={() => setDirty(true)} />;
|
|
966
|
+
* }
|
|
967
|
+
* ```
|
|
968
|
+
*/
|
|
969
|
+
declare function usePanelContextMenu(items: ContextMenuItem[]): void;
|
|
970
|
+
|
|
949
971
|
/** Built-in lifecycle events always available on the workspace event bus. */
|
|
950
972
|
interface BuiltInEvents {
|
|
951
973
|
'panel:opened': {
|
|
@@ -2138,6 +2160,12 @@ declare const toast: ToastFunction;
|
|
|
2138
2160
|
*/
|
|
2139
2161
|
declare function ToastContainer({ position, maxVisible, defaultDuration, defaultClosable, pauseOnHover, animation, newestOnTop, progressBar, width, adapter, }: RddToastsProps): React$1.ReactElement | null;
|
|
2140
2162
|
|
|
2163
|
+
/**
|
|
2164
|
+
* @file types.ts
|
|
2165
|
+
* @description Public types of the Panel Overlay system: toolbar edges, widget stretch and
|
|
2166
|
+
* placement, and the config of an imperatively opened widget.
|
|
2167
|
+
*/
|
|
2168
|
+
|
|
2141
2169
|
/** Edge of a panel to which a `PanelToolbar` attaches. */
|
|
2142
2170
|
type ToolbarPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
2143
2171
|
/**
|
|
@@ -2191,6 +2219,12 @@ interface ManagedWidget {
|
|
|
2191
2219
|
*/
|
|
2192
2220
|
stretch?: Stretch;
|
|
2193
2221
|
}
|
|
2222
|
+
|
|
2223
|
+
/**
|
|
2224
|
+
* @file PanelOverlayRoot.tsx
|
|
2225
|
+
* @description The Panel Overlay root: provides the overlay contexts and draws the corner drop zones.
|
|
2226
|
+
*/
|
|
2227
|
+
|
|
2194
2228
|
/** Props for `<RddPanelOverlay>`. */
|
|
2195
2229
|
interface RddPanelOverlayProps {
|
|
2196
2230
|
children: React$1.ReactNode;
|
|
@@ -2211,6 +2245,12 @@ interface RddPanelOverlayProps {
|
|
|
2211
2245
|
* }
|
|
2212
2246
|
*/
|
|
2213
2247
|
declare function PanelOverlayRoot({ children, className, style }: RddPanelOverlayProps): React$1.ReactElement;
|
|
2248
|
+
|
|
2249
|
+
/**
|
|
2250
|
+
* @file PanelToolbar.tsx
|
|
2251
|
+
* @description A toolbar on a panel edge, and its buttons, toggles and layout primitives.
|
|
2252
|
+
*/
|
|
2253
|
+
|
|
2214
2254
|
/** Background style of a `PanelToolbar`. */
|
|
2215
2255
|
type ToolbarVariant = 'transparent' | 'frosted' | 'solid';
|
|
2216
2256
|
/** Visual style applied to `ToolbarButton` and `ToolbarToggle` components. */
|
|
@@ -2282,6 +2322,12 @@ declare function ToolbarItem({ children }: {
|
|
|
2282
2322
|
declare function ToolbarCenter({ children }: {
|
|
2283
2323
|
children: React$1.ReactNode;
|
|
2284
2324
|
}): React$1.ReactElement;
|
|
2325
|
+
|
|
2326
|
+
/**
|
|
2327
|
+
* @file ToolbarSearch.tsx
|
|
2328
|
+
* @description The search field of a panel toolbar, with its results dropdown.
|
|
2329
|
+
*/
|
|
2330
|
+
|
|
2285
2331
|
/** A single result item returned by `RddToolbarSearchProps.onSearch`. */
|
|
2286
2332
|
interface SearchResult {
|
|
2287
2333
|
/** Unique identifier for this result — passed to `onSelect`. */
|
|
@@ -2320,6 +2366,12 @@ interface RddToolbarSearchProps {
|
|
|
2320
2366
|
* />
|
|
2321
2367
|
*/
|
|
2322
2368
|
declare function ToolbarSearchInput({ placeholder, onSearch, onSelect }: RddToolbarSearchProps): React$1.ReactElement;
|
|
2369
|
+
|
|
2370
|
+
/**
|
|
2371
|
+
* @file FloatingWidget.tsx
|
|
2372
|
+
* @description A floating widget inside a panel: docked to a corner or free, stretchable, resizable.
|
|
2373
|
+
*/
|
|
2374
|
+
|
|
2323
2375
|
/** Props for `<RddFloatingWidget>`. */
|
|
2324
2376
|
interface RddFloatingWidgetProps {
|
|
2325
2377
|
/** Unique identifier within the panel overlay. Used for z-order and stack tracking. */
|
|
@@ -2404,6 +2456,7 @@ interface RddFloatingWidgetProps {
|
|
|
2404
2456
|
* </RddFloatingWidget>
|
|
2405
2457
|
*/
|
|
2406
2458
|
declare function PanelFloatingWindow(props: RddFloatingWidgetProps): React$1.ReactElement | null;
|
|
2459
|
+
|
|
2407
2460
|
/**
|
|
2408
2461
|
* What `useFloatingWidgets()` returns.
|
|
2409
2462
|
*/
|
|
@@ -2580,9 +2633,9 @@ interface ResizeConstraints {
|
|
|
2580
2633
|
* rather than one "container bound" — a resize toward the fixed edge (e/s) is
|
|
2581
2634
|
* naturally bounded by a maximum dimension, while a resize toward the moving edge
|
|
2582
2635
|
* (w/n) is naturally bounded by a minimum position, and the two calling sites this
|
|
2583
|
-
* was extracted from need different subsets of these (see
|
|
2636
|
+
* was extracted from need different subsets of these (see workspace/floatingWindowDrag.ts's
|
|
2584
2637
|
* `startResize`, which omits all four and lets a window grow unbounded and be
|
|
2585
|
-
* dragged fully off-screen, vs.
|
|
2638
|
+
* dragged fully off-screen, vs. panelOverlay/FloatingWidget.tsx's `handleResizePointerDown`, which
|
|
2586
2639
|
* supplies all four to keep windows within their container).
|
|
2587
2640
|
*/
|
|
2588
2641
|
declare function computeResizedRect(dir: ResizeDir, dx: number, dy: number, start: ResizeRect, constraints: ResizeConstraints): ResizeRect;
|