react-panel-layout 0.5.2 → 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 (463) hide show
  1. package/dist/{FloatingPanelFrame-D9Cp2al1.cjs → FloatingPanelFrame-CEmXDvUA.cjs} +2 -2
  2. package/dist/{FloatingPanelFrame-D9Cp2al1.cjs.map → FloatingPanelFrame-CEmXDvUA.cjs.map} +1 -1
  3. package/dist/{FloatingPanelFrame-lLg-Lpg7.js → FloatingPanelFrame-SgYLc6Ud.js} +11 -11
  4. package/dist/{FloatingPanelFrame-lLg-Lpg7.js.map → FloatingPanelFrame-SgYLc6Ud.js.map} +1 -1
  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 +67 -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/useContentCache-CO3LYNmz.js +24 -0
  111. package/dist/useContentCache-CO3LYNmz.js.map +1 -0
  112. package/dist/useContentCache-DqXtLrLs.cjs +2 -0
  113. package/dist/useContentCache-DqXtLrLs.cjs.map +1 -0
  114. package/dist/useDocumentPointerEvents-CKdhGXd0.js +46 -0
  115. package/dist/useDocumentPointerEvents-CKdhGXd0.js.map +1 -0
  116. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs +2 -0
  117. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs.map +1 -0
  118. package/dist/useEffectEvent-Dp7HLCf0.js +13 -0
  119. package/dist/useEffectEvent-Dp7HLCf0.js.map +1 -0
  120. package/dist/useEffectEvent-huSsGUnl.cjs +2 -0
  121. package/dist/useEffectEvent-huSsGUnl.cjs.map +1 -0
  122. package/dist/useFloatingState-C4kRaW_R.cjs +2 -0
  123. package/dist/useFloatingState-C4kRaW_R.cjs.map +1 -0
  124. package/dist/useFloatingState-tEfA_wbc.js +74 -0
  125. package/dist/useFloatingState-tEfA_wbc.js.map +1 -0
  126. package/dist/window/index.d.ts +61 -0
  127. package/dist/window.cjs +2 -0
  128. package/dist/window.cjs.map +1 -0
  129. package/dist/window.js +149 -0
  130. package/dist/window.js.map +1 -0
  131. package/docs/design-tokens.md +405 -0
  132. package/package.json +29 -4
  133. package/src/PanelSystemContext.tsx +88 -0
  134. package/src/components/grid/GridLayerList.tsx +172 -0
  135. package/src/components/grid/GridLayerResizeHandles.tsx +145 -0
  136. package/src/components/grid/GridLayout.spec.tsx +743 -0
  137. package/src/components/grid/GridLayout.tsx +130 -0
  138. package/src/components/grid/GridTrackResizeHandle.tsx +87 -0
  139. package/src/components/paneling/FloatingPanelFrame.tsx +203 -0
  140. package/src/components/panels/DropSuggestOverlay.tsx +131 -0
  141. package/src/components/panels/PanelGroupView.tsx +112 -0
  142. package/src/components/pivot/PivotLayer.tsx +27 -0
  143. package/src/components/resizer/HorizontalDivider.tsx +52 -0
  144. package/src/components/resizer/ResizeHandle.tsx +118 -0
  145. package/src/components/tabs/TabBar.tsx +223 -0
  146. package/src/components/tabs/TabBarTab.tsx +133 -0
  147. package/src/components/tabs/TabDragOverlay.tsx +92 -0
  148. package/src/components/window/DialogOverlay.tsx +180 -0
  149. package/src/components/window/Drawer.tsx +282 -0
  150. package/src/components/window/DrawerLayers.tsx +58 -0
  151. package/src/components/window/FloatingWindow.tsx +95 -0
  152. package/src/components/window/PopupLayerPortal.tsx +218 -0
  153. package/src/config/PanelContentDeclaration.tsx +427 -0
  154. package/src/config/index.tsx +52 -0
  155. package/src/config/panelJsx.spec.tsx +54 -0
  156. package/src/config/panelJsxConfig.spec.tsx +54 -0
  157. package/src/config/panelJsxDrawer.spec.tsx +33 -0
  158. package/src/config/panelRouter.spec.ts +68 -0
  159. package/src/config/panelRouter.tsx +155 -0
  160. package/src/constants/styles.ts +261 -0
  161. package/src/demo/Layout.module.css +258 -0
  162. package/src/demo/Layout.tsx +176 -0
  163. package/src/demo/components/CodeBlock.module.css +54 -0
  164. package/src/demo/components/CodeBlock.tsx +34 -0
  165. package/src/demo/components/CodePreview.module.css +37 -0
  166. package/src/demo/components/CodePreview.tsx +31 -0
  167. package/src/demo/components/DataPreview.module.css +177 -0
  168. package/src/demo/components/DataPreview.tsx +115 -0
  169. package/src/demo/components/Story.module.css +68 -0
  170. package/src/demo/components/Story.tsx +54 -0
  171. package/src/demo/components/layout/CodePanel.module.css +183 -0
  172. package/src/demo/components/layout/CodePanel.tsx +149 -0
  173. package/src/demo/components/layout/DemoPage.module.css +60 -0
  174. package/src/demo/components/layout/DemoPage.tsx +56 -0
  175. package/src/demo/components/layout/SingleSamplePage.module.css +11 -0
  176. package/src/demo/components/layout/SingleSamplePage.tsx +35 -0
  177. package/src/demo/components/layout/SplitDemoLayout.module.css +107 -0
  178. package/src/demo/components/layout/SplitDemoLayout.tsx +218 -0
  179. package/src/demo/components/layout/index.ts +11 -0
  180. package/src/demo/components/tab-styles/ChromeTabBar.module.css +75 -0
  181. package/src/demo/components/tab-styles/ChromeTabBar.tsx +111 -0
  182. package/src/demo/components/tab-styles/GitHubTabBar.module.css +81 -0
  183. package/src/demo/components/tab-styles/GitHubTabBar.tsx +109 -0
  184. package/src/demo/components/tab-styles/VSCodeTabBar.module.css +78 -0
  185. package/src/demo/components/tab-styles/VSCodeTabBar.tsx +109 -0
  186. package/src/demo/components/tab-styles/index.ts +6 -0
  187. package/src/demo/components/ui/DemoButton.module.css +63 -0
  188. package/src/demo/components/ui/DemoButton.tsx +32 -0
  189. package/src/demo/components/ui/DemoCard.module.css +15 -0
  190. package/src/demo/components/ui/DemoCard.tsx +30 -0
  191. package/src/demo/components/ui/DemoContainer.module.css +17 -0
  192. package/src/demo/components/ui/DemoContainer.tsx +30 -0
  193. package/src/demo/components/ui/DemoPanel.module.css +23 -0
  194. package/src/demo/components/ui/DemoPanel.tsx +33 -0
  195. package/src/demo/components/ui/PanelText.module.css +18 -0
  196. package/src/demo/components/ui/PanelText.tsx +29 -0
  197. package/src/demo/components/ui/PanelTitle.module.css +18 -0
  198. package/src/demo/components/ui/PanelTitle.tsx +31 -0
  199. package/src/demo/contexts/TabbarDemoConfig.tsx +218 -0
  200. package/src/demo/demo.css +172 -0
  201. package/src/demo/hooks/useMedia.ts +41 -0
  202. package/src/demo/hooks/useShikiHighlight.ts +55 -0
  203. package/src/demo/index.tsx +293 -0
  204. package/src/demo/pages/Drawer/animations/index.tsx +22 -0
  205. package/src/demo/pages/Drawer/basics/index.tsx +17 -0
  206. package/src/demo/pages/Drawer/components/DrawerAnimations.module.css +125 -0
  207. package/src/demo/pages/Drawer/components/DrawerAnimations.tsx +118 -0
  208. package/src/demo/pages/Drawer/components/DrawerBasics.module.css +55 -0
  209. package/src/demo/pages/Drawer/components/DrawerBasics.tsx +76 -0
  210. package/src/demo/pages/Drawer/components/DrawerMenuLayout.module.css +332 -0
  211. package/src/demo/pages/Drawer/components/DrawerMenuLayout.tsx +199 -0
  212. package/src/demo/pages/Drawer/menu/index.tsx +17 -0
  213. package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.module.css +163 -0
  214. package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.tsx +234 -0
  215. package/src/demo/pages/FloatingPanelFrame/basic/index.tsx +17 -0
  216. package/src/demo/pages/FloatingPanelFrame/complex/index.tsx +26 -0
  217. package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.module.css +16 -0
  218. package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.tsx +24 -0
  219. package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.module.css +54 -0
  220. package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.tsx +67 -0
  221. package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.module.css +21 -0
  222. package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.tsx +41 -0
  223. package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.module.css +5 -0
  224. package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.tsx +43 -0
  225. package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.module.css +11 -0
  226. package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.tsx +42 -0
  227. package/src/demo/pages/FloatingPanelFrame/index.tsx +80 -0
  228. package/src/demo/pages/FloatingPanelFrame/scrollable/index.tsx +30 -0
  229. package/src/demo/pages/FloatingPanelFrame/with-controls/index.tsx +30 -0
  230. package/src/demo/pages/FloatingPanelFrame/with-meta/index.tsx +17 -0
  231. package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.module.css +112 -0
  232. package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.tsx +56 -0
  233. package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.module.css +46 -0
  234. package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.tsx +29 -0
  235. package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.module.css +54 -0
  236. package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.tsx +30 -0
  237. package/src/demo/pages/HorizontalDivider/index.module.css +14 -0
  238. package/src/demo/pages/HorizontalDivider/index.tsx +64 -0
  239. package/src/demo/pages/HorizontalDivider/panels-with-rich-content/index.tsx +21 -0
  240. package/src/demo/pages/HorizontalDivider/simple-resizable-panels/index.tsx +21 -0
  241. package/src/demo/pages/HorizontalDivider/three-panel-layout/index.tsx +21 -0
  242. package/src/demo/pages/PanelLayout/PanelLayoutDemo.module.css +174 -0
  243. package/src/demo/pages/PanelLayout/PanelLayoutDemo.tsx +248 -0
  244. package/src/demo/pages/PanelLayout/components/DashboardLayout.module.css +115 -0
  245. package/src/demo/pages/PanelLayout/components/DashboardLayout.tsx +124 -0
  246. package/src/demo/pages/PanelLayout/components/DraggableOverlays.module.css +101 -0
  247. package/src/demo/pages/PanelLayout/components/DraggableOverlays.tsx +122 -0
  248. package/src/demo/pages/PanelLayout/components/IDELayout.module.css +104 -0
  249. package/src/demo/pages/PanelLayout/components/IDELayout.tsx +143 -0
  250. package/src/demo/pages/PanelLayout/components/SimpleGrid.module.css +19 -0
  251. package/src/demo/pages/PanelLayout/components/SimpleGrid.tsx +62 -0
  252. package/src/demo/pages/PanelLayout/dashboard/index.tsx +22 -0
  253. package/src/demo/pages/PanelLayout/draggable-overlays/index.tsx +22 -0
  254. package/src/demo/pages/PanelLayout/ide-layout/index.tsx +22 -0
  255. package/src/demo/pages/PanelLayout/index.tsx +94 -0
  256. package/src/demo/pages/PanelLayout/simple-grid/index.tsx +22 -0
  257. package/src/demo/pages/PanelSystem/PanelSystemPreview.module.css +20 -0
  258. package/src/demo/pages/PanelSystem/PanelSystemPreview.tsx +101 -0
  259. package/src/demo/pages/PanelSystem/preview/index.tsx +18 -0
  260. package/src/demo/pages/PanelSystem/tabbar/index.tsx +129 -0
  261. package/src/demo/pages/Pivot/basics/index.tsx +17 -0
  262. package/src/demo/pages/Pivot/components/Pivot.module.css +278 -0
  263. package/src/demo/pages/Pivot/components/PivotBasics.tsx +103 -0
  264. package/src/demo/pages/Pivot/components/PivotSidebar.tsx +168 -0
  265. package/src/demo/pages/Pivot/components/PivotTabs.tsx +129 -0
  266. package/src/demo/pages/Pivot/components/PivotTransitions.tsx +120 -0
  267. package/src/demo/pages/Pivot/components/SwipePivot.module.css +114 -0
  268. package/src/demo/pages/Pivot/components/SwipePivot.tsx +193 -0
  269. package/src/demo/pages/Pivot/components/SwipeTabsPivot.module.css +203 -0
  270. package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +289 -0
  271. package/src/demo/pages/Pivot/sidebar/index.tsx +17 -0
  272. package/src/demo/pages/Pivot/swipe/index.tsx +16 -0
  273. package/src/demo/pages/Pivot/swipe-debug/index.tsx +287 -0
  274. package/src/demo/pages/Pivot/swipe-tabs/index.tsx +15 -0
  275. package/src/demo/pages/Pivot/tabs/index.tsx +17 -0
  276. package/src/demo/pages/Pivot/transitions/index.tsx +17 -0
  277. package/src/demo/pages/ResizeHandle/both-directions/index.tsx +17 -0
  278. package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.module.css +72 -0
  279. package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.tsx +41 -0
  280. package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.module.css +61 -0
  281. package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.tsx +33 -0
  282. package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.module.css +83 -0
  283. package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.tsx +53 -0
  284. package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.module.css +68 -0
  285. package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.tsx +33 -0
  286. package/src/demo/pages/ResizeHandle/horizontal/index.tsx +17 -0
  287. package/src/demo/pages/ResizeHandle/index.module.css +11 -0
  288. package/src/demo/pages/ResizeHandle/index.tsx +71 -0
  289. package/src/demo/pages/ResizeHandle/nested-panels/index.tsx +17 -0
  290. package/src/demo/pages/ResizeHandle/vertical/index.tsx +17 -0
  291. package/src/demo/pages/ResponsiveLayout/adaptive-workspace/index.tsx +22 -0
  292. package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.module.css +423 -0
  293. package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.tsx +398 -0
  294. package/src/demo/pages/Stack/basics/index.tsx +22 -0
  295. package/src/demo/pages/Stack/components/Stack.module.css +234 -0
  296. package/src/demo/pages/Stack/components/StackBasics.tsx +217 -0
  297. package/src/demo/pages/Stack/components/StackTablet.module.css +299 -0
  298. package/src/demo/pages/Stack/components/StackTablet.tsx +401 -0
  299. package/src/demo/pages/Stack/tablet/index.tsx +22 -0
  300. package/src/demo/pages/StickyHeader/basics/index.tsx +17 -0
  301. package/src/demo/pages/StickyHeader/components/StickyHeader.module.css +219 -0
  302. package/src/demo/pages/StickyHeader/components/StickyHeaderBasics.tsx +103 -0
  303. package/src/demo/routes.tsx +193 -0
  304. package/src/demo/styles/animations.css +68 -0
  305. package/src/demo/styles/stack-themes.css +35 -0
  306. package/src/demo/utils/createPanelView.tsx +58 -0
  307. package/src/floating/index.ts +24 -0
  308. package/src/grid/index.ts +75 -0
  309. package/src/hooks/ContentCacheContext.tsx +87 -0
  310. package/src/hooks/gesture/presets.spec.ts +86 -0
  311. package/src/hooks/gesture/presets.ts +95 -0
  312. package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +237 -0
  313. package/src/hooks/gesture/testing/createGestureSimulator.ts +310 -0
  314. package/src/hooks/gesture/thresholdValue.spec.ts +103 -0
  315. package/src/hooks/gesture/thresholdValue.ts +77 -0
  316. package/src/hooks/gesture/types.ts +290 -0
  317. package/src/hooks/gesture/useDirectionalLock.spec.ts +271 -0
  318. package/src/hooks/gesture/useDirectionalLock.ts +115 -0
  319. package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +454 -0
  320. package/src/hooks/gesture/useEdgeSwipeInput.ts +131 -0
  321. package/src/hooks/gesture/useNativeGestureGuard.spec.ts +413 -0
  322. package/src/hooks/gesture/useNativeGestureGuard.ts +133 -0
  323. package/src/hooks/gesture/usePointerTracking.spec.ts +364 -0
  324. package/src/hooks/gesture/usePointerTracking.ts +134 -0
  325. package/src/hooks/gesture/useScrollBoundary.spec.ts +249 -0
  326. package/src/hooks/gesture/useScrollBoundary.ts +113 -0
  327. package/src/hooks/gesture/useSwipeInput.spec.ts +592 -0
  328. package/src/hooks/gesture/useSwipeInput.ts +310 -0
  329. package/src/hooks/gesture/utils.spec.ts +152 -0
  330. package/src/hooks/gesture/utils.ts +87 -0
  331. package/src/hooks/useAnimatedVisibility.spec.ts +257 -0
  332. package/src/hooks/useAnimatedVisibility.ts +146 -0
  333. package/src/hooks/useAnimationFrame.ts +200 -0
  334. package/src/hooks/useCSSMatrix.spec.ts +214 -0
  335. package/src/hooks/useCSSMatrix.ts +262 -0
  336. package/src/hooks/useClonedElementPreview.ts +28 -0
  337. package/src/hooks/useContainerScroll.ts +78 -0
  338. package/src/hooks/useContentCache.spec.tsx +232 -0
  339. package/src/hooks/useContentCache.tsx +127 -0
  340. package/src/hooks/useDocumentPointerEvents.ts +137 -0
  341. package/src/hooks/useDocumentScroll.ts +41 -0
  342. package/src/hooks/useEffectEvent.ts +40 -0
  343. package/src/hooks/useElementComponentWrapper.tsx +63 -0
  344. package/src/hooks/useIntersectionObserver.tsx +125 -0
  345. package/src/hooks/useIsomorphicLayoutEffect.ts +29 -0
  346. package/src/hooks/useResizeObserver.tsx +81 -0
  347. package/src/hooks/useScrollContainer.ts +79 -0
  348. package/src/hooks/useSnapAnimation.ts +128 -0
  349. package/src/hooks/useSwipeContentTransform.spec.ts +133 -0
  350. package/src/hooks/useSwipeContentTransform.ts +235 -0
  351. package/src/hooks/useTransitionState.ts +95 -0
  352. package/src/index.tsx +88 -0
  353. package/src/modules/grid/GridLayoutContext.tsx +57 -0
  354. package/src/modules/grid/LayerInstanceContext.tsx +56 -0
  355. package/src/modules/grid/resizeHandles.ts +157 -0
  356. package/src/modules/grid/trackUtils.ts +146 -0
  357. package/src/modules/grid/useGridPlacements.ts +143 -0
  358. package/src/modules/grid/useGridTracks.ts +156 -0
  359. package/src/modules/grid/useLayerDragHandle.ts +16 -0
  360. package/src/modules/grid/useLayerInteractions.tsx +850 -0
  361. package/src/modules/keybindings/KeybindingsProvider.tsx +111 -0
  362. package/src/modules/panels/dom/DomRegistry.tsx +94 -0
  363. package/src/modules/panels/index.ts +45 -0
  364. package/src/modules/panels/interactions/InteractionsContext.test.tsx +330 -0
  365. package/src/modules/panels/interactions/InteractionsContext.tsx +394 -0
  366. package/src/modules/panels/interactions/dnd.ts +28 -0
  367. package/src/modules/panels/keybindings/KeybindingsInstaller.tsx +15 -0
  368. package/src/modules/panels/layout/adapter.ts +124 -0
  369. package/src/modules/panels/rendering/ContentRegistry.spec.tsx +304 -0
  370. package/src/modules/panels/rendering/ContentRegistry.tsx +205 -0
  371. package/src/modules/panels/rendering/GroupContainer.tsx +65 -0
  372. package/src/modules/panels/rendering/RenderBridge.tsx +115 -0
  373. package/src/modules/panels/rendering/RenderContext.tsx +31 -0
  374. package/src/modules/panels/state/PanelSplitHandles.tsx +147 -0
  375. package/src/modules/panels/state/PanelSystemContext.splitLimits.spec.tsx +50 -0
  376. package/src/modules/panels/state/PanelSystemContext.tsx +289 -0
  377. package/src/modules/panels/state/StateContext.tsx +12 -0
  378. package/src/modules/panels/state/cleanup.ts +37 -0
  379. package/src/modules/panels/state/commands.ts +53 -0
  380. package/src/modules/panels/state/focus/Context.tsx +25 -0
  381. package/src/modules/panels/state/focus/logic.ts +57 -0
  382. package/src/modules/panels/state/groups/Context.tsx +25 -0
  383. package/src/modules/panels/state/groups/logic.ts +105 -0
  384. package/src/modules/panels/state/splitLimits.spec.ts +46 -0
  385. package/src/modules/panels/state/splitLimits.ts +90 -0
  386. package/src/modules/panels/state/state.spec.ts +49 -0
  387. package/src/modules/panels/state/tree/Context.tsx +24 -0
  388. package/src/modules/panels/state/tree/logic.spec.ts +34 -0
  389. package/src/modules/panels/state/tree/logic.ts +138 -0
  390. package/src/modules/panels/state/types.ts +142 -0
  391. package/src/modules/panels/system/PanelSystem.empty-tabbar.spec.tsx +53 -0
  392. package/src/modules/panels/system/PanelSystem.tab-click-activates.spec.tsx +44 -0
  393. package/src/modules/panels/system/PanelSystem.tab-reorder.spec.tsx +64 -0
  394. package/src/modules/panels/system/PanelSystem.tabs-no-dup.spec.tsx +57 -0
  395. package/src/modules/panels/system/PanelSystem.tsx +206 -0
  396. package/src/modules/pivot/PivotContent.spec.tsx +179 -0
  397. package/src/modules/pivot/PivotContent.tsx +77 -0
  398. package/src/modules/pivot/SwipePivotContent.debug.tmp.tsx +237 -0
  399. package/src/modules/pivot/SwipePivotContent.position.spec.tsx +167 -0
  400. package/src/modules/pivot/SwipePivotContent.spec.tsx +464 -0
  401. package/src/modules/pivot/SwipePivotContent.test.tsx +502 -0
  402. package/src/modules/pivot/SwipePivotContent.tsx +197 -0
  403. package/src/modules/pivot/SwipePivotTabBar.spec.tsx +865 -0
  404. package/src/modules/pivot/SwipePivotTabBar.tsx +523 -0
  405. package/src/modules/pivot/index.ts +8 -0
  406. package/src/modules/pivot/scaleInputState.spec.ts +210 -0
  407. package/src/modules/pivot/scaleInputState.ts +66 -0
  408. package/src/modules/pivot/types.ts +139 -0
  409. package/src/modules/pivot/usePivot.spec.ts +621 -0
  410. package/src/modules/pivot/usePivot.spec.tsx +186 -0
  411. package/src/modules/pivot/usePivot.tsx +345 -0
  412. package/src/modules/pivot/usePivotSwipeInput.spec.ts +649 -0
  413. package/src/modules/pivot/usePivotSwipeInput.ts +136 -0
  414. package/src/modules/resizer/useResizeDrag.ts +94 -0
  415. package/src/modules/stack/StackContent.spec.tsx +264 -0
  416. package/src/modules/stack/StackContent.tsx +111 -0
  417. package/src/modules/stack/SwipeStackContent.spec.tsx +1277 -0
  418. package/src/modules/stack/SwipeStackContent.tsx +356 -0
  419. package/src/modules/stack/SwipeStackOutlet.spec.tsx +252 -0
  420. package/src/modules/stack/SwipeStackOutlet.tsx +221 -0
  421. package/src/modules/stack/computeStackContentState.spec.ts +281 -0
  422. package/src/modules/stack/computeStackContentState.ts +304 -0
  423. package/src/modules/stack/computeSwipeStackTransform.spec.ts +186 -0
  424. package/src/modules/stack/computeSwipeStackTransform.ts +145 -0
  425. package/src/modules/stack/types.ts +226 -0
  426. package/src/modules/stack/useStackAnimationState.spec.ts +186 -0
  427. package/src/modules/stack/useStackAnimationState.ts +138 -0
  428. package/src/modules/stack/useStackNavigation.spec.ts +477 -0
  429. package/src/modules/stack/useStackNavigation.tsx +336 -0
  430. package/src/modules/stack/useStackSwipeInput.spec.ts +276 -0
  431. package/src/modules/stack/useStackSwipeInput.ts +139 -0
  432. package/src/modules/window/useDrawerState.ts +81 -0
  433. package/src/modules/window/useFloatingState.spec.ts +252 -0
  434. package/src/modules/window/useFloatingState.ts +141 -0
  435. package/src/panels/index.ts +119 -0
  436. package/src/pivot/index.ts +19 -0
  437. package/src/resizer/index.ts +68 -0
  438. package/src/stack/index.ts +91 -0
  439. package/src/sticky-header/StickyArea.tsx +221 -0
  440. package/src/sticky-header/index.ts +18 -0
  441. package/src/sticky-header/types.ts +68 -0
  442. package/src/types.ts +323 -0
  443. package/src/utils/CSSMatrix.ts +321 -0
  444. package/src/utils/css.ts +65 -0
  445. package/src/utils/dialogUtils.ts +43 -0
  446. package/src/utils/math.ts +18 -0
  447. package/src/utils/polyfills/createDialogPolyfill.ts +18 -0
  448. package/src/utils/typedActions.ts +103 -0
  449. package/src/vite-env.d.ts +6 -0
  450. package/src/window/index.ts +67 -0
  451. package/dist/GridLayout-BQQ63eA1.cjs +0 -2
  452. package/dist/GridLayout-BQQ63eA1.cjs.map +0 -1
  453. package/dist/GridLayout-CJTKq7Mp.js +0 -1465
  454. package/dist/GridLayout-CJTKq7Mp.js.map +0 -1
  455. package/dist/sticky-header/StickyHeader.d.ts +0 -53
  456. package/dist/styles-CA2_zLZt.js +0 -52
  457. package/dist/styles-CA2_zLZt.js.map +0 -1
  458. package/dist/styles-PsqGOEJP.cjs +0 -2
  459. package/dist/styles-PsqGOEJP.cjs.map +0 -1
  460. package/dist/usePivot-7ctin_P_.cjs +0 -2
  461. package/dist/usePivot-7ctin_P_.cjs.map +0 -1
  462. package/dist/usePivot-CgQxB8rc.js +0 -124
  463. package/dist/usePivot-CgQxB8rc.js.map +0 -1
