framer-motion 9.0.7 → 9.1.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/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.7";
2018
+ this.version = "9.1.0";
2019
2019
  /**
2020
2020
  * Duration, in milliseconds, since last updating frame.
2021
2021
  *
@@ -3598,7 +3598,12 @@ function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }) {
3598
3598
  /**
3599
3599
  * A list of values that can be hardware-accelerated.
3600
3600
  */
3601
- const acceleratedValues = new Set(["opacity"]);
3601
+ const acceleratedValues = new Set([
3602
+ "opacity",
3603
+ "clipPath",
3604
+ "filter",
3605
+ "transform",
3606
+ ]);
3602
3607
  /**
3603
3608
  * 10ms is chosen here as it strikes a balance between smooth
3604
3609
  * results (more than one keyframe per frame at 60fps) and
@@ -3809,51 +3814,41 @@ function inertia({ keyframes, velocity = 0, min, max, power = 0.8, timeConstant
3809
3814
  };
3810
3815
  }
3811
3816
 
3812
- const underDampedSpring = () => ({
3817
+ const underDampedSpring = {
3813
3818
  type: "spring",
3814
3819
  stiffness: 500,
3815
3820
  damping: 25,
3816
3821
  restSpeed: 10,
3817
- });
3822
+ };
3818
3823
  const criticallyDampedSpring = (target) => ({
3819
3824
  type: "spring",
3820
3825
  stiffness: 550,
3821
3826
  damping: target === 0 ? 2 * Math.sqrt(550) : 30,
3822
3827
  restSpeed: 10,
3823
3828
  });
3824
- const linearTween = () => ({
3825
- type: "keyframes",
3826
- ease: "linear",
3827
- duration: 0.3,
3828
- });
3829
3829
  const keyframesTransition = {
3830
3830
  type: "keyframes",
3831
3831
  duration: 0.8,
3832
3832
  };
3833
- const defaultTransitions = {
3834
- x: underDampedSpring,
3835
- y: underDampedSpring,
3836
- z: underDampedSpring,
3837
- rotate: underDampedSpring,
3838
- rotateX: underDampedSpring,
3839
- rotateY: underDampedSpring,
3840
- rotateZ: underDampedSpring,
3841
- scaleX: criticallyDampedSpring,
3842
- scaleY: criticallyDampedSpring,
3843
- scale: criticallyDampedSpring,
3844
- opacity: linearTween,
3845
- backgroundColor: linearTween,
3846
- color: linearTween,
3847
- default: criticallyDampedSpring,
3833
+ /**
3834
+ * Default easing curve is a slightly shallower version of
3835
+ * the default browser easing curve.
3836
+ */
3837
+ const ease = {
3838
+ type: "keyframes",
3839
+ ease: [0.25, 0.1, 0.35, 1],
3840
+ duration: 0.3,
3848
3841
  };
3849
3842
  const getDefaultTransition = (valueKey, { keyframes }) => {
3850
3843
  if (keyframes.length > 2) {
3851
3844
  return keyframesTransition;
3852
3845
  }
3853
- else {
3854
- const factory = defaultTransitions[valueKey] || defaultTransitions.default;
3855
- return factory(keyframes[1]);
3846
+ else if (transformProps.has(valueKey)) {
3847
+ return valueKey.startsWith("scale")
3848
+ ? criticallyDampedSpring(keyframes[1])
3849
+ : underDampedSpring;
3856
3850
  }
3851
+ return ease;
3857
3852
  };
3858
3853
 
3859
3854
  /**
@@ -7774,7 +7769,7 @@ function updateMotionValuesFromProps(element, next, prev) {
7774
7769
  * and warn against mismatches.
7775
7770
  */
7776
7771
  if (process.env.NODE_ENV === "development") {
7777
- warnOnce(nextValue.version === "9.0.7", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.7 may not work as expected.`);
7772
+ warnOnce(nextValue.version === "9.1.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.1.0 may not work as expected.`);
7778
7773
  }
7779
7774
  }
