@rootnative/inertia 0.0.5 → 0.0.6

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 (37) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/README.md +1 -1
  3. package/dist/{chunk-RIVVBABB.mjs → chunk-2ICQLWH2.mjs} +81 -34
  4. package/dist/{chunk-27U6766G.js → chunk-5MGWHOSV.js} +2 -2
  5. package/dist/{chunk-VQ5D35UA.js → chunk-767UKZXG.js} +81 -33
  6. package/dist/{chunk-27MKBTSG.mjs → chunk-BAAQI37F.mjs} +1 -1
  7. package/dist/{chunk-OAUWLPQH.mjs → chunk-C3EDC5ZW.mjs} +1 -1
  8. package/dist/{chunk-GTJ6VAH5.mjs → chunk-CMHVF6F4.mjs} +1 -1
  9. package/dist/{chunk-COEJVWRZ.mjs → chunk-F7LJX56B.mjs} +1 -1
  10. package/dist/chunk-FWWVHLXB.js +8 -0
  11. package/dist/chunk-K5SI6VXS.js +8 -0
  12. package/dist/{chunk-XSK5MNUH.mjs → chunk-PFPO7DX2.mjs} +1 -1
  13. package/dist/chunk-STARIT6W.js +8 -0
  14. package/dist/{chunk-QQVDZKSD.js → chunk-X7B5WR5A.js} +2 -2
  15. package/dist/index.d.mts +29 -1
  16. package/dist/index.d.ts +29 -1
  17. package/dist/index.js +26 -22
  18. package/dist/index.mjs +12 -12
  19. package/dist/motion/Image.js +3 -3
  20. package/dist/motion/Image.mjs +2 -2
  21. package/dist/motion/Pressable.js +3 -3
  22. package/dist/motion/Pressable.mjs +2 -2
  23. package/dist/motion/ScrollView.js +3 -3
  24. package/dist/motion/ScrollView.mjs +2 -2
  25. package/dist/motion/Text.js +3 -3
  26. package/dist/motion/Text.mjs +2 -2
  27. package/dist/motion/View.js +3 -3
  28. package/dist/motion/View.mjs +2 -2
  29. package/llms.txt +1 -0
  30. package/package.json +1 -1
  31. package/src/index.ts +4 -0
  32. package/src/internal/boxShadow.ts +71 -9
  33. package/src/internal/color.ts +70 -0
  34. package/src/motion/createMotionComponent.tsx +93 -47
  35. package/dist/chunk-67GHRCF6.js +0 -8
  36. package/dist/chunk-GPOMFIIU.js +0 -8
  37. package/dist/chunk-K63LXGKS.js +0 -8
