@seed-design/stackflow 1.1.20 → 1.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/lib/_virtual/_rolldown/runtime.cjs +34 -0
  2. package/lib/_virtual/_rolldown/runtime.js +14 -0
  3. package/lib/components/AppBar/AppBar.cjs +86 -102
  4. package/lib/components/AppBar/AppBar.js +84 -98
  5. package/lib/components/AppBar/AppBar.namespace.cjs +20 -16
  6. package/lib/components/AppBar/AppBar.namespace.js +15 -1
  7. package/lib/components/AppBar/index.cjs +17 -18
  8. package/lib/components/AppBar/index.js +3 -3
  9. package/lib/components/AppScreen/AppScreen.cjs +46 -61
  10. package/lib/components/AppScreen/AppScreen.js +45 -57
  11. package/lib/components/AppScreen/AppScreen.namespace.cjs +17 -13
  12. package/lib/components/AppScreen/AppScreen.namespace.js +12 -1
  13. package/lib/components/AppScreen/index.cjs +14 -15
  14. package/lib/components/AppScreen/index.js +3 -3
  15. package/lib/components/index.cjs +30 -26
  16. package/lib/components/index.js +5 -6
  17. package/lib/hooks/index.cjs +3 -9
  18. package/lib/hooks/index.js +2 -1
  19. package/lib/hooks/useActivityZIndexBase.cjs +12 -11
  20. package/lib/hooks/useActivityZIndexBase.js +11 -7
  21. package/lib/index.cjs +41 -32
  22. package/lib/index.js +8 -10
  23. package/lib/plugin.cjs +16 -16
  24. package/lib/plugin.js +14 -12
  25. package/lib/primitive/AppBar/AppBar.cjs +41 -33
  26. package/lib/primitive/AppBar/AppBar.js +40 -29
  27. package/lib/primitive/AppBar/AppBar.namespace.cjs +16 -12
  28. package/lib/primitive/AppBar/AppBar.namespace.js +11 -1
  29. package/lib/primitive/AppBar/anatomy.cjs +18 -0
  30. package/lib/primitive/AppBar/anatomy.d.ts +15 -0
  31. package/lib/primitive/AppBar/anatomy.js +18 -0
  32. package/lib/primitive/AppBar/index.cjs +13 -14
  33. package/lib/primitive/AppBar/index.js +3 -3
  34. package/lib/primitive/AppBar/useAppBar.cjs +29 -36
  35. package/lib/primitive/AppBar/useAppBar.js +28 -32
  36. package/lib/primitive/AppBar/useAppBarContext.cjs +11 -18
  37. package/lib/primitive/AppBar/useAppBarContext.js +10 -14
  38. package/lib/primitive/AppScreen/AppScreen.cjs +49 -52
  39. package/lib/primitive/AppScreen/AppScreen.js +48 -48
  40. package/lib/primitive/AppScreen/AppScreen.namespace.cjs +16 -12
  41. package/lib/primitive/AppScreen/AppScreen.namespace.js +11 -1
  42. package/lib/primitive/AppScreen/anatomy.cjs +17 -0
  43. package/lib/primitive/AppScreen/anatomy.d.ts +14 -0
  44. package/lib/primitive/AppScreen/anatomy.js +17 -0
  45. package/lib/primitive/AppScreen/index.cjs +15 -16
  46. package/lib/primitive/AppScreen/index.js +4 -4
  47. package/lib/primitive/AppScreen/useAppScreen.cjs +60 -63
  48. package/lib/primitive/AppScreen/useAppScreen.js +59 -59
  49. package/lib/primitive/AppScreen/useAppScreenContext.cjs +11 -18
  50. package/lib/primitive/AppScreen/useAppScreenContext.js +10 -14
  51. package/lib/primitive/GlobalInteraction/GlobalInteraction.cjs +21 -26
  52. package/lib/primitive/GlobalInteraction/GlobalInteraction.js +20 -22
  53. package/lib/primitive/GlobalInteraction/animation.cjs +303 -0
  54. package/lib/primitive/GlobalInteraction/animation.d.ts +16 -0
  55. package/lib/primitive/GlobalInteraction/animation.js +299 -0
  56. package/lib/primitive/GlobalInteraction/constants.cjs +9 -0
  57. package/lib/primitive/GlobalInteraction/constants.d.ts +19 -0
  58. package/lib/primitive/GlobalInteraction/constants.js +8 -0
  59. package/lib/primitive/GlobalInteraction/dom.cjs +147 -0
  60. package/lib/primitive/GlobalInteraction/dom.d.ts +44 -0
  61. package/lib/primitive/GlobalInteraction/dom.js +140 -0
  62. package/lib/primitive/GlobalInteraction/index.cjs +5 -11
  63. package/lib/primitive/GlobalInteraction/index.js +3 -2
  64. package/lib/primitive/GlobalInteraction/useGlobalInteraction.cjs +220 -133
  65. package/lib/primitive/GlobalInteraction/useGlobalInteraction.d.ts +10 -26
  66. package/lib/primitive/GlobalInteraction/useGlobalInteraction.js +219 -129
  67. package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.cjs +11 -18
  68. package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.js +10 -14
  69. package/lib/primitive/GlobalInteraction/useSwipeBack.cjs +71 -55
  70. package/lib/primitive/GlobalInteraction/useSwipeBack.d.ts +19 -2
  71. package/lib/primitive/GlobalInteraction/useSwipeBack.js +70 -51
  72. package/lib/primitive/index.cjs +55 -27
  73. package/lib/primitive/index.js +26 -9
  74. package/lib/primitive/private/useElementOffset.cjs +29 -51
  75. package/lib/primitive/private/useElementOffset.js +27 -28
  76. package/lib/primitive/private/useTopActivity.cjs +22 -31
  77. package/lib/primitive/private/useTopActivity.js +21 -27
  78. package/lib/utils/createStyleContext.cjs +91 -74
  79. package/lib/utils/createStyleContext.js +89 -70
  80. package/lib/utils/styled.cjs +13 -20
  81. package/lib/utils/styled.js +12 -16
  82. package/package.json +4 -4
  83. package/src/components/AppBar/AppBar.tsx +9 -3
  84. package/src/primitive/AppBar/AppBar.tsx +4 -1
  85. package/src/primitive/AppBar/anatomy.ts +16 -0
  86. package/src/primitive/AppBar/useAppBar.tsx +2 -1
  87. package/src/primitive/AppScreen/anatomy.ts +15 -0
  88. package/src/primitive/AppScreen/useAppScreen.tsx +5 -4
  89. package/src/primitive/GlobalInteraction/animation.ts +447 -0
  90. package/src/primitive/GlobalInteraction/constants.ts +24 -0
  91. package/src/primitive/GlobalInteraction/dom.ts +211 -0
  92. package/src/primitive/GlobalInteraction/useGlobalInteraction.ts +302 -129
  93. package/src/primitive/GlobalInteraction/useSwipeBack.ts +64 -26
