motion-dom 12.27.3-alpha.0 → 12.27.3-alpha.2
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 +56 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/layout/LayoutAnimationBuilder.mjs +51 -2
- package/dist/es/layout/LayoutAnimationBuilder.mjs.map +1 -1
- package/dist/es/projection/node/create-projection-node.mjs +16 -16
- package/dist/es/projection/node/create-projection-node.mjs.map +1 -1
- package/dist/es/projection/shared/stack.mjs +7 -0
- package/dist/es/projection/shared/stack.mjs.map +1 -1
- package/dist/motion-dom.dev.js +56 -1
- package/dist/motion-dom.js +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -7272,6 +7272,13 @@ class NodeStack {
|
|
|
7272
7272
|
const prevLead = this.lead;
|
|
7273
7273
|
if (node === prevLead)
|
|
7274
7274
|
return;
|
|
7275
|
+
console.log("[projection] promote", {
|
|
7276
|
+
layoutId: node.options.layoutId,
|
|
7277
|
+
node: node.id,
|
|
7278
|
+
prevLead: prevLead?.id,
|
|
7279
|
+
prevLeadSnapshot: Boolean(prevLead?.snapshot),
|
|
7280
|
+
prevLeadResumeFrom: Boolean(prevLead?.resumeFrom),
|
|
7281
|
+
});
|
|
7275
7282
|
this.prevLead = prevLead;
|
|
7276
7283
|
this.lead = node;
|
|
7277
7284
|
node.show();
|
|
@@ -8994,6 +9001,22 @@ const HTMLProjectionNode = createProjectionNode({
|
|
|
8994
9001
|
|
|
8995
9002
|
const layoutSelector = "[data-layout], [data-layout-id]";
|
|
8996
9003
|
const noop = () => { };
|
|
9004
|
+
function snapshotFromTarget(projection) {
|
|
9005
|
+
const target = projection.targetWithTransforms || projection.target;
|
|
9006
|
+
if (!target)
|
|
9007
|
+
return undefined;
|
|
9008
|
+
const measuredBox = createBox();
|
|
9009
|
+
const layoutBox = createBox();
|
|
9010
|
+
copyBoxInto(measuredBox, target);
|
|
9011
|
+
copyBoxInto(layoutBox, target);
|
|
9012
|
+
return {
|
|
9013
|
+
animationId: projection.root?.animationId ?? 0,
|
|
9014
|
+
measuredBox,
|
|
9015
|
+
layoutBox,
|
|
9016
|
+
latestValues: projection.animationValues || projection.latestValues || {},
|
|
9017
|
+
source: projection.id,
|
|
9018
|
+
};
|
|
9019
|
+
}
|
|
8997
9020
|
class LayoutAnimationBuilder {
|
|
8998
9021
|
constructor(scope, updateDom, defaultOptions) {
|
|
8999
9022
|
this.sharedTransitions = new Map();
|
|
@@ -9006,7 +9029,7 @@ class LayoutAnimationBuilder {
|
|
|
9006
9029
|
this.notifyReady = resolve;
|
|
9007
9030
|
this.rejectReady = reject;
|
|
9008
9031
|
});
|
|
9009
|
-
|
|
9032
|
+
frame.postRender(() => {
|
|
9010
9033
|
this.start().then(this.notifyReady).catch(this.rejectReady);
|
|
9011
9034
|
});
|
|
9012
9035
|
}
|
|
@@ -9022,6 +9045,21 @@ class LayoutAnimationBuilder {
|
|
|
9022
9045
|
const beforeRecords = this.buildRecords(beforeElements);
|
|
9023
9046
|
const exitCandidates = collectExitCandidates(beforeRecords);
|
|
9024
9047
|
beforeRecords.forEach(({ projection }) => {
|
|
9048
|
+
const hasCurrentAnimation = Boolean(projection.currentAnimation);
|
|
9049
|
+
const isSharedLayout = Boolean(projection.options.layoutId);
|
|
9050
|
+
if (hasCurrentAnimation && isSharedLayout) {
|
|
9051
|
+
const snapshot = snapshotFromTarget(projection);
|
|
9052
|
+
if (snapshot) {
|
|
9053
|
+
projection.snapshot = snapshot;
|
|
9054
|
+
}
|
|
9055
|
+
else if (projection.snapshot) {
|
|
9056
|
+
projection.snapshot = undefined;
|
|
9057
|
+
}
|
|
9058
|
+
}
|
|
9059
|
+
else if (projection.snapshot &&
|
|
9060
|
+
(projection.currentAnimation || projection.isProjecting())) {
|
|
9061
|
+
projection.snapshot = undefined;
|
|
9062
|
+
}
|
|
9025
9063
|
projection.isPresent = true;
|
|
9026
9064
|
projection.willUpdate();
|
|
9027
9065
|
});
|
|
@@ -9029,6 +9067,23 @@ class LayoutAnimationBuilder {
|
|
|
9029
9067
|
const afterElements = collectLayoutElements(this.scope);
|
|
9030
9068
|
const afterRecords = this.buildRecords(afterElements);
|
|
9031
9069
|
const exitRecords = this.handleExitingElements(beforeRecords, afterRecords, exitCandidates);
|
|
9070
|
+
afterRecords.forEach(({ projection }) => {
|
|
9071
|
+
const instance = projection.instance;
|
|
9072
|
+
const resumeFromInstance = projection.resumeFrom
|
|
9073
|
+
?.instance;
|
|
9074
|
+
if (!instance || !resumeFromInstance)
|
|
9075
|
+
return;
|
|
9076
|
+
if (!("style" in instance))
|
|
9077
|
+
return;
|
|
9078
|
+
const currentTransform = instance.style.transform;
|
|
9079
|
+
const resumeFromTransform = resumeFromInstance.style.transform;
|
|
9080
|
+
if (currentTransform &&
|
|
9081
|
+
resumeFromTransform &&
|
|
9082
|
+
currentTransform === resumeFromTransform) {
|
|
9083
|
+
instance.style.transform = "";
|
|
9084
|
+
instance.style.transformOrigin = "";
|
|
9085
|
+
}
|
|
9086
|
+
});
|
|
9032
9087
|
afterRecords.forEach(({ projection }) => {
|
|
9033
9088
|
projection.isPresent = true;
|
|
9034
9089
|
});
|