package/dist/index.d.mts CHANGED
@@ -292,6 +292,34 @@ declare function ensureWorkletEasing(easing: EasingInput | undefined): ((t: numb
292
292
  */
293
293
  declare function buildReleaseAnimation(transition: TransitionConfig, toValue: number): unknown;
294
294
 
295
+ /**
296
+ * The one colour spelling Reanimated's animation drivers cannot accept.
297
+ *
298
+ * Reanimated dispatches an animation on the runtime shape of its **source**
299
+ * value, and `isColor()` is the gate for the RGBA-channel path. That gate is
300
+ * `processColorInitially(value) != null`, and Reanimated's colour-name table
301
+ * (`Colors.ts`) maps `transparent` to `undefined` — every other CSS colour
302
+ * name maps to a packed integer. So `'transparent'` is the single named colour
303
+ * that reports **false**.
304
+ *
305
+ * A value that fails the gate but is still a string falls to the
306
+ * prefix-number-suffix branch, which exists for values like `'100%'`. It runs
307
+ * `parseFloat('transparent')` → `NaN`, animates that, and re-attaches the
308
+ * prefix, so the slot fills with `'transparentNaN'`. Under `withTiming` the
309
+ * animation still snaps to its target when the duration elapses, which hides
310
+ * the fault; under `withSpring` — the library default — settling is decided by
311
+ * comparisons against `NaN`, which are all false, so the animation runs
312
+ * forever and the colour never appears.
313
+ *
314
+ * `'rgba(0, 0, 0, 0)'` is the same colour and passes the gate.
315
+ *
316
+ * This only applies to values handed to `withSpring` / `withTiming`.
317
+ * `interpolateColor` parses `'transparent'` correctly, which is why the
318
+ * gesture cascade, the shared-element carry, and `useShadow` are unaffected
319
+ * and keep the consumer's own spelling.
320
+ */
321
+ declare const TRANSPARENT = "rgba(0, 0, 0, 0)";
322
+
295
323
  /**
296
324
  * Drive a `SharedValue<number>` toward `target` with **any** transition shape
297
325
  * — spring, timing, decay, or no-animation — or a `TransitionName` registered
@@ -869,4 +897,4 @@ declare function useShadow({ from, to, progress, }: UseShadowOptions): ReturnTyp
869
897
  */
870
898
  declare function useVariants<V extends Readonly<Record<string, object>>>(variants: V, initial?: keyof V & string): VariantController<keyof V & string>;
871
899
 
872
- export { AnimatableValue, type Animator, type BoxShadowLayer, type ColorCascadeLayer, type ColorStyleKey, EasingInput, type ExtrapolationMode, type InterpolatedStyleMap, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, NamedTransitions, type NumericStyleKey, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, type TransformKey, TransitionConfig, TransitionInput, TransitionName, type UseColorCascadeOptions, type UseColorTransitionOptions, type UseInterpolatedStyleOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useAnimator, useBooleanSpring, useColorCascade, useColorTransition, useInterpolatedStyle, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };
900
+ export { AnimatableValue, type Animator, type BoxShadowLayer, type ColorCascadeLayer, type ColorStyleKey, EasingInput, type ExtrapolationMode, type InterpolatedStyleMap, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, NamedTransitions, type NumericStyleKey, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, TRANSPARENT, type TransformKey, TransitionConfig, TransitionInput, TransitionName, type UseColorCascadeOptions, type UseColorTransitionOptions, type UseInterpolatedStyleOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useAnimator, useBooleanSpring, useColorCascade, useColorTransition, useInterpolatedStyle, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };
package/dist/index.d.ts CHANGED
@@ -292,6 +292,34 @@ declare function ensureWorkletEasing(easing: EasingInput | undefined): ((t: numb
292
292
  */
293
293
  declare function buildReleaseAnimation(transition: TransitionConfig, toValue: number): unknown;
294
294
 
295
+ /**
296
+ * The one colour spelling Reanimated's animation drivers cannot accept.
297
+ *
298
+ * Reanimated dispatches an animation on the runtime shape of its **source**
299
+ * value, and `isColor()` is the gate for the RGBA-channel path. That gate is
300
+ * `processColorInitially(value) != null`, and Reanimated's colour-name table
301
+ * (`Colors.ts`) maps `transparent` to `undefined` — every other CSS colour
302
+ * name maps to a packed integer. So `'transparent'` is the single named colour
303
+ * that reports **false**.
304
+ *
305
+ * A value that fails the gate but is still a string falls to the
306
+ * prefix-number-suffix branch, which exists for values like `'100%'`. It runs
307
+ * `parseFloat('transparent')` → `NaN`, animates that, and re-attaches the
308
+ * prefix, so the slot fills with `'transparentNaN'`. Under `withTiming` the
309
+ * animation still snaps to its target when the duration elapses, which hides
310
+ * the fault; under `withSpring` — the library default — settling is decided by
311
+ * comparisons against `NaN`, which are all false, so the animation runs
312
+ * forever and the colour never appears.
313
+ *
314
+ * `'rgba(0, 0, 0, 0)'` is the same colour and passes the gate.
315
+ *
316
+ * This only applies to values handed to `withSpring` / `withTiming`.
317
+ * `interpolateColor` parses `'transparent'` correctly, which is why the
318
+ * gesture cascade, the shared-element carry, and `useShadow` are unaffected
319
+ * and keep the consumer's own spelling.
320
+ */
321
+ declare const TRANSPARENT = "rgba(0, 0, 0, 0)";
322
+
295
323
  /**
296
324
  * Drive a `SharedValue<number>` toward `target` with **any** transition shape
297
325
  * — spring, timing, decay, or no-animation — or a `TransitionName` registered
@@ -869,4 +897,4 @@ declare function useShadow({ from, to, progress, }: UseShadowOptions): ReturnTyp
869
897
  */
870
898
  declare function useVariants<V extends Readonly<Record<string, object>>>(variants: V, initial?: keyof V & string): VariantController<keyof V & string>;
871
899
 
872
- export { AnimatableValue, type Animator, type BoxShadowLayer, type ColorCascadeLayer, type ColorStyleKey, EasingInput, type ExtrapolationMode, type InterpolatedStyleMap, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, NamedTransitions, type NumericStyleKey, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, type TransformKey, TransitionConfig, TransitionInput, TransitionName, type UseColorCascadeOptions, type UseColorTransitionOptions, type UseInterpolatedStyleOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useAnimator, useBooleanSpring, useColorCascade, useColorTransition, useInterpolatedStyle, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };
900
+ export { AnimatableValue, type Animator, type BoxShadowLayer, type ColorCascadeLayer, type ColorStyleKey, EasingInput, type ExtrapolationMode, type InterpolatedStyleMap, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, NamedTransitions, type NumericStyleKey, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, TRANSPARENT, type TransformKey, TransitionConfig, TransitionInput, TransitionName, type UseColorCascadeOptions, type UseColorTransitionOptions, type UseInterpolatedStyleOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useAnimator, useBooleanSpring, useColorCascade, useColorTransition, useInterpolatedStyle, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk4NAMD62I_js = require('./chunk-4NAMD62I.js');
4
- var chunkK63LXGKS_js = require('./chunk-K63LXGKS.js');
5
- var chunk67GHRCF6_js = require('./chunk-67GHRCF6.js');
6
- var chunkGPOMFIIU_js = require('./chunk-GPOMFIIU.js');
7
- var chunk27U6766G_js = require('./chunk-27U6766G.js');
8
- var chunkQQVDZKSD_js = require('./chunk-QQVDZKSD.js');
9
- var chunkVQ5D35UA_js = require('./chunk-VQ5D35UA.js');
4
+ var chunkK5SI6VXS_js = require('./chunk-K5SI6VXS.js');
5
+ var chunkSTARIT6W_js = require('./chunk-STARIT6W.js');
6
+ var chunkFWWVHLXB_js = require('./chunk-FWWVHLXB.js');
7
+ var chunk5MGWHOSV_js = require('./chunk-5MGWHOSV.js');
8
+ var chunkX7B5WR5A_js = require('./chunk-X7B5WR5A.js');
9
+ var chunk767UKZXG_js = require('./chunk-767UKZXG.js');
10
10
  var chunkOBRGJAST_js = require('./chunk-OBRGJAST.js');
11
11
  var chunkPM6CVGXJ_js = require('./chunk-PM6CVGXJ.js');
12
12
  var react = require('react');
@@ -15,11 +15,11 @@ var reactNativeWorklets = require('react-native-worklets');
15
15
 
16
16
  // src/motion/index.ts
17
17
  var Motion = {
18
- View: chunkK63LXGKS_js.MotionView,
19
- Text: chunk67GHRCF6_js.MotionText,
20
- Image: chunkGPOMFIIU_js.MotionImage,
21
- Pressable: chunk27U6766G_js.MotionPressable,
22
- ScrollView: chunkQQVDZKSD_js.MotionScrollView
18
+ View: chunkK5SI6VXS_js.MotionView,
19
+ Text: chunkSTARIT6W_js.MotionText,
20
+ Image: chunkFWWVHLXB_js.MotionImage,
21
+ Pressable: chunk5MGWHOSV_js.MotionPressable,
22
+ ScrollView: chunkX7B5WR5A_js.MotionScrollView
23
23
  };
24
24
  function useAnimation(target, transition) {
25
25
  const output = reactNativeReanimated.useSharedValue(target);
@@ -362,9 +362,9 @@ function useShadow({
362
362
  const hasElevation = from.elevation !== void 0 || to.elevation !== void 0;
363
363
  const hasColor = from.shadowColor !== void 0 || to.shadowColor !== void 0;
364
364
  const hasOffset = from.shadowOffset !== void 0 || to.shadowOffset !== void 0;
365
- const boxShadowPairs = from.boxShadow !== void 0 || to.boxShadow !== void 0 ? chunkVQ5D35UA_js.pairBoxShadowLayers(
366
- chunkVQ5D35UA_js.resolveBoxShadowInput(from.boxShadow),
367
- chunkVQ5D35UA_js.resolveBoxShadowInput(to.boxShadow)
365
+ const boxShadowPairs = from.boxShadow !== void 0 || to.boxShadow !== void 0 ? chunk767UKZXG_js.pairBoxShadowLayers(
366
+ chunk767UKZXG_js.resolveBoxShadowInput(from.boxShadow),
367
+ chunk767UKZXG_js.resolveBoxShadowInput(to.boxShadow)
368
368
  ) : [];
369
369
  const opacityFrom = from.shadowOpacity ?? 0;
370
370
  const opacityTo = to.shadowOpacity ?? 0;
@@ -467,35 +467,39 @@ Object.defineProperty(exports, "useGesture", {
467
467
  });
468
468
  Object.defineProperty(exports, "MotionView", {
469
469
  enumerable: true,
470
- get: function () { return chunkK63LXGKS_js.MotionView; }
470
+ get: function () { return chunkK5SI6VXS_js.MotionView; }
471
471
  });
472
472
  Object.defineProperty(exports, "MotionText", {
473
473
  enumerable: true,
474
- get: function () { return chunk67GHRCF6_js.MotionText; }
474
+ get: function () { return chunkSTARIT6W_js.MotionText; }
475
475
  });
476
476
  Object.defineProperty(exports, "MotionImage", {
477
477
  enumerable: true,
478
- get: function () { return chunkGPOMFIIU_js.MotionImage; }
478
+ get: function () { return chunkFWWVHLXB_js.MotionImage; }
479
479
  });
480
480
  Object.defineProperty(exports, "MotionPressable", {
481
481
  enumerable: true,
482
- get: function () { return chunk27U6766G_js.MotionPressable; }
482
+ get: function () { return chunk5MGWHOSV_js.MotionPressable; }
483
483
  });
484
484
  Object.defineProperty(exports, "MotionScrollView", {
485
485
  enumerable: true,
486
- get: function () { return chunkQQVDZKSD_js.MotionScrollView; }
486
+ get: function () { return chunkX7B5WR5A_js.MotionScrollView; }
487
487
  });
488
488
  Object.defineProperty(exports, "Presence", {
489
489
  enumerable: true,
490
- get: function () { return chunkVQ5D35UA_js.Presence; }
490
+ get: function () { return chunk767UKZXG_js.Presence; }
491
+ });
492
+ Object.defineProperty(exports, "TRANSPARENT", {
493
+ enumerable: true,
494
+ get: function () { return chunk767UKZXG_js.TRANSPARENT; }
491
495
  });
492
496
  Object.defineProperty(exports, "createMotionComponent", {
493
497
  enumerable: true,
494
- get: function () { return chunkVQ5D35UA_js.createMotionComponent; }
498
+ get: function () { return chunk767UKZXG_js.createMotionComponent; }
495
499
  });
496
500
  Object.defineProperty(exports, "usePresence", {
497
501
  enumerable: true,
498
- get: function () { return chunkVQ5D35UA_js.usePresence; }
502
+ get: function () { return chunk767UKZXG_js.usePresence; }
499
503
  });
500
504
  Object.defineProperty(exports, "MotionConfig", {
501
505
  enumerable: true,
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  export { useGesture } from './chunk-OW5XTGVN.mjs';
2
- import { MotionView } from './chunk-GTJ6VAH5.mjs';
3
- export { MotionView } from './chunk-GTJ6VAH5.mjs';
4
- import { MotionText } from './chunk-COEJVWRZ.mjs';
5
- export { MotionText } from './chunk-COEJVWRZ.mjs';
6
- import { MotionImage } from './chunk-XSK5MNUH.mjs';
7
- export { MotionImage } from './chunk-XSK5MNUH.mjs';
8
- import { MotionPressable } from './chunk-OAUWLPQH.mjs';
9
- export { MotionPressable } from './chunk-OAUWLPQH.mjs';
10
- import { MotionScrollView } from './chunk-27MKBTSG.mjs';
11
- export { MotionScrollView } from './chunk-27MKBTSG.mjs';
12
- import { pairBoxShadowLayers, resolveBoxShadowInput } from './chunk-RIVVBABB.mjs';
13
- export { Presence, createMotionComponent, usePresence } from './chunk-RIVVBABB.mjs';
2
+ import { MotionView } from './chunk-CMHVF6F4.mjs';
3
+ export { MotionView } from './chunk-CMHVF6F4.mjs';
4
+ import { MotionText } from './chunk-F7LJX56B.mjs';
5
+ export { MotionText } from './chunk-F7LJX56B.mjs';
6
+ import { MotionImage } from './chunk-PFPO7DX2.mjs';
7
+ export { MotionImage } from './chunk-PFPO7DX2.mjs';
8
+ import { MotionPressable } from './chunk-C3EDC5ZW.mjs';
9
+ export { MotionPressable } from './chunk-C3EDC5ZW.mjs';
10
+ import { MotionScrollView } from './chunk-BAAQI37F.mjs';
11
+ export { MotionScrollView } from './chunk-BAAQI37F.mjs';
12
+ import { pairBoxShadowLayers, resolveBoxShadowInput } from './chunk-2ICQLWH2.mjs';
13
+ export { Presence, TRANSPARENT, createMotionComponent, usePresence } from './chunk-2ICQLWH2.mjs';
14
14
  import { useShouldReduceMotion, resolveNamedTransition, useNamedTransitions, lookupNamedTransition } from './chunk-Z3HCJ43H.mjs';
15
15
  export { MotionConfig, resolveNamedTransition, useMotionConfig, useNamedTransitions, useShouldReduceMotion } from './chunk-Z3HCJ43H.mjs';
16
16
  import { stableSig, resolveTransition, springToReanimated, warnNonWorkletOnce } from './chunk-REYL77RE.mjs';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkGPOMFIIU_js = require('../chunk-GPOMFIIU.js');
4
- require('../chunk-VQ5D35UA.js');
3
+ var chunkFWWVHLXB_js = require('../chunk-FWWVHLXB.js');
4
+ require('../chunk-767UKZXG.js');
5
5
  require('../chunk-OBRGJAST.js');
6
6
  require('../chunk-PM6CVGXJ.js');
7
7
 
@@ -9,5 +9,5 @@ require('../chunk-PM6CVGXJ.js');
9
9
 
10
10
  Object.defineProperty(exports, "MotionImage", {
11
11
  enumerable: true,
12
- get: function () { return chunkGPOMFIIU_js.MotionImage; }
12
+ get: function () { return chunkFWWVHLXB_js.MotionImage; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionImage } from '../chunk-XSK5MNUH.mjs';
2
- import '../chunk-RIVVBABB.mjs';
1
+ export { MotionImage } from '../chunk-PFPO7DX2.mjs';
2
+ import '../chunk-2ICQLWH2.mjs';
3
3
  import '../chunk-Z3HCJ43H.mjs';
4
4
  import '../chunk-REYL77RE.mjs';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk27U6766G_js = require('../chunk-27U6766G.js');
4
- require('../chunk-VQ5D35UA.js');
3
+ var chunk5MGWHOSV_js = require('../chunk-5MGWHOSV.js');
4
+ require('../chunk-767UKZXG.js');
5
5
  require('../chunk-OBRGJAST.js');
6
6
  require('../chunk-PM6CVGXJ.js');
7
7
 
@@ -9,5 +9,5 @@ require('../chunk-PM6CVGXJ.js');
9
9
 
10
10
  Object.defineProperty(exports, "MotionPressable", {
11
11
  enumerable: true,
12
- get: function () { return chunk27U6766G_js.MotionPressable; }
12
+ get: function () { return chunk5MGWHOSV_js.MotionPressable; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionPressable } from '../chunk-OAUWLPQH.mjs';
2
- import '../chunk-RIVVBABB.mjs';
1
+ export { MotionPressable } from '../chunk-C3EDC5ZW.mjs';
2
+ import '../chunk-2ICQLWH2.mjs';
3
3
  import '../chunk-Z3HCJ43H.mjs';
4
4
  import '../chunk-REYL77RE.mjs';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkQQVDZKSD_js = require('../chunk-QQVDZKSD.js');
4
- require('../chunk-VQ5D35UA.js');
3
+ var chunkX7B5WR5A_js = require('../chunk-X7B5WR5A.js');
4
+ require('../chunk-767UKZXG.js');
5
5
  require('../chunk-OBRGJAST.js');
6
6
  require('../chunk-PM6CVGXJ.js');
7
7
 
@@ -9,5 +9,5 @@ require('../chunk-PM6CVGXJ.js');
9
9
 
10
10
  Object.defineProperty(exports, "MotionScrollView", {
11
11
  enumerable: true,
12
- get: function () { return chunkQQVDZKSD_js.MotionScrollView; }
12
+ get: function () { return chunkX7B5WR5A_js.MotionScrollView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionScrollView } from '../chunk-27MKBTSG.mjs';
2
- import '../chunk-RIVVBABB.mjs';
1
+ export { MotionScrollView } from '../chunk-BAAQI37F.mjs';
2
+ import '../chunk-2ICQLWH2.mjs';
3
3
  import '../chunk-Z3HCJ43H.mjs';
4
4
  import '../chunk-REYL77RE.mjs';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk67GHRCF6_js = require('../chunk-67GHRCF6.js');
4
- require('../chunk-VQ5D35UA.js');
3
+ var chunkSTARIT6W_js = require('../chunk-STARIT6W.js');
4
+ require('../chunk-767UKZXG.js');
5
5
  require('../chunk-OBRGJAST.js');
6
6
  require('../chunk-PM6CVGXJ.js');
7
7
 
@@ -9,5 +9,5 @@ require('../chunk-PM6CVGXJ.js');
9
9
 
10
10
  Object.defineProperty(exports, "MotionText", {
11
11
  enumerable: true,
12
- get: function () { return chunk67GHRCF6_js.MotionText; }
12
+ get: function () { return chunkSTARIT6W_js.MotionText; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionText } from '../chunk-COEJVWRZ.mjs';
2
- import '../chunk-RIVVBABB.mjs';
1
+ export { MotionText } from '../chunk-F7LJX56B.mjs';
2
+ import '../chunk-2ICQLWH2.mjs';
3
3
  import '../chunk-Z3HCJ43H.mjs';
4
4
  import '../chunk-REYL77RE.mjs';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkK63LXGKS_js = require('../chunk-K63LXGKS.js');
4
- require('../chunk-VQ5D35UA.js');
3
+ var chunkK5SI6VXS_js = require('../chunk-K5SI6VXS.js');
4
+ require('../chunk-767UKZXG.js');
5
5
  require('../chunk-OBRGJAST.js');
6
6
  require('../chunk-PM6CVGXJ.js');
7
7
 
@@ -9,5 +9,5 @@ require('../chunk-PM6CVGXJ.js');
9
9
 
10
10
  Object.defineProperty(exports, "MotionView", {
11
11
  enumerable: true,
12
- get: function () { return chunkK63LXGKS_js.MotionView; }
12
+ get: function () { return chunkK5SI6VXS_js.MotionView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionView } from '../chunk-GTJ6VAH5.mjs';
2
- import '../chunk-RIVVBABB.mjs';
1
+ export { MotionView } from '../chunk-CMHVF6F4.mjs';
2
+ import '../chunk-2ICQLWH2.mjs';
3
3
  import '../chunk-Z3HCJ43H.mjs';
4
4
  import '../chunk-REYL77RE.mjs';
package/llms.txt CHANGED
@@ -67,6 +67,7 @@ import { MotionScrollView } from '@rootnative/inertia/scroll-view'
67
67
  - `resolveAnimatableValue(value, base, factory?)` — one level up: resolves a full per-property `animate` value (plain target, `{ to, ...override }` step, or keyframe array → `withSequence` with sequence-level `repeat`) into one animation. Gives custom components the complete `animate` grammar.
68
68
  - `cubicBezier(x1, y1, x2, y2)` / `cubicBezier(css)` — builds a `timing.easing` value from cubic-bezier control points: four numbers, a W3C CSS `cubic-bezier(0.2, 0, 0, 1)` string (design-token form), or a CSS keyword (`'linear'` | `'ease'` | `'ease-in'` | `'ease-out'` | `'ease-in-out'`). Makes CSS-format easing tokens directly consumable — pair with named transitions to feed a theme's motion tokens into the registry. Invalid input throws (`x1`/`x2` must be within [0, 1]; `step-*` and `linear(...)` unsupported).
69
69
  - `ensureWorkletEasing(easing)` — normalizes any accepted easing input (plain function, worklet, or Reanimated 4 `EasingFunctionFactory`) into a worklet `withTiming` can consume. Only needed for manual `withTiming` calls — the resolvers and primitives apply it automatically.
70
+ - `TRANSPARENT` — `'rgba(0, 0, 0, 0)'`, the value to seed a colour shared value with when a custom component has no other source. Not `'transparent'`: Reanimated's colour table maps that keyword to `undefined`, so it is the one CSS colour name `isColor()` rejects, and a slot resting at it cannot be animated away from — under `withTiming` the target still snaps in at the end, under `withSpring` (the default) the animation never settles. Only affects values passed to `withSpring` / `withTiming`; `interpolateColor` parses the keyword fine, so hooks that interpolate colours themselves are unaffected.
70
71
  - `SharedValue<T>` (type) — re-exported from the root entry so props/refs that carry a value-layer hook result can be typed without importing from `react-native-reanimated`.
71
72
  - `@rootnative/inertia/reanimated` — render-layer interop subpath: pure re-exports of `Animated`, `createAnimatedComponent`, `useAnimatedStyle`, `useAnimatedProps`, `useDerivedValue`, `interpolate`, `interpolateColor`, `Extrapolation`, `cancelAnimation` (plus `SharedValue` / `DerivedValue` / `AnimatedStyle` / `AnimatedProps` types) under their original Reanimated names, for components that own their own `useAnimatedStyle` worklet over Inertia-driven shared values. Names must stay original — the Reanimated Babel plugin auto-workletizes callbacks by callee name. The `with*` animation factories are deliberately not re-exported; start animations with `useAnimation` / `resolveTransition` / `buildReleaseAnimation`.
72
73
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/inertia",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
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
@@ -39,6 +39,10 @@ export {
39
39
  resolveAnimatableValue,
40
40
  ensureWorkletEasing,
41
41
  } from './transitions'
42
+ // Seed value for any color shared value a custom animated component drives
43
+ // through `resolveTransition`. Exported because the obvious choice —
44
+ // `'transparent'` — cannot be animated away from; see the symbol's own docs.
45
+ export { TRANSPARENT } from './internal/color'
42
46
  export {
43
47
  useAnimation,
44
48
  useAnimator,
@@ -12,6 +12,8 @@
12
12
  * loudly there, not silently render the wrong elevation.
13
13
  */
14
14
 
15
+ import { normalizeAnimatableColor, TRANSPARENT } from './color'
16
+
15
17
  /**
16
18
  * One layer of a `box-shadow`, structurally mirroring React Native's
17
19
  * `BoxShadowValue` (RN 0.76+ `boxShadow` style). Lengths are px numbers.
@@ -205,7 +207,7 @@ function invisibleLayer(inset: boolean): ResolvedBoxShadowLayer {
205
207
  offsetY: 0,
206
208
  blurRadius: 0,
207
209
  spreadDistance: 0,
208
- color: 'transparent',
210
+ color: TRANSPARENT,
209
211
  inset,
210
212
  }
211
213
  }
@@ -225,10 +227,10 @@ function invisibleLayer(inset: boolean): ResolvedBoxShadowLayer {
225
227
  * drive, and nothing it can't.
226
228
  *
227
229
  * `inset` is deliberately absent. `withTiming` / `withSpring` recurse into
228
- * arrays and objects and animate each leaf, and a boolean leaf falls through
229
- * to the plain numeric path — `false + (false - false) * p` evaluates to `0`,
230
- * so an in-flight frame hands the native shadow a number where it expects a
231
- * boolean. Inset is instead carried alongside as a static per-layer flag (see
230
+ * objects and animate each leaf, and a boolean leaf falls through to the plain
231
+ * numeric path — `false + (false - false) * p` evaluates to `0`, so an
232
+ * in-flight frame hands the native shadow a number where it expects a boolean.
233
+ * Inset is instead carried alongside as a static per-layer flag (see
232
234
  * `SplitBoxShadow.insets`) and reattached when the style is emitted.
233
235
  */
234
236
  export interface AnimatedBoxShadowLayer {
@@ -295,10 +297,16 @@ function coerceLength(value: unknown, field: string): number {
295
297
  return parseFloat(trimmed)
296
298
  }
297
299
 
298
- /** Drop `inset`, leaving only the fields Reanimated may drive. */
300
+ /**
301
+ * Drop `inset`, leaving only the fields Reanimated may drive, and rewrite a
302
+ * `'transparent'` colour to its RGBA spelling — see {@link TRANSPARENT} for
303
+ * why the CSS keyword cannot be animated. Done here rather than at parse time
304
+ * so the `useShadow` path, which interpolates colours itself and accepts the
305
+ * keyword happily, keeps the consumer's own spelling.
306
+ */
299
307
  function strip(layer: ResolvedBoxShadowLayer): AnimatedBoxShadowLayer {
300
- const { inset: _inset, ...rest } = layer
301
- return rest
308
+ const { inset: _inset, color, ...rest } = layer
309
+ return { ...rest, color: normalizeAnimatableColor(color) }
302
310
  }
303
311
 
304
312
  /**
@@ -335,7 +343,7 @@ export function normalizeBoxShadow(input: BoxShadowInput): SplitBoxShadow {
335
343
  * Prepare a from/to pair for a Reanimated-driven `boxShadow` animation.
336
344
  *
337
345
  * Both sides come back padded to the same layer count, because Reanimated's
338
- * `arrayOnStart` walks the **current** value's indices and reads `toValue[i]`
346
+ * `objectOnStart` walks the **current** value's keys and reads `toValue[key]`
339
347
  * for each — a target with fewer layers leaves the surplus leaves with
340
348
  * `toValue: undefined`, and a target with more never animates the extras at
341
349
  * all. `pairBoxShadowLayers` supplies the padding (a transparent zero layer,
@@ -373,3 +381,57 @@ export function prepareBoxShadowAnimation(
373
381
  }
374
382
  return { from, to, insets }
375
383
  }
384
+
385
+ /**
386
+ * The shape a `boxShadow` shared value actually holds: layers keyed by their
387
+ * index (`{ 0: layer, 1: layer }`) rather than an array.
388
+ *
389
+ * **This is not cosmetic, and an array does not work here.** Reanimated's
390
+ * animation drivers walk a structured value by dispatching on each leaf's
391
+ * runtime shape, but the two container branches are not symmetrical
392
+ * (`animation/util.ts`):
393
+ *
394
+ * - `objectOnStart` re-assigns the **decorated** `onStart` onto each child
395
+ * (`animation[key].onStart = animation.onStart`), so a child that is itself
396
+ * an object or a colour is dispatched again, recursively.
397
+ * - `arrayOnStart` does not. Each element gets the **base** scalar `onStart`,
398
+ * so anything other than a number is handed straight to the spring/timing
399
+ * maths. A layer object yields `object - object` → `NaN`; a colour string
400
+ * yields the same.
401
+ *
402
+ * The failure is silent and total: `withTiming` still snaps to the target when
403
+ * its duration elapses, so an array *looks* like it works, while `withSpring`
404
+ * — Inertia's default — decides it has settled only when
405
+ * `isAnimationTerminatingCalculation` says so, and every comparison against
406
+ * `NaN` is false. The animation never finishes, the shared value holds
407
+ * `'[object Object]NaN'` forever, `onAnimationEnd` never fires, and the frame
408
+ * loop never stops.
409
+ *
410
+ * Keying by index sends the layer list down the object branch, where the
411
+ * recursion works and each layer's colour reaches the RGBA-channel path.
412
+ */
413
+ export type BoxShadowPayload = Record<string, AnimatedBoxShadowLayer>
414
+
415
+ /** Index-key a layer list into the shape a shared value can animate. */
416
+ export function layersToPayload(
417
+ layers: readonly AnimatedBoxShadowLayer[],
418
+ ): BoxShadowPayload {
419
+ const payload: BoxShadowPayload = {}
420
+ for (let i = 0; i < layers.length; i++) payload[i] = layers[i]!
421
+ return payload
422
+ }
423
+
424
+ /**
425
+ * Read an index-keyed payload back out as a layer list.
426
+ *
427
+ * Callable from a worklet: the loop stops at the first missing index rather
428
+ * than asking for the key set, so no `Object.keys` runs at frame time.
429
+ */
430
+ export function payloadToLayers(
431
+ payload: BoxShadowPayload,
432
+ ): AnimatedBoxShadowLayer[] {
433
+ 'worklet'
434
+ const layers: AnimatedBoxShadowLayer[] = []
435
+ for (let i = 0; payload[i] !== undefined; i++) layers.push(payload[i]!)
436
+ return layers
437
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The one colour spelling Reanimated's animation drivers cannot accept.
3
+ *
4
+ * Reanimated dispatches an animation on the runtime shape of its **source**
5
+ * value, and `isColor()` is the gate for the RGBA-channel path. That gate is
6
+ * `processColorInitially(value) != null`, and Reanimated's colour-name table
7
+ * (`Colors.ts`) maps `transparent` to `undefined` — every other CSS colour
8
+ * name maps to a packed integer. So `'transparent'` is the single named colour
9
+ * that reports **false**.
10
+ *
11
+ * A value that fails the gate but is still a string falls to the
12
+ * prefix-number-suffix branch, which exists for values like `'100%'`. It runs
13
+ * `parseFloat('transparent')` → `NaN`, animates that, and re-attaches the
14
+ * prefix, so the slot fills with `'transparentNaN'`. Under `withTiming` the
15
+ * animation still snaps to its target when the duration elapses, which hides
16
+ * the fault; under `withSpring` — the library default — settling is decided by
17
+ * comparisons against `NaN`, which are all false, so the animation runs
18
+ * forever and the colour never appears.
19
+ *
20
+ * `'rgba(0, 0, 0, 0)'` is the same colour and passes the gate.
21
+ *
22
+ * This only applies to values handed to `withSpring` / `withTiming`.
23
+ * `interpolateColor` parses `'transparent'` correctly, which is why the
24
+ * gesture cascade, the shared-element carry, and `useShadow` are unaffected
25
+ * and keep the consumer's own spelling.
26
+ */
27
+ export const TRANSPARENT = 'rgba(0, 0, 0, 0)'
28
+
29
+ /**
30
+ * Rewrite `'transparent'` to a spelling Reanimated recognises. Any other value
31
+ * — a different colour, a number, a non-string — is returned untouched, by
32
+ * reference, so this costs nothing on the overwhelmingly common path.
33
+ */
34
+ export function normalizeAnimatableColor<T>(value: T): T | string {
35
+ return value === 'transparent' ? TRANSPARENT : value
36
+ }
37
+
38
+ /**
39
+ * Apply {@link normalizeAnimatableColor} across a whole `animate` target for a
40
+ * colour key, including the sequence forms — a keyframe array whose entries are
41
+ * either raw values or `{ to, ...transitionOverride }` step objects.
42
+ *
43
+ * Returns the input by reference when nothing needed rewriting, so an
44
+ * unaffected target neither allocates nor breaks any identity a caller relies
45
+ * on.
46
+ */
47
+ export function normalizeAnimatableColorTarget<T>(target: T): T {
48
+ if (typeof target === 'string') {
49
+ return normalizeAnimatableColor(target) as T
50
+ }
51
+ if (!Array.isArray(target)) return target
52
+
53
+ let changed = false
54
+ const next = target.map((step) => {
55
+ if (step === 'transparent') {
56
+ changed = true
57
+ return TRANSPARENT
58
+ }
59
+ if (
60
+ step !== null &&
61
+ typeof step === 'object' &&
62
+ (step as { to?: unknown }).to === 'transparent'
63
+ ) {
64
+ changed = true
65
+ return { ...(step as object), to: TRANSPARENT }
66
+ }
67
+ return step
68
+ })
69
+ return (changed ? next : target) as T
70
+ }