@onlynative/inertia 0.0.1-alpha.0 → 0.0.1-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 (52) hide show
  1. package/README.md +7 -7
  2. package/dist/index.d.mts +5 -6
  3. package/dist/index.d.ts +5 -6
  4. package/dist/index.js +84 -10
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +85 -11
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/motion/Image.d.mts +1 -1
  9. package/dist/motion/Image.d.ts +1 -1
  10. package/dist/motion/Image.js +84 -10
  11. package/dist/motion/Image.js.map +1 -1
  12. package/dist/motion/Image.mjs +85 -11
  13. package/dist/motion/Image.mjs.map +1 -1
  14. package/dist/motion/Pressable.d.mts +1 -1
  15. package/dist/motion/Pressable.d.ts +1 -1
  16. package/dist/motion/Pressable.js +84 -10
  17. package/dist/motion/Pressable.js.map +1 -1
  18. package/dist/motion/Pressable.mjs +85 -11
  19. package/dist/motion/Pressable.mjs.map +1 -1
  20. package/dist/motion/ScrollView.d.mts +1 -1
  21. package/dist/motion/ScrollView.d.ts +1 -1
  22. package/dist/motion/ScrollView.js +84 -10
  23. package/dist/motion/ScrollView.js.map +1 -1
  24. package/dist/motion/ScrollView.mjs +85 -11
  25. package/dist/motion/ScrollView.mjs.map +1 -1
  26. package/dist/motion/Text.d.mts +1 -1
  27. package/dist/motion/Text.d.ts +1 -1
  28. package/dist/motion/Text.js +84 -10
  29. package/dist/motion/Text.js.map +1 -1
  30. package/dist/motion/Text.mjs +85 -11
  31. package/dist/motion/Text.mjs.map +1 -1
  32. package/dist/motion/View.d.mts +1 -1
  33. package/dist/motion/View.d.ts +1 -1
  34. package/dist/motion/View.js +84 -10
  35. package/dist/motion/View.js.map +1 -1
  36. package/dist/motion/View.mjs +85 -11
  37. package/dist/motion/View.mjs.map +1 -1
  38. package/dist/testing/index.d.mts +57 -0
  39. package/dist/testing/index.d.ts +57 -0
  40. package/dist/testing/index.js +19 -0
  41. package/dist/testing/index.js.map +1 -0
  42. package/dist/testing/index.mjs +16 -0
  43. package/dist/testing/index.mjs.map +1 -0
  44. package/dist/{types-CmbXx-G3.d.mts → types-DeZZzE_e.d.mts} +20 -3
  45. package/dist/{types-CmbXx-G3.d.ts → types-DeZZzE_e.d.ts} +20 -3
  46. package/llms.txt +5 -1
  47. package/package.json +19 -12
  48. package/src/gestures/focusVisibility.ts +61 -0
  49. package/src/gestures/index.ts +1 -0
  50. package/src/motion/createMotionComponent.tsx +132 -47
  51. package/src/testing/index.ts +78 -0
  52. package/src/types.ts +20 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config/MotionConfigContext.ts","../src/config/MotionConfig.tsx","../src/presence/PresenceContext.ts","../src/presence/Presence.tsx","../src/transitions/easing.ts","../src/transitions/resolve.ts","../src/motion/createMotionComponent.tsx","../src/motion/Image.tsx","../src/motion/Pressable.tsx","../src/motion/ScrollView.tsx","../src/motion/Text.tsx","../src/motion/View.tsx","../src/motion/index.ts","../src/values/useVariants.ts"],"names":["createContext","useContext","useMemo","jsx","step","Motion","useRef","useState"],"mappings":";;;;;;AAwBO,IAAM,qBAAA,GAA2C;AAAA,EACtD,aAAA,EAAe;AACjB,CAAA;AAEO,IAAM,mBAAA,GAAsB,aAAA;AAAA,EACjC;AACF,CAAA;AAMO,SAAS,eAAA,GAAqC;AACnD,EAAA,OAAO,WAAW,mBAAmB,CAAA;AACvC;AAQO,SAAS,qBAAA,GAAiC;AAC/C,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,eAAA,EAAgB;AAC1C,EAAA,MAAM,YAAY,gBAAA,EAAiB;AACnC,EAAA,IAAI,aAAA,KAAkB,SAAS,OAAO,KAAA;AACtC,EAAA,IAAI,aAAA,KAAkB,UAAU,OAAO,IAAA;AACvC,EAAA,OAAO,SAAA;AACT;ACvCO,SAAS,YAAA,CAAa;AAAA,EAC3B,aAAA,GAAgB,MAAA;AAAA,EAChB;AACF,CAAA,EAG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AA,SAAA,CAAU,IAAI,QAAQ,CAAA;AACtB,QAAA,OAAO,MAAM;AACX,UAAA,SAAA,CAAU,OAAO,QAAQ,CAAA;AAAA,QAC3B,CAAA;AAAA,MACF;AAAA,KACF;AACA,IAAA,OAAO,UAAA;AAAA,EAGT,CAAA,EAAG,EAAE,CAAA;AACP","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","import { type ReactNode, useMemo } from 'react'\nimport {\n MotionConfigContext,\n type MotionConfigValue,\n type ReducedMotion,\n} from './MotionConfigContext'\n\n/**\n * Provider that controls how descendant Motion primitives respond to\n * reduced-motion preferences. Wrap the root of your app once with the\n * default (`reducedMotion=\"user\"`) to respect the OS accessibility setting,\n * or scope a subtree with `'always'` / `'never'` for specific use cases.\n */\nexport function MotionConfig({\n reducedMotion = 'user',\n children,\n}: {\n reducedMotion?: ReducedMotion\n children: ReactNode\n}) {\n const value = useMemo<MotionConfigValue>(\n () => ({ reducedMotion }),\n [reducedMotion],\n )\n return (\n <MotionConfigContext.Provider value={value}>\n {children}\n </MotionConfigContext.Provider>\n )\n}\n","import { createContext, useContext } from 'react'\n\n/**\n * Per-child contract between `<Presence>` and its descendant Motion\n * primitives. `<Presence>` provides a fresh value to each rendered child;\n * Motion primitives consume it to gate exit animations.\n *\n * - `isPresent`: `true` while the child is in the incoming children list.\n * Flips to `false` when the parent removes it; the child remains rendered\n * until `safeToRemove` is called.\n * - `safeToRemove`: callback the child invokes when its exit animation has\n * settled. `<Presence>` then drops the snapshot entry and unmounts.\n */\nexport interface PresenceContextValue {\n isPresent: boolean\n safeToRemove: () => void\n}\n\nexport const PresenceContext = createContext<PresenceContextValue | null>(null)\n\n/**\n * Read the surrounding `<Presence>` contract from a child component. Returns\n * `null` when there is no `<Presence>` ancestor — useful for components that\n * want to support both standalone and Presence-wrapped use without branching.\n */\nexport function usePresence(): PresenceContextValue | null {\n return useContext(PresenceContext)\n}\n","import {\n Children,\n isValidElement,\n type Key,\n type ReactElement,\n type ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { PresenceContext, type PresenceContextValue } from './PresenceContext'\n\ninterface RenderEntry {\n key: Key\n element: ReactElement\n isPresent: boolean\n}\n\n/**\n * Wrap a list of children with mount / unmount transitions. When a child is\n * removed from the incoming list it stays in the snapshot until its exit\n * animation completes; descendants consume the per-child `<PresenceContext>`\n * to coordinate.\n *\n * Children must be `<Motion.*>` primitives (or any component that consumes\n * `usePresence()` and calls `safeToRemove`). Plain elements without that\n * contract will linger in the snapshot once removed; document that and pick\n * the right primitive.\n *\n * Children also need explicit `key`s so removal is detectable across\n * renders. Without a key, React falls back to positional identity and\n * removal looks like a prop change — Presence has nothing to mark exiting.\n */\nexport function Presence({ children }: { children: ReactNode }) {\n const incoming = useMemo(() => {\n const out: ReactElement[] = []\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return\n if (child.key === null) {\n if (__DEV__) {\n console.warn(\n '[inertia] <Presence> children must have a `key`. Skipping a keyless child.',\n )\n }\n return\n }\n out.push(child)\n })\n return out\n }, [children])\n\n // Snapshot of elements removed from `incoming` whose exit animation is\n // still in flight. setExiting is called synchronously during render below\n // (the documented pattern for derived-from-prop-change state), so React\n // re-renders with the new snapshot before committing — no visual frame\n // where the departing child has vanished.\n const [exiting, setExiting] = useState<Map<Key, ReactElement>>(\n () => new Map(),\n )\n\n // Tracks the previous render's `incoming` so we can diff. Updated\n // synchronously alongside the setState call.\n const prevIncomingRef = useRef<ReactElement[]>(incoming)\n\n if (prevIncomingRef.current !== incoming) {\n const prev = prevIncomingRef.current\n prevIncomingRef.current = incoming\n const incomingKeys = new Set(incoming.map((el) => el.key as Key))\n let next: Map<Key, ReactElement> | null = null\n const ensureMutable = () => {\n if (!next) next = new Map(exiting)\n return next\n }\n\n // Departures: in prev but not in current → snapshot for exit.\n for (const oldEl of prev) {\n const key = oldEl.key as Key\n if (!incomingKeys.has(key) && !exiting.has(key)) {\n ensureMutable().set(key, oldEl)\n }\n }\n // Returns: was exiting and reappears → drop the snapshot. The live\n // `incoming` entry takes over with the same key, so React reconciles\n // the underlying Motion instance and the in-flight exit animation\n // interrupts back toward `animate` values.\n for (const el of incoming) {\n const key = el.key as Key\n if (exiting.has(key)) {\n ensureMutable().delete(key)\n }\n }\n\n if (next) setExiting(next)\n }\n\n const handleRemove = useCallback((key: Key) => {\n setExiting((prev) => {\n if (!prev.has(key)) return prev\n const next = new Map(prev)\n next.delete(key)\n return next\n })\n }, [])\n\n // Single combined render list. Putting `incoming` and `exiting` entries in\n // one array (rather than two `.map` calls inside a fragment) ensures React\n // reconciles by `key` across positions — when an entry moves from\n // present-list to exiting-list, the component instance persists.\n const renderList: RenderEntry[] = []\n for (const el of incoming) {\n renderList.push({\n key: el.key as Key,\n element: el,\n isPresent: true,\n })\n }\n for (const [key, el] of exiting) {\n if (!renderList.some((entry) => entry.key === key)) {\n renderList.push({ key, element: el, isPresent: false })\n }\n }\n\n return (\n <>\n {renderList.map(({ key, element, isPresent }) => (\n <PresenceItem\n key={key}\n itemKey={key}\n isPresent={isPresent}\n onRemove={handleRemove}\n >\n {element}\n </PresenceItem>\n ))}\n </>\n )\n}\n\nfunction PresenceItem({\n itemKey,\n isPresent,\n onRemove,\n children,\n}: {\n itemKey: Key\n isPresent: boolean\n onRemove: (key: Key) => void\n children: ReactNode\n}) {\n const value = useMemo<PresenceContextValue>(\n () => ({\n isPresent,\n safeToRemove: () => onRemove(itemKey),\n }),\n [isPresent, itemKey, onRemove],\n )\n return (\n <PresenceContext.Provider value={value}>\n {children}\n </PresenceContext.Provider>\n )\n}\n\ndeclare const __DEV__: boolean\n","import { isWorkletFunction } from 'react-native-reanimated'\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 * 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: ((t: number) => number) | undefined,\n): ((t: number) => number) | undefined {\n if (!easing) return undefined\n if (isWorkletFunction(easing)) return easing\n const wrapped = (t: number) => {\n 'worklet'\n return easing(t)\n }\n return wrapped\n}\n","import {\n Easing,\n withDecay,\n withDelay,\n withRepeat,\n withSequence,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { ensureWorkletEasing } from './easing'\nimport {\n type AnimatableValue,\n type DecayTransition,\n type RepeatConfig,\n type SequenceStep,\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\n/**\n * Default spring physics, expressed in react-spring vocabulary. Conversion\n * to Reanimated's raw `stiffness` / `damping` lives below; raw config never\n * leaks past this module.\n */\nconst DEFAULT_SPRING: Required<\n Pick<SpringTransition, 'tension' | 'friction' | 'mass'>\n> = {\n tension: 170,\n friction: 26,\n mass: 1,\n}\n\nconst DEFAULT_TIMING_DURATION = 250\n\nfunction springToReanimated(t: SpringTransition) {\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\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 */\nfunction applyRepeat(animation: unknown, repeat: RepeatConfig | undefined) {\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\nfunction 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 */\nfunction 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\n/**\n * True when the value is a `{ to, ...transitionOverride }` sequence step.\n * Plain numbers and plain transition objects fail this check.\n */\nfunction isStepObject<V>(\n v: SequenceStep<V> | V,\n): v is Extract<SequenceStep<V>, { to: V }> {\n return (\n typeof v === 'object' &&\n v !== null &&\n !Array.isArray(v) &&\n 'to' in (v as object)\n )\n}\n\n/**\n * Resolve a per-property `animate` value into a Reanimated animation.\n *\n * Handles the three shapes of `AnimatableValue`:\n * 1. plain value → single `resolveTransition` call\n * 2. `{ to, ...over }` → single step with the override merged into `base`\n * 3. array of either → `withSequence` of resolved steps, with the\n * top-level `repeat` applied at the **sequence level** (not per step).\n * Per-step `repeat` overrides remain step-local.\n */\nexport function resolveAnimatableValue<V extends number | string>(\n value: AnimatableValue<V>,\n base: TransitionConfig | undefined,\n factory?: CallbackFactory,\n): unknown {\n if (Array.isArray(value)) {\n const steps = value as ReadonlyArray<SequenceStep<V>>\n const stepBase = stripRepeat(base)\n const animations = steps.map((step, i) =>\n resolveStep(step, stepBase, factory?.('step', i)),\n )\n const seq = withSequence(...(animations as never[]))\n return applyRepeat(seq, base ? repeatOf(base) : undefined)\n }\n const step = value as SequenceStep<V>\n const cb = factory?.('animation', undefined)\n if (isStepObject<V>(step)) {\n return resolveStep(step, base, cb)\n }\n return resolveTransition(base, step as V, cb)\n}\n\nfunction resolveStep<V extends number | string>(\n step: SequenceStep<V>,\n base: TransitionConfig | undefined,\n cb?: AnimationCallback,\n): unknown {\n if (isStepObject<V>(step)) {\n const { to, ...override } = step as { to: V } & Partial<TransitionConfig>\n const merged = mergeTransition(base, override as Partial<TransitionConfig>)\n return resolveTransition(merged, to, cb)\n }\n return resolveTransition(base, step as V, cb)\n}\n\nfunction mergeTransition(\n base: TransitionConfig | undefined,\n override: Partial<TransitionConfig>,\n): TransitionConfig {\n // If the override declares a `type`, it wins outright — mixing fields from\n // a spring base into a timing override produces garbage. Otherwise inherit\n // the base's type and shallow-merge the rest.\n if (override.type && base && override.type !== base.type) {\n return override as TransitionConfig\n }\n return { ...(base ?? { type: 'spring' }), ...override } as TransitionConfig\n}\n","import {\n type ComponentType,\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport Animated, {\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n type SharedValue,\n} from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { usePresence } from '../presence'\nimport { resolveAnimatableValue } from '../transitions'\nimport {\n type AnimatableValue,\n type AnimateStyle,\n type AnimationCallbackInfo,\n type GestureSubStates,\n type MotionComponent,\n type MotionProps,\n type PerPropertyTransition,\n type Transition,\n type TransitionConfig,\n type VariantController,\n type VariantsMap,\n} from '../types'\n\n/**\n * Animatable properties supported in the alpha. Expanding this set is a\n * mechanical change — add the key here, decide whether it lives inside\n * `transform`, and wire it through `buildAnimatedStyle` below.\n */\nconst TRANSFORM_KEYS = [\n 'translateX',\n 'translateY',\n 'scale',\n 'scaleX',\n 'scaleY',\n 'rotate',\n] as const\n\nconst TOP_LEVEL_KEYS = ['opacity', 'width', 'height', 'borderRadius'] as const\n\n/**\n * Per-effect transform-group coordinator. Counts how many transform-axis\n * terminal callbacks are still pending; when the last one fires, the\n * factory emits a single coalesced `onAnimationEnd({ key: 'transform' })`\n * instead of N per-axis callbacks. Mutated by the dispatch closure.\n */\ntype TransformGroup = { remaining: number }\n\nconst ALL_KEYS = [...TRANSFORM_KEYS, ...TOP_LEVEL_KEYS] as const\ntype AnimatableKey = (typeof ALL_KEYS)[number]\ntype TransformKey = (typeof TRANSFORM_KEYS)[number]\n\nconst TRANSFORM_KEY_SET = new Set<AnimatableKey>(TRANSFORM_KEYS)\n\n// Stable style object applied while a Motion primitive is mid-exit so taps\n// fall through. Hoisted so every render shares the same reference and\n// Reanimated's style merging treats it as a no-op when present.\nconst EXITING_POINTER_EVENTS_STYLE = { pointerEvents: 'none' } as const\n\nconst DEFAULT_RESTING: Record<AnimatableKey, number> = {\n translateX: 0,\n translateY: 0,\n scale: 1,\n scaleX: 1,\n scaleY: 1,\n rotate: 0,\n opacity: 1,\n width: 0,\n height: 0,\n borderRadius: 0,\n}\n\nconst TRANSITION_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\nfunction 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_KEYS.has(k))\n}\n\nfunction transitionFor<S>(\n prop: keyof S,\n transition: Transition<S> | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return (transition as PerPropertyTransition<S>)[prop]\n}\n\n/**\n * Factory that wraps a React Native primitive as a `Motion.*` component.\n *\n * The generic `C` flows through `MotionProps`, so `animate` / `initial` /\n * `exit` / `transition` all infer from `C`'s `style` prop. There is no\n * shared `ViewStyle & TextStyle & ImageStyle` fallback.\n *\n * Alpha scope: numeric properties listed in `ALL_KEYS`, applied via\n * Reanimated shared values + `useAnimatedStyle`. Sequences, variants,\n * gestures, color animation, and the cross-render memoization optimization\n * land in later phases.\n */\nexport function createMotionComponent<C extends ComponentType<any>>(\n Component: C,\n): MotionComponent<C> {\n const AnimatedComponent = Animated.createAnimatedComponent(\n Component as ComponentType<any>,\n )\n\n type Props = React.ComponentProps<C> & MotionProps<React.ComponentProps<C>>\n\n const Motion = forwardRef<unknown, Props>(function Motion(props, ref) {\n const {\n initial,\n animate,\n exit,\n transition,\n variants,\n controller,\n gesture,\n onAnimationEnd,\n style,\n ...rest\n } = props as Props & { style?: unknown }\n\n // <Presence> contract: when an ancestor flips `isPresent` to false the\n // child stays rendered until `safeToRemove` is called, giving the exit\n // animation time to play. `null` when there is no <Presence> ancestor.\n const presence = usePresence()\n const isExiting = presence !== null && presence.isPresent === false\n\n // Resolved reduced-motion preference for this subtree. When true, every\n // per-key transition is replaced with `no-animation` below, so values\n // snap to target without interpolation. The hook also subscribes to OS\n // changes (via Reanimated's `useReducedMotion`), so toggling the\n // accessibility setting at runtime re-renders this component.\n const shouldReduceMotion = useShouldReduceMotion()\n\n // Pin the latest `onAnimationEnd` in a ref so the worklet callback always\n // dispatches against the current closure without re-resolving the\n // animation graph. Worklets can read refs via `runOnJS`.\n const onAnimationEndRef = useRef(onAnimationEnd)\n onAnimationEndRef.current = onAnimationEnd\n\n // Resolve `animate` against `variants` / `controller`. The controller's\n // `current` wins when both are set (typed contract: don't mix\n // `controller` and `animate` — controller drives the animation in that\n // mode). When `animate` is a string and `variants` exist, look it up.\n const variantKey = useControllerKey(controller)\n const resolvedAnimate = resolveAnimateInput(\n animate as AnimateStyle<unknown> | string | undefined,\n variants as VariantsMap<unknown> | undefined,\n variantKey,\n )\n\n const animateRecord = (resolvedAnimate ?? {}) as Partial<\n Record<AnimatableKey, AnimatableValue<number>>\n >\n const initialRecord =\n initial && initial !== false\n ? (initial as Partial<Record<AnimatableKey, number>>)\n : undefined\n const exitRecord = exit\n ? (exit as Partial<Record<AnimatableKey, AnimatableValue<number>>>)\n : undefined\n\n // Gesture sub-state activation tracked as JS state so changes invalidate\n // the merged-target signature and re-run the animation effect. The cost\n // is three useState slots regardless of whether `gesture` is set; that's\n // tiny and lets us stay rules-of-hooks-clean.\n const [pressed, setPressed] = useState(false)\n const [focused, setFocused] = useState(false)\n const [hovered, setHovered] = useState(false)\n\n // The set of keys this instance animates is locked at first render. With\n // variants in play the union across all variants is what matters — a key\n // touched by any variant must be active so the worklet picks it up when\n // the controller transitions. Gesture sub-states join the same union so\n // pressed/focused/hovered targets can drive any key they declare.\n const activeKeysRef = useRef<readonly AnimatableKey[] | null>(null)\n if (activeKeysRef.current === null) {\n const touched = new Set<AnimatableKey>()\n for (const k of ALL_KEYS) {\n if (k in animateRecord) touched.add(k)\n if (initialRecord && k in initialRecord) touched.add(k)\n }\n if (variants) {\n for (const variant of Object.values(variants) as object[]) {\n if (!variant) continue\n for (const k of ALL_KEYS) {\n if (k in variant) touched.add(k)\n }\n }\n }\n if (gesture) {\n for (const subState of [\n gesture.pressed,\n gesture.focused,\n gesture.hovered,\n ] as Array<object | undefined>) {\n if (!subState) continue\n for (const k of ALL_KEYS) {\n if (k in subState) touched.add(k)\n }\n }\n }\n if (exitRecord) {\n for (const k of ALL_KEYS) {\n if (k in exitRecord) touched.add(k)\n }\n }\n activeKeysRef.current = ALL_KEYS.filter((k) => touched.has(k))\n }\n const hasTransformRef = useRef<boolean>(\n activeKeysRef.current.some((k) => TRANSFORM_KEY_SET.has(k)),\n )\n\n const sharedValues = useAnimatableSharedValues((key) => {\n if (initial === false) {\n const a = animateRecord[key]\n return restValue(a) ?? DEFAULT_RESTING[key]\n }\n return (\n initialRecord?.[key] ??\n restValue(animateRecord[key]) ??\n DEFAULT_RESTING[key]\n )\n })\n\n // Merge gesture sub-state targets over the base `animate` record. Keys\n // touched by any sub-state always appear in the merged record (falling\n // back to `animateRecord` or `DEFAULT_RESTING`) so releasing a gesture\n // animates back to a defined value rather than getting skipped.\n //\n // While exiting, exit values override everything — gesture / animate\n // targets are inert because the component is on its way out.\n const mergedRecord =\n isExiting && exitRecord\n ? { ...animateRecord, ...exitRecord }\n : mergeGestureTargets(animateRecord, gesture, {\n pressed,\n focused,\n hovered,\n })\n const mergedSig =\n stableSig(mergedRecord) +\n (isExiting ? '|exit' : '') +\n (shouldReduceMotion ? '|rm' : '')\n const transitionSig = stableSig(transition)\n\n // Stable ref to the live `safeToRemove` so the effect's settle-counter\n // closure can reach the latest <Presence> binding without retriggering.\n const safeToRemoveRef = useRef<(() => void) | undefined>(undefined)\n safeToRemoveRef.current = presence?.safeToRemove\n\n useEffect(() => {\n // Exit fast-path: nothing to animate (or no exit prop), tell <Presence>\n // immediately so the unmount isn't gated on a phantom animation.\n if (isExiting && (!exitRecord || Object.keys(exitRecord).length === 0)) {\n safeToRemoveRef.current?.()\n return\n }\n\n let pending = 0\n let done = false\n const onSettle = () => {\n if (done) return\n pending--\n if (pending <= 0) {\n done = true\n if (isExiting) safeToRemoveRef.current?.()\n }\n }\n\n // Count transform axes participating in this effect run so the factory\n // can coalesce their terminal callbacks into a single transform-group\n // event. `undefined` when no transform axis is animating, which lets\n // the factory skip the coalescing branch entirely.\n let transformPending = 0\n for (const k of ALL_KEYS) {\n if (TRANSFORM_KEY_SET.has(k) && mergedRecord[k] !== undefined) {\n transformPending++\n }\n }\n const transformGroup: TransformGroup | undefined =\n transformPending > 0 ? { remaining: transformPending } : undefined\n\n for (const key of ALL_KEYS) {\n const target = mergedRecord[key]\n if (target === undefined) continue\n // Reduced-motion overrides every per-key transition (and any nested\n // sequence-step transition) with `no-animation`, which the resolver\n // turns into a direct value assignment. Sequences still iterate but\n // each step settles instantly, which matches the \"snap to final\n // state\" expectation.\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : transitionFor(key, transition)\n if (isExiting) pending++\n const factory = makeKeyCallbackFactory(\n key,\n sharedValues[key],\n targetEndValue(target),\n onAnimationEndRef,\n {\n stepCount: stepCountOf(target),\n totalIterations: totalIterationsOf(cfg),\n },\n isExiting ? onSettle : undefined,\n TRANSFORM_KEY_SET.has(key) ? transformGroup : undefined,\n )\n sharedValues[key].value = resolveAnimatableValue(\n target,\n cfg,\n factory,\n ) as never\n }\n\n // No exit-targeted keys (only `animate` keys present, no `exit`)\n // → release immediately rather than wait for animations that aren't\n // headed toward an exit value.\n if (isExiting && pending === 0) {\n safeToRemoveRef.current?.()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [mergedSig, transitionSig])\n\n const animatedStyle = useAnimatedStyle(() => {\n const activeKeys = activeKeysRef.current!\n const hasTransform = hasTransformRef.current\n const out: Record<string, unknown> = {}\n const transform: Array<Record<string, unknown>> = []\n for (const key of activeKeys) {\n const v = sharedValues[key].value\n if (TRANSFORM_KEY_SET.has(key)) {\n transform.push(\n key === 'rotate' ? { rotate: `${v}deg` } : { [key]: v },\n )\n } else {\n out[key] = v\n }\n }\n if (hasTransform) out.transform = transform\n return out\n })\n\n // Exiting children are tap-deaf: the next press should fall through to\n // whatever is underneath, not re-trigger a soon-to-unmount node. This is\n // the moti #297 fix and a v0.1 acceptance criterion. RN 0.71+ deprecates\n // `pointerEvents` as a prop in favor of the style key, so we merge it\n // alongside the animated style instead of spreading as a prop.\n const mergedStyle = useMemo(\n () =>\n (isExiting\n ? [style, animatedStyle, EXITING_POINTER_EVENTS_STYLE]\n : [style, animatedStyle]) as unknown,\n [style, animatedStyle, isExiting],\n )\n\n const gestureHandlers = useGestureHandlers(\n gesture,\n rest as Record<string, unknown>,\n setPressed,\n setFocused,\n setHovered,\n )\n\n return (\n <AnimatedComponent\n ref={ref as never}\n {...(rest as object)}\n {...gestureHandlers}\n style={mergedStyle}\n />\n )\n })\n\n Motion.displayName = `Motion(${Component.displayName ?? Component.name ?? 'Component'})`\n\n return Motion as unknown as MotionComponent<C>\n}\n\ntype SharedValueMap = Record<AnimatableKey, SharedValue<number>>\n\n/**\n * Allocate one shared value per animatable key in `ALL_KEYS` and return a\n * **stable** map — same object reference across every render.\n *\n * Stability matters: `useAnimatedStyle` derives its dep array from\n * `Object.values(updater.__closure)`. Our worklet captures `sharedValues`,\n * so a fresh object literal each render would change that dep, fire\n * Reanimated's effect, and re-bind the worklet on the UI thread on every\n * render — the exact cost design principle 8 calls out. The shared values themselves\n * are stable across renders (Reanimated's `useSharedValue` is a `useRef`\n * under the hood), so snapshotting the wrapping object once is safe.\n *\n * Hooks are called in a stable, lexical order — fine for rules-of-hooks.\n * Unused shared values are cheap; the worklet skips them via\n * `activeKeysRef`.\n */\nfunction useAnimatableSharedValues(\n init: (key: AnimatableKey) => number,\n): SharedValueMap {\n const translateX = useSharedValue(init('translateX'))\n const translateY = useSharedValue(init('translateY'))\n const scale = useSharedValue(init('scale'))\n const scaleX = useSharedValue(init('scaleX'))\n const scaleY = useSharedValue(init('scaleY'))\n const rotate = useSharedValue(init('rotate'))\n const opacity = useSharedValue(init('opacity'))\n const width = useSharedValue(init('width'))\n const height = useSharedValue(init('height'))\n const borderRadius = useSharedValue(init('borderRadius'))\n\n const ref = useRef<SharedValueMap | null>(null)\n if (ref.current === null) {\n ref.current = {\n translateX,\n translateY,\n scale,\n scaleX,\n scaleY,\n rotate,\n opacity,\n width,\n height,\n borderRadius,\n }\n }\n return ref.current\n}\n\n/**\n * Build a per-key `CallbackFactory` for the resolver. Each step in a sequence\n * (or the single animation, when `value` isn't an array) gets its own\n * Reanimated callback; when it settles on the UI thread, the callback bridges\n * to JS via `runOnJS` and invokes the user's `onAnimationEnd` with a fully\n * populated `AnimationCallbackInfo`.\n *\n * Phase resolution lives here, on the JS thread. The resolver hands us a\n * coarse rawPhase (`'step'` for any sequence step, `'animation'` for a\n * single-shot terminal); we map that onto the public phase set\n * (`'step' | 'sequence' | 'repeat' | 'animation'`) using `meta` and the\n * iteration counter. `iteration` resets per effect run because the factory\n * is constructed fresh inside the effect.\n */\nfunction makeKeyCallbackFactory(\n key: string,\n sharedValue: SharedValue<number>,\n target: number | string | undefined,\n onAnimationEndRef: {\n current: ((info: AnimationCallbackInfo<unknown>) => void) | undefined\n },\n meta: { stepCount: number; totalIterations: number },\n onSettle?: () => void,\n transformGroup?: TransformGroup,\n) {\n if (!onAnimationEndRef.current && !onSettle) return undefined\n\n // Shared across this animation graph's callbacks (one per sequence step,\n // or one for a single-shot). Mutated when a full pass completes.\n const state = { iteration: 0 }\n\n const isTransformKey = TRANSFORM_KEY_SET.has(key as AnimatableKey)\n\n const dispatch = (\n rawPhase: 'step' | 'animation',\n step: number | undefined,\n finished: boolean,\n value: number | string | undefined,\n ) => {\n const isLastIteration = state.iteration >= meta.totalIterations - 1\n let phase: 'step' | 'sequence' | 'repeat' | 'animation'\n let isTerminal = false\n\n if (rawPhase === 'step') {\n const isLastInPass = step !== undefined && step === meta.stepCount - 1\n if (!isLastInPass) {\n phase = 'step'\n } else if (isLastIteration) {\n phase = 'animation'\n isTerminal = true\n } else {\n phase = 'sequence'\n }\n } else if (isLastIteration) {\n phase = 'animation'\n isTerminal = true\n } else {\n phase = 'repeat'\n }\n\n const reportedIteration = state.iteration\n if (phase === 'sequence' || phase === 'repeat') state.iteration++\n\n const fn = onAnimationEndRef.current\n if (fn) {\n // Transform-group coalescing: a multi-axis translate / scale /\n // rotate animation should fire onAnimationEnd ONCE for the logical\n // transform, not once per axis. We only coalesce the terminal\n // `'animation'` phase — `step`/`sequence`/`repeat` events fire\n // per-axis since each is its own logical event. Released per-axis\n // for a single-axis case too, with `key: 'transform'` for\n // consistency.\n if (isTransformKey && transformGroup && phase === 'animation') {\n transformGroup.remaining--\n if (transformGroup.remaining <= 0) {\n fn({\n key: 'transform' as never,\n finished,\n value,\n target,\n phase,\n step,\n iteration: reportedIteration,\n })\n }\n } else {\n fn({\n key: key as never,\n finished,\n value,\n target,\n phase,\n step,\n iteration: reportedIteration,\n })\n }\n }\n // Settle hooks fire per-axis on the terminal phase — <Presence> waits\n // for *every* exiting property to settle before unmounting, so we\n // intentionally do not coalesce these (the transform-group coalesce\n // is purely a user-callback ergonomic).\n if (onSettle && isTerminal) onSettle()\n }\n\n return (rawPhase: 'step' | 'animation', step: number | undefined) => {\n // Reanimated invokes the callback with only `finished` (see\n // valueSetter.js:24,40,51 in 4.x) — `current` is never passed. Read the\n // shared value inside the worklet; by the time the callback fires the\n // final/clamped value has already been written to it.\n const cb = (finished?: boolean) => {\n 'worklet'\n runOnJS(dispatch)(rawPhase, step, !!finished, sharedValue.value)\n }\n return cb\n }\n}\n\n/**\n * Number of sequence steps in an animatable value. `1` for plain values and\n * single-step `{ to }` objects; the array length for keyframe arrays.\n */\nfunction stepCountOf(v: AnimatableValue<number> | undefined): number {\n if (Array.isArray(v)) return v.length\n return 1\n}\n\n/**\n * Total number of iterations the animation will run, including the initial\n * pass. `1` when there is no `repeat`; `Number.POSITIVE_INFINITY` for\n * `'infinite'`. Decay and `no-animation` configs cannot repeat — both return\n * `1` so the iteration counter stays at 0.\n */\nfunction totalIterationsOf(cfg: TransitionConfig | undefined): number {\n if (!cfg || cfg.type === 'no-animation' || cfg.type === 'decay') return 1\n const r = cfg.repeat\n if (r === undefined) return 1\n if (r === 'infinite') return Number.POSITIVE_INFINITY\n if (typeof r === 'number') return r\n if (r.count === 'infinite') return Number.POSITIVE_INFINITY\n return r.count\n}\n\n/**\n * Pull a single end-value out of an `AnimatableValue` for the\n * `AnimationCallbackInfo.target` field. Plain numbers/strings come through;\n * the last sequence step's `to`/value is used for arrays; `{ to }` step\n * objects use `to`. Returns `undefined` for unrecognized shapes.\n */\nfunction targetEndValue(\n v: AnimatableValue<number> | undefined,\n): number | string | undefined {\n if (v === undefined) return undefined\n if (typeof v === 'number' || typeof v === 'string') return v\n if (Array.isArray(v)) {\n return v.length > 0\n ? targetEndValue(v[v.length - 1] as AnimatableValue<number>)\n : undefined\n }\n if (typeof v === 'object' && v !== null && 'to' in v) {\n const to = (v as { to: unknown }).to\n return typeof to === 'number' || typeof to === 'string' ? to : undefined\n }\n return undefined\n}\n\n/**\n * Subscribe to a `VariantController` and return its `current` key. Returns\n * `undefined` when no controller is provided so callers can fall back to a\n * literal `animate` value.\n */\nfunction useControllerKey(\n controller: VariantController | undefined,\n): string | undefined {\n const [, setTick] = useState(0)\n useEffect(() => {\n if (!controller) return\n const unsub = controller.subscribe(() => setTick((n) => n + 1))\n return unsub\n }, [controller])\n return controller?.current\n}\n\n/**\n * Resolve the effective `animate` target from the public-prop tuple.\n *\n * Precedence: `controller.current` (when controller is set) > string-keyed\n * `animate` looked up in `variants` > literal `animate` object > `undefined`.\n */\nfunction resolveAnimateInput(\n animate: AnimateStyle<unknown> | string | undefined,\n variants: VariantsMap<unknown> | undefined,\n controllerKey: string | undefined,\n): AnimateStyle<unknown> | undefined {\n if (controllerKey !== undefined && variants && controllerKey in variants) {\n return variants[controllerKey]\n }\n if (typeof animate === 'string') {\n if (variants && animate in variants) return variants[animate]\n if (__DEV__) {\n console.warn(\n `[inertia] animate=\"${animate}\" but no matching variant. Did you forget to pass \\`variants\\`?`,\n )\n }\n return undefined\n }\n return animate as AnimateStyle<unknown> | undefined\n}\n\ndeclare const __DEV__: boolean\n\n/**\n * Pick the resting/initial-frame number out of an `AnimatableValue`. Plain\n * numbers come through unchanged; sequence arrays use their first element;\n * `{ to }` step objects use `to`. Non-numeric or unresolvable shapes return\n * `undefined` so the caller can fall back to `DEFAULT_RESTING`.\n */\nfunction restValue(v: AnimatableValue<number> | undefined): number | undefined {\n if (v === undefined) return undefined\n if (typeof v === 'number') return v\n if (Array.isArray(v)) {\n return v.length > 0 ? restValue(v[0] as AnimatableValue<number>) : undefined\n }\n if (typeof v === 'object' && v !== null && 'to' in v) {\n const to = (v as { to: unknown }).to\n return typeof to === 'number' ? to : undefined\n }\n return undefined\n}\n\nfunction 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 — gives a stable signature\n * regardless of property declaration order. Functions serialize as `null` so a\n * change in easing-fn reference is invisible here; that's fine for v0.1\n * (easing swaps are rare and the worklet wrapper handles correctness).\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\n/**\n * Merge gesture sub-state targets over the base `animate` record. Keys touched\n * by any declared sub-state are always present in the result so releasing a\n * gesture animates the property back to a defined value (the base `animate`\n * value when present, otherwise `DEFAULT_RESTING`). Sub-states layer in\n * priority order: `hovered` < `focused` < `pressed`.\n */\nfunction mergeGestureTargets(\n base: Partial<Record<AnimatableKey, AnimatableValue<number>>>,\n gesture: GestureSubStates<unknown> | undefined,\n active: { pressed: boolean; focused: boolean; hovered: boolean },\n): Partial<Record<AnimatableKey, AnimatableValue<number>>> {\n if (!gesture) return base\n const merged: Partial<Record<AnimatableKey, AnimatableValue<number>>> = {\n ...base,\n }\n const subStates = [\n gesture.hovered,\n gesture.focused,\n gesture.pressed,\n ] as Array<\n Partial<Record<AnimatableKey, AnimatableValue<number>>> | undefined\n >\n for (const sub of subStates) {\n if (!sub) continue\n for (const k of ALL_KEYS) {\n if (k in sub && !(k in merged)) {\n merged[k] = DEFAULT_RESTING[k]\n }\n }\n }\n if (active.hovered && gesture.hovered) {\n Object.assign(\n merged,\n gesture.hovered as Partial<\n Record<AnimatableKey, AnimatableValue<number>>\n >,\n )\n }\n if (active.focused && gesture.focused) {\n Object.assign(\n merged,\n gesture.focused as Partial<\n Record<AnimatableKey, AnimatableValue<number>>\n >,\n )\n }\n if (active.pressed && gesture.pressed) {\n Object.assign(\n merged,\n gesture.pressed as Partial<\n Record<AnimatableKey, AnimatableValue<number>>\n >,\n )\n }\n return merged\n}\n\ntype GestureHandlers = Record<string, (event: unknown) => void>\n\n/**\n * Build the touch / focus / hover handler props for a gesture-enabled Motion\n * primitive. Returns an empty object when `gesture` is undefined so the\n * component renders identically to the gesture-less path (zero overhead).\n *\n * Existing user-supplied handlers on the same events are composed: the user's\n * handler runs first, then the internal state setter. We pull user handlers\n * out of `rest` rather than overwriting them.\n */\nfunction useGestureHandlers(\n gesture: GestureSubStates<unknown> | undefined,\n rest: Record<string, unknown>,\n setPressed: (next: boolean) => void,\n setFocused: (next: boolean) => void,\n setHovered: (next: boolean) => void,\n): GestureHandlers {\n return useMemo(() => {\n if (!gesture) return {}\n const handlers: GestureHandlers = {}\n if (gesture.pressed) {\n handlers.onTouchStart = compose(rest.onTouchStart, () => setPressed(true))\n handlers.onTouchEnd = compose(rest.onTouchEnd, () => setPressed(false))\n handlers.onTouchCancel = compose(rest.onTouchCancel, () =>\n setPressed(false),\n )\n // Pressable / TouchableOpacity expose press hooks above the touch layer;\n // forward to those when present so wrapping consumers stay consistent.\n handlers.onPressIn = compose(rest.onPressIn, () => setPressed(true))\n handlers.onPressOut = compose(rest.onPressOut, () => setPressed(false))\n }\n if (gesture.focused) {\n handlers.onFocus = compose(rest.onFocus, () => setFocused(true))\n handlers.onBlur = compose(rest.onBlur, () => setFocused(false))\n }\n if (gesture.hovered) {\n // Web-only events. RN-Web 0.72+ accepts these on View; native ignores\n // them so the cost is zero on iOS / Android.\n handlers.onMouseEnter = compose(rest.onMouseEnter, () => setHovered(true))\n handlers.onMouseLeave = compose(rest.onMouseLeave, () =>\n setHovered(false),\n )\n }\n return handlers\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n gesture?.pressed ? 1 : 0,\n gesture?.focused ? 1 : 0,\n gesture?.hovered ? 1 : 0,\n rest.onTouchStart,\n rest.onTouchEnd,\n rest.onTouchCancel,\n rest.onPressIn,\n rest.onPressOut,\n rest.onFocus,\n rest.onBlur,\n rest.onMouseEnter,\n rest.onMouseLeave,\n ])\n}\n\nfunction compose(\n user: unknown,\n ours: (event: unknown) => void,\n): (event: unknown) => void {\n if (typeof user !== 'function') return ours\n return (event: unknown) => {\n ;(user as (event: unknown) => void)(event)\n ours(event)\n }\n}\n\n// Suppress the implicit any-return of the rotate ternary's union shape.\n// `TransformKey` is exported only to keep the type readable in d.ts.\nexport type { TransformKey }\n","import { Image } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `Image`. Inherits `Image`'s prop surface, with `animate` /\n * `initial` / `exit` / `transition` typed against `ImageStyle` (so\n * `tintColor` is accepted on `animate` here, but rejected on `Motion.View`).\n */\nexport const MotionImage = createMotionComponent(Image)\n","import { Pressable } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into\n * Pressable's native `onPressIn` / `onPressOut` via the factory's handler\n * composition, picking up touch slop and accessibility semantics for free.\n *\n * Note: the function-style `style={(state) => ...}` Pressable form is not\n * supported. Drive press-state styling through `gesture.pressed` instead.\n */\nexport const MotionPressable = createMotionComponent(Pressable)\n","import { ScrollView } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `ScrollView`. Animations apply to the scroll container itself —\n * useful for entrance transforms or fades on the whole list. Scroll-position\n * driven animation (`useScroll`) lands in the values layer.\n */\nexport const MotionScrollView = createMotionComponent(ScrollView)\n","import { Text } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `Text`. Inherits `Text`'s prop surface, with `animate` /\n * `initial` / `exit` / `transition` typed against `TextStyle`.\n */\nexport const MotionText = createMotionComponent(Text)\n","import { View } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `View`. Inherits `View`'s prop surface, with `animate` /\n * `initial` / `exit` / `transition` typed against `ViewStyle`.\n */\nexport const MotionView = createMotionComponent(View)\n","import { MotionImage } from './Image'\nimport { MotionPressable } from './Pressable'\nimport { MotionScrollView } from './ScrollView'\nimport { MotionText } from './Text'\nimport { MotionView } from './View'\n\nexport { createMotionComponent } from './createMotionComponent'\nexport {\n MotionView,\n MotionText,\n MotionImage,\n MotionPressable,\n MotionScrollView,\n}\n\n/**\n * The `Motion.*` namespace. Each property is a primitive with its style prop\n * inferred from the underlying RN component. There is no shared style fallback.\n */\nexport const Motion = {\n View: MotionView,\n Text: MotionText,\n Image: MotionImage,\n Pressable: MotionPressable,\n ScrollView: MotionScrollView,\n} as const\n","import { useMemo, useRef } from 'react'\nimport { type VariantController } from '../types'\n\n/**\n * Build a controller for a variants map. The controller is the imperative\n * escape hatch — pass it to a Motion primitive via `controller={...}` and\n * call `controller.transitionTo('open')` from event handlers, async chains,\n * etc. The hook name mirrors the prop name (`variants`) so the relationship\n * is obvious.\n *\n * The controller is identity-stable across renders. State changes are\n * delivered to subscribers via `subscribe` — Motion primitives subscribe\n * internally and re-resolve `animate` on each transition.\n */\nexport function useVariants<V extends Readonly<Record<string, object>>>(\n variants: V,\n initial?: keyof V & string,\n): VariantController<keyof V & string> {\n // Pin the variants object reference for the lifetime of the controller.\n // Consumers shouldn't recreate the map on every render anyway, but if they\n // do, the controller still works against the first definition's keys.\n const variantsRef = useRef(variants)\n\n return useMemo(() => {\n const listeners = new Set<(next: keyof V & string) => void>()\n let current =\n initial ??\n ((Object.keys(variantsRef.current)[0] ?? '') as keyof V & string)\n\n const controller: VariantController<keyof V & string> = {\n get current() {\n return current\n },\n transitionTo(next) {\n if (next === current) return\n if (!(next in variantsRef.current)) {\n if (__DEV__) {\n console.warn(\n `[inertia] useVariants: unknown variant \"${String(next)}\". Known keys: ${Object.keys(variantsRef.current).join(', ')}`,\n )\n }\n return\n }\n current = next\n for (const fn of listeners) fn(next)\n },\n subscribe(listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n }\n return controller\n // Identity-stable controller — only build once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\ndeclare const __DEV__: boolean\n"]}
