react-dockable-desktop 4.2.1 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -539,21 +539,28 @@ interface WindowActions {
539
539
  /**
540
540
  * Opens a registered panel into the workspace.
541
541
  * If the panel ID is already open, the panel is focused instead of duplicated.
542
+ * Becomes `state.activePanelId` by default — pass `options.focus: false` to open
543
+ * without stealing focus from whatever is currently active.
542
544
  * @param id - Unique instance identifier for this panel.
543
545
  * @param component - Component key registered in the panel catalog.
544
546
  * @param options.title - Override the panel tab/window title. Accepts a plain string or an i18n message descriptor.
545
547
  * @param options.initialTarget - Initial placement: `'floating'`, `'docked'` (default when a grid exists), or `'tabbed'`.
546
548
  * @param options.anchor - Pin the new floating window to a workspace corner on creation. Has no effect when `initialTarget` is `'docked'` or `'tabbed'`.
549
+ * @param options.focus - Set `state.activePanelId` to this panel. @default true
547
550
  * @example
548
551
  * ```ts
549
552
  * // Open floating and pin to the top-right corner:
550
553
  * actions.openPanel('layers', 'layertree', { initialTarget: 'floating', anchor: 'top-right' });
554
+ *
555
+ * // Open in the background without stealing focus:
556
+ * actions.openPanel('prefetch', 'report', { focus: false });
551
557
  * ```
552
558
  */
553
559
  openPanel: (id: string, component: string, options?: {
554
560
  title?: string | ContextMenuPredefinedMessage;
555
561
  initialTarget?: 'floating' | 'docked' | 'tabbed';
556
562
  anchor?: FloatAnchor | null;
563
+ focus?: boolean;
557
564
  }) => void;
558
565
  /**
559
566
  * Closes a panel immediately, bypassing dirty-state close guards.
@@ -962,8 +969,9 @@ interface DockableDesktopProviderProps extends WindowManagerProviderProps {
962
969
  contextMenuAdapter?: ContextMenuAdapter;
963
970
  }
964
971
  /**
965
- * Composite provider that wraps `WindowManagerProvider`, `PanelProvider`, and `ToolbarProvider`
966
- * in the correct order, and mounts the workspace-level `ContextMenuProvider` so that
972
+ * Composite provider that wraps `WindowManagerProvider`, `PanelProvider`, `ToolbarProvider`,
973
+ * and `PanelContributionProvider` in the correct order, and mounts the workspace-level
974
+ * `ContextMenuProvider` so that
967
975
  * `showContextMenu()` and `useShowContextMenu()` work from any component in the tree —
968
976
  * including siblings of `<WindowManager>` such as `<Sidebar>`, `<SidePanelRenderer>`,
969
977
  * and `<ModalStackRenderer>`.
@@ -1406,7 +1414,16 @@ interface ToolbarRadioItem {
1406
1414
  onActivate?: (id: string) => void;
1407
1415
  disabled?: boolean;
1408
1416
  }
1409
- /** An independent on/off toggle modifier (e.g. snap-to-grid). */
1417
+ /**
1418
+ * An independent on/off toggle modifier (e.g. snap-to-grid).
1419
+ *
1420
+ * Supports both uncontrolled mode (omit `active` — state lives in
1421
+ * ToolbarContext, keyed by `id`) and controlled mode (provide `active` —
1422
+ * the caller is the single source of truth and must update the prop in
1423
+ * response to `onToggle`). Controlled mode is what lets independent
1424
+ * instances of the same panel type report independent active state
1425
+ * instead of colliding on a shared id.
1426
+ */
1410
1427
  interface ToolbarToggleItem {
1411
1428
  type: 'toggle';
1412
1429
  id: string;
@@ -1414,6 +1431,12 @@ interface ToolbarToggleItem {
1414
1431
  icon: React$1.ReactNode;
1415
1432
  /** Keyboard shortcut hint — reserved for future custom tooltip. */
1416
1433
  shortcut?: string;
1434
+ /**
1435
+ * Controlled active state. When provided (even as false), the component
1436
+ * reads this prop instead of ToolbarContext and does not update context
1437
+ * on click. Omit (undefined) for uncontrolled behaviour.
1438
+ */
1439
+ active?: boolean;
1417
1440
  /** Called after the toggle flips; receives the new active state. */
1418
1441
  onToggle?: (active: boolean) => void;
1419
1442
  disabled?: boolean;
@@ -1865,4 +1888,91 @@ interface PanelFloatingWindowManagerHandle {
1865
1888
  */
1866
1889
  declare function usePanelFloatingWindowManager(): PanelFloatingWindowManagerHandle;
1867
1890
 
1868
- export { type BuiltInPanelEvents, type ButtonVariant, type CloseOptions, ConfirmationForm, type ConfirmationFormProps, ContextMenu, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuPredefinedMessage, type ContextMenuProps, ContextMenuProvider, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, DefaultContextMenuAdapter, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWindow, FormContainerContext, type FormContainerContract, FormContainerProvider, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, LeftPanelRenderer, type ManagedWindowConfig, type MenuItemAction, type MessageFormatter, type ModalOptions, ModalStackRenderer, type PanelActions, type PanelDefinition, PanelFloatingWindow, type PanelFloatingWindowManagerHandle, type PanelFloatingWindowProps, type PanelInfo, type PanelInstance, type PanelInstanceId, PanelOverlayRoot, type PanelOverlayRootProps, PanelProvider, PanelRegistry, PanelRegistryClass, type PanelRegistryEntry, type PanelState, type PanelTitle, PanelToolbar, ToolbarItem as PanelToolbarItem, type PanelToolbarProps, ToolbarSeparator as PanelToolbarSeparator, type PredefinedMessageKey, type ResolvedToastOptions, RightPanelRenderer, type SearchResult, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarProps, type SidebarTab, type SidebarTabContextValue, type SplitDirection, type SplitOrientation, type StyleClasses, type TaskbarVisibility, type ToastAdapter, ToastContainer, type ToastContainerProps, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, Toolbar, type ToolbarActionItem, ToolbarButton, type ToolbarButtonProps, ToolbarCenter, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarProps, ToolbarProvider, type ToolbarRadioItem, ToolbarSearchInput, type ToolbarSearchInputProps, type ToolbarSeparator$1 as ToolbarSeparator, ToolbarSpacer, ToolbarToggle, type ToolbarToggleItem, type ToolbarToggleProps, type ToolbarVariant, type UsePanelFloatingWindowReturn, type WindowActions, WindowManager, type WindowManagerProps, WindowManagerProvider, type WindowManagerProviderProps, type WindowState, WorkspaceClient, type WorkspaceClientConfig, defaultPredefinedMessages, formatLabel, toast, useFormContainer, useFormatMessage, usePanelActions, usePanelContext, usePanelContextMenu, usePanelFloatingWindow, usePanelFloatingWindowManager, usePanelId, usePanelState, usePredefinedMessages, useRegistry, useShowContextMenu, useSidebar, useSidebarTab, useStyleClasses, useToolbar, useWindowManagerActions, useWindowManagerState };
1891
+ /**
1892
+ * @file PanelContributionContext.tsx
1893
+ * @description Lets any panel publish toolbar items and/or sidebar sections that
1894
+ * should only be surfaced while it is the globally active panel (`state.activePanelId`).
1895
+ * Optional, additive module — `DockableDesktopProvider` wires it up automatically.
1896
+ * Neither `<Toolbar>` nor `<Sidebar>` reads from this automatically; the app shell
1897
+ * merges `useActivePanelContribution()`'s result into its own `items`/`tabs` calls.
1898
+ */
1899
+
1900
+ /** A single named, labeled slot of content a panel contributes to the app's Sidebar while active. */
1901
+ interface PanelSidebarSection {
1902
+ id: string;
1903
+ label: string;
1904
+ icon?: React$1.ReactNode;
1905
+ content: React$1.ReactNode;
1906
+ }
1907
+ /**
1908
+ * What a panel publishes via `usePanelContribution()`. Both fields are optional and
1909
+ * independent — a panel may contribute only toolbar items, only sidebar sections,
1910
+ * both, or neither. The app decides what "toolbar items" and "sidebar sections" mean
1911
+ * for its own domain (map controls, document formatting, anything else).
1912
+ */
1913
+ interface PanelContribution {
1914
+ toolbarItems?: ToolbarItem$1[];
1915
+ sidebarSections?: PanelSidebarSection[];
1916
+ }
1917
+ /**
1918
+ * Provider enabling `usePanelContribution()` / `useActivePanelContribution()`.
1919
+ * Mounted automatically by `DockableDesktopProvider` — only needed manually when
1920
+ * composing `WindowManagerProvider` directly without it.
1921
+ */
1922
+ declare const PanelContributionProvider: React$1.FC<{
1923
+ children: React$1.ReactNode;
1924
+ }>;
1925
+ /**
1926
+ * Publish this panel's toolbar items and/or sidebar sections. Call on every render —
1927
+ * republishes automatically whenever `contribution` changes, and is cleared when the
1928
+ * panel unmounts. Memoize the object (and its array/callback contents, e.g. with
1929
+ * `useMemo`/`useCallback`) to avoid republishing on every unrelated re-render.
1930
+ *
1931
+ * Contributions are only ever surfaced while this panel is `state.activePanelId` —
1932
+ * see `useActivePanelContribution()`. No-op outside a `PanelContributionProvider` tree.
1933
+ *
1934
+ * @example
1935
+ * function MapPanel() {
1936
+ * const [controller, setController] = useState<'pan' | 'draw' | 'measure'>('pan');
1937
+ * usePanelContribution({
1938
+ * toolbarItems: (['pan', 'draw', 'measure'] as const).map(id => ({
1939
+ * type: 'toggle', id, label: id, icon: icons[id],
1940
+ * active: controller === id, onToggle: () => setController(id),
1941
+ * })),
1942
+ * sidebarSections: [{ id: 'layers', label: 'Layers', content: <LayerList /> }],
1943
+ * });
1944
+ * // ...
1945
+ * }
1946
+ */
1947
+ declare function usePanelContribution(contribution: PanelContribution): void;
1948
+ /**
1949
+ * Returns whatever the currently active panel (`state.activePanelId`) has published
1950
+ * via `usePanelContribution()`, or `null` if no panel is active or the active panel
1951
+ * hasn't contributed anything. Intended for the app shell to merge into its own
1952
+ * `<Toolbar items={...}>` / `<Sidebar tabs={...}>` calls.
1953
+ */
1954
+ declare function useActivePanelContribution(): PanelContribution | null;
1955
+ /**
1956
+ * Converts a contributed sidebar section into a `SidebarTab` for `<Sidebar tabs={...}>`.
1957
+ * `SidebarTab.icon` is required, so supply `fallbackIcon` for sections that omit one.
1958
+ * `eagerMount`/`preserveState` have no contribution-side equivalent — a contribution
1959
+ * only exists while its owning panel is mounted and active, so both are left unset.
1960
+ */
1961
+ declare function sidebarSectionToTab(section: PanelSidebarSection, fallbackIcon?: React$1.ReactNode): SidebarTab;
1962
+ /**
1963
+ * Convenience wrapper around `useActivePanelContribution()` for the common case:
1964
+ * append the active panel's contributed toolbar items (behind a separator) to a
1965
+ * static list. Returns `staticItems` unchanged when there's nothing to add.
1966
+ * For manual control (a different merge position, no separator, etc.), call
1967
+ * `useActivePanelContribution()` directly instead.
1968
+ */
1969
+ declare function useMergedToolbarItems(staticItems: ToolbarItem$1[]): ToolbarItem$1[];
1970
+ /**
1971
+ * Convenience wrapper around `useActivePanelContribution()` for the common case:
1972
+ * append the active panel's contributed sidebar sections (via `sidebarSectionToTab`)
1973
+ * to a static tab list, as dynamic tabs that appear only while their panel is active.
1974
+ * Returns `staticTabs` unchanged when there's nothing to add.
1975
+ */
1976
+ declare function useMergedSidebarTabs(staticTabs: SidebarTab[], fallbackIcon?: React$1.ReactNode): SidebarTab[];
1977
+
1978
+ export { type BuiltInPanelEvents, type ButtonVariant, type CloseOptions, ConfirmationForm, type ConfirmationFormProps, ContextMenu, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuPredefinedMessage, type ContextMenuProps, ContextMenuProvider, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, DefaultContextMenuAdapter, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWindow, FormContainerContext, type FormContainerContract, FormContainerProvider, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, LeftPanelRenderer, type ManagedWindowConfig, type MenuItemAction, type MessageFormatter, type ModalOptions, ModalStackRenderer, type PanelActions, type PanelContribution, PanelContributionProvider, type PanelDefinition, PanelFloatingWindow, type PanelFloatingWindowManagerHandle, type PanelFloatingWindowProps, type PanelInfo, type PanelInstance, type PanelInstanceId, PanelOverlayRoot, type PanelOverlayRootProps, PanelProvider, PanelRegistry, PanelRegistryClass, type PanelRegistryEntry, type PanelSidebarSection, type PanelState, type PanelTitle, PanelToolbar, ToolbarItem as PanelToolbarItem, type PanelToolbarProps, ToolbarSeparator as PanelToolbarSeparator, type PredefinedMessageKey, type ResolvedToastOptions, RightPanelRenderer, type SearchResult, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarProps, type SidebarTab, type SidebarTabContextValue, type SplitDirection, type SplitOrientation, type StyleClasses, type TaskbarVisibility, type ToastAdapter, ToastContainer, type ToastContainerProps, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, Toolbar, type ToolbarActionItem, ToolbarButton, type ToolbarButtonProps, ToolbarCenter, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarProps, ToolbarProvider, type ToolbarRadioItem, ToolbarSearchInput, type ToolbarSearchInputProps, type ToolbarSeparator$1 as ToolbarSeparator, ToolbarSpacer, ToolbarToggle, type ToolbarToggleItem, type ToolbarToggleProps, type ToolbarVariant, type UsePanelFloatingWindowReturn, type WindowActions, WindowManager, type WindowManagerProps, WindowManagerProvider, type WindowManagerProviderProps, type WindowState, WorkspaceClient, type WorkspaceClientConfig, defaultPredefinedMessages, formatLabel, sidebarSectionToTab, toast, useActivePanelContribution, useFormContainer, useFormatMessage, useMergedSidebarTabs, useMergedToolbarItems, usePanelActions, usePanelContext, usePanelContextMenu, usePanelContribution, usePanelFloatingWindow, usePanelFloatingWindowManager, usePanelId, usePanelState, usePredefinedMessages, useRegistry, useShowContextMenu, useSidebar, useSidebarTab, useStyleClasses, useToolbar, useWindowManagerActions, useWindowManagerState };
package/dist/index.d.ts CHANGED
@@ -539,21 +539,28 @@ interface WindowActions {
539
539
  /**
540
540
  * Opens a registered panel into the workspace.
541
541
  * If the panel ID is already open, the panel is focused instead of duplicated.
542
+ * Becomes `state.activePanelId` by default — pass `options.focus: false` to open
543
+ * without stealing focus from whatever is currently active.
542
544
  * @param id - Unique instance identifier for this panel.
543
545
  * @param component - Component key registered in the panel catalog.
544
546
  * @param options.title - Override the panel tab/window title. Accepts a plain string or an i18n message descriptor.
545
547
  * @param options.initialTarget - Initial placement: `'floating'`, `'docked'` (default when a grid exists), or `'tabbed'`.
546
548
  * @param options.anchor - Pin the new floating window to a workspace corner on creation. Has no effect when `initialTarget` is `'docked'` or `'tabbed'`.
549
+ * @param options.focus - Set `state.activePanelId` to this panel. @default true
547
550
  * @example
548
551
  * ```ts
549
552
  * // Open floating and pin to the top-right corner:
550
553
  * actions.openPanel('layers', 'layertree', { initialTarget: 'floating', anchor: 'top-right' });
554
+ *
555
+ * // Open in the background without stealing focus:
556
+ * actions.openPanel('prefetch', 'report', { focus: false });
551
557
  * ```
552
558
  */
553
559
  openPanel: (id: string, component: string, options?: {
554
560
  title?: string | ContextMenuPredefinedMessage;
555
561
  initialTarget?: 'floating' | 'docked' | 'tabbed';
556
562
  anchor?: FloatAnchor | null;
563
+ focus?: boolean;
557
564
  }) => void;
558
565
  /**
559
566
  * Closes a panel immediately, bypassing dirty-state close guards.
@@ -962,8 +969,9 @@ interface DockableDesktopProviderProps extends WindowManagerProviderProps {
962
969
  contextMenuAdapter?: ContextMenuAdapter;
963
970
  }
964
971
  /**
965
- * Composite provider that wraps `WindowManagerProvider`, `PanelProvider`, and `ToolbarProvider`
966
- * in the correct order, and mounts the workspace-level `ContextMenuProvider` so that
972
+ * Composite provider that wraps `WindowManagerProvider`, `PanelProvider`, `ToolbarProvider`,
973
+ * and `PanelContributionProvider` in the correct order, and mounts the workspace-level
974
+ * `ContextMenuProvider` so that
967
975
  * `showContextMenu()` and `useShowContextMenu()` work from any component in the tree —
968
976
  * including siblings of `<WindowManager>` such as `<Sidebar>`, `<SidePanelRenderer>`,
969
977
  * and `<ModalStackRenderer>`.
@@ -1406,7 +1414,16 @@ interface ToolbarRadioItem {
1406
1414
  onActivate?: (id: string) => void;
1407
1415
  disabled?: boolean;
1408
1416
  }
1409
- /** An independent on/off toggle modifier (e.g. snap-to-grid). */
1417
+ /**
1418
+ * An independent on/off toggle modifier (e.g. snap-to-grid).
1419
+ *
1420
+ * Supports both uncontrolled mode (omit `active` — state lives in
1421
+ * ToolbarContext, keyed by `id`) and controlled mode (provide `active` —
1422
+ * the caller is the single source of truth and must update the prop in
1423
+ * response to `onToggle`). Controlled mode is what lets independent
1424
+ * instances of the same panel type report independent active state
1425
+ * instead of colliding on a shared id.
1426
+ */
1410
1427
  interface ToolbarToggleItem {
1411
1428
  type: 'toggle';
1412
1429
  id: string;
@@ -1414,6 +1431,12 @@ interface ToolbarToggleItem {
1414
1431
  icon: React$1.ReactNode;
1415
1432
  /** Keyboard shortcut hint — reserved for future custom tooltip. */
1416
1433
  shortcut?: string;
1434
+ /**
1435
+ * Controlled active state. When provided (even as false), the component
1436
+ * reads this prop instead of ToolbarContext and does not update context
1437
+ * on click. Omit (undefined) for uncontrolled behaviour.
1438
+ */
1439
+ active?: boolean;
1417
1440
  /** Called after the toggle flips; receives the new active state. */
1418
1441
  onToggle?: (active: boolean) => void;
1419
1442
  disabled?: boolean;
@@ -1865,4 +1888,91 @@ interface PanelFloatingWindowManagerHandle {
1865
1888
  */
1866
1889
  declare function usePanelFloatingWindowManager(): PanelFloatingWindowManagerHandle;
1867
1890
 
1868
- export { type BuiltInPanelEvents, type ButtonVariant, type CloseOptions, ConfirmationForm, type ConfirmationFormProps, ContextMenu, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuPredefinedMessage, type ContextMenuProps, ContextMenuProvider, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, DefaultContextMenuAdapter, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWindow, FormContainerContext, type FormContainerContract, FormContainerProvider, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, LeftPanelRenderer, type ManagedWindowConfig, type MenuItemAction, type MessageFormatter, type ModalOptions, ModalStackRenderer, type PanelActions, type PanelDefinition, PanelFloatingWindow, type PanelFloatingWindowManagerHandle, type PanelFloatingWindowProps, type PanelInfo, type PanelInstance, type PanelInstanceId, PanelOverlayRoot, type PanelOverlayRootProps, PanelProvider, PanelRegistry, PanelRegistryClass, type PanelRegistryEntry, type PanelState, type PanelTitle, PanelToolbar, ToolbarItem as PanelToolbarItem, type PanelToolbarProps, ToolbarSeparator as PanelToolbarSeparator, type PredefinedMessageKey, type ResolvedToastOptions, RightPanelRenderer, type SearchResult, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarProps, type SidebarTab, type SidebarTabContextValue, type SplitDirection, type SplitOrientation, type StyleClasses, type TaskbarVisibility, type ToastAdapter, ToastContainer, type ToastContainerProps, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, Toolbar, type ToolbarActionItem, ToolbarButton, type ToolbarButtonProps, ToolbarCenter, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarProps, ToolbarProvider, type ToolbarRadioItem, ToolbarSearchInput, type ToolbarSearchInputProps, type ToolbarSeparator$1 as ToolbarSeparator, ToolbarSpacer, ToolbarToggle, type ToolbarToggleItem, type ToolbarToggleProps, type ToolbarVariant, type UsePanelFloatingWindowReturn, type WindowActions, WindowManager, type WindowManagerProps, WindowManagerProvider, type WindowManagerProviderProps, type WindowState, WorkspaceClient, type WorkspaceClientConfig, defaultPredefinedMessages, formatLabel, toast, useFormContainer, useFormatMessage, usePanelActions, usePanelContext, usePanelContextMenu, usePanelFloatingWindow, usePanelFloatingWindowManager, usePanelId, usePanelState, usePredefinedMessages, useRegistry, useShowContextMenu, useSidebar, useSidebarTab, useStyleClasses, useToolbar, useWindowManagerActions, useWindowManagerState };
1891
+ /**
1892
+ * @file PanelContributionContext.tsx
1893
+ * @description Lets any panel publish toolbar items and/or sidebar sections that
1894
+ * should only be surfaced while it is the globally active panel (`state.activePanelId`).
1895
+ * Optional, additive module — `DockableDesktopProvider` wires it up automatically.
1896
+ * Neither `<Toolbar>` nor `<Sidebar>` reads from this automatically; the app shell
1897
+ * merges `useActivePanelContribution()`'s result into its own `items`/`tabs` calls.
1898
+ */
1899
+
1900
+ /** A single named, labeled slot of content a panel contributes to the app's Sidebar while active. */
1901
+ interface PanelSidebarSection {
1902
+ id: string;
1903
+ label: string;
1904
+ icon?: React$1.ReactNode;
1905
+ content: React$1.ReactNode;
1906
+ }
1907
+ /**
1908
+ * What a panel publishes via `usePanelContribution()`. Both fields are optional and
1909
+ * independent — a panel may contribute only toolbar items, only sidebar sections,
1910
+ * both, or neither. The app decides what "toolbar items" and "sidebar sections" mean
1911
+ * for its own domain (map controls, document formatting, anything else).
1912
+ */
1913
+ interface PanelContribution {
1914
+ toolbarItems?: ToolbarItem$1[];
1915
+ sidebarSections?: PanelSidebarSection[];
1916
+ }
1917
+ /**
1918
+ * Provider enabling `usePanelContribution()` / `useActivePanelContribution()`.
1919
+ * Mounted automatically by `DockableDesktopProvider` — only needed manually when
1920
+ * composing `WindowManagerProvider` directly without it.
1921
+ */
1922
+ declare const PanelContributionProvider: React$1.FC<{
1923
+ children: React$1.ReactNode;
1924
+ }>;
1925
+ /**
1926
+ * Publish this panel's toolbar items and/or sidebar sections. Call on every render —
1927
+ * republishes automatically whenever `contribution` changes, and is cleared when the
1928
+ * panel unmounts. Memoize the object (and its array/callback contents, e.g. with
1929
+ * `useMemo`/`useCallback`) to avoid republishing on every unrelated re-render.
1930
+ *
1931
+ * Contributions are only ever surfaced while this panel is `state.activePanelId` —
1932
+ * see `useActivePanelContribution()`. No-op outside a `PanelContributionProvider` tree.
1933
+ *
1934
+ * @example
1935
+ * function MapPanel() {
1936
+ * const [controller, setController] = useState<'pan' | 'draw' | 'measure'>('pan');
1937
+ * usePanelContribution({
1938
+ * toolbarItems: (['pan', 'draw', 'measure'] as const).map(id => ({
1939
+ * type: 'toggle', id, label: id, icon: icons[id],
1940
+ * active: controller === id, onToggle: () => setController(id),
1941
+ * })),
1942
+ * sidebarSections: [{ id: 'layers', label: 'Layers', content: <LayerList /> }],
1943
+ * });
1944
+ * // ...
1945
+ * }
1946
+ */
1947
+ declare function usePanelContribution(contribution: PanelContribution): void;
1948
+ /**
1949
+ * Returns whatever the currently active panel (`state.activePanelId`) has published
1950
+ * via `usePanelContribution()`, or `null` if no panel is active or the active panel
1951
+ * hasn't contributed anything. Intended for the app shell to merge into its own
1952
+ * `<Toolbar items={...}>` / `<Sidebar tabs={...}>` calls.
1953
+ */
1954
+ declare function useActivePanelContribution(): PanelContribution | null;
1955
+ /**
1956
+ * Converts a contributed sidebar section into a `SidebarTab` for `<Sidebar tabs={...}>`.
1957
+ * `SidebarTab.icon` is required, so supply `fallbackIcon` for sections that omit one.
1958
+ * `eagerMount`/`preserveState` have no contribution-side equivalent — a contribution
1959
+ * only exists while its owning panel is mounted and active, so both are left unset.
1960
+ */
1961
+ declare function sidebarSectionToTab(section: PanelSidebarSection, fallbackIcon?: React$1.ReactNode): SidebarTab;
1962
+ /**
1963
+ * Convenience wrapper around `useActivePanelContribution()` for the common case:
1964
+ * append the active panel's contributed toolbar items (behind a separator) to a
1965
+ * static list. Returns `staticItems` unchanged when there's nothing to add.
1966
+ * For manual control (a different merge position, no separator, etc.), call
1967
+ * `useActivePanelContribution()` directly instead.
1968
+ */
1969
+ declare function useMergedToolbarItems(staticItems: ToolbarItem$1[]): ToolbarItem$1[];
1970
+ /**
1971
+ * Convenience wrapper around `useActivePanelContribution()` for the common case:
1972
+ * append the active panel's contributed sidebar sections (via `sidebarSectionToTab`)
1973
+ * to a static tab list, as dynamic tabs that appear only while their panel is active.
1974
+ * Returns `staticTabs` unchanged when there's nothing to add.
1975
+ */
1976
+ declare function useMergedSidebarTabs(staticTabs: SidebarTab[], fallbackIcon?: React$1.ReactNode): SidebarTab[];
1977
+
1978
+ export { type BuiltInPanelEvents, type ButtonVariant, type CloseOptions, ConfirmationForm, type ConfirmationFormProps, ContextMenu, type ContextMenuAdapter, type ContextMenuCheckbox, type ContextMenuHandle, type ContextMenuItem, type ContextMenuLabel, type ContextMenuPredefinedMessage, type ContextMenuProps, ContextMenuProvider, type ContextMenuSeparator, type ContextMenuSimpleItem, type ContextMenuSubMenu, DefaultContextMenuAdapter, DockableDesktopProvider, type DockableDesktopProviderProps, type DropPosition, type DropTarget, type FloatAnchor, type FloatingWindow, FormContainerContext, type FormContainerContract, FormContainerProvider, type LayoutGridNode, type LayoutLeafNode, type LayoutNode, LeftPanelRenderer, type ManagedWindowConfig, type MenuItemAction, type MessageFormatter, type ModalOptions, ModalStackRenderer, type PanelActions, type PanelContribution, PanelContributionProvider, type PanelDefinition, PanelFloatingWindow, type PanelFloatingWindowManagerHandle, type PanelFloatingWindowProps, type PanelInfo, type PanelInstance, type PanelInstanceId, PanelOverlayRoot, type PanelOverlayRootProps, PanelProvider, PanelRegistry, PanelRegistryClass, type PanelRegistryEntry, type PanelSidebarSection, type PanelState, type PanelTitle, PanelToolbar, ToolbarItem as PanelToolbarItem, type PanelToolbarProps, ToolbarSeparator as PanelToolbarSeparator, type PredefinedMessageKey, type ResolvedToastOptions, RightPanelRenderer, type SearchResult, type ShowContextMenuOptions, type SidePanelOptions, SidePanelRenderer, type SidePanelRendererProps, Sidebar, type SidebarContextValue, type SidebarHandle, type SidebarProps, type SidebarTab, type SidebarTabContextValue, type SplitDirection, type SplitOrientation, type StyleClasses, type TaskbarVisibility, type ToastAdapter, ToastContainer, type ToastContainerProps, type ToastFunction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastType, Toolbar, type ToolbarActionItem, ToolbarButton, type ToolbarButtonProps, ToolbarCenter, type ToolbarContextValue, type ToolbarGroupEntry, type ToolbarGroupItem, type ToolbarGroupSubItem, type ToolbarHandle, type ToolbarItem$1 as ToolbarItem, type ToolbarPosition, type ToolbarProps, ToolbarProvider, type ToolbarRadioItem, ToolbarSearchInput, type ToolbarSearchInputProps, type ToolbarSeparator$1 as ToolbarSeparator, ToolbarSpacer, ToolbarToggle, type ToolbarToggleItem, type ToolbarToggleProps, type ToolbarVariant, type UsePanelFloatingWindowReturn, type WindowActions, WindowManager, type WindowManagerProps, WindowManagerProvider, type WindowManagerProviderProps, type WindowState, WorkspaceClient, type WorkspaceClientConfig, defaultPredefinedMessages, formatLabel, sidebarSectionToTab, toast, useActivePanelContribution, useFormContainer, useFormatMessage, useMergedSidebarTabs, useMergedToolbarItems, usePanelActions, usePanelContext, usePanelContextMenu, usePanelContribution, usePanelFloatingWindow, usePanelFloatingWindowManager, usePanelId, usePanelState, usePredefinedMessages, useRegistry, useShowContextMenu, useSidebar, useSidebarTab, useStyleClasses, useToolbar, useWindowManagerActions, useWindowManagerState };