@@ -1,136 +1,223 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const reactUseCallbackRef = require('@radix-ui/react-use-callback-ref');
7
- const React = require('react');
8
- const useTopActivity = require('../private/useTopActivity.cjs');
9
-
1
+ "use client";
2
+ require("../../_virtual/_rolldown/runtime.cjs");
3
+ const require_useTopActivity = require("../private/useTopActivity.cjs");
4
+ const require_dom = require("./dom.cjs");
5
+ const require_animation = require("./animation.cjs");
6
+ let react = require("react");
7
+ //#region src/primitive/GlobalInteraction/useGlobalInteraction.ts
8
+ var IDLE_CONTEXT = Object.freeze({
9
+ x0: 0,
10
+ t0: 0,
11
+ displacement: 0,
12
+ displacementRatio: 0,
13
+ velocity: 0
14
+ });
15
+ var DEFAULT_DISPLACEMENT_RATIO_THRESHOLD = .4;
16
+ var DEFAULT_VELOCITY_THRESHOLD = 1;
10
17
  function useGlobalInteraction() {
11
- const [swipeBackState, setSwipeBackState] = React.useState("idle");
12
- const swipeBackContextRef = React.useRef({
13
- x0: 0,
14
- t0: 0,
15
- displacement: 0,
16
- displacementRatio: 0,
17
- velocity: 0
18
- });
19
- const stackRef = React.useRef(null);
20
- const setSwipeBackContext = React.useCallback((ctx) => {
21
- swipeBackContextRef.current = ctx;
22
- stackRef.current?.style.setProperty(
23
- "--swipe-back-displacement",
24
- `${ctx.displacement.toString()}px`
25
- );
26
- stackRef.current?.style.setProperty(
27
- "--swipe-back-displacement-ratio",
28
- ctx.displacementRatio.toString()
29
- );
30
- }, []);
31
- const getSwipeBackEvents = React.useCallback(
32
- (props) => {
33
- const {
34
- swipeBackDisplacementRatioThreshold: displacementRatioThreshold = 0.4,
35
- swipeBackVelocityThreshold: velocityThreshold = 1
36
- } = props;
37
- const onSwipeStart = reactUseCallbackRef.useCallbackRef(props.onSwipeBackStart);
38
- const onSwipeMove = reactUseCallbackRef.useCallbackRef(props.onSwipeBackMove);
39
- const onSwipeEnd = reactUseCallbackRef.useCallbackRef(props.onSwipeBackEnd);
40
- const startSwipeBack = React.useCallback(
41
- ({ x0, t0 }) => {
42
- setSwipeBackContext({
43
- x0,
44
- t0,
45
- displacement: 0,
46
- displacementRatio: 0,
47
- velocity: 0
48
- });
49
- setSwipeBackState((prev) => prev === "swiping" ? prev : "swiping");
50
- onSwipeStart?.();
51
- },
52
- [onSwipeStart]
53
- );
54
- const moveSwipeBack = React.useCallback(
55
- ({ x, t }) => {
56
- const displacement = Math.max(0, x - swipeBackContextRef.current.x0);
57
- const displacementRatio = displacement / window.innerWidth;
58
- const velocity = displacement / (t - swipeBackContextRef.current.t0);
59
- setSwipeBackContext({
60
- ...swipeBackContextRef.current,
61
- displacement,
62
- displacementRatio,
63
- velocity
64
- });
65
- setSwipeBackState((prev) => prev === "swiping" ? prev : "swiping");
66
- onSwipeMove?.({ displacement, displacementRatio });
67
- },
68
- [onSwipeMove]
69
- );
70
- const endSwipeBack = React.useCallback(
71
- (_) => {
72
- const swiped = swipeBackContextRef.current.displacementRatio > displacementRatioThreshold || swipeBackContextRef.current.velocity > velocityThreshold;
73
- if (swiped) {
74
- stackRef.current?.style.setProperty("--swipe-back-target", "100%");
75
- setSwipeBackState("completing");
76
- } else {
77
- stackRef.current?.style.setProperty("--swipe-back-target", "0");
78
- setSwipeBackState("canceling");
79
- }
80
- onSwipeEnd?.({ swiped });
81
- },
82
- [onSwipeEnd, displacementRatioThreshold, velocityThreshold]
83
- );
84
- const reset = React.useCallback(() => {
85
- setSwipeBackContext({
86
- x0: 0,
87
- t0: 0,
88
- displacement: 0,
89
- displacementRatio: 0,
90
- velocity: 0
91
- });
92
- stackRef.current?.style.setProperty("--swipe-back-target", "0");
93
- setSwipeBackState("idle");
94
- }, []);
95
- return React.useMemo(
96
- () => ({
97
- startSwipeBack,
98
- moveSwipeBack,
99
- endSwipeBack,
100
- reset
101
- }),
102
- [startSwipeBack, moveSwipeBack, endSwipeBack, reset]
103
- );
104
- },
105
- [setSwipeBackContext]
106
- );
107
- const topActivity = useTopActivity.useTopActivity();
108
- const stackProps = React.useMemo(
109
- () => ({
110
- "data-swipe-back-state": swipeBackState,
111
- "data-global-transition-state": topActivity.transitionState,
112
- "data-top-activity-type": topActivity.activityType,
113
- "data-top-transition-style": topActivity.transitionStyle
114
- }),
115
- [
116
- swipeBackState,
117
- topActivity.transitionState,
118
- topActivity.activityType,
119
- topActivity.transitionStyle
120
- ]
121
- );
122
- return React.useMemo(
123
- () => ({
124
- stackRef,
125
- swipeBackContextRef,
126
- swipeBackState,
127
- setSwipeBackState,
128
- setSwipeBackContext,
129
- getSwipeBackEvents,
130
- stackProps
131
- }),
132
- [swipeBackState, setSwipeBackContext, getSwipeBackEvents, stackProps]
133
- );
18
+ const swipeBackStateRef = (0, react.useRef)("idle");
19
+ const swipeBackContextRef = (0, react.useRef)({ ...IDLE_CONTEXT });
20
+ const stackRef = (0, react.useRef)(null);
21
+ const cachedTargetsRef = (0, react.useRef)(null);
22
+ const runningAnimsRef = (0, react.useRef)([]);
23
+ const appBarBgScrubAnimRef = (0, react.useRef)(null);
24
+ const swipeStyleRef = (0, react.useRef)(null);
25
+ const pendingPushRAFRef = (0, react.useRef)(null);
26
+ const skipNextExitRef = (0, react.useRef)(false);
27
+ /** Cancel any running WAAPI animations and clear the ref. */
28
+ const stopRunningAnims = (0, react.useCallback)(() => {
29
+ require_animation.cancelAll(runningAnimsRef.current);
30
+ runningAnimsRef.current = [];
31
+ }, []);
32
+ /** Cancel the in-place scrub animation on the AppBar background. */
33
+ const stopAppBarBgScrub = (0, react.useCallback)(() => {
34
+ appBarBgScrubAnimRef.current?.cancel();
35
+ appBarBgScrubAnimRef.current = null;
36
+ }, []);
37
+ /** Cancel a pending deferred push animation, if any. */
38
+ const cancelPendingPushRAF = (0, react.useCallback)(() => {
39
+ if (pendingPushRAFRef.current !== null) {
40
+ cancelAnimationFrame(pendingPushRAFRef.current);
41
+ pendingPushRAFRef.current = null;
42
+ }
43
+ }, []);
44
+ /** Update swipe-back-state attribute on the stack DOM element. */
45
+ const setSwipeBackState = (0, react.useCallback)((state) => {
46
+ swipeBackStateRef.current = state;
47
+ if (stackRef.current) stackRef.current.dataset["swipeBackState"] = state;
48
+ }, []);
49
+ const startSwipeBack = (0, react.useCallback)(({ x0, t0 }) => {
50
+ cancelPendingPushRAF();
51
+ stopRunningAnims();
52
+ stopAppBarBgScrub();
53
+ swipeBackContextRef.current = {
54
+ ...IDLE_CONTEXT,
55
+ x0,
56
+ t0
57
+ };
58
+ if (stackRef.current) {
59
+ cachedTargetsRef.current = require_dom.findTransitionTargets(stackRef.current);
60
+ swipeStyleRef.current = require_dom.readTransitionStyle(stackRef.current);
61
+ }
62
+ setSwipeBackState("swiping");
63
+ }, [
64
+ cancelPendingPushRAF,
65
+ stopRunningAnims,
66
+ stopAppBarBgScrub,
67
+ setSwipeBackState
68
+ ]);
69
+ const moveSwipeBack = (0, react.useCallback)(({ x, t }) => {
70
+ const ctx = swipeBackContextRef.current;
71
+ const displacement = Math.max(0, x - ctx.x0);
72
+ const displacementRatio = displacement / window.innerWidth;
73
+ const velocity = displacement / (t - ctx.t0);
74
+ ctx.displacement = displacement;
75
+ ctx.displacementRatio = displacementRatio;
76
+ ctx.velocity = velocity;
77
+ const targets = cachedTargetsRef.current;
78
+ if (targets && swipeStyleRef.current === "slideFromRightIOS") {
79
+ require_dom.applySwipeStyles(targets, displacement, displacementRatio);
80
+ appBarBgScrubAnimRef.current = require_animation.scrubAppBarBackground(targets.topAppBarBackground, `translate3d(${displacement}px, 0, 0)`, appBarBgScrubAnimRef.current);
81
+ }
82
+ return ctx;
83
+ }, []);
84
+ const endSwipeBack = (0, react.useCallback)((thresholds = {}) => {
85
+ const { displacementRatioThreshold = DEFAULT_DISPLACEMENT_RATIO_THRESHOLD, velocityThreshold = DEFAULT_VELOCITY_THRESHOLD } = thresholds;
86
+ const ctx = swipeBackContextRef.current;
87
+ const swiped = ctx.displacementRatio > displacementRatioThreshold || ctx.velocity > velocityThreshold;
88
+ const targets = cachedTargetsRef.current;
89
+ if (!targets) {
90
+ setSwipeBackState("idle");
91
+ return swiped;
92
+ }
93
+ if (swipeStyleRef.current !== "slideFromRightIOS") {
94
+ cachedTargetsRef.current = null;
95
+ swipeStyleRef.current = null;
96
+ setSwipeBackState("idle");
97
+ return swiped;
98
+ }
99
+ stopAppBarBgScrub();
100
+ const onFinish = (animations, pin) => {
101
+ pin();
102
+ require_animation.cancelAll(animations);
103
+ if (runningAnimsRef.current === animations) {
104
+ runningAnimsRef.current = [];
105
+ cachedTargetsRef.current = null;
106
+ swipeStyleRef.current = null;
107
+ setSwipeBackState("idle");
108
+ }
109
+ };
110
+ if (swiped) {
111
+ setSwipeBackState("completing");
112
+ skipNextExitRef.current = true;
113
+ const { animations, finished } = require_animation.animateSwipeComplete(targets, ctx.displacement);
114
+ runningAnimsRef.current = animations;
115
+ finished.then(() => onFinish(animations, () => require_dom.setPostExitPositions(targets)));
116
+ } else {
117
+ setSwipeBackState("canceling");
118
+ const { animations, finished } = require_animation.animateSwipeCancel(targets, ctx.displacement);
119
+ runningAnimsRef.current = animations;
120
+ finished.then(() => onFinish(animations, () => require_dom.setIdlePositions(targets)));
121
+ }
122
+ return swiped;
123
+ }, [setSwipeBackState, stopAppBarBgScrub]);
124
+ const resetSwipeBack = (0, react.useCallback)(() => {
125
+ stopRunningAnims();
126
+ stopAppBarBgScrub();
127
+ if (cachedTargetsRef.current) require_dom.clearAllStyles(cachedTargetsRef.current);
128
+ cachedTargetsRef.current = null;
129
+ swipeStyleRef.current = null;
130
+ swipeBackContextRef.current = { ...IDLE_CONTEXT };
131
+ setSwipeBackState("idle");
132
+ }, [
133
+ stopRunningAnims,
134
+ stopAppBarBgScrub,
135
+ setSwipeBackState
136
+ ]);
137
+ const topActivity = require_useTopActivity.useTopActivity();
138
+ const prevTransitionStateRef = (0, react.useRef)(topActivity.transitionState);
139
+ (0, react.useLayoutEffect)(() => {
140
+ const prev = prevTransitionStateRef.current;
141
+ const next = topActivity.transitionState;
142
+ prevTransitionStateRef.current = next;
143
+ const stackEl = stackRef.current;
144
+ if (!stackEl) return;
145
+ const swipeState = swipeBackStateRef.current;
146
+ if (next === "enter-active" && prev !== "enter-active") {
147
+ if (swipeState !== "idle") return;
148
+ stopRunningAnims();
149
+ cancelPendingPushRAF();
150
+ pendingPushRAFRef.current = requestAnimationFrame(() => {
151
+ pendingPushRAFRef.current = null;
152
+ const style = require_dom.readTransitionStyle(stackEl);
153
+ const targets = require_dom.findTransitionTargets(stackEl);
154
+ const { animations, finished } = require_animation.animateTransition(targets, "push", style);
155
+ runningAnimsRef.current = animations;
156
+ finished.then(() => {
157
+ require_dom.setIdlePositions(targets, style);
158
+ require_animation.cancelAll(animations);
159
+ if (runningAnimsRef.current === animations) runningAnimsRef.current = [];
160
+ });
161
+ });
162
+ }
163
+ if (next === "exit-active" && prev !== "exit-active") {
164
+ if (skipNextExitRef.current) {
165
+ skipNextExitRef.current = false;
166
+ return;
167
+ }
168
+ if (swipeState !== "idle") return;
169
+ cancelPendingPushRAF();
170
+ stopRunningAnims();
171
+ const style = require_dom.readTransitionStyle(stackEl);
172
+ const targets = require_dom.findTransitionTargets(stackEl);
173
+ const { animations, finished } = require_animation.animateTransition(targets, "pop", style);
174
+ runningAnimsRef.current = animations;
175
+ finished.then(() => {
176
+ require_dom.setPostExitPositions(targets, style);
177
+ require_animation.cancelAll(animations);
178
+ if (runningAnimsRef.current === animations) runningAnimsRef.current = [];
179
+ });
180
+ }
181
+ }, [
182
+ topActivity.transitionState,
183
+ stopRunningAnims,
184
+ cancelPendingPushRAF
185
+ ]);
186
+ (0, react.useEffect)(() => {
187
+ return () => {
188
+ cancelPendingPushRAF();
189
+ stopRunningAnims();
190
+ stopAppBarBgScrub();
191
+ };
192
+ }, [
193
+ cancelPendingPushRAF,
194
+ stopRunningAnims,
195
+ stopAppBarBgScrub
196
+ ]);
197
+ const stackProps = (0, react.useMemo)(() => ({
198
+ "data-swipe-back-state": swipeBackStateRef.current,
199
+ "data-global-transition-state": topActivity.transitionState,
200
+ "data-top-activity-type": topActivity.activityType,
201
+ "data-top-transition-style": topActivity.transitionStyle
202
+ }), [
203
+ topActivity.transitionState,
204
+ topActivity.activityType,
205
+ topActivity.transitionStyle
206
+ ]);
207
+ return (0, react.useMemo)(() => ({
208
+ stackRef,
209
+ startSwipeBack,
210
+ moveSwipeBack,
211
+ endSwipeBack,
212
+ resetSwipeBack,
213
+ stackProps
214
+ }), [
215
+ startSwipeBack,
216
+ moveSwipeBack,
217
+ endSwipeBack,
218
+ resetSwipeBack,
219
+ stackProps
220
+ ]);
134
221
  }
