framer-motion 9.0.1 → 9.0.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/README.md CHANGED
@@ -3,8 +3,20 @@
3
3
  </p>
4
4
  <h1 align="center">Framer Motion</h1>
5
5
  <h3 align="center">
6
- An open source motion library for React, <a href="https://www.framer.com">made by Framer</a>.
6
+ An open source motion library for React, made by Framer. Motion powers Framer, the web builder for creative pros. Design and ship your dream site. Zero code, maximum speed.
7
7
  </h3>
8
+ <br/>
9
+ <p align="center">
10
+ <a href="https://www.framer.com?utm_source=motion">
11
+ <img src="https://framerusercontent.com/images/atXqxn4JhKm4LXVncdNjkKV7yCU.png" width="140" alt="Start for free" />
12
+ </a>
13
+ </p>
14
+ <br/>
15
+ <p align="center">
16
+ <a href="https://www.framer.com?utm_source=motion">
17
+ <img src="https://framerusercontent.com/images/pMSOmGP2V8sSaZRV2D7i4HTBTe4.png" width="1000" alt="Framer Banner" />
18
+ </a>
19
+ </p>
8
20
 
9
21
  <br>
10
22
 
@@ -23,6 +35,8 @@
23
35
  </a>
24
36
  </p>
25
37
 
38
+ <br>
39
+ <hr>
26
40
  <br>
27
41
 
28
42
  Framer Motion is an open source, production-ready library that’s designed for all creative developers.
@@ -85,4 +99,4 @@ export const MyComponent = ({ isVisible }) => (
85
99
 
86
100
  ### ✨ Framer
87
101
 
88
- - Design and publish sites that inspire. [Try Framer for free](https://www.framer.com/).
102
+ - Design and publish sites that inspire. [Try Framer for free](https://www.framer.com/?utm_source=motion-readme).
package/dist/cjs/index.js CHANGED
@@ -344,12 +344,11 @@ function createMotionComponent({ preloadedFeatures, createVisualElement, project
344
344
  * Load Motion gesture and animation features. These are rendered as renderless
345
345
  * components so each feature can optionally make use of React lifecycle methods.
346
346
  */
347
- const lazyStrictMode = React.useContext(LazyContext).strict;
348
347
  const initialLayoutGroupConfig = React.useContext(SwitchLayoutGroupContext);
349
348
  if (context.visualElement) {
350
349
  features = context.visualElement.loadFeatures(
351
350
  // Note: Pass the full new combined props to correctly re-render dynamic feature components.
352
- configAndProps, lazyStrictMode, preloadedFeatures, projectionId, projectionNodeConstructor ||
351
+ configAndProps, React.useContext(LazyContext).strict, preloadedFeatures, projectionId, projectionNodeConstructor ||
353
352
  featureDefinitions.projectionNodeConstructor, initialLayoutGroupConfig);
354
353
  }
355
354
  }
@@ -855,6 +854,7 @@ const validMotionProps = new Set([
855
854
  "onHoverEnd",
856
855
  "onViewportEnter",
857
856
  "onViewportLeave",
857
+ "ignoreStrict",
858
858
  "viewport",
859
859
  ]);
860
860
  /**
@@ -2133,7 +2133,7 @@ class MotionValue {
2133
2133
  * This will be replaced by the build step with the latest version number.
2134
2134
  * When MotionValues are provided to motion components, warn if versions are mixed.
2135
2135
  */
2136
- this.version = "9.0.1";
2136
+ this.version = "9.0.2";
2137
2137
  /**
2138
2138
  * Duration, in milliseconds, since last updating frame.
2139
2139
  *
@@ -5982,7 +5982,7 @@ function updateMotionValuesFromProps(element, next, prev) {
5982
5982
  * and warn against mismatches.
5983
5983
  */
5984
5984
  if (process.env.NODE_ENV === "development") {
5985
- warnOnce(nextValue.version === "9.0.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.1 may not work as expected.`);
5985
+ warnOnce(nextValue.version === "9.0.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.2 may not work as expected.`);
5986
5986
  }
5987
5987
  }
5988
5988
  else if (isMotionValue(prevValue)) {
@@ -6220,7 +6220,10 @@ class VisualElement {
6220
6220
  if (process.env.NODE_ENV !== "production" &&
6221
6221
  preloadedFeatures &&
6222
6222
  isStrict) {
6223
- heyListen.invariant(false, "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.");
6223
+ const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
6224
+ renderedProps.ignoreStrict
6225
+ ? heyListen.warning(false, strictMessage)
6226
+ : heyListen.invariant(false, strictMessage);
6224
6227
  }
6225
6228
  for (let i = 0; i < numFeatures; i++) {
6226
6229
  const name = featureNames[i];
@@ -9084,7 +9087,7 @@ function ReorderGroup({ children, as = "ul", axis = "y", onReorder, values, ...p
9084
9087
  React.useEffect(() => {
9085
9088
  isReordering.current = false;
9086
9089
  });
9087
- return (React__namespace.createElement(Component, { ...props, ref: externalRef },
9090
+ return (React__namespace.createElement(Component, { ...props, ref: externalRef, ignoreStrict: true },
9088
9091
  React__namespace.createElement(ReorderContext.Provider, { value: context }, children)));
9089
9092
  }
9090
9093
  const Group = React.forwardRef(ReorderGroup);
@@ -9221,7 +9224,7 @@ function ReorderItem({ children, style = {}, value, as = "li", onDrag, layout =
9221
9224
  onDrag && onDrag(event, gesturePoint);
9222
9225
  }, onLayoutMeasure: (measured) => {
9223
9226
  measuredLayout.current = measured;
9224
- }, ref: externalRef }, children));
9227
+ }, ref: externalRef, ignoreStrict: true }, children));
9225
9228
  }
9226
9229
  const Item = React.forwardRef(ReorderItem);
9227
9230
 
@@ -38,7 +38,7 @@ function ReorderGroup({ children, as = "ul", axis = "y", onReorder, values, ...p
38
38
  useEffect(() => {
39
39
  isReordering.current = false;
40
40
  });
41
- return (React.createElement(Component, { ...props, ref: externalRef },
41
+ return (React.createElement(Component, { ...props, ref: externalRef, ignoreStrict: true },
42
42
  React.createElement(ReorderContext.Provider, { value: context }, children)));
43
43
  }
44
44
  const Group = forwardRef(ReorderGroup);
@@ -32,7 +32,7 @@ function ReorderItem({ children, style = {}, value, as = "li", onDrag, layout =
32
32
  onDrag && onDrag(event, gesturePoint);
33
33
  }, onLayoutMeasure: (measured) => {
34
34
  measuredLayout.current = measured;
35
- }, ref: externalRef }, children));
35
+ }, ref: externalRef, ignoreStrict: true }, children));
36
36
  }
