react-dockable-desktop 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +327 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +427 -0
- package/dist/index.d.ts +427 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1766 -0
- package/package.json +70 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default, { ComponentType, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface WindowManagerProps {
|
|
5
|
+
skin?: string;
|
|
6
|
+
defaultPanelIcon?: React__default.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const WindowManager: React__default.FC<WindowManagerProps>;
|
|
9
|
+
|
|
10
|
+
interface PanelRegistryEntry {
|
|
11
|
+
Component: ComponentType<any>;
|
|
12
|
+
defaultOptions?: {
|
|
13
|
+
title?: string;
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
initialTarget?: 'floating' | 'docked' | 'tabbed';
|
|
16
|
+
favoritePosition?: {
|
|
17
|
+
x: number | string;
|
|
18
|
+
y: number | string;
|
|
19
|
+
width: number | string;
|
|
20
|
+
height: number | string;
|
|
21
|
+
};
|
|
22
|
+
canDrag?: boolean;
|
|
23
|
+
canMinimize?: boolean;
|
|
24
|
+
canClose?: boolean;
|
|
25
|
+
defaultStickyRight?: boolean;
|
|
26
|
+
defaultStickyBottom?: boolean;
|
|
27
|
+
disableLivePreview?: boolean;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
declare class PanelRegistryClass {
|
|
31
|
+
private registry;
|
|
32
|
+
register<P extends object>(id: string, Component: ComponentType<P>, defaultOptions?: PanelRegistryEntry['defaultOptions']): void;
|
|
33
|
+
get(id: string): PanelRegistryEntry | undefined;
|
|
34
|
+
getRegisteredIds(): string[];
|
|
35
|
+
}
|
|
36
|
+
declare const PanelRegistry: PanelRegistryClass;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Default English messages for every action exposed by Dockable Desktop.
|
|
40
|
+
*
|
|
41
|
+
* Each value's `id` is the react-intl message ID that the consumer should
|
|
42
|
+
* define in their IntlProvider messages table. The `defaultMessage` is used
|
|
43
|
+
* as a fallback when no external formatter is provided.
|
|
44
|
+
*
|
|
45
|
+
* Pass a partial or full override to <WindowManagerProvider predefinedMessages={…} />
|
|
46
|
+
* to customise labels without replacing the whole table.
|
|
47
|
+
*/
|
|
48
|
+
declare const defaultPredefinedMessages: {
|
|
49
|
+
readonly floatWindow: {
|
|
50
|
+
readonly id: "dockable-desktop-floatWindow";
|
|
51
|
+
readonly defaultMessage: "Float Window";
|
|
52
|
+
};
|
|
53
|
+
readonly minimizePanel: {
|
|
54
|
+
readonly id: "dockable-desktop-minimizePanel";
|
|
55
|
+
readonly defaultMessage: "Minimize Panel";
|
|
56
|
+
};
|
|
57
|
+
readonly closeTab: {
|
|
58
|
+
readonly id: "dockable-desktop-closeTab";
|
|
59
|
+
readonly defaultMessage: "Close Tab";
|
|
60
|
+
};
|
|
61
|
+
readonly restorePanel: {
|
|
62
|
+
readonly id: "dockable-desktop-restorePanel";
|
|
63
|
+
readonly defaultMessage: "Restore Panel";
|
|
64
|
+
};
|
|
65
|
+
readonly maximizePanel: {
|
|
66
|
+
readonly id: "dockable-desktop-maximizePanel";
|
|
67
|
+
readonly defaultMessage: "Maximize Panel";
|
|
68
|
+
};
|
|
69
|
+
readonly closePanel: {
|
|
70
|
+
readonly id: "dockable-desktop-closePanel";
|
|
71
|
+
readonly defaultMessage: "Close Panel";
|
|
72
|
+
};
|
|
73
|
+
readonly dockWindow: {
|
|
74
|
+
readonly id: "dockable-desktop-dockWindow";
|
|
75
|
+
readonly defaultMessage: "Dock Window";
|
|
76
|
+
};
|
|
77
|
+
readonly minimize: {
|
|
78
|
+
readonly id: "dockable-desktop-minimize";
|
|
79
|
+
readonly defaultMessage: "Minimize";
|
|
80
|
+
};
|
|
81
|
+
readonly maximize: {
|
|
82
|
+
readonly id: "dockable-desktop-maximize";
|
|
83
|
+
readonly defaultMessage: "Maximize";
|
|
84
|
+
};
|
|
85
|
+
readonly restoreSize: {
|
|
86
|
+
readonly id: "dockable-desktop-restoreSize";
|
|
87
|
+
readonly defaultMessage: "Restore Size";
|
|
88
|
+
};
|
|
89
|
+
readonly close: {
|
|
90
|
+
readonly id: "dockable-desktop-close";
|
|
91
|
+
readonly defaultMessage: "Close";
|
|
92
|
+
};
|
|
93
|
+
readonly closeEmptyGroup: {
|
|
94
|
+
readonly id: "dockable-desktop-closeEmptyGroup";
|
|
95
|
+
readonly defaultMessage: "Close empty split group";
|
|
96
|
+
};
|
|
97
|
+
readonly anchorToRightEdge: {
|
|
98
|
+
readonly id: "dockable-desktop-anchorToRightEdge";
|
|
99
|
+
readonly defaultMessage: "Anchor to Right Edge";
|
|
100
|
+
};
|
|
101
|
+
readonly anchorToBottomEdge: {
|
|
102
|
+
readonly id: "dockable-desktop-anchorToBottomEdge";
|
|
103
|
+
readonly defaultMessage: "Anchor to Bottom Edge";
|
|
104
|
+
};
|
|
105
|
+
readonly windowAnchoringOptions: {
|
|
106
|
+
readonly id: "dockable-desktop-windowAnchoringOptions";
|
|
107
|
+
readonly defaultMessage: "Window Anchoring Options";
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Union of every key in `defaultPredefinedMessages`.
|
|
112
|
+
*
|
|
113
|
+
* Import this type in your i18n message tables to get a compile-time
|
|
114
|
+
* guarantee that all keys are present and no typos exist:
|
|
115
|
+
*
|
|
116
|
+
* import type { PredefinedMessageKey } from 'react-dockable-desktop';
|
|
117
|
+
*
|
|
118
|
+
* const myMessages: Record<PredefinedMessageKey, string> = { ... };
|
|
119
|
+
*/
|
|
120
|
+
type PredefinedMessageKey = keyof typeof defaultPredefinedMessages;
|
|
121
|
+
|
|
122
|
+
interface ContextMenuPredefinedMessage {
|
|
123
|
+
id: string;
|
|
124
|
+
defaultMessage?: string;
|
|
125
|
+
values?: Record<string, string | number>;
|
|
126
|
+
}
|
|
127
|
+
type MessageFormatter = (msg: ContextMenuPredefinedMessage) => string;
|
|
128
|
+
type SplitOrientation = 'horizontal' | 'vertical';
|
|
129
|
+
interface LayoutGridNode {
|
|
130
|
+
type: 'branch';
|
|
131
|
+
orientation: SplitOrientation;
|
|
132
|
+
children: LayoutNode[];
|
|
133
|
+
sizes: number[];
|
|
134
|
+
}
|
|
135
|
+
interface LayoutLeafNode {
|
|
136
|
+
type: 'leaf';
|
|
137
|
+
id: string;
|
|
138
|
+
panels: string[];
|
|
139
|
+
activePanelId: string | null;
|
|
140
|
+
canClose?: boolean;
|
|
141
|
+
/** When true the leaf group persists in the layout even after its last panel
|
|
142
|
+
* is closed/floated/minimised. Defaults to false (auto-remove). */
|
|
143
|
+
keepOnEmpty?: boolean;
|
|
144
|
+
}
|
|
145
|
+
type LayoutNode = LayoutGridNode | LayoutLeafNode;
|
|
146
|
+
interface FloatingWindow {
|
|
147
|
+
id: string;
|
|
148
|
+
x: number | string;
|
|
149
|
+
y: number | string;
|
|
150
|
+
width: number | string;
|
|
151
|
+
height: number | string;
|
|
152
|
+
z: number;
|
|
153
|
+
maximized?: boolean;
|
|
154
|
+
stickyRight?: boolean;
|
|
155
|
+
stickyBottom?: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface PanelInfo {
|
|
158
|
+
id: string;
|
|
159
|
+
title: string | ContextMenuPredefinedMessage;
|
|
160
|
+
component: string;
|
|
161
|
+
state: 'docked' | 'floating' | 'minimized';
|
|
162
|
+
previousState?: 'docked' | 'floating';
|
|
163
|
+
lastFloatingRect?: {
|
|
164
|
+
x: number;
|
|
165
|
+
y: number;
|
|
166
|
+
width: number;
|
|
167
|
+
height: number;
|
|
168
|
+
stickyRight?: boolean;
|
|
169
|
+
stickyBottom?: boolean;
|
|
170
|
+
};
|
|
171
|
+
lastLeafId?: string;
|
|
172
|
+
dirty?: boolean;
|
|
173
|
+
}
|
|
174
|
+
interface WindowState {
|
|
175
|
+
gridRoot: LayoutNode;
|
|
176
|
+
floating: FloatingWindow[];
|
|
177
|
+
minimized: {
|
|
178
|
+
id: string;
|
|
179
|
+
title: string | ContextMenuPredefinedMessage;
|
|
180
|
+
component: string;
|
|
181
|
+
}[];
|
|
182
|
+
panels: Record<string, PanelInfo>;
|
|
183
|
+
draggedPanelId: string | null;
|
|
184
|
+
pendingClose: {
|
|
185
|
+
id: string;
|
|
186
|
+
resolve: (discard: boolean) => void;
|
|
187
|
+
} | null;
|
|
188
|
+
}
|
|
189
|
+
interface WindowActions {
|
|
190
|
+
openPanel: (id: string, component: string, options?: {
|
|
191
|
+
title?: string | ContextMenuPredefinedMessage;
|
|
192
|
+
initialTarget?: 'floating' | 'docked' | 'tabbed';
|
|
193
|
+
stickyRight?: boolean;
|
|
194
|
+
stickyBottom?: boolean;
|
|
195
|
+
}) => void;
|
|
196
|
+
closePanel: (id: string) => void;
|
|
197
|
+
minimizePanel: (id: string) => void;
|
|
198
|
+
restorePanel: (id: string) => void;
|
|
199
|
+
floatPanel: (id: string, rect?: {
|
|
200
|
+
x: number;
|
|
201
|
+
y: number;
|
|
202
|
+
width: number;
|
|
203
|
+
height: number;
|
|
204
|
+
}) => void;
|
|
205
|
+
dockPanel: (id: string, targetLeafId?: string) => void;
|
|
206
|
+
maximizePanel: (id: string) => void;
|
|
207
|
+
updateSplitSizes: (path: number[], sizes: number[]) => void;
|
|
208
|
+
updateFloatingPosition: (id: string, updates: Partial<Pick<FloatingWindow, 'x' | 'y' | 'width' | 'height' | 'stickyRight' | 'stickyBottom'>>) => void;
|
|
209
|
+
bringToFront: (id: string) => void;
|
|
210
|
+
saveLayout: () => string;
|
|
211
|
+
loadLayout: (layoutJson: string) => void;
|
|
212
|
+
publish: (event: string, data: any) => void;
|
|
213
|
+
subscribe: (event: string, callback: (data: any) => void) => () => void;
|
|
214
|
+
setDraggedPanelId: (id: string | null) => void;
|
|
215
|
+
dockPanelToGroup: (id: string, targetLeafId: string, position: 'left' | 'right' | 'top' | 'bottom' | 'center') => void;
|
|
216
|
+
movePanelOrder: (panelId: string, targetLeafId: string, targetIndex: number) => void;
|
|
217
|
+
closeLeafGroup: (leafId: string) => void;
|
|
218
|
+
registerCloseGuard: (id: string, guard: () => boolean | Promise<boolean>) => void;
|
|
219
|
+
unregisterCloseGuard: (id: string) => void;
|
|
220
|
+
setPanelDirty: (id: string, dirty: boolean) => void;
|
|
221
|
+
updatePanelTitle: (id: string, title: string | ContextMenuPredefinedMessage) => void;
|
|
222
|
+
requestClosePanel: (id: string, options?: {
|
|
223
|
+
force?: boolean;
|
|
224
|
+
}) => Promise<void>;
|
|
225
|
+
resolvePendingClose: (discard: boolean) => void;
|
|
226
|
+
dockPanelToWorkspaceEdge: (id: string, position: 'left' | 'right' | 'top' | 'bottom') => void;
|
|
227
|
+
}
|
|
228
|
+
interface StyleClasses {
|
|
229
|
+
modalClass?: string;
|
|
230
|
+
modalBodyClass?: string;
|
|
231
|
+
sidePanelClass?: string;
|
|
232
|
+
sidePanelBodyClass?: string;
|
|
233
|
+
windowClass?: string;
|
|
234
|
+
windowBodyClass?: string;
|
|
235
|
+
}
|
|
236
|
+
declare const useStyleClasses: () => StyleClasses;
|
|
237
|
+
interface WindowManagerProviderProps {
|
|
238
|
+
children: React__default.ReactNode;
|
|
239
|
+
formatMessage?: MessageFormatter;
|
|
240
|
+
predefinedMessages?: Record<string, ContextMenuPredefinedMessage>;
|
|
241
|
+
modalClass?: string;
|
|
242
|
+
modalBodyClass?: string;
|
|
243
|
+
sidePanelClass?: string;
|
|
244
|
+
sidePanelBodyClass?: string;
|
|
245
|
+
windowClass?: string;
|
|
246
|
+
windowBodyClass?: string;
|
|
247
|
+
}
|
|
248
|
+
declare const WindowManagerProvider: React__default.FC<WindowManagerProviderProps>;
|
|
249
|
+
declare const useWindowManagerState: () => WindowState;
|
|
250
|
+
declare const useWindowManagerActions: () => WindowActions;
|
|
251
|
+
declare const useFormatMessage: () => MessageFormatter;
|
|
252
|
+
declare const formatLabel: (label: string | ContextMenuPredefinedMessage | undefined, formatter: MessageFormatter) => string;
|
|
253
|
+
declare const usePanelContext: () => {
|
|
254
|
+
publish: (event: string, data: any) => void;
|
|
255
|
+
subscribe: (event: string, callback: (data: any) => void) => () => void;
|
|
256
|
+
};
|
|
257
|
+
declare const usePredefinedMessages: () => Record<"floatWindow" | "minimizePanel" | "closeTab" | "restorePanel" | "maximizePanel" | "closePanel" | "dockWindow" | "minimize" | "maximize" | "restoreSize" | "close" | "closeEmptyGroup" | "anchorToRightEdge" | "anchorToBottomEdge" | "windowAnchoringOptions", ContextMenuPredefinedMessage>;
|
|
258
|
+
|
|
259
|
+
interface CloseOptions {
|
|
260
|
+
force?: boolean;
|
|
261
|
+
}
|
|
262
|
+
type ContainerType = 'left-panel' | 'right-panel' | 'modal' | 'dockable-panel' | 'standalone';
|
|
263
|
+
interface FormContainerContract {
|
|
264
|
+
requestClose: (options?: CloseOptions) => void;
|
|
265
|
+
setDirty: (dirty: boolean) => void;
|
|
266
|
+
onCloseRequested: (handler: () => boolean | Promise<boolean>) => (() => void);
|
|
267
|
+
setTitle: (title: string | {
|
|
268
|
+
id: string;
|
|
269
|
+
defaultMessage: string;
|
|
270
|
+
values?: Record<string, any>;
|
|
271
|
+
}) => void;
|
|
272
|
+
setIcon?: (icon: React.ReactNode) => void;
|
|
273
|
+
containerType?: ContainerType;
|
|
274
|
+
instanceId: string;
|
|
275
|
+
onClose?: (handler: () => void) => () => void;
|
|
276
|
+
onMinimize?: (handler: () => void) => () => void;
|
|
277
|
+
onRestore?: (handler: () => void) => () => void;
|
|
278
|
+
onResize?: (handler: (width: number, height: number) => void) => () => void;
|
|
279
|
+
}
|
|
280
|
+
declare const FormContainerContext: React$1.Context<FormContainerContract>;
|
|
281
|
+
declare const FormContainerProvider: React$1.Provider<FormContainerContract>;
|
|
282
|
+
declare const useFormContainer: () => FormContainerContract;
|
|
283
|
+
|
|
284
|
+
type PanelInstanceId = string;
|
|
285
|
+
interface PanelTitleDescriptor {
|
|
286
|
+
id: string;
|
|
287
|
+
defaultMessage?: string;
|
|
288
|
+
values?: Record<string, string | number>;
|
|
289
|
+
}
|
|
290
|
+
type PanelTitle = string | PanelTitleDescriptor;
|
|
291
|
+
interface SidePanelOptions {
|
|
292
|
+
title?: PanelTitle;
|
|
293
|
+
icon?: React__default.ReactNode;
|
|
294
|
+
width?: number | string;
|
|
295
|
+
}
|
|
296
|
+
interface ModalOptions {
|
|
297
|
+
title?: PanelTitle;
|
|
298
|
+
icon?: React__default.ReactNode;
|
|
299
|
+
size?: 'small' | 'medium' | 'large' | 'fullscreen' | 'auto';
|
|
300
|
+
closable?: boolean;
|
|
301
|
+
}
|
|
302
|
+
interface PanelInstance {
|
|
303
|
+
id: PanelInstanceId;
|
|
304
|
+
Component: ComponentType<any>;
|
|
305
|
+
props: Record<string, any>;
|
|
306
|
+
containerType: 'left-panel' | 'right-panel' | 'modal';
|
|
307
|
+
options: SidePanelOptions | ModalOptions;
|
|
308
|
+
dirty?: boolean;
|
|
309
|
+
}
|
|
310
|
+
interface PanelState {
|
|
311
|
+
leftPanel: PanelInstance | null;
|
|
312
|
+
rightPanel: PanelInstance | null;
|
|
313
|
+
modals: PanelInstance[];
|
|
314
|
+
}
|
|
315
|
+
interface PanelActions {
|
|
316
|
+
openLeftPanel: <P extends object>(Component: ComponentType<P>, props: P, options?: SidePanelOptions) => Promise<PanelInstanceId | null>;
|
|
317
|
+
openRightPanel: <P extends object>(Component: ComponentType<P>, props: P, options?: SidePanelOptions) => Promise<PanelInstanceId | null>;
|
|
318
|
+
openModal: <P extends object>(Component: ComponentType<P>, props: P, options?: ModalOptions) => PanelInstanceId;
|
|
319
|
+
close: (id: PanelInstanceId) => void;
|
|
320
|
+
closeAll: () => void;
|
|
321
|
+
closeAllModals: () => void;
|
|
322
|
+
getInstance: (id: PanelInstanceId) => PanelInstance | undefined;
|
|
323
|
+
updateInstance: (id: PanelInstanceId, updates: Partial<Pick<PanelInstance, 'props' | 'options' | 'dirty'>>) => void;
|
|
324
|
+
setDirty: (id: PanelInstanceId, dirty: boolean) => void;
|
|
325
|
+
registerCloseHandler: (id: PanelInstanceId, handler: () => Promise<boolean>) => void;
|
|
326
|
+
unregisterCloseHandler: (id: PanelInstanceId) => void;
|
|
327
|
+
}
|
|
328
|
+
declare const PanelProvider: React__default.FC<{
|
|
329
|
+
children: ReactNode;
|
|
330
|
+
}>;
|
|
331
|
+
declare const usePanelState: () => PanelState;
|
|
332
|
+
declare const usePanelActions: () => PanelActions;
|
|
333
|
+
|
|
334
|
+
declare const ModalStackRenderer: React__default.FC;
|
|
335
|
+
|
|
336
|
+
interface SidePanelRendererProps {
|
|
337
|
+
/**
|
|
338
|
+
* Default panel width applied when openLeftPanel/openRightPanel do not specify one.
|
|
339
|
+
* Accepts a number (treated as px) or any CSS width string (e.g. '40vw').
|
|
340
|
+
* Falls back to 400px if omitted.
|
|
341
|
+
*/
|
|
342
|
+
defaultWidth?: number | string;
|
|
343
|
+
}
|
|
344
|
+
declare const SidePanelRenderer: React__default.FC<SidePanelRendererProps>;
|
|
345
|
+
declare const LeftPanelRenderer: React__default.FC<SidePanelRendererProps>;
|
|
346
|
+
declare const RightPanelRenderer: React__default.FC<SidePanelRendererProps>;
|
|
347
|
+
|
|
348
|
+
interface ConfirmationFormProps {
|
|
349
|
+
title?: string | {
|
|
350
|
+
id: string;
|
|
351
|
+
defaultMessage?: string;
|
|
352
|
+
values?: any;
|
|
353
|
+
};
|
|
354
|
+
message: string | {
|
|
355
|
+
id: string;
|
|
356
|
+
defaultMessage?: string;
|
|
357
|
+
values?: any;
|
|
358
|
+
};
|
|
359
|
+
alert?: string;
|
|
360
|
+
alertType?: 'info' | 'warning' | 'success' | 'danger';
|
|
361
|
+
useYesNoTitles?: boolean;
|
|
362
|
+
onOK?: () => void;
|
|
363
|
+
onCancel?: () => void;
|
|
364
|
+
}
|
|
365
|
+
declare const ConfirmationForm: React__default.FC<ConfirmationFormProps>;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Per-tab configuration supplied by the consuming application.
|
|
369
|
+
*/
|
|
370
|
+
interface SidebarTab {
|
|
371
|
+
id: string;
|
|
372
|
+
label: string;
|
|
373
|
+
icon: React__default.ReactNode;
|
|
374
|
+
/**
|
|
375
|
+
* Mount immediately when the Sidebar first renders, not on first user click.
|
|
376
|
+
* Implies `preserveState: true`.
|
|
377
|
+
* Use when other parts of the app need to interact with the panel before
|
|
378
|
+
* the user has opened it (e.g. push data into a context, warm up a WebGL map).
|
|
379
|
+
* Default: false
|
|
380
|
+
*/
|
|
381
|
+
eagerMount?: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Once mounted for the first time, keep the component alive in the DOM
|
|
384
|
+
* behind `display: none` when closed instead of unmounting it.
|
|
385
|
+
* Use for panels with expensive local state (long forms, WebGL scenes, etc.).
|
|
386
|
+
* Ignored when `eagerMount` is true (eagerly mounted panels are always preserved).
|
|
387
|
+
* Default: false
|
|
388
|
+
*/
|
|
389
|
+
preserveState?: boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Called to obtain the drawer content for this tab.
|
|
392
|
+
* @param tabId - the id of this tab
|
|
393
|
+
* @param onClose - call to collapse the sidebar drawer
|
|
394
|
+
* @param onOpen - call to expand the drawer and select this tab programmatically
|
|
395
|
+
* (useful when the panel itself detects it has new data to show)
|
|
396
|
+
*/
|
|
397
|
+
renderContent: (tabId: string, onClose: () => void, onOpen: () => void) => React__default.ReactNode;
|
|
398
|
+
}
|
|
399
|
+
interface SidebarProps {
|
|
400
|
+
/** Which side the tab strip and drawer appear on. Default: 'right' */
|
|
401
|
+
position?: 'left' | 'right';
|
|
402
|
+
tabs: SidebarTab[];
|
|
403
|
+
/** Width of the open drawer. Default: '220px' */
|
|
404
|
+
drawerWidth?: string;
|
|
405
|
+
/** Controlled active tab id. Leave undefined to use internal state. */
|
|
406
|
+
activeTabId?: string | null;
|
|
407
|
+
/** Called when the active tab changes in uncontrolled mode. */
|
|
408
|
+
onActiveTabChange?: (tabId: string | null) => void;
|
|
409
|
+
/** Main workspace content, rendered between the strip and drawer (or around them). */
|
|
410
|
+
children?: React__default.ReactNode;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Imperative handle exposed by <Sidebar ref={...}> via forwardRef.
|
|
414
|
+
* Allows external components (outside the sidebar tree) to control
|
|
415
|
+
* which tab is open without prop drilling.
|
|
416
|
+
*/
|
|
417
|
+
interface SidebarHandle {
|
|
418
|
+
/** Expand the drawer and activate the tab with the given id. */
|
|
419
|
+
openTab: (tabId: string) => void;
|
|
420
|
+
/** Collapse the drawer (equivalent to clicking the active tab icon). */
|
|
421
|
+
closeDrawer: () => void;
|
|
422
|
+
/** Returns the currently active tab id, or null if the drawer is collapsed. */
|
|
423
|
+
getActiveTab: () => string | null;
|
|
424
|
+
}
|
|
425
|
+
declare const Sidebar: React__default.ForwardRefExoticComponent<SidebarProps & React__default.RefAttributes<SidebarHandle>>;
|
|
426
|
+
|
|
427
|
+
export { type CloseOptions, ConfirmationForm, type ConfirmationFormProps, type ContextMenuPredefinedMessage, type FloatingWindow, FormContainerContext, type FormContainerContract, FormContainerProvider, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, LeftPanelRenderer, type MessageFormatter, type ModalOptions, ModalStackRenderer, type PanelActions, type PanelInfo, type PanelInstance, type PanelInstanceId, PanelProvider, PanelRegistry, type PanelState, type PanelTitle, type PredefinedMessageKey, RightPanelRenderer, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarHandle, type SidebarProps, type SidebarTab, type SplitOrientation, type StyleClasses, type WindowActions, WindowManager, WindowManagerProvider, type WindowState, defaultPredefinedMessages, formatLabel, useFormContainer, useFormatMessage, usePanelActions, usePanelContext, usePanelState, usePredefinedMessages, useStyleClasses, useWindowManagerActions, useWindowManagerState };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import Rt,{useState as pe,useRef as me,useEffect as de}from"react";import{createPortal as Mt}from"react-dom";import{createContext as De,useContext as Oe,useState as Ut,useRef as Xe,useMemo as at,useCallback as Y}from"react";var st=class{registry=new Map;register(d,r,h){this.registry.set(d,{Component:r,defaultOptions:h})}get(d){return this.registry.get(d)}getRegisteredIds(){return Array.from(this.registry.keys())}},_=new st;var We={floatWindow:{id:"dockable-desktop-floatWindow",defaultMessage:"Float Window"},minimizePanel:{id:"dockable-desktop-minimizePanel",defaultMessage:"Minimize Panel"},closeTab:{id:"dockable-desktop-closeTab",defaultMessage:"Close Tab"},restorePanel:{id:"dockable-desktop-restorePanel",defaultMessage:"Restore Panel"},maximizePanel:{id:"dockable-desktop-maximizePanel",defaultMessage:"Maximize Panel"},closePanel:{id:"dockable-desktop-closePanel",defaultMessage:"Close Panel"},dockWindow:{id:"dockable-desktop-dockWindow",defaultMessage:"Dock Window"},minimize:{id:"dockable-desktop-minimize",defaultMessage:"Minimize"},maximize:{id:"dockable-desktop-maximize",defaultMessage:"Maximize"},restoreSize:{id:"dockable-desktop-restoreSize",defaultMessage:"Restore Size"},close:{id:"dockable-desktop-close",defaultMessage:"Close"},closeEmptyGroup:{id:"dockable-desktop-closeEmptyGroup",defaultMessage:"Close empty split group"},anchorToRightEdge:{id:"dockable-desktop-anchorToRightEdge",defaultMessage:"Anchor to Right Edge"},anchorToBottomEdge:{id:"dockable-desktop-anchorToBottomEdge",defaultMessage:"Anchor to Bottom Edge"},windowAnchoringOptions:{id:"dockable-desktop-windowAnchoringOptions",defaultMessage:"Window Anchoring Options"}};import{jsx as Fe}from"react/jsx-runtime";var vt=De(null),Pt=De(null),xt=De(null),wt=De(We),Ct=De({}),xe=()=>Oe(Ct),rt=class{listeners={};subscribe(d,r){return this.listeners[d]||(this.listeners[d]=[]),this.listeners[d].push(r),()=>{this.listeners[d]=this.listeners[d].filter(h=>h!==r)}}publish(d,r){this.listeners[d]&&this.listeners[d].forEach(h=>h(r))}},Jt={type:"branch",orientation:"vertical",sizes:[.75,.25],children:[{type:"leaf",id:"group-left-top",panels:["main-map","main-editor"],activePanelId:"main-map"},{type:"leaf",id:"group-left-bottom",panels:["system-console","help-docs"],activePanelId:"system-console"}]},Zt={"main-map":{id:"main-map",title:"Main Map",component:"mainMap",state:"docked"},"main-editor":{id:"main-editor",title:"Code Editor",component:"editor",state:"docked"},"system-console":{id:"system-console",title:"Console Output",component:"terminal",state:"docked"},"help-docs":{id:"help-docs",title:"Help Center",component:"help",state:"docked"},"live-preview":{id:"live-preview",title:"Live Preview Output",component:"preview",state:"floating"}},Qt=[{id:"live-preview",x:450,y:200,width:320,height:250,z:1e3}],Vt=({children:i,formatMessage:d,predefinedMessages:r,modalClass:h,modalBodyClass:T,sidePanelClass:w,sidePanelBodyClass:L,windowClass:W,windowBodyClass:b})=>{let[C,y]=Ut({gridRoot:Jt,floating:Qt,minimized:[],panels:Zt,draggedPanelId:null,pendingClose:null}),f=Xe(C);f.current=C;let m=Xe({}),M=at(()=>({...We,...r}),[r]),H=Xe(new rt),v=Xe(1e3),c=Y((e,s)=>H.current.subscribe(e,s),[]),x=Y((e,s)=>{H.current.publish(e,s)},[]),k=Y((e,s)=>{let n=typeof e.x=="string"?parseFloat(e.x):e.x,a=typeof e.y=="string"?parseFloat(e.y):e.y,o=typeof e.width=="string"?parseFloat(e.width):e.width,t=typeof e.height=="string"?parseFloat(e.height):e.height;isNaN(n)&&(n=300),isNaN(a)&&(a=150),isNaN(o)&&(o=450),isNaN(t)&&(t=350);let l=O=>s.some(F=>{let R=typeof F.x=="string"?parseFloat(F.x):F.x,z=typeof F.y=="string"?parseFloat(F.y):F.y;return!F.maximized&&Math.abs(R-O.x)<20&&Math.abs(z-O.y)<20}),g=0;for(;l({x:n,y:a})&&g<10;)n+=30,a+=30,g++;let P=Math.max(100,window.innerWidth||1024),N=Math.max(100,window.innerHeight||768);return(n+o>P||a+t>N)&&(n=100+g%5*30,a=100+g%5*30),n=Math.max(0,Math.min(n,P-100)),a=Math.max(0,Math.min(a,N-40)),{x:n,y:a,width:o,height:t}},[]),E=Y(e=>{v.current+=1;let s=v.current;y(n=>{let a=n.panels[e];if(!a)return n;if(a.state==="floating")return{...n,floating:n.floating.map(o=>o.id===e?{...o,z:s}:o)};if(a.state==="docked"){let o=t=>t.type==="leaf"?t.panels.includes(e)?{...t,activePanelId:e}:t:{...t,children:t.children.map(o)};return{...n,gridRoot:o(n.gridRoot)}}return n})},[]),p=(e,s)=>{if(e.type==="leaf"){let n=e.panels.indexOf(s);if(n===-1)return e;let a=e.panels.filter(l=>l!==s),o=e.activePanelId===s?a[n]||a[n-1]||a[0]||null:e.activePanelId,t={...e,panels:a,activePanelId:o};return a.length===0&&!e.keepOnEmpty?null:t}else{let n=e.children.map(t=>p(t,s)).filter(t=>t!==null);if(n.length===0)return null;if(n.length===1)return n[0];let a=e.sizes.slice(0,n.length),o=a.reduce((t,l)=>t+l,0);return{...e,children:n,sizes:a.map(t=>t/o)}}},I=(e,s,n)=>{if(e.type==="leaf"){if(e.id===s){let a=e.panels.includes(n)?e.panels:[...e.panels,n];return{...e,panels:a,activePanelId:n}}return e}else return{...e,children:e.children.map(a=>I(a,s,n))}},S=e=>{if(e.type==="leaf")return e.id;for(let s of e.children){let n=S(s);if(n)return n}return null},D=Y((e,s,n)=>{y(a=>{let o=a.panels[e],t=_.get(s),l=n?.title||n?.title||t?.defaultOptions?.title||e,g=n?.initialTarget||t?.defaultOptions?.initialTarget||"docked",P=t?.defaultOptions?.favoritePosition||{x:300,y:150,width:450,height:350};if(o)if(o.state==="minimized"){let R=a.minimized.filter(z=>z.id!==e);if(g==="floating"||!a.gridRoot){v.current+=1;let z=k(P,a.floating);return{...a,minimized:R,floating:[...a.floating,{...z,id:e,z:v.current}],panels:{...a.panels,[e]:{...o,state:"floating"}}}}else{let z=S(a.gridRoot)||"group-left-top";return{...a,minimized:R,gridRoot:I(a.gridRoot,z,e),panels:{...a.panels,[e]:{...o,state:"docked"}}}}}else{if(o.state==="floating")return E(e),a;{let R=z=>z.type==="leaf"?z.panels.includes(e)?{...z,activePanelId:e}:z:{...z,children:z.children.map(R)};return{...a,gridRoot:R(a.gridRoot)}}}let O={id:e,title:l,component:s,state:g==="tabbed"?"docked":g},F={...a.panels,[e]:O};if(g==="floating"){v.current+=1;let R=k(P,a.floating),z=n?.stickyRight??t?.defaultOptions?.defaultStickyRight??!1,K=n?.stickyBottom??t?.defaultOptions?.defaultStickyBottom??!1,j=Math.max(100,window.innerWidth||1024),U=Math.max(100,window.innerHeight||768),Z=typeof R.width=="string"?parseFloat(R.width):R.width,re=typeof R.height=="string"?parseFloat(R.height):R.height,le=R.x,be=R.y,ke=10;return z&&(le=j-Z-ke),K&&(be=U-re-ke),{...a,floating:[...a.floating,{...R,id:e,z:v.current,x:le,y:be,stickyRight:z,stickyBottom:K}],panels:F}}else{let R=S(a.gridRoot)||"group-left-top";return{...a,gridRoot:I(a.gridRoot,R,e),panels:F}}})},[k,E]),A=Y(e=>{y(s=>{let n=s.panels[e];if(!n||_.get(n.component)?.defaultOptions?.canClose===!1)return s;delete m.current[e];let o={...s.panels};delete o[e];let t=p(s.gridRoot,e);return{...s,gridRoot:t||{type:"leaf",id:"group-default",panels:[],activePanelId:null},floating:s.floating.filter(l=>l.id!==e),minimized:s.minimized.filter(l=>l.id!==e),panels:o}})},[]),X=Y((e,s)=>{m.current[e]=s},[]),ie=Y(e=>{delete m.current[e]},[]),J=Y((e,s)=>{y(n=>{let a=n.panels[e];return a?{...n,panels:{...n.panels,[e]:{...a,dirty:s}}}:n})},[]),V=Y((e,s)=>{y(n=>{let a=n.panels[e];return a?{...n,panels:{...n.panels,[e]:{...a,title:s}}}:n})},[]),te=Y(e=>{y(s=>s.pendingClose?(s.pendingClose.resolve(e),{...s,pendingClose:null}):s)},[]),ee=Y(async(e,s)=>{if(s?.force){A(e);return}let n=m.current[e];n&&!await n()||f.current.panels[e]?.dirty&&!await new Promise(t=>{y(l=>({...l,pendingClose:{id:e,resolve:t}}))})||A(e)},[A]),se=Y(e=>{y(s=>{let n=s.panels[e];if(!n||n.state==="minimized"||_.get(n.component)?.defaultOptions?.canMinimize===!1)return s;let o,t;if(n.state==="floating"){let g=s.floating.find(P=>P.id===e);g&&(o={x:g.x,y:g.y,width:g.width,height:g.height,stickyRight:g.stickyRight,stickyBottom:g.stickyBottom})}else if(n.state==="docked"){let g=P=>{if(P.type==="leaf")return P.panels.includes(e)?P.id:null;for(let N of P.children){let O=g(N);if(O)return O}return null};t=g(s.gridRoot)}let l=p(s.gridRoot,e);return{...s,gridRoot:l||{type:"leaf",id:"group-default",panels:[],activePanelId:null},floating:s.floating.filter(g=>g.id!==e),minimized:[...s.minimized,{id:e,title:n.title,component:n.component}],panels:{...s.panels,[e]:{...n,state:"minimized",previousState:n.state,lastFloatingRect:o,lastLeafId:t}}}})},[]),he=Y(e=>{y(s=>{let n=s.panels[e];if(!n||n.state!=="minimized")return s;let a=s.minimized.filter(t=>t.id!==e);if((n.previousState||"docked")==="floating"){v.current+=1;let t=_.get(n.component),l=n.lastFloatingRect||t?.defaultOptions?.favoritePosition||{x:300,y:150,width:450,height:350},g=k(l,s.floating);return{...s,minimized:a,floating:[...s.floating,{...g,id:e,z:v.current,stickyRight:!!n.lastFloatingRect?.stickyRight,stickyBottom:!!n.lastFloatingRect?.stickyBottom}],panels:{...s.panels,[e]:{...n,state:"floating"}}}}else{let t=(N,O)=>N.type==="leaf"?N.id===O:N.children.some(F=>t(F,O)),l=n.lastLeafId&&t(s.gridRoot,n.lastLeafId),g=_.get(n.component),P=g?.defaultOptions?.canDrag!==!1;if(l)return{...s,minimized:a,gridRoot:I(s.gridRoot,n.lastLeafId,e),panels:{...s.panels,[e]:{...n,state:"docked"}}};if(P){v.current+=1;let N=n.lastFloatingRect||g?.defaultOptions?.favoritePosition||{x:300,y:150,width:450,height:350},O=k(N,s.floating);return{...s,minimized:a,floating:[...s.floating,{...O,id:e,z:v.current,stickyRight:!!n.lastFloatingRect?.stickyRight,stickyBottom:!!n.lastFloatingRect?.stickyBottom}],panels:{...s.panels,[e]:{...n,state:"floating"}}}}else{let N=S(s.gridRoot)||"group-left-top";return{...s,minimized:a,gridRoot:I(s.gridRoot,N,e),panels:{...s.panels,[e]:{...n,state:"docked"}}}}}})},[k]),ue=Y((e,s)=>{y(n=>{let a=n.panels[e];if(!a||_.get(a.component)?.defaultOptions?.canDrag===!1)return n;let t=_.get(a.component),l=s||t?.defaultOptions?.favoritePosition||{x:300,y:150,width:450,height:350},g=p(n.gridRoot,e);v.current+=1;let P=k(l,n.floating);return{...n,gridRoot:g||{type:"leaf",id:"group-default",panels:[],activePanelId:null},floating:[...n.floating,{...P,id:e,z:v.current}],panels:{...n.panels,[e]:{...a,state:"floating"}}}})},[k]),ae=Y((e,s)=>{y(n=>{let a=n.panels[e];if(!a)return n;let o=n.floating.filter(g=>g.id!==e),t=p(n.gridRoot,e),l=s||S(t||n.gridRoot)||"group-left-top";return{...n,gridRoot:I(t||n.gridRoot,l,e),floating:o,panels:{...n.panels,[e]:{...a,state:"docked"}}}})},[]),ge=(e,s,n,a)=>{if(e.type==="leaf"){if(e.id===s){let o={type:"leaf",id:`group-split-${Date.now()}-${Math.floor(Math.random()*1e3)}`,panels:[n],activePanelId:n};return{type:"branch",orientation:a==="left"||a==="right"?"horizontal":"vertical",sizes:[.5,.5],children:a==="left"||a==="top"?[o,e]:[e,o]}}return e}else return{...e,children:e.children.map(o=>ge(o,s,n,a))}},Q=Y(e=>{y(s=>({...s,draggedPanelId:e}))},[]),fe=Y((e,s,n)=>{y(a=>{let o=a.panels[e];if(!o)return a;let t=a.floating.filter(P=>P.id!==e),l=p(a.gridRoot,e),g;return n==="center"?g=I(l||a.gridRoot,s,e):g=ge(l||a.gridRoot,s,e,n),{...a,gridRoot:g,floating:t,panels:{...a.panels,[e]:{...o,state:"docked"}},draggedPanelId:null}})},[]),q=Y((e,s)=>{y(n=>{let a=n.panels[e];if(!a)return n;let o=n.floating.filter(O=>O.id!==e),t=p(n.gridRoot,e),l={type:"leaf",id:`group-edge-${Date.now()}-${Math.floor(Math.random()*1e3)}`,panels:[e],activePanelId:e},g=s==="left"||s==="right"?"horizontal":"vertical",P=s==="left"||s==="top"?[l,t||n.gridRoot]:[t||n.gridRoot,l];return{...n,gridRoot:{type:"branch",orientation:g,sizes:s==="left"||s==="top"?[.3,.7]:[.7,.3],children:P},floating:o,panels:{...n.panels,[e]:{...a,state:"docked"}},draggedPanelId:null}})},[]),$=Y((e,s,n)=>{y(a=>{let o=a.panels[e];if(!o)return a;let t=p(a.gridRoot,e),l=N=>{if(N.type==="leaf"){if(N.id===s){let O=N.panels.filter(z=>z!==e),F=Math.max(0,Math.min(n,O.length)),R=[...O];return R.splice(F,0,e),{...N,panels:R,activePanelId:e}}return N}else return{...N,children:N.children.map(l)}},g=l(t||a.gridRoot),P=a.floating.filter(N=>N.id!==e);return{...a,gridRoot:g,floating:P,panels:{...a.panels,[e]:{...o,state:"docked"}},draggedPanelId:null}})},[]),Pe=Y(e=>{y(s=>{let n=o=>{if(o.type==="leaf")return o.id===e&&o.canClose!==!1?null:o;{let t=o.children.map(P=>n(P)).filter(P=>P!==null);if(t.length===0)return null;if(t.length===1)return t[0];let l=o.sizes.slice(0,t.length),g=l.reduce((P,N)=>P+N,0);return{...o,children:t,sizes:l.map(P=>P/g)}}},a=n(s.gridRoot);return{...s,gridRoot:a||{type:"leaf",id:"group-default",panels:[],activePanelId:null}}})},[]),Ae=Y(e=>{y(s=>({...s,floating:s.floating.map(n=>n.id===e?{...n,maximized:!n.maximized}:n)}))},[]),$e=Y((e,s)=>{let n=(a,o)=>{if(a.type==="leaf")return a;if(o===e.length)return{...a,sizes:s};let t=e[o],l=a.children.map((g,P)=>P===t?n(g,o+1):g);return{...a,children:l}};y(a=>({...a,gridRoot:n(a.gridRoot,0)}))},[]),Ge=Y((e,s)=>{y(n=>({...n,floating:n.floating.map(a=>a.id===e?{...a,...s}:a)}))},[]),Ye=Y(()=>JSON.stringify({gridRoot:C.gridRoot,floating:C.floating,minimized:C.minimized,panels:C.panels}),[C]),Ee=Y(e=>{try{let s=JSON.parse(e);s.gridRoot&&s.floating&&s.minimized&&s.panels&&y({gridRoot:s.gridRoot,floating:s.floating,minimized:s.minimized,panels:s.panels,draggedPanelId:null,pendingClose:null})}catch(s){console.error("Failed to parse layout configuration:",s)}},[]),ye=at(()=>({openPanel:D,closePanel:A,minimizePanel:se,restorePanel:he,floatPanel:ue,dockPanel:ae,maximizePanel:Ae,updateSplitSizes:$e,updateFloatingPosition:Ge,bringToFront:E,saveLayout:Ye,loadLayout:Ee,publish:x,subscribe:c,setDraggedPanelId:Q,dockPanelToGroup:fe,movePanelOrder:$,closeLeafGroup:Pe,registerCloseGuard:X,unregisterCloseGuard:ie,setPanelDirty:J,updatePanelTitle:V,requestClosePanel:ee,resolvePendingClose:te,dockPanelToWorkspaceEdge:q}),[D,A,se,he,ue,ae,Ae,$e,Ge,E,Ye,Ee,x,c,Q,fe,$,Pe,X,ie,J,V,ee,te,q]),tt=e=>{let s=e.defaultMessage||e.id;return e.values&&Object.entries(e.values).forEach(([n,a])=>{s=s.replace(`{${n}}`,String(a))}),s},nt=at(()=>({modalClass:h,modalBodyClass:T,sidePanelClass:w,sidePanelBodyClass:L,windowClass:W,windowBodyClass:b}),[h,T,w,L,W,b]);return Fe(Ct.Provider,{value:nt,children:Fe(vt.Provider,{value:C,children:Fe(Pt.Provider,{value:ye,children:Fe(xt.Provider,{value:d||tt,children:Fe(wt.Provider,{value:M,children:i})})})})})},Le=()=>{let i=Oe(vt);if(!i)throw new Error("useWindowManagerState must be used within WindowManagerProvider");return i},Ie=()=>{let i=Oe(Pt);if(!i)throw new Error("useWindowManagerActions must be used within WindowManagerProvider");return i},we=()=>Oe(xt)||(d=>{let r=d.defaultMessage||d.id;return d.values&&Object.entries(d.values).forEach(([h,T])=>{r=r.replace(`{${h}}`,String(T))}),r}),G=(i,d)=>i?typeof i=="string"?i:d(i):"",_t=()=>{let{publish:i,subscribe:d}=Ie();return{publish:i,subscribe:d}},qe=()=>Oe(wt);import{JsonContextMenu as on}from"replace-react-contexify";import"replace-react-contexify/styles.css";import{createContext as en,useContext as tn}from"react";var nn={requestClose:()=>{console.warn("FormContainerContract: requestClose called but no container is present")},setDirty:()=>{},onCloseRequested:()=>()=>{},setTitle:()=>{},setIcon:()=>{},containerType:"standalone",instanceId:"standalone",onClose:()=>()=>{},onMinimize:()=>()=>{},onRestore:()=>()=>{},onResize:()=>()=>{}},lt=en(nn),Ne=lt.Provider,dt=()=>tn(lt);import{Fragment as un,jsx as u,jsxs as B}from"react/jsx-runtime";var Be=new Map,Ke="preserved-dom-container",ct=B("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u("rect",{x:"3",y:"3",width:"7",height:"9",rx:"1"}),u("rect",{x:"14",y:"3",width:"7",height:"5",rx:"1"}),u("rect",{x:"14",y:"12",width:"7",height:"9",rx:"1"}),u("rect",{x:"3",y:"16",width:"7",height:"5",rx:"1"})]}),kt=i=>{let d=Be.get(i);return d||(d=document.createElement("div"),d.style.width="100%",d.style.height="100%",Be.set(i,d)),d},sn=(i,d)=>{let r=_.get(d);if(!r)return B("div",{className:"w-100 h-100 d-flex flex-column align-items-center justify-content-center bg-transparent text-danger font-monospace p-3 text-center",style:{border:"2px dashed var(--bs-danger, #dc3545)"},children:[u("h6",{className:"fw-bold mb-1",children:"\u26A0\uFE0F Component Unregistered"}),B("span",{className:"small text-muted",children:["Key: ",d]})]});let h=r.Component;return u(h,{panelId:i})},ut=new Map,Te=new Map,je=i=>{let d=Te.get(i);return d||(d={onClose:new Set,onMinimize:new Set,onRestore:new Set,onResize:new Set},Te.set(i,d)),d},It=({panelId:i})=>{let d=me(null);return de(()=>{let r=d.current;if(!r)return;let h=kt(i);r.appendChild(h);let T=new ResizeObserver(w=>{for(let L of w){let{width:W,height:b}=L.contentRect;if(W>0&&b>0){ut.set(i,{width:W,height:b});let C=Te.get(i);C&&C.onResize.forEach(y=>y(W,b))}}});return T.observe(r),()=>{T.disconnect();let w=document.getElementById(Ke);w||(w=document.createElement("div"),w.id=Ke,w.style.display="none",document.body.appendChild(w)),w.appendChild(h)}},[i]),u("div",{ref:d,className:"w-100 h-100"})},an=({panelId:i})=>{let d=Le(),r=me(null),h=d.panels[i],T=h?_.get(h.component):null,w=T?.defaultOptions?.disableLivePreview||!1,[L,W]=pe({width:800,height:500,scale:.25});if(de(()=>{if(w)return;let b=r.current;if(!b)return;let C=Be.get(i);if(!C)return;let y=ut.get(i)||{width:800,height:500},f=y.width,m=y.height,v=Math.min(220/f,140/m);return W({width:f,height:m,scale:v}),b.appendChild(C),()=>{let c=document.getElementById(Ke);c||(c=document.createElement("div"),c.id=Ke,c.style.display="none",document.body.appendChild(c)),c.appendChild(C)}},[i,w]),w){let b=ut.get(i)||{width:800,height:500},f=Math.min(220/b.width,140/b.height),m=b.width*f,M=b.height*f,H=T?.defaultOptions?.icon||u("span",{children:"\u{1F533}"});return B("div",{className:"taskbar-item-preview-frame d-flex flex-column align-items-center justify-content-center text-muted",style:{width:`${m}px`,height:`${M}px`,background:"linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%)",border:"1px dashed var(--taskbar-item-border, rgba(255, 255, 255, 0.15))"},children:[u("div",{className:"taskbar-preview-placeholder-icon mb-1.5",style:{transform:"scale(1.2)",filter:"drop-shadow(0 0 8px rgba(56, 189, 248, 0.4))"},children:H}),u("div",{style:{fontSize:"9px",fontWeight:500,letterSpacing:"0.5px",opacity:.7,textTransform:"uppercase"},children:"Active Session"})]})}return u("div",{className:"taskbar-item-preview-frame",style:{width:`${L.width*L.scale}px`,height:`${L.height*L.scale}px`},children:u("div",{ref:r,className:"taskbar-item-preview-host",style:{width:`${L.width}px`,height:`${L.height}px`,transform:`scale(${L.scale})`,transformOrigin:"top left",position:"absolute",top:0,left:0}})})},rn=({panelId:i,children:d})=>{let r=Le(),{requestClosePanel:h,setPanelDirty:T,registerCloseGuard:w,unregisterCloseGuard:L,updatePanelTitle:W}=Ie(),b=r.minimized.some(f=>f.id===i),C=me(b);de(()=>{let f=Te.get(i);f&&(b&&!C.current?f.onMinimize.forEach(m=>m()):!b&&C.current&&f.onRestore.forEach(m=>m()),C.current=b)},[b,i]),de(()=>()=>{let f=Te.get(i);f&&(f.onClose.forEach(m=>m()),Te.delete(i))},[i]);let y=Rt.useMemo(()=>({requestClose:f=>h(i,f),setDirty:f=>T(i,f),onCloseRequested:f=>(w(i,f),()=>L(i)),setTitle:f=>W(i,f),instanceId:i,onClose:f=>{let m=je(i);return m.onClose.add(f),()=>m.onClose.delete(f)},onMinimize:f=>{let m=je(i);return m.onMinimize.add(f),()=>m.onMinimize.delete(f)},onRestore:f=>{let m=je(i);return m.onRestore.add(f),()=>m.onRestore.delete(f)},onResize:f=>{let m=je(i);return m.onResize.add(f),()=>m.onResize.delete(f)}}),[i,h,T,w,L,W]);return u(Ne,{value:y,children:d})},Nt=({node:i,path:d,onTabRightClick:r,activeDropZone:h,onHoverDropZone:T,onTabDragStart:w,hoveredTab:L,onTabHover:W,defaultPanelIcon:b})=>{let{updateSplitSizes:C}=Ie();if(i.type==="leaf")return u(ln,{leaf:i,onTabRightClick:r,activeDropZone:h,onHoverDropZone:T,onTabDragStart:w,hoveredTab:L,onTabHover:W,defaultPanelIcon:b});let y=i.orientation==="horizontal",f=(m,M)=>{M.preventDefault();let H=y?M.clientX:M.clientY,v=[...i.sizes],c=M.currentTarget.parentElement,x=c?y?c.clientWidth:c.clientHeight:y?1e3:800,k=p=>{let D=((y?p.clientX:p.clientY)-H)/x,A=[...v];A[m]+=D,A[m+1]-=D,A[m]>.1&&A[m+1]>.1&&C(d,A)},E=()=>{window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",E)};window.addEventListener("mousemove",k),window.addEventListener("mouseup",E)};return u("div",{className:`d-flex w-100 h-100 ${y?"flex-row":"flex-column"}`,style:{overflow:"hidden",position:"relative"},children:i.children.map((m,M)=>{let H=i.sizes[M]*100;return B(Rt.Fragment,{children:[u("div",{style:{flexGrow:i.sizes[M],flexBasis:`${H}%`,overflow:"hidden",position:"relative"},children:u(Nt,{node:m,path:[...d,M],onTabRightClick:r,activeDropZone:h,onHoverDropZone:T,onTabDragStart:w,hoveredTab:L,onTabHover:W,defaultPanelIcon:b})}),M<i.children.length-1&&u("div",{onMouseDown:v=>f(M,v),style:{cursor:y?"col-resize":"row-resize",width:y?"6px":"100%",height:y?"100%":"6px",backgroundColor:"var(--resizer-bg)",zIndex:20,transition:"background-color 0.2s"},className:"resizer-bar hover-highlight"})]},M)})})},ln=({leaf:i,onTabRightClick:d,activeDropZone:r,onHoverDropZone:h,onTabDragStart:T,hoveredTab:w,onTabHover:L,defaultPanelIcon:W})=>{let b=Le(),{requestClosePanel:C,openPanel:y,closeLeafGroup:f}=Ie(),m=we(),M=qe(),{windowClass:H,windowBodyClass:v}=xe(),c=x=>{y(x,b.panels[x].component)};return B("div",{className:`workspace-panel w-100 h-100 d-flex flex-column ${H??""}`,style:{overflow:"hidden",position:"relative"},children:[B("div",{className:"workspace-tab-bar d-flex flex-row justify-content-between align-items-center",style:{minHeight:"38px"},children:[u("div",{className:"d-flex flex-row overflow-x-auto flex-grow-1 tab-headers-container",style:{scrollbarWidth:"none"},onMouseMove:x=>{b.draggedPanelId&&x.target===x.currentTarget&&L(i.id,"EMPTY",i.panels.length,"right")},onMouseLeave:x=>{b.draggedPanelId&&x.target===x.currentTarget&&L(i.id,"",-1,null)},children:i.panels.map((x,k)=>{let E=b.panels[x];if(!E)return null;let p=i.activePanelId===x,S=_.get(E.component)?.defaultOptions,D=w&&w.leafId===i.id&&w.panelId===x,A=k===i.panels.length-1,X=w&&w.leafId===i.id&&w.panelId==="EMPTY"&&A,ie=D?w.side==="left"?"drag-hover-left":"drag-hover-right":X?"drag-hover-right":"";return B("div",{onClick:()=>c(x),onMouseDown:J=>{S?.canDrag!==!1&&T(x,J)},onContextMenu:J=>d(x,J),onMouseMove:J=>{if(b.draggedPanelId){let V=J.currentTarget.getBoundingClientRect(),ee=J.clientX-V.left<V.width/2?"left":"right";L(i.id,x,k,ee)}},onMouseLeave:()=>{b.draggedPanelId&&L(i.id,"",-1,null)},className:`workspace-tab ${p?"active workspace-tab-active":"workspace-tab-inactive"} ${ie}`,style:{cursor:S?.canDrag===!1?"default":"pointer"},children:[B("span",{className:"text-truncate d-flex align-items-center",style:{maxWidth:"120px"},children:[u("span",{className:"workspace-tab-icon",children:S?.icon||W||ct}),B("span",{children:[G(E.title,m),E.dirty?" *":""]})]}),S?.canClose!==!1&&u("span",{onClick:J=>{J.stopPropagation(),C(x)},title:G(M.closeTab,m),className:"close-tab-x ms-auto d-flex align-items-center justify-content-center",style:{width:"18px",height:"18px"},children:u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:u("path",{d:"M18 6L6 18M6 6l12 12"})})})]},x)})}),i.panels.length===0&&i.keepOnEmpty&&i.canClose!==!1&&u("span",{onClick:()=>f(i.id),className:"close-tab-x d-flex align-items-center justify-content-center me-2 header-close-empty-group",style:{width:"18px",height:"18px",cursor:"pointer"},title:G(M.closeEmptyGroup,m),children:u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:u("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),B("div",{className:`flex-grow-1 w-100 h-100 bg-transparent ${v??""}`,style:{position:"relative",overflow:"hidden"},children:[i.activePanelId&&b.panels[i.activePanelId]?u(It,{panelId:i.activePanelId},i.activePanelId):u("div",{className:"w-100 h-100 d-flex align-items-center justify-content-center font-monospace text-muted small empty-leaf-placeholder",children:u("span",{children:"Empty Workspace Section"})}),b.draggedPanelId!==null&&u("div",{className:"dock-drop-zone-overlay",children:B("div",{className:"dock-target-cross",children:[u("div",{onMouseEnter:()=>h(i.id,"top"),onMouseLeave:()=>h(i.id,null),className:"dock-target-box dock-target-top",children:"\u25B2"}),u("div",{onMouseEnter:()=>h(i.id,"bottom"),onMouseLeave:()=>h(i.id,null),className:"dock-target-box dock-target-bottom",children:"\u25BC"}),u("div",{onMouseEnter:()=>h(i.id,"left"),onMouseLeave:()=>h(i.id,null),className:"dock-target-box dock-target-left",children:"\u25C0"}),u("div",{onMouseEnter:()=>h(i.id,"right"),onMouseLeave:()=>h(i.id,null),className:"dock-target-box dock-target-right",children:"\u25B6"}),u("div",{onMouseEnter:()=>h(i.id,"center"),onMouseLeave:()=>h(i.id,null),className:"dock-target-box dock-target-center",children:"\u25A3"})]})}),b.draggedPanelId!==null&&r!==null&&r.leafId===i.id&&u("div",{className:"dock-preview-highlight",style:{left:r.position==="right"?"50%":"0",top:r.position==="bottom"?"50%":"0",width:r.position==="left"||r.position==="right"?"50%":"100%",height:r.position==="top"||r.position==="bottom"?"50%":"100%"}})]})]})},dn=({skin:i="vscode",defaultPanelIcon:d})=>{let r=Le(),{restorePanel:h,minimizePanel:T,requestClosePanel:w,resolvePendingClose:L,maximizePanel:W,updateFloatingPosition:b,bringToFront:C,floatPanel:y,setDraggedPanelId:f,dockPanelToGroup:m,movePanelOrder:M,dockPanelToWorkspaceEdge:H}=Ie(),v=we(),c=qe(),{windowClass:x,windowBodyClass:k}=xe(),[E,p]=pe([]),I=me(null),S=me(null),[D,A]=pe(null),X=me(null),[ie,J]=pe(!1);de(()=>()=>{X.current&&clearTimeout(X.current)},[]);let[V,te]=pe(null),ee=me(null),[se,he]=pe({x:0,y:0}),[ue,ae]=pe(null),ge=me(null),Q=o=>{ae(o),ge.current=o},[fe,q]=pe(null),$=me(null),Pe=(o,t,l,g)=>{let P=g?{leafId:o,panelId:t,index:l,side:g}:null;q(P),$.current=P},Ae=(o,t)=>{let l=t?{leafId:o,position:t}:null;te(l),ee.current=l},$e=(o,t)=>{if(t.button!==0)return;let l=t.clientX,g=t.clientY,P=!1,N=R=>{let z=R.clientX-l,K=R.clientY-g;!P&&(Math.abs(z)>5||Math.abs(K)>5)&&(P=!0,f(o)),P&&he({x:R.clientX,y:R.clientY})},O=R=>{if(window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",F),P){let z=ee.current,K=$.current,j=ge.current;if(j)H(o,j);else if(K){let U=K.index;K.side==="right"&&(U+=1),M(o,K.leafId,U)}else z?m(o,z.leafId,z.position):y(o,{x:R.clientX-150,y:R.clientY-15,width:450,height:350});f(null),te(null),ee.current=null,q(null),$.current=null,Q(null)}},F=R=>{O(R)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",F)},Ge=(o,t)=>{t.preventDefault();let l=r.panels[o];if(!l)return;let P=_.get(l.component)?.defaultOptions,N=[];P?.canDrag!==!1&&N.push({label:G(c.floatWindow,v),action:()=>y(o)}),P?.canMinimize!==!1&&N.push({label:G(c.minimizePanel,v),action:()=>T(o)}),N.length>0&&P?.canClose!==!1&&N.push({separator:!0}),P?.canClose!==!1&&N.push({label:G(c.closeTab,v),action:()=>w(o)}),N.length!==0&&S.current?.show({event:t,contextMenu:{items:N}})},Ye=(o,t)=>{t.preventDefault(),A(null),S.current?.show({event:t,contextMenu:{items:[{label:G(c.restorePanel,v),action:()=>h(o)},{label:G(c.maximizePanel,v),action:()=>W(o)},{separator:!0},{label:G(c.closePanel,v),action:()=>w(o)}]}})};de(()=>{let o=Object.keys(r.panels);p(o);for(let t of Array.from(Be.keys()))o.includes(t)||Be.delete(t)},[r.panels]),de(()=>{let o=()=>{r.draggedPanelId!==null&&(f(null),te(null),q(null))};return window.addEventListener("blur",o),()=>{window.removeEventListener("blur",o)}},[r.draggedPanelId]);let Ee=me(null),[ye,tt]=pe({width:1024,height:768});de(()=>{let o=Ee.current;if(!o)return;let t=new ResizeObserver(l=>{if(!l||l.length===0)return;let g=l[0].contentRect;tt({width:Math.max(100,g.width),height:Math.max(100,g.height)})});return t.observe(o),()=>{t.disconnect()}},[]),de(()=>{let o=ye.width,t=ye.height;r.floating.forEach(l=>{let g=typeof l.width=="string"?parseFloat(l.width):l.width,P=typeof l.height=="string"?parseFloat(l.height):l.height,N=typeof l.x=="string"?parseFloat(l.x):l.x,O=typeof l.y=="string"?parseFloat(l.y):l.y,F=g,R=P,z=N,K=O,j=!1;F>o&&(F=Math.max(200,o-20),j=!0),R>t&&(R=Math.max(150,t-40),j=!0);let U=10;if(l.stickyRight)z=o-F-U,j=!0;else{let Z=o-100;z>Z&&(z=Math.max(0,Z),j=!0)}if(l.stickyBottom)K=t-R-U,j=!0;else{let Z=t-40;K>Z&&(K=Math.max(0,Z),j=!0)}j&&b(l.id,{x:z,y:K,width:F,height:R})})},[ye,r.floating,b]),de(()=>{let o=t=>{if(t.button!==0)return;let l=t.target;if(!l)return;let g=l.closest(".floating-window");if(!g)return;let P=g.getAttribute("data-window-id");P&&C(P)};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[C]);let nt=(o,t)=>{let l=r.floating.find(U=>U.id===o);if(!l||l.maximized)return;C(o);let g=t.clientX,P=t.clientY,O=t.currentTarget.closest(".floating-window"),F=O?O.offsetLeft:0,R=O?O.offsetTop:0,z=!1,K=U=>{let Z=U.clientX-g,re=U.clientY-P;if(!z&&(Math.abs(Z)>5||Math.abs(re)>5)&&(z=!0,f(o)),z){let le=F+Z,be=R+re;b(o,{x:le,y:be,stickyRight:!1,stickyBottom:!1})}},j=()=>{if(z){let U=ee.current,Z=$.current,re=ge.current;if(re)H(o,re);else if(Z){let le=Z.index;Z.side==="right"&&(le+=1),M(o,Z.leafId,le)}else U&&m(o,U.leafId,U.position);f(null),te(null),ee.current=null,q(null),$.current=null,Q(null)}window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",j)};window.addEventListener("mousemove",K),window.addEventListener("mouseup",j)},e=(o,t)=>{t.stopPropagation();let l=r.floating.find(j=>j.id===o);if(!l||l.maximized)return;C(o);let g=t.clientX,P=t.clientY,O=t.currentTarget.closest(".floating-window"),F=O?O.offsetWidth:400,R=O?O.offsetHeight:300,z=j=>{let U=j.clientX-g,Z=j.clientY-P,re=Math.max(200,F+U),le=Math.max(150,R+Z),be=l.x,ke=l.y,ot=ye.width,it=ye.height,Xt=typeof l.x=="string"?parseFloat(l.x):l.x,qt=typeof l.y=="string"?parseFloat(l.y):l.y,jt=typeof l.width=="string"?parseFloat(l.width):l.width,Kt=typeof l.height=="string"?parseFloat(l.height):l.height,yt=Math.abs(Xt+jt-ot)<4,bt=Math.abs(qt+Kt-it)<4;yt&&(be=ot-re,be<0&&(be=0,re=ot)),bt&&(ke=it-le,ke<0&&(ke=0,le=it)),b(o,{x:be,y:ke,width:re,height:le,stickyRight:yt,stickyBottom:bt})},K=()=>{window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",K)};window.addEventListener("mousemove",z),window.addEventListener("mouseup",K)},s=o=>{if(I.current){let t=o==="left"?-150:150;I.current.scrollBy({left:t,behavior:"smooth"})}},[n,a]=pe("dark");return de(()=>{let o=()=>{let l=document.documentElement.getAttribute("data-bs-theme")==="light"?"light":"dark";a(l)};o();let t=new MutationObserver(o);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-bs-theme"]}),()=>t.disconnect()},[]),B("div",{"data-workspace-skin":i,"data-bs-theme":n,className:"d-flex flex-column w-100 h-100 overflow-hidden",style:{userSelect:"none"},children:[B("div",{ref:Ee,className:`flex-grow-1 w-100 position-relative ${r.draggedPanelId?"dragging-active":""}`,style:{overflow:"hidden"},children:[r.draggedPanelId!==null&&B(un,{children:[u("div",{className:"workspace-edge-trigger edge-trigger-left",onMouseEnter:()=>Q("left"),onMouseLeave:()=>Q(null)}),u("div",{className:"workspace-edge-trigger edge-trigger-right",onMouseEnter:()=>Q("right"),onMouseLeave:()=>Q(null)}),u("div",{className:"workspace-edge-trigger edge-trigger-top",onMouseEnter:()=>Q("top"),onMouseLeave:()=>Q(null)}),u("div",{className:"workspace-edge-trigger edge-trigger-bottom",onMouseEnter:()=>Q("bottom"),onMouseLeave:()=>Q(null)})]}),r.draggedPanelId!==null&&ue!==null&&u("div",{className:`workspace-edge-preview edge-preview-${ue}`}),u("div",{className:"w-100 h-100",style:{overflow:"hidden",position:"relative"},children:r.gridRoot?u(Nt,{node:r.gridRoot,path:[],onTabRightClick:Ge,activeDropZone:V,onHoverDropZone:Ae,onTabDragStart:$e,hoveredTab:fe,onTabHover:Pe,defaultPanelIcon:d}):u("div",{className:"w-100 h-100 d-flex align-items-center justify-content-center text-muted font-monospace small",children:"Grid Empty"})}),(()=>{let o=r.floating.length>0?Math.max(...r.floating.map(t=>t.z)):0;return r.floating.map(t=>{let l=r.panels[t.id];if(!l)return null;let g=t.maximized,P=r.draggedPanelId===t.id,N=t.z===o&&r.floating.length>0,F=_.get(l.component)?.defaultOptions;return B("div",{"data-window-id":t.id,className:`floating-window ${g?"maximized":""} ${N?"v2-window-focused":""} ${x??""}`,style:{position:"absolute",left:g?0:typeof t.x=="number"?`${t.x}px`:t.x,top:g?0:typeof t.y=="number"?`${t.y}px`:t.y,width:g?"100%":typeof t.width=="number"?`${t.width}px`:t.width,height:g?"100%":typeof t.height=="number"?`${t.height}px`:t.height,zIndex:t.z,pointerEvents:P?"none":"auto"},children:[B("div",{onDoubleClick:()=>W(t.id),onMouseDown:R=>{F?.canDrag!==!1&&nt(t.id,R)},className:"floating-window-titlebar d-flex flex-row justify-content-between align-items-center cursor-move",style:{cursor:g||F?.canDrag===!1?"default":"move"},children:[B("span",{className:"floating-window-title text-truncate me-2 d-flex align-items-center",children:[u("span",{className:"window-title-icon",children:F?.icon||d||ct}),B("span",{children:[G(l.title,v),l.dirty?" *":""]})]}),B("div",{className:"d-flex align-items-center gap-1.5",onMouseDown:R=>R.stopPropagation(),children:[F?.canDrag!==!1&&u("button",{type:"button",title:G(c.windowAnchoringOptions,v),onClick:R=>{let z=!!t.stickyRight,K=!!t.stickyBottom;S.current?.show({event:R,contextMenu:{items:[{label:G(c.anchorToRightEdge,v),checkbox:{active:!0,enabled:!0,value:z},action:()=>{let j=ye.width,U=typeof t.width=="string"?parseFloat(t.width):t.width;z?b(t.id,{stickyRight:!1}):b(t.id,{x:j-U-10,stickyRight:!0})}},{label:G(c.anchorToBottomEdge,v),checkbox:{active:!0,enabled:!0,value:K},action:()=>{let j=ye.height,U=typeof t.height=="string"?parseFloat(t.height):t.height;K?b(t.id,{stickyBottom:!1}):b(t.id,{y:j-U-10,stickyBottom:!0})}}]}})},className:"custom-tab-btn btn-anchor-tab",children:B("svg",{className:`anchor-icon ${t.stickyRight&&t.stickyBottom?"anchor-sticky-both":t.stickyRight?"anchor-sticky-right":t.stickyBottom?"anchor-sticky-bottom":""}`,width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[u("circle",{cx:"12",cy:"5",r:"2"}),u("path",{d:"M12 7v7m0 0a4 4 0 0 1-4-4M12 14a4 4 0 0 0 4-4M5 18h14"})]})}),F?.canMinimize!==!1&&u("button",{type:"button",title:G(c.minimize,v),onClick:()=>T(t.id),className:"custom-tab-btn",children:u("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:u("path",{d:"M5 12h14"})})}),u("button",{type:"button",title:g?G(c.restoreSize,v):G(c.maximize,v),onClick:()=>W(t.id),className:"custom-tab-btn",children:u("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:u("rect",{x:"4",y:"4",width:"16",height:"16",rx:"1.5"})})}),F?.canClose!==!1&&u("button",{type:"button",title:G(c.close,v),onClick:()=>w(t.id),className:"custom-tab-btn btn-close-tab",children:u("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:u("path",{d:"M18 6L6 18M6 6l12 12"})})})]})]}),u("div",{className:`flex-grow-1 w-100 overflow-hidden ${k??""}`,style:{position:"relative"},children:u(It,{panelId:t.id},t.id)}),!g&&u("div",{onMouseDown:R=>e(t.id,R),style:{position:"absolute",right:0,bottom:0,width:"14px",height:"14px",cursor:"se-resize",zIndex:30,background:"linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.2) 50%)"}})]},t.id)})})()]}),r.minimized.length>0&&B("div",{className:"flex-shrink-0 w-100 d-flex flex-row align-items-center taskbar-footer-container px-3 py-1.5 justify-content-center",style:{height:"48px",zIndex:100},children:[u("button",{type:"button",onClick:()=>s("left"),className:"btn btn-sm btn-link taskbar-nav-btn text-decoration-none py-0 font-monospace",style:{display:r.minimized.length>4?"block":"none"},children:"\u25C0"}),u("div",{ref:I,className:"d-flex flex-row gap-2 overflow-x-auto align-items-center mx-2 px-1 py-0.5 scrollbar-hidden",style:{maxWidth:"800px",scrollbarWidth:"none",scrollSnapType:"x mandatory"},children:r.minimized.map(o=>{let l=_.get(o.component)?.defaultOptions?.icon||d||ct;return u("div",{onClick:()=>h(o.id),onContextMenu:g=>Ye(o.id,g),onMouseEnter:g=>{if(ie)return;X.current&&clearTimeout(X.current);let P=g.currentTarget.getBoundingClientRect();A({id:o.id,rect:P,title:o.title,component:o.component})},onMouseLeave:()=>{X.current=setTimeout(()=>{A(null)},150)},className:"taskbar-glassmorphic-item rounded d-flex align-items-center justify-content-center cursor-pointer hover-elevate",style:{backdropFilter:"blur(6px)",transition:"all 0.2s",cursor:"pointer",scrollSnapAlign:"start",width:"38px",height:"38px",position:"relative",padding:0},children:u("span",{className:"taskbar-item-icon d-flex align-items-center justify-content-center",children:l})},o.id)})}),D&&Mt(B("div",{className:"taskbar-item-tooltip d-flex flex-column gap-1",style:{position:"fixed",left:`${D.rect.left+D.rect.width/2}px`,top:`${D.rect.top-8}px`,transform:"translateX(-50%) translateY(-100%)",opacity:1,pointerEvents:"auto",zIndex:999999},onMouseEnter:()=>{X.current&&clearTimeout(X.current)},onMouseLeave:()=>{A(null)},children:[B("div",{className:"d-flex flex-row align-items-center justify-content-between w-100 gap-3 px-1 py-0.5",children:[B("span",{className:"tooltip-title-text text-truncate",style:{maxWidth:"140px"},children:[G(D.title,v),r.panels[D.id]?.dirty?" *":""]}),u("span",{onClick:o=>{o.stopPropagation(),w(D.id),A(null)},title:G(c.closePanel,v),className:"tooltip-close-x d-flex align-items-center justify-content-center",children:u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:u("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),u(an,{panelId:D.id})]}),document.body),u("button",{type:"button",onClick:()=>s("right"),className:"btn btn-sm btn-link taskbar-nav-btn text-decoration-none py-0 font-monospace",style:{display:r.minimized.length>4?"block":"none"},children:"\u25B6"})]}),E.map(o=>{let t=r.panels[o];if(!t)return null;let l=kt(o);return Mt(u(rn,{panelId:o,children:u("div",{style:{width:"100%",height:"100%"},children:sn(o,t.component)})}),l,o)}),u(on,{ref:S,id:"workspace-context-menu",theme:"dark",onShow:()=>J(!0),onHide:()=>J(!1)}),r.draggedPanelId!==null&&!r.floating.some(o=>o.id===r.draggedPanelId)&&B("div",{className:"position-fixed bg-black bg-opacity-80 border border-info rounded text-info font-monospace px-3 py-1.5 shadow-lg d-flex align-items-center gap-2",style:{left:se.x+12,top:se.y+12,zIndex:1e5,pointerEvents:"none",fontSize:"0.75rem",boxShadow:"0 8px 24px rgba(0,0,0,0.5)",borderLeft:"3px solid var(--accent-color)",whiteSpace:"nowrap"},children:["\u{1F4C4} ",G(r.panels[r.draggedPanelId]?.title,v)||"Tab"]}),r.pendingClose&&(()=>{let o=r.panels[r.pendingClose.id],t=o?G(o.title,v):"Panel";return u("div",{className:"close-warning-overlay",children:B("div",{className:"close-warning-modal",children:[B("div",{className:"close-warning-header",children:[u("div",{className:"close-warning-icon",children:"\u26A0\uFE0F"}),u("h5",{className:"close-warning-title",children:"Unsaved Changes"})]}),B("p",{className:"close-warning-message",children:['"',t,'" has unsaved changes. Do you want to discard your changes and close the panel?']}),B("div",{className:"close-warning-footer",children:[u("button",{type:"button",className:"btn-warning-action btn-warning-cancel",onClick:()=>L(!1),children:"Cancel"}),u("button",{type:"button",className:"btn-warning-action btn-warning-discard",onClick:()=>L(!0),children:"Discard Changes"})]})]})})})()]})},cn=dn;import{createContext as Lt,useContext as Tt,useState as gn,useCallback as ce,useMemo as fn,useRef as pn}from"react";import{jsx as zt}from"react/jsx-runtime";var mn=0,gt=()=>`panel-${++mn}-${Date.now()}`,Ue=new Map,St={leftPanel:null,rightPanel:null,modals:[]},Et=Lt(null),Wt=Lt(null),hn=({children:i})=>{let[d,r]=gn(St),h=pn(d);h.current=d;let T=ce((c,x)=>{Ue.set(c,x)},[]),w=ce(c=>{Ue.delete(c)},[]),L=ce(async(c,x,k={})=>{let E=h.current.leftPanel;if(E){let S=Ue.get(E.id);if(S&&!await S())return null}let p=gt(),I={id:p,Component:c,props:x,containerType:"left-panel",options:k};return r(S=>({...S,leftPanel:I})),p},[]),W=ce(async(c,x,k={})=>{let E=h.current.rightPanel;if(E){let S=Ue.get(E.id);if(S&&!await S())return null}let p=gt(),I={id:p,Component:c,props:x,containerType:"right-panel",options:k};return r(S=>({...S,rightPanel:I})),p},[]),b=ce((c,x,k={})=>{let E=gt(),p=x.title,I={...k,title:k.title||p||"Confirmation"},S={id:E,Component:c,props:x,containerType:"modal",options:I};return r(D=>({...D,modals:[...D.modals,S]})),E},[]),C=ce(c=>{r(x=>({leftPanel:x.leftPanel?.id===c?null:x.leftPanel,rightPanel:x.rightPanel?.id===c?null:x.rightPanel,modals:x.modals.filter(k=>k.id!==c)}))},[]),y=ce(()=>{r(St)},[]),f=ce(()=>{r(c=>({...c,modals:[]}))},[]),m=ce(c=>d.leftPanel?.id===c?d.leftPanel:d.rightPanel?.id===c?d.rightPanel:d.modals.find(x=>x.id===c),[d]),M=ce((c,x)=>{r(k=>({leftPanel:k.leftPanel?.id===c?{...k.leftPanel,...x}:k.leftPanel,rightPanel:k.rightPanel?.id===c?{...k.rightPanel,...x}:k.rightPanel,modals:k.modals.map(E=>E.id===c?{...E,...x}:E)}))},[]),H=ce((c,x)=>{M(c,{dirty:x})},[M]),v=fn(()=>({openLeftPanel:L,openRightPanel:W,openModal:b,close:C,closeAll:y,closeAllModals:f,getInstance:m,updateInstance:M,setDirty:H,registerCloseHandler:T,unregisterCloseHandler:w}),[L,W,b,C,y,f,m,M,H,T,w]);return zt(Et.Provider,{value:d,children:zt(Wt.Provider,{value:v,children:i})})},Ce=()=>{let i=Tt(Et);if(!i)throw new Error("usePanelState must be used within PanelProvider");return i},He=()=>{let i=Tt(Wt);if(!i)throw new Error("usePanelActions must be used within PanelProvider");return i};import{useCallback as Me,useRef as pt,useEffect as bn,useState as Dt,useMemo as vn}from"react";import{useEffect as Ft,useRef as yn}from"react";import{jsx as Se,jsxs as ft}from"react/jsx-runtime";var Je=({zIndex:i,onDiscard:d,onCancel:r,message:h,title:T})=>{let w=yn(null);return Ft(()=>{let C=setTimeout(()=>{w.current?.focus()},50);return()=>clearTimeout(C)},[]),Ft(()=>{let C=y=>{y.key==="Escape"&&(y.stopPropagation(),y.preventDefault(),r())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[r]),Se("div",{className:"close-warning-overlay",style:{zIndex:i},children:ft("div",{className:"close-warning-modal",children:[ft("div",{className:"close-warning-header",children:[Se("div",{className:"close-warning-icon",children:"\u26A0\uFE0F"}),Se("h5",{className:"close-warning-title",children:T||"Unsaved Changes"})]}),Se("p",{className:"close-warning-message",children:h||"You have unsaved changes that will be lost."}),Se("p",{className:"close-warning-message",style:{fontWeight:500,margin:0},children:"Do you want to discard your changes and close?"}),ft("div",{className:"close-warning-footer",children:[Se("button",{type:"button",className:"btn-warning-action btn-warning-cancel",onClick:r,ref:w,children:"Cancel"}),Se("button",{type:"button",className:"btn-warning-action btn-warning-discard",onClick:d,children:"Discard Changes"})]})]})})};import{Fragment as Ot,jsx as oe,jsxs as Ze}from"react/jsx-runtime";var Pn=({modal:i,index:d,isTopmost:r})=>{let{close:h,updateInstance:T,setDirty:w}=He(),L=we(),{modalClass:W,modalBodyClass:b}=xe(),C=pt(null),[y,f]=Dt(!1),m=pt(null),{id:M,Component:H,props:v,options:c,dirty:x}=i,k=c,[E,p]=Dt(k.icon||null),I=pt(k);I.current=k;let S=Me(()=>new Promise(q=>{m.current=q,f(!0)}),[]),D=Me(()=>{m.current?.(!0),m.current=null,f(!1)},[]),A=Me(()=>{m.current?.(!1),m.current=null,f(!1)},[]),X=Me(async q=>{if(q?.force){h(M);return}if(C.current){if(!await C.current())return;h(M);return}x&&!await S()||h(M)},[h,M,x,S]),ie=Me(q=>w(M,q),[w,M]),J=Me(q=>T(M,{options:{...I.current,title:q}}),[T,M]),V=Me(q=>p(q),[]),te=Me(q=>(C.current=q,()=>{C.current=null}),[]),ee=vn(()=>({requestClose:X,setDirty:ie,setTitle:J,setIcon:V,onCloseRequested:te,containerType:"modal",instanceId:M}),[X,ie,J,V,te,M]),se=G(k.title,L),he=x?`${se} *`:se,ue=k.size?`v2-modal-size-${k.size}`:"v2-modal-size-auto",ae=k.closable!==!1;bn(()=>{if(!r||!ae||y)return;let q=$=>{$.key==="Escape"&&($.stopPropagation(),X())};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[X,ae,r,y]);let Q=1e4+d*10,fe=Q+5;return Ze(Ot,{children:[Ze("div",{className:"v2-modal-overlay",style:{zIndex:Q},children:[oe("div",{className:"v2-modal-curtain",onClick:ae?()=>X():void 0}),Ze("div",{className:`v2-modal-window ${ue} ${W??""}`,children:[Ze("div",{className:"v2-modal-header",children:[E&&oe("div",{className:"v2-modal-icon",children:E}),oe("h4",{className:"v2-modal-title",children:he}),ae&&oe("button",{className:"v2-modal-close-button",onClick:()=>X(),title:"Close",type:"button",children:oe("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:oe("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),oe("div",{className:`v2-modal-body ${b??""}`,children:oe(Ne,{value:ee,children:oe(H,{...v,panelId:M})})})]})]}),y&&oe(Je,{zIndex:fe,onDiscard:D,onCancel:A})]})},xn=()=>{let{modals:i}=Ce();return i.length===0?null:oe(Ot,{children:i.map((d,r)=>oe(Pn,{modal:d,index:r,isTopmost:r===i.length-1},d.id))})},wn=xn;import{useCallback as ve,useRef as mt,useEffect as Bt,useState as Ht,useMemo as Cn}from"react";import{Fragment as At,jsx as ne,jsxs as Qe}from"react/jsx-runtime";var Ve=({panel:i,position:d,defaultWidth:r})=>{let{close:h,updateInstance:T,setDirty:w,registerCloseHandler:L,unregisterCloseHandler:W}=He(),{modals:b}=Ce(),C=we(),{sidePanelClass:y,sidePanelBodyClass:f}=xe(),m=mt(null),[M,H]=Ht(!1),v=mt(null),{id:c,Component:x,props:k,options:E,dirty:p}=i,I=E,[S,D]=Ht(I.icon||null),A=mt(I);A.current=I;let X=ve(()=>new Promise($=>{v.current=$,H(!0)}),[]),ie=ve(()=>{v.current?.(!0),v.current=null,H(!1)},[]),J=ve(()=>{v.current?.(!1),v.current=null,H(!1)},[]),V=ve(async $=>{if($?.force){h(c);return}if(m.current){if(!await m.current())return;h(c);return}p&&!await X()||h(c)},[h,c,p,X]),te=ve(async()=>m.current?await m.current():!p,[p]);Bt(()=>(L(c,te),()=>W(c)),[c,te,L,W]);let ee=ve($=>w(c,$),[w,c]),se=ve($=>T(c,{options:{...A.current,title:$}}),[T,c]),he=ve($=>D($),[]),ue=ve($=>(m.current=$,()=>{m.current=null}),[]),ae=Cn(()=>({requestClose:V,setDirty:ee,setTitle:se,setIcon:he,onCloseRequested:ue,containerType:d==="left"?"left-panel":"right-panel",instanceId:c}),[V,ee,se,he,ue,d,c]),ge=G(I.title,C),Q=p?`${ge} *`:ge;Bt(()=>{let $=Pe=>{Pe.key==="Escape"&&b.length===0&&!M&&V()};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[V,b.length,M]);let fe=I.width||r||400,q=typeof fe=="number"?`${fe}px`:fe;return Qe(At,{children:[ne("div",{className:`v2-side-panel v2-side-panel-${d} v2-side-panel-visible ${y??""}`,style:{width:q},children:Qe("div",{className:"v2-side-panel-window",children:[Qe("div",{className:"v2-side-panel-header",children:[S&&ne("div",{className:"v2-side-panel-icon",children:S}),ne("h4",{className:"v2-side-panel-title",children:Q}),ne("button",{className:"v2-side-panel-close-button",onClick:()=>V(),title:"Close",type:"button",children:ne("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:ne("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),ne("div",{className:`v2-side-panel-body ${f??""}`,children:ne(Ne,{value:ae,children:ne(x,{...k,panelId:c})})})]})}),M&&ne(Je,{zIndex:2e4,onDiscard:ie,onCancel:J})]})},Mn=({defaultWidth:i})=>{let{leftPanel:d,rightPanel:r}=Ce();return Qe(At,{children:[d&&ne(Ve,{panel:d,position:"left",defaultWidth:i},d.id),r&&ne(Ve,{panel:r,position:"right",defaultWidth:i},r.id)]})},Rn=({defaultWidth:i})=>{let{leftPanel:d}=Ce();return d?ne(Ve,{panel:d,position:"left",defaultWidth:i},d.id):null},kn=({defaultWidth:i})=>{let{rightPanel:d}=Ce();return d?ne(Ve,{panel:d,position:"right",defaultWidth:i},d.id):null},In=Mn;import{useEffect as $t,useRef as Nn}from"react";import{jsx as ze,jsxs as ht}from"react/jsx-runtime";var Sn=({title:i,message:d,alert:r,alertType:h="info",useYesNoTitles:T=!1,onOK:w,onCancel:L})=>{let{requestClose:W,setIcon:b,setTitle:C}=dt(),y=Nn(null);$t(()=>{if(i){let c=typeof i=="string"?i:i.defaultMessage||i.id;C(c)}b&&b(ze("span",{children:"\u2753"}))},[i,C,b]),$t(()=>{y.current?.focus()},[]);let f=typeof d=="string"?d:d.defaultMessage||d.id,m=T?"No":"Cancel",M=T?"Yes":"OK",H=c=>{c.preventDefault(),w?.(),W()},v=()=>{L?.(),W()};return ht("form",{onSubmit:H,className:"p-3 d-flex flex-column gap-3",children:[r&&ht("div",{className:`alert alert-${h==="danger"?"danger":h} d-flex align-items-center gap-2 m-0 p-2.5 small`,children:[ze("span",{children:"\u2139\uFE0F"}),ze("span",{children:r})]}),ze("div",{style:{fontSize:"0.9rem",color:"inherit",lineHeight:1.5},children:f}),ze("hr",{className:"my-2 opacity-10"}),ht("div",{className:"d-flex justify-content-end gap-2",children:[ze("button",{type:"button",className:"btn btn-sm btn-outline-secondary font-monospace",onClick:v,children:m}),ze("button",{type:"submit",className:"btn btn-sm btn-primary font-monospace",ref:y,children:M})]})]})},zn=Sn;import{useState as Gt,useEffect as _e,useRef as Ln,useCallback as Yt,useImperativeHandle as Tn,forwardRef as En}from"react";import{Fragment as Fn,jsx as Re,jsxs as et}from"react/jsx-runtime";var Wn=En(function({position:d="right",tabs:r,drawerWidth:h="220px",activeTabId:T,onActiveTabChange:w,children:L},W){let b=T!==void 0,[C,y]=Gt(null),f=b?T:C,[m,M]=Gt(()=>{let p=new Set;for(let I of r)I.eagerMount&&p.add(I.id);return p});_e(()=>{let p=r.filter(I=>I.eagerMount&&!m.has(I.id));p.length>0&&M(I=>{let S=new Set(I);for(let D of p)S.add(D.id);return S})},[r]);let H=Ln(f??null);_e(()=>{H.current=f??null},[f]);let v=Yt(p=>{b||y(p),w?.(p)},[b,w]);Tn(W,()=>({openTab:p=>v(p),closeDrawer:()=>v(null),getActiveTab:()=>H.current}),[v]);let c=p=>{v(f===p?null:p)},x=Yt(()=>v(null),[v]);_e(()=>{f&&!m.has(f)&&M(p=>{let I=new Set(p);return I.add(f),I})},[f,m]),_e(()=>{f===null&&M(p=>{let I=!1,S=new Set(p);for(let D of p){let A=r.find(X=>X.id===D);A&&!A.eagerMount&&!A.preserveState&&(S.delete(D),I=!0)}return I?S:p})},[f,r]);let k=Re("div",{className:`sidebar-tabs-strip ${d}`,style:{width:"56px",height:"100%"},children:r.map(p=>{let I=f===p.id;return Re("button",{type:"button",onClick:()=>c(p.id),className:`sidebar-tab-btn ${I?"active":""}`,title:p.label,"aria-pressed":I,children:p.icon},p.id)})}),E=Re("div",{className:`sidebar-content-drawer h-100 ${d}`,style:{width:f?h:"0px",minWidth:f?h:"0px",overflow:"hidden",flexShrink:0},children:r.map(p=>{if(!m.has(p.id))return null;let S=f===p.id,D=()=>v(p.id);return et("div",{style:{display:S?"flex":"none",flexDirection:"column",height:"100%",width:"100%"},children:[et("div",{className:"d-flex align-items-center justify-content-between border-bottom border-secondary-subtle px-3 py-2 flex-shrink-0",style:{background:"rgba(0,0,0,0.08)",minHeight:"38px"},children:[Re("span",{className:"sidebar-header-title",children:p.label}),Re("button",{type:"button",onClick:x,className:"btn btn-link p-0 text-secondary d-flex align-items-center",style:{textDecoration:"none"},title:"Close panel","aria-label":"Close panel",children:et("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Re("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Re("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),Re("div",{className:"flex-grow-1 overflow-auto",children:p.renderContent(p.id,x,D)})]},p.id)})});return et(Fn,{children:[d==="left"&&k,d==="left"&&E,L,d==="right"&&E,d==="right"&&k]})});export{zn as ConfirmationForm,lt as FormContainerContext,Ne as FormContainerProvider,Rn as LeftPanelRenderer,wn as ModalStackRenderer,hn as PanelProvider,_ as PanelRegistry,kn as RightPanelRenderer,In as SidePanelRenderer,Wn as Sidebar,cn as WindowManager,Vt as WindowManagerProvider,We as defaultPredefinedMessages,G as formatLabel,dt as useFormContainer,we as useFormatMessage,He as usePanelActions,_t as usePanelContext,Ce as usePanelState,qe as usePredefinedMessages,xe as useStyleClasses,Ie as useWindowManagerActions,Le as useWindowManagerState};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|