framer-motion 11.9.0 → 11.10.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/client.js +19 -50
- package/dist/cjs/dom.js +17 -39
- package/dist/cjs/index.js +36 -50
- package/dist/cjs/m.js +6 -17
- package/dist/dom.d.ts +4 -7
- package/dist/dom.js +1 -1
- package/dist/es/dom.mjs +1 -1
- package/dist/es/index.mjs +1 -1
- package/dist/es/motion/utils/use-visual-state.mjs +6 -13
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/utils/delay.mjs +5 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/es/value/use-will-change/add-will-change.mjs +6 -14
- package/dist/framer-motion.dev.js +36 -50
- package/dist/framer-motion.js +1 -1
- package/package.json +5 -5
package/dist/cjs/client.js
CHANGED
|
@@ -3279,7 +3279,7 @@ class MotionValue {
|
|
|
3279
3279
|
* This will be replaced by the build step with the latest version number.
|
|
3280
3280
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3281
3281
|
*/
|
|
3282
|
-
this.version = "11.
|
|
3282
|
+
this.version = "11.10.0";
|
|
3283
3283
|
/**
|
|
3284
3284
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
3285
3285
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -3592,6 +3592,12 @@ function getOptimisedAppearId(visualElement) {
|
|
|
3592
3592
|
return visualElement.props[optimizedAppearDataAttribute];
|
|
3593
3593
|
}
|
|
3594
3594
|
|
|
3595
|
+
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
3596
|
+
|
|
3597
|
+
function isWillChangeMotionValue(value) {
|
|
3598
|
+
return Boolean(isMotionValue(value) && value.add);
|
|
3599
|
+
}
|
|
3600
|
+
|
|
3595
3601
|
function getWillChangeName(name) {
|
|
3596
3602
|
if (transformProps.has(name)) {
|
|
3597
3603
|
return "transform";
|
|
@@ -3601,49 +3607,18 @@ function getWillChangeName(name) {
|
|
|
3601
3607
|
}
|
|
3602
3608
|
}
|
|
3603
3609
|
|
|
3604
|
-
class WillChangeMotionValue extends MotionValue {
|
|
3605
|
-
constructor() {
|
|
3606
|
-
super(...arguments);
|
|
3607
|
-
this.values = [];
|
|
3608
|
-
}
|
|
3609
|
-
add(name) {
|
|
3610
|
-
const styleName = getWillChangeName(name);
|
|
3611
|
-
if (styleName) {
|
|
3612
|
-
addUniqueItem(this.values, styleName);
|
|
3613
|
-
this.update();
|
|
3614
|
-
}
|
|
3615
|
-
}
|
|
3616
|
-
update() {
|
|
3617
|
-
this.set(this.values.length ? this.values.join(", ") : "auto");
|
|
3618
|
-
}
|
|
3619
|
-
}
|
|
3620
|
-
|
|
3621
|
-
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
3622
|
-
|
|
3623
|
-
function isWillChangeMotionValue(value) {
|
|
3624
|
-
return Boolean(isMotionValue(value) && value.add);
|
|
3625
|
-
}
|
|
3626
|
-
|
|
3627
3610
|
function addValueToWillChange(visualElement, key) {
|
|
3628
3611
|
var _a;
|
|
3629
3612
|
if (!visualElement.applyWillChange)
|
|
3630
3613
|
return;
|
|
3631
|
-
|
|
3632
|
-
/**
|
|
3633
|
-
* If we haven't created a willChange MotionValue, and the we haven't been
|
|
3634
|
-
* manually provided one, create one.
|
|
3635
|
-
*/
|
|
3636
|
-
if (!willChange && !((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange)) {
|
|
3637
|
-
willChange = new WillChangeMotionValue("auto");
|
|
3638
|
-
visualElement.addValue("willChange", willChange);
|
|
3639
|
-
}
|
|
3640
|
-
/**
|
|
3641
|
-
* It could be that a user has set willChange to a regular MotionValue,
|
|
3642
|
-
* in which case we can't add the value to it.
|
|
3643
|
-
*/
|
|
3614
|
+
const willChange = visualElement.getValue("willChange");
|
|
3644
3615
|
if (isWillChangeMotionValue(willChange)) {
|
|
3645
3616
|
return willChange.add(key);
|
|
3646
3617
|
}
|
|
3618
|
+
else if (!((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange) &&
|
|
3619
|
+
getWillChangeName(key)) {
|
|
3620
|
+
visualElement.setStaticValue("willChange", "transform");
|
|
3621
|
+
}
|
|
3647
3622
|
}
|
|
3648
3623
|
|
|
3649
3624
|
/**
|
|
@@ -5902,7 +5877,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
5902
5877
|
* and warn against mismatches.
|
|
5903
5878
|
*/
|
|
5904
5879
|
if (process.env.NODE_ENV === "development") {
|
|
5905
|
-
warnOnce(nextValue.version === "11.
|
|
5880
|
+
warnOnce(nextValue.version === "11.10.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.10.0 may not work as expected.`);
|
|
5906
5881
|
}
|
|
5907
5882
|
}
|
|
5908
5883
|
else if (isMotionValue(prevValue)) {
|
|
@@ -9346,12 +9321,6 @@ const makeUseVisualState = (config) => (props, isStatic) => {
|
|
|
9346
9321
|
const make = () => makeState(config, props, context, presenceContext, isStatic);
|
|
9347
9322
|
return isStatic ? make() : useConstant(make);
|
|
9348
9323
|
};
|
|
9349
|
-
function addWillChange(willChange, name) {
|
|
9350
|
-
const memberName = getWillChangeName(name);
|
|
9351
|
-
if (memberName) {
|
|
9352
|
-
addUniqueItem(willChange, memberName);
|
|
9353
|
-
}
|
|
9354
|
-
}
|
|
9355
9324
|
function forEachDefinition(props, definition, callback) {
|
|
9356
9325
|
const list = Array.isArray(definition) ? definition : [definition];
|
|
9357
9326
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -9365,8 +9334,7 @@ function forEachDefinition(props, definition, callback) {
|
|
|
9365
9334
|
function makeLatestValues(props, context, presenceContext, shouldApplyWillChange, scrapeMotionValues) {
|
|
9366
9335
|
var _a;
|
|
9367
9336
|
const values = {};
|
|
9368
|
-
|
|
9369
|
-
const applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
9337
|
+
let applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
9370
9338
|
const motionValues = scrapeMotionValues(props, {});
|
|
9371
9339
|
for (const key in motionValues) {
|
|
9372
9340
|
values[key] = resolveMotionValue(motionValues[key]);
|
|
@@ -9418,13 +9386,14 @@ function makeLatestValues(props, context, presenceContext, shouldApplyWillChange
|
|
|
9418
9386
|
if (animate && initial !== false && !isAnimationControls(animate)) {
|
|
9419
9387
|
forEachDefinition(props, animate, (target) => {
|
|
9420
9388
|
for (const key in target) {
|
|
9421
|
-
|
|
9389
|
+
const willChangeName = getWillChangeName(key);
|
|
9390
|
+
if (willChangeName) {
|
|
9391
|
+
values.willChange = "transform";
|
|
9392
|
+
return;
|
|
9393
|
+
}
|
|
9422
9394
|
}
|
|
9423
9395
|
});
|
|
9424
9396
|
}
|
|
9425
|
-
if (willChange.length) {
|
|
9426
|
-
values.willChange = willChange.join(",");
|
|
9427
|
-
}
|
|
9428
9397
|
}
|
|
9429
9398
|
return values;
|
|
9430
9399
|
}
|
package/dist/cjs/dom.js
CHANGED
|
@@ -279,7 +279,7 @@ class MotionValue {
|
|
|
279
279
|
* This will be replaced by the build step with the latest version number.
|
|
280
280
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
281
281
|
*/
|
|
282
|
-
this.version = "11.
|
|
282
|
+
this.version = "11.10.0";
|
|
283
283
|
/**
|
|
284
284
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
285
285
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -3580,6 +3580,12 @@ function getOptimisedAppearId(visualElement) {
|
|
|
3580
3580
|
return visualElement.props[optimizedAppearDataAttribute];
|
|
3581
3581
|
}
|
|
3582
3582
|
|
|
3583
|
+
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
3584
|
+
|
|
3585
|
+
function isWillChangeMotionValue(value) {
|
|
3586
|
+
return Boolean(isMotionValue(value) && value.add);
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3583
3589
|
function getWillChangeName(name) {
|
|
3584
3590
|
if (transformProps.has(name)) {
|
|
3585
3591
|
return "transform";
|
|
@@ -3589,49 +3595,18 @@ function getWillChangeName(name) {
|
|
|
3589
3595
|
}
|
|
3590
3596
|
}
|
|
3591
3597
|
|
|
3592
|
-
class WillChangeMotionValue extends MotionValue {
|
|
3593
|
-
constructor() {
|
|
3594
|
-
super(...arguments);
|
|
3595
|
-
this.values = [];
|
|
3596
|
-
}
|
|
3597
|
-
add(name) {
|
|
3598
|
-
const styleName = getWillChangeName(name);
|
|
3599
|
-
if (styleName) {
|
|
3600
|
-
addUniqueItem(this.values, styleName);
|
|
3601
|
-
this.update();
|
|
3602
|
-
}
|
|
3603
|
-
}
|
|
3604
|
-
update() {
|
|
3605
|
-
this.set(this.values.length ? this.values.join(", ") : "auto");
|
|
3606
|
-
}
|
|
3607
|
-
}
|
|
3608
|
-
|
|
3609
|
-
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
3610
|
-
|
|
3611
|
-
function isWillChangeMotionValue(value) {
|
|
3612
|
-
return Boolean(isMotionValue(value) && value.add);
|
|
3613
|
-
}
|
|
3614
|
-
|
|
3615
3598
|
function addValueToWillChange(visualElement, key) {
|
|
3616
3599
|
var _a;
|
|
3617
3600
|
if (!visualElement.applyWillChange)
|
|
3618
3601
|
return;
|
|
3619
|
-
|
|
3620
|
-
/**
|
|
3621
|
-
* If we haven't created a willChange MotionValue, and the we haven't been
|
|
3622
|
-
* manually provided one, create one.
|
|
3623
|
-
*/
|
|
3624
|
-
if (!willChange && !((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange)) {
|
|
3625
|
-
willChange = new WillChangeMotionValue("auto");
|
|
3626
|
-
visualElement.addValue("willChange", willChange);
|
|
3627
|
-
}
|
|
3628
|
-
/**
|
|
3629
|
-
* It could be that a user has set willChange to a regular MotionValue,
|
|
3630
|
-
* in which case we can't add the value to it.
|
|
3631
|
-
*/
|
|
3602
|
+
const willChange = visualElement.getValue("willChange");
|
|
3632
3603
|
if (isWillChangeMotionValue(willChange)) {
|
|
3633
3604
|
return willChange.add(key);
|
|
3634
3605
|
}
|
|
3606
|
+
else if (!((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange) &&
|
|
3607
|
+
getWillChangeName(key)) {
|
|
3608
|
+
visualElement.setStaticValue("willChange", "transform");
|
|
3609
|
+
}
|
|
3635
3610
|
}
|
|
3636
3611
|
|
|
3637
3612
|
/**
|
|
@@ -3818,7 +3793,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
3818
3793
|
* and warn against mismatches.
|
|
3819
3794
|
*/
|
|
3820
3795
|
if (process.env.NODE_ENV === "development") {
|
|
3821
|
-
warnOnce(nextValue.version === "11.
|
|
3796
|
+
warnOnce(nextValue.version === "11.10.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.10.0 may not work as expected.`);
|
|
3822
3797
|
}
|
|
3823
3798
|
}
|
|
3824
3799
|
else if (isMotionValue(prevValue)) {
|
|
@@ -6021,6 +5996,9 @@ function delay(callback, timeout) {
|
|
|
6021
5996
|
frame.read(checkElapsed, true);
|
|
6022
5997
|
return () => cancelFrame(checkElapsed);
|
|
6023
5998
|
}
|
|
5999
|
+
function delayInSeconds(callback, timeout) {
|
|
6000
|
+
return delay(callback, secondsToMilliseconds(timeout));
|
|
6001
|
+
}
|
|
6024
6002
|
|
|
6025
6003
|
const distance = (a, b) => Math.abs(a - b);
|
|
6026
6004
|
function distance2D(a, b) {
|
|
@@ -6061,7 +6039,7 @@ exports.circOut = circOut;
|
|
|
6061
6039
|
exports.clamp = clamp;
|
|
6062
6040
|
exports.createScopedAnimate = createScopedAnimate;
|
|
6063
6041
|
exports.cubicBezier = cubicBezier;
|
|
6064
|
-
exports.delay =
|
|
6042
|
+
exports.delay = delayInSeconds;
|
|
6065
6043
|
exports.distance = distance;
|
|
6066
6044
|
exports.distance2D = distance2D;
|
|
6067
6045
|
exports.easeIn = easeIn;
|
package/dist/cjs/index.js
CHANGED
|
@@ -3362,7 +3362,7 @@ class MotionValue {
|
|
|
3362
3362
|
* This will be replaced by the build step with the latest version number.
|
|
3363
3363
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3364
3364
|
*/
|
|
3365
|
-
this.version = "11.
|
|
3365
|
+
this.version = "11.10.0";
|
|
3366
3366
|
/**
|
|
3367
3367
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
3368
3368
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -3678,6 +3678,12 @@ function getOptimisedAppearId(visualElement) {
|
|
|
3678
3678
|
return visualElement.props[optimizedAppearDataAttribute];
|
|
3679
3679
|
}
|
|
3680
3680
|
|
|
3681
|
+
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
3682
|
+
|
|
3683
|
+
function isWillChangeMotionValue(value) {
|
|
3684
|
+
return Boolean(isMotionValue(value) && value.add);
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3681
3687
|
function getWillChangeName(name) {
|
|
3682
3688
|
if (transformProps.has(name)) {
|
|
3683
3689
|
return "transform";
|
|
@@ -3687,49 +3693,18 @@ function getWillChangeName(name) {
|
|
|
3687
3693
|
}
|
|
3688
3694
|
}
|
|
3689
3695
|
|
|
3690
|
-
class WillChangeMotionValue extends MotionValue {
|
|
3691
|
-
constructor() {
|
|
3692
|
-
super(...arguments);
|
|
3693
|
-
this.values = [];
|
|
3694
|
-
}
|
|
3695
|
-
add(name) {
|
|
3696
|
-
const styleName = getWillChangeName(name);
|
|
3697
|
-
if (styleName) {
|
|
3698
|
-
addUniqueItem(this.values, styleName);
|
|
3699
|
-
this.update();
|
|
3700
|
-
}
|
|
3701
|
-
}
|
|
3702
|
-
update() {
|
|
3703
|
-
this.set(this.values.length ? this.values.join(", ") : "auto");
|
|
3704
|
-
}
|
|
3705
|
-
}
|
|
3706
|
-
|
|
3707
|
-
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
3708
|
-
|
|
3709
|
-
function isWillChangeMotionValue(value) {
|
|
3710
|
-
return Boolean(isMotionValue(value) && value.add);
|
|
3711
|
-
}
|
|
3712
|
-
|
|
3713
3696
|
function addValueToWillChange(visualElement, key) {
|
|
3714
3697
|
var _a;
|
|
3715
3698
|
if (!visualElement.applyWillChange)
|
|
3716
3699
|
return;
|
|
3717
|
-
|
|
3718
|
-
/**
|
|
3719
|
-
* If we haven't created a willChange MotionValue, and the we haven't been
|
|
3720
|
-
* manually provided one, create one.
|
|
3721
|
-
*/
|
|
3722
|
-
if (!willChange && !((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange)) {
|
|
3723
|
-
willChange = new WillChangeMotionValue("auto");
|
|
3724
|
-
visualElement.addValue("willChange", willChange);
|
|
3725
|
-
}
|
|
3726
|
-
/**
|
|
3727
|
-
* It could be that a user has set willChange to a regular MotionValue,
|
|
3728
|
-
* in which case we can't add the value to it.
|
|
3729
|
-
*/
|
|
3700
|
+
const willChange = visualElement.getValue("willChange");
|
|
3730
3701
|
if (isWillChangeMotionValue(willChange)) {
|
|
3731
3702
|
return willChange.add(key);
|
|
3732
3703
|
}
|
|
3704
|
+
else if (!((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange) &&
|
|
3705
|
+
getWillChangeName(key)) {
|
|
3706
|
+
visualElement.setStaticValue("willChange", "transform");
|
|
3707
|
+
}
|
|
3733
3708
|
}
|
|
3734
3709
|
|
|
3735
3710
|
/**
|
|
@@ -6017,7 +5992,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
6017
5992
|
* and warn against mismatches.
|
|
6018
5993
|
*/
|
|
6019
5994
|
if (process.env.NODE_ENV === "development") {
|
|
6020
|
-
warnOnce(nextValue.version === "11.
|
|
5995
|
+
warnOnce(nextValue.version === "11.10.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.10.0 may not work as expected.`);
|
|
6021
5996
|
}
|
|
6022
5997
|
}
|
|
6023
5998
|
else if (isMotionValue(prevValue)) {
|
|
@@ -10770,12 +10745,6 @@ const makeUseVisualState = (config) => (props, isStatic) => {
|
|
|
10770
10745
|
const make = () => makeState(config, props, context, presenceContext, isStatic);
|
|
10771
10746
|
return isStatic ? make() : useConstant(make);
|
|
10772
10747
|
};
|
|
10773
|
-
function addWillChange(willChange, name) {
|
|
10774
|
-
const memberName = getWillChangeName(name);
|
|
10775
|
-
if (memberName) {
|
|
10776
|
-
addUniqueItem(willChange, memberName);
|
|
10777
|
-
}
|
|
10778
|
-
}
|
|
10779
10748
|
function forEachDefinition(props, definition, callback) {
|
|
10780
10749
|
const list = Array.isArray(definition) ? definition : [definition];
|
|
10781
10750
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -10789,8 +10758,7 @@ function forEachDefinition(props, definition, callback) {
|
|
|
10789
10758
|
function makeLatestValues(props, context, presenceContext, shouldApplyWillChange, scrapeMotionValues) {
|
|
10790
10759
|
var _a;
|
|
10791
10760
|
const values = {};
|
|
10792
|
-
|
|
10793
|
-
const applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
10761
|
+
let applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
10794
10762
|
const motionValues = scrapeMotionValues(props, {});
|
|
10795
10763
|
for (const key in motionValues) {
|
|
10796
10764
|
values[key] = resolveMotionValue(motionValues[key]);
|
|
@@ -10842,13 +10810,14 @@ function makeLatestValues(props, context, presenceContext, shouldApplyWillChange
|
|
|
10842
10810
|
if (animate && initial !== false && !isAnimationControls(animate)) {
|
|
10843
10811
|
forEachDefinition(props, animate, (target) => {
|
|
10844
10812
|
for (const key in target) {
|
|
10845
|
-
|
|
10813
|
+
const willChangeName = getWillChangeName(key);
|
|
10814
|
+
if (willChangeName) {
|
|
10815
|
+
values.willChange = "transform";
|
|
10816
|
+
return;
|
|
10817
|
+
}
|
|
10846
10818
|
}
|
|
10847
10819
|
});
|
|
10848
10820
|
}
|
|
10849
|
-
if (willChange.length) {
|
|
10850
|
-
values.willChange = willChange.join(",");
|
|
10851
|
-
}
|
|
10852
10821
|
}
|
|
10853
10822
|
return values;
|
|
10854
10823
|
}
|
|
@@ -12039,6 +12008,23 @@ function useTime() {
|
|
|
12039
12008
|
return time;
|
|
12040
12009
|
}
|
|
12041
12010
|
|
|
12011
|
+
class WillChangeMotionValue extends MotionValue {
|
|
12012
|
+
constructor() {
|
|
12013
|
+
super(...arguments);
|
|
12014
|
+
this.values = [];
|
|
12015
|
+
}
|
|
12016
|
+
add(name) {
|
|
12017
|
+
const styleName = getWillChangeName(name);
|
|
12018
|
+
if (styleName) {
|
|
12019
|
+
addUniqueItem(this.values, styleName);
|
|
12020
|
+
this.update();
|
|
12021
|
+
}
|
|
12022
|
+
}
|
|
12023
|
+
update() {
|
|
12024
|
+
this.set(this.values.length ? this.values.join(", ") : "auto");
|
|
12025
|
+
}
|
|
12026
|
+
}
|
|
12027
|
+
|
|
12042
12028
|
function useWillChange() {
|
|
12043
12029
|
return useConstant(() => new WillChangeMotionValue("auto"));
|
|
12044
12030
|
}
|
package/dist/cjs/m.js
CHANGED
|
@@ -799,11 +799,6 @@ function getWillChangeName(name) {
|
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
|
|
802
|
-
function addUniqueItem(arr, item) {
|
|
803
|
-
if (arr.indexOf(item) === -1)
|
|
804
|
-
arr.push(item);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
802
|
function makeState({ applyWillChange = false, scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext, isStatic) {
|
|
808
803
|
const state = {
|
|
809
804
|
latestValues: makeLatestValues(props, context, presenceContext, isStatic ? false : applyWillChange, scrapeMotionValuesFromProps),
|
|
@@ -820,12 +815,6 @@ const makeUseVisualState = (config) => (props, isStatic) => {
|
|
|
820
815
|
const make = () => makeState(config, props, context, presenceContext, isStatic);
|
|
821
816
|
return isStatic ? make() : useConstant(make);
|
|
822
817
|
};
|
|
823
|
-
function addWillChange(willChange, name) {
|
|
824
|
-
const memberName = getWillChangeName(name);
|
|
825
|
-
if (memberName) {
|
|
826
|
-
addUniqueItem(willChange, memberName);
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
818
|
function forEachDefinition(props, definition, callback) {
|
|
830
819
|
const list = Array.isArray(definition) ? definition : [definition];
|
|
831
820
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -839,8 +828,7 @@ function forEachDefinition(props, definition, callback) {
|
|
|
839
828
|
function makeLatestValues(props, context, presenceContext, shouldApplyWillChange, scrapeMotionValues) {
|
|
840
829
|
var _a;
|
|
841
830
|
const values = {};
|
|
842
|
-
|
|
843
|
-
const applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
831
|
+
let applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
844
832
|
const motionValues = scrapeMotionValues(props, {});
|
|
845
833
|
for (const key in motionValues) {
|
|
846
834
|
values[key] = resolveMotionValue(motionValues[key]);
|
|
@@ -892,13 +880,14 @@ function makeLatestValues(props, context, presenceContext, shouldApplyWillChange
|
|
|
892
880
|
if (animate && initial !== false && !isAnimationControls(animate)) {
|
|
893
881
|
forEachDefinition(props, animate, (target) => {
|
|
894
882
|
for (const key in target) {
|
|
895
|
-
|
|
883
|
+
const willChangeName = getWillChangeName(key);
|
|
884
|
+
if (willChangeName) {
|
|
885
|
+
values.willChange = "transform";
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
896
888
|
}
|
|
897
889
|
});
|
|
898
890
|
}
|
|
899
|
-
if (willChange.length) {
|
|
900
|
-
values.willChange = willChange.join(",");
|
|
901
|
-
}
|
|
902
891
|
}
|
|
903
892
|
return values;
|
|
904
893
|
}
|
package/dist/dom.d.ts
CHANGED
|
@@ -909,6 +909,9 @@ declare global {
|
|
|
909
909
|
|
|
910
910
|
declare function spring({ keyframes, restDelta, restSpeed, ...options }: ValueAnimationOptions<number>): KeyframeGenerator<number>;
|
|
911
911
|
|
|
912
|
+
type DelayedFunction = (overshoot: number) => void;
|
|
913
|
+
declare function delayInSeconds(callback: DelayedFunction, timeout: number): () => void;
|
|
914
|
+
|
|
912
915
|
declare const backOut: (t: number) => number;
|
|
913
916
|
declare const backIn: EasingFunction;
|
|
914
917
|
declare const backInOut: EasingFunction;
|
|
@@ -944,12 +947,6 @@ declare function stagger(duration?: number, { startDelay, from, ease }?: Stagger
|
|
|
944
947
|
|
|
945
948
|
declare const clamp: (min: number, max: number, v: number) => number;
|
|
946
949
|
|
|
947
|
-
type DelayedFunction = (overshoot: number) => void;
|
|
948
|
-
/**
|
|
949
|
-
* Timeout defined in ms
|
|
950
|
-
*/
|
|
951
|
-
declare function delay(callback: DelayedFunction, timeout: number): () => void;
|
|
952
|
-
|
|
953
950
|
declare const distance: (a: number, b: number) => number;
|
|
954
951
|
declare function distance2D(a: Point, b: Point): number;
|
|
955
952
|
|
|
@@ -1014,4 +1011,4 @@ declare const sync: Batcher;
|
|
|
1014
1011
|
*/
|
|
1015
1012
|
declare const cancelSync: Record<string, (process: Process) => void>;
|
|
1016
1013
|
|
|
1017
|
-
export { type DelayedFunction, type DevMessage, type Direction, type InterpolateOptions, type MixerFactory, MotionValue, type PassiveEffect, type Subscriber, animate, animateMini, anticipate, backIn, backInOut, backOut, cancelFrame, cancelSync, circIn, circInOut, circOut, clamp, createScopedAnimate, cubicBezier, delay, distance, distance2D, easeIn, easeInOut, easeOut, frame, frameData, frameSteps, inView, inertia, interpolate, invariant, keyframes, mirrorEasing, mix, motionValue, pipe, progress, reverseEasing, scroll, scrollInfo, spring, stagger, steps, sync, transform, warning, wrap };
|
|
1014
|
+
export { type DelayedFunction, type DevMessage, type Direction, type InterpolateOptions, type MixerFactory, MotionValue, type PassiveEffect, type Subscriber, animate, animateMini, anticipate, backIn, backInOut, backOut, cancelFrame, cancelSync, circIn, circInOut, circOut, clamp, createScopedAnimate, cubicBezier, delayInSeconds as delay, distance, distance2D, easeIn, easeInOut, easeOut, frame, frameData, frameSteps, inView, inertia, interpolate, invariant, keyframes, mirrorEasing, mix, motionValue, pipe, progress, reverseEasing, scroll, scrollInfo, spring, stagger, steps, sync, transform, warning, wrap };
|