@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.
Files changed (100) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/README.md +7 -7
  3. package/dist/applyBounds-BYGiHrYO.d.mts +18 -0
  4. package/dist/applyBounds-BYGiHrYO.d.ts +18 -0
  5. package/dist/{chunk-E3ALFSH2.js → chunk-2UGWAB6N.js} +78 -70
  6. package/dist/{chunk-ZBHQPVWE.js → chunk-3ZNHPT5Z.js} +2 -2
  7. package/dist/{chunk-IHVMNOS4.js → chunk-46766TBM.js} +2 -2
  8. package/dist/{chunk-MUT6BTZS.js → chunk-4EZ5DBL3.js} +10 -7
  9. package/dist/{chunk-MFAFB4K7.mjs → chunk-6FCATUMY.mjs} +8 -10
  10. package/dist/{chunk-6YIUETBF.mjs → chunk-7BH3CAO5.mjs} +1 -1
  11. package/dist/{chunk-JBK5ZLMH.mjs → chunk-CUHOCONB.mjs} +1 -1
  12. package/dist/{chunk-M4766VUV.mjs → chunk-DRA2K53O.mjs} +1 -1
  13. package/dist/{chunk-L4JFECXU.mjs → chunk-F4HMCXAX.mjs} +6 -3
  14. package/dist/{chunk-W7NTRSPD.mjs → chunk-HEAWMZEM.mjs} +105 -66
  15. package/dist/{chunk-IX6SEOSK.mjs → chunk-JENYDTXH.mjs} +52 -44
  16. package/dist/chunk-KFHZMFAX.js +23 -0
  17. package/dist/{chunk-6AN5X3YE.js → chunk-KXU6VH2Y.js} +10 -11
  18. package/dist/{chunk-WNVHPMBI.js → chunk-N33GSDNQ.js} +106 -65
  19. package/dist/chunk-OH46TGEA.mjs +20 -0
  20. package/dist/{chunk-QNLSCOR5.mjs → chunk-OLOSU2BD.mjs} +1 -1
  21. package/dist/chunk-PLKXCJIB.js +8 -0
  22. package/dist/{chunk-GSUC4HWP.mjs → chunk-QXKPIENP.mjs} +1 -1
  23. package/dist/chunk-UBHQJFUW.js +8 -0
  24. package/dist/{chunk-6NOCY764.js → chunk-VKXSL3ZL.js} +2 -2
  25. package/dist/chunk-XKNEQDAT.js +8 -0
  26. package/dist/{chunk-EN4PN7X3.mjs → chunk-Z23AMUSW.mjs} +1 -1
  27. package/dist/gestureLayer/index.d.mts +3 -3
  28. package/dist/gestureLayer/index.d.ts +3 -3
  29. package/dist/gestureLayer/index.js +12 -18
  30. package/dist/gestureLayer/index.mjs +5 -11
  31. package/dist/index.d.mts +87 -45
  32. package/dist/index.d.ts +87 -45
  33. package/dist/index.js +114 -91
  34. package/dist/index.mjs +66 -59
  35. package/dist/motion/FlatList.d.mts +1 -1
  36. package/dist/motion/FlatList.d.ts +1 -1
  37. package/dist/motion/FlatList.js +5 -5
  38. package/dist/motion/FlatList.mjs +4 -4
  39. package/dist/motion/Image.d.mts +1 -1
  40. package/dist/motion/Image.d.ts +1 -1
  41. package/dist/motion/Image.js +5 -5
  42. package/dist/motion/Image.mjs +4 -4
  43. package/dist/motion/Pressable.d.mts +1 -1
  44. package/dist/motion/Pressable.d.ts +1 -1
  45. package/dist/motion/Pressable.js +5 -5
  46. package/dist/motion/Pressable.mjs +4 -4
  47. package/dist/motion/ScrollView.d.mts +1 -1
  48. package/dist/motion/ScrollView.d.ts +1 -1
  49. package/dist/motion/ScrollView.js +5 -5
  50. package/dist/motion/ScrollView.mjs +4 -4
  51. package/dist/motion/Text.d.mts +1 -1
  52. package/dist/motion/Text.d.ts +1 -1
  53. package/dist/motion/Text.js +5 -5
  54. package/dist/motion/Text.mjs +4 -4
  55. package/dist/motion/View.d.mts +1 -1
  56. package/dist/motion/View.d.ts +1 -1
  57. package/dist/motion/View.js +5 -5
  58. package/dist/motion/View.mjs +4 -4
  59. package/dist/touch/index.d.mts +2 -1
  60. package/dist/touch/index.d.ts +2 -1
  61. package/dist/touch/index.js +16 -31
  62. package/dist/touch/index.mjs +11 -29
  63. package/dist/{types-DyJpG64F.d.mts → types-08mG8fNk.d.mts} +10 -3
  64. package/dist/{types-DyJpG64F.d.ts → types-08mG8fNk.d.ts} +10 -3
  65. package/dist/{useGesture-DbH46EBp.d.ts → useGesture-D1lHeQQ6.d.ts} +1 -1
  66. package/dist/{useGesture-CnZQnYHH.d.mts → useGesture-DjszaHWz.d.mts} +1 -1
  67. package/package.json +4 -2
  68. package/src/config/namedTransitions.ts +7 -9
  69. package/src/gestureLayer/index.ts +3 -0
  70. package/src/gestureLayer/useGestureLayer.ts +6 -9
  71. package/src/gestures/focusVisibility.ts +19 -17
  72. package/src/gestures/index.ts +1 -1
  73. package/src/index.ts +9 -0
  74. package/src/layout/resolveLayout.ts +4 -1
  75. package/src/layout/useSharedLayout.ts +2 -1
  76. package/src/motion/createMotionComponent.tsx +92 -44
  77. package/src/presence/Presence.tsx +5 -7
  78. package/src/touch/applyBounds.ts +30 -0
  79. package/src/touch/index.ts +1 -0
  80. package/src/touch/useTouchDrag.ts +15 -45
  81. package/src/transitions/constants.ts +14 -0
  82. package/src/transitions/easing.ts +23 -11
  83. package/src/transitions/index.ts +5 -0
  84. package/src/transitions/keys.ts +0 -2
  85. package/src/transitions/resolve.ts +86 -11
  86. package/src/transitions/resolveSequence.ts +3 -1
  87. package/src/transitions/runtime.ts +4 -7
  88. package/src/transitions/spring.ts +7 -2
  89. package/src/types.ts +9 -2
  90. package/src/values/extrapolation.ts +21 -0
  91. package/src/values/index.ts +1 -0
  92. package/src/values/useGesture.ts +9 -2
  93. package/src/values/useInterpolatedStyle.ts +5 -12
  94. package/src/values/useShadow.ts +18 -7
  95. package/src/values/useSpring.ts +34 -25
  96. package/src/values/useTransform.ts +24 -20
  97. package/src/values/useTranslateStyle.ts +31 -0
  98. package/dist/chunk-24NUL23E.js +0 -8
  99. package/dist/chunk-4XBX7KOD.js +0 -8
  100. package/dist/chunk-Z5USXWTE.js +0 -8
