motion-dom 14.5.0 → 14.6.0
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 +144 -55
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/animation/NativeAnimation.mjs +10 -4
- package/dist/es/animation/NativeAnimation.mjs.map +1 -1
- package/dist/es/animation/generators/spring.mjs +11 -9
- package/dist/es/animation/generators/spring.mjs.map +1 -1
- package/dist/es/animation/keyframes/utils/unit-conversion.mjs +8 -7
- package/dist/es/animation/keyframes/utils/unit-conversion.mjs.map +1 -1
- package/dist/es/animation/optimized-appear/data-id.mjs +1 -3
- package/dist/es/animation/optimized-appear/data-id.mjs.map +1 -1
- package/dist/es/animation/waapi/supports/waapi.mjs +8 -2
- package/dist/es/animation/waapi/supports/waapi.mjs.map +1 -1
- package/dist/es/frameloop/process-frame.mjs +42 -0
- package/dist/es/frameloop/process-frame.mjs.map +1 -0
- package/dist/es/frameloop/render-step.mjs +15 -1
- package/dist/es/frameloop/render-step.mjs.map +1 -1
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +16 -6
- package/dist/es/gestures/drag/VisualElementDragControls.mjs.map +1 -1
- package/dist/es/index.mjs +3 -1
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/projection/node/DocumentProjectionNode.mjs +8 -3
- package/dist/es/projection/node/DocumentProjectionNode.mjs.map +1 -1
- package/dist/es/projection/node/HTMLProjectionNode.mjs +4 -5
- package/dist/es/projection/node/HTMLProjectionNode.mjs.map +1 -1
- package/dist/es/projection/node/create-projection-node.mjs +21 -12
- package/dist/es/projection/node/create-projection-node.mjs.map +1 -1
- package/dist/es/projection/node/root.mjs +6 -0
- package/dist/es/projection/node/root.mjs.map +1 -0
- package/dist/es/projection/styles/default-scale-correctors.mjs +3 -4
- package/dist/es/projection/styles/default-scale-correctors.mjs.map +1 -1
- package/dist/es/render/utils/animation-state.mjs +1 -2
- package/dist/es/render/utils/animation-state.mjs.map +1 -1
- package/dist/es/render/utils/variant-props.mjs +1 -1
- package/dist/es/render/utils/variant-props.mjs.map +1 -1
- package/dist/index.d.ts +44 -14
- package/dist/motion-dom.dev.js +144 -55
- package/dist/motion-dom.js +1 -1
- package/dist/size-rollup-motion-value.js +1 -1
- package/dist/size-rollup-motion-value.js.map +1 -1
- package/dist/size-rollup-style-effect.js +1 -1
- package/dist/size-rollup-style-effect.js.map +1 -1
- package/package.json +3 -3
package/dist/motion-dom.dev.js
CHANGED
|
@@ -621,6 +621,11 @@
|
|
|
621
621
|
*/
|
|
622
622
|
let isProcessing = false;
|
|
623
623
|
let flushNextFrame = false;
|
|
624
|
+
/**
|
|
625
|
+
* The callback currently running. If it schedules itself with `immediate`
|
|
626
|
+
* it's left in place, so as before it doesn't run again this step.
|
|
627
|
+
*/
|
|
628
|
+
let running;
|
|
624
629
|
/**
|
|
625
630
|
* A set of processes which were marked keepAlive when scheduled.
|
|
626
631
|
* A keepAlive process is always also held by a frame queue until
|
|
@@ -638,7 +643,7 @@
|
|
|
638
643
|
nextFrame.add(callback);
|
|
639
644
|
runNextFrame();
|
|
640
645
|
}
|
|
641
|
-
callback(latestFrameData);
|
|
646
|
+
(running = callback)(latestFrameData);
|
|
642
647
|
}
|
|
643
648
|
const step = {
|
|
644
649
|
/**
|
|
@@ -649,6 +654,14 @@
|
|
|
649
654
|
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
650
655
|
if (keepAlive)
|
|
651
656
|
toKeepAlive.add(callback);
|
|
657
|
+
/**
|
|
658
|
+
* A callback scheduled with `immediate` during processing may
|
|
659
|
+
* already have run this step (for instance, a value it reads was
|
|
660
|
+
* changed by a later callback). Re-adding moves it to the end of
|
|
661
|
+
* the queue, so it runs again. The running callback is excluded,
|
|
662
|
+
* so one that re-schedules itself can't loop forever.
|
|
663
|
+
*/
|
|
664
|
+
addToCurrentFrame && callback !== running && queue.delete(callback);
|
|
652
665
|
queue.add(callback);
|
|
653
666
|
return callback;
|
|
654
667
|
},
|
|
@@ -683,6 +696,7 @@
|
|
|
683
696
|
// Clear the frame so no callbacks remain. This is to avoid
|
|
684
697
|
// memory leaks should this render step not run for a while.
|
|
685
698
|
thisFrame.clear();
|
|
699
|
+
running = undefined;
|
|
686
700
|
isProcessing = false;
|
|
687
701
|
if (flushNextFrame) {
|
|
688
702
|
flushNextFrame = false;
|
|
@@ -1029,7 +1043,7 @@
|
|
|
1029
1043
|
}
|
|
1030
1044
|
return springOptions;
|
|
1031
1045
|
}
|
|
1032
|
-
function
|
|
1046
|
+
function springGenerator(optionsOrVisualDuration = springDefaults.visualDuration, bounce = springDefaults.bounce) {
|
|
1033
1047
|
const options = typeof optionsOrVisualDuration !== "object"
|
|
1034
1048
|
? {
|
|
1035
1049
|
visualDuration: optionsOrVisualDuration,
|
|
@@ -1214,13 +1228,15 @@
|
|
|
1214
1228
|
};
|
|
1215
1229
|
return generator;
|
|
1216
1230
|
}
|
|
1217
|
-
spring
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1231
|
+
const spring = /* @__PURE__ */ Object.assign(springGenerator, {
|
|
1232
|
+
applyToOptions: (options) => {
|
|
1233
|
+
const generatorOptions = createGeneratorEasing(options, 100, springGenerator);
|
|
1234
|
+
options.ease = generatorOptions.ease;
|
|
1235
|
+
options.duration = motionUtils.secondsToMilliseconds(generatorOptions.duration);
|
|
1236
|
+
options.type = "keyframes";
|
|
1237
|
+
return options;
|
|
1238
|
+
},
|
|
1239
|
+
});
|
|
1224
1240
|
|
|
1225
1241
|
function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) {
|
|
1226
1242
|
const origin = keyframes[0];
|
|
@@ -2302,7 +2318,7 @@
|
|
|
2302
2318
|
|
|
2303
2319
|
const isNumOrPxType = (v) => v === number || v === px;
|
|
2304
2320
|
const transformKeys = new Set(["x", "y", "z"]);
|
|
2305
|
-
const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key));
|
|
2321
|
+
const nonTranslationalTransformKeys = /* @__PURE__ */ transformPropOrder.filter((key) => !transformKeys.has(key));
|
|
2306
2322
|
/**
|
|
2307
2323
|
* Reset any bounding box-changing transforms so the element can be
|
|
2308
2324
|
* measured. Returns the values to restore. Values already at their
|
|
@@ -2344,6 +2360,8 @@
|
|
|
2344
2360
|
? size
|
|
2345
2361
|
: size - parseFloat(paddingStart) - parseFloat(paddingEnd);
|
|
2346
2362
|
}
|
|
2363
|
+
const transformX = ({ transform }) => parseValueFromTransform(transform, "x");
|
|
2364
|
+
const transformY = ({ transform }) => parseValueFromTransform(transform, "y");
|
|
2347
2365
|
const positionalValues = {
|
|
2348
2366
|
// Dimensions
|
|
2349
2367
|
width: ({ width, paddingLeft = "0", paddingRight = "0", boxSizing }, measureBox) => measureDimension(width, measureBox, "x", paddingLeft, paddingRight, boxSizing),
|
|
@@ -2358,13 +2376,12 @@
|
|
|
2358
2376
|
const { x } = measureBox();
|
|
2359
2377
|
return parseFloat(left) + (x.max - x.min);
|
|
2360
2378
|
},
|
|
2361
|
-
// Transform
|
|
2362
|
-
x:
|
|
2363
|
-
y:
|
|
2379
|
+
// Transform, including translate longform names
|
|
2380
|
+
x: transformX,
|
|
2381
|
+
y: transformY,
|
|
2382
|
+
translateX: transformX,
|
|
2383
|
+
translateY: transformY,
|
|
2364
2384
|
};
|
|
2365
|
-
// Alias translate longform names
|
|
2366
|
-
positionalValues.translateX = positionalValues.x;
|
|
2367
|
-
positionalValues.translateY = positionalValues.y;
|
|
2368
2385
|
|
|
2369
2386
|
const toResolve = new Set();
|
|
2370
2387
|
let isScheduled = false;
|
|
@@ -2718,18 +2735,24 @@
|
|
|
2718
2735
|
if (this.isStopped)
|
|
2719
2736
|
return;
|
|
2720
2737
|
this.isStopped = true;
|
|
2721
|
-
|
|
2722
|
-
|
|
2738
|
+
/**
|
|
2739
|
+
* Before its finish event, a finished animation (an instant one is
|
|
2740
|
+
* as soon as it starts) is still showing its end, so it's stopped
|
|
2741
|
+
* like a running one. Otherwise that event would apply its end
|
|
2742
|
+
* over whatever animates the value next.
|
|
2743
|
+
*/
|
|
2744
|
+
if (this.state === "idle" || this.finishedTime !== null)
|
|
2723
2745
|
return;
|
|
2724
|
-
}
|
|
2725
2746
|
if (this.updateMotionValue) {
|
|
2726
2747
|
this.updateMotionValue();
|
|
2727
2748
|
}
|
|
2728
2749
|
else {
|
|
2729
2750
|
this.commitStyles();
|
|
2730
2751
|
}
|
|
2731
|
-
if (!this.isPseudoElement)
|
|
2752
|
+
if (!this.isPseudoElement) {
|
|
2753
|
+
this.animation.onfinish = null;
|
|
2732
2754
|
this.cancel();
|
|
2755
|
+
}
|
|
2733
2756
|
}
|
|
2734
2757
|
/**
|
|
2735
2758
|
* WAAPI doesn't natively have any interruption capabilities.
|
|
@@ -3038,7 +3061,13 @@
|
|
|
3038
3061
|
"borderBottomColor",
|
|
3039
3062
|
"borderLeftColor",
|
|
3040
3063
|
]);
|
|
3041
|
-
|
|
3064
|
+
/**
|
|
3065
|
+
* WAAPI runs on the browser's clock, so on a manual clock every animation
|
|
3066
|
+
* runs in JS where processFrame can drive it. Set the flag before starting
|
|
3067
|
+
* animations: running WAAPI animations stay on the browser's clock.
|
|
3068
|
+
*/
|
|
3069
|
+
const supportsWaapi = () => !motionUtils.MotionGlobalConfig.useManualTiming &&
|
|
3070
|
+
Object.hasOwnProperty.call(Element.prototype, "animate");
|
|
3042
3071
|
function supportsBrowserAnimation(options) {
|
|
3043
3072
|
const { motionValue, name, repeatDelay, repeatType, damping, type, keyframes, } = options;
|
|
3044
3073
|
/**
|
|
@@ -5229,12 +5258,8 @@
|
|
|
5229
5258
|
}
|
|
5230
5259
|
}
|
|
5231
5260
|
|
|
5232
|
-
function camelToDash(str) {
|
|
5233
|
-
return str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);
|
|
5234
|
-
}
|
|
5235
|
-
|
|
5236
5261
|
const optimizedAppearDataId = "framerAppearId";
|
|
5237
|
-
const optimizedAppearDataAttribute = "data-"
|
|
5262
|
+
const optimizedAppearDataAttribute = "data-framer-appear-id";
|
|
5238
5263
|
|
|
5239
5264
|
function getOptimisedAppearId(visualElement) {
|
|
5240
5265
|
return visualElement.props[optimizedAppearDataAttribute];
|
|
@@ -6162,6 +6187,10 @@
|
|
|
6162
6187
|
const styleEffect =
|
|
6163
6188
|
/*@__PURE__*/ createSelectorEffect(styleSubjectEffect);
|
|
6164
6189
|
|
|
6190
|
+
function camelToDash(str) {
|
|
6191
|
+
return str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);
|
|
6192
|
+
}
|
|
6193
|
+
|
|
6165
6194
|
function buildHTMLStyles(state, latestValues, transformTemplate) {
|
|
6166
6195
|
const { style, vars, transformOrigin } = state;
|
|
6167
6196
|
// Track whether we encounter any transform or transformOrigin values.
|
|
@@ -6737,6 +6766,41 @@
|
|
|
6737
6766
|
const { schedule: microtask, cancel: cancelMicrotask } =
|
|
6738
6767
|
/* @__PURE__ */ createRenderBatcher(queueMicrotask, false);
|
|
6739
6768
|
|
|
6769
|
+
/**
|
|
6770
|
+
* Process a frame now, for driving Motion from a loop other than
|
|
6771
|
+
* window.requestAnimationFrame, like an XRSession's during an immersive
|
|
6772
|
+
* WebXR session. Wherever window.requestAnimationFrame does fire, Motion
|
|
6773
|
+
* keeps processing frames from it too.
|
|
6774
|
+
*
|
|
6775
|
+
* `timestamp` defaults to now. For a timeline you control, set
|
|
6776
|
+
* `MotionGlobalConfig.useManualTiming = true` and pass each frame's time in
|
|
6777
|
+
* milliseconds.
|
|
6778
|
+
*
|
|
6779
|
+
* Animations Motion hands to the browser (WAAPI), like `opacity` or
|
|
6780
|
+
* `transform` on an HTML or SVG element, follow the browser's clock. With
|
|
6781
|
+
* `useManualTiming` on, Motion runs those in JS instead, except for
|
|
6782
|
+
* `motion/mini`, view transitions and optimized appear animations, and
|
|
6783
|
+
* colours only the browser can mix, like `oklch()`, which jump to their end.
|
|
6784
|
+
*
|
|
6785
|
+
* Ignored when called inside a frame.
|
|
6786
|
+
*/
|
|
6787
|
+
const processFrame = (timestamp = time.now()) => {
|
|
6788
|
+
if (frameData.isProcessing)
|
|
6789
|
+
return;
|
|
6790
|
+
const delta = timestamp - frameData.timestamp;
|
|
6791
|
+
// Clamp like the requestAnimationFrame loop, unless the timeline is ours
|
|
6792
|
+
frameData.delta = motionUtils.MotionGlobalConfig.useManualTiming
|
|
6793
|
+
? delta
|
|
6794
|
+
: Math.max(Math.min(delta, 40), 1);
|
|
6795
|
+
time.set((frameData.timestamp = timestamp));
|
|
6796
|
+
frameData.isProcessing = true;
|
|
6797
|
+
// frameSteps' keys are in stepsOrder
|
|
6798
|
+
for (const step in frameSteps) {
|
|
6799
|
+
frameSteps[step].process(frameData);
|
|
6800
|
+
}
|
|
6801
|
+
frameData.isProcessing = false;
|
|
6802
|
+
};
|
|
6803
|
+
|
|
6740
6804
|
function animateSingleValue(value, keyframes, options) {
|
|
6741
6805
|
const motionValue$1 = isMotionValue(value) ? value : motionValue(value);
|
|
6742
6806
|
motionValue$1.start(animateMotionValue("", motionValue$1, keyframes, options));
|
|
@@ -7203,10 +7267,9 @@
|
|
|
7203
7267
|
};
|
|
7204
7268
|
|
|
7205
7269
|
const defaultScaleCorrectors = {
|
|
7206
|
-
borderRadius: {
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
},
|
|
7270
|
+
borderRadius: /* @__PURE__ */ Object.assign({}, correctBorderRadius, {
|
|
7271
|
+
applyTo: /* @__PURE__ */ cornerRadiusProps.slice(),
|
|
7272
|
+
}),
|
|
7210
7273
|
borderTopLeftRadius: correctBorderRadius,
|
|
7211
7274
|
borderTopRightRadius: correctBorderRadius,
|
|
7212
7275
|
borderBottomLeftRadius: correctBorderRadius,
|
|
@@ -7311,14 +7374,6 @@
|
|
|
7311
7374
|
hasEverUpdated: false,
|
|
7312
7375
|
};
|
|
7313
7376
|
|
|
7314
|
-
/**
|
|
7315
|
-
* Correctors registered via addScaleCorrector before projection loaded
|
|
7316
|
-
* (e.g. with an async LazyMotion bundle) take precedence over the defaults.
|
|
7317
|
-
*/
|
|
7318
|
-
Object.assign(scaleCorrectors, {
|
|
7319
|
-
...defaultScaleCorrectors,
|
|
7320
|
-
...scaleCorrectors,
|
|
7321
|
-
});
|
|
7322
7377
|
const metrics = {
|
|
7323
7378
|
nodes: 0,
|
|
7324
7379
|
calculatedTargetDeltas: 0,
|
|
@@ -7361,6 +7416,16 @@
|
|
|
7361
7416
|
}
|
|
7362
7417
|
}
|
|
7363
7418
|
function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {
|
|
7419
|
+
/**
|
|
7420
|
+
* Correctors registered via addScaleCorrector before projection loaded
|
|
7421
|
+
* (e.g. with an async LazyMotion bundle) take precedence over the defaults.
|
|
7422
|
+
* Applied here rather than at module scope so bundlers can drop projection
|
|
7423
|
+
* when it's unused.
|
|
7424
|
+
*/
|
|
7425
|
+
Object.assign(scaleCorrectors, {
|
|
7426
|
+
...defaultScaleCorrectors,
|
|
7427
|
+
...scaleCorrectors,
|
|
7428
|
+
});
|
|
7364
7429
|
return class ProjectionNode {
|
|
7365
7430
|
constructor(latestValues = {}, parent = defaultParent?.()) {
|
|
7366
7431
|
/**
|
|
@@ -8017,7 +8082,7 @@
|
|
|
8017
8082
|
}
|
|
8018
8083
|
return boxWithoutScroll;
|
|
8019
8084
|
}
|
|
8020
|
-
applyTransform(box, transformOnly = false, output) {
|
|
8085
|
+
applyTransform(box, transformOnly = false, output, skipOwnTransform) {
|
|
8021
8086
|
const withTransforms = output || createBox();
|
|
8022
8087
|
copyBoxInto(withTransforms, box);
|
|
8023
8088
|
for (let i = 0; i < this.path.length; i++) {
|
|
@@ -8033,7 +8098,7 @@
|
|
|
8033
8098
|
continue;
|
|
8034
8099
|
transformBox(withTransforms, node.latestValues, node.layout?.layoutBox);
|
|
8035
8100
|
}
|
|
8036
|
-
if (hasTransform(this.latestValues)) {
|
|
8101
|
+
if (!skipOwnTransform && hasTransform(this.latestValues)) {
|
|
8037
8102
|
transformBox(withTransforms, this.latestValues, this.layout?.layoutBox);
|
|
8038
8103
|
}
|
|
8039
8104
|
return withTransforms;
|
|
@@ -8168,7 +8233,11 @@
|
|
|
8168
8233
|
}
|
|
8169
8234
|
else if (this.targetDelta) {
|
|
8170
8235
|
if (Boolean(this.resumingFrom)) {
|
|
8171
|
-
|
|
8236
|
+
/**
|
|
8237
|
+
* Own transforms are applied later, in applyTransformsToTarget,
|
|
8238
|
+
* so only apply ancestor transforms here or they'd be doubled.
|
|
8239
|
+
*/
|
|
8240
|
+
this.applyTransform(this.layout.layoutBox, false, this.target, true);
|
|
8172
8241
|
}
|
|
8173
8242
|
else {
|
|
8174
8243
|
copyBoxInto(this.target, this.layout.layoutBox);
|
|
@@ -8937,10 +9006,13 @@
|
|
|
8937
9006
|
* A dragged node doesn't layout animate, so it jumps to its new layout. Shift
|
|
8938
9007
|
* its descendants' snapshots by the same amount, so they only animate layout
|
|
8939
9008
|
* changes relative to it, rather than lagging behind.
|
|
9009
|
+
*
|
|
9010
|
+
* If its drag ended since the snapshot (e.g. drag disabled from onDrag), it
|
|
9011
|
+
* layout animates again, so its descendants mustn't follow its jump.
|
|
8940
9012
|
*/
|
|
8941
9013
|
function followDraggedAncestor(node) {
|
|
8942
9014
|
const { snapshot, dragAncestor } = node;
|
|
8943
|
-
const to = dragAncestor?.layout;
|
|
9015
|
+
const to = dragAncestor?.isAnimationBlocked && dragAncestor.layout;
|
|
8944
9016
|
if (!snapshot || !to || node.resumeFrom || node.isAnimationBlocked)
|
|
8945
9017
|
return;
|
|
8946
9018
|
const from = dragAncestor.dragSnapshot;
|
|
@@ -9054,11 +9126,16 @@
|
|
|
9054
9126
|
return () => target.removeEventListener(eventName, handler, options);
|
|
9055
9127
|
}
|
|
9056
9128
|
|
|
9057
|
-
const DocumentProjectionNode =
|
|
9129
|
+
const DocumentProjectionNode =
|
|
9130
|
+
/* @__PURE__ */ createProjectionNode({
|
|
9058
9131
|
attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify),
|
|
9059
9132
|
measureScroll: () => ({
|
|
9060
|
-
x: document.documentElement.scrollLeft ||
|
|
9061
|
-
|
|
9133
|
+
x: document.documentElement.scrollLeft ||
|
|
9134
|
+
document.body?.scrollLeft ||
|
|
9135
|
+
0,
|
|
9136
|
+
y: document.documentElement.scrollTop ||
|
|
9137
|
+
document.body?.scrollTop ||
|
|
9138
|
+
0,
|
|
9062
9139
|
}),
|
|
9063
9140
|
checkIsScrollRoot: () => true,
|
|
9064
9141
|
});
|
|
@@ -9066,7 +9143,9 @@
|
|
|
9066
9143
|
const rootProjectionNode = {
|
|
9067
9144
|
current: undefined,
|
|
9068
9145
|
};
|
|
9069
|
-
|
|
9146
|
+
|
|
9147
|
+
const HTMLProjectionNode =
|
|
9148
|
+
/* @__PURE__ */ createProjectionNode({
|
|
9070
9149
|
measureScroll: (instance) => ({
|
|
9071
9150
|
x: instance.scrollLeft,
|
|
9072
9151
|
y: instance.scrollTop,
|
|
@@ -9110,7 +9189,7 @@
|
|
|
9110
9189
|
"whileDrag",
|
|
9111
9190
|
"exit",
|
|
9112
9191
|
];
|
|
9113
|
-
const variantProps = ["initial"
|
|
9192
|
+
const variantProps = /* @__PURE__ */ ["initial"].concat(variantPriorityOrder);
|
|
9114
9193
|
|
|
9115
9194
|
function isControllingVariants(props) {
|
|
9116
9195
|
if (isAnimationControls(props.animate))
|
|
@@ -10956,7 +11035,11 @@
|
|
|
10956
11035
|
element: this.visualElement.current,
|
|
10957
11036
|
});
|
|
10958
11037
|
}
|
|
10959
|
-
|
|
11038
|
+
/**
|
|
11039
|
+
* @param dragAxes - The axes to animate on release, if not the `drag`
|
|
11040
|
+
* prop's, e.g. when drag was disabled mid-gesture.
|
|
11041
|
+
*/
|
|
11042
|
+
stop(event, panInfo, dragAxes) {
|
|
10960
11043
|
const finalEvent = event || this.latestPointerEvent;
|
|
10961
11044
|
const finalPanInfo = panInfo || this.latestPanInfo;
|
|
10962
11045
|
const isDragging = this.isDragging;
|
|
@@ -10964,7 +11047,7 @@
|
|
|
10964
11047
|
if (!isDragging || !finalPanInfo || !finalEvent)
|
|
10965
11048
|
return;
|
|
10966
11049
|
const { velocity } = finalPanInfo;
|
|
10967
|
-
this.startAnimation(velocity);
|
|
11050
|
+
this.startAnimation(velocity, dragAxes);
|
|
10968
11051
|
const { onDragEnd } = this.getProps();
|
|
10969
11052
|
if (onDragEnd) {
|
|
10970
11053
|
frame.postRender(() => onDragEnd(finalEvent, finalPanInfo));
|
|
@@ -11085,11 +11168,11 @@
|
|
|
11085
11168
|
}
|
|
11086
11169
|
return measuredConstraints;
|
|
11087
11170
|
}
|
|
11088
|
-
startAnimation(velocity) {
|
|
11171
|
+
startAnimation(velocity, dragAxes) {
|
|
11089
11172
|
const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps();
|
|
11090
11173
|
const constraints = this.constraints || {};
|
|
11091
11174
|
const momentumAnimations = eachAxis((axis) => {
|
|
11092
|
-
if (!shouldDrag(axis, drag, this.currentDirection)) {
|
|
11175
|
+
if (!shouldDrag(axis, dragAxes || drag, this.currentDirection)) {
|
|
11093
11176
|
return;
|
|
11094
11177
|
}
|
|
11095
11178
|
let transition = (constraints && constraints[axis]) || {};
|
|
@@ -11292,9 +11375,15 @@
|
|
|
11292
11375
|
const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => {
|
|
11293
11376
|
if (this.isDragging && hasLayoutChanged) {
|
|
11294
11377
|
eachAxis((axis) => {
|
|
11295
|
-
|
|
11296
|
-
|
|
11378
|
+
/**
|
|
11379
|
+
* Only compensate axes this gesture drags. A
|
|
11380
|
+
* non-drag axis follows its layout instead, as
|
|
11381
|
+
* nothing would ever move it back (e.g. snapping
|
|
11382
|
+
* to origin only animates drag axes).
|
|
11383
|
+
*/
|
|
11384
|
+
if (!shouldDrag(axis, this.getProps().drag, this.currentDirection))
|
|
11297
11385
|
return;
|
|
11386
|
+
const motionValue = this.getAxisMotionValue(axis);
|
|
11298
11387
|
this.originPoint[axis] += delta[axis].translate;
|
|
11299
11388
|
motionValue.set(motionValue.get() + delta[axis].translate);
|
|
11300
11389
|
});
|
|
@@ -13769,8 +13858,7 @@
|
|
|
13769
13858
|
const valueHasChanged = Array.isArray(next) && Array.isArray(prev)
|
|
13770
13859
|
? !shallowCompare(next, prev) || variantDidChange
|
|
13771
13860
|
: next !== prev;
|
|
13772
|
-
if (valueHasChanged &&
|
|
13773
|
-
(next === undefined || next === null)) {
|
|
13861
|
+
if (valueHasChanged && (next === undefined || next === null)) {
|
|
13774
13862
|
removedKeys.add(key);
|
|
13775
13863
|
}
|
|
13776
13864
|
else if (valueHasChanged ||
|
|
@@ -14236,6 +14324,7 @@
|
|
|
14236
14324
|
exports.positionalKeys = positionalKeys;
|
|
14237
14325
|
exports.prefersReducedMotion = prefersReducedMotion;
|
|
14238
14326
|
exports.press = press;
|
|
14327
|
+
exports.processFrame = processFrame;
|
|
14239
14328
|
exports.progressPercentage = progressPercentage;
|
|
14240
14329
|
exports.propEffect = propEffect;
|
|
14241
14330
|
exports.propagateDirtyNodes = propagateDirtyNodes;
|