1
+ {"version":3,"sources":["../src/config/MotionConfigContext.ts","../src/config/MotionConfig.tsx","../src/gestures/focusVisibility.ts","../src/presence/PresenceContext.ts","../src/presence/Presence.tsx","../src/transitions/easing.ts","../src/transitions/resolve.ts","../src/motion/createMotionComponent.tsx","../src/motion/Image.tsx","../src/motion/Pressable.tsx","../src/motion/ScrollView.tsx","../src/motion/Text.tsx","../src/motion/View.tsx","../src/motion/index.ts","../src/values/useVariants.ts"],"names":["createContext","useContext","useMemo","jsx","step","Motion","useRef","useState"],"mappings":";;;;;;AAwBO,IAAM,qBAAA,GAA2C;AAAA,EACtD,aAAA,EAAe;AACjB,CAAA;AAEO,IAAM,mBAAA,GAAsB,aAAA;AAAA,EACjC;AACF,CAAA;AAMO,SAAS,eAAA,GAAqC;AACnD,EAAA,OAAO,WAAW,mBAAmB,CAAA;AACvC;AAQO,SAAS,qBAAA,GAAiC;AAC/C,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,eAAA,EAAgB;AAC1C,EAAA,MAAM,YAAY,gBAAA,EAAiB;AACnC,EAAA,IAAI,aAAA,KAAkB,SAAS,OAAO,KAAA;AACtC,EAAA,IAAI,aAAA,KAAkB,UAAU,OAAO,IAAA;AACvC,EAAA,OAAO,SAAA;AACT;ACvCO,SAAS,YAAA,CAAa;AAAA,EAC3B,aAAA,GAAgB,MAAA;AAAA,EAChB;AACF,CAAA,EAGG;AACD,EAAA,MAAM,KAAA,GAAQ,OAAA;AAAA,IACZ,OAAO,EAAE,aAAA,EAAc,CAAA;AAAA,IACvB,CAAC,aAAa;AAAA,GAChB;AACA,EAAA,uBACE,GAAA,CAAC,mBAAA,CAAoB,QAAA,EAApB,EAA6B,OAC3B,QAAA,EACH,CAAA;AAEJ;ACLA,IAAI,QAAA,GAA0B,UAAA;AAC9B,IAAI,SAAA,GAAY,KA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IAAI,OAAA,GACF,YACE,MAAA,CAAO,IAAA,CAAK,YAAY,OAAO,CAAA,CAAE,CAAC,CAAA,IAAK,EAAA,CAAA;AAE3C,IAAA,MAAM,UAAA,GAAkD;AAAA,MACtD,IAAI,OAAA,GAAU;AACZ,QAAA,OAAO,OAAA;AAAA,MACT,CAAA;AAAA,MACA,aAAa,IAAA,EAAM;AACjB,QAAA,IAAI,SAAS,OAAA,EAAS;AACtB,QAAA,IAAI,EAAE,IAAA,IAAQ,WAAA,CAAY,OAAA,CAAA,EAAU;AAClC,UAAA,IAAI,OAAA,EAAS;AACX,YAAA,OAAA,CAAQ,IAAA;AAAA,cACN,CAAA,wCAAA,EAA2C,MAAA,CAAO,IAAI,CAAC,CAAA,eAAA,EAAkB,MAAA,CAAO,IAAA,CAAK,WAAA,CAAY,OAAO,CAAA,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,aACtH;AAAA,UACF;AACA,UAAA;AAAA,QACF;AACA,QAAA,OAAA,GAAU,IAAA;AACV,QAAA,KAAA,MAAW,EAAA,IAAM,SAAA,EAAW,EAAA,CAAG,IAAI,CAAA;AAAA,MACrC,CAAA;AAAA,MACA,UAAU,QAAA,EAAU;AAClB,QAAA,SAAA,CAAU,IAAI,QAAQ,CAAA;AACtB,QAAA,OAAO,MAAM;AACX,UAAA,SAAA,CAAU,OAAO,QAAQ,CAAA;AAAA,QAC3B,CAAA;AAAA,MACF;AAAA,KACF;AACA,IAAA,OAAO,UAAA;AAAA,EAGT,CAAA,EAAG,EAAE,CAAA;AACP","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","import { type ReactNode, useMemo } from 'react'\nimport {\n MotionConfigContext,\n type MotionConfigValue,\n type ReducedMotion,\n} from './MotionConfigContext'\n\n/**\n * Provider that controls how descendant Motion primitives respond to\n * reduced-motion preferences. Wrap the root of your app once with the\n * default (`reducedMotion=\"user\"`) to respect the OS accessibility setting,\n * or scope a subtree with `'always'` / `'never'` for specific use cases.\n */\nexport function MotionConfig({\n reducedMotion = 'user',\n children,\n}: {\n reducedMotion?: ReducedMotion\n children: ReactNode\n}) {\n const value = useMemo<MotionConfigValue>(\n () => ({ reducedMotion }),\n [reducedMotion],\n )\n return (\n <MotionConfigContext.Provider value={value}>\n {children}\n </MotionConfigContext.Provider>\n )\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 { createContext, useContext } from 'react'\n\n/**\n * Per-child contract between `<Presence>` and its descendant Motion\n * primitives. `<Presence>` provides a fresh value to each rendered child;\n * Motion primitives consume it to gate exit animations.\n *\n * - `isPresent`: `true` while the child is in the incoming children list.\n * Flips to `false` when the parent removes it; the child remains rendered\n * until `safeToRemove` is called.\n * - `safeToRemove`: callback the child invokes when its exit animation has\n * settled. `<Presence>` then drops the snapshot entry and unmounts.\n */\nexport interface PresenceContextValue {\n isPresent: boolean\n safeToRemove: () => void\n}\n\nexport const PresenceContext = createContext<PresenceContextValue | null>(null)\n\n/**\n * Read the surrounding `<Presence>` contract from a child component. Returns\n * `null` when there is no `<Presence>` ancestor — useful for components that\n * want to support both standalone and Presence-wrapped use without branching.\n */\nexport function usePresence(): PresenceContextValue | null {\n return useContext(PresenceContext)\n}\n","import {\n Children,\n isValidElement,\n type Key,\n type ReactElement,\n type ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { PresenceContext, type PresenceContextValue } from './PresenceContext'\n\ninterface RenderEntry {\n key: Key\n element: ReactElement\n isPresent: boolean\n}\n\n/**\n * Wrap a list of children with mount / unmount transitions. When a child is\n * removed from the incoming list it stays in the snapshot until its exit\n * animation completes; descendants consume the per-child `<PresenceContext>`\n * to coordinate.\n *\n * Children must be `<Motion.*>` primitives (or any component that consumes\n * `usePresence()` and calls `safeToRemove`). Plain elements without that\n * contract will linger in the snapshot once removed; document that and pick\n * the right primitive.\n *\n * Children also need explicit `key`s so removal is detectable across\n * renders. Without a key, React falls back to positional identity and\n * removal looks like a prop change — Presence has nothing to mark exiting.\n */\nexport function Presence({ children }: { children: ReactNode }) {\n const incoming = useMemo(() => {\n const out: ReactElement[] = []\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return\n if (child.key === null) {\n if (__DEV__) {\n console.warn(\n '[inertia] <Presence> children must have a `key`. Skipping a keyless child.',\n )\n }\n return\n }\n out.push(child)\n })\n return out\n }, [children])\n\n // Snapshot of elements removed from `incoming` whose exit animation is\n // still in flight. setExiting is called synchronously during render below\n // (the documented pattern for derived-from-prop-change state), so React\n // re-renders with the new snapshot before committing — no visual frame\n // where the departing child has vanished.\n const [exiting, setExiting] = useState<Map<Key, ReactElement>>(\n () => new Map(),\n )\n\n // Tracks the previous render's `incoming` so we can diff. Updated\n // synchronously alongside the setState call.\n const prevIncomingRef = useRef<ReactElement[]>(incoming)\n\n if (prevIncomingRef.current !== incoming) {\n const prev = prevIncomingRef.current\n prevIncomingRef.current = incoming\n const incomingKeys = new Set(incoming.map((el) => el.key as Key))\n let next: Map<Key, ReactElement> | null = null\n const ensureMutable = () => {\n if (!next) next = new Map(exiting)\n return next\n }\n\n // Departures: in prev but not in current → snapshot for exit.\n for (const oldEl of prev) {\n const key = oldEl.key as Key\n if (!incomingKeys.has(key) && !exiting.has(key)) {\n ensureMutable().set(key, oldEl)\n }\n }\n // Returns: was exiting and reappears → drop the snapshot. The live\n // `incoming` entry takes over with the same key, so React reconciles\n // the underlying Motion instance and the in-flight exit animation\n // interrupts back toward `animate` values.\n for (const el of incoming) {\n const key = el.key as Key\n if (exiting.has(key)) {\n ensureMutable().delete(key)\n }\n }\n\n if (next) setExiting(next)\n }\n\n const handleRemove = useCallback((key: Key) => {\n setExiting((prev) => {\n if (!prev.has(key)) return prev\n const next = new Map(prev)\n next.delete(key)\n return next\n })\n }, [])\n\n // Single combined render list. Putting `incoming` and `exiting` entries in\n // one array (rather than two `.map` calls inside a fragment) ensures React\n // reconciles by `key` across positions — when an entry moves from\n // present-list to exiting-list, the component instance persists.\n const renderList: RenderEntry[] = []\n for (const el of incoming) {\n renderList.push({\n key: el.key as Key,\n element: el,\n isPresent: true,\n })\n }\n for (const [key, el] of exiting) {\n if (!renderList.some((entry) => entry.key === key)) {\n renderList.push({ key, element: el, isPresent: false })\n }\n }\n\n return (\n <>\n {renderList.map(({ key, element, isPresent }) => (\n <PresenceItem\n key={key}\n itemKey={key}\n isPresent={isPresent}\n onRemove={handleRemove}\n >\n {element}\n </PresenceItem>\n ))}\n </>\n )\n}\n\nfunction PresenceItem({\n itemKey,\n isPresent,\n onRemove,\n children,\n}: {\n itemKey: Key\n isPresent: boolean\n onRemove: (key: Key) => void\n children: ReactNode\n}) {\n const value = useMemo<PresenceContextValue>(\n () => ({\n isPresent,\n safeToRemove: () => onRemove(itemKey),\n }),\n [isPresent, itemKey, onRemove],\n )\n return (\n <PresenceContext.Provider value={value}>\n {children}\n </PresenceContext.Provider>\n )\n}\n\ndeclare const __DEV__: boolean\n","import { isWorkletFunction } from 'react-native-reanimated'\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 * 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: ((t: number) => number) | undefined,\n): ((t: number) => number) | undefined {\n if (!easing) return undefined\n if (isWorkletFunction(easing)) return easing\n const wrapped = (t: number) => {\n 'worklet'\n return easing(t)\n }\n return wrapped\n}\n","import {\n Easing,\n withDecay,\n withDelay,\n withRepeat,\n withSequence,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { ensureWorkletEasing } from './easing'\nimport {\n type AnimatableValue,\n type DecayTransition,\n type RepeatConfig,\n type SequenceStep,\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\n/**\n * Default spring physics, expressed in react-spring vocabulary. Conversion\n * to Reanimated's raw `stiffness` / `damping` lives below; raw config never\n * leaks past this module.\n */\nconst DEFAULT_SPRING: Required<\n Pick<SpringTransition, 'tension' | 'friction' | 'mass'>\n> = {\n tension: 170,\n friction: 26,\n mass: 1,\n}\n\nconst DEFAULT_TIMING_DURATION = 250\n\nfunction springToReanimated(t: SpringTransition) {\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\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 */\nfunction applyRepeat(animation: unknown, repeat: RepeatConfig | undefined) {\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\nfunction 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 */\nfunction 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\n/**\n * True when the value is a `{ to, ...transitionOverride }` sequence step.\n * Plain numbers and plain transition objects fail this check.\n */\nfunction isStepObject<V>(\n v: SequenceStep<V> | V,\n): v is Extract<SequenceStep<V>, { to: V }> {\n return (\n typeof v === 'object' &&\n v !== null &&\n !Array.isArray(v) &&\n 'to' in (v as object)\n )\n}\n\n/**\n * Resolve a per-property `animate` value into a Reanimated animation.\n *\n * Handles the three shapes of `AnimatableValue`:\n * 1. plain value → single `resolveTransition` call\n * 2. `{ to, ...over }` → single step with the override merged into `base`\n * 3. array of either → `withSequence` of resolved steps, with the\n * top-level `repeat` applied at the **sequence level** (not per step).\n * Per-step `repeat` overrides remain step-local.\n */\nexport function resolveAnimatableValue<V extends number | string>(\n value: AnimatableValue<V>,\n base: TransitionConfig | undefined,\n factory?: CallbackFactory,\n): unknown {\n if (Array.isArray(value)) {\n const steps = value as ReadonlyArray<SequenceStep<V>>\n const stepBase = stripRepeat(base)\n const animations = steps.map((step, i) =>\n resolveStep(step, stepBase, factory?.('step', i)),\n )\n const seq = withSequence(...(animations as never[]))\n return applyRepeat(seq, base ? repeatOf(base) : undefined)\n }\n const step = value as SequenceStep<V>\n const cb = factory?.('animation', undefined)\n if (isStepObject<V>(step)) {\n return resolveStep(step, base, cb)\n }\n return resolveTransition(base, step as V, cb)\n}\n\nfunction resolveStep<V extends number | string>(\n step: SequenceStep<V>,\n base: TransitionConfig | undefined,\n cb?: AnimationCallback,\n): unknown {\n if (isStepObject<V>(step)) {\n const { to, ...override } = step as { to: V } & Partial<TransitionConfig>\n const merged = mergeTransition(base, override as Partial<TransitionConfig>)\n return resolveTransition(merged, to, cb)\n }\n return resolveTransition(base, step as V, cb)\n}\n\nfunction mergeTransition(\n base: TransitionConfig | undefined,\n override: Partial<TransitionConfig>,\n): TransitionConfig {\n // If the override declares a `type`, it wins outright — mixing fields from\n // a spring base into a timing override produces garbage. Otherwise inherit\n // the base's type and shallow-merge the rest.\n if (override.type && base && override.type !== base.type) {\n return override as TransitionConfig\n }\n return { ...(base ?? { type: 'spring' }), ...override } as TransitionConfig\n}\n","import {\n type ComponentType,\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport Animated, {\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n type SharedValue,\n} from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { isFocusVisible } from '../gestures'\nimport { usePresence } from '../presence'\nimport { resolveAnimatableValue } from '../transitions'\nimport {\n type AnimatableValue,\n type AnimateStyle,\n type AnimationCallbackInfo,\n type GestureSubStates,\n type MotionComponent,\n type MotionProps,\n type PerPropertyTransition,\n type Transition,\n type TransitionConfig,\n type VariantController,\n type VariantsMap,\n} from '../types'\n\n/**\n * Animatable properties supported in the alpha. Expanding this set is a\n * mechanical change — add the key here, decide whether it lives inside\n * `transform`, and wire it through `buildAnimatedStyle` below.\n */\nconst TRANSFORM_KEYS = [\n 'translateX',\n 'translateY',\n 'scale',\n 'scaleX',\n 'scaleY',\n 'rotate',\n] as const\n\nconst NUMERIC_TOP_LEVEL_KEYS = [\n 'opacity',\n 'width',\n 'height',\n 'borderRadius',\n] as const\n\n// Color-valued keys. Reanimated's value setter detects color strings and\n// interpolates between their packed RGBA representations natively in\n// `withSpring` / `withTiming` — so the resolver path is identical to numeric\n// keys; only the shared-value seed and the resting default differ.\n//\n// `tintColor` is Image-only, but allocated unconditionally here: the\n// per-primitive type system (`AnimateStyle<C>`) is what gates which keys\n// `animate` accepts at compile time. An unused shared value is a single ref;\n// allocating it everywhere keeps hook order stable and the factory generic.\nconst COLOR_KEYS = [\n 'backgroundColor',\n 'borderColor',\n 'color',\n 'tintColor',\n] as const\n\n/**\n * Per-effect transform-group coordinator. Counts how many transform-axis\n * terminal callbacks are still pending; when the last one fires, the\n * factory emits a single coalesced `onAnimationEnd({ key: 'transform' })`\n * instead of N per-axis callbacks. Mutated by the dispatch closure.\n */\ntype TransformGroup = { remaining: number }\n\nconst ALL_KEYS = [\n ...TRANSFORM_KEYS,\n ...NUMERIC_TOP_LEVEL_KEYS,\n ...COLOR_KEYS,\n] as const\ntype AnimatableKey = (typeof ALL_KEYS)[number]\ntype TransformKey = (typeof TRANSFORM_KEYS)[number]\n\nconst TRANSFORM_KEY_SET = new Set<AnimatableKey>(TRANSFORM_KEYS)\n\n// Stable style object applied while a Motion primitive is mid-exit so taps\n// fall through. Hoisted so every render shares the same reference and\n// Reanimated's style merging treats it as a no-op when present.\nconst EXITING_POINTER_EVENTS_STYLE = { pointerEvents: 'none' } as const\n\nconst DEFAULT_RESTING: Record<AnimatableKey, number | string> = {\n translateX: 0,\n translateY: 0,\n scale: 1,\n scaleX: 1,\n scaleY: 1,\n rotate: 0,\n opacity: 1,\n width: 0,\n height: 0,\n borderRadius: 0,\n // 'transparent' is the only safe universal default for colors: it works as\n // an initial seed for any color animation (no jarring opaque flash on mount\n // when `initial` is omitted) and rgba(0,0,0,0) interpolates cleanly into\n // any opaque target via Reanimated's color util.\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n color: 'transparent',\n tintColor: 'transparent',\n}\n\nconst TRANSITION_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\nfunction 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_KEYS.has(k))\n}\n\nfunction transitionFor<S>(\n prop: keyof S,\n transition: Transition<S> | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return (transition as PerPropertyTransition<S>)[prop]\n}\n\n/**\n * Factory that wraps a React Native primitive as a `Motion.*` component.\n *\n * The generic `C` flows through `MotionProps`, so `animate` / `initial` /\n * `exit` / `transition` all infer from `C`'s `style` prop. There is no\n * shared `ViewStyle & TextStyle & ImageStyle` fallback.\n *\n * Alpha scope: numeric properties (transforms, opacity, width, height,\n * borderRadius) and color properties (backgroundColor, borderColor, color,\n * tintColor) applied via Reanimated shared values + `useAnimatedStyle`.\n */\nexport function createMotionComponent<C extends ComponentType<any>>(\n Component: C,\n): MotionComponent<C> {\n const AnimatedComponent = Animated.createAnimatedComponent(\n Component as ComponentType<any>,\n )\n\n type Props = React.ComponentProps<C> & MotionProps<React.ComponentProps<C>>\n\n const Motion = forwardRef<unknown, Props>(function Motion(props, ref) {\n const {\n initial,\n animate,\n exit,\n transition,\n variants,\n controller,\n gesture,\n onAnimationEnd,\n style,\n ...rest\n } = props as Props & { style?: unknown }\n\n // <Presence> contract: when an ancestor flips `isPresent` to false the\n // child stays rendered until `safeToRemove` is called, giving the exit\n // animation time to play. `null` when there is no <Presence> ancestor.\n const presence = usePresence()\n const isExiting = presence !== null && presence.isPresent === false\n\n // Resolved reduced-motion preference for this subtree. When true, every\n // per-key transition is replaced with `no-animation` below, so values\n // snap to target without interpolation. The hook also subscribes to OS\n // changes (via Reanimated's `useReducedMotion`), so toggling the\n // accessibility setting at runtime re-renders this component.\n const shouldReduceMotion = useShouldReduceMotion()\n\n // Pin the latest `onAnimationEnd` in a ref so the worklet callback always\n // dispatches against the current closure without re-resolving the\n // animation graph. Worklets can read refs via `runOnJS`.\n const onAnimationEndRef = useRef(onAnimationEnd)\n onAnimationEndRef.current = onAnimationEnd\n\n // Resolve `animate` against `variants` / `controller`. The controller's\n // `current` wins when both are set (typed contract: don't mix\n // `controller` and `animate` — controller drives the animation in that\n // mode). When `animate` is a string and `variants` exist, look it up.\n const variantKey = useControllerKey(controller)\n const resolvedAnimate = resolveAnimateInput(\n animate as AnimateStyle<unknown> | string | undefined,\n variants as VariantsMap<unknown> | undefined,\n variantKey,\n )\n\n const animateRecord = (resolvedAnimate ?? {}) as Partial<\n Record<AnimatableKey, AnimatableValue<number | string>>\n >\n const initialRecord =\n initial && initial !== false\n ? (initial as Partial<Record<AnimatableKey, number | string>>)\n : undefined\n const exitRecord = exit\n ? (exit as Partial<\n Record<AnimatableKey, AnimatableValue<number | string>>\n >)\n : undefined\n\n // Gesture sub-state activation tracked as JS state so changes invalidate\n // the merged-target signature and re-run the animation effect. The cost\n // is four useState slots regardless of whether `gesture` is set; that's\n // tiny and lets us stay rules-of-hooks-clean.\n const [pressed, setPressed] = useState(false)\n const [focused, setFocused] = useState(false)\n const [focusVisible, setFocusVisible] = useState(false)\n const [hovered, setHovered] = useState(false)\n\n // The set of keys this instance animates is locked at first render. With\n // variants in play the union across all variants is what matters — a key\n // touched by any variant must be active so the worklet picks it up when\n // the controller transitions. Gesture sub-states join the same union so\n // pressed/focused/hovered targets can drive any key they declare.\n const activeKeysRef = useRef<readonly AnimatableKey[] | null>(null)\n if (activeKeysRef.current === null) {\n const touched = new Set<AnimatableKey>()\n for (const k of ALL_KEYS) {\n if (k in animateRecord) touched.add(k)\n if (initialRecord && k in initialRecord) touched.add(k)\n }\n if (variants) {\n for (const variant of Object.values(variants) as object[]) {\n if (!variant) continue\n for (const k of ALL_KEYS) {\n if (k in variant) touched.add(k)\n }\n }\n }\n if (gesture) {\n for (const subState of [\n gesture.pressed,\n gesture.focused,\n gesture.focusVisible,\n gesture.hovered,\n ] as Array<object | undefined>) {\n if (!subState) continue\n for (const k of ALL_KEYS) {\n if (k in subState) touched.add(k)\n }\n }\n }\n if (exitRecord) {\n for (const k of ALL_KEYS) {\n if (k in exitRecord) touched.add(k)\n }\n }\n activeKeysRef.current = ALL_KEYS.filter((k) => touched.has(k))\n }\n const hasTransformRef = useRef<boolean>(\n activeKeysRef.current.some((k) => TRANSFORM_KEY_SET.has(k)),\n )\n\n const sharedValues = useAnimatableSharedValues((key) => {\n if (initial === false) {\n const a = animateRecord[key]\n return restValue(a) ?? DEFAULT_RESTING[key]\n }\n return (\n initialRecord?.[key] ??\n restValue(animateRecord[key]) ??\n DEFAULT_RESTING[key]\n )\n })\n\n // Merge gesture sub-state targets over the base `animate` record. Keys\n // touched by any sub-state always appear in the merged record (falling\n // back to `animateRecord` or `DEFAULT_RESTING`) so releasing a gesture\n // animates back to a defined value rather than getting skipped.\n //\n // While exiting, exit values override everything — gesture / animate\n // targets are inert because the component is on its way out.\n const mergedRecord =\n isExiting && exitRecord\n ? { ...animateRecord, ...exitRecord }\n : mergeGestureTargets(animateRecord, gesture, {\n pressed,\n focused,\n focusVisible,\n hovered,\n })\n const mergedSig =\n stableSig(mergedRecord) +\n (isExiting ? '|exit' : '') +\n (shouldReduceMotion ? '|rm' : '')\n const transitionSig = stableSig(transition)\n\n // Stable ref to the live `safeToRemove` so the effect's settle-counter\n // closure can reach the latest <Presence> binding without retriggering.\n const safeToRemoveRef = useRef<(() => void) | undefined>(undefined)\n safeToRemoveRef.current = presence?.safeToRemove\n\n useEffect(() => {\n // Exit fast-path: nothing to animate (or no exit prop), tell <Presence>\n // immediately so the unmount isn't gated on a phantom animation.\n if (isExiting && (!exitRecord || Object.keys(exitRecord).length === 0)) {\n safeToRemoveRef.current?.()\n return\n }\n\n let pending = 0\n let done = false\n const onSettle = () => {\n if (done) return\n pending--\n if (pending <= 0) {\n done = true\n if (isExiting) safeToRemoveRef.current?.()\n }\n }\n\n // Count transform axes participating in this effect run so the factory\n // can coalesce their terminal callbacks into a single transform-group\n // event. `undefined` when no transform axis is animating, which lets\n // the factory skip the coalescing branch entirely.\n let transformPending = 0\n for (const k of ALL_KEYS) {\n if (TRANSFORM_KEY_SET.has(k) && mergedRecord[k] !== undefined) {\n transformPending++\n }\n }\n const transformGroup: TransformGroup | undefined =\n transformPending > 0 ? { remaining: transformPending } : undefined\n\n for (const key of ALL_KEYS) {\n const target = mergedRecord[key]\n if (target === undefined) continue\n // Reduced-motion overrides every per-key transition (and any nested\n // sequence-step transition) with `no-animation`, which the resolver\n // turns into a direct value assignment. Sequences still iterate but\n // each step settles instantly, which matches the \"snap to final\n // state\" expectation.\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : transitionFor(key, transition)\n if (isExiting) pending++\n const factory = makeKeyCallbackFactory(\n key,\n sharedValues[key],\n targetEndValue(target),\n onAnimationEndRef,\n {\n stepCount: stepCountOf(target),\n totalIterations: totalIterationsOf(cfg),\n },\n isExiting ? onSettle : undefined,\n TRANSFORM_KEY_SET.has(key) ? transformGroup : undefined,\n )\n sharedValues[key].value = resolveAnimatableValue(\n target,\n cfg,\n factory,\n ) as never\n }\n\n // No exit-targeted keys (only `animate` keys present, no `exit`)\n // → release immediately rather than wait for animations that aren't\n // headed toward an exit value.\n if (isExiting && pending === 0) {\n safeToRemoveRef.current?.()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [mergedSig, transitionSig])\n\n const animatedStyle = useAnimatedStyle(() => {\n const activeKeys = activeKeysRef.current!\n const hasTransform = hasTransformRef.current\n const out: Record<string, unknown> = {}\n const transform: Array<Record<string, unknown>> = []\n for (const key of activeKeys) {\n const v = sharedValues[key].value\n if (TRANSFORM_KEY_SET.has(key)) {\n transform.push(\n key === 'rotate' ? { rotate: `${v}deg` } : { [key]: v },\n )\n } else {\n out[key] = v\n }\n }\n if (hasTransform) out.transform = transform\n return out\n })\n\n // Exiting children are tap-deaf: the next press should fall through to\n // whatever is underneath, not re-trigger a soon-to-unmount node. This is\n // the moti #297 fix and a v0.1 acceptance criterion. RN 0.71+ deprecates\n // `pointerEvents` as a prop in favor of the style key, so we merge it\n // alongside the animated style instead of spreading as a prop.\n const mergedStyle = useMemo(\n () =>\n (isExiting\n ? [style, animatedStyle, EXITING_POINTER_EVENTS_STYLE]\n : [style, animatedStyle]) as unknown,\n [style, animatedStyle, isExiting],\n )\n\n const gestureHandlers = useGestureHandlers(\n gesture,\n rest as Record<string, unknown>,\n setPressed,\n setFocused,\n setFocusVisible,\n setHovered,\n )\n\n return (\n <AnimatedComponent\n ref={ref as never}\n {...(rest as object)}\n {...gestureHandlers}\n style={mergedStyle}\n />\n )\n })\n\n Motion.displayName = `Motion(${Component.displayName ?? Component.name ?? 'Component'})`\n\n return Motion as unknown as MotionComponent<C>\n}\n\ntype SharedValueMap = Record<AnimatableKey, SharedValue<number | string>>\n\n/**\n * Allocate one shared value per animatable key in `ALL_KEYS` and return a\n * **stable** map — same object reference across every render.\n *\n * Stability matters: `useAnimatedStyle` derives its dep array from\n * `Object.values(updater.__closure)`. Our worklet captures `sharedValues`,\n * so a fresh object literal each render would change that dep, fire\n * Reanimated's effect, and re-bind the worklet on the UI thread on every\n * render — the exact cost design principle 8 calls out. The shared values themselves\n * are stable across renders (Reanimated's `useSharedValue` is a `useRef`\n * under the hood), so snapshotting the wrapping object once is safe.\n *\n * Hooks are called in a stable, lexical order — fine for rules-of-hooks.\n * Unused shared values are cheap; the worklet skips them via\n * `activeKeysRef`. Color keys are seeded with the initial color string so\n * Reanimated's value setter recognizes the slot as a color from the first\n * `withSpring` / `withTiming` call.\n */\nfunction useAnimatableSharedValues(\n init: (key: AnimatableKey) => number | string,\n): SharedValueMap {\n const translateX = useSharedValue<number | string>(init('translateX'))\n const translateY = useSharedValue<number | string>(init('translateY'))\n const scale = useSharedValue<number | string>(init('scale'))\n const scaleX = useSharedValue<number | string>(init('scaleX'))\n const scaleY = useSharedValue<number | string>(init('scaleY'))\n const rotate = useSharedValue<number | string>(init('rotate'))\n const opacity = useSharedValue<number | string>(init('opacity'))\n const width = useSharedValue<number | string>(init('width'))\n const height = useSharedValue<number | string>(init('height'))\n const borderRadius = useSharedValue<number | string>(init('borderRadius'))\n const backgroundColor = useSharedValue<number | string>(\n init('backgroundColor'),\n )\n const borderColor = useSharedValue<number | string>(init('borderColor'))\n const color = useSharedValue<number | string>(init('color'))\n const tintColor = useSharedValue<number | string>(init('tintColor'))\n\n const ref = useRef<SharedValueMap | null>(null)\n if (ref.current === null) {\n ref.current = {\n translateX,\n translateY,\n scale,\n scaleX,\n scaleY,\n rotate,\n opacity,\n width,\n height,\n borderRadius,\n backgroundColor,\n borderColor,\n color,\n tintColor,\n }\n }\n return ref.current\n}\n\n/**\n * Build a per-key `CallbackFactory` for the resolver. Each step in a sequence\n * (or the single animation, when `value` isn't an array) gets its own\n * Reanimated callback; when it settles on the UI thread, the callback bridges\n * to JS via `runOnJS` and invokes the user's `onAnimationEnd` with a fully\n * populated `AnimationCallbackInfo`.\n *\n * Phase resolution lives here, on the JS thread. The resolver hands us a\n * coarse rawPhase (`'step'` for any sequence step, `'animation'` for a\n * single-shot terminal); we map that onto the public phase set\n * (`'step' | 'sequence' | 'repeat' | 'animation'`) using `meta` and the\n * iteration counter. `iteration` resets per effect run because the factory\n * is constructed fresh inside the effect.\n */\nfunction makeKeyCallbackFactory(\n key: string,\n sharedValue: SharedValue<number | string>,\n target: number | string | undefined,\n onAnimationEndRef: {\n current: ((info: AnimationCallbackInfo<unknown>) => void) | undefined\n },\n meta: { stepCount: number; totalIterations: number },\n onSettle?: () => void,\n transformGroup?: TransformGroup,\n) {\n if (!onAnimationEndRef.current && !onSettle) return undefined\n\n // Shared across this animation graph's callbacks (one per sequence step,\n // or one for a single-shot). Mutated when a full pass completes.\n const state = { iteration: 0 }\n\n const isTransformKey = TRANSFORM_KEY_SET.has(key as AnimatableKey)\n\n const dispatch = (\n rawPhase: 'step' | 'animation',\n step: number | undefined,\n finished: boolean,\n value: number | string | undefined,\n ) => {\n const isLastIteration = state.iteration >= meta.totalIterations - 1\n let phase: 'step' | 'sequence' | 'repeat' | 'animation'\n let isTerminal = false\n\n if (rawPhase === 'step') {\n const isLastInPass = step !== undefined && step === meta.stepCount - 1\n if (!isLastInPass) {\n phase = 'step'\n } else if (isLastIteration) {\n phase = 'animation'\n isTerminal = true\n } else {\n phase = 'sequence'\n }\n } else if (isLastIteration) {\n phase = 'animation'\n isTerminal = true\n } else {\n phase = 'repeat'\n }\n\n const reportedIteration = state.iteration\n if (phase === 'sequence' || phase === 'repeat') state.iteration++\n\n const fn = onAnimationEndRef.current\n if (fn) {\n // Transform-group coalescing: a multi-axis translate / scale /\n // rotate animation should fire onAnimationEnd ONCE for the logical\n // transform, not once per axis. We only coalesce the terminal\n // `'animation'` phase — `step`/`sequence`/`repeat` events fire\n // per-axis since each is its own logical event. Released per-axis\n // for a single-axis case too, with `key: 'transform'` for\n // consistency.\n if (isTransformKey && transformGroup && phase === 'animation') {\n transformGroup.remaining--\n if (transformGroup.remaining <= 0) {\n fn({\n key: 'transform' as never,\n finished,\n value,\n target,\n phase,\n step,\n iteration: reportedIteration,\n })\n }\n } else {\n fn({\n key: key as never,\n finished,\n value,\n target,\n phase,\n step,\n iteration: reportedIteration,\n })\n }\n }\n // Settle hooks fire per-axis on the terminal phase — <Presence> waits\n // for *every* exiting property to settle before unmounting, so we\n // intentionally do not coalesce these (the transform-group coalesce\n // is purely a user-callback ergonomic).\n if (onSettle && isTerminal) onSettle()\n }\n\n return (rawPhase: 'step' | 'animation', step: number | undefined) => {\n // Reanimated invokes the callback with only `finished` (see\n // valueSetter.js:24,40,51 in 4.x) — `current` is never passed. Read the\n // shared value inside the worklet; by the time the callback fires the\n // final/clamped value has already been written to it.\n const cb = (finished?: boolean) => {\n 'worklet'\n runOnJS(dispatch)(rawPhase, step, !!finished, sharedValue.value)\n }\n return cb\n }\n}\n\n/**\n * Number of sequence steps in an animatable value. `1` for plain values and\n * single-step `{ to }` objects; the array length for keyframe arrays.\n */\nfunction stepCountOf(v: AnimatableValue<number | string> | undefined): number {\n if (Array.isArray(v)) return v.length\n return 1\n}\n\n/**\n * Total number of iterations the animation will run, including the initial\n * pass. `1` when there is no `repeat`; `Number.POSITIVE_INFINITY` for\n * `'infinite'`. Decay and `no-animation` configs cannot repeat — both return\n * `1` so the iteration counter stays at 0.\n */\nfunction totalIterationsOf(cfg: TransitionConfig | undefined): number {\n if (!cfg || cfg.type === 'no-animation' || cfg.type === 'decay') return 1\n const r = cfg.repeat\n if (r === undefined) return 1\n if (r === 'infinite') return Number.POSITIVE_INFINITY\n if (typeof r === 'number') return r\n if (r.count === 'infinite') return Number.POSITIVE_INFINITY\n return r.count\n}\n\n/**\n * Pull a single end-value out of an `AnimatableValue` for the\n * `AnimationCallbackInfo.target` field. Plain numbers/strings come through;\n * the last sequence step's `to`/value is used for arrays; `{ to }` step\n * objects use `to`. Returns `undefined` for unrecognized shapes.\n */\nfunction targetEndValue(\n v: AnimatableValue<number | string> | undefined,\n): number | string | undefined {\n if (v === undefined) return undefined\n if (typeof v === 'number' || typeof v === 'string') return v\n if (Array.isArray(v)) {\n return v.length > 0\n ? targetEndValue(v[v.length - 1] as AnimatableValue<number | string>)\n : undefined\n }\n if (typeof v === 'object' && v !== null && 'to' in v) {\n const to = (v as { to: unknown }).to\n return typeof to === 'number' || typeof to === 'string' ? to : undefined\n }\n return undefined\n}\n\n/**\n * Subscribe to a `VariantController` and return its `current` key. Returns\n * `undefined` when no controller is provided so callers can fall back to a\n * literal `animate` value.\n */\nfunction useControllerKey(\n controller: VariantController | undefined,\n): string | undefined {\n const [, setTick] = useState(0)\n useEffect(() => {\n if (!controller) return\n const unsub = controller.subscribe(() => setTick((n) => n + 1))\n return unsub\n }, [controller])\n return controller?.current\n}\n\n/**\n * Resolve the effective `animate` target from the public-prop tuple.\n *\n * Precedence: `controller.current` (when controller is set) > string-keyed\n * `animate` looked up in `variants` > literal `animate` object > `undefined`.\n */\nfunction resolveAnimateInput(\n animate: AnimateStyle<unknown> | string | undefined,\n variants: VariantsMap<unknown> | undefined,\n controllerKey: string | undefined,\n): AnimateStyle<unknown> | undefined {\n if (controllerKey !== undefined && variants && controllerKey in variants) {\n return variants[controllerKey]\n }\n if (typeof animate === 'string') {\n if (variants && animate in variants) return variants[animate]\n if (__DEV__) {\n console.warn(\n `[inertia] animate=\"${animate}\" but no matching variant. Did you forget to pass \\`variants\\`?`,\n )\n }\n return undefined\n }\n return animate as AnimateStyle<unknown> | undefined\n}\n\ndeclare const __DEV__: boolean\n\n/**\n * Pick the resting/initial-frame value out of an `AnimatableValue`. Plain\n * numbers and color strings come through unchanged; sequence arrays use their\n * first element; `{ to }` step objects use `to`. Unresolvable shapes return\n * `undefined` so the caller can fall back to `DEFAULT_RESTING`.\n */\nfunction restValue(\n v: AnimatableValue<number | string> | undefined,\n): number | string | undefined {\n if (v === undefined) return undefined\n if (typeof v === 'number' || typeof v === 'string') return v\n if (Array.isArray(v)) {\n return v.length > 0\n ? restValue(v[0] as AnimatableValue<number | string>)\n : undefined\n }\n if (typeof v === 'object' && v !== null && 'to' in v) {\n const to = (v as { to: unknown }).to\n return typeof to === 'number' || typeof to === 'string' ? to : undefined\n }\n return undefined\n}\n\nfunction 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 — gives a stable signature\n * regardless of property declaration order. Functions serialize as `null` so a\n * change in easing-fn reference is invisible here; that's fine for v0.1\n * (easing swaps are rare and the worklet wrapper handles correctness).\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\n/**\n * Merge gesture sub-state targets over the base `animate` record. Keys touched\n * by any declared sub-state are always present in the result so releasing a\n * gesture animates the property back to a defined value (the base `animate`\n * value when present, otherwise `DEFAULT_RESTING`). Sub-states layer in\n * priority order (lowest first):\n * `hovered` < `focused` < `focusVisible` < `pressed`.\n */\nfunction mergeGestureTargets(\n base: Partial<Record<AnimatableKey, AnimatableValue<number | string>>>,\n gesture: GestureSubStates<unknown> | undefined,\n active: {\n pressed: boolean\n focused: boolean\n focusVisible: boolean\n hovered: boolean\n },\n): Partial<Record<AnimatableKey, AnimatableValue<number | string>>> {\n if (!gesture) return base\n const merged: Partial<\n Record<AnimatableKey, AnimatableValue<number | string>>\n > = {\n ...base,\n }\n const subStates = [\n gesture.hovered,\n gesture.focused,\n gesture.focusVisible,\n gesture.pressed,\n ] as Array<\n Partial<Record<AnimatableKey, AnimatableValue<number | string>>> | undefined\n >\n for (const sub of subStates) {\n if (!sub) continue\n for (const k of ALL_KEYS) {\n if (k in sub && !(k in merged)) {\n merged[k] = DEFAULT_RESTING[k]\n }\n }\n }\n if (active.hovered && gesture.hovered) {\n Object.assign(\n merged,\n gesture.hovered as Partial<\n Record<AnimatableKey, AnimatableValue<number | string>>\n >,\n )\n }\n if (active.focused && gesture.focused) {\n Object.assign(\n merged,\n gesture.focused as Partial<\n Record<AnimatableKey, AnimatableValue<number | string>>\n >,\n )\n }\n if (active.focusVisible && gesture.focusVisible) {\n Object.assign(\n merged,\n gesture.focusVisible as Partial<\n Record<AnimatableKey, AnimatableValue<number | string>>\n >,\n )\n }\n if (active.pressed && gesture.pressed) {\n Object.assign(\n merged,\n gesture.pressed as Partial<\n Record<AnimatableKey, AnimatableValue<number | string>>\n >,\n )\n }\n return merged\n}\n\ntype GestureHandlers = Record<string, (event: unknown) => void>\n\n/**\n * Build the touch / focus / hover handler props for a gesture-enabled Motion\n * primitive. Returns an empty object when `gesture` is undefined so the\n * component renders identically to the gesture-less path (zero overhead).\n *\n * Existing user-supplied handlers on the same events are composed: the user's\n * handler runs first, then the internal state setter. We pull user handlers\n * out of `rest` rather than overwriting them.\n */\nfunction useGestureHandlers(\n gesture: GestureSubStates<unknown> | undefined,\n rest: Record<string, unknown>,\n setPressed: (next: boolean) => void,\n setFocused: (next: boolean) => void,\n setFocusVisible: (next: boolean) => void,\n setHovered: (next: boolean) => void,\n): GestureHandlers {\n return useMemo(() => {\n if (!gesture) return {}\n const handlers: GestureHandlers = {}\n if (gesture.pressed) {\n handlers.onTouchStart = compose(rest.onTouchStart, () => setPressed(true))\n handlers.onTouchEnd = compose(rest.onTouchEnd, () => setPressed(false))\n handlers.onTouchCancel = compose(rest.onTouchCancel, () =>\n setPressed(false),\n )\n // Pressable / TouchableOpacity expose press hooks above the touch layer;\n // forward to those when present so wrapping consumers stay consistent.\n handlers.onPressIn = compose(rest.onPressIn, () => setPressed(true))\n handlers.onPressOut = compose(rest.onPressOut, () => setPressed(false))\n }\n // Mount onFocus/onBlur if either focus sub-state is declared. The two flags\n // are independent: `focused` always tracks focus; `focusVisible` only\n // engages when the most recent input was keyboard (W3C `:focus-visible`\n // semantics). On native the modality is always `'keyboard'`, so the two\n // flags move together.\n if (gesture.focused || gesture.focusVisible) {\n handlers.onFocus = compose(rest.onFocus, () => {\n if (gesture.focused) setFocused(true)\n if (gesture.focusVisible && isFocusVisible()) setFocusVisible(true)\n })\n handlers.onBlur = compose(rest.onBlur, () => {\n if (gesture.focused) setFocused(false)\n if (gesture.focusVisible) setFocusVisible(false)\n })\n }\n if (gesture.hovered) {\n // Web-only events. RN-Web 0.72+ accepts these on View; native ignores\n // them so the cost is zero on iOS / Android.\n handlers.onMouseEnter = compose(rest.onMouseEnter, () => setHovered(true))\n handlers.onMouseLeave = compose(rest.onMouseLeave, () =>\n setHovered(false),\n )\n }\n return handlers\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n gesture?.pressed ? 1 : 0,\n gesture?.focused ? 1 : 0,\n gesture?.focusVisible ? 1 : 0,\n gesture?.hovered ? 1 : 0,\n rest.onTouchStart,\n rest.onTouchEnd,\n rest.onTouchCancel,\n rest.onPressIn,\n rest.onPressOut,\n rest.onFocus,\n rest.onBlur,\n rest.onMouseEnter,\n rest.onMouseLeave,\n ])\n}\n\nfunction compose(\n user: unknown,\n ours: (event: unknown) => void,\n): (event: unknown) => void {\n if (typeof user !== 'function') return ours\n return (event: unknown) => {\n ;(user as (event: unknown) => void)(event)\n ours(event)\n }\n}\n\n// Suppress the implicit any-return of the rotate ternary's union shape.\n// `TransformKey` is exported only to keep the type readable in d.ts.\nexport type { TransformKey }\n","import { Image } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `Image`. Inherits `Image`'s prop surface, with `animate` /\n * `initial` / `exit` / `transition` typed against `ImageStyle` (so\n * `tintColor` is accepted on `animate` here, but rejected on `Motion.View`).\n */\nexport const MotionImage = createMotionComponent(Image)\n","import { Pressable } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into\n * Pressable's native `onPressIn` / `onPressOut` via the factory's handler\n * composition, picking up touch slop and accessibility semantics for free.\n *\n * Note: the function-style `style={(state) => ...}` Pressable form is not\n * supported. Drive press-state styling through `gesture.pressed` instead.\n */\nexport const MotionPressable = createMotionComponent(Pressable)\n","import { ScrollView } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `ScrollView`. Animations apply to the scroll container itself —\n * useful for entrance transforms or fades on the whole list. Scroll-position\n * driven animation (`useScroll`) lands in the values layer.\n */\nexport const MotionScrollView = createMotionComponent(ScrollView)\n","import { Text } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `Text`. Inherits `Text`'s prop surface, with `animate` /\n * `initial` / `exit` / `transition` typed against `TextStyle`.\n */\nexport const MotionText = createMotionComponent(Text)\n","import { View } from 'react-native'\nimport { createMotionComponent } from './createMotionComponent'\n\n/**\n * Animatable `View`. Inherits `View`'s prop surface, with `animate` /\n * `initial` / `exit` / `transition` typed against `ViewStyle`.\n */\nexport const MotionView = createMotionComponent(View)\n","import { MotionImage } from './Image'\nimport { MotionPressable } from './Pressable'\nimport { MotionScrollView } from './ScrollView'\nimport { MotionText } from './Text'\nimport { MotionView } from './View'\n\nexport { createMotionComponent } from './createMotionComponent'\nexport {\n MotionView,\n MotionText,\n MotionImage,\n MotionPressable,\n MotionScrollView,\n}\n\n/**\n * The `Motion.*` namespace. Each property is a primitive with its style prop\n * inferred from the underlying RN component. There is no shared style fallback.\n */\nexport const Motion = {\n View: MotionView,\n Text: MotionText,\n Image: MotionImage,\n Pressable: MotionPressable,\n ScrollView: MotionScrollView,\n} as const\n","import { useMemo, useRef } from 'react'\nimport { type VariantController } from '../types'\n\n/**\n * Build a controller for a variants map. The controller is the imperative\n * escape hatch — pass it to a Motion primitive via `controller={...}` and\n * call `controller.transitionTo('open')` from event handlers, async chains,\n * etc. The hook name mirrors the prop name (`variants`) so the relationship\n * is obvious.\n *\n * The controller is identity-stable across renders. State changes are\n * delivered to subscribers via `subscribe` — Motion primitives subscribe\n * internally and re-resolve `animate` on each transition.\n */\nexport function useVariants<V extends Readonly<Record<string, object>>>(\n variants: V,\n initial?: keyof V & string,\n): VariantController<keyof V & string> {\n // Pin the variants object reference for the lifetime of the controller.\n // Consumers shouldn't recreate the map on every render anyway, but if they\n // do, the controller still works against the first definition's keys.\n const variantsRef = useRef(variants)\n\n return useMemo(() => {\n const listeners = new Set<(next: keyof V & string) => void>()\n let current =\n initial ??\n ((Object.keys(variantsRef.current)[0] ?? '') as keyof V & string)\n\n const controller: VariantController<keyof V & string> = {\n get current() {\n return current\n },\n transitionTo(next) {\n if (next === current) return\n if (!(next in variantsRef.current)) {\n if (__DEV__) {\n console.warn(\n `[inertia] useVariants: unknown variant \"${String(next)}\". Known keys: ${Object.keys(variantsRef.current).join(', ')}`,\n )\n }\n return\n }\n current = next\n for (const fn of listeners) fn(next)\n },\n subscribe(listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n }\n return controller\n // Identity-stable controller — only build once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\ndeclare const __DEV__: boolean\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Image } from 'react-native';
2
- import { M as MotionComponent } from '../types-CmbXx-G3.mjs';
2
+ import { M as MotionComponent } from '../types-DeZZzE_e.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Image } from 'react-native';
2
- import { M as MotionComponent } from '../types-CmbXx-G3.js';
2
+ import { M as MotionComponent } from '../types-DeZZzE_e.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -26,6 +26,29 @@ function useShouldReduceMotion() {
26
26
  if (reducedMotion === "always") return true;
27
27
  return osReduced;
28
28
  }
