@mkbabb/keyframes.js 6.2.1 → 6.3.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 +2 -0
- package/dist/engine/index.d.ts +11 -2
- package/dist/engine/index.js +1004 -1004
- package/dist/keyframes.d.ts +15 -2
- package/dist/keyframes.js +114 -114
- package/dist/registry-8bG0FhGi.js +163 -0
- package/dist/{registry-Dd7GzvJm.js → registry-Bs7A0T_s.js} +1 -1
- package/dist/{sequence-BUgKKePR.js → sequence-CPGHHEVM.js} +72 -69
- package/package.json +1 -1
- package/dist/registry-CPtiwlwX.js +0 -162
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { c as e } from "./sequence-CPGHHEVM.js";
|
|
2
|
+
import { CubicBezier as t, bezierPresets as n, easing as r, linearEasing as i, steppedEase as a } from "@mkbabb/value.js/easing";
|
|
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
|
+
//#region src/animation/compile/emit/serialize-value.ts
|
|
5
|
+
var x = class extends Error {
|
|
6
|
+
value;
|
|
7
|
+
issue;
|
|
8
|
+
code = "SERIALIZE_INVARIANT";
|
|
9
|
+
constructor(e, t) {
|
|
10
|
+
super(`ingest admitted a value the serializer refuses (${t.code}).`), this.value = e, this.issue = t, this.name = "SerializeInvariantError";
|
|
11
|
+
}
|
|
12
|
+
}, S = (e) => {
|
|
13
|
+
let t = y(e);
|
|
14
|
+
if (!t.ok) throw new x(e, t.error);
|
|
15
|
+
return t.value;
|
|
16
|
+
}, C = (e, t) => {
|
|
17
|
+
let n = `${e / 1e3}s`, r = `${e}ms`;
|
|
18
|
+
return t === "s" ? n : t === "ms" ? r : n.length <= r.length ? n : r;
|
|
19
|
+
}, w = (e) => e === Infinity ? "infinite" : String(e), T = (e) => [
|
|
20
|
+
e.duration == null ? void 0 : C(e.duration, e.durationUnit),
|
|
21
|
+
e.timingFunction == null ? void 0 : E(e.timingFunction),
|
|
22
|
+
e.delay == null ? void 0 : C(e.delay, e.delayUnit),
|
|
23
|
+
e.iterationCount == null ? void 0 : w(e.iterationCount),
|
|
24
|
+
e.direction,
|
|
25
|
+
e.fillMode,
|
|
26
|
+
e.composition,
|
|
27
|
+
e.name
|
|
28
|
+
].filter((e) => e !== void 0).join(" "), E = (e) => {
|
|
29
|
+
switch (e.kind) {
|
|
30
|
+
case "keyword": return e.name;
|
|
31
|
+
case "cubic-bezier": return `cubic-bezier(${e.x1}, ${e.y1}, ${e.x2}, ${e.y2})`;
|
|
32
|
+
case "steps": return `steps(${e.count}, ${e.position})`;
|
|
33
|
+
case "linear-function": return `linear(${e.stops.map((e) => `${e.output}${e.input.map((e) => ` ${e * 100}%`).join("")}`).join(", ")})`;
|
|
34
|
+
}
|
|
35
|
+
}, D = (e) => `${e.name}: ${S(e.value)}${e.important ? " !important" : ""}`, O = (e) => e.split("\n").map((e) => ` ${e}`).join("\n"), k = (t) => {
|
|
36
|
+
switch (t.kind) {
|
|
37
|
+
case "keyframes": return `@keyframes ${t.name} {\n${t.rules.map((t) => O(`${t.selectors.map(e).join(", ")} {\n${t.declarations.map((e) => O(`${D(e)};`)).join("\n")}\n}`)).join("\n")}\n}`;
|
|
38
|
+
case "property": {
|
|
39
|
+
let e = [];
|
|
40
|
+
return t.descriptor.syntax !== void 0 && e.push(`syntax: ${t.descriptor.syntax};`), t.descriptor.inherits !== void 0 && e.push(`inherits: ${t.descriptor.inherits};`), t.descriptor.initialValue !== void 0 && e.push(`initial-value: ${S(t.descriptor.initialValue)};`), `@property ${t.name} {\n${e.map(O).join("\n")}\n}`;
|
|
41
|
+
}
|
|
42
|
+
case "function": {
|
|
43
|
+
let e = t.descriptor.parameters?.map((e) => {
|
|
44
|
+
let t = e.syntax === void 0 ? "" : ` ${e.syntax}`, n = e.default === void 0 ? "" : `: ${S(e.default)}`;
|
|
45
|
+
return `${e.name}${t}${n}`;
|
|
46
|
+
}).join(", ") ?? "", n = t.descriptor.declarations?.map((e) => `${D(e)};`) ?? [];
|
|
47
|
+
return `@function ${t.name}(${e}) {\n${n.map(O).join("\n")}\n}`;
|
|
48
|
+
}
|
|
49
|
+
case "style": {
|
|
50
|
+
let e = t.declarations.map((e) => `${D(e)};`), n = t.children?.map((e) => k(e)) ?? [];
|
|
51
|
+
return `${t.selectors.join(", ")} {\n${[...e, ...n].map(O).join("\n")}\n}`;
|
|
52
|
+
}
|
|
53
|
+
case "scope": return `@scope (${t.root?.join(", ") ?? ""})${t.limit === void 0 ? "" : ` to (${t.limit.join(", ")})`} {\n${t.children.map((e) => O(k(e))).join("\n")}\n}`;
|
|
54
|
+
case "starting-style": return `@starting-style {\n${t.children.map((e) => O(k(e))).join("\n")}\n}`;
|
|
55
|
+
case "scroll-timeline": {
|
|
56
|
+
let e = Object.entries(t.descriptor).map(([e, t]) => `${e}: ${t};`);
|
|
57
|
+
return `@scroll-timeline ${t.name} {\n${e.map(O).join("\n")}\n}`;
|
|
58
|
+
}
|
|
59
|
+
case "view-timeline": {
|
|
60
|
+
let e = Object.entries(t.descriptor).map(([e, t]) => `${e}: ${t};`);
|
|
61
|
+
return `@view-timeline ${t.name} {\n${e.map(O).join("\n")}\n}`;
|
|
62
|
+
}
|
|
63
|
+
case "unknown": {
|
|
64
|
+
let e = t.prelude === "" ? "" : ` ${t.prelude}`;
|
|
65
|
+
return t.children === void 0 ? t.body === null ? `@${t.atName}${e};` : `@${t.atName}${e} {${t.body}}` : `@${t.atName}${e} {\n${t.children.map((e) => O(k(e))).join("\n")}\n}`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, A = (e) => `${e.code} at ${e.start}-${e.end}: expected ${e.expected.join(" or ")}, got ${e.actual ?? "end of input"}`;
|
|
69
|
+
function j(e, t) {
|
|
70
|
+
if (e.ok) return e.value;
|
|
71
|
+
throw t(e.diagnostics);
|
|
72
|
+
}
|
|
73
|
+
function M(e, t) {
|
|
74
|
+
return e.ok ? {
|
|
75
|
+
value: e.value,
|
|
76
|
+
issues: []
|
|
77
|
+
} : {
|
|
78
|
+
value: t,
|
|
79
|
+
issues: e.diagnostics
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function N(e, t, n) {
|
|
83
|
+
try {
|
|
84
|
+
let r = e();
|
|
85
|
+
return r.ok ? t(r.value) : n;
|
|
86
|
+
} catch {
|
|
87
|
+
return n;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function P(e, t) {
|
|
91
|
+
return e.ok ? e.value : t;
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/animation/compile/easing/registry.ts
|
|
95
|
+
var F = [
|
|
96
|
+
"easeOutCubic",
|
|
97
|
+
"easeInOutSine",
|
|
98
|
+
"easeInOutCubic",
|
|
99
|
+
"easeInOutQuad",
|
|
100
|
+
"easeInOutExpo",
|
|
101
|
+
"easeInOutCirc",
|
|
102
|
+
"easeOutExpo",
|
|
103
|
+
"smoothStep3",
|
|
104
|
+
"easeInBounce"
|
|
105
|
+
], I = [
|
|
106
|
+
...Object.keys(n),
|
|
107
|
+
"ease-in-bounce",
|
|
108
|
+
...F
|
|
109
|
+
], L = (e) => {
|
|
110
|
+
let t = r(e);
|
|
111
|
+
if (!t.ok) throw Error(`value.js rejected its own easing ${JSON.stringify(e)}: ${t.error.code}`);
|
|
112
|
+
return t.value;
|
|
113
|
+
}, R = I.map((e) => [e, L(e)]), z = new Set(I), B = (e) => {
|
|
114
|
+
let t = e.flatMap(({ output: e, input: t }) => t.length === 2 ? [{
|
|
115
|
+
output: e,
|
|
116
|
+
input: t[0]
|
|
117
|
+
}, {
|
|
118
|
+
output: e,
|
|
119
|
+
input: t[1]
|
|
120
|
+
}] : [{
|
|
121
|
+
output: e,
|
|
122
|
+
input: t[0]
|
|
123
|
+
}]);
|
|
124
|
+
t[0].input ??= 0, t[t.length - 1].input ??= 1;
|
|
125
|
+
let n = t[0].input;
|
|
126
|
+
for (let e = 1; e < t.length; e++) {
|
|
127
|
+
let r = t[e].input;
|
|
128
|
+
r !== void 0 && (t[e].input = Math.max(n, r), n = t[e].input);
|
|
129
|
+
}
|
|
130
|
+
for (let e = 0; e < t.length - 1;) {
|
|
131
|
+
let n = e + 1;
|
|
132
|
+
for (; t[n].input === void 0;) n++;
|
|
133
|
+
let r = t[e].input, i = t[n].input;
|
|
134
|
+
for (let a = e + 1; a < n; a++) t[a].input = r + (i - r) * (a - e) / (n - e);
|
|
135
|
+
e = n;
|
|
136
|
+
}
|
|
137
|
+
return t;
|
|
138
|
+
}, V = (e) => {
|
|
139
|
+
switch (e.kind) {
|
|
140
|
+
case "keyword": {
|
|
141
|
+
let t = r(e.name);
|
|
142
|
+
if (t.ok) return t.value;
|
|
143
|
+
throw TypeError(`Invalid timing function: ${t.error.code}.`);
|
|
144
|
+
}
|
|
145
|
+
case "cubic-bezier": {
|
|
146
|
+
let n = t(e.x1, e.y1, e.x2, e.y2);
|
|
147
|
+
if (n.ok) return n.value;
|
|
148
|
+
throw TypeError(`Invalid cubic-bezier(): ${n.error.code}.`);
|
|
149
|
+
}
|
|
150
|
+
case "steps": {
|
|
151
|
+
let t = a(e.count, e.position);
|
|
152
|
+
if (t.ok) return t.value;
|
|
153
|
+
throw TypeError(`Invalid steps(): ${t.error.code}.`);
|
|
154
|
+
}
|
|
155
|
+
case "linear-function": {
|
|
156
|
+
let t = i(B(e.stops));
|
|
157
|
+
if (t.ok) return t.value;
|
|
158
|
+
throw TypeError(`Invalid linear(): ${t.error.code}.`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}, H = (e) => typeof e == "string" ? z.has(e) ? L(e) : V(j(v(e), () => /* @__PURE__ */ TypeError(`Unknown timing function "${e}".`))) : e;
|
|
162
|
+
//#endregion
|
|
163
|
+
export { C, S as E, T as S, E as T, _, s as a, b, u as c, P as d, f, g, h, o as i, d as l, m, R as n, c as o, p, M as r, l as s, H as t, A as u, v, k as w, N as x, j as y };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./registry-
|
|
1
|
+
import { n as e, t } from "./registry-8bG0FhGi.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-Bs7A0T_s.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
|
}
|
|
@@ -238,12 +238,12 @@ function D(e) {
|
|
|
238
238
|
function O(e, t) {
|
|
239
239
|
S(e, t);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function re(e) {
|
|
242
242
|
C(e);
|
|
243
243
|
}
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region src/animation/physics/spring/solver/duration.ts
|
|
246
|
-
function
|
|
246
|
+
function ie(t) {
|
|
247
247
|
let { visualDuration: n, duration: r, bounce: i = 0, ...a } = t, o = n ?? r ?? .5, s = 1 - e(i, -1, 1);
|
|
248
248
|
return {
|
|
249
249
|
...a,
|
|
@@ -253,7 +253,7 @@ function re(t) {
|
|
|
253
253
|
}
|
|
254
254
|
//#endregion
|
|
255
255
|
//#region src/animation/physics/spring/solver/solver.ts
|
|
256
|
-
function
|
|
256
|
+
function k(e, t, n, r) {
|
|
257
257
|
if (t < 1) return {
|
|
258
258
|
regime: "under",
|
|
259
259
|
w: e,
|
|
@@ -278,7 +278,7 @@ function A(e, t, n, r) {
|
|
|
278
278
|
e2: Math.exp(o * r)
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function A(e, t, n, r = {
|
|
282
282
|
x: 0,
|
|
283
283
|
v: 0
|
|
284
284
|
}) {
|
|
@@ -293,12 +293,12 @@ function j(e, t, n, r = {
|
|
|
293
293
|
let { r1: i, r2: a, e1: o, e2: s } = n, c = (t - a * e) / (i - a), l = e - c;
|
|
294
294
|
return r.x = c * o + l * s, r.v = c * i * o + l * a * s, r;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
return
|
|
296
|
+
function ae(e, t, n, r, i, a) {
|
|
297
|
+
return A(e, t, k(n, r, i, a));
|
|
298
298
|
}
|
|
299
299
|
//#endregion
|
|
300
300
|
//#region src/animation/physics/spring/solver/vector.ts
|
|
301
|
-
var
|
|
301
|
+
var j = new Float64Array(), oe = class {
|
|
302
302
|
solution = {
|
|
303
303
|
x: 0,
|
|
304
304
|
v: 0
|
|
@@ -316,10 +316,10 @@ var M = new Float64Array(), ae = class {
|
|
|
316
316
|
this.vecOrigin.set(this.vecCurrent), this.vecOriginVel.set(this.vecVelocity), this.vecTarget.set(e), this.vecElapsed = 0;
|
|
317
317
|
}
|
|
318
318
|
get values() {
|
|
319
|
-
return this.vecCurrent ??
|
|
319
|
+
return this.vecCurrent ?? j;
|
|
320
320
|
}
|
|
321
321
|
get velocities() {
|
|
322
|
-
return this.vecVelocity ??
|
|
322
|
+
return this.vecVelocity ?? j;
|
|
323
323
|
}
|
|
324
324
|
get armed() {
|
|
325
325
|
return this.vecTarget !== null;
|
|
@@ -327,32 +327,32 @@ var M = new Float64Array(), ae = class {
|
|
|
327
327
|
tick(e, t, n, r) {
|
|
328
328
|
if (this.vecTarget === null || e <= 0) return this.values;
|
|
329
329
|
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 =
|
|
330
|
+
let i = this.vecElapsed, a = this.vecOrigin, o = this.vecOriginVel, s = this.vecTarget, c = this.vecCurrent, l = this.vecVelocity, u = k(t, n, r, i), d = this.solution;
|
|
331
331
|
for (let e = 0; e < c.length; e++) {
|
|
332
332
|
let t = a[e] - s[e], n = o[e];
|
|
333
|
-
|
|
333
|
+
A(t, n, u, d), c[e] = s[e] + d.x, l[e] = d.v;
|
|
334
334
|
}
|
|
335
335
|
return c;
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
338
|
//#endregion
|
|
339
339
|
//#region src/animation/physics/spring/vector-surface.ts
|
|
340
|
-
function
|
|
341
|
-
let n = e ?? new
|
|
340
|
+
function se(e, t) {
|
|
341
|
+
let n = e ?? new oe();
|
|
342
342
|
return n.setTargets(t), n;
|
|
343
343
|
}
|
|
344
|
-
function se(e) {
|
|
345
|
-
return e?.values ?? M;
|
|
346
|
-
}
|
|
347
344
|
function ce(e) {
|
|
348
|
-
return e?.
|
|
345
|
+
return e?.values ?? j;
|
|
346
|
+
}
|
|
347
|
+
function le(e) {
|
|
348
|
+
return e?.velocities ?? j;
|
|
349
349
|
}
|
|
350
|
-
function
|
|
351
|
-
return e === null || t <= 0 ?
|
|
350
|
+
function M(e, t, n, r, i) {
|
|
351
|
+
return e === null || t <= 0 ? j : e.tick(t, n, r, i);
|
|
352
352
|
}
|
|
353
353
|
//#endregion
|
|
354
354
|
//#region src/animation/physics/spring/progress.ts
|
|
355
|
-
var
|
|
355
|
+
var N = class e {
|
|
356
356
|
options;
|
|
357
357
|
get respectReducedMotion() {
|
|
358
358
|
return this.options.respectReducedMotion;
|
|
@@ -383,7 +383,7 @@ var P = class e {
|
|
|
383
383
|
}, 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 = v(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
384
|
}
|
|
385
385
|
static fromDuration(t) {
|
|
386
|
-
return new e(
|
|
386
|
+
return new e(ie(t ?? {}));
|
|
387
387
|
}
|
|
388
388
|
get target() {
|
|
389
389
|
return this.targetValue;
|
|
@@ -418,7 +418,7 @@ var P = class e {
|
|
|
418
418
|
return this.disposed || this.isSettled ? this.currentValue : (this.elapsed = Math.max(0, e), this.evaluateAt(this.elapsed), this.checkSettled(), this.emit(), this.currentValue);
|
|
419
419
|
}
|
|
420
420
|
evaluateAt(e) {
|
|
421
|
-
let t = this.scaledTarget(), n = this.originValue - t, r = this.originVelocity, { x: i, v: a } =
|
|
421
|
+
let t = this.scaledTarget(), n = this.originValue - t, r = this.originVelocity, { x: i, v: a } = ae(n, r, this.omega, this.zeta, this.omegaD, e);
|
|
422
422
|
this.currentValue = t + i, this.currentVelocity = a;
|
|
423
423
|
}
|
|
424
424
|
scaledTarget() {
|
|
@@ -437,16 +437,16 @@ var P = class e {
|
|
|
437
437
|
this.targetValue = n, this.currentValue = n, this.currentVelocity = r, this.originValue = n, this.originVelocity = r, this.elapsed = 0, this.amplitudeScale = v(this.options.respectReducedMotion), this.isSettled = r === 0, this.emit(), this._playback.stop();
|
|
438
438
|
}
|
|
439
439
|
setTargets(e) {
|
|
440
|
-
this.vectorLanes =
|
|
440
|
+
this.vectorLanes = se(this.vectorLanes, e);
|
|
441
441
|
}
|
|
442
442
|
get values() {
|
|
443
|
-
return
|
|
443
|
+
return ce(this.vectorLanes);
|
|
444
444
|
}
|
|
445
445
|
get velocities() {
|
|
446
|
-
return
|
|
446
|
+
return le(this.vectorLanes);
|
|
447
447
|
}
|
|
448
448
|
tickVector(e) {
|
|
449
|
-
return this.disposed || this.vectorLanes === null || e <= 0 ? this.values :
|
|
449
|
+
return this.disposed || this.vectorLanes === null || e <= 0 ? this.values : M(this.vectorLanes, e, this.omega, this.zeta, this.omegaD);
|
|
450
450
|
}
|
|
451
451
|
subscribe(e) {
|
|
452
452
|
return this.subscribers.add(e), () => {
|
|
@@ -463,13 +463,13 @@ var P = class e {
|
|
|
463
463
|
O(this, e);
|
|
464
464
|
}
|
|
465
465
|
stop() {
|
|
466
|
-
|
|
466
|
+
re(this);
|
|
467
467
|
}
|
|
468
468
|
};
|
|
469
469
|
//#endregion
|
|
470
470
|
//#region src/animation/physics/spring/solver/sample.ts
|
|
471
|
-
function
|
|
472
|
-
let t = new
|
|
471
|
+
function P(e) {
|
|
472
|
+
let t = new N({
|
|
473
473
|
response: e.response,
|
|
474
474
|
dampingFraction: e.dampingFraction,
|
|
475
475
|
initial: 0,
|
|
@@ -483,8 +483,8 @@ function F(e) {
|
|
|
483
483
|
}
|
|
484
484
|
//#endregion
|
|
485
485
|
//#region src/animation/physics/spring/css/linear-stops.ts
|
|
486
|
-
function
|
|
487
|
-
let t = e.sampleCount ?? 24, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i =
|
|
486
|
+
function F(e) {
|
|
487
|
+
let t = e.sampleCount ?? 24, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = P({
|
|
488
488
|
response: e.response,
|
|
489
489
|
dampingFraction: e.dampingFraction,
|
|
490
490
|
sampleCount: t,
|
|
@@ -497,18 +497,18 @@ function I(e) {
|
|
|
497
497
|
}
|
|
498
498
|
return a.push("1"), `linear(${a.join(", ")})`;
|
|
499
499
|
}
|
|
500
|
-
var
|
|
501
|
-
function
|
|
500
|
+
var I = (e) => Math.round(e * 1e5) / 1e5;
|
|
501
|
+
function L(e) {
|
|
502
502
|
let t = e.length - 1;
|
|
503
503
|
if (t < 1) throw RangeError(`linearFromSamples needs at least 2 samples; got ${e.length}.`);
|
|
504
504
|
let n = [];
|
|
505
|
-
for (let r = 0; r <= t; r++) n.push(`${
|
|
505
|
+
for (let r = 0; r <= t; r++) n.push(`${I(e[r])} ${I(r / t * 100)}%`);
|
|
506
506
|
return `linear(${n.join(", ")})`;
|
|
507
507
|
}
|
|
508
508
|
//#endregion
|
|
509
509
|
//#region src/animation/physics/spring/css/timing-function.ts
|
|
510
|
-
function
|
|
511
|
-
let t = e.sampleCount ?? 64, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i =
|
|
510
|
+
function R(e) {
|
|
511
|
+
let t = e.sampleCount ?? 64, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = P({
|
|
512
512
|
response: e.response,
|
|
513
513
|
dampingFraction: e.dampingFraction,
|
|
514
514
|
sampleCount: t,
|
|
@@ -519,8 +519,8 @@ function z(e) {
|
|
|
519
519
|
for (let e = 1; e <= t; e++) a[e] = i[e - 1];
|
|
520
520
|
return a[t] = 1, a;
|
|
521
521
|
}
|
|
522
|
-
function
|
|
523
|
-
let t =
|
|
522
|
+
function z(e) {
|
|
523
|
+
let t = R(e), n = t.length - 1, r = (e) => {
|
|
524
524
|
if (e <= 0) return 0;
|
|
525
525
|
if (e >= 1) return 1;
|
|
526
526
|
let r = e * n, i = Math.floor(r), a = r - i, o = t[i];
|
|
@@ -531,10 +531,13 @@ function B(e) {
|
|
|
531
531
|
};
|
|
532
532
|
return e.settleThreshold !== void 0 && (i.settleThreshold = e.settleThreshold), e.maxDuration !== void 0 && (i.maxDuration = e.maxDuration), {
|
|
533
533
|
fn: r,
|
|
534
|
-
css:
|
|
534
|
+
css: F(i)
|
|
535
535
|
};
|
|
536
536
|
}
|
|
537
537
|
//#endregion
|
|
538
|
+
//#region src/animation/compile/emit/selector.ts
|
|
539
|
+
var B = (e) => e.kind === "percent" ? `${e.value * 100}%` : e.offset === void 0 ? e.name : `${e.name} ${e.offset * 100}%`;
|
|
540
|
+
//#endregion
|
|
538
541
|
//#region src/animation/orchestration/timeline/native.ts
|
|
539
542
|
function V(e) {
|
|
540
543
|
if (typeof window > "u") return null;
|
|
@@ -591,24 +594,24 @@ function q(e, t, n) {
|
|
|
591
594
|
if (i === void 0) throw Error(`Sequence: unknown position "${e}". Register it with .label("${e}", at) first, or pass a number / "+=n" / "-=n".`);
|
|
592
595
|
return i;
|
|
593
596
|
}
|
|
594
|
-
function
|
|
597
|
+
function ue(t, n, r, i) {
|
|
595
598
|
if (n <= 0) return 0;
|
|
596
599
|
let a = e(t, 0, n * r), o = Math.floor(a / n), s = a - o * n;
|
|
597
600
|
return s === 0 && o > 0 && (--o, s = n), i && o % 2 == 1 ? n - s : s;
|
|
598
601
|
}
|
|
599
|
-
function
|
|
602
|
+
function de(e, t, n) {
|
|
600
603
|
return n && (t - 1) % 2 == 1 ? 0 : e;
|
|
601
604
|
}
|
|
602
|
-
function
|
|
605
|
+
function fe(e, t, n) {
|
|
603
606
|
return e === 1 && t === 1 && !n;
|
|
604
607
|
}
|
|
605
608
|
function J(e, t, n) {
|
|
606
609
|
return n === 0 ? e : e - t / n;
|
|
607
610
|
}
|
|
608
|
-
async function
|
|
611
|
+
async function pe(e, t) {
|
|
609
612
|
e._playOrigin === void 0 && (e._playOrigin = J(t, e._time, e._rate)), e._lastClock = t;
|
|
610
|
-
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 ?
|
|
611
|
-
if (e._time = a,
|
|
613
|
+
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 ? de(e.duration, e._repeatCount, e._yoyoOn) : 0 : ue(n, e.duration, e._repeatCount, e._yoyoOn);
|
|
614
|
+
if (e._time = a, fe(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);
|
|
612
615
|
if (K(e.events, e.entries, e.labels, a), G(e.entries, a), i) {
|
|
613
616
|
Y(e);
|
|
614
617
|
let t = e._resolvePlay;
|
|
@@ -638,15 +641,15 @@ function Z(e, t) {
|
|
|
638
641
|
e._playingPromise === n && (e._playingPromise = null);
|
|
639
642
|
}), n;
|
|
640
643
|
}
|
|
641
|
-
function
|
|
644
|
+
function me(e) {
|
|
642
645
|
return e.started && !e.paused;
|
|
643
646
|
}
|
|
644
|
-
function
|
|
647
|
+
function he(e, t, n) {
|
|
645
648
|
e.paused ? n() : t();
|
|
646
649
|
}
|
|
647
650
|
//#endregion
|
|
648
651
|
//#region src/animation/orchestration/sequence/lifecycle.ts
|
|
649
|
-
function
|
|
652
|
+
function ge(e) {
|
|
650
653
|
return Q(e, 0);
|
|
651
654
|
}
|
|
652
655
|
function Q(e, t) {
|
|
@@ -657,38 +660,38 @@ function Q(e, t) {
|
|
|
657
660
|
e._resolvePlay = t, e.playback.loop(e._boundFrame);
|
|
658
661
|
}));
|
|
659
662
|
}
|
|
660
|
-
function
|
|
663
|
+
function $(e) {
|
|
661
664
|
e.playback.stop(), Y(e);
|
|
662
665
|
let t = e._resolvePlay;
|
|
663
666
|
e._resolvePlay = null, t?.();
|
|
664
667
|
}
|
|
665
|
-
function
|
|
668
|
+
function _e(e) {
|
|
666
669
|
!e._playingPromise || e._paused || (e._paused = !0, e.playback.stop(), e._playOrigin = void 0);
|
|
667
670
|
}
|
|
668
|
-
function
|
|
671
|
+
function ve(e) {
|
|
669
672
|
if (!e._playingPromise) {
|
|
670
673
|
Q(e, e._time);
|
|
671
674
|
return;
|
|
672
675
|
}
|
|
673
676
|
e._paused && (e._paused = !1, e._playOrigin = void 0, e._lastClock = void 0, e.playback.loop(e._boundFrame));
|
|
674
677
|
}
|
|
675
|
-
function
|
|
678
|
+
function ye(e, t) {
|
|
676
679
|
if (!Number.isFinite(t)) throw Error(`Sequence.timeScale(n): n must be a finite number, got ${t}.`);
|
|
677
680
|
e._rate = t, X(e, e._playingPromise != null);
|
|
678
681
|
}
|
|
679
|
-
function
|
|
682
|
+
function be(e) {
|
|
680
683
|
e._rate = -e._rate, X(e, e._playingPromise != null);
|
|
681
684
|
}
|
|
682
|
-
function
|
|
685
|
+
function xe(e, t) {
|
|
683
686
|
if (t !== Infinity && (!Number.isInteger(t) || t < 1)) throw Error(`Sequence.repeat(count): count must be a positive integer or Infinity, got ${t}.`);
|
|
684
687
|
e._repeatCount = t;
|
|
685
688
|
}
|
|
686
|
-
function
|
|
689
|
+
function Se(e, t) {
|
|
687
690
|
e._yoyoOn = t;
|
|
688
691
|
}
|
|
689
692
|
//#endregion
|
|
690
693
|
//#region src/animation/orchestration/sequence/events.ts
|
|
691
|
-
var
|
|
694
|
+
var Ce = class {
|
|
692
695
|
subscribers = new Map([
|
|
693
696
|
["segment:enter", /* @__PURE__ */ new Set()],
|
|
694
697
|
["segment:leave", /* @__PURE__ */ new Set()],
|
|
@@ -723,10 +726,10 @@ var Se = class {
|
|
|
723
726
|
}
|
|
724
727
|
this._prevPhase = n;
|
|
725
728
|
}
|
|
726
|
-
},
|
|
729
|
+
}, we = class {
|
|
727
730
|
entries = [];
|
|
728
731
|
labels = /* @__PURE__ */ new Map();
|
|
729
|
-
events = new
|
|
732
|
+
events = new Ce();
|
|
730
733
|
cursor = 0;
|
|
731
734
|
_time = 0;
|
|
732
735
|
respectReducedMotion;
|
|
@@ -783,32 +786,32 @@ var Se = class {
|
|
|
783
786
|
return this._playingPromise ?? Promise.resolve();
|
|
784
787
|
}
|
|
785
788
|
play() {
|
|
786
|
-
return
|
|
789
|
+
return ge(this);
|
|
787
790
|
}
|
|
788
791
|
async _frame(e) {
|
|
789
|
-
return
|
|
792
|
+
return pe(this, e);
|
|
790
793
|
}
|
|
791
794
|
stop() {
|
|
792
|
-
return
|
|
795
|
+
return $(this), this;
|
|
793
796
|
}
|
|
794
797
|
pause() {
|
|
795
|
-
return
|
|
798
|
+
return _e(this), this;
|
|
796
799
|
}
|
|
797
800
|
resume() {
|
|
798
|
-
return
|
|
801
|
+
return ve(this), this;
|
|
799
802
|
}
|
|
800
803
|
timeScale(e) {
|
|
801
|
-
return
|
|
804
|
+
return ye(this, e), this;
|
|
802
805
|
}
|
|
803
806
|
reverse() {
|
|
804
|
-
return
|
|
807
|
+
return be(this), this;
|
|
805
808
|
}
|
|
806
809
|
repeat(e) {
|
|
807
|
-
return
|
|
810
|
+
return xe(this, e), this;
|
|
808
811
|
}
|
|
809
812
|
yoyo(e = !0) {
|
|
810
|
-
return
|
|
813
|
+
return Se(this, e), this;
|
|
811
814
|
}
|
|
812
815
|
};
|
|
813
816
|
//#endregion
|
|
814
|
-
export {
|
|
817
|
+
export { u as C, a as D, i as E, o as O, ee as S, s as T, y as _, U as a, t as b, B as c, L as d, F as f, v as g, b as h, he as i, z as l, T as m, Z as n, W as o, N as p, me as r, V as s, we as t, R as u, f as v, d as w, n as x, e as y };
|
package/package.json
CHANGED