@rootnative/inertia 0.0.9 → 0.0.10
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/CHANGELOG.md +68 -1
- package/README.md +7 -7
- package/dist/applyBounds-BYGiHrYO.d.mts +18 -0
- package/dist/applyBounds-BYGiHrYO.d.ts +18 -0
- package/dist/{chunk-E3ALFSH2.js → chunk-2UGWAB6N.js} +78 -70
- package/dist/{chunk-ZBHQPVWE.js → chunk-3ZNHPT5Z.js} +2 -2
- package/dist/{chunk-IHVMNOS4.js → chunk-46766TBM.js} +2 -2
- package/dist/{chunk-MUT6BTZS.js → chunk-4EZ5DBL3.js} +10 -7
- package/dist/{chunk-MFAFB4K7.mjs → chunk-6FCATUMY.mjs} +8 -10
- package/dist/{chunk-6YIUETBF.mjs → chunk-7BH3CAO5.mjs} +1 -1
- package/dist/{chunk-JBK5ZLMH.mjs → chunk-CUHOCONB.mjs} +1 -1
- package/dist/{chunk-M4766VUV.mjs → chunk-DRA2K53O.mjs} +1 -1
- package/dist/{chunk-L4JFECXU.mjs → chunk-F4HMCXAX.mjs} +6 -3
- package/dist/{chunk-W7NTRSPD.mjs → chunk-HEAWMZEM.mjs} +105 -66
- package/dist/{chunk-IX6SEOSK.mjs → chunk-JENYDTXH.mjs} +52 -44
- package/dist/chunk-KFHZMFAX.js +23 -0
- package/dist/{chunk-6AN5X3YE.js → chunk-KXU6VH2Y.js} +10 -11
- package/dist/{chunk-WNVHPMBI.js → chunk-N33GSDNQ.js} +106 -65
- package/dist/chunk-OH46TGEA.mjs +20 -0
- package/dist/{chunk-QNLSCOR5.mjs → chunk-OLOSU2BD.mjs} +1 -1
- package/dist/chunk-PLKXCJIB.js +8 -0
- package/dist/{chunk-GSUC4HWP.mjs → chunk-QXKPIENP.mjs} +1 -1
- package/dist/chunk-UBHQJFUW.js +8 -0
- package/dist/{chunk-6NOCY764.js → chunk-VKXSL3ZL.js} +2 -2
- package/dist/chunk-XKNEQDAT.js +8 -0
- package/dist/{chunk-EN4PN7X3.mjs → chunk-Z23AMUSW.mjs} +1 -1
- package/dist/gestureLayer/index.d.mts +3 -3
- package/dist/gestureLayer/index.d.ts +3 -3
- package/dist/gestureLayer/index.js +12 -18
- package/dist/gestureLayer/index.mjs +5 -11
- package/dist/index.d.mts +87 -45
- package/dist/index.d.ts +87 -45
- package/dist/index.js +114 -91
- package/dist/index.mjs +66 -59
- package/dist/motion/FlatList.d.mts +1 -1
- package/dist/motion/FlatList.d.ts +1 -1
- package/dist/motion/FlatList.js +5 -5
- package/dist/motion/FlatList.mjs +4 -4
- package/dist/motion/Image.d.mts +1 -1
- package/dist/motion/Image.d.ts +1 -1
- package/dist/motion/Image.js +5 -5
- package/dist/motion/Image.mjs +4 -4
- package/dist/motion/Pressable.d.mts +1 -1
- package/dist/motion/Pressable.d.ts +1 -1
- package/dist/motion/Pressable.js +5 -5
- package/dist/motion/Pressable.mjs +4 -4
- package/dist/motion/ScrollView.d.mts +1 -1
- package/dist/motion/ScrollView.d.ts +1 -1
- package/dist/motion/ScrollView.js +5 -5
- package/dist/motion/ScrollView.mjs +4 -4
- package/dist/motion/Text.d.mts +1 -1
- package/dist/motion/Text.d.ts +1 -1
- package/dist/motion/Text.js +5 -5
- package/dist/motion/Text.mjs +4 -4
- package/dist/motion/View.d.mts +1 -1
- package/dist/motion/View.d.ts +1 -1
- package/dist/motion/View.js +5 -5
- package/dist/motion/View.mjs +4 -4
- package/dist/touch/index.d.mts +2 -1
- package/dist/touch/index.d.ts +2 -1
- package/dist/touch/index.js +16 -31
- package/dist/touch/index.mjs +11 -29
- package/dist/{types-DyJpG64F.d.mts → types-08mG8fNk.d.mts} +10 -3
- package/dist/{types-DyJpG64F.d.ts → types-08mG8fNk.d.ts} +10 -3
- package/dist/{useGesture-DbH46EBp.d.ts → useGesture-D1lHeQQ6.d.ts} +1 -1
- package/dist/{useGesture-CnZQnYHH.d.mts → useGesture-DjszaHWz.d.mts} +1 -1
- package/package.json +4 -2
- package/src/config/namedTransitions.ts +7 -9
- package/src/gestureLayer/index.ts +3 -0
- package/src/gestureLayer/useGestureLayer.ts +6 -9
- package/src/gestures/focusVisibility.ts +19 -17
- package/src/gestures/index.ts +1 -1
- package/src/index.ts +9 -0
- package/src/layout/resolveLayout.ts +4 -1
- package/src/layout/useSharedLayout.ts +2 -1
- package/src/motion/createMotionComponent.tsx +92 -44
- package/src/presence/Presence.tsx +5 -7
- package/src/touch/applyBounds.ts +30 -0
- package/src/touch/index.ts +1 -0
- package/src/touch/useTouchDrag.ts +15 -45
- package/src/transitions/constants.ts +14 -0
- package/src/transitions/easing.ts +23 -11
- package/src/transitions/index.ts +5 -0
- package/src/transitions/keys.ts +0 -2
- package/src/transitions/resolve.ts +86 -11
- package/src/transitions/resolveSequence.ts +3 -1
- package/src/transitions/runtime.ts +4 -7
- package/src/transitions/spring.ts +7 -2
- package/src/types.ts +9 -2
- package/src/values/extrapolation.ts +21 -0
- package/src/values/index.ts +1 -0
- package/src/values/useGesture.ts +9 -2
- package/src/values/useInterpolatedStyle.ts +5 -12
- package/src/values/useShadow.ts +18 -7
- package/src/values/useSpring.ts +34 -25
- package/src/values/useTransform.ts +24 -20
- package/src/values/useTranslateStyle.ts +31 -0
- package/dist/chunk-24NUL23E.js +0 -8
- package/dist/chunk-4XBX7KOD.js +0 -8
- package/dist/chunk-Z5USXWTE.js +0 -8
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
export { applyBounds, useTranslateStyle } from './chunk-OH46TGEA.mjs';
|
|
2
|
+
export { useGesture } from './chunk-F4HMCXAX.mjs';
|
|
3
|
+
import { MotionView } from './chunk-QXKPIENP.mjs';
|
|
4
|
+
export { MotionView } from './chunk-QXKPIENP.mjs';
|
|
5
|
+
import { MotionText } from './chunk-OLOSU2BD.mjs';
|
|
6
|
+
export { MotionText } from './chunk-OLOSU2BD.mjs';
|
|
7
|
+
import { MotionImage } from './chunk-7BH3CAO5.mjs';
|
|
8
|
+
export { MotionImage } from './chunk-7BH3CAO5.mjs';
|
|
9
|
+
import { MotionPressable } from './chunk-CUHOCONB.mjs';
|
|
10
|
+
export { MotionPressable } from './chunk-CUHOCONB.mjs';
|
|
11
|
+
import { MotionScrollView } from './chunk-DRA2K53O.mjs';
|
|
12
|
+
export { MotionScrollView } from './chunk-DRA2K53O.mjs';
|
|
13
|
+
import { MotionFlatList } from './chunk-Z23AMUSW.mjs';
|
|
14
|
+
export { MotionFlatList } from './chunk-Z23AMUSW.mjs';
|
|
15
|
+
import { pairBoxShadowLayers, resolveBoxShadowInput } from './chunk-JENYDTXH.mjs';
|
|
16
|
+
export { Presence, Stagger, TRANSPARENT, createMotionComponent, usePresence, useStaggerDelay } from './chunk-JENYDTXH.mjs';
|
|
17
|
+
import { useShouldReduceMotion, resolveNamedTransition, useNamedTransitions, lookupNamedTransition } from './chunk-6FCATUMY.mjs';
|
|
18
|
+
export { MotionConfig, resolveNamedTransition, useMotionConfig, useNamedTransitions, useShouldReduceMotion } from './chunk-6FCATUMY.mjs';
|
|
19
|
+
import { stableSig, resolveTransition, springToReanimated, warnOnce, warnNonWorkletOnce } from './chunk-HEAWMZEM.mjs';
|
|
20
|
+
export { applyDelay, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, isTopLevelTransition, resolveAnimatableValue, resolveTransition, stableSig } from './chunk-HEAWMZEM.mjs';
|
|
20
21
|
import { useEffect, useRef, useCallback, useMemo } from 'react';
|
|
21
|
-
import { useSharedValue, cancelAnimation, withSpring, useAnimatedReaction, useAnimatedStyle, interpolateColor, interpolate, useDerivedValue,
|
|
22
|
+
import { useSharedValue, cancelAnimation, withSpring, useAnimatedReaction, useAnimatedStyle, interpolateColor, interpolate, useDerivedValue, useAnimatedScrollHandler, Extrapolation } from 'react-native-reanimated';
|
|
22
23
|
import { isWorkletFunction } from 'react-native-worklets';
|
|
23
24
|
|
|
24
25
|
// src/motion/index.ts
|
|
@@ -62,6 +63,7 @@ function useAnimator() {
|
|
|
62
63
|
}
|
|
63
64
|
function useSpring(target, config) {
|
|
64
65
|
const spring = resolveSpringInput(config, useNamedTransitions());
|
|
66
|
+
const shouldReduceMotion = useShouldReduceMotion();
|
|
65
67
|
const reanimConfig = useMemo(
|
|
66
68
|
() => springToReanimated(spring ?? {}),
|
|
67
69
|
// Keyed on the resolved primitive fields rather than the `config` object
|
|
@@ -69,34 +71,28 @@ function useSpring(target, config) {
|
|
|
69
71
|
// depending on `config` itself would rebuild the Reanimated config on
|
|
70
72
|
// every render and defeat the memo.
|
|
71
73
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
|
-
[
|
|
73
|
-
spring?.tension,
|
|
74
|
-
spring?.friction,
|
|
75
|
-
spring?.mass,
|
|
76
|
-
spring?.velocity,
|
|
77
|
-
spring?.restSpeedThreshold,
|
|
78
|
-
spring?.restDisplacementThreshold
|
|
79
|
-
]
|
|
74
|
+
[spring?.tension, spring?.friction, spring?.mass, spring?.velocity]
|
|
80
75
|
);
|
|
81
76
|
const isSharedTarget = isSharedValue(target);
|
|
82
77
|
const initial = isSharedTarget ? target.value : target;
|
|
83
78
|
const output = useSharedValue(initial);
|
|
84
79
|
useEffect(() => {
|
|
85
80
|
if (isSharedTarget) return;
|
|
86
|
-
output.value = withSpring(target, reanimConfig);
|
|
87
|
-
}, [isSharedTarget, target, reanimConfig]);
|
|
81
|
+
output.value = shouldReduceMotion ? target : withSpring(target, reanimConfig);
|
|
82
|
+
}, [isSharedTarget, target, reanimConfig, shouldReduceMotion]);
|
|
83
|
+
const source = isSharedTarget ? target : null;
|
|
88
84
|
useAnimatedReaction(
|
|
89
85
|
() => {
|
|
90
86
|
"worklet";
|
|
91
|
-
if (
|
|
92
|
-
return
|
|
87
|
+
if (source === null) return null;
|
|
88
|
+
return source.value;
|
|
93
89
|
},
|
|
94
90
|
(next, prev) => {
|
|
95
91
|
"worklet";
|
|
96
92
|
if (next === null || next === prev) return;
|
|
97
|
-
output.value = withSpring(next, reanimConfig);
|
|
93
|
+
output.value = shouldReduceMotion ? next : withSpring(next, reanimConfig);
|
|
98
94
|
},
|
|
99
|
-
[
|
|
95
|
+
[source, reanimConfig, shouldReduceMotion]
|
|
100
96
|
);
|
|
101
97
|
useEffect(
|
|
102
98
|
() => () => cancelAnimation(output),
|
|
@@ -110,11 +106,10 @@ function resolveSpringInput(config, registry) {
|
|
|
110
106
|
if (typeof config !== "string") return config;
|
|
111
107
|
const cfg = lookupNamedTransition(config, registry);
|
|
112
108
|
if (cfg.type === void 0 || cfg.type === "spring") return cfg;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
109
|
+
warnOnce(
|
|
110
|
+
`spring-only:${config}`,
|
|
111
|
+
`[inertia] Named transition "${config}" resolves to type '${cfg.type}', but useSpring / useBooleanSpring are spring-only \u2014 falling back to the default spring. Use useAnimation to honor non-spring named transitions.`
|
|
112
|
+
);
|
|
118
113
|
return void 0;
|
|
119
114
|
}
|
|
120
115
|
function isSharedValue(v) {
|
|
@@ -164,6 +159,13 @@ function useColorTransition(progress, range, options) {
|
|
|
164
159
|
return { [key]: interpolateColor(progress.value, [0, 1], [from, to]) };
|
|
165
160
|
});
|
|
166
161
|
}
|
|
162
|
+
function mapExtrapolation(mode) {
|
|
163
|
+
if (mode === "identity") return Extrapolation.IDENTITY;
|
|
164
|
+
if (mode === "extend") return Extrapolation.EXTEND;
|
|
165
|
+
return Extrapolation.CLAMP;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// src/values/useInterpolatedStyle.ts
|
|
167
169
|
var TRANSFORM_KEYS = /* @__PURE__ */ new Set([
|
|
168
170
|
"translateX",
|
|
169
171
|
"translateY",
|
|
@@ -192,11 +194,6 @@ function evenlySpaced(count) {
|
|
|
192
194
|
for (let i = 0; i < count; i++) out.push(i / (count - 1));
|
|
193
195
|
return out;
|
|
194
196
|
}
|
|
195
|
-
function mapExtrapolation(mode) {
|
|
196
|
-
if (mode === "identity") return Extrapolation.IDENTITY;
|
|
197
|
-
if (mode === "extend") return Extrapolation.EXTEND;
|
|
198
|
-
return Extrapolation.CLAMP;
|
|
199
|
-
}
|
|
200
197
|
function buildSignature(map, options) {
|
|
201
198
|
let sig = "";
|
|
202
199
|
for (const key of Object.keys(map)) {
|
|
@@ -213,8 +210,9 @@ function buildEntries(map, options) {
|
|
|
213
210
|
const output = map[key];
|
|
214
211
|
if (output === void 0 || output.length === 0) continue;
|
|
215
212
|
const input = explicitInput ? explicitInput : output.length === 2 ? [0, 1] : evenlySpaced(output.length);
|
|
216
|
-
if (
|
|
217
|
-
|
|
213
|
+
if (explicitInput && explicitInput.length !== output.length) {
|
|
214
|
+
warnOnce(
|
|
215
|
+
`interpolated-style-range:${String(key)}:${explicitInput.length}:${output.length}`,
|
|
218
216
|
`[inertia] useInterpolatedStyle: inputRange has ${explicitInput.length} stops but the "${String(
|
|
219
217
|
key
|
|
220
218
|
)}" output has ${output.length}. They must match \u2014 interpolation results are undefined otherwise.`
|
|
@@ -303,6 +301,15 @@ function useMotionValue(initial) {
|
|
|
303
301
|
return sv;
|
|
304
302
|
}
|
|
305
303
|
function useTransform(arg1, inputRange, outputRange, options) {
|
|
304
|
+
const rangeSig = stableSig([inputRange, outputRange]);
|
|
305
|
+
const ranges = useMemo(
|
|
306
|
+
() => ({
|
|
307
|
+
input: inputRange ?? [],
|
|
308
|
+
output: outputRange ?? []
|
|
309
|
+
}),
|
|
310
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
311
|
+
[rangeSig]
|
|
312
|
+
);
|
|
306
313
|
let producer;
|
|
307
314
|
if (typeof arg1 === "function") {
|
|
308
315
|
const userFn = arg1;
|
|
@@ -320,11 +327,11 @@ function useTransform(arg1, inputRange, outputRange, options) {
|
|
|
320
327
|
}
|
|
321
328
|
} else {
|
|
322
329
|
const source = arg1;
|
|
323
|
-
const input =
|
|
324
|
-
const output =
|
|
330
|
+
const input = ranges.input;
|
|
331
|
+
const output = ranges.output;
|
|
325
332
|
const isColor = output.length > 0 && typeof output[0] === "string";
|
|
326
|
-
const extrapolateLeft =
|
|
327
|
-
const extrapolateRight =
|
|
333
|
+
const extrapolateLeft = mapExtrapolation(options?.extrapolateLeft);
|
|
334
|
+
const extrapolateRight = mapExtrapolation(options?.extrapolateRight);
|
|
328
335
|
producer = isColor ? () => {
|
|
329
336
|
"worklet";
|
|
330
337
|
return interpolateColor(
|
|
@@ -344,11 +351,6 @@ function useTransform(arg1, inputRange, outputRange, options) {
|
|
|
344
351
|
}
|
|
345
352
|
return useDerivedValue(producer);
|
|
346
353
|
}
|
|
347
|
-
function mapExtrapolation2(mode) {
|
|
348
|
-
if (mode === "identity") return Extrapolation.IDENTITY;
|
|
349
|
-
if (mode === "extend") return Extrapolation.EXTEND;
|
|
350
|
-
return Extrapolation.CLAMP;
|
|
351
|
-
}
|
|
352
354
|
function useScroll() {
|
|
353
355
|
const scrollX = useSharedValue(0);
|
|
354
356
|
const scrollY = useSharedValue(0);
|
|
@@ -375,10 +377,15 @@ function useShadow({
|
|
|
375
377
|
const hasElevation = from.elevation !== void 0 || to.elevation !== void 0;
|
|
376
378
|
const hasColor = from.shadowColor !== void 0 || to.shadowColor !== void 0;
|
|
377
379
|
const hasOffset = from.shadowOffset !== void 0 || to.shadowOffset !== void 0;
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
const boxShadowSig = stableSig([from.boxShadow, to.boxShadow]);
|
|
381
|
+
const boxShadowPairs = useMemo(
|
|
382
|
+
() => from.boxShadow !== void 0 || to.boxShadow !== void 0 ? pairBoxShadowLayers(
|
|
383
|
+
resolveBoxShadowInput(from.boxShadow),
|
|
384
|
+
resolveBoxShadowInput(to.boxShadow)
|
|
385
|
+
) : [],
|
|
386
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
387
|
+
[boxShadowSig]
|
|
388
|
+
);
|
|
382
389
|
const opacityFrom = from.shadowOpacity ?? 0;
|
|
383
390
|
const opacityTo = to.shadowOpacity ?? 0;
|
|
384
391
|
const radiusFrom = from.shadowRadius ?? 0;
|
package/dist/motion/FlatList.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunk46766TBM_js = require('../chunk-46766TBM.js');
|
|
4
|
+
require('../chunk-2UGWAB6N.js');
|
|
5
|
+
require('../chunk-KXU6VH2Y.js');
|
|
6
|
+
require('../chunk-N33GSDNQ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionFlatList", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk46766TBM_js.MotionFlatList; }
|
|
13
13
|
});
|
package/dist/motion/FlatList.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionFlatList } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionFlatList } from '../chunk-Z23AMUSW.mjs';
|
|
2
|
+
import '../chunk-JENYDTXH.mjs';
|
|
3
|
+
import '../chunk-6FCATUMY.mjs';
|
|
4
|
+
import '../chunk-HEAWMZEM.mjs';
|
package/dist/motion/Image.d.mts
CHANGED
package/dist/motion/Image.d.ts
CHANGED
package/dist/motion/Image.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkXKNEQDAT_js = require('../chunk-XKNEQDAT.js');
|
|
4
|
+
require('../chunk-2UGWAB6N.js');
|
|
5
|
+
require('../chunk-KXU6VH2Y.js');
|
|
6
|
+
require('../chunk-N33GSDNQ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionImage", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkXKNEQDAT_js.MotionImage; }
|
|
13
13
|
});
|
package/dist/motion/Image.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionImage } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionImage } from '../chunk-7BH3CAO5.mjs';
|
|
2
|
+
import '../chunk-JENYDTXH.mjs';
|
|
3
|
+
import '../chunk-6FCATUMY.mjs';
|
|
4
|
+
import '../chunk-HEAWMZEM.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_native from 'react-native';
|
|
3
|
-
import { M as MotionComponent } from '../types-
|
|
3
|
+
import { M as MotionComponent } from '../types-08mG8fNk.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_native from 'react-native';
|
|
3
|
-
import { M as MotionComponent } from '../types-
|
|
3
|
+
import { M as MotionComponent } from '../types-08mG8fNk.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into
|
package/dist/motion/Pressable.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkVKXSL3ZL_js = require('../chunk-VKXSL3ZL.js');
|
|
4
|
+
require('../chunk-2UGWAB6N.js');
|
|
5
|
+
require('../chunk-KXU6VH2Y.js');
|
|
6
|
+
require('../chunk-N33GSDNQ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionPressable", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkVKXSL3ZL_js.MotionPressable; }
|
|
13
13
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionPressable } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionPressable } from '../chunk-CUHOCONB.mjs';
|
|
2
|
+
import '../chunk-JENYDTXH.mjs';
|
|
3
|
+
import '../chunk-6FCATUMY.mjs';
|
|
4
|
+
import '../chunk-HEAWMZEM.mjs';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunk3ZNHPT5Z_js = require('../chunk-3ZNHPT5Z.js');
|
|
4
|
+
require('../chunk-2UGWAB6N.js');
|
|
5
|
+
require('../chunk-KXU6VH2Y.js');
|
|
6
|
+
require('../chunk-N33GSDNQ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionScrollView", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk3ZNHPT5Z_js.MotionScrollView; }
|
|
13
13
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionScrollView } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionScrollView } from '../chunk-DRA2K53O.mjs';
|
|
2
|
+
import '../chunk-JENYDTXH.mjs';
|
|
3
|
+
import '../chunk-6FCATUMY.mjs';
|
|
4
|
+
import '../chunk-HEAWMZEM.mjs';
|
package/dist/motion/Text.d.mts
CHANGED
package/dist/motion/Text.d.ts
CHANGED
package/dist/motion/Text.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkUBHQJFUW_js = require('../chunk-UBHQJFUW.js');
|
|
4
|
+
require('../chunk-2UGWAB6N.js');
|
|
5
|
+
require('../chunk-KXU6VH2Y.js');
|
|
6
|
+
require('../chunk-N33GSDNQ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionText", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkUBHQJFUW_js.MotionText; }
|
|
13
13
|
});
|
package/dist/motion/Text.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionText } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionText } from '../chunk-OLOSU2BD.mjs';
|
|
2
|
+
import '../chunk-JENYDTXH.mjs';
|
|
3
|
+
import '../chunk-6FCATUMY.mjs';
|
|
4
|
+
import '../chunk-HEAWMZEM.mjs';
|
package/dist/motion/View.d.mts
CHANGED
package/dist/motion/View.d.ts
CHANGED
package/dist/motion/View.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkPLKXCJIB_js = require('../chunk-PLKXCJIB.js');
|
|
4
|
+
require('../chunk-2UGWAB6N.js');
|
|
5
|
+
require('../chunk-KXU6VH2Y.js');
|
|
6
|
+
require('../chunk-N33GSDNQ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionView", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkPLKXCJIB_js.MotionView; }
|
|
13
13
|
});
|
package/dist/motion/View.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionView } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionView } from '../chunk-QXKPIENP.mjs';
|
|
2
|
+
import '../chunk-JENYDTXH.mjs';
|
|
3
|
+
import '../chunk-6FCATUMY.mjs';
|
|
4
|
+
import '../chunk-HEAWMZEM.mjs';
|
package/dist/touch/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export { a as applyBounds } from '../applyBounds-BYGiHrYO.mjs';
|
|
1
2
|
import { PanResponderInstance } from 'react-native';
|
|
2
3
|
import { useAnimatedStyle, SharedValue } from 'react-native-reanimated';
|
|
3
|
-
import { T as TransitionConfig } from '../types-
|
|
4
|
+
import { T as TransitionConfig } from '../types-08mG8fNk.mjs';
|
|
4
5
|
import 'react';
|
|
5
6
|
|
|
6
7
|
/**
|
package/dist/touch/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export { a as applyBounds } from '../applyBounds-BYGiHrYO.js';
|
|
1
2
|
import { PanResponderInstance } from 'react-native';
|
|
2
3
|
import { useAnimatedStyle, SharedValue } from 'react-native-reanimated';
|
|
3
|
-
import { T as TransitionConfig } from '../types-
|
|
4
|
+
import { T as TransitionConfig } from '../types-08mG8fNk.js';
|
|
4
5
|
import 'react';
|
|
5
6
|
|
|
6
7
|
/**
|
package/dist/touch/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkKFHZMFAX_js = require('../chunk-KFHZMFAX.js');
|
|
4
|
+
var chunkN33GSDNQ_js = require('../chunk-N33GSDNQ.js');
|
|
4
5
|
var react = require('react');
|
|
5
6
|
var reactNative = require('react-native');
|
|
6
7
|
var reactNativeReanimated = require('react-native-reanimated');
|
|
@@ -19,22 +20,12 @@ function useTouchDrag(options = {}) {
|
|
|
19
20
|
const top = constraints?.top;
|
|
20
21
|
const bottom = constraints?.bottom;
|
|
21
22
|
const elasticCoef = elastic;
|
|
22
|
-
const
|
|
23
|
+
const callbacksRef = react.useRef(options);
|
|
24
|
+
callbacksRef.current = options;
|
|
23
25
|
const responder = react.useMemo(
|
|
24
26
|
() => buildResponder(),
|
|
25
27
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
[
|
|
27
|
-
lockX,
|
|
28
|
-
lockY,
|
|
29
|
-
left,
|
|
30
|
-
right,
|
|
31
|
-
top,
|
|
32
|
-
bottom,
|
|
33
|
-
elasticCoef,
|
|
34
|
-
onDragStart,
|
|
35
|
-
onDragEnd,
|
|
36
|
-
onRelease
|
|
37
|
-
]
|
|
28
|
+
[lockX, lockY, left, right, top, bottom, elasticCoef]
|
|
38
29
|
);
|
|
39
30
|
function buildResponder() {
|
|
40
31
|
const handleEnd = (g) => {
|
|
@@ -43,19 +34,20 @@ function useTouchDrag(options = {}) {
|
|
|
43
34
|
const y = dragY.value;
|
|
44
35
|
const vx = g.vx * 1e3;
|
|
45
36
|
const vy = g.vy * 1e3;
|
|
37
|
+
const { onRelease, onDragEnd } = callbacksRef.current;
|
|
46
38
|
if (onRelease) {
|
|
47
39
|
const result = onRelease({ x, y, velocity: { x: vx, y: vy } });
|
|
48
40
|
if (result) {
|
|
49
41
|
if (result.x && lockX) {
|
|
50
42
|
const toX = "to" in result.x ? result.x.to : x;
|
|
51
|
-
dragX.value =
|
|
43
|
+
dragX.value = chunkN33GSDNQ_js.buildReleaseAnimation(
|
|
52
44
|
result.x,
|
|
53
45
|
toX
|
|
54
46
|
);
|
|
55
47
|
}
|
|
56
48
|
if (result.y && lockY) {
|
|
57
49
|
const toY = "to" in result.y ? result.y.to : y;
|
|
58
|
-
dragY.value =
|
|
50
|
+
dragY.value = chunkN33GSDNQ_js.buildReleaseAnimation(
|
|
59
51
|
result.y,
|
|
60
52
|
toY
|
|
61
53
|
);
|
|
@@ -74,11 +66,11 @@ function useTouchDrag(options = {}) {
|
|
|
74
66
|
startX.value = dragX.value;
|
|
75
67
|
startY.value = dragY.value;
|
|
76
68
|
isDragging.value = true;
|
|
77
|
-
|
|
69
|
+
callbacksRef.current.onDragStart?.();
|
|
78
70
|
},
|
|
79
71
|
onPanResponderMove: (_e, g) => {
|
|
80
72
|
if (lockX) {
|
|
81
|
-
dragX.value = applyBounds(
|
|
73
|
+
dragX.value = chunkKFHZMFAX_js.applyBounds(
|
|
82
74
|
startX.value + g.dx,
|
|
83
75
|
left,
|
|
84
76
|
right,
|
|
@@ -86,7 +78,7 @@ function useTouchDrag(options = {}) {
|
|
|
86
78
|
);
|
|
87
79
|
}
|
|
88
80
|
if (lockY) {
|
|
89
|
-
dragY.value = applyBounds(
|
|
81
|
+
dragY.value = chunkKFHZMFAX_js.applyBounds(
|
|
90
82
|
startY.value + g.dy,
|
|
91
83
|
top,
|
|
92
84
|
bottom,
|
|
@@ -98,9 +90,7 @@ function useTouchDrag(options = {}) {
|
|
|
98
90
|
onPanResponderTerminate: (_e, g) => handleEnd(g)
|
|
99
91
|
});
|
|
100
92
|
}
|
|
101
|
-
const animatedStyle =
|
|
102
|
-
transform: [{ translateX: dragX.value }, { translateY: dragY.value }]
|
|
103
|
-
}));
|
|
93
|
+
const animatedStyle = chunkKFHZMFAX_js.useTranslateStyle(dragX, dragY);
|
|
104
94
|
return {
|
|
105
95
|
panHandlers: responder.panHandlers,
|
|
106
96
|
animatedStyle,
|
|
@@ -109,14 +99,9 @@ function useTouchDrag(options = {}) {
|
|
|
109
99
|
isDragging
|
|
110
100
|
};
|
|
111
101
|
}
|
|
112
|
-
function applyBounds(value, min, max, elastic) {
|
|
113
|
-
if (min !== void 0 && value < min) {
|
|
114
|
-
return elastic > 0 ? min + (value - min) * elastic : min;
|
|
115
|
-
}
|
|
116
|
-
if (max !== void 0 && value > max) {
|
|
117
|
-
return elastic > 0 ? max + (value - max) * elastic : max;
|
|
118
|
-
}
|
|
119
|
-
return value;
|
|
120
|
-
}
|
|
121
102
|
|
|
103
|
+
Object.defineProperty(exports, "applyBounds", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () { return chunkKFHZMFAX_js.applyBounds; }
|
|
106
|
+
});
|
|
122
107
|
exports.useTouchDrag = useTouchDrag;
|