react-dockable-desktop 1.3.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -301
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +293 -67
- package/dist/index.d.ts +293 -67
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React__default, { ComponentType, ReactNode } from 'react';
|
|
1
|
+
import React$1, { ComponentType, Context, Provider, ReactNode } from 'react';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* @file WindowManager.tsx
|
|
@@ -10,9 +9,9 @@ import React__default, { ComponentType, ReactNode } from 'react';
|
|
|
10
9
|
|
|
11
10
|
interface WindowManagerProps {
|
|
12
11
|
skin?: string;
|
|
13
|
-
defaultPanelIcon?:
|
|
12
|
+
defaultPanelIcon?: React$1.ReactNode;
|
|
14
13
|
}
|
|
15
|
-
declare const WindowManager:
|
|
14
|
+
declare const WindowManager: React$1.FC<WindowManagerProps>;
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Represents a registered component configuration template inside the panel catalog registry.
|
|
@@ -90,7 +89,7 @@ declare const PanelRegistry: PanelRegistryClass;
|
|
|
90
89
|
* define in their IntlProvider messages table. The `defaultMessage` is used
|
|
91
90
|
* as a fallback when no external formatter is provided.
|
|
92
91
|
*
|
|
93
|
-
* Pass a partial or full override to
|
|
92
|
+
* Pass a partial or full override to `<WindowManagerProvider predefinedMessages={…} />`
|
|
94
93
|
* to customise labels without replacing the whole table.
|
|
95
94
|
*/
|
|
96
95
|
declare const defaultPredefinedMessages: {
|
|
@@ -249,6 +248,15 @@ interface ContextMenuPredefinedMessage {
|
|
|
249
248
|
type MessageFormatter = (msg: ContextMenuPredefinedMessage) => string;
|
|
250
249
|
/** Orientation modifier indicating split directions. */
|
|
251
250
|
type SplitOrientation = 'horizontal' | 'vertical';
|
|
251
|
+
/** The four cardinal directions a panel can be docked relative to another. */
|
|
252
|
+
type SplitDirection = 'left' | 'right' | 'top' | 'bottom';
|
|
253
|
+
/** All possible drop positions — cardinal directions plus center (same group). */
|
|
254
|
+
type DropPosition = SplitDirection | 'center';
|
|
255
|
+
/** The target leaf and position for a drag-and-drop dock operation. */
|
|
256
|
+
interface DropTarget {
|
|
257
|
+
leafId: string;
|
|
258
|
+
position: DropPosition;
|
|
259
|
+
}
|
|
252
260
|
/**
|
|
253
261
|
* Grid layout branch node containing nested splits and relative flex sizes.
|
|
254
262
|
*/
|
|
@@ -358,73 +366,222 @@ interface WindowState {
|
|
|
358
366
|
isRtl: boolean;
|
|
359
367
|
}
|
|
360
368
|
/**
|
|
361
|
-
*
|
|
369
|
+
* All layout mutation methods, event bus handles, and serialization methods
|
|
370
|
+
* exposed by the `WindowManagerProvider`.
|
|
371
|
+
*
|
|
372
|
+
* Obtain this object via {@link useWindowManagerActions} inside a component,
|
|
373
|
+
* or via {@link WorkspaceClient} methods from outside the React tree.
|
|
374
|
+
*
|
|
375
|
+
* @group Hooks
|
|
376
|
+
* @example
|
|
377
|
+
* ```tsx
|
|
378
|
+
* function MyToolbar() {
|
|
379
|
+
* const actions = useWindowManagerActions();
|
|
380
|
+
* return <button onClick={() => actions.openPanel('map-1', 'map')}>Open Map</button>;
|
|
381
|
+
* }
|
|
382
|
+
* ```
|
|
362
383
|
*/
|
|
363
384
|
interface WindowActions {
|
|
364
|
-
/**
|
|
385
|
+
/**
|
|
386
|
+
* Opens a registered panel into the workspace.
|
|
387
|
+
* If the panel ID is already open, the panel is focused instead of duplicated.
|
|
388
|
+
* @param id - Unique instance identifier for this panel.
|
|
389
|
+
* @param component - Component key registered in the panel catalog.
|
|
390
|
+
* @param options - Optional display and placement overrides.
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* actions.openPanel('map-1', 'map', { title: 'Satellite View', initialTarget: 'floating' });
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
365
396
|
openPanel: (id: string, component: string, options?: {
|
|
366
397
|
title?: string | ContextMenuPredefinedMessage;
|
|
367
398
|
initialTarget?: 'floating' | 'docked' | 'tabbed';
|
|
368
399
|
stickyRight?: boolean;
|
|
369
400
|
stickyBottom?: boolean;
|
|
370
401
|
}) => void;
|
|
371
|
-
/**
|
|
402
|
+
/**
|
|
403
|
+
* Closes a panel immediately, bypassing dirty-state close guards.
|
|
404
|
+
* For guarded close, use {@link requestClosePanel}.
|
|
405
|
+
* @param id - Panel instance ID.
|
|
406
|
+
*/
|
|
372
407
|
closePanel: (id: string) => void;
|
|
373
|
-
/**
|
|
408
|
+
/**
|
|
409
|
+
* Minimizes a panel to the bottom taskbar dock, preserving its layout position.
|
|
410
|
+
* @param id - Panel instance ID.
|
|
411
|
+
*/
|
|
374
412
|
minimizePanel: (id: string) => void;
|
|
375
|
-
/**
|
|
413
|
+
/**
|
|
414
|
+
* Restores a minimized panel back to its last docked or floating position.
|
|
415
|
+
* @param id - Panel instance ID.
|
|
416
|
+
*/
|
|
376
417
|
restorePanel: (id: string) => void;
|
|
377
|
-
/**
|
|
418
|
+
/**
|
|
419
|
+
* Detaches a docked panel, converting it to a resizable floating window.
|
|
420
|
+
* @param id - Panel instance ID.
|
|
421
|
+
* @param rect - Optional initial position and size for the floating window.
|
|
422
|
+
*/
|
|
378
423
|
floatPanel: (id: string, rect?: {
|
|
379
424
|
x: number;
|
|
380
425
|
y: number;
|
|
381
426
|
width: number;
|
|
382
427
|
height: number;
|
|
383
428
|
}) => void;
|
|
384
|
-
/**
|
|
429
|
+
/**
|
|
430
|
+
* Returns a floating window to a docked grid tab group.
|
|
431
|
+
* @param id - Panel instance ID.
|
|
432
|
+
* @param targetLeafId - Target leaf group ID. Defaults to the panel's last leaf.
|
|
433
|
+
*/
|
|
385
434
|
dockPanel: (id: string, targetLeafId?: string) => void;
|
|
386
|
-
/**
|
|
435
|
+
/**
|
|
436
|
+
* Maximizes a floating window to cover the entire workspace viewport.
|
|
437
|
+
* @param id - Panel instance ID.
|
|
438
|
+
*/
|
|
387
439
|
maximizePanel: (id: string) => void;
|
|
388
|
-
/**
|
|
440
|
+
/**
|
|
441
|
+
* Resizes the flex split proportions of a branch node's children.
|
|
442
|
+
* @param path - Index path from root to the branch node.
|
|
443
|
+
* @param sizes - New proportional sizes (must sum to 1.0).
|
|
444
|
+
*/
|
|
389
445
|
updateSplitSizes: (path: number[], sizes: number[]) => void;
|
|
390
|
-
/**
|
|
446
|
+
/**
|
|
447
|
+
* Updates the position or size of a floating window.
|
|
448
|
+
* @param id - Panel instance ID.
|
|
449
|
+
* @param updates - Partial update to `x`, `y`, `width`, `height`, `stickyRight`, or `stickyBottom`.
|
|
450
|
+
*/
|
|
391
451
|
updateFloatingPosition: (id: string, updates: Partial<Pick<FloatingWindow, 'x' | 'y' | 'width' | 'height' | 'stickyRight' | 'stickyBottom'>>) => void;
|
|
392
|
-
/**
|
|
393
|
-
|
|
394
|
-
|
|
452
|
+
/**
|
|
453
|
+
* Activates the given panel regardless of its current state.
|
|
454
|
+
* - Floating panel: raises z-index so the window appears on top of others.
|
|
455
|
+
* - Docked panel: selects the tab within its leaf group.
|
|
456
|
+
* @param id - Panel instance ID.
|
|
457
|
+
* @example
|
|
458
|
+
* ```ts
|
|
459
|
+
* // Ensure a panel is visible before updating its content:
|
|
460
|
+
* if (actions.isOpen('map-1')) actions.focusPanel('map-1');
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
focusPanel: (id: string) => void;
|
|
464
|
+
/**
|
|
465
|
+
* Returns `true` if a panel with the given ID is currently open (docked, floating, or minimized).
|
|
466
|
+
* Uses a synchronous `stateRef` read — safe to call outside of render.
|
|
467
|
+
* @param id - Panel instance ID.
|
|
468
|
+
* @returns `true` if the panel is open.
|
|
469
|
+
* @example
|
|
470
|
+
* ```ts
|
|
471
|
+
* if (!actions.isOpen('map-1')) {
|
|
472
|
+
* actions.openPanel('map-1', 'map');
|
|
473
|
+
* } else {
|
|
474
|
+
* actions.focusPanel('map-1');
|
|
475
|
+
* }
|
|
476
|
+
* ```
|
|
477
|
+
*/
|
|
478
|
+
isOpen: (id: string) => boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Returns the IDs of all currently open panels (docked, floating, and minimized).
|
|
481
|
+
* Uses a synchronous `stateRef` read — safe to call outside of render.
|
|
482
|
+
* @returns Array of panel instance IDs.
|
|
483
|
+
*/
|
|
484
|
+
getOpenPanelIds: () => string[];
|
|
485
|
+
/**
|
|
486
|
+
* Serializes the entire workspace state to a JSON string.
|
|
487
|
+
* Includes grid layout, floating window positions, minimized panels, and panel metadata.
|
|
488
|
+
* @returns JSON string suitable for storage and later restoration via {@link loadLayout}.
|
|
489
|
+
* @example
|
|
490
|
+
* ```ts
|
|
491
|
+
* localStorage.setItem('layout', actions.saveLayout());
|
|
492
|
+
* ```
|
|
493
|
+
*/
|
|
395
494
|
saveLayout: () => string;
|
|
396
|
-
/**
|
|
397
|
-
|
|
398
|
-
|
|
495
|
+
/**
|
|
496
|
+
* Restores a previously serialized workspace from a JSON string.
|
|
497
|
+
* Replaces the entire current layout — all panels not in the snapshot are closed.
|
|
498
|
+
* @param layoutJson - JSON string produced by {@link saveLayout}.
|
|
499
|
+
* @returns `true` if the layout was successfully parsed and applied, `false` otherwise.
|
|
500
|
+
*/
|
|
501
|
+
loadLayout: (layoutJson: string) => boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Publishes an event to the inter-panel pub/sub event bus.
|
|
504
|
+
* @param event - Event name string.
|
|
505
|
+
* @param data - Arbitrary payload passed to all subscribers.
|
|
506
|
+
*/
|
|
399
507
|
publish: (event: string, data: any) => void;
|
|
400
|
-
/**
|
|
508
|
+
/**
|
|
509
|
+
* Subscribes a callback to the inter-panel pub/sub event bus.
|
|
510
|
+
* @param event - Event name string.
|
|
511
|
+
* @param callback - Function called with the event payload.
|
|
512
|
+
* @returns Unsubscribe function — call it to remove the listener.
|
|
513
|
+
* @example
|
|
514
|
+
* ```ts
|
|
515
|
+
* useEffect(() => actions.subscribe('map:zoom', ({ level }) => setZoom(level)), []);
|
|
516
|
+
* ```
|
|
517
|
+
*/
|
|
401
518
|
subscribe: (event: string, callback: (data: any) => void) => () => void;
|
|
402
|
-
/** Stores reference to the active tab ID being dragged. */
|
|
519
|
+
/** @internal Stores reference to the active tab ID being dragged. */
|
|
403
520
|
setDraggedPanelId: (id: string | null) => void;
|
|
404
|
-
/**
|
|
405
|
-
|
|
406
|
-
|
|
521
|
+
/**
|
|
522
|
+
* Splits an existing leaf group and docks a panel to the given side.
|
|
523
|
+
* @param id - Panel instance ID to dock.
|
|
524
|
+
* @param targetLeafId - Leaf group ID to split.
|
|
525
|
+
* @param position - Which side of the target to split and dock into.
|
|
526
|
+
*/
|
|
527
|
+
dockPanelToGroup: (id: string, targetLeafId: string, position: DropPosition) => void;
|
|
528
|
+
/**
|
|
529
|
+
* Reorders a panel's tab index within a docked leaf group.
|
|
530
|
+
* @param panelId - Panel instance ID to move.
|
|
531
|
+
* @param targetLeafId - Destination leaf group ID.
|
|
532
|
+
* @param targetIndex - New tab index within the target group.
|
|
533
|
+
*/
|
|
407
534
|
movePanelOrder: (panelId: string, targetLeafId: string, targetIndex: number) => void;
|
|
408
|
-
/**
|
|
535
|
+
/**
|
|
536
|
+
* Closes an empty leaf group (removes it from the grid tree).
|
|
537
|
+
* @param leafId - Leaf node ID to remove.
|
|
538
|
+
*/
|
|
409
539
|
closeLeafGroup: (leafId: string) => void;
|
|
410
|
-
/**
|
|
540
|
+
/**
|
|
541
|
+
* Registers a close guard that can intercept and cancel panel close requests.
|
|
542
|
+
* @param id - Panel instance ID to guard.
|
|
543
|
+
* @param guard - Function returning `true` (allow close) or `false` / `Promise<false>` (block).
|
|
544
|
+
*/
|
|
411
545
|
registerCloseGuard: (id: string, guard: () => boolean | Promise<boolean>) => void;
|
|
412
|
-
/**
|
|
546
|
+
/**
|
|
547
|
+
* Removes a previously registered close guard.
|
|
548
|
+
* @param id - Panel instance ID.
|
|
549
|
+
*/
|
|
413
550
|
unregisterCloseGuard: (id: string) => void;
|
|
414
|
-
/**
|
|
551
|
+
/**
|
|
552
|
+
* Marks a panel as dirty (has unsaved changes). Dirty panels show a visual indicator
|
|
553
|
+
* and the built-in close guard prompts the user before closing.
|
|
554
|
+
* @param id - Panel instance ID.
|
|
555
|
+
* @param dirty - `true` to mark dirty, `false` to clear.
|
|
556
|
+
* @param options - Custom confirmation dialog options.
|
|
557
|
+
*/
|
|
415
558
|
setPanelDirty: (id: string, dirty: boolean, options?: DirtyStateOptions) => void;
|
|
416
|
-
/**
|
|
559
|
+
/**
|
|
560
|
+
* Updates the display title of an open panel.
|
|
561
|
+
* @param id - Panel instance ID.
|
|
562
|
+
* @param title - New title string or localizable message descriptor.
|
|
563
|
+
*/
|
|
417
564
|
updatePanelTitle: (id: string, title: string | ContextMenuPredefinedMessage) => void;
|
|
418
|
-
/**
|
|
565
|
+
/**
|
|
566
|
+
* Closes a panel, first running any registered close guards.
|
|
567
|
+
* If the panel is dirty, shows the built-in unsaved-changes confirmation dialog.
|
|
568
|
+
* @param id - Panel instance ID.
|
|
569
|
+
* @param options - `force: true` bypasses guards; `onConfirm` provides a custom dialog.
|
|
570
|
+
*/
|
|
419
571
|
requestClosePanel: (id: string, options?: {
|
|
420
572
|
force?: boolean;
|
|
421
573
|
onConfirm?: (opts?: DirtyStateOptions) => Promise<boolean>;
|
|
422
574
|
}) => Promise<void>;
|
|
423
|
-
/**
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
575
|
+
/**
|
|
576
|
+
* Docks a floating panel to a workspace edge, creating a full-width or full-height column/row.
|
|
577
|
+
* @param id - Panel instance ID.
|
|
578
|
+
* @param position - Edge to dock to.
|
|
579
|
+
*/
|
|
580
|
+
dockPanelToWorkspaceEdge: (id: string, position: SplitDirection) => void;
|
|
581
|
+
/**
|
|
582
|
+
* Overrides the workspace layout direction.
|
|
583
|
+
* @param dir - `'ltr'` or `'rtl'`.
|
|
584
|
+
*/
|
|
428
585
|
setDirection: (dir: 'ltr' | 'rtl') => void;
|
|
429
586
|
}
|
|
430
587
|
/** Represents custom CSS classes injected into layout parts. */
|
|
@@ -438,8 +595,25 @@ interface StyleClasses {
|
|
|
438
595
|
}
|
|
439
596
|
/** Custom hook to read configured style class contexts. */
|
|
440
597
|
declare const useStyleClasses: () => StyleClasses;
|
|
598
|
+
/**
|
|
599
|
+
* React hook to read the scoped {@link PanelRegistryClass} for the current provider.
|
|
600
|
+
* When the provider was created with a {@link WorkspaceClient}, this returns the client's
|
|
601
|
+
* private registry. Otherwise it returns the global `PanelRegistry` singleton.
|
|
602
|
+
*
|
|
603
|
+
* @group Hooks
|
|
604
|
+
* @returns The panel registry instance in scope.
|
|
605
|
+
* @example
|
|
606
|
+
* ```tsx
|
|
607
|
+
* function MyComponent() {
|
|
608
|
+
* const registry = useRegistry();
|
|
609
|
+
* const entry = registry.get('map');
|
|
610
|
+
* return entry ? <entry.Component panelId="preview" /> : null;
|
|
611
|
+
* }
|
|
612
|
+
* ```
|
|
613
|
+
*/
|
|
614
|
+
declare const useRegistry: () => PanelRegistryClass;
|
|
441
615
|
interface WindowManagerProviderProps {
|
|
442
|
-
children:
|
|
616
|
+
children: React$1.ReactNode;
|
|
443
617
|
/** WorkspaceClient instance created outside the React tree. When provided, its registry
|
|
444
618
|
* and config take precedence over the individual props below. */
|
|
445
619
|
client?: WorkspaceClient;
|
|
@@ -453,15 +627,42 @@ interface WindowManagerProviderProps {
|
|
|
453
627
|
windowClass?: string;
|
|
454
628
|
windowBodyClass?: string;
|
|
455
629
|
}
|
|
456
|
-
declare const WindowManagerProvider:
|
|
630
|
+
declare const WindowManagerProvider: React$1.FC<WindowManagerProviderProps>;
|
|
457
631
|
/**
|
|
458
|
-
* React hook to
|
|
632
|
+
* React hook to subscribe to the live {@link WindowState} inside a component.
|
|
633
|
+
* The component re-renders whenever the state changes.
|
|
634
|
+
*
|
|
635
|
+
* For imperative reads without a subscription, use {@link WorkspaceClient} methods
|
|
636
|
+
* like `isOpen()` and `getOpenPanelIds()` instead.
|
|
637
|
+
*
|
|
638
|
+
* @group Hooks
|
|
639
|
+
* @returns The current workspace state tree.
|
|
459
640
|
* @throws Error if used outside of a {@link WindowManagerProvider}.
|
|
641
|
+
* @example
|
|
642
|
+
* ```tsx
|
|
643
|
+
* function PanelList() {
|
|
644
|
+
* const { panels } = useWindowManagerState();
|
|
645
|
+
* return <ul>{Object.keys(panels).map(id => <li key={id}>{id}</li>)}</ul>;
|
|
646
|
+
* }
|
|
647
|
+
* ```
|
|
460
648
|
*/
|
|
461
649
|
declare const useWindowManagerState: () => WindowState;
|
|
462
650
|
/**
|
|
463
|
-
* React hook to retrieve
|
|
651
|
+
* React hook to retrieve all layout mutation actions.
|
|
652
|
+
* Returns the public {@link WindowActions} interface.
|
|
653
|
+
*
|
|
654
|
+
* @group Hooks
|
|
655
|
+
* @returns The full set of workspace mutation methods.
|
|
464
656
|
* @throws Error if used outside of a {@link WindowManagerProvider}.
|
|
657
|
+
* @example
|
|
658
|
+
* ```tsx
|
|
659
|
+
* function Toolbar() {
|
|
660
|
+
* const actions = useWindowManagerActions();
|
|
661
|
+
* return (
|
|
662
|
+
* <button onClick={() => actions.openPanel('map-1', 'map')}>Open Map</button>
|
|
663
|
+
* );
|
|
664
|
+
* }
|
|
665
|
+
* ```
|
|
465
666
|
*/
|
|
466
667
|
declare const useWindowManagerActions: () => WindowActions;
|
|
467
668
|
/**
|
|
@@ -475,14 +676,11 @@ declare const formatLabel: (label: string | ContextMenuPredefinedMessage | undef
|
|
|
475
676
|
/**
|
|
476
677
|
* React hook providing pub-sub helper methods for inter-panel event messaging.
|
|
477
678
|
*/
|
|
478
|
-
declare const usePanelContext: () =>
|
|
479
|
-
publish: (event: string, data: any) => void;
|
|
480
|
-
subscribe: (event: string, callback: (data: any) => void) => () => void;
|
|
481
|
-
};
|
|
679
|
+
declare const usePanelContext: () => Pick<WindowActions, "publish" | "subscribe">;
|
|
482
680
|
/**
|
|
483
681
|
* React hook to fetch the localizable predefined message map catalog.
|
|
484
682
|
*/
|
|
485
|
-
declare const usePredefinedMessages: () => Record<
|
|
683
|
+
declare const usePredefinedMessages: () => Record<PredefinedMessageKey, ContextMenuPredefinedMessage>;
|
|
486
684
|
|
|
487
685
|
/** Per-panel definition supplied to WorkspaceClient constructor. */
|
|
488
686
|
interface PanelDefinition {
|
|
@@ -511,11 +709,20 @@ interface WorkspaceClientConfig {
|
|
|
511
709
|
/**
|
|
512
710
|
* WorkspaceClient is the central configuration and imperative API object for
|
|
513
711
|
* react-dockable-desktop. Create one instance outside the React tree and pass
|
|
514
|
-
* it to
|
|
712
|
+
* it to `<WindowManagerProvider client={client}>`.
|
|
515
713
|
*
|
|
516
714
|
* Pattern: TanStack QueryClient / Redux store — configuration and imperative
|
|
517
715
|
* access live on the client; rendering is delegated to the thin React provider.
|
|
518
716
|
*
|
|
717
|
+
* @remarks
|
|
718
|
+
* Calls made before the provider mounts are queued and replayed automatically
|
|
719
|
+
* in order once `_connect()` fires. If the client is never connected to a
|
|
720
|
+
* provider (e.g. `client={workspace}` was forgotten), a console warning is
|
|
721
|
+
* emitted in development after 1 second.
|
|
722
|
+
*
|
|
723
|
+
* `subscribe()` and `saveLayout()` return values immediately and cannot be
|
|
724
|
+
* queued — they return safe defaults (`() => {}` and `''`) when disconnected.
|
|
725
|
+
*
|
|
519
726
|
* @example
|
|
520
727
|
* const workspace = new WorkspaceClient({
|
|
521
728
|
* panels: {
|
|
@@ -531,7 +738,8 @@ interface WorkspaceClientConfig {
|
|
|
531
738
|
*
|
|
532
739
|
* // Imperative access from anywhere:
|
|
533
740
|
* workspace.saveLayout();
|
|
534
|
-
* workspace.openPanel('map', 'map');
|
|
741
|
+
* workspace.openPanel('map-1', 'map');
|
|
742
|
+
* workspace.focusPanel('map-1');
|
|
535
743
|
*/
|
|
536
744
|
declare class WorkspaceClient {
|
|
537
745
|
/** Scoped panel registry — fully independent from the global singleton. */
|
|
@@ -541,6 +749,10 @@ declare class WorkspaceClient {
|
|
|
541
749
|
/** Non-rendering configuration forwarded to the provider. */
|
|
542
750
|
readonly config: Pick<WorkspaceClientConfig, 'formatMessage' | 'predefinedMessages' | 'dir'>;
|
|
543
751
|
private _actions;
|
|
752
|
+
/** Calls queued before _connect() fires — replayed in order on first connect. */
|
|
753
|
+
private _pendingCalls;
|
|
754
|
+
/** DEV-only timer that warns if _connect() is never called within 1 second. */
|
|
755
|
+
private _disconnectedWarnTimer;
|
|
544
756
|
constructor(config?: WorkspaceClientConfig);
|
|
545
757
|
/** @internal Called by WindowManagerProvider after mount. */
|
|
546
758
|
_connect(actions: WindowActions): void;
|
|
@@ -548,8 +760,11 @@ declare class WorkspaceClient {
|
|
|
548
760
|
_disconnect(): void;
|
|
549
761
|
/** True while the provider is mounted and React state is accessible. */
|
|
550
762
|
get isConnected(): boolean;
|
|
551
|
-
|
|
552
|
-
|
|
763
|
+
/**
|
|
764
|
+
* Dispatches a void action immediately if connected, or queues it for replay.
|
|
765
|
+
* In development, warns if the client is still not connected after 1 second.
|
|
766
|
+
*/
|
|
767
|
+
private _dispatch;
|
|
553
768
|
openPanel(...args: Parameters<WindowActions['openPanel']>): void;
|
|
554
769
|
closePanel(id: string): void;
|
|
555
770
|
minimizePanel(id: string): void;
|
|
@@ -557,7 +772,18 @@ declare class WorkspaceClient {
|
|
|
557
772
|
floatPanel(...args: Parameters<WindowActions['floatPanel']>): void;
|
|
558
773
|
dockPanel(...args: Parameters<WindowActions['dockPanel']>): void;
|
|
559
774
|
maximizePanel(id: string): void;
|
|
560
|
-
|
|
775
|
+
/**
|
|
776
|
+
* Activates the given panel regardless of its current state.
|
|
777
|
+
* For floating panels: raises z-index so the window appears on top.
|
|
778
|
+
* For docked panels: selects the tab within its leaf group.
|
|
779
|
+
*/
|
|
780
|
+
focusPanel(id: string): void;
|
|
781
|
+
/** Returns `true` if a panel with this ID is currently open. */
|
|
782
|
+
isOpen(id: string): boolean;
|
|
783
|
+
/** Returns the IDs of all currently open panels. */
|
|
784
|
+
getOpenPanelIds(): string[];
|
|
785
|
+
saveLayout(): string;
|
|
786
|
+
loadLayout(json: string): boolean;
|
|
561
787
|
setDirection(dir: 'ltr' | 'rtl'): void;
|
|
562
788
|
publish(event: string, data: unknown): void;
|
|
563
789
|
subscribe(event: string, callback: (data: unknown) => void): () => void;
|
|
@@ -607,8 +833,8 @@ interface FormContainerContract {
|
|
|
607
833
|
/**
|
|
608
834
|
* Context that supplies the {@link FormContainerContract} to panels inside the Window Manager.
|
|
609
835
|
*/
|
|
610
|
-
declare const FormContainerContext:
|
|
611
|
-
declare const FormContainerProvider:
|
|
836
|
+
declare const FormContainerContext: Context<FormContainerContract>;
|
|
837
|
+
declare const FormContainerProvider: Provider<FormContainerContract>;
|
|
612
838
|
/**
|
|
613
839
|
* React hook to retrieve the current {@link FormContainerContract} from context.
|
|
614
840
|
* Enables sub-forms to trigger close requests, mark themselves dirty, rename their tabs, or listen to resize events.
|
|
@@ -635,7 +861,7 @@ interface SidePanelOptions {
|
|
|
635
861
|
/** Display title for the side-panel header. */
|
|
636
862
|
title?: PanelTitle;
|
|
637
863
|
/** Icon displayed next to the panel title. */
|
|
638
|
-
icon?:
|
|
864
|
+
icon?: React$1.ReactNode;
|
|
639
865
|
/** Specific CSS width (e.g. 300, '40%') for the panel container. */
|
|
640
866
|
width?: number | string;
|
|
641
867
|
}
|
|
@@ -644,7 +870,7 @@ interface ModalOptions {
|
|
|
644
870
|
/** Display title for the modal header. */
|
|
645
871
|
title?: PanelTitle;
|
|
646
872
|
/** Icon displayed in the modal title bar. */
|
|
647
|
-
icon?:
|
|
873
|
+
icon?: React$1.ReactNode;
|
|
648
874
|
/** Size modifier affecting CSS max-width rules. */
|
|
649
875
|
size?: 'small' | 'medium' | 'large' | 'fullscreen' | 'auto';
|
|
650
876
|
/** If false, hides the modal backdrop exit click and header close button. */
|
|
@@ -707,7 +933,7 @@ interface PanelActions {
|
|
|
707
933
|
* PanelProvider component manages the state and action handlers
|
|
708
934
|
* for drawers (left/right) and active stacked modal overlays.
|
|
709
935
|
*/
|
|
710
|
-
declare const PanelProvider:
|
|
936
|
+
declare const PanelProvider: React$1.FC<{
|
|
711
937
|
children: ReactNode;
|
|
712
938
|
}>;
|
|
713
939
|
/**
|
|
@@ -725,7 +951,7 @@ declare const usePanelActions: () => PanelActions;
|
|
|
725
951
|
* ModalStackRenderer component acts as the global container rendering
|
|
726
952
|
* all active stacked modal windows in the workspace.
|
|
727
953
|
*/
|
|
728
|
-
declare const ModalStackRenderer:
|
|
954
|
+
declare const ModalStackRenderer: React$1.FC;
|
|
729
955
|
|
|
730
956
|
interface SidePanelRendererProps {
|
|
731
957
|
/**
|
|
@@ -739,15 +965,15 @@ interface SidePanelRendererProps {
|
|
|
739
965
|
* SidePanelRenderer component acts as the global container rendering both
|
|
740
966
|
* left and right side drawers if they are currently active.
|
|
741
967
|
*/
|
|
742
|
-
declare const SidePanelRenderer:
|
|
968
|
+
declare const SidePanelRenderer: React$1.FC<SidePanelRendererProps>;
|
|
743
969
|
/**
|
|
744
970
|
* LeftPanelRenderer component renders ONLY the left side drawer if it is currently active.
|
|
745
971
|
*/
|
|
746
|
-
declare const LeftPanelRenderer:
|
|
972
|
+
declare const LeftPanelRenderer: React$1.FC<SidePanelRendererProps>;
|
|
747
973
|
/**
|
|
748
974
|
* RightPanelRenderer component renders ONLY the right side drawer if it is currently active.
|
|
749
975
|
*/
|
|
750
|
-
declare const RightPanelRenderer:
|
|
976
|
+
declare const RightPanelRenderer: React$1.FC<SidePanelRendererProps>;
|
|
751
977
|
|
|
752
978
|
/**
|
|
753
979
|
* Props for the {@link ConfirmationForm} component.
|
|
@@ -780,7 +1006,7 @@ interface ConfirmationFormProps {
|
|
|
780
1006
|
* ConfirmationForm component renders a standard dialog content layout,
|
|
781
1007
|
* allowing users to confirm actions or abort them. Exposes action callbacks.
|
|
782
1008
|
*/
|
|
783
|
-
declare const ConfirmationForm:
|
|
1009
|
+
declare const ConfirmationForm: React$1.FC<ConfirmationFormProps>;
|
|
784
1010
|
|
|
785
1011
|
/**
|
|
786
1012
|
* @file Sidebar.tsx
|
|
@@ -794,7 +1020,7 @@ declare const ConfirmationForm: React__default.FC<ConfirmationFormProps>;
|
|
|
794
1020
|
interface SidebarTab {
|
|
795
1021
|
id: string;
|
|
796
1022
|
label: string;
|
|
797
|
-
icon:
|
|
1023
|
+
icon: React$1.ReactNode;
|
|
798
1024
|
/**
|
|
799
1025
|
* Mount immediately when the Sidebar first renders, not on first user click.
|
|
800
1026
|
* Implies `preserveState: true`.
|
|
@@ -818,7 +1044,7 @@ interface SidebarTab {
|
|
|
818
1044
|
* @param onOpen - call to expand the drawer and select this tab programmatically
|
|
819
1045
|
* (useful when the panel itself detects it has new data to show)
|
|
820
1046
|
*/
|
|
821
|
-
renderContent: (tabId: string, onClose: () => void, onOpen: () => void) =>
|
|
1047
|
+
renderContent: (tabId: string, onClose: () => void, onOpen: () => void) => React$1.ReactNode;
|
|
822
1048
|
}
|
|
823
1049
|
interface SidebarProps {
|
|
824
1050
|
/** Which side the tab strip and drawer appear on. Default: 'right' */
|
|
@@ -831,10 +1057,10 @@ interface SidebarProps {
|
|
|
831
1057
|
/** Called when the active tab changes in uncontrolled mode. */
|
|
832
1058
|
onActiveTabChange?: (tabId: string | null) => void;
|
|
833
1059
|
/** Main workspace content, rendered between the strip and drawer (or around them). */
|
|
834
|
-
children?:
|
|
1060
|
+
children?: React$1.ReactNode;
|
|
835
1061
|
}
|
|
836
1062
|
/**
|
|
837
|
-
* Imperative handle exposed by
|
|
1063
|
+
* Imperative handle exposed by `<Sidebar ref={...}>` via forwardRef.
|
|
838
1064
|
* Allows external components (outside the sidebar tree) to control
|
|
839
1065
|
* which tab is open without prop drilling.
|
|
840
1066
|
*/
|
|
@@ -850,6 +1076,6 @@ interface SidebarHandle {
|
|
|
850
1076
|
* Sidebar component rendering a tab strip and a collapsible content drawer.
|
|
851
1077
|
* Supports imperative method bindings like openTab and closeDrawer via forwardRef.
|
|
852
1078
|
*/
|
|
853
|
-
declare const Sidebar:
|
|
1079
|
+
declare const Sidebar: React$1.ForwardRefExoticComponent<SidebarProps & React$1.RefAttributes<SidebarHandle>>;
|
|
854
1080
|
|
|
855
|
-
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 PanelDefinition, type PanelInfo, type PanelInstance, type PanelInstanceId, PanelProvider, PanelRegistry, type PanelRegistryEntry, 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, WorkspaceClient, type WorkspaceClientConfig, defaultPredefinedMessages, formatLabel, useFormContainer, useFormatMessage, usePanelActions, usePanelContext, usePanelState, usePredefinedMessages, useStyleClasses, useWindowManagerActions, useWindowManagerState };
|
|
1081
|
+
export { type CloseOptions, ConfirmationForm, type ConfirmationFormProps, type ContextMenuPredefinedMessage, type DropPosition, type DropTarget, type FloatingWindow, FormContainerContext, type FormContainerContract, FormContainerProvider, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, LeftPanelRenderer, type MessageFormatter, type ModalOptions, ModalStackRenderer, type PanelActions, type PanelDefinition, type PanelInfo, type PanelInstance, type PanelInstanceId, PanelProvider, PanelRegistry, PanelRegistryClass, type PanelRegistryEntry, type PanelState, type PanelTitle, type PredefinedMessageKey, RightPanelRenderer, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarHandle, type SidebarProps, type SidebarTab, type SplitDirection, type SplitOrientation, type StyleClasses, type WindowActions, WindowManager, WindowManagerProvider, type WindowState, WorkspaceClient, type WorkspaceClientConfig, defaultPredefinedMessages, formatLabel, useFormContainer, useFormatMessage, usePanelActions, usePanelContext, usePanelState, usePredefinedMessages, useRegistry, useStyleClasses, useWindowManagerActions, useWindowManagerState };
|