framer-motion 12.23.14 → 12.23.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/cjs/client.js +1 -2
  2. package/dist/cjs/dom.js +1 -1
  3. package/dist/cjs/{feature-bundle-DUWayF3h.js → feature-bundle-DzuUB-G1.js} +0 -1
  4. package/dist/cjs/index.js +57 -3
  5. package/dist/cjs/m.js +4 -18
  6. package/dist/dom-mini.js +1 -1
  7. package/dist/dom.js +1 -1
  8. package/dist/es/animation/hooks/use-animate-style.mjs +1 -0
  9. package/dist/es/animation/hooks/use-animate.mjs +1 -0
  10. package/dist/es/animation/hooks/use-animated-state.mjs +1 -0
  11. package/dist/es/animation/hooks/use-animation.mjs +1 -0
  12. package/dist/es/client.mjs +0 -2
  13. package/dist/es/components/AnimatePresence/PopChild.mjs +3 -1
  14. package/dist/es/components/AnimatePresence/use-composed-ref.mjs +57 -0
  15. package/dist/es/components/AnimatePresence/use-presence-data.mjs +1 -0
  16. package/dist/es/components/AnimatePresence/use-presence.mjs +1 -0
  17. package/dist/es/components/AnimateSharedLayout.mjs +1 -0
  18. package/dist/es/context/DeprecatedLayoutGroupContext.mjs +1 -0
  19. package/dist/es/context/MotionContext/create.mjs +1 -0
  20. package/dist/es/events/use-dom-event.mjs +1 -0
  21. package/dist/es/index.mjs +0 -2
  22. package/dist/es/m.mjs +0 -1
  23. package/dist/es/motion/utils/use-motion-ref.mjs +1 -0
  24. package/dist/es/motion/utils/use-visual-element.mjs +1 -0
  25. package/dist/es/motion/utils/use-visual-state.mjs +1 -0
  26. package/dist/es/render/dom/features-animation.mjs +1 -0
  27. package/dist/es/render/dom/features-max.mjs +1 -0
  28. package/dist/es/render/dom/features-min.mjs +1 -0
  29. package/dist/es/render/dom/use-render.mjs +1 -0
  30. package/dist/es/render/html/use-html-visual-state.mjs +1 -0
  31. package/dist/es/render/html/use-props.mjs +1 -0
  32. package/dist/es/render/svg/use-props.mjs +1 -0
  33. package/dist/es/render/svg/use-svg-visual-state.mjs +1 -0
  34. package/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs +1 -0
  35. package/dist/es/utils/reduced-motion/use-reduced-motion.mjs +1 -0
  36. package/dist/es/utils/use-animation-frame.mjs +1 -0
  37. package/dist/es/utils/use-constant.mjs +1 -0
  38. package/dist/es/utils/use-cycle.mjs +1 -0
  39. package/dist/es/utils/use-force-update.mjs +1 -0
  40. package/dist/es/utils/use-in-view.mjs +1 -0
  41. package/dist/es/utils/use-instant-transition.mjs +1 -0
  42. package/dist/es/utils/use-is-mounted.mjs +1 -0
  43. package/dist/es/utils/use-isomorphic-effect.mjs +1 -0
  44. package/dist/es/utils/use-motion-value-event.mjs +1 -0
  45. package/dist/es/utils/use-page-in-view.mjs +1 -0
  46. package/dist/es/utils/use-unmount-effect.mjs +1 -0
  47. package/dist/es/value/use-combine-values.mjs +1 -0
  48. package/dist/es/value/use-computed.mjs +1 -0
  49. package/dist/es/value/use-inverted-scale.mjs +1 -0
  50. package/dist/es/value/use-motion-template.mjs +1 -0
  51. package/dist/es/value/use-motion-value.mjs +1 -0
  52. package/dist/es/value/use-scroll.mjs +1 -0
  53. package/dist/es/value/use-spring.mjs +1 -0
  54. package/dist/es/value/use-time.mjs +1 -0
  55. package/dist/es/value/use-transform.mjs +1 -0
  56. package/dist/es/value/use-velocity.mjs +1 -0
  57. package/dist/es/value/use-will-change/index.mjs +1 -0
  58. package/dist/framer-motion.dev.js +56 -2
  59. package/dist/framer-motion.js +1 -1
  60. package/dist/mini.js +1 -1
  61. package/dist/size-rollup-animate.js +1 -1
  62. package/dist/size-rollup-dom-animation-assets.js +1 -1
  63. package/dist/size-rollup-dom-animation-m.js +1 -1
  64. package/dist/size-rollup-dom-animation.js +1 -1
  65. package/dist/size-rollup-dom-max-assets.js +1 -1
  66. package/dist/size-rollup-dom-max.js +1 -1
  67. package/dist/size-rollup-m.js +1 -1
  68. package/dist/size-rollup-motion.js +1 -1
  69. package/dist/size-rollup-scroll.js +1 -1
  70. package/dist/size-rollup-waapi-animate.js +1 -1
  71. package/dist/types/client.d.ts +2 -4
  72. package/dist/types/index.d.ts +78 -3
  73. package/dist/{types.d-CSbqhfMB.d.ts → types.d-DsEeKk6G.d.ts} +3 -79
  74. package/package.json +2 -2
