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.
Files changed (541) hide show
  1. package/dist/{FloatingPanelFrame-lLg-Lpg7.js → FloatingPanelFrame-3eU9AwPo.js} +11 -11
  2. package/dist/{FloatingPanelFrame-lLg-Lpg7.js.map → FloatingPanelFrame-3eU9AwPo.js.map} +1 -1
  3. package/dist/{FloatingPanelFrame-D9Cp2al1.cjs → FloatingPanelFrame-CEmXDvUA.cjs} +2 -2
  4. package/dist/{FloatingPanelFrame-D9Cp2al1.cjs.map → FloatingPanelFrame-CEmXDvUA.cjs.map} +1 -1
  5. package/dist/FloatingWindow-CUXnEtrb.js +827 -0
  6. package/dist/FloatingWindow-CUXnEtrb.js.map +1 -0
  7. package/dist/FloatingWindow-DMwyK0eK.cjs +2 -0
  8. package/dist/FloatingWindow-DMwyK0eK.cjs.map +1 -0
  9. package/dist/GridLayout-DKTg_N61.cjs +2 -0
  10. package/dist/GridLayout-DKTg_N61.cjs.map +1 -0
  11. package/dist/GridLayout-UWNxXw77.js +926 -0
  12. package/dist/GridLayout-UWNxXw77.js.map +1 -0
  13. package/dist/HorizontalDivider-DdxzfV0l.js +30 -0
  14. package/dist/HorizontalDivider-DdxzfV0l.js.map +1 -0
  15. package/dist/HorizontalDivider-_pgV4Mcv.cjs +2 -0
  16. package/dist/HorizontalDivider-_pgV4Mcv.cjs.map +1 -0
  17. package/dist/PanelSystem-BqUzNtf2.js +1946 -0
  18. package/dist/PanelSystem-BqUzNtf2.js.map +1 -0
  19. package/dist/PanelSystem-D603LKKv.cjs +3 -0
  20. package/dist/PanelSystem-D603LKKv.cjs.map +1 -0
  21. package/dist/ResizeHandle-CBcAS918.cjs +2 -0
  22. package/dist/ResizeHandle-CBcAS918.cjs.map +1 -0
  23. package/dist/ResizeHandle-CXjc1meV.js +119 -0
  24. package/dist/ResizeHandle-CXjc1meV.js.map +1 -0
  25. package/dist/SwipePivotTabBar-DWrCuwEI.js +411 -0
  26. package/dist/SwipePivotTabBar-DWrCuwEI.js.map +1 -0
  27. package/dist/SwipePivotTabBar-fjjXkpj7.cjs +2 -0
  28. package/dist/SwipePivotTabBar-fjjXkpj7.cjs.map +1 -0
  29. package/dist/components/gesture/SwipeSafeZone.d.ts +40 -0
  30. package/dist/components/window/Drawer.d.ts +3 -1
  31. package/dist/components/window/DrawerLayers.d.ts +1 -1
  32. package/dist/components/window/drawerStyles.d.ts +69 -0
  33. package/dist/components/window/drawerSwipeConfig.d.ts +29 -0
  34. package/dist/components/window/useDrawerSwipeTransform.d.ts +23 -0
  35. package/dist/config.cjs +1 -1
  36. package/dist/config.cjs.map +1 -1
  37. package/dist/config.js +11 -9
  38. package/dist/config.js.map +1 -1
  39. package/dist/constants/styles.d.ts +35 -4
  40. package/dist/dialog/index.d.ts +69 -0
  41. package/dist/floating.cjs +1 -1
  42. package/dist/floating.js +1 -1
  43. package/dist/grid/index.d.ts +58 -0
  44. package/dist/grid.cjs +2 -0
  45. package/dist/grid.cjs.map +1 -0
  46. package/dist/grid.js +13 -0
  47. package/dist/grid.js.map +1 -0
  48. package/dist/hooks/gesture/presets.d.ts +33 -0
  49. package/dist/hooks/gesture/testing/createGestureSimulator.d.ts +117 -0
  50. package/dist/hooks/gesture/thresholdValue.d.ts +44 -0
  51. package/dist/hooks/gesture/types.d.ts +297 -0
  52. package/dist/hooks/gesture/useDirectionalLock.d.ts +20 -0
  53. package/dist/hooks/gesture/useEdgeSwipeInput.d.ts +23 -0
  54. package/dist/hooks/gesture/useNativeGestureGuard.d.ts +23 -0
  55. package/dist/hooks/gesture/usePointerTracking.d.ts +22 -0
  56. package/dist/hooks/gesture/useScrollBoundary.d.ts +23 -0
  57. package/dist/hooks/gesture/useSwipeInput.d.ts +5 -0
  58. package/dist/hooks/gesture/utils.d.ts +59 -0
  59. package/dist/hooks/useAnimatedVisibility.d.ts +58 -0
  60. package/dist/hooks/useAnimationFrame.d.ts +86 -0
  61. package/dist/hooks/useOperationContinuity.d.ts +64 -0
  62. package/dist/hooks/useResizeObserver.d.ts +33 -1
  63. package/dist/hooks/useSharedElementTransition.d.ts +112 -0
  64. package/dist/hooks/useSnapAnimation.d.ts +54 -0
  65. package/dist/hooks/useSwipeContentTransform.d.ts +86 -0
  66. package/dist/index.cjs +1 -2
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.ts +0 -1
  69. package/dist/index.js +25 -2006
  70. package/dist/index.js.map +1 -1
  71. package/dist/modules/dialog/AlertDialog.d.ts +9 -0
  72. package/dist/modules/dialog/DialogContainer.d.ts +37 -0
  73. package/dist/modules/dialog/Modal.d.ts +26 -0
  74. package/dist/modules/dialog/SwipeDialogContainer.d.ts +16 -0
  75. package/dist/modules/dialog/dialogAnimationUtils.d.ts +113 -0
  76. package/dist/modules/dialog/types.d.ts +183 -0
  77. package/dist/modules/dialog/useDialog.d.ts +39 -0
  78. package/dist/modules/dialog/useDialogContainer.d.ts +47 -0
  79. package/dist/modules/dialog/useDialogSwipeInput.d.ts +70 -0
  80. package/dist/modules/dialog/useDialogTransform.d.ts +82 -0
  81. package/dist/modules/drawer/types.d.ts +74 -0
  82. package/dist/modules/drawer/useDrawerSwipeInput.d.ts +24 -0
  83. package/dist/modules/pivot/PivotContent.d.ts +1 -1
  84. package/dist/modules/pivot/SwipePivotContent.d.ts +39 -0
  85. package/dist/modules/pivot/SwipePivotContent.debug.tmp.d.ts +25 -0
  86. package/dist/modules/pivot/SwipePivotContent.test.d.ts +1 -0
  87. package/dist/modules/pivot/SwipePivotTabBar.d.ts +92 -0
  88. package/dist/modules/pivot/index.d.ts +3 -0
  89. package/dist/modules/pivot/scaleInputState.d.ts +37 -0
  90. package/dist/modules/pivot/types.d.ts +67 -2
  91. package/dist/modules/pivot/usePivotSwipeInput.d.ts +68 -0
  92. package/dist/modules/stack/StackContent.d.ts +15 -0
  93. package/dist/modules/stack/SwipeStackContent.d.ts +66 -0
  94. package/dist/modules/stack/SwipeStackOutlet.d.ts +80 -0
  95. package/dist/modules/stack/computeStackContentState.d.ts +99 -0
  96. package/dist/modules/stack/computeSwipeStackTransform.d.ts +76 -0
  97. package/dist/modules/stack/types.d.ts +194 -0
  98. package/dist/modules/stack/useStackAnimationState.d.ts +32 -0
  99. package/dist/modules/stack/useStackNavigation.d.ts +23 -0
  100. package/dist/modules/stack/useStackSwipeInput.d.ts +27 -0
  101. package/dist/panels/index.d.ts +67 -0
  102. package/dist/panels.cjs +2 -0
  103. package/dist/panels.cjs.map +1 -0
  104. package/dist/panels.js +28 -0
  105. package/dist/panels.js.map +1 -0
  106. package/dist/pivot/index.d.ts +3 -0
  107. package/dist/pivot.cjs +1 -1
  108. package/dist/pivot.cjs.map +1 -1
  109. package/dist/pivot.js +20 -2
  110. package/dist/pivot.js.map +1 -1
  111. package/dist/resizer/index.d.ts +57 -0
  112. package/dist/resizer.cjs +2 -0
  113. package/dist/resizer.cjs.map +1 -0
  114. package/dist/resizer.js +8 -0
  115. package/dist/resizer.js.map +1 -0
  116. package/dist/stack/index.d.ts +72 -0
  117. package/dist/stack.cjs +2 -0
  118. package/dist/stack.cjs.map +1 -0
  119. package/dist/stack.js +721 -0
  120. package/dist/stack.js.map +1 -0
  121. package/dist/sticky-header/StickyArea.d.ts +38 -0
  122. package/dist/sticky-header/calculateStickyMetrics.d.ts +28 -0
  123. package/dist/sticky-header/index.d.ts +4 -4
  124. package/dist/sticky-header/types.d.ts +35 -22
  125. package/dist/sticky-header.cjs +1 -1
  126. package/dist/sticky-header.cjs.map +1 -1
  127. package/dist/sticky-header.js +73 -174
  128. package/dist/sticky-header.js.map +1 -1
  129. package/dist/styles-NkjuMOVS.js +57 -0
  130. package/dist/styles-NkjuMOVS.js.map +1 -0
  131. package/dist/styles-qf6ptVLD.cjs +2 -0
  132. package/dist/styles-qf6ptVLD.cjs.map +1 -0
  133. package/dist/types.d.ts +16 -0
  134. package/dist/useContentCache-CO3LYNmz.js +24 -0
  135. package/dist/useContentCache-CO3LYNmz.js.map +1 -0
  136. package/dist/useContentCache-DqXtLrLs.cjs +2 -0
  137. package/dist/useContentCache-DqXtLrLs.cjs.map +1 -0
  138. package/dist/useDocumentPointerEvents-DXxw3qWj.js +54 -0
  139. package/dist/useDocumentPointerEvents-DXxw3qWj.js.map +1 -0
  140. package/dist/useDocumentPointerEvents-DxDSOtip.cjs +2 -0
  141. package/dist/useDocumentPointerEvents-DxDSOtip.cjs.map +1 -0
  142. package/dist/useFloatingState-C4kRaW_R.cjs +2 -0
  143. package/dist/useFloatingState-C4kRaW_R.cjs.map +1 -0
  144. package/dist/useFloatingState-tEfA_wbc.js +74 -0
  145. package/dist/useFloatingState-tEfA_wbc.js.map +1 -0
  146. package/dist/useNativeGestureGuard-C7TSqEkr.cjs +2 -0
  147. package/dist/useNativeGestureGuard-C7TSqEkr.cjs.map +1 -0
  148. package/dist/useNativeGestureGuard-CGYo6O0r.js +347 -0
  149. package/dist/useNativeGestureGuard-CGYo6O0r.js.map +1 -0
  150. package/dist/window/index.d.ts +63 -0
  151. package/dist/window.cjs +2 -0
  152. package/dist/window.cjs.map +1 -0
  153. package/dist/window.js +160 -0
  154. package/dist/window.js.map +1 -0
  155. package/docs/design-tokens.md +405 -0
  156. package/package.json +34 -4
  157. package/src/PanelSystemContext.tsx +88 -0
  158. package/src/components/gesture/SwipeSafeZone.tsx +69 -0
  159. package/src/components/grid/GridLayerList.tsx +172 -0
  160. package/src/components/grid/GridLayerResizeHandles.tsx +145 -0
  161. package/src/components/grid/GridLayout.spec.tsx +743 -0
  162. package/src/components/grid/GridLayout.tsx +130 -0
  163. package/src/components/grid/GridTrackResizeHandle.tsx +87 -0
  164. package/src/components/paneling/FloatingPanelFrame.tsx +203 -0
  165. package/src/components/panels/DropSuggestOverlay.tsx +131 -0
  166. package/src/components/panels/PanelGroupView.tsx +112 -0
  167. package/src/components/pivot/PivotLayer.tsx +27 -0
  168. package/src/components/resizer/HorizontalDivider.tsx +52 -0
  169. package/src/components/resizer/ResizeHandle.tsx +118 -0
  170. package/src/components/tabs/TabBar.tsx +223 -0
  171. package/src/components/tabs/TabBarTab.tsx +133 -0
  172. package/src/components/tabs/TabDragOverlay.tsx +92 -0
  173. package/src/components/window/DialogOverlay.tsx +180 -0
  174. package/src/components/window/Drawer.tsx +369 -0
  175. package/src/components/window/DrawerLayers.tsx +68 -0
  176. package/src/components/window/FloatingWindow.tsx +95 -0
  177. package/src/components/window/PopupLayerPortal.tsx +218 -0
  178. package/src/components/window/drawerStyles.spec.ts +263 -0
  179. package/src/components/window/drawerStyles.ts +228 -0
  180. package/src/components/window/drawerSwipeConfig.spec.ts +131 -0
  181. package/src/components/window/drawerSwipeConfig.ts +112 -0
  182. package/src/components/window/useDrawerSwipeTransform.spec.ts +234 -0
  183. package/src/components/window/useDrawerSwipeTransform.ts +129 -0
  184. package/src/config/PanelContentDeclaration.tsx +427 -0
  185. package/src/config/index.tsx +52 -0
  186. package/src/config/panelJsx.spec.tsx +54 -0
  187. package/src/config/panelJsxConfig.spec.tsx +54 -0
  188. package/src/config/panelJsxDrawer.spec.tsx +33 -0
  189. package/src/config/panelRouter.spec.ts +68 -0
  190. package/src/config/panelRouter.tsx +155 -0
  191. package/src/constants/styles.ts +280 -0
  192. package/src/demo/Layout.module.css +258 -0
  193. package/src/demo/Layout.tsx +176 -0
  194. package/src/demo/components/CodeBlock.module.css +54 -0
  195. package/src/demo/components/CodeBlock.tsx +34 -0
  196. package/src/demo/components/CodePreview.module.css +37 -0
  197. package/src/demo/components/CodePreview.tsx +31 -0
  198. package/src/demo/components/DataPreview.module.css +177 -0
  199. package/src/demo/components/DataPreview.tsx +115 -0
  200. package/src/demo/components/Story.module.css +68 -0
  201. package/src/demo/components/Story.tsx +54 -0
  202. package/src/demo/components/layout/CodePanel.module.css +183 -0
  203. package/src/demo/components/layout/CodePanel.tsx +149 -0
  204. package/src/demo/components/layout/DemoPage.module.css +60 -0
  205. package/src/demo/components/layout/DemoPage.tsx +56 -0
  206. package/src/demo/components/layout/SingleSamplePage.module.css +11 -0
  207. package/src/demo/components/layout/SingleSamplePage.tsx +35 -0
  208. package/src/demo/components/layout/SplitDemoLayout.module.css +107 -0
  209. package/src/demo/components/layout/SplitDemoLayout.tsx +218 -0
  210. package/src/demo/components/layout/index.ts +11 -0
  211. package/src/demo/components/tab-styles/ChromeTabBar.module.css +75 -0
  212. package/src/demo/components/tab-styles/ChromeTabBar.tsx +111 -0
  213. package/src/demo/components/tab-styles/GitHubTabBar.module.css +81 -0
  214. package/src/demo/components/tab-styles/GitHubTabBar.tsx +109 -0
  215. package/src/demo/components/tab-styles/VSCodeTabBar.module.css +78 -0
  216. package/src/demo/components/tab-styles/VSCodeTabBar.tsx +109 -0
  217. package/src/demo/components/tab-styles/index.ts +6 -0
  218. package/src/demo/components/ui/DemoButton.module.css +63 -0
  219. package/src/demo/components/ui/DemoButton.tsx +32 -0
  220. package/src/demo/components/ui/DemoCard.module.css +15 -0
  221. package/src/demo/components/ui/DemoCard.tsx +30 -0
  222. package/src/demo/components/ui/DemoContainer.module.css +17 -0
  223. package/src/demo/components/ui/DemoContainer.tsx +30 -0
  224. package/src/demo/components/ui/DemoPanel.module.css +23 -0
  225. package/src/demo/components/ui/DemoPanel.tsx +33 -0
  226. package/src/demo/components/ui/PanelText.module.css +18 -0
  227. package/src/demo/components/ui/PanelText.tsx +29 -0
  228. package/src/demo/components/ui/PanelTitle.module.css +18 -0
  229. package/src/demo/components/ui/PanelTitle.tsx +31 -0
  230. package/src/demo/contexts/TabbarDemoConfig.tsx +218 -0
  231. package/src/demo/demo.css +172 -0
  232. package/src/demo/hooks/useMedia.ts +41 -0
  233. package/src/demo/hooks/useShikiHighlight.ts +55 -0
  234. package/src/demo/index.tsx +293 -0
  235. package/src/demo/pages/Dialog/alerts/index.tsx +22 -0
  236. package/src/demo/pages/Dialog/card/index.tsx +22 -0
  237. package/src/demo/pages/Dialog/components/AlertDialogDemo.tsx +124 -0
  238. package/src/demo/pages/Dialog/components/CardExpandDemo.module.css +243 -0
  239. package/src/demo/pages/Dialog/components/CardExpandDemo.tsx +204 -0
  240. package/src/demo/pages/Dialog/components/CustomAlertDialogDemo.tsx +219 -0
  241. package/src/demo/pages/Dialog/components/DialogDemos.module.css +77 -0
  242. package/src/demo/pages/Dialog/components/ModalBasics.tsx +45 -0
  243. package/src/demo/pages/Dialog/components/SwipeDialogDemo.module.css +77 -0
  244. package/src/demo/pages/Dialog/components/SwipeDialogDemo.tsx +181 -0
  245. package/src/demo/pages/Dialog/custom-alert/index.tsx +22 -0
  246. package/src/demo/pages/Dialog/modal/index.tsx +17 -0
  247. package/src/demo/pages/Dialog/swipe/index.tsx +22 -0
  248. package/src/demo/pages/Drawer/animations/index.tsx +22 -0
  249. package/src/demo/pages/Drawer/basics/index.tsx +17 -0
  250. package/src/demo/pages/Drawer/components/DrawerAnimations.module.css +125 -0
  251. package/src/demo/pages/Drawer/components/DrawerAnimations.tsx +118 -0
  252. package/src/demo/pages/Drawer/components/DrawerBasics.module.css +55 -0
  253. package/src/demo/pages/Drawer/components/DrawerBasics.tsx +76 -0
  254. package/src/demo/pages/Drawer/components/DrawerMenuLayout.module.css +332 -0
  255. package/src/demo/pages/Drawer/components/DrawerMenuLayout.tsx +199 -0
  256. package/src/demo/pages/Drawer/components/DrawerSwipe.module.css +316 -0
  257. package/src/demo/pages/Drawer/components/DrawerSwipe.tsx +178 -0
  258. package/src/demo/pages/Drawer/menu/index.tsx +17 -0
  259. package/src/demo/pages/Drawer/swipe/index.tsx +17 -0
  260. package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.module.css +163 -0
  261. package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.tsx +234 -0
  262. package/src/demo/pages/FloatingPanelFrame/basic/index.tsx +17 -0
  263. package/src/demo/pages/FloatingPanelFrame/complex/index.tsx +26 -0
  264. package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.module.css +16 -0
  265. package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.tsx +24 -0
  266. package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.module.css +54 -0
  267. package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.tsx +67 -0
  268. package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.module.css +21 -0
  269. package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.tsx +41 -0
  270. package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.module.css +5 -0
  271. package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.tsx +43 -0
  272. package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.module.css +11 -0
  273. package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.tsx +42 -0
  274. package/src/demo/pages/FloatingPanelFrame/index.tsx +80 -0
  275. package/src/demo/pages/FloatingPanelFrame/scrollable/index.tsx +30 -0
  276. package/src/demo/pages/FloatingPanelFrame/with-controls/index.tsx +30 -0
  277. package/src/demo/pages/FloatingPanelFrame/with-meta/index.tsx +17 -0
  278. package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.module.css +112 -0
  279. package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.tsx +56 -0
  280. package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.module.css +46 -0
  281. package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.tsx +29 -0
  282. package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.module.css +54 -0
  283. package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.tsx +30 -0
  284. package/src/demo/pages/HorizontalDivider/index.module.css +14 -0
  285. package/src/demo/pages/HorizontalDivider/index.tsx +64 -0
  286. package/src/demo/pages/HorizontalDivider/panels-with-rich-content/index.tsx +21 -0
  287. package/src/demo/pages/HorizontalDivider/simple-resizable-panels/index.tsx +21 -0
  288. package/src/demo/pages/HorizontalDivider/three-panel-layout/index.tsx +21 -0
  289. package/src/demo/pages/PanelLayout/PanelLayoutDemo.module.css +174 -0
  290. package/src/demo/pages/PanelLayout/PanelLayoutDemo.tsx +248 -0
  291. package/src/demo/pages/PanelLayout/components/DashboardLayout.module.css +115 -0
  292. package/src/demo/pages/PanelLayout/components/DashboardLayout.tsx +124 -0
  293. package/src/demo/pages/PanelLayout/components/DraggableOverlays.module.css +101 -0
  294. package/src/demo/pages/PanelLayout/components/DraggableOverlays.tsx +122 -0
  295. package/src/demo/pages/PanelLayout/components/IDELayout.module.css +104 -0
  296. package/src/demo/pages/PanelLayout/components/IDELayout.tsx +143 -0
  297. package/src/demo/pages/PanelLayout/components/SimpleGrid.module.css +19 -0
  298. package/src/demo/pages/PanelLayout/components/SimpleGrid.tsx +62 -0
  299. package/src/demo/pages/PanelLayout/dashboard/index.tsx +22 -0
  300. package/src/demo/pages/PanelLayout/draggable-overlays/index.tsx +22 -0
  301. package/src/demo/pages/PanelLayout/ide-layout/index.tsx +22 -0
  302. package/src/demo/pages/PanelLayout/index.tsx +94 -0
  303. package/src/demo/pages/PanelLayout/simple-grid/index.tsx +22 -0
  304. package/src/demo/pages/PanelSystem/PanelSystemPreview.module.css +20 -0
  305. package/src/demo/pages/PanelSystem/PanelSystemPreview.tsx +101 -0
  306. package/src/demo/pages/PanelSystem/preview/index.tsx +18 -0
  307. package/src/demo/pages/PanelSystem/tabbar/index.tsx +129 -0
  308. package/src/demo/pages/Pivot/basics/index.tsx +17 -0
  309. package/src/demo/pages/Pivot/components/Pivot.module.css +278 -0
  310. package/src/demo/pages/Pivot/components/PivotBasics.tsx +103 -0
  311. package/src/demo/pages/Pivot/components/PivotSidebar.tsx +168 -0
  312. package/src/demo/pages/Pivot/components/PivotTabs.tsx +129 -0
  313. package/src/demo/pages/Pivot/components/PivotTransitions.tsx +120 -0
  314. package/src/demo/pages/Pivot/components/SwipePivot.module.css +114 -0
  315. package/src/demo/pages/Pivot/components/SwipePivot.tsx +193 -0
  316. package/src/demo/pages/Pivot/components/SwipeTabsPivot.module.css +203 -0
  317. package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +320 -0
  318. package/src/demo/pages/Pivot/sidebar/index.tsx +17 -0
  319. package/src/demo/pages/Pivot/swipe/index.tsx +16 -0
  320. package/src/demo/pages/Pivot/swipe-debug/index.tsx +287 -0
  321. package/src/demo/pages/Pivot/swipe-tabs/index.tsx +15 -0
  322. package/src/demo/pages/Pivot/tabs/index.tsx +17 -0
  323. package/src/demo/pages/Pivot/transitions/index.tsx +17 -0
  324. package/src/demo/pages/ResizeHandle/both-directions/index.tsx +17 -0
  325. package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.module.css +72 -0
  326. package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.tsx +41 -0
  327. package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.module.css +61 -0
  328. package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.tsx +33 -0
  329. package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.module.css +83 -0
  330. package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.tsx +53 -0
  331. package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.module.css +68 -0
  332. package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.tsx +33 -0
  333. package/src/demo/pages/ResizeHandle/horizontal/index.tsx +17 -0
  334. package/src/demo/pages/ResizeHandle/index.module.css +11 -0
  335. package/src/demo/pages/ResizeHandle/index.tsx +71 -0
  336. package/src/demo/pages/ResizeHandle/nested-panels/index.tsx +17 -0
  337. package/src/demo/pages/ResizeHandle/vertical/index.tsx +17 -0
  338. package/src/demo/pages/ResponsiveLayout/adaptive-workspace/index.tsx +22 -0
  339. package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.module.css +423 -0
  340. package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.tsx +398 -0
  341. package/src/demo/pages/Stack/basics/index.tsx +22 -0
  342. package/src/demo/pages/Stack/components/Stack.module.css +234 -0
  343. package/src/demo/pages/Stack/components/StackBasics.spec.tsx +152 -0
  344. package/src/demo/pages/Stack/components/StackBasics.tsx +301 -0
  345. package/src/demo/pages/Stack/components/StackTablet.module.css +299 -0
  346. package/src/demo/pages/Stack/components/StackTablet.spec.tsx +120 -0
  347. package/src/demo/pages/Stack/components/StackTablet.tsx +422 -0
  348. package/src/demo/pages/Stack/tablet/index.tsx +22 -0
  349. package/src/demo/pages/StickyHeader/basics/index.tsx +17 -0
  350. package/src/demo/pages/StickyHeader/components/StickyHeader.module.css +219 -0
  351. package/src/demo/pages/StickyHeader/components/StickyHeaderBasics.tsx +103 -0
  352. package/src/demo/routes.tsx +214 -0
  353. package/src/demo/styles/animations.css +68 -0
  354. package/src/demo/styles/stack-themes.css +35 -0
  355. package/src/demo/utils/createPanelView.tsx +58 -0
  356. package/src/dialog/index.ts +85 -0
  357. package/src/floating/index.ts +24 -0
  358. package/src/grid/index.ts +75 -0
  359. package/src/hooks/ContentCacheContext.tsx +87 -0
  360. package/src/hooks/gesture/presets.spec.ts +86 -0
  361. package/src/hooks/gesture/presets.ts +95 -0
  362. package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +241 -0
  363. package/src/hooks/gesture/testing/createGestureSimulator.ts +385 -0
  364. package/src/hooks/gesture/thresholdValue.spec.ts +103 -0
  365. package/src/hooks/gesture/thresholdValue.ts +77 -0
  366. package/src/hooks/gesture/types.ts +367 -0
  367. package/src/hooks/gesture/useDirectionalLock.spec.ts +271 -0
  368. package/src/hooks/gesture/useDirectionalLock.ts +115 -0
  369. package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +462 -0
  370. package/src/hooks/gesture/useEdgeSwipeInput.ts +131 -0
  371. package/src/hooks/gesture/useNativeGestureGuard.spec.ts +473 -0
  372. package/src/hooks/gesture/useNativeGestureGuard.ts +135 -0
  373. package/src/hooks/gesture/usePointerTracking.spec.ts +364 -0
  374. package/src/hooks/gesture/usePointerTracking.ts +134 -0
  375. package/src/hooks/gesture/useScrollBoundary.spec.ts +249 -0
  376. package/src/hooks/gesture/useScrollBoundary.ts +113 -0
  377. package/src/hooks/gesture/useSwipeInput.spec.ts +592 -0
  378. package/src/hooks/gesture/useSwipeInput.ts +310 -0
  379. package/src/hooks/gesture/utils.spec.ts +152 -0
  380. package/src/hooks/gesture/utils.ts +178 -0
  381. package/src/hooks/useAnimatedVisibility.spec.ts +277 -0
  382. package/src/hooks/useAnimatedVisibility.ts +172 -0
  383. package/src/hooks/useAnimationFrame.ts +208 -0
  384. package/src/hooks/useCSSMatrix.spec.ts +214 -0
  385. package/src/hooks/useCSSMatrix.ts +262 -0
  386. package/src/hooks/useClonedElementPreview.ts +28 -0
  387. package/src/hooks/useContainerScroll.ts +78 -0
  388. package/src/hooks/useContentCache.spec.tsx +232 -0
  389. package/src/hooks/useContentCache.tsx +127 -0
  390. package/src/hooks/useDocumentPointerEvents.ts +137 -0
  391. package/src/hooks/useDocumentScroll.ts +41 -0
  392. package/src/hooks/useEffectEvent.ts +40 -0
  393. package/src/hooks/useElementComponentWrapper.tsx +63 -0
  394. package/src/hooks/useIntersectionObserver.tsx +125 -0
  395. package/src/hooks/useIsomorphicLayoutEffect.ts +29 -0
  396. package/src/hooks/useOperationContinuity.spec.ts +387 -0
  397. package/src/hooks/useOperationContinuity.ts +135 -0
  398. package/src/hooks/useResizeObserver.spec.tsx +277 -0
  399. package/src/hooks/useResizeObserver.tsx +150 -0
  400. package/src/hooks/useScrollContainer.ts +73 -0
  401. package/src/hooks/useSharedElementTransition.ts +333 -0
  402. package/src/hooks/useSnapAnimation.ts +128 -0
  403. package/src/hooks/useSwipeContentTransform.spec.ts +133 -0
  404. package/src/hooks/useSwipeContentTransform.ts +373 -0
  405. package/src/hooks/useTransitionState.ts +95 -0
  406. package/src/index.tsx +88 -0
  407. package/src/modules/dialog/AlertDialog.spec.tsx +387 -0
  408. package/src/modules/dialog/AlertDialog.tsx +221 -0
  409. package/src/modules/dialog/DialogContainer.spec.tsx +228 -0
  410. package/src/modules/dialog/DialogContainer.tsx +188 -0
  411. package/src/modules/dialog/Modal.spec.tsx +220 -0
  412. package/src/modules/dialog/Modal.tsx +182 -0
  413. package/src/modules/dialog/SwipeDialogContainer.tsx +208 -0
  414. package/src/modules/dialog/dialogAnimationUtils.spec.ts +253 -0
  415. package/src/modules/dialog/dialogAnimationUtils.ts +297 -0
  416. package/src/modules/dialog/types.ts +186 -0
  417. package/src/modules/dialog/useDialog.spec.tsx +447 -0
  418. package/src/modules/dialog/useDialog.ts +214 -0
  419. package/src/modules/dialog/useDialogContainer.spec.ts +331 -0
  420. package/src/modules/dialog/useDialogContainer.ts +150 -0
  421. package/src/modules/dialog/useDialogSwipeInput.spec.ts +157 -0
  422. package/src/modules/dialog/useDialogSwipeInput.ts +319 -0
  423. package/src/modules/dialog/useDialogTransform.spec.ts +370 -0
  424. package/src/modules/dialog/useDialogTransform.ts +407 -0
  425. package/src/modules/drawer/types.ts +102 -0
  426. package/src/modules/drawer/useDrawerSwipeInput.spec.ts +566 -0
  427. package/src/modules/drawer/useDrawerSwipeInput.ts +399 -0
  428. package/src/modules/grid/GridLayoutContext.tsx +57 -0
  429. package/src/modules/grid/LayerInstanceContext.tsx +56 -0
  430. package/src/modules/grid/resizeHandles.ts +157 -0
  431. package/src/modules/grid/trackUtils.ts +146 -0
  432. package/src/modules/grid/useGridPlacements.ts +143 -0
  433. package/src/modules/grid/useGridTracks.ts +156 -0
  434. package/src/modules/grid/useLayerDragHandle.ts +16 -0
  435. package/src/modules/grid/useLayerInteractions.tsx +850 -0
  436. package/src/modules/keybindings/KeybindingsProvider.tsx +111 -0
  437. package/src/modules/panels/dom/DomRegistry.tsx +94 -0
  438. package/src/modules/panels/index.ts +45 -0
  439. package/src/modules/panels/interactions/InteractionsContext.test.tsx +330 -0
  440. package/src/modules/panels/interactions/InteractionsContext.tsx +394 -0
  441. package/src/modules/panels/interactions/dnd.ts +28 -0
  442. package/src/modules/panels/keybindings/KeybindingsInstaller.tsx +15 -0
  443. package/src/modules/panels/layout/adapter.ts +124 -0
  444. package/src/modules/panels/rendering/ContentRegistry.spec.tsx +311 -0
  445. package/src/modules/panels/rendering/ContentRegistry.tsx +205 -0
  446. package/src/modules/panels/rendering/GroupContainer.tsx +65 -0
  447. package/src/modules/panels/rendering/RenderBridge.tsx +115 -0
  448. package/src/modules/panels/rendering/RenderContext.tsx +31 -0
  449. package/src/modules/panels/state/PanelSplitHandles.tsx +147 -0
  450. package/src/modules/panels/state/PanelSystemContext.splitLimits.spec.tsx +50 -0
  451. package/src/modules/panels/state/PanelSystemContext.tsx +289 -0
  452. package/src/modules/panels/state/StateContext.tsx +12 -0
  453. package/src/modules/panels/state/cleanup.ts +37 -0
  454. package/src/modules/panels/state/commands.ts +53 -0
  455. package/src/modules/panels/state/focus/Context.tsx +25 -0
  456. package/src/modules/panels/state/focus/logic.ts +57 -0
  457. package/src/modules/panels/state/groups/Context.tsx +25 -0
  458. package/src/modules/panels/state/groups/logic.ts +105 -0
  459. package/src/modules/panels/state/splitLimits.spec.ts +46 -0
  460. package/src/modules/panels/state/splitLimits.ts +90 -0
  461. package/src/modules/panels/state/state.spec.ts +49 -0
  462. package/src/modules/panels/state/tree/Context.tsx +24 -0
  463. package/src/modules/panels/state/tree/logic.spec.ts +34 -0
  464. package/src/modules/panels/state/tree/logic.ts +138 -0
  465. package/src/modules/panels/state/types.ts +142 -0
  466. package/src/modules/panels/system/PanelSystem.empty-tabbar.spec.tsx +53 -0
  467. package/src/modules/panels/system/PanelSystem.tab-click-activates.spec.tsx +44 -0
  468. package/src/modules/panels/system/PanelSystem.tab-reorder.spec.tsx +64 -0
  469. package/src/modules/panels/system/PanelSystem.tabs-no-dup.spec.tsx +57 -0
  470. package/src/modules/panels/system/PanelSystem.tsx +206 -0
  471. package/src/modules/pivot/PivotContent.spec.tsx +179 -0
  472. package/src/modules/pivot/PivotContent.tsx +77 -0
  473. package/src/modules/pivot/SwipePivotContent.debug.tmp.tsx +237 -0
  474. package/src/modules/pivot/SwipePivotContent.position.spec.tsx +171 -0
  475. package/src/modules/pivot/SwipePivotContent.spec.tsx +494 -0
  476. package/src/modules/pivot/SwipePivotContent.test.tsx +502 -0
  477. package/src/modules/pivot/SwipePivotContent.tsx +197 -0
  478. package/src/modules/pivot/SwipePivotTabBar.spec.tsx +882 -0
  479. package/src/modules/pivot/SwipePivotTabBar.tsx +583 -0
  480. package/src/modules/pivot/index.ts +8 -0
  481. package/src/modules/pivot/scaleInputState.spec.ts +219 -0
  482. package/src/modules/pivot/scaleInputState.ts +66 -0
  483. package/src/modules/pivot/types.ts +139 -0
  484. package/src/modules/pivot/usePivot.spec.ts +635 -0
  485. package/src/modules/pivot/usePivot.spec.tsx +186 -0
  486. package/src/modules/pivot/usePivot.tsx +345 -0
  487. package/src/modules/pivot/usePivotSwipeInput.spec.ts +708 -0
  488. package/src/modules/pivot/usePivotSwipeInput.ts +136 -0
  489. package/src/modules/resizer/useResizeDrag.ts +94 -0
  490. package/src/modules/stack/StackContent.spec.tsx +264 -0
  491. package/src/modules/stack/StackContent.tsx +111 -0
  492. package/src/modules/stack/SwipeStackContent.spec.tsx +1564 -0
  493. package/src/modules/stack/SwipeStackContent.tsx +366 -0
  494. package/src/modules/stack/SwipeStackOutlet.spec.tsx +250 -0
  495. package/src/modules/stack/SwipeStackOutlet.tsx +221 -0
  496. package/src/modules/stack/computeStackContentState.spec.ts +281 -0
  497. package/src/modules/stack/computeStackContentState.ts +304 -0
  498. package/src/modules/stack/computeSwipeStackTransform.spec.ts +186 -0
  499. package/src/modules/stack/computeSwipeStackTransform.ts +145 -0
  500. package/src/modules/stack/swipeTransitionContinuity.spec.tsx +1133 -0
  501. package/src/modules/stack/types.ts +226 -0
  502. package/src/modules/stack/useStackAnimationState.spec.ts +188 -0
  503. package/src/modules/stack/useStackAnimationState.ts +143 -0
  504. package/src/modules/stack/useStackNavigation.spec.ts +672 -0
  505. package/src/modules/stack/useStackNavigation.tsx +393 -0
  506. package/src/modules/stack/useStackSwipeInput.spec.ts +309 -0
  507. package/src/modules/stack/useStackSwipeInput.ts +139 -0
  508. package/src/modules/window/useDrawerState.ts +81 -0
  509. package/src/modules/window/useFloatingState.spec.ts +252 -0
  510. package/src/modules/window/useFloatingState.ts +141 -0
  511. package/src/panels/index.ts +119 -0
  512. package/src/pivot/index.ts +19 -0
  513. package/src/resizer/index.ts +68 -0
  514. package/src/stack/index.ts +91 -0
  515. package/src/sticky-header/StickyArea.tsx +193 -0
  516. package/src/sticky-header/calculateStickyMetrics.spec.ts +105 -0
  517. package/src/sticky-header/calculateStickyMetrics.ts +50 -0
  518. package/src/sticky-header/index.ts +18 -0
  519. package/src/sticky-header/types.ts +68 -0
  520. package/src/types.ts +341 -0
  521. package/src/utils/CSSMatrix.ts +321 -0
  522. package/src/utils/css.ts +65 -0
  523. package/src/utils/dialogUtils.ts +43 -0
  524. package/src/utils/math.ts +18 -0
  525. package/src/utils/polyfills/createDialogPolyfill.ts +18 -0
  526. package/src/utils/typedActions.ts +103 -0
  527. package/src/vite-env.d.ts +6 -0
  528. package/src/window/index.ts +69 -0
  529. package/dist/GridLayout-BQQ63eA1.cjs +0 -2
  530. package/dist/GridLayout-BQQ63eA1.cjs.map +0 -1
  531. package/dist/GridLayout-CJTKq7Mp.js +0 -1465
  532. package/dist/GridLayout-CJTKq7Mp.js.map +0 -1
  533. package/dist/sticky-header/StickyHeader.d.ts +0 -53
  534. package/dist/styles-CA2_zLZt.js +0 -52
  535. package/dist/styles-CA2_zLZt.js.map +0 -1
  536. package/dist/styles-PsqGOEJP.cjs +0 -2
  537. package/dist/styles-PsqGOEJP.cjs.map +0 -1
  538. package/dist/usePivot-7ctin_P_.cjs +0 -2
  539. package/dist/usePivot-7ctin_P_.cjs.map +0 -1
  540. package/dist/usePivot-CgQxB8rc.js +0 -124
  541. package/dist/usePivot-CgQxB8rc.js.map +0 -1
