framer-motion 7.6.1 → 7.6.2

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
@@ -2258,7 +2258,7 @@ class MotionValue {
2258
2258
  * This will be replaced by the build step with the latest version number.
2259
2259
  * When MotionValues are provided to motion components, warn if versions are mixed.
2260
2260
  */
2261
- this.version = "7.6.1";
2261
+ this.version = "7.6.2";
2262
2262
  /**
2263
2263
  * Duration, in milliseconds, since last updating frame.
2264
2264
  *
@@ -4236,7 +4236,7 @@ function updateMotionValuesFromProps(element, next, prev) {
4236
4236
  * and warn against mismatches.
4237
4237
  */
4238
4238
  if (process.env.NODE_ENV === "development") {
4239
- warnOnce(nextValue.version === "7.6.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.6.1 may not work as expected.`);
4239
+ warnOnce(nextValue.version === "7.6.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.6.2 may not work as expected.`);
4240
4240
  }
4241
4241
  }
4242
4242
  else if (isMotionValue(prevValue)) {
@@ -7864,9 +7864,12 @@ const createScrollMotionValues = () => ({
7864
7864
  scrollXProgress: motionValue(0),
7865
7865
  scrollYProgress: motionValue(0),
7866
7866
  });
7867
- function useScroll({ container, target, ...options } = {}) {
7867
+ function useScroll({ container, target, layoutEffect = true, ...options } = {}) {
7868
7868
  const values = useConstant(createScrollMotionValues);
7869
- useIsomorphicLayoutEffect(() => {
7869
+ const useLifecycleEffect = layoutEffect
7870
+ ? useIsomorphicLayoutEffect
7871
+ : React.useEffect;
7872
+ useLifecycleEffect(() => {
7870
7873
  return dom.scroll(({ x, y }) => {
7871
7874
  values.scrollX.set(x.current);
7872
7875
  values.scrollXProgress.set(x.progress);
@@ -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.6.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.6.1 may not work as expected.`);
25
+ warnOnce(nextValue.version === "7.6.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.6.2 may not work as expected.`);
26
26
  }
27
27
  }
28
28
  else if (isMotionValue(prevValue)) {
@@ -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.6.1";
27
+ this.version = "7.6.2";
28
28
  /**
29
29
  * Duration, in milliseconds, since last updating frame.
30
30
  *
@@ -1,6 +1,7 @@
1
1
  import { scroll } from '@motionone/dom';
2
2
  import { motionValue } from './index.mjs';
3
3
  import { useConstant } from '../utils/use-constant.mjs';
4
+ import { useEffect } from 'react';
4
5
  import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
5
6
 
6
7
  const createScrollMotionValues = () => ({
@@ -9,9 +10,12 @@ const createScrollMotionValues = () => ({
9
10
  scrollXProgress: motionValue(0),
10
11
  scrollYProgress: motionValue(0),
11
12
  });
12
- function useScroll({ container, target, ...options } = {}) {
13
+ function useScroll({ container, target, layoutEffect = true, ...options } = {}) {
13
14
  const values = useConstant(createScrollMotionValues);
14
- useIsomorphicLayoutEffect(() => {
15
+ const useLifecycleEffect = layoutEffect
16
+ ? useIsomorphicLayoutEffect
17
+ : useEffect;
18
+ useLifecycleEffect(() => {
15
19
  return scroll(({ x, y }) => {
16
20
  values.scrollX.set(x.current);
17
21
  values.scrollXProgress.set(x.progress);
@@ -3426,7 +3426,7 @@
3426
3426
  * This will be replaced by the build step with the latest version number.
3427
3427
  * When MotionValues are provided to motion components, warn if versions are mixed.
3428
3428
  */
3429
- this.version = "7.6.1";
3429
+ this.version = "7.6.2";
3430
3430
  /**
3431
3431
  * Duration, in milliseconds, since last updating frame.
3432
3432
  *
@@ -5404,7 +5404,7 @@
5404
5404
  * and warn against mismatches.
5405
5405
  */
5406
5406
  {
5407
- warnOnce(nextValue.version === "7.6.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.6.1 may not work as expected.`);
5407
+ warnOnce(nextValue.version === "7.6.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.6.2 may not work as expected.`);
5408
5408
  }
5409
5409
  }
5410
5410
  else if (isMotionValue(prevValue)) {
@@ -9613,9 +9613,12 @@
9613
9613
  scrollXProgress: motionValue(0),
9614
9614
  scrollYProgress: motionValue(0),
9615
9615
  });
9616
- function useScroll({ container, target, ...options } = {}) {
9616
+ function useScroll({ container, target, layoutEffect = true, ...options } = {}) {
9617
9617
  const values = useConstant(createScrollMotionValues);
9618
- useIsomorphicLayoutEffect(() => {
9618
+ const useLifecycleEffect = layoutEffect
9619
+ ? useIsomorphicLayoutEffect
9620
+ : React.useEffect;
9621
+ useLifecycleEffect(() => {
9619
9622
  return scroll(({ x, y }) => {
9620
9623
  values.scrollX.set(x.current);
9621
9624
  values.scrollXProgress.set(x.progress);