package/dist/index.mjs CHANGED
@@ -1,24 +1,25 @@
1
- export { useGesture } from './chunk-L4JFECXU.mjs';
2
- import { MotionView } from './chunk-GSUC4HWP.mjs';
3
- export { MotionView } from './chunk-GSUC4HWP.mjs';
4
- import { MotionText } from './chunk-QNLSCOR5.mjs';
5
- export { MotionText } from './chunk-QNLSCOR5.mjs';
6
- import { MotionImage } from './chunk-6YIUETBF.mjs';
7
- export { MotionImage } from './chunk-6YIUETBF.mjs';
8
- import { MotionPressable } from './chunk-JBK5ZLMH.mjs';
9
- export { MotionPressable } from './chunk-JBK5ZLMH.mjs';
10
- import { MotionScrollView } from './chunk-M4766VUV.mjs';
11
- export { MotionScrollView } from './chunk-M4766VUV.mjs';
12
- import { MotionFlatList } from './chunk-EN4PN7X3.mjs';
13
- export { MotionFlatList } from './chunk-EN4PN7X3.mjs';
14
- import { pairBoxShadowLayers, resolveBoxShadowInput } from './chunk-IX6SEOSK.mjs';
15
- export { Presence, Stagger, TRANSPARENT, createMotionComponent, usePresence, useStaggerDelay } from './chunk-IX6SEOSK.mjs';
16
- import { useShouldReduceMotion, resolveNamedTransition, useNamedTransitions, lookupNamedTransition } from './chunk-MFAFB4K7.mjs';
17
- export { MotionConfig, resolveNamedTransition, useMotionConfig, useNamedTransitions, useShouldReduceMotion } from './chunk-MFAFB4K7.mjs';
18
- import { stableSig, resolveTransition, springToReanimated, warnNonWorkletOnce } from './chunk-W7NTRSPD.mjs';
19
- export { applyDelay, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveTransition } from './chunk-W7NTRSPD.mjs';
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, Extrapolation, useAnimatedScrollHandler } from 'react-native-reanimated';
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 (!isSharedTarget) return null;
92
- return target.value;
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
- [isSharedTarget, reanimConfig]
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
- if (__DEV__) {
114
- console.warn(
115
- `[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.`
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 (__DEV__ && explicitInput && explicitInput.length !== output.length) {
217
- console.warn(
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 = inputRange;
324
- const output = outputRange;
330
+ const input = ranges.input;
331
+ const output = ranges.output;
325
332
  const isColor = output.length > 0 && typeof output[0] === "string";
326
- const extrapolateLeft = mapExtrapolation2(options?.extrapolateLeft);
327
- const extrapolateRight = mapExtrapolation2(options?.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 boxShadowPairs = from.boxShadow !== void 0 || to.boxShadow !== void 0 ? pairBoxShadowLayers(
379
- resolveBoxShadowInput(from.boxShadow),
380
- resolveBoxShadowInput(to.boxShadow)
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;
@@ -1,5 +1,5 @@
1
1
  import { FlatListProps, FlatList } from 'react-native';
2
- import { V as VariantsMap, a as MotionProps } from '../types-DyJpG64F.mjs';
2
+ import { V as VariantsMap, a as MotionProps } from '../types-08mG8fNk.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { FlatListProps, FlatList } from 'react-native';
2
- import { V as VariantsMap, a as MotionProps } from '../types-DyJpG64F.js';
2
+ import { V as VariantsMap, a as MotionProps } from '../types-08mG8fNk.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkIHVMNOS4_js = require('../chunk-IHVMNOS4.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
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 chunkIHVMNOS4_js.MotionFlatList; }
12
+ get: function () { return chunk46766TBM_js.MotionFlatList; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionFlatList } from '../chunk-EN4PN7X3.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionFlatList } from '../chunk-Z23AMUSW.mjs';
2
+ import '../chunk-JENYDTXH.mjs';
3
+ import '../chunk-6FCATUMY.mjs';
4
+ import '../chunk-HEAWMZEM.mjs';
@@ -1,5 +1,5 @@
1
1
  import { Image } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.mjs';
2
+ import { M as MotionComponent } from '../types-08mG8fNk.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Image } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.js';
2
+ import { M as MotionComponent } from '../types-08mG8fNk.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkZ5USXWTE_js = require('../chunk-Z5USXWTE.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
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 chunkZ5USXWTE_js.MotionImage; }
12
+ get: function () { return chunkXKNEQDAT_js.MotionImage; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionImage } from '../chunk-6YIUETBF.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
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-DyJpG64F.mjs';
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-DyJpG64F.js';
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
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunk6NOCY764_js = require('../chunk-6NOCY764.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
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 chunk6NOCY764_js.MotionPressable; }
12
+ get: function () { return chunkVKXSL3ZL_js.MotionPressable; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionPressable } from '../chunk-JBK5ZLMH.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionPressable } from '../chunk-CUHOCONB.mjs';
2
+ import '../chunk-JENYDTXH.mjs';
3
+ import '../chunk-6FCATUMY.mjs';
4
+ import '../chunk-HEAWMZEM.mjs';
@@ -1,5 +1,5 @@
1
1
  import { ScrollView } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.mjs';
2
+ import { M as MotionComponent } from '../types-08mG8fNk.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { ScrollView } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.js';
2
+ import { M as MotionComponent } from '../types-08mG8fNk.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkZBHQPVWE_js = require('../chunk-ZBHQPVWE.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
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 chunkZBHQPVWE_js.MotionScrollView; }
12
+ get: function () { return chunk3ZNHPT5Z_js.MotionScrollView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionScrollView } from '../chunk-M4766VUV.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionScrollView } from '../chunk-DRA2K53O.mjs';
2
+ import '../chunk-JENYDTXH.mjs';
3
+ import '../chunk-6FCATUMY.mjs';
4
+ import '../chunk-HEAWMZEM.mjs';
@@ -1,5 +1,5 @@
1
1
  import { Text } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.mjs';
2
+ import { M as MotionComponent } from '../types-08mG8fNk.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Text } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.js';
2
+ import { M as MotionComponent } from '../types-08mG8fNk.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunk4XBX7KOD_js = require('../chunk-4XBX7KOD.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
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 chunk4XBX7KOD_js.MotionText; }
12
+ get: function () { return chunkUBHQJFUW_js.MotionText; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionText } from '../chunk-QNLSCOR5.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionText } from '../chunk-OLOSU2BD.mjs';
2
+ import '../chunk-JENYDTXH.mjs';
3
+ import '../chunk-6FCATUMY.mjs';
4
+ import '../chunk-HEAWMZEM.mjs';
@@ -1,5 +1,5 @@
1
1
  import { View } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.mjs';
2
+ import { M as MotionComponent } from '../types-08mG8fNk.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { View } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.js';
2
+ import { M as MotionComponent } from '../types-08mG8fNk.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunk24NUL23E_js = require('../chunk-24NUL23E.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
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 chunk24NUL23E_js.MotionView; }
12
+ get: function () { return chunkPLKXCJIB_js.MotionView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionView } from '../chunk-GSUC4HWP.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionView } from '../chunk-QXKPIENP.mjs';
2
+ import '../chunk-JENYDTXH.mjs';
3
+ import '../chunk-6FCATUMY.mjs';
4
+ import '../chunk-HEAWMZEM.mjs';
@@ -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-DyJpG64F.mjs';
4
+ import { T as TransitionConfig } from '../types-08mG8fNk.mjs';
4
5
  import 'react';
5
6
 
6
7
  /**
@@ -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-DyJpG64F.js';
4
+ import { T as TransitionConfig } from '../types-08mG8fNk.js';
4
5
  import 'react';
5
6
 
6
7
  /**
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkWNVHPMBI_js = require('../chunk-WNVHPMBI.js');
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 { onDragStart, onDragEnd, onRelease } = options;
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 = chunkWNVHPMBI_js.buildReleaseAnimation(
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 = chunkWNVHPMBI_js.buildReleaseAnimation(
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
- if (onDragStart) onDragStart();
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 = reactNativeReanimated.useAnimatedStyle(() => ({
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;