@mkbabb/keyframes.js 6.5.0 → 6.6.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/README.md +77 -4
- package/dist/engine/index.d.ts +5 -0
- package/dist/engine/index.js +933 -931
- package/dist/keyframes.d.ts +101 -5
- package/dist/keyframes.js +250 -153
- package/dist/{registry-DIMQ5-f9.js → registry-BZOrCZZh.js} +1 -1
- package/dist/{registry-BgJd9srG.js → registry-D3fj1upb.js} +1 -1
- package/dist/{sequence-BRhiigt1.js → sequence-BzJ-b_HG.js} +126 -114
- package/package.json +5 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e } from "./sequence-
|
|
1
|
+
import { c as e } from "./sequence-BzJ-b_HG.js";
|
|
2
2
|
import { CubicBezier as t, bezierPresets as n, easing as r, linearEasing as i, steppedEase as a } from "@mkbabb/value.js/easing";
|
|
3
3
|
import { collectAnimationOptions as o, collectCustomFunctions as s, collectKeyframes as c, collectPropertyDescriptors as l, collectStyleRules as u, collectTimelineOptions as d, parseAnimationRange as f, parseAnimationTimeline as p, parseCssScalar as m, parseCssValues as h, parseKeyframeSelector as g, parseStylesheet as _, parseTimingFunction as v, serializeCssValue as y, serializeTimelineOptions as b } from "@mkbabb/value.js/css";
|
|
4
4
|
//#region src/animation/compile/emit/serialize-value.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./registry-
|
|
1
|
+
import { n as e, t } from "./registry-BZOrCZZh.js";
|
|
2
2
|
export { t as resolveTimingFunction, e as timingFunctionEntries };
|
|
@@ -27,7 +27,7 @@ var s = (e) => typeof e == "function" ? { fn: e } : e, c = /^(linear|ease|ease-i
|
|
|
27
27
|
async function d(e) {
|
|
28
28
|
let t;
|
|
29
29
|
try {
|
|
30
|
-
t = await import("./registry-
|
|
30
|
+
t = await import("./registry-D3fj1upb.js");
|
|
31
31
|
} catch (t) {
|
|
32
32
|
throw Error(`keyframes: the easing-registry chunk failed to load while resolving easing "${e}" — the easing registry is unreachable.`, { cause: t });
|
|
33
33
|
}
|
|
@@ -124,10 +124,12 @@ var C = class {
|
|
|
124
124
|
}));
|
|
125
125
|
};
|
|
126
126
|
drive = (e, t) => {
|
|
127
|
-
this._rafId
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
if (this._rafId !== null) return;
|
|
128
|
+
let n = !0;
|
|
129
|
+
this._run((r) => {
|
|
130
|
+
let i = n ? 0 : r - this._lastFrameT;
|
|
131
|
+
return n = !1, this._lastFrameT = r, e.tickDt(i), t?.(), !e.settled;
|
|
132
|
+
});
|
|
131
133
|
};
|
|
132
134
|
loop = (e) => {
|
|
133
135
|
this.stop(), this._run(e);
|
|
@@ -165,7 +167,7 @@ var D = {
|
|
|
165
167
|
initial: 0,
|
|
166
168
|
clamp: !0,
|
|
167
169
|
respectReducedMotion: !1
|
|
168
|
-
},
|
|
170
|
+
}, ee = class {
|
|
169
171
|
options;
|
|
170
172
|
targetValue;
|
|
171
173
|
currentValue;
|
|
@@ -221,7 +223,7 @@ var D = {
|
|
|
221
223
|
stop() {
|
|
222
224
|
E(this);
|
|
223
225
|
}
|
|
224
|
-
},
|
|
226
|
+
}, O = {
|
|
225
227
|
response: .5,
|
|
226
228
|
dampingFraction: .86,
|
|
227
229
|
initial: 0,
|
|
@@ -232,7 +234,7 @@ var D = {
|
|
|
232
234
|
};
|
|
233
235
|
//#endregion
|
|
234
236
|
//#region src/animation/physics/spring/managed-play.ts
|
|
235
|
-
function
|
|
237
|
+
function k(e) {
|
|
236
238
|
w(e);
|
|
237
239
|
}
|
|
238
240
|
function te(e, t) {
|
|
@@ -243,7 +245,7 @@ function ne(e) {
|
|
|
243
245
|
}
|
|
244
246
|
//#endregion
|
|
245
247
|
//#region src/animation/physics/spring/solver/duration.ts
|
|
246
|
-
function
|
|
248
|
+
function re(t) {
|
|
247
249
|
let { visualDuration: n, duration: r, bounce: i = 0, ...a } = t, o = n ?? r ?? .5, s = 1 - e(i, -1, 1);
|
|
248
250
|
return {
|
|
249
251
|
...a,
|
|
@@ -253,7 +255,7 @@ function A(t) {
|
|
|
253
255
|
}
|
|
254
256
|
//#endregion
|
|
255
257
|
//#region src/animation/physics/spring/solver/solver.ts
|
|
256
|
-
function
|
|
258
|
+
function A(e, t, n, r) {
|
|
257
259
|
if (t < 1) return {
|
|
258
260
|
regime: "under",
|
|
259
261
|
w: e,
|
|
@@ -278,7 +280,7 @@ function j(e, t, n, r) {
|
|
|
278
280
|
e2: Math.exp(o * r)
|
|
279
281
|
};
|
|
280
282
|
}
|
|
281
|
-
function
|
|
283
|
+
function j(e, t, n, r = {
|
|
282
284
|
x: 0,
|
|
283
285
|
v: 0
|
|
284
286
|
}) {
|
|
@@ -293,12 +295,12 @@ function M(e, t, n, r = {
|
|
|
293
295
|
let { r1: i, r2: a, e1: o, e2: s } = n, c = (t - a * e) / (i - a), l = e - c;
|
|
294
296
|
return r.x = c * o + l * s, r.v = c * i * o + l * a * s, r;
|
|
295
297
|
}
|
|
296
|
-
function
|
|
297
|
-
return
|
|
298
|
+
function M(e, t, n, r, i, a) {
|
|
299
|
+
return j(e, t, A(n, r, i, a));
|
|
298
300
|
}
|
|
299
301
|
//#endregion
|
|
300
302
|
//#region src/animation/physics/spring/solver/vector.ts
|
|
301
|
-
var
|
|
303
|
+
var N = new Float64Array(), ie = class {
|
|
302
304
|
solution = {
|
|
303
305
|
x: 0,
|
|
304
306
|
v: 0
|
|
@@ -316,10 +318,10 @@ var P = new Float64Array(), re = class {
|
|
|
316
318
|
this.vecOrigin.set(this.vecCurrent), this.vecOriginVel.set(this.vecVelocity), this.vecTarget.set(e), this.vecElapsed = 0;
|
|
317
319
|
}
|
|
318
320
|
get values() {
|
|
319
|
-
return this.vecCurrent ??
|
|
321
|
+
return this.vecCurrent ?? N;
|
|
320
322
|
}
|
|
321
323
|
get velocities() {
|
|
322
|
-
return this.vecVelocity ??
|
|
324
|
+
return this.vecVelocity ?? N;
|
|
323
325
|
}
|
|
324
326
|
get armed() {
|
|
325
327
|
return this.vecTarget !== null;
|
|
@@ -327,32 +329,32 @@ var P = new Float64Array(), re = class {
|
|
|
327
329
|
tick(e, t, n, r) {
|
|
328
330
|
if (this.vecTarget === null || e <= 0) return this.values;
|
|
329
331
|
this.vecElapsed += e / 1e3;
|
|
330
|
-
let i = this.vecElapsed, a = this.vecOrigin, o = this.vecOriginVel, s = this.vecTarget, c = this.vecCurrent, l = this.vecVelocity, u =
|
|
332
|
+
let i = this.vecElapsed, a = this.vecOrigin, o = this.vecOriginVel, s = this.vecTarget, c = this.vecCurrent, l = this.vecVelocity, u = A(t, n, r, i), d = this.solution;
|
|
331
333
|
for (let e = 0; e < c.length; e++) {
|
|
332
334
|
let t = a[e] - s[e], n = o[e];
|
|
333
|
-
|
|
335
|
+
j(t, n, u, d), c[e] = s[e] + d.x, l[e] = d.v;
|
|
334
336
|
}
|
|
335
337
|
return c;
|
|
336
338
|
}
|
|
337
339
|
};
|
|
338
340
|
//#endregion
|
|
339
341
|
//#region src/animation/physics/spring/vector-surface.ts
|
|
340
|
-
function
|
|
341
|
-
let n = e ?? new
|
|
342
|
+
function ae(e, t) {
|
|
343
|
+
let n = e ?? new ie();
|
|
342
344
|
return n.setTargets(t), n;
|
|
343
345
|
}
|
|
344
|
-
function ae(e) {
|
|
345
|
-
return e?.values ?? P;
|
|
346
|
-
}
|
|
347
346
|
function oe(e) {
|
|
348
|
-
return e?.
|
|
347
|
+
return e?.values ?? N;
|
|
348
|
+
}
|
|
349
|
+
function se(e) {
|
|
350
|
+
return e?.velocities ?? N;
|
|
349
351
|
}
|
|
350
|
-
function
|
|
351
|
-
return e === null || t <= 0 ?
|
|
352
|
+
function ce(e, t, n, r, i) {
|
|
353
|
+
return e === null || t <= 0 ? N : e.tick(t, n, r, i);
|
|
352
354
|
}
|
|
353
355
|
//#endregion
|
|
354
356
|
//#region src/animation/physics/spring/progress.ts
|
|
355
|
-
var
|
|
357
|
+
var P = class e {
|
|
356
358
|
options;
|
|
357
359
|
get respectReducedMotion() {
|
|
358
360
|
return this.options.respectReducedMotion;
|
|
@@ -378,12 +380,12 @@ var F = class e {
|
|
|
378
380
|
}
|
|
379
381
|
constructor(e) {
|
|
380
382
|
this.options = {
|
|
381
|
-
...
|
|
383
|
+
...O,
|
|
382
384
|
...e
|
|
383
385
|
}, this.targetValue = this.options.initial, this.currentValue = this.options.initial, this.currentVelocity = this.options.initialVelocity, this.isSettled = this.options.initialVelocity === 0, this.elapsed = 0, this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.amplitudeScale = x(this.options.respectReducedMotion), this.omega = 2 * Math.PI / this.options.response, this.zeta = this.options.dampingFraction, this.omegaD = this.zeta < 1 ? this.omega * Math.sqrt(1 - this.zeta * this.zeta) : 0;
|
|
384
386
|
}
|
|
385
387
|
static fromDuration(t) {
|
|
386
|
-
return new e(
|
|
388
|
+
return new e(re(t ?? {}));
|
|
387
389
|
}
|
|
388
390
|
get target() {
|
|
389
391
|
return this.targetValue;
|
|
@@ -402,7 +404,7 @@ var F = class e {
|
|
|
402
404
|
}
|
|
403
405
|
reseatTarget(e) {
|
|
404
406
|
this.targetValue = e, S(this.options.respectReducedMotion, () => this._snapSettled(), () => {
|
|
405
|
-
this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.elapsed = 0, this.isSettled = !1, this.amplitudeScale = x(this.options.respectReducedMotion), this._onFrame &&
|
|
407
|
+
this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.elapsed = 0, this.isSettled = !1, this.amplitudeScale = x(this.options.respectReducedMotion), this._onFrame && k(this);
|
|
406
408
|
});
|
|
407
409
|
}
|
|
408
410
|
_snapSettled() {
|
|
@@ -418,7 +420,7 @@ var F = class e {
|
|
|
418
420
|
return this.disposed || this.isSettled ? this.currentValue : (this.elapsed = Math.max(0, e), this.evaluateAt(this.elapsed), this.checkSettled(), this.emit(), this.currentValue);
|
|
419
421
|
}
|
|
420
422
|
evaluateAt(e) {
|
|
421
|
-
let t = this.scaledTarget(), n = this.originValue - t, r = this.originVelocity, { x: i, v: a } =
|
|
423
|
+
let t = this.scaledTarget(), n = this.originValue - t, r = this.originVelocity, { x: i, v: a } = M(n, r, this.omega, this.zeta, this.omegaD, e);
|
|
422
424
|
this.currentValue = t + i, this.currentVelocity = a;
|
|
423
425
|
}
|
|
424
426
|
scaledTarget() {
|
|
@@ -437,16 +439,16 @@ var F = class e {
|
|
|
437
439
|
this.targetValue = n, this.currentValue = n, this.currentVelocity = r, this.originValue = n, this.originVelocity = r, this.elapsed = 0, this.amplitudeScale = x(this.options.respectReducedMotion), this.isSettled = r === 0, this.emit(), this._playback.stop();
|
|
438
440
|
}
|
|
439
441
|
setTargets(e) {
|
|
440
|
-
this.vectorLanes =
|
|
442
|
+
this.vectorLanes = ae(this.vectorLanes, e);
|
|
441
443
|
}
|
|
442
444
|
get values() {
|
|
443
|
-
return
|
|
445
|
+
return oe(this.vectorLanes);
|
|
444
446
|
}
|
|
445
447
|
get velocities() {
|
|
446
|
-
return
|
|
448
|
+
return se(this.vectorLanes);
|
|
447
449
|
}
|
|
448
450
|
tickVector(e) {
|
|
449
|
-
return this.disposed || this.vectorLanes === null || e <= 0 ? this.values :
|
|
451
|
+
return this.disposed || this.vectorLanes === null || e <= 0 ? this.values : ce(this.vectorLanes, e, this.omega, this.zeta, this.omegaD);
|
|
450
452
|
}
|
|
451
453
|
subscribe(e) {
|
|
452
454
|
return this.subscribers.add(e), () => {
|
|
@@ -465,9 +467,9 @@ var F = class e {
|
|
|
465
467
|
stop() {
|
|
466
468
|
ne(this);
|
|
467
469
|
}
|
|
468
|
-
},
|
|
469
|
-
function
|
|
470
|
-
let t = e.initialVelocity ?? 0, n = new
|
|
470
|
+
}, le = 12, ue = .02;
|
|
471
|
+
function F(e) {
|
|
472
|
+
let t = e.initialVelocity ?? 0, n = new P({
|
|
471
473
|
response: e.response,
|
|
472
474
|
dampingFraction: e.dampingFraction,
|
|
473
475
|
initial: 0,
|
|
@@ -477,14 +479,14 @@ function I(e) {
|
|
|
477
479
|
});
|
|
478
480
|
n.target = 1;
|
|
479
481
|
let r = () => n.settled ? 1 : n.value, i = [], a = 0;
|
|
480
|
-
if (t !== 0) for (let t =
|
|
482
|
+
if (t !== 0) for (let t = le; t >= 1; t--) {
|
|
481
483
|
let o = 2 ** -t;
|
|
482
484
|
n._stepSeconds(o * e.dt - a), a = o * e.dt, i.push([o, r()]);
|
|
483
485
|
}
|
|
484
486
|
let o = [];
|
|
485
487
|
for (let t = 1; t <= e.sampleCount; t++) n._stepSeconds(e.dt - a), a = 0, o.push(r());
|
|
486
488
|
if (n.dispose(), i.length > 0) {
|
|
487
|
-
let n = (n, r) => Math.abs(r / (n * e.dt) - t) <=
|
|
489
|
+
let n = (n, r) => Math.abs(r / (n * e.dt) - t) <= ue * Math.abs(t);
|
|
488
490
|
if (o.length > 0 && n(1, o[0])) i = [];
|
|
489
491
|
else {
|
|
490
492
|
let e = 0;
|
|
@@ -502,43 +504,53 @@ function I(e) {
|
|
|
502
504
|
}
|
|
503
505
|
//#endregion
|
|
504
506
|
//#region src/animation/physics/spring/solver/settle.ts
|
|
505
|
-
var
|
|
506
|
-
function
|
|
507
|
-
let t = e.response, n = e.dampingFraction, r = e.initialVelocity ??
|
|
507
|
+
var de = 4096, fe = 20, pe = 2 ** 32;
|
|
508
|
+
function I(e) {
|
|
509
|
+
let t = e.response, n = e.dampingFraction, r = e.initialVelocity ?? O.initialVelocity, i = e.settleThreshold ?? O.settleThreshold, a = e.velocitySettleThreshold ?? O.velocitySettleThreshold;
|
|
508
510
|
if (!(t > 0) || !Number.isFinite(t)) throw RangeError(`settleTime: response must be finite and > 0; got ${t}.`);
|
|
509
511
|
if (!(n >= 0) || !Number.isFinite(n)) throw RangeError(`settleTime: dampingFraction must be finite and >= 0; got ${n}.`);
|
|
510
512
|
if (!(i > 0) || !Number.isFinite(i)) throw RangeError(`settleTime: settleThreshold must be finite and > 0; got ${i}.`);
|
|
511
513
|
if (!(a > 0)) throw RangeError(`settleTime: velocitySettleThreshold must be > 0 (Infinity allowed); got ${a}.`);
|
|
512
514
|
if (!Number.isFinite(r)) throw RangeError(`settleTime: initialVelocity must be finite; got ${r}.`);
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
515
|
+
return R(-1, r, t, n, i, a);
|
|
516
|
+
}
|
|
517
|
+
function L(e, t, n, r, i) {
|
|
518
|
+
let a, o = (e) => a(e), s = 0;
|
|
519
|
+
if (r < 1) {
|
|
520
|
+
let o = e, s = (t + r * n * e) / i, c = Math.hypot(o, s);
|
|
521
|
+
a = (e) => {
|
|
522
|
+
let t = Math.exp(-r * n * e) * c;
|
|
523
|
+
return [t, t * n];
|
|
519
524
|
};
|
|
520
|
-
} else if (
|
|
521
|
-
let e =
|
|
522
|
-
|
|
523
|
-
let
|
|
524
|
-
return [
|
|
525
|
-
},
|
|
526
|
-
let
|
|
527
|
-
return [
|
|
525
|
+
} else if (r === 1) {
|
|
526
|
+
let r = e, i = t + n * e, c = Math.abs(i), l = Math.abs(r), u = Math.abs(i - n * r);
|
|
527
|
+
s = 1 / n, a = (e) => {
|
|
528
|
+
let t = Math.exp(-n * e);
|
|
529
|
+
return [t * (l + c * e), t * (u + n * c * e)];
|
|
530
|
+
}, o = (e, t) => {
|
|
531
|
+
let r = Math.exp(-n * e);
|
|
532
|
+
return [r * (l + c * (e + t)), r * (u + n * c * (e + t))];
|
|
528
533
|
};
|
|
529
534
|
} else {
|
|
530
|
-
let
|
|
531
|
-
|
|
532
|
-
let
|
|
533
|
-
return [
|
|
535
|
+
let i = n * Math.sqrt(r * r - 1), o = -r * n + i, s = -r * n - i, c = (t - s * e) / (o - s), l = e - c;
|
|
536
|
+
a = (e) => {
|
|
537
|
+
let t = Math.abs(c) * Math.exp(o * e), n = Math.abs(l) * Math.exp(s * e);
|
|
538
|
+
return [t + n, t * -o + n * -s];
|
|
534
539
|
};
|
|
535
540
|
}
|
|
536
|
-
|
|
541
|
+
return {
|
|
542
|
+
bound: a,
|
|
543
|
+
supBound: o,
|
|
544
|
+
onset: s
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
function R(e, t, n, r, i, a) {
|
|
548
|
+
let o = 2 * Math.PI / n, s = r < 1 ? o * Math.sqrt(1 - r * r) : 0, { bound: c, supBound: l, onset: u } = L(e, t, o, r, s), d = (e) => {
|
|
537
549
|
let [t, n] = c(e);
|
|
538
550
|
return t < i && n < a;
|
|
539
|
-
}, f = u, p = Math.max(
|
|
551
|
+
}, f = u, p = Math.max(n, u);
|
|
540
552
|
for (; !d(p);) {
|
|
541
|
-
if (p >
|
|
553
|
+
if (p > pe * n) return Infinity;
|
|
542
554
|
f = p, p *= 2;
|
|
543
555
|
}
|
|
544
556
|
for (let e = 0; e < 30; e++) {
|
|
@@ -548,20 +560,20 @@ function R(e) {
|
|
|
548
560
|
let m = {
|
|
549
561
|
x: 0,
|
|
550
562
|
v: 0
|
|
551
|
-
}, h = (
|
|
552
|
-
|
|
563
|
+
}, h = (n) => {
|
|
564
|
+
j(e, t, A(o, r, s, n), m);
|
|
553
565
|
}, g = (e) => (h(e), !(Math.abs(m.x) < i && Math.abs(m.v) < a)), _ = (e, t) => {
|
|
554
566
|
h(e);
|
|
555
|
-
let [
|
|
567
|
+
let [n, s] = l(e, t), c = o * o * n + 2 * r * o * s;
|
|
556
568
|
return Math.abs(m.x) + t * s < i && Math.abs(m.v) + t * c < a;
|
|
557
569
|
}, v = (e, t, n) => {
|
|
558
570
|
if (_(e, t - e)) return null;
|
|
559
571
|
if (n === 0) return g(e) ? [e, t] : null;
|
|
560
572
|
let r = (e + t) / 2;
|
|
561
573
|
return v(r, t, n - 1) ?? v(e, r, n - 1);
|
|
562
|
-
}, y =
|
|
574
|
+
}, y = n / de;
|
|
563
575
|
for (let e = p; e > 0;) {
|
|
564
|
-
let t = Math.max(0, e - y), n = v(t, e,
|
|
576
|
+
let t = Math.max(0, e - y), n = v(t, e, fe);
|
|
565
577
|
if (n) {
|
|
566
578
|
let [e, t] = n;
|
|
567
579
|
for (let n = 0; n < 40; n++) {
|
|
@@ -578,7 +590,7 @@ function R(e) {
|
|
|
578
590
|
//#region src/animation/physics/spring/css/span.ts
|
|
579
591
|
function z(e) {
|
|
580
592
|
if (e.maxDuration !== "settle") return e.maxDuration ?? e.response * 4;
|
|
581
|
-
let t =
|
|
593
|
+
let t = I({
|
|
582
594
|
response: e.response,
|
|
583
595
|
dampingFraction: e.dampingFraction,
|
|
584
596
|
...e.initialVelocity !== void 0 && { initialVelocity: e.initialVelocity },
|
|
@@ -591,7 +603,7 @@ function z(e) {
|
|
|
591
603
|
//#endregion
|
|
592
604
|
//#region src/animation/physics/spring/css/linear-stops.ts
|
|
593
605
|
function B(e) {
|
|
594
|
-
let t = e.sampleCount ?? 24, n = e.settleThreshold ?? .001, r = z(e), { positions: i, head: a } =
|
|
606
|
+
let t = e.sampleCount ?? 24, n = e.settleThreshold ?? .001, r = z(e), { positions: i, head: a } = F({
|
|
595
607
|
response: e.response,
|
|
596
608
|
dampingFraction: e.dampingFraction,
|
|
597
609
|
sampleCount: t,
|
|
@@ -610,7 +622,7 @@ function B(e) {
|
|
|
610
622
|
return o.push("1"), `linear(${o.join(", ")})`;
|
|
611
623
|
}
|
|
612
624
|
var V = (e) => Math.round(e * 1e5) / 1e5;
|
|
613
|
-
function
|
|
625
|
+
function me(e) {
|
|
614
626
|
let t = e.length - 1;
|
|
615
627
|
if (t < 1) throw RangeError(`linearFromSamples needs at least 2 samples; got ${e.length}.`);
|
|
616
628
|
let n = [];
|
|
@@ -619,11 +631,11 @@ function H(e) {
|
|
|
619
631
|
}
|
|
620
632
|
//#endregion
|
|
621
633
|
//#region src/animation/physics/spring/css/timing-function.ts
|
|
622
|
-
function
|
|
623
|
-
return
|
|
634
|
+
function he(e) {
|
|
635
|
+
return H(e, z(e)).lut;
|
|
624
636
|
}
|
|
625
|
-
function
|
|
626
|
-
let n = e.sampleCount ?? 64, r = e.settleThreshold ?? .001, { positions: i, head: a } =
|
|
637
|
+
function H(e, t) {
|
|
638
|
+
let n = e.sampleCount ?? 64, r = e.settleThreshold ?? .001, { positions: i, head: a } = F({
|
|
627
639
|
response: e.response,
|
|
628
640
|
dampingFraction: e.dampingFraction,
|
|
629
641
|
sampleCount: n,
|
|
@@ -638,8 +650,8 @@ function U(e, t) {
|
|
|
638
650
|
head: a.map(([e, t]) => [e / n, t])
|
|
639
651
|
};
|
|
640
652
|
}
|
|
641
|
-
function
|
|
642
|
-
let t = z(e), { lut: n, head: r } =
|
|
653
|
+
function ge(e) {
|
|
654
|
+
let t = z(e), { lut: n, head: r } = H(e, t), i = n.length - 1, a = [
|
|
643
655
|
[0, 0],
|
|
644
656
|
...r,
|
|
645
657
|
[1 / i, n[1]]
|
|
@@ -666,10 +678,10 @@ function pe(e) {
|
|
|
666
678
|
}
|
|
667
679
|
//#endregion
|
|
668
680
|
//#region src/animation/compile/emit/selector.ts
|
|
669
|
-
var
|
|
681
|
+
var U = (e) => `${Number((e * 100).toFixed(10))}%`, _e = (e) => e.kind === "percent" ? U(e.value) : e.offset === void 0 ? e.name : `${e.name} ${U(e.offset)}`;
|
|
670
682
|
//#endregion
|
|
671
683
|
//#region src/animation/orchestration/timeline/native.ts
|
|
672
|
-
function
|
|
684
|
+
function ve(e) {
|
|
673
685
|
if (typeof window > "u") return null;
|
|
674
686
|
if (e.kind === "scroll") {
|
|
675
687
|
if (globalThis.ScrollTimeline === void 0) return null;
|
|
@@ -683,7 +695,7 @@ function he(e) {
|
|
|
683
695
|
//#endregion
|
|
684
696
|
//#region src/animation/physics/decay.ts
|
|
685
697
|
var W = 5;
|
|
686
|
-
function
|
|
698
|
+
function ye(e) {
|
|
687
699
|
let t = e.initial ?? 0, n = e.velocity, r = e.friction ?? W;
|
|
688
700
|
if (r <= 0) throw Error("decay() requires a friction coefficient > 0.");
|
|
689
701
|
let i = t + n / r;
|
|
@@ -699,7 +711,7 @@ function ge(e) {
|
|
|
699
711
|
};
|
|
700
712
|
};
|
|
701
713
|
}
|
|
702
|
-
function
|
|
714
|
+
function be(e) {
|
|
703
715
|
let t = e.friction ?? W;
|
|
704
716
|
if (t <= 0) throw Error("decayRest() requires a friction coefficient > 0.");
|
|
705
717
|
return (e.initial ?? 0) + e.velocity / t;
|
|
@@ -724,24 +736,24 @@ function q(e, t, n) {
|
|
|
724
736
|
if (i === void 0) throw Error(`Sequence: unknown position "${e}". Register it with .label("${e}", at) first, or pass a number / "+=n" / "-=n".`);
|
|
725
737
|
return i;
|
|
726
738
|
}
|
|
727
|
-
function
|
|
739
|
+
function xe(t, n, r, i) {
|
|
728
740
|
if (n <= 0) return 0;
|
|
729
741
|
let a = e(t, 0, n * r), o = Math.floor(a / n), s = a - o * n;
|
|
730
742
|
return s === 0 && o > 0 && (--o, s = n), i && o % 2 == 1 ? n - s : s;
|
|
731
743
|
}
|
|
732
|
-
function
|
|
744
|
+
function Se(e, t, n) {
|
|
733
745
|
return n && (t - 1) % 2 == 1 ? 0 : e;
|
|
734
746
|
}
|
|
735
|
-
function
|
|
747
|
+
function Ce(e, t, n) {
|
|
736
748
|
return e === 1 && t === 1 && !n;
|
|
737
749
|
}
|
|
738
750
|
function J(e, t, n) {
|
|
739
751
|
return n === 0 ? e : e - t / n;
|
|
740
752
|
}
|
|
741
|
-
async function
|
|
753
|
+
async function we(e, t) {
|
|
742
754
|
e._playOrigin === void 0 && (e._playOrigin = J(t, e._time, e._rate)), e._lastClock = t;
|
|
743
|
-
let n = (t - e._playOrigin) * e._rate, r = e.duration * e._repeatCount, i = e._rate >= 0 ? n >= r : n <= 0, a = i ? e._rate >= 0 ?
|
|
744
|
-
if (e._time = a,
|
|
755
|
+
let n = (t - e._playOrigin) * e._rate, r = e.duration * e._repeatCount, i = e._rate >= 0 ? n >= r : n <= 0, a = i ? e._rate >= 0 ? Se(e.duration, e._repeatCount, e._yoyoOn) : 0 : xe(n, e.duration, e._repeatCount, e._yoyoOn);
|
|
756
|
+
if (e._time = a, Ce(e._rate, e._repeatCount, e._yoyoOn)) for (let { animation: t, at: n } of e.entries) a >= n && a - n < t.options.duration && await t.advanceTo(a);
|
|
745
757
|
if (K(e.events, e.entries, e.labels, a), G(e.entries, a), i) {
|
|
746
758
|
Y(e);
|
|
747
759
|
let t = e._resolvePlay;
|
|
@@ -771,18 +783,18 @@ function Z(e, t) {
|
|
|
771
783
|
e._playingPromise === n && (e._playingPromise = null);
|
|
772
784
|
}), n;
|
|
773
785
|
}
|
|
774
|
-
function
|
|
786
|
+
function Te(e) {
|
|
775
787
|
return e.started && !e.paused;
|
|
776
788
|
}
|
|
777
|
-
function
|
|
789
|
+
function Ee(e, t, n) {
|
|
778
790
|
e.paused ? n() : t();
|
|
779
791
|
}
|
|
780
792
|
//#endregion
|
|
781
793
|
//#region src/animation/orchestration/sequence/lifecycle.ts
|
|
782
|
-
function
|
|
783
|
-
return
|
|
794
|
+
function De(e) {
|
|
795
|
+
return Q(e, 0);
|
|
784
796
|
}
|
|
785
|
-
function
|
|
797
|
+
function Q(e, t) {
|
|
786
798
|
if (e._playingPromise) return e._playingPromise;
|
|
787
799
|
if (e.respectReducedMotion && b()) return e.seek(e.duration), Promise.resolve();
|
|
788
800
|
for (let { animation: t, at: n } of e.entries) t.startTime = n, t.started = !0, t.managed = !0;
|
|
@@ -790,38 +802,38 @@ function $(e, t) {
|
|
|
790
802
|
e._resolvePlay = t, e.playback.loop(e._boundFrame);
|
|
791
803
|
}));
|
|
792
804
|
}
|
|
793
|
-
function
|
|
805
|
+
function $(e) {
|
|
794
806
|
e.playback.stop(), Y(e);
|
|
795
807
|
let t = e._resolvePlay;
|
|
796
808
|
e._resolvePlay = null, t?.();
|
|
797
809
|
}
|
|
798
|
-
function
|
|
810
|
+
function Oe(e) {
|
|
799
811
|
!e._playingPromise || e._paused || (e._paused = !0, e.playback.stop(), e._playOrigin = void 0);
|
|
800
812
|
}
|
|
801
|
-
function
|
|
813
|
+
function ke(e) {
|
|
802
814
|
if (!e._playingPromise) {
|
|
803
|
-
|
|
815
|
+
Q(e, e._time);
|
|
804
816
|
return;
|
|
805
817
|
}
|
|
806
818
|
e._paused && (e._paused = !1, e._playOrigin = void 0, e._lastClock = void 0, e.playback.loop(e._boundFrame));
|
|
807
819
|
}
|
|
808
|
-
function
|
|
820
|
+
function Ae(e, t) {
|
|
809
821
|
if (!Number.isFinite(t)) throw Error(`Sequence.timeScale(n): n must be a finite number, got ${t}.`);
|
|
810
822
|
e._rate = t, X(e, e._playingPromise != null);
|
|
811
823
|
}
|
|
812
|
-
function
|
|
824
|
+
function je(e) {
|
|
813
825
|
e._rate = -e._rate, X(e, e._playingPromise != null);
|
|
814
826
|
}
|
|
815
|
-
function
|
|
827
|
+
function Me(e, t) {
|
|
816
828
|
if (t !== Infinity && (!Number.isInteger(t) || t < 1)) throw Error(`Sequence.repeat(count): count must be a positive integer or Infinity, got ${t}.`);
|
|
817
829
|
e._repeatCount = t;
|
|
818
830
|
}
|
|
819
|
-
function
|
|
831
|
+
function Ne(e, t) {
|
|
820
832
|
e._yoyoOn = t;
|
|
821
833
|
}
|
|
822
834
|
//#endregion
|
|
823
835
|
//#region src/animation/orchestration/sequence/events.ts
|
|
824
|
-
var
|
|
836
|
+
var Pe = class {
|
|
825
837
|
subscribers = new Map([
|
|
826
838
|
["segment:enter", /* @__PURE__ */ new Set()],
|
|
827
839
|
["segment:leave", /* @__PURE__ */ new Set()],
|
|
@@ -856,10 +868,10 @@ var je = class {
|
|
|
856
868
|
}
|
|
857
869
|
this._prevPhase = n;
|
|
858
870
|
}
|
|
859
|
-
},
|
|
871
|
+
}, Fe = class {
|
|
860
872
|
entries = [];
|
|
861
873
|
labels = /* @__PURE__ */ new Map();
|
|
862
|
-
events = new
|
|
874
|
+
events = new Pe();
|
|
863
875
|
cursor = 0;
|
|
864
876
|
_time = 0;
|
|
865
877
|
respectReducedMotion;
|
|
@@ -916,32 +928,32 @@ var je = class {
|
|
|
916
928
|
return this._playingPromise ?? Promise.resolve();
|
|
917
929
|
}
|
|
918
930
|
play() {
|
|
919
|
-
return
|
|
931
|
+
return De(this);
|
|
920
932
|
}
|
|
921
933
|
async _frame(e) {
|
|
922
|
-
return
|
|
934
|
+
return we(this, e);
|
|
923
935
|
}
|
|
924
936
|
stop() {
|
|
925
|
-
return
|
|
937
|
+
return $(this), this;
|
|
926
938
|
}
|
|
927
939
|
pause() {
|
|
928
|
-
return
|
|
940
|
+
return Oe(this), this;
|
|
929
941
|
}
|
|
930
942
|
resume() {
|
|
931
|
-
return
|
|
943
|
+
return ke(this), this;
|
|
932
944
|
}
|
|
933
945
|
timeScale(e) {
|
|
934
|
-
return
|
|
946
|
+
return Ae(this, e), this;
|
|
935
947
|
}
|
|
936
948
|
reverse() {
|
|
937
|
-
return
|
|
949
|
+
return je(this), this;
|
|
938
950
|
}
|
|
939
951
|
repeat(e) {
|
|
940
|
-
return
|
|
952
|
+
return Me(this, e), this;
|
|
941
953
|
}
|
|
942
954
|
yoyo(e = !0) {
|
|
943
|
-
return
|
|
955
|
+
return Ne(this, e), this;
|
|
944
956
|
}
|
|
945
957
|
};
|
|
946
958
|
//#endregion
|
|
947
|
-
export {
|
|
959
|
+
export { d as A, S as C, n as D, t as E, i as M, a as N, f as O, o as P, x as S, e as T, A as _, ye as a, ee as b, _e as c, me as d, B as f, P as g, I as h, Ee as i, s as j, u as k, ge as l, R as m, Z as n, be as o, L as p, Te as r, ve as s, Fe as t, he as u, j as v, p as w, C as x, O as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkbabb/keyframes.js",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.0",
|
|
4
4
|
"description": "Create keyframe animations for anything in JavaScript; specify your keyframes in standards-complaint CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -53,7 +53,9 @@
|
|
|
53
53
|
"review:owner-golden": "node scripts/gates/visual/index.mjs",
|
|
54
54
|
"demo:correctness": "node scripts/run-demo-roster.mjs",
|
|
55
55
|
"audit:lighthouse": "node scripts/observe/lighthouse.mjs",
|
|
56
|
-
"release:changelog": "node scripts/release/changelog.mjs"
|
|
56
|
+
"release:changelog": "node scripts/release/changelog.mjs",
|
|
57
|
+
"ci:actions": "npm run check:lib && npm run check && npm run test:lib && npm run test:demo && npm run lint && npm run proof:publish",
|
|
58
|
+
"preship": "scripts/preship.sh"
|
|
57
59
|
},
|
|
58
60
|
"repository": {
|
|
59
61
|
"type": "git",
|
|
@@ -75,7 +77,7 @@
|
|
|
75
77
|
"@iconify/vue": "^5.0.1",
|
|
76
78
|
"@lucide/vue": "^1.17.0",
|
|
77
79
|
"@microsoft/api-extractor": "^7.58.7",
|
|
78
|
-
"@mkbabb/glass-ui": "11.
|
|
80
|
+
"@mkbabb/glass-ui": "11.1.0",
|
|
79
81
|
"@tailwindcss/postcss": "^4.3.0",
|
|
80
82
|
"@types/node": "^22.20.0",
|
|
81
83
|
"@types/three": "^0.184.1",
|