@rootnative/inertia 0.0.3 → 0.0.5

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 (75) hide show
  1. package/CHANGELOG.md +92 -5
  2. package/README.md +9 -3
  3. package/dist/{chunk-OQV66TBQ.mjs → chunk-27MKBTSG.mjs} +1 -1
  4. package/dist/{chunk-3XTVY34H.js → chunk-27U6766G.js} +2 -2
  5. package/dist/{chunk-4PEHWDAZ.js → chunk-4NAMD62I.js} +7 -7
  6. package/dist/chunk-67GHRCF6.js +8 -0
  7. package/dist/{chunk-SGUHE5CX.mjs → chunk-COEJVWRZ.mjs} +1 -1
  8. package/dist/chunk-GPOMFIIU.js +8 -0
  9. package/dist/{chunk-BQQTHG2V.mjs → chunk-GTJ6VAH5.mjs} +1 -1
  10. package/dist/chunk-K63LXGKS.js +8 -0
  11. package/dist/{chunk-46P57VMY.mjs → chunk-OAUWLPQH.mjs} +1 -1
  12. package/dist/{chunk-7AOERN53.js → chunk-OBRGJAST.js} +3 -3
  13. package/dist/{chunk-RGNX6UZN.mjs → chunk-OW5XTGVN.mjs} +2 -2
  14. package/dist/{chunk-PTRF47DA.js → chunk-PM6CVGXJ.js} +11 -3
  15. package/dist/{chunk-W5MC3P4N.js → chunk-QQVDZKSD.js} +2 -2
  16. package/dist/{chunk-CY7Y64C3.mjs → chunk-REYL77RE.mjs} +11 -4
  17. package/dist/{chunk-CSODMRJ7.mjs → chunk-RIVVBABB.mjs} +597 -134
  18. package/dist/{chunk-BP3Y2SHQ.js → chunk-VQ5D35UA.js} +617 -152
  19. package/dist/{chunk-O22NXXCZ.mjs → chunk-XSK5MNUH.mjs} +1 -1
  20. package/dist/{chunk-R63GIUNU.mjs → chunk-Z3HCJ43H.mjs} +1 -1
  21. package/dist/gestureLayer/index.d.mts +2 -2
  22. package/dist/gestureLayer/index.d.ts +2 -2
  23. package/dist/gestureLayer/index.js +10 -10
  24. package/dist/gestureLayer/index.mjs +3 -3
  25. package/dist/index.d.mts +4 -4
  26. package/dist/index.d.ts +4 -4
  27. package/dist/index.js +48 -169
  28. package/dist/index.mjs +17 -137
  29. package/dist/motion/Image.d.mts +1 -1
  30. package/dist/motion/Image.d.ts +1 -1
  31. package/dist/motion/Image.js +5 -5
  32. package/dist/motion/Image.mjs +4 -4
  33. package/dist/motion/Pressable.d.mts +1 -1
  34. package/dist/motion/Pressable.d.ts +1 -1
  35. package/dist/motion/Pressable.js +5 -5
  36. package/dist/motion/Pressable.mjs +4 -4
  37. package/dist/motion/ScrollView.d.mts +1 -1
  38. package/dist/motion/ScrollView.d.ts +1 -1
  39. package/dist/motion/ScrollView.js +5 -5
  40. package/dist/motion/ScrollView.mjs +4 -4
  41. package/dist/motion/Text.d.mts +1 -1
  42. package/dist/motion/Text.d.ts +1 -1
  43. package/dist/motion/Text.js +5 -5
  44. package/dist/motion/Text.mjs +4 -4
  45. package/dist/motion/View.d.mts +1 -1
  46. package/dist/motion/View.d.ts +1 -1
  47. package/dist/motion/View.js +5 -5
  48. package/dist/motion/View.mjs +4 -4
  49. package/dist/touch/index.d.mts +1 -1
  50. package/dist/touch/index.d.ts +1 -1
  51. package/dist/touch/index.js +3 -3
  52. package/dist/touch/index.mjs +1 -1
  53. package/dist/{types-G1dBU2IQ.d.mts → types-BQgLJeQG.d.mts} +85 -14
  54. package/dist/{types-G1dBU2IQ.d.ts → types-BQgLJeQG.d.ts} +85 -14
  55. package/dist/{useGesture-D1e4ixJo.d.ts → useGesture-B0_CzOUz.d.ts} +1 -1
  56. package/dist/{useGesture-RFY6kTL3.d.mts → useGesture-DfaTx-3t.d.mts} +1 -1
  57. package/llms.txt +3 -1
  58. package/package.json +1 -1
  59. package/src/index.ts +2 -1
  60. package/src/internal/boxShadow.ts +177 -6
  61. package/src/internal/nonWorkletWarning.ts +4 -6
  62. package/src/internal/warnOnce.ts +28 -0
  63. package/src/layout/index.ts +10 -0
  64. package/src/layout/measureWindow.ts +135 -0
  65. package/src/layout/sharedRegistry.ts +107 -18
  66. package/src/layout/useSharedLayout.ts +256 -91
  67. package/src/motion/createMotionComponent.tsx +497 -74
  68. package/src/motion/installCheck.ts +1 -1
  69. package/src/transitions/index.ts +1 -1
  70. package/src/transitions/resolveSequence.ts +12 -0
  71. package/src/types.ts +155 -12
  72. package/src/values/useColorTransition.ts +1 -1
  73. package/dist/chunk-FNVFV4EY.js +0 -8
  74. package/dist/chunk-FWQOXA43.js +0 -8
  75. package/dist/chunk-KBP4LR75.js +0 -8
