framer-motion 10.0.1 → 10.1.0-alpha.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
@@ -37,9 +37,6 @@ const MotionConfigContext = React.createContext({
37
37
  });
38
38
 
39
39
  const MotionContext = React.createContext({});
40
- function useVisualElementContext() {
41
- return React.useContext(MotionContext).visualElement;
42
- }
43
40
 
44
41
  /**
45
42
  * @public
@@ -53,7 +50,7 @@ const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useE
53
50
  const LazyContext = React.createContext({ strict: false });
54
51
 
55
52
  function useVisualElement(Component, visualState, props, createVisualElement) {
56
- const parent = useVisualElementContext();
53
+ const { visualElement: parent } = React.useContext(MotionContext);
57
54
  const lazyContext = React.useContext(LazyContext);
58
55
  const presenceContext = React.useContext(PresenceContext);
59
56
  const reducedMotionConfig = React.useContext(MotionConfigContext).reducedMotion;
@@ -193,13 +190,13 @@ function variantLabelsAsDependency(prop) {
193
190
  const featureProps = {
194
191
  animation: [
195
192
  "animate",
196
- "exit",
197
193
  "variants",
198
194
  "whileHover",
199
195
  "whileTap",
196
+ "exit",
197
+ "whileInView",
200
198
  "whileFocus",
201
199
  "whileDrag",
202
- "whileInView",
203
200
  ],
204
201
  exit: ["exit"],
205
202
  drag: ["drag", "dragControls"],
@@ -1987,7 +1984,7 @@ class MotionValue {
1987
1984
  * This will be replaced by the build step with the latest version number.
1988
1985
  * When MotionValues are provided to motion components, warn if versions are mixed.
1989
1986
  */
1990
- this.version = "10.0.1";
1987
+ this.version = "10.1.0-alpha.0";
1991
1988
  /**
1992
1989
  * Duration, in milliseconds, since last updating frame.
1993
1990
  *
@@ -7840,7 +7837,7 @@ function updateMotionValuesFromProps(element, next, prev) {
7840
7837
  * and warn against mismatches.
7841
7838
  */
