@rootnative/inertia 0.0.9 → 0.0.11

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 (105) hide show
  1. package/CHANGELOG.md +95 -1
  2. package/README.md +8 -8
  3. package/dist/{chunk-MFAFB4K7.mjs → chunk-2Q6JMDYZ.mjs} +8 -10
  4. package/dist/chunk-2UREDR4Z.js +8 -0
  5. package/dist/{chunk-ZBHQPVWE.js → chunk-3PB27UIE.js} +2 -2
  6. package/dist/{chunk-IX6SEOSK.mjs → chunk-5EYIZG72.mjs} +60 -45
  7. package/dist/{chunk-EN4PN7X3.mjs → chunk-7RMSLKQQ.mjs} +1 -1
  8. package/dist/{chunk-6YIUETBF.mjs → chunk-DT2KVAAO.mjs} +1 -1
  9. package/dist/{chunk-L4JFECXU.mjs → chunk-FKJLPYGY.mjs} +6 -3
  10. package/dist/{chunk-E3ALFSH2.js → chunk-HBURWGCZ.js} +86 -71
  11. package/dist/chunk-JAJHKJC5.js +8 -0
  12. package/dist/chunk-JBMTTICC.js +8 -0
  13. package/dist/{chunk-GSUC4HWP.mjs → chunk-JGQ6YRDN.mjs} +1 -1
  14. package/dist/chunk-KFHZMFAX.js +23 -0
  15. package/dist/{chunk-M4766VUV.mjs → chunk-LHW4VNWD.mjs} +1 -1
  16. package/dist/{chunk-MUT6BTZS.js → chunk-NTG6PSGZ.js} +10 -7
  17. package/dist/chunk-OH46TGEA.mjs +20 -0
  18. package/dist/{chunk-6AN5X3YE.js → chunk-QDMSFRQR.js} +10 -11
  19. package/dist/{chunk-W7NTRSPD.mjs → chunk-QIRKPDXA.mjs} +118 -68
  20. package/dist/{chunk-WNVHPMBI.js → chunk-QX5JHRZ2.js} +118 -66
  21. package/dist/{chunk-6NOCY764.js → chunk-R7YD6L3D.js} +2 -2
  22. package/dist/{chunk-JBK5ZLMH.mjs → chunk-RO4XFTQ6.mjs} +1 -1
  23. package/dist/{chunk-QNLSCOR5.mjs → chunk-UGYBFAVY.mjs} +1 -1
  24. package/dist/{chunk-IHVMNOS4.js → chunk-XLKI2MSD.js} +2 -2
  25. package/dist/gestureLayer/index.d.mts +3 -3
  26. package/dist/gestureLayer/index.d.ts +3 -3
  27. package/dist/gestureLayer/index.js +12 -18
  28. package/dist/gestureLayer/index.mjs +5 -11
  29. package/dist/index.d.mts +108 -49
  30. package/dist/index.d.ts +108 -49
  31. package/dist/index.js +114 -91
  32. package/dist/index.mjs +66 -59
  33. package/dist/motion/FlatList.d.mts +2 -1
  34. package/dist/motion/FlatList.d.ts +2 -1
  35. package/dist/motion/FlatList.js +5 -5
  36. package/dist/motion/FlatList.mjs +4 -4
  37. package/dist/motion/Image.d.mts +2 -1
  38. package/dist/motion/Image.d.ts +2 -1
  39. package/dist/motion/Image.js +5 -5
  40. package/dist/motion/Image.mjs +4 -4
  41. package/dist/motion/Pressable.d.mts +2 -1
  42. package/dist/motion/Pressable.d.ts +2 -1
  43. package/dist/motion/Pressable.js +5 -5
  44. package/dist/motion/Pressable.mjs +4 -4
  45. package/dist/motion/ScrollView.d.mts +2 -1
  46. package/dist/motion/ScrollView.d.ts +2 -1
  47. package/dist/motion/ScrollView.js +5 -5
  48. package/dist/motion/ScrollView.mjs +4 -4
  49. package/dist/motion/Text.d.mts +2 -1
  50. package/dist/motion/Text.d.ts +2 -1
  51. package/dist/motion/Text.js +5 -5
  52. package/dist/motion/Text.mjs +4 -4
  53. package/dist/motion/View.d.mts +2 -1
  54. package/dist/motion/View.d.ts +2 -1
  55. package/dist/motion/View.js +5 -5
  56. package/dist/motion/View.mjs +4 -4
  57. package/dist/touch/index.d.mts +5 -3
  58. package/dist/touch/index.d.ts +5 -3
  59. package/dist/touch/index.js +16 -31
  60. package/dist/touch/index.mjs +11 -29
  61. package/dist/{types-DyJpG64F.d.mts → types-C5Zbs9MC.d.mts} +22 -4
  62. package/dist/{types-DyJpG64F.d.ts → types-C5Zbs9MC.d.ts} +22 -4
  63. package/dist/{useGesture-DbH46EBp.d.ts → useGesture-Be0ZhCWj.d.ts} +1 -1
  64. package/dist/{useGesture-CnZQnYHH.d.mts → useGesture-Ve8EGjTr.d.mts} +1 -1
  65. package/dist/useTranslateStyle-BDrOD97O.d.mts +58 -0
  66. package/dist/useTranslateStyle-BDrOD97O.d.ts +58 -0
  67. package/jest-preset.js +31 -2
  68. package/llms.txt +2 -1
  69. package/package.json +15 -12
  70. package/src/config/namedTransitions.ts +7 -9
  71. package/src/gestureLayer/index.ts +3 -0
  72. package/src/gestureLayer/useGestureLayer.ts +6 -9
  73. package/src/gestures/focusVisibility.ts +19 -17
  74. package/src/gestures/index.ts +1 -1
  75. package/src/index.ts +12 -0
  76. package/src/internal/boxShadow.ts +24 -2
  77. package/src/layout/resolveLayout.ts +4 -1
  78. package/src/layout/useSharedLayout.ts +2 -1
  79. package/src/motion/createMotionComponent.tsx +92 -44
  80. package/src/presence/Presence.tsx +5 -7
  81. package/src/touch/applyBounds.ts +30 -0
  82. package/src/touch/index.ts +1 -0
  83. package/src/touch/useTouchDrag.ts +18 -46
  84. package/src/transitions/constants.ts +14 -0
  85. package/src/transitions/easing.ts +23 -11
  86. package/src/transitions/index.ts +5 -0
  87. package/src/transitions/keys.ts +0 -2
  88. package/src/transitions/resolve.ts +86 -11
  89. package/src/transitions/resolveSequence.ts +45 -3
  90. package/src/transitions/runtime.ts +4 -7
  91. package/src/transitions/spring.ts +7 -2
  92. package/src/types.ts +23 -3
  93. package/src/values/extrapolation.ts +21 -0
  94. package/src/values/index.ts +3 -0
  95. package/src/values/useColorCascade.ts +3 -3
  96. package/src/values/useColorTransition.ts +17 -2
  97. package/src/values/useGesture.ts +9 -2
  98. package/src/values/useInterpolatedStyle.ts +13 -13
  99. package/src/values/useShadow.ts +36 -9
  100. package/src/values/useSpring.ts +34 -25
  101. package/src/values/useTransform.ts +24 -20
  102. package/src/values/useTranslateStyle.ts +47 -0
  103. package/dist/chunk-24NUL23E.js +0 -8
  104. package/dist/chunk-4XBX7KOD.js +0 -8
  105. package/dist/chunk-Z5USXWTE.js +0 -8
