react-panel-layout 0.4.1 → 0.5.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 (63) hide show
  1. package/README.md +291 -0
  2. package/dist/FloatingPanelFrame-DDT6aING.js +66 -0
  3. package/dist/FloatingPanelFrame-DDT6aING.js.map +1 -0
  4. package/dist/FloatingPanelFrame-DrYwgI9f.cjs +2 -0
  5. package/dist/FloatingPanelFrame-DrYwgI9f.cjs.map +1 -0
  6. package/dist/GridLayout-DC7fCmcI.cjs +2 -0
  7. package/dist/GridLayout-DC7fCmcI.cjs.map +1 -0
  8. package/dist/GridLayout-tpSM0iM-.js +1460 -0
  9. package/dist/GridLayout-tpSM0iM-.js.map +1 -0
  10. package/dist/components/grid/GridLayout.d.ts +5 -0
  11. package/dist/components/pivot/PivotLayer.d.ts +14 -0
  12. package/dist/components/window/FloatingWindow.d.ts +15 -0
  13. package/dist/config/PanelContentDeclaration.d.ts +20 -0
  14. package/dist/config/panelRouter.d.ts +4 -2
  15. package/dist/config.cjs +1 -1
  16. package/dist/config.cjs.map +1 -1
  17. package/dist/config.js +125 -76
  18. package/dist/config.js.map +1 -1
  19. package/dist/constants/styles.d.ts +8 -0
  20. package/dist/floating.cjs +1 -1
  21. package/dist/floating.js +1 -1
  22. package/dist/index.cjs +2 -2
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.ts +4 -1
  25. package/dist/index.js +996 -853
  26. package/dist/index.js.map +1 -1
  27. package/dist/modules/grid/GridLayoutContext.d.ts +5 -0
  28. package/dist/modules/grid/resizeHandles.d.ts +14 -0
  29. package/dist/modules/grid/trackUtils.d.ts +29 -0
  30. package/dist/modules/grid/useGridTracks.d.ts +6 -15
  31. package/dist/modules/grid/useLayerInteractions.d.ts +2 -1
  32. package/dist/modules/panels/rendering/ContentRegistry.d.ts +50 -0
  33. package/dist/modules/panels/rendering/RenderContext.d.ts +1 -0
  34. package/dist/modules/panels/state/types.d.ts +2 -2
  35. package/dist/modules/pivot/PivotContent.d.ts +29 -0
  36. package/dist/modules/pivot/index.d.ts +5 -0
  37. package/dist/modules/pivot/types.d.ts +62 -0
  38. package/dist/modules/pivot/usePivot.d.ts +28 -0
  39. package/dist/modules/window/useFloatingState.d.ts +9 -0
  40. package/dist/pivot/index.d.ts +8 -0
  41. package/dist/pivot.cjs +2 -0
  42. package/dist/pivot.cjs.map +1 -0
  43. package/dist/pivot.js +5 -0
  44. package/dist/pivot.js.map +1 -0
  45. package/dist/styles-DcG3aIFx.cjs +2 -0
  46. package/dist/styles-DcG3aIFx.cjs.map +1 -0
  47. package/dist/styles-w0ZixggV.js +51 -0
  48. package/dist/styles-w0ZixggV.js.map +1 -0
  49. package/dist/types.d.ts +106 -4
  50. package/dist/usePivot-C8q0pMgW.cjs +2 -0
  51. package/dist/usePivot-C8q0pMgW.cjs.map +1 -0
  52. package/dist/usePivot-z9gumDf-.js +97 -0
  53. package/dist/usePivot-z9gumDf-.js.map +1 -0
  54. package/dist/utils/css.d.ts +19 -0
  55. package/package.json +6 -1
  56. package/dist/FloatingPanelFrame-BeP9z8EI.js +0 -98
  57. package/dist/FloatingPanelFrame-BeP9z8EI.js.map +0 -1
  58. package/dist/FloatingPanelFrame-Cu50Y9xg.cjs +0 -2
  59. package/dist/FloatingPanelFrame-Cu50Y9xg.cjs.map +0 -1
  60. package/dist/GridLayout-CwuQEP7k.cjs +0 -2
  61. package/dist/GridLayout-CwuQEP7k.cjs.map +0 -1
  62. package/dist/GridLayout-DZCV1X-3.js +0 -1338
  63. package/dist/GridLayout-DZCV1X-3.js.map +0 -1
