framer-motion 12.34.2 → 12.34.4
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/README.md +3 -5
- package/dist/cjs/client.js +1 -1
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/dom-mini.js.map +1 -1
- package/dist/cjs/dom.js +8 -16
- package/dist/cjs/dom.js.map +1 -1
- package/dist/cjs/{feature-bundle-Cb13qNcx.js → feature-bundle-CUI5saed.js} +2 -5
- package/dist/cjs/feature-bundle-CUI5saed.js.map +1 -0
- package/dist/cjs/index.js +9 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/m.js +3 -9
- package/dist/cjs/m.js.map +1 -1
- package/dist/cjs/mini.js.map +1 -1
- package/dist/dom-mini.d.ts +1 -0
- package/dist/dom.d.ts +1 -0
- package/dist/dom.js +1 -1
- package/dist/es/animation/animate/index.mjs +6 -2
- package/dist/es/animation/animate/index.mjs.map +1 -1
- package/dist/es/animation/animate/resolve-subjects.mjs.map +1 -1
- package/dist/es/animation/animate/sequence.mjs.map +1 -1
- package/dist/es/animation/animate/subject.mjs.map +1 -1
- package/dist/es/animation/animators/waapi/animate-elements.mjs.map +1 -1
- package/dist/es/animation/animators/waapi/animate-sequence.mjs.map +1 -1
- package/dist/es/animation/animators/waapi/animate-style.mjs.map +1 -1
- package/dist/es/animation/hooks/animation-controls.mjs.map +1 -1
- package/dist/es/animation/optimized-appear/handoff.mjs.map +1 -1
- package/dist/es/animation/optimized-appear/start.mjs.map +1 -1
- package/dist/es/animation/optimized-appear/store-id.mjs.map +1 -1
- package/dist/es/animation/optimized-appear/store.mjs.map +1 -1
- package/dist/es/animation/sequence/create.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/calc-repeat-duration.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/calc-time.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/edit.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/normalize-times.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/sort.mjs.map +1 -1
- package/dist/es/animation/utils/create-visual-element.mjs.map +1 -1
- package/dist/es/animation/utils/is-dom-keyframes.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/PopChild.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/PresenceChild.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/index.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/use-presence.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/utils.mjs.map +1 -1
- package/dist/es/components/Reorder/Group.mjs.map +1 -1
- package/dist/es/components/Reorder/Item.mjs.map +1 -1
- package/dist/es/components/Reorder/utils/auto-scroll.mjs.map +1 -1
- package/dist/es/components/Reorder/utils/check-reorder.mjs.map +1 -1
- package/dist/es/context/MotionContext/index.mjs.map +1 -1
- package/dist/es/context/MotionContext/utils.mjs.map +1 -1
- package/dist/es/events/add-pointer-event.mjs.map +1 -1
- package/dist/es/events/event-info.mjs.map +1 -1
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +1 -1
- package/dist/es/gestures/drag/VisualElementDragControls.mjs.map +1 -1
- package/dist/es/gestures/drag/index.mjs.map +1 -1
- package/dist/es/gestures/drag/use-drag-controls.mjs.map +1 -1
- package/dist/es/gestures/drag/utils/constraints.mjs.map +1 -1
- package/dist/es/gestures/focus.mjs.map +1 -1
- package/dist/es/gestures/hover.mjs.map +1 -1
- package/dist/es/gestures/pan/PanSession.mjs +2 -5
- package/dist/es/gestures/pan/PanSession.mjs.map +1 -1
- package/dist/es/gestures/pan/index.mjs.map +1 -1
- package/dist/es/gestures/press.mjs.map +1 -1
- package/dist/es/index.mjs +2 -2
- package/dist/es/m.mjs +1 -1
- package/dist/es/motion/features/animation/exit.mjs.map +1 -1
- package/dist/es/motion/features/animation/index.mjs.map +1 -1
- package/dist/es/motion/features/animations.mjs.map +1 -1
- package/dist/es/motion/features/definitions.mjs.map +1 -1
- package/dist/es/motion/features/drag.mjs.map +1 -1
- package/dist/es/motion/features/gestures.mjs.map +1 -1
- package/dist/es/motion/features/layout.mjs.map +1 -1
- package/dist/es/motion/features/load-features.mjs.map +1 -1
- package/dist/es/motion/features/viewport/index.mjs.map +1 -1
- package/dist/es/motion/features/viewport/observers.mjs.map +1 -1
- package/dist/es/motion/utils/is-motion-component.mjs.map +1 -1
- package/dist/es/motion/utils/symbol.mjs.map +1 -1
- package/dist/es/motion/utils/unwrap-motion-component.mjs.map +1 -1
- package/dist/es/motion/utils/use-visual-element.mjs.map +1 -1
- package/dist/es/motion/utils/valid-prop.mjs.map +1 -1
- package/dist/es/projection/use-instant-layout-transition.mjs.map +1 -1
- package/dist/es/projection/use-reset-projection.mjs.map +1 -1
- package/dist/es/render/components/create-proxy.mjs.map +1 -1
- package/dist/es/render/components/m/create.mjs.map +1 -1
- package/dist/es/render/components/m/elements.mjs.map +1 -1
- package/dist/es/render/components/motion/create.mjs.map +1 -1
- package/dist/es/render/components/motion/elements.mjs.map +1 -1
- package/dist/es/render/components/motion/feature-bundle.mjs.map +1 -1
- package/dist/es/render/dom/create-visual-element.mjs.map +1 -1
- package/dist/es/render/dom/features-animation.mjs.map +1 -1
- package/dist/es/render/dom/features-max.mjs.map +1 -1
- package/dist/es/render/dom/features-min.mjs.map +1 -1
- package/dist/es/render/dom/scroll/attach-animation.mjs.map +1 -1
- package/dist/es/render/dom/scroll/attach-function.mjs.map +1 -1
- package/dist/es/render/dom/scroll/index.mjs.map +1 -1
- package/dist/es/render/dom/scroll/info.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/edge.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/index.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/inset.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/offset.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/presets.mjs +0 -12
- package/dist/es/render/dom/scroll/offsets/presets.mjs.map +1 -1
- package/dist/es/render/dom/scroll/on-scroll-handler.mjs.map +1 -1
- package/dist/es/render/dom/scroll/track.mjs +2 -2
- package/dist/es/render/dom/scroll/track.mjs.map +1 -1
- package/dist/es/render/dom/scroll/utils/can-use-native-timeline.mjs.map +1 -1
- package/dist/es/render/dom/scroll/utils/get-timeline.mjs.map +1 -1
- package/dist/es/render/dom/utils/filter-props.mjs.map +1 -1
- package/dist/es/render/dom/utils/is-svg-component.mjs.map +1 -1
- package/dist/es/render/dom/viewport/index.mjs.map +1 -1
- package/dist/es/render/html/use-html-visual-state.mjs.map +1 -1
- package/dist/es/render/html/use-props.mjs.map +1 -1
- package/dist/es/render/html/utils/create-render-state.mjs.map +1 -1
- package/dist/es/render/svg/lowercase-elements.mjs.map +1 -1
- package/dist/es/render/svg/use-svg-visual-state.mjs.map +1 -1
- package/dist/es/render/svg/utils/create-render-state.mjs.map +1 -1
- package/dist/es/utils/distance.mjs.map +1 -1
- package/dist/es/utils/get-context-window.mjs.map +1 -1
- package/dist/es/utils/is-ref-object.mjs.map +1 -1
- package/dist/es/utils/transform-viewbox-point.mjs.map +1 -1
- package/dist/es/utils/use-composed-ref.mjs.map +1 -1
- package/dist/es/utils/use-cycle.mjs.map +1 -1
- package/dist/es/value/scroll/use-element-scroll.mjs.map +1 -1
- package/dist/es/value/scroll/use-viewport-scroll.mjs.map +1 -1
- package/dist/es/value/use-combine-values.mjs.map +1 -1
- package/dist/es/value/use-will-change/WillChangeMotionValue.mjs.map +1 -1
- package/dist/framer-motion.dev.js +15 -9
- 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.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.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/size-rollup-waapi-animate.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types.d-DOCC-kZB.d.ts +223 -0
- package/package.json +3 -3
- package/dist/cjs/feature-bundle-Cb13qNcx.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-composed-ref.mjs","sources":["../../../src/utils/use-composed-ref.ts"],"sourcesContent":["/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\nimport * as React from \"react\"\n\ntype PossibleRef<T> = React.Ref<T> | undefined\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T): void | (() => void) {\n if (typeof ref === \"function\") {\n return ref(value)\n } else if (ref !== null && ref !== undefined) {\n ;(ref as React.MutableRefObject<T>).current = value\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node)\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true\n }\n return cleanup\n })\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i]\n if (typeof cleanup === \"function\") {\n cleanup()\n } else {\n setRef(refs[i], null)\n }\n }\n }\n }\n }\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs)\n}\n\nexport { useComposedRefs }\n"],"names":[],"mappings":";;AAAA;;AAEG;AAKH;;;AAGG;AACH,SAAS,MAAM,CAAI,GAAmB,EAAE,KAAQ,EAAA;AAC5C,IAAA,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;AAC3B,QAAA,OAAO,GAAG,CAAC,KAAK,CAAC
|
|
1
|
+
{"version":3,"file":"use-composed-ref.mjs","sources":["../../../src/utils/use-composed-ref.ts"],"sourcesContent":["/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\nimport * as React from \"react\"\n\ntype PossibleRef<T> = React.Ref<T> | undefined\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T): void | (() => void) {\n if (typeof ref === \"function\") {\n return ref(value)\n } else if (ref !== null && ref !== undefined) {\n ;(ref as React.MutableRefObject<T>).current = value\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node)\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true\n }\n return cleanup\n })\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i]\n if (typeof cleanup === \"function\") {\n cleanup()\n } else {\n setRef(refs[i], null)\n }\n }\n }\n }\n }\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs)\n}\n\nexport { useComposedRefs }\n"],"names":[],"mappings":";;AAAA;;AAEG;AAKH;;;AAGG;AACH,SAAS,MAAM,CAAI,GAAmB,EAAE,KAAQ,EAAA;AAC5C,IAAA,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;AAC3B,QAAA,OAAO,GAAG,CAAC,KAAK,CAAC;IACrB;SAAO,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE;AACxC,QAAA,GAAiC,CAAC,OAAO,GAAG,KAAK;IACvD;AACJ;AAEA;;;AAGG;AACH,SAAS,WAAW,CAAI,GAAG,IAAsB,EAAA;IAC7C,OAAO,CAAC,IAAI,KAAI;QACZ,IAAI,UAAU,GAAG,KAAK;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAI;YAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC;YACjC,IAAI,CAAC,UAAU,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;gBAC9C,UAAU,GAAG,IAAI;YACrB;AACA,YAAA,OAAO,OAAO;AAClB,QAAA,CAAC,CAAC;;;;;QAKF,IAAI,UAAU,EAAE;AACZ,YAAA,OAAO,MAAK;AACR,gBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACtC,oBAAA,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC;AAC3B,oBAAA,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;AAC/B,wBAAA,OAAO,EAAE;oBACb;yBAAO;wBACH,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;oBACzB;gBACJ;AACJ,YAAA,CAAC;QACL;AACJ,IAAA,CAAC;AACL;AAEA;;;AAGG;AACH,SAAS,eAAe,CAAI,GAAG,IAAsB,EAAA;;AAEjD,IAAA,OAAO,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,CAAC;AACxD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-cycle.mjs","sources":["../../../src/utils/use-cycle.ts"],"sourcesContent":["\"use client\"\n\nimport { wrap } from \"motion-utils\"\nimport { useCallback, useRef, useState } from \"react\"\n\nexport type Cycle = (i?: number) => void\n\nexport type CycleState<T> = [T, Cycle]\n\n/**\n * Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments.\n *\n * An index value can be passed to the returned `cycle` function to cycle to a specific index.\n *\n * ```jsx\n * import * as React from \"react\"\n * import { motion, useCycle } from \"framer-motion\"\n *\n * export const MyComponent = () => {\n * const [x, cycleX] = useCycle(0, 50, 100)\n *\n * return (\n * <motion.div\n * animate={{ x: x }}\n * onTap={() => cycleX()}\n * />\n * )\n * }\n * ```\n *\n * @param items - items to cycle through\n * @returns [currentState, cycleState]\n *\n * @public\n */\nexport function useCycle<T>(...items: T[]): CycleState<T> {\n const index = useRef(0)\n const [item, setItem] = useState(items[index.current])\n\n const runCycle = useCallback(\n (next?: number) => {\n index.current =\n typeof next !== \"number\"\n ? wrap(0, items.length, index.current + 1)\n : next\n\n setItem(items[index.current])\n },\n // The array will change on each call, but by putting items.length at\n // the front of this array, we guarantee the dependency comparison will match up\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [items.length, ...items]\n )\n return [item, runCycle]\n}\n"],"names":[],"mappings":";;;;AASA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;
|
|
1
|
+
{"version":3,"file":"use-cycle.mjs","sources":["../../../src/utils/use-cycle.ts"],"sourcesContent":["\"use client\"\n\nimport { wrap } from \"motion-utils\"\nimport { useCallback, useRef, useState } from \"react\"\n\nexport type Cycle = (i?: number) => void\n\nexport type CycleState<T> = [T, Cycle]\n\n/**\n * Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments.\n *\n * An index value can be passed to the returned `cycle` function to cycle to a specific index.\n *\n * ```jsx\n * import * as React from \"react\"\n * import { motion, useCycle } from \"framer-motion\"\n *\n * export const MyComponent = () => {\n * const [x, cycleX] = useCycle(0, 50, 100)\n *\n * return (\n * <motion.div\n * animate={{ x: x }}\n * onTap={() => cycleX()}\n * />\n * )\n * }\n * ```\n *\n * @param items - items to cycle through\n * @returns [currentState, cycleState]\n *\n * @public\n */\nexport function useCycle<T>(...items: T[]): CycleState<T> {\n const index = useRef(0)\n const [item, setItem] = useState(items[index.current])\n\n const runCycle = useCallback(\n (next?: number) => {\n index.current =\n typeof next !== \"number\"\n ? wrap(0, items.length, index.current + 1)\n : next\n\n setItem(items[index.current])\n },\n // The array will change on each call, but by putting items.length at\n // the front of this array, we guarantee the dependency comparison will match up\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [items.length, ...items]\n )\n return [item, runCycle]\n}\n"],"names":[],"mappings":";;;;AASA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG;AACF;AACA;AAEA;AAEQ;;AAEQ;;;;;;;;AAUhB;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-element-scroll.mjs","sources":["../../../../src/value/scroll/use-element-scroll.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { RefObject } from \"react\"\nimport { useScroll } from \"../use-scroll\"\n\n/**\n * @deprecated useElementScroll is deprecated. Convert to useScroll({ container: ref })\n */\nexport function useElementScroll(ref: RefObject<HTMLElement | null>) {\n if (process.env.NODE_ENV === \"development\") {\n warnOnce(\n false,\n \"useElementScroll is deprecated. Convert to useScroll({ container: ref }).\"\n )\n }\n\n return useScroll({ container: ref })\n}\n"],"names":[],"mappings":";;;AAIA;;AAEG;AACG,SAAU,gBAAgB,CAAC,GAAkC,EAAA;IAC/D,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;AACxC,QAAA,QAAQ,CACJ,KAAK,EACL,2EAA2E,CAC9E
|
|
1
|
+
{"version":3,"file":"use-element-scroll.mjs","sources":["../../../../src/value/scroll/use-element-scroll.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { RefObject } from \"react\"\nimport { useScroll } from \"../use-scroll\"\n\n/**\n * @deprecated useElementScroll is deprecated. Convert to useScroll({ container: ref })\n */\nexport function useElementScroll(ref: RefObject<HTMLElement | null>) {\n if (process.env.NODE_ENV === \"development\") {\n warnOnce(\n false,\n \"useElementScroll is deprecated. Convert to useScroll({ container: ref }).\"\n )\n }\n\n return useScroll({ container: ref })\n}\n"],"names":[],"mappings":";;;AAIA;;AAEG;AACG,SAAU,gBAAgB,CAAC,GAAkC,EAAA;IAC/D,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;AACxC,QAAA,QAAQ,CACJ,KAAK,EACL,2EAA2E,CAC9E;IACL;IAEA,OAAO,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;AACxC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-viewport-scroll.mjs","sources":["../../../../src/value/scroll/use-viewport-scroll.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { useScroll } from \"../use-scroll\"\n\n/**\n * @deprecated useViewportScroll is deprecated. Convert to useScroll()\n */\nexport function useViewportScroll() {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(\n false,\n \"useViewportScroll is deprecated. Convert to useScroll().\"\n )\n }\n return useScroll()\n}\n"],"names":[],"mappings":";;;AAGA;;AAEG;SACa,iBAAiB,GAAA;IAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AACvC,QAAA,QAAQ,CACJ,KAAK,EACL,0DAA0D,CAC7D
|
|
1
|
+
{"version":3,"file":"use-viewport-scroll.mjs","sources":["../../../../src/value/scroll/use-viewport-scroll.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { useScroll } from \"../use-scroll\"\n\n/**\n * @deprecated useViewportScroll is deprecated. Convert to useScroll()\n */\nexport function useViewportScroll() {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(\n false,\n \"useViewportScroll is deprecated. Convert to useScroll().\"\n )\n }\n return useScroll()\n}\n"],"names":[],"mappings":";;;AAGA;;AAEG;SACa,iBAAiB,GAAA;IAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AACvC,QAAA,QAAQ,CACJ,KAAK,EACL,0DAA0D,CAC7D;IACL;IACA,OAAO,SAAS,EAAE;AACtB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-combine-values.mjs","sources":["../../../src/value/use-combine-values.ts"],"sourcesContent":["\"use client\"\n\nimport { cancelFrame, frame, MotionValue } from \"motion-dom\"\nimport { useIsomorphicLayoutEffect } from \"../utils/use-isomorphic-effect\"\nimport { useMotionValue } from \"./use-motion-value\"\n\nexport function useCombineMotionValues<R>(\n values: MotionValue[],\n combineValues: () => R\n) {\n /**\n * Initialise the returned motion value. This remains the same between renders.\n */\n const value = useMotionValue(combineValues())\n\n /**\n * Create a function that will update the template motion value with the latest values.\n * This is pre-bound so whenever a motion value updates it can schedule its\n * execution in Framesync. If it's already been scheduled it won't be fired twice\n * in a single frame.\n */\n const updateValue = () => value.set(combineValues())\n\n /**\n * Synchronously update the motion value with the latest values during the render.\n * This ensures that within a React render, the styles applied to the DOM are up-to-date.\n */\n updateValue()\n\n /**\n * Subscribe to all motion values found within the template. Whenever any of them change,\n * schedule an update.\n */\n useIsomorphicLayoutEffect(() => {\n const scheduleUpdate = () => frame.preRender(updateValue, false, true)\n const subscriptions = values.map((v) => v.on(\"change\", scheduleUpdate))\n\n return () => {\n subscriptions.forEach((unsubscribe) => unsubscribe())\n cancelFrame(updateValue)\n }\n })\n\n return value\n}\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"use-combine-values.mjs","sources":["../../../src/value/use-combine-values.ts"],"sourcesContent":["\"use client\"\n\nimport { cancelFrame, frame, MotionValue } from \"motion-dom\"\nimport { useIsomorphicLayoutEffect } from \"../utils/use-isomorphic-effect\"\nimport { useMotionValue } from \"./use-motion-value\"\n\nexport function useCombineMotionValues<R>(\n values: MotionValue[],\n combineValues: () => R\n) {\n /**\n * Initialise the returned motion value. This remains the same between renders.\n */\n const value = useMotionValue(combineValues())\n\n /**\n * Create a function that will update the template motion value with the latest values.\n * This is pre-bound so whenever a motion value updates it can schedule its\n * execution in Framesync. If it's already been scheduled it won't be fired twice\n * in a single frame.\n */\n const updateValue = () => value.set(combineValues())\n\n /**\n * Synchronously update the motion value with the latest values during the render.\n * This ensures that within a React render, the styles applied to the DOM are up-to-date.\n */\n updateValue()\n\n /**\n * Subscribe to all motion values found within the template. Whenever any of them change,\n * schedule an update.\n */\n useIsomorphicLayoutEffect(() => {\n const scheduleUpdate = () => frame.preRender(updateValue, false, true)\n const subscriptions = values.map((v) => v.on(\"change\", scheduleUpdate))\n\n return () => {\n subscriptions.forEach((unsubscribe) => unsubscribe())\n cancelFrame(updateValue)\n }\n })\n\n return value\n}\n"],"names":[],"mappings":";;;;;AAMM;AAIF;;AAEG;AACH;AAEA;;;;;AAKG;AACH;AAEA;;;AAGG;AACH;AAEA;;;AAGG;;AAEC;;AAGA;;;AAGA;AACJ;AAEA;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WillChangeMotionValue.mjs","sources":["../../../../src/value/use-will-change/WillChangeMotionValue.ts"],"sourcesContent":["import {\n acceleratedValues,\n MotionValue,\n transformProps,\n type WillChange,\n} from \"motion-dom\"\n\nexport class WillChangeMotionValue\n extends MotionValue<string>\n implements WillChange\n{\n private isEnabled = false\n\n add(name: string) {\n if (transformProps.has(name) || acceleratedValues.has(name)) {\n this.isEnabled = true\n this.update()\n }\n }\n\n private update() {\n this.set(this.isEnabled ? \"transform\" : \"auto\")\n }\n}\n"],"names":[],"mappings":";;AAOM,MAAO,qBACT,SAAQ,WAAmB,CAAA;AAD/B,IAAA,WAAA,GAAA;;QAIY,
|
|
1
|
+
{"version":3,"file":"WillChangeMotionValue.mjs","sources":["../../../../src/value/use-will-change/WillChangeMotionValue.ts"],"sourcesContent":["import {\n acceleratedValues,\n MotionValue,\n transformProps,\n type WillChange,\n} from \"motion-dom\"\n\nexport class WillChangeMotionValue\n extends MotionValue<string>\n implements WillChange\n{\n private isEnabled = false\n\n add(name: string) {\n if (transformProps.has(name) || acceleratedValues.has(name)) {\n this.isEnabled = true\n this.update()\n }\n }\n\n private update() {\n this.set(this.isEnabled ? \"transform\" : \"auto\")\n }\n}\n"],"names":[],"mappings":";;AAOM,MAAO,qBACT,SAAQ,WAAmB,CAAA;AAD/B,IAAA,WAAA,GAAA;;QAIY,IAAA,CAAA,SAAS,GAAG,KAAK;IAY7B;AAVI,IAAA,GAAG,CAAC,IAAY,EAAA;AACZ,QAAA,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AACzD,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI;YACrB,IAAI,CAAC,MAAM,EAAE;QACjB;IACJ;IAEQ,MAAM,GAAA;AACV,QAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;IACnD;AACH;;;;"}
|
|
@@ -1269,6 +1269,11 @@
|
|
|
1269
1269
|
// stiffness/damping/mass overrides duration/bounce
|
|
1270
1270
|
if (!isSpringType(options, physicsKeys) &&
|
|
1271
1271
|
isSpringType(options, durationKeys)) {
|
|
1272
|
+
// Time-defined springs should ignore inherited velocity.
|
|
1273
|
+
// Velocity from interrupted animations can cause findSpring()
|
|
1274
|
+
// to compute wildly different spring parameters, leading to
|
|
1275
|
+
// massive oscillation on small-range animations.
|
|
1276
|
+
springOptions.velocity = 0;
|
|
1272
1277
|
if (options.visualDuration) {
|
|
1273
1278
|
const visualDuration = options.visualDuration;
|
|
1274
1279
|
const root = (2 * Math.PI) / (visualDuration * 1.2);
|
|
@@ -1284,7 +1289,7 @@
|
|
|
1284
1289
|
};
|
|
1285
1290
|
}
|
|
1286
1291
|
else {
|
|
1287
|
-
const derived = findSpring(options);
|
|
1292
|
+
const derived = findSpring({ ...options, velocity: 0 });
|
|
1288
1293
|
springOptions = {
|
|
1289
1294
|
...springOptions,
|
|
1290
1295
|
...derived,
|
|
@@ -11531,12 +11536,9 @@
|
|
|
11531
11536
|
// Capture listener catches element scroll events as they bubble
|
|
11532
11537
|
window.addEventListener("scroll", this.onElementScroll, {
|
|
11533
11538
|
capture: true,
|
|
11534
|
-
passive: true,
|
|
11535
11539
|
});
|
|
11536
11540
|
// Direct window scroll listener (window scroll doesn't bubble)
|
|
11537
|
-
window.addEventListener("scroll", this.onWindowScroll
|
|
11538
|
-
passive: true,
|
|
11539
|
-
});
|
|
11541
|
+
window.addEventListener("scroll", this.onWindowScroll);
|
|
11540
11542
|
this.removeScrollListeners = () => {
|
|
11541
11543
|
window.removeEventListener("scroll", this.onElementScroll, {
|
|
11542
11544
|
capture: true,
|
|
@@ -13650,9 +13652,13 @@
|
|
|
13650
13652
|
let animations = [];
|
|
13651
13653
|
let animationOnComplete;
|
|
13652
13654
|
if (isSequence(subjectOrSequence)) {
|
|
13655
|
+
const { onComplete, ...sequenceOptions } = optionsOrKeyframes || {};
|
|
13656
|
+
if (typeof onComplete === "function") {
|
|
13657
|
+
animationOnComplete = onComplete;
|
|
13658
|
+
}
|
|
13653
13659
|
animations = animateSequence(subjectOrSequence, reduceMotion !== undefined
|
|
13654
|
-
? { reduceMotion, ...
|
|
13655
|
-
:
|
|
13660
|
+
? { reduceMotion, ...sequenceOptions }
|
|
13661
|
+
: sequenceOptions, scope);
|
|
13656
13662
|
}
|
|
13657
13663
|
else {
|
|
13658
13664
|
// Extract top-level onComplete so it doesn't get applied per-value
|
|
@@ -14122,11 +14128,11 @@
|
|
|
14122
14128
|
const listener = () => frame.read(measureAll);
|
|
14123
14129
|
scrollListeners.set(container, listener);
|
|
14124
14130
|
const target = getEventTarget(container);
|
|
14125
|
-
window.addEventListener("resize", listener
|
|
14131
|
+
window.addEventListener("resize", listener);
|
|
14126
14132
|
if (container !== document.documentElement) {
|
|
14127
14133
|
resizeListeners.set(container, resize(container, listener));
|
|
14128
14134
|
}
|
|
14129
|
-
target.addEventListener("scroll", listener
|
|
14135
|
+
target.addEventListener("scroll", listener);
|
|
14130
14136
|
listener();
|
|
14131
14137
|
}
|
|
14132
14138
|
/**
|