framer-motion 6.2.7 → 6.2.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
@@ -33,6 +33,14 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
33
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
34
34
  var sync__default = /*#__PURE__*/_interopDefaultLegacy(sync);
35
35
 
36
+ /**
37
+ * Browser-safe usage of process
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;
43
+
36
44
  var createDefinition = function (propNames) { return ({
37
45
  isEnabled: function (props) { return propNames.some(function (name) { return !!props[name]; }); },
38
46
  }); };
@@ -94,7 +102,7 @@ function useFeatures(props, visualElement, preloadedFeatures) {
94
102
  * If we're in development mode, check to make sure we're not rendering a motion component
95
103
  * as a child of LazyMotion, as this will break the file-size benefits of using it.
96
104
  */
97
- if (process.env.NODE_ENV !== "production" &&
105
+ if (process$1.env.NODE_ENV !== "production" &&
98
106
  preloadedFeatures &&
99
107
  lazyContext.strict) {
100
108
  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.");
@@ -4316,7 +4324,7 @@ function useMissingIntersectionObserver(shouldObserve, state, visualElement, _a)
4316
4324
  React.useEffect(function () {
4317
4325
  if (!shouldObserve || !fallback)
4318
4326
  return;
4319
- if (process.env.NODE_ENV !== "production") {
4327
+ if (process$1.env.NODE_ENV !== "production") {
4320
4328
  warnOnce(false, "IntersectionObserver not available on this device. whileInView animations will trigger on mount.");
4321
4329
  }
4322
4330
  /**
@@ -5014,7 +5022,11 @@ function createAnimationState(visualElement) {
5014
5022
  // Propagate active change to children
5015
5023
  (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
5016
5024
  state[type].isActive = isActive;
5017
- return animateChanges(options, type);
5025
+ var animations = animateChanges(options, type);
5026
+ for (var key in state) {
5027
+ state[key].protectedKeys = {};
5028
+ }
5029
+ return animations;
5018
5030
  }
5019
5031
  return {
5020
5032
  isAnimated: isAnimated,
@@ -7189,7 +7201,7 @@ function newChildrenMap() {
7189
7201
  }
7190
7202
 
7191
7203
  var getChildKey = function (child) { return child.key || ""; };
7192
- var isDev = process.env.NODE_ENV !== "production";
7204
+ var isDev = process$1.env.NODE_ENV !== "production";
7193
7205
  function updateChildLookup(children, allChildren) {
7194
7206
  var seenChildren = isDev ? new Set() : null;
7195
7207
  children.forEach(function (child) {
@@ -7329,7 +7341,7 @@ var AnimatePresence = function (_a) {
7329
7341
  var key = child.key;
7330
7342
  return exiting.has(key) ? (child) : (React__namespace.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout }, child));
7331
7343
  });
7332
- if (process.env.NODE_ENV !== "production" &&
7344
+ if (process$1.env.NODE_ENV !== "production" &&
7333
7345
  exitBeforeEnter &&
7334
7346
  childrenToRender.length > 1) {
7335
7347
  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,6 +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
5
  import { useForceUpdate } from '../../utils/use-force-update.mjs';
5
6
  import { useIsMounted } from '../../utils/use-is-mounted.mjs';
6
7
  import { PresenceChild } from './PresenceChild.mjs';
@@ -1,6 +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
5
  import { featureDefinitions } from './definitions.mjs';
5
6
  import { invariant } from 'hey-listen';
6
7
  import { LazyContext } from '../../context/LazyContext.mjs';
@@ -1,3 +1,4 @@
1
+ import process from '../../../utils/process.mjs';
1
2
  import { useRef, useEffect } from 'react';
2
3
  import { AnimationType } from '../../../render/utils/types.mjs';
3
4
  import { warnOnce } from '../../../utils/warn-once.mjs';
@@ -294,7 +294,11 @@ function createAnimationState(visualElement) {
294
294
  // Propagate active change to children
295
295
  (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
296
296
  state[type].isActive = isActive;
297
- return animateChanges(options, type);
297
+ var animations = animateChanges(options, type);
298
+ for (var key in state) {
299
+ state[key].protectedKeys = {};
300
+ }
301
+ return animations;
298
302
  }
299
303
  return {
300
304
  isAnimated: isAnimated,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Browser-safe usage of process
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;
8
+
9
+ export { process$1 as default };
@@ -6247,7 +6247,11 @@
6247
6247
  // Propagate active change to children
6248
6248
  (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
6249
6249
  state[type].isActive = isActive;
6250
- return animateChanges(options, type);
6250
+ var animations = animateChanges(options, type);
6251
+ for (var key in state) {
6252
+ state[key].protectedKeys = {};
6253
+ }
6254
+ return animations;
6251
6255
  }
6252
6256
  return {
6253
6257
  isAnimated: isAnimated,