@@ -1 +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,YAELA,EAAM,OACD,QAKLG,EAAiBC,GAAuC,CAC5D,MAAMC,EAAuB,CAAA,EACvBC,EAAQC,GAA2B,CACvCF,EAAO,KAAKE,CAAI,EACZA,EAAK,UACPA,EAAK,SAAS,QAASC,GAAUF,EAAKE,CAAK,CAAC,CAEhD,EACA,OAAAJ,EAAO,QAASK,GAAMH,EAAKG,CAAC,CAAC,EACtBJ,CACT,EAEMK,EAAqBN,GAA+B,CACxD,MAAMO,MAAW,IACjBP,EAAO,QAASK,GAAM,CACpB,GAAIE,EAAK,IAAIF,EAAE,EAAE,EACf,MAAM,IAAI,MAAM,qCAAqCA,EAAE,EAAE,EAAE,EAE7DE,EAAK,IAAIF,EAAE,EAAE,CACf,CAAC,CACH,EAEaG,EAAyBR,GAA4C,CAChF,MAAMS,EAAOV,EAAcC,CAAM,EACjC,OAAAM,EAAkBG,CAAI,EACfA,EAAK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T,CACA,OAAIhC,EAAYR,EAAMgC,CAAM,EACnBhC,EAELW,EAAM,eAAeX,CAAI,EAEpBc,EADId,EACK,MAAM,QAAQ,EAEzB,IACT,EACA,OAAOc,EAAMD,CAAQ,CACvB,EAEaS,EAA2BT,GAAwD,CAC9F,MAAM4B,EAAYR,EAAmBpB,CAAQ,EAC7C,GAAI,CAAC4B,EACH,OAAO,KAET,GAAI,CAACA,EAAU,MAAQA,EAAU,KAAK,SAAW,EAC/C,MAAM,IAAI,MAAM,kEAAkE,EAEpF,GAAI,CAACA,EAAU,SAAWA,EAAU,QAAQ,SAAW,EACrD,MAAM,IAAI,MAAM,kEAAkE,EAEpF,GAAI,CAACA,EAAU,OAASA,EAAU,MAAM,SAAW,EACjD,MAAM,IAAI,MAAM,2DAA2D,EAG7E,MAAMC,EAAWD,EAAU,MAAM,OAC3BE,EAAWF,EAAU,MAAM,CAAC,GAAG,QAAU,EAC/C,GAAIC,IAAaD,EAAU,KAAK,OAC9B,MAAM,IAAI,MAAM,oBAAoBC,CAAQ,4BAA4BD,EAAU,KAAK,MAAM,IAAI,EAEnG,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"}
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 FloatingBehavior,\n LayerDefinition,\n LayerPositionMode,\n PanelLayoutConfig,\n PanelLayoutProps,\n PivotBehavior,\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?: FloatingBehavior;\n /** Pivot behavior for content switching. */\n pivot?: PivotBehavior;\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 pivot: route.pivot,\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 | (Omit<PanelCommonProps, \"children\"> & {\n type: \"pivot\";\n area: string;\n /** Currently active item ID (controlled mode) */\n activeId?: string;\n /** Default active item ID (uncontrolled mode) */\n defaultActiveId?: string;\n /** Callback when active item changes */\n onActiveChange?: (id: string) => void;\n children?: React.ReactNode;\n });\n\nexport const Panel: React.FC<PanelProps> = () => null;\n\n/**\n * PivotItem declaration for use inside <Panel type=\"pivot\">\n */\nexport type PivotItemDeclProps = {\n id: string;\n label?: string;\n disabled?: boolean;\n children?: React.ReactNode;\n};\n\nexport const PivotItem: React.FC<PivotItemDeclProps> = () => 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 if (props.type === \"pivot\") {\n if (!props.area) {\n throw new Error(`<Panel id=\"${props.id}\"> requires an explicit 'area' prop when type=\"pivot\".`);\n }\n const pivotItems = collectPivotItems(props.children);\n if (pivotItems.length === 0) {\n throw new Error(`<Panel id=\"${props.id}\"> requires at least one <PivotItem> child when type=\"pivot\".`);\n }\n routes.push({\n id: props.id,\n area: props.area,\n element: 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 pivot: {\n items: pivotItems,\n activeId: props.activeId,\n defaultActiveId: props.defaultActiveId,\n onActiveChange: props.onActiveChange,\n },\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\ntype CollectedPivotItem = {\n id: string;\n label?: string;\n content: React.ReactNode;\n disabled?: boolean;\n};\n\nconst collectPivotItems = (children: React.ReactNode): CollectedPivotItem[] => {\n const items: CollectedPivotItem[] = [];\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, PivotItem)) {\n const props = node.props as PivotItemDeclProps;\n if (!props.id) {\n throw new Error(\"<PivotItem> requires an 'id' prop.\");\n }\n items.push({\n id: props.id,\n label: props.label,\n content: props.children ?? null,\n disabled: props.disabled,\n });\n return;\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 }\n }\n };\n visit(children);\n return items;\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","PivotItem","isElementOf","element","component","React","buildRoutesFromChildren","children","visit","props","pivotItems","collectPivotItems","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","items","collected","rowCount","colCount"],"mappings":"ycA+DMA,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,MAAOA,EAAM,MACb,cAAeA,EAAM,aAAA,CAEzB,EAEME,EAA4BF,GAC5BA,EAAM,aACDA,EAAM,aAEXA,EAAM,SAED,YAELA,EAAM,OACD,QAKLG,EAAiBC,GAAuC,CAC5D,MAAMC,EAAuB,CAAA,EACvBC,EAAQC,GAA2B,CACvCF,EAAO,KAAKE,CAAI,EACZA,EAAK,UACPA,EAAK,SAAS,QAASC,GAAUF,EAAKE,CAAK,CAAC,CAEhD,EACA,OAAAJ,EAAO,QAASK,GAAMH,EAAKG,CAAC,CAAC,EACtBJ,CACT,EAEMK,EAAqBN,GAA+B,CACxD,MAAMO,MAAW,IACjBP,EAAO,QAASK,GAAM,CACpB,GAAIE,EAAK,IAAIF,EAAE,EAAE,EACf,MAAM,IAAI,MAAM,qCAAqCA,EAAE,EAAE,EAAE,EAE7DE,EAAK,IAAIF,EAAE,EAAE,CACf,CAAC,CACH,EAEaG,EAAyBR,GAA4C,CAChF,MAAMS,EAAOV,EAAcC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EAAM,UAEtBG,EADWf,EACF,MAAM,QAAQ,EAG7B,EACA,OAAAe,EAAMD,CAAQ,EACP8B,CACT,EAEanB,EAA2BX,GAAwD,CAC9F,MAAM+B,EAAYT,EAAmBtB,CAAQ,EAC7C,GAAI,CAAC+B,EACH,OAAO,KAET,GAAI,CAACA,EAAU,MAAQA,EAAU,KAAK,SAAW,EAC/C,MAAM,IAAI,MAAM,kEAAkE,EAEpF,GAAI,CAACA,EAAU,SAAWA,EAAU,QAAQ,SAAW,EACrD,MAAM,IAAI,MAAM,kEAAkE,EAEpF,GAAI,CAACA,EAAU,OAASA,EAAU,MAAM,SAAW,EACjD,MAAM,IAAI,MAAM,2DAA2D,EAG7E,MAAMC,EAAWD,EAAU,MAAM,OAC3BE,EAAWF,EAAU,MAAM,CAAC,GAAG,QAAU,EAC/C,GAAIC,IAAaD,EAAU,KAAK,OAC9B,MAAM,IAAI,MAAM,oBAAoBC,CAAQ,4BAA4BD,EAAU,KAAK,MAAM,IAAI,EAEnG,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 CHANGED
@@ -1,50 +1,51 @@
1
- import { jsx as p } from "react/jsx-runtime";
1
+ import { jsx as u } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
- import { G as d } from "./GridLayout-DZCV1X-3.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.`);
3
+ import { G as d } from "./GridLayout-tpSM0iM-.js";
4
+ const h = (i) => {
5
+ const r = f(i);
6
+ if (r === "grid" && !i.area)
7
+ throw new Error(`PanelRoute ${i.id} must specify 'area' for grid placement.`);
8
8
  return {
9
- id: t.id,
10
- component: t.element,
11
- visible: t.visible,
12
- gridArea: t.area,
9
+ id: i.id,
10
+ component: i.element,
11
+ visible: i.visible,
12
+ gridArea: i.area,
13
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
14
+ position: i.position,
15
+ zIndex: i.zIndex,
16
+ width: i.width,
17
+ height: i.height,
18
+ pointerEvents: i.pointerEvents,
19
+ style: i.style,
20
+ drawer: i.drawer,
21
+ floating: i.floating,
22
+ pivot: i.pivot,
23
+ backdropStyle: i.backdropStyle
23
24
  };
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));
25
+ }, f = (i) => i.positionMode ? i.positionMode : i.floating ? "absolute" : (i.drawer, "grid"), w = (i) => {
26
+ const r = [], n = (t) => {
27
+ r.push(t), t.children && t.children.forEach((e) => n(e));
27
28
  };
28
- return t.forEach((i) => n(i)), r;
29
- }, g = (t) => {
29
+ return i.forEach((t) => n(t)), r;
30
+ }, m = (i) => {
30
31
  const r = /* @__PURE__ */ new Set();
31
- t.forEach((n) => {
32
+ i.forEach((n) => {
32
33
  if (r.has(n.id))
33
34
  throw new Error(`Duplicate PanelRoute id detected: ${n.id}`);
34
35
  r.add(n.id);
35
36
  });
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);
37
+ }, g = (i) => {
38
+ const r = w(i);
39
+ return m(r), r.map((n) => h(n));
40
+ }, v = () => null, y = () => null, a = (i, r) => s.isValidElement(i) ? i.type === r : !1, E = (i) => {
41
+ const r = [], n = (t) => {
42
+ if (!(t == null || typeof t == "boolean")) {
43
+ if (Array.isArray(t)) {
44
+ t.forEach(n);
44
45
  return;
45
46
  }
46
- if (a(i, y)) {
47
- const e = i.props;
47
+ if (a(t, v)) {
48
+ const e = t.props;
48
49
  if (!e.id)
49
50
  throw new Error("<Panel> requires an 'id' prop.");
50
51
  if (e.type === "grid") {
@@ -100,33 +101,58 @@ const f = (t) => {
100
101
  });
101
102
  return;
102
103
  }
104
+ if (e.type === "pivot") {
105
+ if (!e.area)
106
+ throw new Error(`<Panel id="${e.id}"> requires an explicit 'area' prop when type="pivot".`);
107
+ const o = A(e.children);
108
+ if (o.length === 0)
109
+ throw new Error(`<Panel id="${e.id}"> requires at least one <PivotItem> child when type="pivot".`);
110
+ r.push({
111
+ id: e.id,
112
+ area: e.area,
113
+ element: null,
114
+ visible: e.visible,
115
+ zIndex: e.zIndex,
116
+ width: e.width,
117
+ height: e.height,
118
+ pointerEvents: e.pointerEvents,
119
+ style: e.style,
120
+ pivot: {
121
+ items: o,
122
+ activeId: e.activeId,
123
+ defaultActiveId: e.defaultActiveId,
124
+ onActiveChange: e.onActiveChange
125
+ }
126
+ });
127
+ return;
128
+ }
103
129
  throw new Error("<Panel> has unsupported type.");
104
130
  }
105
- if (s.isValidElement(i)) {
106
- if (i.type === s.Fragment) {
107
- n(i.props.children);
131
+ if (s.isValidElement(t)) {
132
+ if (t.type === s.Fragment) {
133
+ n(t.props.children);
108
134
  return;
109
135
  }
110
136
  return;
111
137
  }
112
138
  }
113
139
  };
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);
140
+ return n(i), r;
141
+ }, q = ({ config: i, style: r, children: n }) => {
142
+ const t = s.useMemo(() => E(n), [n]), e = s.useMemo(() => g(t), [t]), o = s.useMemo(() => {
143
+ if (i)
144
+ return i;
145
+ const l = P(n);
120
146
  if (!l)
121
147
  throw new Error("Panel requires either 'config' prop or a JSX config (<Config><Rows/><Columns/><Areas/></Config>). ");
122
148
  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) => {
149
+ }, [n, i]);
150
+ return /* @__PURE__ */ u(d, { config: o, layers: e, style: r });
151
+ }, b = () => null, M = () => null, S = () => null, z = () => null, C = () => null, I = () => null, c = (i, r) => {
152
+ const n = [], t = (e) => {
127
153
  if (!(e == null || typeof e == "boolean")) {
128
154
  if (Array.isArray(e)) {
129
- e.forEach(i);
155
+ e.forEach(t);
130
156
  return;
131
157
  }
132
158
  if (a(e, r)) {
@@ -141,39 +167,62 @@ const f = (t) => {
141
167
  });
142
168
  return;
143
169
  }
144
- s.isValidElement(e) && i(e.props.children);
170
+ s.isValidElement(e) && t(e.props.children);
145
171
  }
146
172
  };
147
- return i(t), n;
148
- }, x = (t) => {
149
- const r = c(t, v);
173
+ return t(i), n;
174
+ }, x = (i) => {
175
+ const r = p(i, b);
150
176
  if (!r)
151
177
  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;
178
+ const n = r.props, t = c(r.props.children, z), e = c(r.props.children, C), o = p(r.props.children, I), l = o ? o.props.matrix : void 0;
153
179
  return {
154
180
  gap: n.gap,
155
181
  style: n.style,
156
- rows: i,
182
+ rows: t,
157
183
  columns: e,
158
184
  areas: l
159
185
  };
160
- }, c = (t, r) => {
161
- const n = (i) => {
162
- if (i == null || typeof i == "boolean")
186
+ }, p = (i, r) => {
187
+ const n = (t) => {
188
+ if (t == null || typeof t == "boolean")
163
189
  return null;
164
- if (Array.isArray(i)) {
165
- for (const e of i) {
190
+ if (Array.isArray(t)) {
191
+ for (const e of t) {
166
192
  const o = n(e);
167
193
  if (o)
168
194
  return o;
169
195
  }
170
196
  return null;
171
197
  }
172
- return a(i, r) ? i : s.isValidElement(i) ? n(i.props.children) : null;
198
+ return a(t, r) ? t : s.isValidElement(t) ? n(t.props.children) : null;
199
+ };
200
+ return n(i);
201
+ }, A = (i) => {
202
+ const r = [], n = (t) => {
203
+ if (!(t == null || typeof t == "boolean")) {
204
+ if (Array.isArray(t)) {
205
+ t.forEach(n);
206
+ return;
207
+ }
208
+ if (a(t, y)) {
209
+ const e = t.props;
210
+ if (!e.id)
211
+ throw new Error("<PivotItem> requires an 'id' prop.");
212
+ r.push({
213
+ id: e.id,
214
+ label: e.label,
215
+ content: e.children ?? null,
216
+ disabled: e.disabled
217
+ });
218
+ return;
219
+ }
220
+ s.isValidElement(t) && t.type === s.Fragment && n(t.props.children);
221
+ }
173
222
  };
174
- return n(t);
175
- }, R = (t) => {
176
- const r = x(t);
223
+ return n(i), r;
224
+ }, P = (i) => {
225
+ const r = x(i);
177
226
  if (!r)
178
227
  return null;
179
228
  if (!r.rows || r.rows.length === 0)
@@ -182,11 +231,11 @@ const f = (t) => {
182
231
  throw new Error("Config must include at least one <Col size=...> inside <Config>.");
183
232
  if (!r.areas || r.areas.length === 0)
184
233
  throw new Error("Config must include <Areas matrix={...}> inside <Config>.");
185
- const n = r.areas.length, i = r.areas[0]?.length ?? 0;
234
+ const n = r.areas.length, t = r.areas[0]?.length ?? 0;
186
235
  if (n !== r.rows.length)
187
236
  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}).`);
237
+ if (t !== r.columns.length)
238
+ throw new Error(`Areas column count (${t}) must match Columns count (${r.columns.length}).`);
190
239
  return {
191
240
  areas: r.areas,
192
241
  rows: r.rows,
@@ -196,15 +245,15 @@ const f = (t) => {
196
245
  };
197
246
  };
198
247
  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,
248
+ I as Areas,
249
+ C as Col,
250
+ S as Columns,
251
+ b as Config,
252
+ v as Panel,
253
+ q as PanelLayout,
254
+ z as Row,
255
+ M as Rows,
256
+ P as buildConfigFromChildren,
208
257
  E as buildRoutesFromChildren
209
258
  };
210
259
  //# sourceMappingURL=config.js.map
@@ -1 +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;AAAA,IACf,UAAUA,EAAM;AAAA,IAChB,cAAcC;AAAA,IACd,UAAUD,EAAM;AAAA,IAChB,QAAQA,EAAM;AAAA,IACd,OAAOA,EAAM;AAAA,IACb,QAAQA,EAAM;AAAA,IACd,eAAeA,EAAM;AAAA,IACrB,OAAOA,EAAM;AAAA,IACb,QAAQA,EAAM;AAAA,IACd,UAAUA,EAAM;AAAA,IAChB,eAAeA,EAAM;AAAA,EAA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AAeX,CAAI,IAEpBc,EADId,EACK,MAAM,QAAQ,IAEzB;AAAA,EACT;AACA,SAAOc,EAAMD,CAAQ;AACvB,GAEaS,IAA0B,CAACT,MAAwD;AAC9F,QAAM4B,IAAYR,EAAmBpB,CAAQ;AAC7C,MAAI,CAAC4B;AACH,WAAO;AAET,MAAI,CAACA,EAAU,QAAQA,EAAU,KAAK,WAAW;AAC/C,UAAM,IAAI,MAAM,kEAAkE;AAEpF,MAAI,CAACA,EAAU,WAAWA,EAAU,QAAQ,WAAW;AACrD,UAAM,IAAI,MAAM,kEAAkE;AAEpF,MAAI,CAACA,EAAU,SAASA,EAAU,MAAM,WAAW;AACjD,UAAM,IAAI,MAAM,2DAA2D;AAG7E,QAAMC,IAAWD,EAAU,MAAM,QAC3BE,IAAWF,EAAU,MAAM,CAAC,GAAG,UAAU;AAC/C,MAAIC,MAAaD,EAAU,KAAK;AAC9B,UAAM,IAAI,MAAM,oBAAoBC,CAAQ,4BAA4BD,EAAU,KAAK,MAAM,IAAI;AAEnG,MAAIE,MAAaF,EAAU,QAAQ;AACjC,UAAM,IAAI,MAAM,uBAAuBE,CAAQ,+BAA+BF,EAAU,QAAQ,MAAM,IAAI;AAG5G,SAAO;AAAA,IACL,OAAOA,EAAU;AAAA,IACjB,MAAMA,EAAU;AAAA,IAChB,SAASA,EAAU;AAAA,IACnB,KAAKA,EAAU;AAAA,IACf,OAAOA,EAAU;AAAA,EAAA;AAErB;"}
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 FloatingBehavior,\n LayerDefinition,\n LayerPositionMode,\n PanelLayoutConfig,\n PanelLayoutProps,\n PivotBehavior,\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?: FloatingBehavior;\n /** Pivot behavior for content switching. */\n pivot?: PivotBehavior;\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 pivot: route.pivot,\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 | (Omit<PanelCommonProps, \"children\"> & {\n type: \"pivot\";\n area: string;\n /** Currently active item ID (controlled mode) */\n activeId?: string;\n /** Default active item ID (uncontrolled mode) */\n defaultActiveId?: string;\n /** Callback when active item changes */\n onActiveChange?: (id: string) => void;\n children?: React.ReactNode;\n });\n\nexport const Panel: React.FC<PanelProps> = () => null;\n\n/**\n * PivotItem declaration for use inside <Panel type=\"pivot\">\n */\nexport type PivotItemDeclProps = {\n id: string;\n label?: string;\n disabled?: boolean;\n children?: React.ReactNode;\n};\n\nexport const PivotItem: React.FC<PivotItemDeclProps> = () => 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 if (props.type === \"pivot\") {\n if (!props.area) {\n throw new Error(`<Panel id=\"${props.id}\"> requires an explicit 'area' prop when type=\"pivot\".`);\n }\n const pivotItems = collectPivotItems(props.children);\n if (pivotItems.length === 0) {\n throw new Error(`<Panel id=\"${props.id}\"> requires at least one <PivotItem> child when type=\"pivot\".`);\n }\n routes.push({\n id: props.id,\n area: props.area,\n element: 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 pivot: {\n items: pivotItems,\n activeId: props.activeId,\n defaultActiveId: props.defaultActiveId,\n onActiveChange: props.onActiveChange,\n },\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\ntype CollectedPivotItem = {\n id: string;\n label?: string;\n content: React.ReactNode;\n disabled?: boolean;\n};\n\nconst collectPivotItems = (children: React.ReactNode): CollectedPivotItem[] => {\n const items: CollectedPivotItem[] = [];\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, PivotItem)) {\n const props = node.props as PivotItemDeclProps;\n if (!props.id) {\n throw new Error(\"<PivotItem> requires an 'id' prop.\");\n }\n items.push({\n id: props.id,\n label: props.label,\n content: props.children ?? null,\n disabled: props.disabled,\n });\n return;\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 }\n }\n };\n visit(children);\n return items;\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","PivotItem","isElementOf","element","component","React","buildRoutesFromChildren","children","visit","props","pivotItems","collectPivotItems","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","items","collected","rowCount","colCount"],"mappings":";;;AA+DA,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;AAAA,IACf,UAAUA,EAAM;AAAA,IAChB,cAAcC;AAAA,IACd,UAAUD,EAAM;AAAA,IAChB,QAAQA,EAAM;AAAA,IACd,OAAOA,EAAM;AAAA,IACb,QAAQA,EAAM;AAAA,IACd,eAAeA,EAAM;AAAA,IACrB,OAAOA,EAAM;AAAA,IACb,QAAQA,EAAM;AAAA,IACd,UAAUA,EAAM;AAAA,IAChB,OAAOA,EAAM;AAAA,IACb,eAAeA,EAAM;AAAA,EAAA;AAEzB,GAEME,IAA2B,CAACF,MAC5BA,EAAM,eACDA,EAAM,eAEXA,EAAM,WAED,cAELA,EAAM,QACD,SAKLG,IAAgB,CAACC,MAAuC;AAC5D,QAAMC,IAAuB,CAAA,GACvBC,IAAO,CAACC,MAA2B;AACvC,IAAAF,EAAO,KAAKE,CAAI,GACZA,EAAK,YACPA,EAAK,SAAS,QAAQ,CAACC,MAAUF,EAAKE,CAAK,CAAC;AAAA,EAEhD;AACA,SAAAJ,EAAO,QAAQ,CAACK,MAAMH,EAAKG,CAAC,CAAC,GACtBJ;AACT,GAEMK,IAAoB,CAACN,MAA+B;AACxD,QAAMO,wBAAW,IAAA;AACjB,EAAAP,EAAO,QAAQ,CAACK,MAAM;AACpB,QAAIE,EAAK,IAAIF,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,SAASA,EAAU,MAAM,WAAW;AACjD,UAAM,IAAI,MAAM,2DAA2D;AAG7E,QAAMC,IAAWD,EAAU,MAAM,QAC3BE,IAAWF,EAAU,MAAM,CAAC,GAAG,UAAU;AAC/C,MAAIC,MAAaD,EAAU,KAAK;AAC9B,UAAM,IAAI,MAAM,oBAAoBC,CAAQ,4BAA4BD,EAAU,KAAK,MAAM,IAAI;AAEnG,MAAIE,MAAaF,EAAU,QAAQ;AACjC,UAAM,IAAI,MAAM,uBAAuBE,CAAQ,+BAA+BF,EAAU,QAAQ,MAAM,IAAI;AAG5G,SAAO;AAAA,IACL,OAAOA,EAAU;AAAA,IACjB,MAAMA,EAAU;AAAA,IAChB,SAASA,EAAU;AAAA,IACnB,KAAKA,EAAU;AAAA,IACf,OAAOA,EAAU;AAAA,EAAA;AAErB;"}
@@ -69,6 +69,14 @@ export declare const COLOR_DRAWER_BACKDROP = "var(--rpl-color-drawer-backdrop, r
69
69
  */
70
70
  export declare const DRAWER_TRANSITION_DURATION = "var(--rpl-drawer-transition-duration, 220ms)";
71
71
  export declare const DRAWER_TRANSITION_EASING = "var(--rpl-drawer-transition-easing, cubic-bezier(0.22, 1, 0.36, 1))";
72
+ /**
73
+ * Pivot animations
74
+ * User defines @keyframes in their CSS and references via these tokens.
75
+ * - Enter: Applied when content becomes active
76
+ * - Leave: Applied when content becomes inactive
77
+ */
78
+ export declare const PIVOT_ANIMATION_ENTER = "var(--rpl-pivot-animation-enter, none)";
79
+ export declare const PIVOT_ANIMATION_LEAVE = "var(--rpl-pivot-animation-leave, none)";
72
80
  /**
73
81
  * Tab sizing
74
82
  */
package/dist/floating.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./FloatingPanelFrame-Cu50Y9xg.cjs");exports.FloatingPanelContent=a.FloatingPanelContent;exports.FloatingPanelControls=a.FloatingPanelControls;exports.FloatingPanelFrame=a.FloatingPanelFrame;exports.FloatingPanelHeader=a.FloatingPanelHeader;exports.FloatingPanelMeta=a.FloatingPanelMeta;exports.FloatingPanelTitle=a.FloatingPanelTitle;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./FloatingPanelFrame-DrYwgI9f.cjs");exports.FloatingPanelContent=a.FloatingPanelContent;exports.FloatingPanelControls=a.FloatingPanelControls;exports.FloatingPanelFrame=a.FloatingPanelFrame;exports.FloatingPanelHeader=a.FloatingPanelHeader;exports.FloatingPanelMeta=a.FloatingPanelMeta;exports.FloatingPanelTitle=a.FloatingPanelTitle;
2
2
  //# sourceMappingURL=floating.cjs.map
package/dist/floating.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e, d as l, F as t, a as o, c as F, b as i } from "./FloatingPanelFrame-BeP9z8EI.js";
1
+ import { e, d as l, F as t, a as o, c as F, b as i } from "./FloatingPanelFrame-DDT6aING.js";
2
2
  export {
3
3
  e as FloatingPanelContent,
4
4
  l as FloatingPanelControls,