29
+ var modality = "keyboard";
30
+ var installed = false;
31
+ function setKeyboard() {
32
+ modality = "keyboard";
33
+ }
34
+ function setPointer() {
35
+ modality = "pointer";
36
+ }
37
+ function ensureInstalled() {
38
+ if (installed) return;
39
+ if (reactNative.Platform.OS !== "web") return;
40
+ if (typeof document === "undefined") return;
41
+ document.addEventListener("keydown", setKeyboard, true);
42
+ document.addEventListener("mousedown", setPointer, true);
43
+ document.addEventListener("pointerdown", setPointer, true);
44
+ document.addEventListener("touchstart", setPointer, true);
45
+ installed = true;
46
+ }
47
+ function isFocusVisible() {
48
+ if (reactNative.Platform.OS !== "web") return true;
49
+ ensureInstalled();
50
+ return modality === "keyboard";
51
+ }
29
52
  var PresenceContext = react.createContext(null);
30
53
  function usePresence() {
31
54
  return react.useContext(PresenceContext);
@@ -169,8 +192,23 @@ var TRANSFORM_KEYS = [
169
192
  "scaleY",
170
193
  "rotate"
171
194
  ];
172
- var TOP_LEVEL_KEYS = ["opacity", "width", "height", "borderRadius"];
173
- var ALL_KEYS = [...TRANSFORM_KEYS, ...TOP_LEVEL_KEYS];
195
+ var NUMERIC_TOP_LEVEL_KEYS = [
196
+ "opacity",
197
+ "width",
198
+ "height",
199
+ "borderRadius"
200
+ ];
201
+ var COLOR_KEYS = [
202
+ "backgroundColor",
203
+ "borderColor",
204
+ "color",
205
+ "tintColor"
206
+ ];
207
+ var ALL_KEYS = [
208
+ ...TRANSFORM_KEYS,
209
+ ...NUMERIC_TOP_LEVEL_KEYS,
210
+ ...COLOR_KEYS
211
+ ];
174
212
  var TRANSFORM_KEY_SET = new Set(TRANSFORM_KEYS);
175
213
  var EXITING_POINTER_EVENTS_STYLE = { pointerEvents: "none" };
176
214
  var DEFAULT_RESTING = {
@@ -183,7 +221,15 @@ var DEFAULT_RESTING = {
183
221
  opacity: 1,
184
222
  width: 0,
185
223
  height: 0,
186
- borderRadius: 0
224
+ borderRadius: 0,
225
+ // 'transparent' is the only safe universal default for colors: it works as
226
+ // an initial seed for any color animation (no jarring opaque flash on mount
227
+ // when `initial` is omitted) and rgba(0,0,0,0) interpolates cleanly into
228
+ // any opaque target via Reanimated's color util.
229
+ backgroundColor: "transparent",
230
+ borderColor: "transparent",
231
+ color: "transparent",
232
+ tintColor: "transparent"
187
233
  };
188
234
  var TRANSITION_KEYS = /* @__PURE__ */ new Set([
189
235
  "type",
@@ -244,6 +290,7 @@ function createMotionComponent(Component) {
244
290
  const exitRecord = exit ? exit : void 0;
245
291
  const [pressed, setPressed] = react.useState(false);
246
292
  const [focused, setFocused] = react.useState(false);
293
+ const [focusVisible, setFocusVisible] = react.useState(false);
247
294
  const [hovered, setHovered] = react.useState(false);
248
295
  const activeKeysRef = react.useRef(null);
249
296
  if (activeKeysRef.current === null) {
@@ -264,6 +311,7 @@ function createMotionComponent(Component) {
264
311
  for (const subState of [
265
312
  gesture.pressed,
266
313
  gesture.focused,
314
+ gesture.focusVisible,
267
315
  gesture.hovered
268
316
  ]) {
269
317
  if (!subState) continue;
@@ -292,6 +340,7 @@ function createMotionComponent(Component) {
292
340
  const mergedRecord = isExiting && exitRecord ? { ...animateRecord, ...exitRecord } : mergeGestureTargets(animateRecord, gesture, {
293
341
  pressed,
294
342
  focused,
343
+ focusVisible,
295
344
  hovered
296
345
  });
297
346
  const mergedSig = stableSig(mergedRecord) + (isExiting ? "|exit" : "") + (shouldReduceMotion ? "|rm" : "");
@@ -374,6 +423,7 @@ function createMotionComponent(Component) {
374
423
  rest,
375
424
  setPressed,
376
425
  setFocused,
426
+ setFocusVisible,
377
427
  setHovered
378
428
  );
379
429
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -400,6 +450,12 @@ function useAnimatableSharedValues(init) {
400
450
  const width = Animated.useSharedValue(init("width"));
401
451
  const height = Animated.useSharedValue(init("height"));
402
452
  const borderRadius = Animated.useSharedValue(init("borderRadius"));
453
+ const backgroundColor = Animated.useSharedValue(
454
+ init("backgroundColor")
455
+ );
456
+ const borderColor = Animated.useSharedValue(init("borderColor"));
457
+ const color = Animated.useSharedValue(init("color"));
458
+ const tintColor = Animated.useSharedValue(init("tintColor"));
403
459
  const ref = react.useRef(null);
404
460
  if (ref.current === null) {
405
461
  ref.current = {
@@ -412,7 +468,11 @@ function useAnimatableSharedValues(init) {
412
468
  opacity,
413
469
  width,
414
470
  height,
415
- borderRadius
471
+ borderRadius,
472
+ backgroundColor,
473
+ borderColor,
474
+ color,
475
+ tintColor
416
476
  };
417
477
  }
418
478
  return ref.current;
@@ -531,13 +591,13 @@ function resolveAnimateInput(animate, variants, controllerKey) {
531
591
  }
532
592
  function restValue(v) {
533
593
  if (v === void 0) return void 0;
534
- if (typeof v === "number") return v;
594
+ if (typeof v === "number" || typeof v === "string") return v;
535
595
  if (Array.isArray(v)) {
536
596
  return v.length > 0 ? restValue(v[0]) : void 0;
537
597
  }
538
598
  if (typeof v === "object" && v !== null && "to" in v) {
539
599
  const to = v.to;
540
- return typeof to === "number" ? to : void 0;
600
+ return typeof to === "number" || typeof to === "string" ? to : void 0;
541
601
  }
542
602
  return void 0;
543
603
  }
@@ -569,6 +629,7 @@ function mergeGestureTargets(base, gesture, active) {
569
629
  const subStates = [
570
630
  gesture.hovered,
571
631
  gesture.focused,
632
+ gesture.focusVisible,
572
633
  gesture.pressed
573
634
  ];
574
635
  for (const sub of subStates) {
@@ -591,6 +652,12 @@ function mergeGestureTargets(base, gesture, active) {
591
652
  gesture.focused
592
653
  );
593
654
  }
655
+ if (active.focusVisible && gesture.focusVisible) {
656
+ Object.assign(
657
+ merged,
658
+ gesture.focusVisible
659
+ );
660
+ }
594
661
  if (active.pressed && gesture.pressed) {
595
662
  Object.assign(
596
663
  merged,
@@ -599,7 +666,7 @@ function mergeGestureTargets(base, gesture, active) {
599
666
  }
600
667
  return merged;
601
668
  }
602
- function useGestureHandlers(gesture, rest, setPressed, setFocused, setHovered) {
669
+ function useGestureHandlers(gesture, rest, setPressed, setFocused, setFocusVisible, setHovered) {
603
670
  return react.useMemo(() => {
604
671
  if (!gesture) return {};
605
672
  const handlers = {};
@@ -613,9 +680,15 @@ function useGestureHandlers(gesture, rest, setPressed, setFocused, setHovered) {
613
680
  handlers.onPressIn = compose(rest.onPressIn, () => setPressed(true));
614
681
  handlers.onPressOut = compose(rest.onPressOut, () => setPressed(false));
615
682
  }
616
- if (gesture.focused) {
617
- handlers.onFocus = compose(rest.onFocus, () => setFocused(true));
618
- handlers.onBlur = compose(rest.onBlur, () => setFocused(false));
683
+ if (gesture.focused || gesture.focusVisible) {
684
+ handlers.onFocus = compose(rest.onFocus, () => {
685
+ if (gesture.focused) setFocused(true);
686
+ if (gesture.focusVisible && isFocusVisible()) setFocusVisible(true);
687
+ });
688
+ handlers.onBlur = compose(rest.onBlur, () => {
689
+ if (gesture.focused) setFocused(false);
690
+ if (gesture.focusVisible) setFocusVisible(false);
691
+ });
619
692
  }
620
693
  if (gesture.hovered) {
621
694
  handlers.onMouseEnter = compose(rest.onMouseEnter, () => setHovered(true));
@@ -628,6 +701,7 @@ function useGestureHandlers(gesture, rest, setPressed, setFocused, setHovered) {
628
701
  }, [
629
702
  gesture?.pressed ? 1 : 0,
630
703
  gesture?.focused ? 1 : 0,
704
+ gesture?.focusVisible ? 1 : 0,
631
705
  gesture?.hovered ? 1 : 0,
632
706
  rest.onTouchStart,
633
707
  rest.onTouchEnd,