@forgeax/app-shell 0.35.0 → 0.37.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/react.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement, HTMLAttributes, ReactNode } from 'react';
3
3
  import { DetachedWindowCapability } from './window.js';
4
+ import { DockLayoutControlSnapshot, DockLayoutPanelControl, DockLayoutControlState, DockLayoutControlToggleSource } from './dock.js';
4
5
 
5
6
  /** Stable FNV-1a color bucket for a shell slot name. */
6
7
  declare function hashSlotHue(name: string): number;
@@ -90,6 +91,20 @@ interface SurfaceRegionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'child
90
91
  /** Product-neutral full-size surface region with an explicit fill body. */
91
92
  declare const SurfaceRegion: react.ForwardRefExoticComponent<SurfaceRegionProps & react.RefAttributes<HTMLDivElement>>;
92
93
 
94
+ interface DockLayoutControlBindingOptions<Anchor> {
95
+ state: DockLayoutControlState<Anchor>;
96
+ onToggle: DockLayoutControlToggleSource<Anchor>['onToggle'];
97
+ isPanelOpen(panelId: string): boolean;
98
+ closePanel(panelId: string): void;
99
+ reopenPanel(panelId: string): void;
100
+ }
101
+ interface DockLayoutControlBinding<Anchor> {
102
+ readonly snapshot: DockLayoutControlSnapshot<Anchor>;
103
+ readonly panelControl: DockLayoutPanelControl;
104
+ }
105
+ /** Bind the product-neutral layout-control state, toggle source, and live panel projection to React. */
106
+ declare function useDockLayoutControlBinding<Anchor>({ state, onToggle, isPanelOpen, closePanel, reopenPanel, }: DockLayoutControlBindingOptions<Anchor>): DockLayoutControlBinding<Anchor>;
107
+
93
108
  type ShellSlotElement = 'aside' | 'div' | 'main' | 'section';
94
109
  interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
95
110
  as?: ShellSlotElement;
@@ -98,4 +113,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
98
113
  /** Structural shell marker that preserves the caller's semantic element. */
99
114
  declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
100
115
 
101
- export { DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelEmptyState, type PanelEmptyStateProps, PanelSurface, type PanelSurfaceProps, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, hashSlotHue, isSlotDebugEnabled, useLocalSize };
116
+ export { DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type DockLayoutControlBinding, type DockLayoutControlBindingOptions, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelEmptyState, type PanelEmptyStateProps, PanelSurface, type PanelSurfaceProps, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, hashSlotHue, isSlotDebugEnabled, useDockLayoutControlBinding, useLocalSize };
package/dist/react.js CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ createDockLayoutPanelControl,
3
+ installDockLayoutControlToggle
4
+ } from "./chunk-MYY2LEZI.js";
1
5
  import {
2
6
  shouldShowDetachedPlaceholder
3
7
  } from "./chunk-QMT4V6XC.js";
@@ -400,6 +404,29 @@ var SurfaceRegion = forwardRef(
400
404
  }
401
405
  );
402
406
 
407
+ // src/dock-layout-control.ts
408
+ import { useEffect as useEffect3, useMemo, useSyncExternalStore } from "react";
409
+ function useDockLayoutControlBinding({
410
+ state,
411
+ onToggle,
412
+ isPanelOpen,
413
+ closePanel,
414
+ reopenPanel
415
+ }) {
416
+ const snapshot = useSyncExternalStore(
417
+ state.subscribe,
418
+ state.getSnapshot,
419
+ state.getSnapshot
420
+ );
421
+ useEffect3(() => installDockLayoutControlToggle({ onToggle }, state), [onToggle, state]);
422
+ const panelControl = useMemo(() => createDockLayoutPanelControl({
423
+ isOpen: isPanelOpen,
424
+ close: closePanel,
425
+ reopen: reopenPanel
426
+ }), [closePanel, isPanelOpen, reopenPanel]);
427
+ return useMemo(() => ({ snapshot, panelControl }), [panelControl, snapshot]);
428
+ }
429
+
403
430
  // src/react.tsx
404
431
  function ShellSlot({
405
432
  as = "div",
@@ -421,5 +448,6 @@ export {
421
448
  SurfaceRegion,
422
449
  hashSlotHue,
423
450
  isSlotDebugEnabled,
451
+ useDockLayoutControlBinding,
424
452
  useLocalSize
425
453
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.35.0",
3
+ "version": "0.37.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",