motion 12.6.3-alpha.0 → 12.6.4-alpha.0
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/debug.js +18 -14
- package/dist/cjs/index.js +414 -359
- package/dist/cjs/mini.js +339 -352
- package/dist/cjs/react-client.js +180 -188
- package/dist/cjs/react-m.js +24 -24
- package/dist/cjs/react-mini.js +275 -336
- package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +7 -4
- package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +8 -6
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +10 -8
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +11 -1
- package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +3 -3
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +1 -2
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +1 -2
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/handoff.mjs +2 -4
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +4 -6
- package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +3 -3
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +1 -2
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +2 -2
- package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +5 -10
- package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +1 -2
- package/dist/es/framer-motion/dist/es/motion/index.mjs +2 -3
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +3 -5
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +19 -27
- package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +3 -4
- package/dist/es/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +1 -2
- package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +5 -6
- package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +1 -2
- package/dist/es/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/dom/utils/filter-props.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +1 -2
- package/dist/es/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +2 -3
- package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +3 -5
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/interpolate.mjs +2 -1
- package/dist/es/framer-motion/dist/es/utils/mix/complex.mjs +1 -2
- package/dist/es/framer-motion/dist/es/value/types/complex/index.mjs +2 -3
- package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +2 -2
- package/dist/es/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +0 -7
- package/dist/es/motion/lib/index.mjs +1 -0
- package/dist/es/motion/lib/react.mjs +1 -1
- package/dist/es/motion-dom/dist/es/animation/{controls/BaseGroup.mjs → GroupAnimation.mjs} +4 -5
- package/dist/es/motion-dom/dist/es/animation/GroupAnimationWithThen.mjs +9 -0
- package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +161 -0
- package/dist/es/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +1 -1
- package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +12 -0
- package/dist/es/motion-dom/dist/es/animation/keyframes/hydrate.mjs +26 -0
- package/dist/es/motion-dom/dist/es/animation/utils/get-value-transition.mjs +3 -5
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs +3 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +14 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +26 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/supported.mjs +15 -0
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi/index.mjs → motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs} +8 -6
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs → motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs} +2 -2
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +14 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/linear.mjs +1 -4
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/px-values.mjs +39 -0
- package/dist/es/motion-dom/dist/es/gestures/press/index.mjs +1 -1
- package/dist/es/motion-dom/dist/es/render/dom/style.mjs +15 -0
- package/dist/es/motion-dom/dist/es/utils/resolve-elements.mjs +2 -7
- package/dist/es/motion-dom/dist/es/utils/supports/flags.mjs +1 -3
- package/dist/es/motion-dom/dist/es/utils/supports/memo.mjs +1 -1
- package/dist/es/motion-dom/dist/es/value/index.mjs +1 -1
- package/dist/es/motion-utils/dist/es/errors.mjs +2 -4
- package/dist/es/motion-utils/dist/es/global-config.mjs +1 -4
- package/dist/motion.dev.js +414 -359
- package/dist/motion.js +1 -1
- package/package.json +3 -3
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +0 -116
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +0 -8
- package/dist/es/motion-dom/dist/es/animation/controls/Group.mjs +0 -13
- package/dist/es/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs +0 -85
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/easing.mjs +0 -44
package/dist/cjs/index.js
CHANGED
|
@@ -12,11 +12,8 @@ function removeItem(arr, item) {
|
|
|
12
12
|
arr.splice(index, 1);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let warning = noop;
|
|
19
|
-
exports.invariant = noop;
|
|
15
|
+
let warning = () => { };
|
|
16
|
+
exports.invariant = () => { };
|
|
20
17
|
if (process.env.NODE_ENV !== "production") {
|
|
21
18
|
warning = (check, message) => {
|
|
22
19
|
if (!check && typeof console !== "undefined") {
|
|
@@ -30,10 +27,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
30
27
|
};
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
const MotionGlobalConfig = {
|
|
34
|
-
skipAnimations: false,
|
|
35
|
-
useManualTiming: false,
|
|
36
|
-
};
|
|
30
|
+
const MotionGlobalConfig = {};
|
|
37
31
|
|
|
38
32
|
/*#__NO_SIDE_EFFECTS__*/
|
|
39
33
|
function memo(callback) {
|
|
@@ -45,6 +39,9 @@ function memo(callback) {
|
|
|
45
39
|
};
|
|
46
40
|
}
|
|
47
41
|
|
|
42
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
43
|
+
const noop = (any) => any;
|
|
44
|
+
|
|
48
45
|
/*
|
|
49
46
|
Progress within given range
|
|
50
47
|
|
|
@@ -133,15 +130,14 @@ function warnOnce(condition, message, element) {
|
|
|
133
130
|
|
|
134
131
|
const supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== undefined);
|
|
135
132
|
|
|
136
|
-
class
|
|
133
|
+
class GroupAnimation {
|
|
137
134
|
constructor(animations) {
|
|
138
135
|
// Bound to accomodate common `return animation.stop` pattern
|
|
139
136
|
this.stop = () => this.runAll("stop");
|
|
140
137
|
this.animations = animations.filter(Boolean);
|
|
141
138
|
}
|
|
142
139
|
get finished() {
|
|
143
|
-
|
|
144
|
-
return Promise.all(this.animations.map((animation) => "finished" in animation ? animation.finished : animation));
|
|
140
|
+
return Promise.all(this.animations.map((animation) => animation.finished));
|
|
145
141
|
}
|
|
146
142
|
/**
|
|
147
143
|
* TODO: Filter out cancelled or stopped animations before returning
|
|
@@ -212,156 +208,122 @@ class BaseGroupPlaybackControls {
|
|
|
212
208
|
}
|
|
213
209
|
}
|
|
214
210
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
*/
|
|
219
|
-
class GroupPlaybackControls extends BaseGroupPlaybackControls {
|
|
220
|
-
then(onResolve, onReject) {
|
|
221
|
-
return Promise.all(this.animations).then(onResolve).catch(onReject);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function getValueTransition$1(transition, key) {
|
|
226
|
-
return transition
|
|
227
|
-
? transition[key] ||
|
|
228
|
-
transition["default"] ||
|
|
229
|
-
transition
|
|
230
|
-
: undefined;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Implement a practical max duration for keyframe generation
|
|
235
|
-
* to prevent infinite loops
|
|
236
|
-
*/
|
|
237
|
-
const maxGeneratorDuration = 20000;
|
|
238
|
-
function calcGeneratorDuration(generator) {
|
|
239
|
-
let duration = 0;
|
|
240
|
-
const timeStep = 50;
|
|
241
|
-
let state = generator.next(duration);
|
|
242
|
-
while (!state.done && duration < maxGeneratorDuration) {
|
|
243
|
-
duration += timeStep;
|
|
244
|
-
state = generator.next(duration);
|
|
211
|
+
class GroupAnimationWithThen extends GroupAnimation {
|
|
212
|
+
then(onResolve, _onReject) {
|
|
213
|
+
return this.finished.finally(onResolve).then(() => { });
|
|
245
214
|
}
|
|
246
|
-
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Create a progress => progress easing function from a generator.
|
|
251
|
-
*/
|
|
252
|
-
function createGeneratorEasing(options, scale = 100, createGenerator) {
|
|
253
|
-
const generator = createGenerator({ ...options, keyframes: [0, scale] });
|
|
254
|
-
const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
255
|
-
return {
|
|
256
|
-
type: "keyframes",
|
|
257
|
-
ease: (progress) => {
|
|
258
|
-
return generator.next(duration * progress).value / scale;
|
|
259
|
-
},
|
|
260
|
-
duration: millisecondsToSeconds(duration),
|
|
261
|
-
};
|
|
262
215
|
}
|
|
263
216
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
217
|
+
const isCSSVar = (name) => name.startsWith("--");
|
|
218
|
+
const style = {
|
|
219
|
+
set: (element, name, value) => {
|
|
220
|
+
isCSSVar(name)
|
|
221
|
+
? element.style.setProperty(name, value)
|
|
222
|
+
: (element.style[name] = value);
|
|
223
|
+
},
|
|
224
|
+
get: (element, name) => {
|
|
225
|
+
return isCSSVar(name)
|
|
226
|
+
? element.style.getPropertyValue(name)
|
|
227
|
+
: element.style[name];
|
|
228
|
+
},
|
|
229
|
+
};
|
|
267
230
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
231
|
+
const isNotNull$1 = (value) => value !== null;
|
|
232
|
+
function getFinalKeyframe$1(keyframes, { repeat, repeatType = "loop" }, finalKeyframe) {
|
|
233
|
+
const resolvedKeyframes = keyframes.filter(isNotNull$1);
|
|
234
|
+
const index = repeat && repeatType !== "loop" && repeat % 2 === 1
|
|
235
|
+
? 0
|
|
236
|
+
: resolvedKeyframes.length - 1;
|
|
237
|
+
return !index || finalKeyframe === undefined
|
|
238
|
+
? resolvedKeyframes[index]
|
|
239
|
+
: finalKeyframe;
|
|
271
240
|
}
|
|
272
241
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
get duration() {
|
|
278
|
-
var _a, _b, _c;
|
|
279
|
-
const durationInMs = ((_b = (_a = this.animation) === null || _a === void 0 ? void 0 : _a.effect) === null || _b === void 0 ? void 0 : _b.getComputedTiming().duration) ||
|
|
280
|
-
((_c = this.options) === null || _c === void 0 ? void 0 : _c.duration) ||
|
|
281
|
-
300;
|
|
282
|
-
return millisecondsToSeconds(Number(durationInMs));
|
|
283
|
-
}
|
|
284
|
-
get time() {
|
|
285
|
-
var _a;
|
|
286
|
-
if (this.animation) {
|
|
287
|
-
return millisecondsToSeconds(((_a = this.animation) === null || _a === void 0 ? void 0 : _a.currentTime) || 0);
|
|
288
|
-
}
|
|
289
|
-
return 0;
|
|
290
|
-
}
|
|
291
|
-
set time(newTime) {
|
|
292
|
-
if (this.animation) {
|
|
293
|
-
this.animation.currentTime = secondsToMilliseconds(newTime);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
get speed() {
|
|
297
|
-
return this.animation ? this.animation.playbackRate : 1;
|
|
298
|
-
}
|
|
299
|
-
set speed(newSpeed) {
|
|
300
|
-
if (this.animation) {
|
|
301
|
-
this.animation.playbackRate = newSpeed;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
get state() {
|
|
305
|
-
return this.animation ? this.animation.playState : "finished";
|
|
306
|
-
}
|
|
307
|
-
get startTime() {
|
|
308
|
-
return this.animation ? this.animation.startTime : null;
|
|
309
|
-
}
|
|
310
|
-
get finished() {
|
|
311
|
-
return this.animation ? this.animation.finished : Promise.resolve();
|
|
242
|
+
const supportsPartialKeyframes = /*@__PURE__*/ memo(() => {
|
|
243
|
+
try {
|
|
244
|
+
document.createElement("div").animate({ opacity: [1] });
|
|
312
245
|
}
|
|
313
|
-
|
|
314
|
-
|
|
246
|
+
catch (e) {
|
|
247
|
+
return false;
|
|
315
248
|
}
|
|
316
|
-
|
|
317
|
-
|
|
249
|
+
return true;
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
const pxValues = new Set([
|
|
253
|
+
// Border props
|
|
254
|
+
"borderWidth",
|
|
255
|
+
"borderTopWidth",
|
|
256
|
+
"borderRightWidth",
|
|
257
|
+
"borderBottomWidth",
|
|
258
|
+
"borderLeftWidth",
|
|
259
|
+
"borderRadius",
|
|
260
|
+
"radius",
|
|
261
|
+
"borderTopLeftRadius",
|
|
262
|
+
"borderTopRightRadius",
|
|
263
|
+
"borderBottomRightRadius",
|
|
264
|
+
"borderBottomLeftRadius",
|
|
265
|
+
// Positioning props
|
|
266
|
+
"width",
|
|
267
|
+
"maxWidth",
|
|
268
|
+
"height",
|
|
269
|
+
"maxHeight",
|
|
270
|
+
"top",
|
|
271
|
+
"right",
|
|
272
|
+
"bottom",
|
|
273
|
+
"left",
|
|
274
|
+
// Spacing props
|
|
275
|
+
"padding",
|
|
276
|
+
"paddingTop",
|
|
277
|
+
"paddingRight",
|
|
278
|
+
"paddingBottom",
|
|
279
|
+
"paddingLeft",
|
|
280
|
+
"margin",
|
|
281
|
+
"marginTop",
|
|
282
|
+
"marginRight",
|
|
283
|
+
"marginBottom",
|
|
284
|
+
"marginLeft",
|
|
285
|
+
// Misc
|
|
286
|
+
"backgroundPositionX",
|
|
287
|
+
"backgroundPositionY",
|
|
288
|
+
]);
|
|
289
|
+
|
|
290
|
+
function hydrateKeyframes(element, name, keyframes, pseudoElement) {
|
|
291
|
+
if (!Array.isArray(keyframes)) {
|
|
292
|
+
keyframes = [keyframes];
|
|
318
293
|
}
|
|
319
|
-
|
|
320
|
-
if (
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
294
|
+
for (let i = 0; i < keyframes.length; i++) {
|
|
295
|
+
if (keyframes[i] === null) {
|
|
296
|
+
keyframes[i] =
|
|
297
|
+
i === 0 && !pseudoElement
|
|
298
|
+
? style.get(element, name)
|
|
299
|
+
: keyframes[i - 1];
|
|
324
300
|
}
|
|
325
|
-
if (
|
|
326
|
-
|
|
301
|
+
if (typeof keyframes[i] === "number" && pxValues.has(name)) {
|
|
302
|
+
keyframes[i] = keyframes[i] + "px";
|
|
327
303
|
}
|
|
328
|
-
this.cancel();
|
|
329
|
-
}
|
|
330
|
-
flatten() {
|
|
331
|
-
var _a, _b;
|
|
332
|
-
if (!this.animation || !((_a = this.options) === null || _a === void 0 ? void 0 : _a.allowFlatten))
|
|
333
|
-
return;
|
|
334
|
-
(_b = this.animation.effect) === null || _b === void 0 ? void 0 : _b.updateTiming({ easing: "linear" });
|
|
335
|
-
}
|
|
336
|
-
attachTimeline(timeline) {
|
|
337
|
-
if (this.animation)
|
|
338
|
-
attachTimeline(this.animation, timeline);
|
|
339
|
-
return noop;
|
|
340
|
-
}
|
|
341
|
-
complete() {
|
|
342
|
-
this.animation && this.animation.finish();
|
|
343
304
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
this.animation && this.animation.cancel();
|
|
347
|
-
}
|
|
348
|
-
catch (e) { }
|
|
305
|
+
if (!pseudoElement && !supportsPartialKeyframes() && keyframes.length < 2) {
|
|
306
|
+
keyframes.unshift(style.get(element, name));
|
|
349
307
|
}
|
|
308
|
+
return keyframes;
|
|
350
309
|
}
|
|
351
310
|
|
|
311
|
+
const statsBuffer = {
|
|
312
|
+
value: null,
|
|
313
|
+
addProjectionMetrics: null,
|
|
314
|
+
};
|
|
315
|
+
|
|
352
316
|
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
|
|
353
317
|
|
|
354
318
|
/**
|
|
355
319
|
* Add the ability for test suites to manually set support flags
|
|
356
320
|
* to better test more environments.
|
|
357
321
|
*/
|
|
358
|
-
const supportsFlags = {
|
|
359
|
-
linearEasing: undefined,
|
|
360
|
-
};
|
|
322
|
+
const supportsFlags = {};
|
|
361
323
|
|
|
362
324
|
function memoSupports(callback, supportsFlag) {
|
|
363
325
|
const memoized = memo(callback);
|
|
364
|
-
return () =>
|
|
326
|
+
return () => supportsFlags[supportsFlag] ?? memoized();
|
|
365
327
|
}
|
|
366
328
|
|
|
367
329
|
const supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {
|
|
@@ -382,20 +344,13 @@ resolution = 10 // as milliseconds
|
|
|
382
344
|
let points = "";
|
|
383
345
|
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
384
346
|
for (let i = 0; i < numPoints; i++) {
|
|
385
|
-
points += easing(
|
|
347
|
+
points += easing(i / (numPoints - 1)) + ", ";
|
|
386
348
|
}
|
|
387
349
|
return `linear(${points.substring(0, points.length - 2)})`;
|
|
388
350
|
};
|
|
389
351
|
|
|
390
|
-
function isWaapiSupportedEasing(easing) {
|
|
391
|
-
return Boolean((typeof easing === "function" && supportsLinearEasing()) ||
|
|
392
|
-
!easing ||
|
|
393
|
-
(typeof easing === "string" &&
|
|
394
|
-
(easing in supportedWaapiEasing || supportsLinearEasing())) ||
|
|
395
|
-
isBezierDefinition(easing) ||
|
|
396
|
-
(Array.isArray(easing) && easing.every(isWaapiSupportedEasing)));
|
|
397
|
-
}
|
|
398
352
|
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
|
|
353
|
+
|
|
399
354
|
const supportedWaapiEasing = {
|
|
400
355
|
linear: "linear",
|
|
401
356
|
ease: "ease",
|
|
@@ -407,6 +362,7 @@ const supportedWaapiEasing = {
|
|
|
407
362
|
backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
|
|
408
363
|
backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),
|
|
409
364
|
};
|
|
365
|
+
|
|
410
366
|
function mapEasingToNativeEasing(easing, duration) {
|
|
411
367
|
if (!easing) {
|
|
412
368
|
return undefined;
|
|
@@ -426,6 +382,247 @@ function mapEasingToNativeEasing(easing, duration) {
|
|
|
426
382
|
}
|
|
427
383
|
}
|
|
428
384
|
|
|
385
|
+
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}, pseudoElement = undefined) {
|
|
386
|
+
const keyframeOptions = {
|
|
387
|
+
[valueName]: keyframes,
|
|
388
|
+
};
|
|
389
|
+
if (times)
|
|
390
|
+
keyframeOptions.offset = times;
|
|
391
|
+
const easing = mapEasingToNativeEasing(ease, duration);
|
|
392
|
+
/**
|
|
393
|
+
* If this is an easing array, apply to keyframes, not animation as a whole
|
|
394
|
+
*/
|
|
395
|
+
if (Array.isArray(easing))
|
|
396
|
+
keyframeOptions.easing = easing;
|
|
397
|
+
const animation = element.animate(keyframeOptions, {
|
|
398
|
+
delay,
|
|
399
|
+
duration,
|
|
400
|
+
easing: !Array.isArray(easing) ? easing : "linear",
|
|
401
|
+
fill: "both",
|
|
402
|
+
iterations: repeat + 1,
|
|
403
|
+
direction: repeatType === "reverse" ? "alternate" : "normal",
|
|
404
|
+
pseudoElement,
|
|
405
|
+
});
|
|
406
|
+
return animation;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function isGenerator(type) {
|
|
410
|
+
return typeof type === "function" && "applyToOptions" in type;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function applyGeneratorOptions({ type, ...options }) {
|
|
414
|
+
if (isGenerator(type)) {
|
|
415
|
+
return type.applyToOptions(options);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
options.duration ?? (options.duration = 300);
|
|
419
|
+
options.ease ?? (options.ease = "easeOut");
|
|
420
|
+
}
|
|
421
|
+
return options;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const animationMaps = new WeakMap();
|
|
425
|
+
const animationMapKey = (name, pseudoElement) => `${name}:${pseudoElement}`;
|
|
426
|
+
function getAnimationMap(element) {
|
|
427
|
+
const map = animationMaps.get(element) || new Map();
|
|
428
|
+
animationMaps.set(element, map);
|
|
429
|
+
return map;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API.
|
|
433
|
+
*/
|
|
434
|
+
class NativeAnimation {
|
|
435
|
+
constructor(options) {
|
|
436
|
+
/**
|
|
437
|
+
* If we already have an animation, we don't need to instantiate one
|
|
438
|
+
* and can just use this as a controls interface.
|
|
439
|
+
*/
|
|
440
|
+
if ("animation" in options) {
|
|
441
|
+
this.animation = options.animation;
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
const { element, name, keyframes: unresolvedKeyframes, pseudoElement, allowFlatten = false, } = options;
|
|
445
|
+
let { transition } = options;
|
|
446
|
+
this.allowFlatten = allowFlatten;
|
|
447
|
+
/**
|
|
448
|
+
* Stop any existing animations on the element before reading existing keyframes.
|
|
449
|
+
*
|
|
450
|
+
* TODO: Check for VisualElement before using animation state. This is a fallback
|
|
451
|
+
* for mini animate(). Do this when implementing NativeAnimationExtended.
|
|
452
|
+
*/
|
|
453
|
+
const animationMap = getAnimationMap(element);
|
|
454
|
+
const key = animationMapKey(name, pseudoElement || "");
|
|
455
|
+
const currentAnimation = animationMap.get(key);
|
|
456
|
+
currentAnimation && currentAnimation.stop();
|
|
457
|
+
/**
|
|
458
|
+
* TODO: If these keyframes aren't correctly hydrated then we want to throw
|
|
459
|
+
* run an instant animation.
|
|
460
|
+
*/
|
|
461
|
+
const keyframes = hydrateKeyframes(element, name, unresolvedKeyframes, pseudoElement);
|
|
462
|
+
exports.invariant(typeof transition.type !== "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "motion"?`);
|
|
463
|
+
transition = applyGeneratorOptions(transition);
|
|
464
|
+
this.animation = startWaapiAnimation(element, name, keyframes, transition, pseudoElement);
|
|
465
|
+
if (transition.autoplay === false) {
|
|
466
|
+
this.animation.pause();
|
|
467
|
+
}
|
|
468
|
+
this.removeAnimation = () => animationMap.delete(key);
|
|
469
|
+
this.animation.onfinish = () => {
|
|
470
|
+
if (!pseudoElement) {
|
|
471
|
+
style.set(element, name, getFinalKeyframe$1(keyframes, transition));
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
this.commitStyles();
|
|
475
|
+
}
|
|
476
|
+
this.cancel();
|
|
477
|
+
};
|
|
478
|
+
/**
|
|
479
|
+
* TODO: Check for VisualElement before using animation state.
|
|
480
|
+
*/
|
|
481
|
+
animationMap.set(key, this);
|
|
482
|
+
}
|
|
483
|
+
play() {
|
|
484
|
+
this.animation.play();
|
|
485
|
+
}
|
|
486
|
+
pause() {
|
|
487
|
+
this.animation.pause();
|
|
488
|
+
}
|
|
489
|
+
complete() {
|
|
490
|
+
this.animation.finish();
|
|
491
|
+
}
|
|
492
|
+
cancel() {
|
|
493
|
+
try {
|
|
494
|
+
this.animation.cancel();
|
|
495
|
+
}
|
|
496
|
+
catch (e) { }
|
|
497
|
+
this.removeAnimation();
|
|
498
|
+
}
|
|
499
|
+
stop() {
|
|
500
|
+
const { state } = this;
|
|
501
|
+
if (state === "idle" || state === "finished") {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
this.commitStyles();
|
|
505
|
+
this.cancel();
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* WAAPI doesn't natively have any interruption capabilities.
|
|
509
|
+
*
|
|
510
|
+
* In this method, we commit styles back to the DOM before cancelling
|
|
511
|
+
* the animation.
|
|
512
|
+
*
|
|
513
|
+
* This is designed to be overridden by NativeAnimationExtended, which
|
|
514
|
+
* will create a renderless JS animation and sample it twice to calculate
|
|
515
|
+
* its current value, "previous" value, and therefore allow
|
|
516
|
+
* Motion to also correctly calculate velocity for any subsequent animation
|
|
517
|
+
* while deferring the commit until the next animation frame.
|
|
518
|
+
*/
|
|
519
|
+
commitStyles() {
|
|
520
|
+
this.animation.commitStyles?.();
|
|
521
|
+
}
|
|
522
|
+
get duration() {
|
|
523
|
+
console.log(this.animation.effect?.getComputedTiming());
|
|
524
|
+
const duration = this.animation.effect?.getComputedTiming().duration || 0;
|
|
525
|
+
return millisecondsToSeconds(Number(duration));
|
|
526
|
+
}
|
|
527
|
+
get time() {
|
|
528
|
+
return millisecondsToSeconds(Number(this.animation.currentTime) || 0);
|
|
529
|
+
}
|
|
530
|
+
set time(newTime) {
|
|
531
|
+
this.animation.currentTime = secondsToMilliseconds(newTime);
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* The playback speed of the animation.
|
|
535
|
+
* 1 = normal speed, 2 = double speed, 0.5 = half speed.
|
|
536
|
+
*/
|
|
537
|
+
get speed() {
|
|
538
|
+
return this.animation.playbackRate;
|
|
539
|
+
}
|
|
540
|
+
set speed(newSpeed) {
|
|
541
|
+
this.animation.playbackRate = newSpeed;
|
|
542
|
+
}
|
|
543
|
+
get state() {
|
|
544
|
+
return this.animation.playState;
|
|
545
|
+
}
|
|
546
|
+
get startTime() {
|
|
547
|
+
return Number(this.animation.startTime);
|
|
548
|
+
}
|
|
549
|
+
get finished() {
|
|
550
|
+
return this.animation.finished;
|
|
551
|
+
}
|
|
552
|
+
flatten() {
|
|
553
|
+
if (this.allowFlatten) {
|
|
554
|
+
this.animation.effect?.updateTiming({ easing: "linear" });
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Attaches a timeline to the animation, for instance the `ScrollTimeline`.
|
|
559
|
+
*/
|
|
560
|
+
attachTimeline(timeline) {
|
|
561
|
+
this.animation.timeline = timeline;
|
|
562
|
+
this.animation.onfinish = null;
|
|
563
|
+
return noop;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Allows the animation to be awaited.
|
|
567
|
+
*
|
|
568
|
+
* @deprecated Use `finished` instead.
|
|
569
|
+
*/
|
|
570
|
+
then(onResolve, onReject) {
|
|
571
|
+
return this.finished.then(onResolve).catch(onReject);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function getValueTransition$1(transition, key) {
|
|
576
|
+
return (transition?.[key] ??
|
|
577
|
+
transition?.["default"] ??
|
|
578
|
+
transition);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Implement a practical max duration for keyframe generation
|
|
583
|
+
* to prevent infinite loops
|
|
584
|
+
*/
|
|
585
|
+
const maxGeneratorDuration = 20000;
|
|
586
|
+
function calcGeneratorDuration(generator) {
|
|
587
|
+
let duration = 0;
|
|
588
|
+
const timeStep = 50;
|
|
589
|
+
let state = generator.next(duration);
|
|
590
|
+
while (!state.done && duration < maxGeneratorDuration) {
|
|
591
|
+
duration += timeStep;
|
|
592
|
+
state = generator.next(duration);
|
|
593
|
+
}
|
|
594
|
+
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Create a progress => progress easing function from a generator.
|
|
599
|
+
*/
|
|
600
|
+
function createGeneratorEasing(options, scale = 100, createGenerator) {
|
|
601
|
+
const generator = createGenerator({ ...options, keyframes: [0, scale] });
|
|
602
|
+
const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
603
|
+
return {
|
|
604
|
+
type: "keyframes",
|
|
605
|
+
ease: (progress) => {
|
|
606
|
+
return generator.next(duration * progress).value / scale;
|
|
607
|
+
},
|
|
608
|
+
duration: millisecondsToSeconds(duration),
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
function isWaapiSupportedEasing(easing) {
|
|
613
|
+
return Boolean((typeof easing === "function" && supportsLinearEasing()) ||
|
|
614
|
+
!easing ||
|
|
615
|
+
(typeof easing === "string" &&
|
|
616
|
+
(easing in supportedWaapiEasing || supportsLinearEasing())) ||
|
|
617
|
+
isBezierDefinition(easing) ||
|
|
618
|
+
(Array.isArray(easing) && easing.every(isWaapiSupportedEasing)));
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
function attachTimeline(animation, timeline) {
|
|
622
|
+
animation.timeline = timeline;
|
|
623
|
+
animation.onfinish = null;
|
|
624
|
+
}
|
|
625
|
+
|
|
429
626
|
const stepsOrder = [
|
|
430
627
|
"read", // Read
|
|
431
628
|
"resolveKeyframes", // Write/Read/Write/Read
|
|
@@ -435,11 +632,6 @@ const stepsOrder = [
|
|
|
435
632
|
"postRender", // Compute
|
|
436
633
|
];
|
|
437
634
|
|
|
438
|
-
const statsBuffer = {
|
|
439
|
-
value: null,
|
|
440
|
-
addProjectionMetrics: null,
|
|
441
|
-
};
|
|
442
|
-
|
|
443
635
|
function createRenderStep(runNextFrame, stepName) {
|
|
444
636
|
/**
|
|
445
637
|
* We create and reuse two queues, one to queue jobs for the current frame
|
|
@@ -545,9 +737,11 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
545
737
|
}, {});
|
|
546
738
|
const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
|
|
547
739
|
const processBatch = () => {
|
|
548
|
-
const timestamp =
|
|
740
|
+
const timestamp = MotionGlobalConfig.useManualTiming
|
|
741
|
+
? state.timestamp
|
|
742
|
+
: performance.now();
|
|
549
743
|
runNextFrame = false;
|
|
550
|
-
{
|
|
744
|
+
if (!MotionGlobalConfig.useManualTiming) {
|
|
551
745
|
state.delta = useDefaultElapsed
|
|
552
746
|
? 1000 / 60
|
|
553
747
|
: Math.max(Math.min(timestamp - state.timestamp, maxElapsed$1), 1);
|
|
@@ -629,21 +823,16 @@ function isDragActive() {
|
|
|
629
823
|
}
|
|
630
824
|
|
|
631
825
|
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
632
|
-
var _a;
|
|
633
826
|
if (elementOrSelector instanceof EventTarget) {
|
|
634
827
|
return [elementOrSelector];
|
|
635
828
|
}
|
|
636
829
|
else if (typeof elementOrSelector === "string") {
|
|
637
830
|
let root = document;
|
|
638
831
|
if (scope) {
|
|
639
|
-
// TODO: Refactor to utils package
|
|
640
|
-
// invariant(
|
|
641
|
-
// Boolean(scope.current),
|
|
642
|
-
// "Scope provided, but no element detected."
|
|
643
|
-
// )
|
|
644
832
|
root = scope.current;
|
|
645
833
|
}
|
|
646
|
-
const elements =
|
|
834
|
+
const elements = selectorCache?.[elementOrSelector] ??
|
|
835
|
+
root.querySelectorAll(elementOrSelector);
|
|
647
836
|
return elements ? Array.from(elements) : [];
|
|
648
837
|
}
|
|
649
838
|
return Array.from(elementOrSelector);
|
|
@@ -842,7 +1031,7 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
842
1031
|
if (target instanceof HTMLElement) {
|
|
843
1032
|
target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions));
|
|
844
1033
|
if (!isElementKeyboardAccessible(target) &&
|
|
845
|
-
target.
|
|
1034
|
+
!target.hasAttribute("tabindex")) {
|
|
846
1035
|
target.tabIndex = 0;
|
|
847
1036
|
}
|
|
848
1037
|
}
|
|
@@ -875,7 +1064,7 @@ class MotionValue {
|
|
|
875
1064
|
* This will be replaced by the build step with the latest version number.
|
|
876
1065
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
877
1066
|
*/
|
|
878
|
-
this.version = "12.6.
|
|
1067
|
+
this.version = "12.6.4-alpha.0";
|
|
879
1068
|
/**
|
|
880
1069
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
881
1070
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -1424,9 +1613,17 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
1424
1613
|
const easing = generateLinearEasing((progress) => generator.next(calculatedDuration * progress).value, calculatedDuration, 30);
|
|
1425
1614
|
return calculatedDuration + "ms " + easing;
|
|
1426
1615
|
},
|
|
1616
|
+
toTransition: () => { },
|
|
1427
1617
|
};
|
|
1428
1618
|
return generator;
|
|
1429
1619
|
}
|
|
1620
|
+
spring.applyToOptions = (options) => {
|
|
1621
|
+
const generatorOptions = createGeneratorEasing(options, 100, spring);
|
|
1622
|
+
options.ease = supportsLinearEasing() ? generatorOptions.ease : "easeOut";
|
|
1623
|
+
options.duration = secondsToMilliseconds(generatorOptions.duration);
|
|
1624
|
+
options.type = "keyframes";
|
|
1625
|
+
return options;
|
|
1626
|
+
};
|
|
1430
1627
|
|
|
1431
1628
|
const wrap = (min, max, v) => {
|
|
1432
1629
|
const rangeSize = max - min;
|
|
@@ -1510,7 +1707,6 @@ function calculateRepeatDuration(duration, repeat, _repeatDelay) {
|
|
|
1510
1707
|
* calculate an absolute time for the next keyframes.
|
|
1511
1708
|
*/
|
|
1512
1709
|
function calcNextTime(current, next, prev, labels) {
|
|
1513
|
-
var _a;
|
|
1514
1710
|
if (typeof next === "number") {
|
|
1515
1711
|
return next;
|
|
1516
1712
|
}
|
|
@@ -1521,7 +1717,7 @@ function calcNextTime(current, next, prev, labels) {
|
|
|
1521
1717
|
return prev;
|
|
1522
1718
|
}
|
|
1523
1719
|
else {
|
|
1524
|
-
return
|
|
1720
|
+
return labels.get(next) ?? current;
|
|
1525
1721
|
}
|
|
1526
1722
|
}
|
|
1527
1723
|
|
|
@@ -1634,7 +1830,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
1634
1830
|
const numKeyframes = valueKeyframesAsList.length;
|
|
1635
1831
|
const createGenerator = isGenerator(type)
|
|
1636
1832
|
? type
|
|
1637
|
-
: generators
|
|
1833
|
+
: generators?.[type];
|
|
1638
1834
|
if (numKeyframes <= 2 && createGenerator) {
|
|
1639
1835
|
/**
|
|
1640
1836
|
* As we're creating an easing function from a spring,
|
|
@@ -1656,7 +1852,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
1656
1852
|
ease = springEasing.ease;
|
|
1657
1853
|
duration = springEasing.duration;
|
|
1658
1854
|
}
|
|
1659
|
-
duration
|
|
1855
|
+
duration ?? (duration = defaultDuration);
|
|
1660
1856
|
const startTime = currentTime + calculatedDelay;
|
|
1661
1857
|
/**
|
|
1662
1858
|
* If there's only one time offset of 0, fill in a second with length 1
|
|
@@ -1865,7 +2061,7 @@ const resolveFinalValueInKeyframes = (v) => {
|
|
|
1865
2061
|
|
|
1866
2062
|
function getValueState(visualElement) {
|
|
1867
2063
|
const state = [{}, {}];
|
|
1868
|
-
visualElement
|
|
2064
|
+
visualElement?.values.forEach((value, key) => {
|
|
1869
2065
|
state[0][key] = value.get();
|
|
1870
2066
|
state[1][key] = value.getVelocity();
|
|
1871
2067
|
});
|
|
@@ -1938,11 +2134,6 @@ function addValueToWillChange(visualElement, key) {
|
|
|
1938
2134
|
if (isWillChangeMotionValue(willChange)) {
|
|
1939
2135
|
return willChange.add(key);
|
|
1940
2136
|
}
|
|
1941
|
-
else if (!willChange && MotionGlobalConfig.WillChange) {
|
|
1942
|
-
const newWillChange = new MotionGlobalConfig.WillChange("auto");
|
|
1943
|
-
visualElement.addValue("willChange", newWillChange);
|
|
1944
|
-
newWillChange.add(key);
|
|
1945
|
-
}
|
|
1946
2137
|
}
|
|
1947
2138
|
|
|
1948
2139
|
/**
|
|
@@ -2202,11 +2393,10 @@ const color = {
|
|
|
2202
2393
|
const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
|
|
2203
2394
|
|
|
2204
2395
|
function test(v) {
|
|
2205
|
-
var _a, _b;
|
|
2206
2396
|
return (isNaN(v) &&
|
|
2207
2397
|
typeof v === "string" &&
|
|
2208
|
-
(
|
|
2209
|
-
(
|
|
2398
|
+
(v.match(floatRegex)?.length || 0) +
|
|
2399
|
+
(v.match(colorRegex)?.length || 0) >
|
|
2210
2400
|
0);
|
|
2211
2401
|
}
|
|
2212
2402
|
const NUMBER_TOKEN = "number";
|
|
@@ -2594,8 +2784,7 @@ function measureAllKeyframes() {
|
|
|
2594
2784
|
const restore = transformsToRestore.get(element);
|
|
2595
2785
|
if (restore) {
|
|
2596
2786
|
restore.forEach(([key, value]) => {
|
|
2597
|
-
|
|
2598
|
-
(_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value);
|
|
2787
|
+
element.getValue(key)?.set(value);
|
|
2599
2788
|
});
|
|
2600
2789
|
}
|
|
2601
2790
|
});
|
|
@@ -2682,7 +2871,7 @@ class KeyframeResolver {
|
|
|
2682
2871
|
* If the first keyframe is null, we need to find its value by sampling the element
|
|
2683
2872
|
*/
|
|
2684
2873
|
if (i === 0) {
|
|
2685
|
-
const currentValue = motionValue
|
|
2874
|
+
const currentValue = motionValue?.get();
|
|
2686
2875
|
const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
2687
2876
|
if (currentValue !== undefined) {
|
|
2688
2877
|
unresolvedKeyframes[0] = currentValue;
|
|
@@ -2763,7 +2952,7 @@ function parseCSSVariable(current) {
|
|
|
2763
2952
|
if (!match)
|
|
2764
2953
|
return [,];
|
|
2765
2954
|
const [, token1, token2, fallback] = match;
|
|
2766
|
-
return [`--${token1
|
|
2955
|
+
return [`--${token1 ?? token2}`, fallback];
|
|
2767
2956
|
}
|
|
2768
2957
|
const maxDepth = 4;
|
|
2769
2958
|
function getVariableValue(current, element, depth = 1) {
|
|
@@ -2902,7 +3091,6 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
2902
3091
|
}
|
|
2903
3092
|
}
|
|
2904
3093
|
measureEndState() {
|
|
2905
|
-
var _a;
|
|
2906
3094
|
const { element, name, unresolvedKeyframes } = this;
|
|
2907
3095
|
if (!element || !element.current)
|
|
2908
3096
|
return;
|
|
@@ -2915,7 +3103,7 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
2915
3103
|
this.finalKeyframe = finalKeyframe;
|
|
2916
3104
|
}
|
|
2917
3105
|
// If we removed transform values, reapply them before the next render
|
|
2918
|
-
if (
|
|
3106
|
+
if (this.removedTransforms?.length) {
|
|
2919
3107
|
this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
|
|
2920
3108
|
element
|
|
2921
3109
|
.getValue(unsetTransformName)
|
|
@@ -3271,13 +3459,12 @@ function mixObject(a, b) {
|
|
|
3271
3459
|
};
|
|
3272
3460
|
}
|
|
3273
3461
|
function matchOrder(origin, target) {
|
|
3274
|
-
var _a;
|
|
3275
3462
|
const orderedOrigin = [];
|
|
3276
3463
|
const pointers = { color: 0, var: 0, number: 0 };
|
|
3277
3464
|
for (let i = 0; i < target.values.length; i++) {
|
|
3278
3465
|
const type = target.types[i];
|
|
3279
3466
|
const originIndex = origin.indexes[type][pointers[type]];
|
|
3280
|
-
const originValue =
|
|
3467
|
+
const originValue = origin.values[originIndex] ?? 0;
|
|
3281
3468
|
orderedOrigin[i] = originValue;
|
|
3282
3469
|
pointers[type]++;
|
|
3283
3470
|
}
|
|
@@ -3432,7 +3619,7 @@ const easingDefinitionToFunction = (definition) => {
|
|
|
3432
3619
|
|
|
3433
3620
|
function createMixers(output, ease, customMixer) {
|
|
3434
3621
|
const mixers = [];
|
|
3435
|
-
const mixerFactory = customMixer || mix;
|
|
3622
|
+
const mixerFactory = customMixer || MotionGlobalConfig.mix || mix;
|
|
3436
3623
|
const numMixers = output.length - 1;
|
|
3437
3624
|
for (let i = 0; i < numMixers; i++) {
|
|
3438
3625
|
let mixer = mixerFactory(output[i], output[i + 1]);
|
|
@@ -3504,7 +3691,7 @@ function convertOffsetToTimes(offset, duration) {
|
|
|
3504
3691
|
return offset.map((o) => o * duration);
|
|
3505
3692
|
}
|
|
3506
3693
|
|
|
3507
|
-
function defaultEasing
|
|
3694
|
+
function defaultEasing(values, easing) {
|
|
3508
3695
|
return values.map(() => easing || easeInOut).splice(0, values.length - 1);
|
|
3509
3696
|
}
|
|
3510
3697
|
function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "easeInOut", }) {
|
|
@@ -3535,7 +3722,7 @@ function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "e
|
|
|
3535
3722
|
const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, {
|
|
3536
3723
|
ease: Array.isArray(easingFunctions)
|
|
3537
3724
|
? easingFunctions
|
|
3538
|
-
: defaultEasing
|
|
3725
|
+
: defaultEasing(keyframeValues, easingFunctions),
|
|
3539
3726
|
});
|
|
3540
3727
|
return {
|
|
3541
3728
|
calculatedDuration: duration,
|
|
@@ -3617,7 +3804,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
3617
3804
|
onStop && onStop();
|
|
3618
3805
|
};
|
|
3619
3806
|
const { name, motionValue, element, keyframes } = this.options;
|
|
3620
|
-
const KeyframeResolver$1 =
|
|
3807
|
+
const KeyframeResolver$1 = element?.KeyframeResolver || KeyframeResolver;
|
|
3621
3808
|
const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
|
|
3622
3809
|
this.resolver = new KeyframeResolver$1(keyframes, onResolved, name, motionValue, element);
|
|
3623
3810
|
this.resolver.scheduleResolve();
|
|
@@ -3866,7 +4053,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
3866
4053
|
this.startTime = now - this.holdTime;
|
|
3867
4054
|
}
|
|
3868
4055
|
else if (!this.startTime) {
|
|
3869
|
-
this.startTime = startTime
|
|
4056
|
+
this.startTime = startTime ?? this.calcStartTime();
|
|
3870
4057
|
}
|
|
3871
4058
|
else if (this.state === "finished") {
|
|
3872
4059
|
this.startTime = now;
|
|
@@ -3884,13 +4071,12 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
3884
4071
|
this.driver.start();
|
|
3885
4072
|
}
|
|
3886
4073
|
pause() {
|
|
3887
|
-
var _a;
|
|
3888
4074
|
if (!this._resolved) {
|
|
3889
4075
|
this.pendingPlayState = "paused";
|
|
3890
4076
|
return;
|
|
3891
4077
|
}
|
|
3892
4078
|
this.state = "paused";
|
|
3893
|
-
this.holdTime =
|
|
4079
|
+
this.holdTime = this.currentTime ?? 0;
|
|
3894
4080
|
}
|
|
3895
4081
|
complete() {
|
|
3896
4082
|
if (this.state !== "running") {
|
|
@@ -3930,6 +4116,9 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
3930
4116
|
this.startTime = 0;
|
|
3931
4117
|
return this.tick(time, true);
|
|
3932
4118
|
}
|
|
4119
|
+
get finished() {
|
|
4120
|
+
return this.currentFinishedPromise;
|
|
4121
|
+
}
|
|
3933
4122
|
}
|
|
3934
4123
|
|
|
3935
4124
|
/**
|
|
@@ -3945,27 +4134,6 @@ const acceleratedValues = new Set([
|
|
|
3945
4134
|
// "background-color"
|
|
3946
4135
|
]);
|
|
3947
4136
|
|
|
3948
|
-
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
|
|
3949
|
-
const keyframeOptions = { [valueName]: keyframes };
|
|
3950
|
-
if (times)
|
|
3951
|
-
keyframeOptions.offset = times;
|
|
3952
|
-
const easing = mapEasingToNativeEasing(ease, duration);
|
|
3953
|
-
/**
|
|
3954
|
-
* If this is an easing array, apply to keyframes, not animation as a whole
|
|
3955
|
-
*/
|
|
3956
|
-
if (Array.isArray(easing))
|
|
3957
|
-
keyframeOptions.easing = easing;
|
|
3958
|
-
const animation = element.animate(keyframeOptions, {
|
|
3959
|
-
delay,
|
|
3960
|
-
duration,
|
|
3961
|
-
easing: !Array.isArray(easing) ? easing : "linear",
|
|
3962
|
-
fill: "both",
|
|
3963
|
-
iterations: repeat + 1,
|
|
3964
|
-
direction: repeatType === "reverse" ? "alternate" : "normal",
|
|
3965
|
-
});
|
|
3966
|
-
return animation;
|
|
3967
|
-
}
|
|
3968
|
-
|
|
3969
4137
|
const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
3970
4138
|
|
|
3971
4139
|
/**
|
|
@@ -4076,7 +4244,7 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
4076
4244
|
const animation = startWaapiAnimation(motionValue.owner.current, name, keyframes, { ...this.options, duration, times, ease });
|
|
4077
4245
|
// Override the browser calculated startTime with one synchronised to other JS
|
|
4078
4246
|
// and WAAPI animations starting this event loop.
|
|
4079
|
-
animation.startTime = startTime
|
|
4247
|
+
animation.startTime = startTime ?? this.calcStartTime();
|
|
4080
4248
|
if (this.pendingTimeline) {
|
|
4081
4249
|
attachTimeline(animation, this.pendingTimeline);
|
|
4082
4250
|
this.pendingTimeline = undefined;
|
|
@@ -4135,6 +4303,9 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
4135
4303
|
const { animation } = resolved;
|
|
4136
4304
|
return animation.playbackRate;
|
|
4137
4305
|
}
|
|
4306
|
+
get finished() {
|
|
4307
|
+
return this.resolved.animation.finished;
|
|
4308
|
+
}
|
|
4138
4309
|
set speed(newSpeed) {
|
|
4139
4310
|
const { resolved } = this;
|
|
4140
4311
|
if (!resolved)
|
|
@@ -4381,6 +4552,11 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
4381
4552
|
shouldSkip = true;
|
|
4382
4553
|
}
|
|
4383
4554
|
}
|
|
4555
|
+
if (MotionGlobalConfig.skipAnimations) {
|
|
4556
|
+
shouldSkip = true;
|
|
4557
|
+
options.duration = 0;
|
|
4558
|
+
options.delay = 0;
|
|
4559
|
+
}
|
|
4384
4560
|
/**
|
|
4385
4561
|
* If the transition type or easing has been explicitly set by the user
|
|
4386
4562
|
* then we don't want to allow flattening the animation.
|
|
@@ -4400,7 +4576,7 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
4400
4576
|
});
|
|
4401
4577
|
// We still want to return some animation controls here rather
|
|
4402
4578
|
// than returning undefined
|
|
4403
|
-
return new
|
|
4579
|
+
return new GroupAnimationWithThen([]);
|
|
4404
4580
|
}
|
|
4405
4581
|
}
|
|
4406
4582
|
/**
|
|
@@ -4428,7 +4604,6 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
|
|
|
4428
4604
|
return shouldBlock;
|
|
4429
4605
|
}
|
|
4430
4606
|
function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {
|
|
4431
|
-
var _a;
|
|
4432
4607
|
let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
|
|
4433
4608
|
if (transitionOverride)
|
|
4434
4609
|
transition = transitionOverride;
|
|
@@ -4437,7 +4612,7 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
|
|
|
4437
4612
|
visualElement.animationState &&
|
|
4438
4613
|
visualElement.animationState.getState()[type];
|
|
4439
4614
|
for (const key in target) {
|
|
4440
|
-
const value = visualElement.getValue(key,
|
|
4615
|
+
const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);
|
|
4441
4616
|
const valueTarget = target[key];
|
|
4442
4617
|
if (valueTarget === undefined ||
|
|
4443
4618
|
(animationTypeState &&
|
|
@@ -4596,7 +4771,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4596
4771
|
* and warn against mismatches.
|
|
4597
4772
|
*/
|
|
4598
4773
|
if (process.env.NODE_ENV === "development") {
|
|
4599
|
-
warnOnce(nextValue.version === "12.6.
|
|
4774
|
+
warnOnce(nextValue.version === "12.6.4-alpha.0", `Attempting to mix Motion versions ${nextValue.version} with 12.6.4-alpha.0 may not work as expected.`);
|
|
4600
4775
|
}
|
|
4601
4776
|
}
|
|
4602
4777
|
else if (isMotionValue(prevValue)) {
|
|
@@ -5020,10 +5195,10 @@ class VisualElement {
|
|
|
5020
5195
|
* directly from the instance (which might have performance implications).
|
|
5021
5196
|
*/
|
|
5022
5197
|
readValue(key, target) {
|
|
5023
|
-
var _a;
|
|
5024
5198
|
let value = this.latestValues[key] !== undefined || !this.current
|
|
5025
5199
|
? this.latestValues[key]
|
|
5026
|
-
:
|
|
5200
|
+
: this.getBaseTargetFromProps(this.props, key) ??
|
|
5201
|
+
this.readValueFromInstance(this.current, key, this.options);
|
|
5027
5202
|
if (value !== undefined && value !== null) {
|
|
5028
5203
|
if (typeof value === "string" &&
|
|
5029
5204
|
(isNumericalString(value) || isZeroValueString(value))) {
|
|
@@ -5049,11 +5224,10 @@ class VisualElement {
|
|
|
5049
5224
|
* props.
|
|
5050
5225
|
*/
|
|
5051
5226
|
getBaseTarget(key) {
|
|
5052
|
-
var _a;
|
|
5053
5227
|
const { initial } = this.props;
|
|
5054
5228
|
let valueFromInitial;
|
|
5055
5229
|
if (typeof initial === "string" || typeof initial === "object") {
|
|
5056
|
-
const variant = resolveVariantFromProps(this.props, initial,
|
|
5230
|
+
const variant = resolveVariantFromProps(this.props, initial, this.presenceContext?.custom);
|
|
5057
5231
|
if (variant) {
|
|
5058
5232
|
valueFromInitial = variant[key];
|
|
5059
5233
|
}
|
|
@@ -5420,7 +5594,6 @@ function isForcedMotionValue(key, { layout, layoutId }) {
|
|
|
5420
5594
|
}
|
|
5421
5595
|
|
|
5422
5596
|
function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
5423
|
-
var _a;
|
|
5424
5597
|
const { style } = props;
|
|
5425
5598
|
const newValues = {};
|
|
5426
5599
|
for (const key in style) {
|
|
@@ -5428,7 +5601,7 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
|
5428
5601
|
(prevProps.style &&
|
|
5429
5602
|
isMotionValue(prevProps.style[key])) ||
|
|
5430
5603
|
isForcedMotionValue(key, props) ||
|
|
5431
|
-
|
|
5604
|
+
visualElement?.getValue(key)?.liveStyle !== undefined) {
|
|
5432
5605
|
newValues[key] = style[key];
|
|
5433
5606
|
}
|
|
5434
5607
|
}
|
|
@@ -5707,7 +5880,7 @@ function createScopedAnimate(scope) {
|
|
|
5707
5880
|
else {
|
|
5708
5881
|
animations = animateSubject(subjectOrSequence, optionsOrKeyframes, options, scope);
|
|
5709
5882
|
}
|
|
5710
|
-
const animation = new
|
|
5883
|
+
const animation = new GroupAnimationWithThen(animations);
|
|
5711
5884
|
if (scope) {
|
|
5712
5885
|
scope.animations.push(animation);
|
|
5713
5886
|
}
|
|
@@ -5717,125 +5890,6 @@ function createScopedAnimate(scope) {
|
|
|
5717
5890
|
}
|
|
5718
5891
|
const animate = createScopedAnimate();
|
|
5719
5892
|
|
|
5720
|
-
function setCSSVar(element, name, value) {
|
|
5721
|
-
element.style.setProperty(name, value);
|
|
5722
|
-
}
|
|
5723
|
-
function setStyle(element, name, value) {
|
|
5724
|
-
element.style[name] = value;
|
|
5725
|
-
}
|
|
5726
|
-
|
|
5727
|
-
const supportsPartialKeyframes = /*@__PURE__*/ memo(() => {
|
|
5728
|
-
try {
|
|
5729
|
-
document.createElement("div").animate({ opacity: [1] });
|
|
5730
|
-
}
|
|
5731
|
-
catch (e) {
|
|
5732
|
-
return false;
|
|
5733
|
-
}
|
|
5734
|
-
return true;
|
|
5735
|
-
});
|
|
5736
|
-
|
|
5737
|
-
const state = new WeakMap();
|
|
5738
|
-
function hydrateKeyframes(valueName, keyframes, read) {
|
|
5739
|
-
for (let i = 0; i < keyframes.length; i++) {
|
|
5740
|
-
if (keyframes[i] === null) {
|
|
5741
|
-
keyframes[i] = i === 0 ? read() : keyframes[i - 1];
|
|
5742
|
-
}
|
|
5743
|
-
if (typeof keyframes[i] === "number" &&
|
|
5744
|
-
browserNumberValueTypes[valueName]) {
|
|
5745
|
-
keyframes[i] = browserNumberValueTypes[valueName].transform(keyframes[i]);
|
|
5746
|
-
}
|
|
5747
|
-
}
|
|
5748
|
-
if (!supportsPartialKeyframes() && keyframes.length < 2) {
|
|
5749
|
-
keyframes.unshift(read());
|
|
5750
|
-
}
|
|
5751
|
-
}
|
|
5752
|
-
const defaultEasing = "easeOut";
|
|
5753
|
-
function getElementAnimationState(element) {
|
|
5754
|
-
const animationState = state.get(element) || new Map();
|
|
5755
|
-
state.set(element, animationState);
|
|
5756
|
-
return state.get(element);
|
|
5757
|
-
}
|
|
5758
|
-
class NativeAnimation extends NativeAnimationControls {
|
|
5759
|
-
constructor(element, valueName, valueKeyframes, options) {
|
|
5760
|
-
const isCSSVar = valueName.startsWith("--");
|
|
5761
|
-
exports.invariant(typeof options.type !== "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "framer-motion"?`);
|
|
5762
|
-
const existingAnimation = getElementAnimationState(element).get(valueName);
|
|
5763
|
-
existingAnimation && existingAnimation.stop();
|
|
5764
|
-
const readInitialKeyframe = () => {
|
|
5765
|
-
return valueName.startsWith("--")
|
|
5766
|
-
? element.style.getPropertyValue(valueName)
|
|
5767
|
-
: window.getComputedStyle(element)[valueName];
|
|
5768
|
-
};
|
|
5769
|
-
if (!Array.isArray(valueKeyframes)) {
|
|
5770
|
-
valueKeyframes = [valueKeyframes];
|
|
5771
|
-
}
|
|
5772
|
-
hydrateKeyframes(valueName, valueKeyframes, readInitialKeyframe);
|
|
5773
|
-
// TODO: Replace this with toString()?
|
|
5774
|
-
if (isGenerator(options.type)) {
|
|
5775
|
-
const generatorOptions = createGeneratorEasing(options, 100, options.type);
|
|
5776
|
-
options.ease = supportsLinearEasing()
|
|
5777
|
-
? generatorOptions.ease
|
|
5778
|
-
: defaultEasing;
|
|
5779
|
-
options.duration = secondsToMilliseconds(generatorOptions.duration);
|
|
5780
|
-
options.type = "keyframes";
|
|
5781
|
-
}
|
|
5782
|
-
else {
|
|
5783
|
-
options.ease = options.ease || defaultEasing;
|
|
5784
|
-
}
|
|
5785
|
-
const onFinish = () => {
|
|
5786
|
-
this.setValue(element, valueName, getFinalKeyframe(valueKeyframes, options));
|
|
5787
|
-
this.cancel();
|
|
5788
|
-
this.resolveFinishedPromise();
|
|
5789
|
-
};
|
|
5790
|
-
const init = () => {
|
|
5791
|
-
this.setValue = isCSSVar ? setCSSVar : setStyle;
|
|
5792
|
-
this.options = options;
|
|
5793
|
-
this.updateFinishedPromise();
|
|
5794
|
-
this.removeAnimation = () => {
|
|
5795
|
-
const elementState = state.get(element);
|
|
5796
|
-
elementState && elementState.delete(valueName);
|
|
5797
|
-
};
|
|
5798
|
-
};
|
|
5799
|
-
if (!supportsWaapi()) {
|
|
5800
|
-
super();
|
|
5801
|
-
init();
|
|
5802
|
-
onFinish();
|
|
5803
|
-
}
|
|
5804
|
-
else {
|
|
5805
|
-
super(startWaapiAnimation(element, valueName, valueKeyframes, options));
|
|
5806
|
-
init();
|
|
5807
|
-
if (options.autoplay === false) {
|
|
5808
|
-
this.animation.pause();
|
|
5809
|
-
}
|
|
5810
|
-
this.animation.onfinish = onFinish;
|
|
5811
|
-
getElementAnimationState(element).set(valueName, this);
|
|
5812
|
-
}
|
|
5813
|
-
}
|
|
5814
|
-
/**
|
|
5815
|
-
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
5816
|
-
* resolves when the animation finishes at all but in a future update could/should
|
|
5817
|
-
* reject if its cancels.
|
|
5818
|
-
*/
|
|
5819
|
-
then(resolve, reject) {
|
|
5820
|
-
return this.currentFinishedPromise.then(resolve, reject);
|
|
5821
|
-
}
|
|
5822
|
-
updateFinishedPromise() {
|
|
5823
|
-
this.currentFinishedPromise = new Promise((resolve) => {
|
|
5824
|
-
this.resolveFinishedPromise = resolve;
|
|
5825
|
-
});
|
|
5826
|
-
}
|
|
5827
|
-
play() {
|
|
5828
|
-
if (this.state === "finished") {
|
|
5829
|
-
this.updateFinishedPromise();
|
|
5830
|
-
}
|
|
5831
|
-
super.play();
|
|
5832
|
-
}
|
|
5833
|
-
cancel() {
|
|
5834
|
-
this.removeAnimation();
|
|
5835
|
-
super.cancel();
|
|
5836
|
-
}
|
|
5837
|
-
}
|
|
5838
|
-
|
|
5839
5893
|
function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
5840
5894
|
const elements = resolveElements(elementOrSelector, scope);
|
|
5841
5895
|
const numElements = elements.length;
|
|
@@ -5855,13 +5909,15 @@ function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
|
5855
5909
|
const valueOptions = {
|
|
5856
5910
|
...getValueTransition$1(elementTransition, valueName),
|
|
5857
5911
|
};
|
|
5858
|
-
valueOptions.duration = valueOptions.duration
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5912
|
+
valueOptions.duration && (valueOptions.duration = secondsToMilliseconds(valueOptions.duration));
|
|
5913
|
+
valueOptions.delay && (valueOptions.delay = secondsToMilliseconds(valueOptions.delay));
|
|
5914
|
+
animations.push(new NativeAnimation({
|
|
5915
|
+
element,
|
|
5916
|
+
name: valueName,
|
|
5917
|
+
keyframes: valueKeyframes,
|
|
5918
|
+
transition: valueOptions,
|
|
5919
|
+
allowFlatten: !elementTransition.type && !elementTransition.ease,
|
|
5920
|
+
}));
|
|
5865
5921
|
}
|
|
5866
5922
|
}
|
|
5867
5923
|
return animations;
|
|
@@ -5869,7 +5925,7 @@ function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
|
5869
5925
|
|
|
5870
5926
|
const createScopedWaapiAnimate = (scope) => {
|
|
5871
5927
|
function scopedAnimate(elementOrSelector, keyframes, options) {
|
|
5872
|
-
return new
|
|
5928
|
+
return new GroupAnimationWithThen(animateElements(elementOrSelector, keyframes, options, scope));
|
|
5873
5929
|
}
|
|
5874
5930
|
return scopedAnimate;
|
|
5875
5931
|
};
|
|
@@ -5908,8 +5964,7 @@ function getElementSize(target, borderBoxSize) {
|
|
|
5908
5964
|
}
|
|
5909
5965
|
}
|
|
5910
5966
|
function notifyTarget({ target, contentRect, borderBoxSize, }) {
|
|
5911
|
-
|
|
5912
|
-
(_a = resizeHandlers.get(target)) === null || _a === void 0 ? void 0 : _a.forEach((handler) => {
|
|
5967
|
+
resizeHandlers.get(target)?.forEach((handler) => {
|
|
5913
5968
|
handler({
|
|
5914
5969
|
target,
|
|
5915
5970
|
contentSize: contentRect,
|
|
@@ -5938,14 +5993,14 @@ function resizeElement(target, handler) {
|
|
|
5938
5993
|
resizeHandlers.set(element, elementHandlers);
|
|
5939
5994
|
}
|
|
5940
5995
|
elementHandlers.add(handler);
|
|
5941
|
-
observer
|
|
5996
|
+
observer?.observe(element);
|
|
5942
5997
|
});
|
|
5943
5998
|
return () => {
|
|
5944
5999
|
elements.forEach((element) => {
|
|
5945
6000
|
const elementHandlers = resizeHandlers.get(element);
|
|
5946
|
-
elementHandlers
|
|
5947
|
-
if (!
|
|
5948
|
-
observer
|
|
6001
|
+
elementHandlers?.delete(handler);
|
|
6002
|
+
if (!elementHandlers?.size) {
|
|
6003
|
+
observer?.unobserve(element);
|
|
5949
6004
|
}
|
|
5950
6005
|
});
|
|
5951
6006
|
};
|
|
@@ -6324,7 +6379,6 @@ function scrollInfo(onScroll, { container = document.documentElement, ...options
|
|
|
6324
6379
|
const listener = scrollListeners.get(container);
|
|
6325
6380
|
frame.read(listener, false, true);
|
|
6326
6381
|
return () => {
|
|
6327
|
-
var _a;
|
|
6328
6382
|
cancelFrame(listener);
|
|
6329
6383
|
/**
|
|
6330
6384
|
* Check if we even have any handlers for this container.
|
|
@@ -6342,7 +6396,7 @@ function scrollInfo(onScroll, { container = document.documentElement, ...options
|
|
|
6342
6396
|
scrollListeners.delete(container);
|
|
6343
6397
|
if (scrollListener) {
|
|
6344
6398
|
getEventTarget(container).removeEventListener("scroll", scrollListener);
|
|
6345
|
-
|
|
6399
|
+
resizeListeners.get(container)?.();
|
|
6346
6400
|
window.removeEventListener("resize", scrollListener);
|
|
6347
6401
|
}
|
|
6348
6402
|
};
|
|
@@ -6572,6 +6626,7 @@ exports.easeOut = easeOut;
|
|
|
6572
6626
|
exports.frame = frame;
|
|
6573
6627
|
exports.frameData = frameData;
|
|
6574
6628
|
exports.hover = hover;
|
|
6629
|
+
exports.hslaToRgba = hslaToRgba;
|
|
6575
6630
|
exports.inView = inView;
|
|
6576
6631
|
exports.inertia = inertia;
|
|
6577
6632
|
exports.interpolate = interpolate;
|