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/client.js
CHANGED
|
@@ -4105,69 +4105,51 @@ const useSVGVisualState = /*@__PURE__*/ makeUseVisualState({
|
|
|
4105
4105
|
|
|
4106
4106
|
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
4107
4107
|
|
|
4108
|
-
function isRefObject(ref) {
|
|
4109
|
-
return (ref &&
|
|
4110
|
-
typeof ref === "object" &&
|
|
4111
|
-
Object.prototype.hasOwnProperty.call(ref, "current"));
|
|
4112
|
-
}
|
|
4113
|
-
|
|
4114
|
-
/**
|
|
4115
|
-
* Set a given ref to a given value
|
|
4116
|
-
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
4117
|
-
* Returns a cleanup function if the ref callback returns one (React 19 feature)
|
|
4118
|
-
*/
|
|
4119
|
-
function setRef(ref, value) {
|
|
4120
|
-
if (typeof ref === "function") {
|
|
4121
|
-
return ref(value);
|
|
4122
|
-
}
|
|
4123
|
-
else if (isRefObject(ref)) {
|
|
4124
|
-
ref.current = value;
|
|
4125
|
-
}
|
|
4126
|
-
}
|
|
4127
4108
|
/**
|
|
4128
4109
|
* Creates a ref function that, when called, hydrates the provided
|
|
4129
4110
|
* external ref and VisualElement.
|
|
4130
4111
|
*/
|
|
4131
4112
|
function useMotionRef(visualState, visualElement, externalRef) {
|
|
4132
|
-
|
|
4133
|
-
|
|
4113
|
+
/**
|
|
4114
|
+
* Store externalRef in a ref to avoid including it in the useCallback
|
|
4115
|
+
* dependency array. Including externalRef in dependencies causes issues
|
|
4116
|
+
* with libraries like Radix UI that create new callback refs on each render
|
|
4117
|
+
* when using asChild - this would cause the callback to be recreated,
|
|
4118
|
+
* triggering element remounts and breaking AnimatePresence exit animations.
|
|
4119
|
+
*/
|
|
4120
|
+
const externalRefContainer = React.useRef(externalRef);
|
|
4121
|
+
React.useInsertionEffect(() => {
|
|
4122
|
+
externalRefContainer.current = externalRef;
|
|
4123
|
+
});
|
|
4124
|
+
// Store cleanup function returned by callback refs (React 19 feature)
|
|
4125
|
+
const refCleanup = React.useRef(null);
|
|
4134
4126
|
return React.useCallback((instance) => {
|
|
4135
4127
|
if (instance) {
|
|
4136
|
-
visualState.onMount
|
|
4128
|
+
visualState.onMount?.(instance);
|
|
4137
4129
|
}
|
|
4138
4130
|
if (visualElement) {
|
|
4139
|
-
|
|
4140
|
-
visualElement.mount(instance);
|
|
4141
|
-
}
|
|
4142
|
-
else {
|
|
4143
|
-
visualElement.unmount();
|
|
4144
|
-
}
|
|
4131
|
+
instance ? visualElement.mount(instance) : visualElement.unmount();
|
|
4145
4132
|
}
|
|
4146
|
-
|
|
4133
|
+
const ref = externalRefContainer.current;
|
|
4134
|
+
if (typeof ref === "function") {
|
|
4147
4135
|
if (instance) {
|
|
4148
|
-
|
|
4149
|
-
const cleanup = setRef(externalRef, instance);
|
|
4136
|
+
const cleanup = ref(instance);
|
|
4150
4137
|
if (typeof cleanup === "function") {
|
|
4151
|
-
|
|
4138
|
+
refCleanup.current = cleanup;
|
|
4152
4139
|
}
|
|
4153
4140
|
}
|
|
4141
|
+
else if (refCleanup.current) {
|
|
4142
|
+
refCleanup.current();
|
|
4143
|
+
refCleanup.current = null;
|
|
4144
|
+
}
|
|
4154
4145
|
else {
|
|
4155
|
-
|
|
4156
|
-
if (externalRefCleanupRef.current) {
|
|
4157
|
-
externalRefCleanupRef.current();
|
|
4158
|
-
externalRefCleanupRef.current = null;
|
|
4159
|
-
}
|
|
4160
|
-
else {
|
|
4161
|
-
// Fallback to React <19 behavior for refs that don't return cleanup
|
|
4162
|
-
setRef(externalRef, instance);
|
|
4163
|
-
}
|
|
4146
|
+
ref(instance);
|
|
4164
4147
|
}
|
|
4165
4148
|
}
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
[visualElement, visualState, externalRef]);
|
|
4149
|
+
else if (ref) {
|
|
4150
|
+
ref.current = instance;
|
|
4151
|
+
}
|
|
4152
|
+
}, [visualElement]);
|
|
4171
4153
|
}
|
|
4172
4154
|
|
|
4173
4155
|
/**
|
|
@@ -4175,6 +4157,12 @@ function useMotionRef(visualState, visualElement, externalRef) {
|
|
|
4175
4157
|
*/
|
|
4176
4158
|
const SwitchLayoutGroupContext = React.createContext({});
|
|
4177
4159
|
|
|
4160
|
+
function isRefObject(ref) {
|
|
4161
|
+
return (ref &&
|
|
4162
|
+
typeof ref === "object" &&
|
|
4163
|
+
Object.prototype.hasOwnProperty.call(ref, "current"));
|
|
4164
|
+
}
|
|
4165
|
+
|
|
4178
4166
|
function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor, isSVG) {
|
|
4179
4167
|
const { visualElement: parent } = React.useContext(MotionContext);
|
|
4180
4168
|
const lazyContext = React.useContext(LazyContext);
|
|
@@ -6372,4 +6360,4 @@ exports.useIsPresent = useIsPresent;
|
|
|
6372
6360
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
6373
6361
|
exports.usePresence = usePresence;
|
|
6374
6362
|
exports.visualElementStore = visualElementStore;
|
|
6375
|
-
//# sourceMappingURL=feature-bundle-
|
|
6363
|
+
//# sourceMappingURL=feature-bundle-OJqyiRBo.js.map
|