framer-motion 6.3.7-beta.0 → 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 +19 -9
- package/dist/es/components/AnimatePresence/index.mjs +2 -2
- package/dist/es/motion/features/use-features.mjs +2 -4
- package/dist/es/motion/features/viewport/use-viewport.mjs +2 -2
- package/dist/es/render/utils/motion-values.mjs +8 -0
- package/dist/es/utils/process.mjs +5 -5
- package/dist/es/value/index.mjs +5 -0
- package/dist/framer-motion.dev.js +24 -4
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +22 -0
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/dist/size-webpack-dom-animation.js +1 -1
- package/dist/size-webpack-dom-max.js +1 -1
- package/dist/size-webpack-m.js +1 -1
- package/package.json +11 -8
- package/types/utils/process.d.ts +1 -7
- package/types/value/index.d.ts +5 -0
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
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
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 (
|
|
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++) {
|
|
@@ -470,6 +468,11 @@ var MotionValue = /** @class */ (function () {
|
|
|
470
468
|
*/
|
|
471
469
|
function MotionValue(init) {
|
|
472
470
|
var _this = this;
|
|
471
|
+
/**
|
|
472
|
+
* This will be replaced by the build step with the latest version number.
|
|
473
|
+
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
474
|
+
*/
|
|
475
|
+
this.version = "6.3.9";
|
|
473
476
|
/**
|
|
474
477
|
* Duration, in milliseconds, since last updating frame.
|
|
475
478
|
*
|
|
@@ -4332,7 +4335,7 @@ function useMissingIntersectionObserver(shouldObserve, state, visualElement, _a)
|
|
|
4332
4335
|
React.useEffect(function () {
|
|
4333
4336
|
if (!shouldObserve || !fallback)
|
|
4334
4337
|
return;
|
|
4335
|
-
if (
|
|
4338
|
+
if (env !== "production") {
|
|
4336
4339
|
warnOnce(false, "IntersectionObserver not available on this device. whileInView animations will trigger on mount.");
|
|
4337
4340
|
}
|
|
4338
4341
|
/**
|
|
@@ -5962,6 +5965,13 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
5962
5965
|
* to our visual element's motion value map.
|
|
5963
5966
|
*/
|
|
5964
5967
|
element.addValue(key, nextValue);
|
|
5968
|
+
/**
|
|
5969
|
+
* Check the version of the incoming motion value with this version
|
|
5970
|
+
* and warn against mismatches.
|
|
5971
|
+
*/
|
|
5972
|
+
if (process.env.NODE_ENV === "development") {
|
|
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."));
|
|
5974
|
+
}
|
|
5965
5975
|
}
|
|
5966
5976
|
else if (isMotionValue(prevValue)) {
|
|
5967
5977
|
/**
|
|
@@ -7347,7 +7357,7 @@ var AnimatePresence = function (_a) {
|
|
|
7347
7357
|
var key = child.key;
|
|
7348
7358
|
return exiting.has(key) ? (child) : (React__namespace.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout }, child));
|
|
7349
7359
|
});
|
|
7350
|
-
if (
|
|
7360
|
+
if (env !== "production" &&
|
|
7351
7361
|
exitBeforeEnter &&
|
|
7352
7362
|
childrenToRender.length > 1) {
|
|
7353
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
|
|
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 (
|
|
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
|
|
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 (
|
|
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
|
|
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 (
|
|
78
|
+
if (env !== "production") {
|
|
79
79
|
warnOnce(false, "IntersectionObserver not available on this device. whileInView animations will trigger on mount.");
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { warnOnce } from '../../utils/warn-once.mjs';
|
|
1
2
|
import { motionValue } from '../../value/index.mjs';
|
|
2
3
|
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
3
4
|
|
|
@@ -12,6 +13,13 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
12
13
|
* to our visual element's motion value map.
|
|
13
14
|
*/
|
|
14
15
|
element.addValue(key, nextValue);
|
|
16
|
+
/**
|
|
17
|
+
* Check the version of the incoming motion value with this version
|
|
18
|
+
* and warn against mismatches.
|
|
19
|
+
*/
|
|
20
|
+
if (process.env.NODE_ENV === "development") {
|
|
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
|
+
}
|
|
15
23
|
}
|
|
16
24
|
else if (isMotionValue(prevValue)) {
|
|
17
25
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Browser-safe usage of process
|
|
3
3
|
*/
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
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 {
|
|
9
|
+
export { env };
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -21,6 +21,11 @@ var MotionValue = /** @class */ (function () {
|
|
|
21
21
|
*/
|
|
22
22
|
function MotionValue(init) {
|
|
23
23
|
var _this = this;
|
|
24
|
+
/**
|
|
25
|
+
* This will be replaced by the build step with the latest version number.
|
|
26
|
+
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
27
|
+
*/
|
|
28
|
+
this.version = "6.3.9";
|
|
24
29
|
/**
|
|
25
30
|
* Duration, in milliseconds, since last updating frame.
|
|
26
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++) {
|
|
@@ -1695,6 +1702,11 @@
|
|
|
1695
1702
|
*/
|
|
1696
1703
|
function MotionValue(init) {
|
|
1697
1704
|
var _this = this;
|
|
1705
|
+
/**
|
|
1706
|
+
* This will be replaced by the build step with the latest version number.
|
|
1707
|
+
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
1708
|
+
*/
|
|
1709
|
+
this.version = "6.3.9";
|
|
1698
1710
|
/**
|
|
1699
1711
|
* Duration, in milliseconds, since last updating frame.
|
|
1700
1712
|
*
|
|
@@ -5557,7 +5569,7 @@
|
|
|
5557
5569
|
React.useEffect(function () {
|
|
5558
5570
|
if (!shouldObserve || !fallback)
|
|
5559
5571
|
return;
|
|
5560
|
-
{
|
|
5572
|
+
if (env !== "production") {
|
|
5561
5573
|
warnOnce(false, "IntersectionObserver not available on this device. whileInView animations will trigger on mount.");
|
|
5562
5574
|
}
|
|
5563
5575
|
/**
|
|
@@ -7187,6 +7199,13 @@
|
|
|
7187
7199
|
* to our visual element's motion value map.
|
|
7188
7200
|
*/
|
|
7189
7201
|
element.addValue(key, nextValue);
|
|
7202
|
+
/**
|
|
7203
|
+
* Check the version of the incoming motion value with this version
|
|
7204
|
+
* and warn against mismatches.
|
|
7205
|
+
*/
|
|
7206
|
+
{
|
|
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."));
|
|
7208
|
+
}
|
|
7190
7209
|
}
|
|
7191
7210
|
else if (isMotionValue(prevValue)) {
|
|
7192
7211
|
/**
|
|
@@ -8572,7 +8591,8 @@
|
|
|
8572
8591
|
var key = child.key;
|
|
8573
8592
|
return exiting.has(key) ? (child) : (React__namespace.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout }, child));
|
|
8574
8593
|
});
|
|
8575
|
-
if (
|
|
8594
|
+
if (env !== "production" &&
|
|
8595
|
+
exitBeforeEnter &&
|
|
8576
8596
|
childrenToRender.length > 1) {
|
|
8577
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.");
|
|
8578
8598
|
}
|