@@ -1,1465 +0,0 @@
1
- import { jsxs as H, Fragment as _, jsx as h } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import { F as Pt, e as yt, a as Lt, b as Mt, f as Dt, d as Ut } from "./FloatingPanelFrame-lLg-Lpg7.js";
4
- import { C as jt, D as Kt, o as Zt, p as qt, q as Jt, r as Qt, s as te, G as Y, t as T, u as ee, v as ne, w as oe, R as ut, x as re, y as Q } from "./styles-CA2_zLZt.js";
5
- import { a as se, u as ie } from "./usePivot-CgQxB8rc.js";
6
- import { createPortal as ae } from "react-dom";
7
- import { u as It } from "./useIsomorphicLayoutEffect-DhmEnmZ_.js";
8
- const ce = () => {
9
- const t = /* @__PURE__ */ new Map();
10
- return (e) => {
11
- if (!e)
12
- return;
13
- const n = t.get(e);
14
- if (n !== void 0)
15
- return n;
16
- const o = t.size;
17
- return t.set(e, o), o;
18
- };
19
- }, ue = ce(), tt = /* @__PURE__ */ new Map(), le = (t) => {
20
- const e = `ovs-threshold:${t.threshold}-rootMargin:${t.rootMargin}-root:${ue(t.root)}`;
21
- if (tt.has(e))
22
- return tt.get(e);
23
- const n = new class {
24
- #t = /* @__PURE__ */ new Map();
25
- #e = new IntersectionObserver((o) => {
26
- o.forEach((r) => {
27
- const s = this.#t.get(r.target);
28
- s && s(r);
29
- });
30
- }, t);
31
- observe(o, r) {
32
- return this.#t.set(o, r), this.#e.observe(o), () => {
33
- this.#t.delete(o), this.#e.unobserve(o);
34
- };
35
- }
36
- }();
37
- return tt.set(e, n), n;
38
- }, lt = Object.freeze({
39
- x: 0,
40
- y: 0,
41
- width: 0,
42
- height: 0,
43
- top: 0,
44
- right: 0,
45
- bottom: 0,
46
- left: 0
47
- });
48
- function de(t, { threshold: e = 0, rootMargin: n = "0px", root: o = null }) {
49
- const [r, s] = i.useState(null);
50
- return i.useEffect(() => {
51
- const u = t.current;
52
- return u ? le({
53
- threshold: e,
54
- rootMargin: n,
55
- root: o
56
- }).observe(u, (a) => {
57
- s({
58
- isIntersecting: a.isIntersecting,
59
- boundingClientRect: a.boundingClientRect,
60
- intersectionRatio: a.intersectionRatio,
61
- intersectionRect: a.intersectionRect,
62
- rootBounds: a.rootBounds,
63
- target: a.target,
64
- time: a.time
65
- });
66
- }) : void 0;
67
- }, [t, e, n, o]), i.useMemo(() => ({
68
- isIntersecting: r?.isIntersecting ?? !1,
69
- boundingClientRect: r?.boundingClientRect ?? lt,
70
- intersectionRatio: r?.intersectionRatio ?? 0,
71
- intersectionRect: r?.intersectionRect ?? lt,
72
- rootBounds: r?.rootBounds ?? null,
73
- target: r?.target ?? t.current,
74
- time: r?.time ?? 0
75
- }), [r, t]);
76
- }
77
- const dt = {
78
- position: "fixed",
79
- inset: 0,
80
- background: jt
81
- }, fe = {
82
- willChange: "transform"
83
- }, ft = {
84
- left: {
85
- top: 0,
86
- bottom: 0,
87
- left: 0,
88
- transform: "translateX(-100%)"
89
- },
90
- right: {
91
- top: 0,
92
- bottom: 0,
93
- right: 0,
94
- transform: "translateX(100%)"
95
- },
96
- top: {
97
- top: 0,
98
- left: 0,
99
- right: 0,
100
- transform: "translateY(-100%)"
101
- },
102
- bottom: {
103
- bottom: 0,
104
- left: 0,
105
- right: 0,
106
- transform: "translateY(100%)"
107
- }
108
- }, ge = (t, e, n) => t === "none" ? void 0 : `transform ${e ?? Kt} ${n ?? Zt}`, pe = (t, e) => t ? e : !1, he = ({ chrome: t, frameStyle: e, header: n, dismissible: o, onClose: r, children: s }) => t ? /* @__PURE__ */ H(Pt, { style: e, children: [
109
- /* @__PURE__ */ h(me, { header: n, dismissible: o, onClose: r }),
110
- /* @__PURE__ */ h(
111
- yt,
112
- {
113
- style: { padding: qt, flex: 1, display: "flex", flexDirection: "column" },
114
- children: s
115
- }
116
- )
117
- ] }) : /* @__PURE__ */ h(_, { children: s }), me = ({ header: t, dismissible: e, onClose: n }) => {
118
- if (!t)
119
- return null;
120
- const o = t.showCloseButton ?? !0, r = pe(e, o);
121
- return /* @__PURE__ */ h(i.Activity, { mode: t ? "visible" : "hidden", children: /* @__PURE__ */ H(
122
- Lt,
123
- {
124
- style: { padding: `${Qt} ${te}`, gap: Jt },
125
- children: [
126
- /* @__PURE__ */ h(i.Activity, { mode: t ? "visible" : "hidden", children: /* @__PURE__ */ h(Mt, { children: t.title }) }),
127
- /* @__PURE__ */ h(i.Activity, { mode: r ? "visible" : "hidden", children: /* @__PURE__ */ h(
128
- Dt,
129
- {
130
- onClick: n,
131
- "aria-label": "Close drawer",
132
- style: { marginLeft: "auto" }
133
- }
134
- ) })
135
- ]
136
- }
137
- ) });
138
- }, we = ({
139
- id: t,
140
- config: e,
141
- isOpen: n,
142
- onClose: o,
143
- children: r,
144
- zIndex: s,
145
- width: u,
146
- height: c,
147
- position: a
148
- }) => {
149
- const {
150
- dismissible: l = !0,
151
- header: g,
152
- chrome: f = !0,
153
- inline: m = !1,
154
- transitionMode: w = "css",
155
- transitionDuration: C,
156
- transitionEasing: z
157
- } = e, L = i.useCallback(
158
- (I, R) => I || (R ? R.left !== void 0 ? "left" : R.right !== void 0 ? "right" : R.top !== void 0 ? "top" : R.bottom !== void 0 ? "bottom" : "right" : "right"),
159
- []
160
- )(e.anchor, a), x = {
161
- left: "translateX(0)",
162
- right: "translateX(0)",
163
- top: "translateY(0)",
164
- bottom: "translateY(0)"
165
- }, N = i.useMemo(() => {
166
- const I = ge(w, C, z), R = {
167
- ...fe,
168
- ...m ? { position: "absolute" } : { position: "fixed" },
169
- ...ft[L],
170
- transform: n ? x[L] : ft[L].transform,
171
- transition: I
172
- };
173
- return s !== void 0 && (R.zIndex = s), u !== void 0 && (R.width = typeof u == "number" ? `${u}px` : u), c !== void 0 && (R.height = typeof c == "number" ? `${c}px` : c), R;
174
- }, [c, m, n, L, C, z, w, u, s]), M = g?.title ?? e.ariaLabel ?? "Drawer", D = i.useMemo(() => {
175
- const I = m ? { ...dt, position: "absolute" } : dt, R = w === "none" ? void 0 : `opacity ${C ?? "220ms"} ease`;
176
- return {
177
- ...I,
178
- opacity: n ? 1 : 0,
179
- pointerEvents: n ? "auto" : "none",
180
- transition: R,
181
- zIndex: s !== void 0 ? s - 1 : void 0
182
- };
183
- }, [m, n, C, w, s]), A = i.useMemo(() => {
184
- const I = L === "left" || L === "right", R = { borderRadius: 0 };
185
- return I && (R.height = "100%"), R;
186
- }, [L]);
187
- return /* @__PURE__ */ H(_, { children: [
188
- /* @__PURE__ */ h("div", { style: D, onClick: l ? o : void 0 }),
189
- /* @__PURE__ */ h(
190
- "div",
191
- {
192
- "data-layer-id": t,
193
- "data-placement": L,
194
- style: N,
195
- role: "dialog",
196
- "aria-modal": l ? !0 : void 0,
197
- "aria-hidden": n ? void 0 : !0,
198
- "aria-label": M,
199
- children: /* @__PURE__ */ h(
200
- he,
201
- {
202
- chrome: f,
203
- frameStyle: A,
204
- header: g,
205
- dismissible: l,
206
- onClose: o,
207
- children: r
208
- }
209
- )
210
- }
211
- )
212
- ] });
213
- }, be = (t, e) => new Promise((n) => {
214
- let o = !1;
215
- const r = () => {
216
- o || (o = !0, t.removeEventListener("transitionend", s), n());
217
- }, s = (u) => {
218
- u.target === t && r();
219
- };
220
- t.addEventListener("transitionend", s), setTimeout(r, e + 50);
221
- }), Tt = async (t, e, n, o) => {
222
- switch (e) {
223
- case "none":
224
- t();
225
- return;
226
- case "css":
227
- t(), n && await be(n, o);
228
- return;
229
- }
230
- }, Xn = (t) => {
231
- const [e, n] = i.useState({}), o = i.useRef(t);
232
- o.current = t;
233
- const r = i.useCallback(
234
- async (a, l, g) => {
235
- const { mode: f = "none", element: m, duration: w = 300 } = g ?? {};
236
- await Tt(() => {
237
- n((y) => y[a] === l ? y : { ...y, [a]: l });
238
- }, f, m?.current, w);
239
- const z = o.current;
240
- l ? z?.onOpen?.(a) : z?.onClose?.(a), z?.onTransitionEnd?.(a, l);
241
- },
242
- []
243
- ), s = i.useCallback((a) => e[a] ?? !1, [e]), u = i.useCallback(
244
- (a, l) => r(a, !0, l),
245
- [r]
246
- ), c = i.useCallback(
247
- (a, l) => r(a, !1, l),
248
- [r]
249
- );
250
- return { state: s, open: u, close: c };
251
- }, ve = (t) => {
252
- if (!t)
253
- return 300;
254
- const e = t.match(/(\d+)/);
255
- return e ? parseInt(e[1], 10) : 300;
256
- }, Se = (t) => {
257
- const [e, n] = i.useState(() => {
258
- const a = {};
259
- return t.forEach((l) => {
260
- l.drawer && (a[l.id] = l.drawer.defaultOpen ?? !1);
261
- }), a;
262
- }), o = i.useMemo(() => {
263
- const a = /* @__PURE__ */ new Map();
264
- return t.forEach((l) => a.set(l.id, l)), a;
265
- }, [t]), r = i.useCallback(
266
- async (a, l, g) => {
267
- const f = o.get(a);
268
- if (!f?.drawer)
269
- return;
270
- const m = g?.mode ?? f.drawer.transitionMode ?? "css", w = g?.duration ?? ve(f.drawer.transitionDuration), C = g?.element?.current;
271
- await Tt(() => {
272
- f.drawer?.open === void 0 && n((y) => y[a] === l ? y : { ...y, [a]: l }), f.drawer?.onStateChange?.(l);
273
- }, m, C, w);
274
- },
275
- [o]
276
- ), s = i.useCallback(
277
- (a) => {
278
- const l = o.get(a);
279
- return l?.drawer?.open !== void 0 ? l.drawer.open : e[a] ?? !1;
280
- },
281
- [o, e]
282
- ), u = i.useCallback(
283
- (a, l) => r(a, !0, l),
284
- [r]
285
- ), c = i.useCallback(
286
- (a, l) => r(a, !1, l),
287
- [r]
288
- );
289
- return { state: s, open: u, close: c };
290
- }, Ce = ({ layers: t }) => {
291
- const e = Se(t), n = i.useMemo(() => t.filter((r) => r.drawer), [t]), o = i.useMemo(() => {
292
- const r = /* @__PURE__ */ new Map();
293
- return n.forEach((s) => {
294
- r.set(s.id, () => e.close(s.id));
295
- }), r;
296
- }, [n, e.close]);
297
- return /* @__PURE__ */ h(_, { children: n.map((r) => {
298
- if (!r.drawer)
299
- return null;
300
- const s = e.state(r.id), u = o.get(r.id);
301
- return u ? /* @__PURE__ */ h(
302
- we,
303
- {
304
- id: r.id,
305
- config: r.drawer,
306
- isOpen: s,
307
- onClose: u,
308
- zIndex: r.zIndex,
309
- width: r.width,
310
- height: r.height,
311
- position: r.position,
312
- children: r.component
313
- },
314
- r.id
315
- ) : null;
316
- }) });
317
- }, xt = i.createContext(null), ze = ({ value: t, children: e }) => /* @__PURE__ */ h(xt.Provider, { value: t, children: e }), kt = () => {
318
- const t = i.useContext(xt);
319
- if (!t)
320
- throw new Error("useGridLayoutContext must be used within a GridLayoutProvider.");
321
- return t;
322
- }, At = i.createContext(null), Ht = () => {
323
- const t = i.useContext(At);
324
- if (!t)
325
- throw new Error("usePanelSystem must be used within a PanelSystemProvider.");
326
- return t;
327
- }, Ee = ({ config: t, layers: e, style: n, children: o }) => {
328
- const r = i.useMemo(() => {
329
- const l = /* @__PURE__ */ new Map();
330
- return e.forEach((g) => {
331
- l.set(g.id, g);
332
- }), l;
333
- }, [e]), s = i.useCallback(
334
- (l) => r.get(l)?.component ?? null,
335
- [r]
336
- ), u = i.useMemo(() => e.map((l) => l.id), [e]), { getCachedContent: c } = se({
337
- resolveContent: s,
338
- validIds: u
339
- }), a = i.useMemo(
340
- () => ({
341
- config: t,
342
- style: n,
343
- layers: {
344
- defs: e,
345
- layerById: r
346
- },
347
- getCachedContent: c
348
- }),
349
- [t, n, e, r, c]
350
- );
351
- return /* @__PURE__ */ h(At.Provider, { value: a, children: o });
352
- }, Nt = i.createContext(null), $t = ({ layerId: t, children: e }) => {
353
- const n = i.useMemo(() => ({ layerId: t }), [t]);
354
- return /* @__PURE__ */ h(Nt.Provider, { value: n, children: e });
355
- }, Un = () => {
356
- const t = i.useContext(Nt);
357
- if (!t)
358
- throw new Error("useLayerInstance must be used within a LayerInstanceProvider.");
359
- return t;
360
- }, gt = (t, e, n) => {
361
- if (typeof t == "number" && Number.isFinite(t))
362
- return t;
363
- throw new Error(`Popup layer "${n}" requires a numeric "${e}" value.`);
364
- }, Ft = (t, e) => {
365
- if (!t)
366
- throw new Error(`Popup layer "${e}" must define position (left/top).`);
367
- return {
368
- left: gt(t.left, "left", e),
369
- top: gt(t.top, "top", e)
370
- };
371
- }, V = (t) => `${Math.round(t)}`, G = (t) => {
372
- if (t !== void 0)
373
- return t ? "yes" : "no";
374
- }, Re = (t, e, n, o, r) => {
375
- const s = {}, u = Ft(e, t);
376
- if (typeof n != "number" || typeof o != "number")
377
- throw new Error(`Popup layer "${t}" requires numeric width/height.`);
378
- s.width = V(n), s.height = V(o), s.left = V(u.left), s.top = V(u.top);
379
- const c = r?.features;
380
- if (c) {
381
- const a = G(c.toolbar), l = G(c.menubar), g = G(c.location), f = G(c.status), m = G(c.resizable), w = G(c.scrollbars);
382
- a !== void 0 && (s.toolbar = a), l !== void 0 && (s.menubar = l), g !== void 0 && (s.location = g), f !== void 0 && (s.status = f), m !== void 0 && (s.resizable = m), w !== void 0 && (s.scrollbars = w);
383
- }
384
- return Object.entries(s).map(([a, l]) => `${a}=${l}`).join(",");
385
- }, pt = (t, e, n, o, r) => {
386
- const s = Ft(n, e);
387
- if (typeof o != "number" || typeof r != "number")
388
- throw new Error(`Popup layer "${e}" requires numeric width/height.`);
389
- t.moveTo(Math.round(s.left), Math.round(s.top)), t.resizeTo(Math.round(o), Math.round(r));
390
- }, Pe = ({ layer: t }) => {
391
- const e = t.floating;
392
- if (!e)
393
- throw new Error(`Layer "${t.id}" is missing floating configuration required for popup mode.`);
394
- if ((e.mode ?? "embedded") !== "popup")
395
- throw new Error(`PopupLayerPortal received layer "${t.id}" that is not configured for popup mode.`);
396
- const o = i.useRef(null), r = i.useRef(null), [s, u] = i.useState(!1);
397
- return i.useEffect(() => {
398
- if (typeof window > "u")
399
- return;
400
- const c = Re(t.id, t.position, t.width, t.height, e.popup), a = e.popup?.name ?? t.id, l = ye(
401
- a,
402
- c,
403
- {
404
- position: t.position,
405
- size: { width: t.width, height: t.height }
406
- },
407
- e.popup
408
- );
409
- if (!l)
410
- throw new Error(`Failed to open popup window for layer "${t.id}".`);
411
- const g = l;
412
- r.current = g, e.popup?.focus !== !1 && g.focus(), g.document.title || (g.document.title = t.id), g.document.body.innerHTML = "";
413
- const f = g.document.createElement("div");
414
- f.dataset.layerId = t.id, g.document.body.appendChild(f), o.current = f, u(!0), pt(g, t.id, t.position, t.width, t.height);
415
- const m = () => {
416
- r.current = null, o.current = null, u(!1);
417
- };
418
- return g.addEventListener("beforeunload", m), () => {
419
- g.removeEventListener("beforeunload", m), e.popup?.closeOnUnmount !== !1 && g.close(), r.current = null, o.current = null, u(!1);
420
- };
421
- }, [
422
- e.popup?.closeOnUnmount,
423
- e.popup?.features?.location,
424
- e.popup?.features?.menubar,
425
- e.popup?.features?.resizable,
426
- e.popup?.features?.scrollbars,
427
- e.popup?.features?.status,
428
- e.popup?.features?.toolbar,
429
- e.popup?.focus,
430
- e.popup?.name,
431
- t.id
432
- ]), i.useEffect(() => {
433
- const c = r.current;
434
- c && pt(c, t.id, t.position, t.width, t.height);
435
- }, [t.position?.left, t.position?.top, t.height, t.width, t.id]), !s || !o.current ? null : ae(/* @__PURE__ */ h($t, { layerId: t.id, children: t.component }), o.current);
436
- }, ye = (t, e, n, o) => {
437
- const r = o?.createWindow;
438
- return r ? r({ name: t, features: e, bounds: n }) : window.open("", t, e);
439
- }, Le = ({ onClick: t }) => /* @__PURE__ */ h(Ut, { children: /* @__PURE__ */ h(Dt, { onClick: t, "aria-label": "Close window", "data-drag-ignore": "true" }) }), Me = ({ header: t, draggable: e, onClose: n }) => {
440
- if (!t)
441
- return null;
442
- const o = t.showCloseButton ?? !1;
443
- return /* @__PURE__ */ H(Lt, { ...e ? { "data-drag-handle": "true" } : {}, style: { cursor: e ? "grab" : void 0 }, children: [
444
- t.title ? /* @__PURE__ */ h(Mt, { children: t.title }) : null,
445
- o ? /* @__PURE__ */ h(Le, { onClick: n }) : null
446
- ] });
447
- }, De = ({ header: t, draggable: e, chrome: n, onClose: o, children: r }) => n ? /* @__PURE__ */ H(Pt, { style: { height: "100%", width: "100%" }, children: [
448
- /* @__PURE__ */ h(Me, { header: t, draggable: e, onClose: o }),
449
- /* @__PURE__ */ h(yt, { style: { flex: 1, display: "flex", flexDirection: "column" }, children: r })
450
- ] }) : /* @__PURE__ */ h(_, { children: r }), _t = ({ id: t, config: e, onClose: n, children: o }) => {
451
- const r = e.chrome ?? !1, s = e.draggable ?? !1, u = e.header?.title ?? e.ariaLabel ?? "Floating window";
452
- return /* @__PURE__ */ h("div", { "data-floating-window": t, role: "dialog", "aria-label": u, style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ h(De, { header: e.header, draggable: s, chrome: r, onClose: n, children: o }) });
453
- };
454
- _t.displayName = "FloatingWindow";
455
- const Gt = {
456
- position: "absolute",
457
- pointerEvents: "auto",
458
- boxSizing: "border-box",
459
- background: "transparent",
460
- border: "none"
461
- }, Ie = {
462
- ...Gt,
463
- width: T,
464
- height: T,
465
- zIndex: 2
466
- }, Te = {
467
- ...Gt,
468
- zIndex: 1
469
- }, xe = {
470
- "top-left": {
471
- top: 0,
472
- left: 0,
473
- transform: "translate(-50%, -50%)",
474
- cursor: "nwse-resize"
475
- },
476
- "top-right": {
477
- top: 0,
478
- right: 0,
479
- transform: "translate(50%, -50%)",
480
- cursor: "nesw-resize"
481
- },
482
- "bottom-left": {
483
- bottom: 0,
484
- left: 0,
485
- transform: "translate(-50%, 50%)",
486
- cursor: "nesw-resize"
487
- },
488
- "bottom-right": {
489
- bottom: 0,
490
- right: 0,
491
- transform: "translate(50%, 50%)",
492
- cursor: "nwse-resize"
493
- }
494
- }, ke = {
495
- left: {
496
- top: T,
497
- bottom: T,
498
- left: 0,
499
- width: Y,
500
- transform: "translateX(-50%)",
501
- cursor: "ew-resize"
502
- },
503
- right: {
504
- top: T,
505
- bottom: T,
506
- right: 0,
507
- width: Y,
508
- transform: "translateX(50%)",
509
- cursor: "ew-resize"
510
- },
511
- top: {
512
- left: T,
513
- right: T,
514
- top: 0,
515
- height: Y,
516
- transform: "translateY(-50%)",
517
- cursor: "ns-resize"
518
- },
519
- bottom: {
520
- left: T,
521
- right: T,
522
- bottom: 0,
523
- height: Y,
524
- transform: "translateY(50%)",
525
- cursor: "ns-resize"
526
- }
527
- }, Ae = [
528
- { key: "top-left", variant: "corner", horizontal: "left", vertical: "top" },
529
- { key: "top-right", variant: "corner", horizontal: "right", vertical: "top" },
530
- { key: "bottom-left", variant: "corner", horizontal: "left", vertical: "bottom" },
531
- { key: "bottom-right", variant: "corner", horizontal: "right", vertical: "bottom" },
532
- { key: "left", variant: "edge", horizontal: "left" },
533
- { key: "right", variant: "edge", horizontal: "right" },
534
- { key: "top", variant: "edge", vertical: "top" },
535
- { key: "bottom", variant: "edge", vertical: "bottom" }
536
- ], He = ({ layerId: t, onPointerDown: e }) => /* @__PURE__ */ h(_, { children: Ae.map((n) => {
537
- const o = n.variant === "corner" ? Ie : Te, r = n.variant === "corner" ? xe[n.key] : ke[n.key], s = { ...o, ...r }, u = n.variant === "corner" ? { "data-resize-corner": n.key } : { "data-resize-edge": n.key };
538
- return /* @__PURE__ */ h(
539
- "div",
540
- {
541
- role: "presentation",
542
- "aria-hidden": "true",
543
- style: s,
544
- ...u,
545
- "data-layer-id": t,
546
- onPointerDown: (c) => e(n, c)
547
- },
548
- n.key
549
- );
550
- }) }), Ne = ({ pivot: t }) => {
551
- const { Outlet: e } = ie({
552
- items: t.items,
553
- activeId: t.activeId,
554
- defaultActiveId: t.defaultActiveId,
555
- onActiveChange: t.onActiveChange,
556
- transitionMode: t.transitionMode
557
- });
558
- return /* @__PURE__ */ h(e, {});
559
- }, $e = (t, e) => t.pivot ? /* @__PURE__ */ h(Ne, { pivot: t.pivot }) : t.cache ? e(t.id) : t.component, Wt = i.memo(({ layer: t, onClose: e }) => {
560
- const { getCachedContent: n } = Ht(), o = $e(t, n);
561
- return t.floating?.chrome ? /* @__PURE__ */ h(_t, { id: t.id, config: t.floating, onClose: e, children: o }) : o;
562
- });
563
- Wt.displayName = "LayerContentRenderer";
564
- const Ot = i.memo(({ layerId: t, isResizable: e, onPointerDown: n }) => e ? /* @__PURE__ */ h(He, { layerId: t, onPointerDown: n }) : null);
565
- Ot.displayName = "LayerResizeHandles";
566
- const Fe = (t, e) => t ? "auto" : e ? "visible" : "hidden", Bt = i.memo(({ layer: t, handleLayerPointerDown: e }) => {
567
- const { getLayerRenderState: n } = kt(), { style: o, isResizable: r, isResizing: s, onResizeHandlePointerDown: u } = n(t), c = i.useMemo(() => {
568
- const g = {};
569
- return t.gridArea && (g.gridArea = t.gridArea), t.gridRow && (g.gridRow = t.gridRow), t.gridColumn && (g.gridColumn = t.gridColumn), g;
570
- }, [t.gridArea, t.gridRow, t.gridColumn]), a = i.useMemo(() => {
571
- const g = !!t.floating, f = Fe(t.scrollable, g), m = {
572
- ...o,
573
- ...c,
574
- minWidth: 0,
575
- minHeight: 0,
576
- overflow: f
577
- };
578
- return r ? { ...m, position: "relative" } : m;
579
- }, [o, c, r, t.scrollable, t.floating]), l = i.useCallback(() => {
580
- t.floating?.onClose?.();
581
- }, [t.floating]);
582
- return /* @__PURE__ */ H(
583
- "div",
584
- {
585
- "data-layer-id": t.id,
586
- "data-draggable": !!t.floating?.draggable,
587
- "data-resizable": r,
588
- "data-resizing": s,
589
- style: a,
590
- onPointerDown: e,
591
- children: [
592
- /* @__PURE__ */ h($t, { layerId: t.id, children: /* @__PURE__ */ h(Wt, { layer: t, onClose: l }) }),
593
- /* @__PURE__ */ h(Ot, { layerId: t.id, isResizable: r, onPointerDown: u })
594
- ]
595
- }
596
- );
597
- });
598
- Bt.displayName = "EmbeddedLayer";
599
- const _e = ({ layers: t }) => {
600
- const { handleLayerPointerDown: e } = kt();
601
- return /* @__PURE__ */ h(_, { children: t.map((n) => {
602
- const o = n.floating?.mode ?? "embedded";
603
- return n.floating && o === "popup" ? /* @__PURE__ */ h(Pe, { layer: n }, n.id) : /* @__PURE__ */ h(Bt, { layer: n, handleLayerPointerDown: e }, n.id);
604
- }) });
605
- };
606
- function W(t) {
607
- const e = i.useRef(t);
608
- return e.current = t, i.useCallback((...n) => {
609
- const o = e.current;
610
- if (o)
611
- return o(...n);
612
- }, []);
613
- }
614
- function et(t, e) {
615
- const n = W(e.onMove), o = W(e.onUp), r = W(e.onCancel);
616
- i.useEffect(() => {
617
- if (t)
618
- return e.onMove && document.addEventListener("pointermove", n, { passive: !1 }), e.onUp && document.addEventListener("pointerup", o), e.onCancel && document.addEventListener("pointercancel", r), () => {
619
- e.onMove && document.removeEventListener("pointermove", n), e.onUp && document.removeEventListener("pointerup", o), e.onCancel && document.removeEventListener("pointercancel", r);
620
- };
621
- }, [t, e.onMove, e.onUp, e.onCancel, n, o, r]);
622
- }
623
- function Ge(t, e, n) {
624
- i.useEffect(() => {
625
- const o = t.current;
626
- if (!(!e || !o || n === void 0))
627
- return o.setPointerCapture(n), () => {
628
- o.hasPointerCapture && o.hasPointerCapture(n) && o.releasePointerCapture(n);
629
- };
630
- }, [t, e, n]);
631
- }
632
- function We(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
633
- i.useEffect(() => {
634
- const o = t.current;
635
- if (!e || !o)
636
- return;
637
- const r = (s) => {
638
- s.preventDefault();
639
- };
640
- return n.forEach((s) => {
641
- o.addEventListener(s, r, { passive: !1 });
642
- }), () => {
643
- n.forEach((s) => {
644
- o.removeEventListener(s, r);
645
- });
646
- };
647
- }, [t, e, n]);
648
- }
649
- function Oe(t, e, n) {
650
- const { onMove: o, onUp: r, onCancel: s, pointerId: u, capturePointer: c = !0, preventDefaults: a = !0 } = n;
651
- et(e, { onMove: o, onUp: r, onCancel: s }), Ge(t, e ? c : !1, u), We(t, e ? a : !1);
652
- }
653
- const Be = (t) => {
654
- const e = i.useRef(null), n = i.useRef(null), o = i.useRef(0), [r, s] = i.useState(!1), u = W((f) => {
655
- t.onResize?.(f);
656
- }), c = i.useCallback(
657
- (f) => t.axis === "x" ? f.clientX : f.clientY,
658
- [t.axis]
659
- ), a = i.useCallback(
660
- (f) => {
661
- f.preventDefault(), e.current = f.currentTarget, n.current = f.pointerId, o.current = c(f), s(!0);
662
- },
663
- [c]
664
- ), l = i.useCallback(
665
- (f) => {
666
- const m = c(f), w = m - o.current;
667
- w !== 0 && (o.current = m, u(w));
668
- },
669
- [c, u]
670
- ), g = i.useCallback(() => {
671
- s(!1), n.current = null;
672
- }, []);
673
- return Oe(e, r, {
674
- onMove: l,
675
- onUp: g,
676
- pointerId: n.current ?? void 0,
677
- capturePointer: !0,
678
- preventDefaults: !1
679
- }), {
680
- ref: e,
681
- onPointerDown: a,
682
- isDragging: r
683
- };
684
- }, Ye = ({
685
- element: t,
686
- component: e
687
- }) => i.forwardRef(({ children: n, ...o }, r) => t ? i.cloneElement(
688
- t,
689
- { ...o, ref: r },
690
- n ?? t.props.children
691
- ) : e ? /* @__PURE__ */ h(e, { ...o, ref: r, children: n }) : /* @__PURE__ */ h("div", { ...o, ref: r, children: n }));
692
- function Ve({
693
- element: t,
694
- component: e
695
- }) {
696
- return i.useMemo(
697
- () => Ye({
698
- element: t,
699
- component: e
700
- }),
701
- [e, t]
702
- );
703
- }
704
- const Xe = {
705
- position: "absolute",
706
- zIndex: re
707
- }, Ue = {
708
- vertical: {
709
- width: ut,
710
- height: "100%",
711
- top: 0,
712
- cursor: "col-resize"
713
- },
714
- horizontal: {
715
- width: "100%",
716
- height: ut,
717
- left: 0,
718
- cursor: "row-resize"
719
- }
720
- }, je = {
721
- idle: oe,
722
- hovered: ne,
723
- dragging: ee
724
- }, Ke = ({
725
- direction: t,
726
- onResize: e,
727
- component: n,
728
- element: o,
729
- children: r
730
- }) => {
731
- const s = t === "vertical" ? "x" : "y", { ref: u, isDragging: c, onPointerDown: a } = Be({ axis: s, onResize: e }), [l, g] = i.useState(!1), f = i.useCallback(() => {
732
- g(!0);
733
- }, []), m = i.useCallback(() => {
734
- g(!1);
735
- }, []), w = Ve({
736
- element: o,
737
- component: n
738
- }), C = i.useMemo(() => c ? "dragging" : l ? "hovered" : "idle", [c, l]), z = i.useMemo(() => ({
739
- ...Xe,
740
- ...Ue[t],
741
- backgroundColor: je[C],
742
- touchAction: "none"
743
- }), [t, C]);
744
- return /* @__PURE__ */ h(
745
- w,
746
- {
747
- ref: u,
748
- style: z,
749
- role: "separator",
750
- "aria-orientation": t,
751
- "aria-hidden": void 0,
752
- "data-resize-handle": "true",
753
- "data-direction": t,
754
- "data-is-dragging": c ? "true" : void 0,
755
- onPointerDown: a,
756
- onPointerEnter: f,
757
- onPointerLeave: m,
758
- children: r
759
- }
760
- );
761
- }, ht = {
762
- position: "absolute",
763
- pointerEvents: "auto"
764
- }, mt = ({
765
- direction: t,
766
- trackIndex: e,
767
- align: n,
768
- gap: o,
769
- span: r,
770
- onResize: s
771
- }) => {
772
- const u = t === "col" ? "vertical" : "horizontal", c = i.useCallback(
773
- (g) => {
774
- const f = n === "start" ? -g : g;
775
- s(t, e, f);
776
- },
777
- [n, t, e, s]
778
- ), a = i.useMemo(() => t === "col" ? {
779
- gridColumn: `${e + 1} / ${e + 2}`,
780
- gridRow: `${r.start} / ${r.end}`
781
- } : {
782
- gridRow: `${e + 1} / ${e + 2}`,
783
- gridColumn: `${r.start} / ${r.end}`
784
- }, [t, e, r]), l = i.useMemo(() => {
785
- const f = Math.max(0, o) / 2 + Q / 2;
786
- return t === "col" ? {
787
- ...ht,
788
- width: Q,
789
- height: "100%",
790
- top: 0,
791
- bottom: 0,
792
- ...n === "start" ? { left: -f } : { right: -f }
793
- } : {
794
- ...ht,
795
- width: "100%",
796
- height: Q,
797
- left: 0,
798
- right: 0,
799
- ...n === "start" ? { top: -f } : { bottom: -f }
800
- };
801
- }, [n, t, o]);
802
- return /* @__PURE__ */ h("div", { "data-resizable": "true", style: { ...a, position: "relative", pointerEvents: "none" }, children: /* @__PURE__ */ h("div", { "data-direction": u, "data-align": n, "data-handle": "true", style: l, children: /* @__PURE__ */ h(Ke, { direction: u, onResize: c }) }) });
803
- }, Ze = (t) => {
804
- const e = /* @__PURE__ */ new Map();
805
- t.forEach((o, r) => {
806
- o.forEach((s, u) => {
807
- if (!s || s === ".")
808
- return;
809
- const c = e.get(s);
810
- if (c) {
811
- const l = {
812
- rowStart: Math.min(c.rowStart, r),
813
- rowEnd: Math.max(c.rowEnd, r),
814
- colStart: Math.min(c.colStart, u),
815
- colEnd: Math.max(c.colEnd, u)
816
- };
817
- e.set(s, l);
818
- return;
819
- }
820
- const a = {
821
- rowStart: r,
822
- rowEnd: r,
823
- colStart: u,
824
- colEnd: u
825
- };
826
- e.set(s, a);
827
- });
828
- });
829
- const n = /* @__PURE__ */ new Map();
830
- return e.forEach((o, r) => {
831
- const s = o.rowStart + 1, u = o.rowEnd + 2, c = o.colStart + 1, a = o.colEnd + 2, l = {
832
- gridArea: r,
833
- gridRow: `${s} / ${u}`,
834
- gridColumn: `${c} / ${a}`
835
- };
836
- n.set(r, l);
837
- }), n;
838
- }, qe = (t, e) => {
839
- if ((t.positionMode ?? "grid") !== "grid")
840
- return t;
841
- const o = t.gridArea ?? t.id, r = e.get(o);
842
- if (!r)
843
- return t;
844
- const s = !t.gridArea, u = !t.gridRow, c = !t.gridColumn;
845
- return !s && !u && !c ? t : {
846
- ...t,
847
- gridArea: s ? r.gridArea : t.gridArea,
848
- gridRow: u ? r.gridRow : t.gridRow,
849
- gridColumn: c ? r.gridColumn : t.gridColumn
850
- };
851
- }, Je = (t, e) => {
852
- const n = i.useMemo(() => Ze(t.areas), [t.areas]), o = i.useMemo(() => e.map((c) => qe(c, n)), [e, n]), r = i.useMemo(
853
- () => o.filter((c) => c.visible !== !1),
854
- [o]
855
- ), s = i.useMemo(
856
- () => r.filter((c) => !c.drawer),
857
- [r]
858
- ), u = i.useMemo(() => {
859
- const c = /* @__PURE__ */ new Map();
860
- return o.forEach((a) => {
861
- c.set(a.id, a);
862
- }), c;
863
- }, [o]);
864
- return {
865
- normalizedLayers: o,
866
- visibleLayers: r,
867
- regularLayers: s,
868
- layerById: u
869
- };
870
- }, Qe = (t) => {
871
- if (!t)
872
- return { rowGap: 0, columnGap: 0 };
873
- const e = t.split(/\s+/).map((o) => o.trim()).filter(Boolean), n = (o) => {
874
- const r = o.match(/^(-?\d+(?:\.\d+)?)px$/);
875
- return r ? Number.parseFloat(r[1]) : 0;
876
- };
877
- if (e.length === 1) {
878
- const o = n(e[0]);
879
- return { rowGap: o, columnGap: o };
880
- }
881
- return {
882
- rowGap: n(e[0]),
883
- columnGap: n(e[1])
884
- };
885
- }, tn = (t, e) => {
886
- if (!t)
887
- return [];
888
- const n = getComputedStyle(t);
889
- return (e === "col" ? n.gridTemplateColumns : n.gridTemplateRows).split(/\s+/).map((r) => parseFloat(r)).filter((r) => !Number.isNaN(r));
890
- }, Yt = (t, e = Number.NEGATIVE_INFINITY, n = Number.POSITIVE_INFINITY) => Math.min(Math.max(t, e), n), jn = (t, e) => typeof t != "number" || !Number.isFinite(t) ? e : t, K = (t, e) => `${t}-${e}`, en = (t, e, n, o) => {
891
- const r = K(n, o), s = e[r];
892
- return s !== void 0 ? `minmax(${t.minSize ?? 0}px, ${s}px)` : t.size;
893
- }, wt = (t, e, n) => t.map((o, r) => en(o, e, n, r)).join(" "), X = (t, e) => t.reduce((n, o, r) => (o.resizable && o.size.endsWith("px") && (n[K(e, r)] = parseInt(o.size, 10)), n), {}), nn = ({
894
- trackSizes: t,
895
- track: e,
896
- direction: n,
897
- trackIndex: o,
898
- containerRef: r
899
- }) => {
900
- const s = K(n, o), u = t[s];
901
- if (u !== void 0)
902
- return u;
903
- const a = tn(r?.current ?? null, n)[o];
904
- return a !== void 0 && a > 0 ? a : e.size.endsWith("px") ? Number.parseInt(e.size, 10) : 300;
905
- }, on = (t, e) => t.reduce((n, o, r) => r === e ? n : o.size.includes("fr") ? n + 100 : n + (o.minSize ?? 50), 0), rn = ({
906
- track: t,
907
- tracks: e,
908
- trackIndex: n,
909
- direction: o,
910
- containerRef: r,
911
- gapSizes: s
912
- }) => {
913
- if (!r?.current)
914
- return t.maxSize;
915
- const u = o === "col" ? r.current.offsetWidth : r.current.offsetHeight, c = on(e, n), a = e.length - 1, l = o === "col" ? s.columnGap : s.rowGap, g = a * l, f = u - c - g;
916
- return t.maxSize !== void 0 ? Math.min(t.maxSize, f) : f;
917
- }, sn = (t, e, n) => Yt(t, e ?? Number.NEGATIVE_INFINITY, n ?? Number.POSITIVE_INFINITY), bt = (t, e) => {
918
- const n = t.length, o = [];
919
- for (let u = 0; u < n; u++) {
920
- const c = t[u], a = c[e], l = c[e + 1];
921
- a !== l && o.push(u);
922
- }
923
- if (o.length === 0)
924
- return { start: 1, end: n + 1 };
925
- const r = Math.min(...o), s = Math.max(...o);
926
- return { start: r + 1, end: s + 2 };
927
- }, vt = (t, e) => {
928
- const n = t[e], o = t[e + 1], r = n?.length ?? 0, s = [];
929
- for (let a = 0; a < r; a++) {
930
- const l = n?.[a], g = o?.[a];
931
- l !== g && s.push(a);
932
- }
933
- if (s.length === 0)
934
- return { start: 1, end: r + 1 };
935
- const u = Math.min(...s), c = Math.max(...s);
936
- return { start: u + 1, end: c + 2 };
937
- }, an = (t, e) => {
938
- if (t.length === 0)
939
- return [];
940
- const n = e.length;
941
- if (t.length === 1)
942
- return t[0]?.resizable ? [{ trackIndex: 0, align: "end", span: { start: 1, end: n + 1 } }] : [];
943
- const o = [];
944
- return Array.from({ length: t.length - 1 }, (s, u) => u).forEach((s) => {
945
- const u = t[s];
946
- if (t[s + 1]?.resizable) {
947
- const a = bt(e, s);
948
- o.push({ trackIndex: s + 1, align: "start", span: a });
949
- return;
950
- }
951
- if (u?.resizable) {
952
- const a = bt(e, s);
953
- o.push({ trackIndex: s, align: "end", span: a });
954
- }
955
- }), o;
956
- }, cn = (t, e) => {
957
- if (t.length === 0)
958
- return [];
959
- const n = e[0]?.length ?? 0;
960
- if (t.length === 1)
961
- return t[0]?.resizable ? [{ trackIndex: 0, align: "end", span: { start: 1, end: n + 1 } }] : [];
962
- const o = [];
963
- return Array.from({ length: t.length - 1 }, (s, u) => u).forEach((s) => {
964
- const u = t[s];
965
- if (t[s + 1]?.resizable) {
966
- const a = vt(e, s);
967
- o.push({ trackIndex: s + 1, align: "start", span: a });
968
- return;
969
- }
970
- if (u?.resizable) {
971
- const a = vt(e, s);
972
- o.push({ trackIndex: s, align: "end", span: a });
973
- }
974
- }), o;
975
- }, un = (t) => t !== void 0 ? { gap: t } : {}, ln = (t, e) => {
976
- const n = Object.keys(e), o = {};
977
- for (const g of n)
978
- o[g] = t[g] ?? e[g];
979
- const r = Object.keys(t), s = r.length !== n.length, u = r.some(
980
- (g) => !Object.prototype.hasOwnProperty.call(o, g)
981
- ), c = s ? !0 : u, a = n.some((g) => t[g] !== o[g]);
982
- return (c ? !0 : a) ? o : null;
983
- }, dn = (t, e, n) => {
984
- const [o, r] = i.useState(() => ({
985
- ...X(t.columns, "col"),
986
- ...X(t.rows, "row")
987
- }));
988
- It(() => {
989
- const f = {
990
- ...X(t.columns, "col"),
991
- ...X(t.rows, "row")
992
- };
993
- r((m) => ln(m, f) ?? m);
994
- }, [t.columns, t.rows]);
995
- const s = i.useMemo(() => t.areas.map((f) => `"${f.join(" ")}"`).join(" "), [t.areas]), u = i.useMemo(() => Qe(t.gap), [t.gap]), c = i.useMemo(
996
- () => an(t.columns, t.areas),
997
- [t.columns, t.areas]
998
- ), a = i.useMemo(
999
- () => cn(t.rows, t.areas),
1000
- [t.rows, t.areas]
1001
- ), l = i.useMemo(() => ({
1002
- ...t.style,
1003
- ...e,
1004
- gridTemplateAreas: s,
1005
- gridTemplateRows: wt(t.rows, o, "row"),
1006
- gridTemplateColumns: wt(t.columns, o, "col"),
1007
- ...un(t.gap)
1008
- }), [s, t.columns, t.gap, t.rows, t.style, e, o]), g = i.useCallback(
1009
- (f, m, w) => {
1010
- const C = f === "row" ? t.rows : t.columns, z = C[m];
1011
- if (!z || !z.resizable)
1012
- return;
1013
- const y = nn({
1014
- trackSizes: o,
1015
- track: z,
1016
- direction: f,
1017
- trackIndex: m,
1018
- containerRef: n
1019
- }), L = rn({
1020
- track: z,
1021
- tracks: C,
1022
- trackIndex: m,
1023
- direction: f,
1024
- containerRef: n,
1025
- gapSizes: u
1026
- }), x = K(f, m);
1027
- r((N) => {
1028
- const M = y + w, D = sn(M, z.minSize, L);
1029
- return { ...N, [x]: D };
1030
- });
1031
- },
1032
- [t.columns, t.rows, o, n, u]
1033
- );
1034
- return {
1035
- columnHandles: c,
1036
- rowHandles: a,
1037
- gapSizes: u,
1038
- gridStyle: l,
1039
- handleResize: g
1040
- };
1041
- }, fn = (t) => t.positionMode ? t.positionMode : t.floating ? (t.floating.mode ?? "embedded") === "embedded" ? "absolute" : "relative" : "grid", gn = (t) => ({ position: t === "grid" ? "relative" : t }), pn = (t, e) => e !== "grid" ? {} : {
1042
- gridArea: t.gridArea,
1043
- gridRow: t.gridRow,
1044
- gridColumn: t.gridColumn
1045
- }, hn = (t) => t ? {
1046
- top: t.top,
1047
- right: t.right,
1048
- bottom: t.bottom,
1049
- left: t.left
1050
- } : {}, mn = (t) => t !== void 0 ? { zIndex: t } : {}, wn = (t, e) => ({
1051
- width: t,
1052
- height: e
1053
- }), bn = (t, e) => t.pointerEvents !== void 0 ? typeof t.pointerEvents == "boolean" ? { pointerEvents: t.pointerEvents ? "auto" : "none" } : { pointerEvents: t.pointerEvents } : e === "absolute" || e === "fixed" ? { pointerEvents: "auto" } : {}, vn = (t) => t.floating ? t.floating.position ?? t.floating.defaultPosition ?? t.position : t.position, Sn = (t) => {
1054
- if (t.floating) {
1055
- const e = t.floating.size ?? t.floating.defaultSize;
1056
- if (e)
1057
- return {
1058
- width: e.width,
1059
- height: e.height
1060
- };
1061
- }
1062
- return {
1063
- width: t.width,
1064
- height: t.height
1065
- };
1066
- }, Cn = (t) => t.floating?.zIndex !== void 0 ? t.floating.zIndex : t.zIndex, zn = (t) => {
1067
- const e = fn(t), n = vn(t), o = Sn(t), r = Cn(t);
1068
- return {
1069
- ...t.style,
1070
- ...gn(e),
1071
- ...pn(t, e),
1072
- ...hn(n),
1073
- ...mn(r),
1074
- ...wn(o.width, o.height),
1075
- ...bn(t, e)
1076
- };
1077
- }, En = (t) => {
1078
- const e = t.floating;
1079
- return e ? e.mode ?? "embedded" : null;
1080
- }, F = (t) => En(t) !== "embedded" ? null : t.floating ?? null, St = (t) => t instanceof HTMLElement ? ["INPUT", "TEXTAREA", "SELECT", "BUTTON"].includes(t.tagName) : !1, Ct = (t, e, n) => {
1081
- const o = e ?? Number.NEGATIVE_INFINITY, r = n ?? Number.POSITIVE_INFINITY;
1082
- return Yt(t, o, r);
1083
- }, zt = (t, e, n) => {
1084
- if (typeof t == "number" && Number.isFinite(t))
1085
- return t;
1086
- throw new Error(
1087
- `Floating layer "${n}" must provide a numeric "${e}" value when draggable mode is enabled.`
1088
- );
1089
- }, Et = (t) => {
1090
- const e = F(t);
1091
- if (!e)
1092
- throw new Error(`Floating layer "${t.id}" is missing floating configuration required for dragging.`);
1093
- const n = e.position ?? e.defaultPosition ?? t.position;
1094
- if (!n)
1095
- throw new Error(`Floating layer "${t.id}" must define position with left and top values.`);
1096
- return {
1097
- left: zt(n.left, "left", t.id),
1098
- top: zt(n.top, "top", t.id)
1099
- };
1100
- }, Rn = (t) => {
1101
- const e = F(t);
1102
- return e ? e.constraints ?? {} : {};
1103
- }, Pn = (t, e, n) => t ? t === "left" ? e - n : e + n : e, yn = (t, e, n) => t ? t === "top" ? e - n : e + n : e, Ln = (t, e, n) => !t || t === "right" ? e : e + n, Mn = (t, e, n) => !t || t === "bottom" ? e : e + n, nt = (t, e) => t ? t.dataset.layerId === e ? t : nt(t.parentElement, e) : null, ot = (t, e, n) => !t || n?.(t) ? null : e(t) ? t : ot(t.parentElement, e, n), Dn = (t) => t instanceof HTMLElement ? ot(
1104
- t,
1105
- (e) => e.dataset.dragHandle === "true",
1106
- (e) => e.dataset.dragIgnore === "true"
1107
- ) : null, Rt = (t) => t instanceof HTMLElement ? ot(
1108
- t,
1109
- (e) => e.dataset.resizeCorner !== void 0 || e.dataset.resizeEdge !== void 0
1110
- ) !== null : !1, U = (t) => {
1111
- const e = F(t);
1112
- return e ? e.resizable === !0 : !1;
1113
- }, j = (t) => {
1114
- if (!F(t))
1115
- return null;
1116
- const n = xn(t);
1117
- if (!n)
1118
- throw new Error(`Floating layer "${t.id}" must define width and height when resizable or draggable.`);
1119
- return {
1120
- width: n.width,
1121
- height: n.height
1122
- };
1123
- }, In = (t, e, n) => {
1124
- const o = t.filter(U).reduce((f, m) => {
1125
- if (n === m.id) {
1126
- const C = e[m.id];
1127
- if (C)
1128
- return f[m.id] = C, f;
1129
- }
1130
- const w = j(m);
1131
- return w && (f[m.id] = w), f;
1132
- }, {}), r = Object.keys(e), s = Object.keys(o), u = r.length !== s.length, c = r.some((f) => !Object.prototype.hasOwnProperty.call(o, f)), a = u ? !0 : c, l = s.some((f) => {
1133
- const m = e[f], w = o[f];
1134
- return !m || !w ? !0 : m.width !== w.width || m.height !== w.height;
1135
- });
1136
- return {
1137
- sizes: o,
1138
- changed: a ? !0 : l
1139
- };
1140
- }, Tn = ({
1141
- layers: t,
1142
- layerById: e,
1143
- isRootLevel: n
1144
- }) => {
1145
- const [o, r] = i.useState(null), [s, u] = i.useState(null), [c, a] = i.useState({}), [l, g] = i.useState({}), f = i.useRef(null), m = i.useRef(null), w = W((p, d) => {
1146
- e.get(p)?.floating?.onMove?.(d);
1147
- }), C = W((p, d) => {
1148
- e.get(p)?.floating?.onResize?.(d);
1149
- });
1150
- It(() => {
1151
- const { sizes: p, changed: d } = In(t, l, s);
1152
- d && g(p);
1153
- }, [t, s]);
1154
- const z = i.useCallback(
1155
- (p, d, b, v) => {
1156
- const S = Et(d), P = c[p] ?? { x: 0, y: 0 }, E = {
1157
- pointerStartX: v.clientX,
1158
- pointerStartY: v.clientY,
1159
- initialTranslationX: P.x,
1160
- initialTranslationY: P.y,
1161
- baseLeft: S.left,
1162
- baseTop: S.top,
1163
- layerId: p,
1164
- pointerId: v.pointerId,
1165
- target: b
1166
- };
1167
- if (E.target.setPointerCapture)
1168
- try {
1169
- E.target.setPointerCapture(E.pointerId);
1170
- } catch {
1171
- }
1172
- f.current = E, r(p);
1173
- },
1174
- [c]
1175
- ), y = i.useCallback(
1176
- (p) => {
1177
- const d = p.target, b = Dn(d);
1178
- if (!b)
1179
- return;
1180
- const v = b.closest("[data-layer-id]")?.getAttribute("data-layer-id");
1181
- if (!v)
1182
- return;
1183
- const S = e.get(v);
1184
- if (!S)
1185
- return;
1186
- const P = F(S);
1187
- if (!(!P || P.draggable !== !0) && !St(p.target) && !Rt(p.target) && b) {
1188
- const E = nt(b, v);
1189
- if (!E)
1190
- return;
1191
- z(v, S, E, p);
1192
- return;
1193
- }
1194
- },
1195
- [z, e]
1196
- ), L = i.useCallback(
1197
- (p, d) => {
1198
- const b = e.get(p), v = b ? F(b) : null;
1199
- if (!b || !v || v.draggable !== !0 || St(d.target) || Rt(d.target))
1200
- return;
1201
- const S = nt(d.currentTarget, p);
1202
- S && z(p, b, S, d);
1203
- },
1204
- [z, e]
1205
- ), x = i.useCallback(
1206
- (p, d, b) => {
1207
- const v = e.get(p);
1208
- if (!v || !U(v))
1209
- return;
1210
- const S = l[p] ?? j(v);
1211
- if (!S)
1212
- return;
1213
- const P = Et(v), E = Rn(v), k = c[p] ?? { x: 0, y: 0 };
1214
- if (b.stopPropagation(), b.preventDefault(), b.currentTarget.setPointerCapture)
1215
- try {
1216
- b.currentTarget.setPointerCapture(b.pointerId);
1217
- } catch {
1218
- }
1219
- m.current = {
1220
- layerId: p,
1221
- pointerId: b.pointerId,
1222
- horizontalEdge: d.horizontal,
1223
- verticalEdge: d.vertical,
1224
- startX: b.clientX,
1225
- startY: b.clientY,
1226
- startWidth: S.width,
1227
- startHeight: S.height,
1228
- startPosition: k,
1229
- baseLeft: P.left,
1230
- baseTop: P.top,
1231
- minWidth: E.minWidth,
1232
- maxWidth: E.maxWidth,
1233
- minHeight: E.minHeight,
1234
- maxHeight: E.maxHeight,
1235
- target: b.currentTarget
1236
- }, u(p);
1237
- },
1238
- [e, c, l]
1239
- ), N = i.useCallback(
1240
- (p) => {
1241
- const d = f.current;
1242
- if (!d)
1243
- return;
1244
- const b = p.clientX - d.pointerStartX, v = p.clientY - d.pointerStartY, S = {
1245
- x: d.initialTranslationX + b,
1246
- y: d.initialTranslationY + v
1247
- };
1248
- a((P) => ({ ...P, [d.layerId]: S })), w(d.layerId, {
1249
- left: d.baseLeft + S.x,
1250
- top: d.baseTop + S.y
1251
- });
1252
- },
1253
- [w]
1254
- ), M = i.useCallback(
1255
- (p) => {
1256
- const d = m.current;
1257
- if (!d || d.pointerId !== p.pointerId || !e.get(d.layerId))
1258
- return;
1259
- const v = p.clientX - d.startX, S = p.clientY - d.startY, P = Pn(d.horizontalEdge, d.startWidth, v), E = yn(d.verticalEdge, d.startHeight, S), k = Ct(P, d.minWidth, d.maxWidth), $ = Ct(E, d.minHeight, d.maxHeight), O = d.startWidth - k, Z = d.startHeight - $, it = Ln(
1260
- d.horizontalEdge,
1261
- d.startPosition.x,
1262
- O
1263
- ), Xt = Mn(d.verticalEdge, d.startPosition.y, Z), q = l[d.layerId], at = { width: k, height: $ };
1264
- (!q || q.width !== k || q.height !== $) && (g((J) => ({
1265
- ...J,
1266
- [d.layerId]: at
1267
- })), C(d.layerId, at));
1268
- const ct = c[d.layerId] ?? { x: 0, y: 0 }, B = { x: it, y: Xt };
1269
- (ct.x !== B.x || ct.y !== B.y) && (a((J) => ({
1270
- ...J,
1271
- [d.layerId]: B
1272
- })), w(d.layerId, {
1273
- left: d.baseLeft + B.x,
1274
- top: d.baseTop + B.y
1275
- }));
1276
- },
1277
- [e, c, l, w, C]
1278
- ), D = i.useCallback((p) => {
1279
- const d = f.current;
1280
- if (d) {
1281
- if (d.pointerId === p.pointerId && d.target.releasePointerCapture)
1282
- try {
1283
- d.target.releasePointerCapture(d.pointerId);
1284
- } catch {
1285
- }
1286
- f.current = null;
1287
- }
1288
- r(null);
1289
- }, []), A = i.useCallback((p) => {
1290
- const d = m.current;
1291
- if (d) {
1292
- if (d.pointerId === p.pointerId && d.target.releasePointerCapture)
1293
- try {
1294
- d.target.releasePointerCapture(d.pointerId);
1295
- } catch {
1296
- }
1297
- m.current = null;
1298
- }
1299
- u(null);
1300
- }, []);
1301
- et(o !== null, {
1302
- onMove: N,
1303
- onUp: D,
1304
- onCancel: D
1305
- }), et(s !== null, {
1306
- onMove: M,
1307
- onUp: A,
1308
- onCancel: A
1309
- });
1310
- const I = i.useCallback(
1311
- (p) => {
1312
- const d = zn(p), b = F(p);
1313
- if (!b || b.draggable !== !0)
1314
- return d;
1315
- const v = c[p.id], S = o === p.id, P = s === p.id, E = v ? { transform: `translate(${v.x}px, ${v.y}px)` } : {}, k = l[p.id], $ = U(p) ? j(p) : null, O = k ?? $, Z = O ? { width: `${O.width}px`, height: `${O.height}px` } : {};
1316
- return {
1317
- ...d,
1318
- ...Z,
1319
- ...E,
1320
- ...S || P ? { cursor: "grabbing" } : {}
1321
- };
1322
- },
1323
- [o, c, l, s]
1324
- ), R = i.useCallback(
1325
- (p) => {
1326
- if (!U(p))
1327
- return { isResizable: !1 };
1328
- const b = l[p.id], v = j(p);
1329
- return (b ?? v) !== null ? { isResizable: !0, onPointerDown: (k, $) => {
1330
- x(p.id, k, $);
1331
- } } : { isResizable: !1 };
1332
- },
1333
- [x, l]
1334
- ), rt = i.useCallback(
1335
- (p) => {
1336
- const { isResizable: d, onPointerDown: b } = R(p), v = I(p), S = s === p.id;
1337
- return {
1338
- style: v,
1339
- isResizable: d,
1340
- isResizing: S,
1341
- onResizeHandlePointerDown: (P, E) => {
1342
- b && b(P, E);
1343
- }
1344
- };
1345
- },
1346
- [I, R, s]
1347
- ), st = i.useCallback(
1348
- (p) => ({
1349
- "data-drag-handle": "true",
1350
- role: "button",
1351
- "aria-roledescription": "Drag handle",
1352
- "aria-label": "Drag layer",
1353
- onPointerDown: (d) => {
1354
- L(p, d);
1355
- }
1356
- }),
1357
- [L]
1358
- );
1359
- return {
1360
- providerValue: i.useMemo(
1361
- () => ({
1362
- handleLayerPointerDown: y,
1363
- getLayerRenderState: rt,
1364
- getLayerHandleProps: st,
1365
- isRootLevel: n
1366
- }),
1367
- [st, rt, y, n]
1368
- ),
1369
- draggingLayerId: o,
1370
- resizingLayerId: s
1371
- };
1372
- }, xn = (t) => {
1373
- if (t.floating) {
1374
- const e = t.floating.size ?? t.floating.defaultSize;
1375
- if (e)
1376
- return { width: e.width, height: e.height };
1377
- }
1378
- if (typeof t.width == "number" && typeof t.height == "number")
1379
- return { width: t.width, height: t.height };
1380
- }, Vt = {
1381
- display: "grid",
1382
- width: "100%",
1383
- height: "100%",
1384
- overflow: "hidden"
1385
- }, kn = {
1386
- touchAction: "none",
1387
- WebkitTouchCallout: "none",
1388
- WebkitUserSelect: "none",
1389
- userSelect: "none"
1390
- }, An = {
1391
- ...Vt,
1392
- overflow: "visible",
1393
- height: "auto",
1394
- minHeight: "100%"
1395
- }, Hn = (t) => t ? An : Vt, Kn = ({ config: t, layers: e, style: n, root: o = !1 }) => {
1396
- const r = i.useRef(null), { isIntersecting: s } = de(r, { threshold: 0 });
1397
- return /* @__PURE__ */ h(Ee, { config: t, layers: e, style: n, children: /* @__PURE__ */ h(Nn, { gridRef: r, isIntersecting: s, isRoot: o }) });
1398
- }, Nn = ({ gridRef: t, isIntersecting: e, isRoot: n }) => {
1399
- const { config: o, style: r, layers: s } = Ht(), { normalizedLayers: u, visibleLayers: c, regularLayers: a, layerById: l } = Je(o, s.defs), { columnHandles: g, rowHandles: f, gapSizes: m, gridStyle: w, handleResize: C } = dn(o, r, t), { providerValue: z, draggingLayerId: y, resizingLayerId: L } = Tn({
1400
- layers: u,
1401
- layerById: l,
1402
- isRootLevel: n
1403
- }), x = y ? !0 : !!L, N = i.useMemo(() => ({
1404
- ...Hn(n),
1405
- ...w,
1406
- ...x ? kn : {}
1407
- }), [w, x, n]);
1408
- return /* @__PURE__ */ H(_, { children: [
1409
- /* @__PURE__ */ H(
1410
- "div",
1411
- {
1412
- ref: t,
1413
- style: N,
1414
- "data-dragging": !!y,
1415
- "data-resizing": !!L,
1416
- "data-visible": e,
1417
- children: [
1418
- /* @__PURE__ */ h(ze, { value: z, children: /* @__PURE__ */ h(_e, { layers: a }) }),
1419
- g.map(({ trackIndex: M, align: D, span: A }) => /* @__PURE__ */ h(
1420
- mt,
1421
- {
1422
- direction: "col",
1423
- trackIndex: M,
1424
- align: D,
1425
- gap: m.columnGap,
1426
- span: A,
1427
- onResize: C
1428
- },
1429
- `col-${M}:${D}`
1430
- )),
1431
- f.map(({ trackIndex: M, align: D, span: A }) => /* @__PURE__ */ h(
1432
- mt,
1433
- {
1434
- direction: "row",
1435
- trackIndex: M,
1436
- align: D,
1437
- gap: m.rowGap,
1438
- span: A,
1439
- onResize: C
1440
- },
1441
- `row-${M}:${D}`
1442
- ))
1443
- ]
1444
- }
1445
- ),
1446
- /* @__PURE__ */ h(Ce, { layers: c })
1447
- ] });
1448
- };
1449
- export {
1450
- we as D,
1451
- _t as F,
1452
- Kn as G,
1453
- Ke as R,
1454
- Un as a,
1455
- kt as b,
1456
- W as c,
1457
- Ve as d,
1458
- Yt as e,
1459
- Ce as f,
1460
- Xn as g,
1461
- Tt as r,
1462
- jn as t,
1463
- Be as u
1464
- };
1465
- //# sourceMappingURL=GridLayout-CJTKq7Mp.js.map