@rootnative/inertia 0.0.7 → 0.0.9

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 (57) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/README.md +1 -1
  3. package/dist/chunk-24NUL23E.js +8 -0
  4. package/dist/chunk-4XBX7KOD.js +8 -0
  5. package/dist/{chunk-OBRGJAST.js → chunk-6AN5X3YE.js} +3 -3
  6. package/dist/{chunk-WGCF3WQG.js → chunk-6NOCY764.js} +2 -2
  7. package/dist/{chunk-KBFN4TRO.mjs → chunk-6YIUETBF.mjs} +1 -1
  8. package/dist/{chunk-6V7MOBXO.js → chunk-E3ALFSH2.js} +64 -33
  9. package/dist/{chunk-ZOBOKLAS.mjs → chunk-EN4PN7X3.mjs} +1 -1
  10. package/dist/{chunk-RUIOM2YZ.mjs → chunk-GSUC4HWP.mjs} +1 -1
  11. package/dist/{chunk-QJYFTTM2.js → chunk-IHVMNOS4.js} +2 -2
  12. package/dist/{chunk-HPJMIBBK.mjs → chunk-IX6SEOSK.mjs} +41 -12
  13. package/dist/{chunk-52QSN2VQ.mjs → chunk-JBK5ZLMH.mjs} +1 -1
  14. package/dist/{chunk-OW5XTGVN.mjs → chunk-L4JFECXU.mjs} +2 -2
  15. package/dist/{chunk-VSK2E35J.mjs → chunk-M4766VUV.mjs} +1 -1
  16. package/dist/{chunk-Z3HCJ43H.mjs → chunk-MFAFB4K7.mjs} +1 -1
  17. package/dist/{chunk-4NAMD62I.js → chunk-MUT6BTZS.js} +7 -7
  18. package/dist/{chunk-WMLS4TMX.mjs → chunk-QNLSCOR5.mjs} +1 -1
  19. package/dist/{chunk-REYL77RE.mjs → chunk-W7NTRSPD.mjs} +17 -10
  20. package/dist/{chunk-PM6CVGXJ.js → chunk-WNVHPMBI.js} +16 -8
  21. package/dist/chunk-Z5USXWTE.js +8 -0
  22. package/dist/{chunk-QYR66E2G.js → chunk-ZBHQPVWE.js} +2 -2
  23. package/dist/gestureLayer/index.js +10 -10
  24. package/dist/gestureLayer/index.mjs +3 -3
  25. package/dist/index.d.mts +91 -4
  26. package/dist/index.d.ts +91 -4
  27. package/dist/index.js +69 -53
  28. package/dist/index.mjs +24 -20
  29. package/dist/motion/FlatList.js +5 -5
  30. package/dist/motion/FlatList.mjs +4 -4
  31. package/dist/motion/Image.js +5 -5
  32. package/dist/motion/Image.mjs +4 -4
  33. package/dist/motion/Pressable.js +5 -5
  34. package/dist/motion/Pressable.mjs +4 -4
  35. package/dist/motion/ScrollView.js +5 -5
  36. package/dist/motion/ScrollView.mjs +4 -4
  37. package/dist/motion/Text.js +5 -5
  38. package/dist/motion/Text.mjs +4 -4
  39. package/dist/motion/View.js +5 -5
  40. package/dist/motion/View.mjs +4 -4
  41. package/dist/touch/index.js +3 -3
  42. package/dist/touch/index.mjs +1 -1
  43. package/llms.txt +19 -2
  44. package/package.json +1 -1
  45. package/src/index.ts +5 -0
  46. package/src/motion/createMotionComponent.tsx +45 -10
  47. package/src/stagger/Stagger.tsx +75 -0
  48. package/src/stagger/StaggerContext.ts +25 -0
  49. package/src/stagger/index.ts +2 -0
  50. package/src/transitions/index.ts +6 -1
  51. package/src/transitions/resolve.ts +7 -1
  52. package/src/transitions/runtime.ts +22 -7
  53. package/src/values/index.ts +1 -0
  54. package/src/values/useInterpolatedStyle.ts +37 -7
  55. package/dist/chunk-NPJ46457.js +0 -8
  56. package/dist/chunk-YUTS6JRU.js +0 -8
  57. package/dist/chunk-ZSOCRHU3.js +0 -8
package/dist/index.js CHANGED
@@ -1,36 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var chunk4NAMD62I_js = require('./chunk-4NAMD62I.js');
4
- var chunkNPJ46457_js = require('./chunk-NPJ46457.js');
5
- var chunkZSOCRHU3_js = require('./chunk-ZSOCRHU3.js');
6
- var chunkYUTS6JRU_js = require('./chunk-YUTS6JRU.js');
7
- var chunkWGCF3WQG_js = require('./chunk-WGCF3WQG.js');
8
- var chunkQYR66E2G_js = require('./chunk-QYR66E2G.js');
9
- var chunkQJYFTTM2_js = require('./chunk-QJYFTTM2.js');
10
- var chunk6V7MOBXO_js = require('./chunk-6V7MOBXO.js');
11
- var chunkOBRGJAST_js = require('./chunk-OBRGJAST.js');
12
- var chunkPM6CVGXJ_js = require('./chunk-PM6CVGXJ.js');
3
+ var chunkMUT6BTZS_js = require('./chunk-MUT6BTZS.js');
4
+ var chunk24NUL23E_js = require('./chunk-24NUL23E.js');
5
+ var chunk4XBX7KOD_js = require('./chunk-4XBX7KOD.js');
6
+ var chunkZ5USXWTE_js = require('./chunk-Z5USXWTE.js');
7
+ var chunk6NOCY764_js = require('./chunk-6NOCY764.js');
8
+ var chunkZBHQPVWE_js = require('./chunk-ZBHQPVWE.js');
9
+ var chunkIHVMNOS4_js = require('./chunk-IHVMNOS4.js');
10
+ var chunkE3ALFSH2_js = require('./chunk-E3ALFSH2.js');
11
+ var chunk6AN5X3YE_js = require('./chunk-6AN5X3YE.js');
12
+ var chunkWNVHPMBI_js = require('./chunk-WNVHPMBI.js');
13
13
  var react = require('react');
