@mkbabb/keyframes.js 5.0.0 → 5.2.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 +112 -217
- package/dist/backward-color-BtbRcnna.js +108 -0
- package/dist/compile-BHCTPerD.js +30 -0
- package/dist/{waapi-D0ssxKy1.js → delegation-BQYCrP2p.js} +117 -99
- package/dist/{draw-svg-Dat9mHgi.js → draw-svg-CK9Qrly8.js} +18 -26
- package/dist/easing-registry-DHV2-5gA.js +27 -0
- package/dist/easing-registry-y1p9McFy.js +2 -0
- package/dist/easing-serialize-D4LZCB6i.js +21 -0
- package/dist/engine/index.d.ts +3139 -0
- package/dist/engine/index.js +16 -0
- package/dist/engine-CPK_udUQ.js +1172 -0
- package/dist/engine-DlpimZtM.js +3 -0
- package/dist/entry-D82NKUhP.js +148 -0
- package/dist/format-BdIvdLzG.js +114 -0
- package/dist/group-HM7N4uOE.js +390 -0
- package/dist/handle-D4xrf_ya.js +21 -0
- package/dist/{ingest-CU-kdYcM.js → ingest-_g6tfk2e.js} +62 -56
- package/dist/keyframes.d.ts +1156 -1099
- package/dist/keyframes.js +412 -132
- package/dist/morph-svg-KUrH9KnK.js +79 -0
- package/dist/motion-path-wM5tPfrY.js +26 -0
- package/dist/parse-flatten-DRMHFytp.js +2 -0
- package/dist/parse-flatten-ZZUSEQEL.js +63 -0
- package/dist/presets-DeDJYL4G.js +275 -0
- package/dist/{scheduler-7eIr_q1g.js → scheduler-CfGIC3GX.js} +1 -1
- package/dist/scroll-BEyCx0b_.js +287 -0
- package/dist/sequence-s0bL7Uul.js +736 -0
- package/dist/{validate-B1pE-Y_T.js → validate-xFZ_Ld1k.js} +17 -13
- package/dist/view-transition-BPJQxUTC.js +305 -0
- package/package.json +123 -84
- package/dist/animate-CTWr6K7j.js +0 -26
- package/dist/animations-CZxf0rep.js +0 -224
- package/dist/compile-YRJRdpKF.js +0 -251
- package/dist/decay-BvNmFk51.js +0 -25
- package/dist/engine-DQcb7CLW.js +0 -1349
- package/dist/errors-W8zkvPw4.js +0 -21
- package/dist/format-BUgCTjmr.js +0 -123
- package/dist/morph-svg-83uyYxoW.js +0 -84
- package/dist/motion-path-C0OHqcA3.js +0 -31
- package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
- package/dist/scroll-grammar-B4kPvGh5.js +0 -23
- package/dist/scroll-scene-DQxhxn9I.js +0 -176
- package/dist/sequence-cBr7thU8.js +0 -198
- package/dist/springTimingFunction-D26gPkAy.js +0 -63
- package/dist/timeline-vY3eD3Ax.js +0 -430
- package/dist/utils-BPRImVl5.js +0 -100
|
@@ -1,73 +1,24 @@
|
|
|
1
|
-
import { f as e, i as t } from "./
|
|
1
|
+
import { f as e, i as t } from "./sequence-s0bL7Uul.js";
|
|
2
2
|
import { COMPUTED_UNITS as n, unflattenObjectToString as r } from "@mkbabb/value.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
//#region src/animation/internal/scroll-phases.ts
|
|
4
|
+
var i = {
|
|
5
|
+
entry: {
|
|
6
|
+
start: 0,
|
|
7
|
+
end: .25
|
|
8
|
+
},
|
|
9
|
+
cover: {
|
|
10
|
+
start: .25,
|
|
11
|
+
end: .75
|
|
12
|
+
},
|
|
13
|
+
contain: {
|
|
14
|
+
start: .375,
|
|
15
|
+
end: .625
|
|
16
|
+
},
|
|
17
|
+
exit: {
|
|
18
|
+
start: .75,
|
|
19
|
+
end: 1
|
|
11
20
|
}
|
|
12
|
-
|
|
13
|
-
}, o = 64, s = (e, t, n) => {
|
|
14
|
-
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = n - t;
|
|
15
|
-
for (let n = 0; n <= o; n++) {
|
|
16
|
-
let c = a(e, t + s * n / o);
|
|
17
|
-
for (let [e, t] of c) {
|
|
18
|
-
let n = r.get(e), a = i.get(e);
|
|
19
|
-
(n === void 0 || t < n) && r.set(e, t), (a === void 0 || t > a) && i.set(e, t);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
let c = /* @__PURE__ */ new Map();
|
|
23
|
-
for (let [e, t] of r) c.set(e, (i.get(e) ?? t) - t);
|
|
24
|
-
return c;
|
|
25
|
-
}, c = (e, t, n, r, i, o) => {
|
|
26
|
-
let s = r - t, c = 0;
|
|
27
|
-
for (let r of [.25, .75]) {
|
|
28
|
-
let l = a(e, t + s * r);
|
|
29
|
-
for (let [e, t] of l) {
|
|
30
|
-
let a = n.get(e), s = i.get(e);
|
|
31
|
-
if (a === void 0 || s === void 0) continue;
|
|
32
|
-
let l = o.get(e);
|
|
33
|
-
if (l === void 0 || l === 0) continue;
|
|
34
|
-
let u = a + (s - a) * r, d = Math.abs(t - u) / l;
|
|
35
|
-
d > c && (c = d);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return c;
|
|
39
|
-
};
|
|
40
|
-
function l(e, t, n) {
|
|
41
|
-
let r = /* @__PURE__ */ new Set();
|
|
42
|
-
if (n <= 0) return r;
|
|
43
|
-
for (let n = 1; n < t.length; n++) {
|
|
44
|
-
let o = t[n - 1], l = t[n];
|
|
45
|
-
if (l - o <= 0) continue;
|
|
46
|
-
let u = s(e, o, l), d = a(e, o), f = a(e, l), p = (t, n, r, i) => ({
|
|
47
|
-
a: t,
|
|
48
|
-
sampleA: n,
|
|
49
|
-
b: r,
|
|
50
|
-
sampleB: i,
|
|
51
|
-
error: c(e, t, n, r, i, u)
|
|
52
|
-
}), m = [p(o, d, l, f)], h = 16;
|
|
53
|
-
for (; h > 0;) {
|
|
54
|
-
let t = -1, n = i;
|
|
55
|
-
for (let e = 0; e < m.length; e++) m[e].error > n && (n = m[e].error, t = e);
|
|
56
|
-
if (t === -1) break;
|
|
57
|
-
let o = m[t], s = (o.a + o.b) / 2;
|
|
58
|
-
if (s <= o.a || s >= o.b) {
|
|
59
|
-
m.splice(t, 1);
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
let c = a(e, s);
|
|
63
|
-
r.add(s), h--, m.splice(t, 1, p(o.a, o.sampleA, s, c), p(s, c, o.b, o.sampleB));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return r;
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/animation/waapi.ts
|
|
70
|
-
var u = new Set([
|
|
21
|
+
}, a = new Set([
|
|
71
22
|
...n,
|
|
72
23
|
"%",
|
|
73
24
|
"vh",
|
|
@@ -100,8 +51,8 @@ var u = new Set([
|
|
|
100
51
|
"cqb",
|
|
101
52
|
"cqmin",
|
|
102
53
|
"cqmax"
|
|
103
|
-
]),
|
|
104
|
-
function
|
|
54
|
+
]), o = (e) => typeof e == "string" && a.has(e), s = new Set(["offset-distance"]), c = (e) => s.has(e) || s.has(e.split(".").pop() ?? e), l = () => typeof globalThis.webkitConvertPointFromNodeToPage == "function";
|
|
55
|
+
function u(e) {
|
|
105
56
|
if (!e.targets || e.targets.length === 0) return {
|
|
106
57
|
eligible: !1,
|
|
107
58
|
reason: "no DOM targets"
|
|
@@ -120,23 +71,19 @@ function h(e) {
|
|
|
120
71
|
eligible: !1,
|
|
121
72
|
reason: "non-uniform per-frame timing function (WAAPI supports one easing per animation)"
|
|
122
73
|
};
|
|
123
|
-
if (t.css !== void 0) return {
|
|
124
|
-
eligible: !1,
|
|
125
|
-
reason: "CSS-twinned easing across multiple segments (WAAPI restarts the curve per segment)"
|
|
126
|
-
};
|
|
127
74
|
}
|
|
128
75
|
if (t && t.css === void 0) return {
|
|
129
76
|
eligible: !1,
|
|
130
77
|
reason: "easing has no faithful CSS twin (would run bare linear on the compositor)"
|
|
131
78
|
};
|
|
132
|
-
if (t?.css?.startsWith("linear(") &&
|
|
79
|
+
if (t?.css?.startsWith("linear(") && l()) return {
|
|
133
80
|
eligible: !1,
|
|
134
81
|
reason: "WebKit refuses HW-accel for linear() easing — the spring twin stays on the rAF path (CE-1.0)"
|
|
135
82
|
};
|
|
136
83
|
for (let t of e.frames) for (let [e, n] of Object.entries(t.interpVars)) {
|
|
137
|
-
let t =
|
|
84
|
+
let t = c(e);
|
|
138
85
|
for (let e of n) {
|
|
139
|
-
let n =
|
|
86
|
+
let n = o(e.start?.unit) && !(t && e.start?.unit === "%"), r = o(e.stop?.unit) && !(t && e.stop?.unit === "%");
|
|
140
87
|
if (n || r) return {
|
|
141
88
|
eligible: !1,
|
|
142
89
|
reason: `layout-dependent unit (${String(e.start?.unit ?? e.stop?.unit)}) would freeze to px under WAAPI`
|
|
@@ -149,11 +96,78 @@ function h(e) {
|
|
|
149
96
|
}
|
|
150
97
|
return { eligible: !0 };
|
|
151
98
|
}
|
|
152
|
-
|
|
99
|
+
var d = .005, f = (e, t) => {
|
|
100
|
+
let n = /* @__PURE__ */ new Map(), r = e.interpFrames(t, !1);
|
|
101
|
+
for (let e in r) {
|
|
102
|
+
let t = r[e];
|
|
103
|
+
if (t !== void 0) for (let r = 0; r < t.length; r++) {
|
|
104
|
+
let i = t[r]?.value;
|
|
105
|
+
typeof i == "number" && Number.isFinite(i) && n.set(t.length > 1 ? `${e}.${r}` : e, i);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return n;
|
|
109
|
+
}, p = 64, m = (e, t, n) => {
|
|
110
|
+
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = n - t;
|
|
111
|
+
for (let n = 0; n <= p; n++) {
|
|
112
|
+
let o = f(e, t + a * n / p);
|
|
113
|
+
for (let [e, t] of o) {
|
|
114
|
+
let n = r.get(e), a = i.get(e);
|
|
115
|
+
(n === void 0 || t < n) && r.set(e, t), (a === void 0 || t > a) && i.set(e, t);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
let o = /* @__PURE__ */ new Map();
|
|
119
|
+
for (let [e, t] of r) o.set(e, (i.get(e) ?? t) - t);
|
|
120
|
+
return o;
|
|
121
|
+
}, h = (e, t, n, r, i, a) => {
|
|
122
|
+
let o = r - t, s = 0;
|
|
123
|
+
for (let r of [.25, .75]) {
|
|
124
|
+
let c = f(e, t + o * r);
|
|
125
|
+
for (let [e, t] of c) {
|
|
126
|
+
let o = n.get(e), c = i.get(e);
|
|
127
|
+
if (o === void 0 || c === void 0) continue;
|
|
128
|
+
let l = a.get(e);
|
|
129
|
+
if (l === void 0 || l === 0) continue;
|
|
130
|
+
let u = o + (c - o) * r, d = Math.abs(t - u) / l;
|
|
131
|
+
d > s && (s = d);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return s;
|
|
135
|
+
};
|
|
136
|
+
function g(e, t, n) {
|
|
137
|
+
let r = /* @__PURE__ */ new Set();
|
|
138
|
+
if (n <= 0) return r;
|
|
139
|
+
for (let n = 1; n < t.length; n++) {
|
|
140
|
+
let i = t[n - 1], a = t[n];
|
|
141
|
+
if (a - i <= 0) continue;
|
|
142
|
+
let o = m(e, i, a), s = f(e, i), c = f(e, a), l = (t, n, r, i) => ({
|
|
143
|
+
a: t,
|
|
144
|
+
sampleA: n,
|
|
145
|
+
b: r,
|
|
146
|
+
sampleB: i,
|
|
147
|
+
error: h(e, t, n, r, i, o)
|
|
148
|
+
}), u = [l(i, s, a, c)], p = 16;
|
|
149
|
+
for (; p > 0;) {
|
|
150
|
+
let t = -1, n = d;
|
|
151
|
+
for (let e = 0; e < u.length; e++) u[e].error > n && (n = u[e].error, t = e);
|
|
152
|
+
if (t === -1) break;
|
|
153
|
+
let i = u[t], a = (i.a + i.b) / 2;
|
|
154
|
+
if (a <= i.a || a >= i.b) {
|
|
155
|
+
u.splice(t, 1);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
let o = f(e, a);
|
|
159
|
+
r.add(a), p--, u.splice(t, 1, l(i.a, i.sampleA, a, o), l(a, o, i.b, i.sampleB));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return r;
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/animation/waapi/emission.ts
|
|
166
|
+
function _(t) {
|
|
153
167
|
let n = t.options.duration, i = [], a = /* @__PURE__ */ new Set();
|
|
154
168
|
for (let e of t.frames) a.add(e.time.start), a.add(e.time.stop);
|
|
155
169
|
let o = [...a].sort((e, t) => e - t), s = new Set(o);
|
|
156
|
-
for (let e of
|
|
170
|
+
for (let e of g(t, o, n)) s.add(e);
|
|
157
171
|
for (let a of [...s].sort((e, t) => e - t)) {
|
|
158
172
|
let o = t.interpFrames(a, !1);
|
|
159
173
|
if (Object.keys(o).length === 0) continue;
|
|
@@ -165,44 +179,48 @@ function g(t) {
|
|
|
165
179
|
}
|
|
166
180
|
return i;
|
|
167
181
|
}
|
|
168
|
-
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/animation/waapi/waapi-options.ts
|
|
184
|
+
var v = {
|
|
169
185
|
normal: "normal",
|
|
170
186
|
reverse: "reverse",
|
|
171
187
|
alternate: "alternate",
|
|
172
188
|
"alternate-reverse": "alternate-reverse"
|
|
173
|
-
},
|
|
189
|
+
}, y = {
|
|
174
190
|
none: "none",
|
|
175
191
|
forwards: "forwards",
|
|
176
192
|
backwards: "backwards",
|
|
177
193
|
both: "both"
|
|
178
|
-
},
|
|
194
|
+
}, b = {
|
|
179
195
|
replace: "replace",
|
|
180
196
|
add: "add",
|
|
181
197
|
accumulate: "accumulate"
|
|
182
|
-
},
|
|
198
|
+
}, x = (e) => {
|
|
183
199
|
for (let t of e.frames) {
|
|
184
200
|
let e = t.composition;
|
|
185
|
-
if (e != null && e !== "replace") return
|
|
201
|
+
if (e != null && e !== "replace") return b[e] ?? "replace";
|
|
186
202
|
}
|
|
187
203
|
return "replace";
|
|
188
204
|
};
|
|
189
|
-
function
|
|
190
|
-
let t = e.options, n =
|
|
205
|
+
function S(e) {
|
|
206
|
+
let t = e.options, n = v[t.direction], r = y[t.fillMode];
|
|
191
207
|
if (n == null) throw TypeError(`Unrecognised animation direction "${t.direction}".`);
|
|
192
208
|
if (r == null) throw TypeError(`Unrecognised animation fill mode "${t.fillMode}".`);
|
|
193
|
-
let i =
|
|
209
|
+
let i = e.frames[0]?.timingFunction ?? e.options.timingFunction, a = e.frames.length > 1 ? "linear" : i.css ?? "linear", o = x(e), s = {
|
|
194
210
|
duration: t.duration,
|
|
195
211
|
delay: t.delay,
|
|
196
212
|
iterations: t.iterationCount === Infinity ? Infinity : t.iterationCount,
|
|
197
213
|
direction: n,
|
|
198
214
|
fill: r,
|
|
199
|
-
easing:
|
|
215
|
+
easing: a
|
|
200
216
|
};
|
|
201
|
-
return
|
|
217
|
+
return o !== "replace" && (s.composite = o), s;
|
|
202
218
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/animation/waapi/delegation.ts
|
|
221
|
+
async function C(e) {
|
|
222
|
+
let t = _(e), n = S(e), r = e.targets.map((e) => e.animate(t, n));
|
|
223
|
+
e._playback._waAnimations = r, e.playback.loop(async (t) => {
|
|
206
224
|
if (e.done) return !1;
|
|
207
225
|
if (await e.advanceTo(t), e.paused) for (let e of r) e.pause();
|
|
208
226
|
else for (let e of r) e.playState === "paused" && e.play();
|
|
@@ -214,11 +232,11 @@ async function S(e) {
|
|
|
214
232
|
e.restPosition === "final" && typeof t.commitStyles == "function" && t.commitStyles(), t.cancel();
|
|
215
233
|
} catch {}
|
|
216
234
|
} catch {} finally {
|
|
217
|
-
e.playback.stop(), e._waAnimations = [];
|
|
235
|
+
e.playback.stop(), e._playback._waAnimations = [];
|
|
218
236
|
}
|
|
219
237
|
}
|
|
220
|
-
function
|
|
221
|
-
let r =
|
|
238
|
+
function w(e, n) {
|
|
239
|
+
let r = u(e);
|
|
222
240
|
if (!r.eligible) return {
|
|
223
241
|
attached: !1,
|
|
224
242
|
reason: r.reason
|
|
@@ -228,14 +246,14 @@ function C(e, n) {
|
|
|
228
246
|
attached: !1,
|
|
229
247
|
reason: "native scroll/view timeline unavailable (feature absent)"
|
|
230
248
|
};
|
|
231
|
-
let a =
|
|
232
|
-
...
|
|
249
|
+
let a = _(e), o = {
|
|
250
|
+
...S(e),
|
|
233
251
|
timeline: i
|
|
234
252
|
}, s = e.targets.map((e) => e.animate(a, o));
|
|
235
|
-
return e._waAnimations = s, {
|
|
253
|
+
return e._playback._waAnimations = s, {
|
|
236
254
|
attached: !0,
|
|
237
255
|
animations: s
|
|
238
256
|
};
|
|
239
257
|
}
|
|
240
258
|
//#endregion
|
|
241
|
-
export {
|
|
259
|
+
export { i, C as n, u as r, w as t };
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { n as e } from "./presets-DeDJYL4G.js";
|
|
2
|
+
import { t } from "./engine-CPK_udUQ.js";
|
|
3
|
+
import { t as n } from "./handle-D4xrf_ya.js";
|
|
4
|
+
//#region src/animation/svg/draw-svg.ts
|
|
5
|
+
var r = /* @__PURE__ */ e({
|
|
6
|
+
DrawSVG: () => o,
|
|
7
|
+
fromDrawSVG: () => a
|
|
8
|
+
}), i = (e) => {
|
|
4
9
|
if (typeof e == "number") {
|
|
5
10
|
if (!Number.isFinite(e) || e < 0 || e > 1) throw Error(`fromDrawSVG(): a numeric draw position is a 0..1 fraction, got ${JSON.stringify(e)} — pass a fraction in [0, 1] or a percent string ("0%".."100%").`);
|
|
6
11
|
return e;
|
|
@@ -8,34 +13,21 @@ var t = (e) => {
|
|
|
8
13
|
if (!/^\s*\d*\.?\d+\s*%\s*$/.test(e)) throw Error(`fromDrawSVG(): invalid draw position ${JSON.stringify(e)} — pass a percent string ("0%".."100%") or a 0..1 number.`);
|
|
9
14
|
return parseFloat(e) / 100;
|
|
10
15
|
};
|
|
11
|
-
function
|
|
12
|
-
let { from:
|
|
13
|
-
if (
|
|
14
|
-
let c =
|
|
15
|
-
|
|
16
|
+
function a(e, n = {}) {
|
|
17
|
+
let { from: r = "0%", to: a = "100%", autoPlay: o = !0, ...s } = n;
|
|
18
|
+
if (e == null || typeof e.getTotalLength != "function") throw Error("fromDrawSVG(): `target` must be an SVG geometry element exposing getTotalLength() (a <path>/<line>/<circle>/<rect>/<polygon>/…).");
|
|
19
|
+
let c = i(r), l = i(a), u = e.getTotalLength();
|
|
20
|
+
e.style.strokeDasharray = `${u}`;
|
|
16
21
|
let d = {
|
|
17
22
|
"0%": { "stroke-dashoffset": u * (1 - c) },
|
|
18
23
|
"100%": { "stroke-dashoffset": u * (1 - l) }
|
|
19
|
-
}, f = new
|
|
20
|
-
return f.setTargets(
|
|
24
|
+
}, f = new t(s).fromKeyframes(d);
|
|
25
|
+
return f.setTargets(e), o && f.play(), f;
|
|
21
26
|
}
|
|
22
|
-
var
|
|
23
|
-
animation;
|
|
27
|
+
var o = class extends n {
|
|
24
28
|
constructor(e, t = {}) {
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
play() {
|
|
28
|
-
return this.animation.play();
|
|
29
|
-
}
|
|
30
|
-
pause() {
|
|
31
|
-
return this.animation.pause(), this;
|
|
32
|
-
}
|
|
33
|
-
stop() {
|
|
34
|
-
return this.animation.stop(), this;
|
|
35
|
-
}
|
|
36
|
-
get finished() {
|
|
37
|
-
return this.animation.finished;
|
|
29
|
+
super(a(e, t));
|
|
38
30
|
}
|
|
39
31
|
};
|
|
40
32
|
//#endregion
|
|
41
|
-
export { r as
|
|
33
|
+
export { r as n, a as r, o as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CSSCubicBezier as e, cssLinear as t, parseLinearStops as n, parseSteps as r, steppedEase as i, timingFunctions as a } from "@mkbabb/value.js";
|
|
2
|
+
//#region src/animation/compile/easing-registry.ts
|
|
3
|
+
var o = /^\s*cubic-bezier\s*\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)\s*$/i, s = /^\s*steps\s*\(/i, c = /^\s*linear\s*\(/i, l = (l) => {
|
|
4
|
+
if (l == null) return;
|
|
5
|
+
if (typeof l != "string") return l;
|
|
6
|
+
let u = l.match(o);
|
|
7
|
+
if (u) {
|
|
8
|
+
let t = u.slice(1, 5).map((e) => Number.parseFloat(e ?? ""));
|
|
9
|
+
if (t.length === 4 && t.every((e) => Number.isFinite(e))) {
|
|
10
|
+
let [n, r, i, a] = t;
|
|
11
|
+
return e(n, r, i, a);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (s.test(l)) try {
|
|
15
|
+
let { count: e, jumpTerm: t } = r(l);
|
|
16
|
+
return i(e, t);
|
|
17
|
+
} catch {}
|
|
18
|
+
if (l === "step-start") return i(1, "jump-start");
|
|
19
|
+
if (l === "step-end") return i(1, "jump-end");
|
|
20
|
+
if (c.test(l)) try {
|
|
21
|
+
return t(n(l));
|
|
22
|
+
} catch {}
|
|
23
|
+
let d = a[l];
|
|
24
|
+
if (typeof d == "function" && d.length <= 1) return d;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { l as t };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { y as e } from "./sequence-s0bL7Uul.js";
|
|
2
|
+
import { camelCaseToHyphen as t, timingFunctions as n } from "@mkbabb/value.js";
|
|
3
|
+
//#region src/animation/compile/backward/easing-serialize.ts
|
|
4
|
+
var r = /^(linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end)$/, i = (e) => Math.round(e * 1e5) / 1e5;
|
|
5
|
+
function a(e, t = 32) {
|
|
6
|
+
let n = [];
|
|
7
|
+
for (let r = 0; r <= t; r++) {
|
|
8
|
+
let a = r / t;
|
|
9
|
+
n.push(`${i(e(a))} ${i(a * 100)}%`);
|
|
10
|
+
}
|
|
11
|
+
return `linear(${n.join(", ")})`;
|
|
12
|
+
}
|
|
13
|
+
function o(i) {
|
|
14
|
+
if (i.css !== void 0) return i.css;
|
|
15
|
+
let o = Object.entries(n).find(([e, t]) => t === i.fn)?.[0];
|
|
16
|
+
if (o === void 0) throw new e("timingFunction", i.fn, "a custom TimingFunction has no CSS animation-timing-function representation — attach a faithful Easing.css twin, or use a registry name / cubic-bezier() / linear() literal");
|
|
17
|
+
let s = t(o);
|
|
18
|
+
return r.test(s) ? s : a(i.fn);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { o as t };
|