react-panel-layout 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (466) hide show
  1. package/dist/{FloatingPanelFrame-D9Cp2al1.cjs → FloatingPanelFrame-CEmXDvUA.cjs} +2 -2
  2. package/dist/FloatingPanelFrame-CEmXDvUA.cjs.map +1 -0
  3. package/dist/{FloatingPanelFrame-6W5OexYe.js → FloatingPanelFrame-SgYLc6Ud.js} +12 -15
  4. package/dist/FloatingPanelFrame-SgYLc6Ud.js.map +1 -0
  5. package/dist/FloatingWindow-BpdOpg_L.js +400 -0
  6. package/dist/FloatingWindow-BpdOpg_L.js.map +1 -0
  7. package/dist/FloatingWindow-TCDNY5gE.cjs +2 -0
  8. package/dist/FloatingWindow-TCDNY5gE.cjs.map +1 -0
  9. package/dist/GridLayout-B4VRsC0r.cjs +2 -0
  10. package/dist/GridLayout-B4VRsC0r.cjs.map +1 -0
  11. package/dist/GridLayout-BltqeCPK.js +927 -0
  12. package/dist/GridLayout-BltqeCPK.js.map +1 -0
  13. package/dist/HorizontalDivider-B5Z-KZLk.cjs +2 -0
  14. package/dist/HorizontalDivider-B5Z-KZLk.cjs.map +1 -0
  15. package/dist/HorizontalDivider-WF1k_qND.js +30 -0
  16. package/dist/HorizontalDivider-WF1k_qND.js.map +1 -0
  17. package/dist/PanelSystem-Bs8bQwQF.cjs +3 -0
  18. package/dist/PanelSystem-Bs8bQwQF.cjs.map +1 -0
  19. package/dist/PanelSystem-Dr1TBhxM.js +1946 -0
  20. package/dist/PanelSystem-Dr1TBhxM.js.map +1 -0
  21. package/dist/ResizeHandle-CScipO5l.cjs +2 -0
  22. package/dist/ResizeHandle-CScipO5l.cjs.map +1 -0
  23. package/dist/ResizeHandle-CdA_JYfN.js +120 -0
  24. package/dist/ResizeHandle-CdA_JYfN.js.map +1 -0
  25. package/dist/SwipePivotTabBar-BGO9X94m.js +407 -0
  26. package/dist/SwipePivotTabBar-BGO9X94m.js.map +1 -0
  27. package/dist/SwipePivotTabBar-BrQismcZ.cjs +2 -0
  28. package/dist/SwipePivotTabBar-BrQismcZ.cjs.map +1 -0
  29. package/dist/config.cjs +1 -1
  30. package/dist/config.cjs.map +1 -1
  31. package/dist/config.js +11 -9
  32. package/dist/config.js.map +1 -1
  33. package/dist/constants/styles.d.ts +18 -4
  34. package/dist/floating.cjs +1 -1
  35. package/dist/floating.js +1 -1
  36. package/dist/grid/index.d.ts +58 -0
  37. package/dist/grid.cjs +2 -0
  38. package/dist/grid.cjs.map +1 -0
  39. package/dist/grid.js +13 -0
  40. package/dist/grid.js.map +1 -0
  41. package/dist/hooks/gesture/presets.d.ts +33 -0
  42. package/dist/hooks/gesture/testing/createGestureSimulator.d.ts +110 -0
  43. package/dist/hooks/gesture/thresholdValue.d.ts +44 -0
  44. package/dist/hooks/gesture/types.d.ts +254 -0
  45. package/dist/hooks/gesture/useDirectionalLock.d.ts +20 -0
  46. package/dist/hooks/gesture/useEdgeSwipeInput.d.ts +23 -0
  47. package/dist/hooks/gesture/useNativeGestureGuard.d.ts +23 -0
  48. package/dist/hooks/gesture/usePointerTracking.d.ts +22 -0
  49. package/dist/hooks/gesture/useScrollBoundary.d.ts +23 -0
  50. package/dist/hooks/gesture/useSwipeInput.d.ts +5 -0
  51. package/dist/hooks/gesture/utils.d.ts +40 -0
  52. package/dist/hooks/useAnimatedVisibility.d.ts +58 -0
  53. package/dist/hooks/useAnimationFrame.d.ts +84 -0
  54. package/dist/hooks/useSnapAnimation.d.ts +54 -0
  55. package/dist/hooks/useSwipeContentTransform.d.ts +79 -0
  56. package/dist/index.cjs +1 -2
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.d.ts +0 -1
  59. package/dist/index.js +25 -2006
  60. package/dist/index.js.map +1 -1
  61. package/dist/modules/pivot/PivotContent.d.ts +1 -1
  62. package/dist/modules/pivot/SwipePivotContent.d.ts +39 -0
  63. package/dist/modules/pivot/SwipePivotContent.debug.tmp.d.ts +25 -0
  64. package/dist/modules/pivot/SwipePivotContent.test.d.ts +1 -0
  65. package/dist/modules/pivot/SwipePivotTabBar.d.ts +89 -0
  66. package/dist/modules/pivot/index.d.ts +3 -0
  67. package/dist/modules/pivot/scaleInputState.d.ts +37 -0
  68. package/dist/modules/pivot/types.d.ts +73 -2
  69. package/dist/modules/pivot/usePivotSwipeInput.d.ts +68 -0
  70. package/dist/modules/stack/StackContent.d.ts +15 -0
  71. package/dist/modules/stack/SwipeStackContent.d.ts +63 -0
  72. package/dist/modules/stack/SwipeStackOutlet.d.ts +80 -0
  73. package/dist/modules/stack/computeStackContentState.d.ts +99 -0
  74. package/dist/modules/stack/computeSwipeStackTransform.d.ts +76 -0
  75. package/dist/modules/stack/types.d.ts +194 -0
  76. package/dist/modules/stack/useStackAnimationState.d.ts +32 -0
  77. package/dist/modules/stack/useStackNavigation.d.ts +23 -0
  78. package/dist/modules/stack/useStackSwipeInput.d.ts +27 -0
  79. package/dist/panels/index.d.ts +67 -0
  80. package/dist/panels.cjs +2 -0
  81. package/dist/panels.cjs.map +1 -0
  82. package/dist/panels.js +28 -0
  83. package/dist/panels.js.map +1 -0
  84. package/dist/pivot/index.d.ts +3 -0
  85. package/dist/pivot.cjs +1 -1
  86. package/dist/pivot.cjs.map +1 -1
  87. package/dist/pivot.js +20 -2
  88. package/dist/pivot.js.map +1 -1
  89. package/dist/resizer/index.d.ts +57 -0
  90. package/dist/resizer.cjs +2 -0
  91. package/dist/resizer.cjs.map +1 -0
  92. package/dist/resizer.js +8 -0
  93. package/dist/resizer.js.map +1 -0
  94. package/dist/stack/index.d.ts +72 -0
  95. package/dist/stack.cjs +2 -0
  96. package/dist/stack.cjs.map +1 -0
  97. package/dist/stack.js +980 -0
  98. package/dist/stack.js.map +1 -0
  99. package/dist/sticky-header/StickyArea.d.ts +38 -0
  100. package/dist/sticky-header/index.d.ts +4 -4
  101. package/dist/sticky-header/types.d.ts +35 -22
  102. package/dist/sticky-header.cjs +1 -1
  103. package/dist/sticky-header.cjs.map +1 -1
  104. package/dist/sticky-header.js +65 -174
  105. package/dist/sticky-header.js.map +1 -1
  106. package/dist/styles-DPPuJ0sf.js +57 -0
  107. package/dist/styles-DPPuJ0sf.js.map +1 -0
  108. package/dist/styles-qf6ptVLD.cjs +2 -0
  109. package/dist/styles-qf6ptVLD.cjs.map +1 -0
  110. package/dist/types.d.ts +12 -0
  111. package/dist/useContentCache-CO3LYNmz.js +24 -0
  112. package/dist/useContentCache-CO3LYNmz.js.map +1 -0
  113. package/dist/useContentCache-DqXtLrLs.cjs +2 -0
  114. package/dist/useContentCache-DqXtLrLs.cjs.map +1 -0
  115. package/dist/useDocumentPointerEvents-CKdhGXd0.js +46 -0
  116. package/dist/useDocumentPointerEvents-CKdhGXd0.js.map +1 -0
  117. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs +2 -0
  118. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs.map +1 -0
  119. package/dist/useEffectEvent-Dp7HLCf0.js +13 -0
  120. package/dist/useEffectEvent-Dp7HLCf0.js.map +1 -0
  121. package/dist/useEffectEvent-huSsGUnl.cjs +2 -0
  122. package/dist/useEffectEvent-huSsGUnl.cjs.map +1 -0
  123. package/dist/useFloatingState-C4kRaW_R.cjs +2 -0
  124. package/dist/useFloatingState-C4kRaW_R.cjs.map +1 -0
  125. package/dist/useFloatingState-tEfA_wbc.js +74 -0
  126. package/dist/useFloatingState-tEfA_wbc.js.map +1 -0
  127. package/dist/window/index.d.ts +61 -0
  128. package/dist/window.cjs +2 -0
  129. package/dist/window.cjs.map +1 -0
  130. package/dist/window.js +149 -0
  131. package/dist/window.js.map +1 -0
  132. package/docs/design-tokens.md +405 -0
  133. package/package.json +29 -4
  134. package/src/PanelSystemContext.tsx +88 -0
  135. package/src/components/grid/GridLayerList.tsx +172 -0
  136. package/src/components/grid/GridLayerResizeHandles.tsx +145 -0
  137. package/src/components/grid/GridLayout.spec.tsx +743 -0
  138. package/src/components/grid/GridLayout.tsx +130 -0
  139. package/src/components/grid/GridTrackResizeHandle.tsx +87 -0
  140. package/src/components/paneling/FloatingPanelFrame.tsx +203 -0
  141. package/src/components/panels/DropSuggestOverlay.tsx +131 -0
  142. package/src/components/panels/PanelGroupView.tsx +112 -0
  143. package/src/components/pivot/PivotLayer.tsx +27 -0
  144. package/src/components/resizer/HorizontalDivider.tsx +52 -0
  145. package/src/components/resizer/ResizeHandle.tsx +118 -0
  146. package/src/components/tabs/TabBar.tsx +223 -0
  147. package/src/components/tabs/TabBarTab.tsx +133 -0
  148. package/src/components/tabs/TabDragOverlay.tsx +92 -0
  149. package/src/components/window/DialogOverlay.tsx +180 -0
  150. package/src/components/window/Drawer.tsx +282 -0
  151. package/src/components/window/DrawerLayers.tsx +58 -0
  152. package/src/components/window/FloatingWindow.tsx +95 -0
  153. package/src/components/window/PopupLayerPortal.tsx +218 -0
  154. package/src/config/PanelContentDeclaration.tsx +427 -0
  155. package/src/config/index.tsx +52 -0
  156. package/src/config/panelJsx.spec.tsx +54 -0
  157. package/src/config/panelJsxConfig.spec.tsx +54 -0
  158. package/src/config/panelJsxDrawer.spec.tsx +33 -0
  159. package/src/config/panelRouter.spec.ts +68 -0
  160. package/src/config/panelRouter.tsx +155 -0
  161. package/src/constants/styles.ts +261 -0
  162. package/src/demo/Layout.module.css +258 -0
  163. package/src/demo/Layout.tsx +176 -0
  164. package/src/demo/components/CodeBlock.module.css +54 -0
  165. package/src/demo/components/CodeBlock.tsx +34 -0
  166. package/src/demo/components/CodePreview.module.css +37 -0
  167. package/src/demo/components/CodePreview.tsx +31 -0
  168. package/src/demo/components/DataPreview.module.css +177 -0
  169. package/src/demo/components/DataPreview.tsx +115 -0
  170. package/src/demo/components/Story.module.css +68 -0
  171. package/src/demo/components/Story.tsx +54 -0
  172. package/src/demo/components/layout/CodePanel.module.css +183 -0
  173. package/src/demo/components/layout/CodePanel.tsx +149 -0
  174. package/src/demo/components/layout/DemoPage.module.css +60 -0
  175. package/src/demo/components/layout/DemoPage.tsx +56 -0
  176. package/src/demo/components/layout/SingleSamplePage.module.css +11 -0
  177. package/src/demo/components/layout/SingleSamplePage.tsx +35 -0
  178. package/src/demo/components/layout/SplitDemoLayout.module.css +107 -0
  179. package/src/demo/components/layout/SplitDemoLayout.tsx +218 -0
  180. package/src/demo/components/layout/index.ts +11 -0
  181. package/src/demo/components/tab-styles/ChromeTabBar.module.css +75 -0
  182. package/src/demo/components/tab-styles/ChromeTabBar.tsx +111 -0
  183. package/src/demo/components/tab-styles/GitHubTabBar.module.css +81 -0
  184. package/src/demo/components/tab-styles/GitHubTabBar.tsx +109 -0
  185. package/src/demo/components/tab-styles/VSCodeTabBar.module.css +78 -0
  186. package/src/demo/components/tab-styles/VSCodeTabBar.tsx +109 -0
  187. package/src/demo/components/tab-styles/index.ts +6 -0
  188. package/src/demo/components/ui/DemoButton.module.css +63 -0
  189. package/src/demo/components/ui/DemoButton.tsx +32 -0
  190. package/src/demo/components/ui/DemoCard.module.css +15 -0
  191. package/src/demo/components/ui/DemoCard.tsx +30 -0
  192. package/src/demo/components/ui/DemoContainer.module.css +17 -0
  193. package/src/demo/components/ui/DemoContainer.tsx +30 -0
  194. package/src/demo/components/ui/DemoPanel.module.css +23 -0
  195. package/src/demo/components/ui/DemoPanel.tsx +33 -0
  196. package/src/demo/components/ui/PanelText.module.css +18 -0
  197. package/src/demo/components/ui/PanelText.tsx +29 -0
  198. package/src/demo/components/ui/PanelTitle.module.css +18 -0
  199. package/src/demo/components/ui/PanelTitle.tsx +31 -0
  200. package/src/demo/contexts/TabbarDemoConfig.tsx +218 -0
  201. package/src/demo/demo.css +172 -0
  202. package/src/demo/hooks/useMedia.ts +41 -0
  203. package/src/demo/hooks/useShikiHighlight.ts +55 -0
  204. package/src/demo/index.tsx +293 -0
  205. package/src/demo/pages/Drawer/animations/index.tsx +22 -0
  206. package/src/demo/pages/Drawer/basics/index.tsx +17 -0
  207. package/src/demo/pages/Drawer/components/DrawerAnimations.module.css +125 -0
  208. package/src/demo/pages/Drawer/components/DrawerAnimations.tsx +118 -0
  209. package/src/demo/pages/Drawer/components/DrawerBasics.module.css +55 -0
  210. package/src/demo/pages/Drawer/components/DrawerBasics.tsx +76 -0
  211. package/src/demo/pages/Drawer/components/DrawerMenuLayout.module.css +332 -0
  212. package/src/demo/pages/Drawer/components/DrawerMenuLayout.tsx +199 -0
  213. package/src/demo/pages/Drawer/menu/index.tsx +17 -0
  214. package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.module.css +163 -0
  215. package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.tsx +234 -0
  216. package/src/demo/pages/FloatingPanelFrame/basic/index.tsx +17 -0
  217. package/src/demo/pages/FloatingPanelFrame/complex/index.tsx +26 -0
  218. package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.module.css +16 -0
  219. package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.tsx +24 -0
  220. package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.module.css +54 -0
  221. package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.tsx +67 -0
  222. package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.module.css +21 -0
  223. package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.tsx +41 -0
  224. package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.module.css +5 -0
  225. package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.tsx +43 -0
  226. package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.module.css +11 -0
  227. package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.tsx +42 -0
  228. package/src/demo/pages/FloatingPanelFrame/index.tsx +80 -0
  229. package/src/demo/pages/FloatingPanelFrame/scrollable/index.tsx +30 -0
  230. package/src/demo/pages/FloatingPanelFrame/with-controls/index.tsx +30 -0
  231. package/src/demo/pages/FloatingPanelFrame/with-meta/index.tsx +17 -0
  232. package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.module.css +112 -0
  233. package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.tsx +56 -0
  234. package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.module.css +46 -0
  235. package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.tsx +29 -0
  236. package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.module.css +54 -0
  237. package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.tsx +30 -0
  238. package/src/demo/pages/HorizontalDivider/index.module.css +14 -0
  239. package/src/demo/pages/HorizontalDivider/index.tsx +64 -0
  240. package/src/demo/pages/HorizontalDivider/panels-with-rich-content/index.tsx +21 -0
  241. package/src/demo/pages/HorizontalDivider/simple-resizable-panels/index.tsx +21 -0
  242. package/src/demo/pages/HorizontalDivider/three-panel-layout/index.tsx +21 -0
  243. package/src/demo/pages/PanelLayout/PanelLayoutDemo.module.css +174 -0
  244. package/src/demo/pages/PanelLayout/PanelLayoutDemo.tsx +248 -0
  245. package/src/demo/pages/PanelLayout/components/DashboardLayout.module.css +115 -0
  246. package/src/demo/pages/PanelLayout/components/DashboardLayout.tsx +124 -0
  247. package/src/demo/pages/PanelLayout/components/DraggableOverlays.module.css +101 -0
  248. package/src/demo/pages/PanelLayout/components/DraggableOverlays.tsx +122 -0
  249. package/src/demo/pages/PanelLayout/components/IDELayout.module.css +104 -0
  250. package/src/demo/pages/PanelLayout/components/IDELayout.tsx +143 -0
  251. package/src/demo/pages/PanelLayout/components/SimpleGrid.module.css +19 -0
  252. package/src/demo/pages/PanelLayout/components/SimpleGrid.tsx +62 -0
  253. package/src/demo/pages/PanelLayout/dashboard/index.tsx +22 -0
  254. package/src/demo/pages/PanelLayout/draggable-overlays/index.tsx +22 -0
  255. package/src/demo/pages/PanelLayout/ide-layout/index.tsx +22 -0
  256. package/src/demo/pages/PanelLayout/index.tsx +94 -0
  257. package/src/demo/pages/PanelLayout/simple-grid/index.tsx +22 -0
  258. package/src/demo/pages/PanelSystem/PanelSystemPreview.module.css +20 -0
  259. package/src/demo/pages/PanelSystem/PanelSystemPreview.tsx +101 -0
  260. package/src/demo/pages/PanelSystem/preview/index.tsx +18 -0
  261. package/src/demo/pages/PanelSystem/tabbar/index.tsx +129 -0
  262. package/src/demo/pages/Pivot/basics/index.tsx +17 -0
  263. package/src/demo/pages/Pivot/components/Pivot.module.css +278 -0
  264. package/src/demo/pages/Pivot/components/PivotBasics.tsx +103 -0
  265. package/src/demo/pages/Pivot/components/PivotSidebar.tsx +168 -0
  266. package/src/demo/pages/Pivot/components/PivotTabs.tsx +129 -0
  267. package/src/demo/pages/Pivot/components/PivotTransitions.tsx +120 -0
  268. package/src/demo/pages/Pivot/components/SwipePivot.module.css +114 -0
  269. package/src/demo/pages/Pivot/components/SwipePivot.tsx +193 -0
  270. package/src/demo/pages/Pivot/components/SwipeTabsPivot.module.css +203 -0
  271. package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +289 -0
  272. package/src/demo/pages/Pivot/sidebar/index.tsx +17 -0
  273. package/src/demo/pages/Pivot/swipe/index.tsx +16 -0
  274. package/src/demo/pages/Pivot/swipe-debug/index.tsx +287 -0
  275. package/src/demo/pages/Pivot/swipe-tabs/index.tsx +15 -0
  276. package/src/demo/pages/Pivot/tabs/index.tsx +17 -0
  277. package/src/demo/pages/Pivot/transitions/index.tsx +17 -0
  278. package/src/demo/pages/ResizeHandle/both-directions/index.tsx +17 -0
  279. package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.module.css +72 -0
  280. package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.tsx +41 -0
  281. package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.module.css +61 -0
  282. package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.tsx +33 -0
  283. package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.module.css +83 -0
  284. package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.tsx +53 -0
  285. package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.module.css +68 -0
  286. package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.tsx +33 -0
  287. package/src/demo/pages/ResizeHandle/horizontal/index.tsx +17 -0
  288. package/src/demo/pages/ResizeHandle/index.module.css +11 -0
  289. package/src/demo/pages/ResizeHandle/index.tsx +71 -0
  290. package/src/demo/pages/ResizeHandle/nested-panels/index.tsx +17 -0
  291. package/src/demo/pages/ResizeHandle/vertical/index.tsx +17 -0
  292. package/src/demo/pages/ResponsiveLayout/adaptive-workspace/index.tsx +22 -0
  293. package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.module.css +423 -0
  294. package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.tsx +398 -0
  295. package/src/demo/pages/Stack/basics/index.tsx +22 -0
  296. package/src/demo/pages/Stack/components/Stack.module.css +234 -0
  297. package/src/demo/pages/Stack/components/StackBasics.tsx +217 -0
  298. package/src/demo/pages/Stack/components/StackTablet.module.css +299 -0
  299. package/src/demo/pages/Stack/components/StackTablet.tsx +401 -0
  300. package/src/demo/pages/Stack/tablet/index.tsx +22 -0
  301. package/src/demo/pages/StickyHeader/basics/index.tsx +17 -0
  302. package/src/demo/pages/StickyHeader/components/StickyHeader.module.css +219 -0
  303. package/src/demo/pages/StickyHeader/components/StickyHeaderBasics.tsx +103 -0
  304. package/src/demo/routes.tsx +193 -0
  305. package/src/demo/styles/animations.css +68 -0
  306. package/src/demo/styles/stack-themes.css +35 -0
  307. package/src/demo/utils/createPanelView.tsx +58 -0
  308. package/src/floating/index.ts +24 -0
  309. package/src/grid/index.ts +75 -0
  310. package/src/hooks/ContentCacheContext.tsx +87 -0
  311. package/src/hooks/gesture/presets.spec.ts +86 -0
  312. package/src/hooks/gesture/presets.ts +95 -0
  313. package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +237 -0
  314. package/src/hooks/gesture/testing/createGestureSimulator.ts +310 -0
  315. package/src/hooks/gesture/thresholdValue.spec.ts +103 -0
  316. package/src/hooks/gesture/thresholdValue.ts +77 -0
  317. package/src/hooks/gesture/types.ts +290 -0
  318. package/src/hooks/gesture/useDirectionalLock.spec.ts +271 -0
  319. package/src/hooks/gesture/useDirectionalLock.ts +115 -0
  320. package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +454 -0
  321. package/src/hooks/gesture/useEdgeSwipeInput.ts +131 -0
  322. package/src/hooks/gesture/useNativeGestureGuard.spec.ts +413 -0
  323. package/src/hooks/gesture/useNativeGestureGuard.ts +133 -0
  324. package/src/hooks/gesture/usePointerTracking.spec.ts +364 -0
  325. package/src/hooks/gesture/usePointerTracking.ts +134 -0
  326. package/src/hooks/gesture/useScrollBoundary.spec.ts +249 -0
  327. package/src/hooks/gesture/useScrollBoundary.ts +113 -0
  328. package/src/hooks/gesture/useSwipeInput.spec.ts +592 -0
  329. package/src/hooks/gesture/useSwipeInput.ts +310 -0
  330. package/src/hooks/gesture/utils.spec.ts +152 -0
  331. package/src/hooks/gesture/utils.ts +87 -0
  332. package/src/hooks/useAnimatedVisibility.spec.ts +257 -0
  333. package/src/hooks/useAnimatedVisibility.ts +146 -0
  334. package/src/hooks/useAnimationFrame.ts +200 -0
  335. package/src/hooks/useCSSMatrix.spec.ts +214 -0
  336. package/src/hooks/useCSSMatrix.ts +262 -0
  337. package/src/hooks/useClonedElementPreview.ts +28 -0
  338. package/src/hooks/useContainerScroll.ts +78 -0
  339. package/src/hooks/useContentCache.spec.tsx +232 -0
  340. package/src/hooks/useContentCache.tsx +127 -0
  341. package/src/hooks/useDocumentPointerEvents.ts +137 -0
  342. package/src/hooks/useDocumentScroll.ts +41 -0
  343. package/src/hooks/useEffectEvent.ts +40 -0
  344. package/src/hooks/useElementComponentWrapper.tsx +63 -0
  345. package/src/hooks/useIntersectionObserver.tsx +125 -0
  346. package/src/hooks/useIsomorphicLayoutEffect.ts +29 -0
  347. package/src/hooks/useResizeObserver.tsx +81 -0
  348. package/src/hooks/useScrollContainer.ts +79 -0
  349. package/src/hooks/useSnapAnimation.ts +128 -0
  350. package/src/hooks/useSwipeContentTransform.spec.ts +133 -0
  351. package/src/hooks/useSwipeContentTransform.ts +235 -0
  352. package/src/hooks/useTransitionState.ts +95 -0
  353. package/src/index.tsx +88 -0
  354. package/src/modules/grid/GridLayoutContext.tsx +57 -0
  355. package/src/modules/grid/LayerInstanceContext.tsx +56 -0
  356. package/src/modules/grid/resizeHandles.ts +157 -0
  357. package/src/modules/grid/trackUtils.ts +146 -0
  358. package/src/modules/grid/useGridPlacements.ts +143 -0
  359. package/src/modules/grid/useGridTracks.ts +156 -0
  360. package/src/modules/grid/useLayerDragHandle.ts +16 -0
  361. package/src/modules/grid/useLayerInteractions.tsx +850 -0
  362. package/src/modules/keybindings/KeybindingsProvider.tsx +111 -0
  363. package/src/modules/panels/dom/DomRegistry.tsx +94 -0
  364. package/src/modules/panels/index.ts +45 -0
  365. package/src/modules/panels/interactions/InteractionsContext.test.tsx +330 -0
  366. package/src/modules/panels/interactions/InteractionsContext.tsx +394 -0
  367. package/src/modules/panels/interactions/dnd.ts +28 -0
  368. package/src/modules/panels/keybindings/KeybindingsInstaller.tsx +15 -0
  369. package/src/modules/panels/layout/adapter.ts +124 -0
  370. package/src/modules/panels/rendering/ContentRegistry.spec.tsx +304 -0
  371. package/src/modules/panels/rendering/ContentRegistry.tsx +205 -0
  372. package/src/modules/panels/rendering/GroupContainer.tsx +65 -0
  373. package/src/modules/panels/rendering/RenderBridge.tsx +115 -0
  374. package/src/modules/panels/rendering/RenderContext.tsx +31 -0
  375. package/src/modules/panels/state/PanelSplitHandles.tsx +147 -0
  376. package/src/modules/panels/state/PanelSystemContext.splitLimits.spec.tsx +50 -0
  377. package/src/modules/panels/state/PanelSystemContext.tsx +289 -0
  378. package/src/modules/panels/state/StateContext.tsx +12 -0
  379. package/src/modules/panels/state/cleanup.ts +37 -0
  380. package/src/modules/panels/state/commands.ts +53 -0
  381. package/src/modules/panels/state/focus/Context.tsx +25 -0
  382. package/src/modules/panels/state/focus/logic.ts +57 -0
  383. package/src/modules/panels/state/groups/Context.tsx +25 -0
  384. package/src/modules/panels/state/groups/logic.ts +105 -0
  385. package/src/modules/panels/state/splitLimits.spec.ts +46 -0
  386. package/src/modules/panels/state/splitLimits.ts +90 -0
  387. package/src/modules/panels/state/state.spec.ts +49 -0
  388. package/src/modules/panels/state/tree/Context.tsx +24 -0
  389. package/src/modules/panels/state/tree/logic.spec.ts +34 -0
  390. package/src/modules/panels/state/tree/logic.ts +138 -0
  391. package/src/modules/panels/state/types.ts +142 -0
  392. package/src/modules/panels/system/PanelSystem.empty-tabbar.spec.tsx +53 -0
  393. package/src/modules/panels/system/PanelSystem.tab-click-activates.spec.tsx +44 -0
  394. package/src/modules/panels/system/PanelSystem.tab-reorder.spec.tsx +64 -0
  395. package/src/modules/panels/system/PanelSystem.tabs-no-dup.spec.tsx +57 -0
  396. package/src/modules/panels/system/PanelSystem.tsx +206 -0
  397. package/src/modules/pivot/PivotContent.spec.tsx +179 -0
  398. package/src/modules/pivot/PivotContent.tsx +77 -0
  399. package/src/modules/pivot/SwipePivotContent.debug.tmp.tsx +237 -0
  400. package/src/modules/pivot/SwipePivotContent.position.spec.tsx +167 -0
  401. package/src/modules/pivot/SwipePivotContent.spec.tsx +464 -0
  402. package/src/modules/pivot/SwipePivotContent.test.tsx +502 -0
  403. package/src/modules/pivot/SwipePivotContent.tsx +197 -0
  404. package/src/modules/pivot/SwipePivotTabBar.spec.tsx +865 -0
  405. package/src/modules/pivot/SwipePivotTabBar.tsx +523 -0
  406. package/src/modules/pivot/index.ts +8 -0
  407. package/src/modules/pivot/scaleInputState.spec.ts +210 -0
  408. package/src/modules/pivot/scaleInputState.ts +66 -0
  409. package/src/modules/pivot/types.ts +139 -0
  410. package/src/modules/pivot/usePivot.spec.ts +621 -0
  411. package/src/modules/pivot/usePivot.spec.tsx +186 -0
  412. package/src/modules/pivot/usePivot.tsx +345 -0
  413. package/src/modules/pivot/usePivotSwipeInput.spec.ts +649 -0
  414. package/src/modules/pivot/usePivotSwipeInput.ts +136 -0
  415. package/src/modules/resizer/useResizeDrag.ts +94 -0
  416. package/src/modules/stack/StackContent.spec.tsx +264 -0
  417. package/src/modules/stack/StackContent.tsx +111 -0
  418. package/src/modules/stack/SwipeStackContent.spec.tsx +1277 -0
  419. package/src/modules/stack/SwipeStackContent.tsx +356 -0
  420. package/src/modules/stack/SwipeStackOutlet.spec.tsx +252 -0
  421. package/src/modules/stack/SwipeStackOutlet.tsx +221 -0
  422. package/src/modules/stack/computeStackContentState.spec.ts +281 -0
  423. package/src/modules/stack/computeStackContentState.ts +304 -0
  424. package/src/modules/stack/computeSwipeStackTransform.spec.ts +186 -0
  425. package/src/modules/stack/computeSwipeStackTransform.ts +145 -0
  426. package/src/modules/stack/types.ts +226 -0
  427. package/src/modules/stack/useStackAnimationState.spec.ts +186 -0
  428. package/src/modules/stack/useStackAnimationState.ts +138 -0
  429. package/src/modules/stack/useStackNavigation.spec.ts +477 -0
  430. package/src/modules/stack/useStackNavigation.tsx +336 -0
  431. package/src/modules/stack/useStackSwipeInput.spec.ts +276 -0
  432. package/src/modules/stack/useStackSwipeInput.ts +139 -0
  433. package/src/modules/window/useDrawerState.ts +81 -0
  434. package/src/modules/window/useFloatingState.spec.ts +252 -0
  435. package/src/modules/window/useFloatingState.ts +141 -0
  436. package/src/panels/index.ts +119 -0
  437. package/src/pivot/index.ts +19 -0
  438. package/src/resizer/index.ts +68 -0
  439. package/src/stack/index.ts +91 -0
  440. package/src/sticky-header/StickyArea.tsx +221 -0
  441. package/src/sticky-header/index.ts +18 -0
  442. package/src/sticky-header/types.ts +68 -0
  443. package/src/types.ts +323 -0
  444. package/src/utils/CSSMatrix.ts +321 -0
  445. package/src/utils/css.ts +65 -0
  446. package/src/utils/dialogUtils.ts +43 -0
  447. package/src/utils/math.ts +18 -0
  448. package/src/utils/polyfills/createDialogPolyfill.ts +18 -0
  449. package/src/utils/typedActions.ts +103 -0
  450. package/src/vite-env.d.ts +6 -0
  451. package/src/window/index.ts +67 -0
  452. package/dist/FloatingPanelFrame-6W5OexYe.js.map +0 -1
  453. package/dist/FloatingPanelFrame-D9Cp2al1.cjs.map +0 -1
  454. package/dist/GridLayout-BzrIDrC9.js +0 -1465
  455. package/dist/GridLayout-BzrIDrC9.js.map +0 -1
  456. package/dist/GridLayout-ZrOhoLLB.cjs +0 -2
  457. package/dist/GridLayout-ZrOhoLLB.cjs.map +0 -1
  458. package/dist/sticky-header/StickyHeader.d.ts +0 -53
  459. package/dist/styles-CA2_zLZt.js +0 -52
  460. package/dist/styles-CA2_zLZt.js.map +0 -1
  461. package/dist/styles-PsqGOEJP.cjs +0 -2
  462. package/dist/styles-PsqGOEJP.cjs.map +0 -1
  463. package/dist/usePivot-BS-DGfwd.cjs +0 -2
  464. package/dist/usePivot-BS-DGfwd.cjs.map +0 -1
  465. package/dist/usePivot-BvOGxLQQ.js +0 -124
  466. package/dist/usePivot-BvOGxLQQ.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FloatingWindow-BpdOpg_L.js","sources":["../src/components/window/Drawer.tsx","../src/hooks/useTransitionState.ts","../src/modules/window/useDrawerState.ts","../src/components/window/DrawerLayers.tsx","../src/modules/grid/GridLayoutContext.tsx","../src/PanelSystemContext.tsx","../src/modules/grid/LayerInstanceContext.tsx","../src/components/window/PopupLayerPortal.tsx","../src/components/window/FloatingWindow.tsx"],"sourcesContent":["/**\n * @file Drawer component\n *\n * Mobile-friendly slide-in panel with backdrop support.\n */\nimport * as React from \"react\";\nimport type { DrawerBehavior, WindowPosition } from \"../../types\";\nimport {\n FloatingPanelCloseButton,\n FloatingPanelContent,\n FloatingPanelFrame,\n FloatingPanelHeader,\n FloatingPanelTitle,\n} from \"../paneling/FloatingPanelFrame\";\nimport {\n DRAWER_HEADER_PADDING_Y,\n DRAWER_HEADER_PADDING_X,\n DRAWER_HEADER_GAP,\n DRAWER_CONTENT_PADDING,\n COLOR_DRAWER_BACKDROP,\n DRAWER_TRANSITION_DURATION,\n DRAWER_TRANSITION_EASING,\n} from \"../../constants/styles\";\n\nconst drawerBackdropStyle: React.CSSProperties = {\n position: \"fixed\",\n inset: 0,\n background: COLOR_DRAWER_BACKDROP,\n};\n\nconst drawerBaseStyle: React.CSSProperties = {\n willChange: \"transform\",\n};\n\nconst drawerPlacementStyles: Record<string, React.CSSProperties> = {\n left: {\n top: 0,\n bottom: 0,\n left: 0,\n transform: \"translateX(-100%)\",\n },\n right: {\n top: 0,\n bottom: 0,\n right: 0,\n transform: \"translateX(100%)\",\n },\n top: {\n top: 0,\n left: 0,\n right: 0,\n transform: \"translateY(-100%)\",\n },\n bottom: {\n bottom: 0,\n left: 0,\n right: 0,\n transform: \"translateY(100%)\",\n },\n};\n\nconst computeTransitionValue = (\n mode: DrawerBehavior[\"transitionMode\"] | undefined,\n duration: DrawerBehavior[\"transitionDuration\"],\n easing: DrawerBehavior[\"transitionEasing\"],\n): string | undefined => {\n if (mode === \"none\") {\n return undefined;\n }\n\n const durationValue = duration ?? DRAWER_TRANSITION_DURATION;\n const easingValue = easing ?? DRAWER_TRANSITION_EASING;\n\n return `transform ${durationValue} ${easingValue}`;\n};\n\nexport type DrawerProps = {\n id: string;\n config: DrawerBehavior;\n isOpen: boolean;\n onClose: () => void;\n children: React.ReactNode;\n zIndex?: number;\n width?: string | number;\n height?: string | number;\n position?: WindowPosition;\n};\n\nconst shouldShowCloseButton = (dismissible: boolean, showClose: boolean): boolean => {\n if (!dismissible) {\n return false;\n }\n return showClose;\n};\n\ntype DrawerContentProps = {\n chrome: boolean;\n frameStyle: React.CSSProperties;\n header?: DrawerBehavior[\"header\"];\n dismissible: boolean;\n onClose: () => void;\n children: React.ReactNode;\n};\n\nconst DrawerContent: React.FC<DrawerContentProps> = ({ chrome, frameStyle, header, dismissible, onClose, children }) => {\n if (!chrome) {\n return <>{children}</>;\n }\n return (\n <FloatingPanelFrame style={frameStyle}>\n <DrawerHeaderView header={header} dismissible={dismissible} onClose={onClose} />\n <FloatingPanelContent\n style={{ padding: DRAWER_CONTENT_PADDING, flex: 1, display: \"flex\", flexDirection: \"column\" }}\n >\n {children}\n </FloatingPanelContent>\n </FloatingPanelFrame>\n );\n};\n\nconst DrawerHeaderView: React.FC<{\n header?: DrawerBehavior[\"header\"];\n dismissible: boolean;\n onClose: () => void;\n}> = ({ header, dismissible, onClose }) => {\n if (!header) {\n return null;\n }\n\n const showCloseButton = header.showCloseButton ?? true;\n const shouldShowClose = shouldShowCloseButton(dismissible, showCloseButton);\n\n return (\n <React.Activity mode={header ? \"visible\" : \"hidden\"}>\n <FloatingPanelHeader\n style={{ padding: `${DRAWER_HEADER_PADDING_Y} ${DRAWER_HEADER_PADDING_X}`, gap: DRAWER_HEADER_GAP }}\n >\n <React.Activity mode={header ? \"visible\" : \"hidden\"}>\n <FloatingPanelTitle>{header.title}</FloatingPanelTitle>\n </React.Activity>\n <React.Activity mode={shouldShowClose ? \"visible\" : \"hidden\"}>\n <FloatingPanelCloseButton\n onClick={onClose}\n aria-label=\"Close drawer\"\n style={{ marginLeft: \"auto\" }}\n />\n </React.Activity>\n </FloatingPanelHeader>\n </React.Activity>\n );\n};\n\nexport const Drawer: React.FC<DrawerProps> = ({\n id,\n config,\n isOpen,\n onClose,\n children,\n zIndex,\n width,\n height,\n position,\n}) => {\n const {\n dismissible = true,\n header,\n chrome = true,\n inline = false,\n transitionMode = \"css\",\n transitionDuration,\n transitionEasing,\n } = config;\n\n const resolvePlacement = React.useCallback(\n (anchor?: DrawerBehavior[\"anchor\"], pos?: WindowPosition): \"left\" | \"right\" | \"top\" | \"bottom\" => {\n // Prefer explicit anchor from config\n if (anchor) {\n return anchor;\n }\n // Fall back to inferring from position\n if (!pos) {\n return \"right\";\n }\n if (pos.left !== undefined) {\n return \"left\";\n }\n if (pos.right !== undefined) {\n return \"right\";\n }\n if (pos.top !== undefined) {\n return \"top\";\n }\n if (pos.bottom !== undefined) {\n return \"bottom\";\n }\n return \"right\";\n },\n [],\n );\n\n const placement = resolvePlacement(config.anchor, position);\n\n const openTransforms: Record<string, string> = {\n left: \"translateX(0)\",\n right: \"translateX(0)\",\n top: \"translateY(0)\",\n bottom: \"translateY(0)\",\n };\n\n const drawerStyle = React.useMemo((): React.CSSProperties => {\n const transitionValue = computeTransitionValue(transitionMode, transitionDuration, transitionEasing);\n\n const style: React.CSSProperties = {\n ...drawerBaseStyle,\n ...(inline ? { position: \"absolute\" } : { position: \"fixed\" }),\n ...drawerPlacementStyles[placement],\n transform: isOpen ? openTransforms[placement] : drawerPlacementStyles[placement].transform,\n transition: transitionValue,\n };\n\n if (zIndex !== undefined) {\n style.zIndex = zIndex;\n }\n\n if (width !== undefined) {\n style.width = typeof width === \"number\" ? `${width}px` : width;\n }\n if (height !== undefined) {\n style.height = typeof height === \"number\" ? `${height}px` : height;\n }\n\n return style;\n }, [height, inline, isOpen, placement, transitionDuration, transitionEasing, transitionMode, width, zIndex]);\n\n const ariaLabel = header?.title ?? config.ariaLabel ?? \"Drawer\";\n\n const backdropStyle = React.useMemo((): React.CSSProperties => {\n const base = inline ? { ...drawerBackdropStyle, position: \"absolute\" as const } : drawerBackdropStyle;\n const transitionValue = transitionMode === \"none\" ? undefined : `opacity ${transitionDuration ?? \"220ms\"} ease`;\n return {\n ...base,\n opacity: isOpen ? 1 : 0,\n pointerEvents: isOpen ? \"auto\" : \"none\",\n transition: transitionValue,\n zIndex: zIndex !== undefined ? zIndex - 1 : undefined,\n };\n }, [inline, isOpen, transitionDuration, transitionMode, zIndex]);\n\n const frameStyle = React.useMemo((): React.CSSProperties => {\n const isVertical = placement === \"left\" || placement === \"right\";\n const style: React.CSSProperties = { borderRadius: 0 };\n if (isVertical) {\n style.height = \"100%\";\n }\n return style;\n }, [placement]);\n\n return (\n <>\n <div style={backdropStyle} onClick={dismissible ? onClose : undefined} />\n <div\n data-layer-id={id}\n data-placement={placement}\n style={drawerStyle}\n role=\"dialog\"\n aria-modal={dismissible ? true : undefined}\n aria-hidden={isOpen ? undefined : true}\n aria-label={ariaLabel}\n >\n <DrawerContent\n chrome={chrome}\n frameStyle={frameStyle}\n header={header}\n dismissible={dismissible}\n onClose={onClose}\n >\n {children}\n </DrawerContent>\n </div>\n </>\n );\n};\n","/**\n * @file Generic transition state management with animation support.\n */\nimport * as React from \"react\";\n\nexport type TransitionMode = \"none\" | \"css\";\n\nexport type TransitionOptions = {\n mode?: TransitionMode;\n element?: React.RefObject<HTMLElement>;\n duration?: number;\n};\n\nexport type UseTransitionStateOptions = {\n onOpen?: (id: string) => void;\n onClose?: (id: string) => void;\n onTransitionEnd?: (id: string, isOpen: boolean) => void;\n};\n\nconst waitForTransitionEnd = (el: HTMLElement, timeout: number): Promise<void> =>\n new Promise((resolve) => {\n // eslint-disable-next-line no-restricted-syntax -- mutable flag needed for deduplication\n let resolved = false;\n const done = () => {\n if (resolved) {return;}\n resolved = true;\n el.removeEventListener(\"transitionend\", handler);\n resolve();\n };\n const handler = (e: TransitionEvent) => {\n if (e.target === el) {done();}\n };\n el.addEventListener(\"transitionend\", handler);\n setTimeout(done, timeout + 50);\n });\n\nexport const runTransition = async (\n update: () => void,\n mode: TransitionMode,\n el: HTMLElement | null | undefined,\n duration: number,\n): Promise<void> => {\n switch (mode) {\n case \"none\":\n update();\n return;\n\n case \"css\":\n update();\n if (el) {await waitForTransitionEnd(el, duration);}\n return;\n }\n};\n\nexport const useTransitionState = (options?: UseTransitionStateOptions) => {\n const [states, setStates] = React.useState<Record<string, boolean>>({});\n const optionsRef = React.useRef(options);\n optionsRef.current = options;\n\n const update = React.useCallback(\n async (id: string, isOpen: boolean, transitionOptions?: TransitionOptions) => {\n const { mode = \"none\", element, duration = 300 } = transitionOptions ?? {};\n\n const applyState = () => {\n setStates((prev) => {\n if (prev[id] === isOpen) {return prev;}\n return { ...prev, [id]: isOpen };\n });\n };\n\n await runTransition(applyState, mode, element?.current, duration);\n\n const opts = optionsRef.current;\n if (isOpen) {\n opts?.onOpen?.(id);\n } else {\n opts?.onClose?.(id);\n }\n opts?.onTransitionEnd?.(id, isOpen);\n },\n [],\n );\n\n const state = React.useCallback((id: string): boolean => states[id] ?? false, [states]);\n const open = React.useCallback(\n (id: string, opts?: TransitionOptions) => update(id, true, opts),\n [update],\n );\n const close = React.useCallback(\n (id: string, opts?: TransitionOptions) => update(id, false, opts),\n [update],\n );\n\n return { state, open, close };\n};\n","/**\n * @file Hook for managing drawer state (controlled/uncontrolled)\n */\nimport * as React from \"react\";\nimport {\n type TransitionMode,\n type TransitionOptions,\n runTransition,\n} from \"../../hooks/useTransitionState\";\nimport type { LayerDefinition } from \"../../types\";\n\nconst parseDuration = (value: string | undefined): number => {\n if (!value) {return 300;}\n const match = value.match(/(\\d+)/);\n return match ? parseInt(match[1], 10) : 300;\n};\n\nexport const useDrawerState = (layers: LayerDefinition[]) => {\n const [drawerStates, setDrawerStates] = React.useState<Record<string, boolean>>(() => {\n const initial: Record<string, boolean> = {};\n layers.forEach((layer) => {\n if (layer.drawer) {\n initial[layer.id] = layer.drawer.defaultOpen ?? false;\n }\n });\n return initial;\n });\n\n const layerMap = React.useMemo(() => {\n const map = new Map<string, LayerDefinition>();\n layers.forEach((layer) => map.set(layer.id, layer));\n return map;\n }, [layers]);\n\n const updateState = React.useCallback(\n async (layerId: string, isOpen: boolean, options?: TransitionOptions) => {\n const layer = layerMap.get(layerId);\n if (!layer?.drawer) {return;}\n\n const mode: TransitionMode = options?.mode ?? layer.drawer.transitionMode ?? \"css\";\n const duration = options?.duration ?? parseDuration(layer.drawer.transitionDuration);\n const element = options?.element?.current;\n\n const applyState = () => {\n if (layer.drawer?.open === undefined) {\n setDrawerStates((prev) => {\n if (prev[layerId] === isOpen) {return prev;}\n return { ...prev, [layerId]: isOpen };\n });\n }\n layer.drawer?.onStateChange?.(isOpen);\n };\n\n await runTransition(applyState, mode, element, duration);\n },\n [layerMap],\n );\n\n const state = React.useCallback(\n (layerId: string): boolean => {\n const layer = layerMap.get(layerId);\n if (layer?.drawer?.open !== undefined) {\n return layer.drawer.open;\n }\n return drawerStates[layerId] ?? false;\n },\n [layerMap, drawerStates],\n );\n\n const open = React.useCallback(\n (id: string, options?: TransitionOptions) => updateState(id, true, options),\n [updateState],\n );\n\n const close = React.useCallback(\n (id: string, options?: TransitionOptions) => updateState(id, false, options),\n [updateState],\n );\n\n return { state, open, close };\n};\n","/**\n * @file DrawerLayers component\n */\nimport * as React from \"react\";\nimport type { LayerDefinition } from \"../../types\";\nimport { Drawer } from \"./Drawer\";\nimport { useDrawerState } from \"../../modules/window/useDrawerState\";\n\nexport type DrawerLayersProps = {\n layers: LayerDefinition[];\n};\n\nexport const DrawerLayers: React.FC<DrawerLayersProps> = ({ layers }) => {\n const drawer = useDrawerState(layers);\n\n const drawerLayers = React.useMemo(() => layers.filter((layer) => layer.drawer), [layers]);\n\n const closeHandlers = React.useMemo(() => {\n const handlers = new Map<string, () => void>();\n drawerLayers.forEach((layer) => {\n handlers.set(layer.id, () => drawer.close(layer.id));\n });\n return handlers;\n }, [drawerLayers, drawer.close]);\n\n return (\n <>\n {drawerLayers.map((layer) => {\n if (!layer.drawer) {\n return null;\n }\n\n const isOpen = drawer.state(layer.id);\n const onClose = closeHandlers.get(layer.id);\n\n if (!onClose) {\n return null;\n }\n\n return (\n <Drawer\n key={layer.id}\n id={layer.id}\n config={layer.drawer}\n isOpen={isOpen}\n onClose={onClose}\n zIndex={layer.zIndex}\n width={layer.width}\n height={layer.height}\n position={layer.position}\n >\n {layer.component}\n </Drawer>\n );\n })}\n </>\n );\n};\n","/**\n * @file Context provider for grid layer rendering helpers.\n */\nimport * as React from \"react\";\nimport type { LayerDefinition } from \"../../types\";\n\nexport type GridLayerHandleProps = React.HTMLAttributes<HTMLElement> & {\n \"data-drag-handle\": \"true\";\n};\n\nexport type ResizeHandleConfig =\n | {\n key: \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\";\n variant: \"corner\";\n horizontal: \"left\" | \"right\";\n vertical: \"top\" | \"bottom\";\n }\n | {\n key: \"left\" | \"right\" | \"top\" | \"bottom\";\n variant: \"edge\";\n horizontal?: \"left\" | \"right\";\n vertical?: \"top\" | \"bottom\";\n };\n\nexport type GridLayerRenderState = {\n style: React.CSSProperties;\n isResizable: boolean;\n isResizing: boolean;\n onResizeHandlePointerDown: (config: ResizeHandleConfig, event: React.PointerEvent<HTMLDivElement>) => void;\n};\n\nexport type GridLayoutContextValue = {\n handleLayerPointerDown: (event: React.PointerEvent<HTMLDivElement>) => void;\n getLayerRenderState: (layer: LayerDefinition) => GridLayerRenderState;\n getLayerHandleProps: (layerId: string) => GridLayerHandleProps;\n /**\n * Whether the GridLayout is mounted at root level.\n * When true, scrollable layers should delegate to browser's native scroll.\n */\n isRootLevel: boolean;\n};\n\nconst GridLayoutContext = React.createContext<GridLayoutContextValue | null>(null);\n\nexport const GridLayoutProvider: React.FC<\n React.PropsWithChildren<{ value: GridLayoutContextValue }>\n> = ({ value, children }) => {\n return <GridLayoutContext.Provider value={value}>{children}</GridLayoutContext.Provider>;\n};\n\nexport const useGridLayoutContext = (): GridLayoutContextValue => {\n const context = React.useContext(GridLayoutContext);\n if (!context) {\n throw new Error(\"useGridLayoutContext must be used within a GridLayoutProvider.\");\n }\n return context;\n};\n","/**\n * @file PanelSystemContext\n *\n * Core provider for panel definitions and registry. Grid-specific layout and\n * interactions are composed by UI layers (e.g., GridLayout) on top of this.\n *\n * Includes content caching to preserve React component state across re-renders.\n * This is essential for maintaining internal state when parent components\n * re-create the layers array.\n */\nimport * as React from \"react\";\nimport type { PanelLayoutConfig, LayerDefinition } from \"./types\";\nimport { useContentCache } from \"./hooks/useContentCache\";\n\nexport type PanelSystemContextValue = {\n config: PanelLayoutConfig;\n style?: React.CSSProperties;\n layers: {\n /** Raw panel definitions (no grid normalization). */\n defs: LayerDefinition[];\n /** Fast lookup map by id for consumers. */\n layerById: Map<string, LayerDefinition>;\n };\n /**\n * Get cached content for a layer. Returns the same ReactNode reference\n * for the same layer ID to prevent remounting on parent re-renders.\n */\n getCachedContent: (layerId: string) => React.ReactNode | null;\n};\n\nconst PanelSystemContext = React.createContext<PanelSystemContextValue | null>(null);\n\nexport const usePanelSystem = (): PanelSystemContextValue => {\n const ctx = React.useContext(PanelSystemContext);\n if (!ctx) {\n throw new Error(\"usePanelSystem must be used within a PanelSystemProvider.\");\n }\n return ctx;\n};\n\nexport type PanelSystemProviderProps = React.PropsWithChildren<{\n config: PanelLayoutConfig;\n layers: LayerDefinition[];\n style?: React.CSSProperties;\n}>;\n\nexport const PanelSystemProvider: React.FC<PanelSystemProviderProps> = ({ config, layers, style, children }) => {\n const layerById = React.useMemo(() => {\n const map = new Map<string, LayerDefinition>();\n layers.forEach((layer) => {\n map.set(layer.id, layer);\n });\n return map;\n }, [layers]);\n\n // Content resolver for useContentCache\n const resolveContent = React.useCallback(\n (layerId: string): React.ReactNode | null => {\n const layer = layerById.get(layerId);\n return layer?.component ?? null;\n },\n [layerById],\n );\n\n // Valid IDs for cache cleanup\n const validIds = React.useMemo(() => layers.map((l) => l.id), [layers]);\n\n // Use shared content cache hook\n const { getCachedContent } = useContentCache({\n resolveContent,\n validIds,\n });\n\n const value = React.useMemo<PanelSystemContextValue>(\n () => ({\n config,\n style,\n layers: {\n defs: layers,\n layerById,\n },\n getCachedContent,\n }),\n [config, style, layers, layerById, getCachedContent],\n );\n\n return <PanelSystemContext.Provider value={value}>{children}</PanelSystemContext.Provider>;\n};\n","/**\n * @file Context exposing the current grid layer id and helpers to child components.\n */\nimport * as React from \"react\";\nimport type { LayerDefinition } from \"../../types\";\nimport { usePanelSystem } from \"../../PanelSystemContext\";\nimport { useGridLayoutContext, type GridLayerHandleProps } from \"./GridLayoutContext\";\n\ntype LayerInstanceContextValue = {\n layerId: string;\n};\n\nconst LayerInstanceContext = React.createContext<LayerInstanceContextValue | null>(null);\n\nexport type LayerInstanceProviderProps = React.PropsWithChildren<LayerInstanceContextValue>;\n\nexport const LayerInstanceProvider: React.FC<LayerInstanceProviderProps> = ({ layerId, children }) => {\n const value = React.useMemo(() => ({ layerId }), [layerId]);\n return <LayerInstanceContext.Provider value={value}>{children}</LayerInstanceContext.Provider>;\n};\n\nexport const useLayerInstance = (): LayerInstanceContextValue => {\n const value = React.useContext(LayerInstanceContext);\n if (!value) {\n throw new Error(\"useLayerInstance must be used within a LayerInstanceProvider.\");\n }\n return value;\n};\n\n/**\n * Convenience: read the current layer definition from the core registry.\n */\nexport const useCurrentLayerDefinition = (): LayerDefinition => {\n const { layerId } = useLayerInstance();\n const { layers } = usePanelSystem();\n const def = layers.layerById.get(layerId);\n if (!def) {\n throw new Error(`Layer definition not found for id: ${layerId}`);\n }\n return def;\n};\n\n/**\n * Convenience: get drag handle props, pre-bound to the current layer.\n */\nexport const useCurrentLayerHandleProps = (): GridLayerHandleProps => {\n const { layerId } = useLayerInstance();\n const { getLayerHandleProps } = useGridLayoutContext();\n return React.useMemo(() => getLayerHandleProps(layerId), [getLayerHandleProps, layerId]);\n};\n\n/**\n * Compatibility helper for existing code using useLayerDragHandle.\n * Prefer useCurrentLayerHandleProps for direct access.\n */\nexport const useLayerDragHandleProps = useCurrentLayerHandleProps;\n","/**\n * @file Renders floating layers inside a dedicated browser popup window.\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport type { LayerDefinition, PopupWindowOptions, WindowPosition, WindowBounds } from \"../../types\";\nimport { LayerInstanceProvider } from \"../../modules/grid/LayerInstanceContext\";\n\nconst ensureNumericOffset = (value: number | string | undefined, key: keyof WindowPosition, layerId: string): number => {\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return value;\n }\n throw new Error(`Popup layer \"${layerId}\" requires a numeric \"${key}\" value.`);\n};\n\nconst resolvePopupAnchor = (position: WindowPosition | undefined, layerId: string): { left: number; top: number } => {\n if (!position) {\n throw new Error(`Popup layer \"${layerId}\" must define position (left/top).`);\n }\n return {\n left: ensureNumericOffset(position.left, \"left\", layerId),\n top: ensureNumericOffset(position.top, \"top\", layerId),\n };\n};\n\nconst numericFeature = (value: number): string => {\n return `${Math.round(value)}`;\n};\n\nconst booleanFeature = (value: boolean | undefined): string | undefined => {\n if (value === undefined) {\n return undefined;\n }\n return value ? \"yes\" : \"no\";\n};\n\nconst buildWindowFeatures = (\n layerId: string,\n position: WindowPosition | undefined,\n width: number | string | undefined,\n height: number | string | undefined,\n options: PopupWindowOptions | undefined,\n): string => {\n const features: Record<string, string> = {};\n const anchor = resolvePopupAnchor(position, layerId);\n\n if (typeof width !== \"number\" || typeof height !== \"number\") {\n throw new Error(`Popup layer \"${layerId}\" requires numeric width/height.`);\n }\n features.width = numericFeature(width);\n features.height = numericFeature(height);\n features.left = numericFeature(anchor.left);\n features.top = numericFeature(anchor.top);\n\n const overrides = options?.features;\n if (overrides) {\n const toolbar = booleanFeature(overrides.toolbar);\n const menubar = booleanFeature(overrides.menubar);\n const location = booleanFeature(overrides.location);\n const status = booleanFeature(overrides.status);\n const resizable = booleanFeature(overrides.resizable);\n const scrollbars = booleanFeature(overrides.scrollbars);\n\n if (toolbar !== undefined) {\n features.toolbar = toolbar;\n }\n if (menubar !== undefined) {\n features.menubar = menubar;\n }\n if (location !== undefined) {\n features.location = location;\n }\n if (status !== undefined) {\n features.status = status;\n }\n if (resizable !== undefined) {\n features.resizable = resizable;\n }\n if (scrollbars !== undefined) {\n features.scrollbars = scrollbars;\n }\n }\n\n return Object.entries(features)\n .map(([key, value]) => `${key}=${value}`)\n .join(\",\");\n};\n\nconst applyBoundsToWindow = (\n popupWindow: Window,\n layerId: string,\n position: WindowPosition | undefined,\n width: number | string | undefined,\n height: number | string | undefined,\n) => {\n const anchor = resolvePopupAnchor(position, layerId);\n if (typeof width !== \"number\" || typeof height !== \"number\") {\n throw new Error(`Popup layer \"${layerId}\" requires numeric width/height.`);\n }\n popupWindow.moveTo(Math.round(anchor.left), Math.round(anchor.top));\n popupWindow.resizeTo(Math.round(width), Math.round(height));\n};\n\ntype PopupLayerPortalProps = {\n layer: LayerDefinition;\n};\n\nexport const PopupLayerPortal: React.FC<PopupLayerPortalProps> = ({ layer }) => {\n const floating = layer.floating;\n if (!floating) {\n throw new Error(`Layer \"${layer.id}\" is missing floating configuration required for popup mode.`);\n }\n const mode = floating.mode ?? \"embedded\";\n if (mode !== \"popup\") {\n throw new Error(`PopupLayerPortal received layer \"${layer.id}\" that is not configured for popup mode.`);\n }\n\n const containerRef = React.useRef<HTMLDivElement | null>(null);\n const popupWindowRef = React.useRef<Window | null>(null);\n const [isMounted, setIsMounted] = React.useState(false);\n\n React.useEffect(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const features = buildWindowFeatures(layer.id, layer.position, layer.width, layer.height, floating.popup);\n const windowName = floating.popup?.name ?? layer.id;\n const createdWindow = resolvePopupWindow(\n windowName,\n features,\n {\n position: layer.position,\n size: { width: layer.width as number, height: layer.height as number },\n },\n floating.popup,\n );\n\n if (!createdWindow) {\n throw new Error(`Failed to open popup window for layer \"${layer.id}\".`);\n }\n\n const openedWindow = createdWindow;\n\n popupWindowRef.current = openedWindow;\n\n if (floating.popup?.focus !== false) {\n openedWindow.focus();\n }\n\n if (!openedWindow.document.title) {\n openedWindow.document.title = layer.id;\n }\n openedWindow.document.body.innerHTML = \"\";\n const mountNode = openedWindow.document.createElement(\"div\");\n mountNode.dataset.layerId = layer.id;\n openedWindow.document.body.appendChild(mountNode);\n containerRef.current = mountNode;\n setIsMounted(true);\n\n applyBoundsToWindow(openedWindow, layer.id, layer.position, layer.width, layer.height);\n\n const handleBeforeUnload = () => {\n popupWindowRef.current = null;\n containerRef.current = null;\n setIsMounted(false);\n };\n openedWindow.addEventListener(\"beforeunload\", handleBeforeUnload);\n\n return () => {\n openedWindow.removeEventListener(\"beforeunload\", handleBeforeUnload);\n if (floating.popup?.closeOnUnmount !== false) {\n openedWindow.close();\n }\n popupWindowRef.current = null;\n containerRef.current = null;\n setIsMounted(false);\n };\n }, [\n floating.popup?.closeOnUnmount,\n floating.popup?.features?.location,\n floating.popup?.features?.menubar,\n floating.popup?.features?.resizable,\n floating.popup?.features?.scrollbars,\n floating.popup?.features?.status,\n floating.popup?.features?.toolbar,\n floating.popup?.focus,\n floating.popup?.name,\n layer.id,\n ]);\n\n React.useEffect(() => {\n const popupWindow = popupWindowRef.current;\n if (!popupWindow) {\n return;\n }\n applyBoundsToWindow(popupWindow, layer.id, layer.position, layer.width, layer.height);\n }, [layer.position?.left, layer.position?.top, layer.height, layer.width, layer.id]);\n\n if (!isMounted || !containerRef.current) {\n return null;\n }\n\n return createPortal(<LayerInstanceProvider layerId={layer.id}>{layer.component}</LayerInstanceProvider>, containerRef.current);\n};\n\nconst resolvePopupWindow = (\n windowName: string,\n features: string,\n bounds: WindowBounds,\n options: PopupWindowOptions | undefined,\n): Window | null => {\n const customFactory = options?.createWindow;\n if (customFactory) {\n return customFactory({ name: windowName, features, bounds });\n }\n return window.open(\"\", windowName, features);\n};\n","/**\n * @file FloatingWindow component with chrome support\n *\n * Renders floating panel content with optional built-in chrome (FloatingPanelFrame).\n * When chrome is enabled and header is provided, header becomes the drag handle.\n */\nimport * as React from \"react\";\nimport type { FloatingBehavior } from \"../../types\";\nimport {\n FloatingPanelCloseButton,\n FloatingPanelFrame,\n FloatingPanelHeader,\n FloatingPanelTitle,\n FloatingPanelControls,\n FloatingPanelContent,\n} from \"../paneling/FloatingPanelFrame\";\n\nexport type FloatingWindowProps = {\n id: string;\n config: FloatingBehavior;\n onClose: () => void;\n children: React.ReactNode;\n};\n\ntype CloseButtonProps = {\n onClick: () => void;\n};\n\nconst CloseButton: React.FC<CloseButtonProps> = ({ onClick }) => (\n <FloatingPanelControls>\n <FloatingPanelCloseButton onClick={onClick} aria-label=\"Close window\" data-drag-ignore=\"true\" />\n </FloatingPanelControls>\n);\n\ntype FloatingWindowHeaderProps = {\n header?: FloatingBehavior[\"header\"];\n draggable?: boolean;\n onClose: () => void;\n};\n\nconst FloatingWindowHeader: React.FC<FloatingWindowHeaderProps> = ({ header, draggable, onClose }) => {\n if (!header) {\n return null;\n }\n\n const showCloseButton = header.showCloseButton ?? false;\n const dragHandleProps = draggable ? { \"data-drag-handle\": \"true\" } : {};\n const cursorStyle = draggable ? \"grab\" : undefined;\n\n return (\n <FloatingPanelHeader {...dragHandleProps} style={{ cursor: cursorStyle }}>\n {header.title ? <FloatingPanelTitle>{header.title}</FloatingPanelTitle> : null}\n {showCloseButton ? <CloseButton onClick={onClose} /> : null}\n </FloatingPanelHeader>\n );\n};\n\ntype FloatingWindowViewProps = {\n header?: FloatingBehavior[\"header\"];\n draggable?: boolean;\n chrome: boolean;\n onClose: () => void;\n children: React.ReactNode;\n};\n\nconst FloatingWindowView: React.FC<FloatingWindowViewProps> = ({ header, draggable, chrome, onClose, children }) => {\n if (!chrome) {\n return <>{children}</>;\n }\n\n return (\n <FloatingPanelFrame style={{ height: \"100%\", width: \"100%\" }}>\n <FloatingWindowHeader header={header} draggable={draggable} onClose={onClose} />\n <FloatingPanelContent style={{ flex: 1, display: \"flex\", flexDirection: \"column\" }}>\n {children}\n </FloatingPanelContent>\n </FloatingPanelFrame>\n );\n};\n\nexport const FloatingWindow: React.FC<FloatingWindowProps> = ({ id, config, onClose, children }) => {\n const chrome = config.chrome ?? false;\n const draggable = config.draggable ?? false;\n const ariaLabel = config.header?.title ?? config.ariaLabel ?? \"Floating window\";\n\n return (\n <div data-floating-window={id} role=\"dialog\" aria-label={ariaLabel} style={{ height: \"100%\", width: \"100%\" }}>\n <FloatingWindowView header={config.header} draggable={draggable} chrome={chrome} onClose={onClose}>\n {children}\n </FloatingWindowView>\n </div>\n );\n};\n\nFloatingWindow.displayName = \"FloatingWindow\";\n"],"names":["drawerBackdropStyle","COLOR_DRAWER_BACKDROP","drawerBaseStyle","drawerPlacementStyles","computeTransitionValue","mode","duration","easing","DRAWER_TRANSITION_DURATION","DRAWER_TRANSITION_EASING","shouldShowCloseButton","dismissible","showClose","DrawerContent","chrome","frameStyle","header","onClose","children","jsxs","FloatingPanelFrame","jsx","DrawerHeaderView","FloatingPanelContent","DRAWER_CONTENT_PADDING","showCloseButton","shouldShowClose","React","FloatingPanelHeader","DRAWER_HEADER_PADDING_Y","DRAWER_HEADER_PADDING_X","DRAWER_HEADER_GAP","FloatingPanelTitle","FloatingPanelCloseButton","Drawer","id","config","isOpen","zIndex","width","height","position","inline","transitionMode","transitionDuration","transitionEasing","placement","anchor","pos","openTransforms","drawerStyle","transitionValue","style","ariaLabel","backdropStyle","base","isVertical","Fragment","waitForTransitionEnd","el","timeout","resolve","resolved","done","handler","e","runTransition","update","useTransitionState","options","states","setStates","optionsRef","transitionOptions","element","prev","opts","state","open","close","parseDuration","value","match","useDrawerState","layers","drawerStates","setDrawerStates","initial","layer","layerMap","map","updateState","layerId","DrawerLayers","drawer","drawerLayers","closeHandlers","handlers","GridLayoutContext","GridLayoutProvider","useGridLayoutContext","context","PanelSystemContext","usePanelSystem","ctx","PanelSystemProvider","layerById","resolveContent","validIds","l","getCachedContent","useContentCache","LayerInstanceContext","LayerInstanceProvider","useLayerInstance","ensureNumericOffset","key","resolvePopupAnchor","numericFeature","booleanFeature","buildWindowFeatures","features","overrides","toolbar","menubar","location","status","resizable","scrollbars","applyBoundsToWindow","popupWindow","PopupLayerPortal","floating","containerRef","popupWindowRef","isMounted","setIsMounted","windowName","createdWindow","resolvePopupWindow","openedWindow","mountNode","handleBeforeUnload","createPortal","bounds","customFactory","CloseButton","onClick","FloatingPanelControls","FloatingWindowHeader","draggable","FloatingWindowView","FloatingWindow"],"mappings":";;;;;;AAwBA,MAAMA,IAA2C;AAAA,EAC/C,UAAU;AAAA,EACV,OAAO;AAAA,EACP,YAAYC;AACd,GAEMC,KAAuC;AAAA,EAC3C,YAAY;AACd,GAEMC,IAA6D;AAAA,EACjE,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,WAAW;AAAA,EAAA;AAAA,EAEb,OAAO;AAAA,IACL,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,WAAW;AAAA,EAAA;AAAA,EAEb,KAAK;AAAA,IACH,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,WAAW;AAAA,EAAA;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A,GAClG,UAAA,gBAAAhC,EAACkI,IAAA,EAAmB,QAAQnH,EAAO,QAAQ,WAAAkH,GAAsB,QAAAxI,GAAgB,SAAAG,GAC9E,UAAAC,EAAA,CACH,EAAA,CACF;AAEJ;AAEAsI,GAAe,cAAc;"}
