@onlynative/inertia 0.0.1-alpha.0
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.
- package/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +90 -0
- package/dist/index.d.mts +185 -0
- package/dist/index.d.ts +185 -0
- package/dist/index.js +817 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +796 -0
- package/dist/index.mjs.map +1 -0
- package/dist/motion/Image.d.mts +12 -0
- package/dist/motion/Image.d.ts +12 -0
- package/dist/motion/Image.js +656 -0
- package/dist/motion/Image.js.map +1 -0
- package/dist/motion/Image.mjs +650 -0
- package/dist/motion/Image.mjs.map +1 -0
- package/dist/motion/Pressable.d.mts +15 -0
- package/dist/motion/Pressable.d.ts +15 -0
- package/dist/motion/Pressable.js +656 -0
- package/dist/motion/Pressable.js.map +1 -0
- package/dist/motion/Pressable.mjs +650 -0
- package/dist/motion/Pressable.mjs.map +1 -0
- package/dist/motion/ScrollView.d.mts +12 -0
- package/dist/motion/ScrollView.d.ts +12 -0
- package/dist/motion/ScrollView.js +656 -0
- package/dist/motion/ScrollView.js.map +1 -0
- package/dist/motion/ScrollView.mjs +650 -0
- package/dist/motion/ScrollView.mjs.map +1 -0
- package/dist/motion/Text.d.mts +11 -0
- package/dist/motion/Text.d.ts +11 -0
- package/dist/motion/Text.js +656 -0
- package/dist/motion/Text.js.map +1 -0
- package/dist/motion/Text.mjs +650 -0
- package/dist/motion/Text.mjs.map +1 -0
- package/dist/motion/View.d.mts +11 -0
- package/dist/motion/View.d.ts +11 -0
- package/dist/motion/View.js +656 -0
- package/dist/motion/View.js.map +1 -0
- package/dist/motion/View.mjs +650 -0
- package/dist/motion/View.mjs.map +1 -0
- package/dist/types-CmbXx-G3.d.mts +185 -0
- package/dist/types-CmbXx-G3.d.ts +185 -0
- package/llms.txt +78 -0
- package/package.json +120 -0
- package/src/config/MotionConfig.tsx +30 -0
- package/src/config/MotionConfigContext.ts +53 -0
- package/src/config/index.ts +9 -0
- package/src/index.ts +49 -0
- package/src/motion/Image.tsx +9 -0
- package/src/motion/Pressable.tsx +12 -0
- package/src/motion/ScrollView.tsx +9 -0
- package/src/motion/Text.tsx +8 -0
- package/src/motion/View.tsx +8 -0
- package/src/motion/createMotionComponent.tsx +850 -0
- package/src/motion/index.ts +26 -0
- package/src/presence/Presence.tsx +165 -0
- package/src/presence/PresenceContext.ts +28 -0
- package/src/presence/index.ts +6 -0
- package/src/transitions/easing.ts +29 -0
- package/src/transitions/index.ts +2 -0
- package/src/transitions/resolve.ts +265 -0
- package/src/types.ts +207 -0
- package/src/values/index.ts +1 -0
- package/src/values/useVariants.ts +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/MotionConfigContext.ts","../../src/presence/PresenceContext.ts","../../src/transitions/easing.ts","../../src/transitions/resolve.ts","../../src/motion/createMotionComponent.tsx","../../src/motion/View.tsx"],"names":["createContext","useContext","step","Motion"],"mappings":";;;;;;AAwBO,IAAM,qBAAA,GAA2C;AAAA,EACtD,aAAA,EAAe;AACjB,CAAA;AAEO,IAAM,mBAAA,GAAsB,aAAA;AAAA,EACjC;AACF,CAAA;AAMO,SAAS,eAAA,GAAqC;AACnD,EAAA,OAAO,WAAW,mBAAmB,CAAA;AACvC;AAQO,SAAS,qBAAA,GAAiC;AAC/C,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,eAAA,EAAgB;AAC1C,EAAA,MAAM,YAAY,gBAAA,EAAiB;AACnC,EAAA,IAAI,aAAA,KAAkB,SAAS,OAAO,KAAA;AACtC,EAAA,IAAI,aAAA,KAAkB,UAAU,OAAO,IAAA;AACvC,EAAA,OAAO,SAAA;AACT;AClCO,IAAM,eAAA,GAAkBA,cAA2C,IAAI,CAAA;AAOvE,SAAS,WAAA,GAA2C;AACzD,EAAA,OAAOC,WAAW,eAAe,CAAA;AACnC;ACTO,SAAS,oBACd,MAAA,EACqC;AACrC,EAAA,IAA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Context } 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 { 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 { isWorkletFunction } from 'react-native-reanimated'\n\n/**\n * Reanimated 3.9+ validates that easing functions used in nested-transition\n * contexts (variants, sequences, per-property maps) are worklets, and crashes\n * with `[Reanimated] The easing function is not a worklet` otherwise. The\n * library accepts plain functions on the public surface; this helper wraps\n * them so consumers don't have to think about the worklet boundary.\n *\n * If the input is already a worklet (has been processed by the worklets babel\n * plugin), it's returned as-is. Otherwise it's wrapped in a function whose\n * body declares the `'worklet'` directive — when our source is processed by\n * the consumer's worklets babel plugin (the default Expo/RN setup), the\n * wrapper becomes a real worklet that captures the user fn via closure.\n *\n * The user fn must be pure: no JS-thread captured refs, no shared mutable\n * state, no calls to non-worklet APIs.\n */\nexport function ensureWorkletEasing(\n easing: ((t: number) => number) | undefined,\n): ((t: number) => number) | undefined {\n if (!easing) return undefined\n if (isWorkletFunction(easing)) return easing\n const wrapped = (t: number) => {\n 'worklet'\n return easing(t)\n }\n return wrapped\n}\n","import {\n Easing,\n withDecay,\n withDelay,\n withRepeat,\n withSequence,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\nimport { ensureWorkletEasing } from './easing'\nimport {\n type AnimatableValue,\n type DecayTransition,\n type RepeatConfig,\n type SequenceStep,\n type SpringTransition,\n type TimingTransition,\n type TransitionConfig,\n} from '../types'\n\n/**\n * UI-thread callback Reanimated invokes when an animation settles. Must be a\n * worklet — callers either author one with `'worklet'` or build one via\n * `runOnJS(...)` to bridge to JS-thread code.\n */\nexport type AnimationCallback = (\n finished?: boolean,\n current?: number | string,\n) => void\n\n/**\n * Per-step callback factory. Resolvers call this with the step's phase and\n * sequence index (or `undefined` for non-sequence animations) and attach the\n * resulting callback to the underlying `withSpring` / `withTiming` /\n * `withDecay` call.\n */\nexport type CallbackFactory = (\n phase: 'step' | 'animation',\n step: number | undefined,\n) => AnimationCallback | undefined\n\n/**\n * Default spring physics, expressed in react-spring vocabulary. Conversion\n * to Reanimated's raw `stiffness` / `damping` lives below; raw config never\n * leaks past this module.\n */\nconst DEFAULT_SPRING: Required<\n Pick<SpringTransition, 'tension' | 'friction' | 'mass'>\n> = {\n tension: 170,\n friction: 26,\n mass: 1,\n}\n\nconst DEFAULT_TIMING_DURATION = 250\n\nfunction springToReanimated(t: SpringTransition) {\n return {\n stiffness: t.tension ?? DEFAULT_SPRING.tension,\n damping: t.friction ?? DEFAULT_SPRING.friction,\n mass: t.mass ?? DEFAULT_SPRING.mass,\n velocity: t.velocity,\n restSpeedThreshold: t.restSpeedThreshold,\n restDisplacementThreshold: t.restDisplacementThreshold,\n }\n}\n\nfunction buildSpring(\n cfg: SpringTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withSpring(toValue as number, springToReanimated(cfg), cb as never)\n}\n\nfunction buildTiming(\n cfg: TimingTransition,\n toValue: number | string,\n cb?: AnimationCallback,\n) {\n return withTiming(\n toValue as number,\n {\n duration: cfg.duration ?? DEFAULT_TIMING_DURATION,\n easing: ensureWorkletEasing(cfg.easing) ?? Easing.inOut(Easing.ease),\n },\n cb as never,\n )\n}\n\nfunction buildDecay(cfg: DecayTransition, cb?: AnimationCallback) {\n return withDecay(\n {\n velocity: cfg.velocity ?? 0,\n deceleration: cfg.deceleration,\n clamp: cfg.clamp,\n },\n cb as never,\n )\n}\n\n/**\n * Build a single-step animation (no repeat / no delay / no sequence) for a\n * given config + target. Pulled out so sequence steps can compose without\n * recursing into repeat/delay handling per step. The callback is forwarded\n * to Reanimated; for `no-animation` the callback is fired synchronously\n * since there's nothing to wait for.\n */\nfunction buildOne(\n cfg: TransitionConfig,\n toValue: number | string,\n cb?: AnimationCallback,\n): unknown {\n if (cfg.type === 'no-animation') {\n if (cb) cb(true, toValue)\n return toValue\n }\n if (cfg.type === 'decay') return buildDecay(cfg, cb)\n if (cfg.type === 'timing') return buildTiming(cfg, toValue, cb)\n return buildSpring(cfg as SpringTransition, toValue, cb)\n}\n\n/**\n * Wrap an animation in `withRepeat` per the unified `repeat` shape:\n * - `number` → finite count, alternating direction\n * - `'infinite'` → endless, alternating direction\n * - `{ count, alternate }`→ explicit; `alternate` defaults to `true`\n */\nfunction applyRepeat(animation: unknown, repeat: RepeatConfig | undefined) {\n if (repeat === undefined) return animation\n if (repeat === 'infinite') {\n return withRepeat(animation as never, -1, true)\n }\n if (typeof repeat === 'number') {\n return withRepeat(animation as never, repeat, true)\n }\n const count = repeat.count === 'infinite' ? -1 : repeat.count\n const alternate = repeat.alternate ?? true\n return withRepeat(animation as never, count, alternate)\n}\n\nfunction applyDelay(animation: unknown, delay: number | undefined) {\n if (!delay || delay <= 0) return animation\n return withDelay(delay, animation as never)\n}\n\n/**\n * Build a Reanimated animation for a single property. Runs on the JS thread\n * once per change and produces a baked `withSpring` / `withTiming` /\n * `withDecay` (optionally wrapped in `withDelay` / `withRepeat`) call. The\n * worklet body only consumes the result.\n *\n * `callback`, when provided, fires once when the underlying single-shot\n * animation settles. Repeat-wrapped animations forward the callback to\n * `withRepeat`, so it fires once per iteration as Reanimated does.\n */\nexport function resolveTransition(\n config: TransitionConfig | undefined,\n toValue: number | string,\n callback?: AnimationCallback,\n): unknown {\n const cfg = config ?? ({ type: 'spring' } as SpringTransition)\n const base = buildOne(cfg, toValue, callback)\n const repeated = applyRepeat(base, repeatOf(cfg))\n return applyDelay(repeated, delayOf(cfg))\n}\n\nfunction repeatOf(cfg: TransitionConfig): RepeatConfig | undefined {\n if (cfg.type === 'no-animation' || cfg.type === 'decay') return undefined\n return cfg.repeat\n}\n\n/**\n * Return `cfg` minus its `repeat` field. Used when peeling top-level repeat\n * off a base transition before passing it down to per-sequence-step\n * resolution — the sequence as a whole is what should repeat, not each step.\n */\nfunction stripRepeat(\n cfg: TransitionConfig | undefined,\n): TransitionConfig | undefined {\n if (!cfg) return cfg\n if (cfg.type === 'no-animation' || cfg.type === 'decay') return cfg\n if (cfg.repeat === undefined) return cfg\n const next = { ...cfg }\n delete next.repeat\n return next\n}\n\nfunction delayOf(cfg: TransitionConfig): number | undefined {\n if (cfg.type === 'no-animation') return undefined\n return cfg.delay\n}\n\n/**\n * True when the value is a `{ to, ...transitionOverride }` sequence step.\n * Plain numbers and plain transition objects fail this check.\n */\nfunction isStepObject<V>(\n v: SequenceStep<V> | V,\n): v is Extract<SequenceStep<V>, { to: V }> {\n return (\n typeof v === 'object' &&\n v !== null &&\n !Array.isArray(v) &&\n 'to' in (v as object)\n )\n}\n\n/**\n * Resolve a per-property `animate` value into a Reanimated animation.\n *\n * Handles the three shapes of `AnimatableValue`:\n * 1. plain value → single `resolveTransition` call\n * 2. `{ to, ...over }` → single step with the override merged into `base`\n * 3. array of either → `withSequence` of resolved steps, with the\n * top-level `repeat` applied at the **sequence level** (not per step).\n * Per-step `repeat` overrides remain step-local.\n */\nexport function resolveAnimatableValue<V extends number | string>(\n value: AnimatableValue<V>,\n base: TransitionConfig | undefined,\n factory?: CallbackFactory,\n): unknown {\n if (Array.isArray(value)) {\n const steps = value as ReadonlyArray<SequenceStep<V>>\n const stepBase = stripRepeat(base)\n const animations = steps.map((step, i) =>\n resolveStep(step, stepBase, factory?.('step', i)),\n )\n const seq = withSequence(...(animations as never[]))\n return applyRepeat(seq, base ? repeatOf(base) : undefined)\n }\n const step = value as SequenceStep<V>\n const cb = factory?.('animation', undefined)\n if (isStepObject<V>(step)) {\n return resolveStep(step, base, cb)\n }\n return resolveTransition(base, step as V, cb)\n}\n\nfunction resolveStep<V extends number | string>(\n step: SequenceStep<V>,\n base: TransitionConfig | undefined,\n cb?: AnimationCallback,\n): unknown {\n if (isStepObject<V>(step)) {\n const { to, ...override } = step as { to: V } & Partial<TransitionConfig>\n const merged = mergeTransition(base, override as Partial<TransitionConfig>)\n return resolveTransition(merged, to, cb)\n }\n return resolveTransition(base, step as V, cb)\n}\n\nfunction mergeTransition(\n base: TransitionConfig | undefined,\n override: Partial<TransitionConfig>,\n): TransitionConfig {\n // If the override declares a `type`, it wins outright — mixing fields from\n // a spring base into a timing override produces garbage. Otherwise inherit\n // the base's type and shallow-merge the rest.\n if (override.type && base && override.type !== base.type) {\n return override as TransitionConfig\n }\n return { ...(base ?? { type: 'spring' }), ...override } as TransitionConfig\n}\n","import {\n type ComponentType,\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport Animated, {\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n type SharedValue,\n} from 'react-native-reanimated'\nimport { useShouldReduceMotion } from '../config'\nimport { usePresence } from '../presence'\nimport { resolveAnimatableValue } from '../transitions'\nimport {\n type AnimatableValue,\n type AnimateStyle,\n type AnimationCallbackInfo,\n type GestureSubStates,\n type MotionComponent,\n type MotionProps,\n type PerPropertyTransition,\n type Transition,\n type TransitionConfig,\n type VariantController,\n type VariantsMap,\n} from '../types'\n\n/**\n * Animatable properties supported in the alpha. Expanding this set is a\n * mechanical change — add the key here, decide whether it lives inside\n * `transform`, and wire it through `buildAnimatedStyle` below.\n */\nconst TRANSFORM_KEYS = [\n 'translateX',\n 'translateY',\n 'scale',\n 'scaleX',\n 'scaleY',\n 'rotate',\n] as const\n\nconst TOP_LEVEL_KEYS = ['opacity', 'width', 'height', 'borderRadius'] as const\n\n/**\n * Per-effect transform-group coordinator. Counts how many transform-axis\n * terminal callbacks are still pending; when the last one fires, the\n * factory emits a single coalesced `onAnimationEnd({ key: 'transform' })`\n * instead of N per-axis callbacks. Mutated by the dispatch closure.\n */\ntype TransformGroup = { remaining: number }\n\nconst ALL_KEYS = [...TRANSFORM_KEYS, ...TOP_LEVEL_KEYS] as const\ntype AnimatableKey = (typeof ALL_KEYS)[number]\ntype TransformKey = (typeof TRANSFORM_KEYS)[number]\n\nconst TRANSFORM_KEY_SET = new Set<AnimatableKey>(TRANSFORM_KEYS)\n\n// Stable style object applied while a Motion primitive is mid-exit so taps\n// fall through. Hoisted so every render shares the same reference and\n// Reanimated's style merging treats it as a no-op when present.\nconst EXITING_POINTER_EVENTS_STYLE = { pointerEvents: 'none' } as const\n\nconst DEFAULT_RESTING: Record<AnimatableKey, number> = {\n translateX: 0,\n translateY: 0,\n scale: 1,\n scaleX: 1,\n scaleY: 1,\n rotate: 0,\n opacity: 1,\n width: 0,\n height: 0,\n borderRadius: 0,\n}\n\nconst TRANSITION_KEYS = new Set([\n 'type',\n 'tension',\n 'friction',\n 'mass',\n 'velocity',\n 'restSpeedThreshold',\n 'restDisplacementThreshold',\n 'duration',\n 'easing',\n 'delay',\n 'repeat',\n 'deceleration',\n 'clamp',\n])\n\nfunction isTopLevelTransition(t: unknown): t is TransitionConfig {\n if (t === null || typeof t !== 'object') return false\n const keys = Object.keys(t as object)\n if (keys.length === 0) return false\n return keys.every((k) => TRANSITION_KEYS.has(k))\n}\n\nfunction transitionFor<S>(\n prop: keyof S,\n transition: Transition<S> | undefined,\n): TransitionConfig | undefined {\n if (!transition) return undefined\n if (isTopLevelTransition(transition)) return transition\n return (transition as PerPropertyTransition<S>)[prop]\n}\n\n/**\n * Factory that wraps a React Native primitive as a `Motion.*` component.\n *\n * The generic `C` flows through `MotionProps`, so `animate` / `initial` /\n * `exit` / `transition` all infer from `C`'s `style` prop. There is no\n * shared `ViewStyle & TextStyle & ImageStyle` fallback.\n *\n * Alpha scope: numeric properties listed in `ALL_KEYS`, applied via\n * Reanimated shared values + `useAnimatedStyle`. Sequences, variants,\n * gestures, color animation, and the cross-render memoization optimization\n * land in later phases.\n */\nexport function createMotionComponent<C extends ComponentType<any>>(\n Component: C,\n): MotionComponent<C> {\n const AnimatedComponent = Animated.createAnimatedComponent(\n Component as ComponentType<any>,\n )\n\n type Props = React.ComponentProps<C> & MotionProps<React.ComponentProps<C>>\n\n const Motion = forwardRef<unknown, Props>(function Motion(props, ref) {\n const {\n initial,\n animate,\n exit,\n transition,\n variants,\n controller,\n gesture,\n onAnimationEnd,\n style,\n ...rest\n } = props as Props & { style?: unknown }\n\n // <Presence> contract: when an ancestor flips `isPresent` to false the\n // child stays rendered until `safeToRemove` is called, giving the exit\n // animation time to play. `null` when there is no <Presence> ancestor.\n const presence = usePresence()\n const isExiting = presence !== null && presence.isPresent === false\n\n // Resolved reduced-motion preference for this subtree. When true, every\n // per-key transition is replaced with `no-animation` below, so values\n // snap to target without interpolation. The hook also subscribes to OS\n // changes (via Reanimated's `useReducedMotion`), so toggling the\n // accessibility setting at runtime re-renders this component.\n const shouldReduceMotion = useShouldReduceMotion()\n\n // Pin the latest `onAnimationEnd` in a ref so the worklet callback always\n // dispatches against the current closure without re-resolving the\n // animation graph. Worklets can read refs via `runOnJS`.\n const onAnimationEndRef = useRef(onAnimationEnd)\n onAnimationEndRef.current = onAnimationEnd\n\n // Resolve `animate` against `variants` / `controller`. The controller's\n // `current` wins when both are set (typed contract: don't mix\n // `controller` and `animate` — controller drives the animation in that\n // mode). When `animate` is a string and `variants` exist, look it up.\n const variantKey = useControllerKey(controller)\n const resolvedAnimate = resolveAnimateInput(\n animate as AnimateStyle<unknown> | string | undefined,\n variants as VariantsMap<unknown> | undefined,\n variantKey,\n )\n\n const animateRecord = (resolvedAnimate ?? {}) as Partial<\n Record<AnimatableKey, AnimatableValue<number>>\n >\n const initialRecord =\n initial && initial !== false\n ? (initial as Partial<Record<AnimatableKey, number>>)\n : undefined\n const exitRecord = exit\n ? (exit as Partial<Record<AnimatableKey, AnimatableValue<number>>>)\n : undefined\n\n // Gesture sub-state activation tracked as JS state so changes invalidate\n // the merged-target signature and re-run the animation effect. The cost\n // is three useState slots regardless of whether `gesture` is set; that's\n // tiny and lets us stay rules-of-hooks-clean.\n const [pressed, setPressed] = useState(false)\n const [focused, setFocused] = useState(false)\n const [hovered, setHovered] = useState(false)\n\n // The set of keys this instance animates is locked at first render. With\n // variants in play the union across all variants is what matters — a key\n // touched by any variant must be active so the worklet picks it up when\n // the controller transitions. Gesture sub-states join the same union so\n // pressed/focused/hovered targets can drive any key they declare.\n const activeKeysRef = useRef<readonly AnimatableKey[] | null>(null)\n if (activeKeysRef.current === null) {\n const touched = new Set<AnimatableKey>()\n for (const k of ALL_KEYS) {\n if (k in animateRecord) touched.add(k)\n if (initialRecord && k in initialRecord) touched.add(k)\n }\n if (variants) {\n for (const variant of Object.values(variants) as object[]) {\n if (!variant) continue\n for (const k of ALL_KEYS) {\n if (k in variant) touched.add(k)\n }\n }\n }\n if (gesture) {\n for (const subState of [\n gesture.pressed,\n gesture.focused,\n gesture.hovered,\n ] as Array<object | undefined>) {\n if (!subState) continue\n for (const k of ALL_KEYS) {\n if (k in subState) touched.add(k)\n }\n }\n }\n if (exitRecord) {\n for (const k of ALL_KEYS) {\n if (k in exitRecord) touched.add(k)\n }\n }\n activeKeysRef.current = ALL_KEYS.filter((k) => touched.has(k))\n }\n const hasTransformRef = useRef<boolean>(\n activeKeysRef.current.some((k) => TRANSFORM_KEY_SET.has(k)),\n )\n\n const sharedValues = useAnimatableSharedValues((key) => {\n if (initial === false) {\n const a = animateRecord[key]\n return restValue(a) ?? DEFAULT_RESTING[key]\n }\n return (\n initialRecord?.[key] ??\n restValue(animateRecord[key]) ??\n DEFAULT_RESTING[key]\n )\n })\n\n // Merge gesture sub-state targets over the base `animate` record. Keys\n // touched by any sub-state always appear in the merged record (falling\n // back to `animateRecord` or `DEFAULT_RESTING`) so releasing a gesture\n // animates back to a defined value rather than getting skipped.\n //\n // While exiting, exit values override everything — gesture / animate\n // targets are inert because the component is on its way out.\n const mergedRecord =\n isExiting && exitRecord\n ? { ...animateRecord, ...exitRecord }\n : mergeGestureTargets(animateRecord, gesture, {\n pressed,\n focused,\n hovered,\n })\n const mergedSig =\n stableSig(mergedRecord) +\n (isExiting ? '|exit' : '') +\n (shouldReduceMotion ? '|rm' : '')\n const transitionSig = stableSig(transition)\n\n // Stable ref to the live `safeToRemove` so the effect's settle-counter\n // closure can reach the latest <Presence> binding without retriggering.\n const safeToRemoveRef = useRef<(() => void) | undefined>(undefined)\n safeToRemoveRef.current = presence?.safeToRemove\n\n useEffect(() => {\n // Exit fast-path: nothing to animate (or no exit prop), tell <Presence>\n // immediately so the unmount isn't gated on a phantom animation.\n if (isExiting && (!exitRecord || Object.keys(exitRecord).length === 0)) {\n safeToRemoveRef.current?.()\n return\n }\n\n let pending = 0\n let done = false\n const onSettle = () => {\n if (done) return\n pending--\n if (pending <= 0) {\n done = true\n if (isExiting) safeToRemoveRef.current?.()\n }\n }\n\n // Count transform axes participating in this effect run so the factory\n // can coalesce their terminal callbacks into a single transform-group\n // event. `undefined` when no transform axis is animating, which lets\n // the factory skip the coalescing branch entirely.\n let transformPending = 0\n for (const k of ALL_KEYS) {\n if (TRANSFORM_KEY_SET.has(k) && mergedRecord[k] !== undefined) {\n transformPending++\n }\n }\n const transformGroup: TransformGroup | undefined =\n transformPending > 0 ? { remaining: transformPending } : undefined\n\n for (const key of ALL_KEYS) {\n const target = mergedRecord[key]\n if (target === undefined) continue\n // Reduced-motion overrides every per-key transition (and any nested\n // sequence-step transition) with `no-animation`, which the resolver\n // turns into a direct value assignment. Sequences still iterate but\n // each step settles instantly, which matches the \"snap to final\n // state\" expectation.\n const cfg = shouldReduceMotion\n ? ({ type: 'no-animation' } as const)\n : transitionFor(key, transition)\n if (isExiting) pending++\n const factory = makeKeyCallbackFactory(\n key,\n sharedValues[key],\n targetEndValue(target),\n onAnimationEndRef,\n {\n stepCount: stepCountOf(target),\n totalIterations: totalIterationsOf(cfg),\n },\n isExiting ? onSettle : undefined,\n TRANSFORM_KEY_SET.has(key) ? transformGroup : undefined,\n )\n sharedValues[key].value = resolveAnimatableValue(\n target,\n cfg,\n factory,\n ) as never\n }\n\n // No exit-targeted keys (only `animate` keys present, no `exit`)\n // → release immediately rather than wait for animations that aren't\n // headed toward an exit value.\n if (isExiting && pending === 0) {\n safeToRemoveRef.current?.()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [mergedSig, transitionSig])\n\n const animatedStyle = useAnimatedStyle(() => {\n const activeKeys = activeKeysRef.current!\n const hasTransform = hasTransformRef.current\n const out: Record<string, unknown> = {}\n const transform: Array<Record<string, unknown>> = []\n for (const key of activeKeys) {\n const v = sharedValues[key].value\n if (TRANSFORM_KEY_SET.has(key)) {\n transform.push(\n key === 'rotate' ? { rotate: `${v}deg` } : { [key]: v },\n )\n } else {\n out[key] = v\n }\n }\n if (hasTransform) out.transform = transform\n return out\n })\n\n // Exiting children are tap-deaf: the next press should fall through to\n // whatever is underneath, not re-trigger a soon-to-unmount node. This is\n // the moti #297 fix and a v0.1 acceptance criterion. RN 0.71+ deprecates\n // `pointerEvents` as a prop in favor of the style key, so we merge it\n // alongside the animated style instead of spreading as a prop.\n const mergedStyle = useMemo(\n () =>\n (isExiting\n ? [style, animatedStyle, EXITING_POINTER_EVENTS_STYLE]\n : [style, animatedStyle]) as unknown,\n [style, animatedStyle, isExiting],\n )\n\n const gestureHandlers = useGestureHandlers(\n gesture,\n rest as Record<string, unknown>,\n setPressed,\n setFocused,\n setHovered,\n )\n\n return (\n <AnimatedComponent\n ref={ref as never}\n {...(rest as object)}\n {...gestureHandlers}\n style={mergedStyle}\n />\n )\n })\n\n Motion.displayName = `Motion(${Component.displayName ?? Component.name ?? 'Component'})`\n\n return Motion as unknown as MotionComponent<C>\n}\n\ntype SharedValueMap = Record<AnimatableKey, SharedValue<number>>\n\n/**\n * Allocate one shared value per animatable key in `ALL_KEYS` and return a\n * **stable** map — same object reference across every render.\n *\n * Stability matters: `useAnimatedStyle` derives its dep array from\n * `Object.values(updater.__closure)`. Our worklet captures `sharedValues`,\n * so a fresh object literal each render would change that dep, fire\n * Reanimated's effect, and re-bind the worklet on the UI thread on every\n * render — the exact cost design principle 8 calls out. The shared values themselves\n * are stable across renders (Reanimated's `useSharedValue` is a `useRef`\n * under the hood), so snapshotting the wrapping object once is safe.\n *\n * Hooks are called in a stable, lexical order — fine for rules-of-hooks.\n * Unused shared values are cheap; the worklet skips them via\n * `activeKeysRef`.\n */\nfunction useAnimatableSharedValues(\n init: (key: AnimatableKey) => number,\n): SharedValueMap {\n const translateX = useSharedValue(init('translateX'))\n const translateY = useSharedValue(init('translateY'))\n const scale = useSharedValue(init('scale'))\n const scaleX = useSharedValue(init('scaleX'))\n const scaleY = useSharedValue(init('scaleY'))\n const rotate = useSharedValue(init('rotate'))\n const opacity = useSharedValue(init('opacity'))\n const width = useSharedValue(init('width'))\n const height = useSharedValue(init('height'))\n const borderRadius = useSharedValue(init('borderRadius'))\n\n const ref = useRef<SharedValueMap | null>(null)\n if (ref.current === null) {\n ref.current = {\n translateX,\n translateY,\n scale,\n scaleX,\n scaleY,\n rotate,\n opacity,\n width,\n height,\n borderRadius,\n }\n }\n return ref.current\n}\n\n/**\n * Build a per-key `CallbackFactory` for the resolver. Each step in a sequence\n * (or the single animation, when `value` isn't an array) gets its own\n * Reanimated callback; when it settles on the UI thread, the callback bridges\n * to JS via `runOnJS` and invokes the user's `onAnimationEnd` with a fully\n * populated `AnimationCallbackInfo`.\n *\n * Phase resolution lives here, on the JS thread. The resolver hands us a\n * coarse rawPhase (`'step'` for any sequence step, `'animation'` for a\n * single-shot terminal); we map that onto the public phase set\n * (`'step' | 'sequence' | 'repeat' | 'animation'`) using `meta` and the\n * iteration counter. `iteration` resets per effect run because the factory\n * is constructed fresh inside the effect.\n */\nfunction makeKeyCallbackFactory(\n key: string,\n sharedValue: SharedValue<number>,\n target: number | string | undefined,\n onAnimationEndRef: {\n current: ((info: AnimationCallbackInfo<unknown>) => void) | undefined\n },\n meta: { stepCount: number; totalIterations: number },\n onSettle?: () => void,\n transformGroup?: TransformGroup,\n) {\n if (!onAnimationEndRef.current && !onSettle) return undefined\n\n // Shared across this animation graph's callbacks (one per sequence step,\n // or one for a single-shot). Mutated when a full pass completes.\n const state = { iteration: 0 }\n\n const isTransformKey = TRANSFORM_KEY_SET.has(key as AnimatableKey)\n\n const dispatch = (\n rawPhase: 'step' | 'animation',\n step: number | undefined,\n finished: boolean,\n value: number | string | undefined,\n ) => {\n const isLastIteration = state.iteration >= meta.totalIterations - 1\n let phase: 'step' | 'sequence' | 'repeat' | 'animation'\n let isTerminal = false\n\n if (rawPhase === 'step') {\n const isLastInPass = step !== undefined && step === meta.stepCount - 1\n if (!isLastInPass) {\n phase = 'step'\n } else if (isLastIteration) {\n phase = 'animation'\n isTerminal = true\n } else {\n phase = 'sequence'\n }\n } else if (isLastIteration) {\n phase = 'animation'\n isTerminal = true\n } else {\n phase = 'repeat'\n }\n\n const reportedIteration = state.iteration\n if (phase === 'sequence' || phase === 'repeat') state.iteration++\n\n const fn = onAnimationEndRef.current\n if (fn) {\n // Transform-group coalescing: a multi-axis translate / scale /\n // rotate animation should fire onAnimationEnd ONCE for the logical\n // transform, not once per axis. We only coalesce the terminal\n // `'animation'` phase — `step`/`sequence`/`repeat` events fire\n // per-axis since each is its own logical event. Released per-axis\n // for a single-axis case too, with `key: 'transform'` for\n // consistency.\n if (isTransformKey && transformGroup && phase === 'animation') {\n transformGroup.remaining--\n if (transformGroup.remaining <= 0) {\n fn({\n key: 'transform' as never,\n finished,\n value,\n target,\n phase,\n step,\n iteration: reportedIteration,\n })\n }\n } else {\n fn({\n key: key as never,\n finished,\n value,\n target,\n phase,\n step,\n iteration: reportedIteration,\n })\n }\n }\n // Settle hooks fire per-axis on the terminal phase — <Presence> waits\n // for *every* exiting property to settle before unmounting, so we\n // intentionally do not coalesce these (the transform-group coalesce\n // is purely a user-callback ergonomic).\n if (onSettle && isTerminal) onSettle()\n }\n\n return (rawPhase: 'step' | 'animation', step: number | undefined) => {\n // Reanimated invokes the callback with only `finished` (see\n // valueSetter.js:24,40,51 in 4.x) — `current` is never passed. Read the\n // shared value inside the worklet; by the time the callback fires the\n // final/clamped value has already been written to it.\n const cb = (finished?: boolean) => {\n 'worklet'\n runOnJS(dispatch)(rawPhase, step, !!finished, sharedValue.value)\n }\n return cb\n }\n}\n\n/**\n * Number of sequence steps in an animatable value. `1` for plain values and\n * single-step `{ to }` objects; the array length for keyframe arrays.\n */\nfunction stepCountOf(v: AnimatableValue<number> | undefined): number {\n if (Array.isArray(v)) return v.length\n return 1\n}\n\n/**\n * Total number of iterations the animation will run, including the initial\n * pass. `1` when there is no `repeat`; `Number.POSITIVE_INFINITY` for\n * `'infinite'`. Decay and `no-animation` configs cannot repeat — both return\n * `1` so the iteration counter stays at 0.\n */\nfunction totalIterationsOf(cfg: TransitionConfig | undefined): number {\n if (!cfg || cfg.type === 'no-animation' || cfg.type === 'decay') return 1\n const r = cfg.repeat\n if (r === undefined) return 1\n if (r === 'infinite') return Number.POSITIVE_INFINITY\n if (typeof r === 'number') return r\n if (r.count === 'infinite') return Number.POSITIVE_INFINITY\n return r.count\n}\n\n/**\n * Pull a single end-value out of an `AnimatableValue` for the\n * `AnimationCallbackInfo.target` field. Plain numbers/strings come through;\n * the last sequence step's `to`/value is used for arrays; `{ to }` step\n * objects use `to`. Returns `undefined` for unrecognized shapes.\n */\nfunction targetEndValue(\n v: AnimatableValue<number> | undefined,\n): number | string | undefined {\n if (v === undefined) return undefined\n if (typeof v === 'number' || typeof v === 'string') return v\n if (Array.isArray(v)) {\n return v.length > 0\n ? targetEndValue(v[v.length - 1] as AnimatableValue<number>)\n : undefined\n }\n if (typeof v === 'object' && v !== null && 'to' in v) {\n const to = (v as { to: unknown }).to\n return typeof to === 'number' || typeof to === 'string' ? to : undefined\n }\n return undefined\n}\n\n/**\n * Subscribe to a `VariantController` and return its `current` key. Returns\n * `undefined` when no controller is provided so callers can fall back to a\n * literal `animate` value.\n */\nfunction useControllerKey(\n controller: VariantController | undefined,\n): string | undefined {\n const [, setTick] = useState(0)\n useEffect(() => {\n if (!controller) return\n const unsub = controller.subscribe(() => setTick((n) => n + 1))\n return unsub\n }, [controller])\n return controller?.current\n}\n\n/**\n * Resolve the effective `animate` target from the public-prop tuple.\n *\n * Precedence: `controller.current` (when controller is set) > string-keyed\n * `animate` looked up in `variants` > literal `animate` object > `undefined`.\n */\nfunction resolveAnimateInput(\n animate: AnimateStyle<unknown> | string | undefined,\n variants: VariantsMap<unknown> | undefined,\n controllerKey: string | undefined,\n): AnimateStyle<unknown> | undefined {\n if (controllerKey !== undefined && variants && controllerKey in variants) {\n return variants[controllerKey]\n }\n if (typeof animate === 'string') {\n if (variants && animate in variants) return variants[animate]\n if (__DEV__) {\n console.warn(\n `[inertia] animate=\"${animate}\" but no matching variant. Did you forget to pass \\`variants\\`?`,\n )\n }\n return undefined\n }\n return animate as AnimateStyle<unknown> | undefined\n}\n\ndeclare const __DEV__: boolean\n\n/**\n * Pick the resting/initial-frame number out of an `AnimatableValue`. Plain\n * numbers come through unchanged; sequence arrays use their first element;\n * `{ to }` step objects use `to`. Non-numeric or unresolvable shapes return\n * `undefined` so the caller can fall back to `DEFAULT_RESTING`.\n */\nfunction restValue(v: AnimatableValue<number> | undefined): number | undefined {\n if (v === undefined) return undefined\n if (typeof v === 'number') return v\n if (Array.isArray(v)) {\n return v.length > 0 ? restValue(v[0] as AnimatableValue<number>) : undefined\n }\n if (typeof v === 'object' && v !== null && 'to' in v) {\n const to = (v as { to: unknown }).to\n return typeof to === 'number' ? to : undefined\n }\n return undefined\n}\n\nfunction stableSig(value: unknown): string {\n if (value === undefined) return ''\n try {\n return stableStringify(value)\n } catch {\n return String(value)\n }\n}\n\n/**\n * JSON.stringify with keys sorted at every level — gives a stable signature\n * regardless of property declaration order. Functions serialize as `null` so a\n * change in easing-fn reference is invisible here; that's fine for v0.1\n * (easing swaps are rare and the worklet wrapper handles correctness).\n */\nfunction stableStringify(v: unknown): string {\n if (v === null || typeof v !== 'object') {\n if (typeof v === 'function' || v === undefined) return 'null'\n return JSON.stringify(v)\n }\n if (Array.isArray(v)) {\n return '[' + v.map(stableStringify).join(',') + ']'\n }\n const obj = v as Record<string, unknown>\n const keys = Object.keys(obj).sort()\n return (\n '{' +\n keys\n .map((k) => JSON.stringify(k) + ':' + stableStringify(obj[k]))\n .join(',') +\n '}'\n )\n}\n\n/**\n * Merge gesture sub-state targets over the base `animate` record. Keys touched\n * by any declared sub-state are always present in the result so releasing a\n * gesture animates the property back to a defined value (the base `animate`\n * value when present, otherwise `DEFAULT_RESTING`). Sub-states layer in\n * priority order: `hovered` < `focused` < `pressed`.\n */\nfunction mergeGestureTargets(\n base: Partial<Record<AnimatableKey, AnimatableValue<number>>>,\n gesture: GestureSubStates<unknown> | undefined,\n active: { pressed: boolean; focused: boolean; hovered: boolean },\n): Partial<Record<AnimatableKey, AnimatableValue<number>>> {\n if (!gesture) return base\n const merged: Partial<Record<AnimatableKey, AnimatableValue<number>>> = {\n ...base,\n }\n const subStates = [\n gesture.hovered,\n gesture.focused,\n gesture.pressed,\n ] as Array<\n Partial<Record<AnimatableKey, AnimatableValue<number>>> | undefined\n >\n for (const sub of subStates) {\n if (!sub) continue\n for (const k of ALL_KEYS) {\n if (k in sub && !(k in merged)) {\n merged[k] = DEFAULT_RESTING[k]\n }\n }\n }\n if (active.hovered && gesture.hovered) {\n Object.assign(\n merged,\n gesture.hovered as Partial<\n Record<AnimatableKey, AnimatableValue<number>>\n >,\n )\n }\n if (active.focused && gesture.focused) {\n Object.assign(\n merged,\n gesture.focused as Partial<\n Record<AnimatableKey, AnimatableValue<number>>\n >,\n )\n }\n if (active.pressed && gesture.pressed) {\n Object.assign(\n merged,\n gesture.pressed as Partial<\n Record<AnimatableKey, AnimatableValue<number>>\n >,\n )\n }\n return merged\n}\n\ntype GestureHandlers = Record<string, (event: unknown) => void>\n\n/**\n * Build the touch / focus / hover handler props for a gesture-enabled Motion\n * primitive. Returns an empty object when `gesture` is undefined so the\n * component renders identically to the gesture-less path (zero overhead).\n *\n * Existing user-supplied handlers on the same events are composed: the user's\n * handler runs first, then the internal state setter. We pull user handlers\n * out of `rest` rather than overwriting them.\n */\nfunction useGestureHandlers(\n gesture: GestureSubStates<unknown> | undefined,\n rest: Record<string, unknown>,\n setPressed: (next: boolean) => void,\n setFocused: (next: boolean) => void,\n setHovered: (next: boolean) => void,\n): GestureHandlers {\n return useMemo(() => {\n if (!gesture) return {}\n const handlers: GestureHandlers = {}\n if (gesture.pressed) {\n handlers.onTouchStart = compose(rest.onTouchStart, () => setPressed(true))\n handlers.onTouchEnd = compose(rest.onTouchEnd, () => setPressed(false))\n handlers.onTouchCancel = compose(rest.onTouchCancel, () =>\n setPressed(false),\n )\n // Pressable / TouchableOpacity expose press hooks above the touch layer;\n // forward to those when present so wrapping consumers stay consistent.\n handlers.onPressIn = compose(rest.onPressIn, () => setPressed(true))\n handlers.onPressOut = compose(rest.onPressOut, () => setPressed(false))\n }\n if (gesture.focused) {\n handlers.onFocus = compose(rest.onFocus, () => setFocused(true))\n handlers.onBlur = compose(rest.onBlur, () => setFocused(false))\n }\n if (gesture.hovered) {\n // Web-only events. RN-Web 0.72+ accepts these on View; native ignores\n // them so the cost is zero on iOS / Android.\n handlers.onMouseEnter = compose(rest.onMouseEnter, () => setHovered(true))\n handlers.onMouseLeave = compose(rest.onMouseLeave, () =>\n setHovered(false),\n )\n }\n return handlers\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n gesture?.pressed ? 1 : 0,\n gesture?.focused ? 1 : 0,\n gesture?.hovered ? 1 : 0,\n rest.onTouchStart,\n rest.onTouchEnd,\n rest.onTouchCancel,\n rest.onPressIn,\n rest.onPressOut,\n rest.onFocus,\n rest.onBlur,\n rest.onMouseEnter,\n rest.onMouseLeave,\n ])\n}\n\nfunction compose(\n user: unknown,\n ours: (event: unknown) => void,\n): (event: unknown) => void {\n if (typeof user !== 'function') return ours\n return (event: unknown) => {\n ;(user as (event: unknown) => void)(event)\n ours(event)\n }\n}\n\n// Suppress the implicit any-return of the rotate ternary's union shape.\n// `TransformKey` is exported only to keep the type readable in d.ts.\nexport type { TransformKey }\n","import { 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"]}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { StyleProp } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A single animation step's destination, optionally overriding the transition
|
|
6
|
+
* for that step.
|
|
7
|
+
*/
|
|
8
|
+
type SequenceStep<V> = V | ({
|
|
9
|
+
to: V;
|
|
10
|
+
delay?: number;
|
|
11
|
+
} & TransitionConfig);
|
|
12
|
+
/**
|
|
13
|
+
* A target value for an animatable property: a single value, a sequence of
|
|
14
|
+
* steps (keyframes), or a single step object.
|
|
15
|
+
*/
|
|
16
|
+
type AnimatableValue<V> = V | SequenceStep<V> | ReadonlyArray<SequenceStep<V>>;
|
|
17
|
+
/**
|
|
18
|
+
* Spring transition — public surface uses react-spring vocabulary
|
|
19
|
+
* (`tension` / `friction` / `mass`), not Reanimated's raw stiffness/damping.
|
|
20
|
+
*/
|
|
21
|
+
interface SpringTransition {
|
|
22
|
+
type?: 'spring';
|
|
23
|
+
tension?: number;
|
|
24
|
+
friction?: number;
|
|
25
|
+
mass?: number;
|
|
26
|
+
velocity?: number;
|
|
27
|
+
restSpeedThreshold?: number;
|
|
28
|
+
restDisplacementThreshold?: number;
|
|
29
|
+
delay?: number;
|
|
30
|
+
repeat?: RepeatConfig;
|
|
31
|
+
}
|
|
32
|
+
interface TimingTransition {
|
|
33
|
+
type: 'timing';
|
|
34
|
+
duration?: number;
|
|
35
|
+
easing?: (t: number) => number;
|
|
36
|
+
delay?: number;
|
|
37
|
+
repeat?: RepeatConfig;
|
|
38
|
+
}
|
|
39
|
+
interface DecayTransition {
|
|
40
|
+
type: 'decay';
|
|
41
|
+
velocity?: number;
|
|
42
|
+
deceleration?: number;
|
|
43
|
+
clamp?: [number, number];
|
|
44
|
+
delay?: number;
|
|
45
|
+
}
|
|
46
|
+
interface NoAnimationTransition {
|
|
47
|
+
type: 'no-animation';
|
|
48
|
+
}
|
|
49
|
+
type TransitionConfig = SpringTransition | TimingTransition | DecayTransition | NoAnimationTransition;
|
|
50
|
+
/**
|
|
51
|
+
* Repeat config — one shape, not three flags. Default `alternate: true`.
|
|
52
|
+
*/
|
|
53
|
+
type RepeatConfig = number | 'infinite' | {
|
|
54
|
+
count: number | 'infinite';
|
|
55
|
+
alternate?: boolean;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Per-property transition map. Keys must match keys present on `animate`.
|
|
59
|
+
* Top-level entries on `transition` apply to all properties unless overridden
|
|
60
|
+
* here.
|
|
61
|
+
*/
|
|
62
|
+
type PerPropertyTransition<S> = {
|
|
63
|
+
[K in keyof S]?: TransitionConfig;
|
|
64
|
+
};
|
|
65
|
+
type Transition<S> = TransitionConfig | PerPropertyTransition<S>;
|
|
66
|
+
/**
|
|
67
|
+
* The animation state shape inferred from the underlying component's style
|
|
68
|
+
* prop. We narrow to the value side of `style` so consumers see ViewStyle on
|
|
69
|
+
* `Motion.View`, TextStyle on `Motion.Text`, etc. — no shared union.
|
|
70
|
+
*/
|
|
71
|
+
type AnimateStyle<C> = C extends {
|
|
72
|
+
style?: StyleProp<infer S>;
|
|
73
|
+
} ? {
|
|
74
|
+
[K in keyof S]?: AnimatableValue<S[K]>;
|
|
75
|
+
} : never;
|
|
76
|
+
interface AnimationCallbackInfo<S> {
|
|
77
|
+
/**
|
|
78
|
+
* The animatable key that just settled — typically a `keyof S` (e.g.
|
|
79
|
+
* `'opacity'`, `'translateX'`). The sentinel `'transform'` is emitted in
|
|
80
|
+
* lieu of any specific transform axis (`translateX`/`Y`, `scale`/`X`/`Y`,
|
|
81
|
+
* `rotate`) when the terminal `'animation'` phase fires for a transform
|
|
82
|
+
* group, so a multi-axis translate produces one callback rather than two.
|
|
83
|
+
*/
|
|
84
|
+
key: keyof S | 'transform';
|
|
85
|
+
finished: boolean;
|
|
86
|
+
value: unknown;
|
|
87
|
+
target: unknown;
|
|
88
|
+
phase: 'step' | 'sequence' | 'repeat' | 'animation';
|
|
89
|
+
step: number | undefined;
|
|
90
|
+
iteration: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A variants map: string state names → animate target objects.
|
|
94
|
+
*/
|
|
95
|
+
type VariantsMap<C> = Record<string, AnimateStyle<C>>;
|
|
96
|
+
/**
|
|
97
|
+
* Gesture sub-states accepted by the `gesture` prop on every Motion primitive.
|
|
98
|
+
*
|
|
99
|
+
* - `pressed` — active while the user is touching the component (touch start
|
|
100
|
+
* to touch end / cancel).
|
|
101
|
+
* - `focused` — active while a focusable component owns keyboard focus
|
|
102
|
+
* (no-op for non-focusable underlying components).
|
|
103
|
+
* - `hovered` — web-only. Typed for cross-platform call sites; the runtime is
|
|
104
|
+
* a no-op on native.
|
|
105
|
+
*
|
|
106
|
+
* When a sub-state is active, its values override the base `animate` target
|
|
107
|
+
* per-property. Priority on overlap: `pressed` > `focused` > `hovered`.
|
|
108
|
+
*/
|
|
109
|
+
interface GestureSubStates<C> {
|
|
110
|
+
pressed?: AnimateStyle<C>;
|
|
111
|
+
focused?: AnimateStyle<C>;
|
|
112
|
+
hovered?: AnimateStyle<C>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Controller returned by `useVariants`. The `current` shared state is read
|
|
116
|
+
* via `controller` prop on a Motion primitive; `transitionTo` drives the
|
|
117
|
+
* controller from JS code (event handlers, async chains, etc.).
|
|
118
|
+
*/
|
|
119
|
+
interface VariantController<K extends string = string> {
|
|
120
|
+
current: K;
|
|
121
|
+
transitionTo(next: K): void;
|
|
122
|
+
/** @internal — subscription used by Motion primitives to re-render. */
|
|
123
|
+
subscribe(listener: (next: K) => void): () => void;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Props injected onto every Motion primitive.
|
|
127
|
+
*/
|
|
128
|
+
interface MotionProps<C> {
|
|
129
|
+
/**
|
|
130
|
+
* Initial values applied on mount. Read once on mount and intentionally
|
|
131
|
+
* non-reactive — to reset after a state change, change the component `key`,
|
|
132
|
+
* remount via `<Presence>`, or drive the value through a controller.
|
|
133
|
+
*
|
|
134
|
+
* Pass `false` to skip the initial-mount animation entirely.
|
|
135
|
+
*/
|
|
136
|
+
initial?: AnimateStyle<C> | false;
|
|
137
|
+
/**
|
|
138
|
+
* The animation target. A style object, a variant key (when `variants` is
|
|
139
|
+
* supplied), or an array of sequence steps. Variant keys autocomplete when
|
|
140
|
+
* `variants` is annotated `as const`.
|
|
141
|
+
*/
|
|
142
|
+
animate?: AnimateStyle<C> | string;
|
|
143
|
+
/**
|
|
144
|
+
* Values applied while the component exits via `<Presence>`.
|
|
145
|
+
*/
|
|
146
|
+
exit?: AnimateStyle<C>;
|
|
147
|
+
/**
|
|
148
|
+
* Named animation states. With `variants` set, `animate` accepts a key from
|
|
149
|
+
* this map.
|
|
150
|
+
*/
|
|
151
|
+
variants?: VariantsMap<C>;
|
|
152
|
+
/**
|
|
153
|
+
* Imperative controller from `useVariants(...)`. When supplied, `animate`
|
|
154
|
+
* is read from `controller.current` and re-applied whenever the controller
|
|
155
|
+
* transitions. `animate` and `controller` should not both be set.
|
|
156
|
+
*/
|
|
157
|
+
controller?: VariantController;
|
|
158
|
+
/**
|
|
159
|
+
* Gesture-driven sub-states (`pressed`, `focused`, `hovered`). When omitted,
|
|
160
|
+
* no handlers are mounted on the underlying component. Sub-state values
|
|
161
|
+
* merge over `animate` per-property while the corresponding gesture is
|
|
162
|
+
* active.
|
|
163
|
+
*/
|
|
164
|
+
gesture?: GestureSubStates<C>;
|
|
165
|
+
/**
|
|
166
|
+
* Per-property or top-level transition config. Per-property entries take
|
|
167
|
+
* precedence over the top-level transition.
|
|
168
|
+
*/
|
|
169
|
+
transition?: Transition<AnimateStyle<C>>;
|
|
170
|
+
/**
|
|
171
|
+
* Fired once per logical animation completion. See `AnimationCallbackInfo`
|
|
172
|
+
* for the payload shape — transform parents fire once, not per axis.
|
|
173
|
+
*/
|
|
174
|
+
onAnimationEnd?: (info: AnimationCallbackInfo<AnimateStyle<C>>) => void;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The component type produced by `createMotionComponent`. Combines the
|
|
178
|
+
* underlying component's props (minus `style`, which we replace with an
|
|
179
|
+
* animated style) with the Motion-specific props above.
|
|
180
|
+
*/
|
|
181
|
+
type MotionComponent<C extends ComponentType<any>> = ComponentType<Omit<React.ComponentProps<C>, 'style'> & MotionProps<React.ComponentProps<C>> & {
|
|
182
|
+
style?: React.ComponentProps<C>['style'];
|
|
183
|
+
}>;
|
|
184
|
+
|
|
185
|
+
export type { AnimatableValue as A, DecayTransition as D, GestureSubStates as G, MotionComponent as M, NoAnimationTransition as N, PerPropertyTransition as P, RepeatConfig as R, SequenceStep as S, TransitionConfig as T, VariantController as V, AnimateStyle as a, AnimationCallbackInfo as b, MotionProps as c, SpringTransition as d, TimingTransition as e, Transition as f, VariantsMap as g };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { StyleProp } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A single animation step's destination, optionally overriding the transition
|
|
6
|
+
* for that step.
|
|
7
|
+
*/
|
|
8
|
+
type SequenceStep<V> = V | ({
|
|
9
|
+
to: V;
|
|
10
|
+
delay?: number;
|
|
11
|
+
} & TransitionConfig);
|
|
12
|
+
/**
|
|
13
|
+
* A target value for an animatable property: a single value, a sequence of
|
|
14
|
+
* steps (keyframes), or a single step object.
|
|
15
|
+
*/
|
|
16
|
+
type AnimatableValue<V> = V | SequenceStep<V> | ReadonlyArray<SequenceStep<V>>;
|
|
17
|
+
/**
|
|
18
|
+
* Spring transition — public surface uses react-spring vocabulary
|
|
19
|
+
* (`tension` / `friction` / `mass`), not Reanimated's raw stiffness/damping.
|
|
20
|
+
*/
|
|
21
|
+
interface SpringTransition {
|
|
22
|
+
type?: 'spring';
|
|
23
|
+
tension?: number;
|
|
24
|
+
friction?: number;
|
|
25
|
+
mass?: number;
|
|
26
|
+
velocity?: number;
|
|
27
|
+
restSpeedThreshold?: number;
|
|
28
|
+
restDisplacementThreshold?: number;
|
|
29
|
+
delay?: number;
|
|
30
|
+
repeat?: RepeatConfig;
|
|
31
|
+
}
|
|
32
|
+
interface TimingTransition {
|
|
33
|
+
type: 'timing';
|
|
34
|
+
duration?: number;
|
|
35
|
+
easing?: (t: number) => number;
|
|
36
|
+
delay?: number;
|
|
37
|
+
repeat?: RepeatConfig;
|
|
38
|
+
}
|
|
39
|
+
interface DecayTransition {
|
|
40
|
+
type: 'decay';
|
|
41
|
+
velocity?: number;
|
|
42
|
+
deceleration?: number;
|
|
43
|
+
clamp?: [number, number];
|
|
44
|
+
delay?: number;
|
|
45
|
+
}
|
|
46
|
+
interface NoAnimationTransition {
|
|
47
|
+
type: 'no-animation';
|
|
48
|
+
}
|
|
49
|
+
type TransitionConfig = SpringTransition | TimingTransition | DecayTransition | NoAnimationTransition;
|
|
50
|
+
/**
|
|
51
|
+
* Repeat config — one shape, not three flags. Default `alternate: true`.
|
|
52
|
+
*/
|
|
53
|
+
type RepeatConfig = number | 'infinite' | {
|
|
54
|
+
count: number | 'infinite';
|
|
55
|
+
alternate?: boolean;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Per-property transition map. Keys must match keys present on `animate`.
|
|
59
|
+
* Top-level entries on `transition` apply to all properties unless overridden
|
|
60
|
+
* here.
|
|
61
|
+
*/
|
|
62
|
+
type PerPropertyTransition<S> = {
|
|
63
|
+
[K in keyof S]?: TransitionConfig;
|
|
64
|
+
};
|
|
65
|
+
type Transition<S> = TransitionConfig | PerPropertyTransition<S>;
|
|
66
|
+
/**
|
|
67
|
+
* The animation state shape inferred from the underlying component's style
|
|
68
|
+
* prop. We narrow to the value side of `style` so consumers see ViewStyle on
|
|
69
|
+
* `Motion.View`, TextStyle on `Motion.Text`, etc. — no shared union.
|
|
70
|
+
*/
|
|
71
|
+
type AnimateStyle<C> = C extends {
|
|
72
|
+
style?: StyleProp<infer S>;
|
|
73
|
+
} ? {
|
|
74
|
+
[K in keyof S]?: AnimatableValue<S[K]>;
|
|
75
|
+
} : never;
|
|
76
|
+
interface AnimationCallbackInfo<S> {
|
|
77
|
+
/**
|
|
78
|
+
* The animatable key that just settled — typically a `keyof S` (e.g.
|
|
79
|
+
* `'opacity'`, `'translateX'`). The sentinel `'transform'` is emitted in
|
|
80
|
+
* lieu of any specific transform axis (`translateX`/`Y`, `scale`/`X`/`Y`,
|
|
81
|
+
* `rotate`) when the terminal `'animation'` phase fires for a transform
|
|
82
|
+
* group, so a multi-axis translate produces one callback rather than two.
|
|
83
|
+
*/
|
|
84
|
+
key: keyof S | 'transform';
|
|
85
|
+
finished: boolean;
|
|
86
|
+
value: unknown;
|
|
87
|
+
target: unknown;
|
|
88
|
+
phase: 'step' | 'sequence' | 'repeat' | 'animation';
|
|
89
|
+
step: number | undefined;
|
|
90
|
+
iteration: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A variants map: string state names → animate target objects.
|
|
94
|
+
*/
|
|
95
|
+
type VariantsMap<C> = Record<string, AnimateStyle<C>>;
|
|
96
|
+
/**
|
|
97
|
+
* Gesture sub-states accepted by the `gesture` prop on every Motion primitive.
|
|
98
|
+
*
|
|
99
|
+
* - `pressed` — active while the user is touching the component (touch start
|
|
100
|
+
* to touch end / cancel).
|
|
101
|
+
* - `focused` — active while a focusable component owns keyboard focus
|
|
102
|
+
* (no-op for non-focusable underlying components).
|
|
103
|
+
* - `hovered` — web-only. Typed for cross-platform call sites; the runtime is
|
|
104
|
+
* a no-op on native.
|
|
105
|
+
*
|
|
106
|
+
* When a sub-state is active, its values override the base `animate` target
|
|
107
|
+
* per-property. Priority on overlap: `pressed` > `focused` > `hovered`.
|
|
108
|
+
*/
|
|
109
|
+
interface GestureSubStates<C> {
|
|
110
|
+
pressed?: AnimateStyle<C>;
|
|
111
|
+
focused?: AnimateStyle<C>;
|
|
112
|
+
hovered?: AnimateStyle<C>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Controller returned by `useVariants`. The `current` shared state is read
|
|
116
|
+
* via `controller` prop on a Motion primitive; `transitionTo` drives the
|
|
117
|
+
* controller from JS code (event handlers, async chains, etc.).
|
|
118
|
+
*/
|
|
119
|
+
interface VariantController<K extends string = string> {
|
|
120
|
+
current: K;
|
|
121
|
+
transitionTo(next: K): void;
|
|
122
|
+
/** @internal — subscription used by Motion primitives to re-render. */
|
|
123
|
+
subscribe(listener: (next: K) => void): () => void;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Props injected onto every Motion primitive.
|
|
127
|
+
*/
|
|
128
|
+
interface MotionProps<C> {
|
|
129
|
+
/**
|
|
130
|
+
* Initial values applied on mount. Read once on mount and intentionally
|
|
131
|
+
* non-reactive — to reset after a state change, change the component `key`,
|
|
132
|
+
* remount via `<Presence>`, or drive the value through a controller.
|
|
133
|
+
*
|
|
134
|
+
* Pass `false` to skip the initial-mount animation entirely.
|
|
135
|
+
*/
|
|
136
|
+
initial?: AnimateStyle<C> | false;
|
|
137
|
+
/**
|
|
138
|
+
* The animation target. A style object, a variant key (when `variants` is
|
|
139
|
+
* supplied), or an array of sequence steps. Variant keys autocomplete when
|
|
140
|
+
* `variants` is annotated `as const`.
|
|
141
|
+
*/
|
|
142
|
+
animate?: AnimateStyle<C> | string;
|
|
143
|
+
/**
|
|
144
|
+
* Values applied while the component exits via `<Presence>`.
|
|
145
|
+
*/
|
|
146
|
+
exit?: AnimateStyle<C>;
|
|
147
|
+
/**
|
|
148
|
+
* Named animation states. With `variants` set, `animate` accepts a key from
|
|
149
|
+
* this map.
|
|
150
|
+
*/
|
|
151
|
+
variants?: VariantsMap<C>;
|
|
152
|
+
/**
|
|
153
|
+
* Imperative controller from `useVariants(...)`. When supplied, `animate`
|
|
154
|
+
* is read from `controller.current` and re-applied whenever the controller
|
|
155
|
+
* transitions. `animate` and `controller` should not both be set.
|
|
156
|
+
*/
|
|
157
|
+
controller?: VariantController;
|
|
158
|
+
/**
|
|
159
|
+
* Gesture-driven sub-states (`pressed`, `focused`, `hovered`). When omitted,
|
|
160
|
+
* no handlers are mounted on the underlying component. Sub-state values
|
|
161
|
+
* merge over `animate` per-property while the corresponding gesture is
|
|
162
|
+
* active.
|
|
163
|
+
*/
|
|
164
|
+
gesture?: GestureSubStates<C>;
|
|
165
|
+
/**
|
|
166
|
+
* Per-property or top-level transition config. Per-property entries take
|
|
167
|
+
* precedence over the top-level transition.
|
|
168
|
+
*/
|
|
169
|
+
transition?: Transition<AnimateStyle<C>>;
|
|
170
|
+
/**
|
|
171
|
+
* Fired once per logical animation completion. See `AnimationCallbackInfo`
|
|
172
|
+
* for the payload shape — transform parents fire once, not per axis.
|
|
173
|
+
*/
|
|
174
|
+
onAnimationEnd?: (info: AnimationCallbackInfo<AnimateStyle<C>>) => void;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The component type produced by `createMotionComponent`. Combines the
|
|
178
|
+
* underlying component's props (minus `style`, which we replace with an
|
|
179
|
+
* animated style) with the Motion-specific props above.
|
|
180
|
+
*/
|
|
181
|
+
type MotionComponent<C extends ComponentType<any>> = ComponentType<Omit<React.ComponentProps<C>, 'style'> & MotionProps<React.ComponentProps<C>> & {
|
|
182
|
+
style?: React.ComponentProps<C>['style'];
|
|
183
|
+
}>;
|
|
184
|
+
|
|
185
|
+
export type { AnimatableValue as A, DecayTransition as D, GestureSubStates as G, MotionComponent as M, NoAnimationTransition as N, PerPropertyTransition as P, RepeatConfig as R, SequenceStep as S, TransitionConfig as T, VariantController as V, AnimateStyle as a, AnimationCallbackInfo as b, MotionProps as c, SpringTransition as d, TimingTransition as e, Transition as f, VariantsMap as g };
|
package/llms.txt
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Inertia
|
|
2
|
+
|
|
3
|
+
> Declarative animation primitives for React Native, built on react-native-reanimated. Inspired by Framer Motion (web) and react-spring (cross-platform). DX-first — animations are props on a component, not imperative shared values, worklets, and `useAnimatedStyle` boilerplate.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @onlynative/inertia react-native-reanimated
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Enable the Reanimated Babel plugin per its install guide.
|
|
12
|
+
|
|
13
|
+
## Imports
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Motion, Presence, MotionConfig, useVariants } from '@onlynative/inertia'
|
|
17
|
+
// or for tree-shaking:
|
|
18
|
+
import { MotionView } from '@onlynative/inertia/view'
|
|
19
|
+
import { MotionText } from '@onlynative/inertia/text'
|
|
20
|
+
import { MotionImage } from '@onlynative/inertia/image'
|
|
21
|
+
import { MotionPressable } from '@onlynative/inertia/pressable'
|
|
22
|
+
import { MotionScrollView } from '@onlynative/inertia/scroll-view'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Public API
|
|
26
|
+
|
|
27
|
+
- `Motion.View` / `Motion.Text` / `Motion.Image` / `Motion.Pressable` / `Motion.ScrollView` — animatable primitives. Per-primitive style inference (no shared `ViewStyle & TextStyle & ImageStyle` fallback).
|
|
28
|
+
- `<Presence>` — mount / unmount transitions; children need explicit `key`s. Exiting children get `pointerEvents: 'none'` automatically.
|
|
29
|
+
- `<MotionConfig reducedMotion="user" | "never" | "always">` — gates motion against the OS reduce-motion setting (default `"user"`).
|
|
30
|
+
- `useVariants(variants, initial?)` — returns `{ current, transitionTo }` controller for the `controller` prop.
|
|
31
|
+
- `createMotionComponent<C>(C)` — wrap any component with the same Motion prop surface, inferring style from `C`.
|
|
32
|
+
|
|
33
|
+
## Motion props
|
|
34
|
+
|
|
35
|
+
`initial` (mount-only, non-reactive after first render — pass `false` to skip), `animate`, `exit`, `variants`, `controller`, `gesture`, `transition`, `onAnimationEnd`.
|
|
36
|
+
|
|
37
|
+
## Transitions
|
|
38
|
+
|
|
39
|
+
| `type` | Public config | Default? |
|
|
40
|
+
| ---------------- | ---------------------------------------------------------------- | -------- |
|
|
41
|
+
| `'spring'` | `tension`, `friction`, `mass`, `velocity`, `delay`, `repeat` | yes |
|
|
42
|
+
| `'timing'` | `duration`, `easing`, `delay`, `repeat` | |
|
|
43
|
+
| `'decay'` | `velocity`, `deceleration`, `clamp`, `delay` | |
|
|
44
|
+
| `'no-animation'` | — | |
|
|
45
|
+
|
|
46
|
+
Spring uses react-spring vocabulary (`tension`, `friction`, `mass`). Reanimated's raw `stiffness` / `damping` never appear in the public API. Per-property `transition` entries override the top-level config.
|
|
47
|
+
|
|
48
|
+
## Sequences and repeat
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<Motion.View
|
|
52
|
+
animate={{
|
|
53
|
+
translateX: [0, 100, 0],
|
|
54
|
+
opacity: [0, { to: 1, type: 'spring' }, { to: 0, delay: 500 }],
|
|
55
|
+
}}
|
|
56
|
+
transition={{ repeat: 'infinite' }}
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`repeat`: `number` (finite, alternating) | `'infinite'` | `{ count, alternate }`.
|
|
61
|
+
|
|
62
|
+
## Gestures
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<Motion.View gesture={{ pressed: { scale: 0.96 }, focused: {...}, hovered: {...} }} />
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Sub-state priority: `hovered < focused < pressed`. `hovered` is a no-op on native.
|
|
69
|
+
|
|
70
|
+
## Animatable properties (alpha)
|
|
71
|
+
|
|
72
|
+
`opacity`, `translateX`, `translateY`, `scale`, `scaleX`, `scaleY`, `rotate`, `width`, `height`, `borderRadius`. Color, layout, and SVG path morphing are not in alpha.
|
|
73
|
+
|
|
74
|
+
## Docs
|
|
75
|
+
|
|
76
|
+
- Full docs: https://onlynative.github.io/inertia/
|
|
77
|
+
- Per-page LLM reference: https://onlynative.github.io/inertia/llms-full.txt
|
|
78
|
+
- Source: https://github.com/onlynative/inertia
|