framer-motion 11.11.8 → 11.11.10
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 +32 -79
- package/dist/cjs/dom.js +6 -31
- package/dist/cjs/index.js +41 -79
- package/dist/cjs/m.js +26 -77
- package/dist/dom.js +1 -1
- package/dist/es/motion/utils/use-visual-state.mjs +26 -48
- package/dist/es/render/VisualElement.mjs +0 -5
- package/dist/es/render/html/HTMLVisualElement.mjs +0 -1
- package/dist/es/render/html/config-motion.mjs +0 -1
- package/dist/es/render/html/utils/scrape-motion-values.mjs +0 -7
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/es/value/use-will-change/add-will-change.mjs +4 -8
- package/dist/framer-motion.dev.js +41 -79
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/three.d.ts +0 -6
- package/package.json +6 -6
package/dist/cjs/client.js
CHANGED
|
@@ -3281,7 +3281,7 @@ class MotionValue {
|
|
|
3281
3281
|
* This will be replaced by the build step with the latest version number.
|
|
3282
3282
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3283
3283
|
*/
|
|
3284
|
-
this.version = "11.11.
|
|
3284
|
+
this.version = "11.11.10";
|
|
3285
3285
|
/**
|
|
3286
3286
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
3287
3287
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -3600,27 +3600,15 @@ function isWillChangeMotionValue(value) {
|
|
|
3600
3600
|
return Boolean(isMotionValue(value) && value.add);
|
|
3601
3601
|
}
|
|
3602
3602
|
|
|
3603
|
-
function getWillChangeName(name) {
|
|
3604
|
-
if (transformProps.has(name)) {
|
|
3605
|
-
return "transform";
|
|
3606
|
-
}
|
|
3607
|
-
else if (acceleratedValues.has(name)) {
|
|
3608
|
-
return camelToDash(name);
|
|
3609
|
-
}
|
|
3610
|
-
}
|
|
3611
|
-
|
|
3612
3603
|
function addValueToWillChange(visualElement, key) {
|
|
3613
|
-
var _a;
|
|
3614
|
-
if (!visualElement.applyWillChange)
|
|
3615
|
-
return;
|
|
3616
3604
|
const willChange = visualElement.getValue("willChange");
|
|
3605
|
+
/**
|
|
3606
|
+
* It could be that a user has set willChange to a regular MotionValue,
|
|
3607
|
+
* in which case we can't add the value to it.
|
|
3608
|
+
*/
|
|
3617
3609
|
if (isWillChangeMotionValue(willChange)) {
|
|
3618
3610
|
return willChange.add(key);
|
|
3619
3611
|
}
|
|
3620
|
-
else if (!((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange) &&
|
|
3621
|
-
getWillChangeName(key)) {
|
|
3622
|
-
visualElement.setStaticValue("willChange", "transform");
|
|
3623
|
-
}
|
|
3624
3612
|
}
|
|
3625
3613
|
|
|
3626
3614
|
/**
|
|
@@ -5811,13 +5799,6 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
|
5811
5799
|
newValues[key] = style[key];
|
|
5812
5800
|
}
|
|
5813
5801
|
}
|
|
5814
|
-
/**
|
|
5815
|
-
* If the willChange style has been manually set as a string, set
|
|
5816
|
-
* applyWillChange to false to prevent it from automatically being applied.
|
|
5817
|
-
*/
|
|
5818
|
-
if (visualElement && style && typeof style.willChange === "string") {
|
|
5819
|
-
visualElement.applyWillChange = false;
|
|
5820
|
-
}
|
|
5821
5802
|
return newValues;
|
|
5822
5803
|
}
|
|
5823
5804
|
|
|
@@ -5879,7 +5860,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
5879
5860
|
* and warn against mismatches.
|
|
5880
5861
|
*/
|
|
5881
5862
|
if (process.env.NODE_ENV === "development") {
|
|
5882
|
-
warnOnce(nextValue.version === "11.11.
|
|
5863
|
+
warnOnce(nextValue.version === "11.11.10", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.11.10 may not work as expected.`);
|
|
5883
5864
|
}
|
|
5884
5865
|
}
|
|
5885
5866
|
else if (isMotionValue(prevValue)) {
|
|
@@ -5979,11 +5960,6 @@ class VisualElement {
|
|
|
5979
5960
|
return {};
|
|
5980
5961
|
}
|
|
5981
5962
|
constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }, options = {}) {
|
|
5982
|
-
/**
|
|
5983
|
-
* If true, will-change will be applied to the element. Only HTMLVisualElements
|
|
5984
|
-
* currently support this.
|
|
5985
|
-
*/
|
|
5986
|
-
this.applyWillChange = false;
|
|
5987
5963
|
/**
|
|
5988
5964
|
* A reference to the current underlying Instance, e.g. a HTMLElement
|
|
5989
5965
|
* or Three.Mesh etc.
|
|
@@ -6738,7 +6714,6 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
6738
6714
|
constructor() {
|
|
6739
6715
|
super(...arguments);
|
|
6740
6716
|
this.type = "html";
|
|
6741
|
-
this.applyWillChange = true;
|
|
6742
6717
|
this.renderInstance = renderHTML;
|
|
6743
6718
|
}
|
|
6744
6719
|
readValueFromInstance(instance, key) {
|
|
@@ -9306,9 +9281,9 @@ function useConstant(init) {
|
|
|
9306
9281
|
return ref.current;
|
|
9307
9282
|
}
|
|
9308
9283
|
|
|
9309
|
-
function makeState({
|
|
9284
|
+
function makeState({ scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext) {
|
|
9310
9285
|
const state = {
|
|
9311
|
-
latestValues: makeLatestValues(props, context, presenceContext,
|
|
9286
|
+
latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
|
|
9312
9287
|
renderState: createRenderState(),
|
|
9313
9288
|
};
|
|
9314
9289
|
if (onMount) {
|
|
@@ -9319,23 +9294,11 @@ function makeState({ applyWillChange = false, scrapeMotionValuesFromProps, creat
|
|
|
9319
9294
|
const makeUseVisualState = (config) => (props, isStatic) => {
|
|
9320
9295
|
const context = react.useContext(MotionContext);
|
|
9321
9296
|
const presenceContext = react.useContext(PresenceContext);
|
|
9322
|
-
const make = () => makeState(config, props, context, presenceContext
|
|
9297
|
+
const make = () => makeState(config, props, context, presenceContext);
|
|
9323
9298
|
return isStatic ? make() : useConstant(make);
|
|
9324
9299
|
};
|
|
9325
|
-
function
|
|
9326
|
-
const list = Array.isArray(definition) ? definition : [definition];
|
|
9327
|
-
for (let i = 0; i < list.length; i++) {
|
|
9328
|
-
const resolved = resolveVariantFromProps(props, list[i]);
|
|
9329
|
-
if (resolved) {
|
|
9330
|
-
const { transitionEnd, transition, ...target } = resolved;
|
|
9331
|
-
callback(target, transitionEnd);
|
|
9332
|
-
}
|
|
9333
|
-
}
|
|
9334
|
-
}
|
|
9335
|
-
function makeLatestValues(props, context, presenceContext, shouldApplyWillChange, scrapeMotionValues) {
|
|
9336
|
-
var _a;
|
|
9300
|
+
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
9337
9301
|
const values = {};
|
|
9338
|
-
let applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
9339
9302
|
const motionValues = scrapeMotionValues(props, {});
|
|
9340
9303
|
for (const key in motionValues) {
|
|
9341
9304
|
values[key] = resolveMotionValue(motionValues[key]);
|
|
@@ -9360,40 +9323,31 @@ function makeLatestValues(props, context, presenceContext, shouldApplyWillChange
|
|
|
9360
9323
|
if (variantToSet &&
|
|
9361
9324
|
typeof variantToSet !== "boolean" &&
|
|
9362
9325
|
!isAnimationControls(variantToSet)) {
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
* Take final keyframe if the initial animation is blocked because
|
|
9369
|
-
* we want to initialise at the end of that blocked animation.
|
|
9370
|
-
*/
|
|
9371
|
-
const index = isInitialAnimationBlocked
|
|
9372
|
-
? valueTarget.length - 1
|
|
9373
|
-
: 0;
|
|
9374
|
-
valueTarget = valueTarget[index];
|
|
9375
|
-
}
|
|
9376
|
-
if (valueTarget !== null) {
|
|
9377
|
-
values[key] = valueTarget;
|
|
9378
|
-
}
|
|
9379
|
-
}
|
|
9380
|
-
for (const key in transitionEnd) {
|
|
9381
|
-
values[key] = transitionEnd[key];
|
|
9382
|
-
}
|
|
9383
|
-
});
|
|
9384
|
-
}
|
|
9385
|
-
// Add animating values to will-change
|
|
9386
|
-
if (applyWillChange) {
|
|
9387
|
-
if (animate && initial !== false && !isAnimationControls(animate)) {
|
|
9388
|
-
forEachDefinition(props, animate, (target) => {
|
|
9326
|
+
const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
|
|
9327
|
+
for (let i = 0; i < list.length; i++) {
|
|
9328
|
+
const resolved = resolveVariantFromProps(props, list[i]);
|
|
9329
|
+
if (resolved) {
|
|
9330
|
+
const { transitionEnd, transition, ...target } = resolved;
|
|
9389
9331
|
for (const key in target) {
|
|
9390
|
-
|
|
9391
|
-
if (
|
|
9392
|
-
|
|
9393
|
-
|
|
9332
|
+
let valueTarget = target[key];
|
|
9333
|
+
if (Array.isArray(valueTarget)) {
|
|
9334
|
+
/**
|
|
9335
|
+
* Take final keyframe if the initial animation is blocked because
|
|
9336
|
+
* we want to initialise at the end of that blocked animation.
|
|
9337
|
+
*/
|
|
9338
|
+
const index = isInitialAnimationBlocked
|
|
9339
|
+
? valueTarget.length - 1
|
|
9340
|
+
: 0;
|
|
9341
|
+
valueTarget = valueTarget[index];
|
|
9342
|
+
}
|
|
9343
|
+
if (valueTarget !== null) {
|
|
9344
|
+
values[key] = valueTarget;
|
|
9394
9345
|
}
|
|
9395
9346
|
}
|
|
9396
|
-
|
|
9347
|
+
for (const key in transitionEnd) {
|
|
9348
|
+
values[key] = transitionEnd[key];
|
|
9349
|
+
}
|
|
9350
|
+
}
|
|
9397
9351
|
}
|
|
9398
9352
|
}
|
|
9399
9353
|
return values;
|
|
@@ -9444,7 +9398,6 @@ const svgMotionConfig = {
|
|
|
9444
9398
|
|
|
9445
9399
|
const htmlMotionConfig = {
|
|
9446
9400
|
useVisualState: makeUseVisualState({
|
|
9447
|
-
applyWillChange: true,
|
|
9448
9401
|
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
|
|
9449
9402
|
createRenderState: createHtmlRenderState,
|
|
9450
9403
|
}),
|
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.11.
|
|
282
|
+
this.version = "11.11.10";
|
|
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
|
|
@@ -3901,27 +3901,15 @@ function isWillChangeMotionValue(value) {
|
|
|
3901
3901
|
return Boolean(isMotionValue(value) && value.add);
|
|
3902
3902
|
}
|
|
3903
3903
|
|
|
3904
|
-
function getWillChangeName(name) {
|
|
3905
|
-
if (transformProps.has(name)) {
|
|
3906
|
-
return "transform";
|
|
3907
|
-
}
|
|
3908
|
-
else if (acceleratedValues.has(name)) {
|
|
3909
|
-
return camelToDash(name);
|
|
3910
|
-
}
|
|
3911
|
-
}
|
|
3912
|
-
|
|
3913
3904
|
function addValueToWillChange(visualElement, key) {
|
|
3914
|
-
var _a;
|
|
3915
|
-
if (!visualElement.applyWillChange)
|
|
3916
|
-
return;
|
|
3917
3905
|
const willChange = visualElement.getValue("willChange");
|
|
3906
|
+
/**
|
|
3907
|
+
* It could be that a user has set willChange to a regular MotionValue,
|
|
3908
|
+
* in which case we can't add the value to it.
|
|
3909
|
+
*/
|
|
3918
3910
|
if (isWillChangeMotionValue(willChange)) {
|
|
3919
3911
|
return willChange.add(key);
|
|
3920
3912
|
}
|
|
3921
|
-
else if (!((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange) &&
|
|
3922
|
-
getWillChangeName(key)) {
|
|
3923
|
-
visualElement.setStaticValue("willChange", "transform");
|
|
3924
|
-
}
|
|
3925
3913
|
}
|
|
3926
3914
|
|
|
3927
3915
|
/**
|
|
@@ -4016,13 +4004,6 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
|
4016
4004
|
newValues[key] = style[key];
|
|
4017
4005
|
}
|
|
4018
4006
|
}
|
|
4019
|
-
/**
|
|
4020
|
-
* If the willChange style has been manually set as a string, set
|
|
4021
|
-
* applyWillChange to false to prevent it from automatically being applied.
|
|
4022
|
-
*/
|
|
4023
|
-
if (visualElement && style && typeof style.willChange === "string") {
|
|
4024
|
-
visualElement.applyWillChange = false;
|
|
4025
|
-
}
|
|
4026
4007
|
return newValues;
|
|
4027
4008
|
}
|
|
4028
4009
|
|
|
@@ -4108,7 +4089,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4108
4089
|
* and warn against mismatches.
|
|
4109
4090
|
*/
|
|
4110
4091
|
if (process.env.NODE_ENV === "development") {
|
|
4111
|
-
warnOnce(nextValue.version === "11.11.
|
|
4092
|
+
warnOnce(nextValue.version === "11.11.10", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.11.10 may not work as expected.`);
|
|
4112
4093
|
}
|
|
4113
4094
|
}
|
|
4114
4095
|
else if (isMotionValue(prevValue)) {
|
|
@@ -4214,11 +4195,6 @@ class VisualElement {
|
|
|
4214
4195
|
return {};
|
|
4215
4196
|
}
|
|
4216
4197
|
constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }, options = {}) {
|
|
4217
|
-
/**
|
|
4218
|
-
* If true, will-change will be applied to the element. Only HTMLVisualElements
|
|
4219
|
-
* currently support this.
|
|
4220
|
-
*/
|
|
4221
|
-
this.applyWillChange = false;
|
|
4222
4198
|
/**
|
|
4223
4199
|
* A reference to the current underlying Instance, e.g. a HTMLElement
|
|
4224
4200
|
* or Three.Mesh etc.
|
|
@@ -5006,7 +4982,6 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
5006
4982
|
constructor() {
|
|
5007
4983
|
super(...arguments);
|
|
5008
4984
|
this.type = "html";
|
|
5009
|
-
this.applyWillChange = true;
|
|
5010
4985
|
this.renderInstance = renderHTML;
|
|
5011
4986
|
}
|
|
5012
4987
|
readValueFromInstance(instance, key) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -3364,7 +3364,7 @@ class MotionValue {
|
|
|
3364
3364
|
* This will be replaced by the build step with the latest version number.
|
|
3365
3365
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3366
3366
|
*/
|
|
3367
|
-
this.version = "11.11.
|
|
3367
|
+
this.version = "11.11.10";
|
|
3368
3368
|
/**
|
|
3369
3369
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
3370
3370
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -3686,27 +3686,15 @@ function isWillChangeMotionValue(value) {
|
|
|
3686
3686
|
return Boolean(isMotionValue(value) && value.add);
|
|
3687
3687
|
}
|
|
3688
3688
|
|
|
3689
|
-
function getWillChangeName(name) {
|
|
3690
|
-
if (transformProps.has(name)) {
|
|
3691
|
-
return "transform";
|
|
3692
|
-
}
|
|
3693
|
-
else if (acceleratedValues.has(name)) {
|
|
3694
|
-
return camelToDash(name);
|
|
3695
|
-
}
|
|
3696
|
-
}
|
|
3697
|
-
|
|
3698
3689
|
function addValueToWillChange(visualElement, key) {
|
|
3699
|
-
var _a;
|
|
3700
|
-
if (!visualElement.applyWillChange)
|
|
3701
|
-
return;
|
|
3702
3690
|
const willChange = visualElement.getValue("willChange");
|
|
3691
|
+
/**
|
|
3692
|
+
* It could be that a user has set willChange to a regular MotionValue,
|
|
3693
|
+
* in which case we can't add the value to it.
|
|
3694
|
+
*/
|
|
3703
3695
|
if (isWillChangeMotionValue(willChange)) {
|
|
3704
3696
|
return willChange.add(key);
|
|
3705
3697
|
}
|
|
3706
|
-
else if (!((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange) &&
|
|
3707
|
-
getWillChangeName(key)) {
|
|
3708
|
-
visualElement.setStaticValue("willChange", "transform");
|
|
3709
|
-
}
|
|
3710
3698
|
}
|
|
3711
3699
|
|
|
3712
3700
|
/**
|
|
@@ -6239,13 +6227,6 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
|
6239
6227
|
newValues[key] = style[key];
|
|
6240
6228
|
}
|
|
6241
6229
|
}
|
|
6242
|
-
/**
|
|
6243
|
-
* If the willChange style has been manually set as a string, set
|
|
6244
|
-
* applyWillChange to false to prevent it from automatically being applied.
|
|
6245
|
-
*/
|
|
6246
|
-
if (visualElement && style && typeof style.willChange === "string") {
|
|
6247
|
-
visualElement.applyWillChange = false;
|
|
6248
|
-
}
|
|
6249
6230
|
return newValues;
|
|
6250
6231
|
}
|
|
6251
6232
|
|
|
@@ -6307,7 +6288,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
6307
6288
|
* and warn against mismatches.
|
|
6308
6289
|
*/
|
|
6309
6290
|
if (process.env.NODE_ENV === "development") {
|
|
6310
|
-
warnOnce(nextValue.version === "11.11.
|
|
6291
|
+
warnOnce(nextValue.version === "11.11.10", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.11.10 may not work as expected.`);
|
|
6311
6292
|
}
|
|
6312
6293
|
}
|
|
6313
6294
|
else if (isMotionValue(prevValue)) {
|
|
@@ -6407,11 +6388,6 @@ class VisualElement {
|
|
|
6407
6388
|
return {};
|
|
6408
6389
|
}
|
|
6409
6390
|
constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }, options = {}) {
|
|
6410
|
-
/**
|
|
6411
|
-
* If true, will-change will be applied to the element. Only HTMLVisualElements
|
|
6412
|
-
* currently support this.
|
|
6413
|
-
*/
|
|
6414
|
-
this.applyWillChange = false;
|
|
6415
6391
|
/**
|
|
6416
6392
|
* A reference to the current underlying Instance, e.g. a HTMLElement
|
|
6417
6393
|
* or Three.Mesh etc.
|
|
@@ -7166,7 +7142,6 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
7166
7142
|
constructor() {
|
|
7167
7143
|
super(...arguments);
|
|
7168
7144
|
this.type = "html";
|
|
7169
|
-
this.applyWillChange = true;
|
|
7170
7145
|
this.renderInstance = renderHTML;
|
|
7171
7146
|
}
|
|
7172
7147
|
readValueFromInstance(instance, key) {
|
|
@@ -10802,9 +10777,9 @@ function useConstant(init) {
|
|
|
10802
10777
|
return ref.current;
|
|
10803
10778
|
}
|
|
10804
10779
|
|
|
10805
|
-
function makeState({
|
|
10780
|
+
function makeState({ scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext) {
|
|
10806
10781
|
const state = {
|
|
10807
|
-
latestValues: makeLatestValues(props, context, presenceContext,
|
|
10782
|
+
latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
|
|
10808
10783
|
renderState: createRenderState(),
|
|
10809
10784
|
};
|
|
10810
10785
|
if (onMount) {
|
|
@@ -10815,23 +10790,11 @@ function makeState({ applyWillChange = false, scrapeMotionValuesFromProps, creat
|
|
|
10815
10790
|
const makeUseVisualState = (config) => (props, isStatic) => {
|
|
10816
10791
|
const context = React.useContext(MotionContext);
|
|
10817
10792
|
const presenceContext = React.useContext(PresenceContext);
|
|
10818
|
-
const make = () => makeState(config, props, context, presenceContext
|
|
10793
|
+
const make = () => makeState(config, props, context, presenceContext);
|
|
10819
10794
|
return isStatic ? make() : useConstant(make);
|
|
10820
10795
|
};
|
|
10821
|
-
function
|
|
10822
|
-
const list = Array.isArray(definition) ? definition : [definition];
|
|
10823
|
-
for (let i = 0; i < list.length; i++) {
|
|
10824
|
-
const resolved = resolveVariantFromProps(props, list[i]);
|
|
10825
|
-
if (resolved) {
|
|
10826
|
-
const { transitionEnd, transition, ...target } = resolved;
|
|
10827
|
-
callback(target, transitionEnd);
|
|
10828
|
-
}
|
|
10829
|
-
}
|
|
10830
|
-
}
|
|
10831
|
-
function makeLatestValues(props, context, presenceContext, shouldApplyWillChange, scrapeMotionValues) {
|
|
10832
|
-
var _a;
|
|
10796
|
+
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
10833
10797
|
const values = {};
|
|
10834
|
-
let applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
10835
10798
|
const motionValues = scrapeMotionValues(props, {});
|
|
10836
10799
|
for (const key in motionValues) {
|
|
10837
10800
|
values[key] = resolveMotionValue(motionValues[key]);
|
|
@@ -10856,40 +10819,31 @@ function makeLatestValues(props, context, presenceContext, shouldApplyWillChange
|
|
|
10856
10819
|
if (variantToSet &&
|
|
10857
10820
|
typeof variantToSet !== "boolean" &&
|
|
10858
10821
|
!isAnimationControls(variantToSet)) {
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
* Take final keyframe if the initial animation is blocked because
|
|
10865
|
-
* we want to initialise at the end of that blocked animation.
|
|
10866
|
-
*/
|
|
10867
|
-
const index = isInitialAnimationBlocked
|
|
10868
|
-
? valueTarget.length - 1
|
|
10869
|
-
: 0;
|
|
10870
|
-
valueTarget = valueTarget[index];
|
|
10871
|
-
}
|
|
10872
|
-
if (valueTarget !== null) {
|
|
10873
|
-
values[key] = valueTarget;
|
|
10874
|
-
}
|
|
10875
|
-
}
|
|
10876
|
-
for (const key in transitionEnd) {
|
|
10877
|
-
values[key] = transitionEnd[key];
|
|
10878
|
-
}
|
|
10879
|
-
});
|
|
10880
|
-
}
|
|
10881
|
-
// Add animating values to will-change
|
|
10882
|
-
if (applyWillChange) {
|
|
10883
|
-
if (animate && initial !== false && !isAnimationControls(animate)) {
|
|
10884
|
-
forEachDefinition(props, animate, (target) => {
|
|
10822
|
+
const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
|
|
10823
|
+
for (let i = 0; i < list.length; i++) {
|
|
10824
|
+
const resolved = resolveVariantFromProps(props, list[i]);
|
|
10825
|
+
if (resolved) {
|
|
10826
|
+
const { transitionEnd, transition, ...target } = resolved;
|
|
10885
10827
|
for (const key in target) {
|
|
10886
|
-
|
|
10887
|
-
if (
|
|
10888
|
-
|
|
10889
|
-
|
|
10828
|
+
let valueTarget = target[key];
|
|
10829
|
+
if (Array.isArray(valueTarget)) {
|
|
10830
|
+
/**
|
|
10831
|
+
* Take final keyframe if the initial animation is blocked because
|
|
10832
|
+
* we want to initialise at the end of that blocked animation.
|
|
10833
|
+
*/
|
|
10834
|
+
const index = isInitialAnimationBlocked
|
|
10835
|
+
? valueTarget.length - 1
|
|
10836
|
+
: 0;
|
|
10837
|
+
valueTarget = valueTarget[index];
|
|
10838
|
+
}
|
|
10839
|
+
if (valueTarget !== null) {
|
|
10840
|
+
values[key] = valueTarget;
|
|
10890
10841
|
}
|
|
10891
10842
|
}
|
|
10892
|
-
|
|
10843
|
+
for (const key in transitionEnd) {
|
|
10844
|
+
values[key] = transitionEnd[key];
|
|
10845
|
+
}
|
|
10846
|
+
}
|
|
10893
10847
|
}
|
|
10894
10848
|
}
|
|
10895
10849
|
return values;
|
|
@@ -10940,7 +10894,6 @@ const svgMotionConfig = {
|
|
|
10940
10894
|
|
|
10941
10895
|
const htmlMotionConfig = {
|
|
10942
10896
|
useVisualState: makeUseVisualState({
|
|
10943
|
-
applyWillChange: true,
|
|
10944
10897
|
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
|
|
10945
10898
|
createRenderState: createHtmlRenderState,
|
|
10946
10899
|
}),
|
|
@@ -12084,6 +12037,15 @@ function useTime() {
|
|
|
12084
12037
|
return time;
|
|
12085
12038
|
}
|
|
12086
12039
|
|
|
12040
|
+
function getWillChangeName(name) {
|
|
12041
|
+
if (transformProps.has(name)) {
|
|
12042
|
+
return "transform";
|
|
12043
|
+
}
|
|
12044
|
+
else if (acceleratedValues.has(name)) {
|
|
12045
|
+
return camelToDash(name);
|
|
12046
|
+
}
|
|
12047
|
+
}
|
|
12048
|
+
|
|
12087
12049
|
class WillChangeMotionValue extends MotionValue {
|
|
12088
12050
|
constructor() {
|
|
12089
12051
|
super(...arguments);
|
package/dist/cjs/m.js
CHANGED
|
@@ -686,13 +686,6 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
|
686
686
|
newValues[key] = style[key];
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
/**
|
|
690
|
-
* If the willChange style has been manually set as a string, set
|
|
691
|
-
* applyWillChange to false to prevent it from automatically being applied.
|
|
692
|
-
*/
|
|
693
|
-
if (visualElement && style && typeof style.willChange === "string") {
|
|
694
|
-
visualElement.applyWillChange = false;
|
|
695
|
-
}
|
|
696
689
|
return newValues;
|
|
697
690
|
}
|
|
698
691
|
|
|
@@ -776,31 +769,9 @@ function resolveMotionValue(value) {
|
|
|
776
769
|
: unwrappedValue;
|
|
777
770
|
}
|
|
778
771
|
|
|
779
|
-
|
|
780
|
-
* A list of values that can be hardware-accelerated.
|
|
781
|
-
*/
|
|
782
|
-
const acceleratedValues = new Set([
|
|
783
|
-
"opacity",
|
|
784
|
-
"clipPath",
|
|
785
|
-
"filter",
|
|
786
|
-
"transform",
|
|
787
|
-
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
|
|
788
|
-
// or until we implement support for linear() easing.
|
|
789
|
-
// "background-color"
|
|
790
|
-
]);
|
|
791
|
-
|
|
792
|
-
function getWillChangeName(name) {
|
|
793
|
-
if (transformProps.has(name)) {
|
|
794
|
-
return "transform";
|
|
795
|
-
}
|
|
796
|
-
else if (acceleratedValues.has(name)) {
|
|
797
|
-
return camelToDash(name);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
function makeState({ applyWillChange = false, scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext, isStatic) {
|
|
772
|
+
function makeState({ scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext) {
|
|
802
773
|
const state = {
|
|
803
|
-
latestValues: makeLatestValues(props, context, presenceContext,
|
|
774
|
+
latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
|
|
804
775
|
renderState: createRenderState(),
|
|
805
776
|
};
|
|
806
777
|
if (onMount) {
|
|
@@ -811,23 +782,11 @@ function makeState({ applyWillChange = false, scrapeMotionValuesFromProps, creat
|
|
|
811
782
|
const makeUseVisualState = (config) => (props, isStatic) => {
|
|
812
783
|
const context = react.useContext(MotionContext);
|
|
813
784
|
const presenceContext = react.useContext(PresenceContext);
|
|
814
|
-
const make = () => makeState(config, props, context, presenceContext
|
|
785
|
+
const make = () => makeState(config, props, context, presenceContext);
|
|
815
786
|
return isStatic ? make() : useConstant(make);
|
|
816
787
|
};
|
|
817
|
-
function
|
|
818
|
-
const list = Array.isArray(definition) ? definition : [definition];
|
|
819
|
-
for (let i = 0; i < list.length; i++) {
|
|
820
|
-
const resolved = resolveVariantFromProps(props, list[i]);
|
|
821
|
-
if (resolved) {
|
|
822
|
-
const { transitionEnd, transition, ...target } = resolved;
|
|
823
|
-
callback(target, transitionEnd);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
function makeLatestValues(props, context, presenceContext, shouldApplyWillChange, scrapeMotionValues) {
|
|
828
|
-
var _a;
|
|
788
|
+
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
829
789
|
const values = {};
|
|
830
|
-
let applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
831
790
|
const motionValues = scrapeMotionValues(props, {});
|
|
832
791
|
for (const key in motionValues) {
|
|
833
792
|
values[key] = resolveMotionValue(motionValues[key]);
|
|
@@ -852,40 +811,31 @@ function makeLatestValues(props, context, presenceContext, shouldApplyWillChange
|
|
|
852
811
|
if (variantToSet &&
|
|
853
812
|
typeof variantToSet !== "boolean" &&
|
|
854
813
|
!isAnimationControls(variantToSet)) {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
* Take final keyframe if the initial animation is blocked because
|
|
861
|
-
* we want to initialise at the end of that blocked animation.
|
|
862
|
-
*/
|
|
863
|
-
const index = isInitialAnimationBlocked
|
|
864
|
-
? valueTarget.length - 1
|
|
865
|
-
: 0;
|
|
866
|
-
valueTarget = valueTarget[index];
|
|
867
|
-
}
|
|
868
|
-
if (valueTarget !== null) {
|
|
869
|
-
values[key] = valueTarget;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
for (const key in transitionEnd) {
|
|
873
|
-
values[key] = transitionEnd[key];
|
|
874
|
-
}
|
|
875
|
-
});
|
|
876
|
-
}
|
|
877
|
-
// Add animating values to will-change
|
|
878
|
-
if (applyWillChange) {
|
|
879
|
-
if (animate && initial !== false && !isAnimationControls(animate)) {
|
|
880
|
-
forEachDefinition(props, animate, (target) => {
|
|
814
|
+
const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
|
|
815
|
+
for (let i = 0; i < list.length; i++) {
|
|
816
|
+
const resolved = resolveVariantFromProps(props, list[i]);
|
|
817
|
+
if (resolved) {
|
|
818
|
+
const { transitionEnd, transition, ...target } = resolved;
|
|
881
819
|
for (const key in target) {
|
|
882
|
-
|
|
883
|
-
if (
|
|
884
|
-
|
|
885
|
-
|
|
820
|
+
let valueTarget = target[key];
|
|
821
|
+
if (Array.isArray(valueTarget)) {
|
|
822
|
+
/**
|
|
823
|
+
* Take final keyframe if the initial animation is blocked because
|
|
824
|
+
* we want to initialise at the end of that blocked animation.
|
|
825
|
+
*/
|
|
826
|
+
const index = isInitialAnimationBlocked
|
|
827
|
+
? valueTarget.length - 1
|
|
828
|
+
: 0;
|
|
829
|
+
valueTarget = valueTarget[index];
|
|
830
|
+
}
|
|
831
|
+
if (valueTarget !== null) {
|
|
832
|
+
values[key] = valueTarget;
|
|
886
833
|
}
|
|
887
834
|
}
|
|
888
|
-
|
|
835
|
+
for (const key in transitionEnd) {
|
|
836
|
+
values[key] = transitionEnd[key];
|
|
837
|
+
}
|
|
838
|
+
}
|
|
889
839
|
}
|
|
890
840
|
}
|
|
891
841
|
return values;
|
|
@@ -1276,7 +1226,6 @@ const svgMotionConfig = {
|
|
|
1276
1226
|
|
|
1277
1227
|
const htmlMotionConfig = {
|
|
1278
1228
|
useVisualState: makeUseVisualState({
|
|
1279
|
-
applyWillChange: true,
|
|
1280
1229
|
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
|
|
1281
1230
|
createRenderState: createHtmlRenderState,
|
|
1282
1231
|
}),
|