@@ -0,0 +1,2 @@
1
+ "use strict";const c=require("react/jsx-runtime"),O=require("react"),b=require("./FloatingPanelFrame-CEmXDvUA.cjs"),E=require("./styles-qf6ptVLD.cjs"),V=require("react-dom"),z=require("./useContentCache-DqXtLrLs.cjs");function X(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const u=X(O),y={position:"fixed",inset:0,background:E.COLOR_DRAWER_BACKDROP},Y={willChange:"transform"},F={left:{top:0,bottom:0,left:0,transform:"translateX(-100%)"},right:{top:0,bottom:0,right:0,transform:"translateX(100%)"},top:{top:0,left:0,right:0,transform:"translateY(-100%)"},bottom:{bottom:0,left:0,right:0,transform:"translateY(100%)"}},U=(t,e,o)=>{if(t==="none")return;const r=e??E.DRAWER_TRANSITION_DURATION,n=o??E.DRAWER_TRANSITION_EASING;return`transform ${r} ${n}`},K=(t,e)=>t?e:!1,J=({chrome:t,frameStyle:e,header:o,dismissible:r,onClose:n,children:i})=>t?c.jsxs(b.FloatingPanelFrame,{style:e,children:[c.jsx(Q,{header:o,dismissible:r,onClose:n}),c.jsx(b.FloatingPanelContent,{style:{padding:E.DRAWER_CONTENT_PADDING,flex:1,display:"flex",flexDirection:"column"},children:i})]}):c.jsx(c.Fragment,{children:i}),Q=({header:t,dismissible:e,onClose:o})=>{if(!t)return null;const r=t.showCloseButton??!0,n=K(e,r);return c.jsx(u.Activity,{mode:t?"visible":"hidden",children:c.jsxs(b.FloatingPanelHeader,{style:{padding:`${E.DRAWER_HEADER_PADDING_Y} ${E.DRAWER_HEADER_PADDING_X}`,gap:E.DRAWER_HEADER_GAP},children:[c.jsx(u.Activity,{mode:t?"visible":"hidden",children:c.jsx(b.FloatingPanelTitle,{children:t.title})}),c.jsx(u.Activity,{mode:n?"visible":"hidden",children:c.jsx(b.FloatingPanelCloseButton,{onClick:o,"aria-label":"Close drawer",style:{marginLeft:"auto"}})})]})})},M=({id:t,config:e,isOpen:o,onClose:r,children:n,zIndex:i,width:d,height:f,position:a})=>{const{dismissible:s=!0,header:l,chrome:p=!0,inline:w=!1,transitionMode:h="css",transitionDuration:x,transitionEasing:C}=e,v=u.useCallback((P,m)=>P||(m?m.left!==void 0?"left":m.right!==void 0?"right":m.top!==void 0?"top":m.bottom!==void 0?"bottom":"right":"right"),[])(e.anchor,a),B={left:"translateX(0)",right:"translateX(0)",top:"translateY(0)",bottom:"translateY(0)"},I=u.useMemo(()=>{const P=U(h,x,C),m={...Y,...w?{position:"absolute"}:{position:"fixed"},...F[v],transform:o?B[v]:F[v].transform,transition:P};return i!==void 0&&(m.zIndex=i),d!==void 0&&(m.width=typeof d=="number"?`${d}px`:d),f!==void 0&&(m.height=typeof f=="number"?`${f}px`:f),m},[f,w,o,v,x,C,h,d,i]),G=l?.title??e.ariaLabel??"Drawer",q=u.useMemo(()=>{const P=w?{...y,position:"absolute"}:y,m=h==="none"?void 0:`opacity ${x??"220ms"} ease`;return{...P,opacity:o?1:0,pointerEvents:o?"auto":"none",transition:m,zIndex:i!==void 0?i-1:void 0}},[w,o,x,h,i]),H=u.useMemo(()=>{const P=v==="left"||v==="right",m={borderRadius:0};return P&&(m.height="100%"),m},[v]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{style:q,onClick:s?r:void 0}),c.jsx("div",{"data-layer-id":t,"data-placement":v,style:I,role:"dialog","aria-modal":s?!0:void 0,"aria-hidden":o?void 0:!0,"aria-label":G,children:c.jsx(J,{chrome:p,frameStyle:H,header:l,dismissible:s,onClose:r,children:n})})]})},Z=(t,e)=>new Promise(o=>{let r=!1;const n=()=>{r||(r=!0,t.removeEventListener("transitionend",i),o())},i=d=>{d.target===t&&n()};t.addEventListener("transitionend",i),setTimeout(n,e+50)}),D=async(t,e,o,r)=>{switch(e){case"none":t();return;case"css":t(),o&&await Z(o,r);return}},tt=t=>{const[e,o]=u.useState({}),r=u.useRef(t);r.current=t;const n=u.useCallback(async(a,s,l)=>{const{mode:p="none",element:w,duration:h=300}=l??{};await D(()=>{o(g=>g[a]===s?g:{...g,[a]:s})},p,w?.current,h);const C=r.current;s?C?.onOpen?.(a):C?.onClose?.(a),C?.onTransitionEnd?.(a,s)},[]),i=u.useCallback(a=>e[a]??!1,[e]),d=u.useCallback((a,s)=>n(a,!0,s),[n]),f=u.useCallback((a,s)=>n(a,!1,s),[n]);return{state:i,open:d,close:f}},et=t=>{if(!t)return 300;const e=t.match(/(\d+)/);return e?parseInt(e[1],10):300},A=t=>{const[e,o]=u.useState(()=>{const a={};return t.forEach(s=>{s.drawer&&(a[s.id]=s.drawer.defaultOpen??!1)}),a}),r=u.useMemo(()=>{const a=new Map;return t.forEach(s=>a.set(s.id,s)),a},[t]),n=u.useCallback(async(a,s,l)=>{const p=r.get(a);if(!p?.drawer)return;const w=l?.mode??p.drawer.transitionMode??"css",h=l?.duration??et(p.drawer.transitionDuration),x=l?.element?.current;await D(()=>{p.drawer?.open===void 0&&o(g=>g[a]===s?g:{...g,[a]:s}),p.drawer?.onStateChange?.(s)},w,x,h)},[r]),i=u.useCallback(a=>{const s=r.get(a);return s?.drawer?.open!==void 0?s.drawer.open:e[a]??!1},[r,e]),d=u.useCallback((a,s)=>n(a,!0,s),[n]),f=u.useCallback((a,s)=>n(a,!1,s),[n]);return{state:i,open:d,close:f}},nt=({layers:t})=>{const e=A(t),o=u.useMemo(()=>t.filter(n=>n.drawer),[t]),r=u.useMemo(()=>{const n=new Map;return o.forEach(i=>{n.set(i.id,()=>e.close(i.id))}),n},[o,e.close]);return c.jsx(c.Fragment,{children:o.map(n=>{if(!n.drawer)return null;const i=e.state(n.id),d=r.get(n.id);return d?c.jsx(M,{id:n.id,config:n.drawer,isOpen:i,onClose:d,zIndex:n.zIndex,width:n.width,height:n.height,position:n.position,children:n.component},n.id):null})})},T=u.createContext(null),ot=({value:t,children:e})=>c.jsx(T.Provider,{value:t,children:e}),rt=()=>{const t=u.useContext(T);if(!t)throw new Error("useGridLayoutContext must be used within a GridLayoutProvider.");return t},W=u.createContext(null),st=()=>{const t=u.useContext(W);if(!t)throw new Error("usePanelSystem must be used within a PanelSystemProvider.");return t},it=({config:t,layers:e,style:o,children:r})=>{const n=u.useMemo(()=>{const s=new Map;return e.forEach(l=>{s.set(l.id,l)}),s},[e]),i=u.useCallback(s=>n.get(s)?.component??null,[n]),d=u.useMemo(()=>e.map(s=>s.id),[e]),{getCachedContent:f}=z.useContentCache({resolveContent:i,validIds:d}),a=u.useMemo(()=>({config:t,style:o,layers:{defs:e,layerById:n},getCachedContent:f}),[t,o,e,n,f]);return c.jsx(W.Provider,{value:a,children:r})},_=u.createContext(null),$=({layerId:t,children:e})=>{const o=u.useMemo(()=>({layerId:t}),[t]);return c.jsx(_.Provider,{value:o,children:e})},at=()=>{const t=u.useContext(_);if(!t)throw new Error("useLayerInstance must be used within a LayerInstanceProvider.");return t},L=(t,e,o)=>{if(typeof t=="number"&&Number.isFinite(t))return t;throw new Error(`Popup layer "${o}" requires a numeric "${e}" value.`)},k=(t,e)=>{if(!t)throw new Error(`Popup layer "${e}" must define position (left/top).`);return{left:L(t.left,"left",e),top:L(t.top,"top",e)}},S=t=>`${Math.round(t)}`,j=t=>{if(t!==void 0)return t?"yes":"no"},ut=(t,e,o,r,n)=>{const i={},d=k(e,t);if(typeof o!="number"||typeof r!="number")throw new Error(`Popup layer "${t}" requires numeric width/height.`);i.width=S(o),i.height=S(r),i.left=S(d.left),i.top=S(d.top);const f=n?.features;if(f){const a=j(f.toolbar),s=j(f.menubar),l=j(f.location),p=j(f.status),w=j(f.resizable),h=j(f.scrollbars);a!==void 0&&(i.toolbar=a),s!==void 0&&(i.menubar=s),l!==void 0&&(i.location=l),p!==void 0&&(i.status=p),w!==void 0&&(i.resizable=w),h!==void 0&&(i.scrollbars=h)}return Object.entries(i).map(([a,s])=>`${a}=${s}`).join(",")},R=(t,e,o,r,n)=>{const i=k(o,e);if(typeof r!="number"||typeof n!="number")throw new Error(`Popup layer "${e}" requires numeric width/height.`);t.moveTo(Math.round(i.left),Math.round(i.top)),t.resizeTo(Math.round(r),Math.round(n))},ct=({layer:t})=>{const e=t.floating;if(!e)throw new Error(`Layer "${t.id}" is missing floating configuration required for popup mode.`);if((e.mode??"embedded")!=="popup")throw new Error(`PopupLayerPortal received layer "${t.id}" that is not configured for popup mode.`);const r=u.useRef(null),n=u.useRef(null),[i,d]=u.useState(!1);return u.useEffect(()=>{if(typeof window>"u")return;const f=ut(t.id,t.position,t.width,t.height,e.popup),a=e.popup?.name??t.id,s=lt(a,f,{position:t.position,size:{width:t.width,height:t.height}},e.popup);if(!s)throw new Error(`Failed to open popup window for layer "${t.id}".`);const l=s;n.current=l,e.popup?.focus!==!1&&l.focus(),l.document.title||(l.document.title=t.id),l.document.body.innerHTML="";const p=l.document.createElement("div");p.dataset.layerId=t.id,l.document.body.appendChild(p),r.current=p,d(!0),R(l,t.id,t.position,t.width,t.height);const w=()=>{n.current=null,r.current=null,d(!1)};return l.addEventListener("beforeunload",w),()=>{l.removeEventListener("beforeunload",w),e.popup?.closeOnUnmount!==!1&&l.close(),n.current=null,r.current=null,d(!1)}},[e.popup?.closeOnUnmount,e.popup?.features?.location,e.popup?.features?.menubar,e.popup?.features?.resizable,e.popup?.features?.scrollbars,e.popup?.features?.status,e.popup?.features?.toolbar,e.popup?.focus,e.popup?.name,t.id]),u.useEffect(()=>{const f=n.current;f&&R(f,t.id,t.position,t.width,t.height)},[t.position?.left,t.position?.top,t.height,t.width,t.id]),!i||!r.current?null:V.createPortal(c.jsx($,{layerId:t.id,children:t.component}),r.current)},lt=(t,e,o,r)=>{const n=r?.createWindow;return n?n({name:t,features:e,bounds:o}):window.open("",t,e)},dt=({onClick:t})=>c.jsx(b.FloatingPanelControls,{children:c.jsx(b.FloatingPanelCloseButton,{onClick:t,"aria-label":"Close window","data-drag-ignore":"true"})}),ft=({header:t,draggable:e,onClose:o})=>{if(!t)return null;const r=t.showCloseButton??!1,n=e?{"data-drag-handle":"true"}:{},i=e?"grab":void 0;return c.jsxs(b.FloatingPanelHeader,{...n,style:{cursor:i},children:[t.title?c.jsx(b.FloatingPanelTitle,{children:t.title}):null,r?c.jsx(dt,{onClick:o}):null]})},pt=({header:t,draggable:e,chrome:o,onClose:r,children:n})=>o?c.jsxs(b.FloatingPanelFrame,{style:{height:"100%",width:"100%"},children:[c.jsx(ft,{header:t,draggable:e,onClose:r}),c.jsx(b.FloatingPanelContent,{style:{flex:1,display:"flex",flexDirection:"column"},children:n})]}):c.jsx(c.Fragment,{children:n}),N=({id:t,config:e,onClose:o,children:r})=>{const n=e.chrome??!1,i=e.draggable??!1,d=e.header?.title??e.ariaLabel??"Floating window";return c.jsx("div",{"data-floating-window":t,role:"dialog","aria-label":d,style:{height:"100%",width:"100%"},children:c.jsx(pt,{header:e.header,draggable:i,chrome:n,onClose:o,children:r})})};N.displayName="FloatingWindow";exports.Drawer=M;exports.DrawerLayers=nt;exports.FloatingWindow=N;exports.GridLayoutProvider=ot;exports.LayerInstanceProvider=$;exports.PanelSystemProvider=it;exports.PopupLayerPortal=ct;exports.runTransition=D;exports.useDrawerState=A;exports.useGridLayoutContext=rt;exports.useLayerInstance=at;exports.usePanelSystem=st;exports.useTransitionState=tt;
2
+ //# sourceMappingURL=FloatingWindow-TCDNY5gE.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FloatingWindow-TCDNY5gE.cjs","sources":["../src/components/window/Drawer.tsx","../src/hooks/useTransitionState.ts","../src/modules/window/useDrawerState.ts","../src/components/window/DrawerLayers.tsx","../src/modules/grid/GridLayoutContext.tsx","../src/PanelSystemContext.tsx","../src/modules/grid/LayerInstanceContext.tsx","../src/components/window/PopupLayerPortal.tsx","../src/components/window/FloatingWindow.tsx"],"sourcesContent":["/**\n * @file Drawer component\n *\n * Mobile-friendly slide-in panel with backdrop support.\n */\nimport * as React from \"react\";\nimport type { DrawerBehavior, WindowPosition } from \"../../types\";\nimport {\n FloatingPanelCloseButton,\n FloatingPanelContent,\n FloatingPanelFrame,\n FloatingPanelHeader,\n FloatingPanelTitle,\n} from \"../paneling/FloatingPanelFrame\";\nimport {\n DRAWER_HEADER_PADDING_Y,\n DRAWER_HEADER_PADDING_X,\n DRAWER_HEADER_GAP,\n DRAWER_CONTENT_PADDING,\n COLOR_DRAWER_BACKDROP,\n DRAWER_TRANSITION_DURATION,\n DRAWER_TRANSITION_EASING,\n} from \"../../constants/styles\";\n\nconst drawerBackdropStyle: React.CSSProperties = {\n position: \"fixed\",\n inset: 0,\n background: COLOR_DRAWER_BACKDROP,\n};\n\nconst drawerBaseStyle: React.CSSProperties = {\n willChange: \"transform\",\n};\n\nconst drawerPlacementStyles: Record<string, React.CSSProperties> = {\n left: {\n top: 0,\n bottom: 0,\n left: 0,\n transform: \"translateX(-100%)\",\n },\n right: {\n top: 0,\n bottom: 0,\n right: 0,\n transform: \"translateX(100%)\",\n },\n top: {\n top: 0,\n left: 0,\n right: 0,\n transform: \"translateY(-100%)\",\n },\n bottom: {\n bottom: 0,\n left: 0,\n right: 0,\n transform: \"translateY(100%)\",\n },\n};\n\nconst computeTransitionValue = (\n mode: DrawerBehavior[\"transitionMode\"] | undefined,\n duration: DrawerBehavior[\"transitionDuration\"],\n easing: DrawerBehavior[\"transitionEasing\"],\n): string | undefined => {\n if (mode === \"none\") {\n return undefined;\n }\n\n const durationValue = duration ?? DRAWER_TRANSITION_DURATION;\n const easingValue = easing ?? DRAWER_TRANSITION_EASING;\n\n return `transform ${durationValue} ${easingValue}`;\n};\n\nexport type DrawerProps = {\n id: string;\n config: DrawerBehavior;\n isOpen: boolean;\n onClose: () => void;\n children: React.ReactNode;\n zIndex?: number;\n width?: string | number;\n height?: string | number;\n position?: WindowPosition;\n};\n\nconst shouldShowCloseButton = (dismissible: boolean, showClose: boolean): boolean => {\n if (!dismissible) {\n return false;\n }\n return showClose;\n};\n\ntype DrawerContentProps = {\n chrome: boolean;\n frameStyle: React.CSSProperties;\n header?: DrawerBehavior[\"header\"];\n dismissible: boolean;\n onClose: () => void;\n children: React.ReactNode;\n};\n\nconst DrawerContent: React.FC<DrawerContentProps> = ({ chrome, frameStyle, header, dismissible, onClose, children }) => {\n if (!chrome) {\n return <>{children}</>;\n }\n return (\n <FloatingPanelFrame style={frameStyle}>\n <DrawerHeaderView header={header} dismissible={dismissible} onClose={onClose} />\n <FloatingPanelContent\n style={{ padding: DRAWER_CONTENT_PADDING, flex: 1, display: \"flex\", flexDirection: \"column\" }}\n >\n {children}\n </FloatingPanelContent>\n </FloatingPanelFrame>\n );\n};\n\nconst DrawerHeaderView: React.FC<{\n header?: DrawerBehavior[\"header\"];\n dismissible: boolean;\n onClose: () => void;\n}> = ({ header, dismissible, onClose }) => {\n if (!header) {\n return null;\n }\n\n const showCloseButton = header.showCloseButton ?? true;\n const shouldShowClose = shouldShowCloseButton(dismissible, showCloseButton);\n\n return (\n <React.Activity mode={header ? \"visible\" : \"hidden\"}>\n <FloatingPanelHeader\n style={{ padding: `${DRAWER_HEADER_PADDING_Y} ${DRAWER_HEADER_PADDING_X}`, gap: DRAWER_HEADER_GAP }}\n >\n <React.Activity mode={header ? \"visible\" : \"hidden\"}>\n <FloatingPanelTitle>{header.title}</FloatingPanelTitle>\n </React.Activity>\n <React.Activity mode={shouldShowClose ? \"visible\" : \"hidden\"}>\n <FloatingPanelCloseButton\n onClick={onClose}\n aria-label=\"Close drawer\"\n style={{ marginLeft: \"auto\" }}\n />\n </React.Activity>\n </FloatingPanelHeader>\n </React.Activity>\n );\n};\n\nexport const Drawer: React.FC<DrawerProps> = ({\n id,\n config,\n isOpen,\n onClose,\n children,\n zIndex,\n width,\n height,\n position,\n}) => {\n const {\n dismissible = true,\n header,\n chrome = true,\n inline = false,\n transitionMode = \"css\",\n transitionDuration,\n transitionEasing,\n } = config;\n\n const resolvePlacement = React.useCallback(\n (anchor?: DrawerBehavior[\"anchor\"], pos?: WindowPosition): \"left\" | \"right\" | \"top\" | \"bottom\" => {\n // Prefer explicit anchor from config\n if (anchor) {\n return anchor;\n }\n // Fall back to inferring from position\n if (!pos) {\n return \"right\";\n }\n if (pos.left !== undefined) {\n return \"left\";\n }\n if (pos.right !== undefined) {\n return \"right\";\n }\n if (pos.top !== undefined) {\n return \"top\";\n }\n if (pos.bottom !== undefined) {\n return \"bottom\";\n }\n return \"right\";\n },\n [],\n );\n\n const placement = resolvePlacement(config.anchor, position);\n\n const openTransforms: Record<string, string> = {\n left: \"translateX(0)\",\n right: \"translateX(0)\",\n top: \"translateY(0)\",\n bottom: \"translateY(0)\",\n };\n\n const drawerStyle = React.useMemo((): React.CSSProperties => {\n const transitionValue = computeTransitionValue(transitionMode, transitionDuration, transitionEasing);\n\n const style: React.CSSProperties = {\n ...drawerBaseStyle,\n ...(inline ? { position: \"absolute\" } : { position: \"fixed\" }),\n ...drawerPlacementStyles[placement],\n transform: isOpen ? openTransforms[placement] : drawerPlacementStyles[placement].transform,\n transition: transitionValue,\n };\n\n if (zIndex !== undefined) {\n style.zIndex = zIndex;\n }\n\n if (width !== undefined) {\n style.width = typeof width === \"number\" ? `${width}px` : width;\n }\n if (height !== undefined) {\n style.height = typeof height === \"number\" ? `${height}px` : height;\n }\n\n return style;\n }, [height, inline, isOpen, placement, transitionDuration, transitionEasing, transitionMode, width, zIndex]);\n\n const ariaLabel = header?.title ?? config.ariaLabel ?? \"Drawer\";\n\n const backdropStyle = React.useMemo((): React.CSSProperties => {\n const base = inline ? { ...drawerBackdropStyle, position: \"absolute\" as const } : drawerBackdropStyle;\n const transitionValue = transitionMode === \"none\" ? undefined : `opacity ${transitionDuration ?? \"220ms\"} ease`;\n return {\n ...base,\n opacity: isOpen ? 1 : 0,\n pointerEvents: isOpen ? \"auto\" : \"none\",\n transition: transitionValue,\n zIndex: zIndex !== undefined ? zIndex - 1 : undefined,\n };\n }, [inline, isOpen, transitionDuration, transitionMode, zIndex]);\n\n const frameStyle = React.useMemo((): React.CSSProperties => {\n const isVertical = placement === \"left\" || placement === \"right\";\n const style: React.CSSProperties = { borderRadius: 0 };\n if (isVertical) {\n style.height = \"100%\";\n }\n return style;\n }, [placement]);\n\n return (\n <>\n <div style={backdropStyle} onClick={dismissible ? onClose : undefined} />\n <div\n data-layer-id={id}\n data-placement={placement}\n style={drawerStyle}\n role=\"dialog\"\n aria-modal={dismissible ? true : undefined}\n aria-hidden={isOpen ? undefined : true}\n aria-label={ariaLabel}\n >\n <DrawerContent\n chrome={chrome}\n frameStyle={frameStyle}\n header={header}\n dismissible={dismissible}\n onClose={onClose}\n >\n {children}\n </DrawerContent>\n </div>\n </>\n );\n};\n","/**\n * @file Generic transition state management with animation support.\n */\nimport * as React from \"react\";\n\nexport type TransitionMode = \"none\" | \"css\";\n\nexport type TransitionOptions = {\n mode?: TransitionMode;\n element?: React.RefObject<HTMLElement>;\n duration?: number;\n};\n\nexport type UseTransitionStateOptions = {\n onOpen?: (id: string) => void;\n onClose?: (id: string) => void;\n onTransitionEnd?: (id: string, isOpen: boolean) => void;\n};\n\nconst waitForTransitionEnd = (el: HTMLElement, timeout: number): Promise<void> =>\n new Promise((resolve) => {\n // eslint-disable-next-line no-restricted-syntax -- mutable flag needed for deduplication\n let resolved = false;\n const done = () => {\n if (resolved) {return;}\n resolved = true;\n el.removeEventListener(\"transitionend\", handler);\n resolve();\n };\n const handler = (e: TransitionEvent) => {\n if (e.target === el) {done();}\n };\n el.addEventListener(\"transitionend\", handler);\n setTimeout(done, timeout + 50);\n });\n\nexport const runTransition = async (\n update: () => void,\n mode: TransitionMode,\n el: HTMLElement | null | undefined,\n duration: number,\n): Promise<void> => {\n switch (mode) {\n case \"none\":\n update();\n return;\n\n case \"css\":\n update();\n if (el) {await waitForTransitionEnd(el, duration);}\n return;\n }\n};\n\nexport const useTransitionState = (options?: UseTransitionStateOptions) => {\n const [states, setStates] = React.useState<Record<string, boolean>>({});\n const optionsRef = React.useRef(options);\n optionsRef.current = options;\n\n const update = React.useCallback(\n async (id: string, isOpen: boolean, transitionOptions?: TransitionOptions) => {\n const { mode = \"none\", element, duration = 300 } = transitionOptions ?? {};\n\n const applyState = () => {\n setStates((prev) => {\n if (prev[id] === isOpen) {return prev;}\n return { ...prev, [id]: isOpen };\n });\n };\n\n await runTransition(applyState, mode, element?.current, duration);\n\n const opts = optionsRef.current;\n if (isOpen) {\n opts?.onOpen?.(id);\n } else {\n opts?.onClose?.(id);\n }\n opts?.onTransitionEnd?.(id, isOpen);\n },\n [],\n );\n\n const state = React.useCallback((id: string): boolean => states[id] ?? false, [states]);\n const open = React.useCallback(\n (id: string, opts?: TransitionOptions) => update(id, true, opts),\n [update],\n );\n const close = React.useCallback(\n (id: string, opts?: TransitionOptions) => update(id, false, opts),\n [update],\n );\n\n return { state, open, close };\n};\n","/**\n * @file Hook for managing drawer state (controlled/uncontrolled)\n */\nimport * as React from \"react\";\nimport {\n type TransitionMode,\n type TransitionOptions,\n runTransition,\n} from \"../../hooks/useTransitionState\";\nimport type { LayerDefinition } from \"../../types\";\n\nconst parseDuration = (value: string | undefined): number => {\n if (!value) {return 300;}\n const match = value.match(/(\\d+)/);\n return match ? parseInt(match[1], 10) : 300;\n};\n\nexport const useDrawerState = (layers: LayerDefinition[]) => {\n const [drawerStates, setDrawerStates] = React.useState<Record<string, boolean>>(() => {\n const initial: Record<string, boolean> = {};\n layers.forEach((layer) => {\n if (layer.drawer) {\n initial[layer.id] = layer.drawer.defaultOpen ?? false;\n }\n });\n return initial;\n });\n\n const layerMap = React.useMemo(() => {\n const map = new Map<string, LayerDefinition>();\n layers.forEach((layer) => map.set(layer.id, layer));\n return map;\n }, [layers]);\n\n const updateState = React.useCallback(\n async (layerId: string, isOpen: boolean, options?: TransitionOptions) => {\n const layer = layerMap.get(layerId);\n if (!layer?.drawer) {return;}\n\n const mode: TransitionMode = options?.mode ?? layer.drawer.transitionMode ?? \"css\";\n const duration = options?.duration ?? parseDuration(layer.drawer.transitionDuration);\n const element = options?.element?.current;\n\n const applyState = () => {\n if (layer.drawer?.open === undefined) {\n setDrawerStates((prev) => {\n if (prev[layerId] === isOpen) {return prev;}\n return { ...prev, [layerId]: isOpen };\n });\n }\n layer.drawer?.onStateChange?.(isOpen);\n };\n\n await runTransition(applyState, mode, element, duration);\n },\n [layerMap],\n );\n\n const state = React.useCallback(\n (layerId: string): boolean => {\n const layer = layerMap.get(layerId);\n if (layer?.drawer?.open !== undefined) {\n return layer.drawer.open;\n }\n return drawerStates[layerId] ?? false;\n },\n [layerMap, drawerStates],\n );\n\n const open = React.useCallback(\n (id: string, options?: TransitionOptions) => updateState(id, true, options),\n [updateState],\n );\n\n const close = React.useCallback(\n (id: string, options?: TransitionOptions) => updateState(id, false, options),\n [updateState],\n );\n\n return { state, open, close };\n};\n","/**\n * @file DrawerLayers component\n */\nimport * as React from \"react\";\nimport type { LayerDefinition } from \"../../types\";\nimport { Drawer } from \"./Drawer\";\nimport { useDrawerState } from \"../../modules/window/useDrawerState\";\n\nexport type DrawerLayersProps = {\n layers: LayerDefinition[];\n};\n\nexport const DrawerLayers: React.FC<DrawerLayersProps> = ({ layers }) => {\n const drawer = useDrawerState(layers);\n\n const drawerLayers = React.useMemo(() => layers.filter((layer) => layer.drawer), [layers]);\n\n const closeHandlers = React.useMemo(() => {\n const handlers = new Map<string, () => void>();\n drawerLayers.forEach((layer) => {\n handlers.set(layer.id, () => drawer.close(layer.id));\n });\n return handlers;\n }, [drawerLayers, drawer.close]);\n\n return (\n <>\n {drawerLayers.map((layer) => {\n if (!layer.drawer) {\n return null;\n }\n\n const isOpen = drawer.state(layer.id);\n const onClose = closeHandlers.get(layer.id);\n\n if (!onClose) {\n return null;\n }\n\n return (\n <Drawer\n key={layer.id}\n id={layer.id}\n config={layer.drawer}\n isOpen={isOpen}\n onClose={onClose}\n zIndex={layer.zIndex}\n width={layer.width}\n height={layer.height}\n position={layer.position}\n >\n {layer.component}\n </Drawer>\n );\n })}\n </>\n );\n};\n","/**\n * @file Context provider for grid layer rendering helpers.\n */\nimport * as React from \"react\";\nimport type { LayerDefinition } from \"../../types\";\n\nexport type GridLayerHandleProps = React.HTMLAttributes<HTMLElement> & {\n \"data-drag-handle\": \"true\";\n};\n\nexport type ResizeHandleConfig =\n | {\n key: \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\";\n variant: \"corner\";\n horizontal: \"left\" | \"right\";\n vertical: \"top\" | \"bottom\";\n }\n | {\n key: \"left\" | \"right\" | \"top\" | \"bottom\";\n variant: \"edge\";\n horizontal?: \"left\" | \"right\";\n vertical?: \"top\" | \"bottom\";\n };\n\nexport type GridLayerRenderState = {\n style: React.CSSProperties;\n isResizable: boolean;\n isResizing: boolean;\n onResizeHandlePointerDown: (config: ResizeHandleConfig, event: React.PointerEvent<HTMLDivElement>) => void;\n};\n\nexport type GridLayoutContextValue = {\n handleLayerPointerDown: (event: React.PointerEvent<HTMLDivElement>) => void;\n getLayerRenderState: (layer: LayerDefinition) => GridLayerRenderState;\n getLayerHandleProps: (layerId: string) => GridLayerHandleProps;\n /**\n * Whether the GridLayout is mounted at root level.\n * When true, scrollable layers should delegate to browser's native scroll.\n */\n isRootLevel: boolean;\n};\n\nconst GridLayoutContext = React.createContext<GridLayoutContextValue | null>(null);\n\nexport const GridLayoutProvider: React.FC<\n React.PropsWithChildren<{ value: GridLayoutContextValue }>\n> = ({ value, children }) => {\n return <GridLayoutContext.Provider value={value}>{children}</GridLayoutContext.Provider>;\n};\n\nexport const useGridLayoutContext = (): GridLayoutContextValue => {\n const context = React.useContext(GridLayoutContext);\n if (!context) {\n throw new Error(\"useGridLayoutContext must be used within a GridLayoutProvider.\");\n }\n return context;\n};\n","/**\n * @file PanelSystemContext\n *\n * Core provider for panel definitions and registry. Grid-specific layout and\n * interactions are composed by UI layers (e.g., GridLayout) on top of this.\n *\n * Includes content caching to preserve React component state across re-renders.\n * This is essential for maintaining internal state when parent components\n * re-create the layers array.\n */\nimport * as React from \"react\";\nimport type { PanelLayoutConfig, LayerDefinition } from \"./types\";\nimport { useContentCache } from \"./hooks/useContentCache\";\n\nexport type PanelSystemContextValue = {\n config: PanelLayoutConfig;\n style?: React.CSSProperties;\n layers: {\n /** Raw panel definitions (no grid normalization). */\n defs: LayerDefinition[];\n /** Fast lookup map by id for consumers. */\n layerById: Map<string, LayerDefinition>;\n };\n /**\n * Get cached content for a layer. Returns the same ReactNode reference\n * for the same layer ID to prevent remounting on parent re-renders.\n */\n getCachedContent: (layerId: string) => React.ReactNode | null;\n};\n\nconst PanelSystemContext = React.createContext<PanelSystemContextValue | null>(null);\n\nexport const usePanelSystem = (): PanelSystemContextValue => {\n const ctx = React.useContext(PanelSystemContext);\n if (!ctx) {\n throw new Error(\"usePanelSystem must be used within a PanelSystemProvider.\");\n }\n return ctx;\n};\n\nexport type PanelSystemProviderProps = React.PropsWithChildren<{\n config: PanelLayoutConfig;\n layers: LayerDefinition[];\n style?: React.CSSProperties;\n}>;\n\nexport const PanelSystemProvider: React.FC<PanelSystemProviderProps> = ({ config, layers, style, children }) => {\n const layerById = React.useMemo(() => {\n const map = new Map<string, LayerDefinition>();\n layers.forEach((layer) => {\n map.set(layer.id, layer);\n });\n return map;\n }, [layers]);\n\n // Content resolver for useContentCache\n const resolveContent = React.useCallback(\n (layerId: string): React.ReactNode | null => {\n const layer = layerById.get(layerId);\n return layer?.component ?? null;\n },\n [layerById],\n );\n\n // Valid IDs for cache cleanup\n const validIds = React.useMemo(() => layers.map((l) => l.id), [layers]);\n\n // Use shared content cache hook\n const { getCachedContent } = useContentCache({\n resolveContent,\n validIds,\n });\n\n const value = React.useMemo<PanelSystemContextValue>(\n () => ({\n config,\n style,\n layers: {\n defs: layers,\n layerById,\n },\n getCachedContent,\n }),\n [config, style, layers, layerById, getCachedContent],\n );\n\n return <PanelSystemContext.Provider value={value}>{children}</PanelSystemContext.Provider>;\n};\n","/**\n * @file Context exposing the current grid layer id and helpers to child components.\n */\nimport * as React from \"react\";\nimport type { LayerDefinition } from \"../../types\";\nimport { usePanelSystem } from \"../../PanelSystemContext\";\nimport { useGridLayoutContext, type GridLayerHandleProps } from \"./GridLayoutContext\";\n\ntype LayerInstanceContextValue = {\n layerId: string;\n};\n\nconst LayerInstanceContext = React.createContext<LayerInstanceContextValue | null>(null);\n\nexport type LayerInstanceProviderProps = React.PropsWithChildren<LayerInstanceContextValue>;\n\nexport const LayerInstanceProvider: React.FC<LayerInstanceProviderProps> = ({ layerId, children }) => {\n const value = React.useMemo(() => ({ layerId }), [layerId]);\n return <LayerInstanceContext.Provider value={value}>{children}</LayerInstanceContext.Provider>;\n};\n\nexport const useLayerInstance = (): LayerInstanceContextValue => {\n const value = React.useContext(LayerInstanceContext);\n if (!value) {\n throw new Error(\"useLayerInstance must be used within a LayerInstanceProvider.\");\n }\n return value;\n};\n\n/**\n * Convenience: read the current layer definition from the core registry.\n */\nexport const useCurrentLayerDefinition = (): LayerDefinition => {\n const { layerId } = useLayerInstance();\n const { layers } = usePanelSystem();\n const def = layers.layerById.get(layerId);\n if (!def) {\n throw new Error(`Layer definition not found for id: ${layerId}`);\n }\n return def;\n};\n\n/**\n * Convenience: get drag handle props, pre-bound to the current layer.\n */\nexport const useCurrentLayerHandleProps = (): GridLayerHandleProps => {\n const { layerId } = useLayerInstance();\n const { getLayerHandleProps } = useGridLayoutContext();\n return React.useMemo(() => getLayerHandleProps(layerId), [getLayerHandleProps, layerId]);\n};\n\n/**\n * Compatibility helper for existing code using useLayerDragHandle.\n * Prefer useCurrentLayerHandleProps for direct access.\n */\nexport const useLayerDragHandleProps = useCurrentLayerHandleProps;\n","/**\n * @file Renders floating layers inside a dedicated browser popup window.\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport type { LayerDefinition, PopupWindowOptions, WindowPosition, WindowBounds } from \"../../types\";\nimport { LayerInstanceProvider } from \"../../modules/grid/LayerInstanceContext\";\n\nconst ensureNumericOffset = (value: number | string | undefined, key: keyof WindowPosition, layerId: string): number => {\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return value;\n }\n throw new Error(`Popup layer \"${layerId}\" requires a numeric \"${key}\" value.`);\n};\n\nconst resolvePopupAnchor = (position: WindowPosition | undefined, layerId: string): { left: number; top: number } => {\n if (!position) {\n throw new Error(`Popup layer \"${layerId}\" must define position (left/top).`);\n }\n return {\n left: ensureNumericOffset(position.left, \"left\", layerId),\n top: ensureNumericOffset(position.top, \"top\", layerId),\n };\n};\n\nconst numericFeature = (value: number): string => {\n return `${Math.round(value)}`;\n};\n\nconst booleanFeature = (value: boolean | undefined): string | undefined => {\n if (value === undefined) {\n return undefined;\n }\n return value ? \"yes\" : \"no\";\n};\n\nconst buildWindowFeatures = (\n layerId: string,\n position: WindowPosition | undefined,\n width: number | string | undefined,\n height: number | string | undefined,\n options: PopupWindowOptions | undefined,\n): string => {\n const features: Record<string, string> = {};\n const anchor = resolvePopupAnchor(position, layerId);\n\n if (typeof width !== \"number\" || typeof height !== \"number\") {\n throw new Error(`Popup layer \"${layerId}\" requires numeric width/height.`);\n }\n features.width = numericFeature(width);\n features.height = numericFeature(height);\n features.left = numericFeature(anchor.left);\n features.top = numericFeature(anchor.top);\n\n const overrides = options?.features;\n if (overrides) {\n const toolbar = booleanFeature(overrides.toolbar);\n const menubar = booleanFeature(overrides.menubar);\n const location = booleanFeature(overrides.location);\n const status = booleanFeature(overrides.status);\n const resizable = booleanFeature(overrides.resizable);\n const scrollbars = booleanFeature(overrides.scrollbars);\n\n if (toolbar !== undefined) {\n features.toolbar = toolbar;\n }\n if (menubar !== undefined) {\n features.menubar = menubar;\n }\n if (location !== undefined) {\n features.location = location;\n }\n if (status !== undefined) {\n features.status = status;\n }\n if (resizable !== undefined) {\n features.resizable = resizable;\n }\n if (scrollbars !== undefined) {\n features.scrollbars = scrollbars;\n }\n }\n\n return Object.entries(features)\n .map(([key, value]) => `${key}=${value}`)\n .join(\",\");\n};\n\nconst applyBoundsToWindow = (\n popupWindow: Window,\n layerId: string,\n position: WindowPosition | undefined,\n width: number | string | undefined,\n height: number | string | undefined,\n) => {\n const anchor = resolvePopupAnchor(position, layerId);\n if (typeof width !== \"number\" || typeof height !== \"number\") {\n throw new Error(`Popup layer \"${layerId}\" requires numeric width/height.`);\n }\n popupWindow.moveTo(Math.round(anchor.left), Math.round(anchor.top));\n popupWindow.resizeTo(Math.round(width), Math.round(height));\n};\n\ntype PopupLayerPortalProps = {\n layer: LayerDefinition;\n};\n\nexport const PopupLayerPortal: React.FC<PopupLayerPortalProps> = ({ layer }) => {\n const floating = layer.floating;\n if (!floating) {\n throw new Error(`Layer \"${layer.id}\" is missing floating configuration required for popup mode.`);\n }\n const mode = floating.mode ?? \"embedded\";\n if (mode !== \"popup\") {\n throw new Error(`PopupLayerPortal received layer \"${layer.id}\" that is not configured for popup mode.`);\n }\n\n const containerRef = React.useRef<HTMLDivElement | null>(null);\n const popupWindowRef = React.useRef<Window | null>(null);\n const [isMounted, setIsMounted] = React.useState(false);\n\n React.useEffect(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const features = buildWindowFeatures(layer.id, layer.position, layer.width, layer.height, floating.popup);\n const windowName = floating.popup?.name ?? layer.id;\n const createdWindow = resolvePopupWindow(\n windowName,\n features,\n {\n position: layer.position,\n size: { width: layer.width as number, height: layer.height as number },\n },\n floating.popup,\n );\n\n if (!createdWindow) {\n throw new Error(`Failed to open popup window for layer \"${layer.id}\".`);\n }\n\n const openedWindow = createdWindow;\n\n popupWindowRef.current = openedWindow;\n\n if (floating.popup?.focus !== false) {\n openedWindow.focus();\n }\n\n if (!openedWindow.document.title) {\n openedWindow.document.title = layer.id;\n }\n openedWindow.document.body.innerHTML = \"\";\n const mountNode = openedWindow.document.createElement(\"div\");\n mountNode.dataset.layerId = layer.id;\n openedWindow.document.body.appendChild(mountNode);\n containerRef.current = mountNode;\n setIsMounted(true);\n\n applyBoundsToWindow(openedWindow, layer.id, layer.position, layer.width, layer.height);\n\n const handleBeforeUnload = () => {\n popupWindowRef.current = null;\n containerRef.current = null;\n setIsMounted(false);\n };\n openedWindow.addEventListener(\"beforeunload\", handleBeforeUnload);\n\n return () => {\n openedWindow.removeEventListener(\"beforeunload\", handleBeforeUnload);\n if (floating.popup?.closeOnUnmount !== false) {\n openedWindow.close();\n }\n popupWindowRef.current = null;\n containerRef.current = null;\n setIsMounted(false);\n };\n }, [\n floating.popup?.closeOnUnmount,\n floating.popup?.features?.location,\n floating.popup?.features?.menubar,\n floating.popup?.features?.resizable,\n floating.popup?.features?.scrollbars,\n floating.popup?.features?.status,\n floating.popup?.features?.toolbar,\n floating.popup?.focus,\n floating.popup?.name,\n layer.id,\n ]);\n\n React.useEffect(() => {\n const popupWindow = popupWindowRef.current;\n if (!popupWindow) {\n return;\n }\n applyBoundsToWindow(popupWindow, layer.id, layer.position, layer.width, layer.height);\n }, [layer.position?.left, layer.position?.top, layer.height, layer.width, layer.id]);\n\n if (!isMounted || !containerRef.current) {\n return null;\n }\n\n return createPortal(<LayerInstanceProvider layerId={layer.id}>{layer.component}</LayerInstanceProvider>, containerRef.current);\n};\n\nconst resolvePopupWindow = (\n windowName: string,\n features: string,\n bounds: WindowBounds,\n options: PopupWindowOptions | undefined,\n): Window | null => {\n const customFactory = options?.createWindow;\n if (customFactory) {\n return customFactory({ name: windowName, features, bounds });\n }\n return window.open(\"\", windowName, features);\n};\n","/**\n * @file FloatingWindow component with chrome support\n *\n * Renders floating panel content with optional built-in chrome (FloatingPanelFrame).\n * When chrome is enabled and header is provided, header becomes the drag handle.\n */\nimport * as React from \"react\";\nimport type { FloatingBehavior } from \"../../types\";\nimport {\n FloatingPanelCloseButton,\n FloatingPanelFrame,\n FloatingPanelHeader,\n FloatingPanelTitle,\n FloatingPanelControls,\n FloatingPanelContent,\n} from \"../paneling/FloatingPanelFrame\";\n\nexport type FloatingWindowProps = {\n id: string;\n config: FloatingBehavior;\n onClose: () => void;\n children: React.ReactNode;\n};\n\ntype CloseButtonProps = {\n onClick: () => void;\n};\n\nconst CloseButton: React.FC<CloseButtonProps> = ({ onClick }) => (\n <FloatingPanelControls>\n <FloatingPanelCloseButton onClick={onClick} aria-label=\"Close window\" data-drag-ignore=\"true\" />\n </FloatingPanelControls>\n);\n\ntype FloatingWindowHeaderProps = {\n header?: FloatingBehavior[\"header\"];\n draggable?: boolean;\n onClose: () => void;\n};\n\nconst FloatingWindowHeader: React.FC<FloatingWindowHeaderProps> = ({ header, draggable, onClose }) => {\n if (!header) {\n return null;\n }\n\n const showCloseButton = header.showCloseButton ?? false;\n const dragHandleProps = draggable ? { \"data-drag-handle\": \"true\" } : {};\n const cursorStyle = draggable ? \"grab\" : undefined;\n\n return (\n <FloatingPanelHeader {...dragHandleProps} style={{ cursor: cursorStyle }}>\n {header.title ? <FloatingPanelTitle>{header.title}</FloatingPanelTitle> : null}\n {showCloseButton ? <CloseButton onClick={onClose} /> : null}\n </FloatingPanelHeader>\n );\n};\n\ntype FloatingWindowViewProps = {\n header?: FloatingBehavior[\"header\"];\n draggable?: boolean;\n chrome: boolean;\n onClose: () => void;\n children: React.ReactNode;\n};\n\nconst FloatingWindowView: React.FC<FloatingWindowViewProps> = ({ header, draggable, chrome, onClose, children }) => {\n if (!chrome) {\n return <>{children}</>;\n }\n\n return (\n <FloatingPanelFrame style={{ height: \"100%\", width: \"100%\" }}>\n <FloatingWindowHeader header={header} draggable={draggable} onClose={onClose} />\n <FloatingPanelContent style={{ flex: 1, display: \"flex\", flexDirection: \"column\" }}>\n {children}\n </FloatingPanelContent>\n </FloatingPanelFrame>\n );\n};\n\nexport const FloatingWindow: React.FC<FloatingWindowProps> = ({ id, config, onClose, children }) => {\n const chrome = config.chrome ?? false;\n const draggable = config.draggable ?? false;\n const ariaLabel = config.header?.title ?? config.ariaLabel ?? \"Floating window\";\n\n return (\n <div data-floating-window={id} role=\"dialog\" aria-label={ariaLabel} style={{ height: \"100%\", width: \"100%\" }}>\n <FloatingWindowView header={config.header} draggable={draggable} chrome={chrome} onClose={onClose}>\n {children}\n </FloatingWindowView>\n </div>\n );\n};\n\nFloatingWindow.displayName = \"FloatingWindow\";\n"],"names":["drawerBackdropStyle","COLOR_DRAWER_BACKDROP","drawerBaseStyle","drawerPlacementStyles","computeTransitionValue","mode","duration","easing","durationValue","DRAWER_TRANSITION_DURATION","easingValue","DRAWER_TRANSITION_EASING","shouldShowCloseButton","dismissible","showClose","DrawerContent","chrome","frameStyle","header","onClose","children","jsxs","FloatingPanelFrame","jsx","DrawerHeaderView","FloatingPanelContent","DRAWER_CONTENT_PADDING","showCloseButton","shouldShowClose","React","FloatingPanelHeader","DRAWER_HEADER_PADDING_Y","DRAWER_HEADER_PADDING_X","DRAWER_HEADER_GAP","FloatingPanelTitle","FloatingPanelCloseButton","Drawer","id","config","isOpen","zIndex","width","height","position","inline","transitionMode","transitionDuration","transitionEasing","placement","anchor","pos","openTransforms","drawerStyle","transitionValue","style","ariaLabel","backdropStyle","base","isVertical","Fragment","waitForTransitionEnd","el","timeout","resolve","resolved","done","handler","e","runTransition","update","useTransitionState","options","states","setStates","optionsRef","transitionOptions","element","prev","opts","state","open","close","parseDuration","value","match","useDrawerState","layers","drawerStates","setDrawerStates","initial","layer","layerMap","map","updateState","layerId","DrawerLayers","drawer","drawerLayers","closeHandlers","handlers","GridLayoutContext","GridLayoutProvider","useGridLayoutContext","context","PanelSystemContext","usePanelSystem","ctx","PanelSystemProvider","layerById","resolveContent","validIds","l","getCachedContent","useContentCache","LayerInstanceContext","LayerInstanceProvider","useLayerInstance","ensureNumericOffset","key","resolvePopupAnchor","numericFeature","booleanFeature","buildWindowFeatures","features","overrides","toolbar","menubar","location","status","resizable","scrollbars","applyBoundsToWindow","popupWindow","PopupLayerPortal","floating","containerRef","popupWindowRef","isMounted","setIsMounted","windowName","createdWindow","resolvePopupWindow","openedWindow","mountNode","handleBeforeUnload","createPortal","bounds","customFactory","CloseButton","onClick","FloatingPanelControls","FloatingWindowHeader","draggable","dragHandleProps","cursorStyle","FloatingWindowView","FloatingWindow"],"mappings":"ofAwBMA,EAA2C,CAC/C,SAAU,QACV,MAAO,EACP,WAAYC,EAAAA,qBACd,EAEMC,EAAuC,CAC3C,WAAY,WACd,EAEMC,EAA6D,CACjE,KAAM,CACJ,IAAK,EACL,OAAQ,EACR,KAAM,EACN,UAAW,mBAAA,EAEb,MAAO,CACL,IAAK,EACL,OAAQ,EACR,MAAO,EACP,UAAW,kBAAA,EAEb,IAAK,CACH,IAAK,EACL,KAAM,EACN,MAAO,EACP,UAAW,mBAAA,EAEb,OAAQ,CACN,OAAQ,EACR,KAAM,EACN,MAAO,EACP,UAAW,kBAAA,CAEf,EAEMC,EAAyB,CAC7BC,EACAC,EACAC,IACuB,CACvB,GAAIF,IAAS,OACX,OAGF,MAAMG,EAAgBF,GAAYG,EAAAA,2BAC5BC,EAAcH,GAAUI,EAAAA,yBAE9B,MAAO,aAAaH,CAAa,IAAIE,CAAW,EAClD,EAcME,EAAwB,CAACC,EAAsBC,IAC9CD,EAGEC,EAFE,GAcLC,EAA8C,CAAC,CAAE,OAAAC,EAAQ,WAAAC,EAAY,OAAAC,EAAQ,YAAAL,EAAa,QAAAM,EAAS,SAAAC,KAClGJ,EAIHK,EAAAA,KAACC,EAAAA,mBAAA,CAAmB,MAAOL,EACzB,SAAA,CAAAM,EAAAA,IAACC,EAAA,CAAiB,OAAAN,EAAgB,YAAAL,EAA0B,QAAAM,CAAA,CAAkB,EAC9EI,EAAAA,IAACE,EAAAA,qBAAA,CACC,MAAO,CAAE,QAASC,EAAAA,uBAAwB,KAAM,EAAG,QAAS,OAAQ,cAAe,QAAA,EAElF,SAAAN,CAAA,CAAA,CACH,EACF,oBAVU,SAAAA,EAAS,EAcjBI,EAID,CAAC,CAAE,OAAAN,EAAQ,YAAAL,EAAa,QAAAM,KAAc,CACzC,GAAI,CAACD,EACH,OAAO,KAGT,MAAMS,EAAkBT,EAAO,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AM,EAAG,QAAS,OAAQ,cAAe,QAAA,EACrE,SAAAL,CAAA,CACH,CAAA,EACF,oBATU,SAAAA,EAAS,EAaVwI,EAAgD,CAAC,CAAE,GAAAvH,EAAI,OAAAC,EAAQ,QAAAnB,EAAS,SAAAC,KAAe,CAClG,MAAMJ,EAASsB,EAAO,QAAU,GAC1BkH,EAAYlH,EAAO,WAAa,GAChCiB,EAAYjB,EAAO,QAAQ,OAASA,EAAO,WAAa,kBAE9D,OACEf,EAAAA,IAAC,MAAA,CAAI,uBAAsBc,EAAI,KAAK,SAAS,aAAYkB,EAAW,MAAO,CAAE,OAAQ,OAAQ,MAAO,MAAA,EAClG,SAAAhC,EAAAA,IAACoI,GAAA,CAAmB,OAAQrH,EAAO,OAAQ,UAAAkH,EAAsB,OAAAxI,EAAgB,QAAAG,EAC9E,SAAAC,CAAA,CACH,CAAA,CACF,CAEJ,EAEAwI,EAAe,YAAc"}
@@ -0,0 +1,2 @@
1
+ "use strict";const S=require("react/jsx-runtime"),Tt=require("react"),L=require("./FloatingWindow-TCDNY5gE.cjs"),v=require("./styles-qf6ptVLD.cjs"),Lt=require("./SwipePivotTabBar-BrQismcZ.cjs"),xt=require("./ResizeHandle-CScipO5l.cjs"),pt=require("./useIsomorphicLayoutEffect-DGRNF4Lf.cjs"),ot=require("./useDocumentPointerEvents-ChqrKXDk.cjs"),st=require("./useEffectEvent-huSsGUnl.cjs");function _t(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const d=_t(Tt),Ht=()=>{const t=new Map;return e=>{if(!e)return;const n=t.get(e);if(n!==void 0)return n;const r=t.size;return t.set(e,r),r}},Pt=Ht(),X=new Map,Mt=t=>{const e=`ovs-threshold:${t.threshold}-rootMargin:${t.rootMargin}-root:${Pt(t.root)}`;if(X.has(e))return X.get(e);const n=new class{#t=new Map;#e=new IntersectionObserver(r=>{r.forEach(o=>{const s=this.#t.get(o.target);s&&s(o)})},t);observe(r,o){return this.#t.set(r,o),this.#e.observe(r),()=>{this.#t.delete(r),this.#e.unobserve(r)}}};return X.set(e,n),n},it=Object.freeze({x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0});function Dt(t,{threshold:e=0,rootMargin:n="0px",root:r=null}){const[o,s]=d.useState(null);return d.useEffect(()=>{const a=t.current;return a?Mt({threshold:e,rootMargin:n,root:r}).observe(a,u=>{s({isIntersecting:u.isIntersecting,boundingClientRect:u.boundingClientRect,intersectionRatio:u.intersectionRatio,intersectionRect:u.intersectionRect,rootBounds:u.rootBounds,target:u.target,time:u.time})}):void 0},[t,e,n,r]),d.useMemo(()=>({isIntersecting:o?.isIntersecting??!1,boundingClientRect:o?.boundingClientRect??it,intersectionRatio:o?.intersectionRatio??0,intersectionRect:o?.intersectionRect??it,rootBounds:o?.rootBounds??null,target:o?.target??t.current,time:o?.time??0}),[o,t])}const bt={position:"absolute",pointerEvents:"auto",boxSizing:"border-box",background:"transparent",border:"none"},Gt={...bt,width:v.GRID_LAYER_CORNER_HIT_SIZE,height:v.GRID_LAYER_CORNER_HIT_SIZE,zIndex:2},Nt={...bt,zIndex:1},kt={"top-left":{top:0,left:0,transform:"translate(-50%, -50%)",cursor:"nwse-resize"},"top-right":{top:0,right:0,transform:"translate(50%, -50%)",cursor:"nesw-resize"},"bottom-left":{bottom:0,left:0,transform:"translate(-50%, 50%)",cursor:"nesw-resize"},"bottom-right":{bottom:0,right:0,transform:"translate(50%, 50%)",cursor:"nwse-resize"}},At={left:{top:v.GRID_LAYER_CORNER_HIT_SIZE,bottom:v.GRID_LAYER_CORNER_HIT_SIZE,left:0,width:v.GRID_LAYER_EDGE_HIT_THICKNESS,transform:"translateX(-50%)",cursor:"ew-resize"},right:{top:v.GRID_LAYER_CORNER_HIT_SIZE,bottom:v.GRID_LAYER_CORNER_HIT_SIZE,right:0,width:v.GRID_LAYER_EDGE_HIT_THICKNESS,transform:"translateX(50%)",cursor:"ew-resize"},top:{left:v.GRID_LAYER_CORNER_HIT_SIZE,right:v.GRID_LAYER_CORNER_HIT_SIZE,top:0,height:v.GRID_LAYER_EDGE_HIT_THICKNESS,transform:"translateY(-50%)",cursor:"ns-resize"},bottom:{left:v.GRID_LAYER_CORNER_HIT_SIZE,right:v.GRID_LAYER_CORNER_HIT_SIZE,bottom:0,height:v.GRID_LAYER_EDGE_HIT_THICKNESS,transform:"translateY(50%)",cursor:"ns-resize"}},jt=[{key:"top-left",variant:"corner",horizontal:"left",vertical:"top"},{key:"top-right",variant:"corner",horizontal:"right",vertical:"top"},{key:"bottom-left",variant:"corner",horizontal:"left",vertical:"bottom"},{key:"bottom-right",variant:"corner",horizontal:"right",vertical:"bottom"},{key:"left",variant:"edge",horizontal:"left"},{key:"right",variant:"edge",horizontal:"right"},{key:"top",variant:"edge",vertical:"top"},{key:"bottom",variant:"edge",vertical:"bottom"}],St=({layerId:t,onPointerDown:e})=>S.jsx(S.Fragment,{children:jt.map(n=>{const r=n.variant==="corner"?Gt:Nt,o=n.variant==="corner"?kt[n.key]:At[n.key],s={...r,...o},a=n.variant==="corner"?{"data-resize-corner":n.key}:{"data-resize-edge":n.key};return S.jsx("div",{role:"presentation","aria-hidden":"true",style:s,...a,"data-layer-id":t,onPointerDown:l=>e(n,l)},n.key)})}),Ot=({pivot:t})=>{const{Outlet:e}=Lt.usePivot({items:t.items,activeId:t.activeId,defaultActiveId:t.defaultActiveId,onActiveChange:t.onActiveChange,transitionMode:t.transitionMode});return S.jsx(e,{})},Yt=(t,e)=>t.pivot?S.jsx(Ot,{pivot:t.pivot}):t.cache?e(t.id):t.component,zt=d.memo(({layer:t,onClose:e})=>{const{getCachedContent:n}=L.usePanelSystem(),r=Yt(t,n);return t.floating?.chrome?S.jsx(L.FloatingWindow,{id:t.id,config:t.floating,onClose:e,children:r}):r});zt.displayName="LayerContentRenderer";const wt=d.memo(({layerId:t,isResizable:e,onPointerDown:n})=>e?S.jsx(St,{layerId:t,onPointerDown:n}):null);wt.displayName="LayerResizeHandles";const $t=(t,e)=>t?"auto":e?"visible":"hidden",Et=d.memo(({layer:t,handleLayerPointerDown:e})=>{const{getLayerRenderState:n}=L.useGridLayoutContext(),{style:r,isResizable:o,isResizing:s,onResizeHandlePointerDown:a}=n(t),l=d.useMemo(()=>{const f={};return t.gridArea&&(f.gridArea=t.gridArea),t.gridRow&&(f.gridRow=t.gridRow),t.gridColumn&&(f.gridColumn=t.gridColumn),f},[t.gridArea,t.gridRow,t.gridColumn]),u=d.useMemo(()=>{const f=!!t.floating,g=$t(t.scrollable,f),b={...r,...l,minWidth:0,minHeight:0,overflow:g};return o?{...b,position:"relative"}:b},[r,l,o,t.scrollable,t.floating]),p=d.useCallback(()=>{t.floating?.onClose?.()},[t.floating]);return S.jsxs("div",{"data-layer-id":t.id,"data-draggable":!!t.floating?.draggable,"data-resizable":o,"data-resizing":s,style:u,onPointerDown:e,children:[S.jsx(L.LayerInstanceProvider,{layerId:t.id,children:S.jsx(zt,{layer:t,onClose:p})}),S.jsx(wt,{layerId:t.id,isResizable:o,onPointerDown:a})]})});Et.displayName="EmbeddedLayer";const Rt=({layers:t})=>{const{handleLayerPointerDown:e}=L.useGridLayoutContext();return S.jsx(S.Fragment,{children:t.map(n=>{const r=n.floating?.mode??"embedded";return n.floating&&r==="popup"?S.jsx(L.PopupLayerPortal,{layer:n},n.id):S.jsx(Et,{layer:n,handleLayerPointerDown:e},n.id)})})},at={position:"absolute",pointerEvents:"auto"},K=({direction:t,trackIndex:e,align:n,gap:r,span:o,onResize:s})=>{const a=t==="col"?"vertical":"horizontal",l=d.useCallback(f=>{const g=n==="start"?-f:f;s(t,e,g)},[n,t,e,s]),u=d.useMemo(()=>t==="col"?{gridColumn:`${e+1} / ${e+2}`,gridRow:`${o.start} / ${o.end}`}:{gridRow:`${e+1} / ${e+2}`,gridColumn:`${o.start} / ${o.end}`},[t,e,o]),p=d.useMemo(()=>{const g=Math.max(0,r)/2+v.GRID_HANDLE_THICKNESS/2;return t==="col"?{...at,width:v.GRID_HANDLE_THICKNESS,height:"100%",top:0,bottom:0,...n==="start"?{left:-g}:{right:-g}}:{...at,width:"100%",height:v.GRID_HANDLE_THICKNESS,left:0,right:0,...n==="start"?{top:-g}:{bottom:-g}}},[n,t,r]);return S.jsx("div",{"data-resizable":"true",style:{...u,position:"relative",pointerEvents:"none"},children:S.jsx("div",{"data-direction":a,"data-align":n,"data-handle":"true",style:p,children:S.jsx(xt.ResizeHandle,{direction:a,onResize:l})})})},Ft=t=>{const e=new Map;t.forEach((r,o)=>{r.forEach((s,a)=>{if(!s||s===".")return;const l=e.get(s);if(l){const p={rowStart:Math.min(l.rowStart,o),rowEnd:Math.max(l.rowEnd,o),colStart:Math.min(l.colStart,a),colEnd:Math.max(l.colEnd,a)};e.set(s,p);return}const u={rowStart:o,rowEnd:o,colStart:a,colEnd:a};e.set(s,u)})});const n=new Map;return e.forEach((r,o)=>{const s=r.rowStart+1,a=r.rowEnd+2,l=r.colStart+1,u=r.colEnd+2,p={gridArea:o,gridRow:`${s} / ${a}`,gridColumn:`${l} / ${u}`};n.set(o,p)}),n},Bt=(t,e)=>{if((t.positionMode??"grid")!=="grid")return t;const r=t.gridArea??t.id,o=e.get(r);if(!o)return t;const s=!t.gridArea,a=!t.gridRow,l=!t.gridColumn;return!s&&!a&&!l?t:{...t,gridArea:s?o.gridArea:t.gridArea,gridRow:a?o.gridRow:t.gridRow,gridColumn:l?o.gridColumn:t.gridColumn}},vt=(t,e)=>{const n=d.useMemo(()=>Ft(t.areas),[t.areas]),r=d.useMemo(()=>e.map(l=>Bt(l,n)),[e,n]),o=d.useMemo(()=>r.filter(l=>l.visible!==!1),[r]),s=d.useMemo(()=>o.filter(l=>!l.drawer),[o]),a=d.useMemo(()=>{const l=new Map;return r.forEach(u=>{l.set(u.id,u)}),l},[r]);return{normalizedLayers:r,visibleLayers:o,regularLayers:s,layerById:a}},Wt=t=>{if(!t)return{rowGap:0,columnGap:0};const e=t.split(/\s+/).map(r=>r.trim()).filter(Boolean),n=r=>{const o=r.match(/^(-?\d+(?:\.\d+)?)px$/);return o?Number.parseFloat(o[1]):0};if(e.length===1){const r=n(e[0]);return{rowGap:r,columnGap:r}}return{rowGap:n(e[0]),columnGap:n(e[1])}},Xt=(t,e)=>{if(!t)return[];const n=getComputedStyle(t);return(e==="col"?n.gridTemplateColumns:n.gridTemplateRows).split(/\s+/).map(o=>parseFloat(o)).filter(o=>!Number.isNaN(o))},V=(t,e=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY)=>Math.min(Math.max(t,e),n),Kt=(t,e)=>typeof t!="number"||!Number.isFinite(t)?e:t,$=(t,e)=>`${t}-${e}`,Zt=(t,e,n,r)=>{const o=$(n,r),s=e[o];return s!==void 0?`minmax(${t.minSize??0}px, ${s}px)`:t.size},ct=(t,e,n)=>t.map((r,o)=>Zt(r,e,n,o)).join(" "),j=(t,e)=>t.reduce((n,r,o)=>(r.resizable&&r.size.endsWith("px")&&(n[$(e,o)]=parseInt(r.size,10)),n),{}),Vt=({trackSizes:t,track:e,direction:n,trackIndex:r,containerRef:o})=>{const s=$(n,r),a=t[s];if(a!==void 0)return a;const u=Xt(o?.current??null,n)[r];return u!==void 0&&u>0?u:e.size.endsWith("px")?Number.parseInt(e.size,10):300},qt=(t,e)=>t.reduce((n,r,o)=>o===e?n:r.size.includes("fr")?n+100:n+(r.minSize??50),0),Ut=({track:t,tracks:e,trackIndex:n,direction:r,containerRef:o,gapSizes:s})=>{if(!o?.current)return t.maxSize;const a=r==="col"?o.current.offsetWidth:o.current.offsetHeight,l=qt(e,n),u=e.length-1,p=r==="col"?s.columnGap:s.rowGap,f=u*p,g=a-l-f;return t.maxSize!==void 0?Math.min(t.maxSize,g):g},Jt=(t,e,n)=>V(t,e??Number.NEGATIVE_INFINITY,n??Number.POSITIVE_INFINITY),lt=(t,e)=>{const n=t.length,r=[];for(let a=0;a<n;a++){const l=t[a],u=l[e],p=l[e+1];u!==p&&r.push(a)}if(r.length===0)return{start:1,end:n+1};const o=Math.min(...r),s=Math.max(...r);return{start:o+1,end:s+2}},ut=(t,e)=>{const n=t[e],r=t[e+1],o=n?.length??0,s=[];for(let u=0;u<o;u++){const p=n?.[u],f=r?.[u];p!==f&&s.push(u)}if(s.length===0)return{start:1,end:o+1};const a=Math.min(...s),l=Math.max(...s);return{start:a+1,end:l+2}},Qt=(t,e)=>{if(t.length===0)return[];const n=e.length;if(t.length===1)return t[0]?.resizable?[{trackIndex:0,align:"end",span:{start:1,end:n+1}}]:[];const r=[];return Array.from({length:t.length-1},(s,a)=>a).forEach(s=>{const a=t[s];if(t[s+1]?.resizable){const u=lt(e,s);r.push({trackIndex:s+1,align:"start",span:u});return}if(a?.resizable){const u=lt(e,s);r.push({trackIndex:s,align:"end",span:u})}}),r},te=(t,e)=>{if(t.length===0)return[];const n=e[0]?.length??0;if(t.length===1)return t[0]?.resizable?[{trackIndex:0,align:"end",span:{start:1,end:n+1}}]:[];const r=[];return Array.from({length:t.length-1},(s,a)=>a).forEach(s=>{const a=t[s];if(t[s+1]?.resizable){const u=ut(e,s);r.push({trackIndex:s+1,align:"start",span:u});return}if(a?.resizable){const u=ut(e,s);r.push({trackIndex:s,align:"end",span:u})}}),r},ee=t=>t!==void 0?{gap:t}:{},ne=(t,e)=>{const n=Object.keys(e),r={};for(const f of n)r[f]=t[f]??e[f];const o=Object.keys(t),s=o.length!==n.length,a=o.some(f=>!Object.prototype.hasOwnProperty.call(r,f)),l=s?!0:a,u=n.some(f=>t[f]!==r[f]);return(l?!0:u)?r:null},Ct=(t,e,n)=>{const[r,o]=d.useState(()=>({...j(t.columns,"col"),...j(t.rows,"row")}));pt.useIsomorphicLayoutEffect(()=>{const g={...j(t.columns,"col"),...j(t.rows,"row")};o(b=>ne(b,g)??b)},[t.columns,t.rows]);const s=d.useMemo(()=>t.areas.map(g=>`"${g.join(" ")}"`).join(" "),[t.areas]),a=d.useMemo(()=>Wt(t.gap),[t.gap]),l=d.useMemo(()=>Qt(t.columns,t.areas),[t.columns,t.areas]),u=d.useMemo(()=>te(t.rows,t.areas),[t.rows,t.areas]),p=d.useMemo(()=>({...t.style,...e,gridTemplateAreas:s,gridTemplateRows:ct(t.rows,r,"row"),gridTemplateColumns:ct(t.columns,r,"col"),...ee(t.gap)}),[s,t.columns,t.gap,t.rows,t.style,e,r]),f=d.useCallback((g,b,E)=>{const I=g==="row"?t.rows:t.columns,C=I[b];if(!C||!C.resizable)return;const _=Vt({trackSizes:r,track:C,direction:g,trackIndex:b,containerRef:n}),H=Ut({track:C,tracks:I,trackIndex:b,direction:g,containerRef:n,gapSizes:a}),P=$(g,b);o(N=>{const y=_+E,T=Jt(y,C.minSize,H);return{...N,[P]:T}})},[t.columns,t.rows,r,n,a]);return{columnHandles:l,rowHandles:u,gapSizes:a,gridStyle:p,handleResize:f}},re=t=>t.positionMode?t.positionMode:t.floating?(t.floating.mode??"embedded")==="embedded"?"absolute":"relative":"grid",oe=t=>({position:t==="grid"?"relative":t}),se=(t,e)=>e!=="grid"?{}:{gridArea:t.gridArea,gridRow:t.gridRow,gridColumn:t.gridColumn},ie=t=>t?{top:t.top,right:t.right,bottom:t.bottom,left:t.left}:{},ae=t=>t!==void 0?{zIndex:t}:{},ce=(t,e)=>({width:t,height:e}),le=(t,e)=>t.pointerEvents!==void 0?typeof t.pointerEvents=="boolean"?{pointerEvents:t.pointerEvents?"auto":"none"}:{pointerEvents:t.pointerEvents}:e==="absolute"||e==="fixed"?{pointerEvents:"auto"}:{},ue=t=>t.floating?t.floating.position??t.floating.defaultPosition??t.position:t.position,de=t=>{if(t.floating){const e=t.floating.size??t.floating.defaultSize;if(e)return{width:e.width,height:e.height}}return{width:t.width,height:t.height}},ge=t=>t.floating?.zIndex!==void 0?t.floating.zIndex:t.zIndex,he=t=>{const e=re(t),n=ue(t),r=de(t),o=ge(t);return{...t.style,...oe(e),...se(t,e),...ie(n),...ae(o),...ce(r.width,r.height),...le(t,e)}},fe=t=>{const e=t.floating;return e?e.mode??"embedded":null},D=t=>fe(t)!=="embedded"?null:t.floating??null,dt=t=>t instanceof HTMLElement?["INPUT","TEXTAREA","SELECT","BUTTON"].includes(t.tagName):!1,gt=(t,e,n)=>{const r=e??Number.NEGATIVE_INFINITY,o=n??Number.POSITIVE_INFINITY;return V(t,r,o)},ht=(t,e,n)=>{if(typeof t=="number"&&Number.isFinite(t))return t;throw new Error(`Floating layer "${n}" must provide a numeric "${e}" value when draggable mode is enabled.`)},ft=t=>{const e=D(t);if(!e)throw new Error(`Floating layer "${t.id}" is missing floating configuration required for dragging.`);const n=e.position??e.defaultPosition??t.position;if(!n)throw new Error(`Floating layer "${t.id}" must define position with left and top values.`);return{left:ht(n.left,"left",t.id),top:ht(n.top,"top",t.id)}},me=t=>{const e=D(t);return e?e.constraints??{}:{}},pe=(t,e,n)=>t?t==="left"?e-n:e+n:e,be=(t,e,n)=>t?t==="top"?e-n:e+n:e,Se=(t,e,n)=>!t||t==="right"?e:e+n,ze=(t,e,n)=>!t||t==="bottom"?e:e+n,Z=(t,e)=>t?t.dataset.layerId===e?t:Z(t.parentElement,e):null,q=(t,e,n)=>!t||n?.(t)?null:e(t)?t:q(t.parentElement,e,n),we=t=>t instanceof HTMLElement?q(t,e=>e.dataset.dragHandle==="true",e=>e.dataset.dragIgnore==="true"):null,mt=t=>t instanceof HTMLElement?q(t,e=>e.dataset.resizeCorner!==void 0||e.dataset.resizeEdge!==void 0)!==null:!1,O=t=>{const e=D(t);return e?e.resizable===!0:!1},Y=t=>{if(!D(t))return null;const n=ve(t);if(!n)throw new Error(`Floating layer "${t.id}" must define width and height when resizable or draggable.`);return{width:n.width,height:n.height}},Ee=(t,e,n)=>{const r=t.filter(O).reduce((g,b)=>{if(n===b.id){const I=e[b.id];if(I)return g[b.id]=I,g}const E=Y(b);return E&&(g[b.id]=E),g},{}),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=>{const b=e[g],E=r[g];return!b||!E?!0:b.width!==E.width||b.height!==E.height});return{sizes:r,changed:u?!0:p}},Re=({layers:t,layerById:e,isRootLevel:n})=>{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),E=st.useEffectEvent((c,i)=>{e.get(c)?.floating?.onMove?.(i)}),I=st.useEffectEvent((c,i)=>{e.get(c)?.floating?.onResize?.(i)});pt.useIsomorphicLayoutEffect(()=>{const{sizes:c,changed:i}=Ee(t,p,s);i&&f(c)},[t,s]);const C=d.useCallback((c,i,h,m)=>{const z=ft(i),R=l[c]??{x:0,y:0},w={pointerStartX:m.clientX,pointerStartY:m.clientY,initialTranslationX:R.x,initialTranslationY:R.y,baseLeft:z.left,baseTop:z.top,layerId:c,pointerId:m.pointerId,target:h};if(w.target.setPointerCapture)try{w.target.setPointerCapture(w.pointerId)}catch{}g.current=w,o(c)},[l]),_=d.useCallback(c=>{const i=c.target,h=we(i);if(!h)return;const m=h.closest("[data-layer-id]")?.getAttribute("data-layer-id");if(!m)return;const z=e.get(m);if(!z)return;const R=D(z);if(!(!R||R.draggable!==!0)&&!dt(c.target)&&!mt(c.target)&&h){const w=Z(h,m);if(!w)return;C(m,z,w,c);return}},[C,e]),H=d.useCallback((c,i)=>{const h=e.get(c),m=h?D(h):null;if(!h||!m||m.draggable!==!0||dt(i.target)||mt(i.target))return;const z=Z(i.currentTarget,c);z&&C(c,h,z,i)},[C,e]),P=d.useCallback((c,i,h)=>{const m=e.get(c);if(!m||!O(m))return;const z=p[c]??Y(m);if(!z)return;const R=ft(m),w=me(m),x=l[c]??{x:0,y:0};if(h.stopPropagation(),h.preventDefault(),h.currentTarget.setPointerCapture)try{h.currentTarget.setPointerCapture(h.pointerId)}catch{}b.current={layerId:c,pointerId:h.pointerId,horizontalEdge:i.horizontal,verticalEdge:i.vertical,startX:h.clientX,startY:h.clientY,startWidth:z.width,startHeight:z.height,startPosition:x,baseLeft:R.left,baseTop:R.top,minWidth:w.minWidth,maxWidth:w.maxWidth,minHeight:w.minHeight,maxHeight:w.maxHeight,target:h.currentTarget},a(c)},[e,l,p]),N=d.useCallback(c=>{const i=g.current;if(!i)return;const h=c.clientX-i.pointerStartX,m=c.clientY-i.pointerStartY,z={x:i.initialTranslationX+h,y:i.initialTranslationY+m};u(R=>({...R,[i.layerId]:z})),E(i.layerId,{left:i.baseLeft+z.x,top:i.baseTop+z.y})},[E]),y=d.useCallback(c=>{const i=b.current;if(!i||i.pointerId!==c.pointerId||!e.get(i.layerId))return;const m=c.clientX-i.startX,z=c.clientY-i.startY,R=pe(i.horizontalEdge,i.startWidth,m),w=be(i.verticalEdge,i.startHeight,z),x=gt(R,i.minWidth,i.maxWidth),M=gt(w,i.minHeight,i.maxHeight),k=i.startWidth-x,F=i.startHeight-M,et=Se(i.horizontalEdge,i.startPosition.x,k),yt=ze(i.verticalEdge,i.startPosition.y,F),B=p[i.layerId],nt={width:x,height:M};(!B||B.width!==x||B.height!==M)&&(f(W=>({...W,[i.layerId]:nt})),I(i.layerId,nt));const rt=l[i.layerId]??{x:0,y:0},A={x:et,y:yt};(rt.x!==A.x||rt.y!==A.y)&&(u(W=>({...W,[i.layerId]:A})),E(i.layerId,{left:i.baseLeft+A.x,top:i.baseTop+A.y}))},[e,l,p,E,I]),T=d.useCallback(c=>{const i=g.current;if(i){if(i.pointerId===c.pointerId&&i.target.releasePointerCapture)try{i.target.releasePointerCapture(i.pointerId)}catch{}g.current=null}o(null)},[]),G=d.useCallback(c=>{const i=b.current;if(i){if(i.pointerId===c.pointerId&&i.target.releasePointerCapture)try{i.target.releasePointerCapture(i.pointerId)}catch{}b.current=null}a(null)},[]);ot.useDocumentPointerEvents(r!==null,{onMove:N,onUp:T,onCancel:T}),ot.useDocumentPointerEvents(s!==null,{onMove:y,onUp:G,onCancel:G});const U=d.useCallback(c=>{const i=he(c),h=D(c);if(!h||h.draggable!==!0)return i;const m=l[c.id],z=r===c.id,R=s===c.id,w=m?{transform:`translate(${m.x}px, ${m.y}px)`}:{},x=p[c.id],M=O(c)?Y(c):null,k=x??M,F=k?{width:`${k.width}px`,height:`${k.height}px`}:{};return{...i,...F,...w,...z||R?{cursor:"grabbing"}:{}}},[r,l,p,s]),J=d.useCallback(c=>{if(!O(c))return{isResizable:!1};const h=p[c.id],m=Y(c);return(h??m)!==null?{isResizable:!0,onPointerDown:(x,M)=>{P(c.id,x,M)}}:{isResizable:!1}},[P,p]),Q=d.useCallback(c=>{const{isResizable:i,onPointerDown:h}=J(c),m=U(c),z=s===c.id;return{style:m,isResizable:i,isResizing:z,onResizeHandlePointerDown:(R,w)=>{h&&h(R,w)}}},[U,J,s]),tt=d.useCallback(c=>({"data-drag-handle":"true",role:"button","aria-roledescription":"Drag handle","aria-label":"Drag layer",onPointerDown:i=>{H(c,i)}}),[H]);return{providerValue:d.useMemo(()=>({handleLayerPointerDown:_,getLayerRenderState:Q,getLayerHandleProps:tt,isRootLevel:n}),[tt,Q,_,n]),draggingLayerId:r,resizingLayerId:s}},ve=t=>{if(t.floating){const e=t.floating.size??t.floating.defaultSize;if(e)return{width:e.width,height:e.height}}if(typeof t.width=="number"&&typeof t.height=="number")return{width:t.width,height:t.height}},It={display:"grid",width:"100%",height:"100%",overflow:"hidden"},Ce={touchAction:"none",WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none"},Ie={...It,overflow:"visible",height:"auto",minHeight:"100%"},ye=t=>t?Ie:It,Te=({config:t,layers:e,style:n,root:r=!1})=>{const o=d.useRef(null),{isIntersecting:s}=Dt(o,{threshold:0});return S.jsx(L.PanelSystemProvider,{config:t,layers:e,style:n,children:S.jsx(Le,{gridRef:o,isIntersecting:s,isRoot:r})})},Le=({gridRef:t,isIntersecting:e,isRoot:n})=>{const{config:r,style:o,layers:s}=L.usePanelSystem(),{normalizedLayers:a,visibleLayers:l,regularLayers:u,layerById:p}=vt(r,s.defs),{columnHandles:f,rowHandles:g,gapSizes:b,gridStyle:E,handleResize:I}=Ct(r,o,t),{providerValue:C,draggingLayerId:_,resizingLayerId:H}=Re({layers:a,layerById:p,isRootLevel:n}),P=_?!0:!!H,N=d.useMemo(()=>({...ye(n),...E,...P?Ce:{}}),[E,P,n]);return S.jsxs(S.Fragment,{children:[S.jsxs("div",{ref:t,style:N,"data-dragging":!!_,"data-resizing":!!H,"data-visible":e,children:[S.jsx(L.GridLayoutProvider,{value:C,children:S.jsx(Rt,{layers:u})}),f.map(({trackIndex:y,align:T,span:G})=>S.jsx(K,{direction:"col",trackIndex:y,align:T,gap:b.columnGap,span:G,onResize:I},`col-${y}:${T}`)),g.map(({trackIndex:y,align:T,span:G})=>S.jsx(K,{direction:"row",trackIndex:y,align:T,gap:b.rowGap,span:G,onResize:I},`row-${y}:${T}`))]}),S.jsx(L.DrawerLayers,{layers:l})]})};exports.GridLayerList=Rt;exports.GridLayerResizeHandles=St;exports.GridLayout=Te;exports.GridTrackResizeHandle=K;exports.clampNumber=V;exports.toFiniteNumberOr=Kt;exports.useGridPlacements=vt;exports.useGridTracks=Ct;
2
+ //# sourceMappingURL=GridLayout-B4VRsC0r.cjs.map