@rootnative/inertia 0.0.6 → 0.0.8

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 (79) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/README.md +7 -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-5MGWHOSV.js → chunk-6NOCY764.js} +2 -2
  7. package/dist/{chunk-PFPO7DX2.mjs → chunk-6YIUETBF.mjs} +1 -1
  8. package/dist/{chunk-767UKZXG.js → chunk-E3ALFSH2.js} +76 -33
  9. package/dist/chunk-EN4PN7X3.mjs +22 -0
  10. package/dist/{chunk-CMHVF6F4.mjs → chunk-GSUC4HWP.mjs} +1 -1
  11. package/dist/chunk-IHVMNOS4.js +28 -0
  12. package/dist/{chunk-2ICQLWH2.mjs → chunk-IX6SEOSK.mjs} +53 -12
  13. package/dist/{chunk-C3EDC5ZW.mjs → chunk-JBK5ZLMH.mjs} +1 -1
  14. package/dist/{chunk-OW5XTGVN.mjs → chunk-L4JFECXU.mjs} +2 -2
  15. package/dist/{chunk-BAAQI37F.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-F7LJX56B.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-X7B5WR5A.js → chunk-ZBHQPVWE.js} +2 -2
  23. package/dist/gestureLayer/index.d.mts +2 -2
  24. package/dist/gestureLayer/index.d.ts +2 -2
  25. package/dist/gestureLayer/index.js +10 -10
  26. package/dist/gestureLayer/index.mjs +3 -3
  27. package/dist/index.d.mts +89 -10
  28. package/dist/index.d.ts +89 -10
  29. package/dist/index.js +67 -49
  30. package/dist/index.mjs +21 -18
  31. package/dist/motion/FlatList.d.mts +53 -0
  32. package/dist/motion/FlatList.d.ts +53 -0
  33. package/dist/motion/FlatList.js +13 -0
  34. package/dist/motion/FlatList.mjs +4 -0
  35. package/dist/motion/Image.d.mts +1 -1
  36. package/dist/motion/Image.d.ts +1 -1
  37. package/dist/motion/Image.js +5 -5
  38. package/dist/motion/Image.mjs +4 -4
  39. package/dist/motion/Pressable.d.mts +1 -1
  40. package/dist/motion/Pressable.d.ts +1 -1
  41. package/dist/motion/Pressable.js +5 -5
  42. package/dist/motion/Pressable.mjs +4 -4
  43. package/dist/motion/ScrollView.d.mts +1 -1
  44. package/dist/motion/ScrollView.d.ts +1 -1
  45. package/dist/motion/ScrollView.js +5 -5
  46. package/dist/motion/ScrollView.mjs +4 -4
  47. package/dist/motion/Text.d.mts +1 -1
  48. package/dist/motion/Text.d.ts +1 -1
  49. package/dist/motion/Text.js +5 -5
  50. package/dist/motion/Text.mjs +4 -4
  51. package/dist/motion/View.d.mts +1 -1
  52. package/dist/motion/View.d.ts +1 -1
  53. package/dist/motion/View.js +5 -5
  54. package/dist/motion/View.mjs +4 -4
  55. package/dist/touch/index.d.mts +1 -1
  56. package/dist/touch/index.d.ts +1 -1
  57. package/dist/touch/index.js +3 -3
  58. package/dist/touch/index.mjs +1 -1
  59. package/dist/{types-BQgLJeQG.d.mts → types-DyJpG64F.d.mts} +1 -1
  60. package/dist/{types-BQgLJeQG.d.ts → types-DyJpG64F.d.ts} +1 -1
  61. package/dist/{useGesture-DfaTx-3t.d.mts → useGesture-CnZQnYHH.d.mts} +1 -1
  62. package/dist/{useGesture-B0_CzOUz.d.ts → useGesture-DbH46EBp.d.ts} +1 -1
  63. package/jest-setup.js +7 -1
  64. package/llms.txt +25 -4
  65. package/package.json +8 -1
  66. package/src/index.ts +5 -0
  67. package/src/motion/FlatList.tsx +77 -0
  68. package/src/motion/createMotionComponent.tsx +68 -10
  69. package/src/motion/index.ts +3 -0
  70. package/src/stagger/Stagger.tsx +75 -0
  71. package/src/stagger/StaggerContext.ts +25 -0
  72. package/src/stagger/index.ts +2 -0
  73. package/src/transitions/index.ts +6 -1
  74. package/src/transitions/resolve.ts +7 -1
  75. package/src/transitions/runtime.ts +22 -7
  76. package/src/values/useScroll.ts +9 -5
  77. package/dist/chunk-FWWVHLXB.js +0 -8
  78. package/dist/chunk-K5SI6VXS.js +0 -8
  79. package/dist/chunk-STARIT6W.js +0 -8
