framer-motion 7.5.1 → 7.5.3
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 +32 -5
- package/dist/es/render/index.mjs +31 -3
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +32 -5
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +57 -5
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-webpack-dom-animation.js +1 -1
- package/dist/size-webpack-dom-max.js +1 -1
- package/package.json +5 -5
package/dist/cjs/index.js
CHANGED
|
@@ -2245,7 +2245,7 @@ class MotionValue {
|
|
|
2245
2245
|
* This will be replaced by the build step with the latest version number.
|
|
2246
2246
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2247
2247
|
*/
|
|
2248
|
-
this.version = "7.5.
|
|
2248
|
+
this.version = "7.5.3";
|
|
2249
2249
|
/**
|
|
2250
2250
|
* Duration, in milliseconds, since last updating frame.
|
|
2251
2251
|
*
|
|
@@ -4221,7 +4221,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4221
4221
|
* and warn against mismatches.
|
|
4222
4222
|
*/
|
|
4223
4223
|
if (process.env.NODE_ENV === "development") {
|
|
4224
|
-
warnOnce(nextValue.version === "7.5.
|
|
4224
|
+
warnOnce(nextValue.version === "7.5.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.5.3 may not work as expected.`);
|
|
4225
4225
|
}
|
|
4226
4226
|
}
|
|
4227
4227
|
else if (isMotionValue(prevValue)) {
|
|
@@ -4300,6 +4300,10 @@ const visualElement = ({ treeType = "", build, getBaseTarget, makeTargetAnimatab
|
|
|
4300
4300
|
const baseTarget = {
|
|
4301
4301
|
...latestValues,
|
|
4302
4302
|
};
|
|
4303
|
+
/**
|
|
4304
|
+
* Create an object of the values we initially animated from (if initial prop present).
|
|
4305
|
+
*/
|
|
4306
|
+
const initialValues = props.initial ? { ...latestValues } : {};
|
|
4303
4307
|
// Internal methods ========================
|
|
4304
4308
|
/**
|
|
4305
4309
|
* On mount, this will be hydrated with a callback to disconnect
|
|
@@ -4361,8 +4365,9 @@ const visualElement = ({ treeType = "", build, getBaseTarget, makeTargetAnimatab
|
|
|
4361
4365
|
*/
|
|
4362
4366
|
if (props.values) {
|
|
4363
4367
|
for (const key in props.values) {
|
|
4364
|
-
|
|
4365
|
-
|
|
4368
|
+
const value = props.values[key];
|
|
4369
|
+
if (latestValues[key] !== undefined && isMotionValue(value)) {
|
|
4370
|
+
value.set(latestValues[key]);
|
|
4366
4371
|
}
|
|
4367
4372
|
}
|
|
4368
4373
|
}
|
|
@@ -4645,12 +4650,34 @@ const visualElement = ({ treeType = "", build, getBaseTarget, makeTargetAnimatab
|
|
|
4645
4650
|
* props.
|
|
4646
4651
|
*/
|
|
4647
4652
|
getBaseTarget(key) {
|
|
4653
|
+
var _a;
|
|
4654
|
+
const { initial } = props;
|
|
4655
|
+
const valueFromInitial = typeof initial === "string" || typeof initial === "object"
|
|
4656
|
+
? (_a = resolveVariantFromProps(props, initial)) === null || _a === void 0 ? void 0 : _a[key]
|
|
4657
|
+
: undefined;
|
|
4658
|
+
/**
|
|
4659
|
+
* If this value still exists in the current initial variant, read that.
|
|
4660
|
+
*/
|
|
4661
|
+
if (initial && valueFromInitial !== undefined) {
|
|
4662
|
+
return valueFromInitial;
|
|
4663
|
+
}
|
|
4664
|
+
/**
|
|
4665
|
+
* Alternatively, if this VisualElement config has defined a getBaseTarget
|
|
4666
|
+
* so we can read the value from an alternative source, try that.
|
|
4667
|
+
*/
|
|
4648
4668
|
if (getBaseTarget) {
|
|
4649
4669
|
const target = getBaseTarget(props, key);
|
|
4650
4670
|
if (target !== undefined && !isMotionValue(target))
|
|
4651
4671
|
return target;
|
|
4652
4672
|
}
|
|
4653
|
-
|
|
4673
|
+
/**
|
|
4674
|
+
* If the value was initially defined on initial, but it doesn't any more,
|
|
4675
|
+
* return undefined. Otherwise return the value as initially read from the DOM.
|
|
4676
|
+
*/
|
|
4677
|
+
return initialValues[key] !== undefined &&
|
|
4678
|
+
valueFromInitial === undefined
|
|
4679
|
+
? undefined
|
|
4680
|
+
: baseTarget[key];
|
|
4654
4681
|
},
|
|
4655
4682
|
// Lifecyles ========================
|
|
4656
4683
|
...lifecycles,
|
package/dist/es/render/index.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import { invariant } from 'hey-listen';
|
|
|
14
14
|
import { featureDefinitions } from '../motion/features/definitions.mjs';
|
|
15
15
|
import { createElement } from 'react';
|
|
16
16
|
import { isRefObject } from '../utils/is-ref-object.mjs';
|
|
17
|
+
import { resolveVariantFromProps } from './utils/resolve-variants.mjs';
|
|
17
18
|
|
|
18
19
|
const featureNames = Object.keys(featureDefinitions);
|
|
19
20
|
const numFeatures = featureNames.length;
|
|
@@ -56,6 +57,10 @@ const visualElement = ({ treeType = "", build, getBaseTarget, makeTargetAnimatab
|
|
|
56
57
|
const baseTarget = {
|
|
57
58
|
...latestValues,
|
|
58
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Create an object of the values we initially animated from (if initial prop present).
|
|
62
|
+
*/
|
|
63
|
+
const initialValues = props.initial ? { ...latestValues } : {};
|
|
59
64
|
// Internal methods ========================
|
|
60
65
|
/**
|
|
61
66
|
* On mount, this will be hydrated with a callback to disconnect
|
|
@@ -117,8 +122,9 @@ const visualElement = ({ treeType = "", build, getBaseTarget, makeTargetAnimatab
|
|
|
117
122
|
*/
|
|
118
123
|
if (props.values) {
|
|
119
124
|
for (const key in props.values) {
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
const value = props.values[key];
|
|
126
|
+
if (latestValues[key] !== undefined && isMotionValue(value)) {
|
|
127
|
+
value.set(latestValues[key]);
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
}
|
|
@@ -401,12 +407,34 @@ const visualElement = ({ treeType = "", build, getBaseTarget, makeTargetAnimatab
|
|
|
401
407
|
* props.
|
|
402
408
|
*/
|
|
403
409
|
getBaseTarget(key) {
|
|
410
|
+
var _a;
|
|
411
|
+
const { initial } = props;
|
|
412
|
+
const valueFromInitial = typeof initial === "string" || typeof initial === "object"
|
|
413
|
+
? (_a = resolveVariantFromProps(props, initial)) === null || _a === void 0 ? void 0 : _a[key]
|
|
414
|
+
: undefined;
|
|
415
|
+
/**
|
|
416
|
+
* If this value still exists in the current initial variant, read that.
|
|
417
|
+
*/
|
|
418
|
+
if (initial && valueFromInitial !== undefined) {
|
|
419
|
+
return valueFromInitial;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Alternatively, if this VisualElement config has defined a getBaseTarget
|
|
423
|
+
* so we can read the value from an alternative source, try that.
|
|
424
|
+
*/
|
|
404
425
|
if (getBaseTarget) {
|
|
405
426
|
const target = getBaseTarget(props, key);
|
|
406
427
|
if (target !== undefined && !isMotionValue(target))
|
|
407
428
|
return target;
|
|
408
429
|
}
|
|
409
|
-
|
|
430
|
+
/**
|
|
431
|
+
* If the value was initially defined on initial, but it doesn't any more,
|
|
432
|
+
* return undefined. Otherwise return the value as initially read from the DOM.
|
|
433
|
+
*/
|
|
434
|
+
return initialValues[key] !== undefined &&
|
|
435
|
+
valueFromInitial === undefined
|
|
436
|
+
? undefined
|
|
437
|
+
: baseTarget[key];
|
|
410
438
|
},
|
|
411
439
|
// Lifecyles ========================
|
|
412
440
|
...lifecycles,
|
|
@@ -22,7 +22,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
22
22
|
* and warn against mismatches.
|
|
23
23
|
*/
|
|
24
24
|
if (process.env.NODE_ENV === "development") {
|
|
25
|
-
warnOnce(nextValue.version === "7.5.
|
|
25
|
+
warnOnce(nextValue.version === "7.5.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.5.3 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ class MotionValue {
|
|
|
24
24
|
* This will be replaced by the build step with the latest version number.
|
|
25
25
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
26
26
|
*/
|
|
27
|
-
this.version = "7.5.
|
|
27
|
+
this.version = "7.5.3";
|
|
28
28
|
/**
|
|
29
29
|
* Duration, in milliseconds, since last updating frame.
|
|
30
30
|
*
|
|
@@ -3413,7 +3413,7 @@
|
|
|
3413
3413
|
* This will be replaced by the build step with the latest version number.
|
|
3414
3414
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3415
3415
|
*/
|
|
3416
|
-
this.version = "7.5.
|
|
3416
|
+
this.version = "7.5.3";
|
|
3417
3417
|
/**
|
|
3418
3418
|
* Duration, in milliseconds, since last updating frame.
|
|
3419
3419
|
*
|
|
@@ -5389,7 +5389,7 @@
|
|
|
5389
5389
|
* and warn against mismatches.
|
|
5390
5390
|
*/
|
|
5391
5391
|
{
|
|
5392
|
-
warnOnce(nextValue.version === "7.5.
|
|
5392
|
+
warnOnce(nextValue.version === "7.5.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.5.3 may not work as expected.`);
|
|
5393
5393
|
}
|
|
5394
5394
|
}
|
|
5395
5395
|
else if (isMotionValue(prevValue)) {
|
|
@@ -5468,6 +5468,10 @@
|
|
|
5468
5468
|
const baseTarget = {
|
|
5469
5469
|
...latestValues,
|
|
5470
5470
|
};
|
|
5471
|
+
/**
|
|
5472
|
+
* Create an object of the values we initially animated from (if initial prop present).
|
|
5473
|
+
*/
|
|
5474
|
+
const initialValues = props.initial ? { ...latestValues } : {};
|
|
5471
5475
|
// Internal methods ========================
|
|
5472
5476
|
/**
|
|
5473
5477
|
* On mount, this will be hydrated with a callback to disconnect
|
|
@@ -5529,8 +5533,9 @@
|
|
|
5529
5533
|
*/
|
|
5530
5534
|
if (props.values) {
|
|
5531
5535
|
for (const key in props.values) {
|
|
5532
|
-
|
|
5533
|
-
|
|
5536
|
+
const value = props.values[key];
|
|
5537
|
+
if (latestValues[key] !== undefined && isMotionValue(value)) {
|
|
5538
|
+
value.set(latestValues[key]);
|
|
5534
5539
|
}
|
|
5535
5540
|
}
|
|
5536
5541
|
}
|
|
@@ -5813,12 +5818,34 @@
|
|
|
5813
5818
|
* props.
|
|
5814
5819
|
*/
|
|
5815
5820
|
getBaseTarget(key) {
|
|
5821
|
+
var _a;
|
|
5822
|
+
const { initial } = props;
|
|
5823
|
+
const valueFromInitial = typeof initial === "string" || typeof initial === "object"
|
|
5824
|
+
? (_a = resolveVariantFromProps(props, initial)) === null || _a === void 0 ? void 0 : _a[key]
|
|
5825
|
+
: undefined;
|
|
5826
|
+
/**
|
|
5827
|
+
* If this value still exists in the current initial variant, read that.
|
|
5828
|
+
*/
|
|
5829
|
+
if (initial && valueFromInitial !== undefined) {
|
|
5830
|
+
return valueFromInitial;
|
|
5831
|
+
}
|
|
5832
|
+
/**
|
|
5833
|
+
* Alternatively, if this VisualElement config has defined a getBaseTarget
|
|
5834
|
+
* so we can read the value from an alternative source, try that.
|
|
5835
|
+
*/
|
|
5816
5836
|
if (getBaseTarget) {
|
|
5817
5837
|
const target = getBaseTarget(props, key);
|
|
5818
5838
|
if (target !== undefined && !isMotionValue(target))
|
|
5819
5839
|
return target;
|
|
5820
5840
|
}
|
|
5821
|
-
|
|
5841
|
+
/**
|
|
5842
|
+
* If the value was initially defined on initial, but it doesn't any more,
|
|
5843
|
+
* return undefined. Otherwise return the value as initially read from the DOM.
|
|
5844
|
+
*/
|
|
5845
|
+
return initialValues[key] !== undefined &&
|
|
5846
|
+
valueFromInitial === undefined
|
|
5847
|
+
? undefined
|
|
5848
|
+
: baseTarget[key];
|
|
5822
5849
|
},
|
|
5823
5850
|
// Lifecyles ========================
|
|
5824
5851
|
...lifecycles,
|