react-panel-layout 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FloatingWindow-Bw2djgpz.js +1542 -0
- package/dist/FloatingWindow-Bw2djgpz.js.map +1 -0
- package/dist/FloatingWindow-Cvyokf0m.cjs +2 -0
- package/dist/FloatingWindow-Cvyokf0m.cjs.map +1 -0
- package/dist/GridLayout-B4aCqSyd.js +947 -0
- package/dist/{GridLayout-UWNxXw77.js.map → GridLayout-B4aCqSyd.js.map} +1 -1
- package/dist/GridLayout-DNOClFzz.cjs +2 -0
- package/dist/{GridLayout-DKTg_N61.cjs.map → GridLayout-DNOClFzz.cjs.map} +1 -1
- package/dist/PanelSystem-B8Igvnb2.cjs +3 -0
- package/dist/PanelSystem-B8Igvnb2.cjs.map +1 -0
- package/dist/{PanelSystem-BqUzNtf2.js → PanelSystem-DDUSFjXD.js} +208 -247
- package/dist/PanelSystem-DDUSFjXD.js.map +1 -0
- package/dist/components/window/Drawer.d.ts +1 -0
- package/dist/components/window/DrawerRevealContext.d.ts +61 -0
- package/dist/components/window/drawerRevealAnimationUtils.d.ts +212 -0
- package/dist/components/window/drawerStyles.d.ts +5 -0
- package/dist/components/window/useDrawerSwipeTransform.d.ts +8 -2
- package/dist/components/window/useDrawerTransform.d.ts +68 -0
- package/dist/components/window/useRevealDrawerTransform.d.ts +56 -0
- package/dist/config.cjs +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.js +8 -7
- package/dist/config.js.map +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/grid.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/modules/drawer/drawerStateMachine.d.ts +168 -0
- package/dist/modules/drawer/revealDrawerConstants.d.ts +33 -0
- package/dist/modules/drawer/revealDrawerStateMachine.d.ts +146 -0
- package/dist/modules/drawer/strategies/index.d.ts +8 -0
- package/dist/modules/drawer/strategies/overlayStrategy.d.ts +12 -0
- package/dist/modules/drawer/strategies/revealStrategy.d.ts +12 -0
- package/dist/modules/drawer/strategies/types.d.ts +116 -0
- package/dist/panels.cjs +1 -1
- package/dist/panels.js +1 -1
- package/dist/stack.cjs +1 -1
- package/dist/stack.cjs.map +1 -1
- package/dist/stack.js +306 -347
- package/dist/stack.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/useAnimationFrame-BZ6D2lMq.cjs +2 -0
- package/dist/useAnimationFrame-BZ6D2lMq.cjs.map +1 -0
- package/dist/useAnimationFrame-Bg4e-H8O.js +394 -0
- package/dist/useAnimationFrame-Bg4e-H8O.js.map +1 -0
- package/dist/window.cjs +1 -1
- package/dist/window.js +1 -1
- package/package.json +1 -1
- package/src/components/gesture/SwipeSafeZone.tsx +1 -0
- package/src/components/grid/GridLayout.tsx +110 -38
- package/src/components/window/Drawer.tsx +114 -10
- package/src/components/window/DrawerLayers.tsx +48 -15
- package/src/components/window/DrawerRevealContext.spec.ts +20 -0
- package/src/components/window/DrawerRevealContext.tsx +99 -0
- package/src/components/window/drawerRevealAnimationUtils.spec.ts +375 -0
- package/src/components/window/drawerRevealAnimationUtils.ts +415 -0
- package/src/components/window/drawerStyles.spec.ts +39 -0
- package/src/components/window/drawerStyles.ts +24 -0
- package/src/components/window/useDrawerSwipeTransform.ts +28 -90
- package/src/components/window/useDrawerTransform.ts +505 -0
- package/src/components/window/useRevealDrawerTransform.spec.ts +1936 -0
- package/src/components/window/useRevealDrawerTransform.ts +105 -0
- package/src/demo/components/FullscreenDemoPage.tsx +47 -0
- package/src/demo/fullscreenRoutes.tsx +32 -0
- package/src/demo/index.tsx +5 -0
- package/src/demo/pages/Dialog/components/CardExpandDemo.tsx +23 -8
- package/src/demo/pages/Drawer/components/DrawerBasics.module.css +6 -1
- package/src/demo/pages/Drawer/components/DrawerBasics.tsx +14 -4
- package/src/demo/pages/Drawer/components/DrawerReveal.module.css +157 -0
- package/src/demo/pages/Drawer/components/DrawerReveal.tsx +128 -0
- package/src/demo/pages/Drawer/reveal/index.tsx +17 -0
- package/src/demo/pages/Drawer/reveal-fullscreen/index.tsx +135 -0
- package/src/demo/pages/Drawer/reveal-fullscreen/styles.module.css +233 -0
- package/src/demo/pages/Stack/components/StackBasics.spec.tsx +56 -52
- package/src/demo/pages/Stack/components/StackTablet.spec.tsx +39 -49
- package/src/demo/routes.tsx +2 -0
- package/src/hooks/gesture/testing/createGestureSimulator.ts +1 -0
- package/src/hooks/gesture/useNativeGestureGuard.spec.ts +10 -2
- package/src/hooks/gesture/utils.ts +15 -4
- package/src/hooks/useAnimatedVisibility.spec.ts +3 -3
- package/src/hooks/useOperationContinuity.spec.ts +17 -10
- package/src/hooks/useOperationContinuity.ts +5 -5
- package/src/hooks/useSharedElementTransition.ts +28 -7
- package/src/modules/dialog/dialogAnimationUtils.spec.ts +0 -1
- package/src/modules/dialog/useDialogContainer.spec.ts +11 -3
- package/src/modules/dialog/useDialogSwipeInput.spec.ts +49 -28
- package/src/modules/dialog/useDialogSwipeInput.ts +37 -6
- package/src/modules/dialog/useDialogTransform.spec.ts +63 -30
- package/src/modules/drawer/drawerStateMachine.ts +500 -0
- package/src/modules/drawer/revealDrawerConstants.ts +38 -0
- package/src/modules/drawer/revealDrawerStateMachine.spec.ts +558 -0
- package/src/modules/drawer/revealDrawerStateMachine.ts +197 -0
- package/src/modules/drawer/strategies/index.ts +9 -0
- package/src/modules/drawer/strategies/overlayStrategy.ts +133 -0
- package/src/modules/drawer/strategies/revealStrategy.ts +111 -0
- package/src/modules/drawer/strategies/types.ts +160 -0
- package/src/modules/drawer/useDrawerSwipeInput.ts +7 -4
- package/src/modules/pivot/SwipePivotContent.spec.tsx +48 -37
- package/src/modules/pivot/usePivotSwipeInput.spec.ts +8 -8
- package/src/modules/stack/swipeTransitionContinuity.spec.tsx +1 -1
- package/src/types.ts +15 -0
- package/dist/FloatingWindow-CUXnEtrb.js +0 -827
- package/dist/FloatingWindow-CUXnEtrb.js.map +0 -1
- package/dist/FloatingWindow-DMwyK0eK.cjs +0 -2
- package/dist/FloatingWindow-DMwyK0eK.cjs.map +0 -1
- package/dist/GridLayout-DKTg_N61.cjs +0 -2
- package/dist/GridLayout-UWNxXw77.js +0 -926
- package/dist/PanelSystem-BqUzNtf2.js.map +0 -1
- package/dist/PanelSystem-D603LKKv.cjs +0 -3
- package/dist/PanelSystem-D603LKKv.cjs.map +0 -1
- package/dist/useNativeGestureGuard-C7TSqEkr.cjs +0 -2
- package/dist/useNativeGestureGuard-C7TSqEkr.cjs.map +0 -1
- package/dist/useNativeGestureGuard-CGYo6O0r.js +0 -347
- package/dist/useNativeGestureGuard-CGYo6O0r.js.map +0 -1
- package/src/components/window/useDrawerSwipeTransform.spec.ts +0 -234
package/dist/config.js.map
CHANGED
|
@@ -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 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,IAA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A,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,IA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CACjB;AACD;AAAA,MACF;AACA,MAAIJ,EAAM,eAAeZ,CAAI,KACvBA,EAAK,SAASY,EAAM,YAEtBG,EADWf,EACF,MAAM,QAAQ;AAAA;AAAA,EAG7B;AACA,SAAAe,EAAMD,CAAQ,GACP8B;AACT,GAEanB,IAA0B,CAACX,MAAwD;AAC9F,QAAM+B,IAAYT,EAAmBtB,CAAQ;AAC7C,MAAI,CAAC+B;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;"}
|
package/dist/grid.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GridLayout-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GridLayout-DNOClFzz.cjs"),r=require("./FloatingWindow-Cvyokf0m.cjs");exports.GridLayerList=e.GridLayerList;exports.GridLayerResizeHandles=e.GridLayerResizeHandles;exports.GridLayout=e.GridLayout;exports.GridTrackResizeHandle=e.GridTrackResizeHandle;exports.useGridPlacements=e.useGridPlacements;exports.useGridTracks=e.useGridTracks;exports.GridLayoutProvider=r.GridLayoutProvider;exports.useGridLayoutContext=r.useGridLayoutContext;
|
|
2
2
|
//# sourceMappingURL=grid.cjs.map
|
package/dist/grid.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as e, b as s, G as d, c as i, u as G, d as o } from "./GridLayout-
|
|
2
|
-
import { G as u, u as L } from "./FloatingWindow-
|
|
1
|
+
import { a as e, b as s, G as d, c as i, u as G, d as o } from "./GridLayout-B4aCqSyd.js";
|
|
2
|
+
import { G as u, u as L } from "./FloatingWindow-Bw2djgpz.js";
|
|
3
3
|
export {
|
|
4
4
|
e as GridLayerList,
|
|
5
5
|
s as GridLayerResizeHandles,
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./GridLayout-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./GridLayout-DNOClFzz.cjs"),t=require("./FloatingWindow-Cvyokf0m.cjs"),s=require("./HorizontalDivider-_pgV4Mcv.cjs"),u=require("./ResizeHandle-CBcAS918.cjs"),l=require("react"),c=require("./useFloatingState-C4kRaW_R.cjs"),d=require("./styles-qf6ptVLD.cjs"),i=require("./PanelSystem-B8Igvnb2.cjs");function y(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const S=y(l),g=()=>{const{layerId:e}=t.useLayerInstance(),{getLayerHandleProps:r}=t.useGridLayoutContext();return S.useMemo(()=>r(e),[r,e])};exports.GridLayout=o.GridLayout;exports.Drawer=t.Drawer;exports.DrawerLayers=t.DrawerLayers;exports.FloatingWindow=t.FloatingWindow;exports.runTransition=t.runTransition;exports.useTransitionState=t.useTransitionState;exports.HorizontalDivider=s.HorizontalDivider;exports.ResizeHandle=u.ResizeHandle;exports.useFloatingState=c.useFloatingState;exports.CSS_VAR_PREFIX=d.CSS_VAR_PREFIX;exports.PanelSystem=i.PanelSystem;exports.buildInitialState=i.buildInitialState;exports.useLayerDragHandle=g;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { G as m } from "./GridLayout-
|
|
2
|
-
import { a as e, u as t } from "./FloatingWindow-
|
|
3
|
-
import { D as l, b as d, F as f, r as x, c as y } from "./FloatingWindow-
|
|
1
|
+
import { G as m } from "./GridLayout-B4aCqSyd.js";
|
|
2
|
+
import { a as e, u as t } from "./FloatingWindow-Bw2djgpz.js";
|
|
3
|
+
import { D as l, b as d, F as f, r as x, c as y } from "./FloatingWindow-Bw2djgpz.js";
|
|
4
4
|
import { H as L } from "./HorizontalDivider-DdxzfV0l.js";
|
|
5
5
|
import { R as D } from "./ResizeHandle-CXjc1meV.js";
|
|
6
6
|
import * as o from "react";
|
|
7
7
|
import { u as R } from "./useFloatingState-tEfA_wbc.js";
|
|
8
8
|
import { C as F } from "./styles-NkjuMOVS.js";
|
|
9
|
-
import { P, v as w } from "./PanelSystem-
|
|
9
|
+
import { P, v as w } from "./PanelSystem-DDUSFjXD.js";
|
|
10
10
|
const n = () => {
|
|
11
11
|
const { layerId: r } = e(), { getLayerHandleProps: a } = t();
|
|
12
12
|
return o.useMemo(() => a(r), [a, r]);
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Generic state machine for drawer animations.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a React-independent state machine for managing drawer
|
|
5
|
+
* transitions. It handles swipe gestures, button operations, and animations through
|
|
6
|
+
* a reducer pattern with typed actions.
|
|
7
|
+
*
|
|
8
|
+
* The position type is generic, allowing different drawer modes (reveal, overlay)
|
|
9
|
+
* to use the same state machine logic with mode-specific position calculations.
|
|
10
|
+
*
|
|
11
|
+
* Key design principles:
|
|
12
|
+
* - Pure functions: same input → same output
|
|
13
|
+
* - No React/DOM dependencies
|
|
14
|
+
* - Testable in isolation
|
|
15
|
+
* - Deterministic state transitions
|
|
16
|
+
*/
|
|
17
|
+
import type { DrawerTransformStrategy, DrawerStrategyConfig } from "./strategies/types.js";
|
|
18
|
+
/**
|
|
19
|
+
* Phase of drawer animation lifecycle.
|
|
20
|
+
* - closed: Drawer is hidden
|
|
21
|
+
* - opening: Drawer is animating open
|
|
22
|
+
* - open: Drawer is fully visible
|
|
23
|
+
* - closing: Drawer is animating closed
|
|
24
|
+
*/
|
|
25
|
+
export type DrawerPhase = "closed" | "opening" | "open" | "closing";
|
|
26
|
+
/**
|
|
27
|
+
* Direction of swipe gesture.
|
|
28
|
+
*/
|
|
29
|
+
export type SwipeDirection = "opening" | "closing" | null;
|
|
30
|
+
/**
|
|
31
|
+
* Animation state tracking from/to positions.
|
|
32
|
+
*/
|
|
33
|
+
export type AnimationState<TPosition> = {
|
|
34
|
+
/** Animation type */
|
|
35
|
+
type: "opening" | "closing";
|
|
36
|
+
/** Starting position */
|
|
37
|
+
from: TPosition;
|
|
38
|
+
/** Target position */
|
|
39
|
+
to: TPosition;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Complete state for drawer.
|
|
43
|
+
*/
|
|
44
|
+
export type DrawerState<TPosition> = {
|
|
45
|
+
/** Current animation phase */
|
|
46
|
+
phase: DrawerPhase;
|
|
47
|
+
/** Target open state (what the drawer should be after current operation) */
|
|
48
|
+
targetOpen: boolean;
|
|
49
|
+
/** Current position */
|
|
50
|
+
position: TPosition;
|
|
51
|
+
/** Whether a swipe operation is active */
|
|
52
|
+
isOperating: boolean;
|
|
53
|
+
/** Direction of current swipe */
|
|
54
|
+
swipeDirection: SwipeDirection;
|
|
55
|
+
/** Current swipe displacement in pixels */
|
|
56
|
+
displacement: number;
|
|
57
|
+
/** Animation state if animating */
|
|
58
|
+
animation: AnimationState<TPosition> | null;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Compute progress (0-1) from displacement.
|
|
62
|
+
*
|
|
63
|
+
* @param displacement - Current swipe displacement in pixels
|
|
64
|
+
* @param drawerSize - Size of the drawer in pixels
|
|
65
|
+
* @param direction - Swipe direction ("opening" or "closing")
|
|
66
|
+
* @returns Progress value between 0 and 1
|
|
67
|
+
*/
|
|
68
|
+
export declare function computeProgressFromDisplacement(displacement: number, drawerSize: number, direction: SwipeDirection): number;
|
|
69
|
+
/**
|
|
70
|
+
* Determine if drawer should open or close after swipe ends.
|
|
71
|
+
*
|
|
72
|
+
* @param displacement - Final swipe displacement in pixels
|
|
73
|
+
* @param drawerSize - Size of the drawer in pixels
|
|
74
|
+
* @param direction - Swipe direction
|
|
75
|
+
* @returns true if drawer should be open, false if closed
|
|
76
|
+
*/
|
|
77
|
+
export declare function computeSwipeEndTarget(displacement: number, drawerSize: number, direction: SwipeDirection): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Action creators for drawer state machine.
|
|
80
|
+
*/
|
|
81
|
+
export declare const drawerActions: {
|
|
82
|
+
/** Start swipe operation */
|
|
83
|
+
readonly swipeStart: ((direction: "opening" | "closing") => {
|
|
84
|
+
type: "SWIPE_START";
|
|
85
|
+
payload: {
|
|
86
|
+
direction: "opening" | "closing";
|
|
87
|
+
};
|
|
88
|
+
}) & {
|
|
89
|
+
readonly type: "SWIPE_START";
|
|
90
|
+
};
|
|
91
|
+
/** Update swipe displacement */
|
|
92
|
+
readonly swipeUpdate: ((displacement: number) => {
|
|
93
|
+
type: "SWIPE_UPDATE";
|
|
94
|
+
payload: {
|
|
95
|
+
displacement: number;
|
|
96
|
+
};
|
|
97
|
+
}) & {
|
|
98
|
+
readonly type: "SWIPE_UPDATE";
|
|
99
|
+
};
|
|
100
|
+
/** End swipe operation */
|
|
101
|
+
readonly swipeEnd: (() => {
|
|
102
|
+
type: "SWIPE_END";
|
|
103
|
+
}) & {
|
|
104
|
+
readonly type: "SWIPE_END";
|
|
105
|
+
};
|
|
106
|
+
/** Animation frame update */
|
|
107
|
+
readonly animationFrame: ((easedProgress: number) => {
|
|
108
|
+
type: "ANIMATION_FRAME";
|
|
109
|
+
payload: {
|
|
110
|
+
easedProgress: number;
|
|
111
|
+
};
|
|
112
|
+
}) & {
|
|
113
|
+
readonly type: "ANIMATION_FRAME";
|
|
114
|
+
};
|
|
115
|
+
/** Animation complete */
|
|
116
|
+
readonly animationComplete: (() => {
|
|
117
|
+
type: "ANIMATION_COMPLETE";
|
|
118
|
+
}) & {
|
|
119
|
+
readonly type: "ANIMATION_COMPLETE";
|
|
120
|
+
};
|
|
121
|
+
/** Button open */
|
|
122
|
+
readonly buttonOpen: (() => {
|
|
123
|
+
type: "BUTTON_OPEN";
|
|
124
|
+
}) & {
|
|
125
|
+
readonly type: "BUTTON_OPEN";
|
|
126
|
+
};
|
|
127
|
+
/** Button close */
|
|
128
|
+
readonly buttonClose: (() => {
|
|
129
|
+
type: "BUTTON_CLOSE";
|
|
130
|
+
}) & {
|
|
131
|
+
readonly type: "BUTTON_CLOSE";
|
|
132
|
+
};
|
|
133
|
+
/** Sync open state from external prop */
|
|
134
|
+
readonly syncOpenState: ((isOpen: boolean) => {
|
|
135
|
+
type: "SYNC_OPEN_STATE";
|
|
136
|
+
payload: {
|
|
137
|
+
isOpen: boolean;
|
|
138
|
+
};
|
|
139
|
+
}) & {
|
|
140
|
+
readonly type: "SYNC_OPEN_STATE";
|
|
141
|
+
};
|
|
142
|
+
/** Initialize state */
|
|
143
|
+
readonly initialize: ((isOpen: boolean) => {
|
|
144
|
+
type: "INITIALIZE";
|
|
145
|
+
payload: {
|
|
146
|
+
isOpen: boolean;
|
|
147
|
+
};
|
|
148
|
+
}) & {
|
|
149
|
+
readonly type: "INITIALIZE";
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
export type DrawerAction = ReturnType<(typeof drawerActions)[keyof typeof drawerActions]>;
|
|
153
|
+
/**
|
|
154
|
+
* Create initial state for drawer.
|
|
155
|
+
*
|
|
156
|
+
* @param isOpen - Initial open state
|
|
157
|
+
* @param strategy - Transform strategy
|
|
158
|
+
* @param config - Drawer configuration
|
|
159
|
+
* @returns Initial state
|
|
160
|
+
*/
|
|
161
|
+
export declare function createDrawerInitialState<TPosition>(isOpen: boolean, strategy: DrawerTransformStrategy<TPosition>, config: DrawerStrategyConfig): DrawerState<TPosition>;
|
|
162
|
+
/**
|
|
163
|
+
* Create a drawer reducer for a specific strategy.
|
|
164
|
+
*
|
|
165
|
+
* @param strategy - Transform strategy to use for position calculations
|
|
166
|
+
* @returns Reducer function for the drawer state machine
|
|
167
|
+
*/
|
|
168
|
+
export declare function createDrawerReducer<TPosition>(strategy: DrawerTransformStrategy<TPosition>): (state: DrawerState<TPosition>, action: DrawerAction, config: DrawerStrategyConfig) => DrawerState<TPosition>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Constants for reveal drawer state machine.
|
|
3
|
+
*
|
|
4
|
+
* Centralizes all threshold values used in reveal drawer behavior.
|
|
5
|
+
* These values control swipe gestures, animations, and state transitions.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Minimum swipe distance in pixels to trigger drawer open.
|
|
9
|
+
* Used when opening via edge swipe gesture.
|
|
10
|
+
* ~27% of a 375px mobile screen width.
|
|
11
|
+
*/
|
|
12
|
+
export declare const REVEAL_DRAWER_OPEN_DISTANCE_THRESHOLD = 100;
|
|
13
|
+
/**
|
|
14
|
+
* Ratio of drawer size that must be swiped to dismiss (close) the drawer.
|
|
15
|
+
* Value between 0 and 1. When swiping to close, if displacement exceeds
|
|
16
|
+
* this ratio of the drawer size, the drawer will close.
|
|
17
|
+
*/
|
|
18
|
+
export declare const REVEAL_DRAWER_DISMISS_RATIO = 0.3;
|
|
19
|
+
/**
|
|
20
|
+
* Percentage offset for drawer when closed.
|
|
21
|
+
* The drawer is positioned at -30% (or +30% for right/bottom) when closed,
|
|
22
|
+
* creating a "pull out" parallax effect during the reveal animation.
|
|
23
|
+
*/
|
|
24
|
+
export declare const REVEAL_DRAWER_CLOSED_OFFSET_PERCENT = 30;
|
|
25
|
+
/**
|
|
26
|
+
* Animation duration in milliseconds for reveal transitions.
|
|
27
|
+
*/
|
|
28
|
+
export declare const REVEAL_DRAWER_ANIMATION_DURATION = 300;
|
|
29
|
+
/**
|
|
30
|
+
* Threshold in pixels below which positions are considered equal.
|
|
31
|
+
* Used to determine if animation is needed between two positions.
|
|
32
|
+
*/
|
|
33
|
+
export declare const REVEAL_DRAWER_SNAP_THRESHOLD = 1;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Reveal drawer state machine (backward-compatible re-export).
|
|
3
|
+
*
|
|
4
|
+
* This module provides backward compatibility by re-exporting the generic
|
|
5
|
+
* drawer state machine configured with the reveal strategy.
|
|
6
|
+
*
|
|
7
|
+
* For new code, prefer importing from drawerStateMachine.ts directly
|
|
8
|
+
* with the appropriate strategy.
|
|
9
|
+
*/
|
|
10
|
+
import type { DrawerPlacement } from "../../components/window/drawerStyles.js";
|
|
11
|
+
import type { RevealPosition } from "./strategies/types.js";
|
|
12
|
+
import { computeProgressFromDisplacement as genericComputeProgress, computeSwipeEndTarget as genericComputeSwipeEndTarget, type DrawerPhase, type SwipeDirection, type AnimationState, type DrawerState, type DrawerAction } from "./drawerStateMachine.js";
|
|
13
|
+
import { getPlacementConfig } from "./strategies/types.js";
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use DrawerPhase from drawerStateMachine.ts
|
|
16
|
+
*/
|
|
17
|
+
export type RevealDrawerPhase = DrawerPhase;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use RevealPosition from strategies/types.ts
|
|
20
|
+
*/
|
|
21
|
+
export type RevealPositionPx = RevealPosition;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use AnimationState<RevealPosition>
|
|
24
|
+
*/
|
|
25
|
+
export type { AnimationState };
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use DrawerState<RevealPosition>
|
|
28
|
+
*/
|
|
29
|
+
export type RevealDrawerState = DrawerState<RevealPosition>;
|
|
30
|
+
/**
|
|
31
|
+
* Configuration for the reveal drawer state machine.
|
|
32
|
+
*/
|
|
33
|
+
export type RevealDrawerConfig = {
|
|
34
|
+
placement: DrawerPlacement;
|
|
35
|
+
drawerSize: number;
|
|
36
|
+
};
|
|
37
|
+
export type { SwipeDirection };
|
|
38
|
+
export { getPlacementConfig };
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Use drawerActions from drawerStateMachine.ts
|
|
41
|
+
*/
|
|
42
|
+
export declare const revealDrawerActions: {
|
|
43
|
+
readonly swipeStart: ((direction: "opening" | "closing") => {
|
|
44
|
+
type: "SWIPE_START";
|
|
45
|
+
payload: {
|
|
46
|
+
direction: "opening" | "closing";
|
|
47
|
+
};
|
|
48
|
+
}) & {
|
|
49
|
+
readonly type: "SWIPE_START";
|
|
50
|
+
};
|
|
51
|
+
readonly swipeUpdate: ((displacement: number) => {
|
|
52
|
+
type: "SWIPE_UPDATE";
|
|
53
|
+
payload: {
|
|
54
|
+
displacement: number;
|
|
55
|
+
};
|
|
56
|
+
}) & {
|
|
57
|
+
readonly type: "SWIPE_UPDATE";
|
|
58
|
+
};
|
|
59
|
+
readonly swipeEnd: (() => {
|
|
60
|
+
type: "SWIPE_END";
|
|
61
|
+
}) & {
|
|
62
|
+
readonly type: "SWIPE_END";
|
|
63
|
+
};
|
|
64
|
+
readonly animationFrame: ((easedProgress: number) => {
|
|
65
|
+
type: "ANIMATION_FRAME";
|
|
66
|
+
payload: {
|
|
67
|
+
easedProgress: number;
|
|
68
|
+
};
|
|
69
|
+
}) & {
|
|
70
|
+
readonly type: "ANIMATION_FRAME";
|
|
71
|
+
};
|
|
72
|
+
readonly animationComplete: (() => {
|
|
73
|
+
type: "ANIMATION_COMPLETE";
|
|
74
|
+
}) & {
|
|
75
|
+
readonly type: "ANIMATION_COMPLETE";
|
|
76
|
+
};
|
|
77
|
+
readonly buttonOpen: (() => {
|
|
78
|
+
type: "BUTTON_OPEN";
|
|
79
|
+
}) & {
|
|
80
|
+
readonly type: "BUTTON_OPEN";
|
|
81
|
+
};
|
|
82
|
+
readonly buttonClose: (() => {
|
|
83
|
+
type: "BUTTON_CLOSE";
|
|
84
|
+
}) & {
|
|
85
|
+
readonly type: "BUTTON_CLOSE";
|
|
86
|
+
};
|
|
87
|
+
readonly syncOpenState: ((isOpen: boolean) => {
|
|
88
|
+
type: "SYNC_OPEN_STATE";
|
|
89
|
+
payload: {
|
|
90
|
+
isOpen: boolean;
|
|
91
|
+
};
|
|
92
|
+
}) & {
|
|
93
|
+
readonly type: "SYNC_OPEN_STATE";
|
|
94
|
+
};
|
|
95
|
+
readonly initialize: ((isOpen: boolean) => {
|
|
96
|
+
type: "INITIALIZE";
|
|
97
|
+
payload: {
|
|
98
|
+
isOpen: boolean;
|
|
99
|
+
};
|
|
100
|
+
}) & {
|
|
101
|
+
readonly type: "INITIALIZE";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export type RevealDrawerAction = DrawerAction;
|
|
105
|
+
/**
|
|
106
|
+
* Compute progress from displacement.
|
|
107
|
+
* @deprecated Use computeProgressFromDisplacement from drawerStateMachine.ts
|
|
108
|
+
*/
|
|
109
|
+
export declare const computeProgressFromDisplacement: typeof genericComputeProgress;
|
|
110
|
+
/**
|
|
111
|
+
* Compute swipe end target.
|
|
112
|
+
* @deprecated Use computeSwipeEndTarget from drawerStateMachine.ts
|
|
113
|
+
*/
|
|
114
|
+
export declare const computeSwipeEndTarget: typeof genericComputeSwipeEndTarget;
|
|
115
|
+
/**
|
|
116
|
+
* Compute drawer offset in pixels from progress.
|
|
117
|
+
*/
|
|
118
|
+
export declare function computeDrawerOffsetPx(progress: number, drawerSize: number, placement: DrawerPlacement): number;
|
|
119
|
+
/**
|
|
120
|
+
* Compute content offset in pixels from progress.
|
|
121
|
+
*/
|
|
122
|
+
export declare function computeContentOffsetPx(progress: number, drawerSize: number, placement: DrawerPlacement): number;
|
|
123
|
+
/**
|
|
124
|
+
* Compute position from progress.
|
|
125
|
+
*/
|
|
126
|
+
export declare function computePositionFromProgress(progress: number, config: RevealDrawerConfig): RevealPosition;
|
|
127
|
+
/**
|
|
128
|
+
* Compute target position for open or closed state.
|
|
129
|
+
*/
|
|
130
|
+
export declare function computeTargetPosition(isOpen: boolean, config: RevealDrawerConfig): RevealPosition;
|
|
131
|
+
/**
|
|
132
|
+
* Determine if animation is needed between two positions.
|
|
133
|
+
*/
|
|
134
|
+
export declare function shouldAnimate(from: RevealPosition, to: RevealPosition): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Interpolate between two positions.
|
|
137
|
+
*/
|
|
138
|
+
export declare function interpolatePosition(from: RevealPosition, to: RevealPosition, progress: number): RevealPosition;
|
|
139
|
+
/**
|
|
140
|
+
* Create initial state for reveal drawer.
|
|
141
|
+
*/
|
|
142
|
+
export declare function createInitialState(isOpen: boolean, config: RevealDrawerConfig): RevealDrawerState;
|
|
143
|
+
/**
|
|
144
|
+
* Reveal drawer reducer function.
|
|
145
|
+
*/
|
|
146
|
+
export declare function revealDrawerReducer(state: RevealDrawerState, action: RevealDrawerAction, config: RevealDrawerConfig): RevealDrawerState;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Drawer transform strategies module.
|
|
3
|
+
*
|
|
4
|
+
* Exports strategy implementations for different drawer animation modes.
|
|
5
|
+
*/
|
|
6
|
+
export * from "./types.js";
|
|
7
|
+
export { revealStrategy } from "./revealStrategy.js";
|
|
8
|
+
export { overlayStrategy } from "./overlayStrategy.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Overlay mode drawer transform strategy.
|
|
3
|
+
*
|
|
4
|
+
* Implements the overlay animation where:
|
|
5
|
+
* - Drawer slides from ±100% to 0% (slides over content)
|
|
6
|
+
* - Backdrop opacity changes from 0 to 1
|
|
7
|
+
*/
|
|
8
|
+
import type { DrawerTransformStrategy, OverlayPosition } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Overlay mode drawer transform strategy.
|
|
11
|
+
*/
|
|
12
|
+
export declare const overlayStrategy: DrawerTransformStrategy<OverlayPosition>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Reveal mode drawer transform strategy.
|
|
3
|
+
*
|
|
4
|
+
* Implements the reveal animation where:
|
|
5
|
+
* - Drawer slides from -30% to 0% (parallax effect)
|
|
6
|
+
* - Content slides from 0 to +drawerSize (reveals drawer behind)
|
|
7
|
+
*/
|
|
8
|
+
import type { DrawerTransformStrategy, RevealPosition } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Reveal mode drawer transform strategy.
|
|
11
|
+
*/
|
|
12
|
+
export declare const revealStrategy: DrawerTransformStrategy<RevealPosition>;
|