framer-motion 12.24.9 → 12.24.11
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-Cw8jj9v7.js → feature-bundle-OJqyiRBo.js} +35 -47
- package/dist/cjs/feature-bundle-OJqyiRBo.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/m.js +34 -46
- package/dist/cjs/m.js.map +1 -1
- package/dist/dom-mini.js +1 -1
- package/dist/dom.js +1 -1
- package/dist/es/motion/utils/use-motion-ref.mjs +29 -42
- package/dist/es/motion/utils/use-motion-ref.mjs.map +1 -1
- package/dist/framer-motion.dev.js +56 -54
- package/dist/framer-motion.js +1 -1
- package/dist/mini.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-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-waapi-animate.js +1 -1
- package/dist/size-rollup-waapi-animate.js.map +1 -1
- package/package.json +5 -4
- package/dist/cjs/feature-bundle-Cw8jj9v7.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var featureBundle = require('./feature-bundle-
|
|
7
|
+
var featureBundle = require('./feature-bundle-OJqyiRBo.js');
|
|
8
8
|
var motionDom = require('motion-dom');
|
|
9
9
|
var motionUtils = require('motion-utils');
|
|
10
10
|
|
package/dist/cjs/m.js
CHANGED
|
@@ -850,69 +850,51 @@ for (const key in featureProps) {
|
|
|
850
850
|
|
|
851
851
|
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
852
852
|
|
|
853
|
-
function isRefObject(ref) {
|
|
854
|
-
return (ref &&
|
|
855
|
-
typeof ref === "object" &&
|
|
856
|
-
Object.prototype.hasOwnProperty.call(ref, "current"));
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
/**
|
|
860
|
-
* Set a given ref to a given value
|
|
861
|
-
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
862
|
-
* Returns a cleanup function if the ref callback returns one (React 19 feature)
|
|
863
|
-
*/
|
|
864
|
-
function setRef(ref, value) {
|
|
865
|
-
if (typeof ref === "function") {
|
|
866
|
-
return ref(value);
|
|
867
|
-
}
|
|
868
|
-
else if (isRefObject(ref)) {
|
|
869
|
-
ref.current = value;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
853
|
/**
|
|
873
854
|
* Creates a ref function that, when called, hydrates the provided
|
|
874
855
|
* external ref and VisualElement.
|
|
875
856
|
*/
|
|
876
857
|
function useMotionRef(visualState, visualElement, externalRef) {
|
|
877
|
-
|
|
878
|
-
|
|
858
|
+
/**
|
|
859
|
+
* Store externalRef in a ref to avoid including it in the useCallback
|
|
860
|
+
* dependency array. Including externalRef in dependencies causes issues
|
|
861
|
+
* with libraries like Radix UI that create new callback refs on each render
|
|
862
|
+
* when using asChild - this would cause the callback to be recreated,
|
|
863
|
+
* triggering element remounts and breaking AnimatePresence exit animations.
|
|
864
|
+
*/
|
|
865
|
+
const externalRefContainer = react.useRef(externalRef);
|
|
866
|
+
react.useInsertionEffect(() => {
|
|
867
|
+
externalRefContainer.current = externalRef;
|
|
868
|
+
});
|
|
869
|
+
// Store cleanup function returned by callback refs (React 19 feature)
|
|
870
|
+
const refCleanup = react.useRef(null);
|
|
879
871
|
return react.useCallback((instance) => {
|
|
880
872
|
if (instance) {
|
|
881
|
-
visualState.onMount
|
|
873
|
+
visualState.onMount?.(instance);
|
|
882
874
|
}
|
|
883
875
|
if (visualElement) {
|
|
884
|
-
|
|
885
|
-
visualElement.mount(instance);
|
|
886
|
-
}
|
|
887
|
-
else {
|
|
888
|
-
visualElement.unmount();
|
|
889
|
-
}
|
|
876
|
+
instance ? visualElement.mount(instance) : visualElement.unmount();
|
|
890
877
|
}
|
|
891
|
-
|
|
878
|
+
const ref = externalRefContainer.current;
|
|
879
|
+
if (typeof ref === "function") {
|
|
892
880
|
if (instance) {
|
|
893
|
-
|
|
894
|
-
const cleanup = setRef(externalRef, instance);
|
|
881
|
+
const cleanup = ref(instance);
|
|
895
882
|
if (typeof cleanup === "function") {
|
|
896
|
-
|
|
883
|
+
refCleanup.current = cleanup;
|
|
897
884
|
}
|
|
898
885
|
}
|
|
886
|
+
else if (refCleanup.current) {
|
|
887
|
+
refCleanup.current();
|
|
888
|
+
refCleanup.current = null;
|
|
889
|
+
}
|
|
899
890
|
else {
|
|
900
|
-
|
|
901
|
-
if (externalRefCleanupRef.current) {
|
|
902
|
-
externalRefCleanupRef.current();
|
|
903
|
-
externalRefCleanupRef.current = null;
|
|
904
|
-
}
|
|
905
|
-
else {
|
|
906
|
-
// Fallback to React <19 behavior for refs that don't return cleanup
|
|
907
|
-
setRef(externalRef, instance);
|
|
908
|
-
}
|
|
891
|
+
ref(instance);
|
|
909
892
|
}
|
|
910
893
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
[visualElement, visualState, externalRef]);
|
|
894
|
+
else if (ref) {
|
|
895
|
+
ref.current = instance;
|
|
896
|
+
}
|
|
897
|
+
}, [visualElement]);
|
|
916
898
|
}
|
|
917
899
|
|
|
918
900
|
/**
|
|
@@ -928,6 +910,12 @@ const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId
|
|
|
928
910
|
*/
|
|
929
911
|
const SwitchLayoutGroupContext = react.createContext({});
|
|
930
912
|
|
|
913
|
+
function isRefObject(ref) {
|
|
914
|
+
return (ref &&
|
|
915
|
+
typeof ref === "object" &&
|
|
916
|
+
Object.prototype.hasOwnProperty.call(ref, "current"));
|
|
917
|
+
}
|
|
918
|
+
|
|
931
919
|
const useIsomorphicLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect;
|
|
932
920
|
|
|
933
921
|
function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor, isSVG) {
|