135
-
222
+ //#endregion
136
223
  exports.useGlobalInteraction = useGlobalInteraction;
@@ -1,4 +1,4 @@
1
- import { RefObject, Dispatch, SetStateAction, HTMLAttributes } from 'react';
1
+ import { RefObject, HTMLAttributes } from 'react';
2
2
  export type SwipeBackState = "idle" | "swiping" | "canceling" | "completing";
3
3
  export type UseGlobalInteractionReturn = ReturnType<typeof useGlobalInteraction>;
4
4
  export interface SwipeBackContext {
@@ -8,25 +8,17 @@ export interface SwipeBackContext {
8
8
  displacementRatio: number;
9
9
  velocity: number;
10
10
  }
11
- export interface SwipeBackProps {
11
+ export interface SwipeBackThresholds {
12
12
  /**
13
- * The threshold to determine whether the swipe back is intentional.
13
+ * The threshold to determine whether the swipe back is intentional, by displacement ratio.
14
14
  * @default 0.4
15
15
  */
16
- swipeBackDisplacementRatioThreshold?: number;
16
+ displacementRatioThreshold?: number;
17
17
  /**
18
- * The threshold to determine whether the swipe back is intentional.
18
+ * The threshold to determine whether the swipe back is intentional, by velocity.
19
19
  * @default 1
20
20
  */
21
- swipeBackVelocityThreshold?: number;
22
- onSwipeBackStart?: () => void;
23
- onSwipeBackMove?: (props: {
24
- displacement: number;
25
- displacementRatio: number;
26
- }) => void;
27
- onSwipeBackEnd?: (props: {
28
- swiped: boolean;
29
- }) => void;
21
+ velocityThreshold?: number;
30
22
  }
31
23
  export interface StartSwipeBackProps {
32
24
  x0: number;
@@ -36,19 +28,11 @@ export interface MoveSwipeBackProps {
36
28
  x: number;
37
29
  t: number;
38
30
  }
39
- export interface EndSwipeBackProps {
40
- }
41
31
  export declare function useGlobalInteraction(): {
42
32
  stackRef: RefObject<HTMLDivElement | null>;
43
- swipeBackContextRef: RefObject<SwipeBackContext>;
44
- swipeBackState: SwipeBackState;
45
- setSwipeBackState: Dispatch<SetStateAction<SwipeBackState>>;
46
- setSwipeBackContext: (ctx: SwipeBackContext) => void;
47
- getSwipeBackEvents: (props: SwipeBackProps) => {
48
- startSwipeBack: ({ x0, t0 }: StartSwipeBackProps) => void;
49
- moveSwipeBack: ({ x, t }: MoveSwipeBackProps) => void;
50
- endSwipeBack: (_: EndSwipeBackProps) => void;
51
- reset: () => void;
52
- };
33
+ startSwipeBack: ({ x0, t0 }: StartSwipeBackProps) => void;
34
+ moveSwipeBack: ({ x, t }: MoveSwipeBackProps) => SwipeBackContext;
35
+ endSwipeBack: (thresholds?: SwipeBackThresholds) => boolean;
36
+ resetSwipeBack: () => void;
53
37
  stackProps: HTMLAttributes<HTMLElement>;
54
38
  };