motion-dom 12.32.0 → 12.33.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 +48 -12
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/gestures/press/index.mjs +6 -0
- package/dist/es/gestures/press/index.mjs.map +1 -1
- package/dist/es/projection/shared/stack.mjs +26 -12
- package/dist/es/projection/shared/stack.mjs.map +1 -1
- package/dist/es/render/utils/animation-state.mjs +16 -0
- package/dist/es/render/utils/animation-state.mjs.map +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/motion-dom.dev.js +48 -12
- package/dist/motion-dom.js +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -4415,6 +4415,7 @@ const enableKeyboardPress = (focusEvent, eventOptions) => {
|
|
|
4415
4415
|
function isValidPressEvent(event) {
|
|
4416
4416
|
return isPrimaryPointer(event) && !isDragActive();
|
|
4417
4417
|
}
|
|
4418
|
+
const claimedPointerDownEvents = new WeakSet();
|
|
4418
4419
|
/**
|
|
4419
4420
|
* Create a press gesture.
|
|
4420
4421
|
*
|
|
@@ -4440,7 +4441,12 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
4440
4441
|
const target = startEvent.currentTarget;
|
|
4441
4442
|
if (!isValidPressEvent(startEvent))
|
|
4442
4443
|
return;
|
|
4444
|
+
if (claimedPointerDownEvents.has(startEvent))
|
|
4445
|
+
return;
|
|
4443
4446
|
isPressing.add(target);
|
|
4447
|
+
if (options.stopPropagation) {
|
|
4448
|
+
claimedPointerDownEvents.add(startEvent);
|
|
4449
|
+
}
|
|
4444
4450
|
const onPressEnd = onPressStart(target, startEvent);
|
|
4445
4451
|
const onPointerEnd = (endEvent, success) => {
|
|
4446
4452
|
window.removeEventListener("pointerup", onPointerUp);
|
|
@@ -6822,6 +6828,22 @@ function createAnimationState(visualElement) {
|
|
|
6822
6828
|
typeof prop === "boolean") {
|
|
6823
6829
|
continue;
|
|
6824
6830
|
}
|
|
6831
|
+
/**
|
|
6832
|
+
* If exit is already active and wasn't just activated, skip
|
|
6833
|
+
* re-processing to prevent interrupting running exit animations.
|
|
6834
|
+
* Re-resolving exit with a changed custom value can start new
|
|
6835
|
+
* value animations that stop the originals, leaving the exit
|
|
6836
|
+
* animation promise unresolved and the component stuck in the DOM.
|
|
6837
|
+
*/
|
|
6838
|
+
if (type === "exit" && typeState.isActive && activeDelta !== true) {
|
|
6839
|
+
if (typeState.prevResolvedValues) {
|
|
6840
|
+
encounteredKeys = {
|
|
6841
|
+
...encounteredKeys,
|
|
6842
|
+
...typeState.prevResolvedValues,
|
|
6843
|
+
};
|
|
6844
|
+
}
|
|
6845
|
+
continue;
|
|
6846
|
+
}
|
|
6825
6847
|
/**
|
|
6826
6848
|
* As we go look through the values defined on this type, if we detect
|
|
6827
6849
|
* a changed value or a value that was removed in a higher priority, we set
|
|
@@ -7393,6 +7415,15 @@ class NodeStack {
|
|
|
7393
7415
|
}
|
|
7394
7416
|
add(node) {
|
|
7395
7417
|
motionUtils.addUniqueItem(this.members, node);
|
|
7418
|
+
for (let i = this.members.length - 1; i >= 0; i--) {
|
|
7419
|
+
const m = this.members[i];
|
|
7420
|
+
if (m === node || m === this.lead || m === this.prevLead)
|
|
7421
|
+
continue;
|
|
7422
|
+
const inst = m.instance;
|
|
7423
|
+
if (inst && inst.isConnected === false && m.isPresent !== false && !m.snapshot) {
|
|
7424
|
+
motionUtils.removeItem(this.members, m);
|
|
7425
|
+
}
|
|
7426
|
+
}
|
|
7396
7427
|
node.scheduleRender();
|
|
7397
7428
|
}
|
|
7398
7429
|
remove(node) {
|
|
@@ -7417,7 +7448,8 @@ class NodeStack {
|
|
|
7417
7448
|
let prevLead;
|
|
7418
7449
|
for (let i = indexOfNode; i >= 0; i--) {
|
|
7419
7450
|
const member = this.members[i];
|
|
7420
|
-
|
|
7451
|
+
const inst = member.instance;
|
|
7452
|
+
if (member.isPresent !== false && (!inst || inst.isConnected !== false)) {
|
|
7421
7453
|
prevLead = member;
|
|
7422
7454
|
break;
|
|
7423
7455
|
}
|
|
@@ -7452,17 +7484,21 @@ class NodeStack {
|
|
|
7452
7484
|
nextDep !== undefined &&
|
|
7453
7485
|
prevDep === nextDep;
|
|
7454
7486
|
if (!dependencyMatches) {
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7487
|
+
const prevInstance = prevLead.instance;
|
|
7488
|
+
const isStale = prevInstance && prevInstance.isConnected === false && !prevLead.snapshot;
|
|
7489
|
+
if (!isStale) {
|
|
7490
|
+
node.resumeFrom = prevLead;
|
|
7491
|
+
if (preserveFollowOpacity) {
|
|
7492
|
+
node.resumeFrom.preserveOpacity = true;
|
|
7493
|
+
}
|
|
7494
|
+
if (prevLead.snapshot) {
|
|
7495
|
+
node.snapshot = prevLead.snapshot;
|
|
7496
|
+
node.snapshot.latestValues =
|
|
7497
|
+
prevLead.animationValues || prevLead.latestValues;
|
|
7498
|
+
}
|
|
7499
|
+
if (node.root && node.root.isUpdating) {
|
|
7500
|
+
node.isLayoutDirty = true;
|
|
7501
|
+
}
|
|
7466
7502
|
}
|
|
7467
7503
|
}
|
|
7468
7504
|
const { crossfade } = node.options;
|