package/CHANGELOG.md CHANGED
@@ -4,6 +4,54 @@ All notable changes to `@rootnative/inertia` are documented here. The format fol
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.0.8] - 2026-08-16
8
+
9
+ ### Added
10
+
11
+ - **`<Stagger>` — parent-owned delays for a cascading list entrance.** Wrapping a list in `<Stagger interval={60}>` assigns each child a delay of `delay + position * interval` milliseconds, applied to the declarative animations (the `initial` → `animate` mount and any later `animate` change) of every `Motion.*` primitive in that child's subtree. No child computes `index * ms` itself, which removes the two structural problems of the per-child form: a list that filters or reorders staggers from stale indices, and the cascade cannot be turned off in one place. Positions re-derive from render order every render, `from="last"` reverses the cascade, and `enabled={false}` zeroes every delay — pass `enabled={revealed}` and the reveal cascades while the hide animates together.
12
+
13
+ The delay wraps each key's fully resolved animation exactly once, on the JS thread — never merged into the base transition config, which a keyframe sequence would re-apply per step. It composes with the child's own `transition.delay` (the two add). It deliberately does not delay `gesture` sub-state feedback (press feedback delayed by list position reads as lag), `<Presence>` exits (a positional delay holds `safeToRemove` — and therefore the unmount — hostage to the cascade), or reduced-motion snaps (a deferred snap is still choreography).
14
+
15
+ `<Stagger>` renders no host view — only per-child context providers, so it composes with any layout. Custom animated components built on `resolveTransition` / `resolveAnimatableValue` can participate through the new `useStaggerDelay()` hook, and `applyDelay(animation, ms)` is now exported alongside the other transition utilities.
16
+
17
+ Surfaced by the `purrfect-match` validation consumer (DX feedback entry 13), generalized here per the audience-and-scope rule: the shape follows Framer Motion's `staggerChildren` / `delayChildren`, renamed to `interval` / `delay` because the component's own name already says "children".
18
+
19
+ - **`buildReleaseAnimation` accepts a settle callback.** A third, optional `callback` parameter — the same `(finished) => void` shape Reanimated's `with*` factories accept — is forwarded to the underlying `withSpring` / `withTiming` / `withDecay` call and fires once when the animation settles. For `no-animation` it fires synchronously with `finished: true`, since a direct assignment has no settle point of its own. Existing two-argument call sites are unchanged.
20
+
21
+ This is the primitive behind `useSwipe`'s new `onSwipeEnd` in `@rootnative/inertia-gestures`: a gesture-release worklet can now learn when its release animation has finished without polling a shared value. The `AnimationCallback` type is exported from the root barrel alongside it.
22
+
23
+ ## [0.0.7] - 2026-08-14
24
+
25
+ ### Added
26
+
27
+ - **`Motion.FlatList` — a virtualized animated scroller.** Reachable from the `Motion` namespace, as the named export `MotionFlatList`, and through the new `@rootnative/inertia/flat-list` subpath.
28
+
29
+ It closes a gap that forced a real architectural compromise on consumers: `useScroll`'s `onScroll` is a worklet handler, which only functions on a Reanimated animated component, and until now the only animated scroller was `Motion.ScrollView` — which mounts every row. A long list could virtualize (a plain `FlatList`, no animation) or animate from scroll position (`Motion.ScrollView`, every row mounted), not both. Nothing about `useScroll` was ever specific to `ScrollView`; the primitive was simply missing.
30
+
31
+ Animation props apply to the scroll **container**, matching `Motion.ScrollView`. Rows animate via a `Motion.*` primitive inside `renderItem`, which is what makes scroll-driven row effects work. The `layout` prop animates the list frame; Reanimated's `itemLayoutAnimation` is forwarded untouched for per-row layout animation.
32
+
33
+ Typing keeps both inference paths that a naive wrapper loses. `createMotionComponent<C>` returns a non-generic component, so `data` / `renderItem` would collapse to `any` — the item type is restored with a generic call signature, the same fix Reanimated applies to its own `Animated.FlatList`. The variants map is a **second** generic on that one signature, so `animate="typo"` against a `variants` prop stays a compile error here exactly as on every other primitive; declaring only the item generic would have silently dropped that narrowing on this primitive alone.
34
+
35
+ Built on Reanimated's `Animated.FlatList` rather than RN's `FlatList`, which supplies the `CellRendererComponent` injection behind `itemLayoutAnimation` and defaults `scrollEventThrottle` to 1 — so a `useScroll` handler reports every frame with no extra prop.
36
+
37
+ **Bundle cost: 9.10 kB for the new subpath, +0.04 kB on the root entry**, and nothing on existing subpaths. The cheapest primitive added so far: it is almost entirely the shared factory, adding no parser, no interpolation, and no worklet branch.
38
+
39
+ ### Fixed
40
+
41
+ - **`gesture={{ pressed: … }}` now responds to a mouse on web.** On any primitive that isn't a `Pressable` — a plain `Motion.View`, `Motion.Text`, `Motion.Image` — the pressed layer never engaged under a desktop click. It has been inert on web since the `gesture` prop shipped in `0.0.1`.
42
+
43
+ The cause is which events the layer was wired to. `pressed` was driven by `onTouchStart` / `onTouchEnd` plus `onPressIn` / `onPressOut`. The press pair only exists on `Pressable`-style hosts, and react-native-web forwards `onTouchStart` to the DOM as a real `touchstart` listener — which a mouse never fires. So `Motion.Pressable` worked (it has the press path) while every other primitive had no live path at all for a pointer that isn't a finger.
44
+
45
+ The layer now also listens on `onPointerDown` / `onPointerUp` / `onPointerCancel`, which react-native-web forwards and which cover mouse, pen, and touch alike. `pressed` means "any pointer" on every platform. `onPointerCancel` is included so a browser-initiated takeover (a scroll or drag beginning mid-press) releases the layer instead of leaving it stuck on.
46
+
47
+ A web touch emits both `touchstart` and `pointerdown`; both set the same flag to the same value, so the overlap is idempotent rather than a double-toggle. React Native has no pointer props, so the added handlers are inert on iOS and Android. `hovered`, `focused`, and `focusVisible` were never affected — their events are forwarded on every primitive.
48
+
49
+ **Bundle cost: +0.06 kB (+0.7%) per primitive subpath**, 9.05 → 9.11 kB brotlied, +0.04 kB on the root entry. No `size-limit` cap moved. Handlers are still mounted only when `pressed` is declared, so the gesture-less path is unchanged.
50
+
51
+ ### Internal
52
+
53
+ - **`pressed-modalities.test.tsx` asserts each input modality separately.** Every pre-existing gesture test fires `pressIn` — the one path that already worked on every platform — which is why a six-release gap in the touch and pointer paths went unseen. The new file drives touch, pointer, and press independently, plus the cancel path, the both-events-at-once overlap, composition with a consumer's own pointer handlers, and the guarantee that no pointer handler is mounted when `pressed` isn't declared.
54
+
7
55
  ## [0.0.6] - 2026-08-08
8
56
 
9
57
  **Defect release: two animations that never ran.** Both trace to one assumption about what Reanimated accepts as an animatable value, and both were hidden by the same thing — `type: 'timing'` snaps to its target when the duration elapses, so a total interpolation failure still produced the right end state. `animate={{ boxShadow }}` was inert under the default spring; every colour key was inert when it rested at its default, which is the far more common path. Neither is caught by a mocked test suite, so this release also adds a test file that runs Reanimated's real drivers.
