@onlynative/inertia 0.0.1-alpha.7 → 0.0.1-alpha.9

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 (72) hide show
  1. package/README.md +1 -1
  2. package/dist/gestureLayer/index.d.mts +119 -0
  3. package/dist/gestureLayer/index.d.ts +119 -0
  4. package/dist/gestureLayer/index.js +346 -0
  5. package/dist/gestureLayer/index.js.map +1 -0
  6. package/dist/gestureLayer/index.mjs +344 -0
  7. package/dist/gestureLayer/index.mjs.map +1 -0
  8. package/dist/index.d.mts +114 -74
  9. package/dist/index.d.ts +114 -74
  10. package/dist/index.js +388 -1542
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +388 -1545
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/motion/Image.d.mts +1 -1
  15. package/dist/motion/Image.d.ts +1 -1
  16. package/dist/motion/Image.js +244 -1462
  17. package/dist/motion/Image.js.map +1 -1
  18. package/dist/motion/Image.mjs +247 -1465
  19. package/dist/motion/Image.mjs.map +1 -1
  20. package/dist/motion/Pressable.d.mts +1 -1
  21. package/dist/motion/Pressable.d.ts +1 -1
  22. package/dist/motion/Pressable.js +244 -1462
  23. package/dist/motion/Pressable.js.map +1 -1
  24. package/dist/motion/Pressable.mjs +247 -1465
  25. package/dist/motion/Pressable.mjs.map +1 -1
  26. package/dist/motion/ScrollView.d.mts +1 -1
  27. package/dist/motion/ScrollView.d.ts +1 -1
  28. package/dist/motion/ScrollView.js +244 -1462
  29. package/dist/motion/ScrollView.js.map +1 -1
  30. package/dist/motion/ScrollView.mjs +247 -1465
  31. package/dist/motion/ScrollView.mjs.map +1 -1
  32. package/dist/motion/Text.d.mts +1 -1
  33. package/dist/motion/Text.d.ts +1 -1
  34. package/dist/motion/Text.js +244 -1462
  35. package/dist/motion/Text.js.map +1 -1
  36. package/dist/motion/Text.mjs +247 -1465
  37. package/dist/motion/Text.mjs.map +1 -1
  38. package/dist/motion/View.d.mts +1 -1
  39. package/dist/motion/View.d.ts +1 -1
  40. package/dist/motion/View.js +244 -1462
  41. package/dist/motion/View.js.map +1 -1
  42. package/dist/motion/View.mjs +247 -1465
  43. package/dist/motion/View.mjs.map +1 -1
  44. package/dist/touch/index.d.mts +146 -0
  45. package/dist/touch/index.d.ts +146 -0
  46. package/dist/touch/index.js +166 -0
  47. package/dist/touch/index.js.map +1 -0
  48. package/dist/touch/index.mjs +164 -0
  49. package/dist/touch/index.mjs.map +1 -0
  50. package/dist/{types-NmNeJjo1.d.mts → types-cU43dEmH.d.mts} +64 -17
  51. package/dist/{types-NmNeJjo1.d.ts → types-cU43dEmH.d.ts} +64 -17
  52. package/dist/useGesture-B7A_1DVg.d.ts +84 -0
  53. package/dist/useGesture-cimMrzC1.d.mts +84 -0
  54. package/jest-setup.js +4 -0
  55. package/llms.txt +12 -3
  56. package/package.json +22 -2
  57. package/src/__type-tests__/variants.test-d.tsx +67 -0
  58. package/src/gestureLayer/index.ts +21 -0
  59. package/src/gestureLayer/useGestureLayer.ts +285 -0
  60. package/src/index.ts +7 -0
  61. package/src/layout/index.ts +15 -0
  62. package/src/layout/sharedRegistry.ts +111 -0
  63. package/src/layout/useSharedLayout.ts +289 -0
  64. package/src/motion/createMotionComponent.tsx +123 -37
  65. package/src/motion/installCheck.ts +7 -11
  66. package/src/touch/index.ts +18 -0
  67. package/src/touch/useTouchDrag.ts +289 -0
  68. package/src/types.ts +79 -20
  69. package/src/values/index.ts +11 -0
  70. package/src/values/useBooleanSpring.ts +33 -0
  71. package/src/values/useColorTransition.ts +72 -0
  72. package/src/values/useShadow.ts +116 -0
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config/MotionConfigContext.ts","../src/config/MotionConfig.tsx","../src/gestures/focusVisibility.ts","../../../node_modules/react-native-worklets/logger.ts","../../../node_modules/react-native-worklets/runtimeKind.ts","../../../node_modules/react-native-worklets/WorkletsError.ts","../../../node_modules/react-native-worklets/bundleUnpacker.ts","../../../node_modules/react-native-worklets/callGuard.ts","../../../node_modules/react-native-worklets/errors.ts","../../../node_modules/react-native-worklets/PlatformChecker/PlatformChecker.ts","../../../node_modules/react-native-worklets/PlatformChecker/index.ts","../../../node_modules/react-native-worklets/runLoop/common/setImmediatePolyfill.ts","../../../node_modules/react-native-worklets/runLoop/common/setIntervalPolyfill.ts","../../../node_modules/react-native-worklets/runLoop/uiRuntime/mockedRequestAnimationFrame.ts","../../../node_modules/react-native-worklets/isSynchronizable.ts","../../../node_modules/react-native-worklets/serializableMappingCache.ts","../../../node_modules/react-native-worklets/utils/jsVersion.ts","../../../node_modules/react-native-worklets/workletFunction.ts","../../../node_modules/react-native-worklets/WorkletsModule/JSWorklets.ts","../../../node_modules/react-native-worklets/specs/NativeWorkletsModule.ts","../../../node_modules/react-native-worklets/specs/index.ts","../../../node_modules/react-native-worklets/utils/checkCppVersion.ts","../../../node_modules/react-native-worklets/WorkletsModule/NativeWorklets.ts","../../../node_modules/react-native-worklets/WorkletsModule/workletsModuleInstance.ts","../../../node_modules/react-native-worklets/serializable.ts","../../../node_modules/react-native-worklets/threads.ts","../../../node_modules/react-native-worklets/runLoop/uiRuntime/requestAnimationFrame.ts","../../../node_modules/react-native-worklets/runLoop/uiRuntime/setTimeoutPolyfill.ts","../../../node_modules/react-native-worklets/synchronizableUnpacker.ts","../../../node_modules/react-native-worklets/initializers.ts","../../../node_modules/react-native-worklets/workletRuntimeEntry.ts","../../../node_modules/react-native-worklets/featureFlags/index.ts","../../../node_modules/react-native-worklets/index.ts","../src/transitions/easing.ts","../src/transitions/spring.ts","../src/layout/resolveLayout.ts","../src/presence/PresenceContext.ts","../src/presence/Presence.tsx","../src/transitions/resolve.ts","../src/transitions/keys.ts","../src/transitions/runtime.ts","../src/transitions/sig.ts","../src/motion/installCheck.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/useAnimation.ts","../src/values/useGesture.ts","../src/values/useMotionValue.ts","../src/values/useSpring.ts","../src/values/useTransform.ts","../src/values/useScroll.ts","../src/values/useVariants.ts"],"names":["createContext","useContext","useReducedMotion","useMemo","jsx","Platform","PREFIX","formatMessage","message","logger","warn","console","error","RuntimeKind","globalThis","__RUNTIME_KIND","undefined","ReactNative","WorkletsErrorConstructor","prefix","errorInstance","Error","name","registerWorkletsError","WorkletsError","handleCache","WeakMap","bundleValueUnpacker","objectToUnpack","category","remoteFunctionName","workletHash","__workletHash","getWorklet","__closure","__init","value","get","set","remoteFunctionHolder","label","__remoteFunction","_toString","closureVariables","worklet","__DEV__","getWorkletFromMetroRequire","_e","metroRequire","__r","factory","default","callGuardDEV","fn","args","__workletsModuleProxy","stack","jsEngine","reportFatalErrorOnJS","setupCallGuard","__callGuardDEV","_workletStackDetails","Map","registerWorkletStackDetails","hash","stackDetails","getBundleOffset","frame","split","parsedFrame","exec","file","line","col","Number","processStack","workletStackEntries","match","result","forEach","origLine","origCol","map","errorDetails","lineOffset","colOffset","bundleFile","bundleLine","bundleCol","replace","reportFatalRemoteError","force","ErrorUtils","reportFatalError","registerReportFatalRemoteError","__reportFatalRemoteError","IS_JEST","process","env","JEST_WORKER_ID","IS_WEB","OS","IS_WINDOWS","SHOULD_BE_USE_WEB","RN_IS_JEST","RN_SHOULD_BE_USE_WEB","setupSetImmediate","setImmediatePolyfill","callback","setTimeout","clearImmediatePolyfill","immediateHandle","clearTimeout","setImmediate","clearImmediate","setupSetInterval","intervalHandleToTimeoutHandle","setIntervalPolyfill","delay","intervalHandle","repeatingCallback","timeoutHandle","clearIntervalPolyfill","delete","setInterval","clearInterval","mockedRequestAnimationFrame","performance","now","isSynchronizable","__synchronizableRef","serializableMappingFlag","cache","serializableMappingCache","serializable","serializableRef","bind","jsVersion","isWorkletFunction","createJSWorkletsModule","JSWorklets","requestAnimationFrameImpl","requestAnimationFrame","createSerializable","createSerializableString","createSerializableNumber","createSerializableBoolean","createSerializableBigInt","createSerializableUndefined","createSerializableNull","createSerializableTurboModuleLike","createSerializableObject","createSerializableMap","createSerializableSet","createSerializableImport","createSerializableHostObject","createSerializableArray","createSerializableInitializer","createSerializableFunction","createSerializableWorklet","scheduleOnUI","executeOnUIRuntimeSync","createWorkletRuntime","scheduleOnRuntime","createSynchronizable","synchronizableGetDirty","synchronizableGetBlocking","synchronizableSetBlocking","synchronizableLock","synchronizableUnlock","getStaticFeatureFlag","setDynamicFeatureFlag","TurboModuleRegistry","WorkletsTurboModule","RNWorkletsTurboModule","checkCppVersion","cppVersion","global","_WORKLETS_VERSION_CPP","ok","matchVersion","version1","version2","major1","minor1","major2","minor2","createNativeWorkletsModule","NativeWorklets","constructor","_WORKLETS_VERSION_JS","installTurboModule","shouldPersistRemote","nativeStateSource","from","to","str","num","bool","bigInt","props","proto","obj","shouldRetainRemote","array","keys","values","func","initializer","useDefaultQueue","customQueue","enableEventLoop","workletRuntime","serializableWorklet","synchronizableRef","WorkletsModule","MAGIC_KEY","isHostObject","isPlainJSObject","object","Object","getPrototypeOf","prototype","isTurboModuleLike","getFromCache","cached","INACCESSIBLE_OBJECT","Proxy","_","prop","String","VALID_ARRAY_VIEWS_NAMES","DETECT_CYCLIC_OBJECT_DEPTH_THRESHOLD","processedObjectAtThresholdDepth","createSerializableWeb","createSerializableNative","depth","detectCyclicObject","isObject","isFunction","cloneString","cloneNumber","cloneBoolean","cloneBigInt","cloneUndefined","cloneNull","clonePrimitive","Array","isArray","cloneArray","_WORKLETS_BUNDLE_MODE","__bundleData","cloneImport","cloneRemoteFunction","cloneTurboModuleLike","cloneHostObject","cloneInitializer","__workletContextObjectFactory","cloneContextObject","cloneWorklet","cloneSynchronizable","clonePlainJSObject","Set","cloneSet","cloneMap","RegExp","cloneRegExp","cloneError","ArrayBuffer","cloneArrayBuffer","isView","cloneArrayBufferView","inaccessibleObject","imported","source","require","resolveWeak","cloneObjectProperties","clonedProps","key","element","entries","__initData","clonedElements","clone","freezeObjectInDev","babelVersion","__pluginVersion","getWorkletCode","__stackDetails","workletContextObjectFactory","handle","clonedKeys","clonedValues","push","pattern","flags","buffer","typeName","includes","WORKLET_CODE_THRESHOLD","code","length","substring","isRemoteFunction","descriptor","getOwnPropertyDescriptor","configurable","defineProperty","preventExtensions","makeShareableCloneOnUIRecursiveLEGACY","cloneRecursive","_createSerializableHostObject","_createSerializableArray","_createSerializableSynchronizable","toAdapt","_createSerializable","_createSerializableString","_createSerializableNumber","_createSerializableBoolean","_createSerializableBigInt","_createSerializableUndefined","_createSerializableNull","makeShareableCloneOnUIRecursive","runOnUIQueue","setupMicrotasks","microtasksQueue","isExecutingMicrotasksQueue","queueMicrotask","_microtaskQueueFinalizers","__callMicrotasks","index","finalizer","callMicrotasksOnUIThread","callMicrotasks","runOnUI","enqueueUI","runOnUIWorklet","serializableRunOnUIWorklet","runWorkletOnJS","runOnJS","fun","scheduleOnJS","_scheduleHostFunctionOnJS","_scheduleRemoteFunctionOnJS","runOnUIAsync","Promise","resolve","runOnUIAsyncWorklet","serializableRunOnUIAsyncWorklet","job","flushUIQueue","queue","workletFunction","workletArgs","jobResolve","setupRequestAnimationFrame","nativeRequestAnimationFrame","queuedCallbacks","queuedCallbacksBegin","queuedCallbacksEnd","flushedCallbacks","flushedCallbacksBegin","flushedCallbacksEnd","flushRequested","__flushAnimationFrame","timestamp","__frameTimestamp","cancelAnimationFrame","setupSetTimeout","timeoutHandleToRafHandle","setTimeoutPolyfill","start","rafCallback","rafHandle","clearTimeoutPolyfill","__installUnpacker","serializer","_WORKLET","synchronizableUnpacker","synchronizable","proxy","getDirty","getBlocking","setBlocking","valueOrFunction","newValue","lock","prev","unlock","__synchronizableUnpacker","capturableConsole","getMemorySafeCapturableConsole","consoleCopy","fromEntries","methodName","method","methodWrapper","writable","setupConsole","boundCapturableConsole","assert","debug","log","info","initialized","init","initializeRuntime","initializeRuntimeOnWeb","initializeWorkletRuntime","initializeRNRuntime","installRNBindingsOnUIRuntime","__valueUnpacker","installSynchronizableUnpacker","testWorklet","Refresh","modules","getModules","ReactNativeModuleId","_global","_require","_importDefault","_importAll","module","_exports","_dependencyMap","exports","_target","mod","dependencyMap","hasError","importedAll","importedDefault","isInitialized","publicModule","_log","_getAnimationTimestamp","runtimeBoundCapturableConsole","bundleModeInit","runtimeKind","DynamicFlags","EXAMPLE_DYNAMIC_FLAG","setFlag","_ALWAYS_FALSE","builder","LinearTransition","Children","isValidElement","useState","useRef","useCallback","Fragment","withSpring","withTiming","Easing","withDecay","withRepeat","withDelay","step","withSequence","DEFAULT_TIMING_DURATION","probe","Animated","Motion","forwardRef","useSharedValue","useEffect","useAnimatedStyle","interpolateColor","Image","Pressable","ScrollView","Text","View","useAnimatedReaction","interpolate","useDerivedValue","Extrapolation","useAnimatedScrollHandler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBO,IAAM,qBAAA,GAA2C;AAAA,EACtD,aAAA,EAAe;AACjB,CAAA;AAEO,IAAM,mBAAA,GAAsBA,mBAAA;AAAA,EACjC;AACF,CAAA;AAMO,SAAS,eAAA,GAAqC;AACnD,EAAA,OAAOC,iBAAW,mBAAmB,CAAA;AACvC;AAQO,SAAS,qBAAA,GAAiC;AAC/C,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,eAAA,EAAgB;AAC1C,EAAA,MAAM,YAAYC,yBAAA,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,GAAQC,aAAA;AAAA,IACZ,OAAO,EAAE,aAAA,EAAc,CAAA;AAAA,IACvB,CAAC,aAAa;AAAA,GAChB;AACA,EAAA,uBACEC,cAAA,CAAC,mBAAA,CAAoB,QAAA,EAApB,EA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AA,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.js","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",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"// `isWorkletFunction` lives in `react-native-worklets` (the Reanimated 4 peer\n// dep); Reanimated's own re-export is deprecated.\nimport { isWorkletFunction } from 'react-native-worklets'\nimport { type EasingInput } from '../types'\n\n/**\n * Reanimated 3.9+ validates that easing functions used in nested-transition\n * contexts (variants, sequences, per-property maps) are worklets, and crashes\n * with `[Reanimated] The easing function is not a worklet` otherwise. The\n * library accepts plain functions on the public surface; this helper wraps\n * them so consumers don't have to think about the worklet boundary.\n *\n * If the input is already a worklet (has been processed by the worklets babel\n * plugin), it's returned as-is. Otherwise it's wrapped in a function whose\n * body declares the `'worklet'` directive — when our source is processed by\n * the consumer's worklets babel plugin (the default Expo/RN setup), the\n * wrapper becomes a real worklet that captures the user fn via closure.\n *\n * Reanimated 4 changed `Easing.bezier(...)` to return an\n * `EasingFunctionFactory` (`{ factory: () => EasingFunction }`) rather than\n * the function itself. The helper accepts both shapes — `EasingFunction` and\n * `EasingFunctionFactory` — and unwraps the factory automatically so\n * consumers don't have to call `.factory()` manually.\n *\n * The user fn must be pure: no JS-thread captured refs, no shared mutable\n * state, no calls to non-worklet APIs.\n */\nexport function ensureWorkletEasing(\n easing: EasingInput | undefined,\n): ((t: number) => number) | undefined {\n if (!easing) return undefined\n // Reanimated 4 `EasingFunctionFactory` — unwrap via `.factory()` before\n // checking worklet status, so the wrapped fn (not the factory wrapper)\n // ends up in the transition config.\n const fn = isEasingFactory(easing) ? easing.factory() : easing\n if (isWorkletFunction(fn)) return fn\n const wrapped = (t: number) => {\n 'worklet'\n return fn(t)\n }\n return wrapped\n}\n\nfunction isEasingFactory(\n value: EasingInput,\n): value is { factory: () => (t: number) => number } {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'factory' in value &&\n typeof (value as { factory: unknown }).factory === 'function'\n )\n}\n","import { type SpringTransition } from '../types'\n\n/**\n * Default spring physics, expressed in react-spring vocabulary.\n *\n * `tension: 170` / `friction: 26` / `mass: 1` was picked over Reanimated's\n * raw `stiffness: 100` / `damping: 10` default because the raw default\n * overshoots noticeably for the small (~100px) translates that dominate\n * UI work — buttons, sheets, popovers. These numbers settle in ~350ms with\n * a single, almost-imperceptible overshoot, which matches the perceptual\n * target the rest of the library is tuned against.\n */\nexport const DEFAULT_SPRING: Required<\n Pick<SpringTransition, 'tension' | 'friction' | 'mass'>\n> = {\n tension: 170,\n friction: 26,\n mass: 1,\n}\n\n/**\n * Convert public react-spring vocabulary (`tension` / `friction` / `mass`)\n * to Reanimated's raw `stiffness` / `damping` / `mass`. This is the single\n * place the mapping lives; resolvers, value hooks, and any future surface\n * that needs a Reanimated spring config import from here.\n *\n * The mapping is identity (tension ≡ stiffness, friction ≡ damping) — the\n * names differ but the underlying physics constants are the same. We don't\n * surface the raw names publicly because the react-spring vocabulary is\n * what designers and prior-art consumers expect.\n */\nexport function springToReanimated(t: SpringTransition) {\n 'worklet'\n return {\n stiffness: t.tension ?? DEFAULT_SPRING.tension,\n damping: t.friction ?? DEFAULT_SPRING.friction,\n mass: t.mass ?? DEFAULT_SPRING.mass,\n velocity: t.velocity,\n restSpeedThreshold: t.restSpeedThreshold,\n restDisplacementThreshold: t.restDisplacementThreshold,\n }\n}\n","import { LinearTransition } from 'react-native-reanimated'\nimport { ensureWorkletEasing } from '../transitions/easing'\nimport { DEFAULT_SPRING, springToReanimated } from '../transitions/spring'\nimport { type TransitionConfig } from '../types'\n\nexport type LayoutProp = boolean | TransitionConfig | undefined\n\n/**\n * Resolve the public `layout` prop into a Reanimated `LinearTransition` builder.\n *\n * - `undefined` / `false` / `{ type: 'no-animation' }` → `undefined` (no layout\n * animation; layout changes snap).\n * - `true` → default spring with the library's tuned tension / friction / mass.\n * - `{ type: 'spring', ... }` → spring with react-spring vocabulary, bridged\n * into `springify().damping().stiffness().mass()` via `springToReanimated`.\n * - `{ type: 'timing', ... }` → `.duration().easing()`. User easing fns are\n * auto-wrapped as worklets (Reanimated 3.9+ validates this).\n * - `{ type: 'decay', ... }` → silently downgrades to spring; decay doesn't\n * have a clear target for a layout transition.\n *\n * When `reducedMotion` is true the caller should pass `undefined` so the\n * underlying component renders without a layout animation at all. We choose\n * this over `LinearTransition.duration(0)` because Reanimated still runs the\n * commit-tracking machinery in that case; the snap path is genuinely cheaper.\n */\nexport function resolveLayoutTransition(\n layout: LayoutProp,\n): LinearTransition | undefined {\n if (!layout) return undefined\n\n const cfg: TransitionConfig = layout === true ? { type: 'spring' } : layout\n\n if (cfg.type === 'no-animation') return undefined\n\n if (cfg.type === 'timing') {\n let builder = LinearTransition.duration(cfg.duration ?? 300)\n const easing = ensureWorkletEasing(cfg.easing)\n if (easing) builder = builder.easing(easing)\n if (cfg.delay) builder = builder.delay(cfg.delay)\n return builder\n }\n\n const spring = cfg.type === 'decay' ? ({ type: 'spring' } as const) : cfg\n const { stiffness, damping, mass } = springToReanimated({\n ...DEFAULT_SPRING,\n ...spring,\n })\n let builder = LinearTransition.springify()\n .stiffness(stiffness)\n .damping(damping)\n .mass(mass)\n if ('delay' in spring && spring.delay) builder = builder.delay(spring.delay)\n return builder\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 {\n Easing,\n withDecay,\n withDelay,\n withRepeat,\n withSequence,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { ensureWorkletEasing } from './easing'\nimport { springToReanimated } from './spring'\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\nconst DEFAULT_TIMING_DURATION = 250\n\nfunction buildSpring(\n cfg: SpringTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withSpring(toValue as number, springToReanimated(cfg), cb as never)\n}\n\nfunction buildTiming(\n cfg: TimingTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withTiming(\n toValue as number,\n {\n duration: cfg.duration ?? DEFAULT_TIMING_DURATION,\n easing: ensureWorkletEasing(cfg.easing) ?? Easing.inOut(Easing.ease),\n },\n cb as never,\n )\n}\n\nfunction buildDecay(cfg: DecayTransition, cb?: AnimationCallback) {\n return withDecay(\n {\n velocity: cfg.velocity ?? 0,\n deceleration: cfg.deceleration,\n clamp: cfg.clamp,\n },\n cb as never,\n )\n}\n\n/**\n * Build a single-step animation (no repeat / no delay / no sequence) for a\n * given config + target. Pulled out so sequence steps can compose without\n * recursing into repeat/delay handling per step. The callback is forwarded\n * to Reanimated; for `no-animation` the callback is fired synchronously\n * since there's nothing to wait for.\n */\nfunction buildOne(\n cfg: TransitionConfig,\n toValue: number | string,\n cb?: AnimationCallback,\n): unknown {\n if (cfg.type === 'no-animation') {\n if (cb) cb(true, toValue)\n return toValue\n }\n if (cfg.type === 'decay') return buildDecay(cfg, cb)\n if (cfg.type === 'timing') return buildTiming(cfg, toValue, cb)\n return buildSpring(cfg as SpringTransition, toValue, cb)\n}\n\n/**\n * Wrap an animation in `withRepeat` per the unified `repeat` shape:\n * - `number` → finite count, alternating direction\n * - `'infinite'` → endless, alternating direction\n * - `{ count, alternate }`→ explicit; `alternate` defaults to `true`\n */\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 { type TransitionConfig } from '../types'\n\n/**\n * Field names that may appear on a `TransitionConfig` (spring / timing /\n * decay / no-animation). Used as a structural discriminator: if every key on\n * an object is in this set, the object is treated as a top-level transition;\n * otherwise it's a per-property / per-layer transition map.\n *\n * Adding a new field to `TransitionConfig` requires adding the name here.\n */\nexport const TRANSITION_CONFIG_KEYS = new Set([\n 'type',\n 'tension',\n 'friction',\n 'mass',\n 'velocity',\n 'restSpeedThreshold',\n 'restDisplacementThreshold',\n 'duration',\n 'easing',\n 'delay',\n 'repeat',\n 'deceleration',\n 'clamp',\n])\n\nexport function isTopLevelTransition(t: unknown): t is TransitionConfig {\n if (t === null || typeof t !== 'object') return false\n const keys = Object.keys(t as object)\n if (keys.length === 0) return false\n return keys.every((k) => TRANSITION_CONFIG_KEYS.has(k))\n}\n","import {\n Easing,\n withDecay,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { springToReanimated } from './spring'\nimport { type TransitionConfig } from '../types'\n\nconst DEFAULT_TIMING_DURATION = 250\n\n/**\n * Worklet-safe single-step animation builder. Mirrors a subset of\n * `resolveTransition` for the UI-thread path where the transition config is\n * picked at gesture-release time, not at render time.\n *\n * Supported: spring / timing / decay / no-animation, single-step only.\n * Not supported: sequences, top-level repeat, easing-function\n * auto-worklet-wrapping (pass an already-worklet easing if you need a custom\n * one — most release transitions don't).\n *\n * Use this from gesture worklets (`useDrag` / `usePan` release callbacks, or\n * any custom `Gesture.Pan().onEnd(() => ...)` worklet) to animate a shared\n * value with an Inertia transition without the JS round-trip that would lose\n * the release velocity.\n *\n * For decay transitions, `toValue` is ignored — decay decelerates from the\n * SV's current position via its own physics. Pass `0` if you don't have one.\n */\nexport function buildReleaseAnimation(\n transition: TransitionConfig,\n toValue: number,\n): unknown {\n 'worklet'\n if (transition.type === 'no-animation') return toValue\n if (transition.type === 'decay') {\n const cfg: {\n velocity: number\n deceleration?: number\n clamp?: [number, number]\n } = { velocity: transition.velocity ?? 0 }\n if (transition.deceleration !== undefined) {\n cfg.deceleration = transition.deceleration\n }\n if (transition.clamp !== undefined) cfg.clamp = transition.clamp\n return withDecay(cfg)\n }\n if (transition.type === 'timing') {\n // Reanimated 4's `Easing.bezier(...)` returns an `EasingFunctionFactory`\n // rather than the function itself. Unwrap inline so consumers calling\n // `buildReleaseAnimation` from a gesture worklet don't have to.\n const e = transition.easing\n const easingFn =\n e && typeof e === 'object' && 'factory' in e\n ? e.factory()\n : (e ?? Easing.inOut(Easing.ease))\n return withTiming(toValue, {\n duration: transition.duration ?? DEFAULT_TIMING_DURATION,\n easing: easingFn,\n })\n }\n return withSpring(toValue, springToReanimated(transition))\n}\n","/**\n * Stable string signature for an arbitrary value — used as a dep-array\n * member so a fresh object literal each render doesn't re-fire an effect\n * unless something structurally changed. Functions serialize as `null`\n * (their identity isn't useful in a sig); `undefined` collapses to an empty\n * string so omitted props compare equal across renders.\n */\nexport function stableSig(value: unknown): string {\n if (value === undefined) return ''\n try {\n return stableStringify(value)\n } catch {\n return String(value)\n }\n}\n\n/**\n * JSON.stringify with keys sorted at every level so a sig is invariant under\n * property-declaration order. Functions and `undefined` both serialize as\n * `null` — we accept the latter's information loss (rare in practice) in\n * exchange for not crashing on circular function-bearing graphs.\n */\nfunction stableStringify(v: unknown): string {\n if (v === null || typeof v !== 'object') {\n if (typeof v === 'function' || v === undefined) return 'null'\n return JSON.stringify(v)\n }\n if (Array.isArray(v)) {\n return '[' + v.map(stableStringify).join(',') + ']'\n }\n const obj = v as Record<string, unknown>\n const keys = Object.keys(obj).sort()\n return (\n '{' +\n keys\n .map((k) => JSON.stringify(k) + ':' + stableStringify(obj[k]))\n .join(',') +\n '}'\n )\n}\n","declare const __DEV__: boolean\ndeclare const process: { env?: Record<string, string | undefined> }\ndeclare const require: (path: string) => unknown\n\nlet alreadyChecked = false\n\n/**\n * Surface a clear, actionable error at first `createMotionComponent` call when\n * the consumer's Reanimated install is broken. Production builds, repeat calls,\n * and Jest test runs are all skipped — the check is purely a dev-time\n * paper-cut sander for the two failure modes we can detect from JS:\n *\n * 1. `react-native-reanimated` resolves but is on a v3.x line we don't\n * support (the plugin name and worklet runtime both changed at v4).\n * 2. The worklets babel plugin (`react-native-worklets/plugin` in v4) isn't\n * wired into `babel.config.js`, so `'worklet'` directives are dead strings\n * and the first `withSpring` / `withTiming` call would crash on the UI\n * thread with a generic \"non-worklet function called\" error.\n *\n * The \"Reanimated isn't installed at all\" case isn't handled here — Metro\n * fails to resolve the static `import 'react-native-reanimated'` at the top\n * of `createMotionComponent.tsx` long before this check runs.\n */\nexport function ensureReanimatedInstalled(): void {\n if (!__DEV__ || alreadyChecked) return\n // The standard `react-native-reanimated/mock` doesn't run the worklets\n // babel plugin, so the marker probe would false-positive every test run.\n if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'test') {\n return\n }\n alreadyChecked = true\n\n let version: string | undefined\n try {\n const pkg = require('react-native-reanimated/package.json') as {\n version?: string\n }\n version = pkg.version\n } catch {\n // package.json subpath blocked by `exports` field — skip the version\n // probe rather than emit a misleading error.\n }\n\n if (version) {\n const major = parseInt(version.split('.')[0] ?? '0', 10)\n if (major < 4) {\n console.error(\n `[inertia] react-native-reanimated v${version} is installed, but @onlynative/inertia requires v4.0.0 or later. ` +\n `Upgrade with \\`pnpm add react-native-reanimated@^4\\` (or your package manager's equivalent).`,\n )\n return\n }\n }\n\n // The worklets plugin rewrites any function carrying a top-of-body\n // `'worklet'` directive to expose a `__workletHash` property at runtime.\n // Its absence means the plugin didn't run.\n const probe = function probe() {\n 'worklet'\n return 0\n } as { __workletHash?: number }\n if (typeof probe.__workletHash !== 'number') {\n console.error(\n `[inertia] The Reanimated worklets babel plugin is not configured. ` +\n `Add \\`'react-native-worklets/plugin'\\` as the LAST entry in the \\`plugins\\` array of your \\`babel.config.js\\`, ` +\n `then restart Metro with a fresh cache: \\`npx expo start -c\\` or \\`npx react-native start --reset-cache\\`.`,\n )\n }\n}\n","import {\n type ComponentType,\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport Animated, {\n interpolateColor,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n type SharedValue,\n} from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { isFocusVisible } from '../gestures'\nimport { resolveLayoutTransition, type LayoutProp } from '../layout'\nimport { usePresence } from '../presence'\nimport {\n isTopLevelTransition,\n resolveAnimatableValue,\n resolveTransition,\n stableSig,\n} from '../transitions'\nimport { ensureReanimatedInstalled } from './installCheck'\nimport {\n type AnimatableValue,\n type AnimateStyle,\n type AnimationCallbackInfo,\n type GestureLayerTransitions,\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 'rotateX',\n 'rotateY',\n] as const\n\n// Rotation keys land in the transform array as `{ rotate: '45deg' }` / `{\n// rotateX: '45deg' }` etc. — Reanimated needs the unit-suffixed string form.\n// We hold the underlying shared value as a plain number (degrees) and wrap\n// in the worklet so the resolver pipeline stays uniform with the other\n// numeric transform keys.\nconst ROTATION_KEYS = new Set<string>(['rotate', 'rotateX', 'rotateY'])\n\nconst NUMERIC_TOP_LEVEL_KEYS = [\n 'opacity',\n 'width',\n 'height',\n 'borderRadius',\n 'shadowOpacity',\n 'shadowRadius',\n 'elevation',\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 'shadowColor',\n] as const\n\n// Synthetic axes for the `shadowOffset: { width, height }` nested-object style\n// prop. RN doesn't surface these as top-level keys; the worklet recomposes\n// `shadowOffset` from the two synthetic SVs before emitting the style. The\n// consumer's animate value (`shadowOffset: { width, height }`) decomposes into\n// these at the activation / value-driving boundary; consumers don't write\n// these keys directly.\nconst SHADOW_OFFSET_KEYS = ['shadowOffsetWidth', 'shadowOffsetHeight'] 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 ...SHADOW_OFFSET_KEYS,\n] as const\ntype AnimatableKey = (typeof ALL_KEYS)[number]\ntype TransformKey = (typeof TRANSFORM_KEYS)[number]\ntype ShadowOffsetKey = (typeof SHADOW_OFFSET_KEYS)[number]\n\nconst TRANSFORM_KEY_SET = new Set<AnimatableKey>(TRANSFORM_KEYS)\nconst COLOR_KEY_SET = new Set<AnimatableKey>(COLOR_KEYS)\nconst SHADOW_OFFSET_KEY_SET = new Set<AnimatableKey>(SHADOW_OFFSET_KEYS)\n\nconst GESTURE_LAYER_NAMES = [\n 'hovered',\n 'focused',\n 'focusVisible',\n 'pressed',\n] as const\ntype GestureLayerName = (typeof GESTURE_LAYER_NAMES)[number]\nconst GESTURE_LAYER_NAME_SET = new Set<string>(GESTURE_LAYER_NAMES)\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 rotateX: 0,\n rotateY: 0,\n opacity: 1,\n width: 0,\n height: 0,\n borderRadius: 0,\n shadowOpacity: 0,\n shadowRadius: 0,\n elevation: 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 shadowColor: 'transparent',\n shadowOffsetWidth: 0,\n shadowOffsetHeight: 0,\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 // Gesture-layer keys (`pressed`, `hovered`, …) live on the same map as\n // per-property keys; skip them when looking up a property transition so a\n // user who wires `transition.pressed` doesn't accidentally apply that to a\n // style key named `pressed` (none currently exist, but keep the lookup\n // honest).\n if (GESTURE_LAYER_NAME_SET.has(prop as string)) return undefined\n return (transition as PerPropertyTransition<S>)[prop]\n}\n\nfunction gestureLayerTransitionFor<S>(\n layer: GestureLayerName,\n transition: Transition<S> | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return (transition as GestureLayerTransitions)[layer]\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 */\n// `ComponentType<any>` is React's canonical \"accept any component\" idiom.\n// `unknown` doesn't work — props need to widen to whatever `C` actually accepts\n// at the call site. The two `any` uses below are deliberate.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createMotionComponent<C extends ComponentType<any>>(\n Component: C,\n): MotionComponent<C> {\n ensureReanimatedInstalled()\n\n const AnimatedComponent = Animated.createAnimatedComponent(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 layout,\n onAnimationEnd,\n style,\n ...rest\n } = props as Props & { style?: unknown; layout?: LayoutProp }\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 InternalAnimateRecord\n const initialRecord =\n initial && initial !== false\n ? (initial as InternalInitialRecord)\n : undefined\n const exitRecord = exit ? (exit as InternalAnimateRecord) : undefined\n\n // Gesture sub-state activation tracked as JS state. Activation flips drive\n // the per-layer progress shared values (0↔1); they intentionally do NOT\n // re-run the value-driving effect — gesture sub-state targets live on the\n // worklet's composition chain, not on the base `animate` SV.\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/focusVisible/hovered targets can drive any key they\n // declare even when the base `animate` doesn't touch it.\n const activeKeysRef = useRef<readonly AnimatableKey[] | null>(null)\n if (activeKeysRef.current === null) {\n const touched = new Set<AnimatableKey>()\n collectTouchedKeys(touched, animateRecord)\n if (initialRecord) collectTouchedKeys(touched, initialRecord)\n if (variants) {\n for (const variant of Object.values(variants) as object[]) {\n if (!variant) continue\n collectTouchedKeys(touched, variant as Record<string, unknown>)\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 collectTouchedKeys(touched, subState as Record<string, unknown>)\n }\n }\n if (exitRecord) collectTouchedKeys(touched, exitRecord)\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 const hasShadowOffsetRef = useRef<boolean>(\n activeKeysRef.current.some((k) => SHADOW_OFFSET_KEY_SET.has(k)),\n )\n\n const sharedValues = useAnimatableSharedValues((key) => {\n // Shadow offset synthetics seed from the corresponding axis on the\n // `shadowOffset: { width, height }` source — the consumer doesn't write\n // `shadowOffsetWidth` / `shadowOffsetHeight` directly. Fall back to the\n // generic resting default when neither initial nor animate touched it.\n if (SHADOW_OFFSET_KEY_SET.has(key)) {\n const axis = shadowOffsetAxisFor(key as ShadowOffsetKey)\n if (initial === false) {\n return (\n shadowOffsetAxisValue(animateRecord.shadowOffset, axis) ??\n DEFAULT_RESTING[key]\n )\n }\n return (\n shadowOffsetAxisValue(\n initialRecord?.shadowOffset as\n | { width?: number; height?: number }\n | undefined,\n axis,\n ) ??\n shadowOffsetAxisValue(animateRecord.shadowOffset, axis) ??\n DEFAULT_RESTING[key]\n )\n }\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 // One progress SV per gesture layer, allocated unconditionally for hook\n // stability. Each layer's progress animates 0↔1 with its own transition\n // when its activation flips; the worklet reads them when compositing.\n // Initial value is 0 — even if a sub-state is somehow active on mount,\n // the activation effect below will animate it to 1 on the next tick.\n const pressedProgress = useSharedValue(0)\n const focusedProgress = useSharedValue(0)\n const focusVisibleProgress = useSharedValue(0)\n const hoveredProgress = useSharedValue(0)\n\n // Mirror gesture targets into a UI-runtime-resident shared value so the\n // animated-style worklet can read the latest layer values without having\n // to capture `gesture` directly (which would re-register the worklet on\n // every render where the consumer passes a fresh literal). The signature\n // dependency means we only push to the SV when targets actually change —\n // the SV ref itself is stable across renders.\n //\n // The resolved value is a layer-keyed map of primitive endpoints (numbers\n // or color strings); sequence/`{ to }` step shapes on a sub-state collapse\n // to their final endpoint via `targetEndValue` because a gesture layer\n // describes a steady target, not a keyframe sequence.\n const gestureSV = useSharedValue<ResolvedGestureLayers | null>(\n resolveGestureLayers(gesture),\n )\n const gestureTargetsSig = stableSig(gesture)\n useEffect(() => {\n gestureSV.value = resolveGestureLayers(gesture)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [gestureTargetsSig])\n\n // The base record drives the per-key shared values. Gesture sub-state\n // targets are intentionally NOT merged here — they layer on top in the\n // worklet. Exit values still take precedence over `animate` while exiting\n // because the base SV is what <Presence> waits on to settle.\n const baseRecord =\n isExiting && exitRecord\n ? { ...animateRecord, ...exitRecord }\n : animateRecord\n const baseSig =\n stableSig(baseRecord) +\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) && baseRecord[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 // Shadow offset synthetics read their target from the nested\n // `shadowOffset: { width, height }` source on `baseRecord` — the\n // animate / exit record never has `shadowOffsetWidth` etc. on it\n // directly. The synthetic transition follows the same `shadowOffset`\n // top-level transition entry (no per-axis split).\n const target: AnimatableValue<number | string> | undefined =\n SHADOW_OFFSET_KEY_SET.has(key)\n ? shadowOffsetAxisValue(\n baseRecord.shadowOffset,\n shadowOffsetAxisFor(key as ShadowOffsetKey),\n )\n : baseRecord[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(\n SHADOW_OFFSET_KEY_SET.has(key)\n ? ('shadowOffset' as keyof typeof baseRecord)\n : key,\n transition,\n )\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 }, [baseSig, transitionSig])\n\n // Per-layer progress: when a sub-state activation flips, animate its\n // progress SV 0↔1 with the layer's own transition (or the parent\n // transition / library default, in priority order). On exit we snap every\n // layer to 0 instantly so the unmount-bound base SV isn't fighting a\n // stale layer contribution mid-fade.\n //\n // The `declared` flag short-circuits the effect when the consumer hasn't\n // wired the corresponding sub-state — so a Motion primitive without a\n // `gesture` prop (or with only some sub-states declared) makes zero extra\n // `withSpring` / `withTiming` calls on mount.\n useGestureLayerProgress(\n pressedProgress,\n pressed,\n gesture?.pressed != null,\n 'pressed',\n transition,\n isExiting,\n shouldReduceMotion,\n )\n useGestureLayerProgress(\n focusedProgress,\n focused,\n gesture?.focused != null,\n 'focused',\n transition,\n isExiting,\n shouldReduceMotion,\n )\n useGestureLayerProgress(\n focusVisibleProgress,\n focusVisible,\n gesture?.focusVisible != null,\n 'focusVisible',\n transition,\n isExiting,\n shouldReduceMotion,\n )\n useGestureLayerProgress(\n hoveredProgress,\n hovered,\n gesture?.hovered != null,\n 'hovered',\n transition,\n isExiting,\n shouldReduceMotion,\n )\n\n const animatedStyle = useAnimatedStyle(() => {\n const activeKeys = activeKeysRef.current!\n const hasTransform = hasTransformRef.current\n const hasShadowOffset = hasShadowOffsetRef.current\n const out: Record<string, unknown> = {}\n const transform: Array<Record<string, unknown>> = []\n // shadow-offset reassembly buffers. The two synthetic axis SVs feed in\n // here and the recomposed `{ width, height }` object lands on `out`\n // after the loop so RN gets a single `shadowOffset` style prop.\n let shadowOffsetW = 0\n let shadowOffsetH = 0\n\n // Read each progress SV exactly once so the chain below sees a coherent\n // snapshot for this frame. Reading them on the UI thread is cheap.\n const ph = hoveredProgress.value\n const pf = focusedProgress.value\n const pfv = focusVisibleProgress.value\n const pp = pressedProgress.value\n\n const layers = gestureSV.value\n // Locals are suffixed `Layer` so they don't shadow the outer `pressed` /\n // `focused` / `focusVisible` / `hovered` JS-state booleans — Reanimated's\n // worklet closure tracker would otherwise pick those up as captured\n // dependencies and re-register the worklet on every activation flip.\n const hoveredLayer = layers ? layers.hovered : null\n const focusedLayer = layers ? layers.focused : null\n const focusVisibleLayer = layers ? layers.focusVisible : null\n const pressedLayer = layers ? layers.pressed : null\n\n for (const key of activeKeys) {\n let v = sharedValues[key].value\n const isColor = COLOR_KEY_SET.has(key)\n\n // Composite gesture layers in priority order (lowest first). Each\n // active layer pulls the value toward its pre-resolved primitive\n // endpoint by `progress`; numeric keys lerp, color keys go through\n // Reanimated's RGBA `interpolateColor`. We skip layers with progress\n // 0 to avoid an `interpolateColor(0, ...)` call that would parse the\n // target color string for no visible effect.\n if (hoveredLayer && ph > 0 && hoveredLayer[key] !== undefined) {\n const t = hoveredLayer[key]\n v = isColor\n ? interpolateColor(ph, [0, 1], [v as string, t as string])\n : (v as number) + ((t as number) - (v as number)) * ph\n }\n if (focusedLayer && pf > 0 && focusedLayer[key] !== undefined) {\n const t = focusedLayer[key]\n v = isColor\n ? interpolateColor(pf, [0, 1], [v as string, t as string])\n : (v as number) + ((t as number) - (v as number)) * pf\n }\n if (\n focusVisibleLayer &&\n pfv > 0 &&\n focusVisibleLayer[key] !== undefined\n ) {\n const t = focusVisibleLayer[key]\n v = isColor\n ? interpolateColor(pfv, [0, 1], [v as string, t as string])\n : (v as number) + ((t as number) - (v as number)) * pfv\n }\n if (pressedLayer && pp > 0 && pressedLayer[key] !== undefined) {\n const t = pressedLayer[key]\n v = isColor\n ? interpolateColor(pp, [0, 1], [v as string, t as string])\n : (v as number) + ((t as number) - (v as number)) * pp\n }\n\n if (TRANSFORM_KEY_SET.has(key)) {\n transform.push(\n ROTATION_KEYS.has(key) ? { [key]: `${v}deg` } : { [key]: v },\n )\n } else if (key === 'shadowOffsetWidth') {\n shadowOffsetW = v as number\n } else if (key === 'shadowOffsetHeight') {\n shadowOffsetH = v as number\n } else {\n out[key] = v\n }\n }\n if (hasTransform) out.transform = transform\n if (hasShadowOffset) {\n out.shadowOffset = { width: shadowOffsetW, height: shadowOffsetH }\n }\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 // Resolve the `layout` prop into a Reanimated `LinearTransition` builder.\n // Memoized on the value's stable signature so a fresh `layout={true}` or\n // `layout={{ ... }}` literal each render doesn't rebuild the builder. When\n // reduced motion is active we pass `undefined` — see `resolveLayout` for\n // why we don't pass a duration-0 builder instead.\n const layoutSig = stableSig(layout)\n const layoutTransition = useMemo(\n () => (shouldReduceMotion ? undefined : resolveLayoutTransition(layout)),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [layoutSig, shouldReduceMotion],\n )\n\n return (\n <AnimatedComponent\n ref={ref as never}\n {...(rest as object)}\n {...gestureHandlers}\n layout={layoutTransition}\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 rotateX = useSharedValue<number | string>(init('rotateX'))\n const rotateY = useSharedValue<number | string>(init('rotateY'))\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 shadowOpacity = useSharedValue<number | string>(init('shadowOpacity'))\n const shadowRadius = useSharedValue<number | string>(init('shadowRadius'))\n const elevation = useSharedValue<number | string>(init('elevation'))\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 const shadowColor = useSharedValue<number | string>(init('shadowColor'))\n const shadowOffsetWidth = useSharedValue<number | string>(\n init('shadowOffsetWidth'),\n )\n const shadowOffsetHeight = useSharedValue<number | string>(\n init('shadowOffsetHeight'),\n )\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 rotateX,\n rotateY,\n opacity,\n width,\n height,\n borderRadius,\n shadowOpacity,\n shadowRadius,\n elevation,\n backgroundColor,\n borderColor,\n color,\n tintColor,\n shadowColor,\n shadowOffsetWidth,\n shadowOffsetHeight,\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 * Internal shape of the `animate` / `exit` record after the cast, widened to\n * include the `shadowOffset: { width, height }` nested-object source. The\n * nested object decomposes into the `shadowOffsetWidth` / `shadowOffsetHeight`\n * synthetic axes downstream; consumers don't see the synthetics.\n *\n * v0.1 contract: `shadowOffset` accepts a single `{ width, height }` literal\n * (no sequences, no `{ to }` step objects, no array keyframes). Sequence\n * forms on the nested axes can land in v0.2 if real consumers ask for them.\n */\ntype InternalAnimateRecord = Partial<\n Record<AnimatableKey, AnimatableValue<number | string>>\n> & {\n shadowOffset?: { width?: number; height?: number }\n}\n\ntype InternalInitialRecord = Partial<Record<AnimatableKey, number | string>> & {\n shadowOffset?: { width?: number; height?: number }\n}\n\n/**\n * Resolve a `shadowOffsetWidth` / `shadowOffsetHeight` synthetic key to the\n * axis it represents on the nested-object source.\n */\nfunction shadowOffsetAxisFor(key: ShadowOffsetKey): 'width' | 'height' {\n return key === 'shadowOffsetWidth' ? 'width' : 'height'\n}\n\n/**\n * Read a single axis off a `shadowOffset: { width, height }` source. Returns\n * `undefined` when the source is absent or the axis isn't set, so callers can\n * fall back to the next source in the precedence chain.\n */\nfunction shadowOffsetAxisValue(\n source: { width?: number; height?: number } | undefined,\n axis: 'width' | 'height',\n): number | undefined {\n return source?.[axis]\n}\n\n/**\n * Populate `touched` with the `AnimatableKey`s mentioned in `record`. Direct\n * matches (e.g. `opacity`, `width`) come from the key iteration; the nested\n * `shadowOffset` source decomposes into the two `shadowOffset*` synthetics.\n */\nfunction collectTouchedKeys(\n touched: Set<AnimatableKey>,\n record: Record<string, unknown>,\n): void {\n for (const k of ALL_KEYS) {\n if (k in record) touched.add(k)\n }\n if ('shadowOffset' in record && record.shadowOffset) {\n const so = record.shadowOffset as { width?: unknown; height?: unknown }\n if (so.width !== undefined) touched.add('shadowOffsetWidth')\n if (so.height !== undefined) touched.add('shadowOffsetHeight')\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\n/**\n * Per-layer resolved targets: each declared gesture sub-state collapses to a\n * map of primitive endpoints (numbers or color strings), already passed\n * through `targetEndValue` so the worklet can use them directly without\n * inspecting `AnimatableValue` shapes on the UI thread.\n */\ntype ResolvedGestureLayers = {\n pressed?: Record<string, number | string>\n focused?: Record<string, number | string>\n focusVisible?: Record<string, number | string>\n hovered?: Record<string, number | string>\n}\n\nfunction resolveGestureLayers(\n gesture: GestureSubStates<unknown> | undefined,\n): ResolvedGestureLayers | null {\n if (!gesture) return null\n const out: ResolvedGestureLayers = {}\n for (const layer of GESTURE_LAYER_NAMES) {\n const subState = gesture[layer]\n if (!subState) continue\n const resolved: Record<string, number | string> = {}\n for (const key of ALL_KEYS) {\n // Shadow offset synthetics decompose from the nested `shadowOffset:\n // { width, height }` source on the sub-state, the same as on `animate`.\n if (SHADOW_OFFSET_KEY_SET.has(key)) {\n const axis = shadowOffsetAxisFor(key as ShadowOffsetKey)\n const so = (\n subState as { shadowOffset?: { width?: number; height?: number } }\n ).shadowOffset\n const v = shadowOffsetAxisValue(so, axis)\n if (v !== undefined) resolved[key] = v\n continue\n }\n const raw = (subState as Record<string, unknown>)[key]\n if (raw === undefined) continue\n const t = targetEndValue(raw as AnimatableValue<number | string>)\n if (t !== undefined) resolved[key] = t\n }\n out[layer] = resolved\n }\n return out\n}\n\n/**\n * Drive a single gesture layer's progress shared value 0↔1 with its own\n * transition. Resolution priority for the layer config:\n * `transition.<layerName>` → top-level `transition` → library default spring.\n * On exit, snap to 0 instantly so the unmount-bound base SV finishes its exit\n * animation without a stale layer pulling the value off-target.\n *\n * The hook is invoked unconditionally (one call per layer) so hook order\n * stays stable even when `gesture` adds or removes sub-states across renders.\n */\nfunction useGestureLayerProgress<S>(\n progress: SharedValue<number>,\n active: boolean,\n declared: boolean,\n layer: GestureLayerName,\n transition: Transition<S> | undefined,\n isExiting: boolean,\n shouldReduceMotion: boolean,\n): void {\n const layerCfgSig = stableSig(gestureLayerTransitionFor(layer, transition))\n useEffect(() => {\n if (!declared) return\n if (isExiting) {\n progress.value = 0\n return\n }\n const target = active ? 1 : 0\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (gestureLayerTransitionFor(layer, transition) ??\n ({ type: 'spring' } as const))\n progress.value = resolveTransition(cfg, target) as never\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [active, declared, isExiting, shouldReduceMotion, layerCfgSig])\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 // Deps key on declared-ness, not object identity — a fresh `gesture={...}`\n // literal each render must not rebuild handlers if the same sub-states are\n // declared.\n const hasPressed = gesture?.pressed ? 1 : 0\n const hasFocused = gesture?.focused ? 1 : 0\n const hasFocusVisible = gesture?.focusVisible ? 1 : 0\n const hasHovered = gesture?.hovered ? 1 : 0\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 hasPressed,\n hasFocused,\n hasFocusVisible,\n hasHovered,\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 { useEffect } from 'react'\nimport { useSharedValue, type SharedValue } from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { resolveTransition, stableSig } from '../transitions'\nimport { type TransitionConfig } from '../types'\n\n/**\n * Drive a `SharedValue<number>` toward `target` with **any** transition shape\n * — spring, timing, decay, or no-animation. The general-purpose value-layer\n * hook: reach for it when you need raw `useSharedValue + useEffect + withX`\n * outside the declarative `animate` flow.\n *\n * Re-runs whenever `target` changes shape (`target` is in the dep array) or\n * the transition signature changes (kept stable via JSON-style hashing).\n * Reduced motion (via `<MotionConfig reducedMotion>`) collapses the\n * transition to `no-animation` so the value snaps instead of interpolating.\n *\n * **Spring shorthand.** Prefer [`useSpring`](./useSpring) when you only want\n * spring physics — it accepts the same `tension`/`friction`/`mass` config and\n * also supports a `SharedValue<number>` as the target (UI-thread reactive\n * source). `useAnimation` is JS-thread-driven only.\n *\n * **Loops.** Repeat is part of `TransitionConfig` and flows through\n * untouched — `useAnimation(1, { type: 'timing', duration: 1800, repeat: {\n * count: 'infinite', alternate: false } })` produces an indeterminate-style\n * progress driver.\n *\n * @example\n * ```ts\n * // Toggle progress (Switch / Checkbox / Radio).\n * const progress = useAnimation(isChecked ? 1 : 0, {\n * type: 'spring',\n * tension: 380,\n * friction: 33,\n * })\n *\n * // Float a TextField label when the value becomes non-empty.\n * const floated = useAnimation(hasValue ? 1 : 0, {\n * type: 'timing',\n * duration: 150,\n * })\n *\n * // Indeterminate progress slider (loops forever, snaps back).\n * const slide = useAnimation(1, {\n * type: 'timing',\n * duration: 1800,\n * repeat: { count: 'infinite', alternate: false },\n * })\n * ```\n */\nexport function useAnimation(\n target: number,\n transition?: TransitionConfig,\n): SharedValue<number> {\n const output = useSharedValue<number>(target)\n const shouldReduceMotion = useShouldReduceMotion()\n const cfgSig = stableSig(transition)\n\n useEffect(() => {\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (transition ?? ({ type: 'spring' } as const))\n output.value = resolveTransition(cfg, target) as never\n // `output` is identity-stable per hook instance.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [target, cfgSig, shouldReduceMotion])\n\n return output\n}\n","import { useCallback, useMemo } from 'react'\nimport { useSharedValue, type SharedValue } from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { isFocusVisible } from '../gestures'\nimport { isTopLevelTransition, resolveTransition } from '../transitions'\nimport { type GestureLayerTransitions, type TransitionConfig } from '../types'\n\ntype LayerName = 'pressed' | 'focused' | 'focusVisible' | 'hovered'\n\n/**\n * Handler bag returned by `useGesture`. Spread on a `Pressable` to drive the\n * shared values returned alongside.\n *\n * Hover handlers use `Pressable`'s own `onHoverIn` / `onHoverOut` names (web\n * only — no-ops on native). `onFocus` consults `isFocusVisible()` before\n * raising the keyboard-only `focusVisible` layer; `focused` always raises.\n */\nexport interface UseGestureHandlers {\n onPressIn: () => void\n onPressOut: () => void\n onHoverIn: () => void\n onHoverOut: () => void\n onFocus: () => void\n onBlur: () => void\n}\n\nexport interface UseGestureResult {\n /** 0↔1 progress for the pressed layer. */\n pressed: SharedValue<number>\n /** 0↔1 progress for the focused layer (any focus modality). */\n focused: SharedValue<number>\n /** 0↔1 progress for the focusVisible layer (keyboard focus only). */\n focusVisible: SharedValue<number>\n /** 0↔1 progress for the hovered layer (web only — stays at 0 on native). */\n hovered: SharedValue<number>\n /** Handlers to spread on the receiving `Pressable`. */\n handlers: UseGestureHandlers\n}\n\n/**\n * Build a gesture-layer controller. The hook-form of the `gesture` prop —\n * reach for it when you need to drive multiple animated views from the same\n * gesture state (a focus ring + state-layer halo + content tint all on one\n * Pressable), which the prop-form's \"animate the receiver's own style\" model\n * can't express.\n *\n * Returns four 0↔1 shared values (one per layer) and a handler bag to spread\n * on a `Pressable`. The shared values are stable across renders — feed them\n * into any number of `useAnimatedStyle` blocks anywhere in the tree.\n *\n * Transitions follow the same shape as the `gesture` prop's accompanying\n * `transition`: pass a single `TransitionConfig` to use for every layer, or a\n * `GestureLayerTransitions` map to give each layer its own. Layers without an\n * explicit transition fall back to the library default spring.\n *\n * Reduced motion (via `<MotionConfig reducedMotion>`) collapses every\n * transition to `no-animation` so state changes snap instead of interpolating\n * — same behaviour the gesture prop applies.\n *\n * @example\n * ```tsx\n * import { useAnimatedStyle } from 'react-native-reanimated'\n * import { useGesture } from '@onlynative/inertia'\n *\n * function Card() {\n * const { pressed, focused, hovered, handlers } = useGesture({\n * pressed: { type: 'timing', duration: 100 },\n * hovered: { type: 'timing', duration: 150 },\n * focused: { type: 'timing', duration: 200 },\n * })\n *\n * const ringStyle = useAnimatedStyle(() => ({ opacity: focused.value }))\n * const haloStyle = useAnimatedStyle(() => ({\n * opacity: Math.max(\n * hovered.value * 0.08,\n * focused.value * 0.10,\n * pressed.value * 0.10,\n * ),\n * }))\n *\n * return (\n * <Pressable {...handlers}>\n * <Animated.View style={ringStyle} />\n * <Animated.View style={haloStyle} />\n * </Pressable>\n * )\n * }\n * ```\n */\nexport function useGesture(\n transition?: TransitionConfig | GestureLayerTransitions,\n): UseGestureResult {\n const pressed = useSharedValue(0)\n const focused = useSharedValue(0)\n const focusVisible = useSharedValue(0)\n const hovered = useSharedValue(0)\n const shouldReduceMotion = useShouldReduceMotion()\n\n const setLayer = useCallback(\n (sv: SharedValue<number>, layer: LayerName, target: 0 | 1) => {\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (layerTransition(layer, transition) ?? ({ type: 'spring' } as const))\n sv.value = resolveTransition(cfg, target) as never\n },\n // The transition is intentionally read on every call rather than cooked\n // into the dep array — a fresh literal each render would otherwise\n // rebuild the handler bag and break composing consumers that key off\n // handler identity. `transition` is read inside the callback closure;\n // shared values are stable so the only dep that matters is the reduce-\n // motion flag.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [shouldReduceMotion],\n )\n\n const handlers = useMemo<UseGestureHandlers>(\n () => ({\n onPressIn: () => setLayer(pressed, 'pressed', 1),\n onPressOut: () => setLayer(pressed, 'pressed', 0),\n onHoverIn: () => setLayer(hovered, 'hovered', 1),\n onHoverOut: () => setLayer(hovered, 'hovered', 0),\n onFocus: () => {\n setLayer(focused, 'focused', 1)\n if (isFocusVisible()) setLayer(focusVisible, 'focusVisible', 1)\n },\n onBlur: () => {\n setLayer(focused, 'focused', 0)\n setLayer(focusVisible, 'focusVisible', 0)\n },\n }),\n [setLayer, pressed, focused, focusVisible, hovered],\n )\n\n return { pressed, focused, focusVisible, hovered, handlers }\n}\n\nfunction layerTransition(\n layer: LayerName,\n transition: TransitionConfig | GestureLayerTransitions | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return (transition as GestureLayerTransitions)[layer]\n}\n","import { useSharedValue, type SharedValue } from 'react-native-reanimated'\n\n/**\n * Create an animatable value owned by JS but readable from worklets.\n *\n * This is the escape-hatch primitive that the rest of the value-layer hooks\n * (`useSpring`, `useTransform`, `useScroll`) compose against. It is a thin\n * pass-through over Reanimated's `useSharedValue`: a `SharedValue<T>` with\n * `.value` for direct reads/writes (UI-thread reads in worklets, JS-thread\n * writes from event handlers / effects).\n *\n * We intentionally do not introduce a `MotionValue` wrapper class around the\n * shared value. The simplest object that interops with `useAnimatedStyle`,\n * `useDerivedValue`, and every other Reanimated API _is_ the shared value\n * itself; adding a `{ get, set, value }` shell would force consumers to\n * unwrap it at every Reanimated boundary and break worklet capture.\n *\n * Worklet read:\n * ```ts\n * const x = useMotionValue(0)\n * useAnimatedStyle(() => ({ transform: [{ translateX: x.value }] }))\n * ```\n *\n * JS write:\n * ```ts\n * onPress={() => { x.value = 100 }}\n * ```\n */\nexport function useMotionValue<T extends number | string>(\n initial: T,\n): SharedValue<T> {\n return useSharedValue<T>(initial)\n}\n","import { useEffect, useMemo } from 'react'\nimport {\n useAnimatedReaction,\n useSharedValue,\n withSpring,\n type SharedValue,\n} from 'react-native-reanimated'\nimport { springToReanimated } from '../transitions/spring'\nimport { type SpringTransition } from '../types'\n\n/**\n * Animate a shared value toward `target` with spring physics, using the\n * library's react-spring vocabulary (`tension` / `friction` / `mass`).\n *\n * `target` may be a plain number or a `SharedValue<number>`. The plain-number\n * path drives the spring from a JS `useEffect`, so the animation re-runs on\n * every render where `target` changes. The shared-value path drives the\n * spring from a Reanimated reaction on the UI thread, so values produced by\n * gestures, scroll handlers, or other worklets flow through without bouncing\n * back to JS.\n *\n * Both call sites end up at the same `withSpring` invocation; the split is\n * just about which thread observes the source change.\n */\nexport function useSpring(\n target: number | SharedValue<number>,\n config?: SpringTransition,\n): SharedValue<number> {\n // Reanimated config is rebuilt only when the public config object changes\n // shape. The worklet path reads this from JS-thread closure capture, which\n // is fine: it's the resolved config that's invariant across UI-thread\n // ticks, not a JS-thread reference that would go stale.\n const reanimConfig = useMemo(\n () => springToReanimated(config ?? {}),\n [\n config?.tension,\n config?.friction,\n config?.mass,\n config?.velocity,\n config?.restSpeedThreshold,\n config?.restDisplacementThreshold,\n ],\n )\n\n const isSharedTarget = isSharedValue(target)\n const initial = isSharedTarget ? target.value : (target as number)\n const output = useSharedValue<number>(initial)\n\n // Plain-number path. The reaction below is a no-op when `target` is a\n // number, so this effect carries the change. Reading `target` directly in\n // the dep array means React drives the schedule; we don't have to babysit\n // a stale closure.\n useEffect(() => {\n if (isSharedTarget) return\n output.value = withSpring(target as number, reanimConfig)\n // `output` is identity-stable per hook instance (Reanimated guarantee).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isSharedTarget, target, reanimConfig])\n\n // SharedValue path. `useAnimatedReaction` runs the prepare worklet whenever\n // its returned value changes; we read `.value` off the target SV and pipe\n // it through `withSpring` on the UI thread. When the target is a plain\n // number we never declare a source so the reaction is inert (returns\n // `null`, never fires `react`).\n useAnimatedReaction(\n () => {\n 'worklet'\n if (!isSharedTarget) return null\n return (target as SharedValue<number>).value\n },\n (next, prev) => {\n 'worklet'\n if (next === null || next === prev) return\n output.value = withSpring(next, reanimConfig)\n },\n [isSharedTarget, reanimConfig],\n )\n\n return output\n}\n\nfunction isSharedValue(v: unknown): v is SharedValue<number> {\n // SharedValues are plain objects with a single `value` accessor — there is\n // no public constructor or instanceof check. Reading `'value' in v` on any\n // POJO would also pass, but the hook's call site already narrows the type;\n // this guard exists to dispatch between the two implementation paths, not\n // to validate untrusted input.\n return (\n typeof v === 'object' &&\n v !== null &&\n 'value' in (v as Record<string, unknown>)\n )\n}\n","import {\n Extrapolation,\n interpolate,\n interpolateColor,\n useDerivedValue,\n type SharedValue,\n} from 'react-native-reanimated'\n// `isWorkletFunction` was re-exported from `react-native-reanimated` historically\n// but is deprecated there in favor of importing from `react-native-worklets`.\n// `react-native-worklets` is a required peer of Reanimated 4, so the direct\n// import is always available wherever Inertia is.\nimport { isWorkletFunction } from 'react-native-worklets'\n\n/**\n * Extrapolation behavior at the edges of the input range. Mirrors\n * Reanimated's enum so consumers don't need a separate import.\n *\n * - `'clamp'` (default) — output stays pinned at the first/last value\n * outside the input range. Matches Framer Motion's default.\n * - `'identity'` — return the input unchanged outside the range.\n * - `'extend'` — continue the linear slope beyond the range.\n */\nexport type ExtrapolationMode = 'clamp' | 'identity' | 'extend'\n\nexport interface UseTransformOptions {\n extrapolateLeft?: ExtrapolationMode\n extrapolateRight?: ExtrapolationMode\n}\n\n/**\n * Derive a value from one or more shared values via a transformer worklet.\n *\n * ```ts\n * const x = useMotionValue(0)\n * const y = useMotionValue(0)\n * const distance = useTransform(() => Math.sqrt(x.value ** 2 + y.value ** 2))\n * ```\n *\n * The transformer must be a worklet (or a plain function we auto-wrap —\n * see the easing wrapper for the rationale). It runs on the UI thread on\n * every frame where any read shared value changes.\n */\nexport function useTransform<T>(transformer: () => T): SharedValue<T>\n\n/**\n * Interpolate a numeric shared value onto a range of numbers or colors.\n *\n * ```ts\n * const scroll = useMotionValue(0)\n * const headerOpacity = useTransform(scroll, [0, 100], [1, 0])\n * const headerColor = useTransform(scroll, [0, 100], ['#fff', '#000'])\n * ```\n *\n * When `outputRange` is numeric, this maps to Reanimated's `interpolate`;\n * when it's a tuple of color strings, it maps to `interpolateColor`. The\n * input range must be monotonically increasing.\n */\nexport function useTransform(\n value: SharedValue<number>,\n inputRange: readonly number[],\n outputRange: readonly number[],\n options?: UseTransformOptions,\n): SharedValue<number>\nexport function useTransform(\n value: SharedValue<number>,\n inputRange: readonly number[],\n outputRange: readonly string[],\n options?: UseTransformOptions,\n): SharedValue<string>\n\nexport function useTransform<T>(\n arg1: (() => T) | SharedValue<number>,\n inputRange?: readonly number[],\n outputRange?: readonly number[] | readonly string[],\n options?: UseTransformOptions,\n): SharedValue<T> | SharedValue<number> | SharedValue<string> {\n // Build the producer worklet on the JS thread, then call\n // `useDerivedValue` exactly once. Keeping the hook call unconditional\n // satisfies rules-of-hooks; per-call branching (transformer vs\n // interpolation) is decided once at JS time, never at frame time.\n let producer: () => unknown\n if (typeof arg1 === 'function') {\n // Transformer overload. The public surface accepts a plain function;\n // Reanimated 3.9+ requires worklets in nested-derivation contexts, so\n // we auto-wrap at JS time the same way `ensureWorkletEasing` does.\n const userFn = arg1 as () => T\n producer = isWorkletFunction(userFn)\n ? userFn\n : () => {\n 'worklet'\n return userFn()\n }\n } else {\n // Interpolation overload. We pre-resolve everything JS-side so the\n // worklet body only consumes flat values.\n const source = arg1\n const input = inputRange as readonly number[]\n const output = outputRange as readonly (number | string)[]\n const isColor = output.length > 0 && typeof output[0] === 'string'\n const extrapolateLeft = mapExtrapolation(options?.extrapolateLeft)\n const extrapolateRight = mapExtrapolation(options?.extrapolateRight)\n producer = isColor\n ? () => {\n 'worklet'\n return interpolateColor(\n source.value,\n input as number[],\n output as string[],\n )\n }\n : () => {\n 'worklet'\n return interpolate(\n source.value,\n input as number[],\n output as number[],\n { extrapolateLeft, extrapolateRight },\n )\n }\n }\n\n return useDerivedValue(producer as () => never) as unknown as\n | SharedValue<T>\n | SharedValue<number>\n | SharedValue<string>\n}\n\nfunction mapExtrapolation(mode: ExtrapolationMode | undefined): Extrapolation {\n if (mode === 'identity') return Extrapolation.IDENTITY\n if (mode === 'extend') return Extrapolation.EXTEND\n return Extrapolation.CLAMP\n}\n","import {\n useAnimatedScrollHandler,\n useSharedValue,\n type SharedValue,\n} from 'react-native-reanimated'\nimport { type NativeScrollEvent, type NativeSyntheticEvent } from 'react-native'\n\nexport interface UseScrollResult {\n /** Horizontal scroll offset in points. */\n scrollX: SharedValue<number>\n /** Vertical scroll offset in points. */\n scrollY: SharedValue<number>\n /**\n * Handler to pass to a `Motion.ScrollView`'s `onScroll` prop (or any other\n * Reanimated `Animated.ScrollView`). The handler is opaque to JS — it runs\n * as a worklet — but the type narrows to the same shape RN's native\n * `onScroll` prop expects so it composes cleanly.\n */\n onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void\n}\n\n/**\n * Track the scroll offset of a `Motion.ScrollView` as shared values.\n *\n * ```tsx\n * const { scrollY, onScroll } = useScroll()\n * const headerOpacity = useTransform(scrollY, [0, 100], [1, 0])\n *\n * return (\n * <>\n * <Motion.View animate={{ opacity: headerOpacity }} />\n * <Motion.ScrollView onScroll={onScroll} scrollEventThrottle={16}>\n * …\n * </Motion.ScrollView>\n * </>\n * )\n * ```\n *\n * Scroll events fire on the UI thread, so `scrollX` / `scrollY` are safe to\n * read from any worklet (`useAnimatedStyle`, `useDerivedValue`,\n * `useTransform`) without a JS-thread bounce.\n *\n * Remember to set `scrollEventThrottle={16}` on the `ScrollView` for 60Hz\n * updates — RN's default is to dispatch on every event, which on iOS still\n * means one per frame, but Android benefits from the explicit cap.\n */\nexport function useScroll(): UseScrollResult {\n const scrollX = useSharedValue(0)\n const scrollY = useSharedValue(0)\n\n const handler = useAnimatedScrollHandler({\n onScroll: (event) => {\n 'worklet'\n scrollX.value = event.contentOffset.x\n scrollY.value = event.contentOffset.y\n },\n })\n\n // `useAnimatedScrollHandler` returns an opaque worklet bag whose JS-side\n // type is `(event) => void` but actually carries native event-handler\n // wiring. Cast through `unknown` because the public RN `onScroll` type\n // wants a `NativeSyntheticEvent`-taking function and Reanimated's handler\n // is structurally compatible — the cast is to satisfy the consumer's\n // prop type at the call site.\n return {\n scrollX,\n scrollY,\n onScroll: handler as unknown as (\n event: NativeSyntheticEvent<NativeScrollEvent>,\n ) => void,\n }\n}\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/transitions/easing.ts","../src/transitions/spring.ts","../src/layout/resolveLayout.ts","../src/layout/sharedRegistry.ts","../src/layout/useSharedLayout.ts","../src/presence/PresenceContext.ts","../src/presence/Presence.tsx","../src/transitions/resolve.ts","../src/transitions/keys.ts","../src/transitions/runtime.ts","../src/transitions/sig.ts","../src/motion/installCheck.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/useAnimation.ts","../src/values/useSpring.ts","../src/values/useBooleanSpring.ts","../src/values/useColorTransition.ts","../src/values/useGesture.ts","../src/values/useMotionValue.ts","../src/values/useTransform.ts","../src/values/useScroll.ts","../src/values/useShadow.ts","../src/values/useVariants.ts"],"names":["createContext","useContext","useReducedMotion","useMemo","jsx","Platform","isWorkletFunction","builder","LinearTransition","useSharedValue","useRef","useCallback","useEffect","withSequence","withTiming","withSpring","Children","isValidElement","useState","Fragment","Easing","withDecay","withRepeat","withDelay","step","DEFAULT_TIMING_DURATION","reanimatedVersion","probe","Animated","Motion","forwardRef","useAnimatedStyle","interpolateColor","runOnJS","Image","Pressable","ScrollView","Text","View","useAnimatedReaction","interpolate","useDerivedValue","Extrapolation","useAnimatedScrollHandler"],"mappings":";;;;;;;;;;;;;AAwBO,IAAM,qBAAA,GAA2C;AAAA,EACtD,aAAA,EAAe;AACjB,CAAA;AAEO,IAAM,mBAAA,GAAsBA,mBAAA;AAAA,EACjC;AACF,CAAA;AAMO,SAAS,eAAA,GAAqC;AACnD,EAAA,OAAOC,iBAAW,mBAAmB,CAAA;AACvC;AAQO,SAAS,qBAAA,GAAiC;AAC/C,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,eAAA,EAAgB;AAC1C,EAAA,MAAM,YAAYC,yBAAA,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,GAAQC,aAAA;AAAA,IACZ,OAAO,EAAE,aAAA,EAAc,CAAA;AAAA,IACvB,CAAC,aAAa;AAAA,GAChB;AACA,EAAA,uBACEC,cAAA,CAAC,mBAAA,CAAoB,QAAA,EAApB,EAA6B,OAC3B,QAAA,EACH,CAAA;AAEJ;ACLA,IAAI,QAAA,GAA0B,UAAA;AAC9B,I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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.js","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","// `isWorkletFunction` lives in `react-native-worklets` (the Reanimated 4 peer\n// dep); Reanimated's own re-export is deprecated.\nimport { isWorkletFunction } from 'react-native-worklets'\nimport { type EasingInput } from '../types'\n\n/**\n * Reanimated 3.9+ validates that easing functions used in nested-transition\n * contexts (variants, sequences, per-property maps) are worklets, and crashes\n * with `[Reanimated] The easing function is not a worklet` otherwise. The\n * library accepts plain functions on the public surface; this helper wraps\n * them so consumers don't have to think about the worklet boundary.\n *\n * If the input is already a worklet (has been processed by the worklets babel\n * plugin), it's returned as-is. Otherwise it's wrapped in a function whose\n * body declares the `'worklet'` directive — when our source is processed by\n * the consumer's worklets babel plugin (the default Expo/RN setup), the\n * wrapper becomes a real worklet that captures the user fn via closure.\n *\n * Reanimated 4 changed `Easing.bezier(...)` to return an\n * `EasingFunctionFactory` (`{ factory: () => EasingFunction }`) rather than\n * the function itself. The helper accepts both shapes — `EasingFunction` and\n * `EasingFunctionFactory` — and unwraps the factory automatically so\n * consumers don't have to call `.factory()` manually.\n *\n * The user fn must be pure: no JS-thread captured refs, no shared mutable\n * state, no calls to non-worklet APIs.\n */\nexport function ensureWorkletEasing(\n easing: EasingInput | undefined,\n): ((t: number) => number) | undefined {\n if (!easing) return undefined\n // Reanimated 4 `EasingFunctionFactory` — unwrap via `.factory()` before\n // checking worklet status, so the wrapped fn (not the factory wrapper)\n // ends up in the transition config.\n const fn = isEasingFactory(easing) ? easing.factory() : easing\n if (isWorkletFunction(fn)) return fn\n const wrapped = (t: number) => {\n 'worklet'\n return fn(t)\n }\n return wrapped\n}\n\nfunction isEasingFactory(\n value: EasingInput,\n): value is { factory: () => (t: number) => number } {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'factory' in value &&\n typeof (value as { factory: unknown }).factory === 'function'\n )\n}\n","import { type SpringTransition } from '../types'\n\n/**\n * Default spring physics, expressed in react-spring vocabulary.\n *\n * `tension: 170` / `friction: 26` / `mass: 1` was picked over Reanimated's\n * raw `stiffness: 100` / `damping: 10` default because the raw default\n * overshoots noticeably for the small (~100px) translates that dominate\n * UI work — buttons, sheets, popovers. These numbers settle in ~350ms with\n * a single, almost-imperceptible overshoot, which matches the perceptual\n * target the rest of the library is tuned against.\n */\nexport const DEFAULT_SPRING: Required<\n Pick<SpringTransition, 'tension' | 'friction' | 'mass'>\n> = {\n tension: 170,\n friction: 26,\n mass: 1,\n}\n\n/**\n * Convert public react-spring vocabulary (`tension` / `friction` / `mass`)\n * to Reanimated's raw `stiffness` / `damping` / `mass`. This is the single\n * place the mapping lives; resolvers, value hooks, and any future surface\n * that needs a Reanimated spring config import from here.\n *\n * The mapping is identity (tension ≡ stiffness, friction ≡ damping) — the\n * names differ but the underlying physics constants are the same. We don't\n * surface the raw names publicly because the react-spring vocabulary is\n * what designers and prior-art consumers expect.\n */\nexport function springToReanimated(t: SpringTransition) {\n 'worklet'\n return {\n stiffness: t.tension ?? DEFAULT_SPRING.tension,\n damping: t.friction ?? DEFAULT_SPRING.friction,\n mass: t.mass ?? DEFAULT_SPRING.mass,\n velocity: t.velocity,\n restSpeedThreshold: t.restSpeedThreshold,\n restDisplacementThreshold: t.restDisplacementThreshold,\n }\n}\n","import { LinearTransition } from 'react-native-reanimated'\nimport { ensureWorkletEasing } from '../transitions/easing'\nimport { DEFAULT_SPRING, springToReanimated } from '../transitions/spring'\nimport { type TransitionConfig } from '../types'\n\nexport type LayoutProp = boolean | TransitionConfig | undefined\n\n/**\n * Resolve the public `layout` prop into a Reanimated `LinearTransition` builder.\n *\n * - `undefined` / `false` / `{ type: 'no-animation' }` → `undefined` (no layout\n * animation; layout changes snap).\n * - `true` → default spring with the library's tuned tension / friction / mass.\n * - `{ type: 'spring', ... }` → spring with react-spring vocabulary, bridged\n * into `springify().damping().stiffness().mass()` via `springToReanimated`.\n * - `{ type: 'timing', ... }` → `.duration().easing()`. User easing fns are\n * auto-wrapped as worklets (Reanimated 3.9+ validates this).\n * - `{ type: 'decay', ... }` → silently downgrades to spring; decay doesn't\n * have a clear target for a layout transition.\n *\n * When `reducedMotion` is true the caller should pass `undefined` so the\n * underlying component renders without a layout animation at all. We choose\n * this over `LinearTransition.duration(0)` because Reanimated still runs the\n * commit-tracking machinery in that case; the snap path is genuinely cheaper.\n */\nexport function resolveLayoutTransition(\n layout: LayoutProp,\n): LinearTransition | undefined {\n if (!layout) return undefined\n\n const cfg: TransitionConfig = layout === true ? { type: 'spring' } : layout\n\n if (cfg.type === 'no-animation') return undefined\n\n if (cfg.type === 'timing') {\n let builder = LinearTransition.duration(cfg.duration ?? 300)\n const easing = ensureWorkletEasing(cfg.easing)\n if (easing) builder = builder.easing(easing)\n if (cfg.delay) builder = builder.delay(cfg.delay)\n return builder\n }\n\n const spring = cfg.type === 'decay' ? ({ type: 'spring' } as const) : cfg\n const { stiffness, damping, mass } = springToReanimated({\n ...DEFAULT_SPRING,\n ...spring,\n })\n let builder = LinearTransition.springify()\n .stiffness(stiffness)\n .damping(damping)\n .mass(mass)\n if ('delay' in spring && spring.delay) builder = builder.delay(spring.delay)\n return builder\n}\n","/**\n * Module-level registry of last-known on-screen rects for shared-layout\n * elements, indexed by `layoutId`. Backs `<Motion.* layoutId=\"...\" />` —\n * Reanimated 4 dropped the `sharedTransitionTag` API the previous design\n * relied on, so the cross-screen shared-element transition lives in\n * userland now.\n *\n * Lifecycle, per id:\n * 1. While a Motion primitive with `layoutId={id}` is mounted, every\n * `onLayout` updates the rect via `registerLayout`.\n * 2. When that primitive unmounts, the same rect is left behind under a\n * TTL via `releaseLayout` so a subsequent mount can consume it.\n * 3. The next mount calls `consumeLayout(id)` — if a fresh entry exists\n * it becomes the FLIP source rect; the entry is removed so a third\n * mount with the same id doesn't re-animate from a stale snapshot.\n *\n * Rects are stored in **parent-relative coordinates** (what `onLayout`'s\n * `nativeEvent.layout` reports). This composes for the common case where the\n * source and target share an outer content container — e.g. a typical stack\n * navigator. Nested-parent setups, where the two parents sit at different\n * window offsets, need a window-coordinate path (`measureInWindow`); that is\n * punted to v2 per the roadmap.\n */\n\n/** Parent-relative rect of a measured element (from `onLayout`). */\nexport interface SharedRect {\n x: number\n y: number\n width: number\n height: number\n}\n\ninterface Entry {\n rect: SharedRect\n expiresAt: number\n}\n\nconst REGISTRY = new Map<string, Entry>()\n\n/**\n * How long (ms) a released rect remains consumable. Sized to comfortably\n * cover a typical screen transition (slide animation, gesture-driven\n * dismiss) without leaving stale entries lying around if no incoming\n * mount picks them up.\n */\nexport const SHARED_LAYOUT_TTL_MS = 1000\n\n/**\n * Provide the current monotonic-ish timestamp. Indirected so tests can\n * stub it via `__setSharedLayoutClock` without touching `Date.now` globally.\n */\nlet now = (): number => Date.now()\n\n/**\n * Update the latest known rect for `id`. Called on every `onLayout` of a\n * Motion primitive with `layoutId` set so the registry always holds a\n * current measurement if that primitive becomes the source of a future\n * transition. Resets the TTL each call.\n */\nexport function registerLayout(id: string, rect: SharedRect): void {\n REGISTRY.set(id, { rect, expiresAt: now() + SHARED_LAYOUT_TTL_MS })\n}\n\n/**\n * Record the rect for `id` on unmount so the next mount can consume it as\n * the FLIP source. Functionally identical to `registerLayout` — the split\n * is purely intent-documenting at the call site.\n */\nexport function releaseLayout(id: string, rect: SharedRect): void {\n REGISTRY.set(id, { rect, expiresAt: now() + SHARED_LAYOUT_TTL_MS })\n}\n\n/**\n * Take the recorded rect for `id` if it exists and hasn't expired. The\n * entry is removed in either case — at most one incoming mount consumes\n * a given release, and an expired entry is dropped so it can't poison a\n * later transition. Returns `undefined` when no fresh source is available,\n * in which case the caller should mount without a layout animation.\n */\nexport function consumeLayout(id: string): SharedRect | undefined {\n const entry = REGISTRY.get(id)\n if (!entry) return undefined\n REGISTRY.delete(id)\n if (entry.expiresAt < now()) return undefined\n return entry.rect\n}\n\n/** Drop all entries. Tests use this to isolate between cases. */\nexport function clearSharedRegistry(): void {\n REGISTRY.clear()\n}\n\n/**\n * Inspect a registry entry without consuming it. Intended for tests and\n * dev tooling; production code should go through `consumeLayout`.\n */\nexport function peekSharedLayout(id: string): SharedRect | undefined {\n const entry = REGISTRY.get(id)\n if (!entry) return undefined\n if (entry.expiresAt < now()) return undefined\n return entry.rect\n}\n\n/**\n * Test hook: swap the clock used for TTL calculations. Pass `undefined` to\n * restore `Date.now`. Not exported from the package root — reachable only\n * from inside the workspace.\n */\nexport function __setSharedLayoutClock(fn: (() => number) | undefined): void {\n now = fn ?? Date.now\n}\n","import {\n type MutableRefObject,\n type Ref,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from 'react'\nimport { type LayoutChangeEvent } from 'react-native'\nimport {\n type SharedValue,\n useSharedValue,\n withSequence,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { DEFAULT_SPRING, springToReanimated } from '../transitions/spring'\nimport { type SpringTransition, type TransitionConfig } from '../types'\nimport {\n consumeLayout,\n registerLayout,\n releaseLayout,\n type SharedRect,\n} from './sharedRegistry'\n\n/**\n * Shared values produced by `useSharedLayout`. The worklet inside\n * `createMotionComponent` appends `translateX/Y` and `scaleX/Y` transforms\n * built from these so a shared-layout source rect maps onto the new\n * element's transform stack without conflicting with the user's `animate`\n * transforms — multiple transform entries of the same key compose\n * additively (for translates) and multiplicatively (for scales), which is\n * exactly the FLIP semantic.\n *\n * At rest the values are `(0, 0, 1, 1)` — the identity transform — so when\n * no shared-layout transition is active the worklet's contribution is a\n * no-op.\n */\nexport interface SharedLayoutValues {\n dx: SharedValue<number>\n dy: SharedValue<number>\n sx: SharedValue<number>\n sy: SharedValue<number>\n}\n\n/** What the host component needs to wire into its rendered tree. */\nexport interface SharedLayoutBindings {\n flip: SharedLayoutValues\n /**\n * Composite ref the consumer attaches to the rendered animated\n * component. Forwards the underlying ref to the user-supplied `ref`\n * (when present); kept as a stable callback so a `<Motion.*>` with no\n * `layoutId` doesn't pay anything extra.\n */\n setRef: (node: unknown) => void\n /** onLayout handler the consumer must attach to the animated component. */\n onLayout: (event: LayoutChangeEvent) => void\n}\n\n/**\n * Hook backing `<Motion.* layoutId=\"...\" />`.\n *\n * Responsibilities, in order:\n * 1. Allocate FLIP shared values (identity at rest).\n * 2. Track the latest layout rect via the `onLayout` event, and push it\n * into the registry under `layoutId` so this primitive can serve as\n * the source for a future transition.\n * 3. On unmount, hand the last measured rect to `releaseLayout` so the\n * next mount with the same id can consume it.\n * 4. On the first layout commit, consume any pending source rect and\n * drive the FLIP shared values: snap them to the (delta, scale) that\n * visually places the new element at the source position, then\n * animate back to identity. `withSequence(snap, animate)` keeps the\n * animation starting from the snapped delta rather than from zero.\n *\n * Coordinate space note: rects are in parent-relative coordinates (what\n * `onLayout` reports). For the common cross-screen navigator pattern —\n * both screens share an outer content container — parent-relative deltas\n * match what the user perceives. Nested-parent setups where the source\n * and target screens sit under containers at different screen offsets\n * will be off by that offset; v1 documents this and leaves a precise\n * window-coords path for v2.\n *\n * When `layoutId` is `undefined`, every callback is a no-op and the FLIP\n * shared values stay at identity — the host's worklet then skips the\n * transform contribution entirely.\n */\nexport function useSharedLayout(options: {\n layoutId: string | undefined\n userRef: Ref<unknown> | undefined\n transition: TransitionConfig | undefined\n shouldReduceMotion: boolean\n userOnLayout: ((event: LayoutChangeEvent) => void) | undefined\n}): SharedLayoutBindings {\n const { layoutId, userRef, transition, shouldReduceMotion, userOnLayout } =\n options\n\n const dx = useSharedValue(0)\n const dy = useSharedValue(0)\n const sx = useSharedValue(1)\n const sy = useSharedValue(1)\n\n // Most-recent rect for this primitive. Updated on every layout commit;\n // read on unmount to populate the registry as the FLIP source for the\n // next mount with the same id.\n const lastRectRef = useRef<SharedRect | null>(null)\n\n // First-layout latch — only the first measurement after a fresh mount\n // can consume a source rect. Subsequent layouts (resizes, prop changes)\n // refresh the registry but never re-trigger a FLIP from an old source.\n const consumedRef = useRef(false)\n\n const transitionRef = useRef(transition)\n transitionRef.current = transition\n const reducedMotionRef = useRef(shouldReduceMotion)\n reducedMotionRef.current = shouldReduceMotion\n\n const setRef = useCallback(\n (node: unknown) => {\n if (typeof userRef === 'function') userRef(node)\n else if (userRef) (userRef as MutableRefObject<unknown>).current = node\n },\n [userRef],\n )\n\n const onLayout = useCallback(\n (event: LayoutChangeEvent) => {\n userOnLayout?.(event)\n if (!layoutId) return\n\n const { x, y, width, height } = event.nativeEvent.layout\n const rect: SharedRect = { x, y, width, height }\n lastRectRef.current = rect\n\n // First-layout-only: read the registry BEFORE writing our own rect\n // so a previously-released source rect can be consumed cleanly\n // without being overwritten by the current rect first.\n let source: SharedRect | undefined\n if (!consumedRef.current) {\n consumedRef.current = true\n source = consumeLayout(layoutId)\n }\n registerLayout(layoutId, rect)\n\n if (source) {\n applyFlip({\n source,\n target: rect,\n dx,\n dy,\n sx,\n sy,\n transition: transitionRef.current,\n shouldReduceMotion: reducedMotionRef.current,\n })\n }\n },\n // dx/dy/sx/sy are stable refs from useSharedValue, but eslint's\n // exhaustive-deps would flag them — including them is harmless and\n // silences the warning.\n [layoutId, userOnLayout, dx, dy, sx, sy],\n )\n\n // Reset the first-layout latch when the id changes — a new id is logically\n // a new shared-element identity and should be allowed to consume a source.\n useEffect(() => {\n consumedRef.current = false\n }, [layoutId])\n\n // On unmount, hand the latest rect to the registry under this id so the\n // next mount can consume it as a FLIP source.\n useEffect(() => {\n return () => {\n if (!layoutId) return\n const rect = lastRectRef.current\n if (!rect) return\n releaseLayout(layoutId, rect)\n }\n }, [layoutId])\n\n return useMemo<SharedLayoutBindings>(\n () => ({\n flip: { dx, dy, sx, sy },\n setRef,\n onLayout,\n }),\n [dx, dy, sx, sy, setRef, onLayout],\n )\n}\n\n/**\n * Snap the FLIP shared values so the new element visually overlays its\n * source rect, then animate back to identity. The `withSequence(snap,\n * animate)` shape is what makes the spring start from the snapped delta —\n * a plain `withSpring(0)` from a zero base would animate from-zero, not\n * from-source.\n */\nfunction applyFlip(args: {\n source: SharedRect\n target: SharedRect\n dx: SharedValue<number>\n dy: SharedValue<number>\n sx: SharedValue<number>\n sy: SharedValue<number>\n transition: TransitionConfig | undefined\n shouldReduceMotion: boolean\n}): void {\n const { source, target, dx, dy, sx, sy, transition, shouldReduceMotion } =\n args\n\n // Compute the delta that would visually place the new element at the\n // source rect. The transform origin matters: RN scales around the\n // element's center, so the translation needs to account for the\n // center-of-source vs center-of-target offset, not the top-left offset.\n const sourceCenterX = source.x + source.width / 2\n const sourceCenterY = source.y + source.height / 2\n const targetCenterX = target.x + target.width / 2\n const targetCenterY = target.y + target.height / 2\n const deltaX = sourceCenterX - targetCenterX\n const deltaY = sourceCenterY - targetCenterY\n // Guard against zero-sized targets (degenerate layout) — keep scale at 1\n // so the element at least renders even if the FLIP isn't a perfect match.\n const scaleX = target.width > 0 ? source.width / target.width : 1\n const scaleY = target.height > 0 ? source.height / target.height : 1\n\n if (shouldReduceMotion) {\n // Reduced-motion: skip the visual transition entirely. The element\n // appears at its natural position; the source rect is discarded.\n dx.value = 0\n dy.value = 0\n sx.value = 1\n sy.value = 1\n return\n }\n\n if (transition?.type === 'no-animation') {\n dx.value = 0\n dy.value = 0\n sx.value = 1\n sy.value = 1\n return\n }\n\n if (transition?.type === 'timing') {\n const duration = transition.duration ?? 300\n dx.value = withSequence(\n withTiming(deltaX, { duration: 0 }),\n withTiming(0, { duration }),\n )\n dy.value = withSequence(\n withTiming(deltaY, { duration: 0 }),\n withTiming(0, { duration }),\n )\n sx.value = withSequence(\n withTiming(scaleX, { duration: 0 }),\n withTiming(1, { duration }),\n )\n sy.value = withSequence(\n withTiming(scaleY, { duration: 0 }),\n withTiming(1, { duration }),\n )\n return\n }\n\n // Spring path (default, and the fallback for `'decay'` which doesn't\n // have a meaningful target value for a FLIP transition).\n const springCfg: SpringTransition =\n transition?.type === 'spring'\n ? { ...DEFAULT_SPRING, ...transition }\n : { type: 'spring', ...DEFAULT_SPRING }\n const springParams = springToReanimated(springCfg)\n\n dx.value = withSequence(\n withTiming(deltaX, { duration: 0 }),\n withSpring(0, springParams),\n )\n dy.value = withSequence(\n withTiming(deltaY, { duration: 0 }),\n withSpring(0, springParams),\n )\n sx.value = withSequence(\n withTiming(scaleX, { duration: 0 }),\n withSpring(1, springParams),\n )\n sy.value = withSequence(\n withTiming(scaleY, { duration: 0 }),\n withSpring(1, springParams),\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 {\n Easing,\n withDecay,\n withDelay,\n withRepeat,\n withSequence,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { ensureWorkletEasing } from './easing'\nimport { springToReanimated } from './spring'\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\nconst DEFAULT_TIMING_DURATION = 250\n\nfunction buildSpring(\n cfg: SpringTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withSpring(toValue as number, springToReanimated(cfg), cb as never)\n}\n\nfunction buildTiming(\n cfg: TimingTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withTiming(\n toValue as number,\n {\n duration: cfg.duration ?? DEFAULT_TIMING_DURATION,\n easing: ensureWorkletEasing(cfg.easing) ?? Easing.inOut(Easing.ease),\n },\n cb as never,\n )\n}\n\nfunction buildDecay(cfg: DecayTransition, cb?: AnimationCallback) {\n return withDecay(\n {\n velocity: cfg.velocity ?? 0,\n deceleration: cfg.deceleration,\n clamp: cfg.clamp,\n },\n cb as never,\n )\n}\n\n/**\n * Build a single-step animation (no repeat / no delay / no sequence) for a\n * given config + target. Pulled out so sequence steps can compose without\n * recursing into repeat/delay handling per step. The callback is forwarded\n * to Reanimated; for `no-animation` the callback is fired synchronously\n * since there's nothing to wait for.\n */\nfunction buildOne(\n cfg: TransitionConfig,\n toValue: number | string,\n cb?: AnimationCallback,\n): unknown {\n if (cfg.type === 'no-animation') {\n if (cb) cb(true, toValue)\n return toValue\n }\n if (cfg.type === 'decay') return buildDecay(cfg, cb)\n if (cfg.type === 'timing') return buildTiming(cfg, toValue, cb)\n return buildSpring(cfg as SpringTransition, toValue, cb)\n}\n\n/**\n * Wrap an animation in `withRepeat` per the unified `repeat` shape:\n * - `number` → finite count, alternating direction\n * - `'infinite'` → endless, alternating direction\n * - `{ count, alternate }`→ explicit; `alternate` defaults to `true`\n */\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 { type TransitionConfig } from '../types'\n\n/**\n * Field names that may appear on a `TransitionConfig` (spring / timing /\n * decay / no-animation). Used as a structural discriminator: if every key on\n * an object is in this set, the object is treated as a top-level transition;\n * otherwise it's a per-property / per-layer transition map.\n *\n * Adding a new field to `TransitionConfig` requires adding the name here.\n */\nexport const TRANSITION_CONFIG_KEYS = new Set([\n 'type',\n 'tension',\n 'friction',\n 'mass',\n 'velocity',\n 'restSpeedThreshold',\n 'restDisplacementThreshold',\n 'duration',\n 'easing',\n 'delay',\n 'repeat',\n 'deceleration',\n 'clamp',\n])\n\nexport function isTopLevelTransition(t: unknown): t is TransitionConfig {\n if (t === null || typeof t !== 'object') return false\n const keys = Object.keys(t as object)\n if (keys.length === 0) return false\n return keys.every((k) => TRANSITION_CONFIG_KEYS.has(k))\n}\n","import {\n Easing,\n withDecay,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { springToReanimated } from './spring'\nimport { type TransitionConfig } from '../types'\n\nconst DEFAULT_TIMING_DURATION = 250\n\n/**\n * Worklet-safe single-step animation builder. Mirrors a subset of\n * `resolveTransition` for the UI-thread path where the transition config is\n * picked at gesture-release time, not at render time.\n *\n * Supported: spring / timing / decay / no-animation, single-step only.\n * Not supported: sequences, top-level repeat, easing-function\n * auto-worklet-wrapping (pass an already-worklet easing if you need a custom\n * one — most release transitions don't).\n *\n * Use this from gesture worklets (`useDrag` / `usePan` release callbacks, or\n * any custom `Gesture.Pan().onEnd(() => ...)` worklet) to animate a shared\n * value with an Inertia transition without the JS round-trip that would lose\n * the release velocity.\n *\n * For decay transitions, `toValue` is ignored — decay decelerates from the\n * SV's current position via its own physics. Pass `0` if you don't have one.\n */\nexport function buildReleaseAnimation(\n transition: TransitionConfig,\n toValue: number,\n): unknown {\n 'worklet'\n if (transition.type === 'no-animation') return toValue\n if (transition.type === 'decay') {\n const cfg: {\n velocity: number\n deceleration?: number\n clamp?: [number, number]\n } = { velocity: transition.velocity ?? 0 }\n if (transition.deceleration !== undefined) {\n cfg.deceleration = transition.deceleration\n }\n if (transition.clamp !== undefined) cfg.clamp = transition.clamp\n return withDecay(cfg)\n }\n if (transition.type === 'timing') {\n // Reanimated 4's `Easing.bezier(...)` returns an `EasingFunctionFactory`\n // rather than the function itself. Unwrap inline so consumers calling\n // `buildReleaseAnimation` from a gesture worklet don't have to.\n const e = transition.easing\n const easingFn =\n e && typeof e === 'object' && 'factory' in e\n ? e.factory()\n : (e ?? Easing.inOut(Easing.ease))\n return withTiming(toValue, {\n duration: transition.duration ?? DEFAULT_TIMING_DURATION,\n easing: easingFn,\n })\n }\n return withSpring(toValue, springToReanimated(transition))\n}\n","/**\n * Stable string signature for an arbitrary value — used as a dep-array\n * member so a fresh object literal each render doesn't re-fire an effect\n * unless something structurally changed. Functions serialize as `null`\n * (their identity isn't useful in a sig); `undefined` collapses to an empty\n * string so omitted props compare equal across renders.\n */\nexport function stableSig(value: unknown): string {\n if (value === undefined) return ''\n try {\n return stableStringify(value)\n } catch {\n return String(value)\n }\n}\n\n/**\n * JSON.stringify with keys sorted at every level so a sig is invariant under\n * property-declaration order. Functions and `undefined` both serialize as\n * `null` — we accept the latter's information loss (rare in practice) in\n * exchange for not crashing on circular function-bearing graphs.\n */\nfunction stableStringify(v: unknown): string {\n if (v === null || typeof v !== 'object') {\n if (typeof v === 'function' || v === undefined) return 'null'\n return JSON.stringify(v)\n }\n if (Array.isArray(v)) {\n return '[' + v.map(stableStringify).join(',') + ']'\n }\n const obj = v as Record<string, unknown>\n const keys = Object.keys(obj).sort()\n return (\n '{' +\n keys\n .map((k) => JSON.stringify(k) + ':' + stableStringify(obj[k]))\n .join(',') +\n '}'\n )\n}\n","import { reanimatedVersion } from 'react-native-reanimated'\n\ndeclare const __DEV__: boolean\ndeclare const process: { env?: Record<string, string | undefined> }\n\nlet alreadyChecked = false\n\n/**\n * Surface a clear, actionable error at first `createMotionComponent` call when\n * the consumer's Reanimated install is broken. Production builds, repeat calls,\n * and Jest test runs are all skipped — the check is purely a dev-time\n * paper-cut sander for the two failure modes we can detect from JS:\n *\n * 1. `react-native-reanimated` resolves but is on a v3.x line we don't\n * support (the plugin name and worklet runtime both changed at v4).\n * 2. The worklets babel plugin (`react-native-worklets/plugin` in v4) isn't\n * wired into `babel.config.js`, so `'worklet'` directives are dead strings\n * and the first `withSpring` / `withTiming` call would crash on the UI\n * thread with a generic \"non-worklet function called\" error.\n *\n * The \"Reanimated isn't installed at all\" case isn't handled here — Metro\n * fails to resolve the static `import 'react-native-reanimated'` at the top\n * of `createMotionComponent.tsx` long before this check runs.\n */\nexport function ensureReanimatedInstalled(): void {\n if (!__DEV__ || alreadyChecked) return\n // The standard `react-native-reanimated/mock` doesn't run the worklets\n // babel plugin, so the marker probe would false-positive every test run.\n if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'test') {\n return\n }\n alreadyChecked = true\n\n // Read the version off Reanimated's own runtime export rather than reaching\n // into its `package.json`. A `require('.../package.json')` here would make\n // esbuild emit a `__require` shim that throws on web bundlers (Expo web), and\n // Reanimated's `exports` field may block the subpath anyway.\n const version: string | undefined = reanimatedVersion\n\n if (version) {\n const major = parseInt(version.split('.')[0] ?? '0', 10)\n if (major < 4) {\n console.error(\n `[inertia] react-native-reanimated v${version} is installed, but @onlynative/inertia requires v4.0.0 or later. ` +\n `Upgrade with \\`pnpm add react-native-reanimated@^4\\` (or your package manager's equivalent).`,\n )\n return\n }\n }\n\n // The worklets plugin rewrites any function carrying a top-of-body\n // `'worklet'` directive to expose a `__workletHash` property at runtime.\n // Its absence means the plugin didn't run.\n const probe = function probe() {\n 'worklet'\n return 0\n } as { __workletHash?: number }\n if (typeof probe.__workletHash !== 'number') {\n console.error(\n `[inertia] The Reanimated worklets babel plugin is not configured. ` +\n `Add \\`'react-native-worklets/plugin'\\` as the LAST entry in the \\`plugins\\` array of your \\`babel.config.js\\`, ` +\n `then restart Metro with a fresh cache: \\`npx expo start -c\\` or \\`npx react-native start --reset-cache\\`.`,\n )\n }\n}\n","import {\n type ComponentType,\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport Animated, {\n interpolateColor,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n type SharedValue,\n} from 'react-native-reanimated'\nimport { type LayoutChangeEvent } from 'react-native'\nimport { useShouldReduceMotion } from '../config'\nimport { isFocusVisible } from '../gestures'\nimport {\n resolveLayoutTransition,\n type LayoutProp,\n useSharedLayout,\n} from '../layout'\nimport { usePresence } from '../presence'\nimport {\n isTopLevelTransition,\n resolveAnimatableValue,\n resolveTransition,\n stableSig,\n} from '../transitions'\nimport { ensureReanimatedInstalled } from './installCheck'\nimport {\n type AnimatableValue,\n type AnimateStyle,\n type AnimationCallbackInfo,\n type GestureLayerTransitions,\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 'rotateX',\n 'rotateY',\n] as const\n\n// Rotation keys land in the transform array as `{ rotate: '45deg' }` / `{\n// rotateX: '45deg' }` etc. — Reanimated needs the unit-suffixed string form.\n// We hold the underlying shared value as a plain number (degrees) and wrap\n// in the worklet so the resolver pipeline stays uniform with the other\n// numeric transform keys.\nconst ROTATION_KEYS = new Set<string>(['rotate', 'rotateX', 'rotateY'])\n\nconst NUMERIC_TOP_LEVEL_KEYS = [\n 'opacity',\n 'width',\n 'height',\n 'borderRadius',\n 'shadowOpacity',\n 'shadowRadius',\n 'elevation',\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 'shadowColor',\n] as const\n\n// Synthetic axes for the `shadowOffset: { width, height }` nested-object style\n// prop. RN doesn't surface these as top-level keys; the worklet recomposes\n// `shadowOffset` from the two synthetic SVs before emitting the style. The\n// consumer's animate value (`shadowOffset: { width, height }`) decomposes into\n// these at the activation / value-driving boundary; consumers don't write\n// these keys directly.\nconst SHADOW_OFFSET_KEYS = ['shadowOffsetWidth', 'shadowOffsetHeight'] 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 ...SHADOW_OFFSET_KEYS,\n] as const\ntype AnimatableKey = (typeof ALL_KEYS)[number]\ntype TransformKey = (typeof TRANSFORM_KEYS)[number]\ntype ShadowOffsetKey = (typeof SHADOW_OFFSET_KEYS)[number]\n\nconst TRANSFORM_KEY_SET = new Set<AnimatableKey>(TRANSFORM_KEYS)\nconst COLOR_KEY_SET = new Set<AnimatableKey>(COLOR_KEYS)\nconst SHADOW_OFFSET_KEY_SET = new Set<AnimatableKey>(SHADOW_OFFSET_KEYS)\n\nconst GESTURE_LAYER_NAMES = [\n 'hovered',\n 'focused',\n 'focusVisible',\n 'pressed',\n] as const\ntype GestureLayerName = (typeof GESTURE_LAYER_NAMES)[number]\nconst GESTURE_LAYER_NAME_SET = new Set<string>(GESTURE_LAYER_NAMES)\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 rotateX: 0,\n rotateY: 0,\n opacity: 1,\n width: 0,\n height: 0,\n borderRadius: 0,\n shadowOpacity: 0,\n shadowRadius: 0,\n elevation: 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 shadowColor: 'transparent',\n shadowOffsetWidth: 0,\n shadowOffsetHeight: 0,\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 // Gesture-layer keys (`pressed`, `hovered`, …) live on the same map as\n // per-property keys; skip them when looking up a property transition so a\n // user who wires `transition.pressed` doesn't accidentally apply that to a\n // style key named `pressed` (none currently exist, but keep the lookup\n // honest).\n if (GESTURE_LAYER_NAME_SET.has(prop as string)) return undefined\n return (transition as PerPropertyTransition<S>)[prop]\n}\n\nfunction gestureLayerTransitionFor<S>(\n layer: GestureLayerName,\n transition: Transition<S> | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return (transition as GestureLayerTransitions)[layer]\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 */\n// `ComponentType<any>` is React's canonical \"accept any component\" idiom.\n// `unknown` doesn't work — props need to widen to whatever `C` actually accepts\n// at the call site. The two `any` uses below are deliberate.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createMotionComponent<C extends ComponentType<any>>(\n Component: C,\n): MotionComponent<C> {\n ensureReanimatedInstalled()\n\n const AnimatedComponent = Animated.createAnimatedComponent(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 layout,\n layoutId,\n onAnimationEnd,\n style,\n onLayout: userOnLayout,\n ...rest\n } = props as Props & {\n style?: unknown\n layout?: LayoutProp\n layoutId?: string\n onLayout?: (event: LayoutChangeEvent) => void\n }\n\n // Function-form `style={(state) => ...}` is the Pressable render-prop API.\n // Inertia drives press/focus state through `gesture.*` and merges its own\n // animated style; a function passed here lands inside a style array where\n // the underlying component never invokes it, so the resulting styles are\n // silently dropped. Throw loudly in dev rather than ship the footgun.\n if (__DEV__ && typeof style === 'function') {\n throw new Error(\n '[inertia] `style` must be a style object or array of style objects, ' +\n 'not a function. The function-form `style={(state) => ...}` Pressable ' +\n 'API is not supported — use `gesture.pressed` (or `gesture.focused`, ' +\n 'etc.) to drive state-dependent styling instead.',\n )\n }\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 InternalAnimateRecord\n const initialRecord =\n initial && initial !== false\n ? (initial as InternalInitialRecord)\n : undefined\n const exitRecord = exit ? (exit as InternalAnimateRecord) : undefined\n\n // Gesture sub-state activation tracked as JS state. Activation flips drive\n // the per-layer progress shared values (0↔1); they intentionally do NOT\n // re-run the value-driving effect — gesture sub-state targets live on the\n // worklet's composition chain, not on the base `animate` SV.\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 a *monotonically growing*\n // union, recomputed every render and expanded when a render introduces a\n // key not seen before. It never shrinks. Two requirements meet here:\n //\n // 1. Variants and gesture sub-states contribute the union across *all*\n // their branches up front — a key touched by any variant must be\n // active so the worklet picks it up when the controller transitions\n // to a branch the base `animate` never mentions.\n // 2. A literal `animate` object is reactive: a parent that changes\n // `animate={{ opacity: 1 }}` to `animate={{ opacity: 1, scale: 2 }}`\n // after mount must get `scale` animating. Freezing the set at first\n // render silently dropped the new key (its SV updated, but the\n // worklet — which iterates this set — never read it).\n //\n // Growing-only keeps the worklet stable: the `activeKeysRef.current` array\n // identity only changes on the renders that actually add a key, so the\n // `useAnimatedStyle` worklet (which reads `.current` each frame) sees the\n // expansion without churning frame-to-frame.\n const touched = new Set<AnimatableKey>()\n collectTouchedKeys(touched, animateRecord)\n if (initialRecord) collectTouchedKeys(touched, initialRecord)\n if (variants) {\n for (const variant of Object.values(variants) as object[]) {\n if (!variant) continue\n collectTouchedKeys(touched, variant as Record<string, unknown>)\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 collectTouchedKeys(touched, subState as Record<string, unknown>)\n }\n }\n if (exitRecord) collectTouchedKeys(touched, exitRecord)\n\n const activeKeysRef = useRef<readonly AnimatableKey[] | null>(null)\n const hasTransformRef = useRef<boolean>(false)\n const hasShadowOffsetRef = useRef<boolean>(false)\n // Expand the active set only when this render touched a key we haven't\n // recorded yet. When nothing new appears we keep the existing array\n // identity so the worklet's captured ref doesn't see a fresh value.\n const prevActive = activeKeysRef.current\n let grew = prevActive === null\n if (!grew && prevActive) {\n for (const k of touched) {\n if (!prevActive.includes(k)) {\n grew = true\n break\n }\n }\n }\n if (grew) {\n const merged = new Set<AnimatableKey>(prevActive ?? [])\n for (const k of touched) merged.add(k)\n activeKeysRef.current = ALL_KEYS.filter((k) => merged.has(k))\n hasTransformRef.current = activeKeysRef.current.some((k) =>\n TRANSFORM_KEY_SET.has(k),\n )\n hasShadowOffsetRef.current = activeKeysRef.current.some((k) =>\n SHADOW_OFFSET_KEY_SET.has(k),\n )\n }\n\n const sharedValues = useAnimatableSharedValues((key) => {\n // Shadow offset synthetics seed from the corresponding axis on the\n // `shadowOffset: { width, height }` source — the consumer doesn't write\n // `shadowOffsetWidth` / `shadowOffsetHeight` directly. Fall back to the\n // generic resting default when neither initial nor animate touched it.\n if (SHADOW_OFFSET_KEY_SET.has(key)) {\n const axis = shadowOffsetAxisFor(key as ShadowOffsetKey)\n if (initial === false) {\n return (\n shadowOffsetAxisValue(animateRecord.shadowOffset, axis) ??\n DEFAULT_RESTING[key]\n )\n }\n return (\n shadowOffsetAxisValue(\n initialRecord?.shadowOffset as\n | { width?: number; height?: number }\n | undefined,\n axis,\n ) ??\n shadowOffsetAxisValue(animateRecord.shadowOffset, axis) ??\n DEFAULT_RESTING[key]\n )\n }\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 // One progress SV per gesture layer, allocated unconditionally for hook\n // stability. Each layer's progress animates 0↔1 with its own transition\n // when its activation flips; the worklet reads them when compositing.\n // Initial value is 0 — even if a sub-state is somehow active on mount,\n // the activation effect below will animate it to 1 on the next tick.\n const pressedProgress = useSharedValue(0)\n const focusedProgress = useSharedValue(0)\n const focusVisibleProgress = useSharedValue(0)\n const hoveredProgress = useSharedValue(0)\n\n // Mirror gesture targets into a UI-runtime-resident shared value so the\n // animated-style worklet can read the latest layer values without having\n // to capture `gesture` directly (which would re-register the worklet on\n // every render where the consumer passes a fresh literal). The signature\n // dependency means we only push to the SV when targets actually change —\n // the SV ref itself is stable across renders.\n //\n // The resolved value is a layer-keyed map of primitive endpoints (numbers\n // or color strings); sequence/`{ to }` step shapes on a sub-state collapse\n // to their final endpoint via `targetEndValue` because a gesture layer\n // describes a steady target, not a keyframe sequence.\n const gestureSV = useSharedValue<ResolvedGestureLayers | null>(\n resolveGestureLayers(gesture),\n )\n const gestureTargetsSig = stableSig(gesture)\n useEffect(() => {\n gestureSV.value = resolveGestureLayers(gesture)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [gestureTargetsSig])\n\n // The base record drives the per-key shared values. Gesture sub-state\n // targets are intentionally NOT merged here — they layer on top in the\n // worklet. Exit values still take precedence over `animate` while exiting\n // because the base SV is what <Presence> waits on to settle.\n const baseRecord =\n isExiting && exitRecord\n ? { ...animateRecord, ...exitRecord }\n : animateRecord\n const baseSig =\n stableSig(baseRecord) +\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) && baseRecord[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 // Shadow offset synthetics read their target from the nested\n // `shadowOffset: { width, height }` source on `baseRecord` — the\n // animate / exit record never has `shadowOffsetWidth` etc. on it\n // directly. The synthetic transition follows the same `shadowOffset`\n // top-level transition entry (no per-axis split).\n const target: AnimatableValue<number | string> | undefined =\n SHADOW_OFFSET_KEY_SET.has(key)\n ? shadowOffsetAxisValue(\n baseRecord.shadowOffset,\n shadowOffsetAxisFor(key as ShadowOffsetKey),\n )\n : baseRecord[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(\n SHADOW_OFFSET_KEY_SET.has(key)\n ? ('shadowOffset' as keyof typeof baseRecord)\n : key,\n transition,\n )\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 }, [baseSig, transitionSig])\n\n // Per-layer progress: when a sub-state activation flips, animate its\n // progress SV 0↔1 with the layer's own transition (or the parent\n // transition / library default, in priority order). On exit we snap every\n // layer to 0 instantly so the unmount-bound base SV isn't fighting a\n // stale layer contribution mid-fade.\n //\n // The `declared` flag short-circuits the effect when the consumer hasn't\n // wired the corresponding sub-state — so a Motion primitive without a\n // `gesture` prop (or with only some sub-states declared) makes zero extra\n // `withSpring` / `withTiming` calls on mount.\n useGestureLayerProgress(\n pressedProgress,\n pressed,\n gesture?.pressed != null,\n 'pressed',\n transition,\n isExiting,\n shouldReduceMotion,\n )\n useGestureLayerProgress(\n focusedProgress,\n focused,\n gesture?.focused != null,\n 'focused',\n transition,\n isExiting,\n shouldReduceMotion,\n )\n useGestureLayerProgress(\n focusVisibleProgress,\n focusVisible,\n gesture?.focusVisible != null,\n 'focusVisible',\n transition,\n isExiting,\n shouldReduceMotion,\n )\n useGestureLayerProgress(\n hoveredProgress,\n hovered,\n gesture?.hovered != null,\n 'hovered',\n transition,\n isExiting,\n shouldReduceMotion,\n )\n\n // Shared-element transition wiring. `useSharedLayout` allocates FLIP\n // shared values (identity at rest), measures via the merged `onLayout`,\n // and on first-mount snaps the FLIP transform to a source rect popped\n // from the registry. The worklet below appends those entries to the\n // transform array so they compose with the user's animate transforms —\n // multiple `translateX` entries sum, multiple `scaleX` entries multiply,\n // which is exactly the FLIP semantic.\n const sharedLayout = useSharedLayout({\n layoutId,\n userRef: ref,\n transition: isTopLevelTransition(transition) ? transition : undefined,\n shouldReduceMotion,\n userOnLayout,\n })\n const flip = sharedLayout.flip\n const hasLayoutId = layoutId !== undefined\n\n const animatedStyle = useAnimatedStyle(() => {\n const activeKeys = activeKeysRef.current!\n const hasTransform = hasTransformRef.current\n const hasShadowOffset = hasShadowOffsetRef.current\n const out: Record<string, unknown> = {}\n const transform: Array<Record<string, unknown>> = []\n // shadow-offset reassembly buffers. The two synthetic axis SVs feed in\n // here and the recomposed `{ width, height }` object lands on `out`\n // after the loop so RN gets a single `shadowOffset` style prop.\n let shadowOffsetW = 0\n let shadowOffsetH = 0\n\n // Read each progress SV exactly once so the chain below sees a coherent\n // snapshot for this frame. Reading them on the UI thread is cheap.\n const ph = hoveredProgress.value\n const pf = focusedProgress.value\n const pfv = focusVisibleProgress.value\n const pp = pressedProgress.value\n\n const layers = gestureSV.value\n // Locals are suffixed `Layer` so they don't shadow the outer `pressed` /\n // `focused` / `focusVisible` / `hovered` JS-state booleans — Reanimated's\n // worklet closure tracker would otherwise pick those up as captured\n // dependencies and re-register the worklet on every activation flip.\n const hoveredLayer = layers ? layers.hovered : null\n const focusedLayer = layers ? layers.focused : null\n const focusVisibleLayer = layers ? layers.focusVisible : null\n const pressedLayer = layers ? layers.pressed : null\n\n for (const key of activeKeys) {\n let v = sharedValues[key].value\n const isColor = COLOR_KEY_SET.has(key)\n\n // Composite gesture layers in priority order (lowest first). Each\n // active layer pulls the value toward its pre-resolved primitive\n // endpoint by `progress`; numeric keys lerp, color keys go through\n // Reanimated's RGBA `interpolateColor`. We skip layers with progress\n // 0 to avoid an `interpolateColor(0, ...)` call that would parse the\n // target color string for no visible effect.\n if (hoveredLayer && ph > 0 && hoveredLayer[key] !== undefined) {\n const t = hoveredLayer[key]\n v = isColor\n ? interpolateColor(ph, [0, 1], [v as string, t as string])\n : (v as number) + ((t as number) - (v as number)) * ph\n }\n if (focusedLayer && pf > 0 && focusedLayer[key] !== undefined) {\n const t = focusedLayer[key]\n v = isColor\n ? interpolateColor(pf, [0, 1], [v as string, t as string])\n : (v as number) + ((t as number) - (v as number)) * pf\n }\n if (\n focusVisibleLayer &&\n pfv > 0 &&\n focusVisibleLayer[key] !== undefined\n ) {\n const t = focusVisibleLayer[key]\n v = isColor\n ? interpolateColor(pfv, [0, 1], [v as string, t as string])\n : (v as number) + ((t as number) - (v as number)) * pfv\n }\n if (pressedLayer && pp > 0 && pressedLayer[key] !== undefined) {\n const t = pressedLayer[key]\n v = isColor\n ? interpolateColor(pp, [0, 1], [v as string, t as string])\n : (v as number) + ((t as number) - (v as number)) * pp\n }\n\n if (TRANSFORM_KEY_SET.has(key)) {\n transform.push(\n ROTATION_KEYS.has(key) ? { [key]: `${v}deg` } : { [key]: v },\n )\n } else if (key === 'shadowOffsetWidth') {\n shadowOffsetW = v as number\n } else if (key === 'shadowOffsetHeight') {\n shadowOffsetH = v as number\n } else {\n out[key] = v\n }\n }\n // Shared-element FLIP transforms append after the user's transform\n // entries so they compose multiplicatively in the same `transform`\n // array — separate style entries with `transform` keys would\n // last-write-wins, which is what we explicitly avoid here. At rest\n // (dx, dy, sx, sy) = (0, 0, 1, 1) so the contribution is a no-op\n // when no shared-element transition is active.\n if (hasLayoutId) {\n transform.push({ translateX: flip.dx.value })\n transform.push({ translateY: flip.dy.value })\n transform.push({ scaleX: flip.sx.value })\n transform.push({ scaleY: flip.sy.value })\n }\n if (hasTransform || hasLayoutId) out.transform = transform\n if (hasShadowOffset) {\n out.shadowOffset = { width: shadowOffsetW, height: shadowOffsetH }\n }\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 // Resolve the `layout` prop into a Reanimated `LinearTransition` builder.\n // Memoized on the value's stable signature so a fresh `layout={true}` or\n // `layout={{ ... }}` literal each render doesn't rebuild the builder. When\n // reduced motion is active we pass `undefined` — see `resolveLayout` for\n // why we don't pass a duration-0 builder instead.\n const layoutSig = stableSig(layout)\n const layoutTransition = useMemo(\n () => (shouldReduceMotion ? undefined : resolveLayoutTransition(layout)),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [layoutSig, shouldReduceMotion],\n )\n\n return (\n <AnimatedComponent\n ref={sharedLayout.setRef as never}\n {...(rest as object)}\n {...gestureHandlers}\n onLayout={sharedLayout.onLayout}\n layout={layoutTransition}\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 rotateX = useSharedValue<number | string>(init('rotateX'))\n const rotateY = useSharedValue<number | string>(init('rotateY'))\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 shadowOpacity = useSharedValue<number | string>(init('shadowOpacity'))\n const shadowRadius = useSharedValue<number | string>(init('shadowRadius'))\n const elevation = useSharedValue<number | string>(init('elevation'))\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 const shadowColor = useSharedValue<number | string>(init('shadowColor'))\n const shadowOffsetWidth = useSharedValue<number | string>(\n init('shadowOffsetWidth'),\n )\n const shadowOffsetHeight = useSharedValue<number | string>(\n init('shadowOffsetHeight'),\n )\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 rotateX,\n rotateY,\n opacity,\n width,\n height,\n borderRadius,\n shadowOpacity,\n shadowRadius,\n elevation,\n backgroundColor,\n borderColor,\n color,\n tintColor,\n shadowColor,\n shadowOffsetWidth,\n shadowOffsetHeight,\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 * Internal shape of the `animate` / `exit` record after the cast, widened to\n * include the `shadowOffset: { width, height }` nested-object source. The\n * nested object decomposes into the `shadowOffsetWidth` / `shadowOffsetHeight`\n * synthetic axes downstream; consumers don't see the synthetics.\n *\n * v0.1 contract: `shadowOffset` accepts a single `{ width, height }` literal\n * (no sequences, no `{ to }` step objects, no array keyframes). Sequence\n * forms on the nested axes can land in v0.2 if real consumers ask for them.\n */\ntype InternalAnimateRecord = Partial<\n Record<AnimatableKey, AnimatableValue<number | string>>\n> & {\n shadowOffset?: { width?: number; height?: number }\n}\n\ntype InternalInitialRecord = Partial<Record<AnimatableKey, number | string>> & {\n shadowOffset?: { width?: number; height?: number }\n}\n\n/**\n * Resolve a `shadowOffsetWidth` / `shadowOffsetHeight` synthetic key to the\n * axis it represents on the nested-object source.\n */\nfunction shadowOffsetAxisFor(key: ShadowOffsetKey): 'width' | 'height' {\n return key === 'shadowOffsetWidth' ? 'width' : 'height'\n}\n\n/**\n * Read a single axis off a `shadowOffset: { width, height }` source. Returns\n * `undefined` when the source is absent or the axis isn't set, so callers can\n * fall back to the next source in the precedence chain.\n */\nfunction shadowOffsetAxisValue(\n source: { width?: number; height?: number } | undefined,\n axis: 'width' | 'height',\n): number | undefined {\n return source?.[axis]\n}\n\n/**\n * Populate `touched` with the `AnimatableKey`s mentioned in `record`. Direct\n * matches (e.g. `opacity`, `width`) come from the key iteration; the nested\n * `shadowOffset` source decomposes into the two `shadowOffset*` synthetics.\n */\nfunction collectTouchedKeys(\n touched: Set<AnimatableKey>,\n record: Record<string, unknown>,\n): void {\n for (const k of ALL_KEYS) {\n if (k in record) touched.add(k)\n }\n if ('shadowOffset' in record && record.shadowOffset) {\n const so = record.shadowOffset as { width?: unknown; height?: unknown }\n if (so.width !== undefined) touched.add('shadowOffsetWidth')\n if (so.height !== undefined) touched.add('shadowOffsetHeight')\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\n/**\n * Per-layer resolved targets: each declared gesture sub-state collapses to a\n * map of primitive endpoints (numbers or color strings), already passed\n * through `targetEndValue` so the worklet can use them directly without\n * inspecting `AnimatableValue` shapes on the UI thread.\n */\ntype ResolvedGestureLayers = {\n pressed?: Record<string, number | string>\n focused?: Record<string, number | string>\n focusVisible?: Record<string, number | string>\n hovered?: Record<string, number | string>\n}\n\nfunction resolveGestureLayers(\n gesture: GestureSubStates<unknown> | undefined,\n): ResolvedGestureLayers | null {\n if (!gesture) return null\n const out: ResolvedGestureLayers = {}\n for (const layer of GESTURE_LAYER_NAMES) {\n const subState = gesture[layer]\n if (!subState) continue\n const resolved: Record<string, number | string> = {}\n for (const key of ALL_KEYS) {\n // Shadow offset synthetics decompose from the nested `shadowOffset:\n // { width, height }` source on the sub-state, the same as on `animate`.\n if (SHADOW_OFFSET_KEY_SET.has(key)) {\n const axis = shadowOffsetAxisFor(key as ShadowOffsetKey)\n const so = (\n subState as { shadowOffset?: { width?: number; height?: number } }\n ).shadowOffset\n const v = shadowOffsetAxisValue(so, axis)\n if (v !== undefined) resolved[key] = v\n continue\n }\n const raw = (subState as Record<string, unknown>)[key]\n if (raw === undefined) continue\n const t = targetEndValue(raw as AnimatableValue<number | string>)\n if (t !== undefined) resolved[key] = t\n }\n out[layer] = resolved\n }\n return out\n}\n\n/**\n * Drive a single gesture layer's progress shared value 0↔1 with its own\n * transition. Resolution priority for the layer config:\n * `transition.<layerName>` → top-level `transition` → library default spring.\n * On exit, snap to 0 instantly so the unmount-bound base SV finishes its exit\n * animation without a stale layer pulling the value off-target.\n *\n * The hook is invoked unconditionally (one call per layer) so hook order\n * stays stable even when `gesture` adds or removes sub-states across renders.\n */\nfunction useGestureLayerProgress<S>(\n progress: SharedValue<number>,\n active: boolean,\n declared: boolean,\n layer: GestureLayerName,\n transition: Transition<S> | undefined,\n isExiting: boolean,\n shouldReduceMotion: boolean,\n): void {\n const layerCfgSig = stableSig(gestureLayerTransitionFor(layer, transition))\n useEffect(() => {\n if (!declared) return\n if (isExiting) {\n progress.value = 0\n return\n }\n const target = active ? 1 : 0\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (gestureLayerTransitionFor(layer, transition) ??\n ({ type: 'spring' } as const))\n progress.value = resolveTransition(cfg, target) as never\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [active, declared, isExiting, shouldReduceMotion, layerCfgSig])\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 // Deps key on declared-ness, not object identity — a fresh `gesture={...}`\n // literal each render must not rebuild handlers if the same sub-states are\n // declared.\n const hasPressed = gesture?.pressed ? 1 : 0\n const hasFocused = gesture?.focused ? 1 : 0\n const hasFocusVisible = gesture?.focusVisible ? 1 : 0\n const hasHovered = gesture?.hovered ? 1 : 0\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 hasPressed,\n hasFocused,\n hasFocusVisible,\n hasHovered,\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 { useEffect } from 'react'\nimport { useSharedValue, type SharedValue } from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { resolveTransition, stableSig } from '../transitions'\nimport { type TransitionConfig } from '../types'\n\n/**\n * Drive a `SharedValue<number>` toward `target` with **any** transition shape\n * — spring, timing, decay, or no-animation. The general-purpose value-layer\n * hook: reach for it when you need raw `useSharedValue + useEffect + withX`\n * outside the declarative `animate` flow.\n *\n * Re-runs whenever `target` changes shape (`target` is in the dep array) or\n * the transition signature changes (kept stable via JSON-style hashing).\n * Reduced motion (via `<MotionConfig reducedMotion>`) collapses the\n * transition to `no-animation` so the value snaps instead of interpolating.\n *\n * **Spring shorthand.** Prefer [`useSpring`](./useSpring) when you only want\n * spring physics — it accepts the same `tension`/`friction`/`mass` config and\n * also supports a `SharedValue<number>` as the target (UI-thread reactive\n * source). `useAnimation` is JS-thread-driven only.\n *\n * **Loops.** Repeat is part of `TransitionConfig` and flows through\n * untouched — `useAnimation(1, { type: 'timing', duration: 1800, repeat: {\n * count: 'infinite', alternate: false } })` produces an indeterminate-style\n * progress driver.\n *\n * @example\n * ```ts\n * // Toggle progress (Switch / Checkbox / Radio).\n * const progress = useAnimation(isChecked ? 1 : 0, {\n * type: 'spring',\n * tension: 380,\n * friction: 33,\n * })\n *\n * // Float a TextField label when the value becomes non-empty.\n * const floated = useAnimation(hasValue ? 1 : 0, {\n * type: 'timing',\n * duration: 150,\n * })\n *\n * // Indeterminate progress slider (loops forever, snaps back).\n * const slide = useAnimation(1, {\n * type: 'timing',\n * duration: 1800,\n * repeat: { count: 'infinite', alternate: false },\n * })\n * ```\n */\nexport function useAnimation(\n target: number,\n transition?: TransitionConfig,\n): SharedValue<number> {\n const output = useSharedValue<number>(target)\n const shouldReduceMotion = useShouldReduceMotion()\n const cfgSig = stableSig(transition)\n\n useEffect(() => {\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (transition ?? ({ type: 'spring' } as const))\n output.value = resolveTransition(cfg, target) as never\n // `output` is identity-stable per hook instance.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [target, cfgSig, shouldReduceMotion])\n\n return output\n}\n","import { useEffect, useMemo } from 'react'\nimport {\n useAnimatedReaction,\n useSharedValue,\n withSpring,\n type SharedValue,\n} from 'react-native-reanimated'\nimport { springToReanimated } from '../transitions/spring'\nimport { type SpringTransition } from '../types'\n\n/**\n * Animate a shared value toward `target` with spring physics, using the\n * library's react-spring vocabulary (`tension` / `friction` / `mass`).\n *\n * `target` may be a plain number or a `SharedValue<number>`. The plain-number\n * path drives the spring from a JS `useEffect`, so the animation re-runs on\n * every render where `target` changes. The shared-value path drives the\n * spring from a Reanimated reaction on the UI thread, so values produced by\n * gestures, scroll handlers, or other worklets flow through without bouncing\n * back to JS.\n *\n * Both call sites end up at the same `withSpring` invocation; the split is\n * just about which thread observes the source change.\n */\nexport function useSpring(\n target: number | SharedValue<number>,\n config?: SpringTransition,\n): SharedValue<number> {\n // Reanimated config is rebuilt only when the public config object changes\n // shape. The worklet path reads this from JS-thread closure capture, which\n // is fine: it's the resolved config that's invariant across UI-thread\n // ticks, not a JS-thread reference that would go stale.\n const reanimConfig = useMemo(\n () => springToReanimated(config ?? {}),\n [\n config?.tension,\n config?.friction,\n config?.mass,\n config?.velocity,\n config?.restSpeedThreshold,\n config?.restDisplacementThreshold,\n ],\n )\n\n const isSharedTarget = isSharedValue(target)\n const initial = isSharedTarget ? target.value : (target as number)\n const output = useSharedValue<number>(initial)\n\n // Plain-number path. The reaction below is a no-op when `target` is a\n // number, so this effect carries the change. Reading `target` directly in\n // the dep array means React drives the schedule; we don't have to babysit\n // a stale closure.\n useEffect(() => {\n if (isSharedTarget) return\n output.value = withSpring(target as number, reanimConfig)\n // `output` is identity-stable per hook instance (Reanimated guarantee).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isSharedTarget, target, reanimConfig])\n\n // SharedValue path. `useAnimatedReaction` runs the prepare worklet whenever\n // its returned value changes; we read `.value` off the target SV and pipe\n // it through `withSpring` on the UI thread. When the target is a plain\n // number we never declare a source so the reaction is inert (returns\n // `null`, never fires `react`).\n useAnimatedReaction(\n () => {\n 'worklet'\n if (!isSharedTarget) return null\n return (target as SharedValue<number>).value\n },\n (next, prev) => {\n 'worklet'\n if (next === null || next === prev) return\n output.value = withSpring(next, reanimConfig)\n },\n [isSharedTarget, reanimConfig],\n )\n\n return output\n}\n\nfunction isSharedValue(v: unknown): v is SharedValue<number> {\n // SharedValues are plain objects with a single `value` accessor — there is\n // no public constructor or instanceof check. Reading `'value' in v` on any\n // POJO would also pass, but the hook's call site already narrows the type;\n // this guard exists to dispatch between the two implementation paths, not\n // to validate untrusted input.\n return (\n typeof v === 'object' &&\n v !== null &&\n 'value' in (v as Record<string, unknown>)\n )\n}\n","import { type SharedValue } from 'react-native-reanimated'\nimport { useSpring } from './useSpring'\nimport { type SpringTransition } from '../types'\n\n/**\n * Toggle a 0↔1 progress value with a spring whenever `active` flips.\n *\n * This is the recurring shape behind checkbox checks, accordion expansions,\n * drawer open/closed states, focus rings, and every other binary UI flip\n * that wants spring physics rather than a hard cut. The returned shared\n * value sits at `0` when `active` is `false` and animates toward `1` when\n * `active` flips to `true` (and back again on the reverse flip). Feed it to\n * a `useTransform`, `useShadow`, or a hand-rolled `useAnimatedStyle` to\n * drive whatever the boolean controls visually.\n *\n * ```tsx\n * const progress = useBooleanSpring(isChecked)\n * const indicatorStyle = useAnimatedStyle(() => ({\n * opacity: progress.value,\n * transform: [{ scale: progress.value }],\n * }))\n * ```\n *\n * The spring config follows the same react-spring vocabulary as the rest of\n * the library (`tension` / `friction` / `mass`); omit it to take the\n * library's defaults.\n */\nexport function useBooleanSpring(\n active: boolean,\n springConfig?: SpringTransition,\n): SharedValue<number> {\n return useSpring(active ? 1 : 0, springConfig)\n}\n","import {\n interpolateColor,\n useAnimatedStyle,\n type SharedValue,\n} from 'react-native-reanimated'\n\n/**\n * Color style keys understood by React Native that this hook can target.\n * Sticks to the keys that exist on the v0.1 animatable surface so the\n * returned style fragment is always a legal RN style.\n */\nexport type ColorStyleKey =\n | 'backgroundColor'\n | 'color'\n | 'borderColor'\n | 'borderTopColor'\n | 'borderRightColor'\n | 'borderBottomColor'\n | 'borderLeftColor'\n | 'tintColor'\n | 'shadowColor'\n\nexport interface UseColorTransitionOptions {\n /**\n * Which style slot the interpolated color is emitted under. Defaults to\n * `backgroundColor` — the dominant case for state-layer haloes, card\n * fills, and chip surfaces. Override for ring colors (`borderColor`),\n * text colors (`color`), image tints (`tintColor`), etc.\n */\n key?: ColorStyleKey\n}\n\n/**\n * Interpolate a single color channel between `from` and `to` as `progress`\n * moves 0→1, returning an animated style fragment that can be spread onto\n * any Reanimated-aware view.\n *\n * ```tsx\n * const progress = useBooleanSpring(isPressed)\n * const fillStyle = useColorTransition(progress, [colors.surface, colors.pressed])\n * const ringStyle = useColorTransition(progress, [colors.outline, colors.primary], {\n * key: 'borderColor',\n * })\n *\n * return <Motion.View style={[styles.chip, fillStyle, ringStyle]} />\n * ```\n *\n * This is a pure interpolator: it does not animate on its own. Drive\n * `progress` upstream with a `useSpring`, `useBooleanSpring`, gesture\n * progress, or scroll-derived `useTransform`. Values outside `[0, 1]`\n * clamp. For a raw `SharedValue<string>` (e.g. to feed a gradient or\n * compose into a hand-rolled `useAnimatedStyle`), use `useTransform`\n * directly with a color output range.\n */\nexport function useColorTransition(\n progress: SharedValue<number>,\n range: readonly [string, string],\n options?: UseColorTransitionOptions,\n): ReturnType<typeof useAnimatedStyle> {\n // Resolve the slot key once on the JS thread so the worklet body\n // consumes a single string literal — consistent with the JS-thread\n // resolver principle that keeps `Object.keys`-style walks off the UI\n // thread (see CLAUDE.md design principle 8).\n const key = options?.key ?? 'backgroundColor'\n const from = range[0]\n const to = range[1]\n\n return useAnimatedStyle(() => {\n 'worklet'\n return { [key]: interpolateColor(progress.value, [0, 1], [from, to]) }\n })\n}\n","import { useCallback, useMemo } from 'react'\nimport { useSharedValue, type SharedValue } from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { isFocusVisible } from '../gestures'\nimport { isTopLevelTransition, resolveTransition } from '../transitions'\nimport { type GestureLayerTransitions, type TransitionConfig } from '../types'\n\ntype LayerName = 'pressed' | 'focused' | 'focusVisible' | 'hovered'\n\n/**\n * Handler bag returned by `useGesture`. Spread on a `Pressable` to drive the\n * shared values returned alongside.\n *\n * Hover handlers use `Pressable`'s own `onHoverIn` / `onHoverOut` names (web\n * only — no-ops on native). `onFocus` consults `isFocusVisible()` before\n * raising the keyboard-only `focusVisible` layer; `focused` always raises.\n */\nexport interface UseGestureHandlers {\n onPressIn: () => void\n onPressOut: () => void\n onHoverIn: () => void\n onHoverOut: () => void\n onFocus: () => void\n onBlur: () => void\n}\n\nexport interface UseGestureResult {\n /** 0↔1 progress for the pressed layer. */\n pressed: SharedValue<number>\n /** 0↔1 progress for the focused layer (any focus modality). */\n focused: SharedValue<number>\n /** 0↔1 progress for the focusVisible layer (keyboard focus only). */\n focusVisible: SharedValue<number>\n /** 0↔1 progress for the hovered layer (web only — stays at 0 on native). */\n hovered: SharedValue<number>\n /** Handlers to spread on the receiving `Pressable`. */\n handlers: UseGestureHandlers\n}\n\n/**\n * Build a gesture-layer controller. The hook-form of the `gesture` prop —\n * reach for it when you need to drive multiple animated views from the same\n * gesture state (a focus ring + state-layer halo + content tint all on one\n * Pressable), which the prop-form's \"animate the receiver's own style\" model\n * can't express.\n *\n * Returns four 0↔1 shared values (one per layer) and a handler bag to spread\n * on a `Pressable`. The shared values are stable across renders — feed them\n * into any number of `useAnimatedStyle` blocks anywhere in the tree.\n *\n * Transitions follow the same shape as the `gesture` prop's accompanying\n * `transition`: pass a single `TransitionConfig` to use for every layer, or a\n * `GestureLayerTransitions` map to give each layer its own. Layers without an\n * explicit transition fall back to the library default spring.\n *\n * Reduced motion (via `<MotionConfig reducedMotion>`) collapses every\n * transition to `no-animation` so state changes snap instead of interpolating\n * — same behaviour the gesture prop applies.\n *\n * @example\n * ```tsx\n * import { useAnimatedStyle } from 'react-native-reanimated'\n * import { useGesture } from '@onlynative/inertia'\n *\n * function Card() {\n * const { pressed, focused, hovered, handlers } = useGesture({\n * pressed: { type: 'timing', duration: 100 },\n * hovered: { type: 'timing', duration: 150 },\n * focused: { type: 'timing', duration: 200 },\n * })\n *\n * const ringStyle = useAnimatedStyle(() => ({ opacity: focused.value }))\n * const haloStyle = useAnimatedStyle(() => ({\n * opacity: Math.max(\n * hovered.value * 0.08,\n * focused.value * 0.10,\n * pressed.value * 0.10,\n * ),\n * }))\n *\n * return (\n * <Pressable {...handlers}>\n * <Animated.View style={ringStyle} />\n * <Animated.View style={haloStyle} />\n * </Pressable>\n * )\n * }\n * ```\n */\nexport function useGesture(\n transition?: TransitionConfig | GestureLayerTransitions,\n): UseGestureResult {\n const pressed = useSharedValue(0)\n const focused = useSharedValue(0)\n const focusVisible = useSharedValue(0)\n const hovered = useSharedValue(0)\n const shouldReduceMotion = useShouldReduceMotion()\n\n const setLayer = useCallback(\n (sv: SharedValue<number>, layer: LayerName, target: 0 | 1) => {\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : (layerTransition(layer, transition) ?? ({ type: 'spring' } as const))\n sv.value = resolveTransition(cfg, target) as never\n },\n // The transition is intentionally read on every call rather than cooked\n // into the dep array — a fresh literal each render would otherwise\n // rebuild the handler bag and break composing consumers that key off\n // handler identity. `transition` is read inside the callback closure;\n // shared values are stable so the only dep that matters is the reduce-\n // motion flag.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [shouldReduceMotion],\n )\n\n const handlers = useMemo<UseGestureHandlers>(\n () => ({\n onPressIn: () => setLayer(pressed, 'pressed', 1),\n onPressOut: () => setLayer(pressed, 'pressed', 0),\n onHoverIn: () => setLayer(hovered, 'hovered', 1),\n onHoverOut: () => setLayer(hovered, 'hovered', 0),\n onFocus: () => {\n setLayer(focused, 'focused', 1)\n if (isFocusVisible()) setLayer(focusVisible, 'focusVisible', 1)\n },\n onBlur: () => {\n setLayer(focused, 'focused', 0)\n setLayer(focusVisible, 'focusVisible', 0)\n },\n }),\n [setLayer, pressed, focused, focusVisible, hovered],\n )\n\n return { pressed, focused, focusVisible, hovered, handlers }\n}\n\nfunction layerTransition(\n layer: LayerName,\n transition: TransitionConfig | GestureLayerTransitions | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return (transition as GestureLayerTransitions)[layer]\n}\n","import { useSharedValue, type SharedValue } from 'react-native-reanimated'\n\n/**\n * Create an animatable value owned by JS but readable from worklets.\n *\n * This is the escape-hatch primitive that the rest of the value-layer hooks\n * (`useSpring`, `useTransform`, `useScroll`) compose against. It is a thin\n * pass-through over Reanimated's `useSharedValue`: a `SharedValue<T>` with\n * `.value` for direct reads/writes (UI-thread reads in worklets, JS-thread\n * writes from event handlers / effects).\n *\n * We intentionally do not introduce a `MotionValue` wrapper class around the\n * shared value. The simplest object that interops with `useAnimatedStyle`,\n * `useDerivedValue`, and every other Reanimated API _is_ the shared value\n * itself; adding a `{ get, set, value }` shell would force consumers to\n * unwrap it at every Reanimated boundary and break worklet capture.\n *\n * Worklet read:\n * ```ts\n * const x = useMotionValue(0)\n * useAnimatedStyle(() => ({ transform: [{ translateX: x.value }] }))\n * ```\n *\n * JS write:\n * ```ts\n * onPress={() => { x.value = 100 }}\n * ```\n */\nexport function useMotionValue<T extends number | string>(\n initial: T,\n): SharedValue<T> {\n return useSharedValue<T>(initial)\n}\n","import {\n Extrapolation,\n interpolate,\n interpolateColor,\n useDerivedValue,\n type SharedValue,\n} from 'react-native-reanimated'\n// `isWorkletFunction` was re-exported from `react-native-reanimated` historically\n// but is deprecated there in favor of importing from `react-native-worklets`.\n// `react-native-worklets` is a required peer of Reanimated 4, so the direct\n// import is always available wherever Inertia is.\nimport { isWorkletFunction } from 'react-native-worklets'\n\n/**\n * Extrapolation behavior at the edges of the input range. Mirrors\n * Reanimated's enum so consumers don't need a separate import.\n *\n * - `'clamp'` (default) — output stays pinned at the first/last value\n * outside the input range. Matches Framer Motion's default.\n * - `'identity'` — return the input unchanged outside the range.\n * - `'extend'` — continue the linear slope beyond the range.\n */\nexport type ExtrapolationMode = 'clamp' | 'identity' | 'extend'\n\nexport interface UseTransformOptions {\n extrapolateLeft?: ExtrapolationMode\n extrapolateRight?: ExtrapolationMode\n}\n\n/**\n * Derive a value from one or more shared values via a transformer worklet.\n *\n * ```ts\n * const x = useMotionValue(0)\n * const y = useMotionValue(0)\n * const distance = useTransform(() => Math.sqrt(x.value ** 2 + y.value ** 2))\n * ```\n *\n * The transformer must be a worklet (or a plain function we auto-wrap —\n * see the easing wrapper for the rationale). It runs on the UI thread on\n * every frame where any read shared value changes.\n */\nexport function useTransform<T>(transformer: () => T): SharedValue<T>\n\n/**\n * Interpolate a numeric shared value onto a range of numbers or colors.\n *\n * ```ts\n * const scroll = useMotionValue(0)\n * const headerOpacity = useTransform(scroll, [0, 100], [1, 0])\n * const headerColor = useTransform(scroll, [0, 100], ['#fff', '#000'])\n * ```\n *\n * When `outputRange` is numeric, this maps to Reanimated's `interpolate`;\n * when it's a tuple of color strings, it maps to `interpolateColor`. The\n * input range must be monotonically increasing.\n */\nexport function useTransform(\n value: SharedValue<number>,\n inputRange: readonly number[],\n outputRange: readonly number[],\n options?: UseTransformOptions,\n): SharedValue<number>\nexport function useTransform(\n value: SharedValue<number>,\n inputRange: readonly number[],\n outputRange: readonly string[],\n options?: UseTransformOptions,\n): SharedValue<string>\n\nexport function useTransform<T>(\n arg1: (() => T) | SharedValue<number>,\n inputRange?: readonly number[],\n outputRange?: readonly number[] | readonly string[],\n options?: UseTransformOptions,\n): SharedValue<T> | SharedValue<number> | SharedValue<string> {\n // Build the producer worklet on the JS thread, then call\n // `useDerivedValue` exactly once. Keeping the hook call unconditional\n // satisfies rules-of-hooks; per-call branching (transformer vs\n // interpolation) is decided once at JS time, never at frame time.\n let producer: () => unknown\n if (typeof arg1 === 'function') {\n // Transformer overload. The public surface accepts a plain function;\n // Reanimated 3.9+ requires worklets in nested-derivation contexts, so\n // we auto-wrap at JS time the same way `ensureWorkletEasing` does.\n const userFn = arg1 as () => T\n producer = isWorkletFunction(userFn)\n ? userFn\n : () => {\n 'worklet'\n return userFn()\n }\n } else {\n // Interpolation overload. We pre-resolve everything JS-side so the\n // worklet body only consumes flat values.\n const source = arg1\n const input = inputRange as readonly number[]\n const output = outputRange as readonly (number | string)[]\n const isColor = output.length > 0 && typeof output[0] === 'string'\n const extrapolateLeft = mapExtrapolation(options?.extrapolateLeft)\n const extrapolateRight = mapExtrapolation(options?.extrapolateRight)\n producer = isColor\n ? () => {\n 'worklet'\n return interpolateColor(\n source.value,\n input as number[],\n output as string[],\n )\n }\n : () => {\n 'worklet'\n return interpolate(\n source.value,\n input as number[],\n output as number[],\n { extrapolateLeft, extrapolateRight },\n )\n }\n }\n\n return useDerivedValue(producer as () => never) as unknown as\n | SharedValue<T>\n | SharedValue<number>\n | SharedValue<string>\n}\n\nfunction mapExtrapolation(mode: ExtrapolationMode | undefined): Extrapolation {\n if (mode === 'identity') return Extrapolation.IDENTITY\n if (mode === 'extend') return Extrapolation.EXTEND\n return Extrapolation.CLAMP\n}\n","import {\n useAnimatedScrollHandler,\n useSharedValue,\n type SharedValue,\n} from 'react-native-reanimated'\nimport { type NativeScrollEvent, type NativeSyntheticEvent } from 'react-native'\n\nexport interface UseScrollResult {\n /** Horizontal scroll offset in points. */\n scrollX: SharedValue<number>\n /** Vertical scroll offset in points. */\n scrollY: SharedValue<number>\n /**\n * Handler to pass to a `Motion.ScrollView`'s `onScroll` prop (or any other\n * Reanimated `Animated.ScrollView`). The handler is opaque to JS — it runs\n * as a worklet — but the type narrows to the same shape RN's native\n * `onScroll` prop expects so it composes cleanly.\n */\n onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void\n}\n\n/**\n * Track the scroll offset of a `Motion.ScrollView` as shared values.\n *\n * ```tsx\n * const { scrollY, onScroll } = useScroll()\n * const headerOpacity = useTransform(scrollY, [0, 100], [1, 0])\n *\n * return (\n * <>\n * <Motion.View animate={{ opacity: headerOpacity }} />\n * <Motion.ScrollView onScroll={onScroll} scrollEventThrottle={16}>\n * …\n * </Motion.ScrollView>\n * </>\n * )\n * ```\n *\n * Scroll events fire on the UI thread, so `scrollX` / `scrollY` are safe to\n * read from any worklet (`useAnimatedStyle`, `useDerivedValue`,\n * `useTransform`) without a JS-thread bounce.\n *\n * Remember to set `scrollEventThrottle={16}` on the `ScrollView` for 60Hz\n * updates — RN's default is to dispatch on every event, which on iOS still\n * means one per frame, but Android benefits from the explicit cap.\n */\nexport function useScroll(): UseScrollResult {\n const scrollX = useSharedValue(0)\n const scrollY = useSharedValue(0)\n\n const handler = useAnimatedScrollHandler({\n onScroll: (event) => {\n 'worklet'\n scrollX.value = event.contentOffset.x\n scrollY.value = event.contentOffset.y\n },\n })\n\n // `useAnimatedScrollHandler` returns an opaque worklet bag whose JS-side\n // type is `(event) => void` but actually carries native event-handler\n // wiring. Cast through `unknown` because the public RN `onScroll` type\n // wants a `NativeSyntheticEvent`-taking function and Reanimated's handler\n // is structurally compatible — the cast is to satisfy the consumer's\n // prop type at the call site.\n return {\n scrollX,\n scrollY,\n onScroll: handler as unknown as (\n event: NativeSyntheticEvent<NativeScrollEvent>,\n ) => void,\n }\n}\n","import {\n interpolate,\n interpolateColor,\n useAnimatedStyle,\n type SharedValue,\n} from 'react-native-reanimated'\n\n/**\n * Shape accepted on either end of a `useShadow` tween. Every field is\n * optional — only keys present on at least one side participate in the\n * output style. Mirrors the flat shadow keys on `Motion.View`'s `animate`\n * surface, plus the nested `shadowOffset` source.\n */\nexport interface ShadowConfig {\n shadowOpacity?: number\n shadowRadius?: number\n shadowOffset?: { width?: number; height?: number }\n /** Android elevation. iOS shadow consumers can leave this off. */\n elevation?: number\n shadowColor?: string\n}\n\nexport interface UseShadowOptions {\n /** Shadow state at `progress === 0`. */\n from: ShadowConfig\n /** Shadow state at `progress === 1`. */\n to: ShadowConfig\n /**\n * Driver — typically 0→1. Whatever produces it (a `useSpring`, a gesture\n * progress value, a scroll-derived `useTransform`) is the caller's\n * concern. The hook is a pure interpolator; it does not animate on its\n * own. Values outside `[0, 1]` clamp.\n */\n progress: SharedValue<number>\n}\n\n/**\n * Interpolate between two shadow configs as `progress` moves 0→1, returning\n * an animated style fragment that can be spread onto any Reanimated-aware\n * view (including `Motion.*` primitives and a hand-rolled `Animated.View`).\n *\n * ```tsx\n * const progress = useSpring(isElevated ? 1 : 0)\n * const shadowStyle = useShadow({\n * from: { shadowOpacity: 0.08, shadowRadius: 2, shadowOffset: { width: 0, height: 1 }, elevation: 1 },\n * to: { shadowOpacity: 0.24, shadowRadius: 12, shadowOffset: { width: 0, height: 8 }, elevation: 8 },\n * progress,\n * })\n *\n * return <Motion.View style={[styles.card, shadowStyle]} />\n * ```\n *\n * Only keys present on either `from` or `to` are emitted. A key present on\n * one side and absent on the other tweens from the present value to the\n * absent side's natural zero (`0` for numbers, `'transparent'` for\n * `shadowColor`, `{ width: 0, height: 0 }` for `shadowOffset`). This is a\n * pure interpolator — to \"animate\" the shadow, drive `progress` with a\n * spring, timing, or gesture upstream.\n */\nexport function useShadow({\n from,\n to,\n progress,\n}: UseShadowOptions): ReturnType<typeof useAnimatedStyle> {\n // Resolve presence + endpoints once on the JS thread so the worklet body\n // consumes flat literals — consistent with the JS-thread resolver\n // principle that keeps `Object.keys`-style walks off the UI thread.\n const hasOpacity =\n from.shadowOpacity !== undefined || to.shadowOpacity !== undefined\n const hasRadius =\n from.shadowRadius !== undefined || to.shadowRadius !== undefined\n const hasElevation =\n from.elevation !== undefined || to.elevation !== undefined\n const hasColor =\n from.shadowColor !== undefined || to.shadowColor !== undefined\n const hasOffset =\n from.shadowOffset !== undefined || to.shadowOffset !== undefined\n\n const opacityFrom = from.shadowOpacity ?? 0\n const opacityTo = to.shadowOpacity ?? 0\n const radiusFrom = from.shadowRadius ?? 0\n const radiusTo = to.shadowRadius ?? 0\n const elevationFrom = from.elevation ?? 0\n const elevationTo = to.elevation ?? 0\n const colorFrom = from.shadowColor ?? 'transparent'\n const colorTo = to.shadowColor ?? 'transparent'\n const offsetWFrom = from.shadowOffset?.width ?? 0\n const offsetWTo = to.shadowOffset?.width ?? 0\n const offsetHFrom = from.shadowOffset?.height ?? 0\n const offsetHTo = to.shadowOffset?.height ?? 0\n\n return useAnimatedStyle(() => {\n 'worklet'\n const t = progress.value\n const out: Record<string, unknown> = {}\n if (hasOpacity) {\n out.shadowOpacity = interpolate(t, [0, 1], [opacityFrom, opacityTo])\n }\n if (hasRadius) {\n out.shadowRadius = interpolate(t, [0, 1], [radiusFrom, radiusTo])\n }\n if (hasElevation) {\n out.elevation = interpolate(t, [0, 1], [elevationFrom, elevationTo])\n }\n if (hasColor) {\n out.shadowColor = interpolateColor(t, [0, 1], [colorFrom, colorTo])\n }\n if (hasOffset) {\n out.shadowOffset = {\n width: interpolate(t, [0, 1], [offsetWFrom, offsetWTo]),\n height: interpolate(t, [0, 1], [offsetHFrom, offsetHTo]),\n }\n }\n return out\n })\n}\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"]}