motion-v 1.0.0-alpha.4 → 1.0.0-beta.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/dist/cjs/index.js +1063 -265
- package/dist/es/components/animate-presence/AnimatePresence.d.ts +1 -1
- package/dist/es/components/animate-presence/use-pop-layout.mjs +2 -1
- package/dist/es/components/motion/props.d.ts +0 -6
- package/dist/es/components/motion/props.mjs +1 -3
- package/dist/es/components/motion/use-motion-state.d.ts +41 -41
- package/dist/es/components/motion/use-motion-state.mjs +5 -3
- package/dist/es/components/motion/utils.mjs +4 -2
- package/dist/es/components/reorder/index.d.ts +160 -160
- package/dist/es/components/reorder/utils.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animate/index.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animate/single-value.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +4 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +2 -3
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +3 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +1 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +4 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/waapi/index.mjs +2 -9
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/generators/spring/index.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/interfaces/motion-value.mjs +3 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +3 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/sequence/create.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/easing/utils/map.mjs +1 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/projection/node/create-projection-node.mjs +4 -24
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/VisualElement.mjs +3 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/resize/handle-element.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/scroll/index.mjs +1 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/scroll/observe.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/scroll/track.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/viewport/index.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/utils/setters.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/utils/delay.mjs +2 -1
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/controls/BaseGroup.mjs +79 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/controls/Group.mjs +9 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs +15 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs +17 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/utils/get-value-transition.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs +81 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/attach-timeline.mjs +7 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/easing.mjs +37 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/linear.mjs +13 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/batcher.mjs +64 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs +10 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/microtask.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/order.mjs +17 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/render-step.mjs +70 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/sync-time.mjs +22 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/drag/state/is-active.mjs +11 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/hover.mjs +30 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/press/index.mjs +74 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.mjs +13 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/press/utils/keyboard.mjs +32 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/press/utils/state.mjs +4 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/utils/capture-pointer.mjs +12 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/utils/is-node-or-child.mjs +12 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs +10 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/utils/setup.mjs +15 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/stats/buffer.mjs +7 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/is-bezier-definition.mjs +4 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/resolve-elements.mjs +17 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/flags.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/linear-easing.mjs +12 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/memo.mjs +13 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/scroll-timeline.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/value/index.mjs +277 -0
- package/dist/es/external/.pnpm/motion-utils@12.5.0/external/motion-utils/dist/es/global-config.mjs +7 -0
- package/dist/es/features/gestures/drag/VisualElementDragControls.mjs +2 -1
- package/dist/es/features/gestures/hover/index.mjs +3 -1
- package/dist/es/features/gestures/in-view/index.mjs +2 -1
- package/dist/es/features/gestures/pan/PanSession.mjs +2 -1
- package/dist/es/features/gestures/pan/index.mjs +1 -1
- package/dist/es/features/gestures/press/index.mjs +3 -1
- package/dist/es/index.mjs +6 -1
- package/dist/es/state/create-visual-element.d.ts +2 -1
- package/dist/es/state/motion-state.mjs +1 -1
- package/dist/es/state/style.mjs +4 -0
- package/dist/es/state/utils.d.ts +2 -4
- package/dist/es/types/common.d.ts +1 -1
- package/dist/es/utils/use-animation-frame.mjs +2 -1
- package/dist/es/value/use-combine-values.mjs +3 -1
- package/dist/es/value/use-computed.mjs +2 -1
- package/dist/es/value/use-scroll.mjs +2 -1
- package/dist/es/value/use-spring.mjs +3 -1
- package/dist/es/value/use-time.mjs +2 -1
- package/dist/es/value/use-velocity.mjs +3 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const heyListen = require("hey-listen");
|
|
5
|
-
const motionDom = require("motion-dom");
|
|
6
5
|
const core = require("@vueuse/core");
|
|
7
6
|
function addUniqueItem(arr, item) {
|
|
8
7
|
if (arr.indexOf(item) === -1)
|
|
@@ -28,6 +27,10 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
29
|
}
|
|
30
|
+
const MotionGlobalConfig = {
|
|
31
|
+
skipAnimations: false,
|
|
32
|
+
useManualTiming: false
|
|
33
|
+
};
|
|
31
34
|
// @__NO_SIDE_EFFECTS__
|
|
32
35
|
function memo(callback) {
|
|
33
36
|
let result;
|
|
@@ -81,6 +84,858 @@ function warnOnce(condition, message, element) {
|
|
|
81
84
|
console.warn(message);
|
|
82
85
|
warned.add(message);
|
|
83
86
|
}
|
|
87
|
+
const supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== void 0);
|
|
88
|
+
class BaseGroupPlaybackControls {
|
|
89
|
+
constructor(animations) {
|
|
90
|
+
this.stop = () => this.runAll("stop");
|
|
91
|
+
this.animations = animations.filter(Boolean);
|
|
92
|
+
}
|
|
93
|
+
get finished() {
|
|
94
|
+
return Promise.all(this.animations.map((animation) => "finished" in animation ? animation.finished : animation));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* TODO: Filter out cancelled or stopped animations before returning
|
|
98
|
+
*/
|
|
99
|
+
getAll(propName) {
|
|
100
|
+
return this.animations[0][propName];
|
|
101
|
+
}
|
|
102
|
+
setAll(propName, newValue) {
|
|
103
|
+
for (let i = 0; i < this.animations.length; i++) {
|
|
104
|
+
this.animations[i][propName] = newValue;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
attachTimeline(timeline, fallback) {
|
|
108
|
+
const subscriptions = this.animations.map((animation) => {
|
|
109
|
+
if (supportsScrollTimeline() && animation.attachTimeline) {
|
|
110
|
+
return animation.attachTimeline(timeline);
|
|
111
|
+
} else if (typeof fallback === "function") {
|
|
112
|
+
return fallback(animation);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return () => {
|
|
116
|
+
subscriptions.forEach((cancel, i) => {
|
|
117
|
+
cancel && cancel();
|
|
118
|
+
this.animations[i].stop();
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
get time() {
|
|
123
|
+
return this.getAll("time");
|
|
124
|
+
}
|
|
125
|
+
set time(time2) {
|
|
126
|
+
this.setAll("time", time2);
|
|
127
|
+
}
|
|
128
|
+
get speed() {
|
|
129
|
+
return this.getAll("speed");
|
|
130
|
+
}
|
|
131
|
+
set speed(speed) {
|
|
132
|
+
this.setAll("speed", speed);
|
|
133
|
+
}
|
|
134
|
+
get startTime() {
|
|
135
|
+
return this.getAll("startTime");
|
|
136
|
+
}
|
|
137
|
+
get duration() {
|
|
138
|
+
let max = 0;
|
|
139
|
+
for (let i = 0; i < this.animations.length; i++) {
|
|
140
|
+
max = Math.max(max, this.animations[i].duration);
|
|
141
|
+
}
|
|
142
|
+
return max;
|
|
143
|
+
}
|
|
144
|
+
runAll(methodName) {
|
|
145
|
+
this.animations.forEach((controls) => controls[methodName]());
|
|
146
|
+
}
|
|
147
|
+
flatten() {
|
|
148
|
+
this.runAll("flatten");
|
|
149
|
+
}
|
|
150
|
+
play() {
|
|
151
|
+
this.runAll("play");
|
|
152
|
+
}
|
|
153
|
+
pause() {
|
|
154
|
+
this.runAll("pause");
|
|
155
|
+
}
|
|
156
|
+
cancel() {
|
|
157
|
+
this.runAll("cancel");
|
|
158
|
+
}
|
|
159
|
+
complete() {
|
|
160
|
+
this.runAll("complete");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
class GroupPlaybackControls extends BaseGroupPlaybackControls {
|
|
164
|
+
then(onResolve, onReject) {
|
|
165
|
+
return Promise.all(this.animations).then(onResolve).catch(onReject);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function getValueTransition$1(transition, key) {
|
|
169
|
+
return transition ? transition[key] || transition["default"] || transition : void 0;
|
|
170
|
+
}
|
|
171
|
+
const maxGeneratorDuration = 2e4;
|
|
172
|
+
function calcGeneratorDuration(generator) {
|
|
173
|
+
let duration = 0;
|
|
174
|
+
const timeStep = 50;
|
|
175
|
+
let state2 = generator.next(duration);
|
|
176
|
+
while (!state2.done && duration < maxGeneratorDuration) {
|
|
177
|
+
duration += timeStep;
|
|
178
|
+
state2 = generator.next(duration);
|
|
179
|
+
}
|
|
180
|
+
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
181
|
+
}
|
|
182
|
+
function createGeneratorEasing(options, scale2 = 100, createGenerator) {
|
|
183
|
+
const generator = createGenerator({ ...options, keyframes: [0, scale2] });
|
|
184
|
+
const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
185
|
+
return {
|
|
186
|
+
type: "keyframes",
|
|
187
|
+
ease: (progress2) => {
|
|
188
|
+
return generator.next(duration * progress2).value / scale2;
|
|
189
|
+
},
|
|
190
|
+
duration: /* @__PURE__ */ millisecondsToSeconds$1(duration)
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function isGenerator(type) {
|
|
194
|
+
return typeof type === "function";
|
|
195
|
+
}
|
|
196
|
+
function attachTimeline(animation, timeline) {
|
|
197
|
+
animation.timeline = timeline;
|
|
198
|
+
animation.onfinish = null;
|
|
199
|
+
}
|
|
200
|
+
class NativeAnimationControls {
|
|
201
|
+
constructor(animation) {
|
|
202
|
+
this.animation = animation;
|
|
203
|
+
}
|
|
204
|
+
get duration() {
|
|
205
|
+
var _a, _b, _c;
|
|
206
|
+
const durationInMs = ((_b = (_a = this.animation) === null || _a === void 0 ? void 0 : _a.effect) === null || _b === void 0 ? void 0 : _b.getComputedTiming().duration) || ((_c = this.options) === null || _c === void 0 ? void 0 : _c.duration) || 300;
|
|
207
|
+
return /* @__PURE__ */ millisecondsToSeconds$1(Number(durationInMs));
|
|
208
|
+
}
|
|
209
|
+
get time() {
|
|
210
|
+
var _a;
|
|
211
|
+
if (this.animation) {
|
|
212
|
+
return /* @__PURE__ */ millisecondsToSeconds$1(((_a = this.animation) === null || _a === void 0 ? void 0 : _a.currentTime) || 0);
|
|
213
|
+
}
|
|
214
|
+
return 0;
|
|
215
|
+
}
|
|
216
|
+
set time(newTime) {
|
|
217
|
+
if (this.animation) {
|
|
218
|
+
this.animation.currentTime = /* @__PURE__ */ secondsToMilliseconds$1(newTime);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
get speed() {
|
|
222
|
+
return this.animation ? this.animation.playbackRate : 1;
|
|
223
|
+
}
|
|
224
|
+
set speed(newSpeed) {
|
|
225
|
+
if (this.animation) {
|
|
226
|
+
this.animation.playbackRate = newSpeed;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
get state() {
|
|
230
|
+
return this.animation ? this.animation.playState : "finished";
|
|
231
|
+
}
|
|
232
|
+
get startTime() {
|
|
233
|
+
return this.animation ? this.animation.startTime : null;
|
|
234
|
+
}
|
|
235
|
+
get finished() {
|
|
236
|
+
return this.animation ? this.animation.finished : Promise.resolve();
|
|
237
|
+
}
|
|
238
|
+
play() {
|
|
239
|
+
this.animation && this.animation.play();
|
|
240
|
+
}
|
|
241
|
+
pause() {
|
|
242
|
+
this.animation && this.animation.pause();
|
|
243
|
+
}
|
|
244
|
+
stop() {
|
|
245
|
+
if (!this.animation || this.state === "idle" || this.state === "finished") {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (this.animation.commitStyles) {
|
|
249
|
+
this.animation.commitStyles();
|
|
250
|
+
}
|
|
251
|
+
this.cancel();
|
|
252
|
+
}
|
|
253
|
+
flatten() {
|
|
254
|
+
var _a, _b;
|
|
255
|
+
if (!this.animation || !((_a = this.options) === null || _a === void 0 ? void 0 : _a.allowFlatten))
|
|
256
|
+
return;
|
|
257
|
+
(_b = this.animation.effect) === null || _b === void 0 ? void 0 : _b.updateTiming({ easing: "linear" });
|
|
258
|
+
}
|
|
259
|
+
attachTimeline(timeline) {
|
|
260
|
+
if (this.animation)
|
|
261
|
+
attachTimeline(this.animation, timeline);
|
|
262
|
+
return noop;
|
|
263
|
+
}
|
|
264
|
+
complete() {
|
|
265
|
+
this.animation && this.animation.finish();
|
|
266
|
+
}
|
|
267
|
+
cancel() {
|
|
268
|
+
try {
|
|
269
|
+
this.animation && this.animation.cancel();
|
|
270
|
+
} catch (e) {
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
|
|
275
|
+
const supportsFlags = {
|
|
276
|
+
linearEasing: void 0
|
|
277
|
+
};
|
|
278
|
+
function memoSupports(callback, supportsFlag) {
|
|
279
|
+
const memoized = /* @__PURE__ */ memo(callback);
|
|
280
|
+
return () => {
|
|
281
|
+
var _a;
|
|
282
|
+
return (_a = supportsFlags[supportsFlag]) !== null && _a !== void 0 ? _a : memoized();
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
286
|
+
try {
|
|
287
|
+
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
288
|
+
} catch (e) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
return true;
|
|
292
|
+
}, "linearEasing");
|
|
293
|
+
const generateLinearEasing = (easing, duration, resolution = 10) => {
|
|
294
|
+
let points = "";
|
|
295
|
+
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
296
|
+
for (let i = 0; i < numPoints; i++) {
|
|
297
|
+
points += easing(/* @__PURE__ */ progress$1(0, numPoints - 1, i)) + ", ";
|
|
298
|
+
}
|
|
299
|
+
return `linear(${points.substring(0, points.length - 2)})`;
|
|
300
|
+
};
|
|
301
|
+
function isWaapiSupportedEasing(easing) {
|
|
302
|
+
return Boolean(typeof easing === "function" && supportsLinearEasing() || !easing || typeof easing === "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
|
|
303
|
+
}
|
|
304
|
+
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
|
|
305
|
+
const supportedWaapiEasing = {
|
|
306
|
+
linear: "linear",
|
|
307
|
+
ease: "ease",
|
|
308
|
+
easeIn: "ease-in",
|
|
309
|
+
easeOut: "ease-out",
|
|
310
|
+
easeInOut: "ease-in-out",
|
|
311
|
+
circIn: /* @__PURE__ */ cubicBezierAsString([0, 0.65, 0.55, 1]),
|
|
312
|
+
circOut: /* @__PURE__ */ cubicBezierAsString([0.55, 0, 1, 0.45]),
|
|
313
|
+
backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
|
|
314
|
+
backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
|
|
315
|
+
};
|
|
316
|
+
function mapEasingToNativeEasing(easing, duration) {
|
|
317
|
+
if (!easing) {
|
|
318
|
+
return void 0;
|
|
319
|
+
} else if (typeof easing === "function" && supportsLinearEasing()) {
|
|
320
|
+
return generateLinearEasing(easing, duration);
|
|
321
|
+
} else if (isBezierDefinition(easing)) {
|
|
322
|
+
return cubicBezierAsString(easing);
|
|
323
|
+
} else if (Array.isArray(easing)) {
|
|
324
|
+
return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut);
|
|
325
|
+
} else {
|
|
326
|
+
return supportedWaapiEasing[easing];
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const stepsOrder = [
|
|
330
|
+
"read",
|
|
331
|
+
// Read
|
|
332
|
+
"resolveKeyframes",
|
|
333
|
+
// Write/Read/Write/Read
|
|
334
|
+
"update",
|
|
335
|
+
// Compute
|
|
336
|
+
"preRender",
|
|
337
|
+
// Compute
|
|
338
|
+
"render",
|
|
339
|
+
// Write
|
|
340
|
+
"postRender"
|
|
341
|
+
// Compute
|
|
342
|
+
];
|
|
343
|
+
const statsBuffer = {
|
|
344
|
+
value: null,
|
|
345
|
+
addProjectionMetrics: null
|
|
346
|
+
};
|
|
347
|
+
function createRenderStep(runNextFrame, stepName) {
|
|
348
|
+
let thisFrame = /* @__PURE__ */ new Set();
|
|
349
|
+
let nextFrame = /* @__PURE__ */ new Set();
|
|
350
|
+
let isProcessing = false;
|
|
351
|
+
let flushNextFrame = false;
|
|
352
|
+
const toKeepAlive = /* @__PURE__ */ new WeakSet();
|
|
353
|
+
let latestFrameData = {
|
|
354
|
+
delta: 0,
|
|
355
|
+
timestamp: 0,
|
|
356
|
+
isProcessing: false
|
|
357
|
+
};
|
|
358
|
+
let numCalls = 0;
|
|
359
|
+
function triggerCallback(callback) {
|
|
360
|
+
if (toKeepAlive.has(callback)) {
|
|
361
|
+
step.schedule(callback);
|
|
362
|
+
runNextFrame();
|
|
363
|
+
}
|
|
364
|
+
numCalls++;
|
|
365
|
+
callback(latestFrameData);
|
|
366
|
+
}
|
|
367
|
+
const step = {
|
|
368
|
+
/**
|
|
369
|
+
* Schedule a process to run on the next frame.
|
|
370
|
+
*/
|
|
371
|
+
schedule: (callback, keepAlive = false, immediate = false) => {
|
|
372
|
+
const addToCurrentFrame = immediate && isProcessing;
|
|
373
|
+
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
374
|
+
if (keepAlive)
|
|
375
|
+
toKeepAlive.add(callback);
|
|
376
|
+
if (!queue.has(callback))
|
|
377
|
+
queue.add(callback);
|
|
378
|
+
return callback;
|
|
379
|
+
},
|
|
380
|
+
/**
|
|
381
|
+
* Cancel the provided callback from running on the next frame.
|
|
382
|
+
*/
|
|
383
|
+
cancel: (callback) => {
|
|
384
|
+
nextFrame.delete(callback);
|
|
385
|
+
toKeepAlive.delete(callback);
|
|
386
|
+
},
|
|
387
|
+
/**
|
|
388
|
+
* Execute all schedule callbacks.
|
|
389
|
+
*/
|
|
390
|
+
process: (frameData2) => {
|
|
391
|
+
latestFrameData = frameData2;
|
|
392
|
+
if (isProcessing) {
|
|
393
|
+
flushNextFrame = true;
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
isProcessing = true;
|
|
397
|
+
[thisFrame, nextFrame] = [nextFrame, thisFrame];
|
|
398
|
+
thisFrame.forEach(triggerCallback);
|
|
399
|
+
if (stepName && statsBuffer.value) {
|
|
400
|
+
statsBuffer.value.frameloop[stepName].push(numCalls);
|
|
401
|
+
}
|
|
402
|
+
numCalls = 0;
|
|
403
|
+
thisFrame.clear();
|
|
404
|
+
isProcessing = false;
|
|
405
|
+
if (flushNextFrame) {
|
|
406
|
+
flushNextFrame = false;
|
|
407
|
+
step.process(frameData2);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
return step;
|
|
412
|
+
}
|
|
413
|
+
const maxElapsed$1 = 40;
|
|
414
|
+
function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
415
|
+
let runNextFrame = false;
|
|
416
|
+
let useDefaultElapsed = true;
|
|
417
|
+
const state2 = {
|
|
418
|
+
delta: 0,
|
|
419
|
+
timestamp: 0,
|
|
420
|
+
isProcessing: false
|
|
421
|
+
};
|
|
422
|
+
const flagRunNextFrame = () => runNextFrame = true;
|
|
423
|
+
const steps2 = stepsOrder.reduce((acc, key) => {
|
|
424
|
+
acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : void 0);
|
|
425
|
+
return acc;
|
|
426
|
+
}, {});
|
|
427
|
+
const { read, resolveKeyframes, update, preRender, render, postRender } = steps2;
|
|
428
|
+
const processBatch = () => {
|
|
429
|
+
const timestamp = performance.now();
|
|
430
|
+
runNextFrame = false;
|
|
431
|
+
{
|
|
432
|
+
state2.delta = useDefaultElapsed ? 1e3 / 60 : Math.max(Math.min(timestamp - state2.timestamp, maxElapsed$1), 1);
|
|
433
|
+
}
|
|
434
|
+
state2.timestamp = timestamp;
|
|
435
|
+
state2.isProcessing = true;
|
|
436
|
+
read.process(state2);
|
|
437
|
+
resolveKeyframes.process(state2);
|
|
438
|
+
update.process(state2);
|
|
439
|
+
preRender.process(state2);
|
|
440
|
+
render.process(state2);
|
|
441
|
+
postRender.process(state2);
|
|
442
|
+
state2.isProcessing = false;
|
|
443
|
+
if (runNextFrame && allowKeepAlive) {
|
|
444
|
+
useDefaultElapsed = false;
|
|
445
|
+
scheduleNextBatch(processBatch);
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
const wake = () => {
|
|
449
|
+
runNextFrame = true;
|
|
450
|
+
useDefaultElapsed = true;
|
|
451
|
+
if (!state2.isProcessing) {
|
|
452
|
+
scheduleNextBatch(processBatch);
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
const schedule = stepsOrder.reduce((acc, key) => {
|
|
456
|
+
const step = steps2[key];
|
|
457
|
+
acc[key] = (process2, keepAlive = false, immediate = false) => {
|
|
458
|
+
if (!runNextFrame)
|
|
459
|
+
wake();
|
|
460
|
+
return step.schedule(process2, keepAlive, immediate);
|
|
461
|
+
};
|
|
462
|
+
return acc;
|
|
463
|
+
}, {});
|
|
464
|
+
const cancel = (process2) => {
|
|
465
|
+
for (let i = 0; i < stepsOrder.length; i++) {
|
|
466
|
+
steps2[stepsOrder[i]].cancel(process2);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
return { schedule, cancel, state: state2, steps: steps2 };
|
|
470
|
+
}
|
|
471
|
+
const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
|
|
472
|
+
const { schedule: microtask, cancel: cancelMicrotask } = /* @__PURE__ */ createRenderBatcher(queueMicrotask, false);
|
|
473
|
+
let now;
|
|
474
|
+
function clearTime() {
|
|
475
|
+
now = void 0;
|
|
476
|
+
}
|
|
477
|
+
const time = {
|
|
478
|
+
now: () => {
|
|
479
|
+
if (now === void 0) {
|
|
480
|
+
time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming ? frameData.timestamp : performance.now());
|
|
481
|
+
}
|
|
482
|
+
return now;
|
|
483
|
+
},
|
|
484
|
+
set: (newTime) => {
|
|
485
|
+
now = newTime;
|
|
486
|
+
queueMicrotask(clearTime);
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
const isDragging = {
|
|
490
|
+
x: false,
|
|
491
|
+
y: false
|
|
492
|
+
};
|
|
493
|
+
function isDragActive() {
|
|
494
|
+
return isDragging.y;
|
|
495
|
+
}
|
|
496
|
+
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
497
|
+
var _a;
|
|
498
|
+
if (elementOrSelector instanceof EventTarget) {
|
|
499
|
+
return [elementOrSelector];
|
|
500
|
+
} else if (typeof elementOrSelector === "string") {
|
|
501
|
+
let root = document;
|
|
502
|
+
if (scope) {
|
|
503
|
+
root = scope.current;
|
|
504
|
+
}
|
|
505
|
+
const elements = (_a = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
|
|
506
|
+
return elements ? Array.from(elements) : [];
|
|
507
|
+
}
|
|
508
|
+
return Array.from(elementOrSelector);
|
|
509
|
+
}
|
|
510
|
+
function setupGesture(elementOrSelector, options) {
|
|
511
|
+
const elements = resolveElements(elementOrSelector);
|
|
512
|
+
const gestureAbortController = new AbortController();
|
|
513
|
+
const eventOptions = {
|
|
514
|
+
passive: true,
|
|
515
|
+
...options,
|
|
516
|
+
signal: gestureAbortController.signal
|
|
517
|
+
};
|
|
518
|
+
const cancel = () => gestureAbortController.abort();
|
|
519
|
+
return [elements, eventOptions, cancel];
|
|
520
|
+
}
|
|
521
|
+
function isValidHover(event) {
|
|
522
|
+
return !(event.pointerType === "touch" || isDragActive());
|
|
523
|
+
}
|
|
524
|
+
function hover(elementOrSelector, onHoverStart, options = {}) {
|
|
525
|
+
const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options);
|
|
526
|
+
const onPointerEnter = (enterEvent) => {
|
|
527
|
+
if (!isValidHover(enterEvent))
|
|
528
|
+
return;
|
|
529
|
+
const { target } = enterEvent;
|
|
530
|
+
const onHoverEnd = onHoverStart(target, enterEvent);
|
|
531
|
+
if (typeof onHoverEnd !== "function" || !target)
|
|
532
|
+
return;
|
|
533
|
+
const onPointerLeave = (leaveEvent) => {
|
|
534
|
+
if (!isValidHover(leaveEvent))
|
|
535
|
+
return;
|
|
536
|
+
onHoverEnd(leaveEvent);
|
|
537
|
+
target.removeEventListener("pointerleave", onPointerLeave);
|
|
538
|
+
};
|
|
539
|
+
target.addEventListener("pointerleave", onPointerLeave, eventOptions);
|
|
540
|
+
};
|
|
541
|
+
elements.forEach((element) => {
|
|
542
|
+
element.addEventListener("pointerenter", onPointerEnter, eventOptions);
|
|
543
|
+
});
|
|
544
|
+
return cancel;
|
|
545
|
+
}
|
|
546
|
+
function capturePointer(event, action) {
|
|
547
|
+
const actionName = `${action}PointerCapture`;
|
|
548
|
+
if (event.target instanceof Element && actionName in event.target && event.pointerId !== void 0) {
|
|
549
|
+
try {
|
|
550
|
+
event.target[actionName](event.pointerId);
|
|
551
|
+
} catch (e) {
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
const isNodeOrChild = (parent, child) => {
|
|
556
|
+
if (!child) {
|
|
557
|
+
return false;
|
|
558
|
+
} else if (parent === child) {
|
|
559
|
+
return true;
|
|
560
|
+
} else {
|
|
561
|
+
return isNodeOrChild(parent, child.parentElement);
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
const isPrimaryPointer$1 = (event) => {
|
|
565
|
+
if (event.pointerType === "mouse") {
|
|
566
|
+
return typeof event.button !== "number" || event.button <= 0;
|
|
567
|
+
} else {
|
|
568
|
+
return event.isPrimary !== false;
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
const focusableElements = /* @__PURE__ */ new Set([
|
|
572
|
+
"BUTTON",
|
|
573
|
+
"INPUT",
|
|
574
|
+
"SELECT",
|
|
575
|
+
"TEXTAREA",
|
|
576
|
+
"A"
|
|
577
|
+
]);
|
|
578
|
+
function isElementKeyboardAccessible(element) {
|
|
579
|
+
return focusableElements.has(element.tagName) || element.tabIndex !== -1;
|
|
580
|
+
}
|
|
581
|
+
const isPressing = /* @__PURE__ */ new WeakSet();
|
|
582
|
+
function filterEvents(callback) {
|
|
583
|
+
return (event) => {
|
|
584
|
+
if (event.key !== "Enter")
|
|
585
|
+
return;
|
|
586
|
+
callback(event);
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function firePointerEvent(target, type) {
|
|
590
|
+
target.dispatchEvent(new PointerEvent("pointer" + type, { isPrimary: true, bubbles: true }));
|
|
591
|
+
}
|
|
592
|
+
const enableKeyboardPress = (focusEvent, eventOptions) => {
|
|
593
|
+
const element = focusEvent.currentTarget;
|
|
594
|
+
if (!element)
|
|
595
|
+
return;
|
|
596
|
+
const handleKeydown = filterEvents(() => {
|
|
597
|
+
if (isPressing.has(element))
|
|
598
|
+
return;
|
|
599
|
+
firePointerEvent(element, "down");
|
|
600
|
+
const handleKeyup = filterEvents(() => {
|
|
601
|
+
firePointerEvent(element, "up");
|
|
602
|
+
});
|
|
603
|
+
const handleBlur = () => firePointerEvent(element, "cancel");
|
|
604
|
+
element.addEventListener("keyup", handleKeyup, eventOptions);
|
|
605
|
+
element.addEventListener("blur", handleBlur, eventOptions);
|
|
606
|
+
});
|
|
607
|
+
element.addEventListener("keydown", handleKeydown, eventOptions);
|
|
608
|
+
element.addEventListener("blur", () => element.removeEventListener("keydown", handleKeydown), eventOptions);
|
|
609
|
+
};
|
|
610
|
+
function isValidPressEvent(event) {
|
|
611
|
+
return isPrimaryPointer$1(event) && !isDragActive();
|
|
612
|
+
}
|
|
613
|
+
function press(targetOrSelector, onPressStart, options = {}) {
|
|
614
|
+
const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);
|
|
615
|
+
const startPress = (startEvent) => {
|
|
616
|
+
const target = startEvent.currentTarget;
|
|
617
|
+
if (!target || !isValidPressEvent(startEvent) || isPressing.has(target))
|
|
618
|
+
return;
|
|
619
|
+
isPressing.add(target);
|
|
620
|
+
capturePointer(startEvent, "set");
|
|
621
|
+
const onPressEnd = onPressStart(target, startEvent);
|
|
622
|
+
const onPointerEnd = (endEvent, success) => {
|
|
623
|
+
target.removeEventListener("pointerup", onPointerUp);
|
|
624
|
+
target.removeEventListener("pointercancel", onPointerCancel);
|
|
625
|
+
capturePointer(endEvent, "release");
|
|
626
|
+
if (!isValidPressEvent(endEvent) || !isPressing.has(target)) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
isPressing.delete(target);
|
|
630
|
+
if (typeof onPressEnd === "function") {
|
|
631
|
+
onPressEnd(endEvent, { success });
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
const onPointerUp = (upEvent) => {
|
|
635
|
+
const isOutside = !upEvent.isTrusted ? false : checkOutside(upEvent, target instanceof Element ? target.getBoundingClientRect() : {
|
|
636
|
+
left: 0,
|
|
637
|
+
top: 0,
|
|
638
|
+
right: window.innerWidth,
|
|
639
|
+
bottom: window.innerHeight
|
|
640
|
+
});
|
|
641
|
+
if (isOutside) {
|
|
642
|
+
onPointerEnd(upEvent, false);
|
|
643
|
+
} else {
|
|
644
|
+
onPointerEnd(upEvent, !(target instanceof Element) || isNodeOrChild(target, upEvent.target));
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
const onPointerCancel = (cancelEvent) => {
|
|
648
|
+
onPointerEnd(cancelEvent, false);
|
|
649
|
+
};
|
|
650
|
+
target.addEventListener("pointerup", onPointerUp, eventOptions);
|
|
651
|
+
target.addEventListener("pointercancel", onPointerCancel, eventOptions);
|
|
652
|
+
target.addEventListener("lostpointercapture", onPointerCancel, eventOptions);
|
|
653
|
+
};
|
|
654
|
+
targets.forEach((target) => {
|
|
655
|
+
target = options.useGlobalTarget ? window : target;
|
|
656
|
+
let canAddKeyboardAccessibility = false;
|
|
657
|
+
if (target instanceof HTMLElement) {
|
|
658
|
+
canAddKeyboardAccessibility = true;
|
|
659
|
+
if (!isElementKeyboardAccessible(target) && target.getAttribute("tabindex") === null) {
|
|
660
|
+
target.tabIndex = 0;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
target.addEventListener("pointerdown", startPress, eventOptions);
|
|
664
|
+
if (canAddKeyboardAccessibility) {
|
|
665
|
+
target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions), eventOptions);
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
return cancelEvents;
|
|
669
|
+
}
|
|
670
|
+
function checkOutside(event, rect) {
|
|
671
|
+
return event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom;
|
|
672
|
+
}
|
|
673
|
+
const MAX_VELOCITY_DELTA = 30;
|
|
674
|
+
const isFloat = (value) => {
|
|
675
|
+
return !isNaN(parseFloat(value));
|
|
676
|
+
};
|
|
677
|
+
const collectMotionValues = {
|
|
678
|
+
current: void 0
|
|
679
|
+
};
|
|
680
|
+
class MotionValue {
|
|
681
|
+
/**
|
|
682
|
+
* @param init - The initiating value
|
|
683
|
+
* @param config - Optional configuration options
|
|
684
|
+
*
|
|
685
|
+
* - `transformer`: A function to transform incoming values with.
|
|
686
|
+
*/
|
|
687
|
+
constructor(init, options = {}) {
|
|
688
|
+
this.version = "12.5.0";
|
|
689
|
+
this.canTrackVelocity = null;
|
|
690
|
+
this.events = {};
|
|
691
|
+
this.updateAndNotify = (v, render = true) => {
|
|
692
|
+
const currentTime = time.now();
|
|
693
|
+
if (this.updatedAt !== currentTime) {
|
|
694
|
+
this.setPrevFrameValue();
|
|
695
|
+
}
|
|
696
|
+
this.prev = this.current;
|
|
697
|
+
this.setCurrent(v);
|
|
698
|
+
if (this.current !== this.prev && this.events.change) {
|
|
699
|
+
this.events.change.notify(this.current);
|
|
700
|
+
}
|
|
701
|
+
if (render && this.events.renderRequest) {
|
|
702
|
+
this.events.renderRequest.notify(this.current);
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
this.hasAnimated = false;
|
|
706
|
+
this.setCurrent(init);
|
|
707
|
+
this.owner = options.owner;
|
|
708
|
+
}
|
|
709
|
+
setCurrent(current) {
|
|
710
|
+
this.current = current;
|
|
711
|
+
this.updatedAt = time.now();
|
|
712
|
+
if (this.canTrackVelocity === null && current !== void 0) {
|
|
713
|
+
this.canTrackVelocity = isFloat(this.current);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
setPrevFrameValue(prevFrameValue = this.current) {
|
|
717
|
+
this.prevFrameValue = prevFrameValue;
|
|
718
|
+
this.prevUpdatedAt = this.updatedAt;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
722
|
+
*
|
|
723
|
+
* It returns a function that, when called, will cancel the subscription.
|
|
724
|
+
*
|
|
725
|
+
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
726
|
+
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
727
|
+
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
728
|
+
*
|
|
729
|
+
* ```jsx
|
|
730
|
+
* export const MyComponent = () => {
|
|
731
|
+
* const x = useMotionValue(0)
|
|
732
|
+
* const y = useMotionValue(0)
|
|
733
|
+
* const opacity = useMotionValue(1)
|
|
734
|
+
*
|
|
735
|
+
* useEffect(() => {
|
|
736
|
+
* function updateOpacity() {
|
|
737
|
+
* const maxXY = Math.max(x.get(), y.get())
|
|
738
|
+
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
739
|
+
* opacity.set(newOpacity)
|
|
740
|
+
* }
|
|
741
|
+
*
|
|
742
|
+
* const unsubscribeX = x.on("change", updateOpacity)
|
|
743
|
+
* const unsubscribeY = y.on("change", updateOpacity)
|
|
744
|
+
*
|
|
745
|
+
* return () => {
|
|
746
|
+
* unsubscribeX()
|
|
747
|
+
* unsubscribeY()
|
|
748
|
+
* }
|
|
749
|
+
* }, [])
|
|
750
|
+
*
|
|
751
|
+
* return <motion.div style={{ x }} />
|
|
752
|
+
* }
|
|
753
|
+
* ```
|
|
754
|
+
*
|
|
755
|
+
* @param subscriber - A function that receives the latest value.
|
|
756
|
+
* @returns A function that, when called, will cancel this subscription.
|
|
757
|
+
*
|
|
758
|
+
* @deprecated
|
|
759
|
+
*/
|
|
760
|
+
onChange(subscription) {
|
|
761
|
+
if (process.env.NODE_ENV !== "production") {
|
|
762
|
+
warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
|
|
763
|
+
}
|
|
764
|
+
return this.on("change", subscription);
|
|
765
|
+
}
|
|
766
|
+
on(eventName, callback) {
|
|
767
|
+
if (!this.events[eventName]) {
|
|
768
|
+
this.events[eventName] = new SubscriptionManager();
|
|
769
|
+
}
|
|
770
|
+
const unsubscribe = this.events[eventName].add(callback);
|
|
771
|
+
if (eventName === "change") {
|
|
772
|
+
return () => {
|
|
773
|
+
unsubscribe();
|
|
774
|
+
frame.read(() => {
|
|
775
|
+
if (!this.events.change.getSize()) {
|
|
776
|
+
this.stop();
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
return unsubscribe;
|
|
782
|
+
}
|
|
783
|
+
clearListeners() {
|
|
784
|
+
for (const eventManagers in this.events) {
|
|
785
|
+
this.events[eventManagers].clear();
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Attaches a passive effect to the `MotionValue`.
|
|
790
|
+
*/
|
|
791
|
+
attach(passiveEffect, stopPassiveEffect) {
|
|
792
|
+
this.passiveEffect = passiveEffect;
|
|
793
|
+
this.stopPassiveEffect = stopPassiveEffect;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Sets the state of the `MotionValue`.
|
|
797
|
+
*
|
|
798
|
+
* @remarks
|
|
799
|
+
*
|
|
800
|
+
* ```jsx
|
|
801
|
+
* const x = useMotionValue(0)
|
|
802
|
+
* x.set(10)
|
|
803
|
+
* ```
|
|
804
|
+
*
|
|
805
|
+
* @param latest - Latest value to set.
|
|
806
|
+
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
807
|
+
*
|
|
808
|
+
* @public
|
|
809
|
+
*/
|
|
810
|
+
set(v, render = true) {
|
|
811
|
+
if (!render || !this.passiveEffect) {
|
|
812
|
+
this.updateAndNotify(v, render);
|
|
813
|
+
} else {
|
|
814
|
+
this.passiveEffect(v, this.updateAndNotify);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
setWithVelocity(prev, current, delta) {
|
|
818
|
+
this.set(current);
|
|
819
|
+
this.prev = void 0;
|
|
820
|
+
this.prevFrameValue = prev;
|
|
821
|
+
this.prevUpdatedAt = this.updatedAt - delta;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Set the state of the `MotionValue`, stopping any active animations,
|
|
825
|
+
* effects, and resets velocity to `0`.
|
|
826
|
+
*/
|
|
827
|
+
jump(v, endAnimation = true) {
|
|
828
|
+
this.updateAndNotify(v);
|
|
829
|
+
this.prev = v;
|
|
830
|
+
this.prevUpdatedAt = this.prevFrameValue = void 0;
|
|
831
|
+
endAnimation && this.stop();
|
|
832
|
+
if (this.stopPassiveEffect)
|
|
833
|
+
this.stopPassiveEffect();
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Returns the latest state of `MotionValue`
|
|
837
|
+
*
|
|
838
|
+
* @returns - The latest state of `MotionValue`
|
|
839
|
+
*
|
|
840
|
+
* @public
|
|
841
|
+
*/
|
|
842
|
+
get() {
|
|
843
|
+
if (collectMotionValues.current) {
|
|
844
|
+
collectMotionValues.current.push(this);
|
|
845
|
+
}
|
|
846
|
+
return this.current;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* @public
|
|
850
|
+
*/
|
|
851
|
+
getPrevious() {
|
|
852
|
+
return this.prev;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Returns the latest velocity of `MotionValue`
|
|
856
|
+
*
|
|
857
|
+
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
858
|
+
*
|
|
859
|
+
* @public
|
|
860
|
+
*/
|
|
861
|
+
getVelocity() {
|
|
862
|
+
const currentTime = time.now();
|
|
863
|
+
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
|
|
864
|
+
return 0;
|
|
865
|
+
}
|
|
866
|
+
const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
|
|
867
|
+
return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Registers a new animation to control this `MotionValue`. Only one
|
|
871
|
+
* animation can drive a `MotionValue` at one time.
|
|
872
|
+
*
|
|
873
|
+
* ```jsx
|
|
874
|
+
* value.start()
|
|
875
|
+
* ```
|
|
876
|
+
*
|
|
877
|
+
* @param animation - A function that starts the provided animation
|
|
878
|
+
*/
|
|
879
|
+
start(startAnimation) {
|
|
880
|
+
this.stop();
|
|
881
|
+
return new Promise((resolve) => {
|
|
882
|
+
this.hasAnimated = true;
|
|
883
|
+
this.animation = startAnimation(resolve);
|
|
884
|
+
if (this.events.animationStart) {
|
|
885
|
+
this.events.animationStart.notify();
|
|
886
|
+
}
|
|
887
|
+
}).then(() => {
|
|
888
|
+
if (this.events.animationComplete) {
|
|
889
|
+
this.events.animationComplete.notify();
|
|
890
|
+
}
|
|
891
|
+
this.clearAnimation();
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Stop the currently active animation.
|
|
896
|
+
*
|
|
897
|
+
* @public
|
|
898
|
+
*/
|
|
899
|
+
stop() {
|
|
900
|
+
if (this.animation) {
|
|
901
|
+
this.animation.stop();
|
|
902
|
+
if (this.events.animationCancel) {
|
|
903
|
+
this.events.animationCancel.notify();
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
this.clearAnimation();
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Returns `true` if this value is currently animating.
|
|
910
|
+
*
|
|
911
|
+
* @public
|
|
912
|
+
*/
|
|
913
|
+
isAnimating() {
|
|
914
|
+
return !!this.animation;
|
|
915
|
+
}
|
|
916
|
+
clearAnimation() {
|
|
917
|
+
delete this.animation;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Destroy and clean up subscribers to this `MotionValue`.
|
|
921
|
+
*
|
|
922
|
+
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
923
|
+
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
924
|
+
* created a `MotionValue` via the `motionValue` function.
|
|
925
|
+
*
|
|
926
|
+
* @public
|
|
927
|
+
*/
|
|
928
|
+
destroy() {
|
|
929
|
+
this.clearListeners();
|
|
930
|
+
this.stop();
|
|
931
|
+
if (this.stopPassiveEffect) {
|
|
932
|
+
this.stopPassiveEffect();
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
function motionValue(init, options) {
|
|
937
|
+
return new MotionValue(init, options);
|
|
938
|
+
}
|
|
84
939
|
const clamp$1 = (min, max, v) => {
|
|
85
940
|
if (v > max)
|
|
86
941
|
return max;
|
|
@@ -285,8 +1140,8 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
285
1140
|
return state2;
|
|
286
1141
|
},
|
|
287
1142
|
toString: () => {
|
|
288
|
-
const calculatedDuration = Math.min(
|
|
289
|
-
const easing =
|
|
1143
|
+
const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
1144
|
+
const easing = generateLinearEasing((progress2) => generator.next(calculatedDuration * progress2).value, calculatedDuration, 30);
|
|
290
1145
|
return calculatedDuration + "ms " + easing;
|
|
291
1146
|
}
|
|
292
1147
|
};
|
|
@@ -323,7 +1178,7 @@ function isDOMKeyframes(keyframes2) {
|
|
|
323
1178
|
}
|
|
324
1179
|
function resolveSubjects(subject, keyframes2, scope, selectorCache) {
|
|
325
1180
|
if (typeof subject === "string" && isDOMKeyframes(keyframes2)) {
|
|
326
|
-
return
|
|
1181
|
+
return resolveElements(subject, scope, selectorCache);
|
|
327
1182
|
} else if (subject instanceof NodeList) {
|
|
328
1183
|
return Array.from(subject);
|
|
329
1184
|
} else if (Array.isArray(subject)) {
|
|
@@ -413,7 +1268,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
413
1268
|
let { ease: ease2 = defaultTransition.ease || "easeOut", duration } = valueTransition;
|
|
414
1269
|
const calculatedDelay = typeof delay2 === "function" ? delay2(elementIndex, numSubjects) : delay2;
|
|
415
1270
|
const numKeyframes = valueKeyframesAsList.length;
|
|
416
|
-
const createGenerator =
|
|
1271
|
+
const createGenerator = isGenerator(type) ? type : generators2 === null || generators2 === void 0 ? void 0 : generators2[type];
|
|
417
1272
|
if (numKeyframes <= 2 && createGenerator) {
|
|
418
1273
|
let absoluteDelta = 100;
|
|
419
1274
|
if (numKeyframes === 2 && isNumberKeyframesArray(valueKeyframesAsList)) {
|
|
@@ -424,7 +1279,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
424
1279
|
if (duration !== void 0) {
|
|
425
1280
|
springTransition.duration = /* @__PURE__ */ secondsToMilliseconds$1(duration);
|
|
426
1281
|
}
|
|
427
|
-
const springEasing =
|
|
1282
|
+
const springEasing = createGeneratorEasing(springTransition, absoluteDelta, createGenerator);
|
|
428
1283
|
ease2 = springEasing.ease;
|
|
429
1284
|
duration = springEasing.duration;
|
|
430
1285
|
}
|
|
@@ -606,7 +1461,7 @@ function setMotionValue(visualElement, key, value) {
|
|
|
606
1461
|
if (visualElement.hasValue(key)) {
|
|
607
1462
|
visualElement.getValue(key).set(value);
|
|
608
1463
|
} else {
|
|
609
|
-
visualElement.addValue(key,
|
|
1464
|
+
visualElement.addValue(key, motionValue(value));
|
|
610
1465
|
}
|
|
611
1466
|
}
|
|
612
1467
|
function setTarget(visualElement, definition) {
|
|
@@ -1162,7 +2017,7 @@ function flushKeyframeResolvers() {
|
|
|
1162
2017
|
measureAllKeyframes();
|
|
1163
2018
|
}
|
|
1164
2019
|
class KeyframeResolver {
|
|
1165
|
-
constructor(unresolvedKeyframes, onComplete, name,
|
|
2020
|
+
constructor(unresolvedKeyframes, onComplete, name, motionValue2, element, isAsync = false) {
|
|
1166
2021
|
this.isComplete = false;
|
|
1167
2022
|
this.isAsync = false;
|
|
1168
2023
|
this.needsMeasurement = false;
|
|
@@ -1170,7 +2025,7 @@ class KeyframeResolver {
|
|
|
1170
2025
|
this.unresolvedKeyframes = [...unresolvedKeyframes];
|
|
1171
2026
|
this.onComplete = onComplete;
|
|
1172
2027
|
this.name = name;
|
|
1173
|
-
this.motionValue =
|
|
2028
|
+
this.motionValue = motionValue2;
|
|
1174
2029
|
this.element = element;
|
|
1175
2030
|
this.isAsync = isAsync;
|
|
1176
2031
|
}
|
|
@@ -1180,8 +2035,8 @@ class KeyframeResolver {
|
|
|
1180
2035
|
toResolve.add(this);
|
|
1181
2036
|
if (!isScheduled) {
|
|
1182
2037
|
isScheduled = true;
|
|
1183
|
-
|
|
1184
|
-
|
|
2038
|
+
frame.read(readAllKeyframes);
|
|
2039
|
+
frame.resolveKeyframes(measureAllKeyframes);
|
|
1185
2040
|
}
|
|
1186
2041
|
} else {
|
|
1187
2042
|
this.readKeyframes();
|
|
@@ -1189,11 +2044,11 @@ class KeyframeResolver {
|
|
|
1189
2044
|
}
|
|
1190
2045
|
}
|
|
1191
2046
|
readKeyframes() {
|
|
1192
|
-
const { unresolvedKeyframes, name, element, motionValue } = this;
|
|
2047
|
+
const { unresolvedKeyframes, name, element, motionValue: motionValue2 } = this;
|
|
1193
2048
|
for (let i = 0; i < unresolvedKeyframes.length; i++) {
|
|
1194
2049
|
if (unresolvedKeyframes[i] === null) {
|
|
1195
2050
|
if (i === 0) {
|
|
1196
|
-
const currentValue =
|
|
2051
|
+
const currentValue = motionValue2 === null || motionValue2 === void 0 ? void 0 : motionValue2.get();
|
|
1197
2052
|
const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
1198
2053
|
if (currentValue !== void 0) {
|
|
1199
2054
|
unresolvedKeyframes[0] = currentValue;
|
|
@@ -1206,8 +2061,8 @@ class KeyframeResolver {
|
|
|
1206
2061
|
if (unresolvedKeyframes[0] === void 0) {
|
|
1207
2062
|
unresolvedKeyframes[0] = finalKeyframe;
|
|
1208
2063
|
}
|
|
1209
|
-
if (
|
|
1210
|
-
|
|
2064
|
+
if (motionValue2 && currentValue === void 0) {
|
|
2065
|
+
motionValue2.set(unresolvedKeyframes[0]);
|
|
1211
2066
|
}
|
|
1212
2067
|
} else {
|
|
1213
2068
|
unresolvedKeyframes[i] = unresolvedKeyframes[i - 1];
|
|
@@ -1282,8 +2137,8 @@ const auto = {
|
|
|
1282
2137
|
const dimensionValueTypes = [number, px$1, percent$1, degrees, vw, vh, auto];
|
|
1283
2138
|
const findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v));
|
|
1284
2139
|
class DOMKeyframesResolver extends KeyframeResolver {
|
|
1285
|
-
constructor(unresolvedKeyframes, onComplete, name,
|
|
1286
|
-
super(unresolvedKeyframes, onComplete, name,
|
|
2140
|
+
constructor(unresolvedKeyframes, onComplete, name, motionValue2, element) {
|
|
2141
|
+
super(unresolvedKeyframes, onComplete, name, motionValue2, element, true);
|
|
1287
2142
|
}
|
|
1288
2143
|
readKeyframes() {
|
|
1289
2144
|
const { unresolvedKeyframes, element, name } = this;
|
|
@@ -1406,7 +2261,7 @@ function canAnimate(keyframes2, name, type, velocity) {
|
|
|
1406
2261
|
if (!isOriginAnimatable || !isTargetAnimatable) {
|
|
1407
2262
|
return false;
|
|
1408
2263
|
}
|
|
1409
|
-
return hasKeyframesChanged(keyframes2) || (type === "spring" ||
|
|
2264
|
+
return hasKeyframesChanged(keyframes2) || (type === "spring" || isGenerator(type)) && velocity;
|
|
1410
2265
|
}
|
|
1411
2266
|
const isNotNull = (value) => value !== null;
|
|
1412
2267
|
function getFinalKeyframe(keyframes2, { repeat, repeatType = "loop" }, finalKeyframe) {
|
|
@@ -1419,7 +2274,7 @@ class BaseAnimation {
|
|
|
1419
2274
|
constructor({ autoplay = true, delay: delay2 = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", ...options }) {
|
|
1420
2275
|
this.isStopped = false;
|
|
1421
2276
|
this.hasAttemptedResolve = false;
|
|
1422
|
-
this.createdAt =
|
|
2277
|
+
this.createdAt = time.now();
|
|
1423
2278
|
this.options = {
|
|
1424
2279
|
autoplay,
|
|
1425
2280
|
delay: delay2,
|
|
@@ -1463,10 +2318,10 @@ class BaseAnimation {
|
|
|
1463
2318
|
* Otherwise, it will call initPlayback on the implementing class.
|
|
1464
2319
|
*/
|
|
1465
2320
|
onKeyframesResolved(keyframes2, finalKeyframe) {
|
|
1466
|
-
this.resolvedAt =
|
|
2321
|
+
this.resolvedAt = time.now();
|
|
1467
2322
|
this.hasAttemptedResolve = true;
|
|
1468
|
-
const { name, type, velocity, delay: delay2, onComplete, onUpdate, isGenerator } = this.options;
|
|
1469
|
-
if (!
|
|
2323
|
+
const { name, type, velocity, delay: delay2, onComplete, onUpdate, isGenerator: isGenerator2 } = this.options;
|
|
2324
|
+
if (!isGenerator2 && !canAnimate(keyframes2, name, type, velocity)) {
|
|
1470
2325
|
if (!delay2) {
|
|
1471
2326
|
onUpdate && onUpdate(getFinalKeyframe(keyframes2, this.options, finalKeyframe));
|
|
1472
2327
|
onComplete && onComplete();
|
|
@@ -1745,7 +2600,7 @@ const easingLookup = {
|
|
|
1745
2600
|
anticipate
|
|
1746
2601
|
};
|
|
1747
2602
|
const easingDefinitionToFunction = (definition) => {
|
|
1748
|
-
if (
|
|
2603
|
+
if (isBezierDefinition(definition)) {
|
|
1749
2604
|
exports.invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`);
|
|
1750
2605
|
const [x1, y1, x2, y2] = definition;
|
|
1751
2606
|
return cubicBezier(x1, y1, x2, y2);
|
|
@@ -1831,13 +2686,13 @@ function keyframes({ duration = 300, keyframes: keyframeValues, times, ease: eas
|
|
|
1831
2686
|
const frameloopDriver = (update) => {
|
|
1832
2687
|
const passTimestamp = ({ timestamp }) => update(timestamp);
|
|
1833
2688
|
return {
|
|
1834
|
-
start: () =>
|
|
1835
|
-
stop: () =>
|
|
2689
|
+
start: () => frame.update(passTimestamp, true),
|
|
2690
|
+
stop: () => cancelFrame(passTimestamp),
|
|
1836
2691
|
/**
|
|
1837
2692
|
* If we're processing this frame we can use the
|
|
1838
2693
|
* framelocked timestamp to keep things in sync.
|
|
1839
2694
|
*/
|
|
1840
|
-
now: () =>
|
|
2695
|
+
now: () => frameData.isProcessing ? frameData.timestamp : time.now()
|
|
1841
2696
|
};
|
|
1842
2697
|
};
|
|
1843
2698
|
const generators = {
|
|
@@ -1867,10 +2722,10 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
1867
2722
|
const { onStop } = this.options;
|
|
1868
2723
|
onStop && onStop();
|
|
1869
2724
|
};
|
|
1870
|
-
const { name, motionValue, element, keyframes: keyframes2 } = this.options;
|
|
2725
|
+
const { name, motionValue: motionValue2, element, keyframes: keyframes2 } = this.options;
|
|
1871
2726
|
const KeyframeResolver$1 = (element === null || element === void 0 ? void 0 : element.KeyframeResolver) || KeyframeResolver;
|
|
1872
2727
|
const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
|
|
1873
|
-
this.resolver = new KeyframeResolver$1(keyframes2, onResolved, name,
|
|
2728
|
+
this.resolver = new KeyframeResolver$1(keyframes2, onResolved, name, motionValue2, element);
|
|
1874
2729
|
this.resolver.scheduleResolve();
|
|
1875
2730
|
}
|
|
1876
2731
|
flatten() {
|
|
@@ -1881,7 +2736,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
1881
2736
|
}
|
|
1882
2737
|
initPlayback(keyframes$1) {
|
|
1883
2738
|
const { type = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0 } = this.options;
|
|
1884
|
-
const generatorFactory =
|
|
2739
|
+
const generatorFactory = isGenerator(type) ? type : generators[type] || keyframes;
|
|
1885
2740
|
let mapPercentToKeyframes;
|
|
1886
2741
|
let mirroredGenerator;
|
|
1887
2742
|
if (process.env.NODE_ENV !== "production" && generatorFactory !== keyframes) {
|
|
@@ -1900,7 +2755,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
1900
2755
|
});
|
|
1901
2756
|
}
|
|
1902
2757
|
if (generator.calculatedDuration === null) {
|
|
1903
|
-
generator.calculatedDuration =
|
|
2758
|
+
generator.calculatedDuration = calcGeneratorDuration(generator);
|
|
1904
2759
|
}
|
|
1905
2760
|
const { calculatedDuration } = generator;
|
|
1906
2761
|
const resolvedDuration = calculatedDuration + repeatDelay;
|
|
@@ -1916,7 +2771,6 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
1916
2771
|
}
|
|
1917
2772
|
onPostResolved() {
|
|
1918
2773
|
const { autoplay = true } = this.options;
|
|
1919
|
-
motionDom.activeAnimations.mainThread++;
|
|
1920
2774
|
this.play();
|
|
1921
2775
|
if (this.pendingPlayState === "paused" || !autoplay) {
|
|
1922
2776
|
this.pause();
|
|
@@ -2037,13 +2891,13 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2037
2891
|
this.driver = driver((timestamp) => this.tick(timestamp));
|
|
2038
2892
|
}
|
|
2039
2893
|
onPlay && onPlay();
|
|
2040
|
-
const
|
|
2894
|
+
const now2 = this.driver.now();
|
|
2041
2895
|
if (this.holdTime !== null) {
|
|
2042
|
-
this.startTime =
|
|
2896
|
+
this.startTime = now2 - this.holdTime;
|
|
2043
2897
|
} else if (!this.startTime) {
|
|
2044
2898
|
this.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
|
|
2045
2899
|
} else if (this.state === "finished") {
|
|
2046
|
-
this.startTime =
|
|
2900
|
+
this.startTime = now2;
|
|
2047
2901
|
}
|
|
2048
2902
|
if (this.state === "finished") {
|
|
2049
2903
|
this.updateFinishedPromise();
|
|
@@ -2089,7 +2943,6 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2089
2943
|
this.updateFinishedPromise();
|
|
2090
2944
|
this.startTime = this.cancelTime = null;
|
|
2091
2945
|
this.resolver.cancel();
|
|
2092
|
-
motionDom.activeAnimations.mainThread--;
|
|
2093
2946
|
}
|
|
2094
2947
|
stopDriver() {
|
|
2095
2948
|
if (!this.driver)
|
|
@@ -2097,9 +2950,9 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2097
2950
|
this.driver.stop();
|
|
2098
2951
|
this.driver = void 0;
|
|
2099
2952
|
}
|
|
2100
|
-
sample(
|
|
2953
|
+
sample(time2) {
|
|
2101
2954
|
this.startTime = 0;
|
|
2102
|
-
return this.tick(
|
|
2955
|
+
return this.tick(time2, true);
|
|
2103
2956
|
}
|
|
2104
2957
|
}
|
|
2105
2958
|
function animateValue(options) {
|
|
@@ -2118,12 +2971,9 @@ function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0
|
|
|
2118
2971
|
const keyframeOptions = { [valueName]: keyframes2 };
|
|
2119
2972
|
if (times)
|
|
2120
2973
|
keyframeOptions.offset = times;
|
|
2121
|
-
const easing =
|
|
2974
|
+
const easing = mapEasingToNativeEasing(ease2, duration);
|
|
2122
2975
|
if (Array.isArray(easing))
|
|
2123
2976
|
keyframeOptions.easing = easing;
|
|
2124
|
-
if (motionDom.statsBuffer.value) {
|
|
2125
|
-
motionDom.activeAnimations.waapi++;
|
|
2126
|
-
}
|
|
2127
2977
|
const animation = element.animate(keyframeOptions, {
|
|
2128
2978
|
delay: delay2,
|
|
2129
2979
|
duration,
|
|
@@ -2132,18 +2982,13 @@ function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0
|
|
|
2132
2982
|
iterations: repeat + 1,
|
|
2133
2983
|
direction: repeatType === "reverse" ? "alternate" : "normal"
|
|
2134
2984
|
});
|
|
2135
|
-
if (motionDom.statsBuffer.value) {
|
|
2136
|
-
animation.finished.finally(() => {
|
|
2137
|
-
motionDom.activeAnimations.waapi--;
|
|
2138
|
-
});
|
|
2139
|
-
}
|
|
2140
2985
|
return animation;
|
|
2141
2986
|
}
|
|
2142
2987
|
const supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
2143
2988
|
const sampleDelta = 10;
|
|
2144
2989
|
const maxDuration = 2e4;
|
|
2145
2990
|
function requiresPregeneratedKeyframes(options) {
|
|
2146
|
-
return
|
|
2991
|
+
return isGenerator(options.type) || options.type === "spring" || !isWaapiSupportedEasing(options.ease);
|
|
2147
2992
|
}
|
|
2148
2993
|
function pregenerateKeyframes(keyframes2, options) {
|
|
2149
2994
|
const sampleAnimation = new MainThreadAnimation({
|
|
@@ -2179,20 +3024,20 @@ function isUnsupportedEase(key) {
|
|
|
2179
3024
|
class AcceleratedAnimation extends BaseAnimation {
|
|
2180
3025
|
constructor(options) {
|
|
2181
3026
|
super(options);
|
|
2182
|
-
const { name, motionValue, element, keyframes: keyframes2 } = this.options;
|
|
2183
|
-
this.resolver = new DOMKeyframesResolver(keyframes2, (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe), name,
|
|
3027
|
+
const { name, motionValue: motionValue2, element, keyframes: keyframes2 } = this.options;
|
|
3028
|
+
this.resolver = new DOMKeyframesResolver(keyframes2, (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe), name, motionValue2, element);
|
|
2184
3029
|
this.resolver.scheduleResolve();
|
|
2185
3030
|
}
|
|
2186
3031
|
initPlayback(keyframes2, finalKeyframe) {
|
|
2187
|
-
let { duration = 300, times, ease: ease2, type, motionValue, name, startTime } = this.options;
|
|
2188
|
-
if (!
|
|
3032
|
+
let { duration = 300, times, ease: ease2, type, motionValue: motionValue2, name, startTime } = this.options;
|
|
3033
|
+
if (!motionValue2.owner || !motionValue2.owner.current) {
|
|
2189
3034
|
return false;
|
|
2190
3035
|
}
|
|
2191
|
-
if (typeof ease2 === "string" &&
|
|
3036
|
+
if (typeof ease2 === "string" && supportsLinearEasing() && isUnsupportedEase(ease2)) {
|
|
2192
3037
|
ease2 = unsupportedEasingFunctions[ease2];
|
|
2193
3038
|
}
|
|
2194
3039
|
if (requiresPregeneratedKeyframes(this.options)) {
|
|
2195
|
-
const { onComplete, onUpdate, motionValue:
|
|
3040
|
+
const { onComplete, onUpdate, motionValue: motionValue3, element, ...options } = this.options;
|
|
2196
3041
|
const pregeneratedAnimation = pregenerateKeyframes(keyframes2, options);
|
|
2197
3042
|
keyframes2 = pregeneratedAnimation.keyframes;
|
|
2198
3043
|
if (keyframes2.length === 1) {
|
|
@@ -2203,15 +3048,15 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
2203
3048
|
ease2 = pregeneratedAnimation.ease;
|
|
2204
3049
|
type = "keyframes";
|
|
2205
3050
|
}
|
|
2206
|
-
const animation = startWaapiAnimation(
|
|
3051
|
+
const animation = startWaapiAnimation(motionValue2.owner.current, name, keyframes2, { ...this.options, duration, times, ease: ease2 });
|
|
2207
3052
|
animation.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
|
|
2208
3053
|
if (this.pendingTimeline) {
|
|
2209
|
-
|
|
3054
|
+
attachTimeline(animation, this.pendingTimeline);
|
|
2210
3055
|
this.pendingTimeline = void 0;
|
|
2211
3056
|
} else {
|
|
2212
3057
|
animation.onfinish = () => {
|
|
2213
3058
|
const { onComplete } = this.options;
|
|
2214
|
-
|
|
3059
|
+
motionValue2.set(getFinalKeyframe(keyframes2, this.options, finalKeyframe));
|
|
2215
3060
|
onComplete && onComplete();
|
|
2216
3061
|
this.cancel();
|
|
2217
3062
|
this.resolveFinishedPromise();
|
|
@@ -2287,7 +3132,7 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
2287
3132
|
if (!resolved)
|
|
2288
3133
|
return noop;
|
|
2289
3134
|
const { animation } = resolved;
|
|
2290
|
-
|
|
3135
|
+
attachTimeline(animation, timeline);
|
|
2291
3136
|
}
|
|
2292
3137
|
return noop;
|
|
2293
3138
|
}
|
|
@@ -2325,7 +3170,7 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
2325
3170
|
return;
|
|
2326
3171
|
}
|
|
2327
3172
|
if (this.time) {
|
|
2328
|
-
const { motionValue, onUpdate, onComplete, element, ...options } = this.options;
|
|
3173
|
+
const { motionValue: motionValue2, onUpdate, onComplete, element, ...options } = this.options;
|
|
2329
3174
|
const sampleAnimation = new MainThreadAnimation({
|
|
2330
3175
|
...options,
|
|
2331
3176
|
keyframes: keyframes2,
|
|
@@ -2336,7 +3181,7 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
2336
3181
|
isGenerator: true
|
|
2337
3182
|
});
|
|
2338
3183
|
const sampleTime = /* @__PURE__ */ secondsToMilliseconds$1(this.time);
|
|
2339
|
-
|
|
3184
|
+
motionValue2.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta);
|
|
2340
3185
|
}
|
|
2341
3186
|
const { onStop } = this.options;
|
|
2342
3187
|
onStop && onStop();
|
|
@@ -2355,11 +3200,11 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
2355
3200
|
resolved.animation.cancel();
|
|
2356
3201
|
}
|
|
2357
3202
|
static supports(options) {
|
|
2358
|
-
const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
|
|
2359
|
-
if (!
|
|
3203
|
+
const { motionValue: motionValue2, name, repeatDelay, repeatType, damping, type } = options;
|
|
3204
|
+
if (!motionValue2 || !motionValue2.owner || !(motionValue2.owner.current instanceof HTMLElement)) {
|
|
2360
3205
|
return false;
|
|
2361
3206
|
}
|
|
2362
|
-
const { onUpdate, transformTemplate } =
|
|
3207
|
+
const { onUpdate, transformTemplate } = motionValue2.owner.getProps();
|
|
2363
3208
|
return supportsWaapi() && name && acceleratedValues.has(name) && /**
|
|
2364
3209
|
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
2365
3210
|
* no way to read the value from WAAPI every frame.
|
|
@@ -2400,7 +3245,7 @@ function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildr
|
|
|
2400
3245
|
return !!Object.keys(transition).length;
|
|
2401
3246
|
}
|
|
2402
3247
|
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
|
|
2403
|
-
const valueTransition =
|
|
3248
|
+
const valueTransition = getValueTransition$1(transition, name) || {};
|
|
2404
3249
|
const delay2 = valueTransition.delay || transition.delay || 0;
|
|
2405
3250
|
let { elapsed = 0 } = transition;
|
|
2406
3251
|
elapsed = elapsed - /* @__PURE__ */ secondsToMilliseconds$1(delay2);
|
|
@@ -2448,11 +3293,11 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
2448
3293
|
if (shouldSkip && !isHandoff && value.get() !== void 0) {
|
|
2449
3294
|
const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
|
|
2450
3295
|
if (finalKeyframe !== void 0) {
|
|
2451
|
-
|
|
3296
|
+
frame.update(() => {
|
|
2452
3297
|
options.onUpdate(finalKeyframe);
|
|
2453
3298
|
options.onComplete();
|
|
2454
3299
|
});
|
|
2455
|
-
return new
|
|
3300
|
+
return new GroupPlaybackControls([]);
|
|
2456
3301
|
}
|
|
2457
3302
|
}
|
|
2458
3303
|
if (!isHandoff && AcceleratedAnimation.supports(options)) {
|
|
@@ -2481,13 +3326,13 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
|
|
|
2481
3326
|
}
|
|
2482
3327
|
const valueTransition = {
|
|
2483
3328
|
delay: delay2,
|
|
2484
|
-
...
|
|
3329
|
+
...getValueTransition$1(transition || {}, key)
|
|
2485
3330
|
};
|
|
2486
3331
|
let isHandoff = false;
|
|
2487
3332
|
if (window.MotionHandoffAnimation) {
|
|
2488
3333
|
const appearId = getOptimisedAppearId(visualElement);
|
|
2489
3334
|
if (appearId) {
|
|
2490
|
-
const startTime = window.MotionHandoffAnimation(appearId, key,
|
|
3335
|
+
const startTime = window.MotionHandoffAnimation(appearId, key, frame);
|
|
2491
3336
|
if (startTime !== null) {
|
|
2492
3337
|
valueTransition.startTime = startTime;
|
|
2493
3338
|
isHandoff = true;
|
|
@@ -2503,7 +3348,7 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
|
|
|
2503
3348
|
}
|
|
2504
3349
|
if (transitionEnd) {
|
|
2505
3350
|
Promise.all(animations).then(() => {
|
|
2506
|
-
|
|
3351
|
+
frame.update(() => {
|
|
2507
3352
|
transitionEnd && setTarget(visualElement, transitionEnd);
|
|
2508
3353
|
});
|
|
2509
3354
|
});
|
|
@@ -2604,7 +3449,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
2604
3449
|
warnOnce(nextValue.version === "12.5.0", `Attempting to mix Motion versions ${nextValue.version} with 12.5.0 may not work as expected.`);
|
|
2605
3450
|
}
|
|
2606
3451
|
} else if (isMotionValue$1(prevValue)) {
|
|
2607
|
-
element.addValue(key,
|
|
3452
|
+
element.addValue(key, motionValue(nextValue, { owner: element }));
|
|
2608
3453
|
} else if (prevValue !== nextValue) {
|
|
2609
3454
|
if (element.hasValue(key)) {
|
|
2610
3455
|
const existingValue = element.getValue(key);
|
|
@@ -2615,7 +3460,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
2615
3460
|
}
|
|
2616
3461
|
} else {
|
|
2617
3462
|
const latestValue = element.getStaticValue(key);
|
|
2618
|
-
element.addValue(key,
|
|
3463
|
+
element.addValue(key, motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element }));
|
|
2619
3464
|
}
|
|
2620
3465
|
}
|
|
2621
3466
|
}
|
|
@@ -2667,10 +3512,10 @@ class VisualElement {
|
|
|
2667
3512
|
};
|
|
2668
3513
|
this.renderScheduledAt = 0;
|
|
2669
3514
|
this.scheduleRender = () => {
|
|
2670
|
-
const
|
|
2671
|
-
if (this.renderScheduledAt <
|
|
2672
|
-
this.renderScheduledAt =
|
|
2673
|
-
|
|
3515
|
+
const now2 = time.now();
|
|
3516
|
+
if (this.renderScheduledAt < now2) {
|
|
3517
|
+
this.renderScheduledAt = now2;
|
|
3518
|
+
frame.render(this.render, false, true);
|
|
2674
3519
|
}
|
|
2675
3520
|
};
|
|
2676
3521
|
const { latestValues, renderState, onUpdate } = visualState;
|
|
@@ -2723,8 +3568,8 @@ class VisualElement {
|
|
|
2723
3568
|
}
|
|
2724
3569
|
unmount() {
|
|
2725
3570
|
this.projection && this.projection.unmount();
|
|
2726
|
-
|
|
2727
|
-
|
|
3571
|
+
cancelFrame(this.notifyUpdate);
|
|
3572
|
+
cancelFrame(this.render);
|
|
2728
3573
|
this.valueSubscriptions.forEach((remove) => remove());
|
|
2729
3574
|
this.valueSubscriptions.clear();
|
|
2730
3575
|
this.removeFromVariantTree && this.removeFromVariantTree();
|
|
@@ -2751,7 +3596,7 @@ class VisualElement {
|
|
|
2751
3596
|
}
|
|
2752
3597
|
const removeOnChange = value.on("change", (latestValue) => {
|
|
2753
3598
|
this.latestValues[key] = latestValue;
|
|
2754
|
-
this.props.onUpdate &&
|
|
3599
|
+
this.props.onUpdate && frame.preRender(this.notifyUpdate);
|
|
2755
3600
|
if (valueIsTransform && this.projection) {
|
|
2756
3601
|
this.projection.isTransformDirty = true;
|
|
2757
3602
|
}
|
|
@@ -2913,7 +3758,7 @@ class VisualElement {
|
|
|
2913
3758
|
}
|
|
2914
3759
|
let value = this.values.get(key);
|
|
2915
3760
|
if (value === void 0 && defaultValue !== void 0) {
|
|
2916
|
-
value =
|
|
3761
|
+
value = motionValue(defaultValue === null ? void 0 : defaultValue, { owner: this });
|
|
2917
3762
|
this.addValue(key, value);
|
|
2918
3763
|
}
|
|
2919
3764
|
return value;
|
|
@@ -3260,7 +4105,7 @@ class SVGVisualElement extends DOMVisualElement {
|
|
|
3260
4105
|
}
|
|
3261
4106
|
onBindTransform() {
|
|
3262
4107
|
if (this.current && !this.renderState.dimensions) {
|
|
3263
|
-
|
|
4108
|
+
frame.postRender(this.updateDimensions);
|
|
3264
4109
|
}
|
|
3265
4110
|
}
|
|
3266
4111
|
build(renderState, latestValues, props) {
|
|
@@ -3478,7 +4323,7 @@ function createObjectVisualElement(subject) {
|
|
|
3478
4323
|
visualElementStore.set(subject, node);
|
|
3479
4324
|
}
|
|
3480
4325
|
function animateSingleValue(value, keyframes2, options) {
|
|
3481
|
-
const motionValue$1 = isMotionValue$1(value) ? value :
|
|
4326
|
+
const motionValue$1 = isMotionValue$1(value) ? value : motionValue(value);
|
|
3482
4327
|
motionValue$1.start(animateMotionValue("", motionValue$1, keyframes2, options));
|
|
3483
4328
|
return motionValue$1.animation;
|
|
3484
4329
|
}
|
|
@@ -3528,7 +4373,7 @@ function createScopedAnimate(scope) {
|
|
|
3528
4373
|
} else {
|
|
3529
4374
|
animations = animateSubject(subjectOrSequence, optionsOrKeyframes, options, scope);
|
|
3530
4375
|
}
|
|
3531
|
-
const animation = new
|
|
4376
|
+
const animation = new GroupPlaybackControls(animations);
|
|
3532
4377
|
if (scope) {
|
|
3533
4378
|
scope.animations.push(animation);
|
|
3534
4379
|
}
|
|
@@ -3571,7 +4416,7 @@ function getElementAnimationState(element) {
|
|
|
3571
4416
|
state.set(element, animationState);
|
|
3572
4417
|
return state.get(element);
|
|
3573
4418
|
}
|
|
3574
|
-
class NativeAnimation extends
|
|
4419
|
+
class NativeAnimation extends NativeAnimationControls {
|
|
3575
4420
|
constructor(element, valueName, valueKeyframes, options) {
|
|
3576
4421
|
const isCSSVar = valueName.startsWith("--");
|
|
3577
4422
|
exports.invariant(typeof options.type !== "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "framer-motion"?`);
|
|
@@ -3584,9 +4429,9 @@ class NativeAnimation extends motionDom.NativeAnimationControls {
|
|
|
3584
4429
|
valueKeyframes = [valueKeyframes];
|
|
3585
4430
|
}
|
|
3586
4431
|
hydrateKeyframes(valueName, valueKeyframes, readInitialKeyframe);
|
|
3587
|
-
if (
|
|
3588
|
-
const generatorOptions =
|
|
3589
|
-
options.ease =
|
|
4432
|
+
if (isGenerator(options.type)) {
|
|
4433
|
+
const generatorOptions = createGeneratorEasing(options, 100, options.type);
|
|
4434
|
+
options.ease = supportsLinearEasing() ? generatorOptions.ease : defaultEasing;
|
|
3590
4435
|
options.duration = /* @__PURE__ */ secondsToMilliseconds$1(generatorOptions.duration);
|
|
3591
4436
|
options.type = "keyframes";
|
|
3592
4437
|
} else {
|
|
@@ -3645,7 +4490,7 @@ class NativeAnimation extends motionDom.NativeAnimationControls {
|
|
|
3645
4490
|
}
|
|
3646
4491
|
}
|
|
3647
4492
|
function animateElements(elementOrSelector, keyframes2, options, scope) {
|
|
3648
|
-
const elements =
|
|
4493
|
+
const elements = resolveElements(elementOrSelector, scope);
|
|
3649
4494
|
const numElements = elements.length;
|
|
3650
4495
|
exports.invariant(Boolean(numElements), "No valid element provided.");
|
|
3651
4496
|
const animations = [];
|
|
@@ -3658,7 +4503,7 @@ function animateElements(elementOrSelector, keyframes2, options, scope) {
|
|
|
3658
4503
|
for (const valueName in keyframes2) {
|
|
3659
4504
|
const valueKeyframes = keyframes2[valueName];
|
|
3660
4505
|
const valueOptions = {
|
|
3661
|
-
...
|
|
4506
|
+
...getValueTransition$1(elementTransition, valueName)
|
|
3662
4507
|
};
|
|
3663
4508
|
valueOptions.duration = valueOptions.duration ? /* @__PURE__ */ secondsToMilliseconds$1(valueOptions.duration) : valueOptions.duration;
|
|
3664
4509
|
valueOptions.delay = /* @__PURE__ */ secondsToMilliseconds$1(valueOptions.delay || 0);
|
|
@@ -3670,7 +4515,7 @@ function animateElements(elementOrSelector, keyframes2, options, scope) {
|
|
|
3670
4515
|
}
|
|
3671
4516
|
const createScopedWaapiAnimate = (scope) => {
|
|
3672
4517
|
function scopedAnimate(elementOrSelector, keyframes2, options) {
|
|
3673
|
-
return new
|
|
4518
|
+
return new GroupPlaybackControls(animateElements(elementOrSelector, keyframes2, options, scope));
|
|
3674
4519
|
}
|
|
3675
4520
|
return scopedAnimate;
|
|
3676
4521
|
};
|
|
@@ -3686,8 +4531,8 @@ function observeTimeline(update, timeline) {
|
|
|
3686
4531
|
}
|
|
3687
4532
|
prevProgress = progress2;
|
|
3688
4533
|
};
|
|
3689
|
-
|
|
3690
|
-
return () =>
|
|
4534
|
+
frame.update(onFrame, true);
|
|
4535
|
+
return () => cancelFrame(onFrame);
|
|
3691
4536
|
}
|
|
3692
4537
|
const resizeHandlers = /* @__PURE__ */ new WeakMap();
|
|
3693
4538
|
let observer;
|
|
@@ -3727,7 +4572,7 @@ function createResizeObserver() {
|
|
|
3727
4572
|
function resizeElement(target, handler) {
|
|
3728
4573
|
if (!observer)
|
|
3729
4574
|
createResizeObserver();
|
|
3730
|
-
const elements =
|
|
4575
|
+
const elements = resolveElements(target);
|
|
3731
4576
|
elements.forEach((element) => {
|
|
3732
4577
|
let elementHandlers = resizeHandlers.get(element);
|
|
3733
4578
|
if (!elementHandlers) {
|
|
@@ -3804,7 +4649,7 @@ const keys = {
|
|
|
3804
4649
|
position: "Top"
|
|
3805
4650
|
}
|
|
3806
4651
|
};
|
|
3807
|
-
function updateAxisInfo(element, axisName, info,
|
|
4652
|
+
function updateAxisInfo(element, axisName, info, time2) {
|
|
3808
4653
|
const axis = info[axisName];
|
|
3809
4654
|
const { length, position } = keys[axisName];
|
|
3810
4655
|
const prev = axis.current;
|
|
@@ -3815,13 +4660,13 @@ function updateAxisInfo(element, axisName, info, time) {
|
|
|
3815
4660
|
axis.offset[0] = 0;
|
|
3816
4661
|
axis.offset[1] = axis.scrollLength;
|
|
3817
4662
|
axis.progress = /* @__PURE__ */ progress$1(0, axis.scrollLength, axis.current);
|
|
3818
|
-
const elapsed =
|
|
4663
|
+
const elapsed = time2 - prevTime;
|
|
3819
4664
|
axis.velocity = elapsed > maxElapsed ? 0 : velocityPerSecond(axis.current - prev, elapsed);
|
|
3820
4665
|
}
|
|
3821
|
-
function updateScrollInfo(element, info,
|
|
3822
|
-
updateAxisInfo(element, "x", info,
|
|
3823
|
-
updateAxisInfo(element, "y", info,
|
|
3824
|
-
info.time =
|
|
4666
|
+
function updateScrollInfo(element, info, time2) {
|
|
4667
|
+
updateAxisInfo(element, "x", info, time2);
|
|
4668
|
+
updateAxisInfo(element, "y", info, time2);
|
|
4669
|
+
info.time = time2;
|
|
3825
4670
|
}
|
|
3826
4671
|
function calcInset(element, container) {
|
|
3827
4672
|
const inset = { x: 0, y: 0 };
|
|
@@ -3976,8 +4821,8 @@ function measure(container, target = container, info) {
|
|
|
3976
4821
|
function createOnScrollHandler(element, onScroll, info, options = {}) {
|
|
3977
4822
|
return {
|
|
3978
4823
|
measure: () => measure(element, options.target, info),
|
|
3979
|
-
update: (
|
|
3980
|
-
updateScrollInfo(element, info,
|
|
4824
|
+
update: (time2) => {
|
|
4825
|
+
updateScrollInfo(element, info, time2);
|
|
3981
4826
|
if (options.offset || options.target) {
|
|
3982
4827
|
resolveOffsets(element, info, options);
|
|
3983
4828
|
}
|
|
@@ -4005,7 +4850,7 @@ function scrollInfo(onScroll, { container = document.documentElement, ...options
|
|
|
4005
4850
|
};
|
|
4006
4851
|
const updateAll = () => {
|
|
4007
4852
|
for (const handler of containerHandlers) {
|
|
4008
|
-
handler.update(
|
|
4853
|
+
handler.update(frameData.timestamp);
|
|
4009
4854
|
}
|
|
4010
4855
|
};
|
|
4011
4856
|
const notifyAll2 = () => {
|
|
@@ -4013,9 +4858,9 @@ function scrollInfo(onScroll, { container = document.documentElement, ...options
|
|
|
4013
4858
|
handler.notify();
|
|
4014
4859
|
};
|
|
4015
4860
|
const listener2 = () => {
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4861
|
+
frame.read(measureAll, false, true);
|
|
4862
|
+
frame.read(updateAll, false, true);
|
|
4863
|
+
frame.update(notifyAll2, false, true);
|
|
4019
4864
|
};
|
|
4020
4865
|
scrollListeners.set(container, listener2);
|
|
4021
4866
|
const target = getEventTarget(container);
|
|
@@ -4026,10 +4871,10 @@ function scrollInfo(onScroll, { container = document.documentElement, ...options
|
|
|
4026
4871
|
target.addEventListener("scroll", listener2, { passive: true });
|
|
4027
4872
|
}
|
|
4028
4873
|
const listener = scrollListeners.get(container);
|
|
4029
|
-
|
|
4874
|
+
frame.read(listener, false, true);
|
|
4030
4875
|
return () => {
|
|
4031
4876
|
var _a;
|
|
4032
|
-
|
|
4877
|
+
cancelFrame(listener);
|
|
4033
4878
|
const currentHandlers = onScrollHandlers.get(container);
|
|
4034
4879
|
if (!currentHandlers)
|
|
4035
4880
|
return;
|
|
@@ -4063,7 +4908,7 @@ function getTimeline({ source, container = document.documentElement, axis = "y"
|
|
|
4063
4908
|
}
|
|
4064
4909
|
const elementCache = timelineCache.get(container);
|
|
4065
4910
|
if (!elementCache[axis]) {
|
|
4066
|
-
elementCache[axis] =
|
|
4911
|
+
elementCache[axis] = supportsScrollTimeline() ? new ScrollTimeline({ source: container, axis }) : scrollTimelineFallback({ source: container, axis });
|
|
4067
4912
|
}
|
|
4068
4913
|
return elementCache[axis];
|
|
4069
4914
|
}
|
|
@@ -4112,7 +4957,7 @@ const thresholds = {
|
|
|
4112
4957
|
all: 1
|
|
4113
4958
|
};
|
|
4114
4959
|
function inView(elementOrSelector, onStart, { root, margin: rootMargin, amount = "some" } = {}) {
|
|
4115
|
-
const elements =
|
|
4960
|
+
const elements = resolveElements(elementOrSelector);
|
|
4116
4961
|
const activeIntersections = /* @__PURE__ */ new WeakMap();
|
|
4117
4962
|
const onIntersectionChange = (entries) => {
|
|
4118
4963
|
entries.forEach((entry) => {
|
|
@@ -4170,16 +5015,16 @@ function stagger(duration = 0.1, { startDelay = 0, from = 0, ease: ease2 } = {})
|
|
|
4170
5015
|
};
|
|
4171
5016
|
}
|
|
4172
5017
|
function delay$1(callback, timeout) {
|
|
4173
|
-
const start =
|
|
5018
|
+
const start = time.now();
|
|
4174
5019
|
const checkElapsed = ({ timestamp }) => {
|
|
4175
5020
|
const elapsed = timestamp - start;
|
|
4176
5021
|
if (elapsed >= timeout) {
|
|
4177
|
-
|
|
5022
|
+
cancelFrame(checkElapsed);
|
|
4178
5023
|
callback(elapsed - timeout);
|
|
4179
5024
|
}
|
|
4180
5025
|
};
|
|
4181
|
-
|
|
4182
|
-
return () =>
|
|
5026
|
+
frame.read(checkElapsed, true);
|
|
5027
|
+
return () => cancelFrame(checkElapsed);
|
|
4183
5028
|
}
|
|
4184
5029
|
function delayInSeconds(callback, timeout) {
|
|
4185
5030
|
return delay$1(callback, /* @__PURE__ */ secondsToMilliseconds$1(timeout));
|
|
@@ -4266,13 +5111,13 @@ function useAnimationFrame(callback) {
|
|
|
4266
5111
|
initialTimestamp = timestamp;
|
|
4267
5112
|
callback(timestamp - initialTimestamp, delta);
|
|
4268
5113
|
};
|
|
4269
|
-
const cancel = () =>
|
|
5114
|
+
const cancel = () => cancelFrame(provideTimeSinceStart);
|
|
4270
5115
|
vue.onBeforeUpdate(() => {
|
|
4271
5116
|
cancel();
|
|
4272
|
-
|
|
5117
|
+
frame.update(provideTimeSinceStart, true);
|
|
4273
5118
|
});
|
|
4274
5119
|
vue.onUnmounted(() => cancel());
|
|
4275
|
-
|
|
5120
|
+
frame.update(provideTimeSinceStart, true);
|
|
4276
5121
|
}
|
|
4277
5122
|
const secondsToMilliseconds = (seconds) => seconds * 1e3;
|
|
4278
5123
|
function millisecondsToSeconds(milliseconds) {
|
|
@@ -4492,7 +5337,7 @@ function handleHoverEvent$1(state2, event, lifecycle) {
|
|
|
4492
5337
|
const eventName = `onHover${lifecycle}`;
|
|
4493
5338
|
const callback = props[eventName];
|
|
4494
5339
|
if (callback) {
|
|
4495
|
-
|
|
5340
|
+
frame.postRender(() => callback(event, extractEventInfo$1(event)));
|
|
4496
5341
|
}
|
|
4497
5342
|
}
|
|
4498
5343
|
class HoverGesture extends Feature {
|
|
@@ -4517,7 +5362,7 @@ class HoverGesture extends Feature {
|
|
|
4517
5362
|
if (!element || !this.isActive())
|
|
4518
5363
|
return;
|
|
4519
5364
|
this.unmount();
|
|
4520
|
-
this.unmount =
|
|
5365
|
+
this.unmount = hover(
|
|
4521
5366
|
element,
|
|
4522
5367
|
(el, startEvent) => {
|
|
4523
5368
|
handleHoverEvent$1(this.state, startEvent, "Start");
|
|
@@ -4544,7 +5389,7 @@ function handlePressEvent(state2, event, lifecycle) {
|
|
|
4544
5389
|
const eventName = `onPress${lifecycle === "End" ? "" : lifecycle}`;
|
|
4545
5390
|
const callback = props[eventName];
|
|
4546
5391
|
if (callback) {
|
|
4547
|
-
|
|
5392
|
+
frame.postRender(() => callback(event, extractEventInfo$1(event)));
|
|
4548
5393
|
}
|
|
4549
5394
|
}
|
|
4550
5395
|
class PressGesture extends Feature {
|
|
@@ -4569,7 +5414,7 @@ class PressGesture extends Feature {
|
|
|
4569
5414
|
if (!element || !this.isActive())
|
|
4570
5415
|
return;
|
|
4571
5416
|
this.unmount();
|
|
4572
|
-
this.unmount =
|
|
5417
|
+
this.unmount = press(
|
|
4573
5418
|
element,
|
|
4574
5419
|
(el, startEvent) => {
|
|
4575
5420
|
handlePressEvent(this.state, startEvent, "Start");
|
|
@@ -4591,7 +5436,7 @@ function handleHoverEvent(state2, entry, lifecycle) {
|
|
|
4591
5436
|
const eventName = `onViewport${lifecycle}`;
|
|
4592
5437
|
const callback = props[eventName];
|
|
4593
5438
|
if (callback) {
|
|
4594
|
-
|
|
5439
|
+
frame.postRender(() => callback(entry));
|
|
4595
5440
|
}
|
|
4596
5441
|
}
|
|
4597
5442
|
class InViewGesture extends Feature {
|
|
@@ -4811,7 +5656,7 @@ class PanSession {
|
|
|
4811
5656
|
if (!isPanStarted && !isDistancePastThreshold)
|
|
4812
5657
|
return;
|
|
4813
5658
|
const { point: point3 } = info2;
|
|
4814
|
-
const { timestamp: timestamp2 } =
|
|
5659
|
+
const { timestamp: timestamp2 } = frameData;
|
|
4815
5660
|
this.history.push({ ...point3, timestamp: timestamp2 });
|
|
4816
5661
|
const { onStart, onMove } = this.handlers;
|
|
4817
5662
|
if (!isPanStarted) {
|
|
@@ -4823,7 +5668,7 @@ class PanSession {
|
|
|
4823
5668
|
this.handlePointerMove = (event2, info2) => {
|
|
4824
5669
|
this.lastMoveEvent = event2;
|
|
4825
5670
|
this.lastMoveEventInfo = transformPoint(info2, this.transformPagePoint);
|
|
4826
|
-
|
|
5671
|
+
frame.update(this.updatePoint, true);
|
|
4827
5672
|
};
|
|
4828
5673
|
this.handlePointerUp = (event2, info2) => {
|
|
4829
5674
|
this.end();
|
|
@@ -4850,7 +5695,7 @@ class PanSession {
|
|
|
4850
5695
|
const info = extractEventInfo(event);
|
|
4851
5696
|
const initialInfo = transformPoint(info, this.transformPagePoint);
|
|
4852
5697
|
const { point: point2 } = initialInfo;
|
|
4853
|
-
const { timestamp } =
|
|
5698
|
+
const { timestamp } = frameData;
|
|
4854
5699
|
this.history = [{ ...point2, timestamp }];
|
|
4855
5700
|
const { onSessionStart } = handlers;
|
|
4856
5701
|
onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history));
|
|
@@ -4877,7 +5722,7 @@ class PanSession {
|
|
|
4877
5722
|
}
|
|
4878
5723
|
end() {
|
|
4879
5724
|
this.removeListeners && this.removeListeners();
|
|
4880
|
-
|
|
5725
|
+
cancelFrame(this.updatePoint);
|
|
4881
5726
|
}
|
|
4882
5727
|
}
|
|
4883
5728
|
function transformPoint(info, transformPagePoint) {
|
|
@@ -4917,15 +5762,15 @@ function getVelocity(history, timeDelta) {
|
|
|
4917
5762
|
if (!timestampedPoint) {
|
|
4918
5763
|
return { x: 0, y: 0 };
|
|
4919
5764
|
}
|
|
4920
|
-
const
|
|
5765
|
+
const time2 = millisecondsToSeconds(
|
|
4921
5766
|
lastPoint.timestamp - timestampedPoint.timestamp
|
|
4922
5767
|
);
|
|
4923
|
-
if (
|
|
5768
|
+
if (time2 === 0) {
|
|
4924
5769
|
return { x: 0, y: 0 };
|
|
4925
5770
|
}
|
|
4926
5771
|
const currentVelocity = {
|
|
4927
|
-
x: (lastPoint.x - timestampedPoint.x) /
|
|
4928
|
-
y: (lastPoint.y - timestampedPoint.y) /
|
|
5772
|
+
x: (lastPoint.x - timestampedPoint.x) / time2,
|
|
5773
|
+
y: (lastPoint.y - timestampedPoint.y) / time2
|
|
4929
5774
|
};
|
|
4930
5775
|
if (currentVelocity.x === Infinity) {
|
|
4931
5776
|
currentVelocity.x = 0;
|
|
@@ -5063,7 +5908,7 @@ class VisualElementDragControls {
|
|
|
5063
5908
|
this.originPoint[axis] = current;
|
|
5064
5909
|
});
|
|
5065
5910
|
if (onDragStart) {
|
|
5066
|
-
|
|
5911
|
+
frame.postRender(() => onDragStart(event, info));
|
|
5067
5912
|
}
|
|
5068
5913
|
addValueToWillChange(this.visualElement, "transform");
|
|
5069
5914
|
const state2 = this.visualElement.state;
|
|
@@ -5116,15 +5961,15 @@ class VisualElementDragControls {
|
|
|
5116
5961
|
);
|
|
5117
5962
|
}
|
|
5118
5963
|
stop(event, info) {
|
|
5119
|
-
const
|
|
5964
|
+
const isDragging2 = this.isDragging;
|
|
5120
5965
|
this.cancel();
|
|
5121
|
-
if (!
|
|
5966
|
+
if (!isDragging2)
|
|
5122
5967
|
return;
|
|
5123
5968
|
const { velocity } = info;
|
|
5124
5969
|
this.startAnimation(velocity);
|
|
5125
5970
|
const { onDragEnd } = this.getProps();
|
|
5126
5971
|
if (onDragEnd) {
|
|
5127
|
-
|
|
5972
|
+
frame.postRender(() => onDragEnd(event, info));
|
|
5128
5973
|
}
|
|
5129
5974
|
}
|
|
5130
5975
|
cancel() {
|
|
@@ -5377,19 +6222,19 @@ class VisualElementDragControls {
|
|
|
5377
6222
|
projection.root && projection.root.updateScroll();
|
|
5378
6223
|
projection.updateLayout();
|
|
5379
6224
|
}
|
|
5380
|
-
|
|
6225
|
+
frame.read(measureDragConstraints);
|
|
5381
6226
|
const stopResizeListener = addDomEvent$1(window, "resize", () => this.scalePositionWithinConstraints());
|
|
5382
6227
|
const stopLayoutUpdateListener = projection.addEventListener(
|
|
5383
6228
|
"didUpdate",
|
|
5384
6229
|
({ delta, hasLayoutChanged }) => {
|
|
5385
6230
|
if (this.isDragging && hasLayoutChanged) {
|
|
5386
6231
|
eachAxis$1((axis) => {
|
|
5387
|
-
const
|
|
5388
|
-
if (!
|
|
6232
|
+
const motionValue2 = this.getAxisMotionValue(axis);
|
|
6233
|
+
if (!motionValue2)
|
|
5389
6234
|
return;
|
|
5390
6235
|
this.originPoint[axis] += delta[axis].translate;
|
|
5391
|
-
|
|
5392
|
-
|
|
6236
|
+
motionValue2.set(
|
|
6237
|
+
motionValue2.get() + delta[axis].translate
|
|
5393
6238
|
);
|
|
5394
6239
|
});
|
|
5395
6240
|
this.visualElement.render();
|
|
@@ -5580,7 +6425,7 @@ class LayoutFeature extends Feature {
|
|
|
5580
6425
|
function asyncHandler(handler) {
|
|
5581
6426
|
return (event, info) => {
|
|
5582
6427
|
if (handler) {
|
|
5583
|
-
|
|
6428
|
+
frame.postRender(() => handler(event, info));
|
|
5584
6429
|
}
|
|
5585
6430
|
};
|
|
5586
6431
|
}
|
|
@@ -5617,7 +6462,7 @@ class PanGesture extends Feature {
|
|
|
5617
6462
|
const { onPanEnd } = this.state.options;
|
|
5618
6463
|
delete this.session;
|
|
5619
6464
|
if (onPanEnd) {
|
|
5620
|
-
|
|
6465
|
+
frame.postRender(() => onPanEnd(event, info));
|
|
5621
6466
|
}
|
|
5622
6467
|
}
|
|
5623
6468
|
};
|
|
@@ -5789,12 +6634,16 @@ function createStyles(keyframes2) {
|
|
|
5789
6634
|
if (transforms2.length) {
|
|
5790
6635
|
initialKeyframes.transform = buildTransformTemplate(transforms2);
|
|
5791
6636
|
}
|
|
6637
|
+
if (Object.keys(initialKeyframes).length === 0) {
|
|
6638
|
+
return null;
|
|
6639
|
+
}
|
|
5792
6640
|
return initialKeyframes;
|
|
5793
6641
|
}
|
|
5794
6642
|
const SVG_STYLE_TO_ATTRIBUTES = {
|
|
5795
6643
|
"fill": true,
|
|
5796
6644
|
"stroke": true,
|
|
5797
6645
|
"opacity": true,
|
|
6646
|
+
"stroke-width": true,
|
|
5798
6647
|
"fill-opacity": true,
|
|
5799
6648
|
"stroke-opacity": true,
|
|
5800
6649
|
"stroke-linecap": true,
|
|
@@ -6410,11 +7259,6 @@ function buildProjectionTransform(delta, treeScale, latestTransform) {
|
|
|
6410
7259
|
function eachAxis(callback) {
|
|
6411
7260
|
return [callback("x"), callback("y")];
|
|
6412
7261
|
}
|
|
6413
|
-
const metrics = {
|
|
6414
|
-
nodes: 0,
|
|
6415
|
-
calculatedTargetDeltas: 0,
|
|
6416
|
-
calculatedProjections: 0
|
|
6417
|
-
};
|
|
6418
7262
|
const transformAxes = ["", "X", "Y", "Z"];
|
|
6419
7263
|
const hiddenVisibility = { visibility: "hidden" };
|
|
6420
7264
|
const animationTarget = 1e3;
|
|
@@ -6439,7 +7283,7 @@ function cancelTreeOptimisedTransformAnimations(projectionNode) {
|
|
|
6439
7283
|
const appearId = getOptimisedAppearId(visualElement);
|
|
6440
7284
|
if (window.MotionHasOptimisedAnimation(appearId, "transform")) {
|
|
6441
7285
|
const { layout, layoutId } = projectionNode.options;
|
|
6442
|
-
window.MotionCancelOptimisedAnimation(appearId, "transform",
|
|
7286
|
+
window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout || layoutId));
|
|
6443
7287
|
}
|
|
6444
7288
|
const { parent } = projectionNode;
|
|
6445
7289
|
if (parent && !parent.hasCheckedOptimisedAppear) {
|
|
@@ -6480,16 +7324,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6480
7324
|
};
|
|
6481
7325
|
this.updateProjection = () => {
|
|
6482
7326
|
this.projectionUpdateScheduled = false;
|
|
6483
|
-
if (motionDom.statsBuffer.value) {
|
|
6484
|
-
metrics.nodes = metrics.calculatedTargetDeltas = metrics.calculatedProjections = 0;
|
|
6485
|
-
}
|
|
6486
7327
|
this.nodes.forEach(propagateDirtyNodes);
|
|
6487
7328
|
this.nodes.forEach(resolveTargetDelta);
|
|
6488
7329
|
this.nodes.forEach(calcProjection);
|
|
6489
7330
|
this.nodes.forEach(cleanDirtyNodes);
|
|
6490
|
-
if (motionDom.statsBuffer.addProjectionMetrics) {
|
|
6491
|
-
motionDom.statsBuffer.addProjectionMetrics(metrics);
|
|
6492
|
-
}
|
|
6493
7331
|
};
|
|
6494
7332
|
this.resolvedRelativeTargetAt = 0;
|
|
6495
7333
|
this.hasProjected = false;
|
|
@@ -6571,7 +7409,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6571
7409
|
}
|
|
6572
7410
|
this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
|
|
6573
7411
|
const animationOptions = {
|
|
6574
|
-
...
|
|
7412
|
+
...getValueTransition$1(layoutTransition, "layout"),
|
|
6575
7413
|
onPlay: onLayoutAnimationStart,
|
|
6576
7414
|
onComplete: onLayoutAnimationComplete
|
|
6577
7415
|
};
|
|
@@ -6599,7 +7437,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6599
7437
|
stack && stack.remove(this);
|
|
6600
7438
|
this.parent && this.parent.children.delete(this);
|
|
6601
7439
|
this.instance = void 0;
|
|
6602
|
-
|
|
7440
|
+
cancelFrame(this.updateProjection);
|
|
6603
7441
|
}
|
|
6604
7442
|
// only on the root
|
|
6605
7443
|
blockUpdate() {
|
|
@@ -6672,19 +7510,19 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6672
7510
|
this.nodes.forEach(updateLayout);
|
|
6673
7511
|
this.nodes.forEach(notifyLayoutUpdate);
|
|
6674
7512
|
this.clearAllSnapshots();
|
|
6675
|
-
const
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
7513
|
+
const now2 = time.now();
|
|
7514
|
+
frameData.delta = clamp$1(0, 1e3 / 60, now2 - frameData.timestamp);
|
|
7515
|
+
frameData.timestamp = now2;
|
|
7516
|
+
frameData.isProcessing = true;
|
|
7517
|
+
frameSteps.update.process(frameData);
|
|
7518
|
+
frameSteps.preRender.process(frameData);
|
|
7519
|
+
frameSteps.render.process(frameData);
|
|
7520
|
+
frameData.isProcessing = false;
|
|
6683
7521
|
}
|
|
6684
7522
|
didUpdate() {
|
|
6685
7523
|
if (!this.updateScheduled) {
|
|
6686
7524
|
this.updateScheduled = true;
|
|
6687
|
-
|
|
7525
|
+
microtask.read(this.scheduleUpdate);
|
|
6688
7526
|
}
|
|
6689
7527
|
}
|
|
6690
7528
|
clearAllSnapshots() {
|
|
@@ -6694,11 +7532,11 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6694
7532
|
scheduleUpdateProjection() {
|
|
6695
7533
|
if (!this.projectionUpdateScheduled) {
|
|
6696
7534
|
this.projectionUpdateScheduled = true;
|
|
6697
|
-
|
|
7535
|
+
frame.preRender(this.updateProjection, false, true);
|
|
6698
7536
|
}
|
|
6699
7537
|
}
|
|
6700
7538
|
scheduleCheckAfterUnmount() {
|
|
6701
|
-
|
|
7539
|
+
frame.postRender(() => {
|
|
6702
7540
|
if (this.isLayoutDirty) {
|
|
6703
7541
|
this.root.didUpdate();
|
|
6704
7542
|
} else {
|
|
@@ -6884,7 +7722,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6884
7722
|
forceRelativeParentToResolveTarget() {
|
|
6885
7723
|
if (!this.relativeParent)
|
|
6886
7724
|
return;
|
|
6887
|
-
if (this.relativeParent.resolvedRelativeTargetAt !==
|
|
7725
|
+
if (this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp) {
|
|
6888
7726
|
this.relativeParent.resolveTargetDelta(true);
|
|
6889
7727
|
}
|
|
6890
7728
|
}
|
|
@@ -6901,7 +7739,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6901
7739
|
const { layout, layoutId } = this.options;
|
|
6902
7740
|
if (!this.layout || !(layout || layoutId))
|
|
6903
7741
|
return;
|
|
6904
|
-
this.resolvedRelativeTargetAt =
|
|
7742
|
+
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
6905
7743
|
if (!this.targetDelta && !this.relativeTarget) {
|
|
6906
7744
|
const relativeParent = this.getClosestProjectingParent();
|
|
6907
7745
|
if (relativeParent && relativeParent.layout && this.animationProgress !== 1) {
|
|
@@ -6948,9 +7786,6 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6948
7786
|
this.relativeParent = this.relativeTarget = void 0;
|
|
6949
7787
|
}
|
|
6950
7788
|
}
|
|
6951
|
-
if (motionDom.statsBuffer.value) {
|
|
6952
|
-
metrics.calculatedTargetDeltas++;
|
|
6953
|
-
}
|
|
6954
7789
|
}
|
|
6955
7790
|
getClosestProjectingParent() {
|
|
6956
7791
|
if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) {
|
|
@@ -6976,7 +7811,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6976
7811
|
if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) {
|
|
6977
7812
|
canSkip = false;
|
|
6978
7813
|
}
|
|
6979
|
-
if (this.resolvedRelativeTargetAt ===
|
|
7814
|
+
if (this.resolvedRelativeTargetAt === frameData.timestamp) {
|
|
6980
7815
|
canSkip = false;
|
|
6981
7816
|
}
|
|
6982
7817
|
if (canSkip)
|
|
@@ -7016,9 +7851,6 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7016
7851
|
this.scheduleRender();
|
|
7017
7852
|
this.notifyListeners("projectionUpdate", target);
|
|
7018
7853
|
}
|
|
7019
|
-
if (motionDom.statsBuffer.value) {
|
|
7020
|
-
metrics.calculatedProjections++;
|
|
7021
|
-
}
|
|
7022
7854
|
}
|
|
7023
7855
|
hide() {
|
|
7024
7856
|
this.isVisible = false;
|
|
@@ -7092,12 +7924,11 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7092
7924
|
this.resumingFrom.currentAnimation.stop();
|
|
7093
7925
|
}
|
|
7094
7926
|
if (this.pendingAnimation) {
|
|
7095
|
-
|
|
7927
|
+
cancelFrame(this.pendingAnimation);
|
|
7096
7928
|
this.pendingAnimation = void 0;
|
|
7097
7929
|
}
|
|
7098
|
-
this.pendingAnimation =
|
|
7930
|
+
this.pendingAnimation = frame.update(() => {
|
|
7099
7931
|
globalProjectionState.hasAnimatedSinceResize = true;
|
|
7100
|
-
motionDom.activeAnimations.layout++;
|
|
7101
7932
|
this.currentAnimation = animateSingleValue(0, animationTarget, {
|
|
7102
7933
|
...options,
|
|
7103
7934
|
onUpdate: (latest) => {
|
|
@@ -7105,10 +7936,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7105
7936
|
options.onUpdate && options.onUpdate(latest);
|
|
7106
7937
|
},
|
|
7107
7938
|
onStop: () => {
|
|
7108
|
-
motionDom.activeAnimations.layout--;
|
|
7109
7939
|
},
|
|
7110
7940
|
onComplete: () => {
|
|
7111
|
-
motionDom.activeAnimations.layout--;
|
|
7112
7941
|
options.onComplete && options.onComplete();
|
|
7113
7942
|
this.completeAnimation();
|
|
7114
7943
|
}
|
|
@@ -7386,9 +8215,6 @@ function notifyLayoutUpdate(node) {
|
|
|
7386
8215
|
node.options.transition = void 0;
|
|
7387
8216
|
}
|
|
7388
8217
|
function propagateDirtyNodes(node) {
|
|
7389
|
-
if (motionDom.statsBuffer.value) {
|
|
7390
|
-
metrics.nodes++;
|
|
7391
|
-
}
|
|
7392
8218
|
if (!node.parent)
|
|
7393
8219
|
return;
|
|
7394
8220
|
if (!node.isProjecting()) {
|
|
@@ -7672,14 +8498,14 @@ class MotionState {
|
|
|
7672
8498
|
}
|
|
7673
8499
|
if (this.options.layoutId) {
|
|
7674
8500
|
mountedLayoutIds.add(this.options.layoutId);
|
|
7675
|
-
|
|
8501
|
+
frame.render(() => {
|
|
7676
8502
|
mountedLayoutIds.clear();
|
|
7677
8503
|
});
|
|
7678
8504
|
}
|
|
7679
8505
|
}
|
|
7680
8506
|
clearAnimation() {
|
|
7681
8507
|
var _a, _b;
|
|
7682
|
-
this.currentProcess &&
|
|
8508
|
+
this.currentProcess && cancelFrame(this.currentProcess);
|
|
7683
8509
|
this.currentProcess = null;
|
|
7684
8510
|
(_b = (_a = this.visualElement) == null ? void 0 : _a.variantChildren) == null ? void 0 : _b.forEach((child) => {
|
|
7685
8511
|
child.state.clearAnimation();
|
|
@@ -7688,7 +8514,7 @@ class MotionState {
|
|
|
7688
8514
|
// update trigger animation
|
|
7689
8515
|
startAnimation() {
|
|
7690
8516
|
this.clearAnimation();
|
|
7691
|
-
this.currentProcess =
|
|
8517
|
+
this.currentProcess = frame.render(() => {
|
|
7692
8518
|
this.currentProcess = null;
|
|
7693
8519
|
this.animateUpdates();
|
|
7694
8520
|
});
|
|
@@ -7821,12 +8647,12 @@ function useMotionState(props) {
|
|
|
7821
8647
|
...isSVG ? {} : ((_a2 = state2.visualElement) == null ? void 0 : _a2.latestValues) || state2.baseTarget
|
|
7822
8648
|
};
|
|
7823
8649
|
if (isSVG) {
|
|
7824
|
-
const { attributes, style:
|
|
8650
|
+
const { attributes, style: style22 } = convertSvgStyleToAttributes({
|
|
7825
8651
|
...state2.isMounted() ? state2.target : state2.baseTarget,
|
|
7826
8652
|
...styleProps
|
|
7827
8653
|
});
|
|
7828
8654
|
Object.assign(attrsProps, attributes);
|
|
7829
|
-
styleProps =
|
|
8655
|
+
styleProps = style22;
|
|
7830
8656
|
}
|
|
7831
8657
|
if (props.drag && props.dragListener !== false) {
|
|
7832
8658
|
Object.assign(styleProps, {
|
|
@@ -7836,7 +8662,9 @@ function useMotionState(props) {
|
|
|
7836
8662
|
touchAction: props.drag === true ? "none" : `pan-${props.drag === "x" ? "y" : "x"}`
|
|
7837
8663
|
});
|
|
7838
8664
|
}
|
|
7839
|
-
|
|
8665
|
+
const style2 = createStyles(styleProps);
|
|
8666
|
+
if (style2)
|
|
8667
|
+
attrsProps.style = style2;
|
|
7840
8668
|
return attrsProps;
|
|
7841
8669
|
}
|
|
7842
8670
|
const instance = vue.getCurrentInstance().proxy;
|
|
@@ -7875,17 +8703,17 @@ const MotionComponentProps = {
|
|
|
7875
8703
|
"inView": { type: [String, Array, Object] },
|
|
7876
8704
|
"focus": { type: [String, Array, Object] },
|
|
7877
8705
|
"whileDrag": { type: [String, Array, Object] },
|
|
7878
|
-
"whileHover": { type: [String, Array, Object], default: ({ hover }) => {
|
|
7879
|
-
if (process.env.NODE_ENV === "development" &&
|
|
8706
|
+
"whileHover": { type: [String, Array, Object], default: ({ hover: hover2 }) => {
|
|
8707
|
+
if (process.env.NODE_ENV === "development" && hover2) {
|
|
7880
8708
|
heyListen.warning(true, "hover is deprecated. Use whileHover instead.");
|
|
7881
8709
|
}
|
|
7882
|
-
return
|
|
8710
|
+
return hover2;
|
|
7883
8711
|
} },
|
|
7884
|
-
"whilePress": { type: [String, Array, Object], default: ({ press }) => {
|
|
7885
|
-
if (process.env.NODE_ENV === "development" &&
|
|
8712
|
+
"whilePress": { type: [String, Array, Object], default: ({ press: press2 }) => {
|
|
8713
|
+
if (process.env.NODE_ENV === "development" && press2) {
|
|
7886
8714
|
heyListen.warning(true, "press is deprecated. Use whilePress instead.");
|
|
7887
8715
|
}
|
|
7888
|
-
return
|
|
8716
|
+
return press2;
|
|
7889
8717
|
} },
|
|
7890
8718
|
"whileInView": { type: [String, Array, Object], default: ({ inView: inView2 }) => {
|
|
7891
8719
|
if (process.env.NODE_ENV === "development" && inView2) {
|
|
@@ -7951,9 +8779,7 @@ const MotionComponentProps = {
|
|
|
7951
8779
|
"onPanSessionStart": { type: Function },
|
|
7952
8780
|
"onPanStart": { type: Function },
|
|
7953
8781
|
"onPan": { type: Function },
|
|
7954
|
-
"onPanEnd": { type: Function }
|
|
7955
|
-
"onFocus": { type: Function },
|
|
7956
|
-
"onBlur": { type: Function }
|
|
8782
|
+
"onPanEnd": { type: Function }
|
|
7957
8783
|
};
|
|
7958
8784
|
function checkMotionIsHidden(instance) {
|
|
7959
8785
|
var _a;
|
|
@@ -8033,8 +8859,10 @@ function createMotionComponent(component, options = {}) {
|
|
|
8033
8859
|
const isComponent = typeof props.as === "object";
|
|
8034
8860
|
if ((!isComponent || props.asChild) && el) {
|
|
8035
8861
|
const { style: style2 } = getAttrs();
|
|
8036
|
-
|
|
8037
|
-
|
|
8862
|
+
if (style2) {
|
|
8863
|
+
for (const [key, val] of Object.entries(style2)) {
|
|
8864
|
+
el.style[key] = val;
|
|
8865
|
+
}
|
|
8038
8866
|
}
|
|
8039
8867
|
}
|
|
8040
8868
|
}
|
|
@@ -8120,7 +8948,7 @@ function usePopLayout(props) {
|
|
|
8120
8948
|
if (!style2)
|
|
8121
8949
|
return;
|
|
8122
8950
|
styles.delete(state2);
|
|
8123
|
-
|
|
8951
|
+
frame.render(() => {
|
|
8124
8952
|
document.head.removeChild(style2);
|
|
8125
8953
|
});
|
|
8126
8954
|
}
|
|
@@ -8288,7 +9116,7 @@ function moveItem([...arr], fromIndex, toIndex) {
|
|
|
8288
9116
|
return arr;
|
|
8289
9117
|
}
|
|
8290
9118
|
function useDefaultMotionValue(value, defaultValue = 0) {
|
|
8291
|
-
return isMotionValue(value) ? value :
|
|
9119
|
+
return isMotionValue(value) ? value : motionValue(defaultValue);
|
|
8292
9120
|
}
|
|
8293
9121
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
8294
9122
|
...{
|
|
@@ -8427,16 +9255,16 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8427
9255
|
}
|
|
8428
9256
|
});
|
|
8429
9257
|
function useCombineMotionValues(combineValues) {
|
|
8430
|
-
const value =
|
|
9258
|
+
const value = motionValue(combineValues());
|
|
8431
9259
|
const updateValue = () => value.set(combineValues());
|
|
8432
|
-
const scheduleUpdate = () =>
|
|
9260
|
+
const scheduleUpdate = () => frame.preRender(updateValue, false, true);
|
|
8433
9261
|
let subscriptions;
|
|
8434
9262
|
const subscribe = (values) => {
|
|
8435
9263
|
subscriptions = values.map((v) => v.on("change", scheduleUpdate));
|
|
8436
9264
|
};
|
|
8437
9265
|
const unsubscribe = () => {
|
|
8438
9266
|
subscriptions.forEach((unsubscribe2) => unsubscribe2());
|
|
8439
|
-
|
|
9267
|
+
cancelFrame(updateValue);
|
|
8440
9268
|
};
|
|
8441
9269
|
vue.onUnmounted(() => {
|
|
8442
9270
|
unsubscribe();
|
|
@@ -8448,16 +9276,16 @@ function useCombineMotionValues(combineValues) {
|
|
|
8448
9276
|
};
|
|
8449
9277
|
}
|
|
8450
9278
|
function useComputed(computed) {
|
|
8451
|
-
|
|
9279
|
+
collectMotionValues.current = [];
|
|
8452
9280
|
const { value, subscribe, unsubscribe } = useCombineMotionValues(computed);
|
|
8453
|
-
subscribe(
|
|
8454
|
-
|
|
9281
|
+
subscribe(collectMotionValues.current);
|
|
9282
|
+
collectMotionValues.current = void 0;
|
|
8455
9283
|
vue.onBeforeUpdate(() => {
|
|
8456
9284
|
unsubscribe();
|
|
8457
|
-
|
|
9285
|
+
collectMotionValues.current = [];
|
|
8458
9286
|
computed();
|
|
8459
|
-
subscribe(
|
|
8460
|
-
|
|
9287
|
+
subscribe(collectMotionValues.current);
|
|
9288
|
+
collectMotionValues.current = void 0;
|
|
8461
9289
|
});
|
|
8462
9290
|
return value;
|
|
8463
9291
|
}
|
|
@@ -8490,9 +9318,9 @@ function useListTransform(values, transformer) {
|
|
|
8490
9318
|
return value;
|
|
8491
9319
|
}
|
|
8492
9320
|
function useTime() {
|
|
8493
|
-
const
|
|
8494
|
-
useAnimationFrame((t) =>
|
|
8495
|
-
return
|
|
9321
|
+
const time2 = motionValue(0);
|
|
9322
|
+
useAnimationFrame((t) => time2.set(t));
|
|
9323
|
+
return time2;
|
|
8496
9324
|
}
|
|
8497
9325
|
function useMotionTemplate(fragments, ...values) {
|
|
8498
9326
|
const numFragments = fragments.length;
|
|
@@ -8525,7 +9353,7 @@ function toNumber(v) {
|
|
|
8525
9353
|
}
|
|
8526
9354
|
function useSpring(source, config = {}) {
|
|
8527
9355
|
let activeSpringAnimation = null;
|
|
8528
|
-
const value =
|
|
9356
|
+
const value = motionValue(
|
|
8529
9357
|
isMotionValue(source) ? toNumber(source.get()) : source
|
|
8530
9358
|
);
|
|
8531
9359
|
let latestValue = value.get();
|
|
@@ -8540,7 +9368,7 @@ function useSpring(source, config = {}) {
|
|
|
8540
9368
|
const startAnimation = () => {
|
|
8541
9369
|
const animation = activeSpringAnimation;
|
|
8542
9370
|
if ((animation == null ? void 0 : animation.time) === 0) {
|
|
8543
|
-
animation.sample(
|
|
9371
|
+
animation.sample(frameData.delta);
|
|
8544
9372
|
}
|
|
8545
9373
|
stopAnimation2();
|
|
8546
9374
|
const springConfig = vue.isRef(config) ? config.value : config;
|
|
@@ -8563,7 +9391,7 @@ function useSpring(source, config = {}) {
|
|
|
8563
9391
|
value.attach((v, set) => {
|
|
8564
9392
|
latestValue = v;
|
|
8565
9393
|
latestSetter = set;
|
|
8566
|
-
|
|
9394
|
+
frame.update(startAnimation);
|
|
8567
9395
|
return value.get();
|
|
8568
9396
|
}, stopAnimation2);
|
|
8569
9397
|
}, { immediate: true });
|
|
@@ -8582,10 +9410,10 @@ function refWarning(name, ref) {
|
|
|
8582
9410
|
}
|
|
8583
9411
|
function createScrollMotionValues() {
|
|
8584
9412
|
return {
|
|
8585
|
-
scrollX:
|
|
8586
|
-
scrollY:
|
|
8587
|
-
scrollXProgress:
|
|
8588
|
-
scrollYProgress:
|
|
9413
|
+
scrollX: motionValue(0),
|
|
9414
|
+
scrollY: motionValue(0),
|
|
9415
|
+
scrollXProgress: motionValue(0),
|
|
9416
|
+
scrollYProgress: motionValue(0)
|
|
8589
9417
|
};
|
|
8590
9418
|
}
|
|
8591
9419
|
function useScroll({
|
|
@@ -8626,16 +9454,16 @@ function useScroll({
|
|
|
8626
9454
|
return values;
|
|
8627
9455
|
}
|
|
8628
9456
|
function useVelocity(value) {
|
|
8629
|
-
const velocity =
|
|
9457
|
+
const velocity = motionValue(value.getVelocity());
|
|
8630
9458
|
const updateVelocity = () => {
|
|
8631
9459
|
const latest = value.getVelocity();
|
|
8632
9460
|
velocity.set(latest);
|
|
8633
9461
|
if (latest) {
|
|
8634
|
-
|
|
9462
|
+
frame.update(updateVelocity);
|
|
8635
9463
|
}
|
|
8636
9464
|
};
|
|
8637
9465
|
useMotionValueEvent(value, "change", () => {
|
|
8638
|
-
|
|
9466
|
+
frame.update(updateVelocity, false, true);
|
|
8639
9467
|
});
|
|
8640
9468
|
return velocity;
|
|
8641
9469
|
}
|
|
@@ -8752,7 +9580,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8752
9580
|
}
|
|
8753
9581
|
return axis.value;
|
|
8754
9582
|
});
|
|
8755
|
-
const
|
|
9583
|
+
const isDragging2 = vue.ref(false);
|
|
8756
9584
|
return (_ctx, _cache) => {
|
|
8757
9585
|
return vue.openBlock(), vue.createBlock(vue.unref(Motion), vue.mergeProps(bindProps(), {
|
|
8758
9586
|
drag: drag.value,
|
|
@@ -8760,17 +9588,17 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8760
9588
|
onDrag: _cache[0] || (_cache[0] = (event, gesturePoint) => {
|
|
8761
9589
|
const { velocity } = gesturePoint;
|
|
8762
9590
|
velocity[vue.unref(axis)] && vue.unref(updateOrder)(_ctx.value, point2[vue.unref(axis)].get(), velocity[vue.unref(axis)]);
|
|
8763
|
-
!
|
|
9591
|
+
!isDragging2.value && (isDragging2.value = true);
|
|
8764
9592
|
_ctx.onDrag && _ctx.onDrag(event, gesturePoint);
|
|
8765
9593
|
}),
|
|
8766
9594
|
onDragEnd: _cache[1] || (_cache[1] = (event, gesturePoint) => {
|
|
8767
|
-
|
|
9595
|
+
isDragging2.value = false;
|
|
8768
9596
|
_ctx.onDragEnd && _ctx.onDragEnd(event, gesturePoint);
|
|
8769
9597
|
}),
|
|
8770
9598
|
onLayoutMeasure: _cache[2] || (_cache[2] = (measured) => vue.unref(registerItem)(_ctx.value, measured))
|
|
8771
9599
|
}), {
|
|
8772
9600
|
default: vue.withCtx(() => [
|
|
8773
|
-
vue.renderSlot(_ctx.$slots, "default", { isDragging:
|
|
9601
|
+
vue.renderSlot(_ctx.$slots, "default", { isDragging: isDragging2.value }),
|
|
8774
9602
|
vue.createTextVNode(" " + vue.toDisplayString(warning2()), 1)
|
|
8775
9603
|
]),
|
|
8776
9604
|
_: 3
|
|
@@ -9081,52 +9909,13 @@ class DragControls {
|
|
|
9081
9909
|
}
|
|
9082
9910
|
const createDragControls = () => new DragControls();
|
|
9083
9911
|
const useDragControls = createDragControls;
|
|
9084
|
-
Object.defineProperty(exports, "MotionValue", {
|
|
9085
|
-
enumerable: true,
|
|
9086
|
-
get: () => motionDom.MotionValue
|
|
9087
|
-
});
|
|
9088
|
-
Object.defineProperty(exports, "cancelFrame", {
|
|
9089
|
-
enumerable: true,
|
|
9090
|
-
get: () => motionDom.cancelFrame
|
|
9091
|
-
});
|
|
9092
|
-
Object.defineProperty(exports, "frame", {
|
|
9093
|
-
enumerable: true,
|
|
9094
|
-
get: () => motionDom.frame
|
|
9095
|
-
});
|
|
9096
|
-
Object.defineProperty(exports, "frameData", {
|
|
9097
|
-
enumerable: true,
|
|
9098
|
-
get: () => motionDom.frameData
|
|
9099
|
-
});
|
|
9100
|
-
Object.defineProperty(exports, "hover", {
|
|
9101
|
-
enumerable: true,
|
|
9102
|
-
get: () => motionDom.hover
|
|
9103
|
-
});
|
|
9104
|
-
Object.defineProperty(exports, "isDragActive", {
|
|
9105
|
-
enumerable: true,
|
|
9106
|
-
get: () => motionDom.isDragActive
|
|
9107
|
-
});
|
|
9108
|
-
Object.defineProperty(exports, "motionValue", {
|
|
9109
|
-
enumerable: true,
|
|
9110
|
-
get: () => motionDom.motionValue
|
|
9111
|
-
});
|
|
9112
|
-
Object.defineProperty(exports, "press", {
|
|
9113
|
-
enumerable: true,
|
|
9114
|
-
get: () => motionDom.press
|
|
9115
|
-
});
|
|
9116
|
-
Object.defineProperty(exports, "time", {
|
|
9117
|
-
enumerable: true,
|
|
9118
|
-
get: () => motionDom.time
|
|
9119
|
-
});
|
|
9120
|
-
Object.defineProperty(exports, "useMotionValue", {
|
|
9121
|
-
enumerable: true,
|
|
9122
|
-
get: () => motionDom.motionValue
|
|
9123
|
-
});
|
|
9124
9912
|
exports.AnimatePresence = _sfc_main$4;
|
|
9125
9913
|
exports.LayoutGroup = _sfc_main;
|
|
9126
9914
|
exports.LazyMotion = LazyMotion;
|
|
9127
9915
|
exports.M = M;
|
|
9128
9916
|
exports.Motion = Motion;
|
|
9129
9917
|
exports.MotionConfig = _sfc_main$5;
|
|
9918
|
+
exports.MotionValue = MotionValue;
|
|
9130
9919
|
exports.Reorder = Reorder;
|
|
9131
9920
|
exports.ReorderGroup = ReorderGroup;
|
|
9132
9921
|
exports.ReorderItem = ReorderItem;
|
|
@@ -9138,6 +9927,7 @@ exports.anticipate = anticipate;
|
|
|
9138
9927
|
exports.backIn = backIn;
|
|
9139
9928
|
exports.backInOut = backInOut;
|
|
9140
9929
|
exports.backOut = backOut;
|
|
9930
|
+
exports.cancelFrame = cancelFrame;
|
|
9141
9931
|
exports.circIn = circIn;
|
|
9142
9932
|
exports.circInOut = circInOut;
|
|
9143
9933
|
exports.circOut = circOut;
|
|
@@ -9153,12 +9943,16 @@ exports.domMax = domMax;
|
|
|
9153
9943
|
exports.easeIn = easeIn;
|
|
9154
9944
|
exports.easeInOut = easeInOut;
|
|
9155
9945
|
exports.easeOut = easeOut;
|
|
9946
|
+
exports.frame = frame;
|
|
9947
|
+
exports.frameData = frameData;
|
|
9156
9948
|
exports.getContextWindow = getContextWindow;
|
|
9949
|
+
exports.hover = hover;
|
|
9157
9950
|
exports.inView = inView;
|
|
9158
9951
|
exports.inertia = inertia;
|
|
9159
9952
|
exports.injectLayoutGroup = injectLayoutGroup;
|
|
9160
9953
|
exports.injectMotion = injectMotion;
|
|
9161
9954
|
exports.interpolate = interpolate;
|
|
9955
|
+
exports.isDragActive = isDragActive;
|
|
9162
9956
|
exports.isMotionValue = isMotionValue;
|
|
9163
9957
|
exports.keyframes = keyframes;
|
|
9164
9958
|
exports.m = m;
|
|
@@ -9166,9 +9960,11 @@ exports.millisecondsToSeconds = millisecondsToSeconds;
|
|
|
9166
9960
|
exports.mirrorEasing = mirrorEasing;
|
|
9167
9961
|
exports.mix = mix;
|
|
9168
9962
|
exports.motion = motion;
|
|
9963
|
+
exports.motionValue = motionValue;
|
|
9169
9964
|
exports.mountedStates = mountedStates;
|
|
9170
9965
|
exports.noop = noop;
|
|
9171
9966
|
exports.pipe = pipe;
|
|
9967
|
+
exports.press = press;
|
|
9172
9968
|
exports.progress = progress$1;
|
|
9173
9969
|
exports.provideLayoutGroup = provideLayoutGroup;
|
|
9174
9970
|
exports.provideMotion = provideMotion;
|
|
@@ -9180,6 +9976,7 @@ exports.secondsToMilliseconds = secondsToMilliseconds;
|
|
|
9180
9976
|
exports.spring = spring;
|
|
9181
9977
|
exports.stagger = stagger;
|
|
9182
9978
|
exports.steps = steps;
|
|
9979
|
+
exports.time = time;
|
|
9183
9980
|
exports.transform = transform;
|
|
9184
9981
|
exports.useAnimate = useAnimate;
|
|
9185
9982
|
exports.useAnimationControls = useAnimationControls;
|
|
@@ -9192,6 +9989,7 @@ exports.useInView = useInView;
|
|
|
9192
9989
|
exports.useLayoutGroup = useLayoutGroup;
|
|
9193
9990
|
exports.useMotionConfig = useMotionConfig;
|
|
9194
9991
|
exports.useMotionTemplate = useMotionTemplate;
|
|
9992
|
+
exports.useMotionValue = motionValue;
|
|
9195
9993
|
exports.useMotionValueEvent = useMotionValueEvent;
|
|
9196
9994
|
exports.useReducedMotion = useReducedMotion;
|
|
9197
9995
|
exports.useScroll = useScroll;
|