@@ -1,7 +1,48 @@
1
1
  import { isWorkletFunction } from 'react-native-worklets';
2
- import { withDelay, withSequence, Easing, withDecay, withTiming, withSpring, withRepeat } from 'react-native-reanimated';
2
+ import { withDelay, withSequence, withTiming, Easing, withDecay, withSpring, withRepeat } from 'react-native-reanimated';
3
3
 
4
- // src/transitions/easing.ts
4
+ // src/transitions/sig.ts
5
+ function stableSig(value) {
6
+ if (value === void 0) return "";
7
+ try {
8
+ return stableStringify(value);
9
+ } catch {
10
+ return String(value);
11
+ }
12
+ }
13
+ function stableStringify(v) {
14
+ if (v === null || typeof v !== "object") {
15
+ if (typeof v === "function" || v === void 0) return "null";
16
+ return JSON.stringify(v);
17
+ }
18
+ if (Array.isArray(v)) {
19
+ return "[" + v.map(stableStringify).join(",") + "]";
20
+ }
21
+ const obj = v;
22
+ const keys = Object.keys(obj).sort();
23
+ return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
24
+ }
25
+
26
+ // src/transitions/keys.ts
27
+ var TRANSITION_CONFIG_KEYS = /* @__PURE__ */ new Set([
28
+ "type",
29
+ "tension",
30
+ "friction",
31
+ "mass",
32
+ "velocity",
33
+ "duration",
34
+ "easing",
35
+ "delay",
36
+ "repeat",
37
+ "deceleration",
38
+ "clamp"
39
+ ]);
40
+ function isTopLevelTransition(t) {
41
+ if (t === null || typeof t !== "object") return false;
42
+ const keys = Object.keys(t);
43
+ if (keys.length === 0) return false;
44
+ return keys.every((k) => TRANSITION_CONFIG_KEYS.has(k));
45
+ }
5
46
 
6
47
  // src/internal/warnOnce.ts
7
48
  var warned = /* @__PURE__ */ new Set();
