framer-motion 10.2.2 → 10.2.4
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 +18 -20
- package/dist/cjs/{wrap-b7ab39cb.js → wrap-62da7859.js} +456 -438
- package/dist/dom-entry.d.ts +497 -49
- package/dist/es/animation/GroupPlaybackControls.mjs +25 -0
- package/dist/es/animation/animate.mjs +2 -4
- package/dist/es/animation/create-instant-animation.mjs +13 -3
- package/dist/es/animation/generators/inertia.mjs +87 -0
- package/dist/es/animation/{legacy-popmotion → generators}/keyframes.mjs +8 -15
- package/dist/es/animation/{legacy-popmotion/find-spring.mjs → generators/spring/find.mjs} +6 -5
- package/dist/es/animation/generators/spring/index.mjs +129 -0
- package/dist/es/animation/generators/utils/velocity.mjs +9 -0
- package/dist/es/animation/index.mjs +2 -10
- package/dist/es/animation/js/driver-frameloop.mjs +12 -0
- package/dist/es/animation/js/index.mjs +206 -0
- package/dist/es/animation/optimized-appear/handoff.mjs +3 -1
- package/dist/es/animation/waapi/create-accelerated-animation.mjs +16 -10
- package/dist/es/frameloop/index.mjs +3 -4
- package/dist/es/gestures/pan/PanSession.mjs +2 -2
- package/dist/es/index.mjs +2 -3
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/utils/time-conversion.mjs +2 -1
- package/dist/es/value/index.mjs +3 -3
- package/dist/es/value/use-spring.mjs +1 -1
- package/dist/es/value/use-velocity.mjs +4 -6
- package/dist/framer-motion.dev.js +475 -459
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +70 -114
- package/dist/projection.dev.js +5849 -5831
- package/dist/three-entry.d.ts +11 -9
- package/package.json +7 -7
- package/dist/es/animation/legacy-popmotion/decay.mjs +0 -34
- package/dist/es/animation/legacy-popmotion/index.mjs +0 -163
- package/dist/es/animation/legacy-popmotion/inertia.mjs +0 -90
- package/dist/es/animation/legacy-popmotion/spring.mjs +0 -143
- package/dist/es/frameloop/on-next-frame.mjs +0 -12
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { onNextFrame, defaultTimestep } from './on-next-frame.mjs';
|
|
2
1
|
import { createRenderStep } from './create-render-step.mjs';
|
|
3
2
|
import { frameData } from './data.mjs';
|
|
4
3
|
|
|
@@ -38,7 +37,7 @@ const processStep = (stepId) => steps[stepId].process(frameData);
|
|
|
38
37
|
const processFrame = (timestamp) => {
|
|
39
38
|
runNextFrame = false;
|
|
40
39
|
frameData.delta = useDefaultElapsed
|
|
41
|
-
?
|
|
40
|
+
? 1000 / 60
|
|
42
41
|
: Math.max(Math.min(timestamp - frameData.timestamp, maxElapsed), 1);
|
|
43
42
|
frameData.timestamp = timestamp;
|
|
44
43
|
isProcessing = true;
|
|
@@ -46,14 +45,14 @@ const processFrame = (timestamp) => {
|
|
|
46
45
|
isProcessing = false;
|
|
47
46
|
if (runNextFrame) {
|
|
48
47
|
useDefaultElapsed = false;
|
|
49
|
-
|
|
48
|
+
requestAnimationFrame(processFrame);
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
51
|
const startLoop = () => {
|
|
53
52
|
runNextFrame = true;
|
|
54
53
|
useDefaultElapsed = true;
|
|
55
54
|
if (!isProcessing)
|
|
56
|
-
|
|
55
|
+
requestAnimationFrame(processFrame);
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
export { cancelSync, flushSync, sync };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractEventInfo } from '../../events/event-info.mjs';
|
|
2
2
|
import { sync, cancelSync } from '../../frameloop/index.mjs';
|
|
3
|
-
import { secondsToMilliseconds } from '../../utils/time-conversion.mjs';
|
|
3
|
+
import { secondsToMilliseconds, millisecondsToSeconds } from '../../utils/time-conversion.mjs';
|
|
4
4
|
import { addPointerEvent } from '../../events/add-pointer-event.mjs';
|
|
5
5
|
import { pipe } from '../../utils/pipe.mjs';
|
|
6
6
|
import { distance2D } from '../../utils/distance.mjs';
|
|
@@ -129,7 +129,7 @@ function getVelocity(history, timeDelta) {
|
|
|
129
129
|
if (!timestampedPoint) {
|
|
130
130
|
return { x: 0, y: 0 };
|
|
131
131
|
}
|
|
132
|
-
const time = (lastPoint.timestamp - timestampedPoint.timestamp)
|
|
132
|
+
const time = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);
|
|
133
133
|
if (time === 0) {
|
|
134
134
|
return { x: 0, y: 0 };
|
|
135
135
|
}
|
package/dist/es/index.mjs
CHANGED
|
@@ -40,14 +40,13 @@ export { useInstantTransition } from './utils/use-instant-transition.mjs';
|
|
|
40
40
|
export { useInstantLayoutTransition } from './projection/use-instant-layout-transition.mjs';
|
|
41
41
|
export { useResetProjection } from './projection/use-reset-projection.mjs';
|
|
42
42
|
export { buildTransform } from './render/html/utils/build-transform.mjs';
|
|
43
|
-
export { animateValue } from './animation/
|
|
44
|
-
export { inertia } from './animation/legacy-popmotion/inertia.mjs';
|
|
43
|
+
export { animateValue } from './animation/js/index.mjs';
|
|
45
44
|
export { color } from './value/types/color/index.mjs';
|
|
46
45
|
export { complex } from './value/types/complex/index.mjs';
|
|
47
46
|
export { px } from './value/types/numbers/units.mjs';
|
|
48
47
|
export { startOptimizedAppearAnimation } from './animation/optimized-appear/start.mjs';
|
|
49
48
|
export { optimizedAppearDataAttribute } from './animation/optimized-appear/data-id.mjs';
|
|
50
|
-
export { spring } from './animation/
|
|
49
|
+
export { spring } from './animation/generators/spring/index.mjs';
|
|
51
50
|
export { MotionContext } from './context/MotionContext/index.mjs';
|
|
52
51
|
export { MotionConfigContext } from './context/MotionConfigContext.mjs';
|
|
53
52
|
export { PresenceContext } from './context/PresenceContext.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.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.4 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
|
@@ -5,5 +5,6 @@
|
|
|
5
5
|
* @return milliseconds - Converted time in milliseconds.
|
|
6
6
|
*/
|
|
7
7
|
const secondsToMilliseconds = (seconds) => seconds * 1000;
|
|
8
|
+
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
|
|
8
9
|
|
|
9
|
-
export { secondsToMilliseconds };
|
|
10
|
+
export { millisecondsToSeconds, secondsToMilliseconds };
|
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.4";
|
|
30
30
|
/**
|
|
31
31
|
* Duration, in milliseconds, since last updating frame.
|
|
32
32
|
*
|
|
@@ -272,7 +272,7 @@ class MotionValue {
|
|
|
272
272
|
this.stop();
|
|
273
273
|
return new Promise((resolve) => {
|
|
274
274
|
this.hasAnimated = true;
|
|
275
|
-
this.animation = startAnimation(resolve)
|
|
275
|
+
this.animation = startAnimation(resolve);
|
|
276
276
|
if (this.events.animationStart) {
|
|
277
277
|
this.events.animationStart.notify();
|
|
278
278
|
}
|
|
@@ -306,7 +306,7 @@ class MotionValue {
|
|
|
306
306
|
return !!this.animation;
|
|
307
307
|
}
|
|
308
308
|
clearAnimation() {
|
|
309
|
-
this.animation
|
|
309
|
+
delete this.animation;
|
|
310
310
|
}
|
|
311
311
|
/**
|
|
312
312
|
* Destroy and clean up subscribers to this `MotionValue`.
|
|
@@ -2,8 +2,8 @@ import { useContext, useRef, useInsertionEffect } from 'react';
|
|
|
2
2
|
import { isMotionValue } from './utils/is-motion-value.mjs';
|
|
3
3
|
import { useMotionValue } from './use-motion-value.mjs';
|
|
4
4
|
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
5
|
-
import { animateValue } from '../animation/legacy-popmotion/index.mjs';
|
|
6
5
|
import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
|
|
6
|
+
import { animateValue } from '../animation/js/index.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a `MotionValue` that, when `set`, will use a spring animation to animate to its new state.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMotionValueEvent } from '../utils/use-motion-value-event.mjs';
|
|
2
2
|
import { useMotionValue } from './use-motion-value.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -14,11 +14,9 @@ import { useMotionValue } from './use-motion-value.mjs';
|
|
|
14
14
|
*/
|
|
15
15
|
function useVelocity(value) {
|
|
16
16
|
const velocity = useMotionValue(value.getVelocity());
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}, [value]);
|
|
17
|
+
useMotionValueEvent(value, "velocityChange", (newVelocity) => {
|
|
18
|
+
velocity.set(newVelocity);
|
|
19
|
+
});
|
|
22
20
|
return velocity;
|
|
23
21
|
}
|
|
24
22
|
|