@@ -1,5 +1,5 @@
1
1
  import { Image } from 'react-native';
2
- import { M as MotionComponent } from '../types-G1dBU2IQ.js';
2
+ import { M as MotionComponent } from '../types-BQgLJeQG.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkKBP4LR75_js = require('../chunk-KBP4LR75.js');
4
- require('../chunk-BP3Y2SHQ.js');
5
- require('../chunk-7AOERN53.js');
6
- require('../chunk-PTRF47DA.js');
3
+ var chunkGPOMFIIU_js = require('../chunk-GPOMFIIU.js');
4
+ require('../chunk-VQ5D35UA.js');
5
+ require('../chunk-OBRGJAST.js');
6
+ require('../chunk-PM6CVGXJ.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionImage", {
11
11
  enumerable: true,
12
- get: function () { return chunkKBP4LR75_js.MotionImage; }
12
+ get: function () { return chunkGPOMFIIU_js.MotionImage; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionImage } from '../chunk-O22NXXCZ.mjs';
2
- import '../chunk-CSODMRJ7.mjs';
3
- import '../chunk-R63GIUNU.mjs';
4
- import '../chunk-CY7Y64C3.mjs';
1
+ export { MotionImage } from '../chunk-XSK5MNUH.mjs';
2
+ import '../chunk-RIVVBABB.mjs';
3
+ import '../chunk-Z3HCJ43H.mjs';
4
+ import '../chunk-REYL77RE.mjs';
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import * as react_native from 'react-native';
3
- import { M as MotionComponent } from '../types-G1dBU2IQ.mjs';
3
+ import { M as MotionComponent } from '../types-BQgLJeQG.mjs';
4
4
 
5
5
  /**
6
6
  * Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import * as react_native from 'react-native';
3
- import { M as MotionComponent } from '../types-G1dBU2IQ.js';
3
+ import { M as MotionComponent } from '../types-BQgLJeQG.js';
4
4
 
5
5
  /**
6
6
  * Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunk3XTVY34H_js = require('../chunk-3XTVY34H.js');
4
- require('../chunk-BP3Y2SHQ.js');
5
- require('../chunk-7AOERN53.js');
6
- require('../chunk-PTRF47DA.js');
3
+ var chunk27U6766G_js = require('../chunk-27U6766G.js');
4
+ require('../chunk-VQ5D35UA.js');
5
+ require('../chunk-OBRGJAST.js');
6
+ require('../chunk-PM6CVGXJ.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionPressable", {
11
11
  enumerable: true,
12
- get: function () { return chunk3XTVY34H_js.MotionPressable; }
12
+ get: function () { return chunk27U6766G_js.MotionPressable; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionPressable } from '../chunk-46P57VMY.mjs';
2
- import '../chunk-CSODMRJ7.mjs';
3
- import '../chunk-R63GIUNU.mjs';
4
- import '../chunk-CY7Y64C3.mjs';
1
+ export { MotionPressable } from '../chunk-OAUWLPQH.mjs';
2
+ import '../chunk-RIVVBABB.mjs';
3
+ import '../chunk-Z3HCJ43H.mjs';
4
+ import '../chunk-REYL77RE.mjs';
@@ -1,5 +1,5 @@
1
1
  import { ScrollView } from 'react-native';
2
- import { M as MotionComponent } from '../types-G1dBU2IQ.mjs';
2
+ import { M as MotionComponent } from '../types-BQgLJeQG.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { ScrollView } from 'react-native';
2
- import { M as MotionComponent } from '../types-G1dBU2IQ.js';
2
+ import { M as MotionComponent } from '../types-BQgLJeQG.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkW5MC3P4N_js = require('../chunk-W5MC3P4N.js');
4
- require('../chunk-BP3Y2SHQ.js');
5
- require('../chunk-7AOERN53.js');
6
- require('../chunk-PTRF47DA.js');
3
+ var chunkQQVDZKSD_js = require('../chunk-QQVDZKSD.js');
4
+ require('../chunk-VQ5D35UA.js');
5
+ require('../chunk-OBRGJAST.js');
6
+ require('../chunk-PM6CVGXJ.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionScrollView", {
11
11
  enumerable: true,
12
- get: function () { return chunkW5MC3P4N_js.MotionScrollView; }
12
+ get: function () { return chunkQQVDZKSD_js.MotionScrollView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionScrollView } from '../chunk-OQV66TBQ.mjs';
2
- import '../chunk-CSODMRJ7.mjs';
3
- import '../chunk-R63GIUNU.mjs';
4
- import '../chunk-CY7Y64C3.mjs';
1
+ export { MotionScrollView } from '../chunk-27MKBTSG.mjs';
2
+ import '../chunk-RIVVBABB.mjs';
3
+ import '../chunk-Z3HCJ43H.mjs';
4
+ import '../chunk-REYL77RE.mjs';
@@ -1,5 +1,5 @@
1
1
  import { Text } from 'react-native';
2
- import { M as MotionComponent } from '../types-G1dBU2IQ.mjs';
2
+ import { M as MotionComponent } from '../types-BQgLJeQG.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Text } from 'react-native';
2
- import { M as MotionComponent } from '../types-G1dBU2IQ.js';
2
+ import { M as MotionComponent } from '../types-BQgLJeQG.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkFWQOXA43_js = require('../chunk-FWQOXA43.js');
4
- require('../chunk-BP3Y2SHQ.js');
5
- require('../chunk-7AOERN53.js');
6
- require('../chunk-PTRF47DA.js');
3
+ var chunk67GHRCF6_js = require('../chunk-67GHRCF6.js');
4
+ require('../chunk-VQ5D35UA.js');
5
+ require('../chunk-OBRGJAST.js');
6
+ require('../chunk-PM6CVGXJ.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionText", {
11
11
  enumerable: true,
12
- get: function () { return chunkFWQOXA43_js.MotionText; }
12
+ get: function () { return chunk67GHRCF6_js.MotionText; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionText } from '../chunk-SGUHE5CX.mjs';
2
- import '../chunk-CSODMRJ7.mjs';
3
- import '../chunk-R63GIUNU.mjs';
4
- import '../chunk-CY7Y64C3.mjs';
1
+ export { MotionText } from '../chunk-COEJVWRZ.mjs';
2
+ import '../chunk-RIVVBABB.mjs';
3
+ import '../chunk-Z3HCJ43H.mjs';
4
+ import '../chunk-REYL77RE.mjs';
@@ -1,5 +1,5 @@
1
1
  import { View } from 'react-native';
2
- import { M as MotionComponent } from '../types-G1dBU2IQ.mjs';
2
+ import { M as MotionComponent } from '../types-BQgLJeQG.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { View } from 'react-native';
2
- import { M as MotionComponent } from '../types-G1dBU2IQ.js';
2
+ import { M as MotionComponent } from '../types-BQgLJeQG.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkFNVFV4EY_js = require('../chunk-FNVFV4EY.js');
4
- require('../chunk-BP3Y2SHQ.js');
5
- require('../chunk-7AOERN53.js');
6
- require('../chunk-PTRF47DA.js');
3
+ var chunkK63LXGKS_js = require('../chunk-K63LXGKS.js');
4
+ require('../chunk-VQ5D35UA.js');
5
+ require('../chunk-OBRGJAST.js');
6
+ require('../chunk-PM6CVGXJ.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionView", {
11
11
  enumerable: true,
12
- get: function () { return chunkFNVFV4EY_js.MotionView; }
12
+ get: function () { return chunkK63LXGKS_js.MotionView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionView } from '../chunk-BQQTHG2V.mjs';
2
- import '../chunk-CSODMRJ7.mjs';
3
- import '../chunk-R63GIUNU.mjs';
4
- import '../chunk-CY7Y64C3.mjs';
1
+ export { MotionView } from '../chunk-GTJ6VAH5.mjs';
2
+ import '../chunk-RIVVBABB.mjs';
3
+ import '../chunk-Z3HCJ43H.mjs';
4
+ import '../chunk-REYL77RE.mjs';
@@ -1,6 +1,6 @@
1
1
  import { PanResponderInstance } from 'react-native';
2
2
  import { useAnimatedStyle, SharedValue } from 'react-native-reanimated';
3
- import { T as TransitionConfig } from '../types-G1dBU2IQ.mjs';
3
+ import { T as TransitionConfig } from '../types-BQgLJeQG.mjs';
4
4
  import 'react';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { PanResponderInstance } from 'react-native';
2
2
  import { useAnimatedStyle, SharedValue } from 'react-native-reanimated';
3
- import { T as TransitionConfig } from '../types-G1dBU2IQ.js';
3
+ import { T as TransitionConfig } from '../types-BQgLJeQG.js';
4
4
  import 'react';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkPTRF47DA_js = require('../chunk-PTRF47DA.js');
3
+ var chunkPM6CVGXJ_js = require('../chunk-PM6CVGXJ.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 = chunkPTRF47DA_js.buildReleaseAnimation(
51
+ dragX.value = chunkPM6CVGXJ_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 = chunkPTRF47DA_js.buildReleaseAnimation(
58
+ dragY.value = chunkPM6CVGXJ_js.buildReleaseAnimation(
59
59
  result.y,
60
60
  toY
61
61
  );
@@ -1,4 +1,4 @@
1
- import { buildReleaseAnimation } from '../chunk-CY7Y64C3.mjs';
1
+ import { buildReleaseAnimation } from '../chunk-REYL77RE.mjs';
2
2
  import { useMemo } from 'react';
3
3
  import { PanResponder } from 'react-native';
4
4
  import { useSharedValue, useAnimatedStyle } from 'react-native-reanimated';
@@ -1,5 +1,5 @@
1
1
  import { ComponentType, ComponentProps, Ref, ReactElement } from 'react';
2
- import { StyleProp } from 'react-native';
2
+ import { StyleProp, BoxShadowValue } from 'react-native';
3
3
 
4
4
  /**
5
5
  * A single animation step's destination, optionally overriding the transition
@@ -154,6 +154,50 @@ type AnimatableTransformExtras = {
154
154
  rotateX?: AnimatableValue<number>;
155
155
  rotateY?: AnimatableValue<number>;
156
156
  };
157
+ /**
158
+ * Target shape for the `boxShadow` key on `animate` / `initial` / `exit`: a
159
+ * CSS `box-shadow` string, or RN's own array-of-layers form.
160
+ *
161
+ * Both endpoints of a `boxShadow` animation are normalized to a common layer
162
+ * count on the JS thread, so a two-layer shadow can animate to a one-layer one
163
+ * (the short side is padded with a transparent layer, as CSS transitions do).
164
+ * A layer that is `inset` on one side and not the other is not interpolable
165
+ * and throws.
166
+ */
167
+ type BoxShadowInput = string | ReadonlyArray<BoxShadowValue>;
168
+ /**
169
+ * Keys whose animatable form deliberately departs from the generic
170
+ * `AnimatableValue<S[K]>` mapping.
171
+ *
172
+ * `boxShadow` is the only member. Its natural value is already an array, which
173
+ * collides head-on with `AnimatableValue`'s keyframe-sequence form — nothing
174
+ * distinguishes `[layerA, layerB]` (one two-layer shadow) from a two-step
175
+ * sequence. The array slot is given to layers, which is the shape RN itself
176
+ * uses and by far the common case, and sequences are unsupported on this key.
177
+ * This mirrors the single-value-only contract `shadowOffset` has carried since
178
+ * `0.0.1`. Per-property transitions are unaffected: `transition={{ boxShadow:
179
+ * { type: 'timing' } }}` works as it does for every other key.
180
+ *
181
+ * Conditional on `S` so the key only appears where the underlying style
182
+ * actually has it, rather than being bolted onto every primitive.
183
+ */
184
+ type AnimatableStructuredExtras<S> = 'boxShadow' extends keyof S ? {
185
+ boxShadow?: BoxShadowInput;
186
+ } : {};
187
+ /**
188
+ * The `transform: [...]` array form, passed through as the underlying style
189
+ * types it. Inertia reads transform entries out of the array (see
190
+ * `styleValueFor` in `createMotionComponent`) rather than treating the array as
191
+ * an animatable scalar, so it is exempted from the `AnimatableValue` mapping —
192
+ * wrapping it there would offer a nonsensical `transform: [[...], [...]]`
193
+ * keyframe form.
194
+ *
195
+ * Conditional on `S` for the same reason as `boxShadow`: only appears where the
196
+ * underlying style actually has it.
197
+ */
198
+ type AnimatableTransformArray<S> = 'transform' extends keyof S ? {
199
+ transform?: S['transform'];
200
+ } : {};
157
201
  /**
158
202
  * The animation state shape inferred from the underlying component's style
159
203
  * prop. We narrow to the value side of `style` so consumers see ViewStyle on
@@ -166,11 +210,33 @@ type AnimatableTransformExtras = {
166
210
  * accepts any key. Excluding functions first keeps inference tight.
167
211
  */
168
212
  type _StyleValue<T> = Exclude<T, (...args: any[]) => any>;
213
+ /**
214
+ * The style keys Inertia's runtime actually drives — the type-level mirror of
215
+ * `ALL_KEYS` in `createMotionComponent`, minus the `shadowOffset*` synthetics
216
+ * (consumers write the nested `shadowOffset` object, not the axes) and minus
217
+ * `boxShadow` (handled by `AnimatableStructuredExtras`, whose value shape
218
+ * deliberately departs from `AnimatableValue`).
219
+ *
220
+ * **This list and `ALL_KEYS` must stay in sync.** They are separate because one
221
+ * is a type and the other is a runtime array, and TypeScript can't derive the
222
+ * former from a value living in a module that imports this one. The direction
223
+ * that matters: a key here but not in `ALL_KEYS` typechecks and then silently
224
+ * does nothing at runtime — which is precisely the defect this type was
225
+ * introduced to kill. `animate-keys.test-d.tsx` pins the two together.
226
+ *
227
+ * Before 0.0.5 this type mapped over the component's *entire* style surface, so
228
+ * `animate={{ paddingTop: 40 }}` compiled cleanly and was then dropped on the
229
+ * floor — no error, no warning. That contradicted the library's own headline
230
+ * differentiator (wrong props should error, not go unnoticed), so the mapping is
231
+ * now an intersection: a key must be both animatable by Inertia *and* present on
232
+ * the underlying component's style prop.
233
+ */
234
+ type AnimatableStyleKey = 'translateX' | 'translateY' | 'scaleX' | 'scaleY' | 'opacity' | 'width' | 'height' | 'borderRadius' | 'shadowOpacity' | 'shadowRadius' | 'elevation' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderBottomLeftRadius' | 'borderBottomRightRadius' | 'borderWidth' | 'borderTopWidth' | 'borderRightWidth' | 'borderBottomWidth' | 'borderLeftWidth' | 'top' | 'right' | 'bottom' | 'left' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'paddingHorizontal' | 'paddingVertical' | 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'marginHorizontal' | 'marginVertical' | 'flex' | 'flexGrow' | 'flexShrink' | 'fontSize' | 'letterSpacing' | 'lineHeight' | 'zIndex' | 'gap' | 'rowGap' | 'columnGap' | 'backgroundColor' | 'borderColor' | 'color' | 'tintColor' | 'shadowColor' | 'shadowOffset';
169
235
  type AnimateStyle<C> = C extends {
170
236
  style?: infer Raw;
171
237
  } ? _StyleValue<Raw> extends StyleProp<infer S> ? {
172
- [K in keyof S]?: AnimatableValue<S[K]>;
173
- } & AnimatableTransformExtras : never : never;
238
+ [K in keyof S as K extends AnimatableStyleKey ? K : never]?: K extends 'boxShadow' | 'transform' ? never : AnimatableValue<S[K]>;
239
+ } & AnimatableTransformExtras & AnimatableStructuredExtras<S> & AnimatableTransformArray<S> : never : never;
174
240
  interface AnimationCallbackInfo<S> {
175
241
  /**
176
242
  * The animatable key that just settled — typically a `keyof S` (e.g.
@@ -339,19 +405,24 @@ interface MotionProps<C, V extends VariantsMap<C> = VariantsMap<C>> {
339
405
  * recorded rect to its natural position via a FLIP transform stack.
340
406
  *
341
407
  * Reanimated 4 removed the `sharedTransitionTag` API — `layoutId` is the
342
- * Inertia-side measure-based replacement. Rects are recorded in
343
- * parent-relative coordinates (from `onLayout`), which composes when the
344
- * source and target screens share an outer content container (the common
345
- * stack-navigator case); nested-parent layouts need the v2
346
- * window-coordinate path.
408
+ * Inertia-side measure-based replacement. Rects are recorded in **window**
409
+ * coordinates wherever the host can be measured synchronously (Fabric),
410
+ * which is what lets a source and target sit under containers at different
411
+ * screen offsets; elsewhere both fall back to the parent-relative
412
+ * coordinates `onLayout` reports. A source and target that ended up in
413
+ * different spaces skip the animation rather than play a wrong one.
347
414
  *
348
415
  * The same `transition` prop drives the FLIP animation (spring by
349
416
  * default; `'timing'` honored; `'decay'` downgrades to spring; reduced
350
- * motion skips the transition). Out of scope for the first iteration:
351
- * style-prop interpolation (border radius, colors, etc.) only the
352
- * rect-to-rect transform is animated. Two simultaneously-mounted
353
- * primitives sharing the same `layoutId` are undefined behavior; pick a
354
- * primitive per id at a time.
417
+ * motion skips the transition). Alongside the rect, a fixed set of style
418
+ * keys is carried from the source and crossfaded out on that same
419
+ * transition: `opacity`, `borderRadius`, `backgroundColor`, `borderColor`,
420
+ * `color`, `tintColor`. Transform keys are not carried the FLIP owns
421
+ * them and a key only participates when the element already has a value
422
+ * for it, from a record or from its static `style`.
423
+ *
424
+ * Two simultaneously-mounted primitives sharing the same `layoutId` are
425
+ * undefined behavior; pick a primitive per id at a time.
355
426
  */
356
427
  layoutId?: string;
357
428
  /**
@@ -385,4 +456,4 @@ interface MotionComponent<C extends ComponentType<any>> {
385
456
  displayName?: string;
386
457
  }
387
458
 
388
- export type { AnimatableValue as A, DecayTransition as D, EasingInput as E, GestureLayerTransitions as G, MotionComponent as M, NamedTransitions as N, PerPropertyTransition as P, RegisteredTransitions as R, SpringTransition as S, TransitionConfig as T, VariantController as V, TransitionInput as a, TransitionName as b, AnimateStyle as c, AnimationCallbackInfo as d, EasingFunction as e, EasingFunctionFactory as f, GestureSubStates as g, MotionProps as h, NoAnimationTransition as i, RepeatConfig as j, SequenceStep as k, TimingTransition as l, Transition as m, VariantsMap as n };
459
+ export type { AnimatableValue as A, BoxShadowInput as B, DecayTransition as D, EasingInput as E, GestureLayerTransitions as G, MotionComponent as M, NamedTransitions as N, PerPropertyTransition as P, RegisteredTransitions as R, SpringTransition as S, TransitionConfig as T, VariantController as V, TransitionInput as a, TransitionName as b, AnimateStyle as c, AnimationCallbackInfo as d, EasingFunction as e, EasingFunctionFactory as f, GestureSubStates as g, MotionProps as h, NoAnimationTransition as i, RepeatConfig as j, SequenceStep as k, TimingTransition as l, Transition as m, VariantsMap as n };
@@ -1,5 +1,5 @@
1
1
  import { ComponentType, ComponentProps, Ref, ReactElement } from 'react';
2
- import { StyleProp } from 'react-native';
2
+ import { StyleProp, BoxShadowValue } from 'react-native';
3
3
 
4
4
  /**
5
5
  * A single animation step's destination, optionally overriding the transition
@@ -154,6 +154,50 @@ type AnimatableTransformExtras = {
154
154
  rotateX?: AnimatableValue<number>;
155
155
  rotateY?: AnimatableValue<number>;
156
156
  };
157
+ /**
158
+ * Target shape for the `boxShadow` key on `animate` / `initial` / `exit`: a
159
+ * CSS `box-shadow` string, or RN's own array-of-layers form.
160
+ *
161
+ * Both endpoints of a `boxShadow` animation are normalized to a common layer
162
+ * count on the JS thread, so a two-layer shadow can animate to a one-layer one
163
+ * (the short side is padded with a transparent layer, as CSS transitions do).
164
+ * A layer that is `inset` on one side and not the other is not interpolable
165
+ * and throws.
166
+ */
167
+ type BoxShadowInput = string | ReadonlyArray<BoxShadowValue>;
168
+ /**
169
+ * Keys whose animatable form deliberately departs from the generic
170
+ * `AnimatableValue<S[K]>` mapping.
171
+ *
172
+ * `boxShadow` is the only member. Its natural value is already an array, which
173
+ * collides head-on with `AnimatableValue`'s keyframe-sequence form — nothing
174
+ * distinguishes `[layerA, layerB]` (one two-layer shadow) from a two-step
175
+ * sequence. The array slot is given to layers, which is the shape RN itself
176
+ * uses and by far the common case, and sequences are unsupported on this key.
177
+ * This mirrors the single-value-only contract `shadowOffset` has carried since
178
+ * `0.0.1`. Per-property transitions are unaffected: `transition={{ boxShadow:
179
+ * { type: 'timing' } }}` works as it does for every other key.
180
+ *
181
+ * Conditional on `S` so the key only appears where the underlying style
182
+ * actually has it, rather than being bolted onto every primitive.
183
+ */
184
+ type AnimatableStructuredExtras<S> = 'boxShadow' extends keyof S ? {
185
+ boxShadow?: BoxShadowInput;
186
+ } : {};
187
+ /**
188
+ * The `transform: [...]` array form, passed through as the underlying style
189
+ * types it. Inertia reads transform entries out of the array (see
190
+ * `styleValueFor` in `createMotionComponent`) rather than treating the array as
191
+ * an animatable scalar, so it is exempted from the `AnimatableValue` mapping —
192
+ * wrapping it there would offer a nonsensical `transform: [[...], [...]]`
193
+ * keyframe form.
194
+ *
195
+ * Conditional on `S` for the same reason as `boxShadow`: only appears where the
196
+ * underlying style actually has it.
197
+ */
198
+ type AnimatableTransformArray<S> = 'transform' extends keyof S ? {
199
+ transform?: S['transform'];
200
+ } : {};
157
201
  /**
158
202
  * The animation state shape inferred from the underlying component's style
159
203
  * prop. We narrow to the value side of `style` so consumers see ViewStyle on
@@ -166,11 +210,33 @@ type AnimatableTransformExtras = {
166
210
  * accepts any key. Excluding functions first keeps inference tight.
167
211
  */
168
212
  type _StyleValue<T> = Exclude<T, (...args: any[]) => any>;
213
+ /**
214
+ * The style keys Inertia's runtime actually drives — the type-level mirror of
215
+ * `ALL_KEYS` in `createMotionComponent`, minus the `shadowOffset*` synthetics
216
+ * (consumers write the nested `shadowOffset` object, not the axes) and minus
217
+ * `boxShadow` (handled by `AnimatableStructuredExtras`, whose value shape
218
+ * deliberately departs from `AnimatableValue`).
219
+ *
220
+ * **This list and `ALL_KEYS` must stay in sync.** They are separate because one
221
+ * is a type and the other is a runtime array, and TypeScript can't derive the
222
+ * former from a value living in a module that imports this one. The direction
223
+ * that matters: a key here but not in `ALL_KEYS` typechecks and then silently
224
+ * does nothing at runtime — which is precisely the defect this type was
225
+ * introduced to kill. `animate-keys.test-d.tsx` pins the two together.
226
+ *
227
+ * Before 0.0.5 this type mapped over the component's *entire* style surface, so
228
+ * `animate={{ paddingTop: 40 }}` compiled cleanly and was then dropped on the
229
+ * floor — no error, no warning. That contradicted the library's own headline
230
+ * differentiator (wrong props should error, not go unnoticed), so the mapping is
231
+ * now an intersection: a key must be both animatable by Inertia *and* present on
232
+ * the underlying component's style prop.
233
+ */
234
+ type AnimatableStyleKey = 'translateX' | 'translateY' | 'scaleX' | 'scaleY' | 'opacity' | 'width' | 'height' | 'borderRadius' | 'shadowOpacity' | 'shadowRadius' | 'elevation' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderBottomLeftRadius' | 'borderBottomRightRadius' | 'borderWidth' | 'borderTopWidth' | 'borderRightWidth' | 'borderBottomWidth' | 'borderLeftWidth' | 'top' | 'right' | 'bottom' | 'left' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'paddingHorizontal' | 'paddingVertical' | 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'marginHorizontal' | 'marginVertical' | 'flex' | 'flexGrow' | 'flexShrink' | 'fontSize' | 'letterSpacing' | 'lineHeight' | 'zIndex' | 'gap' | 'rowGap' | 'columnGap' | 'backgroundColor' | 'borderColor' | 'color' | 'tintColor' | 'shadowColor' | 'shadowOffset';
169
235
  type AnimateStyle<C> = C extends {
170
236
  style?: infer Raw;
171
237
  } ? _StyleValue<Raw> extends StyleProp<infer S> ? {
172
- [K in keyof S]?: AnimatableValue<S[K]>;
173
- } & AnimatableTransformExtras : never : never;
238
+ [K in keyof S as K extends AnimatableStyleKey ? K : never]?: K extends 'boxShadow' | 'transform' ? never : AnimatableValue<S[K]>;
239
+ } & AnimatableTransformExtras & AnimatableStructuredExtras<S> & AnimatableTransformArray<S> : never : never;
174
240
  interface AnimationCallbackInfo<S> {
175
241
  /**
176
242
  * The animatable key that just settled — typically a `keyof S` (e.g.
@@ -339,19 +405,24 @@ interface MotionProps<C, V extends VariantsMap<C> = VariantsMap<C>> {
339
405
  * recorded rect to its natural position via a FLIP transform stack.
340
406
  *
341
407
  * Reanimated 4 removed the `sharedTransitionTag` API — `layoutId` is the
342
- * Inertia-side measure-based replacement. Rects are recorded in
343
- * parent-relative coordinates (from `onLayout`), which composes when the
344
- * source and target screens share an outer content container (the common
345
- * stack-navigator case); nested-parent layouts need the v2
346
- * window-coordinate path.
408
+ * Inertia-side measure-based replacement. Rects are recorded in **window**
409
+ * coordinates wherever the host can be measured synchronously (Fabric),
410
+ * which is what lets a source and target sit under containers at different
411
+ * screen offsets; elsewhere both fall back to the parent-relative
412
+ * coordinates `onLayout` reports. A source and target that ended up in
413
+ * different spaces skip the animation rather than play a wrong one.
347
414
  *
348
415
  * The same `transition` prop drives the FLIP animation (spring by
349
416
  * default; `'timing'` honored; `'decay'` downgrades to spring; reduced
350
- * motion skips the transition). Out of scope for the first iteration:
351
- * style-prop interpolation (border radius, colors, etc.) only the
352
- * rect-to-rect transform is animated. Two simultaneously-mounted
353
- * primitives sharing the same `layoutId` are undefined behavior; pick a
354
- * primitive per id at a time.
417
+ * motion skips the transition). Alongside the rect, a fixed set of style
418
+ * keys is carried from the source and crossfaded out on that same
419
+ * transition: `opacity`, `borderRadius`, `backgroundColor`, `borderColor`,
420
+ * `color`, `tintColor`. Transform keys are not carried the FLIP owns
421
+ * them and a key only participates when the element already has a value
422
+ * for it, from a record or from its static `style`.
423
+ *
424
+ * Two simultaneously-mounted primitives sharing the same `layoutId` are
425
+ * undefined behavior; pick a primitive per id at a time.
355
426
  */
356
427
  layoutId?: string;
357
428
  /**
@@ -385,4 +456,4 @@ interface MotionComponent<C extends ComponentType<any>> {
385
456
  displayName?: string;
386
457
  }
387
458
 
388
- export type { AnimatableValue as A, DecayTransition as D, EasingInput as E, GestureLayerTransitions as G, MotionComponent as M, NamedTransitions as N, PerPropertyTransition as P, RegisteredTransitions as R, SpringTransition as S, TransitionConfig as T, VariantController as V, TransitionInput as a, TransitionName as b, AnimateStyle as c, AnimationCallbackInfo as d, EasingFunction as e, EasingFunctionFactory as f, GestureSubStates as g, MotionProps as h, NoAnimationTransition as i, RepeatConfig as j, SequenceStep as k, TimingTransition as l, Transition as m, VariantsMap as n };
459
+ export type { AnimatableValue as A, BoxShadowInput as B, DecayTransition as D, EasingInput as E, GestureLayerTransitions as G, MotionComponent as M, NamedTransitions as N, PerPropertyTransition as P, RegisteredTransitions as R, SpringTransition as S, TransitionConfig as T, VariantController as V, TransitionInput as a, TransitionName as b, AnimateStyle as c, AnimationCallbackInfo as d, EasingFunction as e, EasingFunctionFactory as f, GestureSubStates as g, MotionProps as h, NoAnimationTransition as i, RepeatConfig as j, SequenceStep as k, TimingTransition as l, Transition as m, VariantsMap as n };
@@ -1,5 +1,5 @@
1
1
  import { SharedValue } from 'react-native-reanimated';
2
- import { a as TransitionInput, G as GestureLayerTransitions } from './types-G1dBU2IQ.js';
2
+ import { a as TransitionInput, G as GestureLayerTransitions } from './types-BQgLJeQG.js';
3
3
 
4
4
  /**
5
5
  * Handler bag returned by `useGesture`. Spread on a `Pressable` to drive the
@@ -1,5 +1,5 @@
1
1
  import { SharedValue } from 'react-native-reanimated';
2
- import { a as TransitionInput, G as GestureLayerTransitions } from './types-G1dBU2IQ.mjs';
2
+ import { a as TransitionInput, G as GestureLayerTransitions } from './types-BQgLJeQG.mjs';
3
3
 
4
4
  /**
5
5
  * Handler bag returned by `useGesture`. Spread on a `Pressable` to drive the
package/llms.txt CHANGED
@@ -140,7 +140,9 @@ Color: `backgroundColor`, `borderColor`, `color`, `tintColor` (Image only), `sha
140
140
 
141
141
  Nested object: `shadowOffset: { width, height }`. The only nested-object style on the surface — internally decomposes into two synthetic axis SVs that the worklet recomposes into a single `shadowOffset` prop. `0.0.1` supports the **single-value form only** (`{ width: 0, height: 4 }`); sequences / array keyframes / per-axis transition splits are out of scope, drop to `useMotionValue` for those.
142
142
 
143
- Auto-layout transitions ship via the `layout` prop (`true` / `TransitionConfig`) on every `Motion.*` primitivesee Layout. Shared element transitions ship via the `layoutId` prop: pair the same id on a source and target `Motion.*` and Inertia FLIPs between them on mount (parent-relative coords, rect-only animation, 1s TTL).
143
+ Structured: `boxShadow` — the cross-platform CSS shadow form, as a CSS string (`'0px 4px 8px rgba(0,0,0,0.3)'`, px lengths only) or RN's `BoxShadowValue[]`. Endpoints are normalized on the JS thread and padded to a common layer count (CSS-transition semantics), so layer counts may differ between `initial` and `animate`; every length and color interpolates per layer. `inset` is carried as a static per-layer flag, not interpolated a layer inset on one side only throws. **No sequences on this key** (the array slot means layers, not keyframes) and **not accepted in `gesture` sub-states** (dev-warns and is ignored; drive it from `animate`, or interpolate manually with `useShadow`). Don't animate it alongside the native `shadow*` keys on one element two shadow systems at once; Inertia dev-warns.
144
+
145
+ Auto-layout transitions ship via the `layout` prop (`true` / `TransitionConfig`) on every `Motion.*` primitive — see Layout. Shared element transitions ship via the `layoutId` prop: pair the same id on a source and target `Motion.*` and Inertia FLIPs between them on mount (1s TTL). Alongside the rect, a fixed set of style keys is carried from the source and crossfaded out on the same transition — `opacity`, `borderRadius`, `backgroundColor`, `borderColor`, `color`, `tintColor` — but only for keys the element already has a value for, from a record or its static `style`; transform keys are not carried because the FLIP owns them. Rects are measured in **window** coordinates via `measureInWindow` where the host resolves it synchronously (Fabric), which is what lets source and target sit under differently-offset parents; elsewhere both fall back to parent-relative `onLayout` coords. A source and target in different coordinate spaces skip the animation rather than play a wrong one. A still-mounted source is re-measured when the target lays out, so an ancestor scroll (which never fires `onLayout`) doesn't offset the transition.
144
146
 
145
147
  ## Optional adapter packages
146
148
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/inertia",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
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
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `@rootnative/inertia` — declarative animation primitives for React Native.
3
3
  *
4
- * v0.1 surface: `Motion.View` / `Motion.Text` / `Motion.Image` /
4
+ * Public surface: `Motion.View` / `Motion.Text` / `Motion.Image` /
5
5
  * `Motion.Pressable` / `Motion.ScrollView`, with `initial` / `animate` /
6
6
  * `exit` / `transition` / `variants` / `gesture` / `controller` /
7
7
  * `onAnimationEnd` props. Sequences, repeats (single-value and
@@ -82,6 +82,7 @@ export type {
82
82
  AnimatableValue,
83
83
  AnimateStyle,
84
84
  AnimationCallbackInfo,
85
+ BoxShadowInput,
85
86
  DecayTransition,
86
87
  EasingFunction,
87
88
  EasingFunctionFactory,