framer-motion 7.3.0 → 7.3.3

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
@@ -286,6 +286,8 @@ class VisualElementHandler extends React__default["default"].Component {
286
286
  */
287
287
  const SwitchLayoutGroupContext = React.createContext({});
288
288
 
289
+ const motionComponentSymbol = Symbol.for("motionComponentSymbol");
290
+
289
291
  /**
290
292
  * Create a `motion` component.
291
293
  *
@@ -337,7 +339,9 @@ function createMotionComponent({ preloadedFeatures, createVisualElement, project
337
339
  const lazyStrictMode = React.useContext(LazyContext).strict;
338
340
  const initialLayoutGroupConfig = React.useContext(SwitchLayoutGroupContext);
339
341
  if (context.visualElement) {
340
- features = context.visualElement.loadFeatures(props, lazyStrictMode, preloadedFeatures, projectionId, projectionNodeConstructor ||
342
+ features = context.visualElement.loadFeatures(
343
+ // Note: Pass the full new combined props to correctly re-render dynamic feature components.
344
+ configAndProps, lazyStrictMode, preloadedFeatures, projectionId, projectionNodeConstructor ||
341
345
  featureDefinitions.projectionNodeConstructor, initialLayoutGroupConfig);
342
346
  }
343
347
  }
@@ -349,7 +353,9 @@ function createMotionComponent({ preloadedFeatures, createVisualElement, project
349
353
  features,
350
354
  React__namespace.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement))));
351
355
  }
352
- return React.forwardRef(MotionComponent);
356
+ const ForwardRefComponent = React.forwardRef(MotionComponent);
357
+ ForwardRefComponent[motionComponentSymbol] = Component;
358
+ return ForwardRefComponent;
353
359
  }
354
360
  function useLayoutId({ layoutId }) {
355
361
  const layoutGroupId = React.useContext(LayoutGroupContext).id;
@@ -483,6 +489,7 @@ const transformPropOrder = [
483
489
  "rotate",
484
490
  "rotateX",
485
491
  "rotateY",
492
+ "rotateZ",
486
493
  "skew",
487
494
  "skewX",
488
495
  "skewY",
@@ -2235,7 +2242,7 @@ class MotionValue {
2235
2242
  * This will be replaced by the build step with the latest version number.
2236
2243
  * When MotionValues are provided to motion components, warn if versions are mixed.
2237
2244
  */
2238
- this.version = "7.3.0";
2245
+ this.version = "7.3.3";
2239
2246
  /**
2240
2247
  * Duration, in milliseconds, since last updating frame.
2241
2248
  *
@@ -4211,7 +4218,7 @@ function updateMotionValuesFromProps(element, next, prev) {
4211
4218
  * and warn against mismatches.
4212
4219
  */
4213
4220
  if (process.env.NODE_ENV === "development") {
4214
- warnOnce(nextValue.version === "7.3.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.3.0 may not work as expected.`);
4221
+ warnOnce(nextValue.version === "7.3.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.3.3 may not work as expected.`);
4215
4222
  }
4216
4223
  }
4217
4224
  else if (isMotionValue(prevValue)) {
@@ -8198,6 +8205,28 @@ function useDragControls() {
8198
8205
  return useConstant(createDragControls);
8199
8206
  }
8200
8207
 
8208
+ /**
8209
+ * Checks if a component is a `motion` component.
8210
+ */
8211
+ function isMotionComponent(component) {
8212
+ return (component !== null &&
8213
+ typeof component === "object" &&
8214
+ motionComponentSymbol in component);
8215
+ }
8216
+
8217
+ /**
8218
+ * Unwraps a `motion` component and returns either a string for `motion.div` or
8219
+ * the React component for `motion(Component)`.
8220
+ *
8221
+ * If the component is not a `motion` component it returns undefined.
8222
+ */
8223
+ function unwrapMotionComponent(component) {
8224
+ if (isMotionComponent(component)) {
8225
+ return component[motionComponentSymbol];
8226
+ }
8227
+ return undefined;
8228
+ }
8229
+
8201
8230
  function useInstantLayoutTransition() {
8202
8231
  return startTransition;
8203
8232
  }
@@ -8360,6 +8389,7 @@ exports.domMax = domMax;
8360
8389
  exports.filterProps = filterProps;
8361
8390
  exports.isBrowser = isBrowser;
8362
8391
  exports.isDragActive = isDragActive;
8392
+ exports.isMotionComponent = isMotionComponent;
8363
8393
  exports.isMotionValue = isMotionValue;
8364
8394
  exports.isValidMotionProp = isValidMotionProp;
8365
8395
  exports.m = m;
@@ -8368,6 +8398,7 @@ exports.motion = motion;
8368
8398
  exports.motionValue = motionValue;
8369
8399
  exports.resolveMotionValue = resolveMotionValue;
8370
8400
  exports.transform = transform;
8401
+ exports.unwrapMotionComponent = unwrapMotionComponent;
8371
8402
  exports.useAnimation = useAnimation;
8372
8403
  exports.useAnimationControls = useAnimationControls;
8373
8404
  exports.useAnimationFrame = useAnimationFrame;
package/dist/es/index.mjs CHANGED
@@ -35,6 +35,8 @@ export { useInView } from './utils/use-in-view.mjs';
35
35
  export { DragControls, useDragControls } from './gestures/drag/use-drag-controls.mjs';
36
36
  export { useDomEvent } from './events/use-dom-event.mjs';
37
37
  export { createMotionComponent } from './motion/index.mjs';
38
+ export { isMotionComponent } from './motion/utils/is-motion-component.mjs';
39
+ export { unwrapMotionComponent } from './motion/utils/unwrap-motion-component.mjs';
38
40
  export { visualElement } from './render/index.mjs';
39
41
  export { addScaleCorrector } from './projection/styles/scale-correction.mjs';
40
42
  export { useInstantTransition } from './utils/use-instant-transition.mjs';
@@ -13,6 +13,7 @@ import { LayoutGroupContext } from '../context/LayoutGroupContext.mjs';
13
13
  import { VisualElementHandler } from './utils/VisualElementHandler.mjs';
14
14
  import { LazyContext } from '../context/LazyContext.mjs';
15
15
  import { SwitchLayoutGroupContext } from '../context/SwitchLayoutGroupContext.mjs';
16
+ import { motionComponentSymbol } from './utils/symbol.mjs';
16
17
 
17
18
  /**
18
19
  * Create a `motion` component.
@@ -65,7 +66,9 @@ function createMotionComponent({ preloadedFeatures, createVisualElement, project
65
66
  const lazyStrictMode = useContext(LazyContext).strict;
66
67
  const initialLayoutGroupConfig = useContext(SwitchLayoutGroupContext);
67
68
  if (context.visualElement) {
68
- features = context.visualElement.loadFeatures(props, lazyStrictMode, preloadedFeatures, projectionId, projectionNodeConstructor ||
69
+ features = context.visualElement.loadFeatures(
70
+ // Note: Pass the full new combined props to correctly re-render dynamic feature components.
71
+ configAndProps, lazyStrictMode, preloadedFeatures, projectionId, projectionNodeConstructor ||
69
72
  featureDefinitions.projectionNodeConstructor, initialLayoutGroupConfig);
70
73
  }
71
74
  }
@@ -77,7 +80,9 @@ function createMotionComponent({ preloadedFeatures, createVisualElement, project
77
80
  features,
78
81
  React.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement))));
79
82
  }
80
- return forwardRef(MotionComponent);
83
+ const ForwardRefComponent = forwardRef(MotionComponent);
84
+ ForwardRefComponent[motionComponentSymbol] = Component;
85
+ return ForwardRefComponent;
81
86
  }
82
87
  function useLayoutId({ layoutId }) {
83
88
  const layoutGroupId = useContext(LayoutGroupContext).id;
@@ -0,0 +1,12 @@
1
+ import { motionComponentSymbol } from './symbol.mjs';
2
+
3
+ /**
4
+ * Checks if a component is a `motion` component.
5
+ */
6
+ function isMotionComponent(component) {
7
+ return (component !== null &&
8
+ typeof component === "object" &&
9
+ motionComponentSymbol in component);
10
+ }
11
+
12
+ export { isMotionComponent };
@@ -0,0 +1,3 @@
1
+ const motionComponentSymbol = Symbol.for("motionComponentSymbol");
2
+
3
+ export { motionComponentSymbol };
@@ -0,0 +1,17 @@
1
+ import { isMotionComponent } from './is-motion-component.mjs';
2
+ import { motionComponentSymbol } from './symbol.mjs';
3
+
4
+ /**
5
+ * Unwraps a `motion` component and returns either a string for `motion.div` or
6
+ * the React component for `motion(Component)`.
7
+ *
8
+ * If the component is not a `motion` component it returns undefined.
9
+ */
10
+ function unwrapMotionComponent(component) {
11
+ if (isMotionComponent(component)) {
12
+ return component[motionComponentSymbol];
13
+ }
14
+ return undefined;
15
+ }
16
+
17
+ export { unwrapMotionComponent };
@@ -15,6 +15,7 @@ const transformPropOrder = [
15
15
  "rotate",
16
16
  "rotateX",
17
17
  "rotateY",
18
+ "rotateZ",
18
19
  "skew",
19
20
  "skewX",
20
21
  "skewY",
@@ -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.3.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.3.0 may not work as expected.`);
25
+ warnOnce(nextValue.version === "7.3.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.3.3 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.3.0";
27
+ this.version = "7.3.3";
28
28
  /**
29
29
  * Duration, in milliseconds, since last updating frame.
30
30
  *
@@ -280,6 +280,8 @@
280
280
  */
281
281
  const SwitchLayoutGroupContext = React.createContext({});
282
282
 
283
+ const motionComponentSymbol = Symbol.for("motionComponentSymbol");
284
+
283
285
  /**
284
286
  * Create a `motion` component.
285
287
  *
@@ -331,7 +333,9 @@
331
333
  const lazyStrictMode = React.useContext(LazyContext).strict;
332
334
  const initialLayoutGroupConfig = React.useContext(SwitchLayoutGroupContext);
333
335
  if (context.visualElement) {
334
- features = context.visualElement.loadFeatures(props, lazyStrictMode, preloadedFeatures, projectionId, projectionNodeConstructor ||
336
+ features = context.visualElement.loadFeatures(
337
+ // Note: Pass the full new combined props to correctly re-render dynamic feature components.
338
+ configAndProps, lazyStrictMode, preloadedFeatures, projectionId, projectionNodeConstructor ||
335
339
  featureDefinitions.projectionNodeConstructor, initialLayoutGroupConfig);
336
340
  }
337
341
  }
@@ -343,7 +347,9 @@
343
347
  features,
344
348
  React__namespace.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement))));
345
349
  }
346
- return React.forwardRef(MotionComponent);
350
+ const ForwardRefComponent = React.forwardRef(MotionComponent);
351
+ ForwardRefComponent[motionComponentSymbol] = Component;
352
+ return ForwardRefComponent;
347
353
  }
348
354
  function useLayoutId({ layoutId }) {
349
355
  const layoutGroupId = React.useContext(LayoutGroupContext).id;
@@ -477,6 +483,7 @@
477
483
  "rotate",
478
484
  "rotateX",
479
485
  "rotateY",
486
+ "rotateZ",
480
487
  "skew",
481
488
  "skewX",
482
489
  "skewY",
@@ -3403,7 +3410,7 @@
3403
3410
  * This will be replaced by the build step with the latest version number.
3404
3411
  * When MotionValues are provided to motion components, warn if versions are mixed.
3405
3412
  */
3406
- this.version = "7.3.0";
3413
+ this.version = "7.3.3";
3407
3414
  /**
3408
3415
  * Duration, in milliseconds, since last updating frame.
3409
3416
  *
@@ -5379,7 +5386,7 @@
5379
5386
  * and warn against mismatches.
5380
5387
  */
5381
5388
  {
5382
- warnOnce(nextValue.version === "7.3.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.3.0 may not work as expected.`);
5389
+ warnOnce(nextValue.version === "7.3.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.3.3 may not work as expected.`);
5383
5390
  }
5384
5391
  }
5385
5392
  else if (isMotionValue(prevValue)) {
@@ -9947,6 +9954,28 @@
9947
9954
  return useConstant(createDragControls);
9948
9955
  }
9949
9956
 
9957
+ /**
9958
+ * Checks if a component is a `motion` component.
9959
+ */
9960
+ function isMotionComponent(component) {
9961
+ return (component !== null &&
9962
+ typeof component === "object" &&
9963
+ motionComponentSymbol in component);
9964
+ }
9965
+
9966
+ /**
9967
+ * Unwraps a `motion` component and returns either a string for `motion.div` or
9968
+ * the React component for `motion(Component)`.
9969
+ *
9970
+ * If the component is not a `motion` component it returns undefined.
9971
+ */
9972
+ function unwrapMotionComponent(component) {
9973
+ if (isMotionComponent(component)) {
9974
+ return component[motionComponentSymbol];
9975
+ }
9976
+ return undefined;
9977
+ }
9978
+
9950
9979
  function useInstantLayoutTransition() {
9951
9980
  return startTransition;
9952
9981
  }
@@ -10109,6 +10138,7 @@
10109
10138
  exports.filterProps = filterProps;
10110
10139
  exports.isBrowser = isBrowser;
10111
10140
  exports.isDragActive = isDragActive;
10141
+ exports.isMotionComponent = isMotionComponent;
10112
10142
  exports.isMotionValue = isMotionValue;
10113
10143
  exports.isValidMotionProp = isValidMotionProp;
10114
10144
  exports.m = m;
@@ -10117,6 +10147,7 @@
10117
10147
  exports.motionValue = motionValue;
10118
10148
  exports.resolveMotionValue = resolveMotionValue;
10119
10149
  exports.transform = transform;
10150
+ exports.unwrapMotionComponent = unwrapMotionComponent;
10120
10151
  exports.useAnimation = useAnimation;
10121
10152
  exports.useAnimationControls = useAnimationControls;
10122
10153
  exports.useAnimationFrame = useAnimationFrame;