framer-motion 10.2.1 → 10.2.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/dom-entry.js +1 -1
- package/dist/cjs/index.js +12 -3
- package/dist/cjs/{wrap-c75f9bd0.js → wrap-27fda06a.js} +1 -2
- package/dist/dom-entry.d.ts +53 -53
- package/dist/es/animation/animate.mjs +0 -1
- package/dist/es/components/LayoutGroup/index.mjs +3 -1
- package/dist/es/context/DeprecatedLayoutGroupContext.mjs +10 -0
- package/dist/es/index.mjs +1 -0
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +12 -4
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +189 -183
- package/dist/projection.dev.js +2 -3
- package/dist/three-entry.d.ts +69 -66
- package/package.json +6 -2
package/dist/cjs/dom-entry.js
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var wrap = require('./wrap-
|
|
6
|
+
var wrap = require('./wrap-27fda06a.js');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
@@ -5516,7 +5516,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
5516
5516
|
* and warn against mismatches.
|
|
5517
5517
|
*/
|
|
5518
5518
|
if (process.env.NODE_ENV === "development") {
|
|
5519
|
-
wrap.warnOnce(nextValue.version === "10.2.
|
|
5519
|
+
wrap.warnOnce(nextValue.version === "10.2.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.3 may not work as expected.`);
|
|
5520
5520
|
}
|
|
5521
5521
|
}
|
|
5522
5522
|
else if (wrap.isMotionValue(prevValue)) {
|
|
@@ -6786,13 +6786,21 @@ function isLazyBundle(features) {
|
|
|
6786
6786
|
return typeof features === "function";
|
|
6787
6787
|
}
|
|
6788
6788
|
|
|
6789
|
+
/**
|
|
6790
|
+
* Note: Still used by components generated by old versions of Framer
|
|
6791
|
+
*
|
|
6792
|
+
* @deprecated
|
|
6793
|
+
*/
|
|
6794
|
+
const DeprecatedLayoutGroupContext = React.createContext(null);
|
|
6795
|
+
|
|
6789
6796
|
const shouldInheritGroup = (inherit) => inherit === true;
|
|
6790
6797
|
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
|
|
6791
6798
|
const LayoutGroup = ({ children, id, inherit = true }) => {
|
|
6792
6799
|
const layoutGroupContext = React.useContext(LayoutGroupContext);
|
|
6800
|
+
const deprecatedLayoutGroupContext = React.useContext(DeprecatedLayoutGroupContext);
|
|
6793
6801
|
const [forceRender, key] = useForceUpdate();
|
|
6794
6802
|
const context = React.useRef(null);
|
|
6795
|
-
const upstreamId = layoutGroupContext.id;
|
|
6803
|
+
const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
|
|
6796
6804
|
if (context.current === null) {
|
|
6797
6805
|
if (shouldInheritId(inherit) && upstreamId) {
|
|
6798
6806
|
id = id ? upstreamId + "-" + id : upstreamId;
|
|
@@ -7899,6 +7907,7 @@ Object.defineProperty(exports, 'warning', {
|
|
|
7899
7907
|
exports.wrap = wrap.wrap;
|
|
7900
7908
|
exports.AnimatePresence = AnimatePresence;
|
|
7901
7909
|
exports.AnimateSharedLayout = AnimateSharedLayout;
|
|
7910
|
+
exports.DeprecatedLayoutGroupContext = DeprecatedLayoutGroupContext;
|
|
7902
7911
|
exports.DragControls = DragControls;
|
|
7903
7912
|
exports.FlatTree = FlatTree;
|
|
7904
7913
|
exports.LayoutGroup = LayoutGroup;
|
|
@@ -415,7 +415,7 @@ class MotionValue {
|
|
|
415
415
|
* This will be replaced by the build step with the latest version number.
|
|
416
416
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
417
417
|
*/
|
|
418
|
-
this.version = "10.2.
|
|
418
|
+
this.version = "10.2.3";
|
|
419
419
|
/**
|
|
420
420
|
* Duration, in milliseconds, since last updating frame.
|
|
421
421
|
*
|
|
@@ -2343,7 +2343,6 @@ function animate(from, to, transition = {}) {
|
|
|
2343
2343
|
value.start(createMotionValueAnimation("", value, to, transition));
|
|
2344
2344
|
return {
|
|
2345
2345
|
stop: () => value.stop(),
|
|
2346
|
-
isAnimating: () => value.isAnimating(),
|
|
2347
2346
|
};
|
|
2348
2347
|
}
|
|
2349
2348
|
|
package/dist/dom-entry.d.ts
CHANGED
|
@@ -28,59 +28,6 @@ declare type Sync = {
|
|
|
28
28
|
[key in StepId]: Schedule;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
interface AnimationPlaybackControls {
|
|
35
|
-
stop: () => void;
|
|
36
|
-
isAnimating: () => boolean;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
interface AnimationPlaybackLifecycles<V> {
|
|
42
|
-
onUpdate?: (latest: V) => void;
|
|
43
|
-
onPlay?: () => void;
|
|
44
|
-
onComplete?: () => void;
|
|
45
|
-
onRepeat?: () => void;
|
|
46
|
-
onStop?: () => void;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
declare type AnimationOptions<V> = (Tween | Spring) & AnimationPlaybackLifecycles<V> & {
|
|
52
|
-
delay?: number;
|
|
53
|
-
type?: "tween" | "spring";
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Animate a single value or a `MotionValue`.
|
|
57
|
-
*
|
|
58
|
-
* The first argument is either a `MotionValue` to animate, or an initial animation value.
|
|
59
|
-
*
|
|
60
|
-
* The second is either a value to animate to, or an array of keyframes to animate through.
|
|
61
|
-
*
|
|
62
|
-
* The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.
|
|
63
|
-
*
|
|
64
|
-
* Returns `AnimationPlaybackControls`, currently just a `stop` method.
|
|
65
|
-
*
|
|
66
|
-
* ```javascript
|
|
67
|
-
* const x = useMotionValue(0)
|
|
68
|
-
*
|
|
69
|
-
* useEffect(() => {
|
|
70
|
-
* const controls = animate(x, 100, {
|
|
71
|
-
* type: "spring",
|
|
72
|
-
* stiffness: 2000,
|
|
73
|
-
* onComplete: v => {}
|
|
74
|
-
* })
|
|
75
|
-
*
|
|
76
|
-
* return controls.stop
|
|
77
|
-
* })
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* @public
|
|
81
|
-
*/
|
|
82
|
-
declare function animate<V>(from: MotionValue<V> | V, to: V | V[], transition?: AnimationOptions<V>): AnimationPlaybackControls;
|
|
83
|
-
|
|
84
31
|
interface Repeat {
|
|
85
32
|
/**
|
|
86
33
|
* The number of times to repeat the transition. Set to `Infinity` for perpetual repeating.
|
|
@@ -398,6 +345,59 @@ interface Spring extends Repeat {
|
|
|
398
345
|
velocity?: number;
|
|
399
346
|
}
|
|
400
347
|
|
|
348
|
+
/**
|
|
349
|
+
* @public
|
|
350
|
+
*/
|
|
351
|
+
interface AnimationPlaybackControls {
|
|
352
|
+
currentTime?: number | null;
|
|
353
|
+
stop: () => void;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* @public
|
|
357
|
+
*/
|
|
358
|
+
interface AnimationPlaybackLifecycles<V> {
|
|
359
|
+
onUpdate?: (latest: V) => void;
|
|
360
|
+
onPlay?: () => void;
|
|
361
|
+
onComplete?: () => void;
|
|
362
|
+
onRepeat?: () => void;
|
|
363
|
+
onStop?: () => void;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* @public
|
|
367
|
+
*/
|
|
368
|
+
declare type AnimationOptions<V> = (Tween | Spring) & AnimationPlaybackLifecycles<V> & {
|
|
369
|
+
delay?: number;
|
|
370
|
+
type?: "tween" | "spring";
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Animate a single value or a `MotionValue`.
|
|
374
|
+
*
|
|
375
|
+
* The first argument is either a `MotionValue` to animate, or an initial animation value.
|
|
376
|
+
*
|
|
377
|
+
* The second is either a value to animate to, or an array of keyframes to animate through.
|
|
378
|
+
*
|
|
379
|
+
* The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.
|
|
380
|
+
*
|
|
381
|
+
* Returns `AnimationPlaybackControls`, currently just a `stop` method.
|
|
382
|
+
*
|
|
383
|
+
* ```javascript
|
|
384
|
+
* const x = useMotionValue(0)
|
|
385
|
+
*
|
|
386
|
+
* useEffect(() => {
|
|
387
|
+
* const controls = animate(x, 100, {
|
|
388
|
+
* type: "spring",
|
|
389
|
+
* stiffness: 2000,
|
|
390
|
+
* onComplete: v => {}
|
|
391
|
+
* })
|
|
392
|
+
*
|
|
393
|
+
* return controls.stop
|
|
394
|
+
* })
|
|
395
|
+
* ```
|
|
396
|
+
*
|
|
397
|
+
* @public
|
|
398
|
+
*/
|
|
399
|
+
declare function animate<V>(from: MotionValue<V> | V, to: V | V[], transition?: AnimationOptions<V>): AnimationPlaybackControls;
|
|
400
|
+
|
|
401
401
|
/**
|
|
402
402
|
* @public
|
|
403
403
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useContext, useRef, useMemo } from 'react';
|
|
3
3
|
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
|
|
4
|
+
import { DeprecatedLayoutGroupContext } from '../../context/DeprecatedLayoutGroupContext.mjs';
|
|
4
5
|
import { useForceUpdate } from '../../utils/use-force-update.mjs';
|
|
5
6
|
import { nodeGroup } from '../../projection/node/group.mjs';
|
|
6
7
|
|
|
@@ -8,9 +9,10 @@ const shouldInheritGroup = (inherit) => inherit === true;
|
|
|
8
9
|
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
|
|
9
10
|
const LayoutGroup = ({ children, id, inherit = true }) => {
|
|
10
11
|
const layoutGroupContext = useContext(LayoutGroupContext);
|
|
12
|
+
const deprecatedLayoutGroupContext = useContext(DeprecatedLayoutGroupContext);
|
|
11
13
|
const [forceRender, key] = useForceUpdate();
|
|
12
14
|
const context = useRef(null);
|
|
13
|
-
const upstreamId = layoutGroupContext.id;
|
|
15
|
+
const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
|
|
14
16
|
if (context.current === null) {
|
|
15
17
|
if (shouldInheritId(inherit) && upstreamId) {
|
|
16
18
|
id = id ? upstreamId + "-" + id : upstreamId;
|
package/dist/es/index.mjs
CHANGED
|
@@ -54,6 +54,7 @@ export { PresenceContext } from './context/PresenceContext.mjs';
|
|
|
54
54
|
export { LayoutGroupContext } from './context/LayoutGroupContext.mjs';
|
|
55
55
|
export { SwitchLayoutGroupContext } from './context/SwitchLayoutGroupContext.mjs';
|
|
56
56
|
export { FlatTree } from './render/utils/flat-tree.mjs';
|
|
57
|
+
export { DeprecatedLayoutGroupContext } from './context/DeprecatedLayoutGroupContext.mjs';
|
|
57
58
|
export { useAnimatedState as useDeprecatedAnimatedState } from './animation/hooks/use-animated-state.mjs';
|
|
58
59
|
export { useInvertedScale as useDeprecatedInvertedScale } from './value/use-inverted-scale.mjs';
|
|
59
60
|
export { AnimateSharedLayout } from './components/AnimateSharedLayout.mjs';
|
|
@@ -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 === "10.2.
|
|
25
|
+
warnOnce(nextValue.version === "10.2.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.3 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ class MotionValue {
|
|
|
26
26
|
* This will be replaced by the build step with the latest version number.
|
|
27
27
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
28
28
|
*/
|
|
29
|
-
this.version = "10.2.
|
|
29
|
+
this.version = "10.2.3";
|
|
30
30
|
/**
|
|
31
31
|
* Duration, in milliseconds, since last updating frame.
|
|
32
32
|
*
|
|
@@ -1995,7 +1995,7 @@
|
|
|
1995
1995
|
* This will be replaced by the build step with the latest version number.
|
|
1996
1996
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
1997
1997
|
*/
|
|
1998
|
-
this.version = "10.2.
|
|
1998
|
+
this.version = "10.2.3";
|
|
1999
1999
|
/**
|
|
2000
2000
|
* Duration, in milliseconds, since last updating frame.
|
|
2001
2001
|
*
|
|
@@ -5613,7 +5613,6 @@
|
|
|
5613
5613
|
value.start(createMotionValueAnimation("", value, to, transition));
|
|
5614
5614
|
return {
|
|
5615
5615
|
stop: () => value.stop(),
|
|
5616
|
-
isAnimating: () => value.isAnimating(),
|
|
5617
5616
|
};
|
|
5618
5617
|
}
|
|
5619
5618
|
|
|
@@ -7862,7 +7861,7 @@
|
|
|
7862
7861
|
* and warn against mismatches.
|
|
7863
7862
|
*/
|
|
7864
7863
|
{
|
|
7865
|
-
warnOnce(nextValue.version === "10.2.
|
|
7864
|
+
warnOnce(nextValue.version === "10.2.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.3 may not work as expected.`);
|
|
7866
7865
|
}
|
|
7867
7866
|
}
|
|
7868
7867
|
else if (isMotionValue(prevValue)) {
|
|
@@ -9130,13 +9129,21 @@
|
|
|
9130
9129
|
return typeof features === "function";
|
|
9131
9130
|
}
|
|
9132
9131
|
|
|
9132
|
+
/**
|
|
9133
|
+
* Note: Still used by components generated by old versions of Framer
|
|
9134
|
+
*
|
|
9135
|
+
* @deprecated
|
|
9136
|
+
*/
|
|
9137
|
+
const DeprecatedLayoutGroupContext = React.createContext(null);
|
|
9138
|
+
|
|
9133
9139
|
const shouldInheritGroup = (inherit) => inherit === true;
|
|
9134
9140
|
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
|
|
9135
9141
|
const LayoutGroup = ({ children, id, inherit = true }) => {
|
|
9136
9142
|
const layoutGroupContext = React.useContext(LayoutGroupContext);
|
|
9143
|
+
const deprecatedLayoutGroupContext = React.useContext(DeprecatedLayoutGroupContext);
|
|
9137
9144
|
const [forceRender, key] = useForceUpdate();
|
|
9138
9145
|
const context = React.useRef(null);
|
|
9139
|
-
const upstreamId = layoutGroupContext.id;
|
|
9146
|
+
const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
|
|
9140
9147
|
if (context.current === null) {
|
|
9141
9148
|
if (shouldInheritId(inherit) && upstreamId) {
|
|
9142
9149
|
id = id ? upstreamId + "-" + id : upstreamId;
|
|
@@ -10698,6 +10705,7 @@
|
|
|
10698
10705
|
|
|
10699
10706
|
exports.AnimatePresence = AnimatePresence;
|
|
10700
10707
|
exports.AnimateSharedLayout = AnimateSharedLayout;
|
|
10708
|
+
exports.DeprecatedLayoutGroupContext = DeprecatedLayoutGroupContext;
|
|
10701
10709
|
exports.DragControls = DragControls;
|
|
10702
10710
|
exports.FlatTree = FlatTree;
|
|
10703
10711
|
exports.LayoutGroup = LayoutGroup;
|