@@ -0,0 +1,120 @@
1
+ import { jsx as g } from "react/jsx-runtime";
2
+ import * as r from "react";
3
+ import { u as h } from "./useDocumentPointerEvents-CKdhGXd0.js";
4
+ import { u as v } from "./useEffectEvent-Dp7HLCf0.js";
5
+ import { a as C, b as I, c as _, R as D, q as S } from "./styles-DPPuJ0sf.js";
6
+ const b = (e) => {
7
+ const n = r.useRef(null), o = r.useRef(null), s = r.useRef(0), [a, u] = r.useState(!1), c = v((t) => {
8
+ e.onResize?.(t);
9
+ }), i = r.useCallback(
10
+ (t) => e.axis === "x" ? t.clientX : t.clientY,
11
+ [e.axis]
12
+ ), E = r.useCallback(
13
+ (t) => {
14
+ t.preventDefault(), n.current = t.currentTarget, o.current = t.pointerId, s.current = i(t), u(!0);
15
+ },
16
+ [i]
17
+ ), l = r.useCallback(
18
+ (t) => {
19
+ const f = i(t), p = f - s.current;
20
+ p !== 0 && (s.current = f, c(p));
21
+ },
22
+ [i, c]
23
+ ), d = r.useCallback(() => {
24
+ u(!1), o.current = null;
25
+ }, []);
26
+ return h(n, a, {
27
+ onMove: l,
28
+ onUp: d,
29
+ pointerId: o.current ?? void 0,
30
+ capturePointer: !0,
31
+ preventDefaults: !1
32
+ }), {
33
+ ref: n,
34
+ onPointerDown: E,
35
+ isDragging: a
36
+ };
37
+ }, z = ({
38
+ element: e,
39
+ component: n
40
+ }) => r.forwardRef(({ children: o, ...s }, a) => e ? r.cloneElement(
41
+ e,
42
+ { ...s, ref: a },
43
+ o ?? e.props.children
44
+ ) : n ? /* @__PURE__ */ g(n, { ...s, ref: a, children: o }) : /* @__PURE__ */ g("div", { ...s, ref: a, children: o }));
45
+ function H({
46
+ element: e,
47
+ component: n
48
+ }) {
49
+ return r.useMemo(
50
+ () => z({
51
+ element: e,
52
+ component: n
53
+ }),
54
+ [n, e]
55
+ );
56
+ }
57
+ const L = {
58
+ position: "absolute",
59
+ zIndex: S
60
+ }, P = {
61
+ vertical: {
62
+ width: D,
63
+ height: "100%",
64
+ top: 0,
65
+ cursor: "col-resize"
66
+ },
67
+ horizontal: {
68
+ width: "100%",
69
+ height: D,
70
+ left: 0,
71
+ cursor: "row-resize"
72
+ }
73
+ }, k = {
74
+ idle: _,
75
+ hovered: I,
76
+ dragging: C
77
+ }, y = ({
78
+ direction: e,
79
+ onResize: n,
80
+ component: o,
81
+ element: s,
82
+ children: a
83
+ }) => {
84
+ const u = e === "vertical" ? "x" : "y", { ref: c, isDragging: i, onPointerDown: E } = b({ axis: u, onResize: n }), [l, d] = r.useState(!1), t = r.useCallback(() => {
85
+ d(!0);
86
+ }, []), f = r.useCallback(() => {
87
+ d(!1);
88
+ }, []), p = H({
89
+ element: s,
90
+ component: o
91
+ }), R = r.useMemo(() => i ? "dragging" : l ? "hovered" : "idle", [i, l]), m = r.useMemo(() => ({
92
+ ...L,
93
+ ...P[e],
94
+ backgroundColor: k[R],
95
+ touchAction: "none"
96
+ }), [e, R]);
97
+ return /* @__PURE__ */ g(
98
+ p,
99
+ {
100
+ ref: c,
101
+ style: m,
102
+ role: "separator",
103
+ "aria-orientation": e,
104
+ "aria-hidden": void 0,
105
+ "data-resize-handle": "true",
106
+ "data-direction": e,
107
+ "data-is-dragging": i ? "true" : void 0,
108
+ onPointerDown: E,
109
+ onPointerEnter: t,
110
+ onPointerLeave: f,
111
+ children: a
112
+ }
113
+ );
114
+ };
115
+ export {
116
+ y as R,
117
+ H as a,
118
+ b as u
119
+ };
120
+ //# sourceMappingURL=ResizeHandle-CdA_JYfN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizeHandle-CdA_JYfN.js","sources":["../src/modules/resizer/useResizeDrag.ts","../src/hooks/useElementComponentWrapper.tsx","../src/components/resizer/ResizeHandle.tsx"],"sourcesContent":["/**\n * @file Shared logic for draggable resize handles.\n */\nimport * as React from \"react\";\nimport { useDragPointerEvents } from \"../../hooks/useDocumentPointerEvents\";\nimport { useEffectEvent } from \"../../hooks/useEffectEvent\";\n\nexport type ResizeDragAxis = \"x\" | \"y\";\n\nexport type UseResizeDragOptions = {\n /** Axis along which the drag should compute deltas */\n axis: ResizeDragAxis;\n /** Callback invoked with the delta value when dragging */\n onResize?: (delta: number) => void;\n};\n\nexport type UseResizeDragResult<TElement extends HTMLElement> = {\n /** Ref to attach to the draggable element */\n ref: React.RefObject<TElement | null>;\n /** Pointer down handler to initiate dragging */\n onPointerDown: (event: React.PointerEvent<TElement>) => void;\n /** Whether a drag interaction is currently active */\n isDragging: boolean;\n};\n\n/**\n * Provides unified pointer handling for resize-capable UI elements.\n *\n * @param options - Configuration for the drag interaction.\n * @returns Handlers and state for wiring into a draggable element.\n */\nexport const useResizeDrag = <TElement extends HTMLElement = HTMLElement>(\n options: UseResizeDragOptions,\n): UseResizeDragResult<TElement> => {\n const elementRef = React.useRef<TElement | null>(null);\n const pointerIdRef = React.useRef<number | null>(null);\n const previousCoordinateRef = React.useRef<number>(0);\n const [isDragging, setIsDragging] = React.useState(false);\n\n const emitResize = useEffectEvent((delta: number) => {\n options.onResize?.(delta);\n });\n\n const getCoordinate = React.useCallback(\n (event: PointerEvent | React.PointerEvent) => {\n return options.axis === \"x\" ? event.clientX : event.clientY;\n },\n [options.axis],\n );\n\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent<TElement>) => {\n event.preventDefault();\n elementRef.current = event.currentTarget;\n pointerIdRef.current = event.pointerId;\n previousCoordinateRef.current = getCoordinate(event);\n setIsDragging(true);\n },\n [getCoordinate],\n );\n\n const handlePointerMove = React.useCallback(\n (event: PointerEvent) => {\n const coordinate = getCoordinate(event);\n const delta = coordinate - previousCoordinateRef.current;\n if (delta === 0) {\n return;\n }\n previousCoordinateRef.current = coordinate;\n emitResize(delta);\n },\n [getCoordinate, emitResize],\n );\n\n const handlePointerUp = React.useCallback(() => {\n setIsDragging(false);\n pointerIdRef.current = null;\n }, []);\n\n useDragPointerEvents(elementRef as React.RefObject<HTMLElement | null>, isDragging, {\n onMove: handlePointerMove,\n onUp: handlePointerUp,\n pointerId: pointerIdRef.current ?? undefined,\n capturePointer: true,\n preventDefaults: false,\n });\n\n return {\n ref: elementRef,\n onPointerDown: handlePointerDown,\n isDragging,\n };\n};\n\n","/**\n * @file Hook for building wrapper components that accept either an element or a component override.\n */\nimport * as React from \"react\";\n\ntype WrapperProps = React.HTMLAttributes<HTMLDivElement>;\n\ntype CloneableProps = WrapperProps & {\n ref?: React.Ref<HTMLDivElement>;\n};\n\ntype UseElementComponentWrapperOptions = {\n element?: React.ReactElement<WrapperProps>;\n component?: React.ComponentType<WrapperProps & { ref?: React.Ref<HTMLDivElement> }>;\n};\n\ntype WrapperComponent = React.ForwardRefExoticComponent<\n React.PropsWithChildren<WrapperProps> & React.RefAttributes<HTMLDivElement>\n>;\n\nconst createWrapperComponent = ({\n element,\n component: Component,\n}: UseElementComponentWrapperOptions): WrapperComponent =>\n React.forwardRef<HTMLDivElement, React.PropsWithChildren<WrapperProps>>(({ children, ...rest }, forwardedRef) => {\n if (element) {\n return React.cloneElement(\n element,\n { ...rest, ref: forwardedRef } as CloneableProps,\n children ?? element.props.children\n );\n }\n if (Component) {\n return (\n <Component {...rest} ref={forwardedRef}>\n {children}\n </Component>\n );\n }\n return (\n <div {...rest} ref={forwardedRef}>\n {children}\n </div>\n );\n });\n\n/**\n * Memoizes a wrapper component that can render either a provided element, a provided component, or a default tag.\n * @returns Wrapper component honoring the overrides.\n */\nexport function useElementComponentWrapper({\n element,\n component,\n}: UseElementComponentWrapperOptions): WrapperComponent {\n return React.useMemo(\n () =>\n createWrapperComponent({\n element,\n component,\n }),\n [component, element]\n );\n}\n","/**\n * @file Resize handle component\n */\nimport * as React from \"react\";\nimport { useResizeDrag } from \"../../modules/resizer/useResizeDrag\";\nimport {\n RESIZE_HANDLE_THICKNESS,\n RESIZE_HANDLE_Z_INDEX,\n COLOR_RESIZE_HANDLE_IDLE,\n COLOR_RESIZE_HANDLE_ACTIVE,\n COLOR_RESIZE_HANDLE_HOVER,\n} from \"../../constants/styles\";\nimport { useElementComponentWrapper } from \"../../hooks/useElementComponentWrapper\";\n\ntype ResizeHandleDirection = \"horizontal\" | \"vertical\";\n\nexport type ResizeHandleProps = {\n /** Direction of resize */\n direction: ResizeHandleDirection;\n /** Callback when resize occurs */\n onResize?: (delta: number) => void;\n /** Custom component for the handle */\n component?: React.ComponentType<React.HTMLAttributes<HTMLDivElement> & { ref?: React.Ref<HTMLDivElement> }>;\n /** Custom element for the handle */\n element?: React.ReactElement<React.HTMLAttributes<HTMLDivElement>>;\n /** Optional children rendered inside the handle */\n children?: React.ReactNode;\n};\n\nconst baseResizeHandleStyle: React.CSSProperties = {\n position: \"absolute\",\n zIndex: RESIZE_HANDLE_Z_INDEX,\n};\n\nconst sizeStylesByDirection: Record<ResizeHandleDirection, React.CSSProperties> = {\n vertical: {\n width: RESIZE_HANDLE_THICKNESS,\n height: \"100%\",\n top: 0,\n cursor: \"col-resize\",\n },\n horizontal: {\n width: \"100%\",\n height: RESIZE_HANDLE_THICKNESS,\n left: 0,\n cursor: \"row-resize\",\n },\n};\n\ntype ResizeHandleVisualState = \"idle\" | \"hovered\" | \"dragging\";\n\nconst backgroundByVisualState: Record<ResizeHandleVisualState, string> = {\n idle: COLOR_RESIZE_HANDLE_IDLE,\n hovered: COLOR_RESIZE_HANDLE_HOVER,\n dragging: COLOR_RESIZE_HANDLE_ACTIVE,\n};\n\n/**\n * ResizeHandle - Draggable handle for resizing grid areas\n */\nexport const ResizeHandle: React.FC<ResizeHandleProps> = ({\n direction,\n onResize,\n component: Component,\n element,\n children,\n}) => {\n const axis = direction === \"vertical\" ? \"x\" : \"y\";\n const { ref, isDragging, onPointerDown } = useResizeDrag<HTMLDivElement>({ axis, onResize });\n const [isHovered, setIsHovered] = React.useState(false);\n const handlePointerEnter = React.useCallback(() => {\n setIsHovered(true);\n }, []);\n const handlePointerLeave = React.useCallback(() => {\n setIsHovered(false);\n }, []);\n\n const Wrapper = useElementComponentWrapper({\n element,\n component: Component,\n });\n const visualState: ResizeHandleVisualState = React.useMemo(() => {\n if (isDragging) {\n return \"dragging\";\n }\n if (isHovered) {\n return \"hovered\";\n }\n return \"idle\";\n }, [isDragging, isHovered]);\n\n const style = React.useMemo(() => {\n return {\n ...baseResizeHandleStyle,\n ...sizeStylesByDirection[direction],\n backgroundColor: backgroundByVisualState[visualState],\n touchAction: \"none\",\n };\n }, [direction, visualState]);\n\n return (\n <Wrapper\n ref={ref}\n style={style}\n role=\"separator\"\n aria-orientation={direction}\n aria-hidden={undefined}\n data-resize-handle=\"true\"\n data-direction={direction}\n data-is-dragging={isDragging ? \"true\" : undefined}\n onPointerDown={onPointerDown}\n onPointerEnter={handlePointerEnter}\n onPointerLeave={handlePointerLeave}\n >\n {children}\n </Wrapper>\n );\n};\n"],"names":["useResizeDrag","options","elementRef","React","pointerIdRef","previousCoordinateRef","isDragging","setIsDragging","emitResize","useEffectEvent","delta","getCoordinate","event","handlePointerDown","handlePointerMove","coordinate","handlePointerUp","useDragPointerEvents","createWrapperComponent","element","Component","children","rest","forwardedRef","useElementComponentWrapper","component","baseResizeHandleStyle","RESIZE_HANDLE_Z_INDEX","sizeStylesByDirection","RESIZE_HANDLE_THICKNESS","backgroundByVisualState","COLOR_RESIZE_HANDLE_IDLE","COLOR_RESIZE_HANDLE_HOVER","COLOR_RESIZE_HANDLE_ACTIVE","ResizeHandle","direction","onResize","axis","ref","onPointerDown","isHovered","setIsHovered","handlePointerEnter","handlePointerLeave","Wrapper","visualState","style","jsx"],"mappings":";;;;;AA+BO,MAAMA,IAAgB,CAC3BC,MACkC;AAClC,QAAMC,IAAaC,EAAM,OAAwB,IAAI,GAC/CC,IAAeD,EAAM,OAAsB,IAAI,GAC/CE,IAAwBF,EAAM,OAAe,CAAC,GAC9C,CAACG,GAAYC,CAAa,IAAIJ,EAAM,SAAS,EAAK,GAElDK,IAAaC,EAAe,CAACC,MAAkB;AACnD,IAAAT,EAAQ,WAAWS,CAAK;AAAA,EAC1B,CAAC,GAEKC,IAAgBR,EAAM;AAAA,IAC1B,CAACS,MACQX,EAAQ,SAAS,MAAMW,EAAM,UAAUA,EAAM;AAAA,IAEtD,CAACX,EAAQ,IAAI;AAAA,EAAA,GAGTY,IAAoBV,EAAM;AAAA,IAC9B,CAACS,MAAwC;AACvC,MAAAA,EAAM,eAAA,GACNV,EAAW,UAAUU,EAAM,eAC3BR,EAAa,UAAUQ,EAAM,WAC7BP,EAAsB,UAAUM,EAAcC,CAAK,GACnDL,EAAc,EAAI;AAAA,IACpB;AAAA,IACA,CAACI,CAAa;AAAA,EAAA,GAGVG,IAAoBX,EAAM;AAAA,IAC9B,CAACS,MAAwB;AACvB,YAAMG,IAAaJ,EAAcC,CAAK,GAChCF,IAAQK,IAAaV,EAAsB;AACjD,MAAIK,MAAU,MAGdL,EAAsB,UAAUU,GAChCP,EAAWE,CAAK;AAAA,IAClB;AAAA,IACA,CAACC,GAAeH,CAAU;AAAA,EAAA,GAGtBQ,IAAkBb,EAAM,YAAY,MAAM;AAC9C,IAAAI,EAAc,EAAK,GACnBH,EAAa,UAAU;AAAA,EACzB,GAAG,CAAA,CAAE;AAEL,SAAAa,EAAqBf,GAAmDI,GAAY;AAAA,IAClF,QAAQQ;AAAA,IACR,MAAME;AAAA,IACN,WAAWZ,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ACJ,QAAMgB,IAAOF,MAAc,aAAa,MAAM,KACxC,EAAE,KAAAG,GAAK,YAAAhC,GAAY,eAAAiC,EAAA,IAAkBvC,EAA8B,EAAE,MAAAqC,GAAM,UAAAD,GAAU,GACrF,CAACI,GAAWC,CAAY,IAAItC,EAAM,SAAS,EAAK,GAChDuC,IAAqBvC,EAAM,YAAY,MAAM;AACjD,IAAAsC,EAAa,EAAI;AAAA,EACnB,GAAG,CAAA,CAAE,GACCE,IAAqBxC,EAAM,YAAY,MAAM;AACjD,IAAAsC,EAAa,EAAK;AAAA,EACpB,GAAG,CAAA,CAAE,GAECG,IAAUpB,EAA2B;AAAA,IACzC,SAAAL;AAAA,IACA,WAAWC;AAAA,EAAA,CACZ,GACKyB,IAAuC1C,EAAM,QAAQ,MACrDG,IACK,aAELkC,IACK,YAEF,QACN,CAAClC,GAAYkC,CAAS,CAAC,GAEpBM,IAAQ3C,EAAM,QAAQ,OACnB;AAAA,IACL,GAAGuB;AAAA,IACH,GAAGE,EAAsBO,CAAS;AAAA,IAClC,iBAAiBL,EAAwBe,CAAW;AAAA,IACpD,aAAa;AAAA,EAAA,IAEd,CAACV,GAAWU,CAAW,CAAC;AAE3B,SACE,gBAAAE;AAAA,IAACH;AAAA,IAAA;AAAA,MACC,KAAAN;AAAA,MACA,OAAAQ;AAAA,MACA,MAAK;AAAA,MACL,oBAAkBX;AAAA,MAClB,eAAa;AAAA,MACb,sBAAmB;AAAA,MACnB,kBAAgBA;AAAA,MAChB,oBAAkB7B,IAAa,SAAS;AAAA,MACxC,eAAAiC;AAAA,MACA,gBAAgBG;AAAA,MAChB,gBAAgBC;AAAA,MAEf,UAAAtB;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -0,0 +1,407 @@
1
+ import { jsx as R, Fragment as H, jsxs as L } from "react/jsx-runtime";
2
+ import * as e from "react";
3
+ import { P as J, r as X } from "./styles-DPPuJ0sf.js";
4
+ import { u as K } from "./useContentCache-CO3LYNmz.js";
5
+ const Q = 1e3;
6
+ function Z({
7
+ isVisible: s,
8
+ leaveAnimation: o,
9
+ skipAnimation: r = !1,
10
+ animationTimeout: h = Q
11
+ }) {
12
+ const u = e.useRef(s), [n, a] = e.useState(!1), l = e.useRef(null);
13
+ e.useEffect(() => () => {
14
+ l.current && clearTimeout(l.current);
15
+ }, []), e.useEffect(() => {
16
+ const i = u.current;
17
+ u.current = s, l.current && (clearTimeout(l.current), l.current = null), i && !s ? r || !o || o === "none" ? a(!1) : (a(!0), l.current = setTimeout(() => {
18
+ a(!1);
19
+ }, h)) : !i && s && a(!1);
20
+ }, [s, o, r, h]);
21
+ const b = e.useCallback(
22
+ (i) => {
23
+ i.target === i.currentTarget && n && (l.current && (clearTimeout(l.current), l.current = null), a(!1));
24
+ },
25
+ [n]
26
+ ), y = s || n;
27
+ return {
28
+ state: {
29
+ shouldDisplay: y,
30
+ isAnimatingOut: n
31
+ },
32
+ props: {
33
+ onAnimationEnd: b
34
+ },
35
+ style: {
36
+ display: y ? "block" : "none"
37
+ }
38
+ };
39
+ }
40
+ const W = {
41
+ position: "absolute",
42
+ inset: 0,
43
+ width: "100%",
44
+ height: "100%"
45
+ }, tt = e.memo(({ id: s, isActive: o, transitionMode: r, children: h }) => {
46
+ const u = Z({
47
+ isVisible: o,
48
+ leaveAnimation: r === "css" ? X : void 0,
49
+ skipAnimation: r !== "css"
50
+ }), n = e.useMemo(() => {
51
+ const l = {
52
+ ...W,
53
+ ...u.style,
54
+ pointerEvents: o ? "auto" : "none"
55
+ };
56
+ return r === "css" && (l.animation = o ? J : X), l;
57
+ }, [o, r, u.style]), a = /* @__PURE__ */ R(
58
+ "div",
59
+ {
60
+ "data-pivot-content": s,
61
+ "data-active": o ? "true" : "false",
62
+ style: n,
63
+ ...u.props,
64
+ children: h
65
+ }
66
+ );
67
+ return r === "none" ? /* @__PURE__ */ R(e.Activity, { mode: o ? "visible" : "hidden", children: a }) : a;
68
+ }), B = e.createContext(null), et = e.memo(() => {
69
+ const s = e.useContext(B);
70
+ if (!s)
71
+ throw new Error("PivotOutlet must be used within usePivot");
72
+ const [, o] = e.useReducer((n) => n + 1, 0);
73
+ e.useEffect(() => s.subscribe(o), [s]);
74
+ const { items: r, activeId: h, transitionMode: u } = s.getState();
75
+ return /* @__PURE__ */ R(H, { children: r.map((n) => /* @__PURE__ */ R(tt, { id: n.id, isActive: n.id === h, transitionMode: u, children: n.cache ? s.getCachedContent(n.id) : n.content }, n.id)) });
76
+ });
77
+ function ut(s) {
78
+ const { items: o, activeId: r, defaultActiveId: h, onActiveChange: u, transitionMode: n = "css", navigationMode: a = "linear" } = s, l = r !== void 0, [b, y] = e.useState(() => {
79
+ if (h !== void 0)
80
+ return h;
81
+ const t = o.find((c) => c.disabled !== !0);
82
+ if (!t)
83
+ throw new Error("usePivot: No enabled items provided");
84
+ return t.id;
85
+ }), i = l ? r : b, [v, S] = e.useState(!1), O = e.useCallback(
86
+ (t, c) => {
87
+ const p = o.find((M) => M.id === t);
88
+ if (!p || p.disabled)
89
+ return;
90
+ const g = c?.animated ?? n === "css";
91
+ S(g), l || y(t), u?.(t);
92
+ },
93
+ [o, l, u, n]
94
+ ), w = e.useCallback(() => {
95
+ S(!1);
96
+ }, []), x = e.useCallback((t) => t === i, [i]), I = e.useMemo(
97
+ () => o.filter((t) => t.disabled !== !0),
98
+ [o]
99
+ ), f = e.useMemo(() => {
100
+ const t = I.findIndex((c) => c.id === i);
101
+ return t === -1 ? 0 : t;
102
+ }, [I, i]), d = I.length, k = e.useCallback(
103
+ (t) => {
104
+ if (t === 0)
105
+ return !1;
106
+ if (a === "loop")
107
+ return d >= 2;
108
+ const c = f + t;
109
+ return c >= 0 && c < d;
110
+ },
111
+ [f, d, a]
112
+ ), _ = e.useCallback(
113
+ (t) => {
114
+ const c = f + t;
115
+ return a === "loop" ? (c % d + d) % d : c;
116
+ },
117
+ [f, a, d]
118
+ ), C = e.useCallback(
119
+ (t, c) => {
120
+ if (!k(t))
121
+ return;
122
+ const p = _(t), g = I[p];
123
+ g && O(g.id, c);
124
+ },
125
+ [k, _, I, O]
126
+ ), D = e.useCallback(
127
+ (t) => {
128
+ const c = I.findIndex((g) => g.id === t);
129
+ if (c === -1)
130
+ return null;
131
+ if (a === "linear") {
132
+ const g = c - f;
133
+ return Math.abs(g) > 1 ? null : g;
134
+ }
135
+ const p = ((c - f) % d + d) % d;
136
+ return p === 0 ? 0 : p === 1 ? 1 : d - p === 1 ? -1 : null;
137
+ },
138
+ [I, f, a, d]
139
+ ), F = e.useCallback(
140
+ (t) => {
141
+ const c = I.findIndex((M) => M.id === t);
142
+ if (c === -1)
143
+ return null;
144
+ if (a === "linear")
145
+ return c - f;
146
+ const p = ((c - f) % d + d) % d, g = d - p;
147
+ return p <= g ? p : -g;
148
+ },
149
+ [I, f, a, d]
150
+ ), q = e.useCallback(
151
+ (t) => ({
152
+ "data-pivot-item": t,
153
+ "data-active": t === i ? "true" : "false",
154
+ "aria-selected": t === i,
155
+ tabIndex: t === i ? 0 : -1,
156
+ onClick: () => {
157
+ O(t);
158
+ }
159
+ }),
160
+ [i, O]
161
+ ), U = e.useMemo(
162
+ () => ({
163
+ position: "relative",
164
+ width: "100%",
165
+ height: "100%"
166
+ }),
167
+ []
168
+ ), T = e.useRef({
169
+ items: o,
170
+ activeId: i,
171
+ transitionMode: n
172
+ });
173
+ T.current = {
174
+ items: o,
175
+ activeId: i,
176
+ transitionMode: n
177
+ };
178
+ const N = e.useRef(/* @__PURE__ */ new Set());
179
+ e.useEffect(() => {
180
+ N.current.forEach((t) => t());
181
+ }, [i, n]);
182
+ const z = e.useCallback(
183
+ (t) => T.current.items.find((p) => p.id === t)?.content ?? null,
184
+ []
185
+ ), m = e.useMemo(() => o.map((t) => t.id), [o]), { getCachedContent: A } = K({
186
+ resolveContent: z,
187
+ validIds: m
188
+ }), P = e.useMemo(
189
+ () => ({
190
+ getState: () => T.current,
191
+ subscribe: (t) => (N.current.add(t), () => N.current.delete(t)),
192
+ getCachedContent: A
193
+ }),
194
+ [A]
195
+ ), E = e.useMemo(() => {
196
+ const t = () => /* @__PURE__ */ R(B.Provider, { value: P, children: /* @__PURE__ */ R("div", { style: U, "data-pivot-container": !0, children: /* @__PURE__ */ R(et, {}) }) });
197
+ return t.displayName = "PivotOutlet", t;
198
+ }, [P, U]);
199
+ return { activeId: i, setActiveId: O, isActive: x, getItemProps: q, Outlet: E, go: C, canGo: k, activeIndex: f, itemCount: d, isAnimating: v, endAnimation: w, navigationMode: a, getVirtualPosition: D, getItemPosition: F };
200
+ }
201
+ const nt = 300, rt = (s, o) => s.phase === "idle" ? 0 : o === "horizontal" ? s.displacement.x : s.displacement.y, G = (s, o) => (s % o + o) % o, st = (s, o, r, h) => {
202
+ const u = o + s;
203
+ return h === "linear" ? u < 0 || u >= r ? null : u : G(u, r);
204
+ }, ot = e.memo(({
205
+ slotPosition: s,
206
+ item: o,
207
+ itemIndex: r,
208
+ isActive: h,
209
+ centerX: u,
210
+ tabWidth: n,
211
+ viewportWidth: a,
212
+ offsetPx: l,
213
+ axis: b,
214
+ renderTab: y
215
+ }) => {
216
+ const i = s * n, v = u + i + l, S = v + n > 0 && v < a, O = b === "horizontal" ? "translateX" : "translateY";
217
+ return /* @__PURE__ */ R(
218
+ "div",
219
+ {
220
+ "data-pivot-tab": o.id,
221
+ "data-slot": s,
222
+ "data-active": h ? "true" : "false",
223
+ style: {
224
+ position: "absolute",
225
+ left: u,
226
+ top: 0,
227
+ width: n,
228
+ height: "100%",
229
+ visibility: S ? "visible" : "hidden",
230
+ willChange: "transform",
231
+ transform: `${O}(${i + l}px)`
232
+ },
233
+ children: y(o, h, r)
234
+ }
235
+ );
236
+ }), $ = (s) => s === 1 ? 1 : 1 - Math.pow(2, -10 * s);
237
+ function lt({
238
+ items: s,
239
+ activeId: o,
240
+ activeIndex: r,
241
+ itemCount: h,
242
+ inputState: u,
243
+ tabWidth: n,
244
+ viewportWidth: a,
245
+ navigationMode: l = "linear",
246
+ axis: b = "horizontal",
247
+ renderTab: y,
248
+ animationDuration: i = nt,
249
+ fixedTabs: v = !1,
250
+ renderIndicator: S
251
+ }) {
252
+ const O = rt(u, b), w = u.phase === "swiping" || u.phase === "tracking", [x, I] = e.useState(0), f = e.useRef(null), [d, k] = e.useState(r * n), _ = e.useRef(r * n), C = e.useRef(null), D = e.useRef(null);
253
+ e.useEffect(() => {
254
+ _.current = d;
255
+ }, [d]);
256
+ const F = e.useRef(r), q = Math.ceil(a / n / 2) + 1, U = (a - n) / 2;
257
+ e.useEffect(() => {
258
+ if (!v || !w) return;
259
+ const m = r * n - O;
260
+ D.current = m, k(m);
261
+ }, [v, w, r, n, O]), e.useEffect(() => {
262
+ if (!v || w) return;
263
+ const m = r * n, A = D.current ?? _.current;
264
+ if (D.current = null, Math.abs(A - m) < 1) {
265
+ k(m);
266
+ return;
267
+ }
268
+ C.current && cancelAnimationFrame(C.current.rafId);
269
+ const P = performance.now(), E = A, t = (c) => {
270
+ const p = c - P, g = Math.min(p / i, 1), M = $(g), V = E + (m - E) * M;
271
+ k(V), g < 1 ? C.current = {
272
+ rafId: requestAnimationFrame(t)
273
+ } : (C.current = null, k(m));
274
+ };
275
+ C.current = {
276
+ rafId: requestAnimationFrame(t)
277
+ };
278
+ }, [v, w, r, n, i]), e.useEffect(() => {
279
+ if (v || F.current === r)
280
+ return;
281
+ const m = F.current;
282
+ F.current = r;
283
+ let A;
284
+ if (l === "loop") {
285
+ const p = G(r - m, h), g = h - p;
286
+ A = p <= g ? p : -g;
287
+ } else
288
+ A = r - m;
289
+ const P = -A * n, E = w ? O : x;
290
+ if (f.current && cancelAnimationFrame(f.current.rafId), Math.abs(E - P) < 1) {
291
+ I(0);
292
+ return;
293
+ }
294
+ const t = performance.now(), c = (p) => {
295
+ const g = p - t, M = Math.min(g / i, 1), V = $(M), j = E - P, Y = j * (1 - V);
296
+ I(Y), M < 1 ? f.current = {
297
+ startTime: t,
298
+ startOffset: j,
299
+ targetOffset: 0,
300
+ rafId: requestAnimationFrame(c)
301
+ } : (f.current = null, I(0));
302
+ };
303
+ f.current = {
304
+ startTime: t,
305
+ startOffset: E - P,
306
+ targetOffset: 0,
307
+ rafId: requestAnimationFrame(c)
308
+ };
309
+ }, [v, r, h, n, i, l, O, w, x]), e.useEffect(() => {
310
+ v && (F.current = r);
311
+ }, [v, r]), e.useEffect(() => () => {
312
+ f.current && cancelAnimationFrame(f.current.rafId), C.current && cancelAnimationFrame(C.current.rafId);
313
+ }, []);
314
+ const T = w ? O : x, N = f.current !== null || C.current !== null;
315
+ if (e.useEffect(() => {
316
+ w && f.current && (cancelAnimationFrame(f.current.rafId), f.current = null, I(0));
317
+ }, [w]), v) {
318
+ const m = s.length * n, A = (a - m) / 2;
319
+ return /* @__PURE__ */ L(
320
+ "div",
321
+ {
322
+ style: {
323
+ position: "relative",
324
+ width: "100%",
325
+ height: "100%",
326
+ overflow: "hidden",
327
+ display: "flex",
328
+ justifyContent: "center"
329
+ },
330
+ children: [
331
+ S?.({
332
+ offsetPx: d,
333
+ tabWidth: n,
334
+ centerX: A,
335
+ isSwiping: w,
336
+ isAnimating: N
337
+ }),
338
+ s.map((P, E) => /* @__PURE__ */ R(
339
+ "div",
340
+ {
341
+ "data-pivot-tab": P.id,
342
+ "data-active": E === r ? "true" : "false",
343
+ style: {
344
+ position: "relative",
345
+ width: n,
346
+ height: "100%",
347
+ flexShrink: 0
348
+ },
349
+ children: y(P, E === r, E)
350
+ },
351
+ P.id
352
+ ))
353
+ ]
354
+ }
355
+ );
356
+ }
357
+ const z = [];
358
+ for (let m = -q; m <= q; m++) {
359
+ const A = st(m, r, h, l);
360
+ A !== null && z.push({
361
+ slotPosition: m,
362
+ itemIndex: A,
363
+ item: s[A]
364
+ });
365
+ }
366
+ return /* @__PURE__ */ L(
367
+ "div",
368
+ {
369
+ style: {
370
+ position: "relative",
371
+ width: "100%",
372
+ height: "100%",
373
+ overflow: "hidden"
374
+ },
375
+ children: [
376
+ S?.({
377
+ offsetPx: T,
378
+ tabWidth: n,
379
+ centerX: U,
380
+ isSwiping: w,
381
+ isAnimating: N
382
+ }),
383
+ z.map(({ slotPosition: m, itemIndex: A, item: P }) => /* @__PURE__ */ R(
384
+ ot,
385
+ {
386
+ slotPosition: m,
387
+ item: P,
388
+ itemIndex: A,
389
+ isActive: A === r,
390
+ centerX: U,
391
+ tabWidth: n,
392
+ viewportWidth: a,
393
+ offsetPx: T,
394
+ axis: b,
395
+ renderTab: y
396
+ },
397
+ m
398
+ ))
399
+ ]
400
+ }
401
+ );
402
+ }
403
+ export {
404
+ lt as S,
405
+ ut as u
406
+ };
407
+ //# sourceMappingURL=SwipePivotTabBar-BGO9X94m.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwipePivotTabBar-BGO9X94m.js","sources":["../src/hooks/useAnimatedVisibility.ts","../src/modules/pivot/PivotContent.tsx","../src/modules/pivot/usePivot.tsx","../src/modules/pivot/SwipePivotTabBar.tsx"],"sourcesContent":["/**\n * @file Hook for animation-aware visibility control.\n *\n * Common pattern for showing/hiding elements with CSS animations:\n * - If animation exists: wait for animationend before hiding\n * - If no animation: hide immediately\n * - Uses display:none for performance (removes from layout)\n * - Includes timeout fallback in case animationend doesn't fire\n */\nimport * as React from \"react\";\n\n/** Default timeout for animation fallback (ms) */\nconst DEFAULT_ANIMATION_TIMEOUT = 1000;\n\ntype AnimatedVisibilityState = {\n /** Whether element should be displayed (display: block/none) */\n shouldDisplay: boolean;\n /** Whether element is currently animating out */\n isAnimatingOut: boolean;\n};\n\ntype UseAnimatedVisibilityOptions = {\n /** Whether the element is logically visible */\n isVisible: boolean;\n /** CSS animation value for leave animation (e.g., CSS variable) */\n leaveAnimation?: string;\n /** Skip animation and hide immediately */\n skipAnimation?: boolean;\n /** Timeout for animation fallback in ms (default: 1000ms) */\n animationTimeout?: number;\n};\n\ntype UseAnimatedVisibilityResult = {\n /** Current visibility state */\n state: AnimatedVisibilityState;\n /** Props to spread on the animated element */\n props: {\n onAnimationEnd: (e: React.AnimationEvent) => void;\n };\n /** Style to apply for display control */\n style: {\n display: \"block\" | \"none\";\n };\n};\n\n/**\n * Hook for animation-aware visibility control.\n *\n * @example\n * const { state, props, style } = useAnimatedVisibility({\n * isVisible: isActive,\n * leaveAnimation: PIVOT_ANIMATION_LEAVE,\n * });\n *\n * return (\n * <div\n * style={{ ...baseStyle, ...style, animation: isActive ? enterAnim : leaveAnim }}\n * {...props}\n * >\n * {children}\n * </div>\n * );\n */\nexport function useAnimatedVisibility({\n isVisible,\n leaveAnimation,\n skipAnimation = false,\n animationTimeout = DEFAULT_ANIMATION_TIMEOUT,\n}: UseAnimatedVisibilityOptions): UseAnimatedVisibilityResult {\n const prevVisibleRef = React.useRef(isVisible);\n const [isAnimatingOut, setIsAnimatingOut] = React.useState(false);\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Clear timeout on unmount\n React.useEffect(() => {\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n React.useEffect(() => {\n const wasVisible = prevVisibleRef.current;\n prevVisibleRef.current = isVisible;\n\n // Clear any pending timeout\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n if (wasVisible && !isVisible) {\n // Transitioning from visible to hidden\n if (skipAnimation || !leaveAnimation || leaveAnimation === \"none\") {\n // No animation, hide immediately\n setIsAnimatingOut(false);\n } else {\n // Has animation, mark as animating out\n setIsAnimatingOut(true);\n\n // Set timeout fallback in case animationend doesn't fire\n // (e.g., CSS variable resolves to \"none\", or animation is very short)\n timeoutRef.current = setTimeout(() => {\n setIsAnimatingOut(false);\n }, animationTimeout);\n }\n } else if (!wasVisible && isVisible) {\n // Transitioning from hidden to visible\n setIsAnimatingOut(false);\n }\n }, [isVisible, leaveAnimation, skipAnimation, animationTimeout]);\n\n const handleAnimationEnd = React.useCallback(\n (e: React.AnimationEvent) => {\n // Only handle animation end for this element (not bubbled from children)\n if (e.target === e.currentTarget && isAnimatingOut) {\n // Clear timeout since animation completed normally\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n setIsAnimatingOut(false);\n }\n },\n [isAnimatingOut],\n );\n\n // Element should be displayed if:\n // - It's visible, OR\n // - It's animating out (leave animation in progress)\n const shouldDisplay = isVisible || isAnimatingOut;\n\n return {\n state: {\n shouldDisplay,\n isAnimatingOut,\n },\n props: {\n onAnimationEnd: handleAnimationEnd,\n },\n style: {\n display: shouldDisplay ? \"block\" : \"none\",\n },\n };\n}\n","/**\n * @file PivotContent component for rendering pivot items with CSS animations.\n *\n * Override via CSS custom properties:\n * - --rpl-pivot-animation-enter: Animation when becoming active\n * - --rpl-pivot-animation-leave: Animation when becoming inactive\n *\n * User defines @keyframes in their CSS and references via these tokens.\n * Example:\n * @keyframes pivotEnter {\n * from { opacity: 0; }\n * to { opacity: 1; }\n * }\n * :root { --rpl-pivot-animation-enter: pivotEnter 150ms ease-out forwards; }\n */\nimport * as React from \"react\";\nimport { PIVOT_ANIMATION_ENTER, PIVOT_ANIMATION_LEAVE } from \"../../constants/styles\";\nimport { useAnimatedVisibility } from \"../../hooks/useAnimatedVisibility\";\n\nexport type PivotContentProps = {\n id: string;\n isActive: boolean;\n transitionMode: \"css\" | \"none\";\n children: React.ReactNode;\n};\n\nconst baseStyle: React.CSSProperties = {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n};\n\n/**\n * Renders pivot content with CSS animation support.\n *\n * When transitionMode=\"css\": Applies enter/leave animations with display:none when hidden.\n * When transitionMode=\"none\": Uses React.Activity for memory optimization.\n */\nexport const PivotContent: React.FC<PivotContentProps> = React.memo(({ id, isActive, transitionMode, children }) => {\n const visibility = useAnimatedVisibility({\n isVisible: isActive,\n leaveAnimation: transitionMode === \"css\" ? PIVOT_ANIMATION_LEAVE : undefined,\n skipAnimation: transitionMode !== \"css\",\n });\n\n const style = React.useMemo<React.CSSProperties>(() => {\n const s: React.CSSProperties = {\n ...baseStyle,\n ...visibility.style,\n pointerEvents: isActive ? \"auto\" : \"none\",\n };\n\n if (transitionMode === \"css\") {\n s.animation = isActive ? PIVOT_ANIMATION_ENTER : PIVOT_ANIMATION_LEAVE;\n }\n\n return s;\n }, [isActive, transitionMode, visibility.style]);\n\n const content = (\n <div\n data-pivot-content={id}\n data-active={isActive ? \"true\" : \"false\"}\n style={style}\n {...visibility.props}\n >\n {children}\n </div>\n );\n\n if (transitionMode === \"none\") {\n return <React.Activity mode={isActive ? \"visible\" : \"hidden\"}>{content}</React.Activity>;\n }\n\n return content;\n});\n","/**\n * @file Headless hook for managing Pivot (content switching) behavior.\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 items array.\n */\nimport * as React from \"react\";\nimport type { UsePivotOptions, UsePivotResult, PivotItemProps, PivotItem, PivotNavigationOptions } from \"./types\";\nimport { PivotContent } from \"./PivotContent\";\nimport { useContentCache } from \"../../hooks/useContentCache\";\n\n/**\n * Context for sharing pivot state with Outlet component.\n * Uses a ref-based approach to avoid re-creating the Outlet component.\n * Includes content cache to preserve component state.\n */\ntype PivotOutletContextValue = {\n getState: () => {\n items: ReadonlyArray<PivotItem>;\n activeId: string;\n transitionMode: \"css\" | \"none\";\n };\n subscribe: (callback: () => void) => () => void;\n /**\n * Get cached content for an item. Returns the same ReactNode reference\n * for the same item ID to prevent remounting on parent re-renders.\n */\n getCachedContent: (itemId: string) => React.ReactNode | null;\n};\n\nconst PivotOutletContext = React.createContext<PivotOutletContextValue | null>(null);\n\n/**\n * Stable Outlet component that subscribes to state changes.\n * This prevents remounting when activeId changes.\n * Uses cached content only when item.cache is true.\n */\nconst PivotOutletInner: React.FC = React.memo(() => {\n const ctx = React.useContext(PivotOutletContext);\n if (!ctx) {\n throw new Error(\"PivotOutlet must be used within usePivot\");\n }\n\n const [, forceUpdate] = React.useReducer((x) => x + 1, 0);\n\n React.useEffect(() => {\n return ctx.subscribe(forceUpdate);\n }, [ctx]);\n\n const { items, activeId, transitionMode } = ctx.getState();\n\n return (\n <>\n {items.map((item) => (\n <PivotContent key={item.id} id={item.id} isActive={item.id === activeId} transitionMode={transitionMode}>\n {item.cache ? ctx.getCachedContent(item.id) : item.content}\n </PivotContent>\n ))}\n </>\n );\n});\n\n/**\n * Headless hook for managing content switching within a scope.\n * Provides behavior only - UI is fully customizable.\n *\n * @example\n * ```tsx\n * const { activeId, getItemProps, Outlet } = usePivot({\n * items: [\n * { id: 'home', label: 'Home', content: <HomePage /> },\n * { id: 'settings', label: 'Settings', content: <SettingsPage /> }\n * ],\n * defaultActiveId: 'home'\n * });\n *\n * return (\n * <div>\n * <nav>\n * {items.map((item) => (\n * <button key={item.id} {...getItemProps(item.id)}>{item.label}</button>\n * ))}\n * </nav>\n * <Outlet />\n * </div>\n * );\n * ```\n */\nexport function usePivot<TId extends string = string>(options: UsePivotOptions<TId>): UsePivotResult<TId> {\n const { items, activeId: controlledActiveId, defaultActiveId, onActiveChange, transitionMode = \"css\", navigationMode = \"linear\" } = options;\n\n const isControlled = controlledActiveId !== undefined;\n\n const [uncontrolledActiveId, setUncontrolledActiveId] = React.useState<TId>(() => {\n if (defaultActiveId !== undefined) {\n return defaultActiveId;\n }\n const firstEnabled = items.find((item) => item.disabled !== true);\n if (!firstEnabled) {\n throw new Error(\"usePivot: No enabled items provided\");\n }\n return firstEnabled.id;\n });\n\n const activeId = isControlled ? controlledActiveId : uncontrolledActiveId;\n\n // Animation state\n const [isAnimating, setIsAnimating] = React.useState(false);\n\n const setActiveId = React.useCallback(\n (id: TId, options?: PivotNavigationOptions) => {\n const target = items.find((item) => item.id === id);\n if (!target) {\n return;\n }\n if (target.disabled) {\n return;\n }\n\n // Determine if we should animate\n const shouldAnimate = options?.animated ?? (transitionMode === \"css\");\n setIsAnimating(shouldAnimate);\n\n if (!isControlled) {\n setUncontrolledActiveId(id);\n }\n onActiveChange?.(id);\n },\n [items, isControlled, onActiveChange, transitionMode],\n );\n\n // End animation callback\n const endAnimation = React.useCallback(() => {\n setIsAnimating(false);\n }, []);\n\n const isActive = React.useCallback((id: TId): boolean => id === activeId, [activeId]);\n\n // Get only enabled items for navigation\n const enabledItems = React.useMemo(\n () => items.filter((item) => item.disabled !== true),\n [items],\n );\n\n // Current index in enabled items\n const activeIndex = React.useMemo(() => {\n const index = enabledItems.findIndex((item) => item.id === activeId);\n return index === -1 ? 0 : index;\n }, [enabledItems, activeId]);\n\n // Total count of enabled items\n const itemCount = enabledItems.length;\n\n // Check if navigation in a direction is possible\n const canGo = React.useCallback(\n (direction: number): boolean => {\n if (direction === 0) {\n return false;\n }\n // In loop mode, navigation is always possible if there are 2+ items\n if (navigationMode === \"loop\") {\n return itemCount >= 2;\n }\n // Linear mode: check bounds\n const targetIndex = activeIndex + direction;\n return targetIndex >= 0 && targetIndex < itemCount;\n },\n [activeIndex, itemCount, navigationMode],\n );\n\n // Compute target index with optional wrap-around\n const computeTargetIndex = React.useCallback(\n (direction: number): number => {\n const rawIndex = activeIndex + direction;\n if (navigationMode === \"loop\") {\n return ((rawIndex % itemCount) + itemCount) % itemCount;\n }\n return rawIndex;\n },\n [activeIndex, navigationMode, itemCount],\n );\n\n // Navigate in a direction\n const go = React.useCallback(\n (direction: number, options?: PivotNavigationOptions): void => {\n if (!canGo(direction)) {\n return;\n }\n const targetIndex = computeTargetIndex(direction);\n const targetItem = enabledItems[targetIndex];\n if (targetItem) {\n setActiveId(targetItem.id, options);\n }\n },\n [canGo, computeTargetIndex, enabledItems, setActiveId],\n );\n\n // Get virtual position for an item relative to active (for loop mode support)\n const getVirtualPosition = React.useCallback(\n (id: TId): -1 | 0 | 1 | null => {\n const itemIndex = enabledItems.findIndex((item) => item.id === id);\n if (itemIndex === -1) {\n return null;\n }\n\n if (navigationMode === \"linear\") {\n const rawOffset = itemIndex - activeIndex;\n if (Math.abs(rawOffset) > 1) {\n return null;\n }\n return rawOffset as -1 | 0 | 1;\n }\n\n // Loop mode: find shortest path\n const forwardDist = ((itemIndex - activeIndex) % itemCount + itemCount) % itemCount;\n if (forwardDist === 0) {\n return 0;\n }\n if (forwardDist === 1) {\n return 1; // Item is next\n }\n if (itemCount - forwardDist === 1) {\n return -1; // Item is previous\n }\n return null;\n },\n [enabledItems, activeIndex, navigationMode, itemCount],\n );\n\n // Get position for any item relative to active (for viewport mode)\n const getItemPosition = React.useCallback(\n (id: TId): number | null => {\n const itemIndex = enabledItems.findIndex((item) => item.id === id);\n if (itemIndex === -1) {\n return null;\n }\n\n if (navigationMode === \"linear\") {\n return itemIndex - activeIndex;\n }\n\n // Loop mode: find shortest path\n const forwardDist = ((itemIndex - activeIndex) % itemCount + itemCount) % itemCount;\n const backwardDist = itemCount - forwardDist;\n\n // Return the shorter path (prefer forward on tie)\n if (forwardDist <= backwardDist) {\n return forwardDist;\n }\n return -backwardDist;\n },\n [enabledItems, activeIndex, navigationMode, itemCount],\n );\n\n const getItemProps = React.useCallback(\n (id: TId): PivotItemProps => ({\n \"data-pivot-item\": id,\n \"data-active\": (id === activeId ? \"true\" : \"false\") as \"true\" | \"false\",\n \"aria-selected\": id === activeId,\n tabIndex: id === activeId ? 0 : -1,\n onClick: () => {\n setActiveId(id);\n },\n }),\n [activeId, setActiveId],\n );\n\n const containerStyle: React.CSSProperties = React.useMemo(\n () => ({\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n }),\n [],\n );\n\n // Store state in a ref for stable getState function\n const stateRef = React.useRef({\n items,\n activeId,\n transitionMode,\n });\n\n // Update ref when state changes\n stateRef.current = {\n items,\n activeId,\n transitionMode,\n };\n\n // Subscribers for state changes\n const subscribersRef = React.useRef(new Set<() => void>());\n\n // Notify subscribers when activeId changes\n React.useEffect(() => {\n subscribersRef.current.forEach((callback) => callback());\n }, [activeId, transitionMode]);\n\n // Content resolver for useContentCache\n const resolveContent = React.useCallback(\n (itemId: string): React.ReactNode | null => {\n const item = stateRef.current.items.find((i) => i.id === itemId);\n return item?.content ?? null;\n },\n [],\n );\n\n // Valid IDs for cache cleanup (cast to string[] for useContentCache compatibility)\n const validIds = React.useMemo((): readonly string[] => items.map((i) => i.id), [items]);\n\n // Use shared content cache hook\n const { getCachedContent } = useContentCache({\n resolveContent,\n validIds,\n });\n\n // Stable context value (never changes)\n const contextValue = React.useMemo<PivotOutletContextValue>(\n () => ({\n getState: () => stateRef.current,\n subscribe: (callback) => {\n subscribersRef.current.add(callback);\n return () => subscribersRef.current.delete(callback);\n },\n getCachedContent,\n }),\n [getCachedContent],\n );\n\n // Stable Outlet component (reference never changes)\n const Outlet = React.useMemo(() => {\n const OutletComponent: React.FC = () => (\n <PivotOutletContext.Provider value={contextValue}>\n <div style={containerStyle} data-pivot-container>\n <PivotOutletInner />\n </div>\n </PivotOutletContext.Provider>\n );\n OutletComponent.displayName = \"PivotOutlet\";\n return OutletComponent;\n }, [contextValue, containerStyle]);\n\n return { activeId, setActiveId, isActive, getItemProps, Outlet, go, canGo, activeIndex, itemCount, isAnimating, endAnimation, navigationMode, getVirtualPosition, getItemPosition };\n}\n","/**\n * @file SwipePivotTabBar - Swipeable tab bar for pivot navigation with proper looping.\n *\n * Infinite loop model:\n * - Uses continuous scroll offset (not discrete positions)\n * - Renders tab slots at fixed positions, content determined by scroll offset\n * - Clones tabs at boundaries for seamless looping\n * - Each slot has stable key (by position), preventing remount jumps\n */\nimport * as React from \"react\";\nimport type { SwipeInputState, GestureAxis } from \"../../hooks/gesture/types.js\";\n\n/**\n * Props passed to the indicator render function.\n * Use these to position a sliding indicator (iOS-style).\n */\nexport type IndicatorRenderProps = {\n /** Current offset in pixels (includes swipe displacement and animation) */\n offsetPx: number;\n /** Width of each tab */\n tabWidth: number;\n /** Center X position where active tab is located */\n centerX: number;\n /** Whether currently swiping */\n isSwiping: boolean;\n /** Whether animation is in progress */\n isAnimating: boolean;\n};\n\nexport type SwipePivotTabBarProps<TId extends string = string> = {\n /** Tab items to render */\n items: ReadonlyArray<{ id: TId; label?: string }>;\n /** Currently active tab ID */\n activeId: TId;\n /** Index of active tab */\n activeIndex: number;\n /** Total number of items */\n itemCount: number;\n /** Current swipe input state */\n inputState: SwipeInputState;\n /** Width of each tab */\n tabWidth: number;\n /** Width of the visible viewport */\n viewportWidth: number;\n /** Navigation mode */\n navigationMode?: \"linear\" | \"loop\";\n /** Axis for swipe (horizontal or vertical) */\n axis?: GestureAxis;\n /** Render function for each tab */\n renderTab: (item: { id: TId; label?: string }, isActive: boolean, index: number) => React.ReactNode;\n /** Animation duration in ms */\n animationDuration?: number;\n /**\n * When true, tabs stay at fixed positions and only the indicator moves.\n * Use this for iOS segmented control style where the \"window\" slides over fixed tabs.\n * @default false\n */\n fixedTabs?: boolean;\n /**\n * Optional render function for a sliding indicator (iOS-style).\n * The indicator follows the active tab position during swipe and animation.\n * Rendered behind the tabs.\n *\n * When used with fixedTabs=true, only the indicator moves while tabs stay fixed.\n *\n * @example\n * ```tsx\n * renderIndicator={({ offsetPx, tabWidth, centerX }) => (\n * <div\n * style={{\n * position: 'absolute',\n * left: centerX,\n * bottom: 0,\n * width: tabWidth,\n * height: 3,\n * backgroundColor: '#007AFF',\n * transform: `translateX(${offsetPx}px)`,\n * }}\n * />\n * )}\n * ```\n */\n renderIndicator?: (props: IndicatorRenderProps) => React.ReactNode;\n};\n\nconst DEFAULT_ANIMATION_DURATION = 300;\n\n/** Get displacement value for the given axis from input state */\nconst getAxisDisplacement = (inputState: SwipeInputState, axis: GestureAxis): number => {\n if (inputState.phase === \"idle\") {\n return 0;\n }\n return axis === \"horizontal\" ? inputState.displacement.x : inputState.displacement.y;\n};\n\n/**\n * Normalize index to valid range [0, count)\n */\nconst normalizeIndex = (index: number, count: number): number => {\n return ((index % count) + count) % count;\n};\n\n/**\n * Calculate which item should appear at a given slot position.\n * For loop mode, wraps around using modulo.\n * For linear mode, returns null if out of range.\n */\nconst getItemAtPosition = (\n slotPosition: number,\n activeIndex: number,\n itemCount: number,\n navigationMode: \"linear\" | \"loop\",\n): number | null => {\n const targetIndex = activeIndex + slotPosition;\n\n if (navigationMode === \"linear\") {\n if (targetIndex < 0 || targetIndex >= itemCount) {\n return null;\n }\n return targetIndex;\n }\n\n // Loop mode: wrap around\n return normalizeIndex(targetIndex, itemCount);\n};\n\ntype TabSlotProps<TId extends string> = {\n slotPosition: number;\n item: { id: TId; label?: string };\n itemIndex: number;\n isActive: boolean;\n centerX: number;\n tabWidth: number;\n viewportWidth: number;\n offsetPx: number;\n axis: GestureAxis;\n renderTab: (item: { id: TId; label?: string }, isActive: boolean, index: number) => React.ReactNode;\n};\n\n/**\n * Tab slot component - renders a tab at a fixed slot position.\n * The slot position is stable; only the content changes based on scroll offset.\n */\nconst TabSlot = React.memo(<TId extends string>({\n slotPosition,\n item,\n itemIndex,\n isActive,\n centerX,\n tabWidth,\n viewportWidth,\n offsetPx,\n axis,\n renderTab,\n}: TabSlotProps<TId>) => {\n // Calculate visual position: centerX + slotPosition * tabWidth + offsetPx\n const basePx = slotPosition * tabWidth;\n const visualPx = centerX + basePx + offsetPx;\n\n // Check if visible in viewport\n const visible = visualPx + tabWidth > 0 && visualPx < viewportWidth;\n\n const transformFn = axis === \"horizontal\" ? \"translateX\" : \"translateY\";\n\n return (\n <div\n data-pivot-tab={item.id}\n data-slot={slotPosition}\n data-active={isActive ? \"true\" : \"false\"}\n style={{\n position: \"absolute\",\n left: centerX,\n top: 0,\n width: tabWidth,\n height: \"100%\",\n visibility: visible ? \"visible\" : \"hidden\",\n willChange: \"transform\",\n transform: `${transformFn}(${basePx + offsetPx}px)`,\n }}\n >\n {renderTab(item, isActive, itemIndex)}\n </div>\n );\n}) as <TId extends string>(props: TabSlotProps<TId>) => React.ReactElement;\n\n/**\n * Easing function for smooth animation\n */\nconst easeOutExpo = (t: number): number => {\n return t === 1 ? 1 : 1 - Math.pow(2, -10 * t);\n};\n\nexport function SwipePivotTabBar<TId extends string = string>({\n items,\n activeId,\n activeIndex,\n itemCount,\n inputState,\n tabWidth,\n viewportWidth,\n navigationMode = \"linear\",\n axis = \"horizontal\",\n renderTab,\n animationDuration = DEFAULT_ANIMATION_DURATION,\n fixedTabs = false,\n renderIndicator,\n}: SwipePivotTabBarProps<TId>): React.ReactElement {\n const displacement = getAxisDisplacement(inputState, axis);\n const isSwiping = inputState.phase === \"swiping\" || inputState.phase === \"tracking\";\n\n // ============================================================\n // Animation state for SLOT-BASED mode (scrolling tabs)\n // ============================================================\n const [animatedOffset, setAnimatedOffset] = React.useState(0);\n const animationRef = React.useRef<{\n startTime: number;\n startOffset: number;\n targetOffset: number;\n rafId: number;\n } | null>(null);\n\n // ============================================================\n // Animation state for FIXED TABS mode (iOS-style indicator)\n // Tracks the actual indicator position in pixels\n // ============================================================\n const [indicatorPosition, setIndicatorPosition] = React.useState(activeIndex * tabWidth);\n const indicatorPositionRef = React.useRef(activeIndex * tabWidth); // Track current position for animation start\n const fixedAnimationRef = React.useRef<{\n rafId: number;\n } | null>(null);\n const lastSwipePositionRef = React.useRef<number | null>(null);\n\n // Keep ref in sync with state\n React.useEffect(() => {\n indicatorPositionRef.current = indicatorPosition;\n }, [indicatorPosition]);\n\n const prevActiveIndexRef = React.useRef(activeIndex);\n\n // Calculate the range of slot positions to render\n const halfRange = Math.ceil(viewportWidth / tabWidth / 2) + 1;\n\n // Center position for active tab (for slot-based mode)\n const centerX = (viewportWidth - tabWidth) / 2;\n\n // ============================================================\n // Fixed tabs mode: track swipe position\n // ============================================================\n React.useEffect(() => {\n if (!fixedTabs || !isSwiping) return;\n\n // During swipe, track the visual position\n // Swipe direction is OPPOSITE to indicator movement\n const visualPosition = activeIndex * tabWidth - displacement;\n lastSwipePositionRef.current = visualPosition;\n setIndicatorPosition(visualPosition);\n }, [fixedTabs, isSwiping, activeIndex, tabWidth, displacement]);\n\n // ============================================================\n // Fixed tabs mode: animate when swipe ends or tab clicked\n // ============================================================\n React.useEffect(() => {\n if (!fixedTabs || isSwiping) return;\n\n // When swipe ends or tab changes via click\n const targetPosition = activeIndex * tabWidth;\n const startPosition = lastSwipePositionRef.current ?? indicatorPositionRef.current;\n lastSwipePositionRef.current = null;\n\n // Already at target\n if (Math.abs(startPosition - targetPosition) < 1) {\n setIndicatorPosition(targetPosition);\n return;\n }\n\n // Cancel existing animation\n if (fixedAnimationRef.current) {\n cancelAnimationFrame(fixedAnimationRef.current.rafId);\n }\n\n // Animate from current position to target\n const startTime = performance.now();\n const animationStartPosition = startPosition; // Capture for closure\n\n const animate = (currentTime: number) => {\n const elapsed = currentTime - startTime;\n const progress = Math.min(elapsed / animationDuration, 1);\n const easedProgress = easeOutExpo(progress);\n\n const currentPosition = animationStartPosition + (targetPosition - animationStartPosition) * easedProgress;\n setIndicatorPosition(currentPosition);\n\n if (progress < 1) {\n fixedAnimationRef.current = {\n rafId: requestAnimationFrame(animate),\n };\n } else {\n fixedAnimationRef.current = null;\n setIndicatorPosition(targetPosition);\n }\n };\n\n fixedAnimationRef.current = {\n rafId: requestAnimationFrame(animate),\n };\n }, [fixedTabs, isSwiping, activeIndex, tabWidth, animationDuration]);\n\n // ============================================================\n // Slot-based mode animation: handle activeIndex changes\n // ============================================================\n React.useEffect(() => {\n if (fixedTabs) return; // Skip for fixed tabs mode\n\n if (prevActiveIndexRef.current === activeIndex) {\n return;\n }\n\n const prevIndex = prevActiveIndexRef.current;\n prevActiveIndexRef.current = activeIndex;\n\n // Calculate direction of movement\n let delta: number;\n if (navigationMode === \"loop\") {\n // Use shortest path in loop mode\n const forwardDist = normalizeIndex(activeIndex - prevIndex, itemCount);\n const backwardDist = itemCount - forwardDist;\n delta = forwardDist <= backwardDist ? forwardDist : -backwardDist;\n } else {\n delta = activeIndex - prevIndex;\n }\n\n // Target offset to animate to (then snap to 0)\n const targetOffsetPx = -delta * tabWidth;\n\n // Start from current visual position\n const startOffset = isSwiping ? displacement : animatedOffset;\n\n // Cancel any existing animation\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current.rafId);\n }\n\n // If already at target (within threshold), snap immediately\n if (Math.abs(startOffset - targetOffsetPx) < 1) {\n setAnimatedOffset(0);\n return;\n }\n\n // Start animation\n const startTime = performance.now();\n\n const animate = (currentTime: number) => {\n const elapsed = currentTime - startTime;\n const progress = Math.min(elapsed / animationDuration, 1);\n const easedProgress = easeOutExpo(progress);\n\n // Interpolate from startOffset toward targetOffset, but we want to end at 0\n // So we animate: startOffset → targetOffset, but since we're rendering with\n // the NEW activeIndex, we need to compensate\n //\n // When activeIndex changes, slots now show different content.\n // We animate the offset from (startOffset - targetOffset) back to 0.\n const compensatedStart = startOffset - targetOffsetPx;\n const currentOffset = compensatedStart * (1 - easedProgress);\n\n setAnimatedOffset(currentOffset);\n\n if (progress < 1) {\n animationRef.current = {\n startTime,\n startOffset: compensatedStart,\n targetOffset: 0,\n rafId: requestAnimationFrame(animate),\n };\n } else {\n animationRef.current = null;\n setAnimatedOffset(0);\n }\n };\n\n animationRef.current = {\n startTime,\n startOffset: startOffset - targetOffsetPx,\n targetOffset: 0,\n rafId: requestAnimationFrame(animate),\n };\n }, [fixedTabs, activeIndex, itemCount, tabWidth, animationDuration, navigationMode, displacement, isSwiping, animatedOffset]);\n\n // Update prevActiveIndexRef for fixed tabs mode too\n React.useEffect(() => {\n if (fixedTabs) {\n prevActiveIndexRef.current = activeIndex;\n }\n }, [fixedTabs, activeIndex]);\n\n // Cleanup animation on unmount\n React.useEffect(() => {\n return () => {\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current.rafId);\n }\n if (fixedAnimationRef.current) {\n cancelAnimationFrame(fixedAnimationRef.current.rafId);\n }\n };\n }, []);\n\n // Current offset for slot-based mode\n const currentOffset = isSwiping ? displacement : animatedOffset;\n const isAnimating = animationRef.current !== null || fixedAnimationRef.current !== null;\n\n // Cancel slot animation when swiping starts\n React.useEffect(() => {\n if (isSwiping && animationRef.current) {\n cancelAnimationFrame(animationRef.current.rafId);\n animationRef.current = null;\n setAnimatedOffset(0);\n }\n }, [isSwiping]);\n\n // ============================================================\n // Fixed tabs mode: render fixed tabs with sliding indicator\n // ============================================================\n if (fixedTabs) {\n // Calculate total width and centering offset\n const totalTabsWidth = items.length * tabWidth;\n const centeringOffset = (viewportWidth - totalTabsWidth) / 2;\n\n return (\n <div\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n overflow: \"hidden\",\n display: \"flex\",\n justifyContent: \"center\",\n }}\n >\n {/* Sliding indicator (rendered behind tabs) */}\n {renderIndicator?.({\n offsetPx: indicatorPosition,\n tabWidth,\n centerX: centeringOffset,\n isSwiping,\n isAnimating,\n })}\n\n {/* Fixed tabs - each tab at its natural position */}\n {items.map((item, index) => (\n <div\n key={item.id}\n data-pivot-tab={item.id}\n data-active={index === activeIndex ? \"true\" : \"false\"}\n style={{\n position: \"relative\",\n width: tabWidth,\n height: \"100%\",\n flexShrink: 0,\n }}\n >\n {renderTab(item, index === activeIndex, index)}\n </div>\n ))}\n </div>\n );\n }\n\n // Slot-based rendering for scrolling tabs (infinite loop support)\n const slots: Array<{\n slotPosition: number;\n itemIndex: number;\n item: { id: TId; label?: string };\n }> = [];\n\n for (let pos = -halfRange; pos <= halfRange; pos++) {\n const itemIndex = getItemAtPosition(pos, activeIndex, itemCount, navigationMode);\n if (itemIndex !== null) {\n slots.push({\n slotPosition: pos,\n itemIndex,\n item: items[itemIndex],\n });\n }\n }\n\n return (\n <div\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n overflow: \"hidden\",\n }}\n >\n {/* Sliding indicator (rendered behind tabs) */}\n {renderIndicator?.({\n offsetPx: currentOffset,\n tabWidth,\n centerX,\n isSwiping,\n isAnimating,\n })}\n\n {/* Tab slots */}\n {slots.map(({ slotPosition, itemIndex, item }) => (\n <TabSlot\n key={slotPosition}\n slotPosition={slotPosition}\n item={item}\n itemIndex={itemIndex}\n isActive={itemIndex === activeIndex}\n centerX={centerX}\n tabWidth={tabWidth}\n viewportWidth={viewportWidth}\n offsetPx={currentOffset}\n axis={axis}\n renderTab={renderTab}\n />\n ))}\n </div>\n );\n}\n"],"names":["DEFAULT_ANIMATION_TIMEOUT","useAnimatedVisibility","isVisible","leaveAnimation","skipAnimation","animationTimeout","prevVisibleRef","React","isAnimatingOut","setIsAnimatingOut","timeoutRef","wasVisible","handleAnimationEnd","e","shouldDisplay","baseStyle","PivotContent","id","isActive","transitionMode","children","visibility","PIVOT_ANIMATION_LEAVE","style","s","PIVOT_ANIMATION_ENTER","content","jsx","PivotOutletContext","PivotOutletInner","ctx","forceUpdate","x","items","activeId","Fragment","item","usePivot","options","controlledActiveId","defaultActiveId","onActiveChange","navigationMode","isControlled","uncontrolledActiveId","setUncontrolledActiveId","firstEnabled","isAnimating","setIsAnimating","setActiveId","target","shouldAnimate","endAnimation","enabledItems","activeIndex","index","itemCount","canGo","direction","targetIndex","computeTargetIndex","rawIndex","go","targetItem","getVirtualPosition","itemIndex","rawOffset","forwardDist","getItemPosition","backwardDist","getItemProps","containerStyle","stateRef","subscribersRef","callback","resolveContent","itemId","i","validIds","getCachedContent","useContentCache","contextValue","Outlet","OutletComponent","DEFAULT_ANIMATION_DURATION","getAxisDisplacement","inputState","axis","normalizeIndex","count","getItemAtPosition","slotPosition","TabSlot","centerX","tabWidth","viewportWidth","offsetPx","renderTab","basePx","visualPx","visible","transformFn","easeOutExpo","t","SwipePivotTabBar","animationDuration","fixedTabs","renderIndicator","displacement","isSwiping","animatedOffset","setAnimatedOffset","animationRef","indicatorPosition","setIndicatorPosition","indicatorPositionRef","fixedAnimationRef","lastSwipePositionRef","prevActiveIndexRef","halfRange","visualPosition","targetPosition","startPosition","startTime","animationStartPosition","animate","currentTime","elapsed","progress","easedProgress","currentPosition","prevIndex","delta","targetOffsetPx","startOffset","compensatedStart","currentOffset","totalTabsWidth","centeringOffset","jsxs","slots","pos"],"mappings":";;;;AAYA,MAAMA,IAA4B;AAmD3B,SAASC,EAAsB;AAAA,EACpC,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,kBAAAC,IAAmBL;AACrB,GAA8D;AAC5D,QAAMM,IAAiBC,EAAM,OAAOL,CAAS,GACvC,CAACM,GAAgBC,CAAiB,IAAIF,EAAM,SAAS,EA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