motion 11.15.0 → 11.16.1
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/README.md +3 -19
- package/dist/cjs/index.js +1677 -1645
- package/dist/cjs/mini.js +215 -185
- package/dist/cjs/react-client.js +3814 -3796
- package/dist/cjs/react-m.js +156 -152
- package/dist/cjs/react-mini.js +215 -185
- package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +1 -0
- package/dist/es/framer-motion/dist/es/animation/animate/single-value.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +7 -7
- package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +8 -8
- package/dist/es/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +26 -89
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +3 -3
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/index.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/generators/spring/find.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +9 -6
- package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +7 -6
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +4 -3
- package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +8 -8
- package/dist/es/framer-motion/dist/es/easing/utils/map.mjs +4 -4
- package/dist/es/framer-motion/dist/es/events/event-info.mjs +1 -0
- package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +2 -1
- package/dist/es/framer-motion/dist/es/gestures/hover.mjs +1 -0
- package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +5 -4
- package/dist/es/framer-motion/dist/es/gestures/press.mjs +1 -0
- package/dist/es/framer-motion/dist/es/motion/index.mjs +11 -7
- package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +3 -3
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +15 -15
- package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +1 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +3 -3
- package/dist/es/framer-motion/dist/es/render/dom/scroll/info.mjs +2 -1
- package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +1 -0
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/delay.mjs +2 -1
- package/dist/es/framer-motion/dist/es/utils/interpolate.mjs +3 -3
- package/dist/es/framer-motion/dist/es/utils/offsets/fill.mjs +2 -1
- package/dist/es/framer-motion/dist/es/value/index.mjs +2 -2
- package/dist/es/framer-motion/dist/es/value/use-spring.mjs +3 -3
- package/dist/es/motion/lib/index.mjs +8 -8
- package/dist/es/motion/lib/react.mjs +8 -8
- package/dist/es/{framer-motion/dist/es/animation/GroupPlaybackControls.mjs → motion-dom/dist/es/animation/controls/BaseGroup.mjs} +6 -5
- package/dist/es/motion-dom/dist/es/animation/controls/Group.mjs +13 -0
- package/dist/es/{framer-motion/dist/es/easing → motion-dom/dist/es/animation/generators}/utils/create-generator-easing.mjs +6 -3
- package/dist/es/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs +85 -0
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi → motion-dom/dist/es/animation/waapi/utils}/easing.mjs +3 -3
- package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/waapi/utils/linear.mjs +2 -1
- package/dist/es/motion-dom/dist/es/gestures/press/index.mjs +4 -3
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/supports-linear-easing.mjs → motion-dom/dist/es/utils/supports/linear-easing.mjs} +1 -1
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/memo-supports.mjs → motion-dom/dist/es/utils/supports/memo.mjs} +3 -2
- package/dist/es/motion-dom/dist/es/utils/supports/scroll-timeline.mjs +6 -0
- package/dist/motion.dev.js +1677 -1645
- package/dist/motion.js +1 -1
- package/package.json +3 -3
- package/dist/es/framer-motion/dist/es/render/dom/scroll/supports.mjs +0 -5
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/utils/calc-duration.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/utils/is-generator.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/utils/get-value-transition.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/waapi/utils/attach-timeline.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/easing → motion-dom/dist/es}/utils/is-bezier-definition.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/supports-flags.mjs → motion-dom/dist/es/utils/supports/flags.mjs} +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/memo.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/progress.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/time-conversion.mjs +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { secondsToMilliseconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
3
|
+
import { createGeneratorEasing } from '../../../../../../motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs';
|
|
4
|
+
import { isGenerator } from '../../../../../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs';
|
|
5
|
+
import { NativeAnimationControls } from '../../../../../../motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs';
|
|
6
|
+
import { supportsLinearEasing } from '../../../../../../motion-dom/dist/es/utils/supports/linear-easing.mjs';
|
|
1
7
|
import { startWaapiAnimation } from './index.mjs';
|
|
2
|
-
import { createGeneratorEasing } from '../../../easing/utils/create-generator-easing.mjs';
|
|
3
8
|
import { browserNumberValueTypes } from '../../../render/dom/value-types/number-browser.mjs';
|
|
4
|
-
import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
5
|
-
import { noop } from '../../../../../../motion-utils/dist/es/noop.mjs';
|
|
6
|
-
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../utils/time-conversion.mjs';
|
|
7
|
-
import { isGenerator } from '../../generators/utils/is-generator.mjs';
|
|
8
|
-
import { attachTimeline } from './utils/attach-timeline.mjs';
|
|
9
9
|
import { getFinalKeyframe } from './utils/get-final-keyframe.mjs';
|
|
10
10
|
import { setCSSVar, setStyle } from './utils/style.mjs';
|
|
11
|
-
import { supportsLinearEasing } from './utils/supports-linear-easing.mjs';
|
|
12
11
|
import { supportsPartialKeyframes } from './utils/supports-partial-keyframes.mjs';
|
|
13
12
|
import { supportsWaapi } from './utils/supports-waapi.mjs';
|
|
14
13
|
|
|
@@ -33,12 +32,9 @@ function getElementAnimationState(element) {
|
|
|
33
32
|
state.set(element, animationState);
|
|
34
33
|
return state.get(element);
|
|
35
34
|
}
|
|
36
|
-
class NativeAnimation {
|
|
35
|
+
class NativeAnimation extends NativeAnimationControls {
|
|
37
36
|
constructor(element, valueName, valueKeyframes, options) {
|
|
38
37
|
const isCSSVar = valueName.startsWith("--");
|
|
39
|
-
this.setValue = isCSSVar ? setCSSVar : setStyle;
|
|
40
|
-
this.options = options;
|
|
41
|
-
this.updateFinishedPromise();
|
|
42
38
|
invariant(typeof options.type !== "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "framer-motion"?`);
|
|
43
39
|
const existingAnimation = getElementAnimationState(element).get(valueName);
|
|
44
40
|
existingAnimation && existingAnimation.stop();
|
|
@@ -63,92 +59,32 @@ class NativeAnimation {
|
|
|
63
59
|
else {
|
|
64
60
|
options.ease = options.ease || defaultEasing;
|
|
65
61
|
}
|
|
66
|
-
this.removeAnimation = () => { var _a; return (_a = state.get(element)) === null || _a === void 0 ? void 0 : _a.delete(valueName); };
|
|
67
62
|
const onFinish = () => {
|
|
68
|
-
this.setValue(element, valueName, getFinalKeyframe(valueKeyframes,
|
|
63
|
+
this.setValue(element, valueName, getFinalKeyframe(valueKeyframes, options));
|
|
69
64
|
this.cancel();
|
|
70
65
|
this.resolveFinishedPromise();
|
|
71
66
|
};
|
|
67
|
+
const init = () => {
|
|
68
|
+
this.setValue = isCSSVar ? setCSSVar : setStyle;
|
|
69
|
+
this.options = options;
|
|
70
|
+
this.updateFinishedPromise();
|
|
71
|
+
this.removeAnimation = () => { var _a; return (_a = state.get(element)) === null || _a === void 0 ? void 0 : _a.delete(valueName); };
|
|
72
|
+
};
|
|
72
73
|
if (!supportsWaapi()) {
|
|
74
|
+
super();
|
|
75
|
+
init();
|
|
73
76
|
onFinish();
|
|
74
77
|
}
|
|
75
78
|
else {
|
|
76
|
-
|
|
79
|
+
super(startWaapiAnimation(element, valueName, valueKeyframes, options));
|
|
80
|
+
init();
|
|
77
81
|
if (options.autoplay === false) {
|
|
78
82
|
this.animation.pause();
|
|
79
83
|
}
|
|
80
84
|
this.animation.onfinish = onFinish;
|
|
81
|
-
if (this.pendingTimeline) {
|
|
82
|
-
attachTimeline(this.animation, this.pendingTimeline);
|
|
83
|
-
}
|
|
84
85
|
getElementAnimationState(element).set(valueName, this);
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
get duration() {
|
|
88
|
-
return millisecondsToSeconds(this.options.duration || 300);
|
|
89
|
-
}
|
|
90
|
-
get time() {
|
|
91
|
-
var _a;
|
|
92
|
-
if (this.animation) {
|
|
93
|
-
return millisecondsToSeconds(((_a = this.animation) === null || _a === void 0 ? void 0 : _a.currentTime) || 0);
|
|
94
|
-
}
|
|
95
|
-
return 0;
|
|
96
|
-
}
|
|
97
|
-
set time(newTime) {
|
|
98
|
-
if (this.animation) {
|
|
99
|
-
this.animation.currentTime = secondsToMilliseconds(newTime);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
get speed() {
|
|
103
|
-
return this.animation ? this.animation.playbackRate : 1;
|
|
104
|
-
}
|
|
105
|
-
set speed(newSpeed) {
|
|
106
|
-
if (this.animation) {
|
|
107
|
-
this.animation.playbackRate = newSpeed;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
get state() {
|
|
111
|
-
return this.animation ? this.animation.playState : "finished";
|
|
112
|
-
}
|
|
113
|
-
get startTime() {
|
|
114
|
-
return this.animation ? this.animation.startTime : null;
|
|
115
|
-
}
|
|
116
|
-
flatten() {
|
|
117
|
-
var _a;
|
|
118
|
-
if (!this.animation)
|
|
119
|
-
return;
|
|
120
|
-
(_a = this.animation.effect) === null || _a === void 0 ? void 0 : _a.updateTiming({ easing: "linear" });
|
|
121
|
-
}
|
|
122
|
-
play() {
|
|
123
|
-
if (this.state === "finished") {
|
|
124
|
-
this.updateFinishedPromise();
|
|
125
|
-
}
|
|
126
|
-
this.animation && this.animation.play();
|
|
127
|
-
}
|
|
128
|
-
pause() {
|
|
129
|
-
this.animation && this.animation.pause();
|
|
130
|
-
}
|
|
131
|
-
stop() {
|
|
132
|
-
if (!this.animation ||
|
|
133
|
-
this.state === "idle" ||
|
|
134
|
-
this.state === "finished") {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (this.animation.commitStyles) {
|
|
138
|
-
this.animation.commitStyles();
|
|
139
|
-
}
|
|
140
|
-
this.cancel();
|
|
141
|
-
}
|
|
142
|
-
complete() {
|
|
143
|
-
this.animation && this.animation.finish();
|
|
144
|
-
}
|
|
145
|
-
cancel() {
|
|
146
|
-
this.removeAnimation();
|
|
147
|
-
try {
|
|
148
|
-
this.animation && this.animation.cancel();
|
|
149
|
-
}
|
|
150
|
-
catch (e) { }
|
|
151
|
-
}
|
|
152
88
|
/**
|
|
153
89
|
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
154
90
|
* resolves when the animation finishes at all but in a future update could/should
|
|
@@ -162,14 +98,15 @@ class NativeAnimation {
|
|
|
162
98
|
this.resolveFinishedPromise = resolve;
|
|
163
99
|
});
|
|
164
100
|
}
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
this.
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
attachTimeline(this.animation, timeline);
|
|
101
|
+
play() {
|
|
102
|
+
if (this.state === "finished") {
|
|
103
|
+
this.updateFinishedPromise();
|
|
171
104
|
}
|
|
172
|
-
|
|
105
|
+
super.play();
|
|
106
|
+
}
|
|
107
|
+
cancel() {
|
|
108
|
+
this.removeAnimation();
|
|
109
|
+
super.cancel();
|
|
173
110
|
}
|
|
174
111
|
}
|
|
175
112
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
|
|
2
1
|
import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
3
|
-
import { secondsToMilliseconds } from '
|
|
4
|
-
import { getValueTransition } from '
|
|
2
|
+
import { secondsToMilliseconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
3
|
+
import { getValueTransition } from '../../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
|
|
4
|
+
import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
|
|
5
5
|
import { NativeAnimation } from './NativeAnimation.mjs';
|
|
6
6
|
|
|
7
7
|
function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GroupPlaybackControls } from '
|
|
1
|
+
import { GroupPlaybackControls } from '../../../../../../motion-dom/dist/es/animation/controls/Group.mjs';
|
|
2
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
3
|
import { animateElements } from './animate-elements.mjs';
|
|
3
4
|
|
|
4
5
|
const createScopedWaapiAnimate = (scope) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { mapEasingToNativeEasing } from '../../../../../../motion-dom/dist/es/animation/waapi/utils/easing.mjs';
|
|
2
3
|
|
|
3
4
|
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
|
|
4
5
|
const keyframeOptions = { [valueName]: keyframes };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { memo } from '../../../../../../../motion-utils/dist/es/memo.mjs';
|
|
2
3
|
|
|
3
4
|
const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
4
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { warning } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
2
3
|
import { clamp } from '../../../utils/clamp.mjs';
|
|
3
|
-
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../utils/time-conversion.mjs';
|
|
4
4
|
import { springDefaults } from './defaults.mjs';
|
|
5
5
|
|
|
6
6
|
const safeMin = 0.001;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { millisecondsToSeconds, secondsToMilliseconds } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { calcGeneratorDuration, maxGeneratorDuration } from '../utils/calc-duration.mjs';
|
|
1
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { millisecondsToSeconds, secondsToMilliseconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
3
|
+
import { calcGeneratorDuration, maxGeneratorDuration } from '../../../../../../motion-dom/dist/es/animation/generators/utils/calc-duration.mjs';
|
|
4
|
+
import { generateLinearEasing } from '../../../../../../motion-dom/dist/es/animation/waapi/utils/linear.mjs';
|
|
6
5
|
import { clamp } from '../../../utils/clamp.mjs';
|
|
6
|
+
import { calcGeneratorVelocity } from '../utils/velocity.mjs';
|
|
7
7
|
import { springDefaults } from './defaults.mjs';
|
|
8
|
+
import { findSpring, calcAngularFreq } from './find.mjs';
|
|
8
9
|
|
|
9
10
|
const durationKeys = ["duration", "bounce"];
|
|
10
11
|
const physicsKeys = ["stiffness", "damping", "mass"];
|
|
@@ -27,7 +28,9 @@ function getSpringOptions(options) {
|
|
|
27
28
|
const visualDuration = options.visualDuration;
|
|
28
29
|
const root = (2 * Math.PI) / (visualDuration * 1.2);
|
|
29
30
|
const stiffness = root * root;
|
|
30
|
-
const damping = 2 *
|
|
31
|
+
const damping = 2 *
|
|
32
|
+
clamp(0.05, 1, 1 - (options.bounce || 0)) *
|
|
33
|
+
Math.sqrt(stiffness);
|
|
31
34
|
springOptions = {
|
|
32
35
|
...springOptions,
|
|
33
36
|
mass: springDefaults.mass,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { GroupPlaybackControls } from '../../../../../motion-dom/dist/es/animation/controls/Group.mjs';
|
|
2
|
+
import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
|
|
3
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
4
|
+
import { secondsToMilliseconds } from '../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
5
|
+
import { frame } from '../../frameloop/frame.mjs';
|
|
4
6
|
import { MotionGlobalConfig } from '../../utils/GlobalConfig.mjs';
|
|
5
7
|
import { instantAnimationState } from '../../utils/use-instant-transition-state.mjs';
|
|
6
|
-
import { getFinalKeyframe } from '../animators/waapi/utils/get-final-keyframe.mjs';
|
|
7
|
-
import { frame } from '../../frameloop/frame.mjs';
|
|
8
8
|
import { AcceleratedAnimation } from '../animators/AcceleratedAnimation.mjs';
|
|
9
9
|
import { MainThreadAnimation } from '../animators/MainThreadAnimation.mjs';
|
|
10
|
-
import {
|
|
10
|
+
import { getFinalKeyframe } from '../animators/waapi/utils/get-final-keyframe.mjs';
|
|
11
|
+
import { getDefaultTransition } from '../utils/default-transitions.mjs';
|
|
11
12
|
import { isTransitionDefined } from '../utils/is-transition-defined.mjs';
|
|
12
13
|
|
|
13
14
|
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
|
|
1
3
|
import { transformProps } from '../../render/html/utils/transform.mjs';
|
|
2
|
-
import { animateMotionValue } from './motion-value.mjs';
|
|
3
4
|
import { setTarget } from '../../render/utils/setters.mjs';
|
|
4
|
-
import { getValueTransition } from '../utils/get-value-transition.mjs';
|
|
5
|
-
import { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';
|
|
6
5
|
import { addValueToWillChange } from '../../value/use-will-change/add-will-change.mjs';
|
|
6
|
+
import { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';
|
|
7
|
+
import { animateMotionValue } from './motion-value.mjs';
|
|
7
8
|
import { frame } from '../../frameloop/frame.mjs';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { progress } from '../../../../../motion-utils/dist/es/progress.mjs';
|
|
3
|
+
import { secondsToMilliseconds } from '../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
4
|
+
import { createGeneratorEasing } from '../../../../../motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs';
|
|
5
|
+
import { isGenerator } from '../../../../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs';
|
|
6
|
+
import { getEasingForSegment } from '../../easing/utils/get-easing-for-segment.mjs';
|
|
2
7
|
import { defaultOffset } from '../../utils/offsets/default.mjs';
|
|
3
8
|
import { fillOffset } from '../../utils/offsets/fill.mjs';
|
|
4
|
-
import { progress } from '../../utils/progress.mjs';
|
|
5
|
-
import { secondsToMilliseconds } from '../../utils/time-conversion.mjs';
|
|
6
9
|
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
7
10
|
import { resolveSubjects } from '../animate/resolve-subjects.mjs';
|
|
8
|
-
import {
|
|
11
|
+
import { calculateRepeatDuration } from './utils/calc-repeat-duration.mjs';
|
|
9
12
|
import { calcNextTime } from './utils/calc-time.mjs';
|
|
10
13
|
import { addKeyframes } from './utils/edit.mjs';
|
|
11
|
-
import { compareByTime } from './utils/sort.mjs';
|
|
12
|
-
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
13
14
|
import { normalizeTimes } from './utils/normalize-times.mjs';
|
|
14
|
-
import {
|
|
15
|
-
import { getEasingForSegment } from '../../easing/utils/get-easing-for-segment.mjs';
|
|
15
|
+
import { compareByTime } from './utils/sort.mjs';
|
|
16
16
|
|
|
17
17
|
const defaultSegmentEasing = "easeInOut";
|
|
18
18
|
const MAX_REPEAT = 20;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
2
|
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
3
|
+
import { isBezierDefinition } from '../../../../../motion-dom/dist/es/utils/is-bezier-definition.mjs';
|
|
4
|
+
import { anticipate } from '../anticipate.mjs';
|
|
5
|
+
import { backIn, backInOut, backOut } from '../back.mjs';
|
|
6
|
+
import { circIn, circInOut, circOut } from '../circ.mjs';
|
|
3
7
|
import { cubicBezier } from '../cubic-bezier.mjs';
|
|
4
8
|
import { easeIn, easeInOut, easeOut } from '../ease.mjs';
|
|
5
|
-
import { circIn, circInOut, circOut } from '../circ.mjs';
|
|
6
|
-
import { backIn, backInOut, backOut } from '../back.mjs';
|
|
7
|
-
import { anticipate } from '../anticipate.mjs';
|
|
8
|
-
import { isBezierDefinition } from './is-bezier-definition.mjs';
|
|
9
9
|
|
|
10
10
|
const easingLookup = {
|
|
11
11
|
linear: noop,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { progress } from '../../../../../../motion-utils/dist/es/progress.mjs';
|
|
2
3
|
import { calcLength } from '../../../projection/geometry/delta-calc.mjs';
|
|
3
4
|
import { clamp } from '../../../utils/clamp.mjs';
|
|
4
5
|
import { mixNumber } from '../../../utils/mix/number.mjs';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Feature } from '../motion/features/Feature.mjs';
|
|
2
|
+
import '../../../../motion-utils/dist/es/errors.mjs';
|
|
2
3
|
import { hover } from '../../../../motion-dom/dist/es/gestures/hover.mjs';
|
|
3
4
|
import { extractEventInfo } from '../events/event-info.mjs';
|
|
4
5
|
import { frame } from '../frameloop/frame.mjs';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { secondsToMilliseconds, millisecondsToSeconds } from '
|
|
1
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
3
|
+
import { isPrimaryPointer } from '../../../../../motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs';
|
|
3
4
|
import { addPointerEvent } from '../../events/add-pointer-event.mjs';
|
|
4
|
-
import {
|
|
5
|
+
import { extractEventInfo } from '../../events/event-info.mjs';
|
|
5
6
|
import { distance2D } from '../../utils/distance.mjs';
|
|
6
|
-
import {
|
|
7
|
+
import { pipe } from '../../utils/pipe.mjs';
|
|
7
8
|
import { frame, cancelFrame, frameData } from '../../frameloop/frame.mjs';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Feature } from '../motion/features/Feature.mjs';
|
|
2
|
+
import '../../../../motion-utils/dist/es/errors.mjs';
|
|
2
3
|
import { press } from '../../../../motion-dom/dist/es/gestures/press/index.mjs';
|
|
3
4
|
import { extractEventInfo } from '../events/event-info.mjs';
|
|
4
5
|
import { frame } from '../frameloop/frame.mjs';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { warning, invariant } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
3
4
|
import { forwardRef, useContext } from 'react';
|
|
5
|
+
import { LayoutGroupContext } from '../context/LayoutGroupContext.mjs';
|
|
6
|
+
import { LazyContext } from '../context/LazyContext.mjs';
|
|
4
7
|
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
5
8
|
import { MotionContext } from '../context/MotionContext/index.mjs';
|
|
6
|
-
import { useVisualElement } from './utils/use-visual-element.mjs';
|
|
7
|
-
import { useMotionRef } from './utils/use-motion-ref.mjs';
|
|
8
9
|
import { useCreateMotionContext } from '../context/MotionContext/create.mjs';
|
|
9
|
-
import { loadFeatures } from './features/load-features.mjs';
|
|
10
10
|
import { isBrowser } from '../utils/is-browser.mjs';
|
|
11
|
-
import { LayoutGroupContext } from '../context/LayoutGroupContext.mjs';
|
|
12
|
-
import { LazyContext } from '../context/LazyContext.mjs';
|
|
13
|
-
import { motionComponentSymbol } from './utils/symbol.mjs';
|
|
14
|
-
import { warning, invariant } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
15
11
|
import { featureDefinitions } from './features/definitions.mjs';
|
|
12
|
+
import { loadFeatures } from './features/load-features.mjs';
|
|
13
|
+
import { motionComponentSymbol } from './utils/symbol.mjs';
|
|
14
|
+
import { useMotionRef } from './utils/use-motion-ref.mjs';
|
|
15
|
+
import { useVisualElement } from './utils/use-visual-element.mjs';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Create a `motion` component.
|
|
@@ -24,6 +24,7 @@ import { featureDefinitions } from './features/definitions.mjs';
|
|
|
24
24
|
* component "offline", or outside the React render cycle.
|
|
25
25
|
*/
|
|
26
26
|
function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
|
|
27
|
+
var _a, _b;
|
|
27
28
|
preloadedFeatures && loadFeatures(preloadedFeatures);
|
|
28
29
|
function MotionComponent(props, externalRef) {
|
|
29
30
|
/**
|
|
@@ -57,6 +58,9 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
|
|
|
57
58
|
*/
|
|
58
59
|
return (jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? (jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] }));
|
|
59
60
|
}
|
|
61
|
+
MotionComponent.displayName = `motion.${typeof Component === "string"
|
|
62
|
+
? Component
|
|
63
|
+
: `create(${(_b = (_a = Component.displayName) !== null && _a !== void 0 ? _a : Component.name) !== null && _b !== void 0 ? _b : ""})`}`;
|
|
60
64
|
const ForwardRefMotionComponent = forwardRef(MotionComponent);
|
|
61
65
|
ForwardRefMotionComponent[motionComponentSymbol] = Component;
|
|
62
66
|
return ForwardRefMotionComponent;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { circOut } from '../../easing/circ.mjs';
|
|
2
|
-
import { progress } from '../../utils/progress.mjs';
|
|
3
|
-
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
4
1
|
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
5
2
|
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
3
|
+
import { progress } from '../../../../../motion-utils/dist/es/progress.mjs';
|
|
4
|
+
import { circOut } from '../../easing/circ.mjs';
|
|
5
|
+
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
6
6
|
import { percent, px } from '../../value/types/numbers/units.mjs';
|
|
7
7
|
|
|
8
8
|
const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
3
|
+
import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
|
|
4
|
+
import { animateSingleValue } from '../../animation/animate/single-value.mjs';
|
|
5
|
+
import { getOptimisedAppearId } from '../../animation/optimized-appear/get-appear-id.mjs';
|
|
6
|
+
import { cancelFrame, frameData, frameSteps, frame } from '../../frameloop/frame.mjs';
|
|
7
|
+
import { microtask } from '../../frameloop/microtask.mjs';
|
|
8
|
+
import { time } from '../../frameloop/sync-time.mjs';
|
|
9
|
+
import { isSVGElement } from '../../render/dom/utils/is-svg-element.mjs';
|
|
10
|
+
import { FlatTree } from '../../render/utils/flat-tree.mjs';
|
|
11
|
+
import { clamp } from '../../utils/clamp.mjs';
|
|
12
|
+
import { delay } from '../../utils/delay.mjs';
|
|
13
|
+
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
1
14
|
import { SubscriptionManager } from '../../utils/subscription-manager.mjs';
|
|
15
|
+
import { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';
|
|
2
16
|
import { mixValues } from '../animation/mix-values.mjs';
|
|
3
17
|
import { copyBoxInto, copyAxisDeltaInto } from '../geometry/copy.mjs';
|
|
4
18
|
import { translateAxis, transformBox, applyBoxDelta, applyTreeDeltas } from '../geometry/delta-apply.mjs';
|
|
5
19
|
import { calcRelativePosition, calcRelativeBox, calcBoxDelta, calcLength, isNear } from '../geometry/delta-calc.mjs';
|
|
6
20
|
import { removeBoxTransforms } from '../geometry/delta-remove.mjs';
|
|
7
|
-
import {
|
|
21
|
+
import { createBox, createDelta } from '../geometry/models.mjs';
|
|
8
22
|
import { boxEqualsRounded, isDeltaZero, axisDeltaEquals, aspectRatio, boxEquals } from '../geometry/utils.mjs';
|
|
9
23
|
import { NodeStack } from '../shared/stack.mjs';
|
|
10
24
|
import { scaleCorrectors } from '../styles/scale-correction.mjs';
|
|
11
25
|
import { buildProjectionTransform } from '../styles/transform.mjs';
|
|
12
26
|
import { eachAxis } from '../utils/each-axis.mjs';
|
|
13
27
|
import { hasTransform, hasScale, has2DTranslate } from '../utils/has-transform.mjs';
|
|
14
|
-
import { FlatTree } from '../../render/utils/flat-tree.mjs';
|
|
15
|
-
import { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';
|
|
16
28
|
import { globalProjectionState } from './state.mjs';
|
|
17
|
-
import { delay } from '../../utils/delay.mjs';
|
|
18
|
-
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
19
|
-
import { isSVGElement } from '../../render/dom/utils/is-svg-element.mjs';
|
|
20
|
-
import { animateSingleValue } from '../../animation/animate/single-value.mjs';
|
|
21
|
-
import { clamp } from '../../utils/clamp.mjs';
|
|
22
|
-
import { cancelFrame, frameData, frameSteps, frame } from '../../frameloop/frame.mjs';
|
|
23
|
-
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
24
|
-
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
25
|
-
import { time } from '../../frameloop/sync-time.mjs';
|
|
26
|
-
import { microtask } from '../../frameloop/microtask.mjs';
|
|
27
|
-
import { getOptimisedAppearId } from '../../animation/optimized-appear/get-appear-id.mjs';
|
|
28
|
-
import { createBox, createDelta } from '../geometry/models.mjs';
|
|
29
29
|
|
|
30
30
|
const metrics = {
|
|
31
31
|
type: "projectionFrame",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { observeTimeline } from './observe.mjs';
|
|
3
|
-
import { supportsScrollTimeline } from './supports.mjs';
|
|
1
|
+
import { supportsScrollTimeline } from '../../../../../../motion-dom/dist/es/utils/supports/scroll-timeline.mjs';
|
|
4
2
|
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
5
3
|
import { noop } from '../../../../../../motion-utils/dist/es/noop.mjs';
|
|
4
|
+
import { observeTimeline } from './observe.mjs';
|
|
5
|
+
import { scrollInfo } from './track.mjs';
|
|
6
6
|
|
|
7
7
|
function scrollTimelineFallback({ source, container, axis = "y", }) {
|
|
8
8
|
// Support legacy source argument. Deprecate later.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { progress } from '../../../../../../motion-utils/dist/es/progress.mjs';
|
|
2
3
|
import { velocityPerSecond } from '../../../utils/velocity-per-second.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -17,7 +17,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
17
17
|
* and warn against mismatches.
|
|
18
18
|
*/
|
|
19
19
|
if (process.env.NODE_ENV === "development") {
|
|
20
|
-
warnOnce(nextValue.version === "11.
|
|
20
|
+
warnOnce(nextValue.version === "11.16.1", `Attempting to mix Motion versions ${nextValue.version} with 11.16.1 may not work as expected.`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
else if (isMotionValue(prevValue)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import '../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { secondsToMilliseconds } from '../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
1
3
|
import { time } from '../frameloop/sync-time.mjs';
|
|
2
|
-
import { secondsToMilliseconds } from './time-conversion.mjs';
|
|
3
4
|
import { frame, cancelFrame } from '../frameloop/frame.mjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { clamp } from './clamp.mjs';
|
|
2
|
-
import { pipe } from './pipe.mjs';
|
|
3
|
-
import { progress } from './progress.mjs';
|
|
4
1
|
import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
5
2
|
import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
|
|
3
|
+
import { progress } from '../../../../motion-utils/dist/es/progress.mjs';
|
|
4
|
+
import { clamp } from './clamp.mjs';
|
|
6
5
|
import { mix } from './mix/index.mjs';
|
|
6
|
+
import { pipe } from './pipe.mjs';
|
|
7
7
|
|
|
8
8
|
function createMixers(output, ease, customMixer) {
|
|
9
9
|
const mixers = [];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { progress } from '../../../../../motion-utils/dist/es/progress.mjs';
|
|
1
3
|
import { mixNumber } from '../mix/number.mjs';
|
|
2
|
-
import { progress } from '../progress.mjs';
|
|
3
4
|
|
|
4
5
|
function fillOffset(offset, remaining) {
|
|
5
6
|
const min = offset[offset.length - 1];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { time } from '../frameloop/sync-time.mjs';
|
|
1
2
|
import { SubscriptionManager } from '../utils/subscription-manager.mjs';
|
|
2
3
|
import { velocityPerSecond } from '../utils/velocity-per-second.mjs';
|
|
3
4
|
import { warnOnce } from '../utils/warn-once.mjs';
|
|
4
|
-
import { time } from '../frameloop/sync-time.mjs';
|
|
5
5
|
import { frame } from '../frameloop/frame.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -34,7 +34,7 @@ class MotionValue {
|
|
|
34
34
|
* This will be replaced by the build step with the latest version number.
|
|
35
35
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
36
36
|
*/
|
|
37
|
-
this.version = "11.
|
|
37
|
+
this.version = "11.16.1";
|
|
38
38
|
/**
|
|
39
39
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
40
40
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useContext, useRef, useInsertionEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { useMotionValue } from './use-motion-value.mjs';
|
|
2
|
+
import { animateValue } from '../animation/animators/MainThreadAnimation.mjs';
|
|
4
3
|
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
5
4
|
import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
|
|
6
|
-
import {
|
|
5
|
+
import { useMotionValue } from './use-motion-value.mjs';
|
|
6
|
+
import { isMotionValue } from './utils/is-motion-value.mjs';
|
|
7
7
|
import { frame, frameData } from '../frameloop/frame.mjs';
|
|
8
8
|
|
|
9
9
|
function toNumber(v) {
|