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

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 (69) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +2 -0
  3. package/dist/gestureLayer/index.d.mts +6 -5
  4. package/dist/gestureLayer/index.d.ts +6 -5
  5. package/dist/gestureLayer/index.js +89 -27
  6. package/dist/gestureLayer/index.js.map +1 -1
  7. package/dist/gestureLayer/index.mjs +89 -27
  8. package/dist/gestureLayer/index.mjs.map +1 -1
  9. package/dist/index.d.mts +127 -16
  10. package/dist/index.d.ts +127 -16
  11. package/dist/index.js +177 -60
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +175 -61
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/motion/Image.d.mts +1 -1
  16. package/dist/motion/Image.d.ts +1 -1
  17. package/dist/motion/Image.js +90 -48
  18. package/dist/motion/Image.js.map +1 -1
  19. package/dist/motion/Image.mjs +90 -48
  20. package/dist/motion/Image.mjs.map +1 -1
  21. package/dist/motion/Pressable.d.mts +1 -1
  22. package/dist/motion/Pressable.d.ts +1 -1
  23. package/dist/motion/Pressable.js +90 -48
  24. package/dist/motion/Pressable.js.map +1 -1
  25. package/dist/motion/Pressable.mjs +90 -48
  26. package/dist/motion/Pressable.mjs.map +1 -1
  27. package/dist/motion/ScrollView.d.mts +1 -1
  28. package/dist/motion/ScrollView.d.ts +1 -1
  29. package/dist/motion/ScrollView.js +90 -48
  30. package/dist/motion/ScrollView.js.map +1 -1
  31. package/dist/motion/ScrollView.mjs +90 -48
  32. package/dist/motion/ScrollView.mjs.map +1 -1
  33. package/dist/motion/Text.d.mts +1 -1
  34. package/dist/motion/Text.d.ts +1 -1
  35. package/dist/motion/Text.js +90 -48
  36. package/dist/motion/Text.js.map +1 -1
  37. package/dist/motion/Text.mjs +90 -48
  38. package/dist/motion/Text.mjs.map +1 -1
  39. package/dist/motion/View.d.mts +1 -1
  40. package/dist/motion/View.d.ts +1 -1
  41. package/dist/motion/View.js +90 -48
  42. package/dist/motion/View.js.map +1 -1
  43. package/dist/motion/View.mjs +90 -48
  44. package/dist/motion/View.mjs.map +1 -1
  45. package/dist/touch/index.d.mts +1 -1
  46. package/dist/touch/index.d.ts +1 -1
  47. package/dist/{types-cU43dEmH.d.mts → types-BzEgiUdJ.d.mts} +58 -9
  48. package/dist/{types-cU43dEmH.d.ts → types-BzEgiUdJ.d.ts} +58 -9
  49. package/dist/{useGesture-BnY65PlQ.d.ts → useGesture-BRLgiNOC.d.ts} +6 -4
  50. package/dist/{useGesture-DxtXdz-K.d.mts → useGesture-C0GBS7d2.d.mts} +6 -4
  51. package/llms.txt +8 -4
  52. package/package.json +1 -1
  53. package/src/__type-tests__/motion-value.test-d.ts +39 -0
  54. package/src/config/MotionConfig.tsx +55 -9
  55. package/src/config/MotionConfigContext.ts +21 -1
  56. package/src/config/index.ts +7 -1
  57. package/src/config/namedTransitions.ts +80 -0
  58. package/src/gestureLayer/useGestureLayer.ts +32 -8
  59. package/src/index.ts +20 -2
  60. package/src/motion/createMotionComponent.tsx +36 -6
  61. package/src/transitions/cubicBezier.ts +126 -0
  62. package/src/transitions/index.ts +1 -0
  63. package/src/types.ts +63 -8
  64. package/src/values/useAnimation.ts +12 -6
  65. package/src/values/useBooleanSpring.ts +5 -3
  66. package/src/values/useGesture.ts +25 -7
  67. package/src/values/useMotionValue.ts +11 -0
  68. package/src/values/useScroll.ts +8 -1
  69. package/src/values/useSpring.ts +46 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/config/MotionConfigContext.ts","../../src/transitions/easing.ts","../../src/transitions/spring.ts","../../src/transitions/resolve.ts","../../src/transitions/keys.ts","../../src/gestures/focusVisibility.ts","../../src/values/useGesture.ts","../../src/gestureLayer/useGestureLayer.ts"],"names":["useSharedValue","useMemo"],"mappings":";;;;;;AAwBO,IAAM,qBAAA,GAA2C;AAAA,EACtD,aAAA,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,QACjB;AACA,QAAA,IACE,qBACA,GAAA,GAAM,CAAA,IACN,iBAAA,CAAkB,CAAC,MAAM,MAAA,EACzB;AACA,UAAA,MAAM,CAAA,GAAI,IAAA,GAAA,CAAS,iBAAA,CAAkB,CAAC,IAAe,IAAA,IAAQ,GAAA;AAC7D,UAAA,IAAI,CAAA,GAAI,GAAG,CAAA,GAAI,CAAA;AAAA,QACjB;AACA,QAAA,IAAI,gBAAgB,EAAA,GAAK,CAAA,IAAK,YAAA,CAAa,CAAC,MAAM,MAAA,EAAW;AAC3D,UAAA,MAAM,CAAA,GAAI,IAAA,GAAA,CAAS,YAAA,CAAa,CAAC,IAAe,IAAA,IAAQ,EAAA;AACxD,UAAA,IAAI,CAAA,GAAI,GAAG,CAAA,GAAI,CAAA;AAAA,QACjB;AACA,QAAA,IAAI,iBAAiB,EAAA,GAAK,CAAA,IAAK,aAAA,CAAc,CAAC,MAAM,MAAA,EAAW;AAC7D,UAAA,CAAA,GAAI,CAAA,GAAA,CAAM,aAAA,CAAc,CAAC,CAAA,GAAe,CAAA,IAAK,EAAA;AAAA,QAC/C;AACA,QAAA,GAAA,CAAI,CAAC,CAAA,GAAI,CAAA;AAAA,MACX;AAAA,IACF;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL,KAAA;AAAA,IACA,UAAU,OAAA,CAAQ;AAAA,GACpB;AACF;AAEA,SAAS,mBACP,UAAA,EAC8B;AAC9B,EAAA,IAAI,CAAC,YAAY,OAAO,MAAA;AACxB,EAAA,IAAI,oBAAA,CAAqB,UAAU,CAAA,EAAG,OAAO,UAAA;AAC7C,EAAA,OAAO,MAAA;AACT","file":"index.mjs","sourcesContent":["import { createContext, useContext } from 'react'\nimport { useReducedMotion } from 'react-native-reanimated'\n\n/**\n * How descendant Motion primitives should treat reduced-motion preferences.\n *\n * - `'user'` (default): defer to the OS accessibility setting via\n * Reanimated's `useReducedMotion()`. This is the only value that respects\n * user choice and is the right default for app-level wrappers.\n * - `'never'`: animate regardless of OS setting. Use sparingly — e.g. for\n * onboarding transitions you've decided are essential.\n * - `'always'`: never animate, regardless of OS setting. Useful for tests\n * and snapshots.\n */\nexport type ReducedMotion = 'user' | 'never' | 'always'\n\nexport interface MotionConfigValue {\n reducedMotion: ReducedMotion\n}\n\n/**\n * Default config used when a Motion primitive is rendered without a\n * `<MotionConfig>` ancestor. `'user'` means respect the OS setting.\n */\nexport const DEFAULT_MOTION_CONFIG: MotionConfigValue = {\n reducedMotion: 'user',\n}\n\nexport const MotionConfigContext = createContext<MotionConfigValue>(\n DEFAULT_MOTION_CONFIG,\n)\n\n/**\n * Read the active `<MotionConfig>` from a descendant. Returns the default\n * (`'user'`) when no provider is present.\n */\nexport function useMotionConfig(): MotionConfigValue {\n return useContext(MotionConfigContext)\n}\n\n/**\n * Resolve the active reduced-motion mode to a boolean. `'user'` consults\n * Reanimated's OS-backed hook; `'always'` / `'never'` shortcut. Motion\n * primitives call this to decide whether to swap transitions for\n * `no-animation`.\n */\nexport function useShouldReduceMotion(): boolean {\n const { reducedMotion } = useMotionConfig()\n const osReduced = useReducedMotion()\n if (reducedMotion === 'never') return false\n if (reducedMotion === 'always') return true\n return osReduced\n}\n","// `isWorkletFunction` lives in `react-native-worklets` (the Reanimated 4 peer\n// dep); Reanimated's own re-export is deprecated.\nimport { isWorkletFunction } from 'react-native-worklets'\nimport { type EasingInput } from '../types'\n\n/**\n * Reanimated 3.9+ validates that easing functions used in nested-transition\n * contexts (variants, sequences, per-property maps) are worklets, and crashes\n * with `[Reanimated] The easing function is not a worklet` otherwise. The\n * library accepts plain functions on the public surface; this helper wraps\n * them so consumers don't have to think about the worklet boundary.\n *\n * If the input is already a worklet (has been processed by the worklets babel\n * plugin), it's returned as-is. Otherwise it's wrapped in a function whose\n * body declares the `'worklet'` directive — when our source is processed by\n * the consumer's worklets babel plugin (the default Expo/RN setup), the\n * wrapper becomes a real worklet that captures the user fn via closure.\n *\n * Reanimated 4 changed `Easing.bezier(...)` to return an\n * `EasingFunctionFactory` (`{ factory: () => EasingFunction }`) rather than\n * the function itself. The helper accepts both shapes — `EasingFunction` and\n * `EasingFunctionFactory` — and unwraps the factory automatically so\n * consumers don't have to call `.factory()` manually.\n *\n * The user fn must be pure: no JS-thread captured refs, no shared mutable\n * state, no calls to non-worklet APIs.\n */\nexport function ensureWorkletEasing(\n easing: EasingInput | undefined,\n): ((t: number) => number) | undefined {\n if (!easing) return undefined\n // Reanimated 4 `EasingFunctionFactory` — unwrap via `.factory()` before\n // checking worklet status, so the wrapped fn (not the factory wrapper)\n // ends up in the transition config.\n const fn = isEasingFactory(easing) ? easing.factory() : easing\n if (isWorkletFunction(fn)) return fn\n const wrapped = (t: number) => {\n 'worklet'\n return fn(t)\n }\n return wrapped\n}\n\nfunction isEasingFactory(\n value: EasingInput,\n): value is { factory: () => (t: number) => number } {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'factory' in value &&\n typeof (value as { factory: unknown }).factory === 'function'\n )\n}\n","import { type SpringTransition } from '../types'\n\n/**\n * Default spring physics, expressed in react-spring vocabulary.\n *\n * `tension: 170` / `friction: 26` / `mass: 1` was picked over Reanimated's\n * raw `stiffness: 100` / `damping: 10` default because the raw default\n * overshoots noticeably for the small (~100px) translates that dominate\n * UI work — buttons, sheets, popovers. These numbers settle in ~350ms with\n * a single, almost-imperceptible overshoot, which matches the perceptual\n * target the rest of the library is tuned against.\n */\nexport const DEFAULT_SPRING: Required<\n Pick<SpringTransition, 'tension' | 'friction' | 'mass'>\n> = {\n tension: 170,\n friction: 26,\n mass: 1,\n}\n\n/**\n * Convert public react-spring vocabulary (`tension` / `friction` / `mass`)\n * to Reanimated's raw `stiffness` / `damping` / `mass`. This is the single\n * place the mapping lives; resolvers, value hooks, and any future surface\n * that needs a Reanimated spring config import from here.\n *\n * The mapping is identity (tension ≡ stiffness, friction ≡ damping) — the\n * names differ but the underlying physics constants are the same. We don't\n * surface the raw names publicly because the react-spring vocabulary is\n * what designers and prior-art consumers expect.\n */\nexport function springToReanimated(t: SpringTransition) {\n 'worklet'\n return {\n stiffness: t.tension ?? DEFAULT_SPRING.tension,\n damping: t.friction ?? DEFAULT_SPRING.friction,\n mass: t.mass ?? DEFAULT_SPRING.mass,\n velocity: t.velocity,\n restSpeedThreshold: t.restSpeedThreshold,\n restDisplacementThreshold: t.restDisplacementThreshold,\n }\n}\n","import {\n Easing,\n withDecay,\n withDelay,\n withRepeat,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { ensureWorkletEasing } from './easing'\nimport { springToReanimated } from './spring'\nimport {\n type DecayTransition,\n type RepeatConfig,\n type SpringTransition,\n type TimingTransition,\n type TransitionConfig,\n} from '../types'\n\n/**\n * UI-thread callback Reanimated invokes when an animation settles. Must be a\n * worklet — callers either author one with `'worklet'` or build one via\n * `runOnJS(...)` to bridge to JS-thread code.\n */\nexport type AnimationCallback = (\n finished?: boolean,\n current?: number | string,\n) => void\n\n/**\n * Per-step callback factory. Resolvers call this with the step's phase and\n * sequence index (or `undefined` for non-sequence animations) and attach the\n * resulting callback to the underlying `withSpring` / `withTiming` /\n * `withDecay` call.\n */\nexport type CallbackFactory = (\n phase: 'step' | 'animation',\n step: number | undefined,\n) => AnimationCallback | undefined\n\nconst DEFAULT_TIMING_DURATION = 250\n\nfunction buildSpring(\n cfg: SpringTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withSpring(toValue as number, springToReanimated(cfg), cb as never)\n}\n\nfunction buildTiming(\n cfg: TimingTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withTiming(\n toValue as number,\n {\n duration: cfg.duration ?? DEFAULT_TIMING_DURATION,\n easing: ensureWorkletEasing(cfg.easing) ?? Easing.inOut(Easing.ease),\n },\n cb as never,\n )\n}\n\nfunction buildDecay(cfg: DecayTransition, cb?: AnimationCallback) {\n return withDecay(\n {\n velocity: cfg.velocity ?? 0,\n deceleration: cfg.deceleration,\n clamp: cfg.clamp,\n },\n cb as never,\n )\n}\n\n/**\n * Build a single-step animation (no repeat / no delay / no sequence) for a\n * given config + target. Pulled out so sequence steps can compose without\n * recursing into repeat/delay handling per step. The callback is forwarded\n * to Reanimated; for `no-animation` the callback is fired synchronously\n * since there's nothing to wait for.\n */\nfunction buildOne(\n cfg: TransitionConfig,\n toValue: number | string,\n cb?: AnimationCallback,\n): unknown {\n if (cfg.type === 'no-animation') {\n if (cb) cb(true, toValue)\n return toValue\n }\n if (cfg.type === 'decay') return buildDecay(cfg, cb)\n if (cfg.type === 'timing') return buildTiming(cfg, toValue, cb)\n return buildSpring(cfg as SpringTransition, toValue, cb)\n}\n\n/**\n * Wrap an animation in `withRepeat` per the unified `repeat` shape:\n * - `number` → finite count, alternating direction\n * - `'infinite'` → endless, alternating direction\n * - `{ count, alternate }`→ explicit; `alternate` defaults to `true`\n */\nexport function applyRepeat(\n animation: unknown,\n repeat: RepeatConfig | undefined,\n) {\n if (repeat === undefined) return animation\n if (repeat === 'infinite') {\n return withRepeat(animation as never, -1, true)\n }\n if (typeof repeat === 'number') {\n return withRepeat(animation as never, repeat, true)\n }\n const count = repeat.count === 'infinite' ? -1 : repeat.count\n const alternate = repeat.alternate ?? true\n return withRepeat(animation as never, count, alternate)\n}\n\nfunction applyDelay(animation: unknown, delay: number | undefined) {\n if (!delay || delay <= 0) return animation\n return withDelay(delay, animation as never)\n}\n\n/**\n * Build a Reanimated animation for a single property. Runs on the JS thread\n * once per change and produces a baked `withSpring` / `withTiming` /\n * `withDecay` (optionally wrapped in `withDelay` / `withRepeat`) call. The\n * worklet body only consumes the result.\n *\n * `callback`, when provided, fires once when the underlying single-shot\n * animation settles. Repeat-wrapped animations forward the callback to\n * `withRepeat`, so it fires once per iteration as Reanimated does.\n */\nexport function resolveTransition(\n config: TransitionConfig | undefined,\n toValue: number | string,\n callback?: AnimationCallback,\n): unknown {\n const cfg = config ?? ({ type: 'spring' } as SpringTransition)\n const base = buildOne(cfg, toValue, callback)\n const repeated = applyRepeat(base, repeatOf(cfg))\n return applyDelay(repeated, delayOf(cfg))\n}\n\nexport function repeatOf(cfg: TransitionConfig): RepeatConfig | undefined {\n if (cfg.type === 'no-animation' || cfg.type === 'decay') return undefined\n return cfg.repeat\n}\n\n/**\n * Return `cfg` minus its `repeat` field. Used when peeling top-level repeat\n * off a base transition before passing it down to per-sequence-step\n * resolution — the sequence as a whole is what should repeat, not each step.\n */\nexport function stripRepeat(\n cfg: TransitionConfig | undefined,\n): TransitionConfig | undefined {\n if (!cfg) return cfg\n if (cfg.type === 'no-animation' || cfg.type === 'decay') return cfg\n if (cfg.repeat === undefined) return cfg\n const next = { ...cfg }\n delete next.repeat\n return next\n}\n\nfunction delayOf(cfg: TransitionConfig): number | undefined {\n if (cfg.type === 'no-animation') return undefined\n return cfg.delay\n}\n","import { type TransitionConfig } from '../types'\n\n/**\n * Field names that may appear on a `TransitionConfig` (spring / timing /\n * decay / no-animation). Used as a structural discriminator: if every key on\n * an object is in this set, the object is treated as a top-level transition;\n * otherwise it's a per-property / per-layer transition map.\n *\n * Adding a new field to `TransitionConfig` requires adding the name here.\n */\nexport const TRANSITION_CONFIG_KEYS = new Set([\n 'type',\n 'tension',\n 'friction',\n 'mass',\n 'velocity',\n 'restSpeedThreshold',\n 'restDisplacementThreshold',\n 'duration',\n 'easing',\n 'delay',\n 'repeat',\n 'deceleration',\n 'clamp',\n])\n\nexport function isTopLevelTransition(t: unknown): t is TransitionConfig {\n if (t === null || typeof t !== 'object') return false\n const keys = Object.keys(t as object)\n if (keys.length === 0) return false\n return keys.every((k) => TRANSITION_CONFIG_KEYS.has(k))\n}\n","import { Platform } from 'react-native'\n\n/**\n * Input-modality tracker for the `focusVisible` gesture sub-state.\n *\n * Implements the W3C `:focus-visible` heuristic: a focus event counts as\n * \"visible\" only when the most recent user input was keyboard-driven. Mouse,\n * pointer, and touch events flip the modality to `'pointer'`; keyboard events\n * flip it back to `'keyboard'`.\n *\n * On native platforms there is no pointer-vs-keyboard distinction — focus\n * arrives via D-pad, screen reader, or hardware keyboard, all of which are\n * keyboard-equivalent — so `isFocusVisible()` is unconditionally `true`.\n *\n * The web listeners attach lazily on first call (capture phase, so they run\n * before the focus event reaches the focused element) and stay installed for\n * the lifetime of the document. They are passive and idle-cheap; the cost is\n * one boolean read per `onFocus` dispatch.\n */\n\ntype InputModality = 'keyboard' | 'pointer'\n\n// Default to `'keyboard'` so a programmatic / autofocus that happens before\n// any user input still draws a focus ring — matches the W3C polyfill default.\nlet modality: InputModality = 'keyboard'\nlet installed = false\n\nfunction setKeyboard() {\n modality = 'keyboard'\n}\n\nfunction setPointer() {\n modality = 'pointer'\n}\n\nfunction ensureInstalled(): void {\n if (installed) return\n if (Platform.OS !== 'web') return\n if (typeof document === 'undefined') return\n document.addEventListener('keydown', setKeyboard, true)\n document.addEventListener('mousedown', setPointer, true)\n document.addEventListener('pointerdown', setPointer, true)\n document.addEventListener('touchstart', setPointer, true)\n installed = true\n}\n\n/**\n * `true` if the next `onFocus` should be treated as \"focus-visible\" (keyboard\n * focus). On native, always `true`. On web, reflects the most recent user\n * input modality.\n */\nexport function isFocusVisible(): boolean {\n if (Platform.OS !== 'web') return true\n ensureInstalled()\n return modality === 'keyboard'\n}\n\n/** @internal — test-only hook to reset module state between cases. */\nexport function __resetFocusVisibilityForTests(next: InputModality): void {\n modality = next\n}\n","import { useCallback, useMemo } from 'react'\nimport { useSharedValue, type SharedValue } from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { isFocusVisible } from '../gestures'\nimport { isTopLevelTransition, resolveTransition } from '../transitions'\nimport { type GestureLayerTransitions, type TransitionConfig } from '../types'\n\ntype LayerName = 'pressed' | 'focused' | 'focusVisible' | 'hovered'\n\n/**\n * Handler bag returned by `useGesture`. Spread on a `Pressable` to drive the\n * shared values returned alongside.\n *\n * Hover handlers use `Pressable`'s own `onHoverIn` / `onHoverOut` names (web\n * only — no-ops on native). `onFocus` consults `isFocusVisible()` before\n * raising the keyboard-only `focusVisible` layer; `focused` always raises.\n */\nexport interface UseGestureHandlers {\n onPressIn: () => void\n onPressOut: () => void\n onHoverIn: () => void\n onHoverOut: () => void\n onFocus: () => void\n onBlur: () => void\n}\n\nexport interface UseGestureResult {\n /** 0↔1 progress for the pressed layer. */\n pressed: SharedValue<number>\n /** 0↔1 progress for the focused layer (any focus modality). */\n focused: SharedValue<number>\n /** 0↔1 progress for the focusVisible layer (keyboard focus only). */\n focusVisible: SharedValue<number>\n /** 0↔1 progress for the hovered layer (web only — stays at 0 on native). */\n hovered: SharedValue<number>\n /** Handlers to spread on the receiving `Pressable`. */\n handlers: UseGestureHandlers\n}\n\n/**\n * Build a gesture-layer controller. The hook-form of the `gesture` prop —\n * reach for it when you need to drive multiple animated views from the same\n * gesture state (a focus ring + state-layer halo + content tint all on one\n * Pressable), which the prop-form's \"animate the receiver's own style\" model\n * can't express.\n *\n * Returns four 0↔1 shared values (one per layer) and a handler bag to spread\n * on a `Pressable`. The shared values are stable across renders — feed them\n * into any number of `useAnimatedStyle` blocks anywhere in the tree.\n *\n * Transitions follow the same shape as the `gesture` prop's accompanying\n * `transition`: pass a single `TransitionConfig` to use for every layer, or a\n * `GestureLayerTransitions` map to give each layer its own. Layers without an\n * explicit transition fall back to the library default spring.\n *\n * Reduced motion (via `<MotionConfig reducedMotion>`) collapses every\n * transition to `no-animation` so state changes snap instead of interpolating\n * — same behaviour the gesture prop applies.\n *\n * @example\n * ```tsx\n * import { useAnimatedStyle } from 'react-native-reanimated'\n * import { useGesture } from '@rootnative/inertia'\n *\n * function Card() {\n * const { pressed, focused, hovered, handlers } = useGesture({\n * pressed: { type: 'timing', duration: 100 },\n * hovered: { type: 'timing', duration: 150 },\n * focused: { type: 'timing', duration: 200 },\n * })\n *\n * const ringStyle = useAnimatedStyle(() => ({ opacity: focused.value }))\n * const haloStyle = useAnimatedStyle(() => ({\n * opacity: Math.max(\n * hovered.value * 0.08,\n * focused.value * 0.10,\n * pressed.value * 0.10,\n * ),\n * }))\n *\n * return (\n * <Pressable {...handlers}>\n * <Animated.View style={ringStyle} />\n * <Animated.View style={haloStyle} />\n * </Pressable>\n * )\n * }\n * ```\n */\nexport function useGesture(\n transition?: TransitionConfig | GestureLayerTransitions,\n): UseGestureResult {\n const pressed = useSharedValue(0)\n const focused = useSharedValue(0)\n const focusVisible = useSharedValue(0)\n const hovered = useSharedValue(0)\n const shouldReduceMotion = useShouldReduceMotion()\n\n const setLayer = useCallback(\n (sv: SharedValue<number>, layer: LayerName, target: 0 | 1) => {\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (layerTransition(layer, transition) ?? ({ type: 'spring' } as const))\n sv.value = resolveTransition(cfg, target) as never\n },\n // The transition is intentionally read on every call rather than cooked\n // into the dep array — a fresh literal each render would otherwise\n // rebuild the handler bag and break composing consumers that key off\n // handler identity. `transition` is read inside the callback closure;\n // shared values are stable so the only dep that matters is the reduce-\n // motion flag.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [shouldReduceMotion],\n )\n\n const handlers = useMemo<UseGestureHandlers>(\n () => ({\n onPressIn: () => setLayer(pressed, 'pressed', 1),\n onPressOut: () => setLayer(pressed, 'pressed', 0),\n onHoverIn: () => setLayer(hovered, 'hovered', 1),\n onHoverOut: () => setLayer(hovered, 'hovered', 0),\n onFocus: () => {\n setLayer(focused, 'focused', 1)\n if (isFocusVisible()) setLayer(focusVisible, 'focusVisible', 1)\n },\n onBlur: () => {\n setLayer(focused, 'focused', 0)\n setLayer(focusVisible, 'focusVisible', 0)\n },\n }),\n [setLayer, pressed, focused, focusVisible, hovered],\n )\n\n return { pressed, focused, focusVisible, hovered, handlers }\n}\n\nfunction layerTransition(\n layer: LayerName,\n transition: TransitionConfig | GestureLayerTransitions | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return (transition as GestureLayerTransitions)[layer]\n}\n","import { useEffect, useMemo } from 'react'\nimport {\n interpolateColor,\n useAnimatedStyle,\n useSharedValue,\n type AnimatedStyle,\n} from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { isTopLevelTransition, resolveTransition } from '../transitions'\nimport { useGesture, type UseGestureHandlers } from '../values/useGesture'\nimport { type GestureLayerTransitions, type TransitionConfig } from '../types'\n\n/**\n * A single gesture-layer style — a flat map of style keys to a value. Numeric\n * values participate in clamped-max composition (the \"strongest active layer\n * wins\" model used by MD3 state-layer haloes); string values are treated as\n * colors and composed via priority cascade with `interpolateColor`.\n *\n * The hook does not validate that string values are valid colors — passing\n * something like `borderStyle: 'solid'` will crash inside the worklet. Keep\n * string values to color strings.\n */\nexport type GestureLayerStyle = {\n [key: string]: number | string | undefined\n}\n\n/**\n * Per-state style maps. Every key is optional; missing layers default to\n * `rest` (or `0` / `'transparent'` if `rest` is also absent for that key).\n *\n * - `rest` — base values, applied when no other layer is active.\n * - `hovered` / `focused` / `focusVisible` / `pressed` — gesture-driven\n * states tracked via the underlying `useGesture` hook. Each owns an\n * independent 0↔1 progress that fades the layer in/out per the configured\n * transition.\n * - `disabled` — gated by the JS-side `options.disabled` flag rather than a\n * gesture. Sits at the top of the priority cascade and overrides every\n * gesture layer when active.\n */\nexport interface GestureLayerStates {\n rest?: GestureLayerStyle\n hovered?: GestureLayerStyle\n focused?: GestureLayerStyle\n focusVisible?: GestureLayerStyle\n pressed?: GestureLayerStyle\n disabled?: GestureLayerStyle\n}\n\nexport interface UseGestureLayerOptions {\n /**\n * When `true`, the `disabled` layer becomes active (or `rest` if `disabled`\n * is undefined). Animates via the top-level transition or the library\n * default spring; per-layer transitions (`GestureLayerTransitions`) do not\n * apply to `disabled`.\n */\n disabled?: boolean\n /**\n * Transition forwarded to the underlying `useGesture` hook. Either a single\n * `TransitionConfig` for every gesture layer, or a `GestureLayerTransitions`\n * map for per-layer fades. Reduced motion collapses every transition to\n * `no-animation`.\n */\n transition?: TransitionConfig | GestureLayerTransitions\n}\n\nexport interface UseGestureLayerResult {\n /**\n * Animated style produced by `useAnimatedStyle` — spread on an\n * `Animated.View` or pass through `<Motion.View style={...} />`.\n */\n style: AnimatedStyle<Record<string, unknown>>\n /** Handlers to spread on the receiving `Pressable`. */\n handlers: UseGestureHandlers\n}\n\n/**\n * A \"strongest active layer wins\" interactive-feedback primitive. Sits one\n * step above `useGesture()` — the consumer supplies the per-state target\n * values, the hook handles the four gesture progress shared values, the\n * disabled override, the worklet, and the transition.\n *\n * Composition model:\n *\n * - **Numeric keys** (opacity, scale, borderWidth, etc.) compose via\n * clamped-max with `rest` as the floor:\n * `out = max(rest, ...for each active gesture layer: lerp(rest, layer, progress))`.\n * This matches the MD3 state-layer halo pattern — multiple states active\n * simultaneously raise the value to the strongest, not the sum.\n * - **Color keys** (any string value) compose via priority cascade with\n * `interpolateColor`, lowest priority first: `hovered → focused →\n * focusVisible → pressed`. Clamped-max doesn't apply to colors; this\n * matches the cascade used by the declarative `gesture` prop.\n * - **Disabled** sits at the top of the cascade for both numeric and color\n * keys — when active, it lerps the composed value toward the `disabled`\n * target.\n *\n * Reach for this when you want MD3 / iOS-translucent state-layer overlays\n * without rewriting the worklet by hand for every consumer; reach for plain\n * `useGesture()` when you need a composition model this hook doesn't\n * express (additive, multiply, per-key custom blends).\n *\n * @example MD3 state-layer halo\n * ```tsx\n * import { useGestureLayer } from '@rootnative/inertia/gesture-layer'\n * import Animated from 'react-native-reanimated'\n * import { Pressable } from 'react-native'\n *\n * function SwitchHalo({ disabled }: { disabled?: boolean }) {\n * const { style, handlers } = useGestureLayer(\n * {\n * rest: { opacity: 0, backgroundColor: 'transparent' },\n * hovered: { opacity: 0.08, backgroundColor: '#000' },\n * focused: { opacity: 0.10, backgroundColor: '#000' },\n * pressed: { opacity: 0.12, backgroundColor: '#000' },\n * },\n * { disabled, transition: { type: 'timing', duration: 150 } },\n * )\n *\n * return (\n * <Pressable {...handlers}>\n * <Animated.View style={style} />\n * </Pressable>\n * )\n * }\n * ```\n */\nexport function useGestureLayer(\n states: GestureLayerStates,\n options: UseGestureLayerOptions = {},\n): UseGestureLayerResult {\n const { disabled: isDisabled = false, transition } = options\n const shouldReduceMotion = useShouldReduceMotion()\n const gesture = useGesture(transition)\n const disabledProgress = useSharedValue(0)\n\n useEffect(() => {\n const target = isDisabled ? 1 : 0\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (disabledTransition(transition) ?? ({ type: 'spring' } as const))\n disabledProgress.value = resolveTransition(cfg, target) as never\n }, [isDisabled, shouldReduceMotion, transition, disabledProgress])\n\n // JS-thread precompute: union of keys across all layers, per-key type\n // (number vs color), and a rest-fallback table. The worklet body reads\n // from `meta` instead of probing each layer per frame — the type check\n // only runs when layer identities change.\n const meta = useMemo(() => {\n const layers = {\n rest: states.rest,\n hovered: states.hovered,\n focused: states.focused,\n focusVisible: states.focusVisible,\n pressed: states.pressed,\n disabled: states.disabled,\n }\n const sources = [\n layers.rest,\n layers.hovered,\n layers.focused,\n layers.focusVisible,\n layers.pressed,\n layers.disabled,\n ]\n const keySet = new Set<string>()\n for (const src of sources) {\n if (!src) continue\n for (const k in src) if (src[k] !== undefined) keySet.add(k)\n }\n const keys = Array.from(keySet)\n const types: Record<string, 'number' | 'color'> = {}\n const restValues: Record<string, number | string> = {}\n for (const k of keys) {\n let firstDefined: number | string | undefined\n for (const src of sources) {\n if (src && src[k] !== undefined) {\n firstDefined = src[k]\n break\n }\n }\n const isColor = typeof firstDefined === 'string'\n types[k] = isColor ? 'color' : 'number'\n const restRaw = layers.rest ? layers.rest[k] : undefined\n restValues[k] =\n restRaw !== undefined ? restRaw : isColor ? 'transparent' : 0\n }\n return { layers, keys, types, restValues }\n }, [\n states.rest,\n states.hovered,\n states.focused,\n states.focusVisible,\n states.pressed,\n states.disabled,\n ])\n\n const style = useAnimatedStyle(() => {\n const { layers, keys, types, restValues } = meta\n const ph = gesture.hovered.value\n const pf = gesture.focused.value\n const pfv = gesture.focusVisible.value\n const pp = gesture.pressed.value\n const pd = disabledProgress.value\n\n const hoveredLayer = layers.hovered\n const focusedLayer = layers.focused\n const focusVisibleLayer = layers.focusVisible\n const pressedLayer = layers.pressed\n const disabledLayer = layers.disabled\n\n const out: Record<string, unknown> = {}\n\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i]!\n const isColor = types[k] === 'color'\n const rest = restValues[k]!\n\n if (isColor) {\n let v = rest as string\n if (hoveredLayer && ph > 0 && hoveredLayer[k] !== undefined) {\n v = interpolateColor(ph, [0, 1], [v, hoveredLayer[k] as string])\n }\n if (focusedLayer && pf > 0 && focusedLayer[k] !== undefined) {\n v = interpolateColor(pf, [0, 1], [v, focusedLayer[k] as string])\n }\n if (\n focusVisibleLayer &&\n pfv > 0 &&\n focusVisibleLayer[k] !== undefined\n ) {\n v = interpolateColor(pfv, [0, 1], [v, focusVisibleLayer[k] as string])\n }\n if (pressedLayer && pp > 0 && pressedLayer[k] !== undefined) {\n v = interpolateColor(pp, [0, 1], [v, pressedLayer[k] as string])\n }\n if (disabledLayer && pd > 0 && disabledLayer[k] !== undefined) {\n v = interpolateColor(pd, [0, 1], [v, disabledLayer[k] as string])\n }\n out[k] = v\n } else {\n const base = rest as number\n let m = base\n if (hoveredLayer && ph > 0 && hoveredLayer[k] !== undefined) {\n const c = base + ((hoveredLayer[k] as number) - base) * ph\n if (c > m) m = c\n }\n if (focusedLayer && pf > 0 && focusedLayer[k] !== undefined) {\n const c = base + ((focusedLayer[k] as number) - base) * pf\n if (c > m) m = c\n }\n if (\n focusVisibleLayer &&\n pfv > 0 &&\n focusVisibleLayer[k] !== undefined\n ) {\n const c = base + ((focusVisibleLayer[k] as number) - base) * pfv\n if (c > m) m = c\n }\n if (pressedLayer && pp > 0 && pressedLayer[k] !== undefined) {\n const c = base + ((pressedLayer[k] as number) - base) * pp\n if (c > m) m = c\n }\n if (disabledLayer && pd > 0 && disabledLayer[k] !== undefined) {\n m = m + ((disabledLayer[k] as number) - m) * pd\n }\n out[k] = m\n }\n }\n\n return out\n })\n\n return {\n style: style as AnimatedStyle<Record<string, unknown>>,\n handlers: gesture.handlers,\n }\n}\n\nfunction disabledTransition(\n transition: TransitionConfig | GestureLayerTransitions | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return undefined\n}\n"]}