@@ -22,7 +63,7 @@ function warnNonWorkletOnce(key, message) {
22
63
  // src/transitions/easing.ts
23
64
  function ensureWorkletEasing(easing) {
24
65
  if (!easing) return void 0;
25
- const fn = isEasingFactory(easing) ? easing.factory() : easing;
66
+ const fn = unwrapEasingFactory(easing);
26
67
  if (isWorkletFunction(fn)) return fn;
27
68
  warnNonWorkletOnce(
28
69
  "timing-easing",
@@ -34,10 +75,18 @@ function ensureWorkletEasing(easing) {
34
75
  };
35
76
  return wrapped;
36
77
  }
37
- function isEasingFactory(value) {
38
- return typeof value === "object" && value !== null && "factory" in value && typeof value.factory === "function";
78
+ function unwrapEasingFactory(easing) {
79
+ "worklet";
80
+ if (typeof easing === "object" && easing !== null && "factory" in easing && typeof easing.factory === "function") {
81
+ return easing.factory();
82
+ }
83
+ return easing;
39
84
  }
40
85
 
86
+ // src/transitions/constants.ts
87
+ var DEFAULT_TIMING_DURATION = 250;
88
+ var DEFAULT_LAYOUT_DURATION = 300;
89
+
41
90
  // src/transitions/spring.ts
42
91
  var DEFAULT_SPRING = {
43
92
  tension: 170,
@@ -50,14 +99,11 @@ function springToReanimated(t) {
50
99
  stiffness: t.tension ?? DEFAULT_SPRING.tension,
51
100
  damping: t.friction ?? DEFAULT_SPRING.friction,
52
101
  mass: t.mass ?? DEFAULT_SPRING.mass,
53
- velocity: t.velocity,
54
- restSpeedThreshold: t.restSpeedThreshold,
55
- restDisplacementThreshold: t.restDisplacementThreshold
102
+ velocity: t.velocity
56
103
  };
57
104
  }
58
105
 
59
106
  // src/transitions/resolve.ts
60
- var DEFAULT_TIMING_DURATION = 250;
61
107
  function buildSpring(cfg, toValue, cb) {
62
108
  return withSpring(toValue, springToReanimated(cfg), cb);
63
109
  }
@@ -90,17 +136,54 @@ function buildOne(cfg, toValue, cb) {
90
136
  if (cfg.type === "timing") return buildTiming(cfg, toValue, cb);
91
137
  return buildSpring(cfg, toValue, cb);
92
138
  }
93
- function applyRepeat(animation, repeat) {
94
- if (repeat === void 0) return animation;
139
+ function normalizeRepeat(repeat) {
140
+ if (repeat === void 0) return void 0;
95
141
  if (repeat === "infinite") {
96
- return withRepeat(animation, -1, true);
142
+ return {
143
+ count: Number.POSITIVE_INFINITY,
144
+ alternate: true,
145
+ explicitAlternate: false
146
+ };
147
+ }
148
+ const rawCount = typeof repeat === "number" ? repeat : repeat.count;
149
+ const alternate = typeof repeat === "number" ? true : repeat.alternate;
150
+ if (rawCount === "infinite") {
151
+ return {
152
+ count: Number.POSITIVE_INFINITY,
153
+ alternate: alternate ?? true,
154
+ explicitAlternate: alternate !== void 0
155
+ };
97
156
  }
98
- if (typeof repeat === "number") {
99
- return withRepeat(animation, repeat, true);
157
+ if (!(rawCount >= 1)) {
158
+ warnOnce(
159
+ `repeat-count:${String(rawCount)}`,
160
+ `[inertia] repeat count ${String(rawCount)} is below 1 \u2014 the animation runs once. Use \`repeat: 2\` or more to repeat, or \`repeat: 'infinite'\`. (Reanimated reads a count of 0 as endless, so it is not forwarded.)`
161
+ );
162
+ return void 0;
100
163
  }
101
- const count = repeat.count === "infinite" ? -1 : repeat.count;
102
- const alternate = repeat.alternate ?? true;
103
- return withRepeat(animation, count, alternate);
164
+ return {
165
+ count: rawCount,
166
+ alternate: alternate ?? true,
167
+ explicitAlternate: alternate !== void 0
168
+ };
169
+ }
170
+ function repeatIterationsOf(repeat) {
171
+ return normalizeRepeat(repeat)?.count ?? 1;
172
+ }
173
+ function applyRepeat(animation, repeat, options) {
174
+ const r = normalizeRepeat(repeat);
175
+ if (r === void 0) return animation;
176
+ const count = Number.isFinite(r.count) ? r.count : -1;
177
+ if (options?.sequence) {
178
+ if (r.explicitAlternate && r.alternate) {
179
+ warnOnce(
180
+ "repeat-sequence-alternate",
181
+ "[inertia] repeat.alternate has no effect on a sequence \u2014 Reanimated restarts a sequence at its first step on every pass. Append the reverse steps to the sequence to alternate."
182
+ );
183
+ }
184
+ return withRepeat(animation, count, false);
185
+ }
186
+ return withRepeat(animation, count, r.alternate);
104
187
  }
105
188
  function applyDelay(animation, delay) {
106
189
  if (!delay || delay <= 0) return animation;
@@ -128,6 +211,10 @@ function delayOf(cfg) {
128
211
  if (cfg.type === "no-animation") return void 0;
129
212
  return cfg.delay;
130
213
  }
214
+ var INSTANT = { duration: 0 };
215
+ function isSnapped(step) {
216
+ return typeof step === "number" || typeof step === "string";
217
+ }
131
218
  function isStepObject(v) {
132
219
  return typeof v === "object" && v !== null && !Array.isArray(v) && "to" in v;
133
220
  }
@@ -138,8 +225,17 @@ function resolveAnimatableValue(value, base, factory) {
138
225
  const animations = steps.map(
139
226
  (step2, i) => resolveStep(step2, stepBase, factory?.("step", i))
140
227
  );
141
- const seq = withSequence(...animations);
142
- return applyRepeat(seq, base ? repeatOf(base) : void 0);
228
+ if (stepBase?.type === "no-animation" && animations.length > 0) {
229
+ return animations[animations.length - 1];
230
+ }
231
+ const seq = withSequence(
232
+ ...animations.map(
233
+ (a) => isSnapped(a) ? withTiming(a, INSTANT) : a
234
+ )
235
+ );
236
+ return applyRepeat(seq, base ? repeatOf(base) : void 0, {
237
+ sequence: true
238
+ });
143
239
  }
144
240
  const step = value;
145
241
  const cb = factory?.("animation", void 0);
@@ -209,7 +305,6 @@ function bezier(x1, y1, x2, y2, source) {
209
305
  }
210
306
  return Easing.bezier(x1, y1, x2, y2);
211
307
  }
212
- var DEFAULT_TIMING_DURATION2 = 250;
213
308
  function buildReleaseAnimation(transition, toValue, callback) {
214
309
  "worklet";
215
310
  if (transition.type === "no-animation") {
@@ -226,11 +321,11 @@ function buildReleaseAnimation(transition, toValue, callback) {
226
321
  }
227
322
  if (transition.type === "timing") {
228
323
  const e = transition.easing;
229
- const easingFn = e && typeof e === "object" && "factory" in e ? e.factory() : e ?? Easing.inOut(Easing.ease);
324
+ const easingFn = e ? unwrapEasingFactory(e) : Easing.inOut(Easing.ease);
230
325
  return withTiming(
231
326
  toValue,
232
327
  {
233
- duration: transition.duration ?? DEFAULT_TIMING_DURATION2,
328
+ duration: transition.duration ?? DEFAULT_TIMING_DURATION,
234
329
  easing: easingFn
235
330
  },
236
331
  callback
@@ -239,49 +334,4 @@ function buildReleaseAnimation(transition, toValue, callback) {
239
334
  return withSpring(toValue, springToReanimated(transition), callback);
240
335
  }
241
336
 
242
- // src/transitions/keys.ts
243
- var TRANSITION_CONFIG_KEYS = /* @__PURE__ */ new Set([
244
- "type",
245
- "tension",
246
- "friction",
247
- "mass",
248
- "velocity",
249
- "restSpeedThreshold",
250
- "restDisplacementThreshold",
251
- "duration",
252
- "easing",
253
- "delay",
254
- "repeat",
255
- "deceleration",
256
- "clamp"
257
- ]);
258
- function isTopLevelTransition(t) {
259
- if (t === null || typeof t !== "object") return false;
260
- const keys = Object.keys(t);
261
- if (keys.length === 0) return false;
262
- return keys.every((k) => TRANSITION_CONFIG_KEYS.has(k));
263
- }
264
-
265
- // src/transitions/sig.ts
266
- function stableSig(value) {
267
- if (value === void 0) return "";
268
- try {
269
- return stableStringify(value);
270
- } catch {
271
- return String(value);
272
- }
273
- }
274
- function stableStringify(v) {
275
- if (v === null || typeof v !== "object") {
276
- if (typeof v === "function" || v === void 0) return "null";
277
- return JSON.stringify(v);
278
- }
279
- if (Array.isArray(v)) {
280
- return "[" + v.map(stableStringify).join(",") + "]";
281
- }
282
- const obj = v;
283
- const keys = Object.keys(obj).sort();
284
- return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
285
- }
286
-
287
- export { DEFAULT_SPRING, applyDelay, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, isTopLevelTransition, resolveAnimatableValue, resolveTransition, springToReanimated, stableSig, warnNonWorkletOnce, warnOnce };
337
+ export { DEFAULT_LAYOUT_DURATION, DEFAULT_SPRING, applyDelay, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, isTopLevelTransition, repeatIterationsOf, resolveAnimatableValue, resolveTransition, springToReanimated, stableSig, warnNonWorkletOnce, warnOnce };
@@ -3,7 +3,48 @@
3
3
  var reactNativeWorklets = require('react-native-worklets');
4
4
  var reactNativeReanimated = require('react-native-reanimated');
5
5
 
6
- // src/transitions/easing.ts
6
+ // src/transitions/sig.ts
7
+ function stableSig(value) {
8
+ if (value === void 0) return "";
9
+ try {
10
+ return stableStringify(value);
11
+ } catch {
12
+ return String(value);
13
+ }
14
+ }
15
+ function stableStringify(v) {
16
+ if (v === null || typeof v !== "object") {
17
+ if (typeof v === "function" || v === void 0) return "null";
18
+ return JSON.stringify(v);
19
+ }
20
+ if (Array.isArray(v)) {
21
+ return "[" + v.map(stableStringify).join(",") + "]";
22
+ }
23
+ const obj = v;
24
+ const keys = Object.keys(obj).sort();
25
+ return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
26
+ }
27
+
28
+ // src/transitions/keys.ts
29
+ var TRANSITION_CONFIG_KEYS = /* @__PURE__ */ new Set([
30
+ "type",
31
+ "tension",
32
+ "friction",
33
+ "mass",
34
+ "velocity",
35
+ "duration",
36
+ "easing",
37
+ "delay",
38
+ "repeat",
39
+ "deceleration",
40
+ "clamp"
41
+ ]);
42
+ function isTopLevelTransition(t) {
43
+ if (t === null || typeof t !== "object") return false;
44
+ const keys = Object.keys(t);
45
+ if (keys.length === 0) return false;
46
+ return keys.every((k) => TRANSITION_CONFIG_KEYS.has(k));
47
+ }
7
48
 
8
49
  // src/internal/warnOnce.ts
9
50
  var warned = /* @__PURE__ */ new Set();
@@ -24,7 +65,7 @@ function warnNonWorkletOnce(key, message) {
24
65
  // src/transitions/easing.ts
25
66
  function ensureWorkletEasing(easing) {
26
67
  if (!easing) return void 0;
27
- const fn = isEasingFactory(easing) ? easing.factory() : easing;
68
+ const fn = unwrapEasingFactory(easing);
28
69
  if (reactNativeWorklets.isWorkletFunction(fn)) return fn;
29
70
  warnNonWorkletOnce(
30
71
  "timing-easing",
@@ -36,10 +77,18 @@ function ensureWorkletEasing(easing) {
36
77
  };
37
78
  return wrapped;
38
79
  }
39
- function isEasingFactory(value) {
40
- return typeof value === "object" && value !== null && "factory" in value && typeof value.factory === "function";
80
+ function unwrapEasingFactory(easing) {
81
+ "worklet";
82
+ if (typeof easing === "object" && easing !== null && "factory" in easing && typeof easing.factory === "function") {
83
+ return easing.factory();
84
+ }
85
+ return easing;
41
86
  }
42
87
 
88
+ // src/transitions/constants.ts
89
+ var DEFAULT_TIMING_DURATION = 250;
90
+ var DEFAULT_LAYOUT_DURATION = 300;
91
+
43
92
  // src/transitions/spring.ts
44
93
  var DEFAULT_SPRING = {
45
94
  tension: 170,
@@ -52,14 +101,11 @@ function springToReanimated(t) {
52
101
  stiffness: t.tension ?? DEFAULT_SPRING.tension,
53
102
  damping: t.friction ?? DEFAULT_SPRING.friction,
54
103
  mass: t.mass ?? DEFAULT_SPRING.mass,
55
- velocity: t.velocity,
56
- restSpeedThreshold: t.restSpeedThreshold,
57
- restDisplacementThreshold: t.restDisplacementThreshold
104
+ velocity: t.velocity
58
105
  };
59
106
  }
60
107
 
61
108
  // src/transitions/resolve.ts
62
- var DEFAULT_TIMING_DURATION = 250;
63
109
  function buildSpring(cfg, toValue, cb) {
64
110
  return reactNativeReanimated.withSpring(toValue, springToReanimated(cfg), cb);
65
111
  }
@@ -92,17 +138,54 @@ function buildOne(cfg, toValue, cb) {
92
138
  if (cfg.type === "timing") return buildTiming(cfg, toValue, cb);
93
139
  return buildSpring(cfg, toValue, cb);
94
140
  }
95
- function applyRepeat(animation, repeat) {
96
- if (repeat === void 0) return animation;
141
+ function normalizeRepeat(repeat) {
142
+ if (repeat === void 0) return void 0;
97
143
  if (repeat === "infinite") {
98
- return reactNativeReanimated.withRepeat(animation, -1, true);
144
+ return {
145
+ count: Number.POSITIVE_INFINITY,
146
+ alternate: true,
147
+ explicitAlternate: false
148
+ };
149
+ }
150
+ const rawCount = typeof repeat === "number" ? repeat : repeat.count;
151
+ const alternate = typeof repeat === "number" ? true : repeat.alternate;
152
+ if (rawCount === "infinite") {
153
+ return {
154
+ count: Number.POSITIVE_INFINITY,
155
+ alternate: alternate ?? true,
156
+ explicitAlternate: alternate !== void 0
157
+ };
99
158
  }
100
- if (typeof repeat === "number") {
101
- return reactNativeReanimated.withRepeat(animation, repeat, true);
159
+ if (!(rawCount >= 1)) {
160
+ warnOnce(
161
+ `repeat-count:${String(rawCount)}`,
162
+ `[inertia] repeat count ${String(rawCount)} is below 1 \u2014 the animation runs once. Use \`repeat: 2\` or more to repeat, or \`repeat: 'infinite'\`. (Reanimated reads a count of 0 as endless, so it is not forwarded.)`
163
+ );
164
+ return void 0;
102
165
  }
103
- const count = repeat.count === "infinite" ? -1 : repeat.count;
104
- const alternate = repeat.alternate ?? true;
105
- return reactNativeReanimated.withRepeat(animation, count, alternate);
166
+ return {
167
+ count: rawCount,
168
+ alternate: alternate ?? true,
169
+ explicitAlternate: alternate !== void 0
170
+ };
171
+ }
172
+ function repeatIterationsOf(repeat) {
173
+ return normalizeRepeat(repeat)?.count ?? 1;
174
+ }
175
+ function applyRepeat(animation, repeat, options) {
176
+ const r = normalizeRepeat(repeat);
177
+ if (r === void 0) return animation;
178
+ const count = Number.isFinite(r.count) ? r.count : -1;
179
+ if (options?.sequence) {
180
+ if (r.explicitAlternate && r.alternate) {
181
+ warnOnce(
182
+ "repeat-sequence-alternate",
183
+ "[inertia] repeat.alternate has no effect on a sequence \u2014 Reanimated restarts a sequence at its first step on every pass. Append the reverse steps to the sequence to alternate."
184
+ );
185
+ }
186
+ return reactNativeReanimated.withRepeat(animation, count, false);
187
+ }
188
+ return reactNativeReanimated.withRepeat(animation, count, r.alternate);
106
189
  }
107
190
  function applyDelay(animation, delay) {
108
191
  if (!delay || delay <= 0) return animation;
@@ -130,6 +213,10 @@ function delayOf(cfg) {
130
213
  if (cfg.type === "no-animation") return void 0;
131
214
  return cfg.delay;
132
215
  }
216
+ var INSTANT = { duration: 0 };
217
+ function isSnapped(step) {
218
+ return typeof step === "number" || typeof step === "string";
219
+ }
133
220
  function isStepObject(v) {
134
221
  return typeof v === "object" && v !== null && !Array.isArray(v) && "to" in v;
135
222
  }
@@ -140,8 +227,17 @@ function resolveAnimatableValue(value, base, factory) {
140
227
  const animations = steps.map(
141
228
  (step2, i) => resolveStep(step2, stepBase, factory?.("step", i))
142
229
  );
143
- const seq = reactNativeReanimated.withSequence(...animations);
144
- return applyRepeat(seq, base ? repeatOf(base) : void 0);
230
+ if (stepBase?.type === "no-animation" && animations.length > 0) {
231
+ return animations[animations.length - 1];
232
+ }
233
+ const seq = reactNativeReanimated.withSequence(
234
+ ...animations.map(
235
+ (a) => isSnapped(a) ? reactNativeReanimated.withTiming(a, INSTANT) : a
236
+ )
237
+ );
238
+ return applyRepeat(seq, base ? repeatOf(base) : void 0, {
239
+ sequence: true
240
+ });
145
241
  }
146
242
  const step = value;
147
243
  const cb = factory?.("animation", void 0);
@@ -211,7 +307,6 @@ function bezier(x1, y1, x2, y2, source) {
211
307
  }
212
308
  return reactNativeReanimated.Easing.bezier(x1, y1, x2, y2);
213
309
  }
214
- var DEFAULT_TIMING_DURATION2 = 250;
215
310
  function buildReleaseAnimation(transition, toValue, callback) {
216
311
  "worklet";
217
312
  if (transition.type === "no-animation") {
@@ -228,11 +323,11 @@ function buildReleaseAnimation(transition, toValue, callback) {
228
323
  }
229
324
  if (transition.type === "timing") {
230
325
  const e = transition.easing;
231
- const easingFn = e && typeof e === "object" && "factory" in e ? e.factory() : e ?? reactNativeReanimated.Easing.inOut(reactNativeReanimated.Easing.ease);
326
+ const easingFn = e ? unwrapEasingFactory(e) : reactNativeReanimated.Easing.inOut(reactNativeReanimated.Easing.ease);
232
327
  return reactNativeReanimated.withTiming(
233
328
  toValue,
234
329
  {
235
- duration: transition.duration ?? DEFAULT_TIMING_DURATION2,
330
+ duration: transition.duration ?? DEFAULT_TIMING_DURATION,
236
331
  easing: easingFn
237
332
  },
238
333
  callback
@@ -241,57 +336,14 @@ function buildReleaseAnimation(transition, toValue, callback) {
241
336
  return reactNativeReanimated.withSpring(toValue, springToReanimated(transition), callback);
242
337
  }
243
338
 
244
- // src/transitions/keys.ts
245
- var TRANSITION_CONFIG_KEYS = /* @__PURE__ */ new Set([
246
- "type",
247
- "tension",
248
- "friction",
249
- "mass",
250
- "velocity",
251
- "restSpeedThreshold",
252
- "restDisplacementThreshold",
253
- "duration",
254
- "easing",
255
- "delay",
256
- "repeat",
257
- "deceleration",
258
- "clamp"
259
- ]);
260
- function isTopLevelTransition(t) {
261
- if (t === null || typeof t !== "object") return false;
262
- const keys = Object.keys(t);
263
- if (keys.length === 0) return false;
264
- return keys.every((k) => TRANSITION_CONFIG_KEYS.has(k));
265
- }
266
-
267
- // src/transitions/sig.ts
268
- function stableSig(value) {
269
- if (value === void 0) return "";
270
- try {
271
- return stableStringify(value);
272
- } catch {
273
- return String(value);
274
- }
275
- }
276
- function stableStringify(v) {
277
- if (v === null || typeof v !== "object") {
278
- if (typeof v === "function" || v === void 0) return "null";
279
- return JSON.stringify(v);
280
- }
281
- if (Array.isArray(v)) {
282
- return "[" + v.map(stableStringify).join(",") + "]";
283
- }
284
- const obj = v;
285
- const keys = Object.keys(obj).sort();
286
- return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
287
- }
288
-
339
+ exports.DEFAULT_LAYOUT_DURATION = DEFAULT_LAYOUT_DURATION;
289
340
  exports.DEFAULT_SPRING = DEFAULT_SPRING;
290
341
  exports.applyDelay = applyDelay;
291
342
  exports.buildReleaseAnimation = buildReleaseAnimation;
292
343
  exports.cubicBezier = cubicBezier;
293
344
  exports.ensureWorkletEasing = ensureWorkletEasing;
294
345
  exports.isTopLevelTransition = isTopLevelTransition;
346
+ exports.repeatIterationsOf = repeatIterationsOf;
295
347
  exports.resolveAnimatableValue = resolveAnimatableValue;
296
348
  exports.resolveTransition = resolveTransition;
297
349
  exports.springToReanimated = springToReanimated;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkE3ALFSH2_js = require('./chunk-E3ALFSH2.js');
3
+ var chunkHBURWGCZ_js = require('./chunk-HBURWGCZ.js');
4
4
  var reactNative = require('react-native');
5
5
 
6
- var MotionPressable = chunkE3ALFSH2_js.createMotionComponent(reactNative.Pressable);
6
+ var MotionPressable = chunkHBURWGCZ_js.createMotionComponent(reactNative.Pressable);
7
7
 
8
8
  exports.MotionPressable = MotionPressable;
@@ -1,4 +1,4 @@
1
- import { createMotionComponent } from './chunk-IX6SEOSK.mjs';
1
+ import { createMotionComponent } from './chunk-5EYIZG72.mjs';
2
2
  import { Pressable } from 'react-native';
3
3
 
4
4
  var MotionPressable = createMotionComponent(Pressable);
@@ -1,4 +1,4 @@
1
- import { createMotionComponent } from './chunk-IX6SEOSK.mjs';
1
+ import { createMotionComponent } from './chunk-5EYIZG72.mjs';
2
2
  import { Text } from 'react-native';
3
3
 
4
4
  var MotionText = createMotionComponent(Text);
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkE3ALFSH2_js = require('./chunk-E3ALFSH2.js');
3
+ var chunkHBURWGCZ_js = require('./chunk-HBURWGCZ.js');
4
4
  var Animated = require('react-native-reanimated');
5
5
 
6
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
7
 
8
8
  var Animated__default = /*#__PURE__*/_interopDefault(Animated);
9
9
 
10
- var MotionFlatList = chunkE3ALFSH2_js.createMotionComponent(
10
+ var MotionFlatList = chunkHBURWGCZ_js.createMotionComponent(
11
11
  Animated__default.default.FlatList
12
12
  // `createMotionComponent<C>` returns a non-generic `MotionComponent<C>`, so
13
13
  // `data` / `renderItem` would collapse to `any` and lose `ItemT` inference.
@@ -1,6 +1,6 @@
1
1
  import { SharedValue, AnimatedStyle } from 'react-native-reanimated';
2
- import { U as UseGestureHandlers } from '../useGesture-CnZQnYHH.mjs';
3
- import { b as TransitionInput, G as GestureLayerTransitions } from '../types-DyJpG64F.mjs';
2
+ import { U as UseGestureHandlers } from '../useGesture-Ve8EGjTr.mjs';
3
+ import { b as TransitionInput, G as GestureLayerTransitions } from '../types-C5Zbs9MC.mjs';
4
4
  import 'react';
5
5
  import 'react-native';
6
6
 
@@ -157,4 +157,4 @@ interface UseGestureLayerResult {
157
157
  */
158
158
  declare function useGestureLayer(states: GestureLayerStates, options?: UseGestureLayerOptions): UseGestureLayerResult;
159
159
 
160
- export { type GestureLayerProgress, type GestureLayerStates, type GestureLayerStyle, type UseGestureLayerOptions, type UseGestureLayerResult, useGestureLayer };
160
+ export { type GestureLayerProgress, type GestureLayerStates, type GestureLayerStyle, GestureLayerTransitions, type UseGestureLayerOptions, type UseGestureLayerResult, useGestureLayer };
@@ -1,6 +1,6 @@
1
1
  import { SharedValue, AnimatedStyle } from 'react-native-reanimated';
2
- import { U as UseGestureHandlers } from '../useGesture-DbH46EBp.js';
3
- import { b as TransitionInput, G as GestureLayerTransitions } from '../types-DyJpG64F.js';
2
+ import { U as UseGestureHandlers } from '../useGesture-Be0ZhCWj.js';
3
+ import { b as TransitionInput, G as GestureLayerTransitions } from '../types-C5Zbs9MC.js';
4
4
  import 'react';
5
5
  import 'react-native';
6
6
 
@@ -157,4 +157,4 @@ interface UseGestureLayerResult {
157
157
  */
158
158
  declare function useGestureLayer(states: GestureLayerStates, options?: UseGestureLayerOptions): UseGestureLayerResult;
159
159
 
160
- export { type GestureLayerProgress, type GestureLayerStates, type GestureLayerStyle, type UseGestureLayerOptions, type UseGestureLayerResult, useGestureLayer };
160
+ export { type GestureLayerProgress, type GestureLayerStates, type GestureLayerStyle, GestureLayerTransitions, type UseGestureLayerOptions, type UseGestureLayerResult, useGestureLayer };
@@ -1,26 +1,27 @@
1
1
  'use strict';
2
2
 
3
- var chunkMUT6BTZS_js = require('../chunk-MUT6BTZS.js');
4
- var chunk6AN5X3YE_js = require('../chunk-6AN5X3YE.js');
5
- var chunkWNVHPMBI_js = require('../chunk-WNVHPMBI.js');
3
+ var chunkNTG6PSGZ_js = require('../chunk-NTG6PSGZ.js');
4
+ var chunkQDMSFRQR_js = require('../chunk-QDMSFRQR.js');
5
+ var chunkQX5JHRZ2_js = require('../chunk-QX5JHRZ2.js');
6
6
  var react = require('react');
7
7
  var reactNativeReanimated = require('react-native-reanimated');
8
8
 
9
9
  function useGestureLayer(states, options = {}) {
10
10
  const { disabled: isDisabled = false, transition: transitionInput } = options;
11
- const shouldReduceMotion = chunk6AN5X3YE_js.useShouldReduceMotion();
12
- const transition = chunk6AN5X3YE_js.resolveNamedTransitionProp(
11
+ const shouldReduceMotion = chunkQDMSFRQR_js.useShouldReduceMotion();
12
+ const transition = chunkQDMSFRQR_js.resolveNamedTransitionProp(
13
13
  transitionInput,
14
- chunk6AN5X3YE_js.useNamedTransitions()
14
+ chunkQDMSFRQR_js.useNamedTransitions()
15
15
  );
16
- const gesture = chunkMUT6BTZS_js.useGesture(transition);
16
+ const gesture = chunkNTG6PSGZ_js.useGesture(transition);
17
17
  const disabledProgress = reactNativeReanimated.useSharedValue(0);
18
- const transitionSig = chunkWNVHPMBI_js.stableSig(transition);
18
+ const transitionSig = chunkQX5JHRZ2_js.stableSig(transition);
19
19
  react.useEffect(() => {
20
20
  const target = isDisabled ? 1 : 0;
21
21
  const cfg = shouldReduceMotion ? { type: "no-animation" } : disabledTransition(transition) ?? { type: "spring" };
22
- disabledProgress.value = chunkWNVHPMBI_js.resolveTransition(cfg, target);
22
+ disabledProgress.value = chunkQX5JHRZ2_js.resolveTransition(cfg, target);
23
23
  }, [isDisabled, shouldReduceMotion, transitionSig, disabledProgress]);
24
+ const statesSig = chunkQX5JHRZ2_js.stableSig(states);
24
25
  const meta = react.useMemo(() => {
25
26
  const layers = {
26
27
  rest: states.rest,
@@ -60,14 +61,7 @@ function useGestureLayer(states, options = {}) {
60
61
  restValues[k] = restRaw !== void 0 ? restRaw : isColor ? "transparent" : 0;
61
62
  }
62
63
  return { layers, keys, types, restValues };
63
- }, [
64
- states.rest,
65
- states.hovered,
66
- states.focused,
67
- states.focusVisible,
68
- states.pressed,
69
- states.disabled
70
- ]);
64
+ }, [statesSig]);
71
65
  const style = reactNativeReanimated.useAnimatedStyle(() => {
72
66
  const { layers, keys, types, restValues } = meta;
73
67
  const ph = gesture.hovered.value;
@@ -154,7 +148,7 @@ function useGestureLayer(states, options = {}) {
154
148
  }
155
149
  function disabledTransition(transition) {
156
150
  if (!transition) return void 0;
157
- if (chunkWNVHPMBI_js.isTopLevelTransition(transition)) return transition;
151
+ if (chunkQX5JHRZ2_js.isTopLevelTransition(transition)) return transition;
158
152
  return void 0;
159
153
  }
160
154