package/dist/es/m.mjs CHANGED
@@ -1,3 +1,2 @@
1
- "use client";
2
1
  export { createMinimalMotionComponent as create } from './render/components/m/create.mjs';
3
2
  export { MotionA as a, MotionAbbr as abbr, MotionAddress as address, MotionAnimate as animate, MotionArea as area, MotionArticle as article, MotionAside as aside, MotionAudio as audio, MotionB as b, MotionBase as base, MotionBdi as bdi, MotionBdo as bdo, MotionBig as big, MotionBlockquote as blockquote, MotionBody as body, MotionButton as button, MotionCanvas as canvas, MotionCaption as caption, MotionCircle as circle, MotionCite as cite, MotionClipPath as clipPath, MotionCode as code, MotionCol as col, MotionColgroup as colgroup, MotionData as data, MotionDatalist as datalist, MotionDd as dd, MotionDefs as defs, MotionDel as del, MotionDesc as desc, MotionDetails as details, MotionDfn as dfn, MotionDialog as dialog, MotionDiv as div, MotionDl as dl, MotionDt as dt, MotionEllipse as ellipse, MotionEm as em, MotionEmbed as embed, MotionFeBlend as feBlend, MotionFeColorMatrix as feColorMatrix, MotionFeComponentTransfer as feComponentTransfer, MotionFeComposite as feComposite, MotionFeConvolveMatrix as feConvolveMatrix, MotionFeDiffuseLighting as feDiffuseLighting, MotionFeDisplacementMap as feDisplacementMap, MotionFeDistantLight as feDistantLight, MotionFeDropShadow as feDropShadow, MotionFeFlood as feFlood, MotionFeFuncA as feFuncA, MotionFeFuncB as feFuncB, MotionFeFuncG as feFuncG, MotionFeFuncR as feFuncR, MotionFeGaussianBlur as feGaussianBlur, MotionFeImage as feImage, MotionFeMerge as feMerge, MotionFeMergeNode as feMergeNode, MotionFeMorphology as feMorphology, MotionFeOffset as feOffset, MotionFePointLight as fePointLight, MotionFeSpecularLighting as feSpecularLighting, MotionFeSpotLight as feSpotLight, MotionFeTile as feTile, MotionFeTurbulence as feTurbulence, MotionFieldset as fieldset, MotionFigcaption as figcaption, MotionFigure as figure, MotionFilter as filter, MotionFooter as footer, MotionForeignObject as foreignObject, MotionForm as form, MotionG as g, MotionH1 as h1, MotionH2 as h2, MotionH3 as h3, MotionH4 as h4, MotionH5 as h5, MotionH6 as h6, MotionHead as head, MotionHeader as header, MotionHgroup as hgroup, MotionHr as hr, MotionHtml as html, MotionI as i, MotionIframe as iframe, MotionImage as image, MotionImg as img, MotionInput as input, MotionIns as ins, MotionKbd as kbd, MotionKeygen as keygen, MotionLabel as label, MotionLegend as legend, MotionLi as li, MotionLine as line, MotionLinearGradient as linearGradient, MotionLink as link, MotionMain as main, MotionMap as map, MotionMark as mark, MotionMarker as marker, MotionMask as mask, MotionMenu as menu, MotionMenuitem as menuitem, MotionMetadata as metadata, MotionMeter as meter, MotionNav as nav, MotionObject as object, MotionOl as ol, MotionOptgroup as optgroup, MotionOption as option, MotionOutput as output, MotionP as p, MotionParam as param, MotionPath as path, MotionPattern as pattern, MotionPicture as picture, MotionPolygon as polygon, MotionPolyline as polyline, MotionPre as pre, MotionProgress as progress, MotionQ as q, MotionRadialGradient as radialGradient, MotionRect as rect, MotionRp as rp, MotionRt as rt, MotionRuby as ruby, MotionS as s, MotionSamp as samp, MotionScript as script, MotionSection as section, MotionSelect as select, MotionSmall as small, MotionSource as source, MotionSpan as span, MotionStop as stop, MotionStrong as strong, MotionStyle as style, MotionSub as sub, MotionSummary as summary, MotionSup as sup, MotionSvg as svg, MotionSymbol as symbol, MotionTable as table, MotionTbody as tbody, MotionTd as td, MotionText as text, MotionTextPath as textPath, MotionTextarea as textarea, MotionTfoot as tfoot, MotionTh as th, MotionThead as thead, MotionTime as time, MotionTitle as title, MotionTr as tr, MotionTrack as track, MotionTspan as tspan, MotionU as u, MotionUl as ul, MotionUse as use, MotionVideo as video, MotionView as view, MotionWbr as wbr, MotionWebview as webview } from './render/components/m/elements.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useCallback } from 'react';
