@gridui/motion 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +257 -2
  2. package/dist/chunk-MMMTUJVS.js +106 -0
  3. package/dist/chunk-MMMTUJVS.js.map +7 -0
  4. package/dist/index.d.ts +25 -0
  5. package/dist/index.js +682 -0
  6. package/dist/index.js.map +7 -0
  7. package/dist/layout-motion/layout-motion.d.ts +20 -0
  8. package/dist/motion-config/context.d.ts +2 -0
  9. package/dist/motion-config/motion-config.d.ts +2 -0
  10. package/dist/motion-config/types.d.ts +27 -0
  11. package/dist/motion-config/validate-transition.d.ts +2 -0
  12. package/dist/motion-layout-group/context.d.ts +1 -0
  13. package/dist/motion-layout-group/motion-layout-group.d.ts +6 -0
  14. package/dist/motion-reveal/motion-reveal.d.ts +9 -0
  15. package/dist/motion-scope/motion-scope.d.ts +6 -0
  16. package/dist/motion-sequence/controller.d.ts +37 -0
  17. package/dist/motion-sequence/use-motion-sequence.d.ts +4 -0
  18. package/dist/motion-size/motion-size.d.ts +8 -0
  19. package/dist/policy.d.ts +4 -0
  20. package/dist/policy.js +15 -0
  21. package/dist/policy.js.map +7 -0
  22. package/dist/presence/presence.d.ts +9 -0
  23. package/dist/shared/dom-policy.d.ts +13 -0
  24. package/dist/shared/outcome.d.ts +1 -0
  25. package/dist/shared/resolve-transition.d.ts +9 -0
  26. package/dist/shared/state.d.ts +6 -0
  27. package/dist/shared/use-motion-policy.d.ts +10 -0
  28. package/dist/shared/use-motion-style.d.ts +3 -0
  29. package/dist/spring-value/controller.d.ts +26 -0
  30. package/dist/spring-value/use-spring-value.d.ts +3 -0
  31. package/docs/catalog.json +233 -0
  32. package/docs/reference/README.md +10 -0
  33. package/docs/reference/layout-motion.md +116 -0
  34. package/docs/reference/motion-config.md +46 -0
  35. package/docs/reference/motion-layout-group.md +24 -0
  36. package/docs/reference/motion-reveal.md +110 -0
  37. package/docs/reference/motion-scope.md +60 -0
  38. package/docs/reference/motion-size.md +64 -0
  39. package/docs/reference/presence.md +42 -0
  40. package/package.json +50 -3
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/motion-config/motion-config.tsx", "../src/motion-config/validate-transition.ts", "../src/motion-layout-group/context.ts", "../src/presence/presence.tsx", "../src/layout-motion/layout-motion.tsx", "../src/shared/resolve-transition.ts", "../src/motion-scope/motion-scope.tsx", "../src/motion-layout-group/motion-layout-group.tsx", "../src/spring-value/use-spring-value.ts", "../src/spring-value/controller.ts", "../src/motion-size/motion-size.tsx", "../src/motion-sequence/use-motion-sequence.ts", "../src/motion-sequence/controller.ts", "../src/motion-reveal/motion-reveal.tsx"],
4
+ "sourcesContent": ["import { useContext, useMemo } from \"react\";\nimport { MotionContext } from \"./context\";\nimport type { MotionConfigProps } from \"./types\";\nimport { validateTransition } from \"./validate-transition\";\n\nexport const MotionConfig = ({ children, tempo, reducedMotion, disabled, transition }: MotionConfigProps) => {\n const parent = useContext(MotionContext);\n if (tempo !== undefined && (!Number.isFinite(tempo) || tempo <= 0)) {\n throw new RangeError(\"MotionConfig tempo must be finite and positive.\");\n }\n if (transition) {validateTransition(transition);}\n const value = useMemo(() => ({\n tempo: tempo ?? parent.tempo,\n reducedMotion: parent.reducedMotion === \"always\" ? \"always\" : reducedMotion ?? parent.reducedMotion,\n disabled: parent.disabled || disabled === true,\n transition: transition ?? parent.transition,\n }), [parent, tempo, reducedMotion, disabled, transition]);\n return <MotionContext.Provider value={value}>{children}</MotionContext.Provider>;\n};\n", "import type { MotionTransition } from \"./types\";\n\nexport const validateTransition = (transition: MotionTransition): void => {\n if (transition.type === \"spring\") {\n for (const value of [transition.stiffness, transition.damping, transition.mass]) {\n if (value !== undefined && (!Number.isFinite(value) || value <= 0)) {\n throw new RangeError(\"Motion spring parameters must be finite and positive.\");\n }\n }\n } else if (transition.duration !== undefined && (!Number.isFinite(transition.duration) || transition.duration < 0)) {\n throw new RangeError(\"Motion duration must be finite and nonnegative.\");\n }\n};\n\n", "import { createContext } from \"react\";\n\nexport const LayoutGroupContext = createContext(false);\n", "import { LayoutGroupContext } from \"../motion-layout-group/context\";\nimport { AnimatePresence, LayoutGroup } from \"motion/react\";\nimport { type ReactNode, useContext, useId } from \"react\";\n\nexport type PresenceProps = {\n readonly children: ReactNode;\n readonly mode?: \"sync\" | \"wait\" | \"popLayout\";\n readonly initial?: boolean;\n readonly onExitComplete?: () => void;\n};\n\n/** Keep this boundary mounted. Direct children need stable keys and forwarded refs for popLayout. */\nexport const Presence = ({ children, mode = \"sync\", initial = false, onExitComplete }: PresenceProps) => {\n const id = useId();\n const grouped = useContext(LayoutGroupContext);\n const presence = <AnimatePresence mode={mode} initial={initial} {...(onExitComplete ? { onExitComplete } : {})}>\n {children}\n </AnimatePresence>;\n return grouped ? presence : <LayoutGroup id={id}>{presence}</LayoutGroup>;\n};\n", "import type { MotionState } from \"../shared/state\";\nimport { animate as animateValue, motion, useMotionValue, usePresence, type MotionStyle, type AnimationPlaybackControlsWithThen } from \"motion/react\";\nimport { type ComponentPropsWithRef, type CSSProperties, useImperativeHandle, useEffect, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { MotionTransition } from \"../motion-config/types\";\nimport { fallbackTransition, readThemeTransition, resolveTransition } from \"../shared/resolve-transition\";\nimport { useMotionPolicy } from \"../shared/use-motion-policy\";\n\nexport type LayoutMotionProps = Omit<ComponentPropsWithRef<\"div\">,\n \"onAnimationStart\" | \"onDrag\" | \"onDragStart\" | \"onDragEnd\" | \"style\"> & {\n readonly style?: Omit<CSSProperties, \"transform\" | \"opacity\" | \"scale\" | \"translate\" | \"rotate\">;\n readonly layout?: boolean | \"position\" | \"size\";\n readonly layoutId?: string;\n /** Mark the scrolling element used by descendant layout measurements. */\n readonly layoutScroll?: boolean;\n /** Mark a fixed-position root used by descendant layout measurements. */\n readonly layoutRoot?: boolean;\n readonly enter?: MotionState;\n readonly animate?: MotionState;\n readonly exit?: MotionState;\n readonly transition?: MotionTransition;\n readonly exitTransition?: MotionTransition;\n readonly onAnimationComplete?: () => void;\n readonly onLayoutAnimationComplete?: () => void;\n};\n\nexport const LayoutMotion = ({\n layout = true, layoutId, layoutScroll, layoutRoot, enter, animate, exit,\n transition, exitTransition, ref, inert, style, onAnimationComplete,\n \"aria-hidden\": ariaHidden, ...props\n}: LayoutMotionProps) => {\n const policy = useMotionPolicy();\n const [present, safeToRemove] = usePresence();\n const node = useRef<HTMLDivElement>(null);\n const running = useRef<AnimationPlaybackControlsWithThen[]>([]);\n const [theme, setTheme] = useState(fallbackTransition);\n useImperativeHandle(ref, () => node.current!, []);\n useLayoutEffect(() => {\n const next = readThemeTransition(node.current!);\n setTheme(previous => next.duration === previous.duration && String(next.ease) === String(previous.ease)\n ? previous : next);\n }, [style, props.className, policy.transition, transition]);\n const opacity = animate?.opacity ?? 1;\n const x = animate?.x ?? 0;\n const y = animate?.y ?? 0;\n const scale = animate?.scale ?? 1;\n const opacityValue = useMotionValue(opacity);\n const xValue = useMotionValue(x);\n const yValue = useMotionValue(y);\n const scaleValue = useMotionValue(scale);\n const values = useMemo(() => ({ opacity: opacityValue, x: xValue, y: yValue, scale: scaleValue }),\n [opacityValue, xValue, yValue, scaleValue]);\n const exitOpacity = exit?.opacity;\n const exitX = exit?.x;\n const exitY = exit?.y;\n const exitScale = exit?.scale;\n const hasExit = exit !== undefined;\n // Timing is captured at each target change. Tempo changes update playback speed\n // independently, so a live configuration update never replays an entrance.\n const settings = useEffectEvent(() => ({\n timing: resolveTransition((!present ? exitTransition : undefined) ?? transition ?? policy.transition,\n readThemeTransition(node.current!), 1, policy.immediate),\n immediate: policy.immediate,\n tempo: policy.tempo,\n }));\n const complete = useEffectEvent(() => onAnimationComplete?.());\n useEffect(() => {\n const { timing, immediate, tempo } = settings();\n const target = present ? { opacity, x, y, scale } : {\n opacity: exitOpacity, x: exitX, y: exitY, scale: exitScale,\n };\n let active = true;\n const playback: AnimationPlaybackControlsWithThen[] = [];\n for (const key of [\"opacity\", \"x\", \"y\", \"scale\"] as const) {\n const next = target[key];\n if (next === undefined || next === values[key].get()) { continue; }\n if (immediate) { values[key].jump(next); continue; }\n const animation = animateValue(values[key], next, timing);\n animation.speed = 1 / tempo;\n playback.push(animation);\n }\n running.current = playback;\n if (playback.length) {\n void Promise.all(playback).then(() => {\n if (!active) { return; }\n running.current = [];\n complete();\n if (!present) { safeToRemove(); }\n });\n } else if (!present) {\n safeToRemove();\n }\n return () => {\n active = false;\n for (const animation of playback) { animation.stop(); }\n running.current = [];\n };\n }, [present, hasExit, safeToRemove, values, opacity, x, y, scale, exitOpacity, exitX, exitY, exitScale]);\n useLayoutEffect(() => {\n for (const animation of running.current) {\n if (policy.immediate) { animation.complete(); }\n else { animation.speed = 1 / policy.tempo; }\n }\n }, [policy.immediate, policy.tempo]);\n return <motion.div\n {...props}\n ref={node}\n style={{ ...style, ...values } as MotionStyle}\n inert={!present || inert || undefined}\n aria-hidden={!present ? true : ariaHidden}\n data-motion-present={present ? \"true\" : \"false\"}\n layout={policy.immediate ? false : layout}\n {...(layoutScroll === undefined ? {} : { layoutScroll })}\n {...(layoutRoot === undefined ? {} : { layoutRoot })}\n // Motion 14 can retain an in-flight projection after layout is disabled.\n // Suppress only that projection; MotionValues still own the base transform.\n {...(policy.immediate ? { transformTemplate: () => {\n return x === 0 && y === 0 && scale === 1 ? \"none\" : `translate(${x}px, ${y}px) scale(${scale})`;\n } } : {})}\n {...(layoutId === undefined ? {} : { layoutId })}\n initial={policy.immediate ? false : (enter ?? false)}\n transition={resolveTransition(transition ?? policy.transition, theme, policy.tempo, policy.immediate)}\n />;\n};\n", "import { validateTransition } from \"../motion-config/validate-transition\";\nimport { readMotionDuration } from \"./dom-policy\";\nimport type { Transition } from \"motion/react\";\nimport type { MotionEase, MotionTransition } from \"../motion-config/types\";\n\nexport type ThemeTransition = { duration: number; ease: MotionEase };\nexport const fallbackTransition: ThemeTransition = { duration: 180, ease: [0.2, 0.8, 0.2, 1] };\n\nexport const readThemeTransition = (element: HTMLElement): ThemeTransition => {\n const style = getComputedStyle(element);\n const duration = readMotionDuration(element);\n const rawEase = style.getPropertyValue(\"--gridui-motion-ease-out\").trim();\n const values = /^cubic-bezier\\(([^)]+)\\)$/.exec(rawEase)?.[1]?.split(\",\").map(Number);\n let ease = fallbackTransition.ease;\n if (values?.length === 4 && values.every(Number.isFinite)\n && values[0]! >= 0 && values[0]! <= 1 && values[2]! >= 0 && values[2]! <= 1) {\n ease = [values[0]!, values[1]!, values[2]!, values[3]!];\n } else if (rawEase === \"linear\") {\n ease = \"linear\";\n } else if (rawEase === \"ease-in\") {\n ease = \"easeIn\";\n } else if (rawEase === \"ease-out\") {\n ease = \"easeOut\";\n } else if (rawEase === \"ease-in-out\") {\n ease = \"easeInOut\";\n }\n return { duration, ease };\n};\n\nexport const resolveTransition = (\n transition: MotionTransition | undefined, theme: ThemeTransition, tempo: number, immediate: boolean,\n): Transition => {\n if (transition) {validateTransition(transition);}\n if (immediate) {return { type: \"tween\", duration: 0 };}\n if (transition?.type === \"spring\") {\n return {\n type: \"spring\",\n stiffness: (transition.stiffness ?? 170) / (tempo * tempo),\n damping: (transition.damping ?? 26) / tempo,\n mass: transition.mass ?? 1,\n };\n }\n return {\n type: \"tween\",\n duration: (transition?.duration ?? theme.duration) * tempo / 1000,\n ease: transition?.ease ?? theme.ease,\n };\n};\n", "import { Slot } from \"@radix-ui/react-slot\";\nimport type { ComponentPropsWithRef } from \"react\";\nimport { useMotionStyle } from \"../shared/use-motion-style\";\n\nexport type MotionScopeProps = ComponentPropsWithRef<\"div\"> & { readonly asChild?: boolean };\n\n/** CSS policy boundary. asChild preserves the child's DOM, ref, and semantics. */\nexport const MotionScope = ({ asChild = false, style, ...props }: MotionScopeProps) => {\n const motionStyle = useMotionStyle(style);\n const Component = asChild ? Slot : \"div\";\n return <Component {...props} style={motionStyle} />;\n};\n", "import { LayoutGroup } from \"motion/react\";\nimport { type ReactNode, useId } from \"react\";\nimport { LayoutGroupContext } from \"./context\";\n\nexport type MotionLayoutGroupProps = { readonly children: ReactNode };\n\n/** Deliberately share layout identities across nested Presence boundaries. No DOM. */\nexport const MotionLayoutGroup = ({ children }: MotionLayoutGroupProps) => {\n const id = useId();\n return <LayoutGroupContext.Provider value={true}>\n <LayoutGroup id={id}>{children}</LayoutGroup>\n </LayoutGroupContext.Provider>;\n};\n", "import { useLayoutEffect, useState } from \"react\";\nimport { useMotionPolicy } from \"../shared/use-motion-policy\";\nimport { createSpringValue, type SpringValue, type SpringValueOptions } from \"./controller\";\n\n/** Initial value is captured once. Subscriptions update DOM without React frame renders. */\nexport const useSpringValue = (initial: number, options?: SpringValueOptions): SpringValue => {\n const policy = useMotionPolicy();\n const { tempo, immediate } = policy;\n const [controller] = useState(() => createSpringValue(initial));\n const spring: SpringValueOptions | undefined = options ?? (policy.transition?.type === \"spring\" ? policy.transition : undefined);\n const { stiffness, damping, mass, precision } = spring ?? {};\n useLayoutEffect(() => {\n controller.configure({ ...(stiffness === undefined ? {} : { stiffness }),\n ...(damping === undefined ? {} : { damping }), ...(mass === undefined ? {} : { mass }), ...(precision === undefined ? {} : { precision }) }, { tempo, immediate });\n }, [controller, stiffness, damping, mass, precision, tempo, immediate]);\n useLayoutEffect(() => () => void controller.stop(), [controller]);\n return controller;\n};\n", "import { animate, motionValue, type AnimationPlaybackControlsWithThen } from \"motion/react\";\nimport type { MotionTransition } from \"../motion-config/types\";\nimport { validateTransition } from \"../motion-config/validate-transition\";\nimport type { MotionOutcome } from \"../shared/outcome\";\n\nexport type SpringValueOptions = Omit<Extract<MotionTransition, { type: \"spring\" }>, \"type\"> & {\n /** Rest distance and speed tolerance in value units and units per second. */\n readonly precision?: number;\n};\nexport type SpringValuePolicy = { readonly tempo: number; readonly immediate: boolean };\nexport type SpringValue = {\n readonly get: () => number;\n /** Units per real second, independent of tempo. */\n readonly getVelocity: () => number;\n readonly set: (target: number, velocity?: number) => Promise<MotionOutcome>;\n readonly jump: (target: number) => void;\n readonly stop: () => void;\n readonly subscribe: (changed: (value: number) => void) => () => void;\n};\nexport type SpringValueController = SpringValue & {\n readonly configure: (options: SpringValueOptions, policy: SpringValuePolicy) => void;\n readonly dispose: () => void;\n};\nconst finite = (value: number): void => {\n if (!Number.isFinite(value)) { throw new RangeError(\"Spring values and velocities must be finite.\"); }\n};\n\nexport const createSpringValue = (initial: number, initialOptions: SpringValueOptions = {},\n initialPolicy: SpringValuePolicy = { tempo: 1, immediate: false }): SpringValueController => {\n finite(initial);\n const value = motionValue(initial);\n let disposed = false;\n const assertActive = () => {\n if (disposed) { throw new Error(\"Cannot use a disposed spring value.\"); }\n };\n let options: SpringValueOptions = {};\n let tempo = 1;\n let immediate = true;\n let target = initial;\n let pending: Promise<MotionOutcome> | undefined;\n let run: { animation: AnimationPlaybackControlsWithThen; initialVelocity: number; startTempo: number; resolve: (result: MotionOutcome) => void } | undefined;\n // Before the first engine sample, MotionValue has no velocity history.\n const getVelocity = () => !run ? 0 : run.animation.time === 0\n ? run.initialVelocity * run.startTempo / tempo : value.getVelocity();\n const stop = () => {\n const previous = run;\n run = undefined;\n previous?.animation.stop();\n previous?.resolve(\"cancelled\");\n };\n const jump = (next: number) => {\n assertActive();\n finite(next);\n stop();\n target = next;\n value.jump(next);\n };\n const api: SpringValue = {\n get: () => value.get(),\n getVelocity,\n subscribe: changed => { assertActive(); return value.on(\"change\", changed); },\n stop, jump,\n set: (next, velocity) => {\n assertActive();\n finite(next);\n if (run && next === target && velocity === undefined) { return pending!; }\n const releaseVelocity = velocity ?? getVelocity();\n finite(releaseVelocity);\n stop();\n target = next;\n if (immediate || (value.get() === next && releaseVelocity === 0)) {\n value.jump(next);\n return Promise.resolve(\"finished\");\n }\n const { precision, ...spring } = options;\n const animation = animate(value, next, { type: \"spring\", stiffness: 170, damping: 26, mass: 1,\n ...spring, velocity: releaseVelocity * tempo,\n ...(precision === undefined ? {} : { restDelta: precision, restSpeed: precision * tempo }) });\n animation.speed = 1 / tempo;\n pending = new Promise<MotionOutcome>(resolve => {\n const current = { animation, initialVelocity: releaseVelocity, startTempo: tempo, resolve };\n run = current;\n void animation.then(() => {\n if (run !== current) { return; }\n run = undefined;\n resolve(\"finished\");\n });\n });\n return pending;\n },\n };\n const configure = (next: SpringValueOptions, policy: SpringValuePolicy) => {\n assertActive();\n validateTransition({ type: \"spring\", ...next });\n if (!Number.isFinite(policy.tempo) || policy.tempo <= 0\n || (next.precision !== undefined && (!Number.isFinite(next.precision) || next.precision <= 0))) {\n throw new RangeError(\"Spring tempo and precision must be finite and positive.\");\n }\n options = next;\n tempo = policy.tempo;\n immediate = policy.immediate;\n if (run) {\n if (immediate) {\n const previous = run;\n run = undefined;\n previous.animation.stop();\n value.jump(target);\n previous.resolve(\"finished\");\n } else { run.animation.speed = 1 / tempo; }\n }\n };\n configure(initialOptions, initialPolicy);\n return { ...api, configure, dispose: () => {\n if (disposed) { return; }\n disposed = true;\n stop();\n value.destroy();\n } };\n};\n", "import { type ComponentPropsWithRef, type CSSProperties, useImperativeHandle, useLayoutEffect, useRef } from \"react\";\nimport { useSpringValue } from \"../spring-value/use-spring-value\";\nimport type { SpringValueOptions } from \"../spring-value/controller\";\n\nexport type MotionSizeProps = Omit<ComponentPropsWithRef<\"div\">, \"style\"> & {\n readonly style?: Omit<CSSProperties, \"height\" | \"overflow\" | \"overflowY\">;\n readonly spring?: SpringValueOptions;\n};\n\n/** Animate intrinsic content height. Width and content semantics stay with the caller. */\nexport const MotionSize = ({ children, spring, ref, style, ...props }: MotionSizeProps) => {\n const outer = useRef<HTMLDivElement>(null);\n const inner = useRef<HTMLDivElement>(null);\n const height = useSpringValue(0, spring);\n useImperativeHandle(ref, () => outer.current!, []);\n useLayoutEffect(() => {\n const node = outer.current!;\n const content = inner.current!;\n let revision = 0;\n height.jump(content.offsetHeight);\n let requested = height.get();\n const unsubscribe = height.subscribe(value => { node.style.height = `${Math.max(0, value)}px`; });\n const observer = new ResizeObserver(([entry]) => {\n const target = entry?.borderBoxSize[0]?.blockSize ?? content.offsetHeight;\n if (target === requested) { return; }\n requested = target;\n const run = ++revision;\n node.style.height = `${height.get()}px`;\n node.style.overflow = \"clip\";\n void height.set(target).then(result => {\n if (result === \"finished\" && run === revision) { node.style.height = \"auto\"; node.style.removeProperty(\"overflow\"); }\n });\n });\n observer.observe(content);\n return () => { revision++; observer.disconnect(); unsubscribe(); height.stop(); node.style.removeProperty(\"height\"); node.style.removeProperty(\"overflow\"); };\n }, [height]);\n return <div {...props} ref={outer} style={style}>\n <div ref={inner} style={{ display: \"flow-root\" }}>{children}</div>\n </div>;\n};\n", "import { type RefObject, useLayoutEffect, useState } from \"react\";\nimport { useMotionPolicy } from \"../shared/use-motion-policy\";\nimport { createSequenceController, type MotionSequence } from \"./controller\";\n\n/** Explicit element targets within one mounted scope. This hook owns their animated styles. */\nexport const useMotionSequence = (scope: RefObject<HTMLElement | null>): MotionSequence => {\n const { tempo, immediate, transition } = useMotionPolicy();\n const [controller] = useState(() => createSequenceController(scope));\n useLayoutEffect(() => void controller.configure({ tempo, immediate, transition }), [controller, tempo, immediate, transition]);\n useLayoutEffect(() => () => void controller.dispose(), [controller]);\n return controller.api;\n};\n", "import type { RefObject } from \"react\";\nimport type { MotionEase, MotionTransition } from \"../motion-config/types\";\nimport type { MotionOutcome } from \"../shared/outcome\";\nimport type { MotionState } from \"../shared/state\";\nimport { readThemeTransition } from \"../shared/resolve-transition\";\nimport { validateTransition } from \"../motion-config/validate-transition\";\n\nexport type MotionStep = {\n readonly element: HTMLElement;\n readonly from?: MotionState;\n readonly to: MotionState;\n readonly duration?: number;\n readonly ease?: MotionEase;\n};\nexport type MotionSequenceOptions = {\n readonly order?: \"sequence\" | \"parallel\";\n /** Milliseconds between starts in parallel, or between steps in sequence. */\n readonly stagger?: number;\n};\nexport type MotionRun = {\n readonly finished: Promise<MotionOutcome>;\n readonly cancel: () => void;\n readonly finish: () => void;\n};\nexport type MotionSequence = {\n readonly play: (steps: readonly MotionStep[], options?: MotionSequenceOptions) => MotionRun;\n};\ntype Policy = { tempo: number; immediate: boolean; transition: MotionTransition | undefined };\ntype Property = \"opacity\" | \"transform\";\nconst frames = (state: MotionState): Partial<Record<Property, string>> => ({\n ...(state.opacity === undefined ? {} : { opacity: String(state.opacity) }),\n ...(state.x === undefined && state.y === undefined && state.scale === undefined ? {} : {\n transform: `translate(${state.x ?? 0}px, ${state.y ?? 0}px) scale(${state.scale ?? 1})`,\n }),\n});\nconst easing = (ease: MotionEase): string => Array.isArray(ease) ? `cubic-bezier(${ease.join(\",\")})`\n : ({ linear: \"linear\", easeIn: \"ease-in\", easeOut: \"ease-out\", easeInOut: \"ease-in-out\" })[ease];\n\nexport const createSequenceController = (scope: RefObject<HTMLElement | null>) => {\n let policy: Policy = { tempo: 1, immediate: true, transition: undefined };\n let active: { run: MotionRun; animations: Animation[] } | undefined;\n const originals = new Map<HTMLElement, Map<Property, { value: string; priority: string }>>();\n const play: MotionSequence[\"play\"] = (steps, options = {}) => {\n const stagger = options.stagger ?? 0;\n if (!Number.isFinite(stagger) || stagger < 0) { throw new RangeError(\"Stagger must be finite and nonnegative.\"); }\n const root = scope.current;\n let offset = 0;\n const previous = new Map<HTMLElement, Map<Property, { end: number; value: string }>>();\n const plan = steps.map((step, index) => {\n if (!root?.contains(step.element)) { throw new RangeError(\"Sequence targets must belong to the mounted scope.\"); }\n const theme = readThemeTransition(step.element);\n const base = policy.transition?.type === \"spring\" ? undefined : policy.transition;\n const duration = step.duration ?? base?.duration ?? theme.duration;\n const ease = step.ease ?? base?.ease ?? theme.ease;\n validateTransition({ duration, ease });\n const to = frames(step.to);\n const requestedFrom = step.from ? frames(step.from) : {};\n const from: Partial<Record<Property, string>> = {};\n const delay = options.order === \"parallel\" ? index * stagger : offset;\n offset += duration + stagger;\n const properties = previous.get(step.element) ?? new Map();\n const backwards = (Object.keys(to) as Property[]).every(property => !properties.has(property));\n for (const property of Object.keys(to) as Property[]) {\n const last = properties.get(property);\n if (last && delay < last.end) { throw new RangeError(\"Parallel steps cannot own the same element property at the same time.\"); }\n const start = requestedFrom[property] ?? last?.value;\n if (start !== undefined) { from[property] = start; }\n properties.set(property, { end: delay + duration, value: to[property]! });\n }\n previous.set(step.element, properties);\n return { element: step.element, to, from, duration, ease: easing(ease), delay, backwards };\n });\n active?.run.cancel();\n let resolve!: (result: MotionOutcome) => void;\n const finished = new Promise<MotionOutcome>(done => { resolve = done; });\n const animations: Animation[] = [];\n let settled = false;\n const settle = (result: MotionOutcome) => {\n if (settled) { return; }\n settled = true;\n if (result === \"finished\") {\n for (const step of plan) {\n for (const property of Object.keys(step.to) as Property[]) {\n step.element.style.setProperty(property, step.to[property]!);\n }\n }\n } else {\n // Freeze only properties this scope owns before cancelling WAAPI fills.\n const current = new Map<HTMLElement, Partial<Record<Property, string>>>();\n for (const step of plan) {\n const style = step.element.ownerDocument.defaultView!.getComputedStyle(step.element);\n const values = current.get(step.element) ?? {};\n for (const property of Object.keys(step.to) as Property[]) { values[property] = style.getPropertyValue(property); }\n current.set(step.element, values);\n }\n for (const [element, values] of current) {\n for (const property of Object.keys(values) as Property[]) { element.style.setProperty(property, values[property]!); }\n }\n }\n for (const animation of animations) { animation.cancel(); }\n if (active?.run === run) { active = undefined; }\n resolve(result);\n };\n const run: MotionRun = { finished, cancel: () => void settle(\"cancelled\"), finish: () => void settle(\"finished\") };\n active = { run, animations };\n try {\n for (const step of plan) {\n const saved = originals.get(step.element) ?? new Map();\n for (const property of Object.keys(step.to) as Property[]) {\n if (!saved.has(property)) { saved.set(property, { value: step.element.style.getPropertyValue(property), priority: step.element.style.getPropertyPriority(property) }); }\n }\n originals.set(step.element, saved);\n if (policy.immediate) { continue; }\n // Later steps must not cover earlier steps during their delay.\n const animation = step.element.animate([step.from, step.to], {\n duration: step.duration, delay: step.delay, easing: step.ease, fill: step.backwards ? \"both\" : \"forwards\",\n });\n animation.playbackRate = 1 / policy.tempo;\n animations.push(animation);\n }\n void Promise.all(animations.map(animation => animation.finished)).then(() => void run.finish(), () => void run.cancel());\n if (policy.immediate || !plan.length) { run.finish(); }\n } catch (error) {\n run.cancel();\n throw error;\n }\n return run;\n };\n return {\n api: { play },\n configure: (next: Policy) => {\n policy = next;\n if (next.immediate) { active?.run.finish(); }\n else { for (const animation of active?.animations ?? []) { animation.updatePlaybackRate(1 / next.tempo); } }\n },\n dispose: () => {\n active?.run.cancel();\n for (const [element, properties] of originals) {\n for (const [property, original] of properties) { element.style.setProperty(property, original.value, original.priority); }\n }\n originals.clear();\n },\n };\n};\n", "import { type RefObject, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { LayoutMotion, type LayoutMotionProps } from \"../layout-motion/layout-motion\";\nimport { useMotionPolicy } from \"../shared/use-motion-policy\";\n\nexport type MotionRevealProps = Omit<LayoutMotionProps, \"animate\" | \"exit\" | \"layout\" | \"layoutId\" | \"layoutScroll\" | \"layoutRoot\"> & {\n readonly once?: boolean;\n readonly amount?: number;\n readonly root?: Element | null;\n readonly rootMargin?: string;\n};\n\n/** Offscreen decoration only. Initial visible content and keyboard access stay usable. */\nexport const MotionReveal = ({ once = true, amount = 0, root = null, rootMargin = \"0px\",\n enter = { opacity: 0, y: 12 }, transition, ref, onFocusCapture, ...props }: MotionRevealProps) => {\n if (!Number.isFinite(amount) || amount < 0 || amount > 1) { throw new RangeError(\"Reveal amount must be between zero and one.\"); }\n const node: RefObject<HTMLDivElement | null> = useRef(null);\n const seen = useRef(false);\n const [visible, setVisible] = useState<boolean | null>(null);\n const [focused, setFocused] = useState(false);\n const { immediate } = useMotionPolicy();\n useImperativeHandle(ref, () => node.current!, []);\n useEffect(() => {\n const element = node.current!;\n const Observer = element.ownerDocument.defaultView!.IntersectionObserver;\n if (immediate || focused || (once && seen.current)) { return; }\n const observer = new Observer(([entry]) => {\n if (!entry) { return; }\n const inside = entry.isIntersecting && entry.intersectionRatio >= amount;\n setVisible(inside);\n if (inside) {\n seen.current = true;\n if (once) { observer.disconnect(); }\n }\n }, { root, rootMargin, threshold: amount });\n observer.observe(element);\n return () => void observer.disconnect();\n }, [immediate, focused, once, amount, root, rootMargin]);\n const show = immediate || focused || visible !== false;\n return <LayoutMotion {...props} ref={node} layout={false}\n animate={show ? { opacity: 1, x: 0, y: 0, scale: 1 } : enter}\n {...((!show || focused) ? { transition: { duration: 0 } } : transition ? { transition } : {})}\n onFocusCapture={event => { setFocused(true); onFocusCapture?.(event); }} />;\n};\n"],
5
+ "mappings": ";;;;;;;;;;AAAA,SAAS,YAAY,eAAe;;;ACE7B,IAAM,qBAAqB,CAAC,eAAuC;AACtE,MAAI,WAAW,SAAS,UAAU;AAC9B,eAAW,SAAS,CAAC,WAAW,WAAW,WAAW,SAAS,WAAW,IAAI,GAAG;AAC7E,UAAI,UAAU,WAAc,CAAC,OAAO,SAAS,KAAK,KAAK,SAAS,IAAI;AAChE,cAAM,IAAI,WAAW,uDAAuD;AAAA,MAChF;AAAA,IACJ;AAAA,EACJ,WAAW,WAAW,aAAa,WAAc,CAAC,OAAO,SAAS,WAAW,QAAQ,KAAK,WAAW,WAAW,IAAI;AAChH,UAAM,IAAI,WAAW,iDAAiD;AAAA,EAC1E;AACJ;;;ADKW;AAZJ,IAAM,eAAe,CAAC,EAAE,UAAU,OAAO,eAAe,UAAU,WAAW,MAAyB;AACzG,QAAM,SAAS,WAAW,aAAa;AACvC,MAAI,UAAU,WAAc,CAAC,OAAO,SAAS,KAAK,KAAK,SAAS,IAAI;AAChE,UAAM,IAAI,WAAW,iDAAiD;AAAA,EAC1E;AACA,MAAI,YAAY;AAAC,uBAAmB,UAAU;AAAA,EAAE;AAChD,QAAM,QAAQ,QAAQ,OAAO;AAAA,IACzB,OAAO,SAAS,OAAO;AAAA,IACvB,eAAe,OAAO,kBAAkB,WAAW,WAAW,iBAAiB,OAAO;AAAA,IACtF,UAAU,OAAO,YAAY,aAAa;AAAA,IAC1C,YAAY,cAAc,OAAO;AAAA,EACrC,IAAI,CAAC,QAAQ,OAAO,eAAe,UAAU,UAAU,CAAC;AAC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,CAAC,OAAO;AAAE;AAAA,MAAQ;AACtB,YAAM,SAAS,MAAM,kBAAkB,MAAM,qBAAqB;AAClE,iBAAW,MAAM;AACjB,UAAI,QAAQ;AACR,aAAK,UAAU;AACf,YAAI,MAAM;AAAE,mBAAS,WAAW;AAAA,QAAG;AAAA,MACvC;AAAA,IACJ,GAAG,EAAE,MAAM,YAAY,WAAW,OAAO,CAAC;AAC1C,aAAS,QAAQ,OAAO;AACxB,WAAO,MAAM,KAAK,SAAS,WAAW;AAAA,EAC1C,GAAG,CAAC,WAAW,SAAS,MAAM,QAAQ,MAAM,UAAU,CAAC;AACvD,QAAM,OAAO,aAAa,WAAW,YAAY;AACjD,SAAO,gBAAAJ;AAAA,IAAC;AAAA;AAAA,MAAc,GAAG;AAAA,MAAO,KAAK;AAAA,MAAM,QAAQ;AAAA,MAC/C,SAAS,OAAO,EAAE,SAAS,GAAG,GAAG,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI;AAAA,MACtD,GAAK,CAAC,QAAQ,UAAW,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,IAAI,aAAa,EAAE,WAAW,IAAI,CAAC;AAAA,MAC3F,gBAAgB,WAAS;AAAE,mBAAW,IAAI;AAAG,yBAAiB,KAAK;AAAA,MAAG;AAAA;AAAA,EAAG;AACjF;",
6
+ "names": ["useContext", "jsx", "useMemo", "jsx", "animate", "useMemo", "jsx", "LayoutGroup", "useId", "jsx", "useId", "LayoutGroup", "useLayoutEffect", "useState", "useState", "useLayoutEffect", "useImperativeHandle", "useLayoutEffect", "useRef", "jsx", "useRef", "useImperativeHandle", "useLayoutEffect", "useLayoutEffect", "useState", "useState", "useLayoutEffect", "useEffect", "useImperativeHandle", "useRef", "useState", "jsx", "useRef", "useState", "useImperativeHandle", "useEffect"]
7
+ }
@@ -0,0 +1,20 @@
1
+ import type { MotionState } from "../shared/state";
2
+ import { type ComponentPropsWithRef, type CSSProperties } from "react";
3
+ import type { MotionTransition } from "../motion-config/types";
4
+ export type LayoutMotionProps = Omit<ComponentPropsWithRef<"div">, "onAnimationStart" | "onDrag" | "onDragStart" | "onDragEnd" | "style"> & {
5
+ readonly style?: Omit<CSSProperties, "transform" | "opacity" | "scale" | "translate" | "rotate">;
6
+ readonly layout?: boolean | "position" | "size";
7
+ readonly layoutId?: string;
8
+ /** Mark the scrolling element used by descendant layout measurements. */
9
+ readonly layoutScroll?: boolean;
10
+ /** Mark a fixed-position root used by descendant layout measurements. */
11
+ readonly layoutRoot?: boolean;
12
+ readonly enter?: MotionState;
13
+ readonly animate?: MotionState;
14
+ readonly exit?: MotionState;
15
+ readonly transition?: MotionTransition;
16
+ readonly exitTransition?: MotionTransition;
17
+ readonly onAnimationComplete?: () => void;
18
+ readonly onLayoutAnimationComplete?: () => void;
19
+ };
20
+ export declare const LayoutMotion: ({ layout, layoutId, layoutScroll, layoutRoot, enter, animate, exit, transition, exitTransition, ref, inert, style, onAnimationComplete, "aria-hidden": ariaHidden, ...props }: LayoutMotionProps) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { MotionSettings } from "./types";
2
+ export declare const MotionContext: import("react").Context<MotionSettings>;
@@ -0,0 +1,2 @@
1
+ import type { MotionConfigProps } from "./types";
2
+ export declare const MotionConfig: ({ children, tempo, reducedMotion, disabled, transition }: MotionConfigProps) => import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import type { ReactNode } from "react";
2
+ export type MotionEase = "linear" | "easeIn" | "easeOut" | "easeInOut" | [number, number, number, number];
3
+ /** Durations are milliseconds. Spring parameters describe a physical spring. */
4
+ export type MotionTransition = {
5
+ readonly type?: "tween";
6
+ readonly duration?: number;
7
+ readonly ease?: MotionEase;
8
+ } | {
9
+ readonly type: "spring";
10
+ readonly stiffness?: number;
11
+ readonly damping?: number;
12
+ readonly mass?: number;
13
+ };
14
+ export type MotionConfigProps = {
15
+ readonly children: ReactNode;
16
+ /** Absolute pace in this scope: 0.8 is faster, 1.2 is slower. */
17
+ readonly tempo?: number;
18
+ readonly reducedMotion?: "user" | "always";
19
+ readonly disabled?: boolean;
20
+ readonly transition?: MotionTransition;
21
+ };
22
+ export type MotionSettings = {
23
+ readonly tempo: number;
24
+ readonly reducedMotion: "user" | "always";
25
+ readonly disabled: boolean;
26
+ readonly transition: MotionTransition | undefined;
27
+ };
@@ -0,0 +1,2 @@
1
+ import type { MotionTransition } from "./types";
2
+ export declare const validateTransition: (transition: MotionTransition) => void;
@@ -0,0 +1 @@
1
+ export declare const LayoutGroupContext: import("react").Context<boolean>;
@@ -0,0 +1,6 @@
1
+ import { type ReactNode } from "react";
2
+ export type MotionLayoutGroupProps = {
3
+ readonly children: ReactNode;
4
+ };
5
+ /** Deliberately share layout identities across nested Presence boundaries. No DOM. */
6
+ export declare const MotionLayoutGroup: ({ children }: MotionLayoutGroupProps) => import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { type LayoutMotionProps } from "../layout-motion/layout-motion";
2
+ export type MotionRevealProps = Omit<LayoutMotionProps, "animate" | "exit" | "layout" | "layoutId" | "layoutScroll" | "layoutRoot"> & {
3
+ readonly once?: boolean;
4
+ readonly amount?: number;
5
+ readonly root?: Element | null;
6
+ readonly rootMargin?: string;
7
+ };
8
+ /** Offscreen decoration only. Initial visible content and keyboard access stay usable. */
9
+ export declare const MotionReveal: ({ once, amount, root, rootMargin, enter, transition, ref, onFocusCapture, ...props }: MotionRevealProps) => import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { ComponentPropsWithRef } from "react";
2
+ export type MotionScopeProps = ComponentPropsWithRef<"div"> & {
3
+ readonly asChild?: boolean;
4
+ };
5
+ /** CSS policy boundary. asChild preserves the child's DOM, ref, and semantics. */
6
+ export declare const MotionScope: ({ asChild, style, ...props }: MotionScopeProps) => import("react").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import type { RefObject } from "react";
2
+ import type { MotionEase, MotionTransition } from "../motion-config/types";
3
+ import type { MotionOutcome } from "../shared/outcome";
4
+ import type { MotionState } from "../shared/state";
5
+ export type MotionStep = {
6
+ readonly element: HTMLElement;
7
+ readonly from?: MotionState;
8
+ readonly to: MotionState;
9
+ readonly duration?: number;
10
+ readonly ease?: MotionEase;
11
+ };
12
+ export type MotionSequenceOptions = {
13
+ readonly order?: "sequence" | "parallel";
14
+ /** Milliseconds between starts in parallel, or between steps in sequence. */
15
+ readonly stagger?: number;
16
+ };
17
+ export type MotionRun = {
18
+ readonly finished: Promise<MotionOutcome>;
19
+ readonly cancel: () => void;
20
+ readonly finish: () => void;
21
+ };
22
+ export type MotionSequence = {
23
+ readonly play: (steps: readonly MotionStep[], options?: MotionSequenceOptions) => MotionRun;
24
+ };
25
+ type Policy = {
26
+ tempo: number;
27
+ immediate: boolean;
28
+ transition: MotionTransition | undefined;
29
+ };
30
+ export declare const createSequenceController: (scope: RefObject<HTMLElement | null>) => {
31
+ api: {
32
+ play: (steps: readonly MotionStep[], options?: MotionSequenceOptions) => MotionRun;
33
+ };
34
+ configure: (next: Policy) => void;
35
+ dispose: () => void;
36
+ };
37
+ export {};
@@ -0,0 +1,4 @@
1
+ import { type RefObject } from "react";
2
+ import { type MotionSequence } from "./controller";
3
+ /** Explicit element targets within one mounted scope. This hook owns their animated styles. */
4
+ export declare const useMotionSequence: (scope: RefObject<HTMLElement | null>) => MotionSequence;
@@ -0,0 +1,8 @@
1
+ import { type ComponentPropsWithRef, type CSSProperties } from "react";
2
+ import type { SpringValueOptions } from "../spring-value/controller";
3
+ export type MotionSizeProps = Omit<ComponentPropsWithRef<"div">, "style"> & {
4
+ readonly style?: Omit<CSSProperties, "height" | "overflow" | "overflowY">;
5
+ readonly spring?: SpringValueOptions;
6
+ };
7
+ /** Animate intrinsic content height. Width and content semantics stay with the caller. */
8
+ export declare const MotionSize: ({ children, spring, ref, style, ...props }: MotionSizeProps) => import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { useMotionPolicy } from "./shared/use-motion-policy";
2
+ export { useMotionStyle } from "./shared/use-motion-style";
3
+ export { readMotionDuration, readMotionPolicy, observeMotionPolicy } from "./shared/dom-policy";
4
+ export type { DOMMotionPolicy } from "./shared/dom-policy";
package/dist/policy.js ADDED
@@ -0,0 +1,15 @@
1
+ import {
2
+ observeMotionPolicy,
3
+ readMotionDuration,
4
+ readMotionPolicy,
5
+ useMotionPolicy,
6
+ useMotionStyle
7
+ } from "./chunk-MMMTUJVS.js";
8
+ export {
9
+ observeMotionPolicy,
10
+ readMotionDuration,
11
+ readMotionPolicy,
12
+ useMotionPolicy,
13
+ useMotionStyle
14
+ };
15
+ //# sourceMappingURL=policy.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,9 @@
1
+ import { type ReactNode } from "react";
2
+ export type PresenceProps = {
3
+ readonly children: ReactNode;
4
+ readonly mode?: "sync" | "wait" | "popLayout";
5
+ readonly initial?: boolean;
6
+ readonly onExitComplete?: () => void;
7
+ };
8
+ /** Keep this boundary mounted. Direct children need stable keys and forwarded refs for popLayout. */
9
+ export declare const Presence: ({ children, mode, initial, onExitComplete }: PresenceProps) => import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ export type DOMMotionPolicy = {
2
+ readonly immediate: boolean;
3
+ readonly tempo: number;
4
+ };
5
+ /** Read base time tokens without applying tempo. CSS calc()/var() resolve in the browser. */
6
+ export declare const readMotionDuration: (element: Element, token?: string, fallback?: number) => number;
7
+ export declare const readMotionPolicy: (element: Element) => DOMMotionPolicy;
8
+ /**
9
+ * Observe the current ancestor chain and document preference. Re-subscribe after
10
+ * reparenting; stylesheet-only changes are read on the next explicit read/update.
11
+ * Resource lifecycle stays independent. This observer never scans descendants.
12
+ */
13
+ export declare const observeMotionPolicy: (element: Element, changed: (policy: DOMMotionPolicy) => void) => (() => void);
@@ -0,0 +1 @@
1
+ export type MotionOutcome = "finished" | "cancelled";
@@ -0,0 +1,9 @@
1
+ import type { Transition } from "motion/react";
2
+ import type { MotionEase, MotionTransition } from "../motion-config/types";
3
+ export type ThemeTransition = {
4
+ duration: number;
5
+ ease: MotionEase;
6
+ };
7
+ export declare const fallbackTransition: ThemeTransition;
8
+ export declare const readThemeTransition: (element: HTMLElement) => ThemeTransition;
9
+ export declare const resolveTransition: (transition: MotionTransition | undefined, theme: ThemeTransition, tempo: number, immediate: boolean) => Transition;
@@ -0,0 +1,6 @@
1
+ export type MotionState = {
2
+ readonly opacity?: number;
3
+ readonly x?: number;
4
+ readonly y?: number;
5
+ readonly scale?: number;
6
+ };
@@ -0,0 +1,10 @@
1
+ /** Unknown server preference is visually immediate but must not advance domain state. */
2
+ export declare const useMotionPolicy: () => {
3
+ ready: boolean;
4
+ reason: string | undefined;
5
+ immediate: boolean;
6
+ tempo: number;
7
+ reducedMotion: "user" | "always";
8
+ disabled: boolean;
9
+ transition: import("..").MotionTransition | undefined;
10
+ };
@@ -0,0 +1,3 @@
1
+ import type { CSSProperties } from "react";
2
+ /** Bridge React policy to owned CSS, including nodes rendered through a portal. */
3
+ export declare const useMotionStyle: (style?: CSSProperties) => CSSProperties;
@@ -0,0 +1,26 @@
1
+ import type { MotionTransition } from "../motion-config/types";
2
+ import type { MotionOutcome } from "../shared/outcome";
3
+ export type SpringValueOptions = Omit<Extract<MotionTransition, {
4
+ type: "spring";
5
+ }>, "type"> & {
6
+ /** Rest distance and speed tolerance in value units and units per second. */
7
+ readonly precision?: number;
8
+ };
9
+ export type SpringValuePolicy = {
10
+ readonly tempo: number;
11
+ readonly immediate: boolean;
12
+ };
13
+ export type SpringValue = {
14
+ readonly get: () => number;
15
+ /** Units per real second, independent of tempo. */
16
+ readonly getVelocity: () => number;
17
+ readonly set: (target: number, velocity?: number) => Promise<MotionOutcome>;
18
+ readonly jump: (target: number) => void;
19
+ readonly stop: () => void;
20
+ readonly subscribe: (changed: (value: number) => void) => () => void;
21
+ };
22
+ export type SpringValueController = SpringValue & {
23
+ readonly configure: (options: SpringValueOptions, policy: SpringValuePolicy) => void;
24
+ readonly dispose: () => void;
25
+ };
26
+ export declare const createSpringValue: (initial: number, initialOptions?: SpringValueOptions, initialPolicy?: SpringValuePolicy) => SpringValueController;
@@ -0,0 +1,3 @@
1
+ import { type SpringValue, type SpringValueOptions } from "./controller";
2
+ /** Initial value is captured once. Subscriptions update DOM without React frame renders. */
3
+ export declare const useSpringValue: (initial: number, options?: SpringValueOptions) => SpringValue;
@@ -0,0 +1,233 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "@gridui/motion",
4
+ "version": "1.0.1",
5
+ "category": "core",
6
+ "description": "Shared GridUI motion policy, layout, springs, and scoped animation",
7
+ "usage": "Shared React motion policy, presence/layout transitions, spring values, scoped sequences, intrinsic sizing, and visibility-triggered decoration. Import `MotionConfig`, `Presence`, and `LayoutMotion` from `@gridui/motion`. Load `@gridui/theme/styles.css`; Motion has no component stylesheet. The package uses Motion internally. Consumers do not need to import its engine directly.",
8
+ "documentation": [
9
+ "README.md",
10
+ "docs/reference/README.md",
11
+ "docs/reference/layout-motion.md",
12
+ "docs/reference/motion-config.md",
13
+ "docs/reference/motion-layout-group.md",
14
+ "docs/reference/motion-reveal.md",
15
+ "docs/reference/motion-scope.md",
16
+ "docs/reference/motion-size.md",
17
+ "docs/reference/presence.md"
18
+ ],
19
+ "exports": [
20
+ {
21
+ "name": "createSpringValue",
22
+ "kind": "function",
23
+ "importPath": "@gridui/motion"
24
+ },
25
+ {
26
+ "name": "DOMMotionPolicy",
27
+ "kind": "type",
28
+ "importPath": "@gridui/motion"
29
+ },
30
+ {
31
+ "name": "LayoutMotion",
32
+ "kind": "component",
33
+ "importPath": "@gridui/motion"
34
+ },
35
+ {
36
+ "name": "LayoutMotionProps",
37
+ "kind": "type",
38
+ "importPath": "@gridui/motion"
39
+ },
40
+ {
41
+ "name": "MotionConfig",
42
+ "kind": "component",
43
+ "importPath": "@gridui/motion"
44
+ },
45
+ {
46
+ "name": "MotionConfigProps",
47
+ "kind": "type",
48
+ "importPath": "@gridui/motion"
49
+ },
50
+ {
51
+ "name": "MotionEase",
52
+ "kind": "type",
53
+ "importPath": "@gridui/motion"
54
+ },
55
+ {
56
+ "name": "MotionLayoutGroup",
57
+ "kind": "component",
58
+ "importPath": "@gridui/motion"
59
+ },
60
+ {
61
+ "name": "MotionLayoutGroupProps",
62
+ "kind": "type",
63
+ "importPath": "@gridui/motion"
64
+ },
65
+ {
66
+ "name": "MotionOutcome",
67
+ "kind": "type",
68
+ "importPath": "@gridui/motion"
69
+ },
70
+ {
71
+ "name": "MotionReveal",
72
+ "kind": "component",
73
+ "importPath": "@gridui/motion"
74
+ },
75
+ {
76
+ "name": "MotionRevealProps",
77
+ "kind": "type",
78
+ "importPath": "@gridui/motion"
79
+ },
80
+ {
81
+ "name": "MotionRun",
82
+ "kind": "type",
83
+ "importPath": "@gridui/motion"
84
+ },
85
+ {
86
+ "name": "MotionScope",
87
+ "kind": "component",
88
+ "importPath": "@gridui/motion"
89
+ },
90
+ {
91
+ "name": "MotionScopeProps",
92
+ "kind": "type",
93
+ "importPath": "@gridui/motion"
94
+ },
95
+ {
96
+ "name": "MotionSequence",
97
+ "kind": "type",
98
+ "importPath": "@gridui/motion"
99
+ },
100
+ {
101
+ "name": "MotionSequenceOptions",
102
+ "kind": "type",
103
+ "importPath": "@gridui/motion"
104
+ },
105
+ {
106
+ "name": "MotionSize",
107
+ "kind": "component",
108
+ "importPath": "@gridui/motion"
109
+ },
110
+ {
111
+ "name": "MotionSizeProps",
112
+ "kind": "type",
113
+ "importPath": "@gridui/motion"
114
+ },
115
+ {
116
+ "name": "MotionState",
117
+ "kind": "type",
118
+ "importPath": "@gridui/motion"
119
+ },
120
+ {
121
+ "name": "MotionStep",
122
+ "kind": "type",
123
+ "importPath": "@gridui/motion"
124
+ },
125
+ {
126
+ "name": "MotionTransition",
127
+ "kind": "type",
128
+ "importPath": "@gridui/motion"
129
+ },
130
+ {
131
+ "name": "observeMotionPolicy",
132
+ "kind": "function",
133
+ "importPath": "@gridui/motion"
134
+ },
135
+ {
136
+ "name": "Presence",
137
+ "kind": "component",
138
+ "importPath": "@gridui/motion"
139
+ },
140
+ {
141
+ "name": "PresenceProps",
142
+ "kind": "type",
143
+ "importPath": "@gridui/motion"
144
+ },
145
+ {
146
+ "name": "readMotionDuration",
147
+ "kind": "function",
148
+ "importPath": "@gridui/motion"
149
+ },
150
+ {
151
+ "name": "readMotionPolicy",
152
+ "kind": "function",
153
+ "importPath": "@gridui/motion"
154
+ },
155
+ {
156
+ "name": "SpringValue",
157
+ "kind": "type",
158
+ "importPath": "@gridui/motion"
159
+ },
160
+ {
161
+ "name": "SpringValueController",
162
+ "kind": "type",
163
+ "importPath": "@gridui/motion"
164
+ },
165
+ {
166
+ "name": "SpringValueOptions",
167
+ "kind": "type",
168
+ "importPath": "@gridui/motion"
169
+ },
170
+ {
171
+ "name": "SpringValuePolicy",
172
+ "kind": "type",
173
+ "importPath": "@gridui/motion"
174
+ },
175
+ {
176
+ "name": "useMotionPolicy",
177
+ "kind": "function",
178
+ "importPath": "@gridui/motion"
179
+ },
180
+ {
181
+ "name": "useMotionSequence",
182
+ "kind": "function",
183
+ "importPath": "@gridui/motion"
184
+ },
185
+ {
186
+ "name": "useMotionStyle",
187
+ "kind": "function",
188
+ "importPath": "@gridui/motion"
189
+ },
190
+ {
191
+ "name": "useSpringValue",
192
+ "kind": "function",
193
+ "importPath": "@gridui/motion"
194
+ },
195
+ {
196
+ "name": "DOMMotionPolicy",
197
+ "kind": "type",
198
+ "importPath": "@gridui/motion/policy"
199
+ },
200
+ {
201
+ "name": "observeMotionPolicy",
202
+ "kind": "function",
203
+ "importPath": "@gridui/motion/policy"
204
+ },
205
+ {
206
+ "name": "readMotionDuration",
207
+ "kind": "function",
208
+ "importPath": "@gridui/motion/policy"
209
+ },
210
+ {
211
+ "name": "readMotionPolicy",
212
+ "kind": "function",
213
+ "importPath": "@gridui/motion/policy"
214
+ },
215
+ {
216
+ "name": "useMotionPolicy",
217
+ "kind": "function",
218
+ "importPath": "@gridui/motion/policy"
219
+ },
220
+ {
221
+ "name": "useMotionStyle",
222
+ "kind": "function",
223
+ "importPath": "@gridui/motion/policy"
224
+ }
225
+ ],
226
+ "styles": [
227
+ "@gridui/theme/styles.css"
228
+ ],
229
+ "examples": [
230
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/motion/stories/getting-started.mdx",
231
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/motion/stories/motion.stories.tsx"
232
+ ]
233
+ }