framer-motion
Version:
A simple and powerful JavaScript animation library
1 lines • 69.7 kB
Source Map (JSON)
{"version":3,"file":"remix.mjs","sources":["../../src/remix.ts"],"sourcesContent":["import {\n acquireProjectionNode,\n animateLayout,\n buildHTMLStyles,\n buildSVGAttrs,\n flushLayoutSnapshots,\n frame,\n HTMLVisualElement,\n isControllingVariants,\n isForcedMotionValue,\n isMotionValue,\n isSVGTag,\n isVariantNode,\n resolveMotionValue,\n resolveVariantFromProps,\n scopeMotion as createScope,\n scrapeHTMLMotionValuesFromProps,\n scrapeSVGMotionValuesFromProps,\n SVGVisualElement,\n visualElementStore,\n type LayoutAnimationBuilder,\n type MotionNodeOptions,\n type MotionScope,\n type MotionValue,\n type PresenceContextProps,\n type ReducedMotionConfig,\n type ResolvedValues,\n type ScopeOptions,\n type ScopeSetup,\n type Transition,\n type VariantLabels,\n} from \"motion-dom\"\nimport { createElement, createMixin } from \"remix/component\"\nimport type { Handle, RemixNode } from \"remix/component\"\nimport { DragGesture } from \"./gestures/drag\"\nimport { PanGesture } from \"./gestures/pan\"\nimport { animations } from \"./motion/features/animations\"\nimport { gestureAnimations } from \"./motion/features/gestures\"\nimport { loadFeatures } from \"./motion/features/load-features\"\nimport { isValidMotionProp } from \"./motion/utils/valid-prop\"\nimport { lowercaseSVGElements } from \"./render/svg/lowercase-elements\"\nimport { createReorder } from \"./remix-reorder\"\n\ntype Values = Record<string, any>\n\nexport type MotionStyle = Record<\n string,\n string | number | MotionValue | undefined\n>\n\n/**\n * The same props as React's `<motion.div>`, without React's DOM props.\n */\nexport interface MotionProps extends MotionNodeOptions {\n style?: MotionStyle\n}\n\nexport interface MotionConfigProps {\n transition?: Transition\n reducedMotion?: ReducedMotionConfig\n children?: RemixNode\n}\n\nexport interface AnimatePresenceProps {\n /**\n * Set to `false` to skip the `initial` animation of the motion elements\n * rendered with `AnimatePresence`'s first render.\n */\n initial?: boolean\n\n /**\n * - `\"sync\"`: Elements enter and exit at the same time.\n * - `\"wait\"`: New elements render after the exiting elements are removed.\n * - `\"popLayout\"`: Exiting elements are taken out of the layout with\n * `position: absolute`, so the elements around them can move at once.\n */\n mode?: \"sync\" | \"wait\" | \"popLayout\"\n\n /**\n * In \"popLayout\" mode, the side exiting elements stay pinned to.\n *\n * @default \"left\"\n */\n anchorX?: \"left\" | \"right\"\n\n /**\n * In \"popLayout\" mode, the side exiting elements stay pinned to.\n *\n * @default \"top\"\n */\n anchorY?: \"top\" | \"bottom\"\n\n /**\n * A value that replaces `custom` on exiting elements, to resolve\n * dynamic `exit` variants with the latest data.\n */\n custom?: any\n\n /**\n * Called when every exiting element is removed.\n */\n onExitComplete?: VoidFunction\n\n children?: RemixNode\n}\n\nexport interface LayoutGroupProps {\n /**\n * Prefixes every `layoutId` inside, so separate groups can use the\n * same `layoutId`s without animating between each other.\n */\n id?: string\n children?: RemixNode\n}\n\ninterface VariantContext {\n initial?: false | VariantLabels\n animate?: VariantLabels\n}\n\ninterface PresenceGroup {\n props: AnimatePresenceProps\n isFirstRender: boolean\n}\n\nlet featuresLoaded = false\n\nfunction loadRemixFeatures() {\n if (featuresLoaded) return\n featuresLoaded = true\n loadFeatures({\n ...animations,\n ...gestureAnimations,\n pan: { Feature: PanGesture },\n drag: { Feature: DragGesture },\n })\n}\n\n/**\n * Set a default `transition` and `reducedMotion` for every motion element\n * below it.\n *\n * @public\n */\nexport function MotionConfig(\n handle: Handle<MotionConfigProps, MotionConfigProps>\n) {\n return () => {\n const { children, ...config } = handle.props\n handle.context.set({\n ...(handle.context.get(MotionConfig) as MotionConfigProps),\n ...config,\n })\n return children\n }\n}\n\nconst flatten = (node: RemixNode): any[] =>\n Array.isArray(node) ? (node as any[]).flat(Infinity) : [node]\n\n/**\n * A motion component is a component, so Remix can't see the key of the\n * element it renders. Pass the key to the element, so Remix keeps the\n * element when the component is reordered.\n */\nconst withPresenceKey = (child: any) =>\n child?.key != null && motionComponents.has(child.type)\n ? { ...child, props: { ...child.props, presenceKey: child.key } }\n : child\n\n/**\n * What a child of `AnimatePresence` tells the motion elements inside it.\n */\ninterface PresenceChildContext {\n isPresent: boolean\n custom?: any\n /**\n * Exits registered while the child exits. It's removed when they finish.\n */\n exits: Promise<void>[]\n /**\n * In \"popLayout\" mode, whether an element has left the layout yet.\n */\n popLayout?: boolean\n popped?: boolean\n anchorX?: \"left\" | \"right\"\n anchorY?: \"top\" | \"bottom\"\n}\n\ninterface PresenceChildProps {\n isPresent: boolean\n custom?: any\n popLayout?: boolean\n anchorX?: \"left\" | \"right\"\n anchorY?: \"top\" | \"bottom\"\n onExitComplete: VoidFunction\n children?: RemixNode\n}\n\n/**\n * Keeps an exiting child of `AnimatePresence` until the exits of the\n * motion elements inside it finish, as React's PresenceChild.\n */\nfunction PresenceChild(\n handle: Handle<PresenceChildProps, PresenceChildContext>\n) {\n let exitId = 0\n let popped = false\n let exits: Promise<void>[] = []\n\n return () => {\n const { isPresent, children } = handle.props\n if (isPresent) exits = []\n const context: PresenceChildContext = {\n ...handle.props,\n exits,\n popped,\n }\n handle.context.set(context)\n\n /**\n * Every exit registered since the child started exiting, checked\n * by the latest render only.\n */\n const id = ++exitId\n if (isPresent) {\n popped = false\n } else {\n handle.queueTask(() => {\n popped ||= !!context.popped\n Promise.all([...exits]).then(() => {\n if (id === exitId) handle.props.onExitComplete()\n })\n })\n }\n\n return children\n }\n}\n\ninterface PresenceItem {\n key: any\n child: any\n isPresent: boolean\n}\n\nconst getKey = (child: any, index: number) => child?.key ?? \"__i\" + index\n\n/**\n * Keep removed children of `AnimatePresence` until their motion elements\n * finish their `exit` animations. Also choose how entering and exiting\n * children share the screen, skip their first `initial` animation, and\n * know when exits finish.\n *\n * @public\n */\nexport function AnimatePresence(\n handle: Handle<AnimatePresenceProps, PresenceGroup>\n) {\n let items: PresenceItem[] = []\n const exited = new Set<any>()\n\n const group: PresenceGroup = {\n props: handle.props,\n isFirstRender: true,\n }\n\n const remove = (key: any) => {\n exited.add(key)\n handle.update()\n }\n\n return () => {\n handle.context.set(group)\n if (group.isFirstRender) {\n handle.queueTask(() => (group.isFirstRender = false))\n }\n\n const { mode, custom } = handle.props\n const present = flatten(handle.props.children).filter(\n (child) => child != null && child !== false && child !== true\n )\n const presentKeys = new Map(\n present.map((child, i) => [getKey(child, i), child])\n )\n\n /**\n * Merge the present children with the exiting ones, which keep\n * their place.\n */\n const next: PresenceItem[] = present.map((child, i) => ({\n key: getKey(child, i),\n child,\n isPresent: true,\n }))\n items.forEach((item, i) => {\n if (presentKeys.has(item.key) || exited.has(item.key)) return\n next.splice(Math.min(i, next.length), 0, {\n ...item,\n isPresent: false,\n })\n })\n\n const hadExited = exited.size > 0\n exited.clear()\n items = next\n\n /**\n * Once every exit finishes. Not when an exiting child comes back.\n */\n const isExiting = next.some((item) => !item.isPresent)\n if (hadExited && !isExiting) {\n handle.queueTask(() => handle.props.onExitComplete?.())\n }\n\n /**\n * In \"wait\" mode, render the new children once the old ones\n * have exited.\n */\n const shown =\n mode === \"wait\" && isExiting\n ? next.filter((item) => !item.isPresent)\n : next\n\n return shown.map(({ key, child, isPresent }) =>\n createElement(\n PresenceChild,\n {\n key,\n isPresent,\n custom,\n popLayout: mode === \"popLayout\",\n anchorX: handle.props.anchorX,\n anchorY: handle.props.anchorY,\n onExitComplete: () => remove(key),\n },\n withPresenceKey(child)\n )\n )\n }\n}\n\n/**\n * Inside `AnimatePresence`: keep the exiting child until `exit` resolves,\n * like React's `safeToRemove`. Call it in each render while `isPresent()`\n * is `false`.\n *\n * @public\n */\nexport function holdPresence(handle: Handle<any, any>, exit: Promise<void>) {\n const context = handle.context.get(PresenceChild) as\n | PresenceChildContext\n | undefined\n context && !context.isPresent && context.exits.push(exit)\n}\n\n/**\n * Inside `AnimatePresence`: whether the component is present, or exiting.\n *\n * @public\n */\nexport function isPresent(handle: Handle<any, any>) {\n const context = handle.context.get(PresenceChild) as\n | PresenceChildContext\n | undefined\n return context?.isPresent ?? true\n}\n\n/**\n * Inside `AnimatePresence`: the `custom` value of `AnimatePresence`, while\n * the component exits.\n *\n * @public\n */\nexport function getPresenceData(handle: Handle<any, any>) {\n return (\n handle.context.get(PresenceChild) as PresenceChildContext | undefined\n )?.custom\n}\n\n/**\n * Give the `layoutId`s inside an `id`, so separate groups don't animate\n * between each other.\n *\n * @public\n */\nexport function LayoutGroup(\n handle: Handle<LayoutGroupProps, LayoutGroupProps>\n) {\n return () => {\n const parent = (handle.context.get(LayoutGroup) as LayoutGroupProps)?.id\n const { id } = handle.props\n handle.context.set({\n id: parent && id ? parent + \"-\" + id : id || parent,\n })\n return handle.props.children\n }\n}\n\n/**\n * Passes variant labels from a motion component to the motion components\n * inside it, so their server render starts in the inherited variant.\n */\nfunction VariantProvider(\n handle: Handle<\n { value: VariantContext; children?: RemixNode },\n VariantContext\n >\n) {\n return () => {\n handle.context.set(handle.props.value)\n return handle.props.children\n }\n}\n\nconst isLabels = (value: unknown): value is VariantLabels =>\n typeof value === \"string\" || Array.isArray(value)\n\nfunction getVariantContext(\n props: MotionProps,\n parent?: VariantContext\n): VariantContext | undefined {\n if (!isControllingVariants(props as any)) {\n return props.inherit === false ? undefined : parent\n }\n return {\n initial:\n props.initial === false || isLabels(props.initial)\n ? props.initial\n : undefined,\n animate: isLabels(props.animate) ? props.animate : undefined,\n }\n}\n\nconst isSVGElement = (tag: string) =>\n !tag.includes(\"-\") &&\n (lowercaseSVGElements.includes(tag) || /[A-Z]/u.test(tag))\n\n/**\n * The values a motion element renders before it animates, as React's\n * `makeLatestValues`.\n */\nfunction makeLatestValues(\n props: MotionProps,\n context: VariantContext | undefined,\n isSVG: boolean,\n isInitialBlocked?: boolean\n) {\n const values: ResolvedValues = {}\n\n const motionValues = (\n isSVG ? scrapeSVGMotionValuesFromProps : scrapeHTMLMotionValuesFromProps\n )(props as any, {}, undefined as any)\n for (const key in motionValues) {\n values[key] = resolveMotionValue(motionValues[key])\n }\n\n let { initial, animate } = props\n if (\n context &&\n isVariantNode(props as any) &&\n !isControllingVariants(props as any) &&\n props.inherit !== false\n ) {\n if (initial === undefined) initial = context.initial\n if (animate === undefined) animate = context.animate\n }\n\n const isBlocked = isInitialBlocked || initial === false\n const toSet = isBlocked ? animate : initial\n if (!toSet || typeof toSet === \"boolean\") return values\n\n for (const definition of Array.isArray(toSet) ? toSet : [toSet]) {\n const resolved = resolveVariantFromProps(props as any, definition)\n if (!resolved) continue\n\n const { transitionEnd, transition, ...target } = resolved as Values\n for (const key in target) {\n let value = target[key]\n if (Array.isArray(value)) {\n value = value[isBlocked ? value.length - 1 : 0]\n }\n if (value !== null) values[key] = value\n }\n Object.assign(values, transitionEnd)\n }\n\n return values\n}\n\n/**\n * Split `style` into what Remix renders and what Motion owns: motion\n * values and transforms like `x`, which the VisualElement renders.\n */\nfunction splitStyle(style: MotionStyle | undefined, props: MotionProps) {\n const css: Values = {}\n for (const key in style) {\n const value = style[key]\n if (!isMotionValue(value) && !isForcedMotionValue(key, props as any)) {\n css[key] = value\n }\n }\n return css\n}\n\nconst createRenderState = () => ({\n style: {},\n vars: {},\n transform: {},\n transformOrigin: {},\n attrs: {},\n})\n\n/**\n * The style, and attributes for SVG, that render `latestValues`.\n */\nfunction renderValues(\n latestValues: ResolvedValues,\n props: MotionProps,\n tag: string,\n isSVG: boolean\n): Values {\n const state = createRenderState()\n if (isSVG) {\n buildSVGAttrs(\n state,\n latestValues,\n isSVGTag(tag),\n props.transformTemplate,\n props.style\n )\n } else {\n buildHTMLStyles(state, latestValues, props.transformTemplate)\n }\n return { ...state.attrs, style: { ...state.vars, ...state.style } }\n}\n\n/**\n * Run each callback even if an earlier one throws, and report the error.\n */\nconst run = (callback: VoidFunction) => {\n try {\n callback()\n } catch (error) {\n queueMicrotask(() => {\n throw error\n })\n }\n}\n\n/**\n * Elements inserted in one commit are mounted together on the next\n * microtask, so every parent exists before its children look it up.\n * Remix inserts children before their parents.\n */\nlet insertQueue:\n | Array<[create: VoidFunction, mount: VoidFunction, animate: VoidFunction]>\n | undefined\n\nfunction queueInsert(\n create: VoidFunction,\n mount: VoidFunction,\n animate: VoidFunction\n) {\n if (!insertQueue) {\n insertQueue = []\n queueMicrotask(flushInserts)\n }\n insertQueue.push([create, mount, animate])\n}\n\n/**\n * Mount the elements inserted in this commit. Also runs before a layout\n * snapshot, in case they update again before the microtask.\n */\nfunction flushInserts() {\n const queue = insertQueue\n if (!queue) return\n insertQueue = undefined\n\n // Parents first, so children join their variant tree...\n for (let i = queue.length - 1; i >= 0; i--) run(queue[i][0])\n for (let i = queue.length - 1; i >= 0; i--) run(queue[i][1])\n // ...and children animate first, as with React's effects.\n for (const [, , animate] of queue) run(animate)\n}\n\n/**\n * Updates queued in one commit: every element gets its new props before\n * any of them animates, as React's insertion effects run before its\n * effects. So a variant change from a parent animates its children with\n * their new transitions.\n */\nlet updateQueue: Array<[update: VoidFunction, animate: VoidFunction]> | undefined\n\nfunction queueUpdate(update: VoidFunction, animate: VoidFunction) {\n if (!updateQueue) {\n updateQueue = []\n queueMicrotask(() => {\n const queue = updateQueue!\n updateQueue = undefined\n for (const [update] of queue) run(update)\n // Parents render first, so animate in reverse: children first.\n for (let i = queue.length - 1; i >= 0; i--) run(queue[i][1])\n })\n }\n updateQueue.push([update, animate])\n}\n\ntype AnyVisualElement = HTMLVisualElement | SVGVisualElement\n\n/**\n * Elements created and not yet mounted, so children inserted in the same\n * commit can find their parent.\n */\nconst pendingElements = /*@__PURE__*/ new WeakMap<Element, AnyVisualElement>()\n\nfunction findParent(element: Element) {\n for (let node = element.parentElement; node; node = node.parentElement) {\n const parent = pendingElements.get(node) || visualElementStore.get(node)\n if (parent) return parent as AnyVisualElement\n }\n return undefined\n}\n\ninterface Presence {\n /**\n * Start this element's exit, if it has one.\n */\n exit(): Promise<void> | undefined\n\n /**\n * Return to present after an exit was cancelled.\n */\n enter(): void\n}\n\n/**\n * Remix only tells the root of a removed subtree that it's leaving, so\n * the root starts the exits of the motion elements inside it, as\n * AnimatePresence does in React, and waits for all of them.\n */\nconst presences = /*@__PURE__*/ new WeakMap<Element, Presence>()\n\n/**\n * Take an exiting element out of the layout, where it is now, so the\n * elements around it move at once. Returns a function that puts it back.\n */\nfunction measurePop(node: Element) {\n if (!(node instanceof HTMLElement)) return\n const parent = node.offsetParent as HTMLElement | null\n const { offsetTop: top, offsetLeft: left } = node\n const { width, height } = getComputedStyle(node)\n const w = parseFloat(width)\n const h = parseFloat(height)\n return {\n top,\n left,\n right: (parent?.offsetWidth || 0) - w - left,\n bottom: (parent?.offsetHeight || 0) - h - top,\n width,\n height,\n }\n}\n\ntype PopBox = NonNullable<ReturnType<typeof measurePop>>\n\nfunction popLayout(\n node: Element,\n box = measurePop(node),\n anchorX: \"left\" | \"right\" = \"left\",\n anchorY: \"top\" | \"bottom\" = \"top\"\n) {\n if (!(node instanceof HTMLElement) || !box) return\n const { style } = node\n const popped: Values = {\n position: \"absolute\",\n width: box.width,\n height: box.height,\n [anchorX]: box[anchorX] + \"px\",\n [anchorY]: box[anchorY] + \"px\",\n }\n const previous: Values = {}\n for (const key in popped) previous[key] = style[key as any]\n Object.assign(style, popped)\n return () => Object.assign(style, previous)\n}\n\nconst getLayoutNode = (node: Element) =>\n acquireProjectionNode(node as HTMLElement)[0]\n\n/**\n * layoutId elements exiting within AnimatePresence, and how to finish\n * their exit. A layout snapshot resets node options, so they're marked\n * again after each one.\n */\nconst exitingLayouts = /*@__PURE__*/ new Map<Element, VoidFunction>()\n\nfunction markLayoutExit(node: Element) {\n const projection = getLayoutNode(node)\n projection.isPresent = false\n /**\n * Nodes created in this snapshot promote in document order, so an\n * exiting node can resume from the one that takes over from it.\n */\n projection.resumeFrom = undefined\n projection.setOptions({ onExitComplete: exitingLayouts.get(node) })\n return projection\n}\n\n/**\n * Layout animations: every host with `layout` or `layoutId` that is about\n * to update shares one animateLayout() for the whole document. It must\n * snapshot synchronously in `beforeUpdate`, as Remix changes the DOM\n * straight after, and finishes when the first host commits.\n */\nlet layoutPass:\n | { builder: LayoutAnimationBuilder; commit: VoidFunction }\n | undefined\n\nfunction snapshotLayout() {\n if (layoutPass) return\n flushInserts()\n\n let commit!: VoidFunction\n const committed = new Promise<void>((resolve) => {\n commit = () => {\n // A late fallback mustn't end a newer pass.\n if (layoutPass?.commit === commit) layoutPass = undefined\n resolve()\n }\n })\n\n layoutPass = {\n builder: animateLayout(document.documentElement, () => committed),\n commit,\n }\n flushLayoutSnapshots()\n exitingLayouts.forEach((_, node) => markLayoutExit(node))\n\n /**\n * If the update is abandoned, don't block the next one.\n */\n requestAnimationFrame(commit)\n}\n\n/**\n * Animate to the latest props. Then forget which children entered with\n * this render, so the next children's `delayChildren` stagger starts\n * from 0, as in React.\n */\nfunction animateChanges(visualElement: AnyVisualElement | undefined) {\n if (!visualElement) return\n visualElement.animationState?.animateChanges()\n visualElement.enteringChildren = undefined\n}\n\nlet presenceId = 0\n\nconst motionMixin = /*@__PURE__*/ createMixin<Element, [props: MotionProps]>(\n (handle, tag) => {\n const isSVG = isSVGElement(tag)\n let props: MotionProps = {}\n let element: Element | undefined\n let visualElement: AnyVisualElement | undefined\n let releaseProjection: VoidFunction | undefined\n let initialValues: Values | undefined\n let presence: PresenceContextProps | null = null\n let isExiting = false\n let isInitialBlocked: boolean | undefined\n const id = String(presenceId++)\n\n const getConfig = () =>\n handle.context.get(MotionConfig) as MotionConfigProps | undefined\n const getVariantParent = () =>\n handle.context.get(VariantProvider) as VariantContext | undefined\n const getGroup = () =>\n handle.context.get(AnimatePresence) as PresenceGroup | undefined\n const getPresenceChild = () =>\n handle.context.get(PresenceChild) as\n | PresenceChildContext\n | undefined\n\n /**\n * Inside AnimatePresence: the exit this element started.\n */\n let exitDone: Promise<void> | undefined\n let exitResolvers: VoidFunction[] = []\n let pop: VoidFunction | undefined\n let popBox: PopBox | undefined\n let restoreLayout: VoidFunction | undefined\n\n const getProps = (): MotionProps => {\n const transition = props.transition ?? getConfig()?.transition\n return transition ? { ...props, transition } : props\n }\n\n const getLayoutId = () => {\n const group = (\n handle.context.get(LayoutGroup) as LayoutGroupProps | undefined\n )?.id\n const { layoutId } = props\n return group && layoutId ? group + \"-\" + layoutId : layoutId\n }\n\n const setPresence = (\n isPresent: boolean,\n onExitComplete?: VoidFunction\n ) => {\n const custom = getPresenceChild()?.custom\n presence = {\n id,\n isPresent,\n register: () => () => {},\n onExitComplete,\n custom: custom === undefined ? props.custom : custom,\n }\n visualElement!.update(getProps() as any, presence)\n visualElement!.updateFeatures()\n }\n\n /**\n * Drag measures layout, so it needs a projection node before its\n * feature mounts, including when drag is turned on later. A\n * layoutId element joins its stack when it mounts, as in React.\n */\n const acquireProjection = (node: Element) => {\n if (!props.drag && !getLayoutId()) return\n releaseProjection ||= acquireProjectionNode(node as HTMLElement)[1]\n props.drag &&\n getLayoutNode(node).setOptions({ alwaysMeasureLayout: true })\n }\n\n /**\n * Exit within AnimatePresence: animate `exit`, and hand a layoutId\n * over to the element that replaces it, as React's exit does.\n */\n const startExit = (layoutId?: string) => {\n const current = visualElement!\n const exits: Promise<void>[] = []\n\n if (props.exit) {\n isExiting = true\n exits.push(\n new Promise<void>((resolve) => {\n exitResolvers.push(resolve)\n handle.queueTask(() => {\n if (visualElement === current && isExiting) {\n setPresence(false, resolve)\n } else resolve()\n })\n })\n )\n }\n\n const node = element!\n if (layoutId) {\n exits.push(\n new Promise<void>((resolve) => {\n exitingLayouts.set(node, () => {\n exitingLayouts.delete(node)\n resolve()\n })\n /**\n * Measure the layout now, before the DOM changes,\n * and hand over as React does before its commit.\n */\n snapshotLayout()\n const projection = markLayoutExit(node)\n /**\n * If an element replaces this one, it crossfades\n * from it and calls onExitComplete.\n */\n projection.relegate() ||\n frame.postRender(() => {\n const stack = projection.getStack()\n if (!stack || stack.lead === projection) {\n exitingLayouts.get(node)?.()\n }\n })\n })\n )\n }\n\n // In case this element didn't update in the commit.\n handle.queueTask(beforeLayout)\n if (layoutId) handle.queueTask(() => layoutPass?.commit())\n\n return Promise.all(exits).then(() => {})\n }\n\n handle.addEventListener(\"insert\", ({ node }) => {\n element = node\n loadRemixFeatures()\n\n presences.set(node, {\n exit: () => {\n if (!props.exit || !visualElement || isExiting) return\n isExiting = true\n return new Promise<void>((resolve) =>\n setPresence(false, resolve)\n )\n },\n enter: () => {\n if (!isExiting || !visualElement) return\n isExiting = false\n setPresence(true)\n },\n })\n\n queueInsert(\n () => {\n /**\n * Removed before it mounted.\n */\n if (element !== node) return\n\n const nodeProps = getProps()\n const VisualElement = isSVG\n ? SVGVisualElement\n : HTMLVisualElement\n visualElement = new VisualElement({\n parent: findParent(node),\n props: nodeProps as any,\n presenceContext: presence,\n blockInitialAnimation: isInitialBlocked,\n reducedMotionConfig: getConfig()?.reducedMotion,\n visualState: {\n latestValues: makeLatestValues(\n nodeProps,\n getVariantParent(),\n isSVG,\n isInitialBlocked\n ),\n renderState: createRenderState(),\n },\n }) as AnyVisualElement\n pendingElements.set(node, visualElement)\n },\n () => {\n pendingElements.delete(node)\n if (element !== node || !visualElement) return\n\n visualElement.mount(node as any)\n\n /**\n * The element rendered its first values. Render the\n * latest, in case they changed before it mounted.\n */\n visualElement.scheduleRenderMicrotask()\n\n acquireProjection(node)\n visualElement.updateFeatures()\n },\n () => {\n if (element === node) animateChanges(visualElement)\n }\n )\n })\n\n handle.addEventListener(\"beforeRemove\", (event) => {\n const node = element\n if (!node || isExiting || getPresenceChild()) return\n\n const leaving = [node, ...node.querySelectorAll(\"*\")]\n .map((el) => presences.get(el))\n .filter(Boolean) as Presence[]\n const exited = leaving\n .map((presence) => presence.exit())\n .filter(Boolean)\n\n if (!exited.length) return\n\n let cancel!: VoidFunction\n const done = new Promise<void>((resolve) => {\n cancel = resolve\n Promise.all(exited).then(() => resolve())\n })\n\n event.persistNode((signal) => {\n const reclaim = () => {\n leaving.forEach((presence) => presence.enter())\n cancel()\n }\n if (signal.aborted) reclaim()\n signal.addEventListener(\"abort\", reclaim)\n return done\n })\n })\n\n handle.addEventListener(\"remove\", () => {\n if (element) {\n presences.delete(element)\n // Removed by its own component mid-exit: its exits are done.\n exitingLayouts.get(element)?.()\n }\n exitResolvers.forEach((resolve) => resolve())\n exitResolvers = []\n releaseProjection?.()\n visualElement?.unmount()\n releaseProjection = visualElement = element = undefined\n presence = null\n })\n\n /**\n * After the DOM changes, before the layout animation measures it:\n * take an exiting element out of the layout.\n */\n const beforeLayout = () => {\n pop?.()\n pop = undefined\n }\n\n handle.addEventListener(\"beforeUpdate\", ({ node }) => {\n /**\n * Where this element is before the DOM changes, in case it\n * exits in this update and leaves the layout.\n */\n if (getPresenceChild()?.popLayout && !exitDone) {\n popBox = measurePop(node)\n }\n\n const hasLayout = props.layout || props.layoutId\n if (hasLayout) snapshotLayout()\n else if (!getPresenceChild()?.popLayout) return\n\n /**\n * Set the options once this render's props have arrived, after\n * the snapshot has reset them, and before the layout animation\n * starts.\n */\n queueMicrotask(() => {\n beforeLayout()\n // Removed in this update.\n if (!hasLayout || element !== node) return\n /**\n * The layout animation's node, which isn't always the\n * VisualElement's: animateLayout() can adopt the element\n * before it mounts.\n */\n getLayoutNode(node).setOptions({\n transition: getProps().transition as any,\n animationType:\n typeof props.layout === \"string\"\n ? props.layout\n : \"both\",\n layoutAnchor: props.layoutAnchor,\n crossfade: props.layoutCrossfade,\n })\n })\n })\n\n handle.addEventListener(\"commit\", () => layoutPass?.commit())\n\n return (nextProps, hostProps) => {\n props = {\n ...nextProps,\n style: (hostProps.style as any) ?? nextProps.style,\n }\n\n /**\n * Motion renders motion values passed as attributes, like\n * <motion.circle cx={cx} />, so Remix never sees them.\n */\n const motionAttrs: Values = {}\n for (const key in hostProps) {\n const value = (hostProps as Values)[key]\n if (key !== \"style\" && isMotionValue(value)) {\n ;(props as Values)[key] = value\n motionAttrs[key] = undefined\n }\n }\n\n const { layout } = props\n const layoutId = getLayoutId()\n\n const presenceChild = getPresenceChild()\n if (presenceChild && visualElement && element) {\n if (!presenceChild.isPresent) {\n if (!exitDone) {\n exitDone = startExit(layoutId)\n /**\n * The outermost motion element of the child leaves\n * the layout. Parents render before children.\n */\n if (presenceChild.popLayout && !presenceChild.popped) {\n presenceChild.popped = true\n const node = element\n const { anchorX, anchorY } = presenceChild\n const box = popBox\n pop = () =>\n (restoreLayout = popLayout(\n node,\n box,\n anchorX,\n anchorY\n ))\n }\n }\n presenceChild.exits.push(exitDone)\n } else if (exitDone) {\n exitDone = pop = undefined\n exitResolvers = []\n restoreLayout?.()\n restoreLayout = undefined\n if (isExiting) {\n isExiting = false\n setPresence(true)\n }\n if (exitingLayouts.delete(element)) {\n const projection = getLayoutNode(element)\n projection.isPresent = true\n projection.setOptions({ onExitComplete: undefined })\n projection.promote()\n }\n }\n }\n\n /**\n * A layoutId element inserted during a layout pass animates\n * from the element it replaces, with its own transition.\n */\n if (layoutId && layoutPass && !element) {\n layoutPass.builder.shared(layoutId, getProps().transition || {})\n }\n\n if (visualElement) {\n const current = visualElement\n handle.queueTask(() =>\n queueUpdate(\n () => {\n if (visualElement !== current) return\n current.update(getProps() as any, presence)\n acquireProjection(element!)\n current.updateFeatures()\n },\n () => visualElement === current && animateChanges(current)\n )\n )\n }\n\n /**\n * Render the values Motion starts from, on the server too. Keep\n * rendering the same values on later renders, so Remix's\n * per-property diff never overwrites what Motion animated.\n */\n if (!initialValues) {\n const group = getGroup()\n isInitialBlocked =\n group?.isFirstRender && group.props.initial === false\n initialValues = renderValues(\n makeLatestValues(\n getProps(),\n getVariantParent(),\n isSVG,\n isInitialBlocked\n ),\n props,\n tag,\n isSVG\n )\n }\n\n const { style: initialStyle, ...attrs } = initialValues\n const patch: Values = { ...motionAttrs, ...attrs }\n const style = { ...splitStyle(props.style, props), ...initialStyle }\n\n /**\n * As React: no ghost image, text selection or scrolling in the\n * drag direction, and tap gestures are keyboard accessible.\n */\n if (!isSVG) {\n const { drag } = props\n if (drag && props.dragListener !== false) {\n patch.draggable = false\n style.userSelect =\n style.WebkitUserSelect =\n style.WebkitTouchCallout =\n \"none\"\n style.touchAction =\n drag === true ? \"none\" : `pan-${drag === \"x\" ? \"y\" : \"x\"}`\n }\n if (\n hostProps.tabIndex === undefined &&\n (props.onTap || props.onTapStart || props.whileTap)\n ) {\n patch.tabIndex = 0\n }\n }\n if (Object.keys(style).length) patch.style = style\n if (layout) patch[\"data-layout\"] = layout === true ? \"\" : layout\n if (layoutId) patch[\"data-layout-id\"] = layoutId\n\n return createElement(handle.element, { ...hostProps, ...patch })\n }\n }\n)\n\nexport type MotionComponentProps = MotionProps & {\n children?: RemixNode | MotionValue\n [key: string]: any\n}\n\nexport type MotionComponent = (\n handle: Handle<MotionComponentProps>\n) => () => RemixNode\n\nconst motionComponents = /*@__PURE__*/ new WeakSet<MotionComponent>()\n\nfunction createMotionComponent(tag: string): MotionComponent {\n const component: MotionComponent = (handle) => {\n let text: { value: MotionValue; initial: string } | undefined\n\n return () => {\n let { children, mix, presenceKey, ...rest } = handle.props\n const motionProps: Values = {}\n const hostProps: Values = {}\n\n for (const key in rest) {\n if (key === \"style\" || !isValidMotionProp(key)) {\n hostProps[key] = rest[key]\n }\n if (isValidMotionProp(key)) motionProps[key] = rest[key]\n }\n\n /**\n * A motion value child renders its first value. Motion then\n * updates the text, so keep rendering the same text.\n */\n if (isMotionValue(children)) {\n motionProps.children = children\n if (text?.value !== children) {\n text = { value: children, initial: String(children.get()) }\n }\n children = text.initial\n }\n\n const parent = handle.context.get(VariantProvider) as\n | VariantContext\n | undefined\n\n return createElement(\n tag,\n {\n ...hostProps,\n ...(presenceKey != null && { key: presenceKey }),\n mix: [motionMixin(motionProps), mix],\n },\n createElement(\n VariantProvider,\n { value: getVariantContext(motionProps, parent) },\n children\n )\n )\n }\n }\n motionComponents.add(component)\n return component\n}\n\nconst components = /*@__PURE__*/ new Map<string, MotionComponent>()\n\ntype Motion = typeof motionMixin & {\n [Tag in\n | keyof HTMLElementTagNameMap\n | keyof SVGElementTagNameMap]: MotionComponent\n}\n\n/**\n * Animate elements with Motion in Remix 3, with the same props as React's\n * `<motion.div>`:\n *\n * ```tsx\n * <motion.ul initial=\"hidden\" animate=\"visible\" variants={list}>\n * {items.map((item) => (\n * <motion.li key={item.id} variants={item} exit={{ opacity: 0 }} />\n * ))}\n * </motion.ul>\n * ```\n *\n * `initial` is rendered on the server. `exit` keeps an element, and\n * everything inside it, in the DOM until its exit animation finishes.\n *\n * `motion(props)` is the same as a mixin for any element, as used by the\n * components.\n *\n * Experimental: Remix 3's component API is new, so this API can change\n * in a minor release.\n *\n * @public\n */\nexport const motion = /*@__PURE__*/ new Proxy(motionMixin, {\n get(target, key, receiver) {\n if (typeof key !== \"string\" || key in target) {\n return Reflect.get(target, key, receiver)\n }\n let component = components.get(key)\n if (!component) {\n component = createMotionComponent(key)\n components.set(key, component)\n }\n return component\n },\n}) as Motion\n\nconst scopeMixin = /*@__PURE__*/ createMixin<\n HTMLElement,\n [setup: ScopeSetup, options?: ScopeOptions]\n>(\n (handle) => {\n let setup: ScopeSetup = () => {}\n let scopeOptions: ScopeOptions | undefined\n let scope: MotionScope | undefined\n\n handle.addEventListener(\"insert\", ({ node }) => {\n scope = createScope(node, (s) => setup(s), scopeOptions)\n })\n\n handle.addEventListener(\"remove\", () => {\n scope?.cancel()\n scope = undefined\n })\n\n return (nextSetup, nextOptions) => {\n setup = nextSetup\n scopeOptions = nextOptions\n return handle.element\n }\n },\n { ssr: false }\n)\n\n/**\n * The `mix` form of vanilla `scopeMotion()`: run `setup` in a scope rooted\n * at this element, so selectors resolve inside it. Everything it starts is\n * cancelled, and inline styles restored, when the element is removed.\n *\n * ```tsx\n * <ul mix={scopeMotion(() => {\n * animate(\"li\", { opacity: [0, 1] }, { delay: stagger(0.05) })\n * })} />\n * ```\n *\n * @public\n */\nexport const scopeMotion = scopeMixin\n\n/**\n * Drag, or grab with Space and move with the arrow keys, to reorder a\n * list, with the same props as React's `Reorder`:\n *\n * ```tsx\n * <Reorder.Group values={items} onReorder={(next) => {\n * items = next\n * handle.update()\n * }}>\n * {items.map((item) => (\n * <Reorder.Item key={item} value={item}>{item}</Reorder.Item>\n * ))}\n * </Reorder.Group>\n * ```\n *\n * @public\n */\nexport const Reorder = /*@__PURE__*/ createReorder(motion)\n"],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