@@ -225,7 +273,9 @@ Initial alpha publish. The full initial surface is in place; APIs are still subj
225
273
  - SVG path morphing, gradient interpolation, and shared-element transitions across screens are out of scope until `0.2.x` / `1.x` per the roadmap.
226
274
  - `react-native-gesture-handler` integration (drag, pan, swipe sub-states) lands in `0.2` via the optional `@rootnative/inertia-gestures` adapter.
227
275
 
228
- [unreleased]: https://github.com/rootnative/inertia/compare/core+gestures+gradients+svg@0.0.6...HEAD
276
+ [unreleased]: https://github.com/rootnative/inertia/compare/core+gestures+gradients+svg@0.0.8...HEAD
277
+ [0.0.8]: https://github.com/rootnative/inertia/releases/tag/core+gestures+gradients+svg@0.0.8
278
+ [0.0.7]: https://github.com/rootnative/inertia/releases/tag/core+gestures+gradients+svg@0.0.7
229
279
  [0.0.6]: https://github.com/rootnative/inertia/releases/tag/core+gestures+gradients+svg@0.0.6
230
280
  [0.0.5]: https://github.com/rootnative/inertia/releases/tag/core+gestures+gradients+svg@0.0.5
231
281
  [0.0.4]: https://github.com/rootnative/inertia/releases/tag/core+gestures+gradients+svg@0.0.4
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ <!--
2
+ Absolute URL, not a relative path: this README is the npm package page, and
3
+ npm does not resolve repository-relative image paths.
4
+ -->
5
+ <img src="https://raw.githubusercontent.com/rootnative/inertia/main/assets/brand/inertia-mark.png" alt="" width="88" height="88" />
6
+
1
7
  # @rootnative/inertia
2
8
 
