framer-motion 11.0.21 → 11.0.23
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/dom-entry.js +1 -1
- package/dist/cjs/{index-legacy-2421bf33.js → index-legacy-8e07ef33.js} +16 -5
- package/dist/cjs/index-legacy-f855c3d0.js +5909 -0
- package/dist/cjs/index.js +9 -4
- package/dist/dom.js +1 -1
- package/dist/es/animation/animators/AcceleratedAnimation.mjs +8 -0
- package/dist/es/animation/animators/BaseAnimation.mjs +6 -3
- package/dist/es/projection/node/create-projection-node.mjs +5 -1
- package/dist/es/projection/styles/transform.mjs +3 -2
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +24 -8
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/projection.dev.js +24 -8
- package/package.json +6 -6
package/dist/cjs/dom-entry.js
CHANGED
|
@@ -1647,6 +1647,7 @@ class BaseAnimation {
|
|
|
1647
1647
|
constructor({ autoplay = true, delay = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", ...options }) {
|
|
1648
1648
|
// Track whether the animation has been stopped. Stopped animations won't restart.
|
|
1649
1649
|
this.isStopped = false;
|
|
1650
|
+
this.hasAttemptedResolve = false;
|
|
1650
1651
|
this.options = {
|
|
1651
1652
|
autoplay,
|
|
1652
1653
|
delay,
|
|
@@ -1664,8 +1665,9 @@ class BaseAnimation {
|
|
|
1664
1665
|
* This is a deoptimisation, but at its worst still batches read/writes.
|
|
1665
1666
|
*/
|
|
1666
1667
|
get resolved() {
|
|
1667
|
-
if (!this._resolved)
|
|
1668
|
+
if (!this._resolved && !this.hasAttemptedResolve) {
|
|
1668
1669
|
flushKeyframeResolvers();
|
|
1670
|
+
}
|
|
1669
1671
|
return this._resolved;
|
|
1670
1672
|
}
|
|
1671
1673
|
/**
|
|
@@ -1674,12 +1676,13 @@ class BaseAnimation {
|
|
|
1674
1676
|
* Otherwise, it will call initPlayback on the implementing class.
|
|
1675
1677
|
*/
|
|
1676
1678
|
onKeyframesResolved(keyframes, finalKeyframe) {
|
|
1677
|
-
|
|
1679
|
+
this.hasAttemptedResolve = true;
|
|
1680
|
+
const { name, type, velocity, delay, onComplete, onUpdate, isGenerator, } = this.options;
|
|
1678
1681
|
/**
|
|
1679
1682
|
* If we can't animate this value with the resolved keyframes
|
|
1680
1683
|
* then we should complete it immediately.
|
|
1681
1684
|
*/
|
|
1682
|
-
if (!canAnimate(keyframes, name, type, velocity)) {
|
|
1685
|
+
if (!isGenerator && !canAnimate(keyframes, name, type, velocity)) {
|
|
1683
1686
|
// Finish immediately
|
|
1684
1687
|
if (instantAnimationState.current || !delay) {
|
|
1685
1688
|
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(getFinalKeyframe(keyframes, this.options, finalKeyframe));
|
|
@@ -2950,6 +2953,7 @@ function pregenerateKeyframes(keyframes, options) {
|
|
|
2950
2953
|
keyframes,
|
|
2951
2954
|
repeat: 0,
|
|
2952
2955
|
delay: 0,
|
|
2956
|
+
isGenerator: true,
|
|
2953
2957
|
});
|
|
2954
2958
|
let state = { done: false, value: keyframes[0] };
|
|
2955
2959
|
const pregeneratedKeyframes = [];
|
|
@@ -2994,6 +2998,12 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
2994
2998
|
const { onComplete, onUpdate, motionValue, ...options } = this.options;
|
|
2995
2999
|
const pregeneratedAnimation = pregenerateKeyframes(keyframes, options);
|
|
2996
3000
|
keyframes = pregeneratedAnimation.keyframes;
|
|
3001
|
+
// If this is a very short animation, ensure we have
|
|
3002
|
+
// at least two keyframes to animate between as older browsers
|
|
3003
|
+
// can't animate between a single keyframe.
|
|
3004
|
+
if (keyframes.length === 1) {
|
|
3005
|
+
keyframes[1] = keyframes[0];
|
|
3006
|
+
}
|
|
2997
3007
|
duration = pregeneratedAnimation.duration;
|
|
2998
3008
|
times = pregeneratedAnimation.times;
|
|
2999
3009
|
ease = pregeneratedAnimation.ease;
|
|
@@ -3142,6 +3152,7 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
3142
3152
|
type,
|
|
3143
3153
|
ease,
|
|
3144
3154
|
times,
|
|
3155
|
+
isGenerator: true,
|
|
3145
3156
|
});
|
|
3146
3157
|
const sampleTime = secondsToMilliseconds(this.time);
|
|
3147
3158
|
motionValue.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta);
|
|
@@ -3378,7 +3389,7 @@ class MotionValue {
|
|
|
3378
3389
|
* This will be replaced by the build step with the latest version number.
|
|
3379
3390
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3380
3391
|
*/
|
|
3381
|
-
this.version = "11.0.
|
|
3392
|
+
this.version = "11.0.23";
|
|
3382
3393
|
/**
|
|
3383
3394
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
3384
3395
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -4146,7 +4157,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4146
4157
|
* and warn against mismatches.
|
|
4147
4158
|
*/
|
|
4148
4159
|
if (process.env.NODE_ENV === "development") {
|
|
4149
|
-
warnOnce(nextValue.version === "11.0.
|
|
4160
|
+
warnOnce(nextValue.version === "11.0.23", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.0.23 may not work as expected.`);
|
|
4150
4161
|
}
|
|
4151
4162
|
}
|
|
4152
4163
|
else if (isMotionValue(prevValue)) {
|