framer-motion 6.2.5 → 6.2.8
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 +25 -8
- package/dist/es/components/LayoutGroup/index.mjs +10 -3
- package/dist/es/render/utils/animation-state.mjs +5 -1
- package/dist/es/utils/use-id.mjs +9 -4
- package/dist/es/utils/use-is-mounted.mjs +3 -2
- package/dist/framer-motion.dev.js +25 -8
- package/dist/framer-motion.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-webpack-dom-animation.js +1 -1
- package/dist/size-webpack-dom-max.js +1 -1
- package/package.json +3 -3
- package/types/components/LayoutGroup/index.d.ts +6 -0
- package/types/utils/use-id.d.ts +6 -1
package/dist/cjs/index.js
CHANGED
|
@@ -4351,9 +4351,15 @@ var gestureAnimations = {
|
|
|
4351
4351
|
|
|
4352
4352
|
var counter = 0;
|
|
4353
4353
|
var incrementId = function () { return counter++; };
|
|
4354
|
-
var useId =
|
|
4355
|
-
|
|
4356
|
-
|
|
4354
|
+
var useId = function () { return useConstant(incrementId); };
|
|
4355
|
+
/**
|
|
4356
|
+
* Ideally we'd use the following code to support React 18 optionally.
|
|
4357
|
+
* But this fairly fails in Webpack (otherwise treeshaking wouldn't work at all).
|
|
4358
|
+
* Need to come up with a different way of figuring this out.
|
|
4359
|
+
*/
|
|
4360
|
+
// export const useId = (React as any).useId
|
|
4361
|
+
// ? (React as any).useId
|
|
4362
|
+
// : () => useConstant(incrementId)
|
|
4357
4363
|
|
|
4358
4364
|
/**
|
|
4359
4365
|
* When a component is the child of `AnimatePresence`, it can use `usePresence`
|
|
@@ -5008,7 +5014,11 @@ function createAnimationState(visualElement) {
|
|
|
5008
5014
|
// Propagate active change to children
|
|
5009
5015
|
(_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); });
|
|
5010
5016
|
state[type].isActive = isActive;
|
|
5011
|
-
|
|
5017
|
+
var animations = animateChanges(options, type);
|
|
5018
|
+
for (var key in state) {
|
|
5019
|
+
state[key].protectedKeys = {};
|
|
5020
|
+
}
|
|
5021
|
+
return animations;
|
|
5012
5022
|
}
|
|
5013
5023
|
return {
|
|
5014
5024
|
isAnimated: isAnimated,
|
|
@@ -7104,7 +7114,7 @@ var m = createMotionProxy(createDomMotionConfig);
|
|
|
7104
7114
|
|
|
7105
7115
|
function useIsMounted() {
|
|
7106
7116
|
var isMounted = React.useRef(false);
|
|
7107
|
-
|
|
7117
|
+
useIsomorphicLayoutEffect(function () {
|
|
7108
7118
|
isMounted.current = true;
|
|
7109
7119
|
return function () {
|
|
7110
7120
|
isMounted.current = false;
|
|
@@ -7362,21 +7372,28 @@ function nodeGroup() {
|
|
|
7362
7372
|
};
|
|
7363
7373
|
}
|
|
7364
7374
|
|
|
7375
|
+
var shouldInheritGroup = function (inherit) { return inherit === true; };
|
|
7376
|
+
var shouldInheritId = function (inherit) {
|
|
7377
|
+
return shouldInheritGroup(inherit === true) || inherit === "id";
|
|
7378
|
+
};
|
|
7365
7379
|
var LayoutGroup = function (_a) {
|
|
7366
7380
|
var _b, _c;
|
|
7367
|
-
var children = _a.children, id = _a.id,
|
|
7381
|
+
var children = _a.children, id = _a.id, inheritId = _a.inheritId, _d = _a.inherit, inherit = _d === void 0 ? true : _d;
|
|
7382
|
+
// Maintain backwards-compatibility with inheritId until 7.0
|
|
7383
|
+
if (inheritId !== undefined)
|
|
7384
|
+
inherit = inheritId;
|
|
7368
7385
|
var layoutGroupContext = React.useContext(LayoutGroupContext);
|
|
7369
7386
|
var deprecatedLayoutGroupContext = React.useContext(DeprecatedLayoutGroupContext);
|
|
7370
7387
|
var _e = tslib.__read(useForceUpdate(), 2), forceRender = _e[0], key = _e[1];
|
|
7371
7388
|
var context = React.useRef(null);
|
|
7372
7389
|
var upstreamId = (_b = layoutGroupContext.id) !== null && _b !== void 0 ? _b : deprecatedLayoutGroupContext;
|
|
7373
7390
|
if (context.current === null) {
|
|
7374
|
-
if (
|
|
7391
|
+
if (shouldInheritId(inherit) && upstreamId) {
|
|
7375
7392
|
id = id ? upstreamId + "-" + id : upstreamId;
|
|
7376
7393
|
}
|
|
7377
7394
|
context.current = {
|
|
7378
7395
|
id: id,
|
|
7379
|
-
group:
|
|
7396
|
+
group: shouldInheritGroup(inherit)
|
|
7380
7397
|
? (_c = layoutGroupContext === null || layoutGroupContext === void 0 ? void 0 : layoutGroupContext.group) !== null && _c !== void 0 ? _c : nodeGroup()
|
|
7381
7398
|
: nodeGroup(),
|
|
7382
7399
|
};
|
|
@@ -6,21 +6,28 @@ import { DeprecatedLayoutGroupContext } from '../../context/DeprecatedLayoutGrou
|
|
|
6
6
|
import { useForceUpdate } from '../../utils/use-force-update.mjs';
|
|
7
7
|
import { nodeGroup } from '../../projection/node/group.mjs';
|
|
8
8
|
|
|
9
|
+
var shouldInheritGroup = function (inherit) { return inherit === true; };
|
|
10
|
+
var shouldInheritId = function (inherit) {
|
|
11
|
+
return shouldInheritGroup(inherit === true) || inherit === "id";
|
|
12
|
+
};
|
|
9
13
|
var LayoutGroup = function (_a) {
|
|
10
14
|
var _b, _c;
|
|
11
|
-
var children = _a.children, id = _a.id,
|
|
15
|
+
var children = _a.children, id = _a.id, inheritId = _a.inheritId, _d = _a.inherit, inherit = _d === void 0 ? true : _d;
|
|
16
|
+
// Maintain backwards-compatibility with inheritId until 7.0
|
|
17
|
+
if (inheritId !== undefined)
|
|
18
|
+
inherit = inheritId;
|
|
12
19
|
var layoutGroupContext = useContext(LayoutGroupContext);
|
|
13
20
|
var deprecatedLayoutGroupContext = useContext(DeprecatedLayoutGroupContext);
|
|
14
21
|
var _e = __read(useForceUpdate(), 2), forceRender = _e[0], key = _e[1];
|
|
15
22
|
var context = useRef(null);
|
|
16
23
|
var upstreamId = (_b = layoutGroupContext.id) !== null && _b !== void 0 ? _b : deprecatedLayoutGroupContext;
|
|
17
24
|
if (context.current === null) {
|
|
18
|
-
if (
|
|
25
|
+
if (shouldInheritId(inherit) && upstreamId) {
|
|
19
26
|
id = id ? upstreamId + "-" + id : upstreamId;
|
|
20
27
|
}
|
|
21
28
|
context.current = {
|
|
22
29
|
id: id,
|
|
23
|
-
group:
|
|
30
|
+
group: shouldInheritGroup(inherit)
|
|
24
31
|
? (_c = layoutGroupContext === null || layoutGroupContext === void 0 ? void 0 : layoutGroupContext.group) !== null && _c !== void 0 ? _c : nodeGroup()
|
|
25
32
|
: nodeGroup(),
|
|
26
33
|
};
|
|
@@ -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
|
-
|
|
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,
|
package/dist/es/utils/use-id.mjs
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { useConstant } from './use-constant.mjs';
|
|
3
2
|
|
|
4
3
|
var counter = 0;
|
|
5
4
|
var incrementId = function () { return counter++; };
|
|
6
|
-
var useId =
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var useId = function () { return useConstant(incrementId); };
|
|
6
|
+
/**
|
|
7
|
+
* Ideally we'd use the following code to support React 18 optionally.
|
|
8
|
+
* But this fairly fails in Webpack (otherwise treeshaking wouldn't work at all).
|
|
9
|
+
* Need to come up with a different way of figuring this out.
|
|
10
|
+
*/
|
|
11
|
+
// export const useId = (React as any).useId
|
|
12
|
+
// ? (React as any).useId
|
|
13
|
+
// : () => useConstant(incrementId)
|
|
9
14
|
|
|
10
15
|
export { useId };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { useRef
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { useIsomorphicLayoutEffect } from './use-isomorphic-effect.mjs';
|
|
2
3
|
|
|
3
4
|
function useIsMounted() {
|
|
4
5
|
var isMounted = useRef(false);
|
|
5
|
-
|
|
6
|
+
useIsomorphicLayoutEffect(function () {
|
|
6
7
|
isMounted.current = true;
|
|
7
8
|
return function () {
|
|
8
9
|
isMounted.current = false;
|
|
@@ -5584,9 +5584,15 @@
|
|
|
5584
5584
|
|
|
5585
5585
|
var counter = 0;
|
|
5586
5586
|
var incrementId = function () { return counter++; };
|
|
5587
|
-
var useId =
|
|
5588
|
-
|
|
5589
|
-
|
|
5587
|
+
var useId = function () { return useConstant(incrementId); };
|
|
5588
|
+
/**
|
|
5589
|
+
* Ideally we'd use the following code to support React 18 optionally.
|
|
5590
|
+
* But this fairly fails in Webpack (otherwise treeshaking wouldn't work at all).
|
|
5591
|
+
* Need to come up with a different way of figuring this out.
|
|
5592
|
+
*/
|
|
5593
|
+
// export const useId = (React as any).useId
|
|
5594
|
+
// ? (React as any).useId
|
|
5595
|
+
// : () => useConstant(incrementId)
|
|
5590
5596
|
|
|
5591
5597
|
/**
|
|
5592
5598
|
* When a component is the child of `AnimatePresence`, it can use `usePresence`
|
|
@@ -6241,7 +6247,11 @@
|
|
|
6241
6247
|
// Propagate active change to children
|
|
6242
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); });
|
|
6243
6249
|
state[type].isActive = isActive;
|
|
6244
|
-
|
|
6250
|
+
var animations = animateChanges(options, type);
|
|
6251
|
+
for (var key in state) {
|
|
6252
|
+
state[key].protectedKeys = {};
|
|
6253
|
+
}
|
|
6254
|
+
return animations;
|
|
6245
6255
|
}
|
|
6246
6256
|
return {
|
|
6247
6257
|
isAnimated: isAnimated,
|
|
@@ -8337,7 +8347,7 @@
|
|
|
8337
8347
|
|
|
8338
8348
|
function useIsMounted() {
|
|
8339
8349
|
var isMounted = React.useRef(false);
|
|
8340
|
-
|
|
8350
|
+
useIsomorphicLayoutEffect(function () {
|
|
8341
8351
|
isMounted.current = true;
|
|
8342
8352
|
return function () {
|
|
8343
8353
|
isMounted.current = false;
|
|
@@ -8593,21 +8603,28 @@
|
|
|
8593
8603
|
};
|
|
8594
8604
|
}
|
|
8595
8605
|
|
|
8606
|
+
var shouldInheritGroup = function (inherit) { return inherit === true; };
|
|
8607
|
+
var shouldInheritId = function (inherit) {
|
|
8608
|
+
return shouldInheritGroup(inherit === true) || inherit === "id";
|
|
8609
|
+
};
|
|
8596
8610
|
var LayoutGroup = function (_a) {
|
|
8597
8611
|
var _b, _c;
|
|
8598
|
-
var children = _a.children, id = _a.id,
|
|
8612
|
+
var children = _a.children, id = _a.id, inheritId = _a.inheritId, _d = _a.inherit, inherit = _d === void 0 ? true : _d;
|
|
8613
|
+
// Maintain backwards-compatibility with inheritId until 7.0
|
|
8614
|
+
if (inheritId !== undefined)
|
|
8615
|
+
inherit = inheritId;
|
|
8599
8616
|
var layoutGroupContext = React.useContext(LayoutGroupContext);
|
|
8600
8617
|
var deprecatedLayoutGroupContext = React.useContext(DeprecatedLayoutGroupContext);
|
|
8601
8618
|
var _e = __read(useForceUpdate(), 2), forceRender = _e[0], key = _e[1];
|
|
8602
8619
|
var context = React.useRef(null);
|
|
8603
8620
|
var upstreamId = (_b = layoutGroupContext.id) !== null && _b !== void 0 ? _b : deprecatedLayoutGroupContext;
|
|
8604
8621
|
if (context.current === null) {
|
|
8605
|
-
if (
|
|
8622
|
+
if (shouldInheritId(inherit) && upstreamId) {
|
|
8606
8623
|
id = id ? upstreamId + "-" + id : upstreamId;
|
|
8607
8624
|
}
|
|
8608
8625
|
context.current = {
|
|
8609
8626
|
id: id,
|
|
8610
|
-
group:
|
|
8627
|
+
group: shouldInheritGroup(inherit)
|
|
8611
8628
|
? (_c = layoutGroupContext === null || layoutGroupContext === void 0 ? void 0 : layoutGroupContext.group) !== null && _c !== void 0 ? _c : nodeGroup()
|
|
8612
8629
|
: nodeGroup(),
|
|
8613
8630
|
};
|