37
37
  const Item = forwardRef(ReorderItem);
38
38
 
@@ -63,12 +63,11 @@ function createMotionComponent({ preloadedFeatures, createVisualElement, project
63
63
  * Load Motion gesture and animation features. These are rendered as renderless
64
64
  * components so each feature can optionally make use of React lifecycle methods.
65
65
  */
66
- const lazyStrictMode = useContext(LazyContext).strict;
67
66
  const initialLayoutGroupConfig = useContext(SwitchLayoutGroupContext);
68
67
  if (context.visualElement) {
69
68
  features = context.visualElement.loadFeatures(
70
69
  // Note: Pass the full new combined props to correctly re-render dynamic feature components.
71
- configAndProps, lazyStrictMode, preloadedFeatures, projectionId, projectionNodeConstructor ||
70
+ configAndProps, useContext(LazyContext).strict, preloadedFeatures, projectionId, projectionNodeConstructor ||
72
71
  featureDefinitions.projectionNodeConstructor, initialLayoutGroupConfig);
73
72
  }
74
73
  }
@@ -36,6 +36,7 @@ const validMotionProps = new Set([
36
36
  "onHoverEnd",
37
37
  "onViewportEnter",
38
38
  "onViewportLeave",
39
+ "ignoreStrict",
39
40
  "viewport",
40
41
  ]);
41
42
  /**
@@ -1,5 +1,5 @@
1
1
  import { sync, cancelSync } from '../frameloop/index.mjs';
2
- import { invariant } from 'hey-listen';
2
+ import { warning, invariant } from 'hey-listen';
3
3
  import { createElement } from 'react';
4
4
  import { featureDefinitions } from '../motion/features/definitions.mjs';
5
5
  import { createBox } from '../projection/geometry/models.mjs';
@@ -218,7 +218,10 @@ class VisualElement {
218
218
  if (process.env.NODE_ENV !== "production" &&
219
219
  preloadedFeatures &&
220
220
  isStrict) {
221
- invariant(false, "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.");
221
+ const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
222
+ renderedProps.ignoreStrict
223
+ ? warning(false, strictMessage)
224
+ : invariant(false, strictMessage);
222
225
  }
223
226
  for (let i = 0; i < numFeatures; i++) {
224
227
  const name = featureNames[i];
@@ -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.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.1 may not work as expected.`);
25
+ warnOnce(nextValue.version === "9.0.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.2 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.1";
28
+ this.version = "9.0.2";
29
29
  /**
30
30
  * Duration, in milliseconds, since last updating frame.
31
31
  *
@@ -342,12 +342,11 @@
342
342
  * Load Motion gesture and animation features. These are rendered as renderless
343
343
  * components so each feature can optionally make use of React lifecycle methods.
344
344
  */
345
- const lazyStrictMode = React.useContext(LazyContext).strict;
346
345
  const initialLayoutGroupConfig = React.useContext(SwitchLayoutGroupContext);
347
346
  if (context.visualElement) {
348
347
  features = context.visualElement.loadFeatures(
349
348
  // Note: Pass the full new combined props to correctly re-render dynamic feature components.
350
- configAndProps, lazyStrictMode, preloadedFeatures, projectionId, projectionNodeConstructor ||
349
+ configAndProps, React.useContext(LazyContext).strict, preloadedFeatures, projectionId, projectionNodeConstructor ||
351
350
  featureDefinitions.projectionNodeConstructor, initialLayoutGroupConfig);
352
351
  }
353
352
  }
