framer-motion 9.0.4 → 9.0.6
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 +18 -8
- package/dist/es/animation/index.mjs +2 -2
- package/dist/es/animation/legacy-popmotion/index.mjs +2 -2
- package/dist/es/animation/legacy-popmotion/inertia.mjs +2 -2
- package/dist/es/animation/waapi/create-accelerated-animation.mjs +6 -3
- package/dist/es/index.mjs +7 -0
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/es/value/use-spring.mjs +2 -2
- package/dist/framer-motion.dev.js +18 -8
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +117 -1
- package/dist/projection.dev.js +11 -8
- 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/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -2015,7 +2015,7 @@ class MotionValue {
|
|
|
2015
2015
|
* This will be replaced by the build step with the latest version number.
|
|
2016
2016
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2017
2017
|
*/
|
|
2018
|
-
this.version = "9.0.
|
|
2018
|
+
this.version = "9.0.6";
|
|
2019
2019
|
/**
|
|
2020
2020
|
* Duration, in milliseconds, since last updating frame.
|
|
2021
2021
|
*
|
|
@@ -3414,7 +3414,7 @@ const framesync = (update) => {
|
|
|
3414
3414
|
stop: () => cancelSync.update(passTimestamp),
|
|
3415
3415
|
};
|
|
3416
3416
|
};
|
|
3417
|
-
function
|
|
3417
|
+
function animateValue({ duration, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = "loop", repeatDelay = 0, keyframes: keyframes$1, autoplay = true, onPlay, onStop, onComplete, onRepeat, onUpdate, type = "keyframes", ...options }) {
|
|
3418
3418
|
const initialElapsed = elapsed;
|
|
3419
3419
|
let driverControls;
|
|
3420
3420
|
let repeatCount = 0;
|
|
@@ -3624,7 +3624,7 @@ function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ..
|
|
|
3624
3624
|
*/
|
|
3625
3625
|
if (options.repeat === Infinity)
|
|
3626
3626
|
return;
|
|
3627
|
-
const sampleAnimation =
|
|
3627
|
+
const sampleAnimation = animateValue({ ...options, elapsed: 0 });
|
|
3628
3628
|
let state = { done: false, value: keyframes[0] };
|
|
3629
3629
|
const pregeneratedKeyframes = [];
|
|
3630
3630
|
/**
|
|
@@ -3689,7 +3689,10 @@ function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ..
|
|
|
3689
3689
|
*/
|
|
3690
3690
|
const { currentTime } = animation;
|
|
3691
3691
|
if (currentTime) {
|
|
3692
|
-
const sampleAnimation =
|
|
3692
|
+
const sampleAnimation = animateValue({
|
|
3693
|
+
...options,
|
|
3694
|
+
autoplay: false,
|
|
3695
|
+
});
|
|
3693
3696
|
value.setWithVelocity(sampleAnimation.sample(currentTime - sampleDelta).value, sampleAnimation.sample(currentTime).value, sampleDelta);
|
|
3694
3697
|
}
|
|
3695
3698
|
sync.update(() => animation.cancel());
|
|
@@ -3736,7 +3739,7 @@ function inertia({ keyframes, velocity = 0, min, max, power = 0.8, timeConstant
|
|
|
3736
3739
|
}
|
|
3737
3740
|
function startAnimation(options) {
|
|
3738
3741
|
currentAnimation && currentAnimation.stop();
|
|
3739
|
-
currentAnimation =
|
|
3742
|
+
currentAnimation = animateValue({
|
|
3740
3743
|
keyframes: [0, 1],
|
|
3741
3744
|
velocity: 0,
|
|
3742
3745
|
...options,
|
|
@@ -4030,7 +4033,7 @@ const createMotionValueAnimation = (valueName, value, target, transition = {}) =
|
|
|
4030
4033
|
/**
|
|
4031
4034
|
* If we didn't create an accelerated animation, create a JS animation
|
|
4032
4035
|
*/
|
|
4033
|
-
return
|
|
4036
|
+
return animateValue(options);
|
|
4034
4037
|
};
|
|
4035
4038
|
};
|
|
4036
4039
|
|
|
@@ -7771,7 +7774,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
7771
7774
|
* and warn against mismatches.
|
|
7772
7775
|
*/
|
|
7773
7776
|
if (process.env.NODE_ENV === "development") {
|
|
7774
|
-
warnOnce(nextValue.version === "9.0.
|
|
7777
|
+
warnOnce(nextValue.version === "9.0.6", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.6 may not work as expected.`);
|
|
7775
7778
|
}
|
|
7776
7779
|
}
|
|
7777
7780
|
else if (isMotionValue(prevValue)) {
|
|
@@ -9383,7 +9386,7 @@ function useSpring(source, config = {}) {
|
|
|
9383
9386
|
if (isStatic)
|
|
9384
9387
|
return set(v);
|
|
9385
9388
|
stopAnimation();
|
|
9386
|
-
activeSpringAnimation.current =
|
|
9389
|
+
activeSpringAnimation.current = animateValue({
|
|
9387
9390
|
keyframes: [value.get(), v],
|
|
9388
9391
|
velocity: value.getVelocity(),
|
|
9389
9392
|
type: "spring",
|
|
@@ -10166,6 +10169,7 @@ exports.addPointerEvent = addPointerEvent;
|
|
|
10166
10169
|
exports.addPointerInfo = addPointerInfo;
|
|
10167
10170
|
exports.addScaleCorrector = addScaleCorrector;
|
|
10168
10171
|
exports.animate = animate;
|
|
10172
|
+
exports.animateValue = animateValue;
|
|
10169
10173
|
exports.animateVisualElement = animateVisualElement;
|
|
10170
10174
|
exports.animationControls = animationControls;
|
|
10171
10175
|
exports.animations = animations;
|
|
@@ -10180,6 +10184,8 @@ exports.circIn = circIn;
|
|
|
10180
10184
|
exports.circInOut = circInOut;
|
|
10181
10185
|
exports.circOut = circOut;
|
|
10182
10186
|
exports.clamp = clamp;
|
|
10187
|
+
exports.color = color;
|
|
10188
|
+
exports.complex = complex;
|
|
10183
10189
|
exports.createBox = createBox;
|
|
10184
10190
|
exports.createDomMotionComponent = createDomMotionComponent;
|
|
10185
10191
|
exports.createMotionComponent = createMotionComponent;
|
|
@@ -10194,6 +10200,8 @@ exports.easeInOut = easeInOut;
|
|
|
10194
10200
|
exports.easeOut = easeOut;
|
|
10195
10201
|
exports.filterProps = filterProps;
|
|
10196
10202
|
exports.frameData = frameData;
|
|
10203
|
+
exports.inertia = inertia;
|
|
10204
|
+
exports.interpolate = interpolate;
|
|
10197
10205
|
exports.isBrowser = isBrowser;
|
|
10198
10206
|
exports.isDragActive = isDragActive;
|
|
10199
10207
|
exports.isMotionComponent = isMotionComponent;
|
|
@@ -10206,6 +10214,8 @@ exports.motion = motion;
|
|
|
10206
10214
|
exports.motionValue = motionValue;
|
|
10207
10215
|
exports.optimizedAppearDataAttribute = optimizedAppearDataAttribute;
|
|
10208
10216
|
exports.pipe = pipe;
|
|
10217
|
+
exports.progress = progress;
|
|
10218
|
+
exports.px = px;
|
|
10209
10219
|
exports.resolveMotionValue = resolveMotionValue;
|
|
10210
10220
|
exports.spring = spring;
|
|
10211
10221
|
exports.startOptimizedAppearAnimation = startOptimizedAppearAnimation;
|
|
@@ -3,7 +3,7 @@ import { secondsToMilliseconds } from '../utils/time-conversion.mjs';
|
|
|
3
3
|
import { instantAnimationState } from '../utils/use-instant-transition-state.mjs';
|
|
4
4
|
import { createAcceleratedAnimation } from './waapi/create-accelerated-animation.mjs';
|
|
5
5
|
import { createInstantAnimation } from './create-instant-animation.mjs';
|
|
6
|
-
import {
|
|
6
|
+
import { animateValue } from './legacy-popmotion/index.mjs';
|
|
7
7
|
import { inertia } from './legacy-popmotion/inertia.mjs';
|
|
8
8
|
import { getDefaultTransition } from './utils/default-transitions.mjs';
|
|
9
9
|
import { isAnimatable } from './utils/is-animatable.mjs';
|
|
@@ -101,7 +101,7 @@ const createMotionValueAnimation = (valueName, value, target, transition = {}) =
|
|
|
101
101
|
/**
|
|
102
102
|
* If we didn't create an accelerated animation, create a JS animation
|
|
103
103
|
*/
|
|
104
|
-
return
|
|
104
|
+
return animateValue(options);
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
|
|
@@ -28,7 +28,7 @@ const framesync = (update) => {
|
|
|
28
28
|
stop: () => cancelSync.update(passTimestamp),
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
function
|
|
31
|
+
function animateValue({ duration, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = "loop", repeatDelay = 0, keyframes: keyframes$1, autoplay = true, onPlay, onStop, onComplete, onRepeat, onUpdate, type = "keyframes", ...options }) {
|
|
32
32
|
const initialElapsed = elapsed;
|
|
33
33
|
let driverControls;
|
|
34
34
|
let repeatCount = 0;
|
|
@@ -150,4 +150,4 @@ function animate({ duration, driver = framesync, elapsed = 0, repeat: repeatMax
|
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
export {
|
|
153
|
+
export { animateValue, hasRepeatDelayElapsed, loopElapsed, reverseElapsed };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { animateValue } from './index.mjs';
|
|
2
2
|
import { velocityPerSecond } from '../../utils/velocity-per-second.mjs';
|
|
3
3
|
import { frameData } from '../../frameloop/data.mjs';
|
|
4
4
|
|
|
@@ -17,7 +17,7 @@ function inertia({ keyframes, velocity = 0, min, max, power = 0.8, timeConstant
|
|
|
17
17
|
}
|
|
18
18
|
function startAnimation(options) {
|
|
19
19
|
currentAnimation && currentAnimation.stop();
|
|
20
|
-
currentAnimation =
|
|
20
|
+
currentAnimation = animateValue({
|
|
21
21
|
keyframes: [0, 1],
|
|
22
22
|
velocity: 0,
|
|
23
23
|
...options,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sync } from '../../frameloop/index.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { animateValue } from '../legacy-popmotion/index.mjs';
|
|
3
3
|
import { animateStyle } from './index.mjs';
|
|
4
4
|
import { isWaapiSupportedEasing } from './easing.mjs';
|
|
5
5
|
import { supports } from './supports.mjs';
|
|
@@ -34,7 +34,7 @@ function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ..
|
|
|
34
34
|
*/
|
|
35
35
|
if (options.repeat === Infinity)
|
|
36
36
|
return;
|
|
37
|
-
const sampleAnimation =
|
|
37
|
+
const sampleAnimation = animateValue({ ...options, elapsed: 0 });
|
|
38
38
|
let state = { done: false, value: keyframes[0] };
|
|
39
39
|
const pregeneratedKeyframes = [];
|
|
40
40
|
/**
|
|
@@ -99,7 +99,10 @@ function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ..
|
|
|
99
99
|
*/
|
|
100
100
|
const { currentTime } = animation;
|
|
101
101
|
if (currentTime) {
|
|
102
|
-
const sampleAnimation =
|
|
102
|
+
const sampleAnimation = animateValue({
|
|
103
|
+
...options,
|
|
104
|
+
autoplay: false,
|
|
105
|
+
});
|
|
103
106
|
value.setWithVelocity(sampleAnimation.sample(currentTime - sampleDelta).value, sampleAnimation.sample(currentTime).value, sampleDelta);
|
|
104
107
|
}
|
|
105
108
|
sync.update(() => animation.cancel());
|
package/dist/es/index.mjs
CHANGED
|
@@ -47,11 +47,18 @@ export { buildTransform } from './render/html/utils/build-transform.mjs';
|
|
|
47
47
|
export { clamp } from './utils/clamp.mjs';
|
|
48
48
|
export { delay } from './utils/delay.mjs';
|
|
49
49
|
export { distance, distance2D } from './utils/distance.mjs';
|
|
50
|
+
export { interpolate } from './utils/interpolate.mjs';
|
|
50
51
|
export { mix } from './utils/mix.mjs';
|
|
51
52
|
export { pipe } from './utils/pipe.mjs';
|
|
53
|
+
export { progress } from './utils/progress.mjs';
|
|
52
54
|
export { wrap } from './utils/wrap.mjs';
|
|
53
55
|
export { sync } from './frameloop/index.mjs';
|
|
54
56
|
export { frameData } from './frameloop/data.mjs';
|
|
57
|
+
export { animateValue } from './animation/legacy-popmotion/index.mjs';
|
|
58
|
+
export { inertia } from './animation/legacy-popmotion/inertia.mjs';
|
|
59
|
+
export { color } from './value/types/color/index.mjs';
|
|
60
|
+
export { complex } from './value/types/complex/index.mjs';
|
|
61
|
+
export { px } from './value/types/numbers/units.mjs';
|
|
55
62
|
export { startOptimizedAppearAnimation } from './animation/optimized-appear/start.mjs';
|
|
56
63
|
export { optimizedAppearDataAttribute } from './animation/optimized-appear/data-id.mjs';
|
|
57
64
|
export { spring } from './animation/legacy-popmotion/spring.mjs';
|
|
@@ -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 === "9.0.
|
|
25
|
+
warnOnce(nextValue.version === "9.0.6", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.6 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -25,7 +25,7 @@ class MotionValue {
|
|
|
25
25
|
* This will be replaced by the build step with the latest version number.
|
|
26
26
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
27
27
|
*/
|
|
28
|
-
this.version = "9.0.
|
|
28
|
+
this.version = "9.0.6";
|
|
29
29
|
/**
|
|
30
30
|
* Duration, in milliseconds, since last updating frame.
|
|
31
31
|
*
|
|
@@ -2,7 +2,7 @@ import { useContext, useRef, useInsertionEffect } from 'react';
|
|
|
2
2
|
import { isMotionValue } from './utils/is-motion-value.mjs';
|
|
3
3
|
import { useMotionValue } from './use-motion-value.mjs';
|
|
4
4
|
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { animateValue } from '../animation/legacy-popmotion/index.mjs';
|
|
6
6
|
import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -42,7 +42,7 @@ function useSpring(source, config = {}) {
|
|
|
42
42
|
if (isStatic)
|
|
43
43
|
return set(v);
|
|
44
44
|
stopAnimation();
|
|
45
|
-
activeSpringAnimation.current =
|
|
45
|
+
activeSpringAnimation.current = animateValue({
|
|
46
46
|
keyframes: [value.get(), v],
|
|
47
47
|
velocity: value.getVelocity(),
|
|
48
48
|
type: "spring",
|
|
@@ -2013,7 +2013,7 @@
|
|
|
2013
2013
|
* This will be replaced by the build step with the latest version number.
|
|
2014
2014
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2015
2015
|
*/
|
|
2016
|
-
this.version = "9.0.
|
|
2016
|
+
this.version = "9.0.6";
|
|
2017
2017
|
/**
|
|
2018
2018
|
* Duration, in milliseconds, since last updating frame.
|
|
2019
2019
|
*
|
|
@@ -3427,7 +3427,7 @@
|
|
|
3427
3427
|
stop: () => cancelSync.update(passTimestamp),
|
|
3428
3428
|
};
|
|
3429
3429
|
};
|
|
3430
|
-
function
|
|
3430
|
+
function animateValue({ duration, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = "loop", repeatDelay = 0, keyframes: keyframes$1, autoplay = true, onPlay, onStop, onComplete, onRepeat, onUpdate, type = "keyframes", ...options }) {
|
|
3431
3431
|
const initialElapsed = elapsed;
|
|
3432
3432
|
let driverControls;
|
|
3433
3433
|
let repeatCount = 0;
|
|
@@ -3637,7 +3637,7 @@
|
|
|
3637
3637
|
*/
|
|
3638
3638
|
if (options.repeat === Infinity)
|
|
3639
3639
|
return;
|
|
3640
|
-
const sampleAnimation =
|
|
3640
|
+
const sampleAnimation = animateValue({ ...options, elapsed: 0 });
|
|
3641
3641
|
let state = { done: false, value: keyframes[0] };
|
|
3642
3642
|
const pregeneratedKeyframes = [];
|
|
3643
3643
|
/**
|
|
@@ -3702,7 +3702,10 @@
|
|
|
3702
3702
|
*/
|
|
3703
3703
|
const { currentTime } = animation;
|
|
3704
3704
|
if (currentTime) {
|
|
3705
|
-
const sampleAnimation =
|
|
3705
|
+
const sampleAnimation = animateValue({
|
|
3706
|
+
...options,
|
|
3707
|
+
autoplay: false,
|
|
3708
|
+
});
|
|
3706
3709
|
value.setWithVelocity(sampleAnimation.sample(currentTime - sampleDelta).value, sampleAnimation.sample(currentTime).value, sampleDelta);
|
|
3707
3710
|
}
|
|
3708
3711
|
sync.update(() => animation.cancel());
|
|
@@ -3749,7 +3752,7 @@
|
|
|
3749
3752
|
}
|
|
3750
3753
|
function startAnimation(options) {
|
|
3751
3754
|
currentAnimation && currentAnimation.stop();
|
|
3752
|
-
currentAnimation =
|
|
3755
|
+
currentAnimation = animateValue({
|
|
3753
3756
|
keyframes: [0, 1],
|
|
3754
3757
|
velocity: 0,
|
|
3755
3758
|
...options,
|
|
@@ -4043,7 +4046,7 @@
|
|
|
4043
4046
|
/**
|
|
4044
4047
|
* If we didn't create an accelerated animation, create a JS animation
|
|
4045
4048
|
*/
|
|
4046
|
-
return
|
|
4049
|
+
return animateValue(options);
|
|
4047
4050
|
};
|
|
4048
4051
|
};
|
|
4049
4052
|
|
|
@@ -7784,7 +7787,7 @@
|
|
|
7784
7787
|
* and warn against mismatches.
|
|
7785
7788
|
*/
|
|
7786
7789
|
{
|
|
7787
|
-
warnOnce(nextValue.version === "9.0.
|
|
7790
|
+
warnOnce(nextValue.version === "9.0.6", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.6 may not work as expected.`);
|
|
7788
7791
|
}
|
|
7789
7792
|
}
|
|
7790
7793
|
else if (isMotionValue(prevValue)) {
|
|
@@ -9394,7 +9397,7 @@
|
|
|
9394
9397
|
if (isStatic)
|
|
9395
9398
|
return set(v);
|
|
9396
9399
|
stopAnimation();
|
|
9397
|
-
activeSpringAnimation.current =
|
|
9400
|
+
activeSpringAnimation.current = animateValue({
|
|
9398
9401
|
keyframes: [value.get(), v],
|
|
9399
9402
|
velocity: value.getVelocity(),
|
|
9400
9403
|
type: "spring",
|
|
@@ -10785,6 +10788,7 @@
|
|
|
10785
10788
|
exports.addPointerInfo = addPointerInfo;
|
|
10786
10789
|
exports.addScaleCorrector = addScaleCorrector;
|
|
10787
10790
|
exports.animate = animate;
|
|
10791
|
+
exports.animateValue = animateValue;
|
|
10788
10792
|
exports.animateVisualElement = animateVisualElement;
|
|
10789
10793
|
exports.animationControls = animationControls;
|
|
10790
10794
|
exports.animations = animations;
|
|
@@ -10799,6 +10803,8 @@
|
|
|
10799
10803
|
exports.circInOut = circInOut;
|
|
10800
10804
|
exports.circOut = circOut;
|
|
10801
10805
|
exports.clamp = clamp$1;
|
|
10806
|
+
exports.color = color;
|
|
10807
|
+
exports.complex = complex;
|
|
10802
10808
|
exports.createBox = createBox;
|
|
10803
10809
|
exports.createDomMotionComponent = createDomMotionComponent;
|
|
10804
10810
|
exports.createMotionComponent = createMotionComponent;
|
|
@@ -10813,6 +10819,8 @@
|
|
|
10813
10819
|
exports.easeOut = easeOut;
|
|
10814
10820
|
exports.filterProps = filterProps;
|
|
10815
10821
|
exports.frameData = frameData;
|
|
10822
|
+
exports.inertia = inertia;
|
|
10823
|
+
exports.interpolate = interpolate$1;
|
|
10816
10824
|
exports.isBrowser = isBrowser;
|
|
10817
10825
|
exports.isDragActive = isDragActive;
|
|
10818
10826
|
exports.isMotionComponent = isMotionComponent;
|
|
@@ -10825,6 +10833,8 @@
|
|
|
10825
10833
|
exports.motionValue = motionValue;
|
|
10826
10834
|
exports.optimizedAppearDataAttribute = optimizedAppearDataAttribute;
|
|
10827
10835
|
exports.pipe = pipe;
|
|
10836
|
+
exports.progress = progress$1;
|
|
10837
|
+
exports.px = px;
|
|
10828
10838
|
exports.resolveMotionValue = resolveMotionValue;
|
|
10829
10839
|
exports.spring = spring;
|
|
10830
10840
|
exports.startOptimizedAppearAnimation = startOptimizedAppearAnimation;
|