7780
7775
  else if (isMotionValue(prevValue)) {
@@ -1,48 +1,40 @@
1
- const underDampedSpring = () => ({
1
+ import { transformProps } from '../../render/html/utils/transform.mjs';
2
+
3
+ const underDampedSpring = {
2
4
  type: "spring",
3
5
  stiffness: 500,
4
6
  damping: 25,
5
7
  restSpeed: 10,
6
- });
8
+ };
7
9
  const criticallyDampedSpring = (target) => ({
8
10
  type: "spring",
9
11
  stiffness: 550,
10
12
  damping: target === 0 ? 2 * Math.sqrt(550) : 30,
11
13
  restSpeed: 10,
12
14
  });
13
- const linearTween = () => ({
14
- type: "keyframes",
15
- ease: "linear",
16
- duration: 0.3,
17
- });
18
15
  const keyframesTransition = {
19
16
  type: "keyframes",
20
17
  duration: 0.8,
21
18
  };
22
- const defaultTransitions = {
23
- x: underDampedSpring,
24
- y: underDampedSpring,
25
- z: underDampedSpring,
26
- rotate: underDampedSpring,
27
- rotateX: underDampedSpring,
28
- rotateY: underDampedSpring,
29
- rotateZ: underDampedSpring,
30
- scaleX: criticallyDampedSpring,
31
- scaleY: criticallyDampedSpring,
32
- scale: criticallyDampedSpring,
33
- opacity: linearTween,
34
- backgroundColor: linearTween,
35
- color: linearTween,
36
- default: criticallyDampedSpring,
19
+ /**
20
+ * Default easing curve is a slightly shallower version of
21
+ * the default browser easing curve.
22
+ */
23
+ const ease = {
24
+ type: "keyframes",
25
+ ease: [0.25, 0.1, 0.35, 1],
26
+ duration: 0.3,
37
27
  };
38
28
  const getDefaultTransition = (valueKey, { keyframes }) => {
39
29
  if (keyframes.length > 2) {
40
30
  return keyframesTransition;
41
31
  }
42
- else {
43
- const factory = defaultTransitions[valueKey] || defaultTransitions.default;
44
- return factory(keyframes[1]);
32
+ else if (transformProps.has(valueKey)) {
33
+ return valueKey.startsWith("scale")
34
+ ? criticallyDampedSpring(keyframes[1])
35
+ : underDampedSpring;
45
36
  }
37
+ return ease;
46
38
  };
47
39
 
48
- export { criticallyDampedSpring, getDefaultTransition, linearTween, underDampedSpring };
40
+ export { getDefaultTransition };
@@ -8,7 +8,12 @@ import { getFinalKeyframe } from './utils/get-final-keyframe.mjs';
8
8
  /**
9
9
  * A list of values that can be hardware-accelerated.
10
10
  */
11
- const acceleratedValues = new Set(["opacity"]);
11
+ const acceleratedValues = new Set([
12
+ "opacity",
13
+ "clipPath",
14
+ "filter",
15
+ "transform",
16
+ ]);
12
17
  /**
13
18
  * 10ms is chosen here as it strikes a balance between smooth
14
19
  * results (more than one keyframe per frame at 60fps) and
@@ -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.7", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.7 may not work as expected.`);
25
+ warnOnce(nextValue.version === "9.1.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.1.0 may not work as expected.`);
26
26
  }
27
27
  }
28
28
  else if (isMotionValue(prevValue)) {
@@ -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.7";
28
+ this.version = "9.1.0";
29
29
  /**
30
30
  * Duration, in milliseconds, since last updating frame.
31
31
  *
@@ -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.7";
2016
+ this.version = "9.1.0";
2017
2017
  /**
2018
2018
  * Duration, in milliseconds, since last updating frame.
2019
2019
  *
@@ -3611,7 +3611,12 @@
3611
3611
  /**
3612
3612
  * A list of values that can be hardware-accelerated.
3613
3613
  */
3614
- const acceleratedValues = new Set(["opacity"]);
3614
+ const acceleratedValues = new Set([
3615
+ "opacity",
3616
+ "clipPath",
3617
+ "filter",
3618
+ "transform",
3619
+ ]);
3615
3620
  /**
3616
3621
  * 10ms is chosen here as it strikes a balance between smooth
3617
3622
  * results (more than one keyframe per frame at 60fps) and
@@ -3822,51 +3827,41 @@
3822
3827
  };
3823
3828
  }
3824
3829
 
3825
- const underDampedSpring = () => ({
3830
+ const underDampedSpring = {
3826
3831
  type: "spring",
3827
3832
  stiffness: 500,
3828
3833
  damping: 25,
3829
3834
  restSpeed: 10,
3830
- });
3835
+ };
3831
3836
  const criticallyDampedSpring = (target) => ({
3832
3837
  type: "spring",
3833
3838
  stiffness: 550,
3834
3839
  damping: target === 0 ? 2 * Math.sqrt(550) : 30,
3835
3840
  restSpeed: 10,
3836
3841
  });
3837
- const linearTween = () => ({
3838
- type: "keyframes",
3839
- ease: "linear",
3840
- duration: 0.3,
3841
- });
3842
3842
  const keyframesTransition = {
3843
3843
  type: "keyframes",
3844
3844
  duration: 0.8,
3845
3845
  };
3846
- const defaultTransitions = {
3847
- x: underDampedSpring,
3848
- y: underDampedSpring,
3849
- z: underDampedSpring,
3850
- rotate: underDampedSpring,
3851
- rotateX: underDampedSpring,
3852
- rotateY: underDampedSpring,
3853
- rotateZ: underDampedSpring,
3854
- scaleX: criticallyDampedSpring,
3855
- scaleY: criticallyDampedSpring,
3856
- scale: criticallyDampedSpring,
3857
- opacity: linearTween,
3858
- backgroundColor: linearTween,
3859
- color: linearTween,
3860
- default: criticallyDampedSpring,
3846
+ /**
3847
+ * Default easing curve is a slightly shallower version of
3848
+ * the default browser easing curve.
3849
+ */
3850
+ const ease = {
3851
+ type: "keyframes",
3852
+ ease: [0.25, 0.1, 0.35, 1],
3853
+ duration: 0.3,
3861
3854
  };
3862
3855
  const getDefaultTransition = (valueKey, { keyframes }) => {
3863
3856
  if (keyframes.length > 2) {
3864
3857
  return keyframesTransition;
3865
3858
  }
3866
- else {
3867
- const factory = defaultTransitions[valueKey] || defaultTransitions.default;
3868
- return factory(keyframes[1]);
3859
+ else if (transformProps.has(valueKey)) {
3860
+ return valueKey.startsWith("scale")
3861
+ ? criticallyDampedSpring(keyframes[1])
3862
+ : underDampedSpring;
3869
3863
  }
3864
+ return ease;
3870
3865
  };
3871
3866
 
3872
3867
  /**
@@ -7787,7 +7782,7 @@
7787
7782
  * and warn against mismatches.
7788
7783
  */
7789
7784
  {
7790
- warnOnce(nextValue.version === "9.0.7", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.7 may not work as expected.`);
7785
+ warnOnce(nextValue.version === "9.1.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.1.0 may not work as expected.`);
7791
7786
  }
7792
7787
  }
7793
7788
  else if (isMotionValue(prevValue)) {