@@ -853,6 +852,7 @@
853
852
  "onHoverEnd",
854
853
  "onViewportEnter",
855
854
  "onViewportLeave",
855
+ "ignoreStrict",
856
856
  "viewport",
857
857
  ]);
858
858
  /**
@@ -2131,7 +2131,7 @@
2131
2131
  * This will be replaced by the build step with the latest version number.
2132
2132
  * When MotionValues are provided to motion components, warn if versions are mixed.
2133
2133
  */
2134
- this.version = "9.0.1";
2134
+ this.version = "9.0.2";
2135
2135
  /**
2136
2136
  * Duration, in milliseconds, since last updating frame.
2137
2137
  *
@@ -5995,7 +5995,7 @@
5995
5995
  * and warn against mismatches.
5996
5996
  */
5997
5997
  {
5998
- warnOnce(nextValue.version === "9.0.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.1 may not work as expected.`);
5998
+ warnOnce(nextValue.version === "9.0.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.2 may not work as expected.`);
5999
5999
  }
6000
6000
  }
6001
6001
  else if (isMotionValue(prevValue)) {
@@ -6232,7 +6232,10 @@
6232
6232
  */
6233
6233
  if (preloadedFeatures &&
6234
6234
  isStrict) {
6235
- invariant(false, "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.");
6235
+ const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
6236
+ renderedProps.ignoreStrict
6237
+ ? warning(false, strictMessage)
6238
+ : invariant(false, strictMessage);
6236
6239
  }
6237
6240
  for (let i = 0; i < numFeatures; i++) {
6238
6241
  const name = featureNames[i];
@@ -9095,7 +9098,7 @@
9095
9098
  React.useEffect(() => {
9096
9099
  isReordering.current = false;
9097
9100
  });
9098
- return (React__namespace.createElement(Component, { ...props, ref: externalRef },
9101
+ return (React__namespace.createElement(Component, { ...props, ref: externalRef, ignoreStrict: true },
9099
9102
  React__namespace.createElement(ReorderContext.Provider, { value: context }, children)));
9100
9103
  }
9101
9104
  const Group = React.forwardRef(ReorderGroup);
@@ -9232,7 +9235,7 @@
9232
9235
  onDrag && onDrag(event, gesturePoint);
9233
9236
  }, onLayoutMeasure: (measured) => {
9234
9237
  measuredLayout.current = measured;
9235
- }, ref: externalRef }, children));
9238
+ }, ref: externalRef, ignoreStrict: true }, children));
9236
9239
  }
9237
9240
  const Item = React.forwardRef(ReorderItem);
9238
9241