@mkbabb/keyframes.js 4.3.0 → 5.0.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 +33 -6
- package/dist/animate-CTWr6K7j.js +26 -0
- package/dist/{animations-DaMcGoCd.js → animations-CZxf0rep.js} +3 -3
- package/dist/compile-YRJRdpKF.js +251 -0
- package/dist/{draw-svg-CF2cTJj-.js → draw-svg-Dat9mHgi.js} +1 -1
- package/dist/engine-DQcb7CLW.js +1349 -0
- package/dist/errors-W8zkvPw4.js +21 -0
- package/dist/format-BUgCTjmr.js +123 -0
- package/dist/ingest-CU-kdYcM.js +160 -0
- package/dist/keyframes.d.ts +2495 -1659
- package/dist/keyframes.js +223 -87
- package/dist/morph-svg-83uyYxoW.js +84 -0
- package/dist/{motion-path-CqmlG74k.js → motion-path-C0OHqcA3.js} +1 -1
- package/dist/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/scheduler-7eIr_q1g.js +14 -0
- package/dist/scroll-grammar-B4kPvGh5.js +23 -0
- package/dist/{scroll-scene-JpRpH1uU.js → scroll-scene-DQxhxn9I.js} +18 -39
- package/dist/{sequence-COn8zk5o.js → sequence-cBr7thU8.js} +49 -7
- package/dist/{springTimingFunction-CcJEvGwN.js → springTimingFunction-D26gPkAy.js} +23 -11
- package/dist/{timeline-BjcmprQ6.js → timeline-vY3eD3Ax.js} +125 -111
- package/dist/utils-BPRImVl5.js +100 -0
- package/dist/validate-B1pE-Y_T.js +35 -0
- package/dist/{waapi-Bd5QadtA.js → waapi-D0ssxKy1.js} +90 -28
- package/package.json +61 -6
- package/dist/animate-D5KoLKwi.js +0 -21
- package/dist/binarySearch-DOP8erk-.js +0 -13
- package/dist/compile-C0xOTIC4.js +0 -249
- package/dist/engine-BKm1GcJT.js +0 -1028
- package/dist/ingest-BFBYGTH-.js +0 -139
package/README.md
CHANGED
|
@@ -133,7 +133,7 @@ bench/ # Vitest benchmarks
|
|
|
133
133
|
|
|
134
134
|
## Animation
|
|
135
135
|
|
|
136
|
-
The `
|
|
136
|
+
The `KeyframesAnimation` object (formerly `Animation`, renamed in 5.0.0 — see `docs/MIGRATION-5.0.0.md`) drives `CSSKeyframesAnimation` and `AnimationGroup`. It's composed of:
|
|
137
137
|
|
|
138
138
|
- **options** (`AnimationOptions`)
|
|
139
139
|
- **transform function**: interpolates between keyframes
|
|
@@ -243,7 +243,7 @@ anim.setTargets(element);
|
|
|
243
243
|
await anim.play();
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
The engine surface (`AnimationEngine`): `
|
|
246
|
+
The engine surface (`AnimationEngine`): `KeyframesAnimation`, `CSSKeyframesAnimation`, `AnimationGroup`, `getAnimationId`, `getTimingFunction`, `resolveKeyframes`, `animate`, `MotionPath`/`fromMotionPath`, `DrawSVG`/`fromDrawSVG`, `MorphSVG`/`fromMorphSVG`, `presets`, and the option constants `DIRECTIONS`, `FILL_MODES`, `defaultOptions`, `defaultLayerConfig`. The **type** surface stays on the static barrel — `import type { KeyframesAnimation } from "@mkbabb/keyframes.js"` costs no runtime edge.
|
|
247
247
|
|
|
248
248
|
### `animate`
|
|
249
249
|
|
|
@@ -300,9 +300,26 @@ new DrawSVG(pathEl, { autoPlay: false }); // class form; `.finished` resolves on
|
|
|
300
300
|
|
|
301
301
|
Options: `from`/`to` (`"0%"`–`"100%"` strings or `0`–`1` numbers; default draw-in `0% → 100%`), `autoPlay`, plus every `AnimationOptions` key. The target must be SVG geometry (`<path>`, `<line>`, `<circle>`, …) exposing `getTotalLength()`.
|
|
302
302
|
|
|
303
|
+
### `MorphSVG`
|
|
304
|
+
|
|
305
|
+
Path-shape morphing — interpolate one SVG path `d` into another. value.js's `PathGeometry` owns the geometry (arc-length sampling via `getTotalLength()`/`getPointAtLength()`); keyframes samples both paths at `samples` uniform points and lerps the matched point sets, so the engine's native numeric interpolation *is* the morph (a true blend — the midpoint is distinct from both endpoints, not a cross-fade).
|
|
306
|
+
|
|
307
|
+
```ts run
|
|
308
|
+
const { fromMorphSVG, MorphSVG } = await loadAnimationEngine();
|
|
309
|
+
|
|
310
|
+
// Morph a triangle into a square over 600ms:
|
|
311
|
+
const morph = new MorphSVG("M0,0 L10,0 L5,10 Z", "M0,0 L10,0 L10,10 L0,10 Z", {
|
|
312
|
+
samples: 64,
|
|
313
|
+
duration: 600,
|
|
314
|
+
});
|
|
315
|
+
const dAtMid = morph.sampleD(0.5); // the interpolated `d` at t = 0.5
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Options: `samples` (point count per path; default `64`), plus every `AnimationOptions` key. Both inputs must be non-degenerate path `d` strings (non-zero arc length, ≥ 2 samples) — a degenerate input refuses with a typed `AnimationOptionError`. `MorphSVG.sampleD(t)` reassembles the morphed `d` at any `t`; the per-point coordinates also surface as `--morph-{i}-x`/`--morph-{i}-y` custom properties for direct CSS binding.
|
|
319
|
+
|
|
303
320
|
## `CSSKeyframesAnimation`
|
|
304
321
|
|
|
305
|
-
An abstraction over `
|
|
322
|
+
An abstraction over `KeyframesAnimation` that parses CSS `@keyframes` into `TemplateAnimationFrame` objects, then adds them to a base `KeyframesAnimation`.
|
|
306
323
|
|
|
307
324
|
Three ways to create keyframes:
|
|
308
325
|
|
|
@@ -613,7 +630,7 @@ Abstract progress driver. Pipeline: `sample() → clamp → easing → boundary
|
|
|
613
630
|
|
|
614
631
|
```ts run
|
|
615
632
|
const easing = await resolveEasing("easeOutCubic");
|
|
616
|
-
const timeline = new
|
|
633
|
+
const timeline = new KeyframesScrollTimeline({
|
|
617
634
|
threshold: 0.35,
|
|
618
635
|
easing,
|
|
619
636
|
boundaryEpsilon: 0.005,
|
|
@@ -634,7 +651,7 @@ manual.tick(); // => 0.25
|
|
|
634
651
|
Options: `easing` (callable or `Easing`), `smoothing` (`SmoothProgressOptions` or `false`), `boundaryEpsilon` (snap eased values within this distance of 0/1 to the boundary — prevents scroll-endpoint oscillation, default 0.005).
|
|
635
652
|
|
|
636
653
|
Subclasses:
|
|
637
|
-
- **`
|
|
654
|
+
- **`KeyframesScrollTimeline`** — scroll position → progress. `threshold` sets viewport fraction for full progress (default 0.35). Injectable `getScrollY`/`getViewportHeight`.
|
|
638
655
|
- **`ManualTimeline`** — externally set value → progress. Smoothing off by default.
|
|
639
656
|
|
|
640
657
|
Where the platform ships native scroll-driven timelines, `createNativeTimeline({ kind: "scroll" | "view", … })` feature-detects and returns a native `AnimationTimeline` (or `null`) as an additive fast lane — the JS sampler stays the general fallback.
|
|
@@ -676,7 +693,7 @@ const stops = springLinearStops({ response: 0.5, dampingFraction: 0.45 });
|
|
|
676
693
|
stops.startsWith("linear(0, "); // => true
|
|
677
694
|
stops.endsWith(", 1)"); // => true
|
|
678
695
|
|
|
679
|
-
// JS: a typed Easing — feed it to NumericAnimation / ElementMorph /
|
|
696
|
+
// JS: a typed Easing — feed it to NumericAnimation / ElementMorph / KeyframesAnimation
|
|
680
697
|
const spring = springTimingFunction({ response: 0.5, dampingFraction: 0.45 });
|
|
681
698
|
spring.fn(0); // => 0
|
|
682
699
|
spring.fn(1); // => 1
|
|
@@ -880,6 +897,16 @@ npm run bench # vitest bench
|
|
|
880
897
|
npm run proof:readme-runs # execute every runnable README snippet against the built dist/
|
|
881
898
|
```
|
|
882
899
|
|
|
900
|
+
### Local CI repro
|
|
901
|
+
|
|
902
|
+
A macOS-pass / Linux-fail CI flake (a render-race, an absolute frame/ms threshold) can be reproduced locally — no push, no 30-minute wait — by running the demo-smoke roster inside the same Linux container the CI runner uses:
|
|
903
|
+
|
|
904
|
+
```sh
|
|
905
|
+
make ci-linux # node:24-slim container · npm ci → gh-pages → proof:all:demo
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
It pulls `node:24-slim` (kf's CI Node), mounts the repo at `/workspace`, installs the Playwright browser, builds the demo, and runs the demo gate roster with `KF_REQUIRE_BROWSER=1`, exiting with the container's code. `docker` is the only requirement.
|
|
909
|
+
|
|
883
910
|
**Dependencies**: [`@mkbabb/value.js`](https://github.com/mkbabb/value.js) (ValueUnit, Color, math, parsing, normalization) and [`@mkbabb/parse-that`](https://github.com/mkbabb/parse-that) (parser combinators).
|
|
884
911
|
|
|
885
912
|
**TypeScript**: `strict: true`, `verbatimModuleSyntax: true`, `target: ES2022`, `moduleResolution: bundler`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { t as e } from "./sequence-cBr7thU8.js";
|
|
2
|
+
import { AnimationGroup as t, CSSKeyframesAnimation as n } from "./engine-DQcb7CLW.js";
|
|
3
|
+
import { fromMotionPath as r } from "./motion-path-C0OHqcA3.js";
|
|
4
|
+
//#region src/animation/animate.ts
|
|
5
|
+
var i = (e) => typeof e == "object" && !!e && !Array.isArray(e) && !(e instanceof Map) && typeof e.path == "string", a = (e) => e instanceof Map || typeof e == "object" && !!e && !Array.isArray(e);
|
|
6
|
+
function o(o, s, c) {
|
|
7
|
+
let { transform: l, autoPlay: u = !0, ...d } = c ?? {};
|
|
8
|
+
if (s instanceof t || s instanceof e) {
|
|
9
|
+
let e = Array.isArray(o) ? o : [o];
|
|
10
|
+
return s.setTargets?.(...e), u && s.play(), s;
|
|
11
|
+
}
|
|
12
|
+
if (i(s)) return r(o, {
|
|
13
|
+
...s,
|
|
14
|
+
...d,
|
|
15
|
+
autoPlay: u
|
|
16
|
+
});
|
|
17
|
+
let f = new n(d);
|
|
18
|
+
if (typeof s == "string") f.fromString(s, l);
|
|
19
|
+
else if (Array.isArray(s)) f.fromVars(s, l);
|
|
20
|
+
else if (a(s)) f.fromKeyframes(s, l);
|
|
21
|
+
else throw Error("animate(): unrecognized input — pass a CSS @keyframes string, a keyframe map ({ \"0%\": {...} }), a vars array ([from, to]), or a MotionPath spec ({ path }).");
|
|
22
|
+
let p = Array.isArray(o) ? o : [o];
|
|
23
|
+
return f.setTargets(...p), u && f.play(), f;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { o as animate };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./springTimingFunction-
|
|
2
|
-
import { CSSKeyframesAnimation as t } from "./engine-
|
|
1
|
+
import { t as e } from "./springTimingFunction-D26gPkAy.js";
|
|
2
|
+
import { CSSKeyframesAnimation as t } from "./engine-DQcb7CLW.js";
|
|
3
3
|
import { CSSCubicBezier as n, steppedEase as r } from "@mkbabb/value.js";
|
|
4
4
|
//#region src/animation/animations.ts
|
|
5
5
|
var ee = "\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n", i = (e) => new t({
|
|
@@ -221,4 +221,4 @@ var ee = "\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n", i =
|
|
|
221
221
|
loop: $
|
|
222
222
|
};
|
|
223
223
|
//#endregion
|
|
224
|
-
export { k as accordionExpand, Q as attentionPresets, b as blurIn, he as blurInOut, x as blurOut, l as bounce, X as enterPresets, Z as exitPresets, i as fadeIn, a as fadeOut, u as
|
|
224
|
+
export { k as accordionExpand, Q as attentionPresets, b as blurIn, he as blurInOut, x as blurOut, l as bounce, X as enterPresets, Z as exitPresets, i as fadeIn, a as fadeOut, u as flipPreset, g as glow, C as gradientBackground, m as heartbeat, V as hover, U as jumpDown, H as jumpUp, $ as loopPresets, j as notificationBounce, P as parallaxScroll, Ne as presetTaxonomy, _e as progressBar, o as pulse, _ as rainbowText, d as rotateIn, T as rotateScale, s as shake, S as skeletonLoading, f as slideIn, I as slideInLeft, F as slideInLeftKeyframes, z as slideInRight, R as slideInRightKeyframes, L as slideOutLeft, B as slideOutRight, N as spinner, q as springPop, G as springScaleIn, K as springSlideIn, Y as springWobble, be as textFocusBlur, ce as typewriter, D as typingCursor, v as warpLeft, y as warpRight };
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { t as e } from "./sequence-cBr7thU8.js";
|
|
2
|
+
import { AnimationGroup as t, getAnimationId as n } from "./engine-DQcb7CLW.js";
|
|
3
|
+
import { a as r, i, n as a, t as o } from "./format-BUgCTjmr.js";
|
|
4
|
+
import { a as s } from "./scroll-grammar-B4kPvGh5.js";
|
|
5
|
+
import { COLOR_SPACE_RANGES as c, color2 as l, deltaEOK as u, formatCSS as d, normalizeColorUnit as f, reverseCSSTime as p, sampleColorRamp as m, scale as h } from "@mkbabb/value.js";
|
|
6
|
+
//#region src/animation/compile-color.ts
|
|
7
|
+
var g = c.oklab.a.number.min, _ = c.oklab.a.number.max, v = c.oklab.b.number.min, y = c.oklab.b.number.max, b = (e) => Math.round(e * 1e4) / 1e4, x = (e) => typeof e == "object" && !!e && e.unit === "color", S = (e) => f(e).value, C = (e) => {
|
|
8
|
+
let t = l(e, "oklab");
|
|
9
|
+
return [
|
|
10
|
+
t.l,
|
|
11
|
+
h(t.a, 0, 1, g, _),
|
|
12
|
+
h(t.b, 0, 1, v, y)
|
|
13
|
+
];
|
|
14
|
+
}, w = (e) => {
|
|
15
|
+
let [t, n, r] = C(e);
|
|
16
|
+
return `oklab(${b(t)} ${b(n)} ${b(r)})`;
|
|
17
|
+
}, T = (e, t) => {
|
|
18
|
+
let [n, r, i] = C(e), [a, o, s] = C(t);
|
|
19
|
+
return u(n, r, i, a, o, s);
|
|
20
|
+
}, E = (e, t, n) => l({
|
|
21
|
+
colorSpace: "oklab",
|
|
22
|
+
l: e,
|
|
23
|
+
a: h(t, g, _, 0, 1),
|
|
24
|
+
b: h(n, v, y, 0, 1),
|
|
25
|
+
alpha: 1
|
|
26
|
+
}, "oklab"), D = (e, t) => {
|
|
27
|
+
let [n, r, i] = C(e), [a, o, s] = C(t);
|
|
28
|
+
return E((n + a) / 2, (r + o) / 2, (i + s) / 2);
|
|
29
|
+
}, O = (e) => {
|
|
30
|
+
let t = /([\d.]+)\s*%/.exec(e.toString());
|
|
31
|
+
return t ? parseFloat(t[1]) : 0;
|
|
32
|
+
}, k = (e, t, n) => {
|
|
33
|
+
let r = (e.parsedVars[t] ?? {})[n];
|
|
34
|
+
if (Array.isArray(r)) return r.find((e) => x(e));
|
|
35
|
+
};
|
|
36
|
+
function A(e, t, n, r, i) {
|
|
37
|
+
let a = t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), o = [], s = 0;
|
|
38
|
+
for (let a = 0; a + 1 < e.templateFrames.length; a++) {
|
|
39
|
+
let c = k(e, a, t), l = k(e, a + 1, t);
|
|
40
|
+
if (!c || !l) continue;
|
|
41
|
+
let u = O(e.templateFrames[a].start), d = O(e.templateFrames[a + 1].start);
|
|
42
|
+
if (c.toString() === l.toString()) {
|
|
43
|
+
o.push({
|
|
44
|
+
pct: u,
|
|
45
|
+
css: c.toString()
|
|
46
|
+
});
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
let f = S(c), p = S(l), h = m(f, p, n, {
|
|
50
|
+
space: r,
|
|
51
|
+
...i
|
|
52
|
+
});
|
|
53
|
+
for (let e = 0; e < h.length; e++) {
|
|
54
|
+
let t = e / (h.length - 1), n = u + (d - u) * t;
|
|
55
|
+
o.push({
|
|
56
|
+
pct: b(n),
|
|
57
|
+
css: w(h[e])
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
for (let e = 0; e + 1 < h.length; e++) {
|
|
61
|
+
let t = (e + .5) / (h.length - 1), n = m(f, p, 1024, {
|
|
62
|
+
space: r,
|
|
63
|
+
...i
|
|
64
|
+
})[Math.round(t * 1023)], a = D(h[e], h[e + 1]);
|
|
65
|
+
s = Math.max(s, T(a, n));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let c = e.templateFrames.length - 1, l = k(e, c, t);
|
|
69
|
+
if (l) {
|
|
70
|
+
let t = O(e.templateFrames[c].start);
|
|
71
|
+
o[o.length - 1]?.pct !== t && o.push({
|
|
72
|
+
pct: t,
|
|
73
|
+
css: l.toString()
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
cssProp: a,
|
|
78
|
+
stops: o,
|
|
79
|
+
worstDelta: s
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function j(e, t, n, r) {
|
|
83
|
+
let i = [], a = /* @__PURE__ */ new Set();
|
|
84
|
+
for (let t = 0; t + 1 < e.templateFrames.length; t++) {
|
|
85
|
+
let n = e.parsedVars[t] ?? {};
|
|
86
|
+
for (let [r, o] of Object.entries(n)) {
|
|
87
|
+
if (a.has(r) || !Array.isArray(o) || !o.some((e) => x(e))) continue;
|
|
88
|
+
let n = k(e, t, r), s = k(e, t + 1, r);
|
|
89
|
+
n && s && n.toString() !== s.toString() && (i.push(r), a.add(r));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (i.length === 0) return null;
|
|
93
|
+
let o = Math.max(3, n), s = e.options.colorSpace === "oklch" ? "oklch" : "oklab", c = e.options.hueMethod ? { hueMethod: e.options.hueMethod } : {}, l = 0, u = /* @__PURE__ */ new Map(), d = [];
|
|
94
|
+
for (let t of i) {
|
|
95
|
+
let n = A(e, t, o, s, c);
|
|
96
|
+
l = Math.max(l, n.worstDelta);
|
|
97
|
+
for (let { pct: e, css: t } of n.stops) {
|
|
98
|
+
let r = u.get(e);
|
|
99
|
+
r || (r = [], u.set(e, r), d.push(e)), r.push(`${n.cssProp}: ${t};`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (l > r) return {
|
|
103
|
+
refused: !0,
|
|
104
|
+
delta: l
|
|
105
|
+
};
|
|
106
|
+
d.sort((e, t) => e - t);
|
|
107
|
+
let f = "";
|
|
108
|
+
for (let e of d) {
|
|
109
|
+
let t = u.get(e);
|
|
110
|
+
f += `${e}% {\n ${t.join("\n ")}\n}\n`;
|
|
111
|
+
}
|
|
112
|
+
return { block: `@keyframes ${t} {\n${f}}` };
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/animation/compile.ts
|
|
116
|
+
var M = .04, N = 16;
|
|
117
|
+
function P(e) {
|
|
118
|
+
let t = [];
|
|
119
|
+
for (let r of Object.keys(e.animations)) {
|
|
120
|
+
let i = e.animations[r], a = i.layer.blendMode, o = a === "weighted" && i.layer.weightSpring != null, s = a === "weighted" && i.layer.weightSpring == null, c = a === "add" ? "add" : s ? "accumulate" : "replace";
|
|
121
|
+
t.push({
|
|
122
|
+
animation: i.animation,
|
|
123
|
+
name: L(n(i.animation)),
|
|
124
|
+
composition: c,
|
|
125
|
+
weighted: o,
|
|
126
|
+
...s ? { staticWeight: i.layer.weight } : {},
|
|
127
|
+
delay: 0
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return t;
|
|
131
|
+
}
|
|
132
|
+
function F(e) {
|
|
133
|
+
return e.entries.map((e) => ({
|
|
134
|
+
animation: e.animation,
|
|
135
|
+
name: L(n(e.animation)),
|
|
136
|
+
composition: "replace",
|
|
137
|
+
weighted: !1,
|
|
138
|
+
delay: e.at
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
function I(e) {
|
|
142
|
+
return e.map((e, t) => {
|
|
143
|
+
let r = "animation" in e ? e.animation : e;
|
|
144
|
+
return {
|
|
145
|
+
animation: r,
|
|
146
|
+
name: L(n(r) || `anim-${t}`),
|
|
147
|
+
composition: "replace",
|
|
148
|
+
weighted: !1,
|
|
149
|
+
delay: 0
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function L(e) {
|
|
154
|
+
let t = e.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
155
|
+
return /^[a-zA-Z_]/.test(t) ? t : `a${t}`;
|
|
156
|
+
}
|
|
157
|
+
function R(e) {
|
|
158
|
+
for (let t = 0; t < e.templateFrames.length; t++) {
|
|
159
|
+
let n = e.parsedVars[t] ?? {};
|
|
160
|
+
for (let [e, t] of Object.entries(n)) if (!Array.isArray(t) || t.length === 0) return e;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function z(e, t, n) {
|
|
164
|
+
let { animation: s, name: c } = e;
|
|
165
|
+
if (e.weighted) return n.push({
|
|
166
|
+
name: c,
|
|
167
|
+
reason: "weighted-blend",
|
|
168
|
+
message: "weighted layer blend has no animation-composition equivalent (CSS composites replace/add/accumulate only); the weighted axis is kf's unique blend tier — the JS playback is the only faithful path"
|
|
169
|
+
}), null;
|
|
170
|
+
for (let e of s.frames) if (!s.usesDefaultRenderer(e.transform)) return n.push({
|
|
171
|
+
name: c,
|
|
172
|
+
reason: "custom-renderer",
|
|
173
|
+
message: "custom renderer (a transform closure, not the default DOM-style renderer) cannot be expressed as CSS — the JS playback is the only faithful path"
|
|
174
|
+
}), null;
|
|
175
|
+
let l = R(s);
|
|
176
|
+
if (l) return n.push({
|
|
177
|
+
name: c,
|
|
178
|
+
reason: "computed-unit-drift",
|
|
179
|
+
message: `computed-unit drift on "${l}" — the declared value cannot be re-emitted as a faithful authored string; the JS playback is the only faithful path`
|
|
180
|
+
}), null;
|
|
181
|
+
let u = j(s, c, t.densifyStops ?? 16, t.deltaEEpsilon ?? .04);
|
|
182
|
+
if (u && "refused" in u) return n.push({
|
|
183
|
+
name: c,
|
|
184
|
+
reason: "perceptual-oklab",
|
|
185
|
+
message: `perceptual oklab color track exceeds the densify ΔE-ε threshold (ΔE ${b(u.delta)} > ${t.deltaEEpsilon ?? .04}) — a faithful pure-CSS twin is not available; the JS playback is the only faithful path`
|
|
186
|
+
}), null;
|
|
187
|
+
let d;
|
|
188
|
+
if (e.staticWeight != null) {
|
|
189
|
+
let t = r(s, c, e.staticWeight);
|
|
190
|
+
if ("refused" in t) return n.push({
|
|
191
|
+
name: c,
|
|
192
|
+
reason: "weighted-blend",
|
|
193
|
+
message: `static-weight pre-multiply cannot scale the non-numeric leaf "${t.key}" (a color/string has no scalar weight) — the weighted blend is kf's unique tier; the JS playback is the only faithful path`
|
|
194
|
+
}), null;
|
|
195
|
+
d = t.block;
|
|
196
|
+
}
|
|
197
|
+
let f = d ?? (u && "block" in u ? u.block : i(s, c)), m;
|
|
198
|
+
try {
|
|
199
|
+
m = a(s.options, c);
|
|
200
|
+
} catch {
|
|
201
|
+
return n.push({
|
|
202
|
+
name: c,
|
|
203
|
+
reason: "custom-renderer",
|
|
204
|
+
message: "easing has no faithful CSS timing-function twin (a custom closure cannot be CSS) — attach an Easing.css twin or use a registry name / cubic-bezier() / linear(); the JS playback is the only faithful path"
|
|
205
|
+
}), null;
|
|
206
|
+
}
|
|
207
|
+
let h = o(e.composition), g = h ? `\n ${h}` : "", _ = e.delay > 0 ? `\n animation-delay: ${p(e.delay)};` : "", v = B(s);
|
|
208
|
+
return `${f}\n\n${`.${c} {\n animation: ${m};${g}${_}${v}\n}`}`;
|
|
209
|
+
}
|
|
210
|
+
function B(e) {
|
|
211
|
+
let t = e.scrollOptions;
|
|
212
|
+
if (t == null) return "";
|
|
213
|
+
let n = s(t), r = "";
|
|
214
|
+
for (let [e, t] of Object.entries(n)) t != null && (r += `\n ${e}: ${t};`);
|
|
215
|
+
return r;
|
|
216
|
+
}
|
|
217
|
+
async function V(n, r = {}) {
|
|
218
|
+
let i = n instanceof t ? P(n) : n instanceof e ? F(n) : I(n), a = /* @__PURE__ */ new Map();
|
|
219
|
+
for (let e of i) {
|
|
220
|
+
let t = a.get(e.name) ?? 0;
|
|
221
|
+
a.set(e.name, t + 1), t > 0 && (e.name = `${e.name}-${t + 1}`);
|
|
222
|
+
}
|
|
223
|
+
r.staggerDelays && i.forEach((e, t) => {
|
|
224
|
+
let n = r.staggerDelays[t];
|
|
225
|
+
typeof n == "number" && n > 0 && (e.delay += n);
|
|
226
|
+
});
|
|
227
|
+
let o = [], s = [];
|
|
228
|
+
for (let e of i) {
|
|
229
|
+
let t = z(e, r, o);
|
|
230
|
+
t && s.push(t);
|
|
231
|
+
}
|
|
232
|
+
let c = o.length === 0;
|
|
233
|
+
if (s.length === 0) return {
|
|
234
|
+
css: "",
|
|
235
|
+
eligible: c,
|
|
236
|
+
refusals: o
|
|
237
|
+
};
|
|
238
|
+
let l = s.join("\n\n"), u;
|
|
239
|
+
try {
|
|
240
|
+
u = await d(l, r.printWidth);
|
|
241
|
+
} catch {
|
|
242
|
+
u = l;
|
|
243
|
+
}
|
|
244
|
+
return {
|
|
245
|
+
css: u,
|
|
246
|
+
eligible: c,
|
|
247
|
+
refusals: o
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
export { M as DEFAULT_DELTA_E_EPSILON, N as DEFAULT_DENSIFY_STOPS, V as compileToCSS };
|