react-native-screen-transitions 3.3.0-beta.3 → 3.3.0-beta.4
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/README.md +95 -31
- package/lib/commonjs/shared/animation/snap-to.js +2 -0
- package/lib/commonjs/shared/animation/snap-to.js.map +1 -1
- package/lib/commonjs/shared/components/create-transition-aware-component.js +20 -18
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container.js +59 -6
- package/lib/commonjs/shared/components/screen-container.js.map +1 -1
- package/lib/commonjs/shared/constants.js +8 -1
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js +49 -39
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture-handlers.js +110 -61
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture-handlers.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-scroll-registry.js +67 -70
- package/lib/commonjs/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures.provider.js +112 -5
- package/lib/commonjs/shared/providers/gestures.provider.js.map +1 -1
- package/lib/commonjs/shared/types/ownership.types.js +71 -0
- package/lib/commonjs/shared/types/ownership.types.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/check-gesture-activation.js +72 -128
- package/lib/commonjs/shared/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/commonjs/shared/utils/gesture/compute-claimed-directions.js +81 -0
- package/lib/commonjs/shared/utils/gesture/compute-claimed-directions.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/determine-snap-target.js +1 -1
- package/lib/commonjs/shared/utils/gesture/determine-snap-target.js.map +1 -1
- package/lib/commonjs/shared/utils/gesture/find-collapse-target.js +48 -0
- package/lib/commonjs/shared/utils/gesture/find-collapse-target.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/resolve-ownership.js +87 -0
- package/lib/commonjs/shared/utils/gesture/resolve-ownership.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/velocity.js +16 -5
- package/lib/commonjs/shared/utils/gesture/velocity.js.map +1 -1
- package/lib/module/shared/animation/snap-to.js +1 -0
- package/lib/module/shared/animation/snap-to.js.map +1 -1
- package/lib/module/shared/components/create-transition-aware-component.js +20 -18
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/screen-container.js +59 -7
- package/lib/module/shared/components/screen-container.js.map +1 -1
- package/lib/module/shared/constants.js +7 -0
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-build-gestures.js +49 -39
- package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-screen-gesture-handlers.js +112 -63
- package/lib/module/shared/hooks/gestures/use-screen-gesture-handlers.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-scroll-registry.js +68 -70
- package/lib/module/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
- package/lib/module/shared/providers/gestures.provider.js +112 -5
- package/lib/module/shared/providers/gestures.provider.js.map +1 -1
- package/lib/module/shared/types/ownership.types.js +67 -0
- package/lib/module/shared/types/ownership.types.js.map +1 -0
- package/lib/module/shared/utils/gesture/check-gesture-activation.js +70 -126
- package/lib/module/shared/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/module/shared/utils/gesture/compute-claimed-directions.js +77 -0
- package/lib/module/shared/utils/gesture/compute-claimed-directions.js.map +1 -0
- package/lib/module/shared/utils/gesture/determine-snap-target.js +1 -1
- package/lib/module/shared/utils/gesture/determine-snap-target.js.map +1 -1
- package/lib/module/shared/utils/gesture/find-collapse-target.js +44 -0
- package/lib/module/shared/utils/gesture/find-collapse-target.js.map +1 -0
- package/lib/module/shared/utils/gesture/resolve-ownership.js +83 -0
- package/lib/module/shared/utils/gesture/resolve-ownership.js.map +1 -0
- package/lib/module/shared/utils/gesture/velocity.js +16 -5
- package/lib/module/shared/utils/gesture/velocity.js.map +1 -1
- package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +6 -0
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts +15 -3
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture-handlers.d.ts +52 -2
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture-handlers.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-scroll-registry.d.ts +11 -6
- package/lib/typescript/shared/hooks/gestures/use-scroll-registry.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/use-backdrop-pointer-events.d.ts +1 -1
- package/lib/typescript/shared/hooks/use-backdrop-pointer-events.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures.provider.d.ts +27 -2
- package/lib/typescript/shared/providers/gestures.provider.d.ts.map +1 -1
- package/lib/typescript/shared/types/ownership.types.d.ts +52 -0
- package/lib/typescript/shared/types/ownership.types.d.ts.map +1 -0
- package/lib/typescript/shared/types/screen.types.d.ts +22 -1
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts +23 -19
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/compute-claimed-directions.d.ts +23 -0
- package/lib/typescript/shared/utils/gesture/compute-claimed-directions.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/determine-snap-target.d.ts +5 -1
- package/lib/typescript/shared/utils/gesture/determine-snap-target.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/find-collapse-target.d.ts +17 -0
- package/lib/typescript/shared/utils/gesture/find-collapse-target.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/resolve-ownership.d.ts +36 -0
- package/lib/typescript/shared/utils/gesture/resolve-ownership.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/velocity.d.ts.map +1 -1
- package/package.json +121 -120
- package/src/shared/animation/snap-to.ts +1 -0
- package/src/shared/components/create-transition-aware-component.tsx +28 -25
- package/src/shared/components/screen-container.tsx +69 -7
- package/src/shared/constants.ts +7 -0
- package/src/shared/hooks/gestures/use-build-gestures.tsx +80 -44
- package/src/shared/hooks/gestures/use-screen-gesture-handlers.ts +147 -71
- package/src/shared/hooks/gestures/use-scroll-registry.tsx +94 -86
- package/src/shared/hooks/use-backdrop-pointer-events.ts +1 -1
- package/src/shared/providers/gestures.provider.tsx +166 -5
- package/src/shared/types/ownership.types.ts +77 -0
- package/src/shared/types/screen.types.ts +24 -1
- package/src/shared/utils/gesture/check-gesture-activation.ts +82 -116
- package/src/shared/utils/gesture/compute-claimed-directions.ts +93 -0
- package/src/shared/utils/gesture/determine-snap-target.ts +6 -2
- package/src/shared/utils/gesture/find-collapse-target.ts +42 -0
- package/src/shared/utils/gesture/resolve-ownership.ts +110 -0
- package/src/shared/utils/gesture/velocity.ts +16 -6
- package/src/shared/__tests__/bounds.store.test.ts +0 -394
- package/src/shared/__tests__/derivations.test.ts +0 -156
- package/src/shared/__tests__/determine-dismissal.test.ts +0 -111
- package/src/shared/__tests__/determine-snap-target.test.ts +0 -268
- package/src/shared/__tests__/geometry.test.ts +0 -130
- package/src/shared/__tests__/gesture-activation.test.ts +0 -471
- package/src/shared/__tests__/gesture.velocity.test.ts +0 -131
- package/src/shared/__tests__/history.store.test.ts +0 -550
- package/src/shared/__tests__/sync-routes-with-removed.test.ts +0 -137
- package/src/shared/__tests__/validate-snap-points.test.ts +0 -125
|
@@ -4,11 +4,102 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useGestureContext = exports.ScreenGestureProvider = void 0;
|
|
7
|
+
var _native = require("@react-navigation/native");
|
|
8
|
+
var _react = require("react");
|
|
7
9
|
var _reactNativeReanimated = require("react-native-reanimated");
|
|
8
10
|
var _useBuildGestures = require("../hooks/gestures/use-build-gestures");
|
|
11
|
+
var _gesture = require("../stores/gesture.store");
|
|
12
|
+
var _stack = require("../types/stack.types");
|
|
9
13
|
var _createProvider = _interopRequireDefault(require("../utils/create-provider"));
|
|
14
|
+
var _computeClaimedDirections = require("../utils/gesture/compute-claimed-directions");
|
|
10
15
|
var _keys = require("./screen/keys.provider");
|
|
16
|
+
var _core = require("./stack/core.provider");
|
|
11
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
/**
|
|
19
|
+
* Gesture System - Core Provider
|
|
20
|
+
*
|
|
21
|
+
* Each screen gets a GestureContext containing:
|
|
22
|
+
* - panGesture: Pan gesture handler for dismiss/snap
|
|
23
|
+
* - scrollConfig: Scroll state for boundary detection
|
|
24
|
+
* - claimedDirections: Which directions this screen handles
|
|
25
|
+
* - childDirectionClaims: Claims registered by descendant screens
|
|
26
|
+
*
|
|
27
|
+
* ScrollView coordination is handled by useScrollRegistry, which finds the
|
|
28
|
+
* gesture owner for the scroll axis and creates appropriate Native gestures.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const NO_CLAIMS = {
|
|
32
|
+
vertical: null,
|
|
33
|
+
"vertical-inverted": null,
|
|
34
|
+
horizontal: null,
|
|
35
|
+
"horizontal-inverted": null
|
|
36
|
+
};
|
|
37
|
+
const DIRECTIONS = ["vertical", "vertical-inverted", "horizontal", "horizontal-inverted"];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Registers direction claims on ancestors that this screen shadows.
|
|
41
|
+
* Only registers claims when this screen is the current (topmost) route
|
|
42
|
+
* in its navigator, preventing unfocused screens from blocking gestures.
|
|
43
|
+
*/
|
|
44
|
+
function useRegisterDirectionClaims(ancestorContext, claimedDirections, routeKey, isIsolated, isCurrentRoute) {
|
|
45
|
+
(0, _react.useEffect)(() => {
|
|
46
|
+
// Only register claims when this screen is the current route
|
|
47
|
+
if (!isCurrentRoute || !ancestorContext) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const gestureValues = _gesture.GestureStore.getRouteGestures(routeKey);
|
|
51
|
+
const isDismissing = gestureValues.isDismissing;
|
|
52
|
+
const claimedAncestors = [];
|
|
53
|
+
let ancestor = ancestorContext;
|
|
54
|
+
while (ancestor) {
|
|
55
|
+
if (ancestor.isIsolated !== isIsolated) break;
|
|
56
|
+
const shadowedDirections = [];
|
|
57
|
+
for (const dir of DIRECTIONS) {
|
|
58
|
+
if (claimedDirections[dir] && ancestor.claimedDirections?.[dir]) {
|
|
59
|
+
shadowedDirections.push(dir);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (shadowedDirections.length > 0) {
|
|
63
|
+
claimedAncestors.push({
|
|
64
|
+
ancestor,
|
|
65
|
+
directions: shadowedDirections
|
|
66
|
+
});
|
|
67
|
+
const newClaims = {
|
|
68
|
+
...ancestor.childDirectionClaims.value
|
|
69
|
+
};
|
|
70
|
+
for (const dir of shadowedDirections) {
|
|
71
|
+
newClaims[dir] = {
|
|
72
|
+
routeKey,
|
|
73
|
+
isDismissing
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
ancestor.childDirectionClaims.value = newClaims;
|
|
77
|
+
}
|
|
78
|
+
ancestor = ancestor.ancestorContext;
|
|
79
|
+
}
|
|
80
|
+
return () => {
|
|
81
|
+
for (const {
|
|
82
|
+
ancestor,
|
|
83
|
+
directions
|
|
84
|
+
} of claimedAncestors) {
|
|
85
|
+
const currentClaims = ancestor.childDirectionClaims.value;
|
|
86
|
+
const newClaims = {
|
|
87
|
+
...currentClaims
|
|
88
|
+
};
|
|
89
|
+
let needsUpdate = false;
|
|
90
|
+
for (const dir of directions) {
|
|
91
|
+
if (currentClaims[dir]?.routeKey === routeKey) {
|
|
92
|
+
newClaims[dir] = null;
|
|
93
|
+
needsUpdate = true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (needsUpdate) {
|
|
97
|
+
ancestor.childDirectionClaims.value = newClaims;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}, [ancestorContext, claimedDirections, routeKey, isIsolated, isCurrentRoute]);
|
|
102
|
+
}
|
|
12
103
|
const {
|
|
13
104
|
ScreenGestureProvider,
|
|
14
105
|
useScreenGestureContext: useGestureContext
|
|
@@ -20,26 +111,42 @@ const {
|
|
|
20
111
|
const {
|
|
21
112
|
current
|
|
22
113
|
} = (0, _keys.useKeys)();
|
|
114
|
+
const {
|
|
115
|
+
flags
|
|
116
|
+
} = (0, _core.useStackCoreContext)();
|
|
23
117
|
const ancestorContext = useGestureContext();
|
|
24
|
-
const scrollConfig = (0, _reactNativeReanimated.useSharedValue)(null);
|
|
25
118
|
const hasGestures = current.options.gestureEnabled === true;
|
|
119
|
+
const isIsolated = flags.STACK_TYPE === _stack.StackType.COMPONENT;
|
|
120
|
+
const hasSnapPoints = Array.isArray(current.options.snapPoints) && current.options.snapPoints.length > 0;
|
|
121
|
+
const claimedDirections = (0, _react.useMemo)(() => (0, _computeClaimedDirections.computeClaimedDirections)(hasGestures, current.options.gestureDirection, hasSnapPoints), [hasGestures, current.options.gestureDirection, hasSnapPoints]);
|
|
122
|
+
const routeKey = current.route.key;
|
|
123
|
+
|
|
124
|
+
// Check if this screen is the current (topmost) route in its navigator
|
|
125
|
+
const isCurrentRoute = (0, _native.useNavigationState)(state => state.routes[state.index]?.key === routeKey);
|
|
126
|
+
const scrollConfig = (0, _reactNativeReanimated.useSharedValue)(null);
|
|
127
|
+
const childDirectionClaims = (0, _reactNativeReanimated.useSharedValue)(NO_CLAIMS);
|
|
128
|
+
useRegisterDirectionClaims(ancestorContext, claimedDirections, routeKey, isIsolated, isCurrentRoute);
|
|
26
129
|
const {
|
|
27
130
|
panGesture,
|
|
28
131
|
panGestureRef,
|
|
29
|
-
nativeGesture,
|
|
30
132
|
gestureAnimationValues
|
|
31
133
|
} = (0, _useBuildGestures.useBuildGestures)({
|
|
32
134
|
scrollConfig,
|
|
33
|
-
ancestorContext
|
|
135
|
+
ancestorContext,
|
|
136
|
+
claimedDirections,
|
|
137
|
+
childDirectionClaims,
|
|
138
|
+
isIsolated
|
|
34
139
|
});
|
|
35
140
|
const value = {
|
|
36
141
|
panGesture,
|
|
37
142
|
panGestureRef,
|
|
38
143
|
scrollConfig,
|
|
39
|
-
nativeGesture,
|
|
40
144
|
gestureAnimationValues,
|
|
41
145
|
ancestorContext,
|
|
42
|
-
gestureEnabled: hasGestures
|
|
146
|
+
gestureEnabled: hasGestures,
|
|
147
|
+
isIsolated,
|
|
148
|
+
claimedDirections,
|
|
149
|
+
childDirectionClaims
|
|
43
150
|
};
|
|
44
151
|
return {
|
|
45
152
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_native","require","_react","_reactNativeReanimated","_useBuildGestures","_gesture","_stack","_createProvider","_interopRequireDefault","_computeClaimedDirections","_keys","_core","e","__esModule","default","NO_CLAIMS","vertical","horizontal","DIRECTIONS","useRegisterDirectionClaims","ancestorContext","claimedDirections","routeKey","isIsolated","isCurrentRoute","useEffect","gestureValues","GestureStore","getRouteGestures","isDismissing","claimedAncestors","ancestor","shadowedDirections","dir","push","length","directions","newClaims","childDirectionClaims","value","currentClaims","needsUpdate","ScreenGestureProvider","useScreenGestureContext","useGestureContext","createProvider","guarded","children","current","useKeys","flags","useStackCoreContext","hasGestures","options","gestureEnabled","STACK_TYPE","StackType","COMPONENT","hasSnapPoints","Array","isArray","snapPoints","useMemo","computeClaimedDirections","gestureDirection","route","key","useNavigationState","state","routes","index","scrollConfig","useSharedValue","panGesture","panGestureRef","gestureAnimationValues","useBuildGestures","exports"],"sourceRoot":"../../../../src","sources":["shared/providers/g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B,IAAI,CAAC;EAC9D,MAAMlC,oBAAoB,GAAG,IAAAkC,qCAAc,EAAoBzD,SAAS,CAAC;EAEzEI,0BAA0B,CACzBC,eAAe,EACfC,iBAAiB,EACjBC,QAAQ,EACRC,UAAU,EACVC,cACD,CAAC;EAED,MAAM;IAAEiD,UAAU;IAAEC,aAAa;IAAEC;EAAuB,CAAC,GAC1D,IAAAC,kCAAgB,EAAC;IAChBL,YAAY;IACZnD,eAAe;IACfC,iBAAiB;IACjBiB,oBAAoB;IACpBf;EACD,CAAC,CAAC;EAEH,MAAMgB,KAAyB,GAAG;IACjCkC,UAAU;IACVC,aAAa;IACbH,YAAY;IACZI,sBAAsB;IACtBvD,eAAe;IACfkC,cAAc,EAAEF,WAAW;IAC3B7B,UAAU;IACVF,iBAAiB;IACjBiB;EACD,CAAC;EAED,OAAO;IACNC,KAAK;IACLQ;EACD,CAAC;AACF,CAAC,CAAC;AAAC8B,OAAA,CAAAjC,iBAAA,GAAAA,iBAAA;AAAAiC,OAAA,CAAAnC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NO_OWNERSHIP = exports.NO_CLAIMS = exports.DIRECTIONS = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Gesture Ownership System Types
|
|
9
|
+
*
|
|
10
|
+
* Core principles:
|
|
11
|
+
* 1. Gestures dismiss stacks, not screens
|
|
12
|
+
* 2. Ownership is per-direction (4 independent directions)
|
|
13
|
+
* 3. Shadowing: child claiming same direction blocks parent
|
|
14
|
+
* 4. Inheritance: no local claim walks up tree to find owner
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The four independent gesture directions.
|
|
19
|
+
* Each direction is owned independently.
|
|
20
|
+
*
|
|
21
|
+
* Uses the same format as GestureDirection from gesture.types.ts
|
|
22
|
+
* (excluding 'bidirectional' which expands to all four).
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* All possible directions as an array for iteration.
|
|
27
|
+
*/
|
|
28
|
+
const DIRECTIONS = exports.DIRECTIONS = ["vertical", "vertical-inverted", "horizontal", "horizontal-inverted"];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Map of which directions a screen claims ownership of.
|
|
32
|
+
* A screen claims a direction when:
|
|
33
|
+
* - gestureEnabled is true AND
|
|
34
|
+
* - gestureDirection includes that direction
|
|
35
|
+
*
|
|
36
|
+
* For snap points, both directions on the axis are claimed automatically.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Empty claims - used when gestureEnabled is false.
|
|
41
|
+
*/
|
|
42
|
+
const NO_CLAIMS = exports.NO_CLAIMS = {
|
|
43
|
+
vertical: false,
|
|
44
|
+
"vertical-inverted": false,
|
|
45
|
+
horizontal: false,
|
|
46
|
+
"horizontal-inverted": false
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Ownership status for a direction relative to the current screen.
|
|
51
|
+
*
|
|
52
|
+
* - 'self': Current screen owns this direction (should activate)
|
|
53
|
+
* - 'ancestor': An ancestor owns this direction (should fail to bubble up)
|
|
54
|
+
* - 'none': No one owns this direction (should fail, no gesture response)
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Map of ownership status for all four directions.
|
|
59
|
+
* Pre-computed during render for worklet access.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Empty ownership - used when no gestures are configured anywhere.
|
|
64
|
+
*/
|
|
65
|
+
const NO_OWNERSHIP = exports.NO_OWNERSHIP = {
|
|
66
|
+
vertical: "none",
|
|
67
|
+
"vertical-inverted": "none",
|
|
68
|
+
horizontal: "none",
|
|
69
|
+
"horizontal-inverted": "none"
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=ownership.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DIRECTIONS","exports","NO_CLAIMS","vertical","horizontal","NO_OWNERSHIP"],"sourceRoot":"../../../../src","sources":["shared/types/ownership.types.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACO,MAAMA,UAAuB,GAAAC,OAAA,CAAAD,UAAA,GAAG,CACtC,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,CACrB;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACO,MAAME,SAA4B,GAAAD,OAAA,CAAAC,SAAA,GAAG;EAC3CC,QAAQ,EAAE,KAAK;EACf,mBAAmB,EAAE,KAAK;EAC1BC,UAAU,EAAE,KAAK;EACjB,qBAAqB,EAAE;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACO,MAAMC,YAAgC,GAAAJ,OAAA,CAAAI,YAAA,GAAG;EAC/CF,QAAQ,EAAE,MAAM;EAChB,mBAAmB,EAAE,MAAM;EAC3BC,UAAU,EAAE,MAAM;EAClB,qBAAqB,EAAE;AACxB,CAAC","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.applyOffsetRules = void 0;
|
|
7
7
|
exports.calculateSwipeDirs = calculateSwipeDirs;
|
|
8
|
-
exports.
|
|
8
|
+
exports.checkScrollBoundary = checkScrollBoundary;
|
|
9
9
|
exports.computeEdgeConstraints = computeEdgeConstraints;
|
|
10
10
|
exports.normalizeSides = normalizeSides;
|
|
11
11
|
exports.shouldActivateOrFail = shouldActivateOrFail;
|
|
@@ -232,142 +232,86 @@ const applyOffsetRules = ({
|
|
|
232
232
|
isSwipingLeft
|
|
233
233
|
};
|
|
234
234
|
};
|
|
235
|
-
|
|
235
|
+
|
|
236
236
|
/**
|
|
237
|
-
* Checks if a
|
|
238
|
-
*
|
|
237
|
+
* Checks if a ScrollView is at its boundary for the given swipe direction.
|
|
238
|
+
* This is a simplified boundary check that respects axis isolation.
|
|
239
|
+
*
|
|
240
|
+
* Per the spec:
|
|
241
|
+
* - A vertical ScrollView never yields to horizontal gestures
|
|
242
|
+
* - A horizontal ScrollView never yields to vertical gestures
|
|
243
|
+
* - ScrollView must be at boundary before yielding control
|
|
244
|
+
*
|
|
245
|
+
* For snap point sheets, the boundary depends on where the sheet originates from:
|
|
246
|
+
* - Bottom sheet (vertical): scrollY = 0 (top/base)
|
|
247
|
+
* - Top sheet (verticalInverted): scrollY >= maxY (bottom/end)
|
|
248
|
+
* - Right drawer (horizontal): scrollX = 0 (left/base)
|
|
249
|
+
* - Left drawer (horizontalInverted): scrollX >= maxX (right/end)
|
|
250
|
+
*
|
|
251
|
+
* The rule: "when the ScrollView can't scroll any further in the direction
|
|
252
|
+
* the sheet came from, yield to the gesture."
|
|
253
|
+
*
|
|
254
|
+
* @param scrollConfig - The current scroll state
|
|
255
|
+
* @param direction - The swipe direction to check
|
|
256
|
+
* @param snapAxisInverted - For snap point sheets, whether the axis is inverted (top sheet / left drawer)
|
|
257
|
+
* @returns true if at boundary (gesture should activate), false otherwise
|
|
239
258
|
*/
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
directions,
|
|
243
|
-
scrollConfig,
|
|
244
|
-
hasSnapPoints,
|
|
245
|
-
canExpandMore
|
|
246
|
-
}) {
|
|
259
|
+
exports.applyOffsetRules = applyOffsetRules;
|
|
260
|
+
function checkScrollBoundary(scrollConfig, direction, snapAxisInverted) {
|
|
247
261
|
"worklet";
|
|
248
262
|
|
|
263
|
+
if (!scrollConfig) {
|
|
264
|
+
// No scroll config means no ScrollView - allow gesture
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
249
267
|
const {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
268
|
+
x: scrollX,
|
|
269
|
+
y: scrollY,
|
|
270
|
+
contentWidth,
|
|
271
|
+
contentHeight,
|
|
272
|
+
layoutWidth,
|
|
273
|
+
layoutHeight
|
|
274
|
+
} = scrollConfig;
|
|
255
275
|
|
|
256
|
-
//
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
const maxScrollX = scrollConfig ? scrollConfig.contentWidth - scrollConfig.layoutWidth : 0;
|
|
260
|
-
const maxScrollY = scrollConfig ? scrollConfig.contentHeight - scrollConfig.layoutHeight : 0;
|
|
261
|
-
const snapAxisInverted = directions.snapAxisInverted;
|
|
276
|
+
// Calculate max scroll values
|
|
277
|
+
const maxScrollX = Math.max(0, contentWidth - layoutWidth);
|
|
278
|
+
const maxScrollY = Math.max(0, contentHeight - layoutHeight);
|
|
262
279
|
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
// Sheet from TOP (vertical-inverted): only activate at scroll BOTTOM
|
|
272
|
-
if (scrollY >= maxScrollY) {
|
|
273
|
-
if (isSwipingUp) {
|
|
274
|
-
return {
|
|
275
|
-
shouldActivate: true,
|
|
276
|
-
direction: "vertical-inverted"
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
if (isSwipingDown && canExpandMore) {
|
|
280
|
-
return {
|
|
281
|
-
shouldActivate: true,
|
|
282
|
-
direction: "vertical"
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
} else {
|
|
287
|
-
// Sheet from BOTTOM (vertical): only activate at scroll TOP
|
|
288
|
-
if (scrollY <= 0) {
|
|
289
|
-
if (isSwipingDown) {
|
|
290
|
-
return {
|
|
291
|
-
shouldActivate: true,
|
|
292
|
-
direction: "vertical"
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
if (isSwipingUp && canExpandMore) {
|
|
296
|
-
return {
|
|
297
|
-
shouldActivate: true,
|
|
298
|
-
direction: "vertical-inverted"
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
280
|
+
// For snap point sheets (snapAxisInverted is defined), boundary depends on sheet origin
|
|
281
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
282
|
+
if (snapAxisInverted !== undefined) {
|
|
283
|
+
const isVerticalDirection = direction === "vertical" || direction === "vertical-inverted";
|
|
284
|
+
if (isVerticalDirection) {
|
|
285
|
+
// Bottom sheet (not inverted): boundary at scroll top
|
|
286
|
+
// Top sheet (inverted): boundary at scroll bottom
|
|
287
|
+
return snapAxisInverted ? scrollY >= maxScrollY : scrollY <= 0;
|
|
303
288
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if (isSwipingLeft) {
|
|
309
|
-
return {
|
|
310
|
-
shouldActivate: true,
|
|
311
|
-
direction: "horizontal-inverted"
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
if (isSwipingRight && canExpandMore) {
|
|
315
|
-
return {
|
|
316
|
-
shouldActivate: true,
|
|
317
|
-
direction: "horizontal"
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
} else {
|
|
322
|
-
// Sheet from RIGHT (horizontal): only activate at scroll LEFT
|
|
323
|
-
if (scrollX <= 0) {
|
|
324
|
-
if (isSwipingRight) {
|
|
325
|
-
return {
|
|
326
|
-
shouldActivate: true,
|
|
327
|
-
direction: "horizontal"
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
if (isSwipingLeft && canExpandMore) {
|
|
331
|
-
return {
|
|
332
|
-
shouldActivate: true,
|
|
333
|
-
direction: "horizontal-inverted"
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
return {
|
|
340
|
-
shouldActivate: false,
|
|
341
|
-
direction: null
|
|
342
|
-
};
|
|
289
|
+
// Horizontal direction
|
|
290
|
+
// Right drawer (not inverted): boundary at scroll left
|
|
291
|
+
// Left drawer (inverted): boundary at scroll right
|
|
292
|
+
return snapAxisInverted ? scrollX >= maxScrollX : scrollX <= 0;
|
|
343
293
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
direction: "horizontal-inverted"
|
|
366
|
-
};
|
|
294
|
+
|
|
295
|
+
// Non-sheet screens: each direction has its own boundary
|
|
296
|
+
switch (direction) {
|
|
297
|
+
case "vertical":
|
|
298
|
+
// Swipe down - check if at top of vertical scroll
|
|
299
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
300
|
+
return scrollY <= 0;
|
|
301
|
+
case "vertical-inverted":
|
|
302
|
+
// Swipe up - check if at bottom of vertical scroll
|
|
303
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
304
|
+
return scrollY >= maxScrollY;
|
|
305
|
+
case "horizontal":
|
|
306
|
+
// Swipe right - check if at left of horizontal scroll
|
|
307
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
308
|
+
return scrollX <= 0;
|
|
309
|
+
case "horizontal-inverted":
|
|
310
|
+
// Swipe left - check if at right of horizontal scroll
|
|
311
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
312
|
+
return scrollX >= maxScrollX;
|
|
313
|
+
default:
|
|
314
|
+
return true;
|
|
367
315
|
}
|
|
368
|
-
return {
|
|
369
|
-
shouldActivate: false,
|
|
370
|
-
direction: null
|
|
371
|
-
};
|
|
372
316
|
}
|
|
373
317
|
//# sourceMappingURL=check-gesture-activation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_gesture","require","GESTURE_ACTIVATION_THRESHOLD_X","GESTURE_ACTIVATION_THRESHOLD_Y","GESTURE_FAIL_TOLERANCE_X","GESTURE_FAIL_TOLERANCE_Y","DEFAULT_EDGE_DISTANCE_HORIZONTAL","DEFAULT_EDGE_DISTANCE_VERTICAL","DEFAULT_ACTIVATION_AREA","normalizeSides","area","mode","left","right","top","bottom","s","computeEdgeConstraints","initialTouch","dimensions","sides","responseDistance","xDist","yDist","horizontalRight","x","horizontalLeft","width","verticalDown","y","verticalUp","height","calculateSwipeDirs","deltaX","deltaY","isVerticalSwipe","Math","abs","isHorizontalSwipe","isSwipingDown","isSwipingUp","isSwipingRight","isSwipingLeft","shouldActivateOrFail","params","hasHorizontal","hasVertical","allowedRight","allowedLeft","allowedUp","allowedDown","horizontalGateRight","horizontalGateLeft","verticalGateUp","verticalGateDown","shouldActivate","shouldFail","hasEnoughHorizontalMovement","hasAcceptableVerticalDeviation","rightOk","leftOk","hasEnoughVerticalMovement","hasAcceptableHorizontalDeviation","upOk","downOk","applyOffsetRules","touch","directions","manager","gestureOffsetState","activationArea","vertical","verticalInverted","horizontal","horizontalInverted","value","GestureOffsetState","PENDING","PASSED","FAILED","fail","exports","
|
|
1
|
+
{"version":3,"names":["_gesture","require","GESTURE_ACTIVATION_THRESHOLD_X","GESTURE_ACTIVATION_THRESHOLD_Y","GESTURE_FAIL_TOLERANCE_X","GESTURE_FAIL_TOLERANCE_Y","DEFAULT_EDGE_DISTANCE_HORIZONTAL","DEFAULT_EDGE_DISTANCE_VERTICAL","DEFAULT_ACTIVATION_AREA","normalizeSides","area","mode","left","right","top","bottom","s","computeEdgeConstraints","initialTouch","dimensions","sides","responseDistance","xDist","yDist","horizontalRight","x","horizontalLeft","width","verticalDown","y","verticalUp","height","calculateSwipeDirs","deltaX","deltaY","isVerticalSwipe","Math","abs","isHorizontalSwipe","isSwipingDown","isSwipingUp","isSwipingRight","isSwipingLeft","shouldActivateOrFail","params","hasHorizontal","hasVertical","allowedRight","allowedLeft","allowedUp","allowedDown","horizontalGateRight","horizontalGateLeft","verticalGateUp","verticalGateDown","shouldActivate","shouldFail","hasEnoughHorizontalMovement","hasAcceptableVerticalDeviation","rightOk","leftOk","hasEnoughVerticalMovement","hasAcceptableHorizontalDeviation","upOk","downOk","applyOffsetRules","touch","directions","manager","gestureOffsetState","activationArea","vertical","verticalInverted","horizontal","horizontalInverted","value","GestureOffsetState","PENDING","PASSED","FAILED","fail","exports","checkScrollBoundary","scrollConfig","direction","snapAxisInverted","scrollX","scrollY","contentWidth","contentHeight","layoutWidth","layoutHeight","maxScrollX","max","maxScrollY","undefined","isVerticalDirection"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/check-gesture-activation.ts"],"mappings":";;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AA+DA;AACA;AACA;AACA,MAAMC,8BAA8B,GAAG,EAAE;AACzC,MAAMC,8BAA8B,GAAG,EAAE;AACzC,MAAMC,wBAAwB,GAAG,EAAE;AACnC,MAAMC,wBAAwB,GAAG,EAAE;AACnC,MAAMC,gCAAgC,GAAG,EAAE;AAC3C,MAAMC,8BAA8B,GAAG,GAAG;AAC1C,MAAMC,uBAAuB,GAAG,QAAiB;AAE1C,SAASC,cAAcA,CAACC,IAA4B,EAAmB;EAC7E,SAAS;;EACT,IAAI,CAACA,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IACtC,MAAMC,IAAoB,GAAGD,IAAI,IAAIF,uBAAuB;IAC5D,OAAO;MAAEI,IAAI,EAAED,IAAI;MAAEE,KAAK,EAAEF,IAAI;MAAEG,GAAG,EAAEH,IAAI;MAAEI,MAAM,EAAEJ;IAAK,CAAC;EAC5D;EAEA,MAAMK,CAAiB,GAAGN,IAAsB;EAChD,OAAO;IACNE,IAAI,EAAEI,CAAC,CAACJ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,mBAAmB;IAE9D,IAAIY,mBAAmB,EAAE;MACxB;MACA;MACA,OAAOX,gBAAgB,GAAGE,OAAO,IAAIO,UAAU,GAAGP,OAAO,IAAI,CAAC;IAC/D;IACA;IACA;IACA;IACA,OAAOF,gBAAgB,GAAGC,OAAO,IAAIM,UAAU,GAAGN,OAAO,IAAI,CAAC;EAC/D;;EAEA;EACA,QAAQF,SAAS;IAChB,KAAK,UAAU;MACd;MACA;MACA,OAAOG,OAAO,IAAI,CAAC;IAEpB,KAAK,mBAAmB;MACvB;MACA;MACA,OAAOA,OAAO,IAAIO,UAAU;IAE7B,KAAK,YAAY;MAChB;MACA;MACA,OAAOR,OAAO,IAAI,CAAC;IAEpB,KAAK,qBAAqB;MACzB;MACA;MACA,OAAOA,OAAO,IAAIM,UAAU;IAE7B;MACC,OAAO,IAAI;EACb;AACD","ignoreList":[]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.claimsAnyDirection = claimsAnyDirection;
|
|
7
|
+
exports.computeClaimedDirections = computeClaimedDirections;
|
|
8
|
+
var _ownership = require("../../types/ownership.types");
|
|
9
|
+
/**
|
|
10
|
+
* Computes which directions a screen claims ownership of.
|
|
11
|
+
*
|
|
12
|
+
* A screen claims a direction when:
|
|
13
|
+
* 1. gestureEnabled is true AND
|
|
14
|
+
* 2. gestureDirection includes that direction
|
|
15
|
+
*
|
|
16
|
+
* For snap points, both directions on the axis are claimed automatically.
|
|
17
|
+
* This is because a snap point sheet handles both expand (inverse) and collapse (primary) gestures.
|
|
18
|
+
*
|
|
19
|
+
* @param gestureEnabled - Whether gestures are enabled for this screen
|
|
20
|
+
* @param gestureDirection - The gesture direction(s) configured for this screen
|
|
21
|
+
* @param hasSnapPoints - Whether this screen has snap points configured
|
|
22
|
+
* @returns The claimed directions for this screen
|
|
23
|
+
*/
|
|
24
|
+
function computeClaimedDirections(gestureEnabled, gestureDirection, hasSnapPoints) {
|
|
25
|
+
// If gestures are not enabled, claim nothing
|
|
26
|
+
if (!gestureEnabled) {
|
|
27
|
+
return _ownership.NO_CLAIMS;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Default to vertical if no direction specified
|
|
31
|
+
const direction = gestureDirection ?? "vertical";
|
|
32
|
+
|
|
33
|
+
// Normalize to array
|
|
34
|
+
const directions = Array.isArray(direction) ? direction : [direction];
|
|
35
|
+
|
|
36
|
+
// Start with no claims
|
|
37
|
+
const claims = {
|
|
38
|
+
vertical: false,
|
|
39
|
+
"vertical-inverted": false,
|
|
40
|
+
horizontal: false,
|
|
41
|
+
"horizontal-inverted": false
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Process each direction
|
|
45
|
+
for (const dir of directions) {
|
|
46
|
+
if (dir === "bidirectional") {
|
|
47
|
+
// Bidirectional claims all four directions
|
|
48
|
+
claims.vertical = true;
|
|
49
|
+
claims["vertical-inverted"] = true;
|
|
50
|
+
claims.horizontal = true;
|
|
51
|
+
claims["horizontal-inverted"] = true;
|
|
52
|
+
} else {
|
|
53
|
+
// Claim the specific direction
|
|
54
|
+
claims[dir] = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// For snap points, claim both directions on the axis
|
|
59
|
+
// This enables both expand (inverse) and collapse/dismiss (primary) gestures
|
|
60
|
+
if (hasSnapPoints) {
|
|
61
|
+
const hasVerticalAxis = claims.vertical || claims["vertical-inverted"];
|
|
62
|
+
const hasHorizontalAxis = claims.horizontal || claims["horizontal-inverted"];
|
|
63
|
+
if (hasVerticalAxis) {
|
|
64
|
+
claims.vertical = true;
|
|
65
|
+
claims["vertical-inverted"] = true;
|
|
66
|
+
}
|
|
67
|
+
if (hasHorizontalAxis) {
|
|
68
|
+
claims.horizontal = true;
|
|
69
|
+
claims["horizontal-inverted"] = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return claims;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Checks if any direction is claimed.
|
|
77
|
+
*/
|
|
78
|
+
function claimsAnyDirection(claims) {
|
|
79
|
+
return claims.vertical || claims["vertical-inverted"] || claims.horizontal || claims["horizontal-inverted"];
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=compute-claimed-directions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ownership","require","computeClaimedDirections","gestureEnabled","gestureDirection","hasSnapPoints","NO_CLAIMS","direction","directions","Array","isArray","claims","vertical","horizontal","dir","hasVerticalAxis","hasHorizontalAxis","claimsAnyDirection"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/compute-claimed-directions.ts"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CACvCC,cAAuB,EACvBC,gBAAmE,EACnEC,aAAsB,EACF;EACpB;EACA,IAAI,CAACF,cAAc,EAAE;IACpB,OAAOG,oBAAS;EACjB;;EAEA;EACA,MAAMC,SAAS,GAAGH,gBAAgB,IAAI,UAAU;;EAEhD;EACA,MAAMI,UAA8B,GAAGC,KAAK,CAACC,OAAO,CAACH,SAAS,CAAC,GAC5DA,SAAS,GACT,CAACA,SAAS,CAAC;;EAEd;EACA,MAAMI,MAAyB,GAAG;IACjCC,QAAQ,EAAE,KAAK;IACf,mBAAmB,EAAE,KAAK;IAC1BC,UAAU,EAAE,KAAK;IACjB,qBAAqB,EAAE;EACxB,CAAC;;EAED;EACA,KAAK,MAAMC,GAAG,IAAIN,UAAU,EAAE;IAC7B,IAAIM,GAAG,KAAK,eAAe,EAAE;MAC5B;MACAH,MAAM,CAACC,QAAQ,GAAG,IAAI;MACtBD,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAI;MAClCA,MAAM,CAACE,UAAU,GAAG,IAAI;MACxBF,MAAM,CAAC,qBAAqB,CAAC,GAAG,IAAI;IACrC,CAAC,MAAM;MACN;MACAA,MAAM,CAACG,GAAG,CAAc,GAAG,IAAI;IAChC;EACD;;EAEA;EACA;EACA,IAAIT,aAAa,EAAE;IAClB,MAAMU,eAAe,GAAGJ,MAAM,CAACC,QAAQ,IAAID,MAAM,CAAC,mBAAmB,CAAC;IACtE,MAAMK,iBAAiB,GACtBL,MAAM,CAACE,UAAU,IAAIF,MAAM,CAAC,qBAAqB,CAAC;IAEnD,IAAII,eAAe,EAAE;MACpBJ,MAAM,CAACC,QAAQ,GAAG,IAAI;MACtBD,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAI;IACnC;IACA,IAAIK,iBAAiB,EAAE;MACtBL,MAAM,CAACE,UAAU,GAAG,IAAI;MACxBF,MAAM,CAAC,qBAAqB,CAAC,GAAG,IAAI;IACrC;EACD;EAEA,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACO,SAASM,kBAAkBA,CAACN,MAAyB,EAAW;EACtE,OACCA,MAAM,CAACC,QAAQ,IACfD,MAAM,CAAC,mBAAmB,CAAC,IAC3BA,MAAM,CAACE,UAAU,IACjBF,MAAM,CAAC,qBAAqB,CAAC;AAE/B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["determineSnapTarget","currentProgress","snapPoints","velocity","dimension","velocityFactor","canDismiss","velocityInProgress","projectedProgress","allTargets","sort","a","b","targetProgress","i","length","current","next","undefined","midpoint","shouldDismiss"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/determine-snap-target.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["determineSnapTarget","currentProgress","snapPoints","velocity","dimension","velocityFactor","canDismiss","velocityInProgress","projectedProgress","allTargets","sort","a","b","targetProgress","i","length","current","next","undefined","midpoint","shouldDismiss"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/determine-snap-target.ts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