react-panel-layout 0.6.0 → 0.7.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-SgYLc6Ud.js → FloatingPanelFrame-3eU9AwPo.js} +2 -2
- package/dist/{FloatingPanelFrame-SgYLc6Ud.js.map → FloatingPanelFrame-3eU9AwPo.js.map} +1 -1
- package/dist/FloatingWindow-Bw2djgpz.js +1542 -0
- package/dist/FloatingWindow-Bw2djgpz.js.map +1 -0
- package/dist/FloatingWindow-Cvyokf0m.cjs +2 -0
- package/dist/FloatingWindow-Cvyokf0m.cjs.map +1 -0
- package/dist/GridLayout-B4aCqSyd.js +947 -0
- package/dist/{GridLayout-BltqeCPK.js.map → GridLayout-B4aCqSyd.js.map} +1 -1
- package/dist/GridLayout-DNOClFzz.cjs +2 -0
- package/dist/{GridLayout-B4VRsC0r.cjs.map → GridLayout-DNOClFzz.cjs.map} +1 -1
- package/dist/{HorizontalDivider-WF1k_qND.js → HorizontalDivider-DdxzfV0l.js} +3 -3
- package/dist/{HorizontalDivider-WF1k_qND.js.map → HorizontalDivider-DdxzfV0l.js.map} +1 -1
- package/dist/{HorizontalDivider-B5Z-KZLk.cjs → HorizontalDivider-_pgV4Mcv.cjs} +2 -2
- package/dist/{HorizontalDivider-B5Z-KZLk.cjs.map → HorizontalDivider-_pgV4Mcv.cjs.map} +1 -1
- package/dist/PanelSystem-B8Igvnb2.cjs +3 -0
- package/dist/PanelSystem-B8Igvnb2.cjs.map +1 -0
- package/dist/{PanelSystem-Dr1TBhxM.js → PanelSystem-DDUSFjXD.js} +209 -248
- package/dist/PanelSystem-DDUSFjXD.js.map +1 -0
- package/dist/ResizeHandle-CBcAS918.cjs +2 -0
- package/dist/{ResizeHandle-CScipO5l.cjs.map → ResizeHandle-CBcAS918.cjs.map} +1 -1
- package/dist/{ResizeHandle-CdA_JYfN.js → ResizeHandle-CXjc1meV.js} +28 -29
- package/dist/{ResizeHandle-CdA_JYfN.js.map → ResizeHandle-CXjc1meV.js.map} +1 -1
- package/dist/SwipePivotTabBar-DWrCuwEI.js +411 -0
- package/dist/SwipePivotTabBar-DWrCuwEI.js.map +1 -0
- package/dist/SwipePivotTabBar-fjjXkpj7.cjs +2 -0
- package/dist/SwipePivotTabBar-fjjXkpj7.cjs.map +1 -0
- package/dist/components/gesture/SwipeSafeZone.d.ts +40 -0
- package/dist/components/window/Drawer.d.ts +4 -1
- package/dist/components/window/DrawerLayers.d.ts +1 -1
- package/dist/components/window/DrawerRevealContext.d.ts +61 -0
- package/dist/components/window/drawerRevealAnimationUtils.d.ts +212 -0
- package/dist/components/window/drawerStyles.d.ts +74 -0
- package/dist/components/window/drawerSwipeConfig.d.ts +29 -0
- package/dist/components/window/useDrawerSwipeTransform.d.ts +29 -0
- package/dist/components/window/useDrawerTransform.d.ts +68 -0
- package/dist/components/window/useRevealDrawerTransform.d.ts +56 -0
- package/dist/config.cjs +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.js +9 -8
- package/dist/config.js.map +1 -1
- package/dist/constants/styles.d.ts +17 -0
- package/dist/dialog/index.d.ts +69 -0
- package/dist/floating.js +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/grid.js +2 -2
- package/dist/hooks/gesture/testing/createGestureSimulator.d.ts +7 -0
- package/dist/hooks/gesture/types.d.ts +48 -5
- package/dist/hooks/gesture/utils.d.ts +19 -0
- package/dist/hooks/useAnimationFrame.d.ts +2 -0
- package/dist/hooks/useOperationContinuity.d.ts +64 -0
- package/dist/hooks/useResizeObserver.d.ts +33 -1
- package/dist/hooks/useSharedElementTransition.d.ts +112 -0
- package/dist/hooks/useSwipeContentTransform.d.ts +9 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/modules/dialog/AlertDialog.d.ts +9 -0
- package/dist/modules/dialog/DialogContainer.d.ts +37 -0
- package/dist/modules/dialog/Modal.d.ts +26 -0
- package/dist/modules/dialog/SwipeDialogContainer.d.ts +16 -0
- package/dist/modules/dialog/dialogAnimationUtils.d.ts +113 -0
- package/dist/modules/dialog/types.d.ts +183 -0
- package/dist/modules/dialog/useDialog.d.ts +39 -0
- package/dist/modules/dialog/useDialogContainer.d.ts +47 -0
- package/dist/modules/dialog/useDialogSwipeInput.d.ts +70 -0
- package/dist/modules/dialog/useDialogTransform.d.ts +82 -0
- package/dist/modules/drawer/drawerStateMachine.d.ts +168 -0
- package/dist/modules/drawer/revealDrawerConstants.d.ts +33 -0
- package/dist/modules/drawer/revealDrawerStateMachine.d.ts +146 -0
- package/dist/modules/drawer/strategies/index.d.ts +8 -0
- package/dist/modules/drawer/strategies/overlayStrategy.d.ts +12 -0
- package/dist/modules/drawer/strategies/revealStrategy.d.ts +12 -0
- package/dist/modules/drawer/strategies/types.d.ts +116 -0
- package/dist/modules/drawer/types.d.ts +74 -0
- package/dist/modules/drawer/useDrawerSwipeInput.d.ts +24 -0
- package/dist/modules/pivot/SwipePivotTabBar.d.ts +3 -0
- package/dist/modules/stack/SwipeStackContent.d.ts +6 -3
- package/dist/modules/stack/SwipeStackOutlet.d.ts +4 -4
- package/dist/modules/stack/computeSwipeStackTransform.d.ts +1 -1
- package/dist/panels.cjs +1 -1
- package/dist/panels.js +1 -1
- package/dist/pivot.cjs +1 -1
- package/dist/pivot.js +1 -1
- package/dist/resizer.cjs +1 -1
- package/dist/resizer.js +2 -2
- package/dist/stack.cjs +1 -1
- package/dist/stack.cjs.map +1 -1
- package/dist/stack.js +480 -780
- package/dist/stack.js.map +1 -1
- package/dist/sticky-header/calculateStickyMetrics.d.ts +28 -0
- package/dist/sticky-header.cjs +1 -1
- package/dist/sticky-header.cjs.map +1 -1
- package/dist/sticky-header.js +59 -51
- package/dist/sticky-header.js.map +1 -1
- package/dist/{styles-DPPuJ0sf.js → styles-NkjuMOVS.js} +13 -13
- package/dist/{styles-DPPuJ0sf.js.map → styles-NkjuMOVS.js.map} +1 -1
- package/dist/styles-qf6ptVLD.cjs.map +1 -1
- package/dist/types.d.ts +30 -0
- package/dist/useAnimationFrame-BZ6D2lMq.cjs +2 -0
- package/dist/useAnimationFrame-BZ6D2lMq.cjs.map +1 -0
- package/dist/useAnimationFrame-Bg4e-H8O.js +394 -0
- package/dist/useAnimationFrame-Bg4e-H8O.js.map +1 -0
- package/dist/useDocumentPointerEvents-DXxw3qWj.js +54 -0
- package/dist/useDocumentPointerEvents-DXxw3qWj.js.map +1 -0
- package/dist/useDocumentPointerEvents-DxDSOtip.cjs +2 -0
- package/dist/useDocumentPointerEvents-DxDSOtip.cjs.map +1 -0
- package/dist/window/index.d.ts +2 -0
- package/dist/window.cjs +1 -1
- package/dist/window.cjs.map +1 -1
- package/dist/window.js +114 -103
- package/dist/window.js.map +1 -1
- package/package.json +6 -1
- package/src/components/gesture/SwipeSafeZone.tsx +70 -0
- package/src/components/grid/GridLayout.tsx +110 -38
- package/src/components/window/Drawer.tsx +353 -162
- package/src/components/window/DrawerLayers.tsx +54 -11
- package/src/components/window/DrawerRevealContext.spec.ts +20 -0
- package/src/components/window/DrawerRevealContext.tsx +99 -0
- package/src/components/window/drawerRevealAnimationUtils.spec.ts +375 -0
- package/src/components/window/drawerRevealAnimationUtils.ts +415 -0
- package/src/components/window/drawerStyles.spec.ts +302 -0
- package/src/components/window/drawerStyles.ts +252 -0
- package/src/components/window/drawerSwipeConfig.spec.ts +131 -0
- package/src/components/window/drawerSwipeConfig.ts +112 -0
- package/src/components/window/useDrawerSwipeTransform.ts +67 -0
- package/src/components/window/useDrawerTransform.ts +505 -0
- package/src/components/window/useRevealDrawerTransform.spec.ts +1936 -0
- package/src/components/window/useRevealDrawerTransform.ts +105 -0
- package/src/constants/styles.ts +19 -0
- package/src/demo/components/FullscreenDemoPage.tsx +47 -0
- package/src/demo/fullscreenRoutes.tsx +32 -0
- package/src/demo/index.tsx +5 -0
- package/src/demo/pages/Dialog/alerts/index.tsx +22 -0
- package/src/demo/pages/Dialog/card/index.tsx +22 -0
- package/src/demo/pages/Dialog/components/AlertDialogDemo.tsx +124 -0
- package/src/demo/pages/Dialog/components/CardExpandDemo.module.css +243 -0
- package/src/demo/pages/Dialog/components/CardExpandDemo.tsx +219 -0
- package/src/demo/pages/Dialog/components/CustomAlertDialogDemo.tsx +219 -0
- package/src/demo/pages/Dialog/components/DialogDemos.module.css +77 -0
- package/src/demo/pages/Dialog/components/ModalBasics.tsx +45 -0
- package/src/demo/pages/Dialog/components/SwipeDialogDemo.module.css +77 -0
- package/src/demo/pages/Dialog/components/SwipeDialogDemo.tsx +181 -0
- package/src/demo/pages/Dialog/custom-alert/index.tsx +22 -0
- package/src/demo/pages/Dialog/modal/index.tsx +17 -0
- package/src/demo/pages/Dialog/swipe/index.tsx +22 -0
- package/src/demo/pages/Drawer/components/DrawerBasics.module.css +6 -1
- package/src/demo/pages/Drawer/components/DrawerBasics.tsx +14 -4
- package/src/demo/pages/Drawer/components/DrawerReveal.module.css +157 -0
- package/src/demo/pages/Drawer/components/DrawerReveal.tsx +128 -0
- package/src/demo/pages/Drawer/components/DrawerSwipe.module.css +316 -0
- package/src/demo/pages/Drawer/components/DrawerSwipe.tsx +178 -0
- package/src/demo/pages/Drawer/reveal/index.tsx +17 -0
- package/src/demo/pages/Drawer/reveal-fullscreen/index.tsx +135 -0
- package/src/demo/pages/Drawer/reveal-fullscreen/styles.module.css +233 -0
- package/src/demo/pages/Drawer/swipe/index.tsx +17 -0
- package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +54 -23
- package/src/demo/pages/Pivot/swipe-debug/index.tsx +1 -1
- package/src/demo/pages/Stack/components/StackBasics.spec.tsx +156 -0
- package/src/demo/pages/Stack/components/StackBasics.tsx +179 -95
- package/src/demo/pages/Stack/components/StackTablet.spec.tsx +110 -0
- package/src/demo/pages/Stack/components/StackTablet.tsx +42 -21
- package/src/demo/routes.tsx +24 -1
- package/src/dialog/index.ts +85 -0
- package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +68 -64
- package/src/hooks/gesture/testing/createGestureSimulator.ts +113 -37
- package/src/hooks/gesture/types.ts +83 -6
- package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +22 -14
- package/src/hooks/gesture/useNativeGestureGuard.spec.ts +99 -31
- package/src/hooks/gesture/useNativeGestureGuard.ts +3 -1
- package/src/hooks/gesture/utils.ts +102 -0
- package/src/hooks/useAnimatedVisibility.spec.ts +44 -24
- package/src/hooks/useAnimatedVisibility.ts +28 -2
- package/src/hooks/useAnimationFrame.ts +8 -0
- package/src/hooks/useOperationContinuity.spec.ts +394 -0
- package/src/hooks/useOperationContinuity.ts +135 -0
- package/src/hooks/useResizeObserver.spec.tsx +277 -0
- package/src/hooks/useResizeObserver.tsx +108 -39
- package/src/hooks/useScrollContainer.ts +4 -10
- package/src/hooks/useSharedElementTransition.ts +354 -0
- package/src/hooks/useSwipeContentTransform.spec.ts +18 -18
- package/src/hooks/useSwipeContentTransform.ts +166 -28
- package/src/modules/dialog/AlertDialog.spec.tsx +387 -0
- package/src/modules/dialog/AlertDialog.tsx +221 -0
- package/src/modules/dialog/DialogContainer.spec.tsx +228 -0
- package/src/modules/dialog/DialogContainer.tsx +188 -0
- package/src/modules/dialog/Modal.spec.tsx +220 -0
- package/src/modules/dialog/Modal.tsx +182 -0
- package/src/modules/dialog/SwipeDialogContainer.tsx +208 -0
- package/src/modules/dialog/dialogAnimationUtils.spec.ts +252 -0
- package/src/modules/dialog/dialogAnimationUtils.ts +297 -0
- package/src/modules/dialog/types.ts +186 -0
- package/src/modules/dialog/useDialog.spec.tsx +447 -0
- package/src/modules/dialog/useDialog.ts +214 -0
- package/src/modules/dialog/useDialogContainer.spec.ts +339 -0
- package/src/modules/dialog/useDialogContainer.ts +150 -0
- package/src/modules/dialog/useDialogSwipeInput.spec.ts +178 -0
- package/src/modules/dialog/useDialogSwipeInput.ts +350 -0
- package/src/modules/dialog/useDialogTransform.spec.ts +403 -0
- package/src/modules/dialog/useDialogTransform.ts +407 -0
- package/src/modules/drawer/drawerStateMachine.ts +500 -0
- package/src/modules/drawer/revealDrawerConstants.ts +38 -0
- package/src/modules/drawer/revealDrawerStateMachine.spec.ts +558 -0
- package/src/modules/drawer/revealDrawerStateMachine.ts +197 -0
- package/src/modules/drawer/strategies/index.ts +9 -0
- package/src/modules/drawer/strategies/overlayStrategy.ts +133 -0
- package/src/modules/drawer/strategies/revealStrategy.ts +111 -0
- package/src/modules/drawer/strategies/types.ts +160 -0
- package/src/modules/drawer/types.ts +102 -0
- package/src/modules/drawer/useDrawerSwipeInput.spec.ts +566 -0
- package/src/modules/drawer/useDrawerSwipeInput.ts +402 -0
- package/src/modules/panels/rendering/ContentRegistry.spec.tsx +21 -14
- package/src/modules/pivot/SwipePivotContent.position.spec.tsx +12 -8
- package/src/modules/pivot/SwipePivotContent.spec.tsx +66 -25
- package/src/modules/pivot/SwipePivotContent.tsx +2 -2
- package/src/modules/pivot/SwipePivotTabBar.spec.tsx +85 -68
- package/src/modules/pivot/SwipePivotTabBar.tsx +75 -15
- package/src/modules/pivot/scaleInputState.spec.ts +11 -2
- package/src/modules/pivot/usePivot.spec.ts +17 -3
- package/src/modules/pivot/usePivotSwipeInput.spec.ts +182 -123
- package/src/modules/stack/SwipeStackContent.spec.tsx +387 -100
- package/src/modules/stack/SwipeStackContent.tsx +43 -33
- package/src/modules/stack/SwipeStackOutlet.spec.tsx +14 -16
- package/src/modules/stack/SwipeStackOutlet.tsx +6 -6
- package/src/modules/stack/computeSwipeStackTransform.spec.ts +5 -5
- package/src/modules/stack/computeSwipeStackTransform.ts +3 -3
- package/src/modules/stack/swipeTransitionContinuity.spec.tsx +1133 -0
- package/src/modules/stack/useStackAnimationState.spec.ts +3 -1
- package/src/modules/stack/useStackAnimationState.ts +18 -13
- package/src/modules/stack/useStackNavigation.spec.ts +198 -3
- package/src/modules/stack/useStackNavigation.tsx +113 -56
- package/src/modules/stack/useStackSwipeInput.spec.ts +65 -32
- package/src/modules/stack/useStackSwipeInput.ts +1 -1
- package/src/sticky-header/StickyArea.tsx +29 -57
- package/src/sticky-header/calculateStickyMetrics.spec.ts +105 -0
- package/src/sticky-header/calculateStickyMetrics.ts +50 -0
- package/src/types.ts +33 -0
- package/src/window/index.ts +2 -0
- package/dist/FloatingWindow-BpdOpg_L.js +0 -400
- package/dist/FloatingWindow-BpdOpg_L.js.map +0 -1
- package/dist/FloatingWindow-TCDNY5gE.cjs +0 -2
- package/dist/FloatingWindow-TCDNY5gE.cjs.map +0 -1
- package/dist/GridLayout-B4VRsC0r.cjs +0 -2
- package/dist/GridLayout-BltqeCPK.js +0 -927
- package/dist/PanelSystem-Bs8bQwQF.cjs +0 -3
- package/dist/PanelSystem-Bs8bQwQF.cjs.map +0 -1
- package/dist/PanelSystem-Dr1TBhxM.js.map +0 -1
- package/dist/ResizeHandle-CScipO5l.cjs +0 -2
- package/dist/SwipePivotTabBar-BGO9X94m.js +0 -407
- package/dist/SwipePivotTabBar-BGO9X94m.js.map +0 -1
- package/dist/SwipePivotTabBar-BrQismcZ.cjs +0 -2
- package/dist/SwipePivotTabBar-BrQismcZ.cjs.map +0 -1
- package/dist/useDocumentPointerEvents-CKdhGXd0.js +0 -46
- package/dist/useDocumentPointerEvents-CKdhGXd0.js.map +0 -1
- package/dist/useDocumentPointerEvents-ChqrKXDk.cjs +0 -2
- package/dist/useDocumentPointerEvents-ChqrKXDk.cjs.map +0 -1
- package/dist/useEffectEvent-Dp7HLCf0.js +0 -13
- package/dist/useEffectEvent-Dp7HLCf0.js.map +0 -1
- package/dist/useEffectEvent-huSsGUnl.cjs +0 -2
- package/dist/useEffectEvent-huSsGUnl.cjs.map +0 -1
package/dist/panels.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as e, a as r, P as o, b as t, g as p, k as u, v as i, d as l, c as G, f as d, n, i as m, m as b, o as c, p as T, q as v, r as f, j as P, h as S, l as y, e as x, t as I, s as g, u as h } from "./PanelSystem-
|
|
1
|
+
import { D as e, a as r, P as o, b as t, g as p, k as u, v as i, d as l, c as G, f as d, n, i as m, m as b, o as c, p as T, q as v, r as f, j as P, h as S, l as y, e as x, t as I, s as g, u as h } from "./PanelSystem-DDUSFjXD.js";
|
|
2
2
|
export {
|
|
3
3
|
e as DropSuggestOverlay,
|
|
4
4
|
r as PanelGroupView,
|
package/dist/pivot.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./SwipePivotTabBar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./SwipePivotTabBar-fjjXkpj7.cjs"),s=(e,c,l)=>{if(c<=0||l<=0||e.phase==="idle")return e;const o=l/c;return{...e,displacement:{x:e.displacement.x*o,y:e.displacement.y*o},velocity:{x:e.velocity.x*o,y:e.velocity.y*o}}};exports.SwipePivotTabBar=r.SwipePivotTabBar;exports.usePivot=r.usePivot;exports.scaleInputState=s;
|
|
2
2
|
//# sourceMappingURL=pivot.cjs.map
|
package/dist/pivot.js
CHANGED
package/dist/resizer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ResizeHandle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ResizeHandle-CBcAS918.cjs"),i=require("./HorizontalDivider-_pgV4Mcv.cjs");exports.ResizeHandle=e.ResizeHandle;exports.useResizeDrag=e.useResizeDrag;exports.HorizontalDivider=i.HorizontalDivider;
|
|
2
2
|
//# sourceMappingURL=resizer.cjs.map
|
package/dist/resizer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as a, u as o } from "./ResizeHandle-
|
|
2
|
-
import { H as i } from "./HorizontalDivider-
|
|
1
|
+
import { R as a, u as o } from "./ResizeHandle-CXjc1meV.js";
|
|
2
|
+
import { H as i } from "./HorizontalDivider-DdxzfV0l.js";
|
|
3
3
|
export {
|
|
4
4
|
i as HorizontalDivider,
|
|
5
5
|
a as ResizeHandle,
|
package/dist/stack.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),ee=require("react"),B=require("./styles-qf6ptVLD.cjs"),te=require("./useIsomorphicLayoutEffect-DGRNF4Lf.cjs"),ne=require("./useContentCache-DqXtLrLs.cjs"),re=require("./useDocumentPointerEvents-ChqrKXDk.cjs"),U=require("./useEffectEvent-huSsGUnl.cjs");function se(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const n=se(ee);function oe(r){const{wasActive:e,isActive:t,transitionMode:s}=r;return s!=="css"||e===t?null:t?"push":"pop"}function ce(r){const{displayMode:e,depth:t,navigationDepth:s,isActive:a,isAnimatingOut:c,isRevealing:u,revealDepth:i}=r;return e==="overlay"?a||c||u&&t===i?"visible":"hidden":t<=s||c?"visible":"hidden"}function ie(r){const{depth:e,activeDepth:t,displayMode:s,isRevealing:a,revealDepth:c}=r,u=e===t,i=e<t;if(a&&u&&c!==null)return`translateX(${.3*100}%)`;if(u)return"translateX(0)";if(i)switch(s){case"overlay":return"translateX(0)";case"slide":return"translateX(-30%)";case"stack":{const f=(t-e)*-5,p=1-(t-e)*.05;return`translateX(${f}%) scale(${p})`}}return"translateX(100%)"}function ae(r,e,t){return e===void 0||e<=0||!t?r:`translateX(${e*100}%)`}function ue(r){if(r==="css")return`transform ${B.STACK_TRANSITION_DURATION} ${B.STACK_TRANSITION_EASING}`}function le(r){const{depth:e,isActive:t,wasActive:s,currentAnimationType:a,displayMode:c,transitionMode:u,navigationState:i,swipeProgress:f}=r,o=oe({wasActive:s,isActive:t,transitionMode:u})??a,d=o==="pop",h=ce({displayMode:c,depth:e,navigationDepth:i.depth,isActive:t,isAnimatingOut:d,isRevealing:i.isRevealing,revealDepth:i.revealDepth}),g=ie({depth:e,activeDepth:i.depth,displayMode:c,isRevealing:i.isRevealing,revealDepth:i.revealDepth}),S=ae(g,f,t),v=(()=>{if(u==="css"){if(o==="push")return B.STACK_ANIMATION_PUSH;if(o==="pop")return B.STACK_ANIMATION_POP}})(),m=ue(u);return{nextAnimationType:o,visibility:h,transform:S,animation:v,transition:m,zIndex:e,pointerEvents:t?"auto":"none"}}const fe={position:"absolute",inset:0,width:"100%",height:"100%"},z=n.memo(({id:r,depth:e,isActive:t,displayMode:s,transitionMode:a,navigationState:c,swipeProgress:u,children:i})=>{const f=n.useRef(null),p=n.useRef(t),[o,d]=n.useState(null),h=le({depth:e,isActive:t,wasActive:p.current,currentAnimationType:o,displayMode:s,transitionMode:a,navigationState:c,swipeProgress:u});te.useIsomorphicLayoutEffect(()=>{const m=p.current;p.current=t,m!==t&&d(h.nextAnimationType)},[t,h.nextAnimationType]);const g=n.useCallback(m=>{m.target===m.currentTarget&&d(null)},[]),S=n.useMemo(()=>{const m={...fe,transform:h.transform,pointerEvents:h.pointerEvents,zIndex:h.zIndex,visibility:h.visibility};return h.animation!==void 0&&(m.animation=h.animation),h.transition!==void 0&&(m.transition=h.transition),m},[h.transform,h.pointerEvents,h.zIndex,h.visibility,h.animation,h.transition]),v=L.jsx("div",{ref:f,"data-stack-content":r,"data-depth":e,"data-active":t?"true":"false",style:S,onAnimationEnd:g,children:i});return a==="none"?L.jsx(n.Activity,{mode:t?"visible":"hidden",children:v}):v}),V=n.createContext(null),de=n.memo(()=>{const r=n.useContext(V);if(!r)throw new Error("StackOutlet must be used within useStackNavigation");const[,e]=n.useReducer(i=>i+1,0);n.useEffect(()=>r.subscribe(e),[r]);const{panels:t,navigationState:s,displayMode:a,transitionMode:c}=r.getState(),u=n.useMemo(()=>s.stack.map((i,f)=>{const p=t.find(o=>o.id===i);return p?{panel:p,depth:f}:null}).filter(i=>i!==null),[s.stack,t]);return L.jsx(L.Fragment,{children:u.map(({panel:i,depth:f})=>L.jsx(z,{id:i.id,depth:f,isActive:f===s.depth,displayMode:a,transitionMode:c,navigationState:s,children:i.cache?r.getCachedContent(i.id):i.content},i.id))})});function pe(r){const{panels:e,initialPanelId:t,displayMode:s,transitionMode:a="css",onPanelChange:c}=r,[u,i]=n.useState(()=>{const l=t??e[0]?.id;if(!l)throw new Error("useStackNavigation: No panels provided");return[l]}),[f,p]=n.useState({isRevealing:!1,revealDepth:null}),o=u.length-1,d=n.useMemo(()=>({stack:u,depth:o,isRevealing:f.isRevealing,revealDepth:f.revealDepth}),[u,o,f.isRevealing,f.revealDepth]),h=u[o],g=o>0?u[o-1]:null,S=n.useCallback(l=>{e.find(R=>R.id===l)&&(i(R=>[...R,l]),c?.(l,o+1))},[e,o,c]),v=n.useCallback(l=>{if(l>=0)return;const y=o+l;if(y<0)return;i(F=>F.slice(0,y+1));const R=u[y];c?.(R,y)},[o,u,c]),m=n.useCallback(l=>{if(l<0||l>=u.length)return;i(R=>R.slice(0,l+1));const y=u[l];c?.(y,l)},[u,c]),w=n.useCallback(l=>{e.find(R=>R.id===l)&&(i(R=>[...R.slice(0,-1),l]),c?.(l,o))},[e,o,c]),E=n.useCallback(l=>l>=0?!1:o+l>=0,[o]),k=n.useCallback(l=>{const y=l??o-1;y<0||y>=o||p({isRevealing:!0,revealDepth:y})},[o]),A=n.useCallback(()=>{o!==0&&p({isRevealing:!0,revealDepth:0})},[o]),P=n.useCallback(()=>{p({isRevealing:!1,revealDepth:null})},[]),D=n.useCallback(l=>{const y=u.indexOf(l),R=y===o;return{"data-stack-panel":l,"data-depth":y,"data-active":R?"true":"false","aria-hidden":!R}},[u,o]),M=n.useCallback(()=>{const l=o>0,y=g?e.find(F=>F.id===g):null,R=y?.title?`Back to ${y.title}`:"Go back";return{onClick:()=>v(-1),disabled:!l,"aria-label":R}},[o,g,e,v]),I=n.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]),C=n.useRef({panels:e,navigationState:d,displayMode:s,transitionMode:a});C.current={panels:e,navigationState:d,displayMode:s,transitionMode:a};const O=n.useRef(new Set);n.useEffect(()=>{O.current.forEach(l=>l())},[d,s,a]);const _=n.useCallback(l=>C.current.panels.find(R=>R.id===l)?.content??null,[]),N=n.useMemo(()=>e.map(l=>l.id),[e]),{getCachedContent:b}=ne.useContentCache({resolveContent:_,validIds:N}),x=n.useMemo(()=>({getState:()=>C.current,subscribe:l=>(O.current.add(l),()=>O.current.delete(l)),getCachedContent:b}),[b]),T=n.useMemo(()=>{const l=()=>L.jsx(V.Provider,{value:x,children:L.jsx("div",{style:I,"data-stack-container":!0,children:L.jsx(de,{})})});return l.displayName="StackOutlet",l},[x,I]);return{state:d,push:S,go:v,move:m,replace:w,revealParent:k,revealRoot:A,dismissReveal:P,getPanelProps:D,getBackButtonProps:M,canGo:E,currentPanelId:h,previousPanelId:g,Outlet:T}}const j={isDown:!1,start:null,current:null,pointerId:null,wasCanceled:!1},G=(r,e)=>({x:r,y:e,timestamp:performance.now()});function he(r){const{enabled:e,primaryOnly:t=!0}=r,[s,a]=n.useState(j),c=n.useCallback(()=>{a(j)},[]),u=U.useEffectEvent(d=>{if(!e||t&&!d.isPrimary||d.pointerType==="mouse"&&d.button!==0)return;const h=G(d.clientX,d.clientY);a({isDown:!0,start:h,current:h,pointerId:d.pointerId,wasCanceled:!1})}),i=U.useEffectEvent(d=>{if(s.pointerId!==d.pointerId)return;const h=G(d.clientX,d.clientY);a(g=>({...g,current:h}))}),f=U.useEffectEvent(()=>{a(j)}),p=U.useEffectEvent(()=>{a({...j,wasCanceled:!0})}),o=s.isDown?e:!1;return re.useDocumentPointerEvents(o,{onMove:i,onUp:f,onCancel:p}),n.useEffect(()=>{!e&&s.isDown&&c()},[e,s.isDown,c]),{state:s,onPointerDown:u,reset:c}}const me=10,ve=(r,e)=>{const t=Math.abs(r),s=Math.abs(e);return t===0&&s===0?null:t>s*1.5?"horizontal":s>t*1.5?"vertical":null};function ge(r){const{tracking:e,lockThreshold:t=me}=r,[s,a]=n.useState(null),c=n.useCallback(()=>{a(null)},[]);return n.useEffect(()=>{if(!e.isDown){s!==null&&c();return}if(s!==null||!e.start||!e.current)return;const u=e.current.x-e.start.x,i=e.current.y-e.start.y;if(Math.max(Math.abs(u),Math.abs(i))<t)return;const p=ve(u,i);p!==null&&a(p)},[e.isDown,e.start,e.current,s,t,c]),{lockedAxis:s,isLocked:s!==null,reset:c}}const H=(r,e,t)=>{const s=t-e;return s<=0?0:r/s},W=r=>r>0?1:r<0?-1:0,Ee=(...r)=>{const e={},t=[];for(const a of r)Object.assign(e,a.style),a.onPointerDown&&t.push(a.onPointerDown);return{onPointerDown:a=>{for(const c of t)c?.(a)},style:e}},Y={distanceThreshold:100,velocityThreshold:.5,lockThreshold:10},K=20,$={phase:"idle",displacement:{x:0,y:0},velocity:{x:0,y:0},direction:0},be=150,q=(r,e,t,s,a)=>{const c=t==="horizontal"?r.x:r.y,u=t==="horizontal"?e.x:e.y,i=Math.abs(c),f=Math.abs(u);if(i>=s.distanceThreshold||f>=s.velocityThreshold){const o=W(c);a?.({phase:"ended",displacement:r,velocity:e,direction:o})}};function ye(r){const{containerRef:e,axis:t,enabled:s=!0,thresholds:a,onSwipeEnd:c,enableWheel:u=!0,pointerStartFilter:i}=r,f={...Y,...a},p=U.useEffectEvent(c),{state:o,onPointerDown:d}=he({enabled:s}),h=n.useCallback(b=>{if(s){if(i){const x=e.current;if(!x||!i(b,x))return}d(b)}},[s,i,e,d]),{lockedAxis:g,isLocked:S}=ge({tracking:o,lockThreshold:f.lockThreshold}),v=n.useRef(null),m=n.useRef(!1);n.useEffect(()=>{m.current=S?g===t:!1},[S,g,t]),n.useEffect(()=>{const b=e.current;if(!b||!s)return;const x=y=>{y.preventDefault()},T=y=>{m.current&&y.preventDefault(),document.addEventListener("touchmove",x,{passive:!1})},l=()=>{document.removeEventListener("touchmove",x)};return document.addEventListener("touchend",l),document.addEventListener("touchcancel",l),b.addEventListener("touchstart",T,{passive:!1}),()=>{b.removeEventListener("touchstart",T),document.removeEventListener("touchend",l),document.removeEventListener("touchcancel",l)}},[e,s]);const[w,E]=n.useState($),k=n.useRef({x:0,y:0}),A=n.useRef(null),P=n.useRef(!1),D=n.useRef(null),M=n.useCallback(()=>{k.current={x:0,y:0},P.current=!1,D.current=null,E($)},[]),I=n.useCallback(()=>{const b={...k.current};q(b,{x:0,y:0},t,f,p),M()},[t,f,p,M]),C=U.useEffectEvent(b=>{if(!s||!u||o.isDown)return;const{deltaX:x,deltaY:T}=b;if(!P.current){const R=Math.abs(x),F=Math.abs(T);(R>=f.lockThreshold||F>=f.lockThreshold)&&(P.current=!0,D.current=R>F?"horizontal":"vertical")}if(P.current&&D.current!==t)return;k.current.x-=x,k.current.y-=T;const l=k.current,y=t==="horizontal"?l.x:l.y;E({phase:"swiping",displacement:{...l},velocity:{x:0,y:0},direction:W(y)}),A.current!==null&&clearTimeout(A.current),A.current=setTimeout(I,be)});n.useEffect(()=>{const b=e.current;if(!b||!s||!u)return;const x=T=>{T.preventDefault(),C(T)};return b.addEventListener("wheel",x,{passive:!1}),()=>{b.removeEventListener("wheel",x),A.current!==null&&clearTimeout(A.current)}},[e,s,u,C]),n.useEffect(()=>()=>{A.current!==null&&clearTimeout(A.current)},[]);const O=n.useMemo(()=>{if(!o.isDown||!o.start||!o.current)return $;const b=o.current.x-o.start.x,x=o.current.y-o.start.y,T={x:b,y:x},l={x:H(b,o.start.timestamp,o.current.timestamp),y:H(x,o.start.timestamp,o.current.timestamp)};return!S||g!==t?{phase:"tracking",displacement:T,velocity:l,direction:0}:{phase:"swiping",displacement:T,velocity:l,direction:W(t==="horizontal"?b:x)}},[o.isDown,o.start,o.current,S,g,t]);n.useEffect(()=>{O.phase!=="idle"&&(v.current=O)},[O]),n.useEffect(()=>{if(o.isDown)return;const b=v.current;!b||b.phase!=="swiping"&&b.phase!=="tracking"||(v.current=null,!o.wasCanceled&&q(b.displacement,b.velocity,t,f,p))},[o.isDown,o.wasCanceled,t,f,p]);const _=O.phase!=="idle"?O:w,N=n.useMemo(()=>({onPointerDown:h,style:{touchAction:t==="horizontal"?"pan-y pinch-zoom":"pan-x pinch-zoom",userSelect:"none",WebkitUserSelect:"none"}}),[t,h]);return{state:_,containerProps:N}}const Se=r=>r==="left"||r==="right"?"horizontal":"vertical",we=(r,e,t,s,a)=>{const c=t.getBoundingClientRect();switch(s){case"left":return r>=c.left&&r<=c.left+a;case"right":return r>=c.right-a&&r<=c.right;case"top":return e>=c.top&&e<=c.top+a;case"bottom":return e>=c.bottom-a&&e<=c.bottom}};function Te(r){const{containerRef:e,edge:t,edgeWidth:s=K,enabled:a=!0,thresholds:c,onSwipeEnd:u}=r,i={...Y,...c},f=Se(t),[p,o]=n.useState(!1),d=n.useCallback((v,m)=>{const w=we(v.clientX,v.clientY,m,t,s);return o(w),w},[t,s]),{state:h,containerProps:g}=ye({containerRef:e,axis:f,enabled:a,thresholds:i,onSwipeEnd:u,enableWheel:!1,pointerStartFilter:d});return n.useEffect(()=>{h.phase==="idle"&&o(!1)},[h.phase]),{isEdgeGesture:p,state:p?h:$,containerProps:g}}const ke=(r,e,t)=>{const s=e.getBoundingClientRect();return r>=s.left&&r<=s.left+t};function xe(r){const{containerRef:e,active:t,preventEdgeBack:s=!0,preventOverscroll:a=!0,edgeWidth:c=K}=r,u=n.useRef(null),i=n.useCallback(()=>{if(!a)return;const o=document.documentElement;u.current===null&&(u.current=o.style.overscrollBehavior),o.style.overscrollBehavior="none"},[a]);n.useEffect(()=>{t||!a||u.current!==null&&(document.documentElement.style.overscrollBehavior=u.current,u.current=null)},[t,a]),n.useEffect(()=>()=>{u.current!==null&&(document.documentElement.style.overscrollBehavior=u.current,u.current=null)},[]);const f=n.useCallback(o=>{if(!s)return;const d=e.current;d&&o.pointerType==="touch"&&ke(o.clientX,d,c)&&(i(),o.preventDefault())},[s,e,c,i]);return{containerProps:n.useMemo(()=>({onPointerDown:s?f:void 0,style:{overscrollBehavior:a?"contain":void 0,WebkitOverflowScrolling:"touch"}}),[a,s,f])}}function Re(r){const{containerRef:e,navigation:t,edge:s="left",edgeWidth:a=20,enabled:c=!0}=r,[u,i]=n.useState(null),f=n.useCallback(m=>{i(null),s==="left"&&m.direction===1&&t.canGo(-1)&&t.go(-1)},[s,t]),{isEdgeGesture:p,state:o,containerProps:d}=Te({containerRef:e,edge:s,edgeWidth:a,enabled:c&&t.canGo(-1),onSwipeEnd:f});n.useEffect(()=>{p&&(o.phase==="swiping"||o.phase==="tracking")?i(o):o.phase==="idle"&&i(null)},[p,o]);const{containerProps:h}=xe({containerRef:e,active:p,preventEdgeBack:!0,preventOverscroll:!0,edgeWidth:a}),g=n.useMemo(()=>{if(!u||!e.current)return 0;const m=e.current.clientWidth;if(m===0)return 0;const w=u.displacement.x;if(s==="left"&&w<=0||s==="right"&&w>=0)return 0;const E=Math.abs(w);return Math.min(E/m,1)},[u,e,s]),S=n.useMemo(()=>Ee(d,h),[d,h]);return{isEdgeSwiping:p,progress:g,inputState:p?o:$,containerProps:S}}const Z={easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r)},Ae=300;function De(r){const{duration:e=Ae,easing:t=Z.easeOutExpo,onFrame:s,onComplete:a}=r,[c,u]=n.useState(!1),i=n.useRef(null),f=n.useRef(null),p=n.useRef(s),o=n.useRef(a);n.useEffect(()=>{p.current=s,o.current=a},[s,a]);const d=n.useCallback(()=>{i.current!==null&&(cancelAnimationFrame(i.current),i.current=null),f.current=null,u(!1)},[]),h=n.useCallback(()=>{d(),u(!0),f.current=null;const g=S=>{f.current===null&&(f.current=S);const v=S-f.current,m=Math.min(v/e,1),w=t(m),E=m>=1,k={progress:m,easedProgress:w,elapsed:v,isComplete:E};p.current?.(k),E?(i.current=null,f.current=null,u(!1),o.current?.()):i.current=requestAnimationFrame(g)};i.current=requestAnimationFrame(g)},[e,t,d]);return n.useEffect(()=>()=>{i.current!==null&&cancelAnimationFrame(i.current)},[]),{isAnimating:c,start:h,cancel:d}}function Ce(r,e,t){return r+(e-r)*t}const Pe=300,X=r=>r==="horizontal"?"translateX":"translateY";function Ie(r){const{elementRef:e,targetPx:t,displacement:s,isSwiping:a,axis:c="horizontal",animationDuration:u=Pe,containerSize:i,animateOnTargetChange:f=!1,initialPx:p}=r,o=p??t,d=n.useRef(o),h=n.useRef(null),g=n.useRef(t),S=n.useRef(i),v=n.useRef(null),m=n.useRef(!0);m.current&&p!==void 0&&p!==t?(v.current={from:p,to:t},m.current=!1):m.current&&(m.current=!1),t!==g.current&&!a&&h.current===null&&(f&&Math.abs(d.current-t)>1?v.current={from:d.current,to:t}:d.current=t,g.current=t),i!==void 0&&i!==S.current&&i>0&&(d.current=t,S.current=i);const w=n.useCallback(({easedProgress:D})=>{const M=e.current,I=h.current;if(!M||!I)return;const C=Ce(I.from,I.to,D);d.current=C,M.style.transform=`${X(c)}(${C}px)`},[c,e]),E=n.useCallback(()=>{h.current=null,d.current=t,g.current=t},[t]),{isAnimating:k,start:A,cancel:P}=De({duration:u,easing:Z.easeOutExpo,onFrame:w,onComplete:E});return n.useLayoutEffect(()=>{if(a){P(),h.current=null,v.current=null;return}if(v.current){const I=v.current;h.current=I,v.current=null;const C=e.current;C&&(C.style.transform=`${X(c)}(${I.from}px)`),A();return}const D=d.current;Math.abs(D-t)>1?(h.current={from:D,to:t},A()):(d.current=t,g.current=t)},[a,t,A,P]),n.useLayoutEffect(()=>{const D=e.current;if(!D||k||h.current!==null||v.current!==null)return;const M=t+s;d.current=M,D.style.transform=`${X(c)}(${M}px)`},[t,s,c,k,e]),{isAnimating:k,currentPx:d.current,animationDirection:h.current}}const J=-.3;function Me(r){return Math.max(0,r)}function Oe(r,e,t=J){if(e<=0)return 0;const s=Math.max(0,r),a=Math.min(s/e,1),c=t*e,u=Math.abs(t)*a*e;return c+u}function Le(r){const{depth:e,navigationDepth:t,isActive:s,isSwiping:a,isAnimating:c}=r;return!!(s||e===t-1&&(a||c))}function _e(r,e){return r===e?"active":r===e-1?"behind":"hidden"}const Ne=300,Fe=.05,Ue=.1,$e={position:"absolute",inset:0,width:"100%",height:"100%"},je=(r,e)=>r.phase==="idle"?0:e==="horizontal"?r.displacement.x:r.displacement.y,Be="-5px 0 15px rgba(0, 0, 0, 0.1)",Q=n.memo(({id:r,depth:e,navigationDepth:t,isActive:s,inputState:a,containerSize:c,axis:u="horizontal",behindOffset:i=J,animationDuration:f=Ne,animateOnMount:p=!1,showShadow:o=!0,displayMode:d="overlay",showDimming:h=!0,children:g})=>{const S=n.useRef(null),v=n.useRef(!0),m=je(a,u),w=a.phase==="swiping"||a.phase==="tracking",E=_e(e,t),k=v.current;v.current&&(v.current=!1);const A=n.useMemo(()=>{switch(E){case"active":return 0;case"behind":return i*c;case"hidden":return c}},[E,i,c]),P=n.useMemo(()=>{if(m<=0)return 0;switch(E){case"active":return Me(m);case"behind":{const T=Oe(m,c,i),l=i*c;return T-l}case"hidden":return 0}},[E,m,c,i]),D=n.useMemo(()=>{if(!(!k||!p)&&E==="active"&&e>0)return c},[k,p,E,e,c]),{isAnimating:M}=Ie({elementRef:S,targetPx:A,displacement:P,isSwiping:w,axis:u,animationDuration:f,containerSize:c,animateOnTargetChange:!0,initialPx:D}),I=Le({depth:e,navigationDepth:t,isActive:s,isSwiping:w,isAnimating:M}),C=n.useMemo(()=>c<=0||m<=0?0:Math.min(m/c,1),[m,c]),O=n.useMemo(()=>{if(d!=="stack")return 1;const T=t-e;if(E==="active")return 1;if(E==="behind"){const l=1-T*Fe;return l+C*(1-l)}return 1},[d,E,e,t,C]),_=n.useMemo(()=>!h||E!=="behind"?0:Ue*(1-C),[h,E,C]);n.useLayoutEffect(()=>{const T=S.current;T&&(T.style.visibility=I?"visible":"hidden")},[I]),n.useLayoutEffect(()=>{const T=S.current;if(!T||d!=="stack")return;const l=T.style.transform;if(l.includes("translateX")){const y=l.match(/translateX\([^)]+\)/);y&&(T.style.transform=`${y[0]} scale(${O})`)}else T.style.transform=`scale(${O})`},[O,d]);const N=o&&e>0&&E==="active",b=n.useMemo(()=>({...$e,pointerEvents:s?"auto":"none",willChange:"transform",zIndex:e,visibility:I?"visible":"hidden",boxShadow:N?Be:void 0}),[s,e,I,N]),x=n.useMemo(()=>_<=0?null:{position:"absolute",inset:0,backgroundColor:`rgba(0, 0, 0, ${_})`,pointerEvents:"none",zIndex:1},[_]);return L.jsxs("div",{ref:S,"data-stack-content":r,"data-depth":e,"data-active":s?"true":"false","data-role":E,style:b,children:[g,x!=null&&L.jsx("div",{style:x,"data-dimming-overlay":!0})]})}),Xe=300;function We(r,e,t){const{stack:s,depth:a}=e,c=[a];a>0&&c.push(a-1);const u=[];for(const i of c){const f=s[i],p=r.find(o=>o.id===f);p&&u.push({panel:p,depth:i,isExiting:!1})}if(t!=null&&!u.some(f=>f.panel.id===t)){const f=r.find(p=>p.id===t);f&&u.push({panel:f,depth:a+1,isExiting:!0})}return u.sort((i,f)=>i.depth-f.depth)}const Ge=n.memo(({panels:r,navigationState:e,inputState:t,containerSize:s,getCachedContent:a,behindOffset:c,animateOnMount:u=!1,animationDuration:i=Xe,showShadow:f,displayMode:p,showDimming:o})=>{const[d,h]=n.useState(null),g=n.useRef(e.depth),S=n.useRef(e.stack);n.useLayoutEffect(()=>{const w=g.current,E=S.current,{depth:k,stack:A}=e;if(g.current=k,S.current=A,k<w){const P=E[w];if(P!=null){h(P);const D=setTimeout(()=>{h(null)},i);return()=>clearTimeout(D)}}},[e.depth,e.stack,i]);const v=n.useMemo(()=>We(r,e,d),[r,e,d]),m=n.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return L.jsx("div",{style:m,"data-swipe-stack-container":!0,children:v.map(({panel:w,depth:E,isExiting:k})=>{const A=E===e.depth&&!k,P=a?.(w.id)??w.content;return L.jsx(Q,{id:w.id,depth:E,navigationDepth:e.depth,isActive:A,inputState:t,containerSize:s,behindOffset:c,animateOnMount:u,animationDuration:i,showShadow:f,displayMode:p,showDimming:o,children:P},w.id)})})});exports.StackContent=z;exports.SwipeStackContent=Q;exports.SwipeStackOutlet=Ge;exports.useStackNavigation=pe;exports.useStackSwipeInput=Re;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),Q=require("react"),B=require("./styles-qf6ptVLD.cjs"),Z=require("./useIsomorphicLayoutEffect-DGRNF4Lf.cjs"),z=require("./useContentCache-DqXtLrLs.cjs"),j=require("./useAnimationFrame-BZ6D2lMq.cjs");function ee(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const r=ee(Q);function te(n){const{wasActive:e,isActive:t,transitionMode:i}=n;return i!=="css"||e===t?null:t?"push":"pop"}function ne(n){const{displayMode:e,depth:t,navigationDepth:i,isActive:a,isAnimatingOut:c,isRevealing:u,revealDepth:s}=n;return e==="overlay"?a||c||u&&t===s?"visible":"hidden":t<=i||c?"visible":"hidden"}function re(n){const{depth:e,activeDepth:t,displayMode:i,isRevealing:a,revealDepth:c}=n,u=e===t,s=e<t;if(a&&u&&c!==null)return`translateX(${.3*100}%)`;if(u)return"translateX(0)";if(s)switch(i){case"overlay":return"translateX(0)";case"slide":return"translateX(-30%)";case"stack":{const l=(t-e)*-5,f=1-(t-e)*.05;return`translateX(${l}%) scale(${f})`}}return"translateX(100%)"}function se(n,e,t){return e===void 0||e<=0||!t?n:`translateX(${e*100}%)`}function ie(n){if(n==="css")return`transform ${B.STACK_TRANSITION_DURATION} ${B.STACK_TRANSITION_EASING}`}function ce(n){const{depth:e,isActive:t,wasActive:i,currentAnimationType:a,displayMode:c,transitionMode:u,navigationState:s,swipeProgress:l}=n,m=te({wasActive:i,isActive:t,transitionMode:u})??a,g=m==="pop",o=ne({displayMode:c,depth:e,navigationDepth:s.depth,isActive:t,isAnimatingOut:g,isRevealing:s.isRevealing,revealDepth:s.revealDepth}),v=re({depth:e,activeDepth:s.depth,displayMode:c,isRevealing:s.isRevealing,revealDepth:s.revealDepth}),y=se(v,l,t),b=(()=>{if(u==="css"){if(m==="push")return B.STACK_ANIMATION_PUSH;if(m==="pop")return B.STACK_ANIMATION_POP}})(),d=ie(u);return{nextAnimationType:m,visibility:o,transform:y,animation:b,transition:d,zIndex:e,pointerEvents:t?"auto":"none"}}const oe={position:"absolute",inset:0,width:"100%",height:"100%"},V=r.memo(({id:n,depth:e,isActive:t,displayMode:i,transitionMode:a,navigationState:c,swipeProgress:u,children:s})=>{const l=r.useRef(null),f=r.useRef(t),[m,g]=r.useState(null),o=ce({depth:e,isActive:t,wasActive:f.current,currentAnimationType:m,displayMode:i,transitionMode:a,navigationState:c,swipeProgress:u});Z.useIsomorphicLayoutEffect(()=>{const d=f.current;f.current=t,d!==t&&g(o.nextAnimationType)},[t,o.nextAnimationType]);const v=r.useCallback(d=>{d.target===d.currentTarget&&g(null)},[]),y=r.useMemo(()=>{const d={...oe,transform:o.transform,pointerEvents:o.pointerEvents,zIndex:o.zIndex,visibility:o.visibility};return o.animation!==void 0&&(d.animation=o.animation),o.transition!==void 0&&(d.transition=o.transition),d},[o.transform,o.pointerEvents,o.zIndex,o.visibility,o.animation,o.transition]),b=E.jsx("div",{ref:l,"data-stack-content":n,"data-depth":e,"data-active":t?"true":"false",style:y,onAnimationEnd:v,children:s});return a==="none"?E.jsx(r.Activity,{mode:t?"visible":"hidden",children:b}):b});function ae(n,e){switch(e.type){case"push":return[...n,e.id];case"go":{if(e.direction>=0)return n;const i=n.length-1+e.direction;return i<0?n:n.slice(0,i+1)}case"move":return e.targetDepth<0||e.targetDepth>=n.length?n:n.slice(0,e.targetDepth+1);case"replace":return n.length===0?[e.id]:[...n.slice(0,-1),e.id]}}const q=r.createContext(null),ue=r.memo(()=>{const n=r.useContext(q);if(!n)throw new Error("StackOutlet must be used within useStackNavigation");const[,e]=r.useReducer(s=>s+1,0);r.useEffect(()=>n.subscribe(e),[n]);const{panels:t,navigationState:i,displayMode:a,transitionMode:c}=n.getState(),u=r.useMemo(()=>i.stack.map((s,l)=>{const f=t.find(m=>m.id===s);return f?{panel:f,depth:l}:null}).filter(s=>s!==null),[i.stack,t]);return E.jsx(E.Fragment,{children:u.map(({panel:s,depth:l})=>E.jsx(V,{id:s.id,depth:l,isActive:l===i.depth,displayMode:a,transitionMode:c,navigationState:i,children:s.cache?n.getCachedContent(s.id):s.content},s.id))})});function le(n){const{panels:e,initialPanelId:t,displayMode:i,transitionMode:a="css",onPanelChange:c}=n,u=t??e[0]?.id;if(!u)throw new Error("useStackNavigation: No panels provided");const[s,l]=r.useReducer(ae,[u]),f=r.useRef(s);f.current=s;const m=r.useRef(s);r.useEffect(()=>{const p=m.current;if(m.current=s,c&&s!==p){const S=s.length-1,A=s[S];A!==void 0&&c(A,S)}},[s,c]);const[g,o]=r.useState({isRevealing:!1,revealDepth:null}),v=s.length-1,y=r.useMemo(()=>({stack:s,depth:v,isRevealing:g.isRevealing,revealDepth:g.revealDepth}),[s,v,g.isRevealing,g.revealDepth]),b=s[v],d=v>0?s[v-1]:null,h=r.useCallback(p=>{e.find(A=>A.id===p)&&l({type:"push",id:p})},[e]),R=r.useCallback(p=>{l({type:"go",direction:p})},[]),k=r.useCallback(p=>{l({type:"move",targetDepth:p})},[]),x=r.useCallback(p=>{e.find(A=>A.id===p)&&l({type:"replace",id:p})},[e]),M=r.useCallback(p=>p>=0?!1:f.current.length-1+p>=0,[]),_=r.useCallback(p=>{const S=f.current.length-1,A=p??S-1;A<0||A>=S||o({isRevealing:!0,revealDepth:A})},[]),$=r.useCallback(()=>{f.current.length-1!==0&&o({isRevealing:!0,revealDepth:0})},[]),O=r.useCallback(()=>{o({isRevealing:!1,revealDepth:null})},[]),N=r.useCallback(p=>{const S=f.current,A=S.indexOf(p),X=S.length-1,F=A===X;return{"data-stack-panel":p,"data-depth":A,"data-active":F?"true":"false","aria-hidden":!F}},[]),C=r.useCallback(()=>{const p=f.current,S=p.length-1,A=S>0,X=S>0?p[S-1]:null,F=X?e.find(J=>J.id===X):null,Y=F?.title?`Back to ${F.title}`:"Go back";return{onClick:()=>R(-1),disabled:!A,"aria-label":Y}},[e,R]),T=r.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]),D=r.useRef({panels:e,navigationState:y,displayMode:i,transitionMode:a});D.current={panels:e,navigationState:y,displayMode:i,transitionMode:a};const w=r.useRef(new Set);r.useEffect(()=>{w.current.forEach(p=>p())},[y,i,a]);const U=r.useCallback(p=>D.current.panels.find(A=>A.id===p)?.content??null,[]),I=r.useMemo(()=>e.map(p=>p.id),[e]),{getCachedContent:P}=z.useContentCache({resolveContent:U,validIds:I}),L=r.useMemo(()=>({getState:()=>D.current,subscribe:p=>(w.current.add(p),()=>w.current.delete(p)),getCachedContent:P}),[P]),H=r.useMemo(()=>{const p=()=>E.jsx(q.Provider,{value:L,children:E.jsx("div",{style:T,"data-stack-container":!0,children:E.jsx(ue,{})})});return p.displayName="StackOutlet",p},[L,T]);return{state:y,push:h,go:R,move:k,replace:x,revealParent:_,revealRoot:$,dismissReveal:O,getPanelProps:N,getBackButtonProps:C,canGo:M,currentPanelId:b,previousPanelId:d,Outlet:H}}function fe(n){const{containerRef:e,navigation:t,edge:i="left",edgeWidth:a=20,enabled:c=!0}=n,[u,s]=r.useState(null),l=r.useCallback(d=>{s(null),i==="left"&&d.direction===1&&t.canGo(-1)&&t.go(-1)},[i,t]),{isEdgeGesture:f,state:m,containerProps:g}=j.useEdgeSwipeInput({containerRef:e,edge:i,edgeWidth:a,enabled:c?t.canGo(-1):!1,onSwipeEnd:l});r.useEffect(()=>{f&&(m.phase==="swiping"||m.phase==="tracking")?s(m):m.phase==="idle"&&s(null)},[f,m]);const{containerProps:o}=j.useNativeGestureGuard({containerRef:e,active:f,preventEdgeBack:!0,preventOverscroll:!0,edgeWidth:a}),v=r.useMemo(()=>{if(!u||!e.current)return 0;const d=e.current.clientWidth;if(d===0)return 0;const h=u.displacement.x;if(i==="left"&&h<=0||i==="right"&&h>=0)return 0;const R=Math.abs(h);return Math.min(R/d,1)},[u,e,i]),y=r.useMemo(()=>j.mergeGestureContainerProps(g,o),[g,o]),b=f?m:j.IDLE_SWIPE_INPUT_STATE;return{isEdgeSwiping:f,progress:v,inputState:b,containerProps:y}}const pe=300,G=n=>n==="horizontal"?"translateX":"translateY",de=(n,e,t,i)=>n||e===void 0||e<=0||t===void 0||t===i?null:{from:t,to:i},me=(n,e,t,i,a,c,u)=>n===e?{type:"none"}:i?{type:"none"}:a?{type:"none"}:c?Math.abs(t-n)<=1?{type:"snap",position:n}:u?t>n?{type:"snap",position:n}:{type:"animate",animation:{from:t,to:n}}:{type:"animate",animation:{from:t,to:n}}:{type:"snap",position:n},he=(n,e,t)=>n===void 0||n===e||n<=0?null:t;function ve(n){const{elementRef:e,targetPx:t,displacement:i,isOperating:a,axis:c="horizontal",animationDuration:u=pe,containerSize:s,animateOnTargetChange:l=!1,initialPx:f,skipTargetChangeAnimation:m=!1}=n,g=f??t,o=r.useRef(g),v=r.useRef(null),y=r.useRef(t),b=r.useRef(s),d=r.useRef(null),h=r.useRef(!1),R=de(h.current,s,f,t);R!==null&&(d.current=R,h.current=!0);const k=me(t,y.current,o.current,a,v.current!==null,l,m);k.type==="animate"?(d.current=k.animation,y.current=t):k.type==="snap"&&(o.current=k.position,y.current=t);const x=he(s,b.current,t);x!==null&&(o.current=x,b.current=s);const M=r.useCallback(({easedProgress:C})=>{const T=e.current,D=v.current;if(!T||!D)return;const w=j.interpolate(D.from,D.to,C);o.current=w,T.style.transform=`${G(c)}(${w}px)`},[c,e]),_=r.useCallback(()=>{v.current=null,o.current=t,y.current=t},[t]),{isAnimating:$,start:O,cancel:N}=j.useAnimationFrame({duration:u,easing:j.easings.easeOutExpo,onFrame:M,onComplete:_});return r.useLayoutEffect(()=>{if(a){N(),v.current=null,d.current=null;return}if(d.current){const D=d.current;v.current=D,d.current=null;const w=e.current;w&&(w.style.transform=`${G(c)}(${D.from}px)`),O();return}const C=o.current;Math.abs(C-t)>1?(v.current={from:C,to:t},O()):(o.current=t,y.current=t)},[a,t,O,N]),r.useLayoutEffect(()=>{const C=e.current;if(!C||$||v.current!==null||d.current!==null)return;const T=t+i;o.current=T,C.style.transform=`${G(c)}(${T}px)`},[t,i,c,$,e]),{isAnimating:$,currentPx:o.current,animationDirection:v.current}}function ge(n,e){const t=r.useRef(e),i=r.useRef(n),a=r.useRef(!1),u=t.current?!e:!1,s=n!==i.current,l=e?s:!1,g=(a.current?!0:l)?!0:u?s:!1,o=e?i.current:n;return r.useLayoutEffect(()=>{e?l&&(a.current=!0):(a.current=!1,i.current=n),t.current=e}),{value:o,changedDuringOperation:g,operationJustEnded:u}}const K=-.3;function ye(n){return Math.max(0,n)}function be(n,e,t=K){if(e<=0)return 0;const i=Math.max(0,n),a=Math.min(i/e,1),c=t*e,u=Math.abs(t)*a*e;return c+u}function Re(n){const{depth:e,navigationDepth:t,isActive:i,isOperating:a,isAnimating:c}=n;return!!(i||e===t-1&&(a||c))}function Ae(n,e){return n===e?"active":n===e-1?"behind":"hidden"}const Se=300,ke=.05,Ce=.1,Te={position:"absolute",inset:0,width:"100%",height:"100%"},De=(n,e)=>n.phase==="idle"?0:e==="horizontal"?n.displacement.x:n.displacement.y,Ie="-5px 0 15px rgba(0, 0, 0, 0.1)",W=r.memo(({id:n,depth:e,navigationDepth:t,isActive:i,operationState:a,containerSize:c,axis:u="horizontal",behindOffset:s=K,animationDuration:l=Se,animateOnMount:f=!1,showShadow:m=!0,displayMode:g="overlay",showDimming:o=!0,children:v})=>{const y=r.useRef(null),b=De(a,u),d=a.phase==="operating",h=Ae(e,t),{value:R,changedDuringOperation:k}=ge(h,b>0),x=r.useMemo(()=>{switch(R){case"active":return 0;case"behind":return s*c;case"hidden":return c}},[R,s,c]),M=r.useMemo(()=>{if(b<=0)return 0;switch(R){case"active":return ye(b);case"behind":{const I=be(b,c,s),P=s*c;return I-P}case"hidden":return 0}},[R,b,c,s]),_=r.useMemo(()=>{if(f&&h==="active"&&e>0)return c},[f,h,e,c]),{isAnimating:$}=ve({elementRef:y,targetPx:x,displacement:M,isOperating:d,axis:u,animationDuration:l,containerSize:c,animateOnTargetChange:!0,initialPx:_,skipTargetChangeAnimation:k}),O=Re({depth:e,navigationDepth:t,isActive:i,isOperating:d,isAnimating:$}),N=r.useMemo(()=>c<=0||b<=0?0:Math.min(b/c,1),[b,c]),C=r.useMemo(()=>{if(g!=="stack")return 1;const I=t-e;if(h==="active")return 1;if(h==="behind"){const P=1-I*ke;return P+N*(1-P)}return 1},[g,h,e,t,N]),T=r.useMemo(()=>!o||h!=="behind"?0:Ce*(1-N),[o,h,N]);r.useLayoutEffect(()=>{const I=y.current;I&&(I.style.visibility=O?"visible":"hidden")},[O]),r.useLayoutEffect(()=>{const I=y.current;if(!I||g!=="stack")return;const P=I.style.transform;if(P.includes("translateX")){const L=P.match(/translateX\([^)]+\)/);L&&(I.style.transform=`${L[0]} scale(${C})`)}else I.style.transform=`scale(${C})`},[C,g]);const D=m?e>0&&h==="active":!1,w=r.useMemo(()=>({...Te,pointerEvents:i?"auto":"none",willChange:"transform",zIndex:e,visibility:O?"visible":"hidden",boxShadow:D?Ie:void 0}),[i,e,O,D]),U=r.useMemo(()=>T<=0?null:{position:"absolute",inset:0,backgroundColor:`rgba(0, 0, 0, ${T})`,pointerEvents:"none",zIndex:1},[T]);return E.jsxs("div",{ref:y,"data-stack-content":n,"data-depth":e,"data-active":i?"true":"false","data-role":h,style:w,children:[v,U!=null?E.jsx("div",{style:U,"data-dimming-overlay":!0}):null]})}),Ee=300;function we(n,e,t){const{stack:i,depth:a}=e,c=[a];a>0&&c.push(a-1);const u=[];for(const s of c){const l=i[s],f=n.find(m=>m.id===l);f&&u.push({panel:f,depth:s,isExiting:!1})}if(t!=null&&!u.some(l=>l.panel.id===t)){const l=n.find(f=>f.id===t);l&&u.push({panel:l,depth:a+1,isExiting:!0})}return u.sort((s,l)=>s.depth-l.depth)}const xe=r.memo(({panels:n,navigationState:e,operationState:t,containerSize:i,getCachedContent:a,behindOffset:c,animateOnMount:u=!1,animationDuration:s=Ee,showShadow:l,displayMode:f,showDimming:m})=>{const[g,o]=r.useState(null),v=r.useRef(e.depth),y=r.useRef(e.stack);r.useLayoutEffect(()=>{const h=v.current,R=y.current,{depth:k,stack:x}=e;if(v.current=k,y.current=x,k<h){const M=R[h];if(M!=null){o(M);const _=setTimeout(()=>{o(null)},s);return()=>clearTimeout(_)}}},[e.depth,e.stack,s]);const b=r.useMemo(()=>we(n,e,g),[n,e,g]),d=r.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return E.jsx("div",{style:d,"data-swipe-stack-container":!0,children:b.map(({panel:h,depth:R,isExiting:k})=>{const x=R===e.depth&&!k,M=a?.(h.id)??h.content;return E.jsx(W,{id:h.id,depth:R,navigationDepth:e.depth,isActive:x,operationState:t,containerSize:i,behindOffset:c,animateOnMount:u,animationDuration:s,showShadow:l,displayMode:f,showDimming:m,children:M},h.id)})})});exports.StackContent=V;exports.SwipeStackContent=W;exports.SwipeStackOutlet=xe;exports.useStackNavigation=le;exports.useStackSwipeInput=fe;
|
|
2
2
|
//# sourceMappingURL=stack.cjs.map
|