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.
- package/dist/{FloatingPanelFrame-D9Cp2al1.cjs → FloatingPanelFrame-CEmXDvUA.cjs} +2 -2
- package/dist/{FloatingPanelFrame-D9Cp2al1.cjs.map → FloatingPanelFrame-CEmXDvUA.cjs.map} +1 -1
- package/dist/{FloatingPanelFrame-lLg-Lpg7.js → FloatingPanelFrame-SgYLc6Ud.js} +11 -11
- package/dist/{FloatingPanelFrame-lLg-Lpg7.js.map → FloatingPanelFrame-SgYLc6Ud.js.map} +1 -1
- package/dist/FloatingWindow-BpdOpg_L.js +400 -0
- package/dist/FloatingWindow-BpdOpg_L.js.map +1 -0
- package/dist/FloatingWindow-TCDNY5gE.cjs +2 -0
- package/dist/FloatingWindow-TCDNY5gE.cjs.map +1 -0
- package/dist/GridLayout-B4VRsC0r.cjs +2 -0
- package/dist/GridLayout-B4VRsC0r.cjs.map +1 -0
- package/dist/GridLayout-BltqeCPK.js +927 -0
- package/dist/GridLayout-BltqeCPK.js.map +1 -0
- package/dist/HorizontalDivider-B5Z-KZLk.cjs +2 -0
- package/dist/HorizontalDivider-B5Z-KZLk.cjs.map +1 -0
- package/dist/HorizontalDivider-WF1k_qND.js +30 -0
- package/dist/HorizontalDivider-WF1k_qND.js.map +1 -0
- package/dist/PanelSystem-Bs8bQwQF.cjs +3 -0
- package/dist/PanelSystem-Bs8bQwQF.cjs.map +1 -0
- package/dist/PanelSystem-Dr1TBhxM.js +1946 -0
- package/dist/PanelSystem-Dr1TBhxM.js.map +1 -0
- package/dist/ResizeHandle-CScipO5l.cjs +2 -0
- package/dist/ResizeHandle-CScipO5l.cjs.map +1 -0
- package/dist/ResizeHandle-CdA_JYfN.js +120 -0
- package/dist/ResizeHandle-CdA_JYfN.js.map +1 -0
- package/dist/SwipePivotTabBar-BGO9X94m.js +407 -0
- package/dist/SwipePivotTabBar-BGO9X94m.js.map +1 -0
- package/dist/SwipePivotTabBar-BrQismcZ.cjs +2 -0
- package/dist/SwipePivotTabBar-BrQismcZ.cjs.map +1 -0
- package/dist/config.cjs +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.js +11 -9
- package/dist/config.js.map +1 -1
- package/dist/constants/styles.d.ts +18 -4
- package/dist/floating.cjs +1 -1
- package/dist/floating.js +1 -1
- package/dist/grid/index.d.ts +58 -0
- package/dist/grid.cjs +2 -0
- package/dist/grid.cjs.map +1 -0
- package/dist/grid.js +13 -0
- package/dist/grid.js.map +1 -0
- package/dist/hooks/gesture/presets.d.ts +33 -0
- package/dist/hooks/gesture/testing/createGestureSimulator.d.ts +110 -0
- package/dist/hooks/gesture/thresholdValue.d.ts +44 -0
- package/dist/hooks/gesture/types.d.ts +254 -0
- package/dist/hooks/gesture/useDirectionalLock.d.ts +20 -0
- package/dist/hooks/gesture/useEdgeSwipeInput.d.ts +23 -0
- package/dist/hooks/gesture/useNativeGestureGuard.d.ts +23 -0
- package/dist/hooks/gesture/usePointerTracking.d.ts +22 -0
- package/dist/hooks/gesture/useScrollBoundary.d.ts +23 -0
- package/dist/hooks/gesture/useSwipeInput.d.ts +5 -0
- package/dist/hooks/gesture/utils.d.ts +40 -0
- package/dist/hooks/useAnimatedVisibility.d.ts +58 -0
- package/dist/hooks/useAnimationFrame.d.ts +84 -0
- package/dist/hooks/useSnapAnimation.d.ts +54 -0
- package/dist/hooks/useSwipeContentTransform.d.ts +79 -0
- package/dist/index.cjs +1 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +25 -2006
- package/dist/index.js.map +1 -1
- package/dist/modules/pivot/PivotContent.d.ts +1 -1
- package/dist/modules/pivot/SwipePivotContent.d.ts +39 -0
- package/dist/modules/pivot/SwipePivotContent.debug.tmp.d.ts +25 -0
- package/dist/modules/pivot/SwipePivotContent.test.d.ts +1 -0
- package/dist/modules/pivot/SwipePivotTabBar.d.ts +89 -0
- package/dist/modules/pivot/index.d.ts +3 -0
- package/dist/modules/pivot/scaleInputState.d.ts +37 -0
- package/dist/modules/pivot/types.d.ts +67 -2
- package/dist/modules/pivot/usePivotSwipeInput.d.ts +68 -0
- package/dist/modules/stack/StackContent.d.ts +15 -0
- package/dist/modules/stack/SwipeStackContent.d.ts +63 -0
- package/dist/modules/stack/SwipeStackOutlet.d.ts +80 -0
- package/dist/modules/stack/computeStackContentState.d.ts +99 -0
- package/dist/modules/stack/computeSwipeStackTransform.d.ts +76 -0
- package/dist/modules/stack/types.d.ts +194 -0
- package/dist/modules/stack/useStackAnimationState.d.ts +32 -0
- package/dist/modules/stack/useStackNavigation.d.ts +23 -0
- package/dist/modules/stack/useStackSwipeInput.d.ts +27 -0
- package/dist/panels/index.d.ts +67 -0
- package/dist/panels.cjs +2 -0
- package/dist/panels.cjs.map +1 -0
- package/dist/panels.js +28 -0
- package/dist/panels.js.map +1 -0
- package/dist/pivot/index.d.ts +3 -0
- package/dist/pivot.cjs +1 -1
- package/dist/pivot.cjs.map +1 -1
- package/dist/pivot.js +20 -2
- package/dist/pivot.js.map +1 -1
- package/dist/resizer/index.d.ts +57 -0
- package/dist/resizer.cjs +2 -0
- package/dist/resizer.cjs.map +1 -0
- package/dist/resizer.js +8 -0
- package/dist/resizer.js.map +1 -0
- package/dist/stack/index.d.ts +72 -0
- package/dist/stack.cjs +2 -0
- package/dist/stack.cjs.map +1 -0
- package/dist/stack.js +980 -0
- package/dist/stack.js.map +1 -0
- package/dist/sticky-header/StickyArea.d.ts +38 -0
- package/dist/sticky-header/index.d.ts +4 -4
- package/dist/sticky-header/types.d.ts +35 -22
- package/dist/sticky-header.cjs +1 -1
- package/dist/sticky-header.cjs.map +1 -1
- package/dist/sticky-header.js +65 -174
- package/dist/sticky-header.js.map +1 -1
- package/dist/styles-DPPuJ0sf.js +57 -0
- package/dist/styles-DPPuJ0sf.js.map +1 -0
- package/dist/styles-qf6ptVLD.cjs +2 -0
- package/dist/styles-qf6ptVLD.cjs.map +1 -0
- package/dist/useContentCache-CO3LYNmz.js +24 -0
- package/dist/useContentCache-CO3LYNmz.js.map +1 -0
- package/dist/useContentCache-DqXtLrLs.cjs +2 -0
- package/dist/useContentCache-DqXtLrLs.cjs.map +1 -0
- package/dist/useDocumentPointerEvents-CKdhGXd0.js +46 -0
- package/dist/useDocumentPointerEvents-CKdhGXd0.js.map +1 -0
- package/dist/useDocumentPointerEvents-ChqrKXDk.cjs +2 -0
- package/dist/useDocumentPointerEvents-ChqrKXDk.cjs.map +1 -0
- package/dist/useEffectEvent-Dp7HLCf0.js +13 -0
- package/dist/useEffectEvent-Dp7HLCf0.js.map +1 -0
- package/dist/useEffectEvent-huSsGUnl.cjs +2 -0
- package/dist/useEffectEvent-huSsGUnl.cjs.map +1 -0
- package/dist/useFloatingState-C4kRaW_R.cjs +2 -0
- package/dist/useFloatingState-C4kRaW_R.cjs.map +1 -0
- package/dist/useFloatingState-tEfA_wbc.js +74 -0
- package/dist/useFloatingState-tEfA_wbc.js.map +1 -0
- package/dist/window/index.d.ts +61 -0
- package/dist/window.cjs +2 -0
- package/dist/window.cjs.map +1 -0
- package/dist/window.js +149 -0
- package/dist/window.js.map +1 -0
- package/docs/design-tokens.md +405 -0
- package/package.json +29 -4
- package/src/PanelSystemContext.tsx +88 -0
- package/src/components/grid/GridLayerList.tsx +172 -0
- package/src/components/grid/GridLayerResizeHandles.tsx +145 -0
- package/src/components/grid/GridLayout.spec.tsx +743 -0
- package/src/components/grid/GridLayout.tsx +130 -0
- package/src/components/grid/GridTrackResizeHandle.tsx +87 -0
- package/src/components/paneling/FloatingPanelFrame.tsx +203 -0
- package/src/components/panels/DropSuggestOverlay.tsx +131 -0
- package/src/components/panels/PanelGroupView.tsx +112 -0
- package/src/components/pivot/PivotLayer.tsx +27 -0
- package/src/components/resizer/HorizontalDivider.tsx +52 -0
- package/src/components/resizer/ResizeHandle.tsx +118 -0
- package/src/components/tabs/TabBar.tsx +223 -0
- package/src/components/tabs/TabBarTab.tsx +133 -0
- package/src/components/tabs/TabDragOverlay.tsx +92 -0
- package/src/components/window/DialogOverlay.tsx +180 -0
- package/src/components/window/Drawer.tsx +282 -0
- package/src/components/window/DrawerLayers.tsx +58 -0
- package/src/components/window/FloatingWindow.tsx +95 -0
- package/src/components/window/PopupLayerPortal.tsx +218 -0
- package/src/config/PanelContentDeclaration.tsx +427 -0
- package/src/config/index.tsx +52 -0
- package/src/config/panelJsx.spec.tsx +54 -0
- package/src/config/panelJsxConfig.spec.tsx +54 -0
- package/src/config/panelJsxDrawer.spec.tsx +33 -0
- package/src/config/panelRouter.spec.ts +68 -0
- package/src/config/panelRouter.tsx +155 -0
- package/src/constants/styles.ts +261 -0
- package/src/demo/Layout.module.css +258 -0
- package/src/demo/Layout.tsx +176 -0
- package/src/demo/components/CodeBlock.module.css +54 -0
- package/src/demo/components/CodeBlock.tsx +34 -0
- package/src/demo/components/CodePreview.module.css +37 -0
- package/src/demo/components/CodePreview.tsx +31 -0
- package/src/demo/components/DataPreview.module.css +177 -0
- package/src/demo/components/DataPreview.tsx +115 -0
- package/src/demo/components/Story.module.css +68 -0
- package/src/demo/components/Story.tsx +54 -0
- package/src/demo/components/layout/CodePanel.module.css +183 -0
- package/src/demo/components/layout/CodePanel.tsx +149 -0
- package/src/demo/components/layout/DemoPage.module.css +60 -0
- package/src/demo/components/layout/DemoPage.tsx +56 -0
- package/src/demo/components/layout/SingleSamplePage.module.css +11 -0
- package/src/demo/components/layout/SingleSamplePage.tsx +35 -0
- package/src/demo/components/layout/SplitDemoLayout.module.css +107 -0
- package/src/demo/components/layout/SplitDemoLayout.tsx +218 -0
- package/src/demo/components/layout/index.ts +11 -0
- package/src/demo/components/tab-styles/ChromeTabBar.module.css +75 -0
- package/src/demo/components/tab-styles/ChromeTabBar.tsx +111 -0
- package/src/demo/components/tab-styles/GitHubTabBar.module.css +81 -0
- package/src/demo/components/tab-styles/GitHubTabBar.tsx +109 -0
- package/src/demo/components/tab-styles/VSCodeTabBar.module.css +78 -0
- package/src/demo/components/tab-styles/VSCodeTabBar.tsx +109 -0
- package/src/demo/components/tab-styles/index.ts +6 -0
- package/src/demo/components/ui/DemoButton.module.css +63 -0
- package/src/demo/components/ui/DemoButton.tsx +32 -0
- package/src/demo/components/ui/DemoCard.module.css +15 -0
- package/src/demo/components/ui/DemoCard.tsx +30 -0
- package/src/demo/components/ui/DemoContainer.module.css +17 -0
- package/src/demo/components/ui/DemoContainer.tsx +30 -0
- package/src/demo/components/ui/DemoPanel.module.css +23 -0
- package/src/demo/components/ui/DemoPanel.tsx +33 -0
- package/src/demo/components/ui/PanelText.module.css +18 -0
- package/src/demo/components/ui/PanelText.tsx +29 -0
- package/src/demo/components/ui/PanelTitle.module.css +18 -0
- package/src/demo/components/ui/PanelTitle.tsx +31 -0
- package/src/demo/contexts/TabbarDemoConfig.tsx +218 -0
- package/src/demo/demo.css +172 -0
- package/src/demo/hooks/useMedia.ts +41 -0
- package/src/demo/hooks/useShikiHighlight.ts +55 -0
- package/src/demo/index.tsx +293 -0
- package/src/demo/pages/Drawer/animations/index.tsx +22 -0
- package/src/demo/pages/Drawer/basics/index.tsx +17 -0
- package/src/demo/pages/Drawer/components/DrawerAnimations.module.css +125 -0
- package/src/demo/pages/Drawer/components/DrawerAnimations.tsx +118 -0
- package/src/demo/pages/Drawer/components/DrawerBasics.module.css +55 -0
- package/src/demo/pages/Drawer/components/DrawerBasics.tsx +76 -0
- package/src/demo/pages/Drawer/components/DrawerMenuLayout.module.css +332 -0
- package/src/demo/pages/Drawer/components/DrawerMenuLayout.tsx +199 -0
- package/src/demo/pages/Drawer/menu/index.tsx +17 -0
- package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.module.css +163 -0
- package/src/demo/pages/FloatingPanelFrame/ResizableFloatingPanelsPreview.tsx +234 -0
- package/src/demo/pages/FloatingPanelFrame/basic/index.tsx +17 -0
- package/src/demo/pages/FloatingPanelFrame/complex/index.tsx +26 -0
- package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.module.css +16 -0
- package/src/demo/pages/FloatingPanelFrame/components/BasicPanel.tsx +24 -0
- package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.module.css +54 -0
- package/src/demo/pages/FloatingPanelFrame/components/ComplexPanel.tsx +67 -0
- package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.module.css +21 -0
- package/src/demo/pages/FloatingPanelFrame/components/PanelWithControls.tsx +41 -0
- package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.module.css +5 -0
- package/src/demo/pages/FloatingPanelFrame/components/PanelWithMeta.tsx +43 -0
- package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.module.css +11 -0
- package/src/demo/pages/FloatingPanelFrame/components/ScrollablePanel.tsx +42 -0
- package/src/demo/pages/FloatingPanelFrame/index.tsx +80 -0
- package/src/demo/pages/FloatingPanelFrame/scrollable/index.tsx +30 -0
- package/src/demo/pages/FloatingPanelFrame/with-controls/index.tsx +30 -0
- package/src/demo/pages/FloatingPanelFrame/with-meta/index.tsx +17 -0
- package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.module.css +112 -0
- package/src/demo/pages/HorizontalDivider/components/PanelsWithRichContent.tsx +56 -0
- package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.module.css +46 -0
- package/src/demo/pages/HorizontalDivider/components/SimpleResizablePanels.tsx +29 -0
- package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.module.css +54 -0
- package/src/demo/pages/HorizontalDivider/components/ThreePanelLayout.tsx +30 -0
- package/src/demo/pages/HorizontalDivider/index.module.css +14 -0
- package/src/demo/pages/HorizontalDivider/index.tsx +64 -0
- package/src/demo/pages/HorizontalDivider/panels-with-rich-content/index.tsx +21 -0
- package/src/demo/pages/HorizontalDivider/simple-resizable-panels/index.tsx +21 -0
- package/src/demo/pages/HorizontalDivider/three-panel-layout/index.tsx +21 -0
- package/src/demo/pages/PanelLayout/PanelLayoutDemo.module.css +174 -0
- package/src/demo/pages/PanelLayout/PanelLayoutDemo.tsx +248 -0
- package/src/demo/pages/PanelLayout/components/DashboardLayout.module.css +115 -0
- package/src/demo/pages/PanelLayout/components/DashboardLayout.tsx +124 -0
- package/src/demo/pages/PanelLayout/components/DraggableOverlays.module.css +101 -0
- package/src/demo/pages/PanelLayout/components/DraggableOverlays.tsx +122 -0
- package/src/demo/pages/PanelLayout/components/IDELayout.module.css +104 -0
- package/src/demo/pages/PanelLayout/components/IDELayout.tsx +143 -0
- package/src/demo/pages/PanelLayout/components/SimpleGrid.module.css +19 -0
- package/src/demo/pages/PanelLayout/components/SimpleGrid.tsx +62 -0
- package/src/demo/pages/PanelLayout/dashboard/index.tsx +22 -0
- package/src/demo/pages/PanelLayout/draggable-overlays/index.tsx +22 -0
- package/src/demo/pages/PanelLayout/ide-layout/index.tsx +22 -0
- package/src/demo/pages/PanelLayout/index.tsx +94 -0
- package/src/demo/pages/PanelLayout/simple-grid/index.tsx +22 -0
- package/src/demo/pages/PanelSystem/PanelSystemPreview.module.css +20 -0
- package/src/demo/pages/PanelSystem/PanelSystemPreview.tsx +101 -0
- package/src/demo/pages/PanelSystem/preview/index.tsx +18 -0
- package/src/demo/pages/PanelSystem/tabbar/index.tsx +129 -0
- package/src/demo/pages/Pivot/basics/index.tsx +17 -0
- package/src/demo/pages/Pivot/components/Pivot.module.css +278 -0
- package/src/demo/pages/Pivot/components/PivotBasics.tsx +103 -0
- package/src/demo/pages/Pivot/components/PivotSidebar.tsx +168 -0
- package/src/demo/pages/Pivot/components/PivotTabs.tsx +129 -0
- package/src/demo/pages/Pivot/components/PivotTransitions.tsx +120 -0
- package/src/demo/pages/Pivot/components/SwipePivot.module.css +114 -0
- package/src/demo/pages/Pivot/components/SwipePivot.tsx +193 -0
- package/src/demo/pages/Pivot/components/SwipeTabsPivot.module.css +203 -0
- package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +289 -0
- package/src/demo/pages/Pivot/sidebar/index.tsx +17 -0
- package/src/demo/pages/Pivot/swipe/index.tsx +16 -0
- package/src/demo/pages/Pivot/swipe-debug/index.tsx +287 -0
- package/src/demo/pages/Pivot/swipe-tabs/index.tsx +15 -0
- package/src/demo/pages/Pivot/tabs/index.tsx +17 -0
- package/src/demo/pages/Pivot/transitions/index.tsx +17 -0
- package/src/demo/pages/ResizeHandle/both-directions/index.tsx +17 -0
- package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.module.css +72 -0
- package/src/demo/pages/ResizeHandle/components/BothDirectionsDemo.tsx +41 -0
- package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.module.css +61 -0
- package/src/demo/pages/ResizeHandle/components/HorizontalResizeDemo.tsx +33 -0
- package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.module.css +83 -0
- package/src/demo/pages/ResizeHandle/components/NestedPanelsDemo.tsx +53 -0
- package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.module.css +68 -0
- package/src/demo/pages/ResizeHandle/components/VerticalResizeDemo.tsx +33 -0
- package/src/demo/pages/ResizeHandle/horizontal/index.tsx +17 -0
- package/src/demo/pages/ResizeHandle/index.module.css +11 -0
- package/src/demo/pages/ResizeHandle/index.tsx +71 -0
- package/src/demo/pages/ResizeHandle/nested-panels/index.tsx +17 -0
- package/src/demo/pages/ResizeHandle/vertical/index.tsx +17 -0
- package/src/demo/pages/ResponsiveLayout/adaptive-workspace/index.tsx +22 -0
- package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.module.css +423 -0
- package/src/demo/pages/ResponsiveLayout/components/ResponsiveWorkspace.tsx +398 -0
- package/src/demo/pages/Stack/basics/index.tsx +22 -0
- package/src/demo/pages/Stack/components/Stack.module.css +234 -0
- package/src/demo/pages/Stack/components/StackBasics.tsx +217 -0
- package/src/demo/pages/Stack/components/StackTablet.module.css +299 -0
- package/src/demo/pages/Stack/components/StackTablet.tsx +401 -0
- package/src/demo/pages/Stack/tablet/index.tsx +22 -0
- package/src/demo/pages/StickyHeader/basics/index.tsx +17 -0
- package/src/demo/pages/StickyHeader/components/StickyHeader.module.css +219 -0
- package/src/demo/pages/StickyHeader/components/StickyHeaderBasics.tsx +103 -0
- package/src/demo/routes.tsx +193 -0
- package/src/demo/styles/animations.css +68 -0
- package/src/demo/styles/stack-themes.css +35 -0
- package/src/demo/utils/createPanelView.tsx +58 -0
- package/src/floating/index.ts +24 -0
- package/src/grid/index.ts +75 -0
- package/src/hooks/ContentCacheContext.tsx +87 -0
- package/src/hooks/gesture/presets.spec.ts +86 -0
- package/src/hooks/gesture/presets.ts +95 -0
- package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +237 -0
- package/src/hooks/gesture/testing/createGestureSimulator.ts +310 -0
- package/src/hooks/gesture/thresholdValue.spec.ts +103 -0
- package/src/hooks/gesture/thresholdValue.ts +77 -0
- package/src/hooks/gesture/types.ts +290 -0
- package/src/hooks/gesture/useDirectionalLock.spec.ts +271 -0
- package/src/hooks/gesture/useDirectionalLock.ts +115 -0
- package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +454 -0
- package/src/hooks/gesture/useEdgeSwipeInput.ts +131 -0
- package/src/hooks/gesture/useNativeGestureGuard.spec.ts +413 -0
- package/src/hooks/gesture/useNativeGestureGuard.ts +133 -0
- package/src/hooks/gesture/usePointerTracking.spec.ts +364 -0
- package/src/hooks/gesture/usePointerTracking.ts +134 -0
- package/src/hooks/gesture/useScrollBoundary.spec.ts +249 -0
- package/src/hooks/gesture/useScrollBoundary.ts +113 -0
- package/src/hooks/gesture/useSwipeInput.spec.ts +592 -0
- package/src/hooks/gesture/useSwipeInput.ts +310 -0
- package/src/hooks/gesture/utils.spec.ts +152 -0
- package/src/hooks/gesture/utils.ts +87 -0
- package/src/hooks/useAnimatedVisibility.spec.ts +257 -0
- package/src/hooks/useAnimatedVisibility.ts +146 -0
- package/src/hooks/useAnimationFrame.ts +200 -0
- package/src/hooks/useCSSMatrix.spec.ts +214 -0
- package/src/hooks/useCSSMatrix.ts +262 -0
- package/src/hooks/useClonedElementPreview.ts +28 -0
- package/src/hooks/useContainerScroll.ts +78 -0
- package/src/hooks/useContentCache.spec.tsx +232 -0
- package/src/hooks/useContentCache.tsx +127 -0
- package/src/hooks/useDocumentPointerEvents.ts +137 -0
- package/src/hooks/useDocumentScroll.ts +41 -0
- package/src/hooks/useEffectEvent.ts +40 -0
- package/src/hooks/useElementComponentWrapper.tsx +63 -0
- package/src/hooks/useIntersectionObserver.tsx +125 -0
- package/src/hooks/useIsomorphicLayoutEffect.ts +29 -0
- package/src/hooks/useResizeObserver.tsx +81 -0
- package/src/hooks/useScrollContainer.ts +79 -0
- package/src/hooks/useSnapAnimation.ts +128 -0
- package/src/hooks/useSwipeContentTransform.spec.ts +133 -0
- package/src/hooks/useSwipeContentTransform.ts +235 -0
- package/src/hooks/useTransitionState.ts +95 -0
- package/src/index.tsx +88 -0
- package/src/modules/grid/GridLayoutContext.tsx +57 -0
- package/src/modules/grid/LayerInstanceContext.tsx +56 -0
- package/src/modules/grid/resizeHandles.ts +157 -0
- package/src/modules/grid/trackUtils.ts +146 -0
- package/src/modules/grid/useGridPlacements.ts +143 -0
- package/src/modules/grid/useGridTracks.ts +156 -0
- package/src/modules/grid/useLayerDragHandle.ts +16 -0
- package/src/modules/grid/useLayerInteractions.tsx +850 -0
- package/src/modules/keybindings/KeybindingsProvider.tsx +111 -0
- package/src/modules/panels/dom/DomRegistry.tsx +94 -0
- package/src/modules/panels/index.ts +45 -0
- package/src/modules/panels/interactions/InteractionsContext.test.tsx +330 -0
- package/src/modules/panels/interactions/InteractionsContext.tsx +394 -0
- package/src/modules/panels/interactions/dnd.ts +28 -0
- package/src/modules/panels/keybindings/KeybindingsInstaller.tsx +15 -0
- package/src/modules/panels/layout/adapter.ts +124 -0
- package/src/modules/panels/rendering/ContentRegistry.spec.tsx +304 -0
- package/src/modules/panels/rendering/ContentRegistry.tsx +205 -0
- package/src/modules/panels/rendering/GroupContainer.tsx +65 -0
- package/src/modules/panels/rendering/RenderBridge.tsx +115 -0
- package/src/modules/panels/rendering/RenderContext.tsx +31 -0
- package/src/modules/panels/state/PanelSplitHandles.tsx +147 -0
- package/src/modules/panels/state/PanelSystemContext.splitLimits.spec.tsx +50 -0
- package/src/modules/panels/state/PanelSystemContext.tsx +289 -0
- package/src/modules/panels/state/StateContext.tsx +12 -0
- package/src/modules/panels/state/cleanup.ts +37 -0
- package/src/modules/panels/state/commands.ts +53 -0
- package/src/modules/panels/state/focus/Context.tsx +25 -0
- package/src/modules/panels/state/focus/logic.ts +57 -0
- package/src/modules/panels/state/groups/Context.tsx +25 -0
- package/src/modules/panels/state/groups/logic.ts +105 -0
- package/src/modules/panels/state/splitLimits.spec.ts +46 -0
- package/src/modules/panels/state/splitLimits.ts +90 -0
- package/src/modules/panels/state/state.spec.ts +49 -0
- package/src/modules/panels/state/tree/Context.tsx +24 -0
- package/src/modules/panels/state/tree/logic.spec.ts +34 -0
- package/src/modules/panels/state/tree/logic.ts +138 -0
- package/src/modules/panels/state/types.ts +142 -0
- package/src/modules/panels/system/PanelSystem.empty-tabbar.spec.tsx +53 -0
- package/src/modules/panels/system/PanelSystem.tab-click-activates.spec.tsx +44 -0
- package/src/modules/panels/system/PanelSystem.tab-reorder.spec.tsx +64 -0
- package/src/modules/panels/system/PanelSystem.tabs-no-dup.spec.tsx +57 -0
- package/src/modules/panels/system/PanelSystem.tsx +206 -0
- package/src/modules/pivot/PivotContent.spec.tsx +179 -0
- package/src/modules/pivot/PivotContent.tsx +77 -0
- package/src/modules/pivot/SwipePivotContent.debug.tmp.tsx +237 -0
- package/src/modules/pivot/SwipePivotContent.position.spec.tsx +167 -0
- package/src/modules/pivot/SwipePivotContent.spec.tsx +464 -0
- package/src/modules/pivot/SwipePivotContent.test.tsx +502 -0
- package/src/modules/pivot/SwipePivotContent.tsx +197 -0
- package/src/modules/pivot/SwipePivotTabBar.spec.tsx +865 -0
- package/src/modules/pivot/SwipePivotTabBar.tsx +523 -0
- package/src/modules/pivot/index.ts +8 -0
- package/src/modules/pivot/scaleInputState.spec.ts +210 -0
- package/src/modules/pivot/scaleInputState.ts +66 -0
- package/src/modules/pivot/types.ts +139 -0
- package/src/modules/pivot/usePivot.spec.ts +621 -0
- package/src/modules/pivot/usePivot.spec.tsx +186 -0
- package/src/modules/pivot/usePivot.tsx +345 -0
- package/src/modules/pivot/usePivotSwipeInput.spec.ts +649 -0
- package/src/modules/pivot/usePivotSwipeInput.ts +136 -0
- package/src/modules/resizer/useResizeDrag.ts +94 -0
- package/src/modules/stack/StackContent.spec.tsx +264 -0
- package/src/modules/stack/StackContent.tsx +111 -0
- package/src/modules/stack/SwipeStackContent.spec.tsx +1277 -0
- package/src/modules/stack/SwipeStackContent.tsx +356 -0
- package/src/modules/stack/SwipeStackOutlet.spec.tsx +252 -0
- package/src/modules/stack/SwipeStackOutlet.tsx +221 -0
- package/src/modules/stack/computeStackContentState.spec.ts +281 -0
- package/src/modules/stack/computeStackContentState.ts +304 -0
- package/src/modules/stack/computeSwipeStackTransform.spec.ts +186 -0
- package/src/modules/stack/computeSwipeStackTransform.ts +145 -0
- package/src/modules/stack/types.ts +226 -0
- package/src/modules/stack/useStackAnimationState.spec.ts +186 -0
- package/src/modules/stack/useStackAnimationState.ts +138 -0
- package/src/modules/stack/useStackNavigation.spec.ts +477 -0
- package/src/modules/stack/useStackNavigation.tsx +336 -0
- package/src/modules/stack/useStackSwipeInput.spec.ts +276 -0
- package/src/modules/stack/useStackSwipeInput.ts +139 -0
- package/src/modules/window/useDrawerState.ts +81 -0
- package/src/modules/window/useFloatingState.spec.ts +252 -0
- package/src/modules/window/useFloatingState.ts +141 -0
- package/src/panels/index.ts +119 -0
- package/src/pivot/index.ts +19 -0
- package/src/resizer/index.ts +68 -0
- package/src/stack/index.ts +91 -0
- package/src/sticky-header/StickyArea.tsx +221 -0
- package/src/sticky-header/index.ts +18 -0
- package/src/sticky-header/types.ts +68 -0
- package/src/types.ts +323 -0
- package/src/utils/CSSMatrix.ts +321 -0
- package/src/utils/css.ts +65 -0
- package/src/utils/dialogUtils.ts +43 -0
- package/src/utils/math.ts +18 -0
- package/src/utils/polyfills/createDialogPolyfill.ts +18 -0
- package/src/utils/typedActions.ts +103 -0
- package/src/vite-env.d.ts +6 -0
- package/src/window/index.ts +67 -0
- package/dist/GridLayout-BQQ63eA1.cjs +0 -2
- package/dist/GridLayout-BQQ63eA1.cjs.map +0 -1
- package/dist/GridLayout-CJTKq7Mp.js +0 -1465
- package/dist/GridLayout-CJTKq7Mp.js.map +0 -1
- package/dist/sticky-header/StickyHeader.d.ts +0 -53
- package/dist/styles-CA2_zLZt.js +0 -52
- package/dist/styles-CA2_zLZt.js.map +0 -1
- package/dist/styles-PsqGOEJP.cjs +0 -2
- package/dist/styles-PsqGOEJP.cjs.map +0 -1
- package/dist/usePivot-7ctin_P_.cjs +0 -2
- package/dist/usePivot-7ctin_P_.cjs.map +0 -1
- package/dist/usePivot-CgQxB8rc.js +0 -124
- package/dist/usePivot-CgQxB8rc.js.map +0 -1
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Swipe Tabs Pivot demo - swipeable tabs with synchronized content
|
|
3
|
+
*
|
|
4
|
+
* Both tab and content areas respond to swipe gestures.
|
|
5
|
+
* Uses SwipePivotTabBar for tabs and scaleInputState for displacement sync.
|
|
6
|
+
* Demonstrates both indicator styles: standard active state and iOS-style sliding indicator.
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { usePivot, scaleInputState, SwipePivotTabBar } from "../../../../pivot/index.js";
|
|
10
|
+
import { usePivotSwipeInput } from "../../../../modules/pivot/usePivotSwipeInput.js";
|
|
11
|
+
import { SwipePivotContent } from "../../../../modules/pivot/SwipePivotContent.js";
|
|
12
|
+
import type { PivotItem, UsePivotResult, IndicatorRenderProps } from "../../../../pivot/index.js";
|
|
13
|
+
import type { SwipeInputState } from "../../../../hooks/gesture/types.js";
|
|
14
|
+
import styles from "./SwipeTabsPivot.module.css";
|
|
15
|
+
|
|
16
|
+
type IndicatorStyle = "standard" | "sliding";
|
|
17
|
+
|
|
18
|
+
type ContentItemsProps = {
|
|
19
|
+
items: PivotItem[];
|
|
20
|
+
pivot: UsePivotResult;
|
|
21
|
+
inputState: SwipeInputState;
|
|
22
|
+
containerWidth: number;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** Renders content items */
|
|
26
|
+
const ContentItems: React.FC<ContentItemsProps> = ({ items, pivot, inputState, containerWidth }) => {
|
|
27
|
+
if (containerWidth <= 0) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
{items.map((item) => {
|
|
34
|
+
const position = pivot.getVirtualPosition(item.id);
|
|
35
|
+
if (position === null) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<SwipePivotContent
|
|
41
|
+
key={item.id}
|
|
42
|
+
id={item.id}
|
|
43
|
+
isActive={pivot.isActive(item.id)}
|
|
44
|
+
position={position}
|
|
45
|
+
inputState={inputState}
|
|
46
|
+
axis="horizontal"
|
|
47
|
+
containerSize={containerWidth}
|
|
48
|
+
canNavigate={true}
|
|
49
|
+
>
|
|
50
|
+
{item.content}
|
|
51
|
+
</SwipePivotContent>
|
|
52
|
+
);
|
|
53
|
+
})}
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const pageColors = ["#ffe0e0", "#e0ffe0", "#e0e0ff", "#fff0e0", "#f0e0ff"];
|
|
59
|
+
|
|
60
|
+
const items: PivotItem[] = [
|
|
61
|
+
{
|
|
62
|
+
id: "tab1",
|
|
63
|
+
label: "Tab 1",
|
|
64
|
+
content: (
|
|
65
|
+
<div className={styles.pageContent} style={{ backgroundColor: pageColors[0] }}>
|
|
66
|
+
<h2>Tab 1 Content</h2>
|
|
67
|
+
<p>Swipe on the tabs above or the content area</p>
|
|
68
|
+
<p>Both areas are synchronized</p>
|
|
69
|
+
</div>
|
|
70
|
+
),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "tab2",
|
|
74
|
+
label: "Tab 2",
|
|
75
|
+
content: (
|
|
76
|
+
<div className={styles.pageContent} style={{ backgroundColor: pageColors[1] }}>
|
|
77
|
+
<h2>Tab 2 Content</h2>
|
|
78
|
+
<p>Infinite loop navigation enabled</p>
|
|
79
|
+
<p>Swipe in any direction to continue</p>
|
|
80
|
+
</div>
|
|
81
|
+
),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "tab3",
|
|
85
|
+
label: "Tab 3",
|
|
86
|
+
content: (
|
|
87
|
+
<div className={styles.pageContent} style={{ backgroundColor: pageColors[2] }}>
|
|
88
|
+
<h2>Tab 3 Content</h2>
|
|
89
|
+
<p>Try swiping on the tab bar</p>
|
|
90
|
+
<p>Content follows the same navigation</p>
|
|
91
|
+
</div>
|
|
92
|
+
),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "tab4",
|
|
96
|
+
label: "Tab 4",
|
|
97
|
+
content: (
|
|
98
|
+
<div className={styles.pageContent} style={{ backgroundColor: pageColors[3] }}>
|
|
99
|
+
<h2>Tab 4 Content</h2>
|
|
100
|
+
<p>More tabs to navigate through</p>
|
|
101
|
+
</div>
|
|
102
|
+
),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "tab5",
|
|
106
|
+
label: "Tab 5",
|
|
107
|
+
content: (
|
|
108
|
+
<div className={styles.pageContent} style={{ backgroundColor: pageColors[4] }}>
|
|
109
|
+
<h2>Tab 5 Content</h2>
|
|
110
|
+
<p>Last tab - swipe left to loop back to Tab 1</p>
|
|
111
|
+
</div>
|
|
112
|
+
),
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
/** Get hint text for current swipe state */
|
|
117
|
+
const getHintText = (phase: SwipeInputState["phase"], displacement: number): string => {
|
|
118
|
+
if (phase === "swiping") {
|
|
119
|
+
return `Swiping: ${Math.round(displacement)}px`;
|
|
120
|
+
}
|
|
121
|
+
return "Swipe tabs or content";
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** Sliding indicator component (iOS segmented control style) */
|
|
125
|
+
const SlidingIndicator = ({ offsetPx, tabWidth, centerX }: IndicatorRenderProps): React.ReactNode => {
|
|
126
|
+
const padding = 4;
|
|
127
|
+
const indicatorWidth = tabWidth - padding * 2;
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<div
|
|
131
|
+
style={{
|
|
132
|
+
position: "absolute",
|
|
133
|
+
left: centerX + padding,
|
|
134
|
+
top: "50%",
|
|
135
|
+
transform: `translateX(${offsetPx}px) translateY(-50%)`,
|
|
136
|
+
width: indicatorWidth,
|
|
137
|
+
height: 28,
|
|
138
|
+
backgroundColor: "#fff",
|
|
139
|
+
borderRadius: 7,
|
|
140
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08)",
|
|
141
|
+
willChange: "transform",
|
|
142
|
+
pointerEvents: "none",
|
|
143
|
+
}}
|
|
144
|
+
/>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const SwipeTabsPivot: React.FC = () => {
|
|
149
|
+
const mainContainerRef = React.useRef<HTMLDivElement>(null);
|
|
150
|
+
const contentContainerRef = React.useRef<HTMLDivElement>(null);
|
|
151
|
+
const [contentContainerWidth, setContentContainerWidth] = React.useState(0);
|
|
152
|
+
const [indicatorStyle, setIndicatorStyle] = React.useState<IndicatorStyle>("sliding");
|
|
153
|
+
|
|
154
|
+
// Per-tab width (each tab takes equal space in viewport)
|
|
155
|
+
const tabWidth = contentContainerWidth / items.length;
|
|
156
|
+
|
|
157
|
+
const pivot = usePivot({
|
|
158
|
+
items,
|
|
159
|
+
defaultActiveId: "tab1",
|
|
160
|
+
transitionMode: "none",
|
|
161
|
+
navigationMode: "loop",
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Use swipe input on the main container (covers both tabs and content)
|
|
165
|
+
const { inputState, containerProps } = usePivotSwipeInput({
|
|
166
|
+
containerRef: mainContainerRef,
|
|
167
|
+
pivot,
|
|
168
|
+
axis: "horizontal",
|
|
169
|
+
thresholds: {
|
|
170
|
+
distanceThreshold: 100,
|
|
171
|
+
velocityThreshold: 0.5,
|
|
172
|
+
lockThreshold: 15,
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Scale inputState for tabs: content swipe distance → tab swipe distance
|
|
177
|
+
const tabInputState = scaleInputState(inputState, contentContainerWidth, tabWidth);
|
|
178
|
+
|
|
179
|
+
// Measure container width
|
|
180
|
+
React.useEffect(() => {
|
|
181
|
+
const updateWidth = () => {
|
|
182
|
+
if (contentContainerRef.current) {
|
|
183
|
+
setContentContainerWidth(contentContainerRef.current.clientWidth);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
updateWidth();
|
|
188
|
+
window.addEventListener("resize", updateWidth);
|
|
189
|
+
return () => window.removeEventListener("resize", updateWidth);
|
|
190
|
+
}, []);
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<div className={styles.container}>
|
|
194
|
+
<h3 className={styles.title}>Swipeable Tabs Demo</h3>
|
|
195
|
+
<p className={styles.subtitle}>Swipe on tabs or content - both are synchronized</p>
|
|
196
|
+
|
|
197
|
+
{/* Indicator style toggle */}
|
|
198
|
+
<div className={styles.styleToggle}>
|
|
199
|
+
<span>Indicator Style:</span>
|
|
200
|
+
<button
|
|
201
|
+
className={styles.toggleButton}
|
|
202
|
+
data-active={indicatorStyle === "standard"}
|
|
203
|
+
onClick={() => setIndicatorStyle("standard")}
|
|
204
|
+
>
|
|
205
|
+
Standard
|
|
206
|
+
</button>
|
|
207
|
+
<button
|
|
208
|
+
className={styles.toggleButton}
|
|
209
|
+
data-active={indicatorStyle === "sliding"}
|
|
210
|
+
onClick={() => setIndicatorStyle("sliding")}
|
|
211
|
+
>
|
|
212
|
+
Sliding (iOS)
|
|
213
|
+
</button>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
{/* Main swipe container wrapping both tabs and content */}
|
|
217
|
+
<div
|
|
218
|
+
ref={mainContainerRef}
|
|
219
|
+
className={styles.mainContainer}
|
|
220
|
+
{...containerProps}
|
|
221
|
+
style={containerProps.style}
|
|
222
|
+
>
|
|
223
|
+
{/* Swipeable tabs using SwipePivotTabBar */}
|
|
224
|
+
<div
|
|
225
|
+
className={styles.tabsContainer}
|
|
226
|
+
data-style={indicatorStyle === "sliding" ? "ios" : undefined}
|
|
227
|
+
>
|
|
228
|
+
{contentContainerWidth > 0 && (
|
|
229
|
+
<SwipePivotTabBar
|
|
230
|
+
items={items}
|
|
231
|
+
activeId={pivot.activeId}
|
|
232
|
+
activeIndex={pivot.activeIndex}
|
|
233
|
+
itemCount={pivot.itemCount}
|
|
234
|
+
inputState={tabInputState}
|
|
235
|
+
tabWidth={tabWidth}
|
|
236
|
+
viewportWidth={contentContainerWidth}
|
|
237
|
+
navigationMode={pivot.navigationMode}
|
|
238
|
+
fixedTabs={indicatorStyle === "sliding"}
|
|
239
|
+
renderTab={(item, isActive) => (
|
|
240
|
+
<button
|
|
241
|
+
className={indicatorStyle === "sliding" ? styles.tabIos : styles.tab}
|
|
242
|
+
data-active={isActive}
|
|
243
|
+
onClick={() => pivot.setActiveId(item.id)}
|
|
244
|
+
>
|
|
245
|
+
{item.label}
|
|
246
|
+
</button>
|
|
247
|
+
)}
|
|
248
|
+
renderIndicator={indicatorStyle === "sliding" ? SlidingIndicator : undefined}
|
|
249
|
+
/>
|
|
250
|
+
)}
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
{/* Content area - uses original inputState */}
|
|
254
|
+
<div ref={contentContainerRef} className={styles.contentContainer}>
|
|
255
|
+
<ContentItems
|
|
256
|
+
items={items}
|
|
257
|
+
pivot={pivot}
|
|
258
|
+
inputState={inputState}
|
|
259
|
+
containerWidth={contentContainerWidth}
|
|
260
|
+
/>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
{/* Navigation info */}
|
|
265
|
+
<div className={styles.info}>
|
|
266
|
+
<span>Tab {pivot.activeIndex + 1} of {pivot.itemCount}</span>
|
|
267
|
+
<span className={styles.hint}>
|
|
268
|
+
{getHintText(inputState.phase, inputState.displacement.x)}
|
|
269
|
+
</span>
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
{/* Manual navigation buttons */}
|
|
273
|
+
<div className={styles.buttons}>
|
|
274
|
+
<button
|
|
275
|
+
className={styles.navButton}
|
|
276
|
+
onClick={() => pivot.go(-1)}
|
|
277
|
+
>
|
|
278
|
+
Previous
|
|
279
|
+
</button>
|
|
280
|
+
<button
|
|
281
|
+
className={styles.navButton}
|
|
282
|
+
onClick={() => pivot.go(1)}
|
|
283
|
+
>
|
|
284
|
+
Next
|
|
285
|
+
</button>
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
);
|
|
289
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Pivot - Sidebar page
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { PivotSidebar } from "../components/PivotSidebar";
|
|
6
|
+
import PivotSidebarSource from "../components/PivotSidebar.tsx?raw";
|
|
7
|
+
import { SingleSamplePage } from "../../../components/layout";
|
|
8
|
+
|
|
9
|
+
const Page: React.FC = () => {
|
|
10
|
+
return (
|
|
11
|
+
<SingleSamplePage title="Pivot / Sidebar Navigation" code={PivotSidebarSource} codeTitle="PivotSidebar.tsx" previewHeight={450}>
|
|
12
|
+
<PivotSidebar />
|
|
13
|
+
</SingleSamplePage>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default Page;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Pivot - Swipe Navigation demo page
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { SwipePivot } from "../components/SwipePivot";
|
|
6
|
+
|
|
7
|
+
// Temporarily render directly without SingleSamplePage to debug
|
|
8
|
+
const Page: React.FC = () => {
|
|
9
|
+
return (
|
|
10
|
+
<div style={{ height: "100%", padding: "16px" }}>
|
|
11
|
+
<SwipePivot />
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default Page;
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Debug page for investigating iOS swipe issue
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { usePivot } from "../../../../pivot/index.js";
|
|
6
|
+
import { usePivotSwipeInput } from "../../../../modules/pivot/usePivotSwipeInput.js";
|
|
7
|
+
import { SwipePivotContent } from "../../../../modules/pivot/SwipePivotContent.js";
|
|
8
|
+
import type { PivotItem } from "../../../../pivot/index.js";
|
|
9
|
+
import type { SwipeInputState } from "../../../../hooks/gesture/types.js";
|
|
10
|
+
|
|
11
|
+
const styles: Record<string, React.CSSProperties> = {
|
|
12
|
+
container: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
flexDirection: "column",
|
|
15
|
+
minHeight: "500px",
|
|
16
|
+
gap: "16px",
|
|
17
|
+
padding: "16px",
|
|
18
|
+
},
|
|
19
|
+
indicators: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
gap: "8px",
|
|
23
|
+
},
|
|
24
|
+
indicator: {
|
|
25
|
+
width: "12px",
|
|
26
|
+
height: "12px",
|
|
27
|
+
borderRadius: "50%",
|
|
28
|
+
border: "none",
|
|
29
|
+
cursor: "pointer",
|
|
30
|
+
backgroundColor: "#ccc",
|
|
31
|
+
},
|
|
32
|
+
indicatorActive: {
|
|
33
|
+
backgroundColor: "#333",
|
|
34
|
+
},
|
|
35
|
+
swipeContainer: {
|
|
36
|
+
flex: 1,
|
|
37
|
+
minHeight: "250px",
|
|
38
|
+
position: "relative",
|
|
39
|
+
overflow: "hidden",
|
|
40
|
+
backgroundColor: "#f0f0f0",
|
|
41
|
+
borderRadius: "8px",
|
|
42
|
+
},
|
|
43
|
+
pageContent: {
|
|
44
|
+
padding: "24px",
|
|
45
|
+
height: "100%",
|
|
46
|
+
display: "flex",
|
|
47
|
+
flexDirection: "column",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
},
|
|
51
|
+
debugPanel: {
|
|
52
|
+
padding: "12px",
|
|
53
|
+
backgroundColor: "#1a1a1a",
|
|
54
|
+
color: "#00ff00",
|
|
55
|
+
fontFamily: "monospace",
|
|
56
|
+
fontSize: "12px",
|
|
57
|
+
borderRadius: "8px",
|
|
58
|
+
maxHeight: "200px",
|
|
59
|
+
overflow: "auto",
|
|
60
|
+
},
|
|
61
|
+
info: {
|
|
62
|
+
display: "flex",
|
|
63
|
+
justifyContent: "space-between",
|
|
64
|
+
padding: "8px 0",
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const pageColors = ["#ffcccc", "#ccffcc", "#ccccff"];
|
|
69
|
+
|
|
70
|
+
const items: PivotItem[] = [
|
|
71
|
+
{
|
|
72
|
+
id: "page1",
|
|
73
|
+
label: "Page 1",
|
|
74
|
+
content: (
|
|
75
|
+
<div style={{ ...styles.pageContent, backgroundColor: pageColors[0] }}>
|
|
76
|
+
<h2>Page 1</h2>
|
|
77
|
+
<p>Swipe left to see Page 2</p>
|
|
78
|
+
</div>
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "page2",
|
|
83
|
+
label: "Page 2",
|
|
84
|
+
content: (
|
|
85
|
+
<div style={{ ...styles.pageContent, backgroundColor: pageColors[1] }}>
|
|
86
|
+
<h2>Page 2</h2>
|
|
87
|
+
<p>Swipe left or right</p>
|
|
88
|
+
</div>
|
|
89
|
+
),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "page3",
|
|
93
|
+
label: "Page 3",
|
|
94
|
+
content: (
|
|
95
|
+
<div style={{ ...styles.pageContent, backgroundColor: pageColors[2] }}>
|
|
96
|
+
<h2>Page 3</h2>
|
|
97
|
+
<p>Last page</p>
|
|
98
|
+
</div>
|
|
99
|
+
),
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
type DebugLog = {
|
|
104
|
+
time: string;
|
|
105
|
+
message: string;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const SwipeDebugPage: React.FC = () => {
|
|
109
|
+
const containerRef = React.useRef<HTMLDivElement>(null);
|
|
110
|
+
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
111
|
+
const [logs, setLogs] = React.useState<DebugLog[]>([]);
|
|
112
|
+
|
|
113
|
+
const addLog = React.useCallback((message: string) => {
|
|
114
|
+
const time = new Date().toISOString().split("T")[1].split(".")[0];
|
|
115
|
+
setLogs((prev) => [...prev.slice(-50), { time, message }]);
|
|
116
|
+
}, []);
|
|
117
|
+
|
|
118
|
+
const pivot = usePivot({
|
|
119
|
+
items,
|
|
120
|
+
defaultActiveId: "page1",
|
|
121
|
+
transitionMode: "none",
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const { inputState, containerProps } = usePivotSwipeInput({
|
|
125
|
+
containerRef,
|
|
126
|
+
pivot,
|
|
127
|
+
axis: "horizontal",
|
|
128
|
+
thresholds: {
|
|
129
|
+
distanceThreshold: 150,
|
|
130
|
+
velocityThreshold: 0.6,
|
|
131
|
+
lockThreshold: 25,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Log input state changes
|
|
136
|
+
const prevInputStateRef = React.useRef<SwipeInputState>(inputState);
|
|
137
|
+
React.useEffect(() => {
|
|
138
|
+
const prev = prevInputStateRef.current;
|
|
139
|
+
if (
|
|
140
|
+
prev.phase !== inputState.phase ||
|
|
141
|
+
prev.direction !== inputState.direction ||
|
|
142
|
+
Math.abs(prev.displacement.x - inputState.displacement.x) > 10
|
|
143
|
+
) {
|
|
144
|
+
addLog(
|
|
145
|
+
`inputState: phase=${inputState.phase}, dir=${inputState.direction}, dx=${Math.round(inputState.displacement.x)}`
|
|
146
|
+
);
|
|
147
|
+
prevInputStateRef.current = inputState;
|
|
148
|
+
}
|
|
149
|
+
}, [inputState, addLog]);
|
|
150
|
+
|
|
151
|
+
// Log active index changes
|
|
152
|
+
const prevActiveIndexRef = React.useRef(pivot.activeIndex);
|
|
153
|
+
React.useEffect(() => {
|
|
154
|
+
if (prevActiveIndexRef.current !== pivot.activeIndex) {
|
|
155
|
+
addLog(`activeIndex: ${prevActiveIndexRef.current} -> ${pivot.activeIndex}`);
|
|
156
|
+
prevActiveIndexRef.current = pivot.activeIndex;
|
|
157
|
+
}
|
|
158
|
+
}, [pivot.activeIndex, addLog]);
|
|
159
|
+
|
|
160
|
+
// Measure container width
|
|
161
|
+
React.useEffect(() => {
|
|
162
|
+
const updateWidth = () => {
|
|
163
|
+
if (containerRef.current) {
|
|
164
|
+
const newWidth = containerRef.current.clientWidth;
|
|
165
|
+
if (newWidth !== containerWidth) {
|
|
166
|
+
addLog(`containerWidth: ${containerWidth} -> ${newWidth}`);
|
|
167
|
+
setContainerWidth(newWidth);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
updateWidth();
|
|
173
|
+
window.addEventListener("resize", updateWidth);
|
|
174
|
+
return () => window.removeEventListener("resize", updateWidth);
|
|
175
|
+
}, [containerWidth, addLog]);
|
|
176
|
+
|
|
177
|
+
// Calculate position offset for each item relative to active
|
|
178
|
+
const getPositionOffset = (itemId: string): number => {
|
|
179
|
+
const itemIndex = items.findIndex((item) => item.id === itemId);
|
|
180
|
+
return itemIndex - pivot.activeIndex;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// Convert offset to display position (-1, 0, 1)
|
|
184
|
+
const toDisplayPosition = (offset: number): -1 | 0 | 1 => {
|
|
185
|
+
if (offset < 0) {
|
|
186
|
+
return -1;
|
|
187
|
+
}
|
|
188
|
+
if (offset > 0) {
|
|
189
|
+
return 1;
|
|
190
|
+
}
|
|
191
|
+
return 0;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// Only render items within ±1 of active
|
|
195
|
+
const shouldRenderItem = (offset: number): boolean => {
|
|
196
|
+
return Math.abs(offset) <= 1;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<div style={styles.container}>
|
|
201
|
+
<h3>iOS Swipe Debug</h3>
|
|
202
|
+
|
|
203
|
+
{/* Page indicators */}
|
|
204
|
+
<div style={styles.indicators}>
|
|
205
|
+
{items.map((item) => (
|
|
206
|
+
<button
|
|
207
|
+
key={item.id}
|
|
208
|
+
style={{
|
|
209
|
+
...styles.indicator,
|
|
210
|
+
...(pivot.isActive(item.id) ? styles.indicatorActive : {}),
|
|
211
|
+
}}
|
|
212
|
+
onClick={() => pivot.setActiveId(item.id)}
|
|
213
|
+
aria-label={`Go to ${item.label}`}
|
|
214
|
+
/>
|
|
215
|
+
))}
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
{/* Swipe area */}
|
|
219
|
+
<div
|
|
220
|
+
ref={containerRef}
|
|
221
|
+
{...containerProps}
|
|
222
|
+
style={{ ...styles.swipeContainer, ...containerProps.style }}
|
|
223
|
+
>
|
|
224
|
+
{items.map((item) => {
|
|
225
|
+
const offset = getPositionOffset(item.id);
|
|
226
|
+
if (!shouldRenderItem(offset)) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const position = toDisplayPosition(offset);
|
|
231
|
+
const canNavigateToPosition = position === 0;
|
|
232
|
+
const canNavigate = canNavigateToPosition ? true : pivot.canGo(position);
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<SwipePivotContent
|
|
236
|
+
key={item.id}
|
|
237
|
+
id={item.id}
|
|
238
|
+
isActive={pivot.isActive(item.id)}
|
|
239
|
+
position={position}
|
|
240
|
+
inputState={inputState}
|
|
241
|
+
axis="horizontal"
|
|
242
|
+
containerSize={containerWidth}
|
|
243
|
+
canNavigate={canNavigate}
|
|
244
|
+
>
|
|
245
|
+
{item.content}
|
|
246
|
+
</SwipePivotContent>
|
|
247
|
+
);
|
|
248
|
+
})}
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
{/* Info */}
|
|
252
|
+
<div style={styles.info}>
|
|
253
|
+
<span>Page {pivot.activeIndex + 1} of {pivot.itemCount}</span>
|
|
254
|
+
<span>Width: {containerWidth}px</span>
|
|
255
|
+
</div>
|
|
256
|
+
|
|
257
|
+
{/* Debug logs */}
|
|
258
|
+
<div style={styles.debugPanel}>
|
|
259
|
+
{logs.map((log, i) => (
|
|
260
|
+
<div key={i}>
|
|
261
|
+
[{log.time}] {log.message}
|
|
262
|
+
</div>
|
|
263
|
+
))}
|
|
264
|
+
{logs.length === 0 && <div>No logs yet. Start swiping...</div>}
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
{/* Manual navigation */}
|
|
268
|
+
<div style={{ display: "flex", gap: "8px" }}>
|
|
269
|
+
<button
|
|
270
|
+
onClick={() => pivot.go(-1)}
|
|
271
|
+
disabled={!pivot.canGo(-1)}
|
|
272
|
+
>
|
|
273
|
+
Previous
|
|
274
|
+
</button>
|
|
275
|
+
<button
|
|
276
|
+
onClick={() => pivot.go(1)}
|
|
277
|
+
disabled={!pivot.canGo(1)}
|
|
278
|
+
>
|
|
279
|
+
Next
|
|
280
|
+
</button>
|
|
281
|
+
<button onClick={() => setLogs([])}>Clear Logs</button>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export default SwipeDebugPage;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Pivot - Swipe Tabs demo page
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { SwipeTabsPivot } from "../components/SwipeTabsPivot.js";
|
|
6
|
+
|
|
7
|
+
const Page: React.FC = () => {
|
|
8
|
+
return (
|
|
9
|
+
<div style={{ height: "100%", padding: "16px" }}>
|
|
10
|
+
<SwipeTabsPivot />
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default Page;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Pivot - Tabs page
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { PivotTabs } from "../components/PivotTabs";
|
|
6
|
+
import PivotTabsSource from "../components/PivotTabs.tsx?raw";
|
|
7
|
+
import { SingleSamplePage } from "../../../components/layout";
|
|
8
|
+
|
|
9
|
+
const Page: React.FC = () => {
|
|
10
|
+
return (
|
|
11
|
+
<SingleSamplePage title="Pivot / Tab Navigation" code={PivotTabsSource} codeTitle="PivotTabs.tsx" previewHeight={400}>
|
|
12
|
+
<PivotTabs />
|
|
13
|
+
</SingleSamplePage>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default Page;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Pivot - Transitions page
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { PivotTransitions } from "../components/PivotTransitions";
|
|
6
|
+
import PivotTransitionsSource from "../components/PivotTransitions.tsx?raw";
|
|
7
|
+
import { SingleSamplePage } from "../../../components/layout";
|
|
8
|
+
|
|
9
|
+
const Page: React.FC = () => {
|
|
10
|
+
return (
|
|
11
|
+
<SingleSamplePage title="Pivot / Transitions" code={PivotTransitionsSource} codeTitle="PivotTransitions.tsx" previewHeight={600}>
|
|
12
|
+
<PivotTransitions />
|
|
13
|
+
</SingleSamplePage>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default Page;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ResizeHandle - Both directions page
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { BothDirectionsDemo } from "../components/BothDirectionsDemo";
|
|
6
|
+
import BothDirectionsDemoSource from "../components/BothDirectionsDemo.tsx?raw";
|
|
7
|
+
import { SingleSamplePage } from "../../../components/layout";
|
|
8
|
+
|
|
9
|
+
const Page: React.FC = () => {
|
|
10
|
+
return (
|
|
11
|
+
<SingleSamplePage title="ResizeHandle / Both Directions" code={BothDirectionsDemoSource} codeTitle="BothDirectionsDemo.tsx">
|
|
12
|
+
<BothDirectionsDemo />
|
|
13
|
+
</SingleSamplePage>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default Page;
|