framer-motion 6.3.8 → 6.3.9

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
@@ -36,10 +36,10 @@ var sync__default = /*#__PURE__*/_interopDefaultLegacy(sync);
36
36
  /**
37
37
  * Browser-safe usage of process
38
38
  */
39
- var mockProcess = { env: { NODE_ENV: "production" } };
40
- var safeProcess = typeof process === "undefined" ? mockProcess : process;
41
- // eslint-disable-next-line import/no-default-export
42
- var process$1 = safeProcess;
39
+ var defaultEnvironment = "production";
40
+ var env = typeof process === "undefined" || process.env === undefined
41
+ ? defaultEnvironment
42
+ : process.env.NODE_ENV || defaultEnvironment;
43
43
 
44
44
  var createDefinition = function (propNames) { return ({
45
45
  isEnabled: function (props) { return propNames.some(function (name) { return !!props[name]; }); },
@@ -102,9 +102,7 @@ function useFeatures(props, visualElement, preloadedFeatures) {
102
102
  * If we're in development mode, check to make sure we're not rendering a motion component
103
103
  * as a child of LazyMotion, as this will break the file-size benefits of using it.
104
104
  */
105
- if (process$1.env.NODE_ENV !== "production" &&
106
- preloadedFeatures &&
107
- lazyContext.strict) {
105
+ if (env !== "production" && preloadedFeatures && lazyContext.strict) {
108
106
  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.");
109
107
  }
110
108
  for (var i = 0; i < numFeatures; i++) {
@@ -474,7 +472,7 @@ var MotionValue = /** @class */ (function () {
474
472
  * This will be replaced by the build step with the latest version number.
475
473
  * When MotionValues are provided to motion components, warn if versions are mixed.
476
474
  */
477
- this.version = "6.3.8";
475
+ this.version = "6.3.9";
478
476
  /**
479
477
  * Duration, in milliseconds, since last updating frame.
480
478
  *
@@ -4337,7 +4335,7 @@ function useMissingIntersectionObserver(shouldObserve, state, visualElement, _a)
4337
4335
  React.useEffect(function () {
4338
4336
  if (!shouldObserve || !fallback)
4339
4337
  return;
4340
- if (process$1.env.NODE_ENV !== "production") {
4338
+ if (env !== "production") {
4341
4339
  warnOnce(false, "IntersectionObserver not available on this device. whileInView animations will trigger on mount.");
4342
4340
  }
4343
4341
  /**
@@ -5972,7 +5970,7 @@ function updateMotionValuesFromProps(element, next, prev) {
5972
5970
  * and warn against mismatches.
5973
5971
  */
5974
5972
  if (process.env.NODE_ENV === "development") {
5975
- warnOnce(nextValue.version !== "6.3.8", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.8 may not work as expected."));
5973
+ warnOnce(nextValue.version !== "6.3.9", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.9 may not work as expected."));
5976
5974
  }
5977
5975
  }
5978
5976
  else if (isMotionValue(prevValue)) {
@@ -7359,7 +7357,7 @@ var AnimatePresence = function (_a) {
7359
7357
  var key = child.key;
7360
7358
  return exiting.has(key) ? (child) : (React__namespace.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout }, child));
7361
7359
  });
7362
- if (process$1.env.NODE_ENV !== "production" &&
7360
+ if (env !== "production" &&
7363
7361
  exitBeforeEnter &&
7364
7362
  childrenToRender.length > 1) {
7365
7363
  console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.");
@@ -1,7 +1,7 @@
1
1
  import { __read, __spreadArray } from 'tslib';
2
2
  import * as React from 'react';
3
3
  import { useContext, useRef, cloneElement, Children, isValidElement } from 'react';
4
- import process from '../../utils/process.mjs';
4
+ import { env } from '../../utils/process.mjs';
5
5
  import { useForceUpdate } from '../../utils/use-force-update.mjs';
6
6
  import { useIsMounted } from '../../utils/use-is-mounted.mjs';
7
7
  import { PresenceChild } from './PresenceChild.mjs';
@@ -144,7 +144,7 @@ var AnimatePresence = function (_a) {
144
144
  var key = child.key;
145
145
  return exiting.has(key) ? (child) : (React.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout }, child));
146
146
  });
147
- if (process.env.NODE_ENV !== "production" &&
147
+ if (env !== "production" &&
148
148
  exitBeforeEnter &&
149
149
  childrenToRender.length > 1) {
150
150
  console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.");
@@ -1,7 +1,7 @@
1
1
  import { __assign } from 'tslib';
2
2
  import * as React from 'react';
3
3
  import { useContext } from 'react';
4
- import process from '../../utils/process.mjs';
4
+ import { env } from '../../utils/process.mjs';
5
5
  import { featureDefinitions } from './definitions.mjs';
6
6
  import { invariant } from 'hey-listen';
7
7
  import { LazyContext } from '../../context/LazyContext.mjs';
@@ -20,9 +20,7 @@ function useFeatures(props, visualElement, preloadedFeatures) {
20
20
  * If we're in development mode, check to make sure we're not rendering a motion component
21
21
  * as a child of LazyMotion, as this will break the file-size benefits of using it.
22
22
  */
23
- if (process.env.NODE_ENV !== "production" &&
24
- preloadedFeatures &&
25
- lazyContext.strict) {
23
+ if (env !== "production" && preloadedFeatures && lazyContext.strict) {
26
24
  invariant(false, "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.");
27
25
  }
28
26
  for (var i = 0; i < numFeatures; i++) {
@@ -1,4 +1,4 @@
1
- import process from '../../../utils/process.mjs';
1
+ import { env } from '../../../utils/process.mjs';
2
2
  import { useRef, useEffect } from 'react';
3
3
  import { AnimationType } from '../../../render/utils/types.mjs';
4
4
  import { warnOnce } from '../../../utils/warn-once.mjs';
@@ -75,7 +75,7 @@ function useMissingIntersectionObserver(shouldObserve, state, visualElement, _a)
75
75
  useEffect(function () {
76
76
  if (!shouldObserve || !fallback)
77
77
  return;
78
- if (process.env.NODE_ENV !== "production") {
78
+ if (env !== "production") {
79
79
  warnOnce(false, "IntersectionObserver not available on this device. whileInView animations will trigger on mount.");
80
80
  }
81
81
  /**
@@ -18,7 +18,7 @@ function updateMotionValuesFromProps(element, next, prev) {
18
18
  * and warn against mismatches.
19
19
  */
20
20
  if (process.env.NODE_ENV === "development") {
21
- warnOnce(nextValue.version !== "6.3.8", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.8 may not work as expected."));
21
+ warnOnce(nextValue.version !== "6.3.9", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.9 may not work as expected."));
22
22
  }
23
23
  }
24
24
  else if (isMotionValue(prevValue)) {
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Browser-safe usage of process
3
3
  */
4
- var mockProcess = { env: { NODE_ENV: "production" } };
5
- var safeProcess = typeof process === "undefined" ? mockProcess : process;
6
- // eslint-disable-next-line import/no-default-export
7
- var process$1 = safeProcess;
4
+ var defaultEnvironment = "production";
5
+ var env = typeof process === "undefined" || process.env === undefined
6
+ ? defaultEnvironment
7
+ : process.env.NODE_ENV || defaultEnvironment;
8
8
 
9
- export { process$1 as default };
9
+ export { env };
@@ -25,7 +25,7 @@ var MotionValue = /** @class */ (function () {
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 = "6.3.8";
28
+ this.version = "6.3.9";
29
29
  /**
30
30
  * Duration, in milliseconds, since last updating frame.
31
31
  *
@@ -120,6 +120,14 @@
120
120
  return to.concat(ar || Array.prototype.slice.call(from));
121
121
  }
122
122
 
123
+ /**
124
+ * Browser-safe usage of process
125
+ */
126
+ var defaultEnvironment = "production";
127
+ var env = typeof process === "undefined" || process.env === undefined
128
+ ? defaultEnvironment
129
+ : "development" ;
130
+
123
131
  var createDefinition = function (propNames) { return ({
124
132
  isEnabled: function (props) { return propNames.some(function (name) { return !!props[name]; }); },
125
133
  }); };
@@ -196,8 +204,7 @@
196
204
  * If we're in development mode, check to make sure we're not rendering a motion component
197
205
  * as a child of LazyMotion, as this will break the file-size benefits of using it.
198
206
  */
199
- if (preloadedFeatures &&
200
- lazyContext.strict) {
207
+ if (env !== "production" && preloadedFeatures && lazyContext.strict) {
201
208
  invariant(false, "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.");
202
209
  }
203
210
  for (var i = 0; i < numFeatures; i++) {
@@ -1699,7 +1706,7 @@
1699
1706
  * This will be replaced by the build step with the latest version number.
1700
1707
  * When MotionValues are provided to motion components, warn if versions are mixed.
1701
1708
  */
1702
- this.version = "6.3.8";
1709
+ this.version = "6.3.9";
1703
1710
  /**
1704
1711
  * Duration, in milliseconds, since last updating frame.
1705
1712
  *
@@ -5562,7 +5569,7 @@
5562
5569
  React.useEffect(function () {
5563
5570
  if (!shouldObserve || !fallback)
5564
5571
  return;
5565
- {
5572
+ if (env !== "production") {
5566
5573
  warnOnce(false, "IntersectionObserver not available on this device. whileInView animations will trigger on mount.");
5567
5574
  }
5568
5575
  /**
@@ -7197,7 +7204,7 @@
7197
7204
  * and warn against mismatches.
7198
7205
  */
7199
7206
  {
7200
- warnOnce(nextValue.version !== "6.3.8", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.8 may not work as expected."));
7207
+ warnOnce(nextValue.version !== "6.3.9", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.9 may not work as expected."));
7201
7208
  }
7202
7209
  }
7203
7210
  else if (isMotionValue(prevValue)) {
@@ -8584,7 +8591,8 @@
8584
8591
  var key = child.key;
8585
8592
  return exiting.has(key) ? (child) : (React__namespace.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout }, child));
8586
8593
  });
8587
- if (exitBeforeEnter &&
8594
+ if (env !== "production" &&
8595
+ exitBeforeEnter &&
8588
8596
  childrenToRender.length > 1) {
8589
8597
  console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.");
8590
8598
  }