2
3
  import { isRefObject } from '../../utils/is-ref-object.mjs';
3
4
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useContext, useRef, useInsertionEffect, useEffect } from 'react';
2
3
  import { optimizedAppearDataAttribute } from '../../animation/optimized-appear/data-id.mjs';
3
4
  import { LazyContext } from '../../context/LazyContext.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useContext } from 'react';
2
3
  import { isAnimationControls } from '../../animation/utils/is-animation-controls.mjs';
3
4
  import { MotionContext } from '../../context/MotionContext/index.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { animations } from '../../motion/features/animations.mjs';
2
3
  import { gestureAnimations } from '../../motion/features/gestures.mjs';
3
4
  import { createDomVisualElement } from './create-visual-element.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { drag } from '../../motion/features/drag.mjs';
2
3
  import { layout } from '../../motion/features/layout.mjs';
3
4
  import { domAnimation } from './features-animation.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { animations } from '../../motion/features/animations.mjs';
2
3
  import { createDomVisualElement } from './create-visual-element.mjs';
3
4
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { isMotionValue } from 'motion-dom';
2
3
  import { Fragment, useMemo, createElement } from 'react';
3
4
  import { useHTMLProps } from '../html/use-props.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';
2
3
  import { createHtmlRenderState } from './utils/create-render-state.mjs';
3
4
  import { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { isMotionValue } from 'motion-dom';
2
3
  import { useMemo } from 'react';
3
4
  import { isForcedMotionValue } from '../../motion/utils/is-forced-motion-value.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useMemo } from 'react';
2
3
  import { copyRawValuesOnly } from '../html/use-props.mjs';
3
4
  import { buildSVGAttrs } from './utils/build-attrs.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';
2
3
  import { createSvgRenderState } from './utils/create-render-state.mjs';
3
4
  import { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useContext } from 'react';
2
3
  import { MotionConfigContext } from '../../context/MotionConfigContext.mjs';
3
4
  import { useReducedMotion } from './use-reduced-motion.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { warnOnce } from 'motion-utils';
2
3
  import { useState } from 'react';
3
4
  import { initPrefersReducedMotion } from './index.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { frame, cancelFrame } from 'motion-dom';
2
3
  import { useRef, useContext, useEffect } from 'react';
3
4
  import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useRef } from 'react';
2
3
 
