framer-motion 12.35.1 → 12.36.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/dist/cjs/client.js +1 -1
- package/dist/cjs/{feature-bundle-jADFMKLx.js → feature-bundle-BakEQtGR.js} +53 -6
- package/dist/cjs/feature-bundle-BakEQtGR.js.map +1 -0
- package/dist/cjs/index.js +78 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/m.js +7 -1
- package/dist/cjs/m.js.map +1 -1
- package/dist/dom-mini.d.ts +17 -5
- package/dist/dom.d.ts +18 -6
- package/dist/dom.js +1 -1
- package/dist/es/components/AnimatePresence/PopChild.mjs +5 -3
- package/dist/es/components/AnimatePresence/PopChild.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/index.mjs +1 -1
- package/dist/es/components/AnimatePresence/index.mjs.map +1 -1
- package/dist/es/events/event-info.mjs +1 -3
- package/dist/es/events/event-info.mjs.map +1 -1
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +2 -1
- package/dist/es/gestures/drag/VisualElementDragControls.mjs.map +1 -1
- package/dist/es/gestures/pan/PanSession.mjs +12 -0
- package/dist/es/gestures/pan/PanSession.mjs.map +1 -1
- package/dist/es/index.mjs +1 -0
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/motion/features/animation/exit.mjs +31 -1
- package/dist/es/motion/features/animation/exit.mjs.map +1 -1
- package/dist/es/render/dom/utils/filter-props.mjs +8 -1
- package/dist/es/render/dom/utils/filter-props.mjs.map +1 -1
- package/dist/es/utils/transform-rotated-parent.mjs +72 -0
- package/dist/es/utils/transform-rotated-parent.mjs.map +1 -0
- package/dist/es/value/use-spring.mjs.map +1 -1
- package/dist/framer-motion.dev.js +358 -96
- package/dist/framer-motion.js +1 -1
- package/dist/size-rollup-animate.js +1 -1
- package/dist/size-rollup-animate.js.map +1 -1
- package/dist/size-rollup-dom-animation-assets.js +1 -1
- package/dist/size-rollup-dom-animation-m.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max-assets.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/dist/size-rollup-m.js.map +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-rollup-motion.js.map +1 -1
- package/dist/size-rollup-scroll.js +1 -1
- package/dist/size-rollup-scroll.js.map +1 -1
- package/dist/types/index.d.ts +55 -10
- package/package.json +4 -4
- package/dist/cjs/feature-bundle-jADFMKLx.js.map +0 -1
package/dist/cjs/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var featureBundle = require('./feature-bundle-
|
|
5
|
+
var featureBundle = require('./feature-bundle-BakEQtGR.js');
|
|
6
6
|
require('motion-dom');
|
|
7
7
|
require('react');
|
|
8
8
|
require('react/jsx-runtime');
|
|
@@ -247,8 +247,12 @@ try {
|
|
|
247
247
|
* We attempt to import this package but require won't be defined in esm environments, in that case
|
|
248
248
|
* isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
|
|
249
249
|
* in favour of explicit injection.
|
|
250
|
+
*
|
|
251
|
+
* String concatenation prevents bundlers like webpack (e.g. Storybook)
|
|
252
|
+
* from statically resolving this optional dependency at build time.
|
|
250
253
|
*/
|
|
251
|
-
|
|
254
|
+
const emotionPkg = "@emotion/is-prop-" + "valid";
|
|
255
|
+
loadExternalIsValidProp(require(emotionPkg).default);
|
|
252
256
|
}
|
|
253
257
|
catch {
|
|
254
258
|
// We don't need to actually do anything here - the fallback is the existing `isPropValid`.
|
|
@@ -265,6 +269,8 @@ function filterProps(props, isDom, forwardMotionProps) {
|
|
|
265
269
|
*/
|
|
266
270
|
if (key === "values" && typeof props.values === "object")
|
|
267
271
|
continue;
|
|
272
|
+
if (motionDom.isMotionValue(props[key]))
|
|
273
|
+
continue;
|
|
268
274
|
if (shouldForward(key) ||
|
|
269
275
|
(forwardMotionProps === true && isValidMotionProp(key)) ||
|
|
270
276
|
(!isDom && !isValidMotionProp(key)) ||
|
|
@@ -892,6 +898,7 @@ class ExitAnimationFeature extends motionDom.Feature {
|
|
|
892
898
|
constructor() {
|
|
893
899
|
super(...arguments);
|
|
894
900
|
this.id = id++;
|
|
901
|
+
this.isExitComplete = false;
|
|
895
902
|
}
|
|
896
903
|
update() {
|
|
897
904
|
if (!this.node.presenceContext)
|
|
@@ -901,9 +908,38 @@ class ExitAnimationFeature extends motionDom.Feature {
|
|
|
901
908
|
if (!this.node.animationState || isPresent === prevIsPresent) {
|
|
902
909
|
return;
|
|
903
910
|
}
|
|
911
|
+
if (isPresent && prevIsPresent === false) {
|
|
912
|
+
/**
|
|
913
|
+
* When re-entering, if the exit animation already completed
|
|
914
|
+
* (element is at rest), reset to initial values so the enter
|
|
915
|
+
* animation replays from the correct position.
|
|
916
|
+
*/
|
|
917
|
+
if (this.isExitComplete) {
|
|
918
|
+
const { initial, custom } = this.node.getProps();
|
|
919
|
+
if (typeof initial === "string") {
|
|
920
|
+
const resolved = motionDom.resolveVariant(this.node, initial, custom);
|
|
921
|
+
if (resolved) {
|
|
922
|
+
const { transition, transitionEnd, ...target } = resolved;
|
|
923
|
+
for (const key in target) {
|
|
924
|
+
this.node
|
|
925
|
+
.getValue(key)
|
|
926
|
+
?.jump(target[key]);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
this.node.animationState.reset();
|
|
931
|
+
this.node.animationState.animateChanges();
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
this.node.animationState.setActive("exit", false);
|
|
935
|
+
}
|
|
936
|
+
this.isExitComplete = false;
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
904
939
|
const exitAnimation = this.node.animationState.setActive("exit", !isPresent);
|
|
905
940
|
if (onExitComplete && !isPresent) {
|
|
906
941
|
exitAnimation.then(() => {
|
|
942
|
+
this.isExitComplete = true;
|
|
907
943
|
onExitComplete(this.id);
|
|
908
944
|
});
|
|
909
945
|
}
|
|
@@ -937,9 +973,7 @@ function extractEventInfo(event) {
|
|
|
937
973
|
},
|
|
938
974
|
};
|
|
939
975
|
}
|
|
940
|
-
const addPointerInfo = (handler) =>
|
|
941
|
-
return (event) => motionDom.isPrimaryPointer(event) && handler(event, extractEventInfo(event));
|
|
942
|
-
};
|
|
976
|
+
const addPointerInfo = (handler) => (event) => motionDom.isPrimaryPointer(event) && handler(event, extractEventInfo(event));
|
|
943
977
|
|
|
944
978
|
function addPointerEvent(target, eventName, handler, options) {
|
|
945
979
|
return motionDom.addDomEvent(target, eventName, addPointerInfo(handler), options);
|
|
@@ -976,6 +1010,12 @@ class PanSession {
|
|
|
976
1010
|
* @internal
|
|
977
1011
|
*/
|
|
978
1012
|
this.lastMoveEventInfo = null;
|
|
1013
|
+
/**
|
|
1014
|
+
* Raw (untransformed) event info, re-transformed each frame
|
|
1015
|
+
* so transformPagePoint sees the current parent matrix.
|
|
1016
|
+
* @internal
|
|
1017
|
+
*/
|
|
1018
|
+
this.lastRawMoveEventInfo = null;
|
|
979
1019
|
/**
|
|
980
1020
|
* @internal
|
|
981
1021
|
*/
|
|
@@ -1003,6 +1043,11 @@ class PanSession {
|
|
|
1003
1043
|
this.updatePoint = () => {
|
|
1004
1044
|
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
1005
1045
|
return;
|
|
1046
|
+
// Re-transform raw point through current transformPagePoint so
|
|
1047
|
+
// animated parent transforms (e.g. rotation) are picked up each frame
|
|
1048
|
+
if (this.lastRawMoveEventInfo) {
|
|
1049
|
+
this.lastMoveEventInfo = transformPoint(this.lastRawMoveEventInfo, this.transformPagePoint);
|
|
1050
|
+
}
|
|
1006
1051
|
const info = getPanInfo(this.lastMoveEventInfo, this.history);
|
|
1007
1052
|
const isPanStarted = this.startEvent !== null;
|
|
1008
1053
|
// Only start panning if the offset is larger than 3 pixels. If we make it
|
|
@@ -1023,6 +1068,7 @@ class PanSession {
|
|
|
1023
1068
|
};
|
|
1024
1069
|
this.handlePointerMove = (event, info) => {
|
|
1025
1070
|
this.lastMoveEvent = event;
|
|
1071
|
+
this.lastRawMoveEventInfo = info;
|
|
1026
1072
|
this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint);
|
|
1027
1073
|
// Throttle mouse move event to once per frame
|
|
1028
1074
|
motionDom.frame.update(this.updatePoint, true);
|
|
@@ -1620,7 +1666,8 @@ class VisualElementDragControls {
|
|
|
1620
1666
|
return;
|
|
1621
1667
|
}
|
|
1622
1668
|
let transition = (constraints && constraints[axis]) || {};
|
|
1623
|
-
if (dragSnapToOrigin
|
|
1669
|
+
if (dragSnapToOrigin === true ||
|
|
1670
|
+
dragSnapToOrigin === axis)
|
|
1624
1671
|
transition = { min: 0, max: 0 };
|
|
1625
1672
|
/**
|
|
1626
1673
|
* Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
|
|
@@ -2375,4 +2422,4 @@ exports.useConstant = useConstant;
|
|
|
2375
2422
|
exports.useIsPresent = useIsPresent;
|
|
2376
2423
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
2377
2424
|
exports.usePresence = usePresence;
|
|
2378
|
-
//# sourceMappingURL=feature-bundle-
|
|
2425
|
+
//# sourceMappingURL=feature-bundle-BakEQtGR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-bundle-BakEQtGR.js","sources":["../../src/context/LayoutGroupContext.ts","../../src/utils/use-constant.ts","../../src/utils/is-browser.ts","../../src/utils/use-isomorphic-effect.ts","../../src/context/PresenceContext.ts","../../src/context/MotionConfigContext.tsx","../../src/components/AnimatePresence/use-presence.ts","../../src/context/LazyContext.ts","../../src/motion/features/definitions.ts","../../src/motion/features/load-features.ts","../../src/motion/utils/valid-prop.ts","../../src/render/dom/utils/filter-props.ts","../../src/render/svg/lowercase-elements.ts","../../src/render/dom/utils/is-svg-component.ts","../../src/render/dom/create-visual-element.ts","../../src/context/MotionContext/index.ts","../../src/context/MotionContext/utils.ts","../../src/context/MotionContext/create.ts","../../src/render/html/utils/create-render-state.ts","../../src/render/html/use-props.ts","../../src/render/svg/utils/create-render-state.ts","../../src/render/svg/use-props.ts","../../src/render/dom/use-render.ts","../../src/motion/utils/use-visual-state.ts","../../src/render/html/use-html-visual-state.ts","../../src/render/svg/use-svg-visual-state.ts","../../src/motion/utils/symbol.ts","../../src/motion/utils/use-motion-ref.ts","../../src/context/SwitchLayoutGroupContext.ts","../../src/utils/is-ref-object.ts","../../src/motion/utils/use-visual-element.ts","../../src/motion/index.tsx","../../src/motion/features/animation/index.ts","../../src/motion/features/animation/exit.ts","../../src/motion/features/animations.ts","../../src/events/event-info.ts","../../src/events/add-pointer-event.ts","../../src/utils/get-context-window.ts","../../src/utils/distance.ts","../../src/gestures/pan/PanSession.ts","../../src/gestures/drag/utils/constraints.ts","../../src/gestures/drag/VisualElementDragControls.ts","../../src/gestures/drag/index.ts","../../src/gestures/pan/index.ts","../../src/motion/features/layout/MeasureLayout.tsx","../../src/motion/features/drag.ts","../../src/gestures/hover.ts","../../src/gestures/focus.ts","../../src/gestures/press.ts","../../src/motion/features/viewport/observers.ts","../../src/motion/features/viewport/index.ts","../../src/motion/features/gestures.ts","../../src/motion/features/layout.ts","../../src/render/components/motion/feature-bundle.ts"],"sourcesContent":["\"use client\"\n\nimport { createContext } from \"react\"\nimport type { NodeGroup } from \"motion-dom\"\n\nexport interface LayoutGroupContextProps {\n id?: string\n group?: NodeGroup\n forceRender?: VoidFunction\n}\n\nexport const LayoutGroupContext = createContext<LayoutGroupContextProps>({})\n","\"use client\"\n\nimport { useRef } from \"react\"\n\ntype Init<T> = () => T\n\n/**\n * Creates a constant value over the lifecycle of a component.\n *\n * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer\n * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`\n * you can ensure that initialisers don't execute twice or more.\n */\nexport function useConstant<T>(init: Init<T>) {\n const ref = useRef<T | null>(null)\n\n if (ref.current === null) {\n ref.current = init()\n }\n\n return ref.current\n}\n","export const isBrowser = typeof window !== \"undefined\"\n","\"use client\"\n\nimport { useEffect, useLayoutEffect } from \"react\"\nimport { isBrowser } from \"./is-browser\"\n\nexport const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect\n","\"use client\"\n\nimport { createContext } from \"react\"\nimport type { PresenceContextProps } from \"motion-dom\"\n\nexport type { PresenceContextProps }\n\n/**\n * @public\n */\nexport const PresenceContext =\n /* @__PURE__ */ createContext<PresenceContextProps | null>(null)\n","\"use client\"\n\nimport type { Transition } from \"motion-dom\"\nimport { TransformPoint } from \"motion-utils\"\nimport { createContext } from \"react\"\n\nexport type ReducedMotionConfig = \"always\" | \"never\" | \"user\"\n\n/**\n * @public\n */\nexport interface MotionConfigContext {\n /**\n * Internal, exported only for usage in Framer\n */\n transformPagePoint: TransformPoint\n\n /**\n * Internal. Determines whether this is a static context ie the Framer canvas. If so,\n * it'll disable all dynamic functionality.\n */\n isStatic: boolean\n\n /**\n * Defines a new default transition for the entire tree.\n *\n * @public\n */\n transition?: Transition\n\n /**\n * If true, will respect the device prefersReducedMotion setting by switching\n * transform animations off.\n *\n * @public\n */\n reducedMotion?: ReducedMotionConfig\n\n /**\n * A custom `nonce` attribute used when wanting to enforce a Content Security Policy (CSP).\n * For more details see:\n * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles\n *\n * @public\n */\n nonce?: string\n\n /**\n * If true, all animations will be skipped and values will be set instantly.\n * Useful for E2E tests and visual regression testing.\n *\n * @public\n */\n skipAnimations?: boolean\n\n}\n\n/**\n * @public\n */\nexport const MotionConfigContext = createContext<MotionConfigContext>({\n transformPagePoint: (p) => p,\n isStatic: false,\n reducedMotion: \"never\",\n})\n","\"use client\"\n\nimport { useCallback, useContext, useEffect, useId } from \"react\"\nimport {\n PresenceContext,\n PresenceContextProps,\n} from \"../../context/PresenceContext\"\n\nexport type SafeToRemove = () => void\n\ntype AlwaysPresent = [true, null]\n\ntype Present = [true]\n\ntype NotPresent = [false, SafeToRemove]\n\n/**\n * When a component is the child of `AnimatePresence`, it can use `usePresence`\n * to access information about whether it's still present in the React tree.\n *\n * ```jsx\n * import { usePresence } from \"framer-motion\"\n *\n * export const Component = () => {\n * const [isPresent, safeToRemove] = usePresence()\n *\n * useEffect(() => {\n * !isPresent && setTimeout(safeToRemove, 1000)\n * }, [isPresent])\n *\n * return <div />\n * }\n * ```\n *\n * If `isPresent` is `false`, it means that a component has been removed from the tree,\n * but `AnimatePresence` won't really remove it until `safeToRemove` has been called.\n *\n * @public\n */\nexport function usePresence(\n subscribe: boolean = true\n): AlwaysPresent | Present | NotPresent {\n const context = useContext(PresenceContext)\n\n if (context === null) return [true, null]\n\n const { isPresent, onExitComplete, register } = context\n\n // It's safe to call the following hooks conditionally (after an early return) because the context will always\n // either be null or non-null for the lifespan of the component.\n\n const id = useId()\n useEffect(() => {\n if (subscribe) {\n return register(id)\n }\n }, [subscribe])\n\n const safeToRemove = useCallback(\n () => subscribe && onExitComplete && onExitComplete(id),\n [id, onExitComplete, subscribe]\n )\n\n return !isPresent && onExitComplete ? [false, safeToRemove] : [true]\n}\n\n/**\n * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.\n * There is no `safeToRemove` function.\n *\n * ```jsx\n * import { useIsPresent } from \"framer-motion\"\n *\n * export const Component = () => {\n * const isPresent = useIsPresent()\n *\n * useEffect(() => {\n * !isPresent && console.log(\"I've been removed!\")\n * }, [isPresent])\n *\n * return <div />\n * }\n * ```\n *\n * @public\n */\nexport function useIsPresent() {\n return isPresent(useContext(PresenceContext))\n}\n\nexport function isPresent(context: PresenceContextProps | null) {\n return context === null ? true : context.isPresent\n}\n","\"use client\"\n\nimport { createContext } from \"react\"\nimport { CreateVisualElement } from \"../render/types\"\n\nexport interface LazyContextProps {\n renderer?: CreateVisualElement\n strict: boolean\n}\n\nexport const LazyContext = createContext<LazyContextProps>({ strict: false })\n","import { getFeatureDefinitions, setFeatureDefinitions } from \"motion-dom\"\nimport { MotionProps } from \"../types\"\nimport { FeatureDefinitions } from \"./types\"\n\nconst featureProps = {\n animation: [\n \"animate\",\n \"variants\",\n \"whileHover\",\n \"whileTap\",\n \"exit\",\n \"whileInView\",\n \"whileFocus\",\n \"whileDrag\",\n ],\n exit: [\"exit\"],\n drag: [\"drag\", \"dragControls\"],\n focus: [\"whileFocus\"],\n hover: [\"whileHover\", \"onHoverStart\", \"onHoverEnd\"],\n tap: [\"whileTap\", \"onTap\", \"onTapStart\", \"onTapCancel\"],\n pan: [\"onPan\", \"onPanStart\", \"onPanSessionStart\", \"onPanEnd\"],\n inView: [\"whileInView\", \"onViewportEnter\", \"onViewportLeave\"],\n layout: [\"layout\", \"layoutId\"],\n}\n\nlet isInitialized = false\n\n/**\n * Initialize feature definitions with isEnabled checks.\n * This must be called before any motion components are rendered.\n */\nexport function initFeatureDefinitions() {\n if (isInitialized) return\n\n const initialFeatureDefinitions: Partial<FeatureDefinitions> = {}\n\n for (const key in featureProps) {\n initialFeatureDefinitions[\n key as keyof typeof initialFeatureDefinitions\n ] = {\n isEnabled: (props: MotionProps) =>\n featureProps[key as keyof typeof featureProps].some(\n (name: string) => !!props[name as keyof typeof props]\n ),\n }\n }\n\n setFeatureDefinitions(initialFeatureDefinitions)\n isInitialized = true\n}\n\n/**\n * Get the current feature definitions, initializing if needed.\n */\nexport function getInitializedFeatureDefinitions(): Partial<FeatureDefinitions> {\n initFeatureDefinitions()\n return getFeatureDefinitions()\n}\n","import { setFeatureDefinitions } from \"motion-dom\"\nimport { getInitializedFeatureDefinitions } from \"./definitions\"\nimport { FeaturePackages } from \"./types\"\n\nexport function loadFeatures(features: FeaturePackages) {\n const featureDefinitions = getInitializedFeatureDefinitions()\n\n for (const key in features) {\n featureDefinitions[key as keyof typeof featureDefinitions] = {\n ...featureDefinitions[key as keyof typeof featureDefinitions],\n ...features[key as keyof typeof features],\n } as any\n }\n\n setFeatureDefinitions(featureDefinitions)\n}\n","import { MotionProps } from \"../types\"\n\n/**\n * A list of all valid MotionProps.\n *\n * @privateRemarks\n * This doesn't throw if a `MotionProp` name is missing - it should.\n */\nconst validMotionProps = new Set<keyof MotionProps>([\n \"animate\",\n \"exit\",\n \"variants\",\n \"initial\",\n \"style\",\n \"values\",\n \"variants\",\n \"transition\",\n \"transformTemplate\",\n \"custom\",\n \"inherit\",\n \"onBeforeLayoutMeasure\",\n \"onAnimationStart\",\n \"onAnimationComplete\",\n \"onUpdate\",\n \"onDragStart\",\n \"onDrag\",\n \"onDragEnd\",\n \"onMeasureDragConstraints\",\n \"onDirectionLock\",\n \"onDragTransitionEnd\",\n \"_dragX\",\n \"_dragY\",\n \"onHoverStart\",\n \"onHoverEnd\",\n \"onViewportEnter\",\n \"onViewportLeave\",\n \"globalTapTarget\",\n \"propagate\",\n \"ignoreStrict\",\n \"viewport\",\n])\n\n/**\n * Check whether a prop name is a valid `MotionProp` key.\n *\n * @param key - Name of the property to check\n * @returns `true` is key is a valid `MotionProp`.\n *\n * @public\n */\nexport function isValidMotionProp(key: string) {\n return (\n key.startsWith(\"while\") ||\n (key.startsWith(\"drag\") && key !== \"draggable\") ||\n key.startsWith(\"layout\") ||\n key.startsWith(\"onTap\") ||\n key.startsWith(\"onPan\") ||\n key.startsWith(\"onLayout\") ||\n validMotionProps.has(key as keyof MotionProps)\n )\n}\n","import { isMotionValue } from \"motion-dom\"\nimport type { MotionProps } from \"../../../motion/types\"\nimport { isValidMotionProp } from \"../../../motion/utils/valid-prop\"\n\nlet shouldForward = (key: string) => !isValidMotionProp(key)\n\nexport type IsValidProp = (key: string) => boolean\n\nexport function loadExternalIsValidProp(isValidProp?: IsValidProp) {\n if (typeof isValidProp !== \"function\") return\n\n // Explicitly filter our events\n shouldForward = (key: string) =>\n key.startsWith(\"on\") ? !isValidMotionProp(key) : isValidProp(key)\n}\n\n/**\n * Emotion and Styled Components both allow users to pass through arbitrary props to their components\n * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which\n * of these should be passed to the underlying DOM node.\n *\n * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props\n * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props\n * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of\n * `@emotion/is-prop-valid`, however to fix this problem we need to use it.\n *\n * By making it an optionalDependency we can offer this functionality only in the situations where it's\n * actually required.\n */\ntry {\n /**\n * We attempt to import this package but require won't be defined in esm environments, in that case\n * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed\n * in favour of explicit injection.\n *\n * String concatenation prevents bundlers like webpack (e.g. Storybook)\n * from statically resolving this optional dependency at build time.\n */\n const emotionPkg = \"@emotion/is-prop-\" + \"valid\"\n loadExternalIsValidProp(require(emotionPkg).default)\n} catch {\n // We don't need to actually do anything here - the fallback is the existing `isPropValid`.\n}\n\nexport function filterProps(\n props: MotionProps,\n isDom: boolean,\n forwardMotionProps: boolean\n) {\n const filteredProps: MotionProps = {}\n\n for (const key in props) {\n /**\n * values is considered a valid prop by Emotion, so if it's present\n * this will be rendered out to the DOM unless explicitly filtered.\n *\n * We check the type as it could be used with the `feColorMatrix`\n * element, which we support.\n */\n if (key === \"values\" && typeof props.values === \"object\") continue\n\n if (isMotionValue(props[key as keyof typeof props])) continue\n\n if (\n shouldForward(key) ||\n (forwardMotionProps === true && isValidMotionProp(key)) ||\n (!isDom && !isValidMotionProp(key)) ||\n // If trying to use native HTML drag events, forward drag listeners\n (props[\"draggable\" as keyof MotionProps] &&\n key.startsWith(\"onDrag\"))\n ) {\n filteredProps[key as keyof MotionProps] =\n props[key as keyof MotionProps]\n }\n }\n\n return filteredProps\n}\n","/**\n * We keep these listed separately as we use the lowercase tag names as part\n * of the runtime bundle to detect SVG components\n */\nexport const lowercaseSVGElements = [\n \"animate\",\n \"circle\",\n \"defs\",\n \"desc\",\n \"ellipse\",\n \"g\",\n \"image\",\n \"line\",\n \"filter\",\n \"marker\",\n \"mask\",\n \"metadata\",\n \"path\",\n \"pattern\",\n \"polygon\",\n \"polyline\",\n \"rect\",\n \"stop\",\n \"switch\",\n \"symbol\",\n \"svg\",\n \"text\",\n \"tspan\",\n \"use\",\n \"view\",\n]\n","import * as React from \"react\"\nimport { lowercaseSVGElements } from \"../../svg/lowercase-elements\"\n\nexport function isSVGComponent(Component: string | React.ComponentType<any>) {\n if (\n /**\n * If it's not a string, it's a custom React component. Currently we only support\n * HTML custom React components.\n */\n typeof Component !== \"string\" ||\n /**\n * If it contains a dash, the element is a custom HTML webcomponent.\n */\n Component.includes(\"-\")\n ) {\n return false\n } else if (\n /**\n * If it's in our list of lowercase SVG tags, it's an SVG component\n */\n lowercaseSVGElements.indexOf(Component) > -1 ||\n /**\n * If it contains a capital letter, it's an SVG component\n */\n /[A-Z]/u.test(Component)\n ) {\n return true\n }\n\n return false\n}\n","import { HTMLVisualElement, SVGVisualElement } from \"motion-dom\"\nimport { ComponentType, Fragment } from \"react\"\nimport { CreateVisualElement, VisualElementOptions } from \"../types\"\nimport { isSVGComponent } from \"./utils/is-svg-component\"\n\nexport const createDomVisualElement: CreateVisualElement = (\n Component: string | ComponentType<React.PropsWithChildren<unknown>>,\n options: VisualElementOptions<HTMLElement | SVGElement>\n) => {\n /**\n * Use explicit isSVG override if provided, otherwise auto-detect\n */\n const isSVG = options.isSVG ?? isSVGComponent(Component)\n\n return isSVG\n ? new SVGVisualElement(options)\n : new HTMLVisualElement(options, {\n allowProjection: Component !== Fragment,\n })\n}\n","\"use client\"\n\nimport type { VisualElement } from \"motion-dom\"\nimport { createContext } from \"react\"\n\nexport interface MotionContextProps<Instance = unknown> {\n visualElement?: VisualElement<Instance>\n initial?: false | string | string[]\n animate?: string | string[]\n}\n\nexport const MotionContext = /* @__PURE__ */ createContext<MotionContextProps>(\n {}\n)\n","import { isControllingVariants, isVariantLabel } from \"motion-dom\"\nimport type { MotionContextProps } from \".\"\nimport { MotionProps } from \"../../motion/types\"\n\nexport function getCurrentTreeVariants(\n props: MotionProps,\n context: MotionContextProps\n): MotionContextProps {\n if (isControllingVariants(props)) {\n const { initial, animate } = props\n return {\n initial:\n initial === false || isVariantLabel(initial)\n ? (initial as any)\n : undefined,\n animate: isVariantLabel(animate) ? animate : undefined,\n }\n }\n return props.inherit !== false ? context : {}\n}\n","\"use client\"\n\nimport { useContext, useMemo } from \"react\"\nimport { MotionContext, type MotionContextProps } from \".\"\nimport { MotionProps } from \"../../motion/types\"\nimport { getCurrentTreeVariants } from \"./utils\"\n\nexport function useCreateMotionContext<Instance>(\n props: MotionProps\n): MotionContextProps<Instance> {\n const { initial, animate } = getCurrentTreeVariants(\n props,\n useContext(MotionContext)\n )\n\n return useMemo(\n () => ({ initial, animate }),\n [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]\n )\n}\n\nfunction variantLabelsAsDependency(\n prop: undefined | string | string[] | boolean\n) {\n return Array.isArray(prop) ? prop.join(\" \") : prop\n}\n","import { HTMLRenderState } from \"../types\"\n\nexport const createHtmlRenderState = (): HTMLRenderState => ({\n style: {},\n transform: {},\n transformOrigin: {},\n vars: {},\n})\n","\"use client\"\n\nimport { AnyResolvedKeyframe, buildHTMLStyles, isForcedMotionValue, isMotionValue, MotionValue } from \"motion-dom\"\nimport { HTMLProps, useMemo } from \"react\"\nimport { MotionProps } from \"../../motion/types\"\nimport { ResolvedValues } from \"../types\"\nimport { createHtmlRenderState } from \"./utils/create-render-state\"\n\nexport function copyRawValuesOnly(\n target: ResolvedValues,\n source: { [key: string]: AnyResolvedKeyframe | MotionValue },\n props: MotionProps\n) {\n for (const key in source) {\n if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {\n target[key] = source[key] as AnyResolvedKeyframe\n }\n }\n}\n\nfunction useInitialMotionValues(\n { transformTemplate }: MotionProps,\n visualState: ResolvedValues\n) {\n return useMemo(() => {\n const state = createHtmlRenderState()\n\n buildHTMLStyles(state, visualState, transformTemplate)\n\n return Object.assign({}, state.vars, state.style)\n }, [visualState])\n}\n\nfunction useStyle(\n props: MotionProps,\n visualState: ResolvedValues\n): ResolvedValues {\n const styleProp = props.style || {}\n const style = {}\n\n /**\n * Copy non-Motion Values straight into style\n */\n copyRawValuesOnly(style, styleProp as any, props)\n\n Object.assign(style, useInitialMotionValues(props, visualState))\n\n return style\n}\n\nexport function useHTMLProps(\n props: MotionProps & HTMLProps<HTMLElement>,\n visualState: ResolvedValues\n) {\n // The `any` isn't ideal but it is the type of createElement props argument\n const htmlProps: any = {}\n const style = useStyle(props, visualState)\n\n if (props.drag && props.dragListener !== false) {\n // Disable the ghost element when a user drags\n htmlProps.draggable = false\n\n // Disable text selection\n style.userSelect =\n style.WebkitUserSelect =\n style.WebkitTouchCallout =\n \"none\"\n\n // Disable scrolling on the draggable direction\n style.touchAction =\n props.drag === true\n ? \"none\"\n : `pan-${props.drag === \"x\" ? \"y\" : \"x\"}`\n }\n\n if (\n props.tabIndex === undefined &&\n (props.onTap || props.onTapStart || props.whileTap)\n ) {\n htmlProps.tabIndex = 0\n }\n\n htmlProps.style = style\n\n return htmlProps\n}\n","import { createHtmlRenderState } from \"../../html/utils/create-render-state\"\nimport { SVGRenderState } from \"../types\"\n\nexport const createSvgRenderState = (): SVGRenderState => ({\n ...createHtmlRenderState(),\n attrs: {},\n})\n","\"use client\"\n\nimport { buildSVGAttrs, isSVGTag } from \"motion-dom\"\nimport { useMemo } from \"react\"\nimport { MotionProps } from \"../../motion/types\"\nimport { copyRawValuesOnly } from \"../html/use-props\"\nimport { ResolvedValues } from \"../types\"\nimport { createSvgRenderState } from \"./utils/create-render-state\"\n\nexport function useSVGProps(\n props: MotionProps,\n visualState: ResolvedValues,\n _isStatic: boolean,\n Component: string | React.ComponentType<React.PropsWithChildren<unknown>>\n) {\n const visualProps = useMemo(() => {\n const state = createSvgRenderState()\n\n buildSVGAttrs(\n state,\n visualState,\n isSVGTag(Component),\n props.transformTemplate,\n props.style\n )\n\n return {\n ...state.attrs,\n style: { ...state.style },\n }\n }, [visualState])\n\n if (props.style) {\n const rawStyles = {}\n copyRawValuesOnly(rawStyles, props.style as any, props)\n visualProps.style = { ...rawStyles, ...visualProps.style }\n }\n\n return visualProps\n}\n","\"use client\"\n\nimport { isMotionValue } from \"motion-dom\"\nimport { Fragment, createElement, useMemo } from \"react\"\nimport { MotionProps } from \"../../motion/types\"\nimport { VisualState } from \"../../motion/utils/use-visual-state\"\nimport { HTMLRenderState } from \"../html/types\"\nimport { useHTMLProps } from \"../html/use-props\"\nimport { SVGRenderState } from \"../svg/types\"\nimport { useSVGProps } from \"../svg/use-props\"\nimport { DOMMotionComponents } from \"./types\"\nimport { filterProps } from \"./utils/filter-props\"\nimport { isSVGComponent } from \"./utils/is-svg-component\"\n\nexport function useRender<\n Props = {},\n TagName extends keyof DOMMotionComponents | string = \"div\"\n>(\n Component: TagName | string | React.ComponentType<Props>,\n props: MotionProps,\n ref: React.Ref<HTMLElement | SVGElement>,\n {\n latestValues,\n }: VisualState<HTMLElement | SVGElement, HTMLRenderState | SVGRenderState>,\n isStatic: boolean,\n forwardMotionProps: boolean = false,\n isSVG?: boolean\n) {\n const useVisualProps =\n (isSVG ?? isSVGComponent(Component)) ? useSVGProps : useHTMLProps\n\n const visualProps = useVisualProps(\n props as any,\n latestValues,\n isStatic,\n Component as any\n )\n const filteredProps = filterProps(\n props,\n typeof Component === \"string\",\n forwardMotionProps\n )\n const elementProps =\n Component !== Fragment ? { ...filteredProps, ...visualProps, ref } : {}\n\n /**\n * If component has been handed a motion value as its child,\n * memoise its initial value and render that. Subsequent updates\n * will be handled by the onChange handler\n */\n const { children } = props\n const renderedChildren = useMemo(\n () => (isMotionValue(children) ? children.get() : children),\n [children]\n )\n\n return createElement<any>(Component, {\n ...elementProps,\n children: renderedChildren,\n })\n}\n","\"use client\"\n\nimport {\n AnyResolvedKeyframe,\n isAnimationControls,\n isControllingVariants as checkIsControllingVariants,\n isVariantNode as checkIsVariantNode,\n ResolvedValues,\n resolveVariantFromProps,\n} from \"motion-dom\"\nimport { useContext } from \"react\"\nimport { MotionContext, MotionContextProps } from \"../../context/MotionContext\"\nimport {\n PresenceContext,\n type PresenceContextProps,\n} from \"../../context/PresenceContext\"\nimport { ScrapeMotionValuesFromProps } from \"../../render/types\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport { resolveMotionValue } from \"motion-dom\"\nimport { MotionProps } from \"../types\"\n\nexport interface VisualState<Instance, RenderState> {\n renderState: RenderState\n latestValues: ResolvedValues\n onMount?: (instance: Instance) => void\n}\n\nexport type UseVisualState<Instance, RenderState> = (\n props: MotionProps,\n isStatic: boolean\n) => VisualState<Instance, RenderState>\n\nexport interface UseVisualStateConfig<RenderState> {\n scrapeMotionValuesFromProps: ScrapeMotionValuesFromProps\n createRenderState: () => RenderState\n}\n\nfunction makeState<I, RS>(\n {\n scrapeMotionValuesFromProps,\n createRenderState,\n }: UseVisualStateConfig<RS>,\n props: MotionProps,\n context: MotionContextProps,\n presenceContext: PresenceContextProps | null\n) {\n const state: VisualState<I, RS> = {\n latestValues: makeLatestValues(\n props,\n context,\n presenceContext,\n scrapeMotionValuesFromProps\n ),\n renderState: createRenderState(),\n }\n\n return state\n}\n\nfunction makeLatestValues(\n props: MotionProps,\n context: MotionContextProps,\n presenceContext: PresenceContextProps | null,\n scrapeMotionValues: ScrapeMotionValuesFromProps\n) {\n const values: ResolvedValues = {}\n\n const motionValues = scrapeMotionValues(props, {})\n for (const key in motionValues) {\n values[key] = resolveMotionValue(motionValues[key])\n }\n\n let { initial, animate } = props\n const isControllingVariants = checkIsControllingVariants(props)\n const isVariantNode = checkIsVariantNode(props)\n\n if (\n context &&\n isVariantNode &&\n !isControllingVariants &&\n props.inherit !== false\n ) {\n if (initial === undefined) initial = context.initial\n if (animate === undefined) animate = context.animate\n }\n\n let isInitialAnimationBlocked = presenceContext\n ? presenceContext.initial === false\n : false\n isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false\n\n const variantToSet = isInitialAnimationBlocked ? animate : initial\n\n if (\n variantToSet &&\n typeof variantToSet !== \"boolean\" &&\n !isAnimationControls(variantToSet)\n ) {\n const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet]\n for (let i = 0; i < list.length; i++) {\n const resolved = resolveVariantFromProps(props, list[i] as any)\n if (resolved) {\n const { transitionEnd, transition, ...target } = resolved\n for (const key in target) {\n let valueTarget = target[key as keyof typeof target]\n\n if (Array.isArray(valueTarget)) {\n /**\n * Take final keyframe if the initial animation is blocked because\n * we want to initialise at the end of that blocked animation.\n */\n const index = isInitialAnimationBlocked\n ? valueTarget.length - 1\n : 0\n valueTarget = valueTarget[index] as any\n }\n\n if (valueTarget !== null) {\n values[key] = valueTarget as AnyResolvedKeyframe\n }\n }\n for (const key in transitionEnd) {\n values[key] = transitionEnd[\n key as keyof typeof transitionEnd\n ] as AnyResolvedKeyframe\n }\n }\n }\n }\n\n return values\n}\n\nexport const makeUseVisualState =\n <I, RS>(config: UseVisualStateConfig<RS>): UseVisualState<I, RS> =>\n (props: MotionProps, isStatic: boolean): VisualState<I, RS> => {\n const context = useContext(MotionContext)\n const presenceContext = useContext(PresenceContext)\n const make = () => makeState(config, props, context, presenceContext)\n\n return isStatic ? make() : useConstant(make)\n }\n","\"use client\"\n\nimport { scrapeHTMLMotionValuesFromProps } from \"motion-dom\"\nimport { makeUseVisualState } from \"../../motion/utils/use-visual-state\"\nimport { createHtmlRenderState } from \"./utils/create-render-state\"\n\nexport const useHTMLVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeHTMLMotionValuesFromProps,\n createRenderState: createHtmlRenderState,\n})\n","\"use client\"\n\nimport { scrapeSVGMotionValuesFromProps } from \"motion-dom\"\nimport { makeUseVisualState } from \"../../motion/utils/use-visual-state\"\nimport { createSvgRenderState } from \"./utils/create-render-state\"\n\nexport const useSVGVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeSVGMotionValuesFromProps,\n createRenderState: createSvgRenderState,\n})\n","export const motionComponentSymbol = Symbol.for(\"motionComponentSymbol\")\n","\"use client\"\n\nimport type { VisualElement } from \"motion-dom\"\nimport * as React from \"react\"\nimport { useCallback, useInsertionEffect, useRef } from \"react\"\nimport { VisualState } from \"./use-visual-state\"\n\n/**\n * Creates a ref function that, when called, hydrates the provided\n * external ref and VisualElement.\n */\nexport function useMotionRef<Instance, RenderState>(\n visualState: VisualState<Instance, RenderState>,\n visualElement?: VisualElement<Instance> | null,\n externalRef?: React.Ref<Instance>\n): React.Ref<Instance> {\n /**\n * Store externalRef in a ref to avoid including it in the useCallback\n * dependency array. Including externalRef in dependencies causes issues\n * with libraries like Radix UI that create new callback refs on each render\n * when using asChild - this would cause the callback to be recreated,\n * triggering element remounts and breaking AnimatePresence exit animations.\n */\n const externalRefContainer = useRef(externalRef)\n useInsertionEffect(() => {\n externalRefContainer.current = externalRef\n })\n\n // Store cleanup function returned by callback refs (React 19 feature)\n const refCleanup = useRef<(() => void) | null>(null)\n\n return useCallback(\n (instance: Instance) => {\n if (instance) {\n visualState.onMount?.(instance)\n }\n\n const ref = externalRefContainer.current\n if (typeof ref === \"function\") {\n if (instance) {\n const cleanup = ref(instance)\n if (typeof cleanup === \"function\") {\n refCleanup.current = cleanup\n }\n } else if (refCleanup.current) {\n refCleanup.current()\n refCleanup.current = null\n } else {\n ref(instance)\n }\n } else if (ref) {\n ;(ref as React.MutableRefObject<Instance>).current = instance\n }\n\n if (visualElement) {\n instance ? visualElement.mount(instance) : visualElement.unmount()\n }\n },\n [visualElement]\n )\n}\n","\"use client\"\n\nimport type { Transition, IProjectionNode } from \"motion-dom\"\nimport { createContext } from \"react\"\n\nexport interface SwitchLayoutGroup {\n register?: (member: IProjectionNode) => void\n deregister?: (member: IProjectionNode) => void\n}\n\nexport type SwitchLayoutGroupContext = SwitchLayoutGroup &\n InitialPromotionConfig\n\nexport type InitialPromotionConfig = {\n /**\n * The initial transition to use when the elements in this group mount (and automatically promoted).\n * Subsequent updates should provide a transition in the promote method.\n */\n transition?: Transition\n /**\n * If the follow tree should preserve its opacity when the lead is promoted on mount\n */\n shouldPreserveFollowOpacity?: (member: IProjectionNode) => boolean\n}\n\n/**\n * Internal, exported only for usage in Framer\n */\nexport const SwitchLayoutGroupContext = createContext<SwitchLayoutGroupContext>(\n {}\n)\n","import { MutableRefObject } from \"./safe-react-types\"\n\nexport function isRefObject<E = any>(ref: any): ref is MutableRefObject<E> {\n return (\n ref &&\n typeof ref === \"object\" &&\n Object.prototype.hasOwnProperty.call(ref, \"current\")\n )\n}\n","\"use client\"\n\nimport {\n optimizedAppearDataAttribute,\n type HTMLRenderState,\n type SVGRenderState,\n type VisualElement,\n} from \"motion-dom\"\nimport * as React from \"react\"\nimport { useContext, useEffect, useInsertionEffect, useRef } from \"react\"\nimport { LazyContext } from \"../../context/LazyContext\"\nimport { MotionConfigContext } from \"../../context/MotionConfigContext\"\nimport { MotionContext } from \"../../context/MotionContext\"\nimport { PresenceContext } from \"../../context/PresenceContext\"\nimport {\n InitialPromotionConfig,\n SwitchLayoutGroupContext,\n} from \"../../context/SwitchLayoutGroupContext\"\nimport { MotionProps } from \"../../motion/types\"\nimport type { IProjectionNode } from \"motion-dom\"\nimport { DOMMotionComponents } from \"../../render/dom/types\"\nimport { CreateVisualElement } from \"../../render/types\"\nimport { isRefObject } from \"../../utils/is-ref-object\"\nimport { useIsomorphicLayoutEffect } from \"../../utils/use-isomorphic-effect\"\nimport { VisualState } from \"./use-visual-state\"\n\nexport function useVisualElement<\n Props,\n TagName extends keyof DOMMotionComponents | string\n>(\n Component: TagName | string | React.ComponentType<Props>,\n visualState:\n | VisualState<SVGElement, SVGRenderState>\n | VisualState<HTMLElement, HTMLRenderState>,\n props: MotionProps & Partial<MotionConfigContext>,\n createVisualElement?: CreateVisualElement<Props, TagName>,\n ProjectionNodeConstructor?: any,\n isSVG?: boolean\n): VisualElement<HTMLElement | SVGElement> | undefined {\n const { visualElement: parent } = useContext(MotionContext)\n const lazyContext = useContext(LazyContext)\n const presenceContext = useContext(PresenceContext)\n const motionConfig = useContext(MotionConfigContext)\n const reducedMotionConfig = motionConfig.reducedMotion\n const skipAnimations = motionConfig.skipAnimations\n\n const visualElementRef = useRef<VisualElement<\n HTMLElement | SVGElement\n > | null>(null)\n\n /**\n * Track whether the component has been through React's commit phase.\n * Used to detect when LazyMotion features load after the component has mounted.\n */\n const hasMountedOnce = useRef(false)\n\n /**\n * If we haven't preloaded a renderer, check to see if we have one lazy-loaded\n */\n createVisualElement =\n createVisualElement ||\n (lazyContext.renderer as CreateVisualElement<Props, TagName>)\n\n if (!visualElementRef.current && createVisualElement) {\n visualElementRef.current = createVisualElement(Component, {\n visualState,\n parent,\n props,\n presenceContext,\n blockInitialAnimation: presenceContext\n ? presenceContext.initial === false\n : false,\n reducedMotionConfig,\n skipAnimations,\n isSVG,\n })\n\n /**\n * If the component has already mounted before features loaded (e.g. via\n * LazyMotion with async feature loading), we need to force the initial\n * animation to run. Otherwise state changes that occurred before features\n * loaded will be lost and the element will snap to its final state.\n */\n if (hasMountedOnce.current && visualElementRef.current) {\n visualElementRef.current.manuallyAnimateOnMount = true\n }\n }\n\n const visualElement = visualElementRef.current\n\n /**\n * Load Motion gesture and animation features. These are rendered as renderless\n * components so each feature can optionally make use of React lifecycle methods.\n */\n const initialLayoutGroupConfig = useContext(SwitchLayoutGroupContext)\n\n if (\n visualElement &&\n !visualElement.projection &&\n ProjectionNodeConstructor &&\n (visualElement.type === \"html\" || visualElement.type === \"svg\")\n ) {\n createProjectionNode(\n visualElementRef.current!,\n props,\n ProjectionNodeConstructor,\n initialLayoutGroupConfig\n )\n }\n\n const isMounted = useRef(false)\n useInsertionEffect(() => {\n /**\n * Check the component has already mounted before calling\n * `update` unnecessarily. This ensures we skip the initial update.\n */\n if (visualElement && isMounted.current) {\n visualElement.update(props, presenceContext)\n }\n })\n\n /**\n * Cache this value as we want to know whether HandoffAppearAnimations\n * was present on initial render - it will be deleted after this.\n */\n const optimisedAppearId =\n props[optimizedAppearDataAttribute as keyof typeof props]\n const wantsHandoff = useRef(\n Boolean(optimisedAppearId) &&\n typeof window !== \"undefined\" &&\n !window.MotionHandoffIsComplete?.(optimisedAppearId) &&\n window.MotionHasOptimisedAnimation?.(optimisedAppearId)\n )\n\n useIsomorphicLayoutEffect(() => {\n /**\n * Track that this component has mounted. This is used to detect when\n * LazyMotion features load after the component has already committed.\n */\n hasMountedOnce.current = true\n\n if (!visualElement) return\n\n isMounted.current = true\n window.MotionIsMounted = true\n\n visualElement.updateFeatures()\n visualElement.scheduleRenderMicrotask()\n\n /**\n * Ideally this function would always run in a useEffect.\n *\n * However, if we have optimised appear animations to handoff from,\n * it needs to happen synchronously to ensure there's no flash of\n * incorrect styles in the event of a hydration error.\n *\n * So if we detect a situtation where optimised appear animations\n * are running, we use useLayoutEffect to trigger animations.\n */\n if (wantsHandoff.current && visualElement.animationState) {\n visualElement.animationState.animateChanges()\n }\n })\n\n useEffect(() => {\n if (!visualElement) return\n\n if (!wantsHandoff.current && visualElement.animationState) {\n visualElement.animationState.animateChanges()\n }\n\n if (wantsHandoff.current) {\n // This ensures all future calls to animateChanges() in this component will run in useEffect\n queueMicrotask(() => {\n window.MotionHandoffMarkAsComplete?.(optimisedAppearId)\n })\n\n wantsHandoff.current = false\n }\n\n /**\n * Now we've finished triggering animations for this element we\n * can wipe the enteringChildren set for the next render.\n */\n visualElement.enteringChildren = undefined\n })\n\n return visualElement!\n}\n\nfunction createProjectionNode(\n visualElement: VisualElement<any>,\n props: MotionProps,\n ProjectionNodeConstructor: any,\n initialPromotionConfig?: InitialPromotionConfig\n) {\n const {\n layoutId,\n layout,\n drag,\n dragConstraints,\n layoutScroll,\n layoutRoot,\n layoutCrossfade,\n } = props\n\n visualElement.projection = new ProjectionNodeConstructor(\n visualElement.latestValues,\n props[\"data-framer-portal-id\"]\n ? undefined\n : getClosestProjectingNode(visualElement.parent)\n ) as IProjectionNode\n\n visualElement.projection.setOptions({\n layoutId,\n layout,\n alwaysMeasureLayout:\n Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)),\n visualElement,\n /**\n * TODO: Update options in an effect. This could be tricky as it'll be too late\n * to update by the time layout animations run.\n * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,\n * ensuring it gets called if there's no potential layout animations.\n *\n */\n animationType: typeof layout === \"string\" ? layout : \"both\",\n initialPromotionConfig,\n crossfade: layoutCrossfade,\n layoutScroll,\n layoutRoot,\n })\n}\n\nfunction getClosestProjectingNode(\n visualElement?: VisualElement<\n unknown,\n unknown,\n { allowProjection?: boolean }\n >\n): IProjectionNode | undefined {\n if (!visualElement) return undefined\n\n return visualElement.options.allowProjection !== false\n ? visualElement.projection\n : getClosestProjectingNode(visualElement.parent)\n}\n","\"use client\"\n\nimport { invariant, warning } from \"motion-utils\"\nimport * as React from \"react\"\nimport { forwardRef, useContext } from \"react\"\nimport { LayoutGroupContext } from \"../context/LayoutGroupContext\"\nimport { LazyContext } from \"../context/LazyContext\"\nimport { MotionConfigContext } from \"../context/MotionConfigContext\"\nimport { MotionContext } from \"../context/MotionContext\"\nimport { useCreateMotionContext } from \"../context/MotionContext/create\"\nimport { DOMMotionComponents } from \"../render/dom/types\"\nimport { useRender } from \"../render/dom/use-render\"\nimport { isSVGComponent } from \"../render/dom/utils/is-svg-component\"\nimport { HTMLRenderState } from \"../render/html/types\"\nimport { useHTMLVisualState } from \"../render/html/use-html-visual-state\"\nimport { SVGRenderState } from \"../render/svg/types\"\nimport { useSVGVisualState } from \"../render/svg/use-svg-visual-state\"\nimport { CreateVisualElement } from \"../render/types\"\nimport { getInitializedFeatureDefinitions } from \"./features/definitions\"\nimport { loadFeatures } from \"./features/load-features\"\nimport { FeatureBundle, FeaturePackages } from \"./features/types\"\nimport { MotionProps } from \"./types\"\nimport { motionComponentSymbol } from \"./utils/symbol\"\nimport { useMotionRef } from \"./utils/use-motion-ref\"\nimport { useVisualElement } from \"./utils/use-visual-element\"\n\nexport interface MotionComponentConfig<\n TagName extends keyof DOMMotionComponents | string = \"div\"\n> {\n preloadedFeatures?: FeatureBundle\n createVisualElement?: CreateVisualElement\n Component: TagName | React.ComponentType<React.PropsWithChildren<unknown>>\n forwardMotionProps?: boolean\n}\n\nexport type MotionComponentProps<Props> = {\n [K in Exclude<keyof Props, keyof MotionProps>]?: Props[K]\n} & MotionProps\n\nexport type MotionComponent<T, P> = T extends keyof DOMMotionComponents\n ? DOMMotionComponents[T]\n : React.ComponentType<\n Omit<MotionComponentProps<P>, \"children\"> & {\n children?: \"children\" extends keyof P\n ? P[\"children\"] | MotionComponentProps<P>[\"children\"]\n : MotionComponentProps<P>[\"children\"]\n }\n >\n\nexport interface MotionComponentOptions {\n forwardMotionProps?: boolean\n /**\n * Specify whether the component renders an HTML or SVG element.\n * This is useful when wrapping custom SVG components that need\n * SVG-specific attribute handling (like viewBox animation).\n * By default, Motion auto-detects based on the component name,\n * but custom React components are always treated as HTML.\n */\n type?: \"html\" | \"svg\"\n}\n\n/**\n * Create a `motion` component.\n *\n * This function accepts a Component argument, which can be either a string (ie \"div\"\n * for `motion.div`), or an actual React component.\n *\n * Alongside this is a config option which provides a way of rendering the provided\n * component \"offline\", or outside the React render cycle.\n */\nexport function createMotionComponent<\n Props,\n TagName extends keyof DOMMotionComponents | string = \"div\"\n>(\n Component: TagName | string | React.ComponentType<Props>,\n { forwardMotionProps = false, type }: MotionComponentOptions = {},\n preloadedFeatures?: FeaturePackages,\n createVisualElement?: CreateVisualElement<Props, TagName>\n) {\n preloadedFeatures && loadFeatures(preloadedFeatures)\n\n /**\n * Determine whether to use SVG or HTML rendering based on:\n * 1. Explicit `type` option (highest priority)\n * 2. Auto-detection via `isSVGComponent`\n */\n const isSVG = type ? type === \"svg\" : isSVGComponent(Component)\n const useVisualState = isSVG ? useSVGVisualState : useHTMLVisualState\n\n function MotionDOMComponent(\n props: MotionComponentProps<Props>,\n externalRef?: React.Ref<HTMLElement | SVGElement>\n ) {\n /**\n * If we need to measure the element we load this functionality in a\n * separate class component in order to gain access to getSnapshotBeforeUpdate.\n */\n let MeasureLayout: undefined | React.ComponentType<MotionProps>\n\n const configAndProps = {\n ...useContext(MotionConfigContext),\n ...props,\n layoutId: useLayoutId(props),\n }\n\n const { isStatic } = configAndProps\n\n const context = useCreateMotionContext<HTMLElement | SVGElement>(props)\n\n const visualState = useVisualState(props, isStatic)\n\n if (!isStatic && typeof window !== \"undefined\") {\n useStrictMode(configAndProps, preloadedFeatures)\n\n const layoutProjection = getProjectionFunctionality(configAndProps)\n MeasureLayout = layoutProjection.MeasureLayout\n\n /**\n * Create a VisualElement for this component. A VisualElement provides a common\n * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as\n * providing a way of rendering to these APIs outside of the React render loop\n * for more performant animations and interactions\n */\n context.visualElement = useVisualElement(\n Component,\n visualState,\n configAndProps,\n createVisualElement,\n layoutProjection.ProjectionNode,\n isSVG\n )\n }\n\n /**\n * The mount order and hierarchy is specific to ensure our element ref\n * is hydrated by the time features fire their effects.\n */\n return (\n <MotionContext.Provider value={context}>\n {MeasureLayout && context.visualElement ? (\n <MeasureLayout\n visualElement={context.visualElement}\n {...configAndProps}\n />\n ) : null}\n {useRender<Props, TagName>(\n Component,\n props,\n useMotionRef<\n HTMLElement | SVGElement,\n HTMLRenderState | SVGRenderState\n >(visualState, context.visualElement, externalRef),\n visualState,\n isStatic,\n forwardMotionProps,\n isSVG\n )}\n </MotionContext.Provider>\n )\n }\n\n MotionDOMComponent.displayName = `motion.${\n typeof Component === \"string\"\n ? Component\n : `create(${Component.displayName ?? Component.name ?? \"\"})`\n }`\n\n const ForwardRefMotionComponent = forwardRef(MotionDOMComponent as any)\n ;(ForwardRefMotionComponent as any)[motionComponentSymbol] = Component\n\n return ForwardRefMotionComponent as MotionComponent<TagName, Props>\n}\n\nfunction useLayoutId({ layoutId }: MotionProps) {\n const layoutGroupId = useContext(LayoutGroupContext).id\n return layoutGroupId && layoutId !== undefined\n ? layoutGroupId + \"-\" + layoutId\n : layoutId\n}\n\nfunction useStrictMode(\n configAndProps: MotionProps,\n preloadedFeatures?: FeaturePackages\n) {\n const isStrict = useContext(LazyContext).strict\n\n /**\n * If we're in development mode, check to make sure we're not rendering a motion component\n * as a child of LazyMotion, as this will break the file-size benefits of using it.\n */\n if (\n process.env.NODE_ENV !== \"production\" &&\n preloadedFeatures &&\n isStrict\n ) {\n const strictMessage =\n \"You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.\"\n configAndProps.ignoreStrict\n ? warning(false, strictMessage, \"lazy-strict-mode\")\n : invariant(false, strictMessage, \"lazy-strict-mode\")\n }\n}\n\nfunction getProjectionFunctionality(props: MotionProps) {\n const featureDefinitions = getInitializedFeatureDefinitions()\n const { drag, layout } = featureDefinitions\n\n if (!drag && !layout) return {}\n\n const combined = { ...drag, ...layout }\n\n return {\n MeasureLayout:\n drag?.isEnabled(props) || layout?.isEnabled(props)\n ? combined.MeasureLayout\n : undefined,\n ProjectionNode: combined.ProjectionNode,\n }\n}\n","import {\n createAnimationState,\n Feature,\n isAnimationControls,\n type VisualElement,\n} from \"motion-dom\"\n\nexport class AnimationFeature extends Feature<unknown> {\n unmountControls?: () => void\n\n /**\n * We dynamically generate the AnimationState manager as it contains a reference\n * to the underlying animation library. We only want to load that if we load this,\n * so people can optionally code split it out using the `m` component.\n */\n constructor(node: VisualElement) {\n super(node)\n node.animationState ||= createAnimationState(node)\n }\n\n updateAnimationControlsSubscription() {\n const { animate } = this.node.getProps()\n if (isAnimationControls(animate)) {\n this.unmountControls = animate.subscribe(this.node)\n }\n }\n\n /**\n * Subscribe any provided AnimationControls to the component's VisualElement\n */\n mount() {\n this.updateAnimationControlsSubscription()\n }\n\n update() {\n const { animate } = this.node.getProps()\n const { animate: prevAnimate } = this.node.prevProps || {}\n if (animate !== prevAnimate) {\n this.updateAnimationControlsSubscription()\n }\n }\n\n unmount() {\n this.node.animationState!.reset()\n this.unmountControls?.()\n }\n}\n","import { Feature, resolveVariant } from \"motion-dom\"\n\nlet id = 0\n\nexport class ExitAnimationFeature extends Feature<unknown> {\n private id: number = id++\n private isExitComplete = false\n\n update() {\n if (!this.node.presenceContext) return\n\n const { isPresent, onExitComplete } = this.node.presenceContext\n const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}\n\n if (!this.node.animationState || isPresent === prevIsPresent) {\n return\n }\n\n if (isPresent && prevIsPresent === false) {\n /**\n * When re-entering, if the exit animation already completed\n * (element is at rest), reset to initial values so the enter\n * animation replays from the correct position.\n */\n if (this.isExitComplete) {\n const { initial, custom } = this.node.getProps()\n\n if (typeof initial === \"string\") {\n const resolved = resolveVariant(\n this.node,\n initial,\n custom\n )\n if (resolved) {\n const { transition, transitionEnd, ...target } =\n resolved\n for (const key in target) {\n this.node\n .getValue(key)\n ?.jump(\n target[\n key as keyof typeof target\n ] as any\n )\n }\n }\n }\n\n this.node.animationState.reset()\n this.node.animationState.animateChanges()\n } else {\n this.node.animationState.setActive(\"exit\", false)\n }\n\n this.isExitComplete = false\n return\n }\n\n const exitAnimation = this.node.animationState.setActive(\n \"exit\",\n !isPresent\n )\n\n if (onExitComplete && !isPresent) {\n exitAnimation.then(() => {\n this.isExitComplete = true\n onExitComplete(this.id)\n })\n }\n }\n\n mount() {\n const { register, onExitComplete } = this.node.presenceContext || {}\n\n if (onExitComplete) {\n onExitComplete(this.id)\n }\n\n if (register) {\n this.unmount = register(this.id)\n }\n }\n\n unmount() {}\n}\n","import { AnimationFeature } from \"./animation\"\nimport { ExitAnimationFeature } from \"./animation/exit\"\nimport { FeaturePackages } from \"./types\"\n\nexport const animations: FeaturePackages = {\n animation: {\n Feature: AnimationFeature,\n },\n exit: {\n Feature: ExitAnimationFeature,\n },\n}\n","import { EventInfo, isPrimaryPointer } from \"motion-dom\"\n\nexport type EventListenerWithPointInfo = (\n e: PointerEvent,\n info: EventInfo\n) => void\n\nexport function extractEventInfo(event: PointerEvent): EventInfo {\n return {\n point: {\n x: event.pageX,\n y: event.pageY,\n },\n }\n}\n\nexport const addPointerInfo =\n (handler: EventListenerWithPointInfo): EventListener =>\n (event: PointerEvent) =>\n isPrimaryPointer(event) && handler(event, extractEventInfo(event))\n","import { addDomEvent } from \"motion-dom\"\nimport { addPointerInfo, EventListenerWithPointInfo } from \"./event-info\"\n\nexport function addPointerEvent(\n target: EventTarget,\n eventName: string,\n handler: EventListenerWithPointInfo,\n options?: AddEventListenerOptions\n) {\n return addDomEvent(target, eventName, addPointerInfo(handler), options)\n}\n","import type { VisualElement } from \"motion-dom\"\n\n// Fixes https://github.com/motiondivision/motion/issues/2270\nexport const getContextWindow = ({ current }: VisualElement<Element>) => {\n return current ? current.ownerDocument.defaultView : null\n}\n","import { Point } from \"motion-utils\"\n\nexport const distance = (a: number, b: number) => Math.abs(a - b)\n\nexport function distance2D(a: Point, b: Point): number {\n // Multi-dimensional\n const xDelta = distance(a.x, b.x)\n const yDelta = distance(a.y, b.y)\n return Math.sqrt(xDelta ** 2 + yDelta ** 2)\n}\n","import type { EventInfo, PanHandler } from \"motion-dom\"\nimport { cancelFrame, frame, frameData, isPrimaryPointer } from \"motion-dom\"\nimport {\n millisecondsToSeconds,\n pipe,\n Point,\n secondsToMilliseconds,\n TransformPoint,\n} from \"motion-utils\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { extractEventInfo } from \"../../events/event-info\"\nimport { distance2D } from \"../../utils/distance\"\n\ninterface PanSessionHandlers {\n onSessionStart: PanHandler\n onStart: PanHandler\n onMove: PanHandler\n onEnd: PanHandler\n onSessionEnd: PanHandler\n resumeAnimation: () => void\n}\n\ninterface PanSessionOptions {\n transformPagePoint?: TransformPoint\n dragSnapToOrigin?: boolean | \"x\" | \"y\"\n distanceThreshold?: number\n contextWindow?: (Window & typeof globalThis) | null\n /**\n * Element being dragged. When provided, scroll events on its\n * ancestors and window are compensated so the gesture continues\n * smoothly during scroll.\n */\n element?: HTMLElement | null\n}\n\ninterface TimestampedPoint extends Point {\n timestamp: number\n}\n\nconst overflowStyles = /*#__PURE__*/ new Set([\"auto\", \"scroll\"])\n\n/**\n * @internal\n */\nexport class PanSession {\n /**\n * @internal\n */\n private history: TimestampedPoint[]\n\n /**\n * @internal\n */\n private startEvent: PointerEvent | null = null\n\n /**\n * @internal\n */\n private lastMoveEvent: PointerEvent | null = null\n\n /**\n * @internal\n */\n private lastMoveEventInfo: EventInfo | null = null\n\n /**\n * Raw (untransformed) event info, re-transformed each frame\n * so transformPagePoint sees the current parent matrix.\n * @internal\n */\n private lastRawMoveEventInfo: EventInfo | null = null\n\n /**\n * @internal\n */\n private transformPagePoint?: TransformPoint\n\n /**\n * @internal\n */\n private handlers: Partial<PanSessionHandlers> = {}\n\n /**\n * @internal\n */\n private removeListeners: Function\n\n /**\n * For determining if an animation should resume after it is interupted\n *\n * @internal\n */\n private dragSnapToOrigin: boolean | \"x\" | \"y\"\n\n /**\n * The distance after which panning should start.\n *\n * @internal\n */\n private distanceThreshold: number\n\n /**\n * @internal\n */\n private contextWindow: PanSessionOptions[\"contextWindow\"] = window\n\n /**\n * Scroll positions of scrollable ancestors and window.\n * @internal\n */\n private scrollPositions: Map<Element | Window, Point> = new Map()\n\n /**\n * Cleanup function for scroll listeners.\n * @internal\n */\n private removeScrollListeners: (() => void) | null = null\n\n constructor(\n event: PointerEvent,\n handlers: Partial<PanSessionHandlers>,\n {\n transformPagePoint,\n contextWindow = window,\n dragSnapToOrigin = false,\n distanceThreshold = 3,\n element,\n }: PanSessionOptions = {}\n ) {\n // If we have more than one touch, don't start detecting this gesture\n if (!isPrimaryPointer(event)) return\n\n this.dragSnapToOrigin = dragSnapToOrigin\n this.handlers = handlers\n this.transformPagePoint = transformPagePoint\n this.distanceThreshold = distanceThreshold\n this.contextWindow = contextWindow || window\n\n const info = extractEventInfo(event)\n const initialInfo = transformPoint(info, this.transformPagePoint)\n const { point } = initialInfo\n\n const { timestamp } = frameData\n\n this.history = [{ ...point, timestamp }]\n\n const { onSessionStart } = handlers\n onSessionStart &&\n onSessionStart(event, getPanInfo(initialInfo, this.history))\n\n this.removeListeners = pipe(\n addPointerEvent(\n this.contextWindow,\n \"pointermove\",\n this.handlePointerMove\n ),\n addPointerEvent(\n this.contextWindow,\n \"pointerup\",\n this.handlePointerUp\n ),\n addPointerEvent(\n this.contextWindow,\n \"pointercancel\",\n this.handlePointerUp\n )\n )\n\n // Start scroll tracking if element provided\n if (element) {\n this.startScrollTracking(element)\n }\n }\n\n /**\n * Start tracking scroll on ancestors and window.\n */\n private startScrollTracking(element: HTMLElement): void {\n // Store initial scroll positions for scrollable ancestors\n let current = element.parentElement\n while (current) {\n const style = getComputedStyle(current)\n if (\n overflowStyles.has(style.overflowX) ||\n overflowStyles.has(style.overflowY)\n ) {\n this.scrollPositions.set(current, {\n x: current.scrollLeft,\n y: current.scrollTop,\n })\n }\n current = current.parentElement\n }\n\n // Track window scroll\n this.scrollPositions.set(window, {\n x: window.scrollX,\n y: window.scrollY,\n })\n\n // Capture listener catches element scroll events as they bubble\n window.addEventListener(\"scroll\", this.onElementScroll, {\n capture: true,\n })\n\n // Direct window scroll listener (window scroll doesn't bubble)\n window.addEventListener(\"scroll\", this.onWindowScroll)\n\n this.removeScrollListeners = () => {\n window.removeEventListener(\"scroll\", this.onElementScroll, {\n capture: true,\n })\n window.removeEventListener(\"scroll\", this.onWindowScroll)\n }\n }\n\n private onElementScroll = (event: Event): void => {\n this.handleScroll(event.target as Element)\n }\n\n private onWindowScroll = (): void => {\n this.handleScroll(window)\n }\n\n /**\n * Handle scroll compensation during drag.\n *\n * For element scroll: adjusts history origin since pageX/pageY doesn't change.\n * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.\n */\n private handleScroll(target: Element | Window): void {\n const initial = this.scrollPositions.get(target)\n if (!initial) return\n\n const isWindow = target === window\n const current = isWindow\n ? { x: window.scrollX, y: window.scrollY }\n : {\n x: (target as Element).scrollLeft,\n y: (target as Element).scrollTop,\n }\n\n const delta = { x: current.x - initial.x, y: current.y - initial.y }\n if (delta.x === 0 && delta.y === 0) return\n\n if (isWindow) {\n // Window scroll: pageX/pageY changes, so update lastMoveEventInfo\n if (this.lastMoveEventInfo) {\n this.lastMoveEventInfo.point.x += delta.x\n this.lastMoveEventInfo.point.y += delta.y\n }\n } else {\n // Element scroll: pageX/pageY unchanged, so adjust history origin\n if (this.history.length > 0) {\n this.history[0].x -= delta.x\n this.history[0].y -= delta.y\n }\n }\n\n this.scrollPositions.set(target, current)\n frame.update(this.updatePoint, true)\n }\n\n private updatePoint = () => {\n if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return\n\n // Re-transform raw point through current transformPagePoint so\n // animated parent transforms (e.g. rotation) are picked up each frame\n if (this.lastRawMoveEventInfo) {\n this.lastMoveEventInfo = transformPoint(\n this.lastRawMoveEventInfo,\n this.transformPagePoint\n )\n }\n\n const info = getPanInfo(this.lastMoveEventInfo, this.history)\n const isPanStarted = this.startEvent !== null\n\n // Only start panning if the offset is larger than 3 pixels. If we make it\n // any larger than this we'll want to reset the pointer history\n // on the first update to avoid visual snapping to the cursor.\n const isDistancePastThreshold =\n distance2D(info.offset, { x: 0, y: 0 }) >= this.distanceThreshold\n\n if (!isPanStarted && !isDistancePastThreshold) return\n\n const { point } = info\n const { timestamp } = frameData\n this.history.push({ ...point, timestamp })\n\n const { onStart, onMove } = this.handlers\n\n if (!isPanStarted) {\n onStart && onStart(this.lastMoveEvent, info)\n this.startEvent = this.lastMoveEvent\n }\n\n onMove && onMove(this.lastMoveEvent, info)\n }\n\n private handlePointerMove = (event: PointerEvent, info: EventInfo) => {\n this.lastMoveEvent = event\n this.lastRawMoveEventInfo = info\n this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint)\n\n // Throttle mouse move event to once per frame\n frame.update(this.updatePoint, true)\n }\n\n private handlePointerUp = (event: PointerEvent, info: EventInfo) => {\n this.end()\n\n const { onEnd, onSessionEnd, resumeAnimation } = this.handlers\n\n // Resume animation if dragSnapToOrigin is set OR if no drag started (user just clicked)\n // This ensures constraint animations continue when interrupted by a click\n if (this.dragSnapToOrigin || !this.startEvent) {\n resumeAnimation && resumeAnimation()\n }\n if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return\n\n const panInfo = getPanInfo(\n event.type === \"pointercancel\"\n ? this.lastMoveEventInfo\n : transformPoint(info, this.transformPagePoint),\n this.history\n )\n\n if (this.startEvent && onEnd) {\n onEnd(event, panInfo)\n }\n\n onSessionEnd && onSessionEnd(event, panInfo)\n }\n\n updateHandlers(handlers: Partial<PanSessionHandlers>) {\n this.handlers = handlers\n }\n\n end() {\n this.removeListeners && this.removeListeners()\n this.removeScrollListeners && this.removeScrollListeners()\n this.scrollPositions.clear()\n cancelFrame(this.updatePoint)\n }\n}\n\nfunction transformPoint(\n info: EventInfo,\n transformPagePoint?: (point: Point) => Point\n) {\n return transformPagePoint ? { point: transformPagePoint(info.point) } : info\n}\n\nfunction subtractPoint(a: Point, b: Point): Point {\n return { x: a.x - b.x, y: a.y - b.y }\n}\n\nfunction getPanInfo({ point }: EventInfo, history: TimestampedPoint[]) {\n return {\n point,\n delta: subtractPoint(point, lastDevicePoint(history)),\n offset: subtractPoint(point, startDevicePoint(history)),\n velocity: getVelocity(history, 0.1),\n }\n}\n\nfunction startDevicePoint(history: TimestampedPoint[]): TimestampedPoint {\n return history[0]\n}\n\nfunction lastDevicePoint(history: TimestampedPoint[]): TimestampedPoint {\n return history[history.length - 1]\n}\n\nfunction getVelocity(history: TimestampedPoint[], timeDelta: number): Point {\n if (history.length < 2) {\n return { x: 0, y: 0 }\n }\n\n let i = history.length - 1\n let timestampedPoint: TimestampedPoint | null = null\n const lastPoint = lastDevicePoint(history)\n while (i >= 0) {\n timestampedPoint = history[i]\n if (\n lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta)\n ) {\n break\n }\n i--\n }\n\n if (!timestampedPoint) {\n return { x: 0, y: 0 }\n }\n\n /**\n * If the selected point is the pointer-down origin (history[0]),\n * there are better movement points available, and the time gap\n * is suspiciously large (>2x timeDelta), use the next point instead.\n * This prevents stale pointer-down points from diluting velocity\n * in hold-then-flick gestures.\n */\n if (\n timestampedPoint === history[0] &&\n history.length > 2 &&\n lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta) * 2\n ) {\n timestampedPoint = history[1]\n }\n\n const time = millisecondsToSeconds(\n lastPoint.timestamp - timestampedPoint.timestamp\n )\n if (time === 0) {\n return { x: 0, y: 0 }\n }\n\n const currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time,\n }\n\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0\n }\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0\n }\n\n return currentVelocity\n}\n","import { calcLength, mixNumber, type DragElastic, type ResolvedConstraints } from \"motion-dom\"\nimport {\n Axis,\n BoundingBox,\n Box,\n progress as calcProgress,\n clamp,\n Point,\n} from \"motion-utils\"\n\n/**\n * Apply constraints to a point. These constraints are both physical along an\n * axis, and an elastic factor that determines how much to constrain the point\n * by if it does lie outside the defined parameters.\n */\nexport function applyConstraints(\n point: number,\n { min, max }: Partial<Axis>,\n elastic?: Axis\n): number {\n if (min !== undefined && point < min) {\n // If we have a min point defined, and this is outside of that, constrain\n point = elastic\n ? mixNumber(min, point, elastic.min)\n : Math.max(point, min)\n } else if (max !== undefined && point > max) {\n // If we have a max point defined, and this is outside of that, constrain\n point = elastic\n ? mixNumber(max, point, elastic.max)\n : Math.min(point, max)\n }\n\n return point\n}\n\n/**\n * Calculates a min projection point based on a pointer, pointer progress\n * within the drag target, and constraints.\n *\n * For instance if an element was 100px width, we were dragging from 0.25\n * along this axis, the pointer is at 200px, and there were no constraints,\n * we would calculate a min projection point of 175px.\n */\nexport function calcConstrainedMinPoint(\n point: number,\n length: number,\n progress: number,\n constraints?: Partial<Axis>,\n elastic?: Axis\n): number {\n // Calculate a min point for this axis and apply it to the current pointer\n const min = point - length * progress\n\n return constraints ? applyConstraints(min, constraints, elastic) : min\n}\n\n/**\n * Calculate constraints in terms of the viewport when defined relatively to the\n * measured axis. This is measured from the nearest edge, so a max constraint of 200\n * on an axis with a max value of 300 would return a constraint of 500 - axis length\n */\nexport function calcRelativeAxisConstraints(\n axis: Axis,\n min?: number,\n max?: number\n): Partial<Axis> {\n return {\n min: min !== undefined ? axis.min + min : undefined,\n max:\n max !== undefined\n ? axis.max + max - (axis.max - axis.min)\n : undefined,\n }\n}\n\n/**\n * Calculate constraints in terms of the viewport when\n * defined relatively to the measured bounding box.\n */\nexport function calcRelativeConstraints(\n layoutBox: Box,\n { top, left, bottom, right }: Partial<BoundingBox>\n): ResolvedConstraints {\n return {\n x: calcRelativeAxisConstraints(layoutBox.x, left, right),\n y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),\n }\n}\n\n/**\n * Calculate viewport constraints when defined as another viewport-relative axis\n */\nexport function calcViewportAxisConstraints(\n layoutAxis: Axis,\n constraintsAxis: Axis\n) {\n let min = constraintsAxis.min - layoutAxis.min\n let max = constraintsAxis.max - layoutAxis.max\n\n // If the constraints axis is actually smaller than the layout axis then we can\n // flip the constraints\n if (\n constraintsAxis.max - constraintsAxis.min <\n layoutAxis.max - layoutAxis.min\n ) {\n ;[min, max] = [max, min]\n }\n\n return { min, max }\n}\n\n/**\n * Calculate viewport constraints when defined as another viewport-relative box\n */\nexport function calcViewportConstraints(layoutBox: Box, constraintsBox: Box) {\n return {\n x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),\n y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),\n }\n}\n\n/**\n * Calculate a transform origin relative to the source axis, between 0-1, that results\n * in an asthetically pleasing scale/transform needed to project from source to target.\n */\nexport function calcOrigin(source: Axis, target: Axis): number {\n let origin = 0.5\n const sourceLength = calcLength(source)\n const targetLength = calcLength(target)\n\n if (targetLength > sourceLength) {\n origin = calcProgress(target.min, target.max - sourceLength, source.min)\n } else if (sourceLength > targetLength) {\n origin = calcProgress(source.min, source.max - targetLength, target.min)\n }\n\n return clamp(0, 1, origin)\n}\n\n/**\n * Calculate the relative progress of one constraints box relative to another.\n * Imagine a page scroll bar. At the top, this would return 0, at the bottom, 1.\n * Anywhere in-between, a value between 0 and 1.\n *\n * This also handles flipped constraints, for instance a draggable container within\n * a smaller viewport like a scrollable view.\n */\nexport function calcProgressWithinConstraints(\n layoutBox: Box,\n constraintsBox: Box\n): Point {\n return {\n x: calcOrigin(layoutBox.x, constraintsBox.x),\n y: calcOrigin(layoutBox.y, constraintsBox.y),\n }\n}\n\n/**\n * Calculate the an axis position based on two axes and a progress value.\n */\nexport function calcPositionFromProgress(\n axis: Axis,\n constraints: Axis,\n progress: number\n): Axis {\n const axisLength = axis.max - axis.min\n const min = mixNumber(\n constraints.min,\n constraints.max - axisLength,\n progress\n )\n return { min, max: min + axisLength }\n}\n\n/**\n * Rebase the calculated viewport constraints relative to the layout.min point.\n */\nexport function rebaseAxisConstraints(\n layout: Axis,\n constraints: Partial<Axis>\n): Partial<Axis> {\n const relativeConstraints: Partial<Axis> = {}\n\n if (constraints.min !== undefined) {\n relativeConstraints.min = constraints.min - layout.min\n }\n\n if (constraints.max !== undefined) {\n relativeConstraints.max = constraints.max - layout.min\n }\n\n return relativeConstraints\n}\n\nexport const defaultElastic = 0.35\n/**\n * Accepts a dragElastic prop and returns resolved elastic values for each axis.\n */\nexport function resolveDragElastic(\n dragElastic: DragElastic = defaultElastic\n): Box {\n if (dragElastic === false) {\n dragElastic = 0\n } else if (dragElastic === true) {\n dragElastic = defaultElastic\n }\n\n return {\n x: resolveAxisElastic(dragElastic, \"left\", \"right\"),\n y: resolveAxisElastic(dragElastic, \"top\", \"bottom\"),\n }\n}\n\nexport function resolveAxisElastic(\n dragElastic: DragElastic,\n minLabel: string,\n maxLabel: string\n): Axis {\n return {\n min: resolvePointElastic(dragElastic, minLabel),\n max: resolvePointElastic(dragElastic, maxLabel),\n }\n}\n\nexport function resolvePointElastic(\n dragElastic: DragElastic,\n label: string\n): number {\n return typeof dragElastic === \"number\"\n ? dragElastic\n : dragElastic[label as keyof typeof dragElastic] || 0\n}\n","import {\n addValueToWillChange,\n animateMotionValue,\n calcLength,\n convertBoundingBoxToBox,\n convertBoxToBoundingBox,\n createBox,\n eachAxis,\n frame,\n isElementTextInput,\n measurePageBox,\n mixNumber,\n PanInfo,\n percent,\n ResolvedConstraints,\n resize,\n setDragLock,\n Transition,\n type VisualElement,\n} from \"motion-dom\"\nimport { Axis, Point, invariant } from \"motion-utils\"\nimport { addDomEvent, type LayoutUpdateData } from \"motion-dom\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { extractEventInfo } from \"../../events/event-info\"\nimport { MotionProps } from \"../../motion/types\"\nimport { getContextWindow } from \"../../utils/get-context-window\"\nimport { isRefObject } from \"../../utils/is-ref-object\"\nimport { PanSession } from \"../pan/PanSession\"\nimport {\n applyConstraints,\n calcOrigin,\n calcRelativeConstraints,\n calcViewportConstraints,\n defaultElastic,\n rebaseAxisConstraints,\n resolveDragElastic,\n} from \"./utils/constraints\"\n\nexport const elementDragControls = new WeakMap<\n VisualElement,\n VisualElementDragControls\n>()\n\nexport interface DragControlOptions {\n /**\n * This distance after which dragging starts and a direction is locked in.\n *\n * @public\n */\n distanceThreshold?: number\n\n /**\n * Whether to immediately snap to the cursor when dragging starts.\n *\n * @public\n */\n snapToCursor?: boolean\n}\n\ntype DragDirection = \"x\" | \"y\"\n\nexport class VisualElementDragControls {\n private visualElement: VisualElement<HTMLElement>\n\n private panSession?: PanSession\n\n private openDragLock: VoidFunction | null = null\n\n isDragging = false\n private currentDirection: DragDirection | null = null\n\n private originPoint: Point = { x: 0, y: 0 }\n\n /**\n * The permitted boundaries of travel, in pixels.\n */\n private constraints: ResolvedConstraints | false = false\n\n private hasMutatedConstraints = false\n\n /**\n * The per-axis resolved elastic values.\n */\n private elastic = createBox()\n\n /**\n * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n private latestPointerEvent: PointerEvent | null = null\n\n /**\n * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n private latestPanInfo: PanInfo | null = null\n\n constructor(visualElement: VisualElement<HTMLElement>) {\n this.visualElement = visualElement\n }\n\n start(\n originEvent: PointerEvent,\n { snapToCursor = false, distanceThreshold }: DragControlOptions = {}\n ) {\n /**\n * Don't start dragging if this component is exiting\n */\n const { presenceContext } = this.visualElement\n if (presenceContext && presenceContext.isPresent === false) return\n\n const onSessionStart = (event: PointerEvent) => {\n if (snapToCursor) {\n this.snapToCursor(extractEventInfo(event).point)\n }\n this.stopAnimation()\n }\n\n const onStart = (event: PointerEvent, info: PanInfo) => {\n // Attempt to grab the global drag gesture lock - maybe make this part of PanSession\n const { drag, dragPropagation, onDragStart } = this.getProps()\n\n if (drag && !dragPropagation) {\n if (this.openDragLock) this.openDragLock()\n\n this.openDragLock = setDragLock(drag)\n\n // If we don 't have the lock, don't start dragging\n if (!this.openDragLock) return\n }\n\n this.latestPointerEvent = event\n this.latestPanInfo = info\n this.isDragging = true\n\n this.currentDirection = null\n\n this.resolveConstraints()\n\n if (this.visualElement.projection) {\n this.visualElement.projection.isAnimationBlocked = true\n this.visualElement.projection.target = undefined\n }\n\n /**\n * Record gesture origin and pointer offset\n */\n eachAxis((axis) => {\n let current = this.getAxisMotionValue(axis).get() || 0\n\n /**\n * If the MotionValue is a percentage value convert to px\n */\n if (percent.test(current)) {\n const { projection } = this.visualElement\n\n if (projection && projection.layout) {\n const measuredAxis = projection.layout.layoutBox[axis]\n\n if (measuredAxis) {\n const length = calcLength(measuredAxis)\n current = length * (parseFloat(current) / 100)\n }\n }\n }\n\n this.originPoint[axis] = current\n })\n\n // Fire onDragStart event\n if (onDragStart) {\n frame.update(() => onDragStart(event, info), false, true)\n }\n\n addValueToWillChange(this.visualElement, \"transform\")\n\n const { animationState } = this.visualElement\n animationState && animationState.setActive(\"whileDrag\", true)\n }\n\n const onMove = (event: PointerEvent, info: PanInfo) => {\n this.latestPointerEvent = event\n this.latestPanInfo = info\n\n const {\n dragPropagation,\n dragDirectionLock,\n onDirectionLock,\n onDrag,\n } = this.getProps()\n\n // If we didn't successfully receive the gesture lock, early return.\n if (!dragPropagation && !this.openDragLock) return\n\n const { offset } = info\n // Attempt to detect drag direction if directionLock is true\n if (dragDirectionLock && this.currentDirection === null) {\n this.currentDirection = getCurrentDirection(offset)\n\n // If we've successfully set a direction, notify listener\n if (this.currentDirection !== null) {\n onDirectionLock && onDirectionLock(this.currentDirection)\n }\n\n return\n }\n\n // Update each point with the latest position\n this.updateAxis(\"x\", info.point, offset)\n this.updateAxis(\"y\", info.point, offset)\n\n /**\n * Ideally we would leave the renderer to fire naturally at the end of\n * this frame but if the element is about to change layout as the result\n * of a re-render we want to ensure the browser can read the latest\n * bounding box to ensure the pointer and element don't fall out of sync.\n */\n this.visualElement.render()\n\n /**\n * This must fire after the render call as it might trigger a state\n * change which itself might trigger a layout update.\n */\n if (onDrag) {\n frame.update(() => onDrag(event, info), false, true)\n }\n }\n\n const onSessionEnd = (event: PointerEvent, info: PanInfo) => {\n this.latestPointerEvent = event\n this.latestPanInfo = info\n\n this.stop(event, info)\n\n this.latestPointerEvent = null\n this.latestPanInfo = null\n }\n\n const resumeAnimation = () => {\n const { dragSnapToOrigin: snap } = this.getProps()\n if (snap || this.constraints) {\n this.startAnimation({ x: 0, y: 0 })\n }\n }\n\n const { dragSnapToOrigin } = this.getProps()\n this.panSession = new PanSession(\n originEvent,\n {\n onSessionStart,\n onStart,\n onMove,\n onSessionEnd,\n resumeAnimation,\n },\n {\n transformPagePoint: this.visualElement.getTransformPagePoint(),\n dragSnapToOrigin,\n distanceThreshold,\n contextWindow: getContextWindow(this.visualElement),\n element: this.visualElement.current,\n }\n )\n }\n\n /**\n * @internal\n */\n stop(event?: PointerEvent, panInfo?: PanInfo) {\n const finalEvent = event || this.latestPointerEvent\n const finalPanInfo = panInfo || this.latestPanInfo\n\n const isDragging = this.isDragging\n this.cancel()\n if (!isDragging || !finalPanInfo || !finalEvent) return\n\n const { velocity } = finalPanInfo\n this.startAnimation(velocity)\n\n const { onDragEnd } = this.getProps()\n if (onDragEnd) {\n frame.postRender(() => onDragEnd(finalEvent, finalPanInfo))\n }\n }\n\n /**\n * @internal\n */\n cancel() {\n this.isDragging = false\n\n const { projection, animationState } = this.visualElement\n\n if (projection) {\n projection.isAnimationBlocked = false\n }\n\n this.endPanSession()\n\n const { dragPropagation } = this.getProps()\n\n if (!dragPropagation && this.openDragLock) {\n this.openDragLock()\n this.openDragLock = null\n }\n\n animationState && animationState.setActive(\"whileDrag\", false)\n }\n\n /**\n * Clean up the pan session without modifying other drag state.\n * This is used during unmount to ensure event listeners are removed\n * without affecting projection animations or drag locks.\n * @internal\n */\n endPanSession() {\n this.panSession && this.panSession.end()\n this.panSession = undefined\n }\n\n private updateAxis(axis: DragDirection, _point: Point, offset?: Point) {\n const { drag } = this.getProps()\n\n // If we're not dragging this axis, do an early return.\n if (!offset || !shouldDrag(axis, drag, this.currentDirection)) return\n\n const axisValue = this.getAxisMotionValue(axis)\n let next = this.originPoint[axis] + offset[axis]\n\n // Apply constraints\n if (this.constraints && this.constraints[axis]) {\n next = applyConstraints(\n next,\n this.constraints[axis],\n this.elastic[axis]\n )\n }\n\n axisValue.set(next)\n }\n\n private resolveConstraints() {\n const { dragConstraints, dragElastic } = this.getProps()\n\n const layout =\n this.visualElement.projection &&\n !this.visualElement.projection.layout\n ? this.visualElement.projection.measure(false)\n : this.visualElement.projection?.layout\n\n const prevConstraints = this.constraints\n\n if (dragConstraints && isRefObject(dragConstraints)) {\n if (!this.constraints) {\n this.constraints = this.resolveRefConstraints()\n }\n } else {\n if (dragConstraints && layout) {\n this.constraints = calcRelativeConstraints(\n layout.layoutBox,\n dragConstraints\n )\n } else {\n this.constraints = false\n }\n }\n\n this.elastic = resolveDragElastic(dragElastic)\n\n /**\n * If we're outputting to external MotionValues, we want to rebase the measured constraints\n * from viewport-relative to component-relative. This only applies to relative (non-ref)\n * constraints, as ref-based constraints from calcViewportConstraints are already in the\n * correct coordinate space for the motion value transform offset.\n */\n if (\n prevConstraints !== this.constraints &&\n !isRefObject(dragConstraints) &&\n layout &&\n this.constraints &&\n !this.hasMutatedConstraints\n ) {\n eachAxis((axis) => {\n if (\n this.constraints !== false &&\n this.getAxisMotionValue(axis)\n ) {\n this.constraints[axis] = rebaseAxisConstraints(\n layout.layoutBox[axis],\n this.constraints[axis]\n )\n }\n })\n }\n }\n\n private resolveRefConstraints() {\n const { dragConstraints: constraints, onMeasureDragConstraints } =\n this.getProps()\n if (!constraints || !isRefObject(constraints)) return false\n\n const constraintsElement = constraints.current as HTMLElement\n\n invariant(\n constraintsElement !== null,\n \"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.\",\n \"drag-constraints-ref\"\n )\n\n const { projection } = this.visualElement\n\n // TODO\n if (!projection || !projection.layout) return false\n\n const constraintsBox = measurePageBox(\n constraintsElement,\n projection.root!,\n this.visualElement.getTransformPagePoint()\n )\n\n let measuredConstraints = calcViewportConstraints(\n projection.layout.layoutBox,\n constraintsBox\n )\n\n /**\n * If there's an onMeasureDragConstraints listener we call it and\n * if different constraints are returned, set constraints to that\n */\n if (onMeasureDragConstraints) {\n const userConstraints = onMeasureDragConstraints(\n convertBoxToBoundingBox(measuredConstraints)\n )\n\n this.hasMutatedConstraints = !!userConstraints\n\n if (userConstraints) {\n measuredConstraints = convertBoundingBoxToBox(userConstraints)\n }\n }\n\n return measuredConstraints\n }\n\n private startAnimation(velocity: Point) {\n const {\n drag,\n dragMomentum,\n dragElastic,\n dragTransition,\n dragSnapToOrigin,\n onDragTransitionEnd,\n } = this.getProps()\n\n const constraints: Partial<ResolvedConstraints> = this.constraints || {}\n\n const momentumAnimations = eachAxis((axis) => {\n if (!shouldDrag(axis, drag, this.currentDirection)) {\n return\n }\n\n let transition = (constraints && constraints[axis]) || {}\n\n if (\n dragSnapToOrigin === true ||\n (dragSnapToOrigin as unknown) === axis\n )\n transition = { min: 0, max: 0 }\n\n /**\n * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame\n * of spring animations so we should look into adding a disable spring option to `inertia`.\n * We could do something here where we affect the `bounceStiffness` and `bounceDamping`\n * using the value of `dragElastic`.\n */\n const bounceStiffness = dragElastic ? 200 : 1000000\n const bounceDamping = dragElastic ? 40 : 10000000\n\n const inertia: Transition = {\n type: \"inertia\",\n velocity: dragMomentum ? velocity[axis] : 0,\n bounceStiffness,\n bounceDamping,\n timeConstant: 750,\n restDelta: 1,\n restSpeed: 10,\n ...dragTransition,\n ...transition,\n }\n\n // If we're not animating on an externally-provided `MotionValue` we can use the\n // component's animation controls which will handle interactions with whileHover (etc),\n // otherwise we just have to animate the `MotionValue` itself.\n return this.startAxisValueAnimation(axis, inertia)\n })\n\n // Run all animations and then resolve the new drag constraints.\n return Promise.all(momentumAnimations).then(onDragTransitionEnd)\n }\n\n private startAxisValueAnimation(\n axis: DragDirection,\n transition: Transition\n ) {\n const axisValue = this.getAxisMotionValue(axis)\n\n addValueToWillChange(this.visualElement, axis)\n\n return axisValue.start(\n animateMotionValue(\n axis,\n axisValue,\n 0,\n transition,\n this.visualElement,\n false\n )\n )\n }\n\n private stopAnimation() {\n eachAxis((axis) => this.getAxisMotionValue(axis).stop())\n }\n\n /**\n * Drag works differently depending on which props are provided.\n *\n * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.\n * - Otherwise, we apply the delta to the x/y motion values.\n */\n private getAxisMotionValue(axis: DragDirection) {\n const dragKey =\n `_drag${axis.toUpperCase()}` as `_drag${Uppercase<DragDirection>}`\n const props = this.visualElement.getProps()\n const externalMotionValue = props[dragKey]\n\n return externalMotionValue\n ? externalMotionValue\n : this.visualElement.getValue(\n axis,\n (props.initial\n ? props.initial[axis as keyof typeof props.initial]\n : undefined) || 0\n )\n }\n\n private snapToCursor(point: Point) {\n eachAxis((axis) => {\n const { drag } = this.getProps()\n\n // If we're not dragging this axis, do an early return.\n if (!shouldDrag(axis, drag, this.currentDirection)) return\n\n const { projection } = this.visualElement\n const axisValue = this.getAxisMotionValue(axis)\n\n if (projection && projection.layout) {\n const { min, max } = projection.layout.layoutBox[axis]\n\n /**\n * The layout measurement includes the current transform value,\n * so we need to add it back to get the correct snap position.\n * This fixes an issue where elements with initial coordinates\n * would snap to the wrong position on the first drag.\n */\n const current = axisValue.get() || 0\n\n axisValue.set(point[axis] - mixNumber(min, max, 0.5) + current)\n }\n })\n }\n\n /**\n * When the viewport resizes we want to check if the measured constraints\n * have changed and, if so, reposition the element within those new constraints\n * relative to where it was before the resize.\n */\n scalePositionWithinConstraints() {\n if (!this.visualElement.current) return\n\n const { drag, dragConstraints } = this.getProps()\n const { projection } = this.visualElement\n if (!isRefObject(dragConstraints) || !projection || !this.constraints)\n return\n\n /**\n * Stop current animations as there can be visual glitching if we try to do\n * this mid-animation\n */\n this.stopAnimation()\n\n /**\n * Record the relative position of the dragged element relative to the\n * constraints box and save as a progress value.\n */\n const boxProgress = { x: 0, y: 0 }\n eachAxis((axis) => {\n const axisValue = this.getAxisMotionValue(axis)\n if (axisValue && this.constraints !== false) {\n const latest = axisValue.get()\n boxProgress[axis] = calcOrigin(\n { min: latest, max: latest },\n this.constraints[axis] as Axis\n )\n }\n })\n\n /**\n * Update the layout of this element and resolve the latest drag constraints\n */\n const { transformTemplate } = this.visualElement.getProps()\n this.visualElement.current.style.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\"\n projection.root && projection.root.updateScroll()\n projection.updateLayout()\n\n /**\n * Reset constraints so resolveConstraints() will recalculate them\n * with the freshly measured layout rather than returning the cached value.\n */\n this.constraints = false\n this.resolveConstraints()\n\n /**\n * For each axis, calculate the current progress of the layout axis\n * within the new constraints.\n */\n eachAxis((axis) => {\n if (!shouldDrag(axis, drag, null)) return\n\n /**\n * Calculate a new transform based on the previous box progress\n */\n const axisValue = this.getAxisMotionValue(axis)\n const { min, max } = (this.constraints as ResolvedConstraints)[\n axis\n ] as Axis\n axisValue.set(mixNumber(min, max, boxProgress[axis]))\n })\n\n /**\n * Flush the updated transform to the DOM synchronously to prevent\n * a visual flash at the element's CSS layout position (0,0) when\n * the transform was stripped for measurement.\n */\n this.visualElement.render()\n }\n\n addListeners() {\n if (!this.visualElement.current) return\n elementDragControls.set(this.visualElement, this)\n const element = this.visualElement.current\n\n /**\n * Attach a pointerdown event listener on this DOM element to initiate drag tracking.\n */\n const stopPointerListener = addPointerEvent(\n element,\n \"pointerdown\",\n (event) => {\n const { drag, dragListener = true } = this.getProps()\n const target = event.target as Element\n\n /**\n * Only block drag if clicking on a text input child element\n * (input, textarea, select, contenteditable) where users might\n * want to select text or interact with the control.\n *\n * Buttons and links don't block drag since they don't have\n * click-and-move actions of their own.\n */\n const isClickingTextInputChild =\n target !== element && isElementTextInput(target)\n\n if (drag && dragListener && !isClickingTextInputChild) {\n this.start(event)\n }\n }\n )\n\n /**\n * If using ref-based constraints, observe both the draggable element\n * and the constraint container for size changes via ResizeObserver.\n * Setup is deferred because dragConstraints.current is null when\n * addListeners first runs (React hasn't committed the ref yet).\n */\n let stopResizeObservers: VoidFunction | undefined\n\n const measureDragConstraints = () => {\n const { dragConstraints } = this.getProps()\n if (isRefObject(dragConstraints) && dragConstraints.current) {\n this.constraints = this.resolveRefConstraints()\n\n if (!stopResizeObservers) {\n stopResizeObservers = startResizeObservers(\n element,\n dragConstraints.current as HTMLElement,\n () => this.scalePositionWithinConstraints()\n )\n }\n }\n }\n\n const { projection } = this.visualElement\n\n const stopMeasureLayoutListener = projection!.addEventListener(\n \"measure\",\n measureDragConstraints\n )\n\n if (projection && !projection!.layout) {\n projection.root && projection.root.updateScroll()\n projection.updateLayout()\n }\n\n frame.read(measureDragConstraints)\n\n /**\n * Attach a window resize listener to scale the draggable target within its defined\n * constraints as the window resizes.\n */\n const stopResizeListener = addDomEvent(window, \"resize\", () =>\n this.scalePositionWithinConstraints()\n )\n\n /**\n * If the element's layout changes, calculate the delta and apply that to\n * the drag gesture's origin point.\n */\n const stopLayoutUpdateListener = projection!.addEventListener(\n \"didUpdate\",\n (({ delta, hasLayoutChanged }: LayoutUpdateData) => {\n if (this.isDragging && hasLayoutChanged) {\n eachAxis((axis) => {\n const motionValue = this.getAxisMotionValue(axis)\n if (!motionValue) return\n\n this.originPoint[axis] += delta[axis].translate\n motionValue.set(\n motionValue.get() + delta[axis].translate\n )\n })\n\n this.visualElement.render()\n }\n }) as any\n )\n\n return () => {\n stopResizeListener()\n stopPointerListener()\n stopMeasureLayoutListener()\n stopLayoutUpdateListener && stopLayoutUpdateListener()\n stopResizeObservers && stopResizeObservers()\n }\n }\n\n getProps(): MotionProps {\n const props = this.visualElement.getProps()\n const {\n drag = false,\n dragDirectionLock = false,\n dragPropagation = false,\n dragConstraints = false,\n dragElastic = defaultElastic,\n dragMomentum = true,\n } = props\n return {\n ...props,\n drag,\n dragDirectionLock,\n dragPropagation,\n dragConstraints,\n dragElastic,\n dragMomentum,\n }\n }\n}\n\nfunction skipFirstCall(callback: VoidFunction): VoidFunction {\n let isFirst = true\n return () => {\n if (isFirst) {\n isFirst = false\n return\n }\n callback()\n }\n}\n\nfunction startResizeObservers(\n element: HTMLElement,\n constraintsElement: HTMLElement,\n onResize: VoidFunction\n): VoidFunction {\n const stopElement = resize(element, skipFirstCall(onResize))\n const stopContainer = resize(constraintsElement, skipFirstCall(onResize))\n return () => {\n stopElement()\n stopContainer()\n }\n}\n\nfunction shouldDrag(\n direction: DragDirection,\n drag: boolean | DragDirection | undefined,\n currentDirection: null | DragDirection\n) {\n return (\n (drag === true || drag === direction) &&\n (currentDirection === null || currentDirection === direction)\n )\n}\n\n/**\n * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower\n * than the provided threshold, return `null`.\n *\n * @param offset - The x/y offset from origin.\n * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.\n */\nfunction getCurrentDirection(\n offset: Point,\n lockThreshold = 10\n): DragDirection | null {\n let direction: DragDirection | null = null\n\n if (Math.abs(offset.y) > lockThreshold) {\n direction = \"y\"\n } else if (Math.abs(offset.x) > lockThreshold) {\n direction = \"x\"\n }\n\n return direction\n}\n\nexport function expectsResolvedDragConstraints({\n dragConstraints,\n onMeasureDragConstraints,\n}: MotionProps) {\n return isRefObject(dragConstraints) && !!onMeasureDragConstraints\n}\n","import { Feature, type VisualElement } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { VisualElementDragControls } from \"./VisualElementDragControls\"\n\nexport class DragGesture extends Feature<HTMLElement> {\n controls: VisualElementDragControls\n\n removeGroupControls: Function = noop\n removeListeners: Function = noop\n\n constructor(node: VisualElement<HTMLElement>) {\n super(node)\n this.controls = new VisualElementDragControls(node)\n }\n\n mount() {\n // If we've been provided a DragControls for manual control over the drag gesture,\n // subscribe this component to it on mount.\n const { dragControls } = this.node.getProps()\n\n if (dragControls) {\n this.removeGroupControls = dragControls.subscribe(this.controls)\n }\n\n this.removeListeners = this.controls.addListeners() || noop\n }\n\n update() {\n const { dragControls } = this.node.getProps()\n const { dragControls: prevDragControls } = this.node.prevProps || {}\n\n if (dragControls !== prevDragControls) {\n this.removeGroupControls()\n if (dragControls) {\n this.removeGroupControls = dragControls.subscribe(this.controls)\n }\n }\n }\n\n unmount() {\n this.removeGroupControls()\n this.removeListeners()\n /**\n * In React 19, during list reorder reconciliation, components may\n * briefly unmount and remount while the drag is still active. If we're\n * actively dragging, we should NOT end the pan session - it will\n * continue tracking pointer events via its window-level listeners.\n *\n * The pan session will be properly cleaned up when:\n * 1. The drag ends naturally (pointerup/pointercancel)\n * 2. The component is truly removed from the DOM\n */\n if (!this.controls.isDragging) {\n this.controls.endPanSession()\n }\n }\n}\n","import { Feature, frame, type PanInfo } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { getContextWindow } from \"../../utils/get-context-window\"\nimport { PanSession } from \"./PanSession\"\n\ntype PanEventHandler = (event: PointerEvent, info: PanInfo) => void\nconst asyncHandler =\n (handler?: PanEventHandler) => (event: PointerEvent, info: PanInfo) => {\n if (handler) {\n frame.update(() => handler(event, info), false, true)\n }\n }\n\nexport class PanGesture extends Feature<Element> {\n private session?: PanSession\n\n private removePointerDownListener: Function = noop\n\n onPointerDown(pointerDownEvent: PointerEvent) {\n this.session = new PanSession(\n pointerDownEvent,\n this.createPanHandlers(),\n {\n transformPagePoint: this.node.getTransformPagePoint(),\n contextWindow: getContextWindow(this.node),\n }\n )\n }\n\n createPanHandlers() {\n const { onPanSessionStart, onPanStart, onPan, onPanEnd } =\n this.node.getProps()\n\n return {\n onSessionStart: asyncHandler(onPanSessionStart),\n onStart: asyncHandler(onPanStart),\n onMove: asyncHandler(onPan),\n onEnd: (event: PointerEvent, info: PanInfo) => {\n delete this.session\n if (onPanEnd) {\n frame.postRender(() => onPanEnd(event, info))\n }\n },\n }\n }\n\n mount() {\n this.removePointerDownListener = addPointerEvent(\n this.node.current!,\n \"pointerdown\",\n (event: PointerEvent) => this.onPointerDown(event)\n )\n }\n\n update() {\n this.session && this.session.updateHandlers(this.createPanHandlers())\n }\n\n unmount() {\n this.removePointerDownListener()\n this.session && this.session.end()\n }\n}\n","\"use client\"\n\nimport { frame, microtask, globalProjectionState, type VisualElement } from \"motion-dom\"\nimport { Component, useContext } from \"react\"\nimport { usePresence } from \"../../../components/AnimatePresence/use-presence\"\nimport {\n LayoutGroupContext,\n LayoutGroupContextProps,\n} from \"../../../context/LayoutGroupContext\"\nimport { SwitchLayoutGroupContext } from \"../../../context/SwitchLayoutGroupContext\"\nimport { MotionProps } from \"../../types\"\n\ninterface MeasureContextProps {\n layoutGroup: LayoutGroupContextProps\n switchLayoutGroup?: SwitchLayoutGroupContext\n isPresent: boolean\n safeToRemove?: VoidFunction | null\n}\n\ntype MeasureProps = MotionProps &\n MeasureContextProps & { visualElement: VisualElement }\n\n/**\n * Track whether we've taken any snapshots yet. If not,\n * we can safely skip notification of didUpdate.\n *\n * Difficult to capture in a test but to prevent flickering\n * we must set this to true either on update or unmount.\n * Running `next-env/layout-id` in Safari will show this behaviour if broken.\n */\nlet hasTakenAnySnapshot = false\n\nclass MeasureLayoutWithContext extends Component<MeasureProps> {\n /**\n * This only mounts projection nodes for components that\n * need measuring, we might want to do it for all components\n * in order to incorporate transforms\n */\n componentDidMount() {\n const { visualElement, layoutGroup, switchLayoutGroup, layoutId } =\n this.props\n const { projection } = visualElement\n\n if (projection) {\n if (layoutGroup.group) layoutGroup.group.add(projection)\n\n if (switchLayoutGroup && switchLayoutGroup.register && layoutId) {\n switchLayoutGroup.register(projection)\n }\n\n if (hasTakenAnySnapshot) {\n projection.root!.didUpdate()\n }\n\n projection.addEventListener(\"animationComplete\", () => {\n this.safeToRemove()\n })\n projection.setOptions({\n ...projection.options,\n layoutDependency: this.props.layoutDependency,\n onExitComplete: () => this.safeToRemove(),\n })\n }\n\n globalProjectionState.hasEverUpdated = true\n }\n\n getSnapshotBeforeUpdate(prevProps: MeasureProps) {\n const { layoutDependency, visualElement, drag, isPresent } = this.props\n const { projection } = visualElement\n\n if (!projection) return null\n\n /**\n * TODO: We use this data in relegate to determine whether to\n * promote a previous element. There's no guarantee its presence data\n * will have updated by this point - if a bug like this arises it will\n * have to be that we markForRelegation and then find a new lead some other way,\n * perhaps in didUpdate\n */\n projection.isPresent = isPresent\n\n if (prevProps.layoutDependency !== layoutDependency) {\n projection.setOptions({\n ...projection.options,\n layoutDependency,\n })\n }\n\n hasTakenAnySnapshot = true\n\n if (\n drag ||\n prevProps.layoutDependency !== layoutDependency ||\n layoutDependency === undefined ||\n prevProps.isPresent !== isPresent\n ) {\n projection.willUpdate()\n } else {\n this.safeToRemove()\n }\n\n if (prevProps.isPresent !== isPresent) {\n if (isPresent) {\n projection.promote()\n } else if (!projection.relegate()) {\n /**\n * If there's another stack member taking over from this one,\n * it's in charge of the exit animation and therefore should\n * be in charge of the safe to remove. Otherwise we call it here.\n */\n frame.postRender(() => {\n const stack = projection.getStack()\n if (!stack || !stack.members.length) {\n this.safeToRemove()\n }\n })\n }\n }\n\n return null\n }\n\n componentDidUpdate() {\n const { projection } = this.props.visualElement\n if (projection) {\n projection.root!.didUpdate()\n\n microtask.postRender(() => {\n if (!projection.currentAnimation && projection.isLead()) {\n this.safeToRemove()\n }\n })\n }\n }\n\n componentWillUnmount() {\n const {\n visualElement,\n layoutGroup,\n switchLayoutGroup: promoteContext,\n } = this.props\n const { projection } = visualElement\n\n hasTakenAnySnapshot = true\n\n if (projection) {\n projection.scheduleCheckAfterUnmount()\n if (layoutGroup && layoutGroup.group)\n layoutGroup.group.remove(projection)\n if (promoteContext && promoteContext.deregister)\n promoteContext.deregister(projection)\n }\n }\n\n safeToRemove() {\n const { safeToRemove } = this.props\n safeToRemove && safeToRemove()\n }\n\n render() {\n return null\n }\n}\n\nexport function MeasureLayout(\n props: MotionProps & { visualElement: VisualElement }\n) {\n const [isPresent, safeToRemove] = usePresence()\n const layoutGroup = useContext(LayoutGroupContext)\n\n return (\n <MeasureLayoutWithContext\n {...props}\n layoutGroup={layoutGroup}\n switchLayoutGroup={useContext(SwitchLayoutGroupContext)}\n isPresent={isPresent}\n safeToRemove={safeToRemove}\n />\n )\n}\n","import { DragGesture } from \"../../gestures/drag\"\nimport { PanGesture } from \"../../gestures/pan\"\nimport { HTMLProjectionNode } from \"../../projection\"\nimport { MeasureLayout } from \"./layout/MeasureLayout\"\nimport { FeaturePackages } from \"./types\"\n\nexport const drag: FeaturePackages = {\n pan: {\n Feature: PanGesture,\n },\n drag: {\n Feature: DragGesture,\n ProjectionNode: HTMLProjectionNode,\n MeasureLayout,\n },\n}\n","import { Feature, frame, hover, type VisualElement } from \"motion-dom\"\nimport { extractEventInfo } from \"../events/event-info\"\n\nfunction handleHoverEvent(\n node: VisualElement<Element>,\n event: PointerEvent,\n lifecycle: \"Start\" | \"End\"\n) {\n const { props } = node\n\n if (node.animationState && props.whileHover) {\n node.animationState.setActive(\"whileHover\", lifecycle === \"Start\")\n }\n\n const eventName = (\"onHover\" + lifecycle) as \"onHoverStart\" | \"onHoverEnd\"\n const callback = props[eventName]\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)))\n }\n}\n\nexport class HoverGesture extends Feature<Element> {\n mount() {\n const { current } = this.node\n if (!current) return\n\n this.unmount = hover(current, (_element, startEvent) => {\n handleHoverEvent(this.node, startEvent, \"Start\")\n\n return (endEvent) => handleHoverEvent(this.node, endEvent, \"End\")\n })\n }\n\n unmount() {}\n}\n","import { Feature, addDomEvent } from \"motion-dom\"\nimport { pipe } from \"motion-utils\"\n\nexport class FocusGesture extends Feature<Element> {\n private isActive = false\n\n onFocus() {\n let isFocusVisible = false\n\n /**\n * If this element doesn't match focus-visible then don't\n * apply whileHover. But, if matches throws that focus-visible\n * is not a valid selector then in that browser outline styles will be applied\n * to the element by default and we want to match that behaviour with whileFocus.\n */\n try {\n isFocusVisible = this.node.current!.matches(\":focus-visible\")\n } catch (e) {\n isFocusVisible = true\n }\n\n if (!isFocusVisible || !this.node.animationState) return\n\n this.node.animationState.setActive(\"whileFocus\", true)\n this.isActive = true\n }\n\n onBlur() {\n if (!this.isActive || !this.node.animationState) return\n this.node.animationState.setActive(\"whileFocus\", false)\n this.isActive = false\n }\n\n mount() {\n this.unmount = pipe(\n addDomEvent(this.node.current!, \"focus\", () => this.onFocus()),\n addDomEvent(this.node.current!, \"blur\", () => this.onBlur())\n ) as VoidFunction\n }\n\n unmount() {}\n}\n","import { Feature, frame, press, type VisualElement } from \"motion-dom\"\nimport { extractEventInfo } from \"../events/event-info\"\n\nfunction handlePressEvent(\n node: VisualElement<Element>,\n event: PointerEvent,\n lifecycle: \"Start\" | \"End\" | \"Cancel\"\n) {\n const { props } = node\n\n if (node.current instanceof HTMLButtonElement && node.current.disabled) {\n return\n }\n\n if (node.animationState && props.whileTap) {\n node.animationState.setActive(\"whileTap\", lifecycle === \"Start\")\n }\n\n const eventName = (\"onTap\" + (lifecycle === \"End\" ? \"\" : lifecycle)) as\n | \"onTapStart\"\n | \"onTap\"\n | \"onTapCancel\"\n\n const callback = props[eventName]\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)))\n }\n}\n\nexport class PressGesture extends Feature<Element> {\n mount() {\n const { current } = this.node\n if (!current) return\n\n const { globalTapTarget, propagate } = this.node.props\n\n this.unmount = press(\n current,\n (_element, startEvent) => {\n handlePressEvent(this.node, startEvent, \"Start\")\n\n return (endEvent, { success }) =>\n handlePressEvent(\n this.node,\n endEvent,\n success ? \"End\" : \"Cancel\"\n )\n },\n {\n useGlobalTarget: globalTapTarget,\n stopPropagation: propagate?.tap === false,\n }\n )\n }\n\n unmount() {}\n}\n","type IntersectionHandler = (entry: IntersectionObserverEntry) => void\n\ninterface ElementIntersectionObservers {\n [key: string]: IntersectionObserver\n}\n\n/**\n * Map an IntersectionHandler callback to an element. We only ever make one handler for one\n * element, so even though these handlers might all be triggered by different\n * observers, we can keep them in the same map.\n */\nconst observerCallbacks = new WeakMap<Element, IntersectionHandler>()\n\n/**\n * Multiple observers can be created for multiple element/document roots. Each with\n * different settings. So here we store dictionaries of observers to each root,\n * using serialised settings (threshold/margin) as lookup keys.\n */\nconst observers = new WeakMap<\n Element | Document,\n ElementIntersectionObservers\n>()\n\nconst fireObserverCallback = (entry: IntersectionObserverEntry) => {\n const callback = observerCallbacks.get(entry.target)\n callback && callback(entry)\n}\n\nconst fireAllObserverCallbacks: IntersectionObserverCallback = (entries) => {\n entries.forEach(fireObserverCallback)\n}\n\nfunction initIntersectionObserver({\n root,\n ...options\n}: IntersectionObserverInit): IntersectionObserver {\n const lookupRoot = root || document\n\n /**\n * If we don't have an observer lookup map for this root, create one.\n */\n if (!observers.has(lookupRoot)) {\n observers.set(lookupRoot, {})\n }\n const rootObservers = observers.get(lookupRoot)!\n\n const key = JSON.stringify(options)\n\n /**\n * If we don't have an observer for this combination of root and settings,\n * create one.\n */\n if (!rootObservers[key]) {\n rootObservers[key] = new IntersectionObserver(\n fireAllObserverCallbacks,\n { root, ...options }\n )\n }\n\n return rootObservers[key]\n}\n\nexport function observeIntersection(\n element: Element,\n options: IntersectionObserverInit,\n callback: IntersectionHandler\n) {\n const rootInteresectionObserver = initIntersectionObserver(options)\n\n observerCallbacks.set(element, callback)\n rootInteresectionObserver.observe(element)\n\n return () => {\n observerCallbacks.delete(element)\n rootInteresectionObserver.unobserve(element)\n }\n}\n","import { Feature } from \"motion-dom\"\nimport { MotionProps } from \"../../types\"\nimport { observeIntersection } from \"./observers\"\n\nconst thresholdNames = {\n some: 0,\n all: 1,\n}\n\nexport class InViewFeature extends Feature<Element> {\n private hasEnteredView = false\n\n private isInView = false\n\n private startObserver() {\n this.unmount()\n\n const { viewport = {} } = this.node.getProps()\n const { root, margin: rootMargin, amount = \"some\", once } = viewport\n\n const options = {\n root: root ? root.current : undefined,\n rootMargin,\n threshold:\n typeof amount === \"number\" ? amount : thresholdNames[amount],\n }\n\n const onIntersectionUpdate = (entry: IntersectionObserverEntry) => {\n const { isIntersecting } = entry\n\n /**\n * If there's been no change in the viewport state, early return.\n */\n if (this.isInView === isIntersecting) return\n\n this.isInView = isIntersecting\n\n /**\n * Handle hasEnteredView. If this is only meant to run once, and\n * element isn't visible, early return. Otherwise set hasEnteredView to true.\n */\n if (once && !isIntersecting && this.hasEnteredView) {\n return\n } else if (isIntersecting) {\n this.hasEnteredView = true\n }\n\n if (this.node.animationState) {\n this.node.animationState.setActive(\n \"whileInView\",\n isIntersecting\n )\n }\n\n /**\n * Use the latest committed props rather than the ones in scope\n * when this observer is created\n */\n const { onViewportEnter, onViewportLeave } = this.node.getProps()\n const callback = isIntersecting ? onViewportEnter : onViewportLeave\n callback && callback(entry)\n }\n\n return observeIntersection(\n this.node.current!,\n options,\n onIntersectionUpdate\n )\n }\n\n mount() {\n this.startObserver()\n }\n\n update() {\n if (typeof IntersectionObserver === \"undefined\") return\n\n const { props, prevProps } = this.node\n const hasOptionsChanged = [\"amount\", \"margin\", \"root\"].some(\n hasViewportOptionChanged(props, prevProps)\n )\n\n if (hasOptionsChanged) {\n this.startObserver()\n }\n }\n\n unmount() {}\n}\n\nfunction hasViewportOptionChanged(\n { viewport = {} }: MotionProps,\n { viewport: prevViewport = {} }: MotionProps = {}\n) {\n return (name: keyof typeof viewport) =>\n viewport[name] !== prevViewport[name]\n}\n","import { HoverGesture } from \"../../gestures/hover\"\nimport { FocusGesture } from \"../../gestures/focus\"\nimport { PressGesture } from \"../../gestures/press\"\nimport { InViewFeature } from \"./viewport\"\nimport { FeaturePackages } from \"./types\"\n\nexport const gestureAnimations: FeaturePackages = {\n inView: {\n Feature: InViewFeature,\n },\n tap: {\n Feature: PressGesture,\n },\n focus: {\n Feature: FocusGesture,\n },\n hover: {\n Feature: HoverGesture,\n },\n}\n","import { HTMLProjectionNode } from \"motion-dom\"\nimport { MeasureLayout } from \"./layout/MeasureLayout\"\nimport { FeaturePackages } from \"./types\"\n\nexport const layout: FeaturePackages = {\n layout: {\n ProjectionNode: HTMLProjectionNode,\n MeasureLayout,\n },\n}\n","import { animations } from \"../../../motion/features/animations\"\nimport { drag } from \"../../../motion/features/drag\"\nimport { gestureAnimations } from \"../../../motion/features/gestures\"\nimport { layout } from \"../../../motion/features/layout\"\n\nexport const featureBundle = {\n ...animations,\n ...gestureAnimations,\n ...drag,\n ...layout,\n}\n"],"names":["createContext","useRef","useLayoutEffect","useEffect","useContext","useId","useCallback","setFeatureDefinitions","getFeatureDefinitions","isMotionValue","SVGVisualElement","HTMLVisualElement","Fragment","isControllingVariants","isVariantLabel","useMemo","isForcedMotionValue","buildHTMLStyles","buildSVGAttrs","isSVGTag","createElement","resolveMotionValue","checkIsControllingVariants","checkIsVariantNode","isAnimationControls","resolveVariantFromProps","scrapeHTMLMotionValuesFromProps","scrapeSVGMotionValuesFromProps","useInsertionEffect","optimizedAppearDataAttribute","_jsxs","_jsx","forwardRef","warning","invariant","Feature","createAnimationState","resolveVariant","isPrimaryPointer","addDomEvent","frameData","frame","pipe","cancelFrame","secondsToMilliseconds","millisecondsToSeconds","mixNumber","calcLength","calcProgress","clamp","createBox","setDragLock","eachAxis","percent","addValueToWillChange","measurePageBox","convertBoxToBoundingBox","convertBoundingBoxToBox","animateMotionValue","isElementTextInput","resize","noop","Component","globalProjectionState","microtask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