@rootnative/inertia 0.0.0-alpha.0 → 0.0.0-alpha.2

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 +10 -0
  2. package/README.md +2 -0
  3. package/dist/gestureLayer/index.d.mts +48 -7
  4. package/dist/gestureLayer/index.d.ts +48 -7
  5. package/dist/gestureLayer/index.js +107 -30
  6. package/dist/gestureLayer/index.mjs +107 -30
  7. package/dist/index.d.mts +127 -16
  8. package/dist/index.d.ts +127 -16
  9. package/dist/index.js +177 -62
  10. package/dist/index.mjs +175 -63
  11. package/dist/motion/Image.d.mts +1 -1
  12. package/dist/motion/Image.d.ts +1 -1
  13. package/dist/motion/Image.js +90 -50
  14. package/dist/motion/Image.mjs +90 -50
  15. package/dist/motion/Pressable.d.mts +1 -1
  16. package/dist/motion/Pressable.d.ts +1 -1
  17. package/dist/motion/Pressable.js +90 -50
  18. package/dist/motion/Pressable.mjs +90 -50
  19. package/dist/motion/ScrollView.d.mts +1 -1
  20. package/dist/motion/ScrollView.d.ts +1 -1
  21. package/dist/motion/ScrollView.js +90 -50
  22. package/dist/motion/ScrollView.mjs +90 -50
  23. package/dist/motion/Text.d.mts +1 -1
  24. package/dist/motion/Text.d.ts +1 -1
  25. package/dist/motion/Text.js +90 -50
  26. package/dist/motion/Text.mjs +90 -50
  27. package/dist/motion/View.d.mts +1 -1
  28. package/dist/motion/View.d.ts +1 -1
  29. package/dist/motion/View.js +90 -50
  30. package/dist/motion/View.mjs +90 -50
  31. package/dist/testing/index.js +0 -2
  32. package/dist/testing/index.mjs +0 -2
  33. package/dist/touch/index.d.mts +1 -1
  34. package/dist/touch/index.d.ts +1 -1
  35. package/dist/touch/index.js +0 -2
  36. package/dist/touch/index.mjs +0 -2
  37. package/dist/{types-cU43dEmH.d.mts → types-BzEgiUdJ.d.mts} +58 -9
  38. package/dist/{types-cU43dEmH.d.ts → types-BzEgiUdJ.d.ts} +58 -9
  39. package/dist/{useGesture-BnY65PlQ.d.ts → useGesture-BRLgiNOC.d.ts} +6 -4
  40. package/dist/{useGesture-DxtXdz-K.d.mts → useGesture-C0GBS7d2.d.mts} +6 -4
  41. package/llms.txt +9 -5
  42. package/package.json +2 -1
  43. package/src/config/MotionConfig.tsx +55 -9
  44. package/src/config/MotionConfigContext.ts +21 -1
  45. package/src/config/index.ts +7 -1
  46. package/src/config/namedTransitions.ts +80 -0
  47. package/src/gestureLayer/index.ts +1 -0
  48. package/src/gestureLayer/useGestureLayer.ts +92 -8
  49. package/src/index.ts +20 -2
  50. package/src/motion/createMotionComponent.tsx +36 -6
  51. package/src/transitions/cubicBezier.ts +126 -0
  52. package/src/transitions/index.ts +1 -0
  53. package/src/types.ts +63 -8
  54. package/src/values/useAnimation.ts +12 -6
  55. package/src/values/useBooleanSpring.ts +5 -3
  56. package/src/values/useGesture.ts +25 -7
  57. package/src/values/useMotionValue.ts +11 -0
  58. package/src/values/useScroll.ts +8 -1
  59. package/src/values/useSpring.ts +46 -9
  60. package/dist/gestureLayer/index.js.map +0 -1
  61. package/dist/gestureLayer/index.mjs.map +0 -1
  62. package/dist/index.js.map +0 -1
  63. package/dist/index.mjs.map +0 -1
  64. package/dist/motion/Image.js.map +0 -1
  65. package/dist/motion/Image.mjs.map +0 -1
  66. package/dist/motion/Pressable.js.map +0 -1
  67. package/dist/motion/Pressable.mjs.map +0 -1
  68. package/dist/motion/ScrollView.js.map +0 -1
  69. package/dist/motion/ScrollView.mjs.map +0 -1
  70. package/dist/motion/Text.js.map +0 -1
  71. package/dist/motion/Text.mjs.map +0 -1
  72. package/dist/motion/View.js.map +0 -1
  73. package/dist/motion/View.mjs.map +0 -1
  74. package/dist/testing/index.js.map +0 -1
  75. package/dist/testing/index.mjs.map +0 -1
  76. package/dist/touch/index.js.map +0 -1
  77. package/dist/touch/index.mjs.map +0 -1
  78. package/src/__type-tests__/animate.test-d.tsx +0 -88
  79. package/src/__type-tests__/variants.test-d.tsx +0 -67