7842
7839
  if (process.env.NODE_ENV === "development") {
7843
- warnOnce(nextValue.version === "10.0.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.0.1 may not work as expected.`);
7840
+ warnOnce(nextValue.version === "10.1.0-alpha.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.1.0-alpha.0 may not work as expected.`);
7844
7841
  }
7845
7842
  }
7846
7843
  else if (isMotionValue(prevValue)) {
@@ -10649,7 +10646,7 @@ let hasWarned = false;
10649
10646
  function useInvertedScale(scale) {
10650
10647
  let parentScaleX = useMotionValue(1);
10651
10648
  let parentScaleY = useMotionValue(1);
10652
- const visualElement = useVisualElementContext();
10649
+ const { visualElement } = React.useContext(MotionContext);
10653
10650
  exports.invariant(!!(scale || visualElement), "If no scale values are provided, useInvertedScale must be used within a child of another motion component.");
10654
10651
  exports.warning(hasWarned, "useInvertedScale is deprecated and will be removed in 3.0. Use the layout prop instead.");
10655
10652
  hasWarned = true;
@@ -10776,6 +10773,5 @@ exports.useTransform = useTransform;
10776
10773
  exports.useUnmountEffect = useUnmountEffect;
10777
10774
  exports.useVelocity = useVelocity;
10778
10775
  exports.useViewportScroll = useViewportScroll;
10779
- exports.useVisualElementContext = useVisualElementContext;
10780
10776
  exports.useWillChange = useWillChange;
10781
10777
  exports.wrap = wrap;
@@ -1,8 +1,5 @@
1
- import { createContext, useContext } from 'react';
1
+ import { createContext } from 'react';
2
2
 
3
3
  const MotionContext = createContext({});
4
- function useVisualElementContext() {
5
- return useContext(MotionContext).visualElement;
6
- }
7
4
 
8
- export { MotionContext, useVisualElementContext };
5
+ export { MotionContext };
package/dist/es/index.mjs CHANGED
@@ -63,7 +63,7 @@ export { px } from './value/types/numbers/units.mjs';
63
63
  export { startOptimizedAppearAnimation } from './animation/optimized-appear/start.mjs';
64
64
  export { optimizedAppearDataAttribute } from './animation/optimized-appear/data-id.mjs';
65
65
  export { spring } from './animation/legacy-popmotion/spring.mjs';
66
- export { MotionContext, useVisualElementContext } from './context/MotionContext/index.mjs';
66
+ export { MotionContext } from './context/MotionContext/index.mjs';
67
67
  export { MotionConfigContext } from './context/MotionConfigContext.mjs';
68
68
  export { PresenceContext } from './context/PresenceContext.mjs';
69
69
  export { LayoutGroupContext } from './context/LayoutGroupContext.mjs';
@@ -1,13 +1,13 @@
1
1
  const featureProps = {
2
2
  animation: [
3
3
  "animate",
4
- "exit",
5
4
  "variants",
6
5
  "whileHover",
7
6
  "whileTap",
7
+ "exit",
8
+ "whileInView",
8
9
  "whileFocus",
9
10
  "whileDrag",
10
- "whileInView",
11
11
  ],
12
12
  exit: ["exit"],
13
13
  drag: ["drag", "dragControls"],
@@ -1,12 +1,12 @@
1
1
  import { useContext, useRef, useInsertionEffect, useEffect } from 'react';
2
2
  import { PresenceContext } from '../../context/PresenceContext.mjs';
3
- import { useVisualElementContext } from '../../context/MotionContext/index.mjs';
3
+ import { MotionContext } from '../../context/MotionContext/index.mjs';
4
4
  import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
5
5
  import { LazyContext } from '../../context/LazyContext.mjs';
6
6
  import { MotionConfigContext } from '../../context/MotionConfigContext.mjs';
7
7
 
8
8
  function useVisualElement(Component, visualState, props, createVisualElement) {
9
- const parent = useVisualElementContext();
9
+ const { visualElement: parent } = useContext(MotionContext);
10
10
  const lazyContext = useContext(LazyContext);
11
11
  const presenceContext = useContext(PresenceContext);
12
12
  const reducedMotionConfig = useContext(MotionConfigContext).reducedMotion;
@@ -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 === "10.0.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.0.1 may not work as expected.`);
25
+ warnOnce(nextValue.version === "10.1.0-alpha.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.1.0-alpha.0 may not work as expected.`);
26
26
  }
27
27
  }
28
28
  else if (isMotionValue(prevValue)) {
@@ -26,7 +26,7 @@ class MotionValue {
26
26
  * This will be replaced by the build step with the latest version number.
27
27
  * When MotionValues are provided to motion components, warn if versions are mixed.
28
28
  */
29
- this.version = "10.0.1";
29
+ this.version = "10.1.0-alpha.0";
30
30
  /**
31
31
  * Duration, in milliseconds, since last updating frame.
32
32
  *
@@ -1,7 +1,8 @@
1
1
  import { useTransform } from './use-transform.mjs';
2
2
  import { invariant, warning } from '../utils/errors.mjs';
3
3
  import { useMotionValue } from './use-motion-value.mjs';
4
- import { useVisualElementContext } from '../context/MotionContext/index.mjs';
4
+ import { MotionContext } from '../context/MotionContext/index.mjs';
5
+ import { useContext } from 'react';
5
6
 
6
7
  // Keep things reasonable and avoid scale: Infinity. In practise we might need
7
8
  // to add another value, opacity, that could interpolate scaleX/Y [0,0.01] => [0,1]
@@ -31,7 +32,7 @@ let hasWarned = false;
31
32
  function useInvertedScale(scale) {
32
33
  let parentScaleX = useMotionValue(1);
33
34
  let parentScaleY = useMotionValue(1);
34
- const visualElement = useVisualElementContext();
35
+ const { visualElement } = useContext(MotionContext);
35
36
  invariant(!!(scale || visualElement), "If no scale values are provided, useInvertedScale must be used within a child of another motion component.");
36
37
  warning(hasWarned, "useInvertedScale is deprecated and will be removed in 3.0. Use the layout prop instead.");
37
38
  hasWarned = true;
@@ -37,9 +37,6 @@
37
37
  });
38
38
 
39
39
  const MotionContext = React.createContext({});
40
- function useVisualElementContext() {
41
- return React.useContext(MotionContext).visualElement;
42
- }
43
40
 
44
41
  /**
45
42
  * @public
@@ -53,7 +50,7 @@
53
50
  const LazyContext = React.createContext({ strict: false });
54
51
 
55
52
  function useVisualElement(Component, visualState, props, createVisualElement) {
56
- const parent = useVisualElementContext();
53
+ const { visualElement: parent } = React.useContext(MotionContext);
57
54
  const lazyContext = React.useContext(LazyContext);
58
55
  const presenceContext = React.useContext(PresenceContext);
59
56
  const reducedMotionConfig = React.useContext(MotionConfigContext).reducedMotion;
@@ -193,13 +190,13 @@
193
190
  const featureProps = {
194
191
  animation: [
195
192
  "animate",
196
- "exit",
197
193
  "variants",
198
194
  "whileHover",
199
195
  "whileTap",
196
+ "exit",
197
+ "whileInView",
200
198
  "whileFocus",
201
199
  "whileDrag",
202
- "whileInView",
203
200
  ],
204
201
  exit: ["exit"],
205
202
  drag: ["drag", "dragControls"],
@@ -1987,7 +1984,7 @@
1987
1984
  * This will be replaced by the build step with the latest version number.
1988
1985
  * When MotionValues are provided to motion components, warn if versions are mixed.
1989
1986
  */
1990
- this.version = "10.0.1";
1987
+ this.version = "10.1.0-alpha.0";
1991
1988
  /**
1992
1989
  * Duration, in milliseconds, since last updating frame.
1993
1990
  *
@@ -7840,7 +7837,7 @@
7840
7837
  * and warn against mismatches.
7841
7838
  */
7842
7839
  {
7843
- warnOnce(nextValue.version === "10.0.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.0.1 may not work as expected.`);
7840
+ warnOnce(nextValue.version === "10.1.0-alpha.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.1.0-alpha.0 may not work as expected.`);
7844
7841
  }
7845
7842
  }
7846
7843
  else if (isMotionValue(prevValue)) {
@@ -10647,7 +10644,7 @@
10647
10644
  function useInvertedScale(scale) {
10648
10645
  let parentScaleX = useMotionValue(1);
10649
10646
  let parentScaleY = useMotionValue(1);
10650
- const visualElement = useVisualElementContext();
10647
+ const { visualElement } = React.useContext(MotionContext);
10651
10648
  exports.invariant(!!(scale || visualElement), "If no scale values are provided, useInvertedScale must be used within a child of another motion component.");
10652
10649
  exports.warning(hasWarned, "useInvertedScale is deprecated and will be removed in 3.0. Use the layout prop instead.");
10653
10650
  hasWarned = true;
@@ -10774,7 +10771,6 @@
10774
10771
  exports.useUnmountEffect = useUnmountEffect;
10775
10772
  exports.useVelocity = useVelocity;
10776
10773
  exports.useViewportScroll = useViewportScroll;
10777
- exports.useVisualElementContext = useVisualElementContext;
10778
10774
  exports.useWillChange = useWillChange;
10779
10775
  exports.wrap = wrap;
10780
10776