3
4
  /**
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { wrap } from 'motion-utils';
2
3
  import { useRef, useState, useCallback } from 'react';
3
4
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { frame } from 'motion-dom';
2
3
  import { useState, useCallback } from 'react';
3
4
  import { useIsMounted } from './use-is-mounted.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useState, useEffect } from 'react';
2
3
  import { inView } from '../render/dom/viewport/index.mjs';
3
4
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { frame } from 'motion-dom';
2
3
  import { MotionGlobalConfig } from 'motion-utils';
3
4
  import { useRef, useEffect } from 'react';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useRef } from 'react';
2
3
  import { useIsomorphicLayoutEffect } from './use-isomorphic-effect.mjs';
3
4
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useLayoutEffect, useEffect } from 'react';
2
3
  import { isBrowser } from './is-browser.mjs';
3
4
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useInsertionEffect } from 'react';
2
3
 
3
4
  function useMotionValueEvent(value, event, callback) {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useState, useEffect } from 'react';
2
3
 
3
4
  function usePageInView() {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useEffect } from 'react';
2
3
 
3
4
  function useUnmountEffect(callback) {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cancelFrame, frame } from 'motion-dom';
2
3
  import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
3
4
  import { useMotionValue } from './use-motion-value.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { collectMotionValues } from 'motion-dom';
2
3
  import { useCombineMotionValues } from './use-combine-values.mjs';
3
4
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { invariant, warning } from 'motion-utils';
2
3
  import { useContext } from 'react';
3
4
  import { MotionContext } from '../context/MotionContext/index.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { isMotionValue } from 'motion-dom';
2
3
  import { useCombineMotionValues } from './use-combine-values.mjs';
3
4
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { motionValue } from 'motion-dom';
2
3
  import { useContext, useState, useEffect } from 'react';
3
4
  import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { motionValue } from 'motion-dom';
2
3
  import { invariant } from 'motion-utils';
3
4
  import { useRef, useCallback, useEffect } from 'react';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { attachSpring, isMotionValue } from 'motion-dom';
2
3
  import { useContext, useInsertionEffect } from 'react';
3
4
  import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useAnimationFrame } from '../utils/use-animation-frame.mjs';
2
3
  import { useMotionValue } from './use-motion-value.mjs';
3
4
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { transform } from 'motion-dom';
2
3
  import { useConstant } from '../utils/use-constant.mjs';
3
4
  import { useCombineMotionValues } from './use-combine-values.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { frame } from 'motion-dom';
2
3
  import { useMotionValueEvent } from '../utils/use-motion-value-event.mjs';
3
4
  import { useMotionValue } from './use-motion-value.mjs';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useConstant } from '../../utils/use-constant.mjs';
2
3
  import { WillChangeMotionValue } from './WillChangeMotionValue.mjs';
3
4
 
@@ -5037,6 +5037,60 @@
5037
5037
  reducedMotion: "never",
5038
5038
  });
5039
5039
 
5040
+ /**
5041
+ * Set a given ref to a given value
5042
+ * This utility takes care of different types of refs: callback refs and RefObject(s)
5043
+ */
5044
+ function setRef(ref, value) {
5045
+ if (typeof ref === "function") {
5046
+ return ref(value);
5047
+ }
5048
+ else if (ref !== null && ref !== undefined) {
5049
+ ref.current = value;
5050
+ }
5051
+ }
5052
+ /**
5053
+ * A utility to compose multiple refs together
5054
+ * Accepts callback refs and RefObject(s)
5055
+ */
5056
+ function composeRefs(...refs) {
5057
+ return (node) => {
5058
+ let hasCleanup = false;
5059
+ const cleanups = refs.map((ref) => {
5060
+ const cleanup = setRef(ref, node);
5061
+ if (!hasCleanup && typeof cleanup === "function") {
5062
+ hasCleanup = true;
5063
+ }
5064
+ return cleanup;
5065
+ });
5066
+ // React <19 will log an error to the console if a callback ref returns a
5067
+ // value. We don't use ref cleanups internally so this will only happen if a
5068
+ // user's ref callback returns a value, which we only expect if they are
5069
+ // using the cleanup functionality added in React 19.
5070
+ if (hasCleanup) {
5071
+ return () => {
5072
+ for (let i = 0; i < cleanups.length; i++) {
5073
+ const cleanup = cleanups[i];
5074
+ if (typeof cleanup === "function") {
5075
+ cleanup();
5076
+ }
5077
+ else {
5078
+ setRef(refs[i], null);
5079
+ }
5080
+ }
5081
+ };
5082
+ }
5083
+ };
5084
+ }
5085
+ /**
5086
+ * A custom hook that composes multiple refs
5087
+ * Accepts callback refs and RefObject(s)
5088
+ */
5089
+ function useComposedRefs(...refs) {
5090
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5091
+ return React__namespace.useCallback(composeRefs(...refs), refs);
5092
+ }
5093
+
5040
5094
  /**
5041
5095
  * Measurement functionality has to be within a separate component
5042
5096
  * to leverage snapshot lifecycle.
@@ -5077,6 +5131,7 @@
5077
5131
  right: 0,
5078
5132
  });
5079
5133
  const { nonce } = React$1.useContext(MotionConfigContext);
5134
+ const composedRef = useComposedRefs(ref, children?.ref);
5080
5135
  /**
5081
5136
  * We create and inject a style block so we can apply this explicit
5082
5137
  * sizing in a non-destructive manner by just deleting the style block.
@@ -5114,7 +5169,7 @@
5114
5169
  }
5115
5170
  };
5116
5171
  }, [isPresent]);
5117
- return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, children: React__namespace.cloneElement(children, { ref }) }));
5172
+ return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, children: React__namespace.cloneElement(children, { ref: composedRef }) }));
5118
5173
  }
5119
5174
 
5120
5175
  const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, root }) => {
@@ -14060,7 +14115,6 @@
14060
14115
  exports.DOMKeyframesResolver = DOMKeyframesResolver;
14061
14116
  exports.DeprecatedLayoutGroupContext = DeprecatedLayoutGroupContext;
14062
14117
  exports.DragControls = DragControls;
14063
- exports.FlatTree = FlatTree;
14064
14118
  exports.GroupAnimation = GroupAnimation;
14065
14119
  exports.GroupAnimationWithThen = GroupAnimationWithThen;
14066
14120
  exports.JSAnimation = JSAnimation;