package/dist/index.d.mts CHANGED
@@ -2,10 +2,10 @@ import * as react from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
3
  import * as react_native from 'react-native';
4
4
  import { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
5
- import { M as MotionComponent, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, V as VariantController } from './types-cU43dEmH.mjs';
6
- export { a as AnimateStyle, b as AnimationCallbackInfo, D as DecayTransition, G as GestureSubStates, c as MotionProps, N as NoAnimationTransition, P as PerPropertyTransition, R as RepeatConfig, d as SequenceStep, e as TimingTransition, f as Transition, g as VariantsMap } from './types-cU43dEmH.mjs';
5
+ import { M as MotionComponent, N as NamedTransitions, T as TransitionInput, a as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-BzEgiUdJ.mjs';
6
+ export { c as AnimateStyle, d as AnimationCallbackInfo, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, G as GestureSubStates, g as MotionProps, h as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, i as RepeatConfig, j as SequenceStep, k as TimingTransition, l as Transition, m as VariantsMap } from './types-BzEgiUdJ.mjs';
7
7
  import { SharedValue, useAnimatedStyle } from 'react-native-reanimated';
8
- export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-DxtXdz-K.mjs';
8
+ export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-C0GBS7d2.mjs';
9
9
  export { MotionImage } from './motion/Image.mjs';
10
10
  export { MotionPressable } from './motion/Pressable.mjs';
11
11
  export { MotionScrollView } from './motion/ScrollView.mjs';
@@ -51,6 +51,12 @@ declare const Motion: {
51
51
  type ReducedMotion = 'user' | 'never' | 'always';
52
52
  interface MotionConfigValue {
53
53
  reducedMotion: ReducedMotion;
54
+ /**
55
+ * Named transitions registered by ancestor `<MotionConfig transitions>`
56
+ * providers, already merged (nearest provider wins per name). Empty with no
57
+ * provider — every name then resolves to the unknown-name fallback.
58
+ */
59
+ transitions: NamedTransitions;
54
60
  }
55
61
  /**
56
62
  * Read the active `<MotionConfig>` from a descendant. Returns the default
@@ -63,18 +69,64 @@ declare function useMotionConfig(): MotionConfigValue;
63
69
  * primitives call this to decide whether to swap transitions for
64
70
  * `no-animation`.
65
71
  */
72
+ /**
73
+ * Read the merged named-transition registry from the nearest `<MotionConfig>`
74
+ * ancestors. This is what the Motion primitives and value-layer hooks consult
75
+ * when a `TransitionName` string is passed where a `TransitionConfig` is
76
+ * accepted; custom animated components (and adapter packages) use it together
77
+ * with `resolveNamedTransition` to support names on their own surface.
78
+ */
79
+ declare function useNamedTransitions(): NamedTransitions;
66
80
  declare function useShouldReduceMotion(): boolean;
67
81
 
82
+ interface MotionConfigProps {
83
+ /**
84
+ * How descendants respond to reduced-motion preferences. Inherits from the
85
+ * nearest ancestor `<MotionConfig>` when omitted (the root default is
86
+ * `'user'` — respect the OS accessibility setting).
87
+ */
88
+ reducedMotion?: ReducedMotion;
89
+ /**
90
+ * Named transitions available to every descendant wherever a
91
+ * `TransitionConfig` is accepted — the `transition` prop (top-level and
92
+ * per-property), the `layout` prop, and the value-layer hooks:
93
+ *
94
+ * ```tsx
95
+ * <MotionConfig
96
+ * transitions={{
97
+ * 'state-press': { type: 'timing', duration: 100 },
98
+ * selection: { type: 'spring', tension: 380, friction: 33 },
99
+ * }}
100
+ * >
101
+ * <Motion.View animate={{ scale: 1 }} transition="selection" />
102
+ * </MotionConfig>
103
+ * ```
104
+ *
105
+ * Names resolve at the nearest provider; nested providers merge with the
106
+ * ancestor registry, child entries overriding same-named ancestor entries.
107
+ * Unknown names warn in dev and fall back to the library default spring.
108
+ * Names are consumer vocabulary — Inertia ships no presets.
109
+ */
110
+ transitions?: NamedTransitions;
111
+ children: ReactNode;
112
+ }
68
113
  /**
69
- * Provider that controls how descendant Motion primitives respond to
70
- * reduced-motion preferences. Wrap the root of your app once with the
114
+ * Provider for subtree-wide animation config: reduced-motion behaviour and
115
+ * the named-transition registry. Wrap the root of your app once with the
71
116
  * default (`reducedMotion="user"`) to respect the OS accessibility setting,
72
117
  * or scope a subtree with `'always'` / `'never'` for specific use cases.
118
+ * Nested providers inherit from their ancestor: an omitted prop keeps the
119
+ * ancestor's value, and `transitions` maps merge per name (child wins).
73
120
  */
74
- declare function MotionConfig({ reducedMotion, children, }: {
75
- reducedMotion?: ReducedMotion;
76
- children: ReactNode;
77
- }): react.JSX.Element;
121
+ declare function MotionConfig({ reducedMotion, transitions, children, }: MotionConfigProps): react.JSX.Element;
122
+
123
+ /**
124
+ * Resolve a single transition input — a `TransitionConfig` passes through
125
+ * untouched, a `TransitionName` is looked up in `registry`. This is the
126
+ * building block adapter packages use to accept names wherever they accept a
127
+ * config (pair it with `useNamedTransitions()` for the registry).
128
+ */
129
+ declare function resolveNamedTransition(input: TransitionInput | undefined, registry: NamedTransitions): TransitionConfig | undefined;
78
130
 
79
131
  /**
80
132
  * Wrap a list of children with mount / unmount transitions. When a child is
@@ -154,6 +206,47 @@ declare function resolveTransition(config: TransitionConfig | undefined, toValue
154
206
  */
155
207
  declare function resolveAnimatableValue<V extends number | string>(value: AnimatableValue<V>, base: TransitionConfig | undefined, factory?: CallbackFactory): unknown;
156
208
 
209
+ /**
210
+ * Build a `timing.easing` value from cubic-bezier control points — as four
211
+ * numbers, as a W3C CSS `cubic-bezier(...)` string, or as a CSS easing
212
+ * keyword. Design systems store easing tokens in the CSS format; this helper
213
+ * makes any such token file directly consumable without hand-translating to
214
+ * `Easing.bezier` calls:
215
+ *
216
+ * ```ts
217
+ * cubicBezier(0.2, 0, 0, 1) // number form
218
+ * cubicBezier('cubic-bezier(0.2, 0, 0, 1)') // CSS token form
219
+ * cubicBezier('ease-out') // CSS keywords, incl. 'linear'
220
+ * ```
221
+ *
222
+ * The return value is exactly what `timing.easing` accepts (Reanimated's
223
+ * bezier factory; the resolver worklet-wraps it via `ensureWorkletEasing`
224
+ * like every other easing input), so it works in the `transition` prop, in
225
+ * named transitions registered on `<MotionConfig transitions>`, and in the
226
+ * value-layer hooks:
227
+ *
228
+ * ```tsx
229
+ * <MotionConfig
230
+ * transitions={{
231
+ * 'state-hover': {
232
+ * type: 'timing',
233
+ * duration: 150,
234
+ * easing: cubicBezier(theme.motion.easingStandard),
235
+ * },
236
+ * }}
237
+ * >
238
+ * ```
239
+ *
240
+ * Invalid input **throws** rather than warning: easing tokens are constructed
241
+ * at theme/module setup, and a malformed token should fail loudly there, not
242
+ * silently animate with the wrong curve. Per the CSS spec, `x1` / `x2` must
243
+ * be within `[0, 1]` (`y1` / `y2` are unrestricted). The stepping keywords
244
+ * (`step-start` / `step-end`) and the CSS `linear(...)` function are not
245
+ * easing curves this helper produces — they're intentionally unsupported.
246
+ */
247
+ declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): EasingInput;
248
+ declare function cubicBezier(css: string): EasingInput;
249
+
157
250
  /**
158
251
  * Reanimated 3.9+ validates that easing functions used in nested-transition
159
252
  * contexts (variants, sequences, per-property maps) are worklets, and crashes
@@ -200,7 +293,8 @@ declare function buildReleaseAnimation(transition: TransitionConfig, toValue: nu
200
293
 
201
294
  /**
202
295
  * Drive a `SharedValue<number>` toward `target` with **any** transition shape
203
- * — spring, timing, decay, or no-animation. The general-purpose value-layer
296
+ * — spring, timing, decay, or no-animation or a `TransitionName` registered
297
+ * on the nearest `<MotionConfig transitions>`. The general-purpose value-layer
204
298
  * hook: reach for it when you need raw `useSharedValue + useEffect + withX`
205
299
  * outside the declarative `animate` flow.
206
300
  *
@@ -242,7 +336,7 @@ declare function buildReleaseAnimation(transition: TransitionConfig, toValue: nu
242
336
  * })
243
337
  * ```
244
338
  */
245
- declare function useAnimation(target: number, transition?: TransitionConfig): SharedValue<number>;
339
+ declare function useAnimation(target: number, transition?: TransitionInput): SharedValue<number>;
246
340
 
247
341
  /**
248
342
  * Toggle a 0↔1 progress value with a spring whenever `active` flips.
@@ -265,9 +359,11 @@ declare function useAnimation(target: number, transition?: TransitionConfig): Sh
265
359
  *
266
360
  * The spring config follows the same react-spring vocabulary as the rest of
267
361
  * the library (`tension` / `friction` / `mass`); omit it to take the
268
- * library's defaults.
362
+ * library's defaults, or pass a `TransitionName` registered on the nearest
363
+ * `<MotionConfig transitions>` (spring-typed names only — see `useSpring`
364
+ * for the non-spring fallback behaviour).
269
365
  */
270
- declare function useBooleanSpring(active: boolean, springConfig?: SpringTransition): SharedValue<number>;
366
+ declare function useBooleanSpring(active: boolean, springConfig?: SpringTransition | TransitionName): SharedValue<number>;
271
367
 
272
368
  /**
273
369
  * Color style keys understood by React Native that this hook can target.
@@ -334,6 +430,8 @@ declare function useColorTransition(progress: SharedValue<number>, range: readon
334
430
  * onPress={() => { x.value = 100 }}
335
431
  * ```
336
432
  */
433
+ declare function useMotionValue(initial: number): SharedValue<number>;
434
+ declare function useMotionValue(initial: string): SharedValue<string>;
337
435
  declare function useMotionValue<T extends number | string>(initial: T): SharedValue<T>;
338
436
 
339
437
  /**
@@ -349,8 +447,14 @@ declare function useMotionValue<T extends number | string>(initial: T): SharedVa
349
447
  *
350
448
  * Both call sites end up at the same `withSpring` invocation; the split is
351
449
  * just about which thread observes the source change.
450
+ *
451
+ * `config` also accepts a `TransitionName` registered on the nearest
452
+ * `<MotionConfig transitions>`. Because this hook is spring-only, the name
453
+ * must resolve to a spring config — a name registered as timing / decay /
454
+ * no-animation warns in dev and falls back to the default spring (reach for
455
+ * `useAnimation` when the named transition's type should be honored).
352
456
  */
353
- declare function useSpring(target: number | SharedValue<number>, config?: SpringTransition): SharedValue<number>;
457
+ declare function useSpring(target: number | SharedValue<number>, config?: SpringTransition | TransitionName): SharedValue<number>;
354
458
 
355
459
  /**
356
460
  * Extrapolation behavior at the edges of the input range. Mirrors
@@ -415,10 +519,13 @@ interface UseScrollResult {
415
519
  * ```tsx
416
520
  * const { scrollY, onScroll } = useScroll()
417
521
  * const headerOpacity = useTransform(scrollY, [0, 100], [1, 0])
522
+ * const headerStyle = useAnimatedStyle(() => ({
523
+ * opacity: headerOpacity.value,
524
+ * }))
418
525
  *
419
526
  * return (
420
527
  * <>
421
- * <Motion.View animate={{ opacity: headerOpacity }} />
528
+ * <Animated.View style={headerStyle} />
422
529
  * <Motion.ScrollView onScroll={onScroll} scrollEventThrottle={16}>
423
530
  * …
424
531
  * </Motion.ScrollView>
@@ -426,6 +533,10 @@ interface UseScrollResult {
426
533
  * )
427
534
  * ```
428
535
  *
536
+ * The derived shared values are consumed through Reanimated interop
537
+ * (`useAnimatedStyle` / `useDerivedValue`) — the declarative `animate` prop
538
+ * takes target values, not shared values.
539
+ *
429
540
  * Scroll events fire on the UI thread, so `scrollX` / `scrollY` are safe to
430
541
  * read from any worklet (`useAnimatedStyle`, `useDerivedValue`,
431
542
  * `useTransform`) without a JS-thread bounce.
@@ -504,4 +615,4 @@ declare function useShadow({ from, to, progress, }: UseShadowOptions): ReturnTyp
504
615
  */
505
616
  declare function useVariants<V extends Readonly<Record<string, object>>>(variants: V, initial?: keyof V & string): VariantController<keyof V & string>;
506
617
 
507
- export { AnimatableValue, type ColorStyleKey, type ExtrapolationMode, Motion, MotionComponent, MotionConfig, type MotionConfigValue, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, TransitionConfig, type UseColorTransitionOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, ensureWorkletEasing, resolveAnimatableValue, resolveTransition, useAnimation, useBooleanSpring, useColorTransition, useMotionConfig, useMotionValue, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };
618
+ export { AnimatableValue, type ColorStyleKey, EasingInput, type ExtrapolationMode, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, NamedTransitions, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, TransitionConfig, TransitionInput, TransitionName, type UseColorTransitionOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useBooleanSpring, useColorTransition, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };
package/dist/index.d.ts CHANGED
@@ -2,10 +2,10 @@ import * as react from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
3
  import * as react_native from 'react-native';
4
4
  import { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
5
- import { M as MotionComponent, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, V as VariantController } from './types-cU43dEmH.js';
6
- export { a as AnimateStyle, b as AnimationCallbackInfo, D as DecayTransition, G as GestureSubStates, c as MotionProps, N as NoAnimationTransition, P as PerPropertyTransition, R as RepeatConfig, d as SequenceStep, e as TimingTransition, f as Transition, g as VariantsMap } from './types-cU43dEmH.js';
5
+ import { M as MotionComponent, N as NamedTransitions, T as TransitionInput, a as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-BzEgiUdJ.js';
6
+ export { c as AnimateStyle, d as AnimationCallbackInfo, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, G as GestureSubStates, g as MotionProps, h as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, i as RepeatConfig, j as SequenceStep, k as TimingTransition, l as Transition, m as VariantsMap } from './types-BzEgiUdJ.js';
7
7
  import { SharedValue, useAnimatedStyle } from 'react-native-reanimated';
8
- export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-BnY65PlQ.js';
8
+ export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-BRLgiNOC.js';
9
9
  export { MotionImage } from './motion/Image.js';
10
10
  export { MotionPressable } from './motion/Pressable.js';
11
11
  export { MotionScrollView } from './motion/ScrollView.js';
@@ -51,6 +51,12 @@ declare const Motion: {
51
51
  type ReducedMotion = 'user' | 'never' | 'always';
52
52
  interface MotionConfigValue {
53
53
  reducedMotion: ReducedMotion;
54
+ /**
55
+ * Named transitions registered by ancestor `<MotionConfig transitions>`
56
+ * providers, already merged (nearest provider wins per name). Empty with no
57
+ * provider — every name then resolves to the unknown-name fallback.
58
+ */
59
+ transitions: NamedTransitions;
54
60
  }
55
61
  /**
56
62
  * Read the active `<MotionConfig>` from a descendant. Returns the default
@@ -63,18 +69,64 @@ declare function useMotionConfig(): MotionConfigValue;
63
69
  * primitives call this to decide whether to swap transitions for
64
70
  * `no-animation`.
65
71
  */
72
+ /**
73
+ * Read the merged named-transition registry from the nearest `<MotionConfig>`
74
+ * ancestors. This is what the Motion primitives and value-layer hooks consult
75
+ * when a `TransitionName` string is passed where a `TransitionConfig` is
76
+ * accepted; custom animated components (and adapter packages) use it together
77
+ * with `resolveNamedTransition` to support names on their own surface.
78
+ */
79
+ declare function useNamedTransitions(): NamedTransitions;
66
80
  declare function useShouldReduceMotion(): boolean;
67
81
 
82
+ interface MotionConfigProps {
83
+ /**
84
+ * How descendants respond to reduced-motion preferences. Inherits from the
85
+ * nearest ancestor `<MotionConfig>` when omitted (the root default is
86
+ * `'user'` — respect the OS accessibility setting).
87
+ */
88
+ reducedMotion?: ReducedMotion;
89
+ /**
90
+ * Named transitions available to every descendant wherever a
91
+ * `TransitionConfig` is accepted — the `transition` prop (top-level and
92
+ * per-property), the `layout` prop, and the value-layer hooks:
93
+ *
94
+ * ```tsx
95
+ * <MotionConfig
96
+ * transitions={{
97
+ * 'state-press': { type: 'timing', duration: 100 },
98
+ * selection: { type: 'spring', tension: 380, friction: 33 },
99
+ * }}
100
+ * >
101
+ * <Motion.View animate={{ scale: 1 }} transition="selection" />
102
+ * </MotionConfig>
103
+ * ```
104
+ *
105
+ * Names resolve at the nearest provider; nested providers merge with the
106
+ * ancestor registry, child entries overriding same-named ancestor entries.
107
+ * Unknown names warn in dev and fall back to the library default spring.
108
+ * Names are consumer vocabulary — Inertia ships no presets.
109
+ */
110
+ transitions?: NamedTransitions;
111
+ children: ReactNode;
112
+ }
68
113
  /**
69
- * Provider that controls how descendant Motion primitives respond to
70
- * reduced-motion preferences. Wrap the root of your app once with the
114
+ * Provider for subtree-wide animation config: reduced-motion behaviour and
115
+ * the named-transition registry. Wrap the root of your app once with the
71
116
  * default (`reducedMotion="user"`) to respect the OS accessibility setting,
72
117
  * or scope a subtree with `'always'` / `'never'` for specific use cases.
118
+ * Nested providers inherit from their ancestor: an omitted prop keeps the
119
+ * ancestor's value, and `transitions` maps merge per name (child wins).
73
120
  */
74
- declare function MotionConfig({ reducedMotion, children, }: {
75
- reducedMotion?: ReducedMotion;
76
- children: ReactNode;
77
- }): react.JSX.Element;
121
+ declare function MotionConfig({ reducedMotion, transitions, children, }: MotionConfigProps): react.JSX.Element;
122
+
123
+ /**
124
+ * Resolve a single transition input — a `TransitionConfig` passes through
125
+ * untouched, a `TransitionName` is looked up in `registry`. This is the
126
+ * building block adapter packages use to accept names wherever they accept a
127
+ * config (pair it with `useNamedTransitions()` for the registry).
128
+ */
129
+ declare function resolveNamedTransition(input: TransitionInput | undefined, registry: NamedTransitions): TransitionConfig | undefined;
78
130
 
79
131
  /**
80
132
  * Wrap a list of children with mount / unmount transitions. When a child is
@@ -154,6 +206,47 @@ declare function resolveTransition(config: TransitionConfig | undefined, toValue
154
206
  */
155
207
  declare function resolveAnimatableValue<V extends number | string>(value: AnimatableValue<V>, base: TransitionConfig | undefined, factory?: CallbackFactory): unknown;
156
208
 
209
+ /**
210
+ * Build a `timing.easing` value from cubic-bezier control points — as four
211
+ * numbers, as a W3C CSS `cubic-bezier(...)` string, or as a CSS easing
212
+ * keyword. Design systems store easing tokens in the CSS format; this helper
213
+ * makes any such token file directly consumable without hand-translating to
214
+ * `Easing.bezier` calls:
215
+ *
216
+ * ```ts
217
+ * cubicBezier(0.2, 0, 0, 1) // number form
218
+ * cubicBezier('cubic-bezier(0.2, 0, 0, 1)') // CSS token form
219
+ * cubicBezier('ease-out') // CSS keywords, incl. 'linear'
220
+ * ```
221
+ *
222
+ * The return value is exactly what `timing.easing` accepts (Reanimated's
223
+ * bezier factory; the resolver worklet-wraps it via `ensureWorkletEasing`
224
+ * like every other easing input), so it works in the `transition` prop, in
225
+ * named transitions registered on `<MotionConfig transitions>`, and in the
226
+ * value-layer hooks:
227
+ *
228
+ * ```tsx
229
+ * <MotionConfig
230
+ * transitions={{
231
+ * 'state-hover': {
232
+ * type: 'timing',
233
+ * duration: 150,
234
+ * easing: cubicBezier(theme.motion.easingStandard),
235
+ * },
236
+ * }}
237
+ * >
238
+ * ```
239
+ *
240
+ * Invalid input **throws** rather than warning: easing tokens are constructed
241
+ * at theme/module setup, and a malformed token should fail loudly there, not
242
+ * silently animate with the wrong curve. Per the CSS spec, `x1` / `x2` must
243
+ * be within `[0, 1]` (`y1` / `y2` are unrestricted). The stepping keywords
244
+ * (`step-start` / `step-end`) and the CSS `linear(...)` function are not
245
+ * easing curves this helper produces — they're intentionally unsupported.
246
+ */
247
+ declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): EasingInput;
248
+ declare function cubicBezier(css: string): EasingInput;
249
+
157
250
  /**
158
251
  * Reanimated 3.9+ validates that easing functions used in nested-transition
159
252
  * contexts (variants, sequences, per-property maps) are worklets, and crashes
@@ -200,7 +293,8 @@ declare function buildReleaseAnimation(transition: TransitionConfig, toValue: nu
200
293
 
201
294
  /**
202
295
  * Drive a `SharedValue<number>` toward `target` with **any** transition shape
203
- * — spring, timing, decay, or no-animation. The general-purpose value-layer
296
+ * — spring, timing, decay, or no-animation or a `TransitionName` registered
297
+ * on the nearest `<MotionConfig transitions>`. The general-purpose value-layer
204
298
  * hook: reach for it when you need raw `useSharedValue + useEffect + withX`
205
299
  * outside the declarative `animate` flow.
206
300
  *
@@ -242,7 +336,7 @@ declare function buildReleaseAnimation(transition: TransitionConfig, toValue: nu
242
336
  * })
243
337
  * ```
244
338
  */
245
- declare function useAnimation(target: number, transition?: TransitionConfig): SharedValue<number>;
339
+ declare function useAnimation(target: number, transition?: TransitionInput): SharedValue<number>;
246
340
 
247
341
  /**
248
342
  * Toggle a 0↔1 progress value with a spring whenever `active` flips.
@@ -265,9 +359,11 @@ declare function useAnimation(target: number, transition?: TransitionConfig): Sh
265
359
  *
266
360
  * The spring config follows the same react-spring vocabulary as the rest of
267
361
  * the library (`tension` / `friction` / `mass`); omit it to take the
268
- * library's defaults.
362
+ * library's defaults, or pass a `TransitionName` registered on the nearest
363
+ * `<MotionConfig transitions>` (spring-typed names only — see `useSpring`
364
+ * for the non-spring fallback behaviour).
269
365
  */
270
- declare function useBooleanSpring(active: boolean, springConfig?: SpringTransition): SharedValue<number>;
366
+ declare function useBooleanSpring(active: boolean, springConfig?: SpringTransition | TransitionName): SharedValue<number>;
271
367
 
272
368
  /**
273
369
  * Color style keys understood by React Native that this hook can target.
@@ -334,6 +430,8 @@ declare function useColorTransition(progress: SharedValue<number>, range: readon
334
430
  * onPress={() => { x.value = 100 }}
335
431
  * ```
336
432
  */
433
+ declare function useMotionValue(initial: number): SharedValue<number>;
434
+ declare function useMotionValue(initial: string): SharedValue<string>;
337
435
  declare function useMotionValue<T extends number | string>(initial: T): SharedValue<T>;
338
436
 
339
437
  /**
@@ -349,8 +447,14 @@ declare function useMotionValue<T extends number | string>(initial: T): SharedVa
349
447
  *
350
448
  * Both call sites end up at the same `withSpring` invocation; the split is
351
449
  * just about which thread observes the source change.
450
+ *
451
+ * `config` also accepts a `TransitionName` registered on the nearest
452
+ * `<MotionConfig transitions>`. Because this hook is spring-only, the name
453
+ * must resolve to a spring config — a name registered as timing / decay /
454
+ * no-animation warns in dev and falls back to the default spring (reach for
455
+ * `useAnimation` when the named transition's type should be honored).
352
456
  */
353
- declare function useSpring(target: number | SharedValue<number>, config?: SpringTransition): SharedValue<number>;
457
+ declare function useSpring(target: number | SharedValue<number>, config?: SpringTransition | TransitionName): SharedValue<number>;
354
458
 
355
459
  /**
356
460
  * Extrapolation behavior at the edges of the input range. Mirrors
@@ -415,10 +519,13 @@ interface UseScrollResult {
415
519
  * ```tsx
416
520
  * const { scrollY, onScroll } = useScroll()
417
521
  * const headerOpacity = useTransform(scrollY, [0, 100], [1, 0])
522
+ * const headerStyle = useAnimatedStyle(() => ({
523
+ * opacity: headerOpacity.value,
524
+ * }))
418
525
  *
419
526
  * return (
420
527
  * <>
421
- * <Motion.View animate={{ opacity: headerOpacity }} />
528
+ * <Animated.View style={headerStyle} />
422
529
  * <Motion.ScrollView onScroll={onScroll} scrollEventThrottle={16}>
423
530
  * …
424
531
  * </Motion.ScrollView>
@@ -426,6 +533,10 @@ interface UseScrollResult {
426
533
  * )
427
534
  * ```
428
535
  *
536
+ * The derived shared values are consumed through Reanimated interop
537
+ * (`useAnimatedStyle` / `useDerivedValue`) — the declarative `animate` prop
538
+ * takes target values, not shared values.
539
+ *
429
540
  * Scroll events fire on the UI thread, so `scrollX` / `scrollY` are safe to
430
541
  * read from any worklet (`useAnimatedStyle`, `useDerivedValue`,
431
542
  * `useTransform`) without a JS-thread bounce.
@@ -504,4 +615,4 @@ declare function useShadow({ from, to, progress, }: UseShadowOptions): ReturnTyp
504
615
  */
505
616
  declare function useVariants<V extends Readonly<Record<string, object>>>(variants: V, initial?: keyof V & string): VariantController<keyof V & string>;
506
617
 
507
- export { AnimatableValue, type ColorStyleKey, type ExtrapolationMode, Motion, MotionComponent, MotionConfig, type MotionConfigValue, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, TransitionConfig, type UseColorTransitionOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, ensureWorkletEasing, resolveAnimatableValue, resolveTransition, useAnimation, useBooleanSpring, useColorTransition, useMotionConfig, useMotionValue, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };
618
+ export { AnimatableValue, type ColorStyleKey, EasingInput, type ExtrapolationMode, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, NamedTransitions, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, TransitionConfig, TransitionInput, TransitionName, type UseColorTransitionOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useBooleanSpring, useColorTransition, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };