react-panel-layout 0.5.2 → 0.6.1
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/{FloatingPanelFrame-lLg-Lpg7.js → FloatingPanelFrame-3eU9AwPo.js} +11 -11
- package/dist/{FloatingPanelFrame-lLg-Lpg7.js.map → FloatingPanelFrame-3eU9AwPo.js.map} +1 -1
- package/dist/{FloatingPanelFrame-D9Cp2al1.cjs → FloatingPanelFrame-CEmXDvUA.cjs} +2 -2
- package/dist/{FloatingPanelFrame-D9Cp2al1.cjs.map → FloatingPanelFrame-CEmXDvUA.cjs.map} +1 -1
- package/dist/FloatingWindow-CUXnEtrb.js +827 -0
- package/dist/FloatingWindow-CUXnEtrb.js.map +1 -0
- package/dist/FloatingWindow-DMwyK0eK.cjs +2 -0
- package/dist/FloatingWindow-DMwyK0eK.cjs.map +1 -0
- package/dist/GridLayout-DKTg_N61.cjs +2 -0
- package/dist/GridLayout-DKTg_N61.cjs.map +1 -0
- package/dist/GridLayout-UWNxXw77.js +926 -0
- package/dist/GridLayout-UWNxXw77.js.map +1 -0
- package/dist/HorizontalDivider-DdxzfV0l.js +30 -0
- package/dist/HorizontalDivider-DdxzfV0l.js.map +1 -0
- package/dist/HorizontalDivider-_pgV4Mcv.cjs +2 -0
- package/dist/HorizontalDivider-_pgV4Mcv.cjs.map +1 -0
- package/dist/PanelSystem-BqUzNtf2.js +1946 -0
- package/dist/PanelSystem-BqUzNtf2.js.map +1 -0
- package/dist/PanelSystem-D603LKKv.cjs +3 -0
- package/dist/PanelSystem-D603LKKv.cjs.map +1 -0
- package/dist/ResizeHandle-CBcAS918.cjs +2 -0
- package/dist/ResizeHandle-CBcAS918.cjs.map +1 -0
- package/dist/ResizeHandle-CXjc1meV.js +119 -0
- package/dist/ResizeHandle-CXjc1meV.js.map +1 -0
- package/dist/SwipePivotTabBar-DWrCuwEI.js +411 -0
- package/dist/SwipePivotTabBar-DWrCuwEI.js.map +1 -0
- package/dist/SwipePivotTabBar-fjjXkpj7.cjs +2 -0
- package/dist/SwipePivotTabBar-fjjXkpj7.cjs.map +1 -0
- package/dist/components/gesture/SwipeSafeZone.d.ts +40 -0
- package/dist/components/window/Drawer.d.ts +3 -1
- package/dist/components/window/DrawerLayers.d.ts +1 -1
- package/dist/components/window/drawerStyles.d.ts +69 -0
- package/dist/components/window/drawerSwipeConfig.d.ts +29 -0
- package/dist/components/window/useDrawerSwipeTransform.d.ts +23 -0
- package/dist/config.cjs +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.js +11 -9
- package/dist/config.js.map +1 -1
- package/dist/constants/styles.d.ts +35 -4
- package/dist/dialog/index.d.ts +69 -0
- package/dist/floating.cjs +1 -1
- package/dist/floating.js +1 -1
- package/dist/grid/index.d.ts +58 -0
- package/dist/grid.cjs +2 -0
- package/dist/grid.cjs.map +1 -0
- package/dist/grid.js +13 -0
- package/dist/grid.js.map +1 -0
- package/dist/hooks/gesture/presets.d.ts +33 -0
- package/dist/hooks/gesture/testing/createGestureSimulator.d.ts +117 -0
- package/dist/hooks/gesture/thresholdValue.d.ts +44 -0
- package/dist/hooks/gesture/types.d.ts +297 -0
- package/dist/hooks/gesture/useDirectionalLock.d.ts +20 -0
- package/dist/hooks/gesture/useEdgeSwipeInput.d.ts +23 -0
- package/dist/hooks/gesture/useNativeGestureGuard.d.ts +23 -0
- package/dist/hooks/gesture/usePointerTracking.d.ts +22 -0
- package/dist/hooks/gesture/useScrollBoundary.d.ts +23 -0
- package/dist/hooks/gesture/useSwipeInput.d.ts +5 -0
- package/dist/hooks/gesture/utils.d.ts +59 -0
- package/dist/hooks/useAnimatedVisibility.d.ts +58 -0
- package/dist/hooks/useAnimationFrame.d.ts +86 -0
- package/dist/hooks/useOperationContinuity.d.ts +64 -0
- package/dist/hooks/useResizeObserver.d.ts +33 -1
- package/dist/hooks/useSharedElementTransition.d.ts +112 -0
- package/dist/hooks/useSnapAnimation.d.ts +54 -0
- package/dist/hooks/useSwipeContentTransform.d.ts +86 -0
- package/dist/index.cjs +1 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +25 -2006
- package/dist/index.js.map +1 -1
- package/dist/modules/dialog/AlertDialog.d.ts +9 -0
- package/dist/modules/dialog/DialogContainer.d.ts +37 -0
- package/dist/modules/dialog/Modal.d.ts +26 -0
- package/dist/modules/dialog/SwipeDialogContainer.d.ts +16 -0
- package/dist/modules/dialog/dialogAnimationUtils.d.ts +113 -0
- package/dist/modules/dialog/types.d.ts +183 -0
- package/dist/modules/dialog/useDialog.d.ts +39 -0
- package/dist/modules/dialog/useDialogContainer.d.ts +47 -0
- package/dist/modules/dialog/useDialogSwipeInput.d.ts +70 -0
- package/dist/modules/dialog/useDialogTransform.d.ts +82 -0
- package/dist/modules/drawer/types.d.ts +74 -0
- package/dist/modules/drawer/useDrawerSwipeInput.d.ts +24 -0
- package/dist/modules/pivot/PivotContent.d.ts +1 -1
- package/dist/modules/pivot/SwipePivotContent.d.ts +39 -0
- package/dist/modules/pivot/SwipePivotContent.debug.tmp.d.ts +25 -0
- package/dist/modules/pivot/SwipePivotContent.test.d.ts +1 -0
- package/dist/modules/pivot/SwipePivotTabBar.d.ts +92 -0
- package/dist/modules/pivot/index.d.ts +3 -0
- package/dist/modules/pivot/scaleInputState.d.ts +37 -0
- package/dist/modules/pivot/types.d.ts +67 -2
- package/dist/modules/pivot/usePivotSwipeInput.d.ts +68 -0
- package/dist/modules/stack/StackContent.d.ts +15 -0
- package/dist/modules/stack/SwipeStackContent.d.ts +66 -0
- package/dist/modules/stack/SwipeStackOutlet.d.ts +80 -0
- package/dist/modules/stack/computeStackContentState.d.ts +99 -0
- package/dist/modules/stack/computeSwipeStackTransform.d.ts +76 -0
- package/dist/modules/stack/types.d.ts +194 -0
- package/dist/modules/stack/useStackAnimationState.d.ts +32 -0
- package/dist/modules/stack/useStackNavigation.d.ts +23 -0
- package/dist/modules/stack/useStackSwipeInput.d.ts +27 -0
- package/dist/panels/index.d.ts +67 -0
- package/dist/panels.cjs +2 -0
- package/dist/panels.cjs.map +1 -0
- package/dist/panels.js +28 -0
- package/dist/panels.js.map +1 -0
- package/dist/pivot/index.d.ts +3 -0
- package/dist/pivot.cjs +1 -1
- package/dist/pivot.cjs.map +1 -1
- package/dist/pivot.js +20 -2
- package/dist/pivot.js.map +1 -1
- package/dist/resizer/index.d.ts +57 -0
- package/dist/resizer.cjs +2 -0
- package/dist/resizer.cjs.map +1 -0
- package/dist/resizer.js +8 -0
- package/dist/resizer.js.map +1 -0
- package/dist/stack/index.d.ts +72 -0
- package/dist/stack.cjs +2 -0
- package/dist/stack.cjs.map +1 -0
- package/dist/stack.js +721 -0
- package/dist/stack.js.map +1 -0
- package/dist/sticky-header/StickyArea.d.ts +38 -0
- package/dist/sticky-header/calculateStickyMetrics.d.ts +28 -0
- package/dist/sticky-header/index.d.ts +4 -4
- package/dist/sticky-header/types.d.ts +35 -22
- package/dist/sticky-header.cjs +1 -1
- package/dist/sticky-header.cjs.map +1 -1
- package/dist/sticky-header.js +73 -174
- package/dist/sticky-header.js.map +1 -1
- package/dist/styles-NkjuMOVS.js +57 -0
- package/dist/styles-NkjuMOVS.js.map +1 -0
- package/dist/styles-qf6ptVLD.cjs +2 -0
- package/dist/styles-qf6ptVLD.cjs.map +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/useContentCache-CO3LYNmz.js +24 -0
- package/dist/useContentCache-CO3LYNmz.js.map +1 -0
- package/dist/useContentCache-DqXtLrLs.cjs +2 -0
- package/dist/useContentCache-DqXtLrLs.cjs.map +1 -0
- package/dist/useDocumentPointerEvents-DXxw3qWj.js +54 -0
- package/dist/useDocumentPointerEvents-DXxw3qWj.js.map +1 -0
- package/dist/useDocumentPointerEvents-DxDSOtip.cjs +2 -0
- package/dist/useDocumentPointerEvents-DxDSOtip.cjs.map +1 -0
- package/dist/useFloatingState-C4kRaW_R.cjs +2 -0
- package/dist/useFloatingState-C4kRaW_R.cjs.map +1 -0
- package/dist/useFloatingState-tEfA_wbc.js +74 -0
- package/dist/useFloatingState-tEfA_wbc.js.map +1 -0
- package/dist/useNativeGestureGuard-C7TSqEkr.cjs +2 -0
- package/dist/useNativeGestureGuard-C7TSqEkr.cjs.map +1 -0
- package/dist/useNativeGestureGuard-CGYo6O0r.js +347 -0
- package/dist/useNativeGestureGuard-CGYo6O0r.js.map +1 -0
- package/dist/window/index.d.ts +63 -0
- package/dist/window.cjs +2 -0
- package/dist/window.cjs.map +1 -0
- package/dist/window.js +160 -0
- package/dist/window.js.map +1 -0
- package/docs/design-tokens.md +405 -0
- package/package.json +34 -4
- package/src/PanelSystemContext.tsx +88 -0
- package/src/components/gesture/SwipeSafeZone.tsx +69 -0
- package/src/components/grid/GridLayerList.tsx +172 -0
- package/src/components/grid/GridLayerResizeHandles.tsx +145 -0
- package/src/components/grid/GridLayout.spec.tsx +743 -0
- package/src/components/grid/GridLayout.tsx +130 -0
- package/src/components/grid/GridTrackResizeHandle.tsx +87 -0
- package/src/components/paneling/FloatingPanelFrame.tsx +203 -0
- package/src/components/panels/DropSuggestOverlay.tsx +131 -0
- package/src/components/panels/PanelGroupView.tsx +112 -0
- package/src/components/pivot/PivotLayer.tsx +27 -0
- package/src/components/resizer/HorizontalDivider.tsx +52 -0
- package/src/components/resizer/ResizeHandle.tsx +118 -0
- package/src/components/tabs/TabBar.tsx +223 -0
- package/src/components/tabs/TabBarTab.tsx +133 -0
- package/src/components/tabs/TabDragOverlay.tsx +92 -0
- package/src/components/window/DialogOverlay.tsx +180 -0
- package/src/components/window/Drawer.tsx +369 -0
- package/src/components/window/DrawerLayers.tsx +68 -0
- package/src/components/window/FloatingWindow.tsx +95 -0
- package/src/components/window/PopupLayerPortal.tsx +218 -0
- package/src/components/window/drawerStyles.spec.ts +263 -0
- package/src/components/window/drawerStyles.ts +228 -0
- package/src/components/window/drawerSwipeConfig.spec.ts +131 -0
- package/src/components/window/drawerSwipeConfig.ts +112 -0
- package/src/components/window/useDrawerSwipeTransform.spec.ts +234 -0
- package/src/components/window/useDrawerSwipeTransform.ts +129 -0
- package/src/config/PanelContentDeclaration.tsx +427 -0
- package/src/config/index.tsx +52 -0
- package/src/config/panelJsx.spec.tsx +54 -0
- package/src/config/panelJsxConfig.spec.tsx +54 -0
- package/src/config/panelJsxDrawer.spec.tsx +33 -0
- package/src/config/panelRouter.spec.ts +68 -0
- package/src/config/panelRouter.tsx +155 -0
- package/src/constants/styles.ts +280 -0
- package/src/demo/Layout.module.css +258 -0
- package/src/demo/Layout.tsx +176 -0
- package/src/demo/components/CodeBlock.module.css +54 -0
- package/src/demo/components/CodeBlock.tsx +34 -0
- package/src/demo/components/CodePreview.module.css +37 -0
- package/src/demo/components/CodePreview.tsx +31 -0
- package/src/demo/components/DataPreview.module.css +177 -0
- package/src/demo/components/DataPreview.tsx +115 -0
- package/src/demo/components/Story.module.css +68 -0
- package/src/demo/components/Story.tsx +54 -0
- package/src/demo/components/layout/CodePanel.module.css +183 -0
- package/src/demo/components/layout/CodePanel.tsx +149 -0
- package/src/demo/components/layout/DemoPage.module.css +60 -0
- package/src/demo/components/layout/DemoPage.tsx +56 -0
- package/src/demo/components/layout/SingleSamplePage.module.css +11 -0
- package/src/demo/components/layout/SingleSamplePage.tsx +35 -0
- package/src/demo/components/layout/SplitDemoLayout.module.css +107 -0
- package/src/demo/components/layout/SplitDemoLayout.tsx +218 -0
- package/src/demo/components/layout/index.ts +11 -0
- package/src/demo/components/tab-styles/ChromeTabBar.module.css +75 -0
- package/src/demo/components/tab-styles/ChromeTabBar.tsx +111 -0
- package/src/demo/components/tab-styles/GitHubTabBar.module.css +81 -0
- package/src/demo/components/tab-styles/GitHubTabBar.tsx +109 -0
- package/src/demo/components/tab-styles/VSCodeTabBar.module.css +78 -0
- package/src/demo/components/tab-styles/VSCodeTabBar.tsx +109 -0
- package/src/demo/components/tab-styles/index.ts +6 -0
- package/src/demo/components/ui/DemoButton.module.css +63 -0
- package/src/demo/components/ui/DemoButton.tsx +32 -0
- package/src/demo/components/ui/DemoCard.module.css +15 -0
- package/src/demo/components/ui/DemoCard.tsx +30 -0
- package/src/demo/components/ui/DemoContainer.module.css +17 -0
- package/src/demo/components/ui/DemoContainer.tsx +30 -0
- package/src/demo/components/ui/DemoPanel.module.css +23 -0
- package/src/demo/components/ui/DemoPanel.tsx +33 -0
- package/src/demo/components/ui/PanelText.module.css +18 -0
- package/src/demo/components/ui/PanelText.tsx +29 -0
- package/src/demo/components/ui/PanelTitle.module.css +18 -0
- package/src/demo/components/ui/PanelTitle.tsx +31 -0
- package/src/demo/contexts/TabbarDemoConfig.tsx +218 -0
- package/src/demo/demo.css +172 -0
- package/src/demo/hooks/useMedia.ts +41 -0
- package/src/demo/hooks/useShikiHighlight.ts +55 -0
- package/src/demo/index.tsx +293 -0
- package/src/demo/pages/Dialog/alerts/index.tsx +22 -0
- package/src/demo/pages/Dialog/card/index.tsx +22 -0
- package/src/demo/pages/Dialog/components/AlertDialogDemo.tsx +124 -0
- package/src/demo/pages/Dialog/components/CardExpandDemo.module.css +243 -0
- package/src/demo/pages/Dialog/components/CardExpandDemo.tsx +204 -0
- package/src/demo/pages/Dialog/components/CustomAlertDialogDemo.tsx +219 -0
- package/src/demo/pages/Dialog/components/DialogDemos.module.css +77 -0
- package/src/demo/pages/Dialog/components/ModalBasics.tsx +45 -0
- package/src/demo/pages/Dialog/components/SwipeDialogDemo.module.css +77 -0
- package/src/demo/pages/Dialog/components/SwipeDialogDemo.tsx +181 -0
- package/src/demo/pages/Dialog/custom-alert/index.tsx +22 -0
- package/src/demo/pages/Dialog/modal/index.tsx +17 -0
- package/src/demo/pages/Dialog/swipe/index.tsx +22 -0
- package/src/demo/pages/Drawer/animations/index.tsx +22 -0
- package/src/demo/pages/Drawer/basics/index.tsx +17 -0
- package/src/demo/pages/Drawer/components/DrawerAnimations.module.css +125 -0
- package/src/demo/pages/Drawer/components/DrawerAnimations.tsx +118 -0
- package/src/demo/pages/Drawer/components/DrawerBasics.module.css +55 -0
- package/src/demo/pages/Drawer/components/DrawerBasics.tsx +76 -0
- package/src/demo/pages/Drawer/components/DrawerMenuLayout.module.css +332 -0
- package/src/demo/pages/Drawer/components/DrawerMenuLayout.tsx +199 -0
- package/src/demo/pages/Drawer/components/DrawerSwipe.module.css +316 -0
- package/src/demo/pages/Drawer/components/DrawerSwipe.tsx +178 -0
- package/src/demo/pages/Drawer/menu/index.tsx +17 -0
- package/src/demo/pages/Drawer/swipe/index.tsx +17 -0
- package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.module.css +163 -0
- package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.tsx +234 -0
- package/src/demo/pages/FloatingPanelFrame/basic/index.tsx +17 -0
- package/src/demo/pages/FloatingPanelFrame/complex/index.tsx +26 -0
- package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.module.css +16 -0
- package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.tsx +24 -0
- package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.module.css +54 -0
- package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.tsx +67 -0
- package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.module.css +21 -0
- package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.tsx +41 -0
- package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.module.css +5 -0
- package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.tsx +43 -0
- package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.module.css +11 -0
- package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.tsx +42 -0
- package/src/demo/pages/FloatingPanelFrame/index.tsx +80 -0
- package/src/demo/pages/FloatingPanelFrame/scrollable/index.tsx +30 -0
- package/src/demo/pages/FloatingPanelFrame/with-controls/index.tsx +30 -0
- package/src/demo/pages/FloatingPanelFrame/with-meta/index.tsx +17 -0
- package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.module.css +112 -0
- package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.tsx +56 -0
- package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.module.css +46 -0
- package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.tsx +29 -0
- package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.module.css +54 -0
- package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.tsx +30 -0
- package/src/demo/pages/HorizontalDivider/index.module.css +14 -0
- package/src/demo/pages/HorizontalDivider/index.tsx +64 -0
- package/src/demo/pages/HorizontalDivider/panels-with-rich-content/index.tsx +21 -0
- package/src/demo/pages/HorizontalDivider/simple-resizable-panels/index.tsx +21 -0
- package/src/demo/pages/HorizontalDivider/three-panel-layout/index.tsx +21 -0
- package/src/demo/pages/PanelLayout/PanelLayoutDemo.module.css +174 -0
- package/src/demo/pages/PanelLayout/PanelLayoutDemo.tsx +248 -0
- package/src/demo/pages/PanelLayout/components/DashboardLayout.module.css +115 -0
- package/src/demo/pages/PanelLayout/components/DashboardLayout.tsx +124 -0
- package/src/demo/pages/PanelLayout/components/DraggableOverlays.module.css +101 -0
- package/src/demo/pages/PanelLayout/components/DraggableOverlays.tsx +122 -0
- package/src/demo/pages/PanelLayout/components/IDELayout.module.css +104 -0
- package/src/demo/pages/PanelLayout/components/IDELayout.tsx +143 -0
- package/src/demo/pages/PanelLayout/components/SimpleGrid.module.css +19 -0
- package/src/demo/pages/PanelLayout/components/SimpleGrid.tsx +62 -0
- package/src/demo/pages/PanelLayout/dashboard/index.tsx +22 -0
- package/src/demo/pages/PanelLayout/draggable-overlays/index.tsx +22 -0
- package/src/demo/pages/PanelLayout/ide-layout/index.tsx +22 -0
- package/src/demo/pages/PanelLayout/index.tsx +94 -0
- package/src/demo/pages/PanelLayout/simple-grid/index.tsx +22 -0
- package/src/demo/pages/PanelSystem/PanelSystemPreview.module.css +20 -0
- package/src/demo/pages/PanelSystem/PanelSystemPreview.tsx +101 -0
- package/src/demo/pages/PanelSystem/preview/index.tsx +18 -0
- package/src/demo/pages/PanelSystem/tabbar/index.tsx +129 -0
- package/src/demo/pages/Pivot/basics/index.tsx +17 -0
- package/src/demo/pages/Pivot/components/Pivot.module.css +278 -0
- package/src/demo/pages/Pivot/components/PivotBasics.tsx +103 -0
- package/src/demo/pages/Pivot/components/PivotSidebar.tsx +168 -0
- package/src/demo/pages/Pivot/components/PivotTabs.tsx +129 -0
- package/src/demo/pages/Pivot/components/PivotTransitions.tsx +120 -0
- package/src/demo/pages/Pivot/components/SwipePivot.module.css +114 -0
- package/src/demo/pages/Pivot/components/SwipePivot.tsx +193 -0
- package/src/demo/pages/Pivot/components/SwipeTabsPivot.module.css +203 -0
- package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +320 -0
- package/src/demo/pages/Pivot/sidebar/index.tsx +17 -0
- package/src/demo/pages/Pivot/swipe/index.tsx +16 -0
- package/src/demo/pages/Pivot/swipe-debug/index.tsx +287 -0
- package/src/demo/pages/Pivot/swipe-tabs/index.tsx +15 -0
- package/src/demo/pages/Pivot/tabs/index.tsx +17 -0
- package/src/demo/pages/Pivot/transitions/index.tsx +17 -0
- package/src/demo/pages/ResizeHandle/both-directions/index.tsx +17 -0
- package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.module.css +72 -0
- package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.tsx +41 -0
- package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.module.css +61 -0
- package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.tsx +33 -0
- package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.module.css +83 -0
- package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.tsx +53 -0
- package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.module.css +68 -0
- package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.tsx +33 -0
- package/src/demo/pages/ResizeHandle/horizontal/index.tsx +17 -0
- package/src/demo/pages/ResizeHandle/index.module.css +11 -0
- package/src/demo/pages/ResizeHandle/index.tsx +71 -0
- package/src/demo/pages/ResizeHandle/nested-panels/index.tsx +17 -0
- package/src/demo/pages/ResizeHandle/vertical/index.tsx +17 -0
- package/src/demo/pages/ResponsiveLayout/adaptive-workspace/index.tsx +22 -0
- package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.module.css +423 -0
- package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.tsx +398 -0
- package/src/demo/pages/Stack/basics/index.tsx +22 -0
- package/src/demo/pages/Stack/components/Stack.module.css +234 -0
- package/src/demo/pages/Stack/components/StackBasics.spec.tsx +152 -0
- package/src/demo/pages/Stack/components/StackBasics.tsx +301 -0
- package/src/demo/pages/Stack/components/StackTablet.module.css +299 -0
- package/src/demo/pages/Stack/components/StackTablet.spec.tsx +120 -0
- package/src/demo/pages/Stack/components/StackTablet.tsx +422 -0
- package/src/demo/pages/Stack/tablet/index.tsx +22 -0
- package/src/demo/pages/StickyHeader/basics/index.tsx +17 -0
- package/src/demo/pages/StickyHeader/components/StickyHeader.module.css +219 -0
- package/src/demo/pages/StickyHeader/components/StickyHeaderBasics.tsx +103 -0
- package/src/demo/routes.tsx +214 -0
- package/src/demo/styles/animations.css +68 -0
- package/src/demo/styles/stack-themes.css +35 -0
- package/src/demo/utils/createPanelView.tsx +58 -0
- package/src/dialog/index.ts +85 -0
- package/src/floating/index.ts +24 -0
- package/src/grid/index.ts +75 -0
- package/src/hooks/ContentCacheContext.tsx +87 -0
- package/src/hooks/gesture/presets.spec.ts +86 -0
- package/src/hooks/gesture/presets.ts +95 -0
- package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +241 -0
- package/src/hooks/gesture/testing/createGestureSimulator.ts +385 -0
- package/src/hooks/gesture/thresholdValue.spec.ts +103 -0
- package/src/hooks/gesture/thresholdValue.ts +77 -0
- package/src/hooks/gesture/types.ts +367 -0
- package/src/hooks/gesture/useDirectionalLock.spec.ts +271 -0
- package/src/hooks/gesture/useDirectionalLock.ts +115 -0
- package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +462 -0
- package/src/hooks/gesture/useEdgeSwipeInput.ts +131 -0
- package/src/hooks/gesture/useNativeGestureGuard.spec.ts +473 -0
- package/src/hooks/gesture/useNativeGestureGuard.ts +135 -0
- package/src/hooks/gesture/usePointerTracking.spec.ts +364 -0
- package/src/hooks/gesture/usePointerTracking.ts +134 -0
- package/src/hooks/gesture/useScrollBoundary.spec.ts +249 -0
- package/src/hooks/gesture/useScrollBoundary.ts +113 -0
- package/src/hooks/gesture/useSwipeInput.spec.ts +592 -0
- package/src/hooks/gesture/useSwipeInput.ts +310 -0
- package/src/hooks/gesture/utils.spec.ts +152 -0
- package/src/hooks/gesture/utils.ts +178 -0
- package/src/hooks/useAnimatedVisibility.spec.ts +277 -0
- package/src/hooks/useAnimatedVisibility.ts +172 -0
- package/src/hooks/useAnimationFrame.ts +208 -0
- package/src/hooks/useCSSMatrix.spec.ts +214 -0
- package/src/hooks/useCSSMatrix.ts +262 -0
- package/src/hooks/useClonedElementPreview.ts +28 -0
- package/src/hooks/useContainerScroll.ts +78 -0
- package/src/hooks/useContentCache.spec.tsx +232 -0
- package/src/hooks/useContentCache.tsx +127 -0
- package/src/hooks/useDocumentPointerEvents.ts +137 -0
- package/src/hooks/useDocumentScroll.ts +41 -0
- package/src/hooks/useEffectEvent.ts +40 -0
- package/src/hooks/useElementComponentWrapper.tsx +63 -0
- package/src/hooks/useIntersectionObserver.tsx +125 -0
- package/src/hooks/useIsomorphicLayoutEffect.ts +29 -0
- package/src/hooks/useOperationContinuity.spec.ts +387 -0
- package/src/hooks/useOperationContinuity.ts +135 -0
- package/src/hooks/useResizeObserver.spec.tsx +277 -0
- package/src/hooks/useResizeObserver.tsx +150 -0
- package/src/hooks/useScrollContainer.ts +73 -0
- package/src/hooks/useSharedElementTransition.ts +333 -0
- package/src/hooks/useSnapAnimation.ts +128 -0
- package/src/hooks/useSwipeContentTransform.spec.ts +133 -0
- package/src/hooks/useSwipeContentTransform.ts +373 -0
- package/src/hooks/useTransitionState.ts +95 -0
- package/src/index.tsx +88 -0
- package/src/modules/dialog/AlertDialog.spec.tsx +387 -0
- package/src/modules/dialog/AlertDialog.tsx +221 -0
- package/src/modules/dialog/DialogContainer.spec.tsx +228 -0
- package/src/modules/dialog/DialogContainer.tsx +188 -0
- package/src/modules/dialog/Modal.spec.tsx +220 -0
- package/src/modules/dialog/Modal.tsx +182 -0
- package/src/modules/dialog/SwipeDialogContainer.tsx +208 -0
- package/src/modules/dialog/dialogAnimationUtils.spec.ts +253 -0
- package/src/modules/dialog/dialogAnimationUtils.ts +297 -0
- package/src/modules/dialog/types.ts +186 -0
- package/src/modules/dialog/useDialog.spec.tsx +447 -0
- package/src/modules/dialog/useDialog.ts +214 -0
- package/src/modules/dialog/useDialogContainer.spec.ts +331 -0
- package/src/modules/dialog/useDialogContainer.ts +150 -0
- package/src/modules/dialog/useDialogSwipeInput.spec.ts +157 -0
- package/src/modules/dialog/useDialogSwipeInput.ts +319 -0
- package/src/modules/dialog/useDialogTransform.spec.ts +370 -0
- package/src/modules/dialog/useDialogTransform.ts +407 -0
- package/src/modules/drawer/types.ts +102 -0
- package/src/modules/drawer/useDrawerSwipeInput.spec.ts +566 -0
- package/src/modules/drawer/useDrawerSwipeInput.ts +399 -0
- package/src/modules/grid/GridLayoutContext.tsx +57 -0
- package/src/modules/grid/LayerInstanceContext.tsx +56 -0
- package/src/modules/grid/resizeHandles.ts +157 -0
- package/src/modules/grid/trackUtils.ts +146 -0
- package/src/modules/grid/useGridPlacements.ts +143 -0
- package/src/modules/grid/useGridTracks.ts +156 -0
- package/src/modules/grid/useLayerDragHandle.ts +16 -0
- package/src/modules/grid/useLayerInteractions.tsx +850 -0
- package/src/modules/keybindings/KeybindingsProvider.tsx +111 -0
- package/src/modules/panels/dom/DomRegistry.tsx +94 -0
- package/src/modules/panels/index.ts +45 -0
- package/src/modules/panels/interactions/InteractionsContext.test.tsx +330 -0
- package/src/modules/panels/interactions/InteractionsContext.tsx +394 -0
- package/src/modules/panels/interactions/dnd.ts +28 -0
- package/src/modules/panels/keybindings/KeybindingsInstaller.tsx +15 -0
- package/src/modules/panels/layout/adapter.ts +124 -0
- package/src/modules/panels/rendering/ContentRegistry.spec.tsx +311 -0
- package/src/modules/panels/rendering/ContentRegistry.tsx +205 -0
- package/src/modules/panels/rendering/GroupContainer.tsx +65 -0
- package/src/modules/panels/rendering/RenderBridge.tsx +115 -0
- package/src/modules/panels/rendering/RenderContext.tsx +31 -0
- package/src/modules/panels/state/PanelSplitHandles.tsx +147 -0
- package/src/modules/panels/state/PanelSystemContext.splitLimits.spec.tsx +50 -0
- package/src/modules/panels/state/PanelSystemContext.tsx +289 -0
- package/src/modules/panels/state/StateContext.tsx +12 -0
- package/src/modules/panels/state/cleanup.ts +37 -0
- package/src/modules/panels/state/commands.ts +53 -0
- package/src/modules/panels/state/focus/Context.tsx +25 -0
- package/src/modules/panels/state/focus/logic.ts +57 -0
- package/src/modules/panels/state/groups/Context.tsx +25 -0
- package/src/modules/panels/state/groups/logic.ts +105 -0
- package/src/modules/panels/state/splitLimits.spec.ts +46 -0
- package/src/modules/panels/state/splitLimits.ts +90 -0
- package/src/modules/panels/state/state.spec.ts +49 -0
- package/src/modules/panels/state/tree/Context.tsx +24 -0
- package/src/modules/panels/state/tree/logic.spec.ts +34 -0
- package/src/modules/panels/state/tree/logic.ts +138 -0
- package/src/modules/panels/state/types.ts +142 -0
- package/src/modules/panels/system/PanelSystem.empty-tabbar.spec.tsx +53 -0
- package/src/modules/panels/system/PanelSystem.tab-click-activates.spec.tsx +44 -0
- package/src/modules/panels/system/PanelSystem.tab-reorder.spec.tsx +64 -0
- package/src/modules/panels/system/PanelSystem.tabs-no-dup.spec.tsx +57 -0
- package/src/modules/panels/system/PanelSystem.tsx +206 -0
- package/src/modules/pivot/PivotContent.spec.tsx +179 -0
- package/src/modules/pivot/PivotContent.tsx +77 -0
- package/src/modules/pivot/SwipePivotContent.debug.tmp.tsx +237 -0
- package/src/modules/pivot/SwipePivotContent.position.spec.tsx +171 -0
- package/src/modules/pivot/SwipePivotContent.spec.tsx +494 -0
- package/src/modules/pivot/SwipePivotContent.test.tsx +502 -0
- package/src/modules/pivot/SwipePivotContent.tsx +197 -0
- package/src/modules/pivot/SwipePivotTabBar.spec.tsx +882 -0
- package/src/modules/pivot/SwipePivotTabBar.tsx +583 -0
- package/src/modules/pivot/index.ts +8 -0
- package/src/modules/pivot/scaleInputState.spec.ts +219 -0
- package/src/modules/pivot/scaleInputState.ts +66 -0
- package/src/modules/pivot/types.ts +139 -0
- package/src/modules/pivot/usePivot.spec.ts +635 -0
- package/src/modules/pivot/usePivot.spec.tsx +186 -0
- package/src/modules/pivot/usePivot.tsx +345 -0
- package/src/modules/pivot/usePivotSwipeInput.spec.ts +708 -0
- package/src/modules/pivot/usePivotSwipeInput.ts +136 -0
- package/src/modules/resizer/useResizeDrag.ts +94 -0
- package/src/modules/stack/StackContent.spec.tsx +264 -0
- package/src/modules/stack/StackContent.tsx +111 -0
- package/src/modules/stack/SwipeStackContent.spec.tsx +1564 -0
- package/src/modules/stack/SwipeStackContent.tsx +366 -0
- package/src/modules/stack/SwipeStackOutlet.spec.tsx +250 -0
- package/src/modules/stack/SwipeStackOutlet.tsx +221 -0
- package/src/modules/stack/computeStackContentState.spec.ts +281 -0
- package/src/modules/stack/computeStackContentState.ts +304 -0
- package/src/modules/stack/computeSwipeStackTransform.spec.ts +186 -0
- package/src/modules/stack/computeSwipeStackTransform.ts +145 -0
- package/src/modules/stack/swipeTransitionContinuity.spec.tsx +1133 -0
- package/src/modules/stack/types.ts +226 -0
- package/src/modules/stack/useStackAnimationState.spec.ts +188 -0
- package/src/modules/stack/useStackAnimationState.ts +143 -0
- package/src/modules/stack/useStackNavigation.spec.ts +672 -0
- package/src/modules/stack/useStackNavigation.tsx +393 -0
- package/src/modules/stack/useStackSwipeInput.spec.ts +309 -0
- package/src/modules/stack/useStackSwipeInput.ts +139 -0
- package/src/modules/window/useDrawerState.ts +81 -0
- package/src/modules/window/useFloatingState.spec.ts +252 -0
- package/src/modules/window/useFloatingState.ts +141 -0
- package/src/panels/index.ts +119 -0
- package/src/pivot/index.ts +19 -0
- package/src/resizer/index.ts +68 -0
- package/src/stack/index.ts +91 -0
- package/src/sticky-header/StickyArea.tsx +193 -0
- package/src/sticky-header/calculateStickyMetrics.spec.ts +105 -0
- package/src/sticky-header/calculateStickyMetrics.ts +50 -0
- package/src/sticky-header/index.ts +18 -0
- package/src/sticky-header/types.ts +68 -0
- package/src/types.ts +341 -0
- package/src/utils/CSSMatrix.ts +321 -0
- package/src/utils/css.ts +65 -0
- package/src/utils/dialogUtils.ts +43 -0
- package/src/utils/math.ts +18 -0
- package/src/utils/polyfills/createDialogPolyfill.ts +18 -0
- package/src/utils/typedActions.ts +103 -0
- package/src/vite-env.d.ts +6 -0
- package/src/window/index.ts +69 -0
- package/dist/GridLayout-BQQ63eA1.cjs +0 -2
- package/dist/GridLayout-BQQ63eA1.cjs.map +0 -1
- package/dist/GridLayout-CJTKq7Mp.js +0 -1465
- package/dist/GridLayout-CJTKq7Mp.js.map +0 -1
- package/dist/sticky-header/StickyHeader.d.ts +0 -53
- package/dist/styles-CA2_zLZt.js +0 -52
- package/dist/styles-CA2_zLZt.js.map +0 -1
- package/dist/styles-PsqGOEJP.cjs +0 -2
- package/dist/styles-PsqGOEJP.cjs.map +0 -1
- package/dist/usePivot-7ctin_P_.cjs +0 -2
- package/dist/usePivot-7ctin_P_.cjs.map +0 -1
- package/dist/usePivot-CgQxB8rc.js +0 -124
- package/dist/usePivot-CgQxB8rc.js.map +0 -1
|
@@ -0,0 +1,926 @@
|
|
|
1
|
+
import { jsx as w, Fragment as Z, jsxs as K } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { e as zt, F as Tt, u as wt, L as Mt, P as Pt, f as xt, G as kt, b as Ht } from "./FloatingWindow-CUXnEtrb.js";
|
|
4
|
+
import { G as $, v as L, w as j } from "./styles-NkjuMOVS.js";
|
|
5
|
+
import { u as Nt } from "./SwipePivotTabBar-DWrCuwEI.js";
|
|
6
|
+
import { R as Dt } from "./ResizeHandle-CXjc1meV.js";
|
|
7
|
+
import { u as St } from "./useIsomorphicLayoutEffect-DhmEnmZ_.js";
|
|
8
|
+
import { u as st, b as it } from "./useDocumentPointerEvents-DXxw3qWj.js";
|
|
9
|
+
const Gt = () => {
|
|
10
|
+
const t = /* @__PURE__ */ new Map();
|
|
11
|
+
return (e) => {
|
|
12
|
+
if (!e)
|
|
13
|
+
return;
|
|
14
|
+
const n = t.get(e);
|
|
15
|
+
if (n !== void 0)
|
|
16
|
+
return n;
|
|
17
|
+
const r = t.size;
|
|
18
|
+
return t.set(e, r), r;
|
|
19
|
+
};
|
|
20
|
+
}, At = Gt(), V = /* @__PURE__ */ new Map(), $t = (t) => {
|
|
21
|
+
const e = `ovs-threshold:${t.threshold}-rootMargin:${t.rootMargin}-root:${At(t.root)}`;
|
|
22
|
+
if (V.has(e))
|
|
23
|
+
return V.get(e);
|
|
24
|
+
const n = new class {
|
|
25
|
+
#t = /* @__PURE__ */ new Map();
|
|
26
|
+
#e = new IntersectionObserver((r) => {
|
|
27
|
+
r.forEach((o) => {
|
|
28
|
+
const s = this.#t.get(o.target);
|
|
29
|
+
s && s(o);
|
|
30
|
+
});
|
|
31
|
+
}, t);
|
|
32
|
+
observe(r, o) {
|
|
33
|
+
return this.#t.set(r, o), this.#e.observe(r), () => {
|
|
34
|
+
this.#t.delete(r), this.#e.unobserve(r);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}();
|
|
38
|
+
return V.set(e, n), n;
|
|
39
|
+
}, at = Object.freeze({
|
|
40
|
+
x: 0,
|
|
41
|
+
y: 0,
|
|
42
|
+
width: 0,
|
|
43
|
+
height: 0,
|
|
44
|
+
top: 0,
|
|
45
|
+
right: 0,
|
|
46
|
+
bottom: 0,
|
|
47
|
+
left: 0
|
|
48
|
+
});
|
|
49
|
+
function Ft(t, { threshold: e = 0, rootMargin: n = "0px", root: r = null }) {
|
|
50
|
+
const [o, s] = d.useState(null);
|
|
51
|
+
return d.useEffect(() => {
|
|
52
|
+
const a = t.current;
|
|
53
|
+
return a ? $t({
|
|
54
|
+
threshold: e,
|
|
55
|
+
rootMargin: n,
|
|
56
|
+
root: r
|
|
57
|
+
}).observe(a, (u) => {
|
|
58
|
+
s({
|
|
59
|
+
isIntersecting: u.isIntersecting,
|
|
60
|
+
boundingClientRect: u.boundingClientRect,
|
|
61
|
+
intersectionRatio: u.intersectionRatio,
|
|
62
|
+
intersectionRect: u.intersectionRect,
|
|
63
|
+
rootBounds: u.rootBounds,
|
|
64
|
+
target: u.target,
|
|
65
|
+
time: u.time
|
|
66
|
+
});
|
|
67
|
+
}) : void 0;
|
|
68
|
+
}, [t, e, n, r]), d.useMemo(() => ({
|
|
69
|
+
isIntersecting: o?.isIntersecting ?? !1,
|
|
70
|
+
boundingClientRect: o?.boundingClientRect ?? at,
|
|
71
|
+
intersectionRatio: o?.intersectionRatio ?? 0,
|
|
72
|
+
intersectionRect: o?.intersectionRect ?? at,
|
|
73
|
+
rootBounds: o?.rootBounds ?? null,
|
|
74
|
+
target: o?.target ?? t.current,
|
|
75
|
+
time: o?.time ?? 0
|
|
76
|
+
}), [o, t]);
|
|
77
|
+
}
|
|
78
|
+
const vt = {
|
|
79
|
+
position: "absolute",
|
|
80
|
+
pointerEvents: "auto",
|
|
81
|
+
boxSizing: "border-box",
|
|
82
|
+
background: "transparent",
|
|
83
|
+
border: "none"
|
|
84
|
+
}, Ot = {
|
|
85
|
+
...vt,
|
|
86
|
+
width: L,
|
|
87
|
+
height: L,
|
|
88
|
+
zIndex: 2
|
|
89
|
+
}, Yt = {
|
|
90
|
+
...vt,
|
|
91
|
+
zIndex: 1
|
|
92
|
+
}, _t = {
|
|
93
|
+
"top-left": {
|
|
94
|
+
top: 0,
|
|
95
|
+
left: 0,
|
|
96
|
+
transform: "translate(-50%, -50%)",
|
|
97
|
+
cursor: "nwse-resize"
|
|
98
|
+
},
|
|
99
|
+
"top-right": {
|
|
100
|
+
top: 0,
|
|
101
|
+
right: 0,
|
|
102
|
+
transform: "translate(50%, -50%)",
|
|
103
|
+
cursor: "nesw-resize"
|
|
104
|
+
},
|
|
105
|
+
"bottom-left": {
|
|
106
|
+
bottom: 0,
|
|
107
|
+
left: 0,
|
|
108
|
+
transform: "translate(-50%, 50%)",
|
|
109
|
+
cursor: "nesw-resize"
|
|
110
|
+
},
|
|
111
|
+
"bottom-right": {
|
|
112
|
+
bottom: 0,
|
|
113
|
+
right: 0,
|
|
114
|
+
transform: "translate(50%, 50%)",
|
|
115
|
+
cursor: "nwse-resize"
|
|
116
|
+
}
|
|
117
|
+
}, Bt = {
|
|
118
|
+
left: {
|
|
119
|
+
top: L,
|
|
120
|
+
bottom: L,
|
|
121
|
+
left: 0,
|
|
122
|
+
width: $,
|
|
123
|
+
transform: "translateX(-50%)",
|
|
124
|
+
cursor: "ew-resize"
|
|
125
|
+
},
|
|
126
|
+
right: {
|
|
127
|
+
top: L,
|
|
128
|
+
bottom: L,
|
|
129
|
+
right: 0,
|
|
130
|
+
width: $,
|
|
131
|
+
transform: "translateX(50%)",
|
|
132
|
+
cursor: "ew-resize"
|
|
133
|
+
},
|
|
134
|
+
top: {
|
|
135
|
+
left: L,
|
|
136
|
+
right: L,
|
|
137
|
+
top: 0,
|
|
138
|
+
height: $,
|
|
139
|
+
transform: "translateY(-50%)",
|
|
140
|
+
cursor: "ns-resize"
|
|
141
|
+
},
|
|
142
|
+
bottom: {
|
|
143
|
+
left: L,
|
|
144
|
+
right: L,
|
|
145
|
+
bottom: 0,
|
|
146
|
+
height: $,
|
|
147
|
+
transform: "translateY(50%)",
|
|
148
|
+
cursor: "ns-resize"
|
|
149
|
+
}
|
|
150
|
+
}, Wt = [
|
|
151
|
+
{ key: "top-left", variant: "corner", horizontal: "left", vertical: "top" },
|
|
152
|
+
{ key: "top-right", variant: "corner", horizontal: "right", vertical: "top" },
|
|
153
|
+
{ key: "bottom-left", variant: "corner", horizontal: "left", vertical: "bottom" },
|
|
154
|
+
{ key: "bottom-right", variant: "corner", horizontal: "right", vertical: "bottom" },
|
|
155
|
+
{ key: "left", variant: "edge", horizontal: "left" },
|
|
156
|
+
{ key: "right", variant: "edge", horizontal: "right" },
|
|
157
|
+
{ key: "top", variant: "edge", vertical: "top" },
|
|
158
|
+
{ key: "bottom", variant: "edge", vertical: "bottom" }
|
|
159
|
+
], Xt = ({ layerId: t, onPointerDown: e }) => /* @__PURE__ */ w(Z, { children: Wt.map((n) => {
|
|
160
|
+
const r = n.variant === "corner" ? Ot : Yt, o = n.variant === "corner" ? _t[n.key] : Bt[n.key], s = { ...r, ...o }, a = n.variant === "corner" ? { "data-resize-corner": n.key } : { "data-resize-edge": n.key };
|
|
161
|
+
return /* @__PURE__ */ w(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
role: "presentation",
|
|
165
|
+
"aria-hidden": "true",
|
|
166
|
+
style: s,
|
|
167
|
+
...a,
|
|
168
|
+
"data-layer-id": t,
|
|
169
|
+
onPointerDown: (l) => e(n, l)
|
|
170
|
+
},
|
|
171
|
+
n.key
|
|
172
|
+
);
|
|
173
|
+
}) }), jt = ({ pivot: t }) => {
|
|
174
|
+
const { Outlet: e } = Nt({
|
|
175
|
+
items: t.items,
|
|
176
|
+
activeId: t.activeId,
|
|
177
|
+
defaultActiveId: t.defaultActiveId,
|
|
178
|
+
onActiveChange: t.onActiveChange,
|
|
179
|
+
transitionMode: t.transitionMode
|
|
180
|
+
});
|
|
181
|
+
return /* @__PURE__ */ w(e, {});
|
|
182
|
+
}, Vt = (t, e) => t.pivot ? /* @__PURE__ */ w(jt, { pivot: t.pivot }) : t.cache ? e(t.id) : t.component, Ct = d.memo(({ layer: t, onClose: e }) => {
|
|
183
|
+
const { getCachedContent: n } = zt(), r = Vt(t, n);
|
|
184
|
+
return t.floating?.chrome ? /* @__PURE__ */ w(Tt, { id: t.id, config: t.floating, onClose: e, children: r }) : r;
|
|
185
|
+
});
|
|
186
|
+
Ct.displayName = "LayerContentRenderer";
|
|
187
|
+
const Rt = d.memo(({ layerId: t, isResizable: e, onPointerDown: n }) => e ? /* @__PURE__ */ w(Xt, { layerId: t, onPointerDown: n }) : null);
|
|
188
|
+
Rt.displayName = "LayerResizeHandles";
|
|
189
|
+
const Kt = (t, e) => t ? "auto" : e ? "visible" : "hidden", Et = d.memo(({ layer: t, handleLayerPointerDown: e }) => {
|
|
190
|
+
const { getLayerRenderState: n } = wt(), { style: r, isResizable: o, isResizing: s, onResizeHandlePointerDown: a } = n(t), l = d.useMemo(() => {
|
|
191
|
+
const f = {};
|
|
192
|
+
return t.gridArea && (f.gridArea = t.gridArea), t.gridRow && (f.gridRow = t.gridRow), t.gridColumn && (f.gridColumn = t.gridColumn), f;
|
|
193
|
+
}, [t.gridArea, t.gridRow, t.gridColumn]), u = d.useMemo(() => {
|
|
194
|
+
const f = !!t.floating, g = Kt(t.scrollable, f), b = {
|
|
195
|
+
...r,
|
|
196
|
+
...l,
|
|
197
|
+
minWidth: 0,
|
|
198
|
+
minHeight: 0,
|
|
199
|
+
overflow: g
|
|
200
|
+
};
|
|
201
|
+
return o ? { ...b, position: "relative" } : b;
|
|
202
|
+
}, [r, l, o, t.scrollable, t.floating]), p = d.useCallback(() => {
|
|
203
|
+
t.floating?.onClose?.();
|
|
204
|
+
}, [t.floating]);
|
|
205
|
+
return /* @__PURE__ */ K(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
"data-layer-id": t.id,
|
|
209
|
+
"data-draggable": !!t.floating?.draggable,
|
|
210
|
+
"data-resizable": o,
|
|
211
|
+
"data-resizing": s,
|
|
212
|
+
style: u,
|
|
213
|
+
onPointerDown: e,
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ w(Mt, { layerId: t.id, children: /* @__PURE__ */ w(Ct, { layer: t, onClose: p }) }),
|
|
216
|
+
/* @__PURE__ */ w(Rt, { layerId: t.id, isResizable: o, onPointerDown: a })
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
Et.displayName = "EmbeddedLayer";
|
|
222
|
+
const Ut = ({ layers: t }) => {
|
|
223
|
+
const { handleLayerPointerDown: e } = wt();
|
|
224
|
+
return /* @__PURE__ */ w(Z, { children: t.map((n) => {
|
|
225
|
+
const r = n.floating?.mode ?? "embedded";
|
|
226
|
+
return n.floating && r === "popup" ? /* @__PURE__ */ w(Pt, { layer: n }, n.id) : /* @__PURE__ */ w(Et, { layer: n, handleLayerPointerDown: e }, n.id);
|
|
227
|
+
}) });
|
|
228
|
+
}, ct = {
|
|
229
|
+
position: "absolute",
|
|
230
|
+
pointerEvents: "auto"
|
|
231
|
+
}, lt = ({
|
|
232
|
+
direction: t,
|
|
233
|
+
trackIndex: e,
|
|
234
|
+
align: n,
|
|
235
|
+
gap: r,
|
|
236
|
+
span: o,
|
|
237
|
+
onResize: s
|
|
238
|
+
}) => {
|
|
239
|
+
const a = t === "col" ? "vertical" : "horizontal", l = d.useCallback(
|
|
240
|
+
(f) => {
|
|
241
|
+
const g = n === "start" ? -f : f;
|
|
242
|
+
s(t, e, g);
|
|
243
|
+
},
|
|
244
|
+
[n, t, e, s]
|
|
245
|
+
), u = d.useMemo(() => t === "col" ? {
|
|
246
|
+
gridColumn: `${e + 1} / ${e + 2}`,
|
|
247
|
+
gridRow: `${o.start} / ${o.end}`
|
|
248
|
+
} : {
|
|
249
|
+
gridRow: `${e + 1} / ${e + 2}`,
|
|
250
|
+
gridColumn: `${o.start} / ${o.end}`
|
|
251
|
+
}, [t, e, o]), p = d.useMemo(() => {
|
|
252
|
+
const g = Math.max(0, r) / 2 + j / 2;
|
|
253
|
+
return t === "col" ? {
|
|
254
|
+
...ct,
|
|
255
|
+
width: j,
|
|
256
|
+
height: "100%",
|
|
257
|
+
top: 0,
|
|
258
|
+
bottom: 0,
|
|
259
|
+
...n === "start" ? { left: -g } : { right: -g }
|
|
260
|
+
} : {
|
|
261
|
+
...ct,
|
|
262
|
+
width: "100%",
|
|
263
|
+
height: j,
|
|
264
|
+
left: 0,
|
|
265
|
+
right: 0,
|
|
266
|
+
...n === "start" ? { top: -g } : { bottom: -g }
|
|
267
|
+
};
|
|
268
|
+
}, [n, t, r]);
|
|
269
|
+
return /* @__PURE__ */ w("div", { "data-resizable": "true", style: { ...u, position: "relative", pointerEvents: "none" }, children: /* @__PURE__ */ w("div", { "data-direction": a, "data-align": n, "data-handle": "true", style: p, children: /* @__PURE__ */ w(Dt, { direction: a, onResize: l }) }) });
|
|
270
|
+
}, Zt = (t) => {
|
|
271
|
+
const e = /* @__PURE__ */ new Map();
|
|
272
|
+
t.forEach((r, o) => {
|
|
273
|
+
r.forEach((s, a) => {
|
|
274
|
+
if (!s || s === ".")
|
|
275
|
+
return;
|
|
276
|
+
const l = e.get(s);
|
|
277
|
+
if (l) {
|
|
278
|
+
const p = {
|
|
279
|
+
rowStart: Math.min(l.rowStart, o),
|
|
280
|
+
rowEnd: Math.max(l.rowEnd, o),
|
|
281
|
+
colStart: Math.min(l.colStart, a),
|
|
282
|
+
colEnd: Math.max(l.colEnd, a)
|
|
283
|
+
};
|
|
284
|
+
e.set(s, p);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const u = {
|
|
288
|
+
rowStart: o,
|
|
289
|
+
rowEnd: o,
|
|
290
|
+
colStart: a,
|
|
291
|
+
colEnd: a
|
|
292
|
+
};
|
|
293
|
+
e.set(s, u);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
const n = /* @__PURE__ */ new Map();
|
|
297
|
+
return e.forEach((r, o) => {
|
|
298
|
+
const s = r.rowStart + 1, a = r.rowEnd + 2, l = r.colStart + 1, u = r.colEnd + 2, p = {
|
|
299
|
+
gridArea: o,
|
|
300
|
+
gridRow: `${s} / ${a}`,
|
|
301
|
+
gridColumn: `${l} / ${u}`
|
|
302
|
+
};
|
|
303
|
+
n.set(o, p);
|
|
304
|
+
}), n;
|
|
305
|
+
}, qt = (t, e) => {
|
|
306
|
+
if ((t.positionMode ?? "grid") !== "grid")
|
|
307
|
+
return t;
|
|
308
|
+
const r = t.gridArea ?? t.id, o = e.get(r);
|
|
309
|
+
if (!o)
|
|
310
|
+
return t;
|
|
311
|
+
const s = !t.gridArea, a = !t.gridRow, l = !t.gridColumn;
|
|
312
|
+
return !s && !a && !l ? t : {
|
|
313
|
+
...t,
|
|
314
|
+
gridArea: s ? o.gridArea : t.gridArea,
|
|
315
|
+
gridRow: a ? o.gridRow : t.gridRow,
|
|
316
|
+
gridColumn: l ? o.gridColumn : t.gridColumn
|
|
317
|
+
};
|
|
318
|
+
}, Jt = (t, e) => {
|
|
319
|
+
const n = d.useMemo(() => Zt(t.areas), [t.areas]), r = d.useMemo(() => e.map((l) => qt(l, n)), [e, n]), o = d.useMemo(
|
|
320
|
+
() => r.filter((l) => l.visible !== !1),
|
|
321
|
+
[r]
|
|
322
|
+
), s = d.useMemo(
|
|
323
|
+
() => o.filter((l) => !l.drawer),
|
|
324
|
+
[o]
|
|
325
|
+
), a = d.useMemo(() => {
|
|
326
|
+
const l = /* @__PURE__ */ new Map();
|
|
327
|
+
return r.forEach((u) => {
|
|
328
|
+
l.set(u.id, u);
|
|
329
|
+
}), l;
|
|
330
|
+
}, [r]);
|
|
331
|
+
return {
|
|
332
|
+
normalizedLayers: r,
|
|
333
|
+
visibleLayers: o,
|
|
334
|
+
regularLayers: s,
|
|
335
|
+
layerById: a
|
|
336
|
+
};
|
|
337
|
+
}, Qt = (t) => {
|
|
338
|
+
if (!t)
|
|
339
|
+
return { rowGap: 0, columnGap: 0 };
|
|
340
|
+
const e = t.split(/\s+/).map((r) => r.trim()).filter(Boolean), n = (r) => {
|
|
341
|
+
const o = r.match(/^(-?\d+(?:\.\d+)?)px$/);
|
|
342
|
+
return o ? Number.parseFloat(o[1]) : 0;
|
|
343
|
+
};
|
|
344
|
+
if (e.length === 1) {
|
|
345
|
+
const r = n(e[0]);
|
|
346
|
+
return { rowGap: r, columnGap: r };
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
rowGap: n(e[0]),
|
|
350
|
+
columnGap: n(e[1])
|
|
351
|
+
};
|
|
352
|
+
}, te = (t, e) => {
|
|
353
|
+
if (!t)
|
|
354
|
+
return [];
|
|
355
|
+
const n = getComputedStyle(t);
|
|
356
|
+
return (e === "col" ? n.gridTemplateColumns : n.gridTemplateRows).split(/\s+/).map((o) => parseFloat(o)).filter((o) => !Number.isNaN(o));
|
|
357
|
+
}, yt = (t, e = Number.NEGATIVE_INFINITY, n = Number.POSITIVE_INFINITY) => Math.min(Math.max(t, e), n), je = (t, e) => typeof t != "number" || !Number.isFinite(t) ? e : t, _ = (t, e) => `${t}-${e}`, ee = (t, e, n, r) => {
|
|
358
|
+
const o = _(n, r), s = e[o];
|
|
359
|
+
return s !== void 0 ? `minmax(${t.minSize ?? 0}px, ${s}px)` : t.size;
|
|
360
|
+
}, ut = (t, e, n) => t.map((r, o) => ee(r, e, n, o)).join(" "), F = (t, e) => t.reduce((n, r, o) => (r.resizable && r.size.endsWith("px") && (n[_(e, o)] = parseInt(r.size, 10)), n), {}), ne = ({
|
|
361
|
+
trackSizes: t,
|
|
362
|
+
track: e,
|
|
363
|
+
direction: n,
|
|
364
|
+
trackIndex: r,
|
|
365
|
+
containerRef: o
|
|
366
|
+
}) => {
|
|
367
|
+
const s = _(n, r), a = t[s];
|
|
368
|
+
if (a !== void 0)
|
|
369
|
+
return a;
|
|
370
|
+
const u = te(o?.current ?? null, n)[r];
|
|
371
|
+
return u !== void 0 && u > 0 ? u : e.size.endsWith("px") ? Number.parseInt(e.size, 10) : 300;
|
|
372
|
+
}, re = (t, e) => t.reduce((n, r, o) => o === e ? n : r.size.includes("fr") ? n + 100 : n + (r.minSize ?? 50), 0), oe = ({
|
|
373
|
+
track: t,
|
|
374
|
+
tracks: e,
|
|
375
|
+
trackIndex: n,
|
|
376
|
+
direction: r,
|
|
377
|
+
containerRef: o,
|
|
378
|
+
gapSizes: s
|
|
379
|
+
}) => {
|
|
380
|
+
if (!o?.current)
|
|
381
|
+
return t.maxSize;
|
|
382
|
+
const a = r === "col" ? o.current.offsetWidth : o.current.offsetHeight, l = re(e, n), u = e.length - 1, p = r === "col" ? s.columnGap : s.rowGap, f = u * p, g = a - l - f;
|
|
383
|
+
return t.maxSize !== void 0 ? Math.min(t.maxSize, g) : g;
|
|
384
|
+
}, se = (t, e, n) => yt(t, e ?? Number.NEGATIVE_INFINITY, n ?? Number.POSITIVE_INFINITY), dt = (t, e) => {
|
|
385
|
+
const n = t.length, r = [];
|
|
386
|
+
for (let a = 0; a < n; a++) {
|
|
387
|
+
const l = t[a], u = l[e], p = l[e + 1];
|
|
388
|
+
u !== p && r.push(a);
|
|
389
|
+
}
|
|
390
|
+
if (r.length === 0)
|
|
391
|
+
return { start: 1, end: n + 1 };
|
|
392
|
+
const o = Math.min(...r), s = Math.max(...r);
|
|
393
|
+
return { start: o + 1, end: s + 2 };
|
|
394
|
+
}, gt = (t, e) => {
|
|
395
|
+
const n = t[e], r = t[e + 1], o = n?.length ?? 0, s = [];
|
|
396
|
+
for (let u = 0; u < o; u++) {
|
|
397
|
+
const p = n?.[u], f = r?.[u];
|
|
398
|
+
p !== f && s.push(u);
|
|
399
|
+
}
|
|
400
|
+
if (s.length === 0)
|
|
401
|
+
return { start: 1, end: o + 1 };
|
|
402
|
+
const a = Math.min(...s), l = Math.max(...s);
|
|
403
|
+
return { start: a + 1, end: l + 2 };
|
|
404
|
+
}, ie = (t, e) => {
|
|
405
|
+
if (t.length === 0)
|
|
406
|
+
return [];
|
|
407
|
+
const n = e.length;
|
|
408
|
+
if (t.length === 1)
|
|
409
|
+
return t[0]?.resizable ? [{ trackIndex: 0, align: "end", span: { start: 1, end: n + 1 } }] : [];
|
|
410
|
+
const r = [];
|
|
411
|
+
return Array.from({ length: t.length - 1 }, (s, a) => a).forEach((s) => {
|
|
412
|
+
const a = t[s];
|
|
413
|
+
if (t[s + 1]?.resizable) {
|
|
414
|
+
const u = dt(e, s);
|
|
415
|
+
r.push({ trackIndex: s + 1, align: "start", span: u });
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
if (a?.resizable) {
|
|
419
|
+
const u = dt(e, s);
|
|
420
|
+
r.push({ trackIndex: s, align: "end", span: u });
|
|
421
|
+
}
|
|
422
|
+
}), r;
|
|
423
|
+
}, ae = (t, e) => {
|
|
424
|
+
if (t.length === 0)
|
|
425
|
+
return [];
|
|
426
|
+
const n = e[0]?.length ?? 0;
|
|
427
|
+
if (t.length === 1)
|
|
428
|
+
return t[0]?.resizable ? [{ trackIndex: 0, align: "end", span: { start: 1, end: n + 1 } }] : [];
|
|
429
|
+
const r = [];
|
|
430
|
+
return Array.from({ length: t.length - 1 }, (s, a) => a).forEach((s) => {
|
|
431
|
+
const a = t[s];
|
|
432
|
+
if (t[s + 1]?.resizable) {
|
|
433
|
+
const u = gt(e, s);
|
|
434
|
+
r.push({ trackIndex: s + 1, align: "start", span: u });
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
if (a?.resizable) {
|
|
438
|
+
const u = gt(e, s);
|
|
439
|
+
r.push({ trackIndex: s, align: "end", span: u });
|
|
440
|
+
}
|
|
441
|
+
}), r;
|
|
442
|
+
}, ce = (t) => t !== void 0 ? { gap: t } : {}, le = (t, e) => {
|
|
443
|
+
const n = Object.keys(e), r = {};
|
|
444
|
+
for (const f of n)
|
|
445
|
+
r[f] = t[f] ?? e[f];
|
|
446
|
+
const o = Object.keys(t), s = o.length !== n.length, a = o.some(
|
|
447
|
+
(f) => !Object.prototype.hasOwnProperty.call(r, f)
|
|
448
|
+
), l = s ? !0 : a, u = n.some((f) => t[f] !== r[f]);
|
|
449
|
+
return (l ? !0 : u) ? r : null;
|
|
450
|
+
}, ue = (t, e, n) => {
|
|
451
|
+
const [r, o] = d.useState(() => ({
|
|
452
|
+
...F(t.columns, "col"),
|
|
453
|
+
...F(t.rows, "row")
|
|
454
|
+
}));
|
|
455
|
+
St(() => {
|
|
456
|
+
const g = {
|
|
457
|
+
...F(t.columns, "col"),
|
|
458
|
+
...F(t.rows, "row")
|
|
459
|
+
};
|
|
460
|
+
o((b) => le(b, g) ?? b);
|
|
461
|
+
}, [t.columns, t.rows]);
|
|
462
|
+
const s = d.useMemo(() => t.areas.map((g) => `"${g.join(" ")}"`).join(" "), [t.areas]), a = d.useMemo(() => Qt(t.gap), [t.gap]), l = d.useMemo(
|
|
463
|
+
() => ie(t.columns, t.areas),
|
|
464
|
+
[t.columns, t.areas]
|
|
465
|
+
), u = d.useMemo(
|
|
466
|
+
() => ae(t.rows, t.areas),
|
|
467
|
+
[t.rows, t.areas]
|
|
468
|
+
), p = d.useMemo(() => ({
|
|
469
|
+
...t.style,
|
|
470
|
+
...e,
|
|
471
|
+
gridTemplateAreas: s,
|
|
472
|
+
gridTemplateRows: ut(t.rows, r, "row"),
|
|
473
|
+
gridTemplateColumns: ut(t.columns, r, "col"),
|
|
474
|
+
...ce(t.gap)
|
|
475
|
+
}), [s, t.columns, t.gap, t.rows, t.style, e, r]), f = d.useCallback(
|
|
476
|
+
(g, b, v) => {
|
|
477
|
+
const E = g === "row" ? t.rows : t.columns, R = E[b];
|
|
478
|
+
if (!R || !R.resizable)
|
|
479
|
+
return;
|
|
480
|
+
const M = ne({
|
|
481
|
+
trackSizes: r,
|
|
482
|
+
track: R,
|
|
483
|
+
direction: g,
|
|
484
|
+
trackIndex: b,
|
|
485
|
+
containerRef: n
|
|
486
|
+
}), P = oe({
|
|
487
|
+
track: R,
|
|
488
|
+
tracks: E,
|
|
489
|
+
trackIndex: b,
|
|
490
|
+
direction: g,
|
|
491
|
+
containerRef: n,
|
|
492
|
+
gapSizes: a
|
|
493
|
+
}), x = _(g, b);
|
|
494
|
+
o((D) => {
|
|
495
|
+
const y = M + v, I = se(y, R.minSize, P);
|
|
496
|
+
return { ...D, [x]: I };
|
|
497
|
+
});
|
|
498
|
+
},
|
|
499
|
+
[t.columns, t.rows, r, n, a]
|
|
500
|
+
);
|
|
501
|
+
return {
|
|
502
|
+
columnHandles: l,
|
|
503
|
+
rowHandles: u,
|
|
504
|
+
gapSizes: a,
|
|
505
|
+
gridStyle: p,
|
|
506
|
+
handleResize: f
|
|
507
|
+
};
|
|
508
|
+
}, de = (t) => t.positionMode ? t.positionMode : t.floating ? (t.floating.mode ?? "embedded") === "embedded" ? "absolute" : "relative" : "grid", ge = (t) => ({ position: t === "grid" ? "relative" : t }), he = (t, e) => e !== "grid" ? {} : {
|
|
509
|
+
gridArea: t.gridArea,
|
|
510
|
+
gridRow: t.gridRow,
|
|
511
|
+
gridColumn: t.gridColumn
|
|
512
|
+
}, fe = (t) => t ? {
|
|
513
|
+
top: t.top,
|
|
514
|
+
right: t.right,
|
|
515
|
+
bottom: t.bottom,
|
|
516
|
+
left: t.left
|
|
517
|
+
} : {}, me = (t) => t !== void 0 ? { zIndex: t } : {}, pe = (t, e) => ({
|
|
518
|
+
width: t,
|
|
519
|
+
height: e
|
|
520
|
+
}), be = (t, e) => t.pointerEvents !== void 0 ? typeof t.pointerEvents == "boolean" ? { pointerEvents: t.pointerEvents ? "auto" : "none" } : { pointerEvents: t.pointerEvents } : e === "absolute" || e === "fixed" ? { pointerEvents: "auto" } : {}, ze = (t) => t.floating ? t.floating.position ?? t.floating.defaultPosition ?? t.position : t.position, we = (t) => {
|
|
521
|
+
if (t.floating) {
|
|
522
|
+
const e = t.floating.size ?? t.floating.defaultSize;
|
|
523
|
+
if (e)
|
|
524
|
+
return {
|
|
525
|
+
width: e.width,
|
|
526
|
+
height: e.height
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
return {
|
|
530
|
+
width: t.width,
|
|
531
|
+
height: t.height
|
|
532
|
+
};
|
|
533
|
+
}, Se = (t) => t.floating?.zIndex !== void 0 ? t.floating.zIndex : t.zIndex, ve = (t) => {
|
|
534
|
+
const e = de(t), n = ze(t), r = we(t), o = Se(t);
|
|
535
|
+
return {
|
|
536
|
+
...t.style,
|
|
537
|
+
...ge(e),
|
|
538
|
+
...he(t, e),
|
|
539
|
+
...fe(n),
|
|
540
|
+
...me(o),
|
|
541
|
+
...pe(r.width, r.height),
|
|
542
|
+
...be(t, e)
|
|
543
|
+
};
|
|
544
|
+
}, Ce = (t) => {
|
|
545
|
+
const e = t.floating;
|
|
546
|
+
return e ? e.mode ?? "embedded" : null;
|
|
547
|
+
}, H = (t) => Ce(t) !== "embedded" ? null : t.floating ?? null, ht = (t) => t instanceof HTMLElement ? ["INPUT", "TEXTAREA", "SELECT", "BUTTON"].includes(t.tagName) : !1, ft = (t, e, n) => {
|
|
548
|
+
const r = e ?? Number.NEGATIVE_INFINITY, o = n ?? Number.POSITIVE_INFINITY;
|
|
549
|
+
return yt(t, r, o);
|
|
550
|
+
}, mt = (t, e, n) => {
|
|
551
|
+
if (typeof t == "number" && Number.isFinite(t))
|
|
552
|
+
return t;
|
|
553
|
+
throw new Error(
|
|
554
|
+
`Floating layer "${n}" must provide a numeric "${e}" value when draggable mode is enabled.`
|
|
555
|
+
);
|
|
556
|
+
}, pt = (t) => {
|
|
557
|
+
const e = H(t);
|
|
558
|
+
if (!e)
|
|
559
|
+
throw new Error(`Floating layer "${t.id}" is missing floating configuration required for dragging.`);
|
|
560
|
+
const n = e.position ?? e.defaultPosition ?? t.position;
|
|
561
|
+
if (!n)
|
|
562
|
+
throw new Error(`Floating layer "${t.id}" must define position with left and top values.`);
|
|
563
|
+
return {
|
|
564
|
+
left: mt(n.left, "left", t.id),
|
|
565
|
+
top: mt(n.top, "top", t.id)
|
|
566
|
+
};
|
|
567
|
+
}, Re = (t) => {
|
|
568
|
+
const e = H(t);
|
|
569
|
+
return e ? e.constraints ?? {} : {};
|
|
570
|
+
}, Ee = (t, e, n) => t ? t === "left" ? e - n : e + n : e, ye = (t, e, n) => t ? t === "top" ? e - n : e + n : e, Ie = (t, e, n) => !t || t === "right" ? e : e + n, Le = (t, e, n) => !t || t === "bottom" ? e : e + n, U = (t, e) => t ? t.dataset.layerId === e ? t : U(t.parentElement, e) : null, q = (t, e, n) => !t || n?.(t) ? null : e(t) ? t : q(t.parentElement, e, n), Te = (t) => t instanceof HTMLElement ? q(
|
|
571
|
+
t,
|
|
572
|
+
(e) => e.dataset.dragHandle === "true",
|
|
573
|
+
(e) => e.dataset.dragIgnore === "true"
|
|
574
|
+
) : null, bt = (t) => t instanceof HTMLElement ? q(
|
|
575
|
+
t,
|
|
576
|
+
(e) => e.dataset.resizeCorner !== void 0 || e.dataset.resizeEdge !== void 0
|
|
577
|
+
) !== null : !1, O = (t) => {
|
|
578
|
+
const e = H(t);
|
|
579
|
+
return e ? e.resizable === !0 : !1;
|
|
580
|
+
}, Y = (t) => {
|
|
581
|
+
if (!H(t))
|
|
582
|
+
return null;
|
|
583
|
+
const n = xe(t);
|
|
584
|
+
if (!n)
|
|
585
|
+
throw new Error(`Floating layer "${t.id}" must define width and height when resizable or draggable.`);
|
|
586
|
+
return {
|
|
587
|
+
width: n.width,
|
|
588
|
+
height: n.height
|
|
589
|
+
};
|
|
590
|
+
}, Me = (t, e, n) => {
|
|
591
|
+
const r = t.filter(O).reduce((g, b) => {
|
|
592
|
+
if (n === b.id) {
|
|
593
|
+
const E = e[b.id];
|
|
594
|
+
if (E)
|
|
595
|
+
return g[b.id] = E, g;
|
|
596
|
+
}
|
|
597
|
+
const v = Y(b);
|
|
598
|
+
return v && (g[b.id] = v), g;
|
|
599
|
+
}, {}), o = Object.keys(e), s = Object.keys(r), a = o.length !== s.length, l = o.some((g) => !Object.prototype.hasOwnProperty.call(r, g)), u = a ? !0 : l, p = s.some((g) => {
|
|
600
|
+
const b = e[g], v = r[g];
|
|
601
|
+
return !b || !v ? !0 : b.width !== v.width || b.height !== v.height;
|
|
602
|
+
});
|
|
603
|
+
return {
|
|
604
|
+
sizes: r,
|
|
605
|
+
changed: u ? !0 : p
|
|
606
|
+
};
|
|
607
|
+
}, Pe = ({
|
|
608
|
+
layers: t,
|
|
609
|
+
layerById: e,
|
|
610
|
+
isRootLevel: n
|
|
611
|
+
}) => {
|
|
612
|
+
const [r, o] = d.useState(null), [s, a] = d.useState(null), [l, u] = d.useState({}), [p, f] = d.useState({}), g = d.useRef(null), b = d.useRef(null), v = st((c, i) => {
|
|
613
|
+
e.get(c)?.floating?.onMove?.(i);
|
|
614
|
+
}), E = st((c, i) => {
|
|
615
|
+
e.get(c)?.floating?.onResize?.(i);
|
|
616
|
+
});
|
|
617
|
+
St(() => {
|
|
618
|
+
const { sizes: c, changed: i } = Me(t, p, s);
|
|
619
|
+
i && f(c);
|
|
620
|
+
}, [t, s]);
|
|
621
|
+
const R = d.useCallback(
|
|
622
|
+
(c, i, h, m) => {
|
|
623
|
+
const z = pt(i), C = l[c] ?? { x: 0, y: 0 }, S = {
|
|
624
|
+
pointerStartX: m.clientX,
|
|
625
|
+
pointerStartY: m.clientY,
|
|
626
|
+
initialTranslationX: C.x,
|
|
627
|
+
initialTranslationY: C.y,
|
|
628
|
+
baseLeft: z.left,
|
|
629
|
+
baseTop: z.top,
|
|
630
|
+
layerId: c,
|
|
631
|
+
pointerId: m.pointerId,
|
|
632
|
+
target: h
|
|
633
|
+
};
|
|
634
|
+
if (S.target.setPointerCapture)
|
|
635
|
+
try {
|
|
636
|
+
S.target.setPointerCapture(S.pointerId);
|
|
637
|
+
} catch {
|
|
638
|
+
}
|
|
639
|
+
g.current = S, o(c);
|
|
640
|
+
},
|
|
641
|
+
[l]
|
|
642
|
+
), M = d.useCallback(
|
|
643
|
+
(c) => {
|
|
644
|
+
const i = c.target, h = Te(i);
|
|
645
|
+
if (!h)
|
|
646
|
+
return;
|
|
647
|
+
const m = h.closest("[data-layer-id]")?.getAttribute("data-layer-id");
|
|
648
|
+
if (!m)
|
|
649
|
+
return;
|
|
650
|
+
const z = e.get(m);
|
|
651
|
+
if (!z)
|
|
652
|
+
return;
|
|
653
|
+
const C = H(z);
|
|
654
|
+
if (!(!C || C.draggable !== !0) && !ht(c.target) && !bt(c.target) && h) {
|
|
655
|
+
const S = U(h, m);
|
|
656
|
+
if (!S)
|
|
657
|
+
return;
|
|
658
|
+
R(m, z, S, c);
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
[R, e]
|
|
663
|
+
), P = d.useCallback(
|
|
664
|
+
(c, i) => {
|
|
665
|
+
const h = e.get(c), m = h ? H(h) : null;
|
|
666
|
+
if (!h || !m || m.draggable !== !0 || ht(i.target) || bt(i.target))
|
|
667
|
+
return;
|
|
668
|
+
const z = U(i.currentTarget, c);
|
|
669
|
+
z && R(c, h, z, i);
|
|
670
|
+
},
|
|
671
|
+
[R, e]
|
|
672
|
+
), x = d.useCallback(
|
|
673
|
+
(c, i, h) => {
|
|
674
|
+
const m = e.get(c);
|
|
675
|
+
if (!m || !O(m))
|
|
676
|
+
return;
|
|
677
|
+
const z = p[c] ?? Y(m);
|
|
678
|
+
if (!z)
|
|
679
|
+
return;
|
|
680
|
+
const C = pt(m), S = Re(m), T = l[c] ?? { x: 0, y: 0 };
|
|
681
|
+
if (h.stopPropagation(), h.preventDefault(), h.currentTarget.setPointerCapture)
|
|
682
|
+
try {
|
|
683
|
+
h.currentTarget.setPointerCapture(h.pointerId);
|
|
684
|
+
} catch {
|
|
685
|
+
}
|
|
686
|
+
b.current = {
|
|
687
|
+
layerId: c,
|
|
688
|
+
pointerId: h.pointerId,
|
|
689
|
+
horizontalEdge: i.horizontal,
|
|
690
|
+
verticalEdge: i.vertical,
|
|
691
|
+
startX: h.clientX,
|
|
692
|
+
startY: h.clientY,
|
|
693
|
+
startWidth: z.width,
|
|
694
|
+
startHeight: z.height,
|
|
695
|
+
startPosition: T,
|
|
696
|
+
baseLeft: C.left,
|
|
697
|
+
baseTop: C.top,
|
|
698
|
+
minWidth: S.minWidth,
|
|
699
|
+
maxWidth: S.maxWidth,
|
|
700
|
+
minHeight: S.minHeight,
|
|
701
|
+
maxHeight: S.maxHeight,
|
|
702
|
+
target: h.currentTarget
|
|
703
|
+
}, a(c);
|
|
704
|
+
},
|
|
705
|
+
[e, l, p]
|
|
706
|
+
), D = d.useCallback(
|
|
707
|
+
(c) => {
|
|
708
|
+
const i = g.current;
|
|
709
|
+
if (!i)
|
|
710
|
+
return;
|
|
711
|
+
const h = c.clientX - i.pointerStartX, m = c.clientY - i.pointerStartY, z = {
|
|
712
|
+
x: i.initialTranslationX + h,
|
|
713
|
+
y: i.initialTranslationY + m
|
|
714
|
+
};
|
|
715
|
+
u((C) => ({ ...C, [i.layerId]: z })), v(i.layerId, {
|
|
716
|
+
left: i.baseLeft + z.x,
|
|
717
|
+
top: i.baseTop + z.y
|
|
718
|
+
});
|
|
719
|
+
},
|
|
720
|
+
[v]
|
|
721
|
+
), y = d.useCallback(
|
|
722
|
+
(c) => {
|
|
723
|
+
const i = b.current;
|
|
724
|
+
if (!i || i.pointerId !== c.pointerId || !e.get(i.layerId))
|
|
725
|
+
return;
|
|
726
|
+
const m = c.clientX - i.startX, z = c.clientY - i.startY, C = Ee(i.horizontalEdge, i.startWidth, m), S = ye(i.verticalEdge, i.startHeight, z), T = ft(C, i.minWidth, i.maxWidth), k = ft(S, i.minHeight, i.maxHeight), G = i.startWidth - T, B = i.startHeight - k, nt = Ie(
|
|
727
|
+
i.horizontalEdge,
|
|
728
|
+
i.startPosition.x,
|
|
729
|
+
G
|
|
730
|
+
), Lt = Le(i.verticalEdge, i.startPosition.y, B), W = p[i.layerId], rt = { width: T, height: k };
|
|
731
|
+
(!W || W.width !== T || W.height !== k) && (f((X) => ({
|
|
732
|
+
...X,
|
|
733
|
+
[i.layerId]: rt
|
|
734
|
+
})), E(i.layerId, rt));
|
|
735
|
+
const ot = l[i.layerId] ?? { x: 0, y: 0 }, A = { x: nt, y: Lt };
|
|
736
|
+
(ot.x !== A.x || ot.y !== A.y) && (u((X) => ({
|
|
737
|
+
...X,
|
|
738
|
+
[i.layerId]: A
|
|
739
|
+
})), v(i.layerId, {
|
|
740
|
+
left: i.baseLeft + A.x,
|
|
741
|
+
top: i.baseTop + A.y
|
|
742
|
+
}));
|
|
743
|
+
},
|
|
744
|
+
[e, l, p, v, E]
|
|
745
|
+
), I = d.useCallback((c) => {
|
|
746
|
+
const i = g.current;
|
|
747
|
+
if (i) {
|
|
748
|
+
if (i.pointerId === c.pointerId && i.target.releasePointerCapture)
|
|
749
|
+
try {
|
|
750
|
+
i.target.releasePointerCapture(i.pointerId);
|
|
751
|
+
} catch {
|
|
752
|
+
}
|
|
753
|
+
g.current = null;
|
|
754
|
+
}
|
|
755
|
+
o(null);
|
|
756
|
+
}, []), N = d.useCallback((c) => {
|
|
757
|
+
const i = b.current;
|
|
758
|
+
if (i) {
|
|
759
|
+
if (i.pointerId === c.pointerId && i.target.releasePointerCapture)
|
|
760
|
+
try {
|
|
761
|
+
i.target.releasePointerCapture(i.pointerId);
|
|
762
|
+
} catch {
|
|
763
|
+
}
|
|
764
|
+
b.current = null;
|
|
765
|
+
}
|
|
766
|
+
a(null);
|
|
767
|
+
}, []);
|
|
768
|
+
it(r !== null, {
|
|
769
|
+
onMove: D,
|
|
770
|
+
onUp: I,
|
|
771
|
+
onCancel: I
|
|
772
|
+
}), it(s !== null, {
|
|
773
|
+
onMove: y,
|
|
774
|
+
onUp: N,
|
|
775
|
+
onCancel: N
|
|
776
|
+
});
|
|
777
|
+
const J = d.useCallback(
|
|
778
|
+
(c) => {
|
|
779
|
+
const i = ve(c), h = H(c);
|
|
780
|
+
if (!h || h.draggable !== !0)
|
|
781
|
+
return i;
|
|
782
|
+
const m = l[c.id], z = r === c.id, C = s === c.id, S = m ? { transform: `translate(${m.x}px, ${m.y}px)` } : {}, T = p[c.id], k = O(c) ? Y(c) : null, G = T ?? k, B = G ? { width: `${G.width}px`, height: `${G.height}px` } : {};
|
|
783
|
+
return {
|
|
784
|
+
...i,
|
|
785
|
+
...B,
|
|
786
|
+
...S,
|
|
787
|
+
...z || C ? { cursor: "grabbing" } : {}
|
|
788
|
+
};
|
|
789
|
+
},
|
|
790
|
+
[r, l, p, s]
|
|
791
|
+
), Q = d.useCallback(
|
|
792
|
+
(c) => {
|
|
793
|
+
if (!O(c))
|
|
794
|
+
return { isResizable: !1 };
|
|
795
|
+
const h = p[c.id], m = Y(c);
|
|
796
|
+
return (h ?? m) !== null ? { isResizable: !0, onPointerDown: (T, k) => {
|
|
797
|
+
x(c.id, T, k);
|
|
798
|
+
} } : { isResizable: !1 };
|
|
799
|
+
},
|
|
800
|
+
[x, p]
|
|
801
|
+
), tt = d.useCallback(
|
|
802
|
+
(c) => {
|
|
803
|
+
const { isResizable: i, onPointerDown: h } = Q(c), m = J(c), z = s === c.id;
|
|
804
|
+
return {
|
|
805
|
+
style: m,
|
|
806
|
+
isResizable: i,
|
|
807
|
+
isResizing: z,
|
|
808
|
+
onResizeHandlePointerDown: (C, S) => {
|
|
809
|
+
h && h(C, S);
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
},
|
|
813
|
+
[J, Q, s]
|
|
814
|
+
), et = d.useCallback(
|
|
815
|
+
(c) => ({
|
|
816
|
+
"data-drag-handle": "true",
|
|
817
|
+
role: "button",
|
|
818
|
+
"aria-roledescription": "Drag handle",
|
|
819
|
+
"aria-label": "Drag layer",
|
|
820
|
+
onPointerDown: (i) => {
|
|
821
|
+
P(c, i);
|
|
822
|
+
}
|
|
823
|
+
}),
|
|
824
|
+
[P]
|
|
825
|
+
);
|
|
826
|
+
return {
|
|
827
|
+
providerValue: d.useMemo(
|
|
828
|
+
() => ({
|
|
829
|
+
handleLayerPointerDown: M,
|
|
830
|
+
getLayerRenderState: tt,
|
|
831
|
+
getLayerHandleProps: et,
|
|
832
|
+
isRootLevel: n
|
|
833
|
+
}),
|
|
834
|
+
[et, tt, M, n]
|
|
835
|
+
),
|
|
836
|
+
draggingLayerId: r,
|
|
837
|
+
resizingLayerId: s
|
|
838
|
+
};
|
|
839
|
+
}, xe = (t) => {
|
|
840
|
+
if (t.floating) {
|
|
841
|
+
const e = t.floating.size ?? t.floating.defaultSize;
|
|
842
|
+
if (e)
|
|
843
|
+
return { width: e.width, height: e.height };
|
|
844
|
+
}
|
|
845
|
+
if (typeof t.width == "number" && typeof t.height == "number")
|
|
846
|
+
return { width: t.width, height: t.height };
|
|
847
|
+
}, It = {
|
|
848
|
+
display: "grid",
|
|
849
|
+
width: "100%",
|
|
850
|
+
height: "100%",
|
|
851
|
+
overflow: "hidden"
|
|
852
|
+
}, ke = {
|
|
853
|
+
touchAction: "none",
|
|
854
|
+
WebkitTouchCallout: "none",
|
|
855
|
+
WebkitUserSelect: "none",
|
|
856
|
+
userSelect: "none"
|
|
857
|
+
}, He = {
|
|
858
|
+
...It,
|
|
859
|
+
overflow: "visible",
|
|
860
|
+
height: "auto",
|
|
861
|
+
minHeight: "100%"
|
|
862
|
+
}, Ne = (t) => t ? He : It, Ve = ({ config: t, layers: e, style: n, root: r = !1 }) => {
|
|
863
|
+
const o = d.useRef(null), { isIntersecting: s } = Ft(o, { threshold: 0 });
|
|
864
|
+
return /* @__PURE__ */ w(xt, { config: t, layers: e, style: n, children: /* @__PURE__ */ w(De, { gridRef: o, isIntersecting: s, isRoot: r }) });
|
|
865
|
+
}, De = ({ gridRef: t, isIntersecting: e, isRoot: n }) => {
|
|
866
|
+
const { config: r, style: o, layers: s } = zt(), { normalizedLayers: a, visibleLayers: l, regularLayers: u, layerById: p } = Jt(r, s.defs), { columnHandles: f, rowHandles: g, gapSizes: b, gridStyle: v, handleResize: E } = ue(r, o, t), { providerValue: R, draggingLayerId: M, resizingLayerId: P } = Pe({
|
|
867
|
+
layers: a,
|
|
868
|
+
layerById: p,
|
|
869
|
+
isRootLevel: n
|
|
870
|
+
}), x = M ? !0 : !!P, D = d.useMemo(() => ({
|
|
871
|
+
...Ne(n),
|
|
872
|
+
...v,
|
|
873
|
+
...x ? ke : {}
|
|
874
|
+
}), [v, x, n]);
|
|
875
|
+
return /* @__PURE__ */ K(Z, { children: [
|
|
876
|
+
/* @__PURE__ */ K(
|
|
877
|
+
"div",
|
|
878
|
+
{
|
|
879
|
+
ref: t,
|
|
880
|
+
style: D,
|
|
881
|
+
"data-dragging": !!M,
|
|
882
|
+
"data-resizing": !!P,
|
|
883
|
+
"data-visible": e,
|
|
884
|
+
children: [
|
|
885
|
+
/* @__PURE__ */ w(kt, { value: R, children: /* @__PURE__ */ w(Ut, { layers: u }) }),
|
|
886
|
+
f.map(({ trackIndex: y, align: I, span: N }) => /* @__PURE__ */ w(
|
|
887
|
+
lt,
|
|
888
|
+
{
|
|
889
|
+
direction: "col",
|
|
890
|
+
trackIndex: y,
|
|
891
|
+
align: I,
|
|
892
|
+
gap: b.columnGap,
|
|
893
|
+
span: N,
|
|
894
|
+
onResize: E
|
|
895
|
+
},
|
|
896
|
+
`col-${y}:${I}`
|
|
897
|
+
)),
|
|
898
|
+
g.map(({ trackIndex: y, align: I, span: N }) => /* @__PURE__ */ w(
|
|
899
|
+
lt,
|
|
900
|
+
{
|
|
901
|
+
direction: "row",
|
|
902
|
+
trackIndex: y,
|
|
903
|
+
align: I,
|
|
904
|
+
gap: b.rowGap,
|
|
905
|
+
span: N,
|
|
906
|
+
onResize: E
|
|
907
|
+
},
|
|
908
|
+
`row-${y}:${I}`
|
|
909
|
+
))
|
|
910
|
+
]
|
|
911
|
+
}
|
|
912
|
+
),
|
|
913
|
+
/* @__PURE__ */ w(Ht, { layers: l })
|
|
914
|
+
] });
|
|
915
|
+
};
|
|
916
|
+
export {
|
|
917
|
+
Ve as G,
|
|
918
|
+
Ut as a,
|
|
919
|
+
Xt as b,
|
|
920
|
+
lt as c,
|
|
921
|
+
ue as d,
|
|
922
|
+
yt as e,
|
|
923
|
+
je as t,
|
|
924
|
+
Jt as u
|
|
925
|
+
};
|
|
926
|
+
//# sourceMappingURL=GridLayout-UWNxXw77.js.map
|