motion-dom 12.35.2 → 12.37.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 +181 -75
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/animation/AsyncMotionValueAnimation.mjs +23 -7
- package/dist/es/animation/AsyncMotionValueAnimation.mjs.map +1 -1
- package/dist/es/animation/JSAnimation.mjs +16 -3
- package/dist/es/animation/JSAnimation.mjs.map +1 -1
- package/dist/es/animation/interfaces/motion-value.mjs +1 -1
- package/dist/es/animation/interfaces/motion-value.mjs.map +1 -1
- package/dist/es/animation/keyframes/utils/unit-conversion.mjs +12 -2
- package/dist/es/animation/keyframes/utils/unit-conversion.mjs.map +1 -1
- package/dist/es/animation/utils/active-animations.mjs +5 -2
- package/dist/es/animation/utils/active-animations.mjs.map +1 -1
- package/dist/es/animation/utils/is-transition-defined.mjs +18 -2
- package/dist/es/animation/utils/is-transition-defined.mjs.map +1 -1
- package/dist/es/animation/waapi/supports/waapi.mjs +21 -12
- package/dist/es/animation/waapi/supports/waapi.mjs.map +1 -1
- package/dist/es/animation/waapi/utils/is-browser-color.mjs +13 -0
- package/dist/es/animation/waapi/utils/is-browser-color.mjs.map +1 -0
- package/dist/es/frameloop/batcher.mjs +3 -2
- package/dist/es/frameloop/batcher.mjs.map +1 -1
- package/dist/es/frameloop/render-step.mjs +5 -3
- package/dist/es/frameloop/render-step.mjs.map +1 -1
- package/dist/es/index.mjs +1 -1
- package/dist/es/layout/LayoutAnimationBuilder.mjs.map +1 -1
- package/dist/es/projection/animation/mix-values.mjs +8 -3
- package/dist/es/projection/animation/mix-values.mjs.map +1 -1
- package/dist/es/projection/geometry/delta-apply.mjs +4 -6
- package/dist/es/projection/geometry/delta-apply.mjs.map +1 -1
- package/dist/es/projection/node/create-projection-node.mjs +31 -10
- package/dist/es/projection/node/create-projection-node.mjs.map +1 -1
- package/dist/es/utils/is-html-element.mjs +3 -1
- package/dist/es/utils/is-html-element.mjs.map +1 -1
- package/dist/es/value/follow-value.mjs +13 -1
- package/dist/es/value/follow-value.mjs.map +1 -1
- package/dist/index.d.ts +28 -12
- package/dist/motion-dom.dev.js +181 -75
- 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/es/animation/utils/get-final-keyframe.mjs +0 -13
- package/dist/es/animation/utils/get-final-keyframe.mjs.map +0 -1
package/dist/motion-dom.dev.js
CHANGED
|
@@ -60,8 +60,7 @@
|
|
|
60
60
|
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
61
61
|
if (keepAlive)
|
|
62
62
|
toKeepAlive.add(callback);
|
|
63
|
-
|
|
64
|
-
queue.add(callback);
|
|
63
|
+
queue.add(callback);
|
|
65
64
|
return callback;
|
|
66
65
|
},
|
|
67
66
|
/**
|
|
@@ -86,7 +85,10 @@
|
|
|
86
85
|
return;
|
|
87
86
|
}
|
|
88
87
|
isProcessing = true;
|
|
89
|
-
|
|
88
|
+
// Swap this frame and the next to avoid GC
|
|
89
|
+
const prevFrame = thisFrame;
|
|
90
|
+
thisFrame = nextFrame;
|
|
91
|
+
nextFrame = prevFrame;
|
|
90
92
|
// Execute this frame
|
|
91
93
|
thisFrame.forEach(triggerCallback);
|
|
92
94
|
/**
|
|
@@ -125,11 +127,12 @@
|
|
|
125
127
|
}, {});
|
|
126
128
|
const { setup, read, resolveKeyframes, preUpdate, update, preRender, render, postRender, } = steps;
|
|
127
129
|
const processBatch = () => {
|
|
128
|
-
const
|
|
130
|
+
const useManualTiming = motionUtils.MotionGlobalConfig.useManualTiming;
|
|
131
|
+
const timestamp = useManualTiming
|
|
129
132
|
? state.timestamp
|
|
130
133
|
: performance.now();
|
|
131
134
|
runNextFrame = false;
|
|
132
|
-
if (!
|
|
135
|
+
if (!useManualTiming) {
|
|
133
136
|
state.delta = useDefaultElapsed
|
|
134
137
|
? 1000 / 60
|
|
135
138
|
: Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
|
|
@@ -1321,9 +1324,9 @@
|
|
|
1321
1324
|
};
|
|
1322
1325
|
}
|
|
1323
1326
|
|
|
1324
|
-
const isNotNull
|
|
1325
|
-
function getFinalKeyframe
|
|
1326
|
-
const resolvedKeyframes = keyframes.filter(isNotNull
|
|
1327
|
+
const isNotNull = (value) => value !== null;
|
|
1328
|
+
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe, speed = 1) {
|
|
1329
|
+
const resolvedKeyframes = keyframes.filter(isNotNull);
|
|
1327
1330
|
const useFirstKeyframe = speed < 0 || (repeat && repeatType !== "loop" && repeat % 2 === 1);
|
|
1328
1331
|
const index = useFirstKeyframe ? 0 : resolvedKeyframes.length - 1;
|
|
1329
1332
|
return !index || finalKeyframe === undefined
|
|
@@ -1388,6 +1391,14 @@
|
|
|
1388
1391
|
* Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.
|
|
1389
1392
|
*/
|
|
1390
1393
|
this.playbackSpeed = 1;
|
|
1394
|
+
/**
|
|
1395
|
+
* Reusable state object for the delay phase to avoid
|
|
1396
|
+
* allocating a new object every frame.
|
|
1397
|
+
*/
|
|
1398
|
+
this.delayState = {
|
|
1399
|
+
done: false,
|
|
1400
|
+
value: undefined,
|
|
1401
|
+
};
|
|
1391
1402
|
/**
|
|
1392
1403
|
* This method is bound to the instance to fix a pattern where
|
|
1393
1404
|
* animation.stop is returned as a reference from a useEffect.
|
|
@@ -1549,9 +1560,14 @@
|
|
|
1549
1560
|
* This prevents delay: x, duration: 0 animations from finishing
|
|
1550
1561
|
* instantly.
|
|
1551
1562
|
*/
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1563
|
+
let state;
|
|
1564
|
+
if (isInDelayPhase) {
|
|
1565
|
+
this.delayState.value = keyframes[0];
|
|
1566
|
+
state = this.delayState;
|
|
1567
|
+
}
|
|
1568
|
+
else {
|
|
1569
|
+
state = frameGenerator.next(elapsed);
|
|
1570
|
+
}
|
|
1555
1571
|
if (mixKeyframes && !isInDelayPhase) {
|
|
1556
1572
|
state.value = mixKeyframes(state.value);
|
|
1557
1573
|
}
|
|
@@ -1566,7 +1582,7 @@
|
|
|
1566
1582
|
(this.state === "finished" || (this.state === "running" && done));
|
|
1567
1583
|
// TODO: The exception for inertia could be cleaner here
|
|
1568
1584
|
if (isAnimationFinished && type !== inertia) {
|
|
1569
|
-
state.value = getFinalKeyframe
|
|
1585
|
+
state.value = getFinalKeyframe(keyframes, this.options, finalKeyframe, this.speed);
|
|
1570
1586
|
}
|
|
1571
1587
|
if (onUpdate) {
|
|
1572
1588
|
onUpdate(state.value);
|
|
@@ -1861,8 +1877,18 @@
|
|
|
1861
1877
|
}
|
|
1862
1878
|
const positionalValues = {
|
|
1863
1879
|
// Dimensions
|
|
1864
|
-
width: ({ x }, { paddingLeft = "0", paddingRight = "0" }) =>
|
|
1865
|
-
|
|
1880
|
+
width: ({ x }, { paddingLeft = "0", paddingRight = "0", boxSizing }) => {
|
|
1881
|
+
const width = x.max - x.min;
|
|
1882
|
+
return boxSizing === "border-box"
|
|
1883
|
+
? width
|
|
1884
|
+
: width - parseFloat(paddingLeft) - parseFloat(paddingRight);
|
|
1885
|
+
},
|
|
1886
|
+
height: ({ y }, { paddingTop = "0", paddingBottom = "0", boxSizing }) => {
|
|
1887
|
+
const height = y.max - y.min;
|
|
1888
|
+
return boxSizing === "border-box"
|
|
1889
|
+
? height
|
|
1890
|
+
: height - parseFloat(paddingTop) - parseFloat(paddingBottom);
|
|
1891
|
+
},
|
|
1866
1892
|
top: (_bbox, { top }) => parseFloat(top),
|
|
1867
1893
|
left: (_bbox, { left }) => parseFloat(left),
|
|
1868
1894
|
bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min),
|
|
@@ -2164,7 +2190,7 @@
|
|
|
2164
2190
|
this.animation.onfinish = () => {
|
|
2165
2191
|
this.finishedTime = this.time;
|
|
2166
2192
|
if (!pseudoElement) {
|
|
2167
|
-
const keyframe = getFinalKeyframe
|
|
2193
|
+
const keyframe = getFinalKeyframe(keyframes, this.options, finalKeyframe, this.speed);
|
|
2168
2194
|
if (this.updateMotionValue) {
|
|
2169
2195
|
this.updateMotionValue(keyframe);
|
|
2170
2196
|
}
|
|
@@ -2470,17 +2496,42 @@
|
|
|
2470
2496
|
/**
|
|
2471
2497
|
* A list of values that can be hardware-accelerated.
|
|
2472
2498
|
*/
|
|
2473
|
-
const acceleratedValues
|
|
2499
|
+
const acceleratedValues = new Set([
|
|
2474
2500
|
"opacity",
|
|
2475
2501
|
"clipPath",
|
|
2476
2502
|
"filter",
|
|
2477
2503
|
"transform",
|
|
2478
|
-
// TODO:
|
|
2504
|
+
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
|
|
2505
|
+
// or until we implement support for linear() easing.
|
|
2479
2506
|
// "background-color"
|
|
2480
2507
|
]);
|
|
2508
|
+
|
|
2509
|
+
const browserColorFunctions = /^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;
|
|
2510
|
+
function hasBrowserOnlyColors(keyframes) {
|
|
2511
|
+
for (let i = 0; i < keyframes.length; i++) {
|
|
2512
|
+
if (typeof keyframes[i] === "string" &&
|
|
2513
|
+
browserColorFunctions.test(keyframes[i])) {
|
|
2514
|
+
return true;
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
return false;
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
const colorProperties = new Set([
|
|
2521
|
+
"color",
|
|
2522
|
+
"backgroundColor",
|
|
2523
|
+
"outlineColor",
|
|
2524
|
+
"fill",
|
|
2525
|
+
"stroke",
|
|
2526
|
+
"borderColor",
|
|
2527
|
+
"borderTopColor",
|
|
2528
|
+
"borderRightColor",
|
|
2529
|
+
"borderBottomColor",
|
|
2530
|
+
"borderLeftColor",
|
|
2531
|
+
]);
|
|
2481
2532
|
const supportsWaapi = /*@__PURE__*/ motionUtils.memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
2482
2533
|
function supportsBrowserAnimation(options) {
|
|
2483
|
-
const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
|
|
2534
|
+
const { motionValue, name, repeatDelay, repeatType, damping, type, keyframes, } = options;
|
|
2484
2535
|
const subject = motionValue?.owner?.current;
|
|
2485
2536
|
/**
|
|
2486
2537
|
* We use this check instead of isHTMLElement() because we explicitly
|
|
@@ -2494,7 +2545,13 @@
|
|
|
2494
2545
|
const { onUpdate, transformTemplate } = motionValue.owner.getProps();
|
|
2495
2546
|
return (supportsWaapi() &&
|
|
2496
2547
|
name &&
|
|
2497
|
-
|
|
2548
|
+
/**
|
|
2549
|
+
* Force WAAPI for color properties with browser-only color formats
|
|
2550
|
+
* (oklch, oklab, lab, lch, etc.) that the JS animation path can't parse.
|
|
2551
|
+
*/
|
|
2552
|
+
(acceleratedValues.has(name) ||
|
|
2553
|
+
(colorProperties.has(name) &&
|
|
2554
|
+
hasBrowserOnlyColors(keyframes))) &&
|
|
2498
2555
|
(name !== "transform" || !transformTemplate) &&
|
|
2499
2556
|
/**
|
|
2500
2557
|
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
@@ -2554,9 +2611,11 @@
|
|
|
2554
2611
|
* If we can't animate this value with the resolved keyframes
|
|
2555
2612
|
* then we should complete it immediately.
|
|
2556
2613
|
*/
|
|
2614
|
+
let canAnimateValue = true;
|
|
2557
2615
|
if (!canAnimate(keyframes, name, type, velocity)) {
|
|
2616
|
+
canAnimateValue = false;
|
|
2558
2617
|
if (motionUtils.MotionGlobalConfig.instantAnimations || !delay) {
|
|
2559
|
-
onUpdate?.(getFinalKeyframe
|
|
2618
|
+
onUpdate?.(getFinalKeyframe(keyframes, options, finalKeyframe));
|
|
2560
2619
|
}
|
|
2561
2620
|
keyframes[0] = keyframes[keyframes.length - 1];
|
|
2562
2621
|
makeAnimationInstant(options);
|
|
@@ -2591,15 +2650,29 @@
|
|
|
2591
2650
|
* Animate via WAAPI if possible. If this is a handoff animation, the optimised animation will be running via
|
|
2592
2651
|
* WAAPI. Therefore, this animation must be JS to ensure it runs "under" the
|
|
2593
2652
|
* optimised animation.
|
|
2653
|
+
*
|
|
2654
|
+
* Also skip WAAPI when keyframes aren't animatable, as the resolved
|
|
2655
|
+
* values may not be valid CSS and would trigger browser warnings.
|
|
2594
2656
|
*/
|
|
2595
|
-
const useWaapi =
|
|
2657
|
+
const useWaapi = canAnimateValue &&
|
|
2658
|
+
!isHandoff &&
|
|
2659
|
+
supportsBrowserAnimation(resolvedOptions);
|
|
2596
2660
|
const element = resolvedOptions.motionValue?.owner?.current;
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2661
|
+
let animation;
|
|
2662
|
+
if (useWaapi) {
|
|
2663
|
+
try {
|
|
2664
|
+
animation = new NativeAnimationExtended({
|
|
2665
|
+
...resolvedOptions,
|
|
2666
|
+
element,
|
|
2667
|
+
});
|
|
2668
|
+
}
|
|
2669
|
+
catch {
|
|
2670
|
+
animation = new JSAnimation(resolvedOptions);
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
else {
|
|
2674
|
+
animation = new JSAnimation(resolvedOptions);
|
|
2675
|
+
}
|
|
2603
2676
|
animation.finished.then(() => {
|
|
2604
2677
|
this.notifyFinished();
|
|
2605
2678
|
}).catch(motionUtils.noop);
|
|
@@ -2777,8 +2850,11 @@
|
|
|
2777
2850
|
const animationMaps = new WeakMap();
|
|
2778
2851
|
const animationMapKey = (name, pseudoElement = "") => `${name}:${pseudoElement}`;
|
|
2779
2852
|
function getAnimationMap(element) {
|
|
2780
|
-
|
|
2781
|
-
|
|
2853
|
+
let map = animationMaps.get(element);
|
|
2854
|
+
if (!map) {
|
|
2855
|
+
map = new Map();
|
|
2856
|
+
animationMaps.set(element, map);
|
|
2857
|
+
}
|
|
2782
2858
|
return map;
|
|
2783
2859
|
}
|
|
2784
2860
|
|
|
@@ -2870,17 +2946,6 @@
|
|
|
2870
2946
|
return ease;
|
|
2871
2947
|
};
|
|
2872
2948
|
|
|
2873
|
-
const isNotNull = (value) => value !== null;
|
|
2874
|
-
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe) {
|
|
2875
|
-
const resolvedKeyframes = keyframes.filter(isNotNull);
|
|
2876
|
-
const index = repeat && repeatType !== "loop" && repeat % 2 === 1
|
|
2877
|
-
? 0
|
|
2878
|
-
: resolvedKeyframes.length - 1;
|
|
2879
|
-
return !index || finalKeyframe === undefined
|
|
2880
|
-
? resolvedKeyframes[index]
|
|
2881
|
-
: finalKeyframe;
|
|
2882
|
-
}
|
|
2883
|
-
|
|
2884
2949
|
/**
|
|
2885
2950
|
* If `transition` has `inherit: true`, shallow-merge it with
|
|
2886
2951
|
* `parentTransition` (child keys win) and strip the `inherit` key.
|
|
@@ -2904,13 +2969,29 @@
|
|
|
2904
2969
|
return valueTransition;
|
|
2905
2970
|
}
|
|
2906
2971
|
|
|
2972
|
+
const orchestrationKeys = new Set([
|
|
2973
|
+
"when",
|
|
2974
|
+
"delay",
|
|
2975
|
+
"delayChildren",
|
|
2976
|
+
"staggerChildren",
|
|
2977
|
+
"staggerDirection",
|
|
2978
|
+
"repeat",
|
|
2979
|
+
"repeatType",
|
|
2980
|
+
"repeatDelay",
|
|
2981
|
+
"from",
|
|
2982
|
+
"elapsed",
|
|
2983
|
+
]);
|
|
2907
2984
|
/**
|
|
2908
2985
|
* Decide whether a transition is defined on a given Transition.
|
|
2909
2986
|
* This filters out orchestration options and returns true
|
|
2910
2987
|
* if any options are left.
|
|
2911
2988
|
*/
|
|
2912
|
-
function isTransitionDefined(
|
|
2913
|
-
|
|
2989
|
+
function isTransitionDefined(transition) {
|
|
2990
|
+
for (const key in transition) {
|
|
2991
|
+
if (!orchestrationKeys.has(key))
|
|
2992
|
+
return true;
|
|
2993
|
+
}
|
|
2994
|
+
return false;
|
|
2914
2995
|
}
|
|
2915
2996
|
|
|
2916
2997
|
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
|
|
@@ -4042,19 +4123,6 @@
|
|
|
4042
4123
|
return true;
|
|
4043
4124
|
});
|
|
4044
4125
|
|
|
4045
|
-
/**
|
|
4046
|
-
* A list of values that can be hardware-accelerated.
|
|
4047
|
-
*/
|
|
4048
|
-
const acceleratedValues = new Set([
|
|
4049
|
-
"opacity",
|
|
4050
|
-
"clipPath",
|
|
4051
|
-
"filter",
|
|
4052
|
-
"transform",
|
|
4053
|
-
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
|
|
4054
|
-
// or until we implement support for linear() easing.
|
|
4055
|
-
// "background-color"
|
|
4056
|
-
]);
|
|
4057
|
-
|
|
4058
4126
|
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
4059
4127
|
if (elementOrSelector == null) {
|
|
4060
4128
|
return [];
|
|
@@ -4200,7 +4268,9 @@
|
|
|
4200
4268
|
* that works across iframes
|
|
4201
4269
|
*/
|
|
4202
4270
|
function isHTMLElement(element) {
|
|
4203
|
-
return motionUtils.isObject(element) &&
|
|
4271
|
+
return (motionUtils.isObject(element) &&
|
|
4272
|
+
"offsetHeight" in element &&
|
|
4273
|
+
!("ownerSVGElement" in element));
|
|
4204
4274
|
}
|
|
4205
4275
|
|
|
4206
4276
|
const translateAlias$1 = {
|
|
@@ -4938,6 +5008,7 @@
|
|
|
4938
5008
|
activeAnimation.stop();
|
|
4939
5009
|
activeAnimation = null;
|
|
4940
5010
|
}
|
|
5011
|
+
value.animation = undefined;
|
|
4941
5012
|
};
|
|
4942
5013
|
const startAnimation = () => {
|
|
4943
5014
|
const currentValue = asNumber$1(value.get());
|
|
@@ -4969,8 +5040,10 @@
|
|
|
4969
5040
|
// multiple calls within the same frame (e.g. rapid mouse events)
|
|
4970
5041
|
const scheduleAnimation = () => {
|
|
4971
5042
|
startAnimation();
|
|
5043
|
+
value.animation = activeAnimation ?? undefined;
|
|
4972
5044
|
value["events"].animationStart?.notify();
|
|
4973
5045
|
activeAnimation?.then(() => {
|
|
5046
|
+
value.animation = undefined;
|
|
4974
5047
|
value["events"].animationComplete?.notify();
|
|
4975
5048
|
});
|
|
4976
5049
|
};
|
|
@@ -4980,7 +5053,16 @@
|
|
|
4980
5053
|
frame.postRender(scheduleAnimation);
|
|
4981
5054
|
}, stopAnimation);
|
|
4982
5055
|
if (isMotionValue(source)) {
|
|
4983
|
-
|
|
5056
|
+
let skipNextAnimation = options.skipInitialAnimation === true;
|
|
5057
|
+
const removeSourceOnChange = source.on("change", (v) => {
|
|
5058
|
+
if (skipNextAnimation) {
|
|
5059
|
+
skipNextAnimation = false;
|
|
5060
|
+
value.jump(parseValue(v, unit), false);
|
|
5061
|
+
}
|
|
5062
|
+
else {
|
|
5063
|
+
value.set(parseValue(v, unit));
|
|
5064
|
+
}
|
|
5065
|
+
});
|
|
4984
5066
|
const removeValueOnDestroy = value.on("destroy", removeSourceOnChange);
|
|
4985
5067
|
return () => {
|
|
4986
5068
|
removeSourceOnChange();
|
|
@@ -6260,10 +6342,8 @@
|
|
|
6260
6342
|
node.options.layoutScroll &&
|
|
6261
6343
|
node.scroll &&
|
|
6262
6344
|
node !== node.root) {
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
y: -node.scroll.offset.y,
|
|
6266
|
-
});
|
|
6345
|
+
translateAxis(box.x, -node.scroll.offset.x);
|
|
6346
|
+
translateAxis(box.y, -node.scroll.offset.y);
|
|
6267
6347
|
}
|
|
6268
6348
|
if (delta) {
|
|
6269
6349
|
// Incoporate each ancestor's scale into a cumulative treeScale for this component
|
|
@@ -6290,8 +6370,8 @@
|
|
|
6290
6370
|
}
|
|
6291
6371
|
}
|
|
6292
6372
|
function translateAxis(axis, distance) {
|
|
6293
|
-
axis.min
|
|
6294
|
-
axis.max
|
|
6373
|
+
axis.min += distance;
|
|
6374
|
+
axis.max += distance;
|
|
6295
6375
|
}
|
|
6296
6376
|
/**
|
|
6297
6377
|
* Apply a transform to an axis from the latest resolved motion values.
|
|
@@ -7458,8 +7538,13 @@
|
|
|
7458
7538
|
return transform || "none";
|
|
7459
7539
|
}
|
|
7460
7540
|
|
|
7461
|
-
const
|
|
7462
|
-
|
|
7541
|
+
const borderLabels = [
|
|
7542
|
+
"borderTopLeftRadius",
|
|
7543
|
+
"borderTopRightRadius",
|
|
7544
|
+
"borderBottomLeftRadius",
|
|
7545
|
+
"borderBottomRightRadius",
|
|
7546
|
+
];
|
|
7547
|
+
const numBorders = borderLabels.length;
|
|
7463
7548
|
const asNumber = (value) => typeof value === "string" ? parseFloat(value) : value;
|
|
7464
7549
|
const isPx = (value) => typeof value === "number" || px.test(value);
|
|
7465
7550
|
function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {
|
|
@@ -7474,7 +7559,7 @@
|
|
|
7474
7559
|
* Mix border radius
|
|
7475
7560
|
*/
|
|
7476
7561
|
for (let i = 0; i < numBorders; i++) {
|
|
7477
|
-
const borderLabel =
|
|
7562
|
+
const borderLabel = borderLabels[i];
|
|
7478
7563
|
let followRadius = getRadius(follow, borderLabel);
|
|
7479
7564
|
let leadRadius = getRadius(lead, borderLabel);
|
|
7480
7565
|
if (followRadius === undefined && leadRadius === undefined)
|
|
@@ -8119,6 +8204,11 @@
|
|
|
8119
8204
|
}
|
|
8120
8205
|
else {
|
|
8121
8206
|
this.isUpdating = false;
|
|
8207
|
+
/**
|
|
8208
|
+
* Ensure animation-blocked nodes (e.g. during drag)
|
|
8209
|
+
* get measured even when memoized (willUpdate skipped).
|
|
8210
|
+
*/
|
|
8211
|
+
this.nodes.forEach(ensureDraggedNodesSnapshotted);
|
|
8122
8212
|
/**
|
|
8123
8213
|
* Write
|
|
8124
8214
|
*/
|
|
@@ -8217,7 +8307,8 @@
|
|
|
8217
8307
|
const prevLayout = this.layout;
|
|
8218
8308
|
this.layout = this.measure(false);
|
|
8219
8309
|
this.layoutVersion++;
|
|
8220
|
-
this.layoutCorrected
|
|
8310
|
+
if (!this.layoutCorrected)
|
|
8311
|
+
this.layoutCorrected = createBox();
|
|
8221
8312
|
this.isLayoutDirty = false;
|
|
8222
8313
|
this.projectionDelta = undefined;
|
|
8223
8314
|
this.notifyListeners("measure", this.layout.layoutBox);
|
|
@@ -8328,8 +8419,8 @@
|
|
|
8328
8419
|
}
|
|
8329
8420
|
return boxWithoutScroll;
|
|
8330
8421
|
}
|
|
8331
|
-
applyTransform(box, transformOnly = false) {
|
|
8332
|
-
const withTransforms = createBox();
|
|
8422
|
+
applyTransform(box, transformOnly = false, output) {
|
|
8423
|
+
const withTransforms = output || createBox();
|
|
8333
8424
|
copyBoxInto(withTransforms, box);
|
|
8334
8425
|
for (let i = 0; i < this.path.length; i++) {
|
|
8335
8426
|
const node = this.path[i];
|
|
@@ -8337,10 +8428,8 @@
|
|
|
8337
8428
|
node.options.layoutScroll &&
|
|
8338
8429
|
node.scroll &&
|
|
8339
8430
|
node !== node.root) {
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
y: -node.scroll.offset.y,
|
|
8343
|
-
});
|
|
8431
|
+
translateAxis(withTransforms.x, -node.scroll.offset.x);
|
|
8432
|
+
translateAxis(withTransforms.y, -node.scroll.offset.y);
|
|
8344
8433
|
}
|
|
8345
8434
|
if (!hasTransform(node.latestValues))
|
|
8346
8435
|
continue;
|
|
@@ -8483,8 +8572,7 @@
|
|
|
8483
8572
|
}
|
|
8484
8573
|
else if (this.targetDelta) {
|
|
8485
8574
|
if (Boolean(this.resumingFrom)) {
|
|
8486
|
-
|
|
8487
|
-
this.target = this.applyTransform(this.layout.layoutBox);
|
|
8575
|
+
this.applyTransform(this.layout.layoutBox, false, this.target);
|
|
8488
8576
|
}
|
|
8489
8577
|
else {
|
|
8490
8578
|
copyBoxInto(this.target, this.layout.layoutBox);
|
|
@@ -9094,6 +9182,12 @@
|
|
|
9094
9182
|
axisSnapshot.max = axisSnapshot.min + length;
|
|
9095
9183
|
});
|
|
9096
9184
|
}
|
|
9185
|
+
else if (animationType === "x" || animationType === "y") {
|
|
9186
|
+
const snapAxis = animationType === "x" ? "y" : "x";
|
|
9187
|
+
copyAxisInto(isShared
|
|
9188
|
+
? snapshot.measuredBox[snapAxis]
|
|
9189
|
+
: snapshot.layoutBox[snapAxis], layout[snapAxis]);
|
|
9190
|
+
}
|
|
9097
9191
|
else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) {
|
|
9098
9192
|
eachAxis((axis) => {
|
|
9099
9193
|
const axisSnapshot = isShared
|
|
@@ -9209,6 +9303,18 @@
|
|
|
9209
9303
|
function clearIsLayoutDirty(node) {
|
|
9210
9304
|
node.isLayoutDirty = false;
|
|
9211
9305
|
}
|
|
9306
|
+
/**
|
|
9307
|
+
* When a node is animation-blocked (e.g. during drag) and its component
|
|
9308
|
+
* didn't re-render (memoized), willUpdate() is never called so there's
|
|
9309
|
+
* no snapshot. Use the previous layout as a snapshot and mark dirty so
|
|
9310
|
+
* resetTransform/updateLayout/notifyLayoutUpdate process it normally.
|
|
9311
|
+
*/
|
|
9312
|
+
function ensureDraggedNodesSnapshotted(node) {
|
|
9313
|
+
if (node.isAnimationBlocked && node.layout && !node.isLayoutDirty) {
|
|
9314
|
+
node.snapshot = node.layout;
|
|
9315
|
+
node.isLayoutDirty = true;
|
|
9316
|
+
}
|
|
9317
|
+
}
|
|
9212
9318
|
function resetTransformStyle(node) {
|
|
9213
9319
|
const { visualElement } = node.options;
|
|
9214
9320
|
if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
|