14
14
  var reactNativeReanimated = require('react-native-reanimated');
15
15
  var reactNativeWorklets = require('react-native-worklets');
16
16
 
17
17
  // src/motion/index.ts
18
18
  var Motion = {
19
- View: chunkNPJ46457_js.MotionView,
20
- Text: chunkZSOCRHU3_js.MotionText,
21
- Image: chunkYUTS6JRU_js.MotionImage,
22
- Pressable: chunkWGCF3WQG_js.MotionPressable,
23
- ScrollView: chunkQYR66E2G_js.MotionScrollView,
24
- FlatList: chunkQJYFTTM2_js.MotionFlatList
19
+ View: chunk24NUL23E_js.MotionView,
20
+ Text: chunk4XBX7KOD_js.MotionText,
21
+ Image: chunkZ5USXWTE_js.MotionImage,
22
+ Pressable: chunk6NOCY764_js.MotionPressable,
23
+ ScrollView: chunkZBHQPVWE_js.MotionScrollView,
24
+ FlatList: chunkIHVMNOS4_js.MotionFlatList
25
25
  };
26
26
  function useAnimation(target, transition) {
27
27
  const output = reactNativeReanimated.useSharedValue(target);
28
- const shouldReduceMotion = chunkOBRGJAST_js.useShouldReduceMotion();
29
- const resolved = chunkOBRGJAST_js.resolveNamedTransition(transition, chunkOBRGJAST_js.useNamedTransitions());
30
- const cfgSig = chunkPM6CVGXJ_js.stableSig(resolved);
28
+ const shouldReduceMotion = chunk6AN5X3YE_js.useShouldReduceMotion();
29
+ const resolved = chunk6AN5X3YE_js.resolveNamedTransition(transition, chunk6AN5X3YE_js.useNamedTransitions());
30
+ const cfgSig = chunkWNVHPMBI_js.stableSig(resolved);
31
31
  react.useEffect(() => {
32
32
  const cfg = shouldReduceMotion ? { type: "no-animation" } : resolved ?? { type: "spring" };
33
- output.value = chunkPM6CVGXJ_js.resolveTransition(cfg, target);
33
+ output.value = chunkWNVHPMBI_js.resolveTransition(cfg, target);
34
34
  }, [target, cfgSig, shouldReduceMotion]);
35
35
  react.useEffect(
36
36
  () => () => reactNativeReanimated.cancelAnimation(output),
@@ -41,22 +41,22 @@ function useAnimation(target, transition) {
41
41
  return output;
42
42
  }
43
43
  function useAnimator() {
44
- const registry = chunkOBRGJAST_js.useNamedTransitions();
45
- const shouldReduceMotion = chunkOBRGJAST_js.useShouldReduceMotion();
44
+ const registry = chunk6AN5X3YE_js.useNamedTransitions();
45
+ const shouldReduceMotion = chunk6AN5X3YE_js.useShouldReduceMotion();
46
46
  const registryRef = react.useRef(registry);
47
47
  registryRef.current = registry;
48
48
  const reduceMotionRef = react.useRef(shouldReduceMotion);
49
49
  reduceMotionRef.current = shouldReduceMotion;
50
50
  return react.useCallback((value, to, transition) => {
51
- const resolved = chunkOBRGJAST_js.resolveNamedTransition(transition, registryRef.current);
51
+ const resolved = chunk6AN5X3YE_js.resolveNamedTransition(transition, registryRef.current);
52
52
  const cfg = reduceMotionRef.current ? { type: "no-animation" } : resolved ?? { type: "spring" };
53
- value.value = chunkPM6CVGXJ_js.resolveTransition(cfg, to);
53
+ value.value = chunkWNVHPMBI_js.resolveTransition(cfg, to);
54
54
  }, []);
55
55
  }
56
56
  function useSpring(target, config) {
57
- const spring = resolveSpringInput(config, chunkOBRGJAST_js.useNamedTransitions());
57
+ const spring = resolveSpringInput(config, chunk6AN5X3YE_js.useNamedTransitions());
58
58
  const reanimConfig = react.useMemo(
59
- () => chunkPM6CVGXJ_js.springToReanimated(spring ?? {}),
59
+ () => chunkWNVHPMBI_js.springToReanimated(spring ?? {}),
60
60
  // Keyed on the resolved primitive fields rather than the `config` object
61
61
  // identity: callers routinely pass a fresh object literal each render, so
62
62
  // depending on `config` itself would rebuild the Reanimated config on
@@ -101,7 +101,7 @@ function useSpring(target, config) {
101
101
  }
102
102
  function resolveSpringInput(config, registry) {
103
103
  if (typeof config !== "string") return config;
104
- const cfg = chunkOBRGJAST_js.lookupNamedTransition(config, registry);
104
+ const cfg = chunk6AN5X3YE_js.lookupNamedTransition(config, registry);
105
105
  if (cfg.type === void 0 || cfg.type === "spring") return cfg;
106
106
  if (__DEV__) {
107
107
  console.warn(
@@ -249,7 +249,11 @@ function buildEntries(map, options) {
249
249
  function useInterpolatedStyle(progress, map, options) {
250
250
  const extrapolate = mapExtrapolation(options?.extrapolate);
251
251
  const sig = buildSignature(map, options);
252
- const entries = react.useMemo(() => buildEntries(map, options), [sig]);
252
+ const entries = react.useMemo(
253
+ () => buildEntries(map, options),
254
+ // eslint-disable-next-line react-hooks/exhaustive-deps
255
+ [sig]
256
+ );
253
257
  return reactNativeReanimated.useAnimatedStyle(() => {
254
258
  "worklet";
255
259
  const out = {};
@@ -298,7 +302,7 @@ function useTransform(arg1, inputRange, outputRange, options) {
298
302
  if (reactNativeWorklets.isWorkletFunction(userFn)) {
299
303
  producer = userFn;
300
304
  } else {
301
- chunkPM6CVGXJ_js.warnNonWorkletOnce(
305
+ chunkWNVHPMBI_js.warnNonWorkletOnce(
302
306
  "useTransform-transformer",
303
307
  "[inertia] useTransform: the transformer is not a worklet, so the shared values it reads can't be tracked as dependencies \u2014 the derived value will only refresh on React re-renders, and native builds reject plain functions on the UI thread. Add the 'worklet' directive as the first statement of the transformer."
304
308
  );
@@ -364,9 +368,9 @@ function useShadow({
364
368
  const hasElevation = from.elevation !== void 0 || to.elevation !== void 0;
365
369
  const hasColor = from.shadowColor !== void 0 || to.shadowColor !== void 0;
366
370
  const hasOffset = from.shadowOffset !== void 0 || to.shadowOffset !== void 0;
367
- const boxShadowPairs = from.boxShadow !== void 0 || to.boxShadow !== void 0 ? chunk6V7MOBXO_js.pairBoxShadowLayers(
368
- chunk6V7MOBXO_js.resolveBoxShadowInput(from.boxShadow),
369
- chunk6V7MOBXO_js.resolveBoxShadowInput(to.boxShadow)
371
+ const boxShadowPairs = from.boxShadow !== void 0 || to.boxShadow !== void 0 ? chunkE3ALFSH2_js.pairBoxShadowLayers(
372
+ chunkE3ALFSH2_js.resolveBoxShadowInput(from.boxShadow),
373
+ chunkE3ALFSH2_js.resolveBoxShadowInput(to.boxShadow)
370
374
  ) : [];
371
375
  const opacityFrom = from.shadowOpacity ?? 0;
372
376
  const opacityTo = to.shadowOpacity ?? 0;
@@ -465,87 +469,99 @@ function useVariants(variants, initial) {
465
469
 
466
470
  Object.defineProperty(exports, "useGesture", {
467
471
  enumerable: true,
468
- get: function () { return chunk4NAMD62I_js.useGesture; }
472
+ get: function () { return chunkMUT6BTZS_js.useGesture; }
469
473
  });
470
474
  Object.defineProperty(exports, "MotionView", {
471
475
  enumerable: true,
472
- get: function () { return chunkNPJ46457_js.MotionView; }
476
+ get: function () { return chunk24NUL23E_js.MotionView; }
473
477
  });
474
478
  Object.defineProperty(exports, "MotionText", {
475
479
  enumerable: true,
476
- get: function () { return chunkZSOCRHU3_js.MotionText; }
480
+ get: function () { return chunk4XBX7KOD_js.MotionText; }
477
481
  });
478
482
  Object.defineProperty(exports, "MotionImage", {
479
483
  enumerable: true,
480
- get: function () { return chunkYUTS6JRU_js.MotionImage; }
484
+ get: function () { return chunkZ5USXWTE_js.MotionImage; }
481
485
  });
482
486
  Object.defineProperty(exports, "MotionPressable", {
483
487
  enumerable: true,
484
- get: function () { return chunkWGCF3WQG_js.MotionPressable; }
488
+ get: function () { return chunk6NOCY764_js.MotionPressable; }
485
489
  });
486
490
  Object.defineProperty(exports, "MotionScrollView", {
487
491
  enumerable: true,
488
- get: function () { return chunkQYR66E2G_js.MotionScrollView; }
492
+ get: function () { return chunkZBHQPVWE_js.MotionScrollView; }
489
493
  });
490
494
  Object.defineProperty(exports, "MotionFlatList", {
491
495
  enumerable: true,
492
- get: function () { return chunkQJYFTTM2_js.MotionFlatList; }
496
+ get: function () { return chunkIHVMNOS4_js.MotionFlatList; }
493
497
  });
494
498
  Object.defineProperty(exports, "Presence", {
495
499
  enumerable: true,
496
- get: function () { return chunk6V7MOBXO_js.Presence; }
500
+ get: function () { return chunkE3ALFSH2_js.Presence; }
501
+ });
502
+ Object.defineProperty(exports, "Stagger", {
503
+ enumerable: true,
504
+ get: function () { return chunkE3ALFSH2_js.Stagger; }
497
505
  });
498
506
  Object.defineProperty(exports, "TRANSPARENT", {
499
507
  enumerable: true,
500
- get: function () { return chunk6V7MOBXO_js.TRANSPARENT; }
508
+ get: function () { return chunkE3ALFSH2_js.TRANSPARENT; }
501
509
  });
502
510
  Object.defineProperty(exports, "createMotionComponent", {
503
511
  enumerable: true,
504
- get: function () { return chunk6V7MOBXO_js.createMotionComponent; }
512
+ get: function () { return chunkE3ALFSH2_js.createMotionComponent; }
505
513
  });
506
514
  Object.defineProperty(exports, "usePresence", {
507
515
  enumerable: true,
508
- get: function () { return chunk6V7MOBXO_js.usePresence; }
516
+ get: function () { return chunkE3ALFSH2_js.usePresence; }
517
+ });
518
+ Object.defineProperty(exports, "useStaggerDelay", {
519
+ enumerable: true,
520
+ get: function () { return chunkE3ALFSH2_js.useStaggerDelay; }
509
521
  });
510
522
  Object.defineProperty(exports, "MotionConfig", {
511
523
  enumerable: true,
512
- get: function () { return chunkOBRGJAST_js.MotionConfig; }
524
+ get: function () { return chunk6AN5X3YE_js.MotionConfig; }
513
525
  });
514
526
  Object.defineProperty(exports, "resolveNamedTransition", {
515
527
  enumerable: true,
516
- get: function () { return chunkOBRGJAST_js.resolveNamedTransition; }
528
+ get: function () { return chunk6AN5X3YE_js.resolveNamedTransition; }
517
529
  });
518
530
  Object.defineProperty(exports, "useMotionConfig", {
519
531
  enumerable: true,
520
- get: function () { return chunkOBRGJAST_js.useMotionConfig; }
532
+ get: function () { return chunk6AN5X3YE_js.useMotionConfig; }
521
533
  });
522
534
  Object.defineProperty(exports, "useNamedTransitions", {
523
535
  enumerable: true,
524
- get: function () { return chunkOBRGJAST_js.useNamedTransitions; }
536
+ get: function () { return chunk6AN5X3YE_js.useNamedTransitions; }
525
537
  });
526
538
  Object.defineProperty(exports, "useShouldReduceMotion", {
527
539
  enumerable: true,
528
- get: function () { return chunkOBRGJAST_js.useShouldReduceMotion; }
540
+ get: function () { return chunk6AN5X3YE_js.useShouldReduceMotion; }
541
+ });
542
+ Object.defineProperty(exports, "applyDelay", {
543
+ enumerable: true,
544
+ get: function () { return chunkWNVHPMBI_js.applyDelay; }
529
545
  });
530
546
  Object.defineProperty(exports, "buildReleaseAnimation", {
531
547
  enumerable: true,
532
- get: function () { return chunkPM6CVGXJ_js.buildReleaseAnimation; }
548
+ get: function () { return chunkWNVHPMBI_js.buildReleaseAnimation; }
533
549
  });
534
550
  Object.defineProperty(exports, "cubicBezier", {
535
551
  enumerable: true,
536
- get: function () { return chunkPM6CVGXJ_js.cubicBezier; }
552
+ get: function () { return chunkWNVHPMBI_js.cubicBezier; }
537
553
  });
538
554
  Object.defineProperty(exports, "ensureWorkletEasing", {
539
555
  enumerable: true,
540
- get: function () { return chunkPM6CVGXJ_js.ensureWorkletEasing; }
556
+ get: function () { return chunkWNVHPMBI_js.ensureWorkletEasing; }
541
557
  });
542
558
  Object.defineProperty(exports, "resolveAnimatableValue", {
543
559
  enumerable: true,
544
- get: function () { return chunkPM6CVGXJ_js.resolveAnimatableValue; }
560
+ get: function () { return chunkWNVHPMBI_js.resolveAnimatableValue; }
545
561
  });
546
562
  Object.defineProperty(exports, "resolveTransition", {
547
563
  enumerable: true,
548
- get: function () { return chunkPM6CVGXJ_js.resolveTransition; }
564
+ get: function () { return chunkWNVHPMBI_js.resolveTransition; }
549
565
  });
550
566
  exports.Motion = Motion;
551
567
  exports.useAnimation = useAnimation;
package/dist/index.mjs CHANGED
@@ -1,22 +1,22 @@
1
- export { useGesture } from './chunk-OW5XTGVN.mjs';
2
- import { MotionView } from './chunk-RUIOM2YZ.mjs';
3
- export { MotionView } from './chunk-RUIOM2YZ.mjs';
4
- import { MotionText } from './chunk-WMLS4TMX.mjs';
5
- export { MotionText } from './chunk-WMLS4TMX.mjs';
6
- import { MotionImage } from './chunk-KBFN4TRO.mjs';
7
- export { MotionImage } from './chunk-KBFN4TRO.mjs';
8
- import { MotionPressable } from './chunk-52QSN2VQ.mjs';
9
- export { MotionPressable } from './chunk-52QSN2VQ.mjs';
10
- import { MotionScrollView } from './chunk-VSK2E35J.mjs';
11
- export { MotionScrollView } from './chunk-VSK2E35J.mjs';
12
- import { MotionFlatList } from './chunk-ZOBOKLAS.mjs';
13
- export { MotionFlatList } from './chunk-ZOBOKLAS.mjs';
14
- import { pairBoxShadowLayers, resolveBoxShadowInput } from './chunk-HPJMIBBK.mjs';
15
- export { Presence, TRANSPARENT, createMotionComponent, usePresence } from './chunk-HPJMIBBK.mjs';
16
- import { useShouldReduceMotion, resolveNamedTransition, useNamedTransitions, lookupNamedTransition } from './chunk-Z3HCJ43H.mjs';
17
- export { MotionConfig, resolveNamedTransition, useMotionConfig, useNamedTransitions, useShouldReduceMotion } from './chunk-Z3HCJ43H.mjs';
18
- import { stableSig, resolveTransition, springToReanimated, warnNonWorkletOnce } from './chunk-REYL77RE.mjs';
19
- export { buildReleaseAnimation, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveTransition } from './chunk-REYL77RE.mjs';
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';
20
20
  import { useEffect, useRef, useCallback, useMemo } from 'react';
21
21
  import { useSharedValue, cancelAnimation, withSpring, useAnimatedReaction, useAnimatedStyle, interpolateColor, interpolate, useDerivedValue, Extrapolation, useAnimatedScrollHandler } from 'react-native-reanimated';
22
22
  import { isWorkletFunction } from 'react-native-worklets';
@@ -256,7 +256,11 @@ function buildEntries(map, options) {
256
256
  function useInterpolatedStyle(progress, map, options) {
257
257
  const extrapolate = mapExtrapolation(options?.extrapolate);
258
258
  const sig = buildSignature(map, options);
259
- const entries = useMemo(() => buildEntries(map, options), [sig]);
259
+ const entries = useMemo(
260
+ () => buildEntries(map, options),
261
+ // eslint-disable-next-line react-hooks/exhaustive-deps
262
+ [sig]
263
+ );
260
264
  return useAnimatedStyle(() => {
261
265
  "worklet";
262
266
  const out = {};
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkQJYFTTM2_js = require('../chunk-QJYFTTM2.js');
4
- require('../chunk-6V7MOBXO.js');
5
- require('../chunk-OBRGJAST.js');
6
- require('../chunk-PM6CVGXJ.js');
3
+ var chunkIHVMNOS4_js = require('../chunk-IHVMNOS4.js');
4
+ require('../chunk-E3ALFSH2.js');
5
+ require('../chunk-6AN5X3YE.js');
6
+ require('../chunk-WNVHPMBI.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionFlatList", {
11
11
  enumerable: true,
12
- get: function () { return chunkQJYFTTM2_js.MotionFlatList; }
12
+ get: function () { return chunkIHVMNOS4_js.MotionFlatList; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionFlatList } from '../chunk-ZOBOKLAS.mjs';
2
- import '../chunk-HPJMIBBK.mjs';
3
- import '../chunk-Z3HCJ43H.mjs';
4
- import '../chunk-REYL77RE.mjs';
1
+ export { MotionFlatList } from '../chunk-EN4PN7X3.mjs';
2
+ import '../chunk-IX6SEOSK.mjs';
3
+ import '../chunk-MFAFB4K7.mjs';
4
+ import '../chunk-W7NTRSPD.mjs';
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkYUTS6JRU_js = require('../chunk-YUTS6JRU.js');
4
- require('../chunk-6V7MOBXO.js');
5
- require('../chunk-OBRGJAST.js');
6
- require('../chunk-PM6CVGXJ.js');
3
+ var chunkZ5USXWTE_js = require('../chunk-Z5USXWTE.js');
4
+ require('../chunk-E3ALFSH2.js');
5
+ require('../chunk-6AN5X3YE.js');
6
+ require('../chunk-WNVHPMBI.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionImage", {
11
11
  enumerable: true,
12
- get: function () { return chunkYUTS6JRU_js.MotionImage; }
12
+ get: function () { return chunkZ5USXWTE_js.MotionImage; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionImage } from '../chunk-KBFN4TRO.mjs';
2
- import '../chunk-HPJMIBBK.mjs';
3
- import '../chunk-Z3HCJ43H.mjs';
4
- import '../chunk-REYL77RE.mjs';
1
+ export { MotionImage } from '../chunk-6YIUETBF.mjs';
2
+ import '../chunk-IX6SEOSK.mjs';
3
+ import '../chunk-MFAFB4K7.mjs';
4
+ import '../chunk-W7NTRSPD.mjs';
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkWGCF3WQG_js = require('../chunk-WGCF3WQG.js');
4
- require('../chunk-6V7MOBXO.js');
5
- require('../chunk-OBRGJAST.js');
6
- require('../chunk-PM6CVGXJ.js');
3
+ var chunk6NOCY764_js = require('../chunk-6NOCY764.js');
4
+ require('../chunk-E3ALFSH2.js');
5
+ require('../chunk-6AN5X3YE.js');
6
+ require('../chunk-WNVHPMBI.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionPressable", {
11
11
  enumerable: true,
12
- get: function () { return chunkWGCF3WQG_js.MotionPressable; }
12
+ get: function () { return chunk6NOCY764_js.MotionPressable; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionPressable } from '../chunk-52QSN2VQ.mjs';
2
- import '../chunk-HPJMIBBK.mjs';
3
- import '../chunk-Z3HCJ43H.mjs';
4
- import '../chunk-REYL77RE.mjs';
1
+ export { MotionPressable } from '../chunk-JBK5ZLMH.mjs';
2
+ import '../chunk-IX6SEOSK.mjs';
3
+ import '../chunk-MFAFB4K7.mjs';
4
+ import '../chunk-W7NTRSPD.mjs';
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkQYR66E2G_js = require('../chunk-QYR66E2G.js');
4
- require('../chunk-6V7MOBXO.js');
5
- require('../chunk-OBRGJAST.js');
6
- require('../chunk-PM6CVGXJ.js');
3
+ var chunkZBHQPVWE_js = require('../chunk-ZBHQPVWE.js');
4
+ require('../chunk-E3ALFSH2.js');
5
+ require('../chunk-6AN5X3YE.js');
6
+ require('../chunk-WNVHPMBI.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionScrollView", {
11
11
  enumerable: true,
12
- get: function () { return chunkQYR66E2G_js.MotionScrollView; }
12
+ get: function () { return chunkZBHQPVWE_js.MotionScrollView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionScrollView } from '../chunk-VSK2E35J.mjs';
2
- import '../chunk-HPJMIBBK.mjs';
3
- import '../chunk-Z3HCJ43H.mjs';
4
- import '../chunk-REYL77RE.mjs';
1
+ export { MotionScrollView } from '../chunk-M4766VUV.mjs';
2
+ import '../chunk-IX6SEOSK.mjs';
3
+ import '../chunk-MFAFB4K7.mjs';
4
+ import '../chunk-W7NTRSPD.mjs';
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkZSOCRHU3_js = require('../chunk-ZSOCRHU3.js');
4
- require('../chunk-6V7MOBXO.js');
5
- require('../chunk-OBRGJAST.js');
6
- require('../chunk-PM6CVGXJ.js');
3
+ var chunk4XBX7KOD_js = require('../chunk-4XBX7KOD.js');
4
+ require('../chunk-E3ALFSH2.js');
5
+ require('../chunk-6AN5X3YE.js');
6
+ require('../chunk-WNVHPMBI.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionText", {
11
11
  enumerable: true,
12
- get: function () { return chunkZSOCRHU3_js.MotionText; }
12
+ get: function () { return chunk4XBX7KOD_js.MotionText; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionText } from '../chunk-WMLS4TMX.mjs';
2
- import '../chunk-HPJMIBBK.mjs';
3
- import '../chunk-Z3HCJ43H.mjs';
4
- import '../chunk-REYL77RE.mjs';
1
+ export { MotionText } from '../chunk-QNLSCOR5.mjs';
2
+ import '../chunk-IX6SEOSK.mjs';
3
+ import '../chunk-MFAFB4K7.mjs';
4
+ import '../chunk-W7NTRSPD.mjs';
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkNPJ46457_js = require('../chunk-NPJ46457.js');
4
- require('../chunk-6V7MOBXO.js');
5
- require('../chunk-OBRGJAST.js');
6
- require('../chunk-PM6CVGXJ.js');
3
+ var chunk24NUL23E_js = require('../chunk-24NUL23E.js');
4
+ require('../chunk-E3ALFSH2.js');
5
+ require('../chunk-6AN5X3YE.js');
6
+ require('../chunk-WNVHPMBI.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionView", {
11
11
  enumerable: true,
12
- get: function () { return chunkNPJ46457_js.MotionView; }
12
+ get: function () { return chunk24NUL23E_js.MotionView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionView } from '../chunk-RUIOM2YZ.mjs';
2
- import '../chunk-HPJMIBBK.mjs';
3
- import '../chunk-Z3HCJ43H.mjs';
4
- import '../chunk-REYL77RE.mjs';
1
+ export { MotionView } from '../chunk-GSUC4HWP.mjs';
2
+ import '../chunk-IX6SEOSK.mjs';
3
+ import '../chunk-MFAFB4K7.mjs';
4
+ import '../chunk-W7NTRSPD.mjs';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkPM6CVGXJ_js = require('../chunk-PM6CVGXJ.js');
3
+ var chunkWNVHPMBI_js = require('../chunk-WNVHPMBI.js');
4
4
  var react = require('react');
5
5
  var reactNative = require('react-native');
6
6
  var reactNativeReanimated = require('react-native-reanimated');
@@ -48,14 +48,14 @@ function useTouchDrag(options = {}) {
48
48
  if (result) {
49
49
  if (result.x && lockX) {
50
50
  const toX = "to" in result.x ? result.x.to : x;
51
- dragX.value = chunkPM6CVGXJ_js.buildReleaseAnimation(
51
+ dragX.value = chunkWNVHPMBI_js.buildReleaseAnimation(
52
52
  result.x,
53
53
  toX
54
54
  );
55
55
  }
56
56
  if (result.y && lockY) {
57
57
  const toY = "to" in result.y ? result.y.to : y;
58
- dragY.value = chunkPM6CVGXJ_js.buildReleaseAnimation(
58
+ dragY.value = chunkWNVHPMBI_js.buildReleaseAnimation(
59
59
  result.y,
60
60
  toY
61
61
  );
@@ -1,4 +1,4 @@
1
- import { buildReleaseAnimation } from '../chunk-REYL77RE.mjs';
1
+ import { buildReleaseAnimation } from '../chunk-W7NTRSPD.mjs';
2
2
  import { useMemo } from 'react';
3
3
  import { PanResponder } from 'react-native';
4
4
  import { useSharedValue, useAnimatedStyle } from 'react-native-reanimated';
package/llms.txt CHANGED
@@ -10,12 +10,28 @@ pnpm add @rootnative/inertia react-native-reanimated
10
10
 
11
11
  Enable the Reanimated Babel plugin per its install guide.
12
12
 
13
+ ## Which package has what
14
+
15
+ The core package does not contain the gesture hooks, the gradient primitive, or the SVG primitives. Each is a separate install. `useSwipe` and `useDrag` are **not** in core — a swipe deck needs `@rootnative/inertia-gestures`.
16
+
17
+ | You want | Package | Extra peer dependency |
18
+ | --- | --- | --- |
19
+ | `Motion.*`, `Presence`, `Stagger`, `MotionConfig`, every value-layer hook | `@rootnative/inertia` | — (core, always required) |
20
+ | `useDrag`, `useSwipe`, `usePan` | `@rootnative/inertia-gestures` | `react-native-gesture-handler` |
21
+ | Animatable linear gradients | `@rootnative/inertia-gradients` | `expo-linear-gradient` |
22
+ | Animatable SVG paths and shapes | `@rootnative/inertia-svg` | `react-native-svg` |
23
+
24
+ `useTouchDrag` is the exception: a drag hook in **core**, under the `@rootnative/inertia/touch` subpath, because PanResponder is built into React Native. Use it for drag without `react-native-gesture-handler`, or when the drag needs keyboard accessibility.
25
+
26
+ All four packages ship in **lockstep** — same version, released together. Install the same version of every `@rootnative/inertia*` package you use. Two things that mislead: the `@rootnative/core` and `@rootnative/components` packages of RootNative UI are a different library on a different version line, and `npm view` shows an `alpha` dist-tag on these packages that is **older** than `latest` (a prerelease leftover — follow `latest`).
27
+
13
28
  ## Imports
14
29
 
15
30
  ```ts
16
31
  import {
17
32
  Motion,
18
33
  Presence,
34
+ Stagger,
19
35
  MotionConfig,
20
36
  useGesture,
21
37
  useVariants,
@@ -50,6 +66,7 @@ import { MotionFlatList } from '@rootnative/inertia/flat-list'
50
66
 
51
67
  - `Motion.View` / `Motion.Text` / `Motion.Image` / `Motion.Pressable` / `Motion.ScrollView` / `Motion.FlatList` — animatable primitives. Per-primitive style inference (no shared `ViewStyle & TextStyle & ImageStyle` fallback). `Motion.FlatList` is the **virtualized** animated scroller: it takes `useScroll`'s `onScroll` handler and keeps `data` / `renderItem` item-type inference, so a long list can virtualize and animate at once. Animation props apply to the scroll container; animate rows with a `Motion.*` inside `renderItem`.
52
68
  - `<Presence>` — mount / unmount transitions; children need explicit `key`s. Exiting children get `pointerEvents: 'none'` automatically.
69
+ - `<Stagger interval delay? from? enabled?>` — assigns each child a delay of `delay + position * interval` (ms), applied to the declarative animations (`initial` → `animate`, later `animate` changes) of every `Motion.*` primitive in that child's subtree. `from='last'` reverses the cascade; `enabled={false}` zeroes every delay (the "cascade in, snap out" switch). Composes with the child's own `transition.delay`; never delays `gesture` feedback, `<Presence>` exits, or reduced-motion snaps. Renders no host view. Custom animated components read the slot's delay with `useStaggerDelay()`.
53
70
  - `<MotionConfig reducedMotion="user" | "never" | "always" transitions={{ name: TransitionConfig }}>` — gates motion against the OS reduce-motion setting (default `"user"`) and registers named transitions for the subtree. A registered name is accepted anywhere a `TransitionConfig` is: the `transition` prop (top-level and per-property/per-layer), the `layout` prop, and the value-layer hooks (`transition="selection"`, `useBooleanSpring(checked, 'selection')`). Nested providers merge (child overrides per name); unknown names warn in dev and fall back to the default spring. Names are consumer vocabulary — no presets ship with the library. Optional compile-time narrowing via `declare module '@rootnative/inertia' { interface RegisteredTransitions { ... } }`. Custom components join the registry with `useNamedTransitions()` + `resolveNamedTransition(input, registry)`.
54
71
  - `useGesture(transition?)` — hook-form of the `gesture` prop. Returns 0↔1 progress shared values (`pressed`, `focused`, `focusVisible`, `hovered`) plus a `handlers` bag to spread on a `Pressable`. Use when one gesture needs to drive multiple animated siblings (focus rings, MD3 state-layer halos, multi-element compositions).
55
72
  - `useGestureLayer(states, options?)` — opt-in helper at `@rootnative/inertia/gesture-layer` for the **strongest-active-layer-wins** composition (MD3 state-layer haloes, iOS-translucent overlays). Supply per-state target maps (`rest` / `hovered` / `focused` / `focusVisible` / `pressed` / `disabled`); the hook owns the worklet. Numeric keys compose via clamped-max with `rest` as the floor; color keys compose via priority cascade with `interpolateColor`; `disabled` (JS-side flag) overrides every gesture layer. Returns `{ style, handlers, states }` — `states` is the per-state 0↔1 progress shared values (`hovered` / `focused` / `focusVisible` / `pressed` / `disabled`) behind the composed style, for deriving extra styles (e.g. `useShadow({ progress: states.hovered })`) from the same gesture wiring. Reach for plain `useGesture` for additive blends or per-key custom rules.
@@ -63,7 +80,7 @@ import { MotionFlatList } from '@rootnative/inertia/flat-list'
63
80
  - `useShadow({ from, to, progress })` — pure value-layer interpolator between two `ShadowConfig`s (`shadowOpacity` / `shadowRadius` / `shadowOffset` / `elevation` / `shadowColor`, plus `boxShadow` as a CSS string or `BoxShadowLayer[]` — the shadow surface on web and RN 0.76+ new-arch; multi-layer, CSS-transition padding semantics, malformed strings throw at setup) driven by a `SharedValue<number>` (0→1). Returns an animated style fragment to spread onto `style`; only emits keys present on either side, absent sides default to natural zero. The hook does not animate on its own — drive `progress` with a spring, a scroll-derived `useTransform`, or any other shared value source.
64
81
  - `useColorTransition(progress, [from, to], options?)` — pure value-layer interpolator for a single color channel, driven by a `SharedValue<number>` (0→1). Returns an animated style fragment with one color key (default `backgroundColor`; configurable via `options.key` to `color` / `borderColor` / `tintColor` / `shadowColor` / per-side border colors). For raw `SharedValue<string>` output, use `useTransform(progress, [0, 1], [from, to])` instead.
65
82
  - `useColorCascade(rest, layers, options?)` — pure value-layer interpolator compositing a **priority-ordered** stack of color layers over a base `rest` color; each `layers` entry is `{ progress: SharedValue<number>, color: string }`, later entries win as their progress rises (equivalent to the nested `focus(error(hover(rest)))` `interpolateColor` chain). `options.key` reuses `ColorStyleKey` (default `backgroundColor`). Returns a spreadable animated style fragment; memoized on a colors+key signature. Color-only by design — cascade a numeric key separately via `useInterpolatedStyle` + `useTransform` max. `useColorTransition` stays the single-layer fast path.
66
- - `useInterpolatedStyle(progress, map, options?)` — pure value-layer interpolator mapping one `SharedValue<number>` onto **N** style props at once, returned as a spreadable animated style fragment (the multi-key, style-fragment counterpart to `useTransform`'s output-range form). Numeric keys (`opacity` / `height` / `fontSize` / …) route through `interpolate`; transform keys (`translateX` / `scale` / `rotate` / …) lift into a `transform` array in map key-order (`rotate*` emit `'<n>deg'`); color keys (`backgroundColor` / `borderColor` / …) route through `interpolateColor` (a multi-stop `useColorTransition`). Stop types are compile-checked. `options.inputRange` (default `[0,1]` / evenly-spaced) and `options.extrapolate` (default `'clamp'`) apply to every key. Memoized on an order-preserving signature. For function-valued or multi-source composition, drop to `useTransform`'s worklet form or a hand-rolled `useAnimatedStyle`.
83
+ - `useInterpolatedStyle(progress, map, options?)` — pure value-layer interpolator mapping one `SharedValue<number>` onto **N** style props at once, returned as a spreadable animated style fragment (the multi-key, style-fragment counterpart to `useTransform`'s output-range form). Numeric keys (`opacity` / `height` / `fontSize` / …) route through `interpolate`; transform keys (`translateX` / `scale` / `rotate` / …) lift into a `transform` array in map key-order (`rotate*` emit `'<n>deg'`); color keys (`backgroundColor` / `borderColor` / …) route through `interpolateColor` (a multi-stop `useColorTransition`). Stop types are compile-checked. **The return type is derived from the map's own keys (`InterpolatedStyle<K>`), so it narrows to the right style family and needs no cast in a `style` array** — view keys satisfy `StyleProp<ViewStyle>`, text-metric keys (`fontSize` / `lineHeight` / `letterSpacing`) satisfy `StyleProp<TextStyle>`, `tintColor` satisfies `StyleProp<ImageStyle>`, and transform keys collapse into the emitted `transform` array. (Reanimated's `useAnimatedStyle` returns the `DefaultStyle` union, whose `TextStyle` member fails against `ViewStyle` on `cursor` inside a style array.) `options.inputRange` (default `[0,1]` / evenly-spaced) and `options.extrapolate` (default `'clamp'`) apply to every key. Memoized on an order-preserving signature. For function-valued or multi-source composition, drop to `useTransform`'s worklet form or a hand-rolled `useAnimatedStyle`.
67
84
  - `useScroll()` — returns `{ scrollX, scrollY, onScroll }` for use with `Motion.ScrollView` or `Motion.FlatList`. Scroll events fire on the UI thread. Set `scrollEventThrottle={16}` on a `Motion.ScrollView`; `Motion.FlatList` defaults it to 1.
68
85
  - `createMotionComponent<C>(C)` — wrap any component with the same Motion prop surface, inferring style from `C`.
69
86
  - `buildReleaseAnimation(transition, toValue)` — worklet-safe single-step animation builder (spring / timing / decay / no-animation). For assigning Inertia-resolved animations to shared values from inside a gesture worklet. Used internally by `@rootnative/inertia-gestures`'s `useDrag({ onRelease })`.
@@ -153,7 +170,7 @@ Auto-layout transitions ship via the `layout` prop (`true` / `TransitionConfig`)
153
170
 
154
171
  - `@rootnative/inertia-gradients` — `MotionLinearGradient` over `expo-linear-gradient`. Animatable: `colors`, `start`, `end`, `locations`.
155
172
  - `@rootnative/inertia-svg` — animatable SVG primitives over `react-native-svg`, all under the `MotionSvg` namespace (`MotionSvg.Path` / `.Circle` / `.Rect` / `.Line`) or as direct imports. `MotionPath` animates `d` (path morphing on structurally-compatible paths — same command sequence after implicit-repeat expansion; remount with `key` to switch shape), `fill`, `stroke`, `strokeWidth`, opacities, `strokeDashoffset`. `MotionCircle` / `MotionRect` / `MotionLine` animate their geometry props, paints, and `strokeDasharray` (element-wise; array length locked at mount). `createMotionSvgComponent(Component, { animatableProps, colorProps, arrayProps })` — the factory behind the prebuilt shapes — wraps any other `react-native-svg` element with the same `initial` / `animate` / `transition` surface; `transition` accepts named transitions from the nearest `<MotionConfig transitions>` (top-level and per-property).
156
- - `@rootnative/inertia-gestures` — `useDrag`, `useSwipe`, `usePan` over `react-native-gesture-handler`. `useDrag` accepts an `onRelease` worklet that returns per-axis Inertia release transitions (snap-to-tick spring, decay with bounds, etc.) — the release velocity stays on the UI thread, no JS round-trip.
173
+ - `@rootnative/inertia-gestures` — `useDrag`, `useSwipe`, `usePan` over `react-native-gesture-handler`. `useDrag` accepts an `onRelease` worklet that returns per-axis Inertia release transitions (snap-to-tick spring, decay with bounds, etc.) — the release velocity stays on the UI thread, no JS round-trip. `useSwipe`'s snap-back is configurable (`releaseTransition`, inline or a named transition, release velocity passed in), and a committed swipe can exit the screen instead of snapping back: `onCommit` (UI-thread worklet, returns per-axis exit transitions) + `onSwipeEnd` (JS thread, fires when the release animation settles) — the card-deck shape.
157
174
 
158
175
  ## Docs
159
176
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/inertia",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Declarative animation primitives for React Native, built on react-native-reanimated.",
5
5
  "license": "MIT",
6
6
  "author": "RootNative",
package/src/index.ts CHANGED
@@ -33,12 +33,16 @@ export type {
33
33
  } from './config'
34
34
  export { Presence, usePresence } from './presence'
35
35
  export type { PresenceContextValue } from './presence'
36
+ export { Stagger, useStaggerDelay } from './stagger'
37
+ export type { StaggerProps } from './stagger'
36
38
  export {
39
+ applyDelay,
37
40
  buildReleaseAnimation,
38
41
  cubicBezier,
39
42
  resolveTransition,
40
43
  resolveAnimatableValue,
41
44
  ensureWorkletEasing,
45
+ type AnimationCallback,
42
46
  } from './transitions'
43
47
  // Seed value for any color shared value a custom animated component drives
44
48
  // through `resolveTransition`. Exported because the obvious choice —
@@ -70,6 +74,7 @@ export type {
70
74
  ColorCascadeLayer,
71
75
  ColorStyleKey,
72
76
  ExtrapolationMode,
77
+ InterpolatedStyle,
73
78
  InterpolatedStyleMap,
74
79
  NumericStyleKey,
75
80
  ShadowConfig,