3
9
  [![npm](https://img.shields.io/npm/v/@rootnative/inertia.svg)](https://www.npmjs.com/package/@rootnative/inertia)
@@ -6,7 +12,7 @@
6
12
 
7
13
  Declarative animation primitives for React Native, built as a thin wrapper around [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/). Inspired by Framer Motion (web) and react-spring (cross-platform).
8
14
 
9
- > **Status:** `0.0.6` — stable. Pre-`1.0.0` minor versions may break — see the root [README](https://github.com/rootnative/inertia#versioning--release).
15
+ > **Status:** `0.0.8` — stable. Pre-`1.0.0` minor versions may break — see the root [README](https://github.com/rootnative/inertia#versioning--release).
10
16
 
11
17
  ## Install
12
18
 
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var chunkE3ALFSH2_js = require('./chunk-E3ALFSH2.js');
4
+ var reactNative = require('react-native');
5
+
6
+ var MotionView = chunkE3ALFSH2_js.createMotionComponent(reactNative.View);
7
+
8
+ exports.MotionView = MotionView;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var chunkE3ALFSH2_js = require('./chunk-E3ALFSH2.js');
4
+ var reactNative = require('react-native');
5
+
6
+ var MotionText = chunkE3ALFSH2_js.createMotionComponent(reactNative.Text);
7
+
8
+ exports.MotionText = MotionText;
@@ -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 reactNativeReanimated = require('react-native-reanimated');
6
6
  var jsxRuntime = require('react/jsx-runtime');
@@ -32,7 +32,7 @@ function MotionConfig({
32
32
  children
33
33
  }) {
34
34
  const parent = useMotionConfig();
35
- const transitionsSig = chunkPM6CVGXJ_js.stableSig(transitions);
35
+ const transitionsSig = chunkWNVHPMBI_js.stableSig(transitions);
36
36
  const value = react.useMemo(
37
37
  () => ({
38
38
  reducedMotion: reducedMotion ?? parent.reducedMotion,
@@ -66,7 +66,7 @@ function resolveNamedTransitionProp(transition, registry) {
66
66
  if (typeof transition === "string") {
67
67
  return lookupNamedTransition(transition, registry);
68
68
  }
69
- if (chunkPM6CVGXJ_js.isTopLevelTransition(transition)) return transition;
69
+ if (chunkWNVHPMBI_js.isTopLevelTransition(transition)) return transition;
70
70
  const map = transition;
71
71
  let out = null;
72
72
  for (const key in map) {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk767UKZXG_js = require('./chunk-767UKZXG.js');
3
+ var chunkE3ALFSH2_js = require('./chunk-E3ALFSH2.js');
4
4
  var reactNative = require('react-native');
5
5
 
6
- var MotionPressable = chunk767UKZXG_js.createMotionComponent(reactNative.Pressable);
6
+ var MotionPressable = chunkE3ALFSH2_js.createMotionComponent(reactNative.Pressable);
7
7
 
8
8
  exports.MotionPressable = MotionPressable;
@@ -1,4 +1,4 @@
1
- import { createMotionComponent } from './chunk-2ICQLWH2.mjs';
1
+ import { createMotionComponent } from './chunk-IX6SEOSK.mjs';
2
2
  import { Image } from 'react-native';
3
3
 
4
4
  var MotionImage = createMotionComponent(Image);
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkOBRGJAST_js = require('./chunk-OBRGJAST.js');
4
- var chunkPM6CVGXJ_js = require('./chunk-PM6CVGXJ.js');
3
+ var chunk6AN5X3YE_js = require('./chunk-6AN5X3YE.js');
4
+ var chunkWNVHPMBI_js = require('./chunk-WNVHPMBI.js');
5
5
  var react = require('react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var Animated = require('react-native-reanimated');
@@ -159,6 +159,26 @@ function PresenceItem({
159
159
  );
160
160
  return /* @__PURE__ */ jsxRuntime.jsx(PresenceContext.Provider, { value, children });
161
161
  }
162
+ var StaggerContext = react.createContext(0);
163
+ function useStaggerDelay() {
164
+ return react.useContext(StaggerContext);
165
+ }
166
+ function Stagger({
167
+ children,
168
+ interval,
169
+ delay = 0,
170
+ from = "first",
171
+ enabled = true
172
+ }) {
173
+ const items = react.Children.toArray(children);
174
+ const count = items.length;
175
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: items.map((child, index) => {
176
+ const position = from === "last" ? count - 1 - index : index;
177
+ const childDelay = enabled ? delay + position * interval : 0;
178
+ const key = react.isValidElement(child) ? child.key ?? index : index;
179
+ return /* @__PURE__ */ jsxRuntime.jsx(StaggerContext.Provider, { value: childDelay, children: child }, key);
180
+ }) });
181
+ }
162
182
 
163
183
  // src/internal/boxShadow.ts
164
184
  var LENGTH = /^[+-]?(\d+\.?\d*|\.\d+)(px)?$/i;
@@ -345,14 +365,14 @@ function resolveLayoutTransition(layout) {
345
365
  if (cfg.type === "no-animation") return void 0;
346
366
  if (cfg.type === "timing") {
347
367
  let builder2 = Animated.LinearTransition.duration(cfg.duration ?? 300);
348
- const easing = chunkPM6CVGXJ_js.ensureWorkletEasing(cfg.easing);
368
+ const easing = chunkWNVHPMBI_js.ensureWorkletEasing(cfg.easing);
349
369
  if (easing) builder2 = builder2.easing(easing);
350
370
  if (cfg.delay) builder2 = builder2.delay(cfg.delay);
351
371
  return builder2;
352
372
  }
353
373
  const spring = cfg.type === "decay" ? { type: "spring" } : cfg;
354
- const { stiffness, damping, mass } = chunkPM6CVGXJ_js.springToReanimated({
355
- ...chunkPM6CVGXJ_js.DEFAULT_SPRING,
374
+ const { stiffness, damping, mass } = chunkWNVHPMBI_js.springToReanimated({
375
+ ...chunkWNVHPMBI_js.DEFAULT_SPRING,
356
376
  ...spring
357
377
  });
358
378
  let builder = Animated.LinearTransition.springify().stiffness(stiffness).damping(damping).mass(mass);
@@ -546,8 +566,8 @@ function legBuilder(transition) {
546
566
  Animated.withTiming(to, { duration })
547
567
  );
548
568
  }
549
- const springCfg = transition?.type === "spring" ? { ...chunkPM6CVGXJ_js.DEFAULT_SPRING, ...transition } : { type: "spring", ...chunkPM6CVGXJ_js.DEFAULT_SPRING };
550
- const springParams = chunkPM6CVGXJ_js.springToReanimated(springCfg);
569
+ const springCfg = transition?.type === "spring" ? { ...chunkWNVHPMBI_js.DEFAULT_SPRING, ...transition } : { type: "spring", ...chunkWNVHPMBI_js.DEFAULT_SPRING };
570
+ const springParams = chunkWNVHPMBI_js.springToReanimated(springCfg);
551
571
  return (from, to) => Animated.withSequence(
552
572
  Animated.withTiming(from, { duration: 0 }),
553
573
  Animated.withSpring(to, springParams)
@@ -833,14 +853,14 @@ var DEFAULT_RESTING = {
833
853
  function transitionFor(prop, transition) {
834
854
  if (!transition) return void 0;
835
855
  if (typeof transition === "string") return void 0;
836
- if (chunkPM6CVGXJ_js.isTopLevelTransition(transition)) return transition;
856
+ if (chunkWNVHPMBI_js.isTopLevelTransition(transition)) return transition;
837
857
  if (GESTURE_LAYER_NAME_SET.has(prop)) return void 0;
838
858
  return transition[prop];
839
859
  }
840
860
  function gestureLayerTransitionFor(layer, transition) {
841
861
  if (!transition) return void 0;
842
862
  if (typeof transition === "string") return void 0;
843
- if (chunkPM6CVGXJ_js.isTopLevelTransition(transition)) return transition;
863
+ if (chunkWNVHPMBI_js.isTopLevelTransition(transition)) return transition;
844
864
  return transition[layer];
845
865
  }
846
866
  function createMotionComponent(Component) {
@@ -890,12 +910,12 @@ function createMotionComponent(Component) {
890
910
  onLayout: userOnLayout,
891
911
  ...rest
892
912
  } = props;
893
- const namedTransitions = chunkOBRGJAST_js.useNamedTransitions();
894
- const transition = chunkOBRGJAST_js.resolveNamedTransitionProp(
913
+ const namedTransitions = chunk6AN5X3YE_js.useNamedTransitions();
914
+ const transition = chunk6AN5X3YE_js.resolveNamedTransitionProp(
895
915
  transitionProp,
896
916
  namedTransitions
897
917
  );
898
- const layout = typeof layoutProp === "string" ? chunkOBRGJAST_js.lookupNamedTransition(layoutProp, namedTransitions) : layoutProp;
918
+ const layout = typeof layoutProp === "string" ? chunk6AN5X3YE_js.lookupNamedTransition(layoutProp, namedTransitions) : layoutProp;
899
919
  if (__DEV__ && typeof style === "function") {
900
920
  throw new Error(
901
921
  "[inertia] `style` must be a style object or array of style objects, not a function. The function-form `style={(state) => ...}` Pressable API is not supported \u2014 use `gesture.pressed` (or `gesture.focused`, etc.) to drive state-dependent styling instead."
@@ -903,7 +923,8 @@ function createMotionComponent(Component) {
903
923
  }
904
924
  const presence = usePresence();
905
925
  const isExiting = presence !== null && presence.isPresent === false;
906
- const shouldReduceMotion = chunkOBRGJAST_js.useShouldReduceMotion();
926
+ const shouldReduceMotion = chunk6AN5X3YE_js.useShouldReduceMotion();
927
+ const staggerDelay = useStaggerDelay();
907
928
  const onAnimationEndRef = react.useRef(onAnimationEnd);
908
929
  onAnimationEndRef.current = onAnimationEnd;
909
930
  const variantKey = useControllerKey(controller);
@@ -987,7 +1008,7 @@ function createMotionComponent(Component) {
987
1008
  if (__DEV__ && hasBoxShadowRef.current && activeKeysRef.current.some(
988
1009
  (k) => k !== "boxShadow" && k.startsWith("shadow")
989
1010
  )) {
990
- chunkPM6CVGXJ_js.warnOnce(
1011
+ chunkWNVHPMBI_js.warnOnce(
991
1012
  "boxShadow-with-native-shadow",
992
1013
  "[inertia] `boxShadow` is animated alongside the native `shadow*` keys on the same element, which applies two shadow systems at once. Pick one: `boxShadow` for the cross-platform CSS form, or the native `shadow*` keys."
993
1014
  );
@@ -1055,7 +1076,7 @@ function createMotionComponent(Component) {
1055
1076
  const boxShadowInsets = Animated.useSharedValue(
1056
1077
  boxShadowSeedRef.current.insets
1057
1078
  );
1058
- const styleRestingSig = chunkPM6CVGXJ_js.stableSig(styleResting);
1079
+ const styleRestingSig = chunkWNVHPMBI_js.stableSig(styleResting);
1059
1080
  react.useEffect(() => {
1060
1081
  for (const key of activeKeysRef.current) {
1061
1082
  if (everDrivenRef.current.has(key)) continue;
@@ -1083,13 +1104,13 @@ function createMotionComponent(Component) {
1083
1104
  const gestureSV = Animated.useSharedValue(
1084
1105
  resolveGestureLayers(gesture)
1085
1106
  );
1086
- const gestureTargetsSig = chunkPM6CVGXJ_js.stableSig(gesture);
1107
+ const gestureTargetsSig = chunkWNVHPMBI_js.stableSig(gesture);
1087
1108
  react.useEffect(() => {
1088
1109
  gestureSV.value = resolveGestureLayers(gesture);
1089
1110
  }, [gestureTargetsSig]);
1090
1111
  const baseRecord = isExiting && exitRecord ? { ...animateRecord, ...exitRecord } : animateRecord;
1091
- const baseSig = chunkPM6CVGXJ_js.stableSig(baseRecord) + (isExiting ? "|exit" : "") + (shouldReduceMotion ? "|rm" : "");
1092
- const transitionSig = chunkPM6CVGXJ_js.stableSig(transition);
1112
+ const baseSig = chunkWNVHPMBI_js.stableSig(baseRecord) + (isExiting ? "|exit" : "") + (shouldReduceMotion ? "|rm" : "");
1113
+ const transitionSig = chunkWNVHPMBI_js.stableSig(transition);
1093
1114
  const safeToRemoveRef = react.useRef(void 0);
1094
1115
  safeToRemoveRef.current = presence?.safeToRemove;
1095
1116
  react.useEffect(() => {
@@ -1111,6 +1132,7 @@ function createMotionComponent(Component) {
1111
1132
  SHADOW_OFFSET_KEY_SET.has(key) ? "shadowOffset" : key,
1112
1133
  transition
1113
1134
  );
1135
+ const runStagger = shouldReduceMotion || isExiting || staggerDelay <= 0 ? 0 : staggerDelay;
1114
1136
  let transformPending = 0;
1115
1137
  for (const k of ALL_KEYS) {
1116
1138
  if (!TRANSFORM_KEY_SET.has(k) || baseRecord[k] === void 0) continue;
@@ -1129,6 +1151,7 @@ function createMotionComponent(Component) {
1129
1151
  boxShadowInsets,
1130
1152
  shadowTarget,
1131
1153
  cfg2,
1154
+ runStagger,
1132
1155
  makeKeyCallbackFactory(
1133
1156
  "boxShadow",
1134
1157
  sharedValues.boxShadow,
@@ -1162,10 +1185,13 @@ function createMotionComponent(Component) {
1162
1185
  isExiting ? onSettle : void 0,
1163
1186
  TRANSFORM_KEY_SET.has(key) ? transformGroup : void 0
1164
1187
  );
1165
- sharedValues[key].value = chunkPM6CVGXJ_js.resolveAnimatableValue(
1166
- COLOR_KEY_SET.has(key) ? normalizeAnimatableColorTarget(target) : target,
1167
- cfg,
1168
- factory
1188
+ sharedValues[key].value = chunkWNVHPMBI_js.applyDelay(
1189
+ chunkWNVHPMBI_js.resolveAnimatableValue(
1190
+ COLOR_KEY_SET.has(key) ? normalizeAnimatableColorTarget(target) : target,
1191
+ cfg,
1192
+ factory
1193
+ ),
1194
+ runStagger
1169
1195
  );
1170
1196
  }
1171
1197
  if (isExiting && pending === 0) {
@@ -1224,7 +1250,7 @@ function createMotionComponent(Component) {
1224
1250
  const sharedLayout = useSharedLayout({
1225
1251
  layoutId,
1226
1252
  userRef: ref,
1227
- transition: chunkPM6CVGXJ_js.isTopLevelTransition(transition) ? transition : void 0,
1253
+ transition: chunkWNVHPMBI_js.isTopLevelTransition(transition) ? transition : void 0,
1228
1254
  shouldReduceMotion,
1229
1255
  userOnLayout,
1230
1256
  readStyles: readSharedStyles
@@ -1326,7 +1352,7 @@ function createMotionComponent(Component) {
1326
1352
  setFocusVisible,
1327
1353
  setHovered
1328
1354
  );
1329
- const layoutSig = chunkPM6CVGXJ_js.stableSig(layout);
1355
+ const layoutSig = chunkWNVHPMBI_js.stableSig(layout);
1330
1356
  const layoutTransition = react.useMemo(
1331
1357
  () => shouldReduceMotion ? void 0 : resolveLayoutTransition(layout),
1332
1358
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1467,7 +1493,7 @@ function shadowOffsetAxisFor(key) {
1467
1493
  function shadowOffsetAxisValue(source, axis) {
1468
1494
  return source?.[axis];
1469
1495
  }
1470
- function driveBoxShadow(slot, insetSlot, target, cfg, factory) {
1496
+ function driveBoxShadow(slot, insetSlot, target, cfg, staggerDelay, factory) {
1471
1497
  const currentLayers = payloadToLayers(slot.value);
1472
1498
  const { from, to, insets } = prepareBoxShadowAnimation(
1473
1499
  { layers: currentLayers, insets: insetSlot.value },
@@ -1475,10 +1501,13 @@ function driveBoxShadow(slot, insetSlot, target, cfg, factory) {
1475
1501
  );
1476
1502
  insetSlot.value = insets;
1477
1503
  if (from.length !== currentLayers.length) slot.value = layersToPayload(from);
1478
- slot.value = chunkPM6CVGXJ_js.resolveTransition(
1479
- cfg,
1480
- layersToPayload(to),
1481
- factory?.("animation", void 0)
1504
+ slot.value = chunkWNVHPMBI_js.applyDelay(
1505
+ chunkWNVHPMBI_js.resolveTransition(
1506
+ cfg,
1507
+ layersToPayload(to),
1508
+ factory?.("animation", void 0)
1509
+ ),
1510
+ staggerDelay
1482
1511
  );
1483
1512
  }
1484
1513
  function styleValueFor(flat, key) {
@@ -1599,7 +1628,7 @@ function resolveGestureLayers(gesture) {
1599
1628
  for (const key of ALL_KEYS) {
1600
1629
  if (STRUCTURED_KEY_SET.has(key)) {
1601
1630
  if (__DEV__ && subState[key] !== void 0) {
1602
- chunkPM6CVGXJ_js.warnOnce(
1631
+ chunkWNVHPMBI_js.warnOnce(
1603
1632
  `gesture-structured-${layer}-${key}`,
1604
1633
  `[inertia] \`${key}\` is not supported inside \`gesture.${layer}\` and will be ignored. Drive it from \`animate\` (optionally via a variant keyed off the same state), or interpolate it yourself with \`useShadow\`.`
1605
1634
  );
@@ -1623,7 +1652,7 @@ function resolveGestureLayers(gesture) {
1623
1652
  return out;
1624
1653
  }
1625
1654
  function useGestureLayerProgress(progress, active, declared, layer, transition, isExiting, shouldReduceMotion) {
1626
- const layerCfgSig = chunkPM6CVGXJ_js.stableSig(gestureLayerTransitionFor(layer, transition));
1655
+ const layerCfgSig = chunkWNVHPMBI_js.stableSig(gestureLayerTransitionFor(layer, transition));
1627
1656
  react.useEffect(() => {
1628
1657
  if (!declared) return;
1629
1658
  if (isExiting) {
@@ -1632,7 +1661,7 @@ function useGestureLayerProgress(progress, active, declared, layer, transition,
1632
1661
  }
1633
1662
  const target = active ? 1 : 0;
1634
1663
  const cfg = shouldReduceMotion ? { type: "no-animation" } : gestureLayerTransitionFor(layer, transition) ?? { type: "spring" };
1635
- progress.value = chunkPM6CVGXJ_js.resolveTransition(cfg, target);
1664
+ progress.value = chunkWNVHPMBI_js.resolveTransition(cfg, target);
1636
1665
  }, [active, declared, isExiting, shouldReduceMotion, layerCfgSig]);
1637
1666
  }
1638
1667
  function useGestureHandlers(gesture, rest, setPressed, setFocused, setFocusVisible, setHovered) {
@@ -1652,11 +1681,20 @@ function useGestureHandlers(gesture, rest, setPressed, setFocused, setFocusVisib
1652
1681
  );
1653
1682
  handlers.onPressIn = compose(rest.onPressIn, () => setPressed(true));
1654
1683
  handlers.onPressOut = compose(rest.onPressOut, () => setPressed(false));
1684
+ handlers.onPointerDown = compose(
1685
+ rest.onPointerDown,
1686
+ () => setPressed(true)
1687
+ );
1688
+ handlers.onPointerUp = compose(rest.onPointerUp, () => setPressed(false));
1689
+ handlers.onPointerCancel = compose(
1690
+ rest.onPointerCancel,
1691
+ () => setPressed(false)
1692
+ );
1655
1693
  }
1656
1694
  if (gesture.focused || gesture.focusVisible) {
1657
1695
  handlers.onFocus = compose(rest.onFocus, () => {
1658
1696
  if (gesture.focused) setFocused(true);
1659
- if (gesture.focusVisible && chunkOBRGJAST_js.isFocusVisible()) setFocusVisible(true);
1697
+ if (gesture.focusVisible && chunk6AN5X3YE_js.isFocusVisible()) setFocusVisible(true);
1660
1698
  });
1661
1699
  handlers.onBlur = compose(rest.onBlur, () => {
1662
1700
  if (gesture.focused) setFocused(false);
@@ -1681,6 +1719,9 @@ function useGestureHandlers(gesture, rest, setPressed, setFocused, setFocusVisib
1681
1719
  rest.onTouchCancel,
1682
1720
  rest.onPressIn,
1683
1721
  rest.onPressOut,
1722
+ rest.onPointerDown,
1723
+ rest.onPointerUp,
1724
+ rest.onPointerCancel,
1684
1725
  rest.onFocus,
1685
1726
  rest.onBlur,
1686
1727
  rest.onMouseEnter,
@@ -1696,8 +1737,10 @@ function compose(user, ours) {
1696
1737
  }
1697
1738
 
1698
1739
  exports.Presence = Presence;
1740
+ exports.Stagger = Stagger;
1699
1741
  exports.TRANSPARENT = TRANSPARENT;
1700
1742
  exports.createMotionComponent = createMotionComponent;
1701
1743
  exports.pairBoxShadowLayers = pairBoxShadowLayers;
1702
1744
  exports.resolveBoxShadowInput = resolveBoxShadowInput;
1703
1745
  exports.usePresence = usePresence;
1746
+ exports.useStaggerDelay = useStaggerDelay;
@@ -0,0 +1,22 @@
1
+ import { createMotionComponent } from './chunk-IX6SEOSK.mjs';
2
+ import Animated from 'react-native-reanimated';
3
+
4
+ var MotionFlatList = createMotionComponent(
5
+ Animated.FlatList
6
+ // `createMotionComponent<C>` returns a non-generic `MotionComponent<C>`, so
7
+ // `data` / `renderItem` would collapse to `any` and lose `ItemT` inference.
8
+ // Restore it with the same call-signature cast Reanimated itself uses for
9
+ // this exact problem (see its `ReanimatedFlatList` export, and the
10
+ // `@ts-expect-error` above `AnimatedFlatList` explaining that
11
+ // `createAnimatedComponent` cannot create generic components).
12
+ //
13
+ // **Both** generics live on the one call signature, and that is deliberate:
14
+ // `ItemT` infers from `data` while `V` infers from `variants`, independently.
15
+ // Declaring only `ItemT` (the obvious first cut) silently drops the
16
+ // variant-key narrowing that `MotionComponent` provides on every other
17
+ // primitive — `animate="typo"` would stop being a compile error here and
18
+ // nowhere else. Both directions are pinned in
19
+ // `__type-tests__/flat-list.test-d.tsx`.
20
+ );
21
+
22
+ export { MotionFlatList };
@@ -1,4 +1,4 @@
1
- import { createMotionComponent } from './chunk-2ICQLWH2.mjs';
1
+ import { createMotionComponent } from './chunk-IX6SEOSK.mjs';
2
2
  import { View } from 'react-native';
3
3
 
4
4
  var MotionView = createMotionComponent(View);
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var chunkE3ALFSH2_js = require('./chunk-E3ALFSH2.js');
4
+ var Animated = require('react-native-reanimated');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var Animated__default = /*#__PURE__*/_interopDefault(Animated);
9
+
10
+ var MotionFlatList = chunkE3ALFSH2_js.createMotionComponent(
11
+ Animated__default.default.FlatList
12
+ // `createMotionComponent<C>` returns a non-generic `MotionComponent<C>`, so
13
+ // `data` / `renderItem` would collapse to `any` and lose `ItemT` inference.
14
+ // Restore it with the same call-signature cast Reanimated itself uses for
15
+ // this exact problem (see its `ReanimatedFlatList` export, and the
16
+ // `@ts-expect-error` above `AnimatedFlatList` explaining that
17
+ // `createAnimatedComponent` cannot create generic components).
18
+ //
19
+ // **Both** generics live on the one call signature, and that is deliberate:
20
+ // `ItemT` infers from `data` while `V` infers from `variants`, independently.
21
+ // Declaring only `ItemT` (the obvious first cut) silently drops the
22
+ // variant-key narrowing that `MotionComponent` provides on every other
23
+ // primitive — `animate="typo"` would stop being a compile error here and
24
+ // nowhere else. Both directions are pinned in
25
+ // `__type-tests__/flat-list.test-d.tsx`.
26
+ );
27
+
28
+ exports.MotionFlatList = MotionFlatList;
@@ -1,5 +1,5 @@
1
- import { useNamedTransitions, resolveNamedTransitionProp, lookupNamedTransition, useShouldReduceMotion, isFocusVisible } from './chunk-Z3HCJ43H.mjs';
2
- import { warnOnce, stableSig, resolveAnimatableValue, isTopLevelTransition, resolveTransition, ensureWorkletEasing, springToReanimated, DEFAULT_SPRING } from './chunk-REYL77RE.mjs';
1
+ import { useNamedTransitions, resolveNamedTransitionProp, lookupNamedTransition, useShouldReduceMotion, isFocusVisible } from './chunk-MFAFB4K7.mjs';
2
+ import { warnOnce, stableSig, applyDelay, resolveAnimatableValue, isTopLevelTransition, resolveTransition, ensureWorkletEasing, springToReanimated, DEFAULT_SPRING } from './chunk-W7NTRSPD.mjs';
3
3
  import { createContext, useContext, useMemo, Children, isValidElement, useState, useRef, useCallback, forwardRef, useEffect } from 'react';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
  import Animated, { useSharedValue, cancelAnimation, useAnimatedStyle, interpolateColor, reanimatedVersion, runOnJS, LinearTransition, withSequence, withTiming, withSpring } from 'react-native-reanimated';
@@ -153,6 +153,26 @@ function PresenceItem({
153
153
  );
154
154
  return /* @__PURE__ */ jsx(PresenceContext.Provider, { value, children });
155
155
  }
156
+ var StaggerContext = createContext(0);
157
+ function useStaggerDelay() {
158
+ return useContext(StaggerContext);
159
+ }
160
+ function Stagger({
161
+ children,
162
+ interval,
163
+ delay = 0,
164
+ from = "first",
165
+ enabled = true
166
+ }) {
167
+ const items = Children.toArray(children);
168
+ const count = items.length;
169
+ return /* @__PURE__ */ jsx(Fragment, { children: items.map((child, index) => {
170
+ const position = from === "last" ? count - 1 - index : index;
171
+ const childDelay = enabled ? delay + position * interval : 0;
172
+ const key = isValidElement(child) ? child.key ?? index : index;
173
+ return /* @__PURE__ */ jsx(StaggerContext.Provider, { value: childDelay, children: child }, key);
174
+ }) });
175
+ }
156
176
 
157
177
  // src/internal/boxShadow.ts
158
178
  var LENGTH = /^[+-]?(\d+\.?\d*|\.\d+)(px)?$/i;
@@ -898,6 +918,7 @@ function createMotionComponent(Component) {
898
918
  const presence = usePresence();
899
919
  const isExiting = presence !== null && presence.isPresent === false;
900
920
  const shouldReduceMotion = useShouldReduceMotion();
921
+ const staggerDelay = useStaggerDelay();
901
922
  const onAnimationEndRef = useRef(onAnimationEnd);
902
923
  onAnimationEndRef.current = onAnimationEnd;
903
924
  const variantKey = useControllerKey(controller);
@@ -1105,6 +1126,7 @@ function createMotionComponent(Component) {
1105
1126
  SHADOW_OFFSET_KEY_SET.has(key) ? "shadowOffset" : key,
1106
1127
  transition
1107
1128
  );
1129
+ const runStagger = shouldReduceMotion || isExiting || staggerDelay <= 0 ? 0 : staggerDelay;
1108
1130
  let transformPending = 0;
1109
1131
  for (const k of ALL_KEYS) {
1110
1132
  if (!TRANSFORM_KEY_SET.has(k) || baseRecord[k] === void 0) continue;
@@ -1123,6 +1145,7 @@ function createMotionComponent(Component) {
1123
1145
  boxShadowInsets,
1124
1146
  shadowTarget,
1125
1147
  cfg2,
1148
+ runStagger,
1126
1149
  makeKeyCallbackFactory(
1127
1150
  "boxShadow",
1128
1151
  sharedValues.boxShadow,
@@ -1156,10 +1179,13 @@ function createMotionComponent(Component) {
1156
1179
  isExiting ? onSettle : void 0,
1157
1180
  TRANSFORM_KEY_SET.has(key) ? transformGroup : void 0
1158
1181
  );
1159
- sharedValues[key].value = resolveAnimatableValue(
1160
- COLOR_KEY_SET.has(key) ? normalizeAnimatableColorTarget(target) : target,
1161
- cfg,
1162
- factory
1182
+ sharedValues[key].value = applyDelay(
1183
+ resolveAnimatableValue(
1184
+ COLOR_KEY_SET.has(key) ? normalizeAnimatableColorTarget(target) : target,
1185
+ cfg,
1186
+ factory
1187
+ ),
1188
+ runStagger
1163
1189
  );
1164
1190
  }
1165
1191
  if (isExiting && pending === 0) {
@@ -1461,7 +1487,7 @@ function shadowOffsetAxisFor(key) {
1461
1487
  function shadowOffsetAxisValue(source, axis) {
1462
1488
  return source?.[axis];
1463
1489
  }
1464
- function driveBoxShadow(slot, insetSlot, target, cfg, factory) {
1490
+ function driveBoxShadow(slot, insetSlot, target, cfg, staggerDelay, factory) {
1465
1491
  const currentLayers = payloadToLayers(slot.value);
1466
1492
  const { from, to, insets } = prepareBoxShadowAnimation(
1467
1493
  { layers: currentLayers, insets: insetSlot.value },
@@ -1469,10 +1495,13 @@ function driveBoxShadow(slot, insetSlot, target, cfg, factory) {
1469
1495
  );
1470
1496
  insetSlot.value = insets;
1471
1497
  if (from.length !== currentLayers.length) slot.value = layersToPayload(from);
1472
- slot.value = resolveTransition(
1473
- cfg,
1474
- layersToPayload(to),
1475
- factory?.("animation", void 0)
1498
+ slot.value = applyDelay(
1499
+ resolveTransition(
1500
+ cfg,
1501
+ layersToPayload(to),
1502
+ factory?.("animation", void 0)
1503
+ ),
1504
+ staggerDelay
1476
1505
  );
1477
1506
  }
1478
1507
  function styleValueFor(flat, key) {
@@ -1646,6 +1675,15 @@ function useGestureHandlers(gesture, rest, setPressed, setFocused, setFocusVisib
1646
1675
  );
1647
1676
  handlers.onPressIn = compose(rest.onPressIn, () => setPressed(true));
1648
1677
  handlers.onPressOut = compose(rest.onPressOut, () => setPressed(false));
1678
+ handlers.onPointerDown = compose(
1679
+ rest.onPointerDown,
1680
+ () => setPressed(true)
1681
+ );
1682
+ handlers.onPointerUp = compose(rest.onPointerUp, () => setPressed(false));
1683
+ handlers.onPointerCancel = compose(
1684
+ rest.onPointerCancel,
1685
+ () => setPressed(false)
1686
+ );
1649
1687
  }
1650
1688
  if (gesture.focused || gesture.focusVisible) {
1651
1689
  handlers.onFocus = compose(rest.onFocus, () => {
@@ -1675,6 +1713,9 @@ function useGestureHandlers(gesture, rest, setPressed, setFocused, setFocusVisib
1675
1713
  rest.onTouchCancel,
1676
1714
  rest.onPressIn,
1677
1715
  rest.onPressOut,
1716
+ rest.onPointerDown,
1717
+ rest.onPointerUp,
1718
+ rest.onPointerCancel,
1678
1719
  rest.onFocus,
1679
1720
  rest.onBlur,
1680
1721
  rest.onMouseEnter,
@@ -1689,4 +1730,4 @@ function compose(user, ours) {
1689
1730
  };
1690
1731
  }
1691
1732
 
1692
- export { Presence, TRANSPARENT, createMotionComponent, pairBoxShadowLayers, resolveBoxShadowInput, usePresence };
1733
+ export { Presence, Stagger, TRANSPARENT, createMotionComponent, pairBoxShadowLayers, resolveBoxShadowInput, usePresence, useStaggerDelay };
@@ -1,4 +1,4 @@
1
- import { createMotionComponent } from './chunk-2ICQLWH2.mjs';
1
+ import { createMotionComponent } from './chunk-IX6SEOSK.mjs';
2
2
  import { Pressable } from 'react-native';
3
3
 
4
4
  var MotionPressable = createMotionComponent(Pressable);
@@ -1,5 +1,5 @@
1
- import { useShouldReduceMotion, resolveNamedTransitionProp, useNamedTransitions, isFocusVisible } from './chunk-Z3HCJ43H.mjs';
2
- import { resolveTransition, isTopLevelTransition } from './chunk-REYL77RE.mjs';
1
+ import { useShouldReduceMotion, resolveNamedTransitionProp, useNamedTransitions, isFocusVisible } from './chunk-MFAFB4K7.mjs';
2
+ import { resolveTransition, isTopLevelTransition } from './chunk-W7NTRSPD.mjs';
3
3
  import { useCallback, useMemo } from 'react';
4
4
  import { useSharedValue } from 'react-native-reanimated';
5
5