1
+ {"version":3,"sources":["../../src/transitions/sig.ts","../../src/config/MotionConfigContext.ts","../../src/transitions/keys.ts","../../src/config/namedTransitions.ts","../../src/transitions/easing.ts","../../src/transitions/spring.ts","../../src/transitions/resolve.ts","../../src/gestures/focusVisibility.ts","../../src/values/useGesture.ts","../../src/gestureLayer/useGestureLayer.ts"],"names":["useSharedValue","useMemo"],"mappings":";;;;;;;;AAOO,SAAS,UAAU,KAAA,EAAwB;AAChD,EAAA,IAAI,KAAA,KAAU,QAAW,OAAO,EAAA;AAChC,EAAA,IAAI;AACF,IAAA,OAAO,gBAAgB,KAAK,CAAA;AAAA,EAC9B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,OAAO,KAAK,CAAA;AAAA,EACrB;AACF;AAQA,SAAS,gBAAgB,CAAA,EAAoB;AAC3C,EAAA,IAAI,CAAA,KAAM,IAAA,IAAQ,OAAO,CAAA,KAAM,QAAA,EAAU;AACvC,IAAA,IAAI,OAAO,CAAA,KAAM,UAAA,IAAc,CAAA,KAAM,QAAW,OAAO,MAAA;AACvD,IAAA,OAAO,IAAA,CAAK,UAAU,CAAC,CAAA;AAAA,EACzB;AACA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA,EAAG;AACpB,IAAA,OAAO,MAAM,CAAA,CAAE,GAAA,CAAI,eAAe,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA,GAAI,GAAA;AAAA,EAClD;AACA,EAAA,MAAM,GAAA,GAAM,CAAA;AACZ,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,IAAA,CAAK,GAAG,EAAE,IAAA,EAAK;AACnC,EAAA,OACE,MACA,IAAA,CACG,GAAA,CAAI,CAAC,CAAA,KAAM,IAAA,CAAK,UAAU,CAAC,CAAA,GAAI,GAAA,G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IAAI,CAAC,YAAY,OAAO,MAAA;AACxB,EAAA,IAAI,oBAAA,CAAqB,UAAU,CAAA,EAAG,OAAO,UAAA;AAC7C,EAAA,OAAO,MAAA;AACT","file":"index.mjs","sourcesContent":["/**\n * Stable string signature for an arbitrary value — used as a dep-array\n * member so a fresh object literal each render doesn't re-fire an effect\n * unless something structurally changed. Functions serialize as `null`\n * (their identity isn't useful in a sig); `undefined` collapses to an empty\n * string so omitted props compare equal across renders.\n */\nexport function stableSig(value: unknown): string {\n if (value === undefined) return ''\n try {\n return stableStringify(value)\n } catch {\n return String(value)\n }\n}\n\n/**\n * JSON.stringify with keys sorted at every level so a sig is invariant under\n * property-declaration order. Functions and `undefined` both serialize as\n * `null` — we accept the latter's information loss (rare in practice) in\n * exchange for not crashing on circular function-bearing graphs.\n */\nfunction stableStringify(v: unknown): string {\n if (v === null || typeof v !== 'object') {\n if (typeof v === 'function' || v === undefined) return 'null'\n return JSON.stringify(v)\n }\n if (Array.isArray(v)) {\n return '[' + v.map(stableStringify).join(',') + ']'\n }\n const obj = v as Record<string, unknown>\n const keys = Object.keys(obj).sort()\n return (\n '{' +\n keys\n .map((k) => JSON.stringify(k) + ':' + stableStringify(obj[k]))\n .join(',') +\n '}'\n )\n}\n","import { createContext, useContext } from 'react'\nimport { useReducedMotion } from 'react-native-reanimated'\nimport { type NamedTransitions } from '../types'\n\n/**\n * How descendant Motion primitives should treat reduced-motion preferences.\n *\n * - `'user'` (default): defer to the OS accessibility setting via\n * Reanimated's `useReducedMotion()`. This is the only value that respects\n * user choice and is the right default for app-level wrappers.\n * - `'never'`: animate regardless of OS setting. Use sparingly — e.g. for\n * onboarding transitions you've decided are essential.\n * - `'always'`: never animate, regardless of OS setting. Useful for tests\n * and snapshots.\n */\nexport type ReducedMotion = 'user' | 'never' | 'always'\n\nexport interface MotionConfigValue {\n reducedMotion: ReducedMotion\n /**\n * Named transitions registered by ancestor `<MotionConfig transitions>`\n * providers, already merged (nearest provider wins per name). Empty with no\n * provider — every name then resolves to the unknown-name fallback.\n */\n transitions: NamedTransitions\n}\n\n/**\n * Default config used when a Motion primitive is rendered without a\n * `<MotionConfig>` ancestor. `'user'` means respect the OS setting; no\n * transitions are registered.\n */\nexport const DEFAULT_MOTION_CONFIG: MotionConfigValue = {\n reducedMotion: 'user',\n transitions: {},\n}\n\nexport const MotionConfigContext = createContext<MotionConfigValue>(\n DEFAULT_MOTION_CONFIG,\n)\n\n/**\n * Read the active `<MotionConfig>` from a descendant. Returns the default\n * (`'user'`) when no provider is present.\n */\nexport function useMotionConfig(): MotionConfigValue {\n return useContext(MotionConfigContext)\n}\n\n/**\n * Resolve the active reduced-motion mode to a boolean. `'user'` consults\n * Reanimated's OS-backed hook; `'always'` / `'never'` shortcut. Motion\n * primitives call this to decide whether to swap transitions for\n * `no-animation`.\n */\n/**\n * Read the merged named-transition registry from the nearest `<MotionConfig>`\n * ancestors. This is what the Motion primitives and value-layer hooks consult\n * when a `TransitionName` string is passed where a `TransitionConfig` is\n * accepted; custom animated components (and adapter packages) use it together\n * with `resolveNamedTransition` to support names on their own surface.\n */\nexport function useNamedTransitions(): NamedTransitions {\n return useMotionConfig().transitions\n}\n\nexport function useShouldReduceMotion(): boolean {\n const { reducedMotion } = useMotionConfig()\n const osReduced = useReducedMotion()\n if (reducedMotion === 'never') return false\n if (reducedMotion === 'always') return true\n return osReduced\n}\n","import { type TransitionConfig } from '../types'\n\n/**\n * Field names that may appear on a `TransitionConfig` (spring / timing /\n * decay / no-animation). Used as a structural discriminator: if every key on\n * an object is in this set, the object is treated as a top-level transition;\n * otherwise it's a per-property / per-layer transition map.\n *\n * Adding a new field to `TransitionConfig` requires adding the name here.\n */\nexport const TRANSITION_CONFIG_KEYS = new Set([\n 'type',\n 'tension',\n 'friction',\n 'mass',\n 'velocity',\n 'restSpeedThreshold',\n 'restDisplacementThreshold',\n 'duration',\n 'easing',\n 'delay',\n 'repeat',\n 'deceleration',\n 'clamp',\n])\n\nexport function isTopLevelTransition(t: unknown): t is TransitionConfig {\n if (t === null || typeof t !== 'object') return false\n const keys = Object.keys(t as object)\n if (keys.length === 0) return false\n return keys.every((k) => TRANSITION_CONFIG_KEYS.has(k))\n}\n","import { isTopLevelTransition } from '../transitions/keys'\nimport {\n type NamedTransitions,\n type Transition,\n type TransitionConfig,\n type TransitionInput,\n} from '../types'\n\ndeclare const __DEV__: boolean\n\n/**\n * Fallback used when a name isn't found in the registry: the library default\n * spring, matching what an omitted transition resolves to everywhere else.\n */\nconst UNKNOWN_NAME_FALLBACK: TransitionConfig = { type: 'spring' }\n\n/**\n * Look a registered transition name up in a registry. Unknown names warn in\n * dev and fall back to the library default spring — the animation still runs,\n * it just isn't the one the token intended, which is the same failure\n * softness the web platform gives an unknown CSS keyword.\n */\nexport function lookupNamedTransition(\n name: string,\n registry: NamedTransitions,\n): TransitionConfig {\n const cfg = registry[name]\n if (cfg) return cfg\n if (__DEV__) {\n console.warn(\n `[inertia] Unknown transition name \"${name}\" — falling back to the ` +\n `default spring. Register it on a provider: ` +\n `<MotionConfig transitions={{ '${name}': { ... } }}>.`,\n )\n }\n return UNKNOWN_NAME_FALLBACK\n}\n\n/**\n * Resolve a single transition input — a `TransitionConfig` passes through\n * untouched, a `TransitionName` is looked up in `registry`. This is the\n * building block adapter packages use to accept names wherever they accept a\n * config (pair it with `useNamedTransitions()` for the registry).\n */\nexport function resolveNamedTransition(\n input: TransitionInput | undefined,\n registry: NamedTransitions,\n): TransitionConfig | undefined {\n if (input === undefined) return undefined\n if (typeof input === 'string') return lookupNamedTransition(input, registry)\n return input\n}\n\n/**\n * Resolve every name inside a `transition` prop value — the top-level string\n * form, and string values on the per-property / gesture-layer map form.\n * Identity-preserving: when the input contains no names it is returned\n * unchanged, so signature- and identity-keyed memoization downstream is\n * unaffected for the config-object path.\n */\nexport function resolveNamedTransitionProp<S>(\n transition: Transition<S> | undefined,\n registry: NamedTransitions,\n): Exclude<Transition<S>, string> | undefined {\n if (transition === undefined) return undefined\n if (typeof transition === 'string') {\n return lookupNamedTransition(transition, registry)\n }\n if (isTopLevelTransition(transition)) return transition\n const map = transition as Record<string, unknown>\n let out: Record<string, unknown> | null = null\n for (const key in map) {\n const value = map[key]\n if (typeof value === 'string') {\n if (out === null) out = { ...map }\n out[key] = lookupNamedTransition(value, registry)\n }\n }\n return (out ?? transition) as Exclude<Transition<S>, string>\n}\n","// `isWorkletFunction` lives in `react-native-worklets` (the Reanimated 4 peer\n// dep); Reanimated's own re-export is deprecated.\nimport { isWorkletFunction } from 'react-native-worklets'\nimport { type EasingInput } from '../types'\n\n/**\n * Reanimated 3.9+ validates that easing functions used in nested-transition\n * contexts (variants, sequences, per-property maps) are worklets, and crashes\n * with `[Reanimated] The easing function is not a worklet` otherwise. The\n * library accepts plain functions on the public surface; this helper wraps\n * them so consumers don't have to think about the worklet boundary.\n *\n * If the input is already a worklet (has been processed by the worklets babel\n * plugin), it's returned as-is. Otherwise it's wrapped in a function whose\n * body declares the `'worklet'` directive — when our source is processed by\n * the consumer's worklets babel plugin (the default Expo/RN setup), the\n * wrapper becomes a real worklet that captures the user fn via closure.\n *\n * Reanimated 4 changed `Easing.bezier(...)` to return an\n * `EasingFunctionFactory` (`{ factory: () => EasingFunction }`) rather than\n * the function itself. The helper accepts both shapes — `EasingFunction` and\n * `EasingFunctionFactory` — and unwraps the factory automatically so\n * consumers don't have to call `.factory()` manually.\n *\n * The user fn must be pure: no JS-thread captured refs, no shared mutable\n * state, no calls to non-worklet APIs.\n */\nexport function ensureWorkletEasing(\n easing: EasingInput | undefined,\n): ((t: number) => number) | undefined {\n if (!easing) return undefined\n // Reanimated 4 `EasingFunctionFactory` — unwrap via `.factory()` before\n // checking worklet status, so the wrapped fn (not the factory wrapper)\n // ends up in the transition config.\n const fn = isEasingFactory(easing) ? easing.factory() : easing\n if (isWorkletFunction(fn)) return fn\n const wrapped = (t: number) => {\n 'worklet'\n return fn(t)\n }\n return wrapped\n}\n\nfunction isEasingFactory(\n value: EasingInput,\n): value is { factory: () => (t: number) => number } {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'factory' in value &&\n typeof (value as { factory: unknown }).factory === 'function'\n )\n}\n","import { type SpringTransition } from '../types'\n\n/**\n * Default spring physics, expressed in react-spring vocabulary.\n *\n * `tension: 170` / `friction: 26` / `mass: 1` was picked over Reanimated's\n * raw `stiffness: 100` / `damping: 10` default because the raw default\n * overshoots noticeably for the small (~100px) translates that dominate\n * UI work — buttons, sheets, popovers. These numbers settle in ~350ms with\n * a single, almost-imperceptible overshoot, which matches the perceptual\n * target the rest of the library is tuned against.\n */\nexport const DEFAULT_SPRING: Required<\n Pick<SpringTransition, 'tension' | 'friction' | 'mass'>\n> = {\n tension: 170,\n friction: 26,\n mass: 1,\n}\n\n/**\n * Convert public react-spring vocabulary (`tension` / `friction` / `mass`)\n * to Reanimated's raw `stiffness` / `damping` / `mass`. This is the single\n * place the mapping lives; resolvers, value hooks, and any future surface\n * that needs a Reanimated spring config import from here.\n *\n * The mapping is identity (tension ≡ stiffness, friction ≡ damping) — the\n * names differ but the underlying physics constants are the same. We don't\n * surface the raw names publicly because the react-spring vocabulary is\n * what designers and prior-art consumers expect.\n */\nexport function springToReanimated(t: SpringTransition) {\n 'worklet'\n return {\n stiffness: t.tension ?? DEFAULT_SPRING.tension,\n damping: t.friction ?? DEFAULT_SPRING.friction,\n mass: t.mass ?? DEFAULT_SPRING.mass,\n velocity: t.velocity,\n restSpeedThreshold: t.restSpeedThreshold,\n restDisplacementThreshold: t.restDisplacementThreshold,\n }\n}\n","import {\n Easing,\n withDecay,\n withDelay,\n withRepeat,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { ensureWorkletEasing } from './easing'\nimport { springToReanimated } from './spring'\nimport {\n type DecayTransition,\n type RepeatConfig,\n type SpringTransition,\n type TimingTransition,\n type TransitionConfig,\n} from '../types'\n\n/**\n * UI-thread callback Reanimated invokes when an animation settles. Must be a\n * worklet — callers either author one with `'worklet'` or build one via\n * `runOnJS(...)` to bridge to JS-thread code.\n */\nexport type AnimationCallback = (\n finished?: boolean,\n current?: number | string,\n) => void\n\n/**\n * Per-step callback factory. Resolvers call this with the step's phase and\n * sequence index (or `undefined` for non-sequence animations) and attach the\n * resulting callback to the underlying `withSpring` / `withTiming` /\n * `withDecay` call.\n */\nexport type CallbackFactory = (\n phase: 'step' | 'animation',\n step: number | undefined,\n) => AnimationCallback | undefined\n\nconst DEFAULT_TIMING_DURATION = 250\n\nfunction buildSpring(\n cfg: SpringTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withSpring(toValue as number, springToReanimated(cfg), cb as never)\n}\n\nfunction buildTiming(\n cfg: TimingTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withTiming(\n toValue as number,\n {\n duration: cfg.duration ?? DEFAULT_TIMING_DURATION,\n easing: ensureWorkletEasing(cfg.easing) ?? Easing.inOut(Easing.ease),\n },\n cb as never,\n )\n}\n\nfunction buildDecay(cfg: DecayTransition, cb?: AnimationCallback) {\n return withDecay(\n {\n velocity: cfg.velocity ?? 0,\n deceleration: cfg.deceleration,\n clamp: cfg.clamp,\n },\n cb as never,\n )\n}\n\n/**\n * Build a single-step animation (no repeat / no delay / no sequence) for a\n * given config + target. Pulled out so sequence steps can compose without\n * recursing into repeat/delay handling per step. The callback is forwarded\n * to Reanimated; for `no-animation` the callback is fired synchronously\n * since there's nothing to wait for.\n */\nfunction buildOne(\n cfg: TransitionConfig,\n toValue: number | string,\n cb?: AnimationCallback,\n): unknown {\n if (cfg.type === 'no-animation') {\n if (cb) cb(true, toValue)\n return toValue\n }\n if (cfg.type === 'decay') return buildDecay(cfg, cb)\n if (cfg.type === 'timing') return buildTiming(cfg, toValue, cb)\n return buildSpring(cfg as SpringTransition, toValue, cb)\n}\n\n/**\n * Wrap an animation in `withRepeat` per the unified `repeat` shape:\n * - `number` → finite count, alternating direction\n * - `'infinite'` → endless, alternating direction\n * - `{ count, alternate }`→ explicit; `alternate` defaults to `true`\n */\nexport function applyRepeat(\n animation: unknown,\n repeat: RepeatConfig | undefined,\n) {\n if (repeat === undefined) return animation\n if (repeat === 'infinite') {\n return withRepeat(animation as never, -1, true)\n }\n if (typeof repeat === 'number') {\n return withRepeat(animation as never, repeat, true)\n }\n const count = repeat.count === 'infinite' ? -1 : repeat.count\n const alternate = repeat.alternate ?? true\n return withRepeat(animation as never, count, alternate)\n}\n\nfunction applyDelay(animation: unknown, delay: number | undefined) {\n if (!delay || delay <= 0) return animation\n return withDelay(delay, animation as never)\n}\n\n/**\n * Build a Reanimated animation for a single property. Runs on the JS thread\n * once per change and produces a baked `withSpring` / `withTiming` /\n * `withDecay` (optionally wrapped in `withDelay` / `withRepeat`) call. The\n * worklet body only consumes the result.\n *\n * `callback`, when provided, fires once when the underlying single-shot\n * animation settles. Repeat-wrapped animations forward the callback to\n * `withRepeat`, so it fires once per iteration as Reanimated does.\n */\nexport function resolveTransition(\n config: TransitionConfig | undefined,\n toValue: number | string,\n callback?: AnimationCallback,\n): unknown {\n const cfg = config ?? ({ type: 'spring' } as SpringTransition)\n const base = buildOne(cfg, toValue, callback)\n const repeated = applyRepeat(base, repeatOf(cfg))\n return applyDelay(repeated, delayOf(cfg))\n}\n\nexport function repeatOf(cfg: TransitionConfig): RepeatConfig | undefined {\n if (cfg.type === 'no-animation' || cfg.type === 'decay') return undefined\n return cfg.repeat\n}\n\n/**\n * Return `cfg` minus its `repeat` field. Used when peeling top-level repeat\n * off a base transition before passing it down to per-sequence-step\n * resolution — the sequence as a whole is what should repeat, not each step.\n */\nexport function stripRepeat(\n cfg: TransitionConfig | undefined,\n): TransitionConfig | undefined {\n if (!cfg) return cfg\n if (cfg.type === 'no-animation' || cfg.type === 'decay') return cfg\n if (cfg.repeat === undefined) return cfg\n const next = { ...cfg }\n delete next.repeat\n return next\n}\n\nfunction delayOf(cfg: TransitionConfig): number | undefined {\n if (cfg.type === 'no-animation') return undefined\n return cfg.delay\n}\n","import { Platform } from 'react-native'\n\n/**\n * Input-modality tracker for the `focusVisible` gesture sub-state.\n *\n * Implements the W3C `:focus-visible` heuristic: a focus event counts as\n * \"visible\" only when the most recent user input was keyboard-driven. Mouse,\n * pointer, and touch events flip the modality to `'pointer'`; keyboard events\n * flip it back to `'keyboard'`.\n *\n * On native platforms there is no pointer-vs-keyboard distinction — focus\n * arrives via D-pad, screen reader, or hardware keyboard, all of which are\n * keyboard-equivalent — so `isFocusVisible()` is unconditionally `true`.\n *\n * The web listeners attach lazily on first call (capture phase, so they run\n * before the focus event reaches the focused element) and stay installed for\n * the lifetime of the document. They are passive and idle-cheap; the cost is\n * one boolean read per `onFocus` dispatch.\n */\n\ntype InputModality = 'keyboard' | 'pointer'\n\n// Default to `'keyboard'` so a programmatic / autofocus that happens before\n// any user input still draws a focus ring — matches the W3C polyfill default.\nlet modality: InputModality = 'keyboard'\nlet installed = false\n\nfunction setKeyboard() {\n modality = 'keyboard'\n}\n\nfunction setPointer() {\n modality = 'pointer'\n}\n\nfunction ensureInstalled(): void {\n if (installed) return\n if (Platform.OS !== 'web') return\n if (typeof document === 'undefined') return\n document.addEventListener('keydown', setKeyboard, true)\n document.addEventListener('mousedown', setPointer, true)\n document.addEventListener('pointerdown', setPointer, true)\n document.addEventListener('touchstart', setPointer, true)\n installed = true\n}\n\n/**\n * `true` if the next `onFocus` should be treated as \"focus-visible\" (keyboard\n * focus). On native, always `true`. On web, reflects the most recent user\n * input modality.\n */\nexport function isFocusVisible(): boolean {\n if (Platform.OS !== 'web') return true\n ensureInstalled()\n return modality === 'keyboard'\n}\n\n/** @internal — test-only hook to reset module state between cases. */\nexport function __resetFocusVisibilityForTests(next: InputModality): void {\n modality = next\n}\n","import { useCallback, useMemo } from 'react'\nimport { useSharedValue, type SharedValue } from 'react-native-reanimated'\nimport {\n resolveNamedTransitionProp,\n useNamedTransitions,\n useShouldReduceMotion,\n} from '../config'\nimport { isFocusVisible } from '../gestures'\nimport { isTopLevelTransition, resolveTransition } from '../transitions'\nimport {\n type GestureLayerTransitions,\n type TransitionConfig,\n type TransitionInput,\n} from '../types'\n\ntype LayerName = 'pressed' | 'focused' | 'focusVisible' | 'hovered'\n\n/**\n * Handler bag returned by `useGesture`. Spread on a `Pressable` to drive the\n * shared values returned alongside.\n *\n * Hover handlers use `Pressable`'s own `onHoverIn` / `onHoverOut` names (web\n * only — no-ops on native). `onFocus` consults `isFocusVisible()` before\n * raising the keyboard-only `focusVisible` layer; `focused` always raises.\n */\nexport interface UseGestureHandlers {\n onPressIn: () => void\n onPressOut: () => void\n onHoverIn: () => void\n onHoverOut: () => void\n onFocus: () => void\n onBlur: () => void\n}\n\nexport interface UseGestureResult {\n /** 0↔1 progress for the pressed layer. */\n pressed: SharedValue<number>\n /** 0↔1 progress for the focused layer (any focus modality). */\n focused: SharedValue<number>\n /** 0↔1 progress for the focusVisible layer (keyboard focus only). */\n focusVisible: SharedValue<number>\n /** 0↔1 progress for the hovered layer (web only — stays at 0 on native). */\n hovered: SharedValue<number>\n /** Handlers to spread on the receiving `Pressable`. */\n handlers: UseGestureHandlers\n}\n\n/**\n * Build a gesture-layer controller. The hook-form of the `gesture` prop —\n * reach for it when you need to drive multiple animated views from the same\n * gesture state (a focus ring + state-layer halo + content tint all on one\n * Pressable), which the prop-form's \"animate the receiver's own style\" model\n * can't express.\n *\n * Returns four 0↔1 shared values (one per layer) and a handler bag to spread\n * on a `Pressable`. The shared values are stable across renders — feed them\n * into any number of `useAnimatedStyle` blocks anywhere in the tree.\n *\n * Transitions follow the same shape as the `gesture` prop's accompanying\n * `transition`: pass a single `TransitionConfig` to use for every layer, or a\n * `GestureLayerTransitions` map to give each layer its own. A `TransitionName`\n * registered on the nearest `<MotionConfig transitions>` is accepted in both\n * positions (top-level and per-layer). Layers without an explicit transition\n * fall back to the library default spring.\n *\n * Reduced motion (via `<MotionConfig reducedMotion>`) collapses every\n * transition to `no-animation` so state changes snap instead of interpolating\n * — same behaviour the gesture prop applies.\n *\n * @example\n * ```tsx\n * import { useAnimatedStyle } from 'react-native-reanimated'\n * import { useGesture } from '@rootnative/inertia'\n *\n * function Card() {\n * const { pressed, focused, hovered, handlers } = useGesture({\n * pressed: { type: 'timing', duration: 100 },\n * hovered: { type: 'timing', duration: 150 },\n * focused: { type: 'timing', duration: 200 },\n * })\n *\n * const ringStyle = useAnimatedStyle(() => ({ opacity: focused.value }))\n * const haloStyle = useAnimatedStyle(() => ({\n * opacity: Math.max(\n * hovered.value * 0.08,\n * focused.value * 0.10,\n * pressed.value * 0.10,\n * ),\n * }))\n *\n * return (\n * <Pressable {...handlers}>\n * <Animated.View style={ringStyle} />\n * <Animated.View style={haloStyle} />\n * </Pressable>\n * )\n * }\n * ```\n */\nexport function useGesture(\n transition?: TransitionInput | GestureLayerTransitions,\n): UseGestureResult {\n const pressed = useSharedValue(0)\n const focused = useSharedValue(0)\n const focusVisible = useSharedValue(0)\n const hovered = useSharedValue(0)\n const shouldReduceMotion = useShouldReduceMotion()\n // Registered transition names (top-level string or per-layer string values)\n // resolve against the nearest <MotionConfig transitions> at render time, so\n // the callbacks below only ever see concrete configs.\n const resolved = resolveNamedTransitionProp(transition, useNamedTransitions())\n\n const setLayer = useCallback(\n (sv: SharedValue<number>, layer: LayerName, target: 0 | 1) => {\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (layerTransition(layer, resolved) ?? ({ type: 'spring' } as const))\n sv.value = resolveTransition(cfg, target) as never\n },\n // The transition is intentionally read on every call rather than cooked\n // into the dep array — a fresh literal each render would otherwise\n // rebuild the handler bag and break composing consumers that key off\n // handler identity. `transition` is read inside the callback closure;\n // shared values are stable so the only dep that matters is the reduce-\n // motion flag.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [shouldReduceMotion],\n )\n\n const handlers = useMemo<UseGestureHandlers>(\n () => ({\n onPressIn: () => setLayer(pressed, 'pressed', 1),\n onPressOut: () => setLayer(pressed, 'pressed', 0),\n onHoverIn: () => setLayer(hovered, 'hovered', 1),\n onHoverOut: () => setLayer(hovered, 'hovered', 0),\n onFocus: () => {\n setLayer(focused, 'focused', 1)\n if (isFocusVisible()) setLayer(focusVisible, 'focusVisible', 1)\n },\n onBlur: () => {\n setLayer(focused, 'focused', 0)\n setLayer(focusVisible, 'focusVisible', 0)\n },\n }),\n [setLayer, pressed, focused, focusVisible, hovered],\n )\n\n return { pressed, focused, focusVisible, hovered, handlers }\n}\n\n// Runs after name resolution, so the `TransitionInput` values on the map form\n// are concrete configs by the time they're read — hence the return cast.\nfunction layerTransition(\n layer: LayerName,\n transition: TransitionConfig | GestureLayerTransitions | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return (transition as GestureLayerTransitions)[layer] as\n | TransitionConfig\n | undefined\n}\n","import { useEffect, useMemo } from 'react'\nimport {\n interpolateColor,\n useAnimatedStyle,\n useSharedValue,\n type AnimatedStyle,\n} from 'react-native-reanimated'\nimport {\n resolveNamedTransitionProp,\n useNamedTransitions,\n useShouldReduceMotion,\n} from '../config'\nimport {\n isTopLevelTransition,\n resolveTransition,\n stableSig,\n} from '../transitions'\nimport { useGesture, type UseGestureHandlers } from '../values/useGesture'\nimport {\n type GestureLayerTransitions,\n type TransitionConfig,\n type TransitionInput,\n} from '../types'\n\n/**\n * A single gesture-layer style — a flat map of style keys to a value. Numeric\n * values participate in clamped-max composition (the \"strongest active layer\n * wins\" model used by MD3 state-layer haloes); string values are treated as\n * colors and composed via priority cascade with `interpolateColor`.\n *\n * The hook does not validate that string values are valid colors — passing\n * something like `borderStyle: 'solid'` will crash inside the worklet. Keep\n * string values to color strings.\n */\nexport type GestureLayerStyle = {\n [key: string]: number | string | undefined\n}\n\n/**\n * Per-state style maps. Every key is optional; missing layers default to\n * `rest` (or `0` / `'transparent'` if `rest` is also absent for that key).\n *\n * - `rest` — base values, applied when no other layer is active.\n * - `hovered` / `focused` / `focusVisible` / `pressed` — gesture-driven\n * states tracked via the underlying `useGesture` hook. Each owns an\n * independent 0↔1 progress that fades the layer in/out per the configured\n * transition.\n * - `disabled` — gated by the JS-side `options.disabled` flag rather than a\n * gesture. Sits at the top of the priority cascade and overrides every\n * gesture layer when active.\n */\nexport interface GestureLayerStates {\n rest?: GestureLayerStyle\n hovered?: GestureLayerStyle\n focused?: GestureLayerStyle\n focusVisible?: GestureLayerStyle\n pressed?: GestureLayerStyle\n disabled?: GestureLayerStyle\n}\n\nexport interface UseGestureLayerOptions {\n /**\n * When `true`, the `disabled` layer becomes active (or `rest` if `disabled`\n * is undefined). Animates via the top-level transition or the library\n * default spring; per-layer transitions (`GestureLayerTransitions`) do not\n * apply to `disabled`.\n */\n disabled?: boolean\n /**\n * Transition forwarded to the underlying `useGesture` hook. Either a single\n * `TransitionConfig` for every gesture layer, or a `GestureLayerTransitions`\n * map for per-layer fades. A `TransitionName` registered on the nearest\n * `<MotionConfig transitions>` is accepted in both positions. Reduced\n * motion collapses every transition to `no-animation`.\n */\n transition?: TransitionInput | GestureLayerTransitions\n}\n\nexport interface UseGestureLayerResult {\n /**\n * Animated style produced by `useAnimatedStyle` — spread on an\n * `Animated.View` or pass through `<Motion.View style={...} />`.\n */\n style: AnimatedStyle<Record<string, unknown>>\n /** Handlers to spread on the receiving `Pressable`. */\n handlers: UseGestureHandlers\n}\n\n/**\n * A \"strongest active layer wins\" interactive-feedback primitive. Sits one\n * step above `useGesture()` — the consumer supplies the per-state target\n * values, the hook handles the four gesture progress shared values, the\n * disabled override, the worklet, and the transition.\n *\n * Composition model:\n *\n * - **Numeric keys** (opacity, scale, borderWidth, etc.) compose via\n * clamped-max with `rest` as the floor:\n * `out = max(rest, ...for each active gesture layer: lerp(rest, layer, progress))`.\n * This matches the MD3 state-layer halo pattern — multiple states active\n * simultaneously raise the value to the strongest, not the sum.\n * - **Color keys** (any string value) compose via priority cascade with\n * `interpolateColor`, lowest priority first: `hovered → focused →\n * focusVisible → pressed`. Clamped-max doesn't apply to colors; this\n * matches the cascade used by the declarative `gesture` prop.\n * - **Disabled** sits at the top of the cascade for both numeric and color\n * keys — when active, it lerps the composed value toward the `disabled`\n * target.\n *\n * Reach for this when you want MD3 / iOS-translucent state-layer overlays\n * without rewriting the worklet by hand for every consumer; reach for plain\n * `useGesture()` when you need a composition model this hook doesn't\n * express (additive, multiply, per-key custom blends).\n *\n * @example MD3 state-layer halo\n * ```tsx\n * import { useGestureLayer } from '@rootnative/inertia/gesture-layer'\n * import Animated from 'react-native-reanimated'\n * import { Pressable } from 'react-native'\n *\n * function SwitchHalo({ disabled }: { disabled?: boolean }) {\n * const { style, handlers } = useGestureLayer(\n * {\n * rest: { opacity: 0, backgroundColor: 'transparent' },\n * hovered: { opacity: 0.08, backgroundColor: '#000' },\n * focused: { opacity: 0.10, backgroundColor: '#000' },\n * pressed: { opacity: 0.12, backgroundColor: '#000' },\n * },\n * { disabled, transition: { type: 'timing', duration: 150 } },\n * )\n *\n * return (\n * <Pressable {...handlers}>\n * <Animated.View style={style} />\n * </Pressable>\n * )\n * }\n * ```\n */\nexport function useGestureLayer(\n states: GestureLayerStates,\n options: UseGestureLayerOptions = {},\n): UseGestureLayerResult {\n const { disabled: isDisabled = false, transition: transitionInput } = options\n const shouldReduceMotion = useShouldReduceMotion()\n // Resolve registered names here (not just in useGesture) because the\n // `disabled` layer reads the top-level transition locally. Identity is\n // preserved when no names are present; when a name resolves, the effect\n // below keys on the structural signature so a per-render resolve of the\n // map form doesn't re-fire it.\n const transition = resolveNamedTransitionProp(\n transitionInput,\n useNamedTransitions(),\n )\n const gesture = useGesture(transition)\n const disabledProgress = useSharedValue(0)\n\n const transitionSig = stableSig(transition)\n useEffect(() => {\n const target = isDisabled ? 1 : 0\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (disabledTransition(transition) ?? ({ type: 'spring' } as const))\n disabledProgress.value = resolveTransition(cfg, target) as never\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isDisabled, shouldReduceMotion, transitionSig, disabledProgress])\n\n // JS-thread precompute: union of keys across all layers, per-key type\n // (number vs color), and a rest-fallback table. The worklet body reads\n // from `meta` instead of probing each layer per frame — the type check\n // only runs when layer identities change.\n const meta = useMemo(() => {\n const layers = {\n rest: states.rest,\n hovered: states.hovered,\n focused: states.focused,\n focusVisible: states.focusVisible,\n pressed: states.pressed,\n disabled: states.disabled,\n }\n const sources = [\n layers.rest,\n layers.hovered,\n layers.focused,\n layers.focusVisible,\n layers.pressed,\n layers.disabled,\n ]\n const keySet = new Set<string>()\n for (const src of sources) {\n if (!src) continue\n for (const k in src) if (src[k] !== undefined) keySet.add(k)\n }\n const keys = Array.from(keySet)\n const types: Record<string, 'number' | 'color'> = {}\n const restValues: Record<string, number | string> = {}\n for (const k of keys) {\n let firstDefined: number | string | undefined\n for (const src of sources) {\n if (src && src[k] !== undefined) {\n firstDefined = src[k]\n break\n }\n }\n const isColor = typeof firstDefined === 'string'\n types[k] = isColor ? 'color' : 'number'\n const restRaw = layers.rest ? layers.rest[k] : undefined\n restValues[k] =\n restRaw !== undefined ? restRaw : isColor ? 'transparent' : 0\n }\n return { layers, keys, types, restValues }\n }, [\n states.rest,\n states.hovered,\n states.focused,\n states.focusVisible,\n states.pressed,\n states.disabled,\n ])\n\n const style = useAnimatedStyle(() => {\n const { layers, keys, types, restValues } = meta\n const ph = gesture.hovered.value\n const pf = gesture.focused.value\n const pfv = gesture.focusVisible.value\n const pp = gesture.pressed.value\n const pd = disabledProgress.value\n\n const hoveredLayer = layers.hovered\n const focusedLayer = layers.focused\n const focusVisibleLayer = layers.focusVisible\n const pressedLayer = layers.pressed\n const disabledLayer = layers.disabled\n\n const out: Record<string, unknown> = {}\n\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i]!\n const isColor = types[k] === 'color'\n const rest = restValues[k]!\n\n if (isColor) {\n let v = rest as string\n if (hoveredLayer && ph > 0 && hoveredLayer[k] !== undefined) {\n v = interpolateColor(ph, [0, 1], [v, hoveredLayer[k] as string])\n }\n if (focusedLayer && pf > 0 && focusedLayer[k] !== undefined) {\n v = interpolateColor(pf, [0, 1], [v, focusedLayer[k] as string])\n }\n if (\n focusVisibleLayer &&\n pfv > 0 &&\n focusVisibleLayer[k] !== undefined\n ) {\n v = interpolateColor(pfv, [0, 1], [v, focusVisibleLayer[k] as string])\n }\n if (pressedLayer && pp > 0 && pressedLayer[k] !== undefined) {\n v = interpolateColor(pp, [0, 1], [v, pressedLayer[k] as string])\n }\n if (disabledLayer && pd > 0 && disabledLayer[k] !== undefined) {\n v = interpolateColor(pd, [0, 1], [v, disabledLayer[k] as string])\n }\n out[k] = v\n } else {\n const base = rest as number\n let m = base\n if (hoveredLayer && ph > 0 && hoveredLayer[k] !== undefined) {\n const c = base + ((hoveredLayer[k] as number) - base) * ph\n if (c > m) m = c\n }\n if (focusedLayer && pf > 0 && focusedLayer[k] !== undefined) {\n const c = base + ((focusedLayer[k] as number) - base) * pf\n if (c > m) m = c\n }\n if (\n focusVisibleLayer &&\n pfv > 0 &&\n focusVisibleLayer[k] !== undefined\n ) {\n const c = base + ((focusVisibleLayer[k] as number) - base) * pfv\n if (c > m) m = c\n }\n if (pressedLayer && pp > 0 && pressedLayer[k] !== undefined) {\n const c = base + ((pressedLayer[k] as number) - base) * pp\n if (c > m) m = c\n }\n if (disabledLayer && pd > 0 && disabledLayer[k] !== undefined) {\n m = m + ((disabledLayer[k] as number) - m) * pd\n }\n out[k] = m\n }\n }\n\n return out\n })\n\n return {\n style: style as AnimatedStyle<Record<string, unknown>>,\n handlers: gesture.handlers,\n }\n}\n\nfunction disabledTransition(\n transition: TransitionConfig | GestureLayerTransitions | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return undefined\n}\n"]}
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 };