framer-motion 12.19.4 → 12.20.1
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/index.js +10 -8
- package/dist/dom.js +1 -1
- package/dist/es/components/AnimatePresence/PopChild.mjs +6 -4
- package/dist/es/components/AnimatePresence/PresenceChild.mjs +2 -2
- package/dist/es/components/AnimatePresence/index.mjs +2 -2
- package/dist/framer-motion.dev.js +17 -15
- package/dist/framer-motion.js +1 -1
- package/dist/types/index.d.ts +6 -1
- package/package.json +3 -3
|
@@ -4916,7 +4916,7 @@
|
|
|
4916
4916
|
|
|
4917
4917
|
class ViewTransitionBuilder {
|
|
4918
4918
|
constructor(update, options = {}) {
|
|
4919
|
-
this.
|
|
4919
|
+
this.currentSubject = "root";
|
|
4920
4920
|
this.targets = new Map();
|
|
4921
4921
|
this.notifyReady = noop;
|
|
4922
4922
|
this.readyPromise = new Promise((resolve) => {
|
|
@@ -4929,8 +4929,8 @@
|
|
|
4929
4929
|
};
|
|
4930
4930
|
addToQueue(this);
|
|
4931
4931
|
}
|
|
4932
|
-
get(
|
|
4933
|
-
this.
|
|
4932
|
+
get(subject) {
|
|
4933
|
+
this.currentSubject = subject;
|
|
4934
4934
|
return this;
|
|
4935
4935
|
}
|
|
4936
4936
|
layout(keyframes, options) {
|
|
@@ -4959,11 +4959,11 @@
|
|
|
4959
4959
|
return this;
|
|
4960
4960
|
}
|
|
4961
4961
|
updateTarget(target, keyframes, options = {}) {
|
|
4962
|
-
const {
|
|
4963
|
-
if (!targets.has(
|
|
4964
|
-
targets.set(
|
|
4962
|
+
const { currentSubject, targets } = this;
|
|
4963
|
+
if (!targets.has(currentSubject)) {
|
|
4964
|
+
targets.set(currentSubject, {});
|
|
4965
4965
|
}
|
|
4966
|
-
const targetData = targets.get(
|
|
4966
|
+
const targetData = targets.get(currentSubject);
|
|
4967
4967
|
targetData[target] = { keyframes, options };
|
|
4968
4968
|
}
|
|
4969
4969
|
then(resolve, reject) {
|
|
@@ -5028,7 +5028,7 @@
|
|
|
5028
5028
|
return this.props.children;
|
|
5029
5029
|
}
|
|
5030
5030
|
}
|
|
5031
|
-
function PopChild({ children, isPresent, anchorX }) {
|
|
5031
|
+
function PopChild({ children, isPresent, anchorX, root }) {
|
|
5032
5032
|
const id = React$1.useId();
|
|
5033
5033
|
const ref = React$1.useRef(null);
|
|
5034
5034
|
const size = React$1.useRef({
|
|
@@ -5057,7 +5057,8 @@
|
|
|
5057
5057
|
const style = document.createElement("style");
|
|
5058
5058
|
if (nonce)
|
|
5059
5059
|
style.nonce = nonce;
|
|
5060
|
-
document.head
|
|
5060
|
+
const parent = root ?? document.head;
|
|
5061
|
+
parent.appendChild(style);
|
|
5061
5062
|
if (style.sheet) {
|
|
5062
5063
|
style.sheet.insertRule(`
|
|
5063
5064
|
[data-motion-pop-id="${id}"] {
|
|
@@ -5070,15 +5071,16 @@
|
|
|
5070
5071
|
`);
|
|
5071
5072
|
}
|
|
5072
5073
|
return () => {
|
|
5073
|
-
|
|
5074
|
-
|
|
5074
|
+
parent.removeChild(style);
|
|
5075
|
+
if (parent.contains(style)) {
|
|
5076
|
+
parent.removeChild(style);
|
|
5075
5077
|
}
|
|
5076
5078
|
};
|
|
5077
5079
|
}, [isPresent]);
|
|
5078
5080
|
return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, children: React__namespace.cloneElement(children, { ref }) }));
|
|
5079
5081
|
}
|
|
5080
5082
|
|
|
5081
|
-
const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, }) => {
|
|
5083
|
+
const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, root }) => {
|
|
5082
5084
|
const presenceChildren = useConstant(newChildrenMap);
|
|
5083
5085
|
const id = React$1.useId();
|
|
5084
5086
|
let isReusedContext = true;
|
|
@@ -5125,7 +5127,7 @@
|
|
|
5125
5127
|
onExitComplete();
|
|
5126
5128
|
}, [isPresent]);
|
|
5127
5129
|
if (mode === "popLayout") {
|
|
5128
|
-
children = (jsx(PopChild, { isPresent: isPresent, anchorX: anchorX, children: children }));
|
|
5130
|
+
children = (jsx(PopChild, { isPresent: isPresent, anchorX: anchorX, root: root, children: children }));
|
|
5129
5131
|
}
|
|
5130
5132
|
return (jsx(PresenceContext.Provider, { value: context, children: children }));
|
|
5131
5133
|
};
|
|
@@ -5243,7 +5245,7 @@
|
|
|
5243
5245
|
*
|
|
5244
5246
|
* @public
|
|
5245
5247
|
*/
|
|
5246
|
-
const AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left", }) => {
|
|
5248
|
+
const AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left", root }) => {
|
|
5247
5249
|
const [isParentPresent, safeToRemove] = usePresence(propagate);
|
|
5248
5250
|
/**
|
|
5249
5251
|
* Filter any children that aren't ReactElements. We can only track components
|
|
@@ -5360,7 +5362,7 @@
|
|
|
5360
5362
|
};
|
|
5361
5363
|
return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial
|
|
5362
5364
|
? undefined
|
|
5363
|
-
: false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, children: child }, key));
|
|
5365
|
+
: false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, children: child }, key));
|
|
5364
5366
|
}) }));
|
|
5365
5367
|
};
|
|
5366
5368
|
|