react-panel-layout 0.2.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.
Files changed (92) hide show
  1. package/README.md +121 -0
  2. package/dist/GridLayout-CmzKfbPP.js +1295 -0
  3. package/dist/GridLayout-CmzKfbPP.js.map +1 -0
  4. package/dist/GridLayout-Dx3Qofl0.cjs +2 -0
  5. package/dist/GridLayout-Dx3Qofl0.cjs.map +1 -0
  6. package/dist/PanelSystemContext.d.ts +25 -0
  7. package/dist/components/grid/GridLayerList.d.ts +10 -0
  8. package/dist/components/grid/GridLayerResizeHandles.d.ts +22 -0
  9. package/dist/components/grid/GridLayout.d.ts +11 -0
  10. package/dist/components/grid/GridTrackResizeHandle.d.ts +18 -0
  11. package/dist/components/paneling/FloatingPanelFrame.d.ts +32 -0
  12. package/dist/components/panels/DropSuggestOverlay.d.ts +13 -0
  13. package/dist/components/panels/PanelGroupView.d.ts +20 -0
  14. package/dist/components/resizer/HorizontalDivider.d.ts +14 -0
  15. package/dist/components/resizer/ResizeHandle.d.ts +24 -0
  16. package/dist/components/tabs/TabBar.d.ts +22 -0
  17. package/dist/components/tabs/TabBarTab.d.ts +20 -0
  18. package/dist/components/tabs/TabDragOverlay.d.ts +5 -0
  19. package/dist/components/window/DialogOverlay.d.ts +17 -0
  20. package/dist/components/window/Drawer.d.ts +22 -0
  21. package/dist/components/window/DrawerLayers.d.ts +9 -0
  22. package/dist/components/window/PopupLayerPortal.d.ts +10 -0
  23. package/dist/config/PanelContentDeclaration.d.ts +79 -0
  24. package/dist/config/index.d.ts +32 -0
  25. package/dist/config/panelRouter.d.ts +57 -0
  26. package/dist/config.cjs +2 -0
  27. package/dist/config.cjs.map +1 -0
  28. package/dist/config.js +210 -0
  29. package/dist/config.js.map +1 -0
  30. package/dist/constants/styles.d.ts +181 -0
  31. package/dist/floating/index.d.ts +8 -0
  32. package/dist/floating.cjs +2 -0
  33. package/dist/floating.cjs.map +1 -0
  34. package/dist/floating.js +67 -0
  35. package/dist/floating.js.map +1 -0
  36. package/dist/hooks/useCSSMatrix.d.ts +47 -0
  37. package/dist/hooks/useClonedElementPreview.d.ts +7 -0
  38. package/dist/hooks/useDocumentPointerEvents.d.ts +37 -0
  39. package/dist/hooks/useEffectEvent.d.ts +17 -0
  40. package/dist/hooks/useElementComponentWrapper.d.ts +18 -0
  41. package/dist/hooks/useIntersectionObserver.d.ts +20 -0
  42. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +23 -0
  43. package/dist/hooks/useResizeObserver.d.ts +15 -0
  44. package/dist/index.cjs +3 -0
  45. package/dist/index.cjs.map +1 -0
  46. package/dist/index.d.ts +20 -0
  47. package/dist/index.js +1863 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/modules/grid/GridLayoutContext.d.ts +34 -0
  50. package/dist/modules/grid/LayerInstanceContext.d.ts +26 -0
  51. package/dist/modules/grid/useGridPlacements.d.ts +7 -0
  52. package/dist/modules/grid/useGridTracks.d.ts +26 -0
  53. package/dist/modules/grid/useLayerDragHandle.d.ts +2 -0
  54. package/dist/modules/grid/useLayerInteractions.d.ts +12 -0
  55. package/dist/modules/keybindings/KeybindingsProvider.d.ts +17 -0
  56. package/dist/modules/panels/dom/DomRegistry.d.ts +19 -0
  57. package/dist/modules/panels/index.d.ts +11 -0
  58. package/dist/modules/panels/interactions/InteractionsContext.d.ts +50 -0
  59. package/dist/modules/panels/interactions/InteractionsContext.test.d.ts +1 -0
  60. package/dist/modules/panels/interactions/dnd.d.ts +5 -0
  61. package/dist/modules/panels/keybindings/KeybindingsInstaller.d.ts +5 -0
  62. package/dist/modules/panels/layout/adapter.d.ts +21 -0
  63. package/dist/modules/panels/rendering/GroupContainer.d.ts +11 -0
  64. package/dist/modules/panels/rendering/RenderBridge.d.ts +8 -0
  65. package/dist/modules/panels/rendering/RenderContext.d.ts +19 -0
  66. package/dist/modules/panels/state/PanelSplitHandles.d.ts +8 -0
  67. package/dist/modules/panels/state/PanelSystemContext.d.ts +148 -0
  68. package/dist/modules/panels/state/StateContext.d.ts +5 -0
  69. package/dist/modules/panels/state/cleanup.d.ts +11 -0
  70. package/dist/modules/panels/state/commands.d.ts +16 -0
  71. package/dist/modules/panels/state/focus/Context.d.ts +14 -0
  72. package/dist/modules/panels/state/focus/logic.d.ts +9 -0
  73. package/dist/modules/panels/state/groups/Context.d.ts +19 -0
  74. package/dist/modules/panels/state/groups/logic.d.ts +11 -0
  75. package/dist/modules/panels/state/splitLimits.d.ts +15 -0
  76. package/dist/modules/panels/state/tree/Context.d.ts +16 -0
  77. package/dist/modules/panels/state/tree/logic.d.ts +42 -0
  78. package/dist/modules/panels/state/types.d.ts +135 -0
  79. package/dist/modules/panels/system/PanelSystem.d.ts +6 -0
  80. package/dist/modules/resizer/useResizeDrag.d.ts +26 -0
  81. package/dist/modules/window/useDrawerState.d.ts +6 -0
  82. package/dist/styles-BMEhL6I0.cjs +2 -0
  83. package/dist/styles-BMEhL6I0.cjs.map +1 -0
  84. package/dist/styles-BnvLfp6e.js +49 -0
  85. package/dist/styles-BnvLfp6e.js.map +1 -0
  86. package/dist/types.d.ts +114 -0
  87. package/dist/utils/CSSMatrix.d.ts +42 -0
  88. package/dist/utils/dialogUtils.d.ts +18 -0
  89. package/dist/utils/math.d.ts +5 -0
  90. package/dist/utils/polyfills/createDialogPolyfill.d.ts +8 -0
  91. package/dist/utils/typedActions.d.ts +37 -0
  92. package/package.json +78 -0
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @file Floating drag preview and insertion guide for tab dragging.
3
+ */
4
+ import * as React from "react";
5
+ export declare const TabDragOverlay: React.FC;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @file Dialog-based overlay component with automatic positioning
3
+ */
4
+ import * as React from "react";
5
+ import type { Position } from "../../types";
6
+ export type DialogOverlayProps = {
7
+ anchor: Position;
8
+ visible: boolean;
9
+ onClose: () => void;
10
+ children: React.ReactNode;
11
+ contentClassName?: string;
12
+ contentStyle?: React.CSSProperties;
13
+ dataAttributes?: Record<string, string | number | boolean | null | undefined>;
14
+ onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
15
+ onPositionChange?: (position: Position) => void;
16
+ };
17
+ export declare const DialogOverlay: React.FC<DialogOverlayProps>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @file Drawer component
3
+ *
4
+ * Mobile-friendly slide-in panel with backdrop support.
5
+ */
6
+ import * as React from "react";
7
+ import type { DrawerBehavior, WindowPosition } from "../../types";
8
+ export type DrawerProps = {
9
+ id: string;
10
+ config: DrawerBehavior;
11
+ isOpen: boolean;
12
+ onClose: () => void;
13
+ children: React.ReactNode;
14
+ className?: string;
15
+ style?: React.CSSProperties;
16
+ zIndex?: number;
17
+ width?: string | number;
18
+ height?: string | number;
19
+ position?: WindowPosition;
20
+ backdropStyle?: React.CSSProperties;
21
+ };
22
+ export declare const Drawer: React.FC<DrawerProps>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file DrawerLayers component
3
+ */
4
+ import * as React from "react";
5
+ import type { LayerDefinition } from "../../types";
6
+ export type DrawerLayersProps = {
7
+ layers: LayerDefinition[];
8
+ };
9
+ export declare const DrawerLayers: React.FC<DrawerLayersProps>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @file Renders floating layers inside a dedicated browser popup window.
3
+ */
4
+ import * as React from "react";
5
+ import type { LayerDefinition } from "../../types";
6
+ type PopupLayerPortalProps = {
7
+ layer: LayerDefinition;
8
+ };
9
+ export declare const PopupLayerPortal: React.FC<PopupLayerPortalProps>;
10
+ export {};
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @file PanelContentDeclaration (JSX DSL for content configuration ONLY)
3
+ *
4
+ * IMPORTANT: This file declares a JSX DSL to configure panel "content" and layout
5
+ * tracks. It does NOT implement grid rendering, resizing, dragging, or drawers.
6
+ * Those behaviors live in the existing layout/rendering modules. Keep this file
7
+ * limited to declaration and conversion into GridLayout props.
8
+ *
9
+ * Usage (content declaration):
10
+ * <PanelLayout>
11
+ * <Config>
12
+ * <Rows>...</Rows>
13
+ * <Columns>...</Columns>
14
+ * <Areas matrix={...}/>
15
+ * </Config>
16
+ * <Panel type="grid" id="main" area="main">...</Panel>
17
+ * <Panel type="floating" id="preview" position={{ left: 0, top: 0 }} width={300} height={200} />
18
+ * <Panel type="drawer" id="nav" drawer={{ defaultOpen: true }} position={{ left: 0 }} />
19
+ * </PanelLayout>
20
+ */
21
+ import * as React from "react";
22
+ import type { DrawerBehavior, GridTrack, PanelLayoutConfig, WindowPosition } from "../types";
23
+ import type { PanelRoute } from "./panelRouter";
24
+ export type PanelRootProps = {
25
+ config?: PanelLayoutConfig;
26
+ style?: React.CSSProperties;
27
+ children?: React.ReactNode;
28
+ };
29
+ type PanelCommonProps = {
30
+ id: string;
31
+ visible?: boolean;
32
+ zIndex?: number;
33
+ width?: number | string;
34
+ height?: number | string;
35
+ pointerEvents?: boolean | "auto" | "none";
36
+ style?: React.CSSProperties;
37
+ children?: React.ReactNode;
38
+ };
39
+ export type PanelProps = (PanelCommonProps & {
40
+ type: "grid";
41
+ area: string;
42
+ }) | (PanelCommonProps & {
43
+ type: "floating";
44
+ position: WindowPosition;
45
+ width: number | string;
46
+ height: number | string;
47
+ draggable?: boolean;
48
+ resizable?: boolean;
49
+ }) | (PanelCommonProps & {
50
+ type: "drawer";
51
+ drawer: DrawerBehavior;
52
+ position?: WindowPosition;
53
+ backdropStyle?: React.CSSProperties;
54
+ });
55
+ export declare const Panel: React.FC<PanelProps>;
56
+ export declare const buildRoutesFromChildren: (children: React.ReactNode) => PanelRoute[];
57
+ export declare const PanelLayout: React.FC<PanelRootProps>;
58
+ export type ConfigProps = {
59
+ gap?: string;
60
+ style?: React.CSSProperties;
61
+ children?: React.ReactNode;
62
+ };
63
+ export declare const Config: React.FC<ConfigProps>;
64
+ export declare const Rows: React.FC<{
65
+ children?: React.ReactNode;
66
+ }>;
67
+ export declare const Columns: React.FC<{
68
+ children?: React.ReactNode;
69
+ }>;
70
+ export type RowProps = GridTrack;
71
+ export declare const Row: React.FC<RowProps>;
72
+ export type ColumnProps = GridTrack;
73
+ export declare const Col: React.FC<ColumnProps>;
74
+ export type AreasProps = {
75
+ matrix: string[][];
76
+ };
77
+ export declare const Areas: React.FC<AreasProps>;
78
+ export declare const buildConfigFromChildren: (children: React.ReactNode) => PanelLayoutConfig | null;
79
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file Config utilities entry point for JSX-based panel configuration
3
+ *
4
+ * This module provides JSX DSL components for declarative panel configuration.
5
+ * Import from 'react-panel-layout/config' to use these utilities.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import { PanelLayout, Config, Rows, Row, Columns, Col, Areas, Panel } from 'react-panel-layout/config';
10
+ *
11
+ * <PanelLayout>
12
+ * <Config>
13
+ * <Rows>
14
+ * <Row size="1fr" />
15
+ * <Row size="2fr" />
16
+ * </Rows>
17
+ * <Columns>
18
+ * <Col size="200px" />
19
+ * <Col size="1fr" />
20
+ * </Columns>
21
+ * <Areas matrix={[
22
+ * ['sidebar', 'main'],
23
+ * ['sidebar', 'main']
24
+ * ]} />
25
+ * </Config>
26
+ * <Panel type="grid" id="sidebar" area="sidebar">Sidebar</Panel>
27
+ * <Panel type="grid" id="main" area="main">Main</Panel>
28
+ * </PanelLayout>
29
+ * ```
30
+ */
31
+ export { PanelLayout, Panel, buildRoutesFromChildren, Config, Rows, Row, Columns, Col, Areas, buildConfigFromChildren, } from "./PanelContentDeclaration";
32
+ export type { PanelRootProps, PanelProps, ConfigProps, RowProps, ColumnProps, AreasProps, } from "./PanelContentDeclaration";
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @file Router-like builder for GridLayout
3
+ *
4
+ * Provides a React Router–style configuration API to declare panel layers.
5
+ * Converts route objects to the existing GridLayout props without magic.
6
+ */
7
+ import * as React from "react";
8
+ import type { DrawerBehavior, FloatingWindowConfig, LayerDefinition, LayerPositionMode, PanelLayoutConfig, PanelLayoutProps, WindowPosition } from "../types";
9
+ export type PanelRoute = {
10
+ /** Unique id for the layer. Required. */
11
+ id: string;
12
+ /** React node to render for this layer. Required. */
13
+ element: React.ReactNode;
14
+ /** Visibility flag. Defaults to visible. */
15
+ visible?: boolean;
16
+ /**
17
+ * Grid placement key. When using `positionMode: 'grid'` (default), this must be provided.
18
+ * Using `area` mirrors React Router's route path intent but for grid cells.
19
+ */
20
+ area?: string;
21
+ /** Explicit positioning mode; defaults to 'grid' unless floating/drawer implies otherwise. */
22
+ positionMode?: LayerPositionMode;
23
+ /** Offsets when using non-grid modes. */
24
+ position?: WindowPosition;
25
+ /** Optional stacking order. */
26
+ zIndex?: number;
27
+ /** Optional dimensions; required for resizable/draggable floating layers. */
28
+ width?: number | string;
29
+ height?: number | string;
30
+ /** Pointer events control. */
31
+ pointerEvents?: boolean | "auto" | "none";
32
+ /** Optional style overrides. */
33
+ style?: React.CSSProperties;
34
+ /** Optional backdrop style (drawer). */
35
+ backdropStyle?: React.CSSProperties;
36
+ /** Drawer behavior for mobile-friendly panels. */
37
+ drawer?: DrawerBehavior;
38
+ /** Floating window configuration. */
39
+ floating?: FloatingWindowConfig;
40
+ /**
41
+ * Optional child declarations; purely a grouping convenience.
42
+ * Children are flattened; no implicit inheritance.
43
+ */
44
+ children?: PanelRoute[];
45
+ };
46
+ export declare const buildLayersFromRoutes: (routes: PanelRoute[]) => LayerDefinition[];
47
+ export declare const createPanelLayoutFromRoutes: (input: {
48
+ config: PanelLayoutConfig;
49
+ routes: PanelRoute[];
50
+ style?: React.CSSProperties;
51
+ }) => PanelLayoutProps;
52
+ export type PanelLayoutRouterProps = {
53
+ config: PanelLayoutConfig;
54
+ routes: PanelRoute[];
55
+ style?: React.CSSProperties;
56
+ };
57
+ export declare const PanelLayoutRouter: React.FC<PanelLayoutRouterProps>;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),b=require("react"),E=require("./GridLayout-Dx3Qofl0.cjs");function v(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:()=>t[i]})}}return r.default=t,Object.freeze(r)}const s=v(b),C=t=>{const r=z(t);if(r==="grid"&&!t.area)throw new Error(`PanelRoute ${t.id} must specify 'area' for grid placement.`);return{id:t.id,component:t.element,visible:t.visible,gridArea:t.area,positionMode:r,position:t.position,zIndex:t.zIndex,width:t.width,height:t.height,pointerEvents:t.pointerEvents,style:t.style,drawer:t.drawer,floating:t.floating,backdropStyle:t.backdropStyle}},z=t=>t.positionMode?t.positionMode:t.floating?"absolute":(t.drawer,"grid"),R=t=>{const r=[],i=n=>{r.push(n),n.children&&n.children.forEach(e=>i(e))};return t.forEach(n=>i(n)),r},P=t=>{const r=new Set;t.forEach(i=>{if(r.has(i.id))throw new Error(`Duplicate PanelRoute id detected: ${i.id}`);r.add(i.id)})},x=t=>{const r=R(t);return P(r),r.map(i=>C(i))},d=()=>null,a=(t,r)=>s.isValidElement(t)?t.type===r:!1,p=t=>{const r=[],i=n=>{if(!(n==null||typeof n=="boolean")){if(Array.isArray(n)){n.forEach(i);return}if(a(n,d)){const e=n.props;if(!e.id)throw new Error("<Panel> requires an 'id' prop.");if(e.type==="grid"){if(!e.area)throw new Error(`<Panel id="${e.id}"> requires an explicit 'area' prop when type="grid".`);r.push({id:e.id,area:e.area,element:e.children??null,visible:e.visible,zIndex:e.zIndex,width:e.width,height:e.height,pointerEvents:e.pointerEvents,style:e.style});return}if(e.type==="floating"){if(!e.position)throw new Error(`<Panel id="${e.id}"> requires a 'position' prop when type="floating".`);if(e.width===void 0||e.height===void 0)throw new Error(`<Panel id="${e.id}"> requires 'width' and 'height' when type="floating".`);r.push({id:e.id,element:e.children??null,visible:e.visible??!0,positionMode:"absolute",position:e.position,zIndex:e.zIndex,width:e.width,height:e.height,pointerEvents:e.pointerEvents,style:e.style,floating:{mode:"embedded",draggable:e.draggable,resizable:e.resizable}});return}if(e.type==="drawer"){r.push({id:e.id,element:e.children??null,visible:e.visible??!0,positionMode:"relative",position:e.position,zIndex:e.zIndex,width:e.width,height:e.height,pointerEvents:e.pointerEvents,style:e.style,drawer:e.drawer,backdropStyle:e.backdropStyle});return}throw new Error("<Panel> has unsupported type.")}if(s.isValidElement(n)){if(n.type===s.Fragment){i(n.props.children);return}return}}};return i(t),r},S=({config:t,style:r,children:i})=>{const n=s.useMemo(()=>p(i),[i]),e=s.useMemo(()=>x(n),[n]),o=s.useMemo(()=>{if(t)return t;const l=m(i);if(!l)throw new Error("Panel requires either 'config' prop or a JSX config (<Config><Rows/><Columns/><Areas/></Config>). ");return l},[i,t]);return y.jsx(E.GridLayout,{config:o,layers:e,style:r})},f=()=>null,A=()=>null,M=()=>null,h=()=>null,w=()=>null,g=()=>null,u=(t,r)=>{const i=[],n=e=>{if(!(e==null||typeof e=="boolean")){if(Array.isArray(e)){e.forEach(n);return}if(a(e,r)){const o=e.props;if(!o.size)throw new Error("Row/Col requires 'size' property.");i.push({size:o.size,resizable:o.resizable,minSize:o.minSize,maxSize:o.maxSize});return}s.isValidElement(e)&&n(e.props.children)}};return n(t),i},q=t=>{const r=c(t,f);if(!r)return null;const i=r.props,n=u(r.props.children,h),e=u(r.props.children,w),o=c(r.props.children,g),l=o?o.props.matrix:void 0;return{gap:i.gap,style:i.style,rows:n,columns:e,areas:l}},c=(t,r)=>{const i=n=>{if(n==null||typeof n=="boolean")return null;if(Array.isArray(n)){for(const e of n){const o=i(e);if(o)return o}return null}return a(n,r)?n:s.isValidElement(n)?i(n.props.children):null};return i(t)},m=t=>{const r=q(t);if(!r)return null;if(!r.rows||r.rows.length===0)throw new Error("Config must include at least one <Row size=...> inside <Config>.");if(!r.columns||r.columns.length===0)throw new Error("Config must include at least one <Col size=...> inside <Config>.");if(!r.areas||r.areas.length===0)throw new Error("Config must include <Areas matrix={...}> inside <Config>.");const i=r.areas.length,n=r.areas[0]?.length??0;if(i!==r.rows.length)throw new Error(`Areas row count (${i}) must match Rows count (${r.rows.length}).`);if(n!==r.columns.length)throw new Error(`Areas column count (${n}) must match Columns count (${r.columns.length}).`);return{areas:r.areas,rows:r.rows,columns:r.columns,gap:r.gap,style:r.style}};exports.Areas=g;exports.Col=w;exports.Columns=M;exports.Config=f;exports.Panel=d;exports.PanelLayout=S;exports.Row=h;exports.Rows=A;exports.buildConfigFromChildren=m;exports.buildRoutesFromChildren=p;
2
+ //# sourceMappingURL=config.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.cjs","sources":["../src/config/panelRouter.tsx","../src/config/PanelContentDeclaration.tsx"],"sourcesContent":["/**\n * @file Router-like builder for GridLayout\n *\n * Provides a React Router–style configuration API to declare panel layers.\n * Converts route objects to the existing GridLayout props without magic.\n */\nimport * as React from \"react\";\nimport type {\n DrawerBehavior,\n FloatingWindowConfig,\n LayerDefinition,\n LayerPositionMode,\n PanelLayoutConfig,\n PanelLayoutProps,\n WindowPosition,\n} from \"../types\";\nimport { GridLayout } from \"../components/grid/GridLayout\";\n\nexport type PanelRoute = {\n /** Unique id for the layer. Required. */\n id: string;\n /** React node to render for this layer. Required. */\n element: React.ReactNode;\n /** Visibility flag. Defaults to visible. */\n visible?: boolean;\n\n /**\n * Grid placement key. When using `positionMode: 'grid'` (default), this must be provided.\n * Using `area` mirrors React Router's route path intent but for grid cells.\n */\n area?: string;\n\n /** Explicit positioning mode; defaults to 'grid' unless floating/drawer implies otherwise. */\n positionMode?: LayerPositionMode;\n /** Offsets when using non-grid modes. */\n position?: WindowPosition;\n /** Optional stacking order. */\n zIndex?: number;\n /** Optional dimensions; required for resizable/draggable floating layers. */\n width?: number | string;\n height?: number | string;\n /** Pointer events control. */\n pointerEvents?: boolean | \"auto\" | \"none\";\n /** Optional style overrides. */\n style?: React.CSSProperties;\n /** Optional backdrop style (drawer). */\n backdropStyle?: React.CSSProperties;\n\n /** Drawer behavior for mobile-friendly panels. */\n drawer?: DrawerBehavior;\n /** Floating window configuration. */\n floating?: FloatingWindowConfig;\n\n /**\n * Optional child declarations; purely a grouping convenience.\n * Children are flattened; no implicit inheritance.\n */\n children?: PanelRoute[];\n};\n\nconst toLayer = (route: PanelRoute): LayerDefinition => {\n const inferredMode: LayerPositionMode = resolveRoutePositionMode(route);\n\n if (inferredMode === \"grid\") {\n if (!route.area) {\n throw new Error(`PanelRoute ${route.id} must specify 'area' for grid placement.`);\n }\n }\n\n return {\n id: route.id,\n component: route.element,\n visible: route.visible,\n gridArea: route.area,\n positionMode: inferredMode,\n position: route.position,\n zIndex: route.zIndex,\n width: route.width,\n height: route.height,\n pointerEvents: route.pointerEvents,\n style: route.style,\n drawer: route.drawer,\n floating: route.floating,\n backdropStyle: route.backdropStyle,\n } satisfies LayerDefinition;\n};\n\nconst resolveRoutePositionMode = (route: PanelRoute): LayerPositionMode => {\n if (route.positionMode) {\n return route.positionMode;\n }\n if (route.floating) {\n // Embedded => absolute, Popup => relative (handled by renderer); keep explicitness here.\n return \"absolute\";\n }\n if (route.drawer) {\n return \"grid\";\n }\n return \"grid\";\n};\n\nconst flattenRoutes = (routes: PanelRoute[]): PanelRoute[] => {\n const result: PanelRoute[] = [];\n const walk = (node: PanelRoute): void => {\n result.push(node);\n if (node.children) {\n node.children.forEach((child) => walk(child));\n }\n };\n routes.forEach((r) => walk(r));\n return result;\n};\n\nconst validateUniqueIds = (routes: PanelRoute[]): void => {\n const seen = new Set<string>();\n routes.forEach((r) => {\n if (seen.has(r.id)) {\n throw new Error(`Duplicate PanelRoute id detected: ${r.id}`);\n }\n seen.add(r.id);\n });\n};\n\nexport const buildLayersFromRoutes = (routes: PanelRoute[]): LayerDefinition[] => {\n const flat = flattenRoutes(routes);\n validateUniqueIds(flat);\n return flat.map((r) => toLayer(r));\n};\n\nexport const createPanelLayoutFromRoutes = (input: {\n config: PanelLayoutConfig;\n routes: PanelRoute[];\n style?: React.CSSProperties;\n}): PanelLayoutProps => {\n const layers = buildLayersFromRoutes(input.routes);\n return {\n config: input.config,\n layers,\n };\n};\n\nexport type PanelLayoutRouterProps = {\n config: PanelLayoutConfig;\n routes: PanelRoute[];\n style?: React.CSSProperties;\n};\n\nexport const PanelLayoutRouter: React.FC<PanelLayoutRouterProps> = ({ config, routes, style }) => {\n const layers = React.useMemo(() => buildLayersFromRoutes(routes), [routes]);\n return <GridLayout config={config} layers={layers} style={style} />;\n};\n","/**\n * @file PanelContentDeclaration (JSX DSL for content configuration ONLY)\n *\n * IMPORTANT: This file declares a JSX DSL to configure panel \"content\" and layout\n * tracks. It does NOT implement grid rendering, resizing, dragging, or drawers.\n * Those behaviors live in the existing layout/rendering modules. Keep this file\n * limited to declaration and conversion into GridLayout props.\n *\n * Usage (content declaration):\n * <PanelLayout>\n * <Config>\n * <Rows>...</Rows>\n * <Columns>...</Columns>\n * <Areas matrix={...}/>\n * </Config>\n * <Panel type=\"grid\" id=\"main\" area=\"main\">...</Panel>\n * <Panel type=\"floating\" id=\"preview\" position={{ left: 0, top: 0 }} width={300} height={200} />\n * <Panel type=\"drawer\" id=\"nav\" drawer={{ defaultOpen: true }} position={{ left: 0 }} />\n * </PanelLayout>\n */\nimport * as React from \"react\";\nimport { GridLayout } from \"../components/grid/GridLayout\";\nimport type { DrawerBehavior, GridTrack, PanelLayoutConfig, WindowPosition } from \"../types\";\nimport type { PanelRoute } from \"./panelRouter\";\nimport { buildLayersFromRoutes } from \"./panelRouter\";\n\nexport type PanelRootProps = {\n config?: PanelLayoutConfig;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\n// Unified child declaration: <Panel type=\"grid\" .../> or <Panel type=\"floating\" .../>...\ntype PanelCommonProps = {\n id: string;\n visible?: boolean;\n zIndex?: number;\n width?: number | string;\n height?: number | string;\n pointerEvents?: boolean | \"auto\" | \"none\";\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\nexport type PanelProps =\n | (PanelCommonProps & { type: \"grid\"; area: string })\n | (PanelCommonProps & {\n type: \"floating\";\n position: WindowPosition;\n width: number | string;\n height: number | string;\n draggable?: boolean;\n resizable?: boolean;\n })\n | (PanelCommonProps & {\n type: \"drawer\";\n drawer: DrawerBehavior;\n position?: WindowPosition;\n backdropStyle?: React.CSSProperties;\n });\n\nexport const Panel: React.FC<PanelProps> = () => null;\n\nconst isElementOf = <P,>(element: unknown, component: React.FC<P>): element is React.ReactElement<P> => {\n if (!React.isValidElement<P>(element)) {\n return false;\n }\n return element.type === component;\n};\n\nexport const buildRoutesFromChildren = (children: React.ReactNode): PanelRoute[] => {\n const routes: PanelRoute[] = [];\n\n const visit = (node: React.ReactNode): void => {\n if (node === null || node === undefined || typeof node === \"boolean\") {\n return;\n }\n if (Array.isArray(node)) {\n node.forEach(visit);\n return;\n }\n // Unified <Panel type=\"...\" />\n if (isElementOf(node, Panel)) {\n const props = node.props as PanelProps;\n if (!props.id) {\n throw new Error(\"<Panel> requires an 'id' prop.\");\n }\n if (props.type === \"grid\") {\n if (!props.area) {\n throw new Error(`<Panel id=\"${props.id}\"> requires an explicit 'area' prop when type=\"grid\".`);\n }\n routes.push({\n id: props.id,\n area: props.area,\n element: props.children ?? null,\n visible: props.visible,\n zIndex: props.zIndex,\n width: props.width,\n height: props.height,\n pointerEvents: props.pointerEvents,\n style: props.style,\n });\n return;\n }\n if (props.type === \"floating\") {\n if (!props.position) {\n throw new Error(`<Panel id=\"${props.id}\"> requires a 'position' prop when type=\"floating\".`);\n }\n if (props.width === undefined || props.height === undefined) {\n throw new Error(`<Panel id=\"${props.id}\"> requires 'width' and 'height' when type=\"floating\".`);\n }\n routes.push({\n id: props.id,\n element: props.children ?? null,\n visible: props.visible ?? true,\n positionMode: \"absolute\",\n position: props.position,\n zIndex: props.zIndex,\n width: props.width,\n height: props.height,\n pointerEvents: props.pointerEvents,\n style: props.style,\n floating: { mode: \"embedded\", draggable: props.draggable, resizable: props.resizable },\n });\n return;\n }\n if (props.type === \"drawer\") {\n routes.push({\n id: props.id,\n element: props.children ?? null,\n visible: props.visible ?? true,\n positionMode: \"relative\",\n position: props.position,\n zIndex: props.zIndex,\n width: props.width,\n height: props.height,\n pointerEvents: props.pointerEvents,\n style: props.style,\n drawer: props.drawer,\n backdropStyle: props.backdropStyle,\n });\n return;\n }\n // unknown type -> error for explicitness\n throw new Error(\"<Panel> has unsupported type.\");\n }\n\n if (React.isValidElement(node)) {\n if (node.type === React.Fragment) {\n const el = node as React.ReactElement<{ children?: React.ReactNode }>;\n visit(el.props.children);\n return;\n }\n // Unknown element: ignore quietly to allow comments/wrappers.\n return;\n }\n // Primitive nodes (string/number) are ignored.\n };\n\n visit(children);\n return routes;\n};\n\n// Root container renamed to PanelLayout to avoid name collision with child <Panel/>\nexport const PanelLayout: React.FC<PanelRootProps> = ({ config, style, children }) => {\n const routes = React.useMemo(() => buildRoutesFromChildren(children), [children]);\n const layers = React.useMemo(() => buildLayersFromRoutes(routes), [routes]);\n const derivedConfig = React.useMemo(() => {\n if (config) {\n return config;\n }\n const built = buildConfigFromChildren(children);\n if (!built) {\n throw new Error(\"Panel requires either 'config' prop or a JSX config (<Config><Rows/><Columns/><Areas/></Config>). \");\n }\n return built;\n }, [children, config]);\n return <GridLayout config={derivedConfig} layers={layers} style={style} />;\n};\n\n// =============================\n// JSX Config Declarations\n// =============================\n\nexport type ConfigProps = {\n gap?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\nexport const Config: React.FC<ConfigProps> = () => {\n return null;\n};\n\nexport const Rows: React.FC<{ children?: React.ReactNode }> = () => {\n return null;\n};\n\nexport const Columns: React.FC<{ children?: React.ReactNode }> = () => {\n return null;\n};\n\nexport type RowProps = GridTrack;\nexport const Row: React.FC<RowProps> = () => {\n return null;\n};\n\nexport type ColumnProps = GridTrack;\nexport const Col: React.FC<ColumnProps> = () => {\n return null;\n};\n\nexport type AreasProps = {\n matrix: string[][];\n};\nexport const Areas: React.FC<AreasProps> = () => {\n return null;\n};\n\ntype CollectedConfig = {\n gap?: string;\n style?: React.CSSProperties;\n rows?: GridTrack[];\n columns?: GridTrack[];\n areas?: string[][];\n};\n\nconst collectTracks = <P extends GridTrack>(children: React.ReactNode, marker: React.FC<P>): GridTrack[] => {\n const result: GridTrack[] = [];\n const visit = (node: React.ReactNode): void => {\n if (node === null || node === undefined || typeof node === \"boolean\") {\n return;\n }\n if (Array.isArray(node)) {\n node.forEach(visit);\n return;\n }\n if (isElementOf(node, marker)) {\n const props = node.props as P;\n if (!props.size) {\n throw new Error(\"Row/Col requires 'size' property.\");\n }\n result.push({\n size: props.size,\n resizable: props.resizable,\n minSize: props.minSize,\n maxSize: props.maxSize,\n });\n return;\n }\n if (React.isValidElement(node)) {\n const el = node as React.ReactElement<{ children?: React.ReactNode }>;\n visit(el.props.children);\n }\n };\n visit(children);\n return result;\n};\n\nconst collectConfigBlock = (children: React.ReactNode): CollectedConfig | null => {\n const node = findFirst(children, Config);\n if (!node) {\n return null;\n }\n const props = node.props as ConfigProps;\n const rows = collectTracks(node.props.children, Row);\n const columns = collectTracks(node.props.children, Col);\n const areasNode = findFirst(node.props.children, Areas);\n const areas = areasNode ? (areasNode.props as AreasProps).matrix : undefined;\n return {\n gap: props.gap,\n style: props.style,\n rows,\n columns,\n areas,\n };\n};\n\nconst findFirst = <P,>(children: React.ReactNode, marker: React.FC<P>): React.ReactElement<P> | null => {\n const visit = (node: React.ReactNode): React.ReactElement<P> | null => {\n if (node === null || node === undefined || typeof node === \"boolean\") {\n return null;\n }\n if (Array.isArray(node)) {\n for (const item of node) {\n const found = visit(item);\n if (found) {\n return found;\n }\n }\n return null;\n }\n if (isElementOf(node, marker)) {\n return node as React.ReactElement<P>;\n }\n if (React.isValidElement(node)) {\n const el = node as React.ReactElement<{ children?: React.ReactNode }>;\n return visit(el.props.children);\n }\n return null;\n };\n return visit(children);\n};\n\nexport const buildConfigFromChildren = (children: React.ReactNode): PanelLayoutConfig | null => {\n const collected = collectConfigBlock(children);\n if (!collected) {\n return null;\n }\n if (!collected.rows || collected.rows.length === 0) {\n throw new Error(\"Config must include at least one <Row size=...> inside <Config>.\");\n }\n if (!collected.columns || collected.columns.length === 0) {\n throw new Error(\"Config must include at least one <Col size=...> inside <Config>.\");\n }\n if (!collected.areas || collected.areas.length === 0) {\n throw new Error(\"Config must include <Areas matrix={...}> inside <Config>.\");\n }\n\n const rowCount = collected.areas.length;\n const colCount = collected.areas[0]?.length ?? 0;\n if (rowCount !== collected.rows.length) {\n throw new Error(`Areas row count (${rowCount}) must match Rows count (${collected.rows.length}).`);\n }\n if (colCount !== collected.columns.length) {\n throw new Error(`Areas column count (${colCount}) must match Columns count (${collected.columns.length}).`);\n }\n\n return {\n areas: collected.areas,\n rows: collected.rows,\n columns: collected.columns,\n gap: collected.gap,\n style: collected.style,\n } satisfies PanelLayoutConfig;\n};\n"],"names":["toLayer","route","inferredMode","resolveRoutePositionMode","flattenRoutes","routes","result","walk","node","child","r","validateUniqueIds","seen","buildLayersFromRoutes","flat","Panel","isElementOf","element","component","React","buildRoutesFromChildren","children","visit","props","PanelLayout","config","style","layers","derivedConfig","built","buildConfigFromChildren","jsx","GridLayout","Config","Rows","Columns","Row","Col","Areas","collectTracks","marker","collectConfigBlock","findFirst","rows","columns","areasNode","areas","item","found","collected","rowCount","colCount"],"mappings":"ycA4DMA,EAAWC,GAAuC,CACtD,MAAMC,EAAkCC,EAAyBF,CAAK,EAEtE,GAAIC,IAAiB,QACf,CAACD,EAAM,KACT,MAAM,IAAI,MAAM,cAAcA,EAAM,EAAE,0CAA0C,EAIpF,MAAO,CACL,GAAIA,EAAM,GACV,UAAWA,EAAM,QACjB,QAASA,EAAM,QACf,SAAUA,EAAM,KAChB,aAAcC,EACd,SAAUD,EAAM,SAChB,OAAQA,EAAM,OACd,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,cAAeA,EAAM,cACrB,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,SAAUA,EAAM,SAChB,cAAeA,EAAM,aAAA,CAEzB,EAEME,EAA4BF,GAC5BA,EAAM,aACDA,EAAM,aAEXA,EAAM,SAED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AEnG,GAAIE,IAAaF,EAAU,QAAQ,OACjC,MAAM,IAAI,MAAM,uBAAuBE,CAAQ,+BAA+BF,EAAU,QAAQ,MAAM,IAAI,EAG5G,MAAO,CACL,MAAOA,EAAU,MACjB,KAAMA,EAAU,KAChB,QAASA,EAAU,QACnB,IAAKA,EAAU,IACf,MAAOA,EAAU,KAAA,CAErB"}
package/dist/config.js ADDED
@@ -0,0 +1,210 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { G as d } from "./GridLayout-CmzKfbPP.js";
4
+ const f = (t) => {
5
+ const r = h(t);
6
+ if (r === "grid" && !t.area)
7
+ throw new Error(`PanelRoute ${t.id} must specify 'area' for grid placement.`);
8
+ return {
9
+ id: t.id,
10
+ component: t.element,
11
+ visible: t.visible,
12
+ gridArea: t.area,
13
+ positionMode: r,
14
+ position: t.position,
15
+ zIndex: t.zIndex,
16
+ width: t.width,
17
+ height: t.height,
18
+ pointerEvents: t.pointerEvents,
19
+ style: t.style,
20
+ drawer: t.drawer,
21
+ floating: t.floating,
22
+ backdropStyle: t.backdropStyle
23
+ };
24
+ }, h = (t) => t.positionMode ? t.positionMode : t.floating ? "absolute" : (t.drawer, "grid"), w = (t) => {
25
+ const r = [], n = (i) => {
26
+ r.push(i), i.children && i.children.forEach((e) => n(e));
27
+ };
28
+ return t.forEach((i) => n(i)), r;
29
+ }, g = (t) => {
30
+ const r = /* @__PURE__ */ new Set();
31
+ t.forEach((n) => {
32
+ if (r.has(n.id))
33
+ throw new Error(`Duplicate PanelRoute id detected: ${n.id}`);
34
+ r.add(n.id);
35
+ });
36
+ }, m = (t) => {
37
+ const r = w(t);
38
+ return g(r), r.map((n) => f(n));
39
+ }, y = () => null, a = (t, r) => s.isValidElement(t) ? t.type === r : !1, E = (t) => {
40
+ const r = [], n = (i) => {
41
+ if (!(i == null || typeof i == "boolean")) {
42
+ if (Array.isArray(i)) {
43
+ i.forEach(n);
44
+ return;
45
+ }
46
+ if (a(i, y)) {
47
+ const e = i.props;
48
+ if (!e.id)
49
+ throw new Error("<Panel> requires an 'id' prop.");
50
+ if (e.type === "grid") {
51
+ if (!e.area)
52
+ throw new Error(`<Panel id="${e.id}"> requires an explicit 'area' prop when type="grid".`);
53
+ r.push({
54
+ id: e.id,
55
+ area: e.area,
56
+ element: e.children ?? null,
57
+ visible: e.visible,
58
+ zIndex: e.zIndex,
59
+ width: e.width,
60
+ height: e.height,
61
+ pointerEvents: e.pointerEvents,
62
+ style: e.style
63
+ });
64
+ return;
65
+ }
66
+ if (e.type === "floating") {
67
+ if (!e.position)
68
+ throw new Error(`<Panel id="${e.id}"> requires a 'position' prop when type="floating".`);
69
+ if (e.width === void 0 || e.height === void 0)
70
+ throw new Error(`<Panel id="${e.id}"> requires 'width' and 'height' when type="floating".`);
71
+ r.push({
72
+ id: e.id,
73
+ element: e.children ?? null,
74
+ visible: e.visible ?? !0,
75
+ positionMode: "absolute",
76
+ position: e.position,
77
+ zIndex: e.zIndex,
78
+ width: e.width,
79
+ height: e.height,
80
+ pointerEvents: e.pointerEvents,
81
+ style: e.style,
82
+ floating: { mode: "embedded", draggable: e.draggable, resizable: e.resizable }
83
+ });
84
+ return;
85
+ }
86
+ if (e.type === "drawer") {
87
+ r.push({
88
+ id: e.id,
89
+ element: e.children ?? null,
90
+ visible: e.visible ?? !0,
91
+ positionMode: "relative",
92
+ position: e.position,
93
+ zIndex: e.zIndex,
94
+ width: e.width,
95
+ height: e.height,
96
+ pointerEvents: e.pointerEvents,
97
+ style: e.style,
98
+ drawer: e.drawer,
99
+ backdropStyle: e.backdropStyle
100
+ });
101
+ return;
102
+ }
103
+ throw new Error("<Panel> has unsupported type.");
104
+ }
105
+ if (s.isValidElement(i)) {
106
+ if (i.type === s.Fragment) {
107
+ n(i.props.children);
108
+ return;
109
+ }
110
+ return;
111
+ }
112
+ }
113
+ };
114
+ return n(t), r;
115
+ }, M = ({ config: t, style: r, children: n }) => {
116
+ const i = s.useMemo(() => E(n), [n]), e = s.useMemo(() => m(i), [i]), o = s.useMemo(() => {
117
+ if (t)
118
+ return t;
119
+ const l = R(n);
120
+ if (!l)
121
+ throw new Error("Panel requires either 'config' prop or a JSX config (<Config><Rows/><Columns/><Areas/></Config>). ");
122
+ return l;
123
+ }, [n, t]);
124
+ return /* @__PURE__ */ p(d, { config: o, layers: e, style: r });
125
+ }, v = () => null, S = () => null, I = () => null, b = () => null, z = () => null, C = () => null, u = (t, r) => {
126
+ const n = [], i = (e) => {
127
+ if (!(e == null || typeof e == "boolean")) {
128
+ if (Array.isArray(e)) {
129
+ e.forEach(i);
130
+ return;
131
+ }
132
+ if (a(e, r)) {
133
+ const o = e.props;
134
+ if (!o.size)
135
+ throw new Error("Row/Col requires 'size' property.");
136
+ n.push({
137
+ size: o.size,
138
+ resizable: o.resizable,
139
+ minSize: o.minSize,
140
+ maxSize: o.maxSize
141
+ });
142
+ return;
143
+ }
144
+ s.isValidElement(e) && i(e.props.children);
145
+ }
146
+ };
147
+ return i(t), n;
148
+ }, x = (t) => {
149
+ const r = c(t, v);
150
+ if (!r)
151
+ return null;
152
+ const n = r.props, i = u(r.props.children, b), e = u(r.props.children, z), o = c(r.props.children, C), l = o ? o.props.matrix : void 0;
153
+ return {
154
+ gap: n.gap,
155
+ style: n.style,
156
+ rows: i,
157
+ columns: e,
158
+ areas: l
159
+ };
160
+ }, c = (t, r) => {
161
+ const n = (i) => {
162
+ if (i == null || typeof i == "boolean")
163
+ return null;
164
+ if (Array.isArray(i)) {
165
+ for (const e of i) {
166
+ const o = n(e);
167
+ if (o)
168
+ return o;
169
+ }
170
+ return null;
171
+ }
172
+ return a(i, r) ? i : s.isValidElement(i) ? n(i.props.children) : null;
173
+ };
174
+ return n(t);
175
+ }, R = (t) => {
176
+ const r = x(t);
177
+ if (!r)
178
+ return null;
179
+ if (!r.rows || r.rows.length === 0)
180
+ throw new Error("Config must include at least one <Row size=...> inside <Config>.");
181
+ if (!r.columns || r.columns.length === 0)
182
+ throw new Error("Config must include at least one <Col size=...> inside <Config>.");
183
+ if (!r.areas || r.areas.length === 0)
184
+ throw new Error("Config must include <Areas matrix={...}> inside <Config>.");
185
+ const n = r.areas.length, i = r.areas[0]?.length ?? 0;
186
+ if (n !== r.rows.length)
187
+ throw new Error(`Areas row count (${n}) must match Rows count (${r.rows.length}).`);
188
+ if (i !== r.columns.length)
189
+ throw new Error(`Areas column count (${i}) must match Columns count (${r.columns.length}).`);
190
+ return {
191
+ areas: r.areas,
192
+ rows: r.rows,
193
+ columns: r.columns,
194
+ gap: r.gap,
195
+ style: r.style
196
+ };
197
+ };
198
+ export {
199
+ C as Areas,
200
+ z as Col,
201
+ I as Columns,
202
+ v as Config,
203
+ y as Panel,
204
+ M as PanelLayout,
205
+ b as Row,
206
+ S as Rows,
207
+ R as buildConfigFromChildren,
208
+ E as buildRoutesFromChildren
209
+ };
210
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sources":["../src/config/panelRouter.tsx","../src/config/PanelContentDeclaration.tsx"],"sourcesContent":["/**\n * @file Router-like builder for GridLayout\n *\n * Provides a React Router–style configuration API to declare panel layers.\n * Converts route objects to the existing GridLayout props without magic.\n */\nimport * as React from \"react\";\nimport type {\n DrawerBehavior,\n FloatingWindowConfig,\n LayerDefinition,\n LayerPositionMode,\n PanelLayoutConfig,\n PanelLayoutProps,\n WindowPosition,\n} from \"../types\";\nimport { GridLayout } from \"../components/grid/GridLayout\";\n\nexport type PanelRoute = {\n /** Unique id for the layer. Required. */\n id: string;\n /** React node to render for this layer. Required. */\n element: React.ReactNode;\n /** Visibility flag. Defaults to visible. */\n visible?: boolean;\n\n /**\n * Grid placement key. When using `positionMode: 'grid'` (default), this must be provided.\n * Using `area` mirrors React Router's route path intent but for grid cells.\n */\n area?: string;\n\n /** Explicit positioning mode; defaults to 'grid' unless floating/drawer implies otherwise. */\n positionMode?: LayerPositionMode;\n /** Offsets when using non-grid modes. */\n position?: WindowPosition;\n /** Optional stacking order. */\n zIndex?: number;\n /** Optional dimensions; required for resizable/draggable floating layers. */\n width?: number | string;\n height?: number | string;\n /** Pointer events control. */\n pointerEvents?: boolean | \"auto\" | \"none\";\n /** Optional style overrides. */\n style?: React.CSSProperties;\n /** Optional backdrop style (drawer). */\n backdropStyle?: React.CSSProperties;\n\n /** Drawer behavior for mobile-friendly panels. */\n drawer?: DrawerBehavior;\n /** Floating window configuration. */\n floating?: FloatingWindowConfig;\n\n /**\n * Optional child declarations; purely a grouping convenience.\n * Children are flattened; no implicit inheritance.\n */\n children?: PanelRoute[];\n};\n\nconst toLayer = (route: PanelRoute): LayerDefinition => {\n const inferredMode: LayerPositionMode = resolveRoutePositionMode(route);\n\n if (inferredMode === \"grid\") {\n if (!route.area) {\n throw new Error(`PanelRoute ${route.id} must specify 'area' for grid placement.`);\n }\n }\n\n return {\n id: route.id,\n component: route.element,\n visible: route.visible,\n gridArea: route.area,\n positionMode: inferredMode,\n position: route.position,\n zIndex: route.zIndex,\n width: route.width,\n height: route.height,\n pointerEvents: route.pointerEvents,\n style: route.style,\n drawer: route.drawer,\n floating: route.floating,\n backdropStyle: route.backdropStyle,\n } satisfies LayerDefinition;\n};\n\nconst resolveRoutePositionMode = (route: PanelRoute): LayerPositionMode => {\n if (route.positionMode) {\n return route.positionMode;\n }\n if (route.floating) {\n // Embedded => absolute, Popup => relative (handled by renderer); keep explicitness here.\n return \"absolute\";\n }\n if (route.drawer) {\n return \"grid\";\n }\n return \"grid\";\n};\n\nconst flattenRoutes = (routes: PanelRoute[]): PanelRoute[] => {\n const result: PanelRoute[] = [];\n const walk = (node: PanelRoute): void => {\n result.push(node);\n if (node.children) {\n node.children.forEach((child) => walk(child));\n }\n };\n routes.forEach((r) => walk(r));\n return result;\n};\n\nconst validateUniqueIds = (routes: PanelRoute[]): void => {\n const seen = new Set<string>();\n routes.forEach((r) => {\n if (seen.has(r.id)) {\n throw new Error(`Duplicate PanelRoute id detected: ${r.id}`);\n }\n seen.add(r.id);\n });\n};\n\nexport const buildLayersFromRoutes = (routes: PanelRoute[]): LayerDefinition[] => {\n const flat = flattenRoutes(routes);\n validateUniqueIds(flat);\n return flat.map((r) => toLayer(r));\n};\n\nexport const createPanelLayoutFromRoutes = (input: {\n config: PanelLayoutConfig;\n routes: PanelRoute[];\n style?: React.CSSProperties;\n}): PanelLayoutProps => {\n const layers = buildLayersFromRoutes(input.routes);\n return {\n config: input.config,\n layers,\n };\n};\n\nexport type PanelLayoutRouterProps = {\n config: PanelLayoutConfig;\n routes: PanelRoute[];\n style?: React.CSSProperties;\n};\n\nexport const PanelLayoutRouter: React.FC<PanelLayoutRouterProps> = ({ config, routes, style }) => {\n const layers = React.useMemo(() => buildLayersFromRoutes(routes), [routes]);\n return <GridLayout config={config} layers={layers} style={style} />;\n};\n","/**\n * @file PanelContentDeclaration (JSX DSL for content configuration ONLY)\n *\n * IMPORTANT: This file declares a JSX DSL to configure panel \"content\" and layout\n * tracks. It does NOT implement grid rendering, resizing, dragging, or drawers.\n * Those behaviors live in the existing layout/rendering modules. Keep this file\n * limited to declaration and conversion into GridLayout props.\n *\n * Usage (content declaration):\n * <PanelLayout>\n * <Config>\n * <Rows>...</Rows>\n * <Columns>...</Columns>\n * <Areas matrix={...}/>\n * </Config>\n * <Panel type=\"grid\" id=\"main\" area=\"main\">...</Panel>\n * <Panel type=\"floating\" id=\"preview\" position={{ left: 0, top: 0 }} width={300} height={200} />\n * <Panel type=\"drawer\" id=\"nav\" drawer={{ defaultOpen: true }} position={{ left: 0 }} />\n * </PanelLayout>\n */\nimport * as React from \"react\";\nimport { GridLayout } from \"../components/grid/GridLayout\";\nimport type { DrawerBehavior, GridTrack, PanelLayoutConfig, WindowPosition } from \"../types\";\nimport type { PanelRoute } from \"./panelRouter\";\nimport { buildLayersFromRoutes } from \"./panelRouter\";\n\nexport type PanelRootProps = {\n config?: PanelLayoutConfig;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\n// Unified child declaration: <Panel type=\"grid\" .../> or <Panel type=\"floating\" .../>...\ntype PanelCommonProps = {\n id: string;\n visible?: boolean;\n zIndex?: number;\n width?: number | string;\n height?: number | string;\n pointerEvents?: boolean | \"auto\" | \"none\";\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\nexport type PanelProps =\n | (PanelCommonProps & { type: \"grid\"; area: string })\n | (PanelCommonProps & {\n type: \"floating\";\n position: WindowPosition;\n width: number | string;\n height: number | string;\n draggable?: boolean;\n resizable?: boolean;\n })\n | (PanelCommonProps & {\n type: \"drawer\";\n drawer: DrawerBehavior;\n position?: WindowPosition;\n backdropStyle?: React.CSSProperties;\n });\n\nexport const Panel: React.FC<PanelProps> = () => null;\n\nconst isElementOf = <P,>(element: unknown, component: React.FC<P>): element is React.ReactElement<P> => {\n if (!React.isValidElement<P>(element)) {\n return false;\n }\n return element.type === component;\n};\n\nexport const buildRoutesFromChildren = (children: React.ReactNode): PanelRoute[] => {\n const routes: PanelRoute[] = [];\n\n const visit = (node: React.ReactNode): void => {\n if (node === null || node === undefined || typeof node === \"boolean\") {\n return;\n }\n if (Array.isArray(node)) {\n node.forEach(visit);\n return;\n }\n // Unified <Panel type=\"...\" />\n if (isElementOf(node, Panel)) {\n const props = node.props as PanelProps;\n if (!props.id) {\n throw new Error(\"<Panel> requires an 'id' prop.\");\n }\n if (props.type === \"grid\") {\n if (!props.area) {\n throw new Error(`<Panel id=\"${props.id}\"> requires an explicit 'area' prop when type=\"grid\".`);\n }\n routes.push({\n id: props.id,\n area: props.area,\n element: props.children ?? null,\n visible: props.visible,\n zIndex: props.zIndex,\n width: props.width,\n height: props.height,\n pointerEvents: props.pointerEvents,\n style: props.style,\n });\n return;\n }\n if (props.type === \"floating\") {\n if (!props.position) {\n throw new Error(`<Panel id=\"${props.id}\"> requires a 'position' prop when type=\"floating\".`);\n }\n if (props.width === undefined || props.height === undefined) {\n throw new Error(`<Panel id=\"${props.id}\"> requires 'width' and 'height' when type=\"floating\".`);\n }\n routes.push({\n id: props.id,\n element: props.children ?? null,\n visible: props.visible ?? true,\n positionMode: \"absolute\",\n position: props.position,\n zIndex: props.zIndex,\n width: props.width,\n height: props.height,\n pointerEvents: props.pointerEvents,\n style: props.style,\n floating: { mode: \"embedded\", draggable: props.draggable, resizable: props.resizable },\n });\n return;\n }\n if (props.type === \"drawer\") {\n routes.push({\n id: props.id,\n element: props.children ?? null,\n visible: props.visible ?? true,\n positionMode: \"relative\",\n position: props.position,\n zIndex: props.zIndex,\n width: props.width,\n height: props.height,\n pointerEvents: props.pointerEvents,\n style: props.style,\n drawer: props.drawer,\n backdropStyle: props.backdropStyle,\n });\n return;\n }\n // unknown type -> error for explicitness\n throw new Error(\"<Panel> has unsupported type.\");\n }\n\n if (React.isValidElement(node)) {\n if (node.type === React.Fragment) {\n const el = node as React.ReactElement<{ children?: React.ReactNode }>;\n visit(el.props.children);\n return;\n }\n // Unknown element: ignore quietly to allow comments/wrappers.\n return;\n }\n // Primitive nodes (string/number) are ignored.\n };\n\n visit(children);\n return routes;\n};\n\n// Root container renamed to PanelLayout to avoid name collision with child <Panel/>\nexport const PanelLayout: React.FC<PanelRootProps> = ({ config, style, children }) => {\n const routes = React.useMemo(() => buildRoutesFromChildren(children), [children]);\n const layers = React.useMemo(() => buildLayersFromRoutes(routes), [routes]);\n const derivedConfig = React.useMemo(() => {\n if (config) {\n return config;\n }\n const built = buildConfigFromChildren(children);\n if (!built) {\n throw new Error(\"Panel requires either 'config' prop or a JSX config (<Config><Rows/><Columns/><Areas/></Config>). \");\n }\n return built;\n }, [children, config]);\n return <GridLayout config={derivedConfig} layers={layers} style={style} />;\n};\n\n// =============================\n// JSX Config Declarations\n// =============================\n\nexport type ConfigProps = {\n gap?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\nexport const Config: React.FC<ConfigProps> = () => {\n return null;\n};\n\nexport const Rows: React.FC<{ children?: React.ReactNode }> = () => {\n return null;\n};\n\nexport const Columns: React.FC<{ children?: React.ReactNode }> = () => {\n return null;\n};\n\nexport type RowProps = GridTrack;\nexport const Row: React.FC<RowProps> = () => {\n return null;\n};\n\nexport type ColumnProps = GridTrack;\nexport const Col: React.FC<ColumnProps> = () => {\n return null;\n};\n\nexport type AreasProps = {\n matrix: string[][];\n};\nexport const Areas: React.FC<AreasProps> = () => {\n return null;\n};\n\ntype CollectedConfig = {\n gap?: string;\n style?: React.CSSProperties;\n rows?: GridTrack[];\n columns?: GridTrack[];\n areas?: string[][];\n};\n\nconst collectTracks = <P extends GridTrack>(children: React.ReactNode, marker: React.FC<P>): GridTrack[] => {\n const result: GridTrack[] = [];\n const visit = (node: React.ReactNode): void => {\n if (node === null || node === undefined || typeof node === \"boolean\") {\n return;\n }\n if (Array.isArray(node)) {\n node.forEach(visit);\n return;\n }\n if (isElementOf(node, marker)) {\n const props = node.props as P;\n if (!props.size) {\n throw new Error(\"Row/Col requires 'size' property.\");\n }\n result.push({\n size: props.size,\n resizable: props.resizable,\n minSize: props.minSize,\n maxSize: props.maxSize,\n });\n return;\n }\n if (React.isValidElement(node)) {\n const el = node as React.ReactElement<{ children?: React.ReactNode }>;\n visit(el.props.children);\n }\n };\n visit(children);\n return result;\n};\n\nconst collectConfigBlock = (children: React.ReactNode): CollectedConfig | null => {\n const node = findFirst(children, Config);\n if (!node) {\n return null;\n }\n const props = node.props as ConfigProps;\n const rows = collectTracks(node.props.children, Row);\n const columns = collectTracks(node.props.children, Col);\n const areasNode = findFirst(node.props.children, Areas);\n const areas = areasNode ? (areasNode.props as AreasProps).matrix : undefined;\n return {\n gap: props.gap,\n style: props.style,\n rows,\n columns,\n areas,\n };\n};\n\nconst findFirst = <P,>(children: React.ReactNode, marker: React.FC<P>): React.ReactElement<P> | null => {\n const visit = (node: React.ReactNode): React.ReactElement<P> | null => {\n if (node === null || node === undefined || typeof node === \"boolean\") {\n return null;\n }\n if (Array.isArray(node)) {\n for (const item of node) {\n const found = visit(item);\n if (found) {\n return found;\n }\n }\n return null;\n }\n if (isElementOf(node, marker)) {\n return node as React.ReactElement<P>;\n }\n if (React.isValidElement(node)) {\n const el = node as React.ReactElement<{ children?: React.ReactNode }>;\n return visit(el.props.children);\n }\n return null;\n };\n return visit(children);\n};\n\nexport const buildConfigFromChildren = (children: React.ReactNode): PanelLayoutConfig | null => {\n const collected = collectConfigBlock(children);\n if (!collected) {\n return null;\n }\n if (!collected.rows || collected.rows.length === 0) {\n throw new Error(\"Config must include at least one <Row size=...> inside <Config>.\");\n }\n if (!collected.columns || collected.columns.length === 0) {\n throw new Error(\"Config must include at least one <Col size=...> inside <Config>.\");\n }\n if (!collected.areas || collected.areas.length === 0) {\n throw new Error(\"Config must include <Areas matrix={...}> inside <Config>.\");\n }\n\n const rowCount = collected.areas.length;\n const colCount = collected.areas[0]?.length ?? 0;\n if (rowCount !== collected.rows.length) {\n throw new Error(`Areas row count (${rowCount}) must match Rows count (${collected.rows.length}).`);\n }\n if (colCount !== collected.columns.length) {\n throw new Error(`Areas column count (${colCount}) must match Columns count (${collected.columns.length}).`);\n }\n\n return {\n areas: collected.areas,\n rows: collected.rows,\n columns: collected.columns,\n gap: collected.gap,\n style: collected.style,\n } satisfies PanelLayoutConfig;\n};\n"],"names":["toLayer","route","inferredMode","resolveRoutePositionMode","flattenRoutes","routes","result","walk","node","child","r","validateUniqueIds","seen","buildLayersFromRoutes","flat","Panel","isElementOf","element","component","React","buildRoutesFromChildren","children","visit","props","PanelLayout","config","style","layers","derivedConfig","built","buildConfigFromChildren","jsx","GridLayout","Config","Rows","Columns","Row","Col","Areas","collectTracks","marker","collectConfigBlock","findFirst","rows","columns","areasNode","areas","item","found","collected","rowCount","colCount"],"mappings":";;;AA4DA,MAAMA,IAAU,CAACC,MAAuC;AACtD,QAAMC,IAAkCC,EAAyBF,CAAK;AAEtE,MAAIC,MAAiB,UACf,CAACD,EAAM;AACT,UAAM,IAAI,MAAM,cAAcA,EAAM,EAAE,0CAA0C;AAIpF,SAAO;AAAA,IACL,IAAIA,EAAM;AAAA,IACV,WAAWA,EAAM;AAAA,IACjB,SAASA,EAAM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