@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.
Files changed (46) hide show
  1. package/README.md +112 -217
  2. package/dist/backward-color-BtbRcnna.js +108 -0
  3. package/dist/compile-BHCTPerD.js +30 -0
  4. package/dist/{waapi-D0ssxKy1.js → delegation-BQYCrP2p.js} +117 -99
  5. package/dist/{draw-svg-Dat9mHgi.js → draw-svg-CK9Qrly8.js} +18 -26
  6. package/dist/easing-registry-DHV2-5gA.js +27 -0
  7. package/dist/easing-registry-y1p9McFy.js +2 -0
  8. package/dist/easing-serialize-D4LZCB6i.js +21 -0
  9. package/dist/engine/index.d.ts +3139 -0
  10. package/dist/engine/index.js +16 -0
  11. package/dist/engine-CPK_udUQ.js +1172 -0
  12. package/dist/engine-DlpimZtM.js +3 -0
  13. package/dist/entry-D82NKUhP.js +148 -0
  14. package/dist/format-BdIvdLzG.js +114 -0
  15. package/dist/group-HM7N4uOE.js +390 -0
  16. package/dist/handle-D4xrf_ya.js +21 -0
  17. package/dist/{ingest-CU-kdYcM.js → ingest-_g6tfk2e.js} +62 -56
  18. package/dist/keyframes.d.ts +1156 -1099
  19. package/dist/keyframes.js +412 -132
  20. package/dist/morph-svg-KUrH9KnK.js +79 -0
  21. package/dist/motion-path-wM5tPfrY.js +26 -0
  22. package/dist/parse-flatten-DRMHFytp.js +2 -0
  23. package/dist/parse-flatten-ZZUSEQEL.js +63 -0
  24. package/dist/presets-DeDJYL4G.js +275 -0
  25. package/dist/{scheduler-7eIr_q1g.js → scheduler-CfGIC3GX.js} +1 -1
  26. package/dist/scroll-BEyCx0b_.js +287 -0
  27. package/dist/sequence-s0bL7Uul.js +736 -0
  28. package/dist/{validate-B1pE-Y_T.js → validate-xFZ_Ld1k.js} +17 -13
  29. package/dist/view-transition-BPJQxUTC.js +305 -0
  30. package/package.json +123 -84
  31. package/dist/animate-CTWr6K7j.js +0 -26
  32. package/dist/animations-CZxf0rep.js +0 -224
  33. package/dist/compile-YRJRdpKF.js +0 -251
  34. package/dist/decay-BvNmFk51.js +0 -25
  35. package/dist/engine-DQcb7CLW.js +0 -1349
  36. package/dist/errors-W8zkvPw4.js +0 -21
  37. package/dist/format-BUgCTjmr.js +0 -123
  38. package/dist/morph-svg-83uyYxoW.js +0 -84
  39. package/dist/motion-path-C0OHqcA3.js +0 -31
  40. package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
  41. package/dist/scroll-grammar-B4kPvGh5.js +0 -23
  42. package/dist/scroll-scene-DQxhxn9I.js +0 -176
  43. package/dist/sequence-cBr7thU8.js +0 -198
  44. package/dist/springTimingFunction-D26gPkAy.js +0 -63
  45. package/dist/timeline-vY3eD3Ax.js +0 -430
  46. package/dist/utils-BPRImVl5.js +0 -100
@@ -1,224 +0,0 @@
1
- import { t as e } from "./springTimingFunction-D26gPkAy.js";
2
- import { CSSKeyframesAnimation as t } from "./engine-DQcb7CLW.js";
3
- import { CSSCubicBezier as n, steppedEase as r } from "@mkbabb/value.js";
4
- //#region src/animation/animations.ts
5
- var ee = "\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n", i = (e) => new t({
6
- duration: 700,
7
- timingFunction: "ease-in-out",
8
- ...e ?? {}
9
- }).fromString(ee), te = "\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n", a = (e) => new t({
10
- duration: 700,
11
- timingFunction: "ease-in-out",
12
- ...e ?? {}
13
- }).fromString(te), ne = "\n 0%, 100% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.05);\n }\n", o = (e) => new t({
14
- duration: 1e3,
15
- timingFunction: "ease-in-out",
16
- iterationCount: Infinity,
17
- ...e ?? {}
18
- }).fromString(ne), re = "\n8%,\n41% {\n transform: translateX(-10px);\n}\n25%,\n58% {\n transform: translateX(10px);\n}\n75% {\n transform: translateX(-5px);\n}\n92% {\n transform: translateX(5px);\n}\n0%,\n100% {\n transform: translateX(0);\n}\n", s = (e) => new t({
19
- duration: 820,
20
- timingFunction: "ease-in-out",
21
- ...e ?? {}
22
- }).fromString(re), c = "\n 0%, 20%, 50%, 80%, 100% {\n transform: translateY(0);\n }\n 40% {\n transform: translateY(-30px);\n }\n 60% {\n transform: translateY(-15px);\n }\n", l = (e) => new t({
23
- duration: 1e3,
24
- timingFunction: n(.28, .84, .42, 1),
25
- ...e ?? {}
26
- }).fromString(c), ie = "\n 0% {\n transform: perspective(400px) rotateY(0);\n animation-timing-function: ease-out;\n }\n 40% {\n transform: perspective(400px) translateZ(150px) rotateY(170deg);\n animation-timing-function: ease-out;\n }\n 50% {\n transform: perspective(400px) translateZ(150px) rotateY(190deg) scale(1);\n animation-timing-function: ease-in;\n }\n 80% {\n transform: perspective(400px) rotateY(360deg) scale(.95);\n animation-timing-function: ease-in;\n }\n 100% {\n transform: perspective(400px) scale(1);\n animation-timing-function: ease-in;\n }\n", u = (e) => new t({
27
- duration: 1e3,
28
- timingFunction: "ease-in-out",
29
- ...e ?? {}
30
- }).fromString(ie), ae = "\n 0% {\n transform-origin: center;\n transform: rotate3d(0, 0, 1, -200deg);\n opacity: 0;\n }\n 100% {\n transform-origin: center;\n transform: none;\n opacity: 1;\n }\n", d = (e) => new t({
31
- duration: 1e3,
32
- timingFunction: n(.25, .46, .45, .94),
33
- ...e ?? {}
34
- }).fromString(ae), oe = "\n 0% {\n transform: translateY(1000px);\n opacity: 0;\n }\n 100% {\n transform: translateY(0);\n opacity: 1;\n }\n", f = (e) => new t({
35
- duration: 1e3,
36
- timingFunction: n(.25, .46, .45, .94),
37
- ...e ?? {}
38
- }).fromString(oe), p = "\n 0% {\n transform: scale(1);\n }\n 14% {\n transform: scale(1.3);\n }\n 28% {\n transform: scale(1);\n }\n 42% {\n transform: scale(1.3);\n }\n 70% {\n transform: scale(1);\n }\n", m = (e) => new t({
39
- duration: 1500,
40
- timingFunction: "ease-in-out",
41
- iterationCount: Infinity,
42
- ...e ?? {}
43
- }).fromString(p), h = "\n 0%, 100% {\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);\n }\n 50% {\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);\n }\n", g = (e) => new t({
44
- duration: 2e3,
45
- timingFunction: "ease-in-out",
46
- iterationCount: Infinity,
47
- ...e ?? {}
48
- }).fromString(h), se = "\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n", ce = (e) => new t({
49
- duration: 3e3,
50
- timingFunction: r(40, "jump-end"),
51
- fillMode: "forwards",
52
- ...e ?? {}
53
- }).fromString(se), le = "\n 0% {\n color: red;\n }\n 15% {\n color: orange;\n }\n 30% {\n color: yellow;\n }\n 45% {\n color: green;\n }\n 60% {\n color: blue;\n }\n 75% {\n color: indigo;\n }\n 90% {\n color: violet;\n }\n 100% {\n color: red;\n }\n", _ = (e) => new t({
54
- duration: 5e3,
55
- timingFunction: "linear",
56
- iterationCount: Infinity,
57
- ...e ?? {}
58
- }).fromString(le), ue = "@keyframes keyframeDelete {\n 0% {\n transform: translateX(0%) rotate(0deg);\n opacity: 1;\n }\n 25% {\n transform: translateX(0%) rotate(5deg);\n opacity: 1;\n }\n 50% {\n transform: translateX(25%) rotate(10deg);\n opacity: 0.5;\n }\n 75% {\n transform: translateX(0%) rotate(0deg);\n opacity: 0.25;\n }\n 100% {\n transform: translateX(-100%);\n opacity: 0;\n }\n}", v = (e) => new t({
59
- duration: 700,
60
- timingFunction: "bounce-in-ease",
61
- ...e ?? {}
62
- }).fromString(ue), de = "@keyframes keyframeDelete {\n 0% {\n transform: translateX(0%) rotate(0deg);\n opacity: 1;\n }\n 25% {\n transform: translateX(0%) rotate(-5deg);\n opacity: 1;\n }\n 50% {\n transform: translateX(-25%) rotate(-10deg);\n opacity: 0.5;\n }\n 100% {\n transform: translateX(100%);\n opacity: 0;\n }\n}", y = (e) => new t({
63
- duration: 700,
64
- timingFunction: "bounce-in-ease",
65
- ...e ?? {}
66
- }).fromString(de), fe = "\n0% {\n filter: blur(10px);\n opacity: 0;\n}\n100% {\n filter: blur(0px);\n opacity: 1;\n}\n", b = (e) => new t({
67
- duration: 2e3,
68
- timingFunction: "ease-in-out",
69
- ...e ?? {}
70
- }).fromString(fe), pe = "\n0% {\n filter: blur(0px);\n opacity: 1;\n}\n100% {\n filter: blur(10px);\n opacity: 0;\n}\n", x = (e) => new t({
71
- duration: 2e3,
72
- timingFunction: "ease-in-out",
73
- ...e ?? {}
74
- }).fromString(pe), me = "\n0% {\n filter: blur(0px);\n}\n50% {\n filter: blur(10px);\n}\n100% {\n filter: blur(0px);\n}\n", he = (e) => new t({
75
- duration: 2e3,
76
- timingFunction: "ease-in-out",
77
- ...e ?? {}
78
- }).fromString(me), ge = "\n0% {\n width: 0%;\n background-color: #ff9999;\n}\n25% {\n width: 25%;\n background-color: #ffcc99;\n}\n50% {\n width: 50%;\n background-color: #ffff99;\n}\n75% {\n width: 75%;\n background-color: #99ff99;\n}\n100% {\n width: 100%;\n background-color: #99ccff;\n}\n", _e = (e) => new t({
79
- duration: 3e3,
80
- timingFunction: "linear",
81
- fillMode: "forwards",
82
- ...e ?? {}
83
- }).fromString(ge), ve = "\n0% {\n background-position: -200% 0;\n}\n100% {\n background-position: 200% 0;\n}\n", S = (e) => new t({
84
- duration: 1500,
85
- timingFunction: "linear",
86
- iterationCount: Infinity,
87
- ...e ?? {}
88
- }).fromString(ve), ye = "\n0%, 100% {\n filter: blur(0px);\n opacity: 1;\n}\n50% {\n filter: blur(4px);\n opacity: 0.5;\n}\n", be = (e) => new t({
89
- duration: 2e3,
90
- timingFunction: "ease-in-out",
91
- ...e ?? {}
92
- }).fromString(ye), xe = "\n0% {\n background-position: 0% 50%;\n}\n50% {\n background-position: 100% 50%;\n}\n100% {\n background-position: 0% 50%;\n}\n", C = (e) => new t({
93
- duration: 5e3,
94
- timingFunction: "ease-in-out",
95
- iterationCount: Infinity,
96
- ...e ?? {}
97
- }).fromString(xe), w = "\n0% {\n transform: rotate(0deg) scale(1);\n}\n25% {\n transform: rotate(90deg) scale(1.1);\n}\n50% {\n transform: rotate(180deg) scale(1);\n}\n75% {\n transform: rotate(270deg) scale(0.9);\n}\n100% {\n transform: rotate(360deg) scale(1);\n}\n", T = (e) => new t({
98
- duration: 2500,
99
- timingFunction: n(.68, -.55, .265, 1.55),
100
- ...e ?? {}
101
- }).fromString(w), E = "\n0%, 100% {\n border-right-color: transparent;\n}\n50% {\n border-right-color: black;\n}\n", D = (e) => new t({
102
- duration: 800,
103
- timingFunction: r(2, "jump-start"),
104
- iterationCount: Infinity,
105
- ...e ?? {}
106
- }).fromString(E), O = "\n0% {\n max-height: 0;\n opacity: 0;\n}\n100% {\n max-height: 1000px;\n opacity: 1;\n}\n", k = (e) => new t({
107
- duration: 500,
108
- timingFunction: n(.25, .46, .45, .94),
109
- fillMode: "forwards",
110
- ...e ?? {}
111
- }).fromString(O), A = "\n0%, 100% {\n transform: translateY(0);\n}\n25% {\n transform: translateY(-10px);\n}\n50% {\n transform: translateY(0);\n}\n75% {\n transform: translateY(-5px);\n}\n", j = (e) => new t({
112
- duration: 1e3,
113
- timingFunction: n(.28, .84, .42, 1),
114
- ...e ?? {}
115
- }).fromString(A), M = "\n0% {\n transform: rotate(0deg);\n border-radius: 50%;\n}\n25% {\n transform: rotate(90deg);\n border-radius: 40% 60% 60% 40% / 40% 40% 60% 60%;\n}\n50% {\n transform: rotate(180deg);\n border-radius: 50%;\n}\n75% {\n transform: rotate(270deg);\n border-radius: 60% 40% 40% 60% / 60% 60% 40% 40%;\n}\n100% {\n transform: rotate(360deg);\n border-radius: 50%;\n}\n", N = (e) => new t({
116
- duration: 2e3,
117
- timingFunction: "linear",
118
- iterationCount: Infinity,
119
- ...e ?? {}
120
- }).fromString(M), Se = "\n0% {\n background-position: 50% 0%;\n}\n100% {\n background-position: 50% 100%;\n}\n", P = (e) => new t({
121
- duration: 1e4,
122
- timingFunction: "linear",
123
- iterationCount: Infinity,
124
- ...e ?? {}
125
- }).fromString(Se), F = "\n0% {\n transform: translateX(-100%);\n opacity: 0;\n}\n100% {\n transform: translateX(0);\n opacity: 1;\n}\n", I = (e) => new t({
126
- duration: 1e3,
127
- timingFunction: n(.25, .46, .45, .94),
128
- ...e ?? {}
129
- }).fromString(F), Ce = "\n0% {\n transform: translateX(0);\n opacity: 1;\n}\n100% {\n transform: translateX(-100%);\n opacity: 0;\n}\n", L = (e) => new t({
130
- duration: 1e3,
131
- timingFunction: n(.25, .46, .45, .94),
132
- ...e ?? {}
133
- }).fromString(Ce), R = "\n0% {\n transform: translateX(100%);\n opacity: 0;\n}\n100% {\n transform: translateX(0);\n opacity: 1;\n}\n", z = (e) => new t({
134
- duration: 1e3,
135
- timingFunction: n(.25, .46, .45, .94),
136
- ...e ?? {}
137
- }).fromString(R), we = "\n0% {\n transform: translateX(0%);\n opacity: 1;\n\n}\n100% {\n transform: translateX(100%);\n opacity: 0;\n}\n", B = (e) => new t({
138
- duration: 1e3,
139
- timingFunction: n(.25, .46, .45, .94),
140
- ...e ?? {}
141
- }).fromString(we), Te = "\n0% {\n transform: translateY(0px);\n}\n50% {\n transform: translateY(5px);\n}\n100% {\n transform: translateY(0px);\n}\n", V = (e) => new t({
142
- duration: 3e3,
143
- timingFunction: "ease-in-out",
144
- iterationCount: Infinity,
145
- fillMode: "none",
146
- direction: "alternate",
147
- ...e ?? {}
148
- }).fromString(Te), Ee = "@keyframes keyframeShift {\n0% {\n transform: translateY(0%);\n opacity: 1;\n}\n\n50% {\n transform: translateY(-50%);\n opacity: 0.75;\n}\n\n100% {\n transform: translateY(-100%);\n opacity: 1;\n}\n}", H = (e) => new t({
149
- duration: 700,
150
- timingFunction: "bounce-in-ease",
151
- ...e ?? {}
152
- }).fromString(Ee), De = "@keyframes keyframeShift {\n0% {\n transform: translateY(0%);\n opacity: 1;\n}\n\n50% {\n transform: translateY(50%);\n opacity: 0.75;\n}\n\n100% {\n transform: translateY(100%);\n opacity: 1;\n}\n}", U = (e) => new t({
153
- duration: 700,
154
- timingFunction: "bounce-in-ease",
155
- ...e ?? {}
156
- }).fromString(De), Oe = {
157
- response: .35,
158
- dampingFraction: .78
159
- }, W = {
160
- response: .5,
161
- dampingFraction: .5
162
- }, ke = {
163
- response: .7,
164
- dampingFraction: .95
165
- }, Ae = "\n 0% {\n transform: scale(0.6);\n opacity: 0;\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n", G = (n) => new t({
166
- duration: 600,
167
- timingFunction: e(W),
168
- ...n ?? {}
169
- }).fromString(Ae), je = "\n 0% {\n transform: translateY(40px);\n opacity: 0;\n }\n 100% {\n transform: translateY(0);\n opacity: 1;\n }\n", K = (n) => new t({
170
- duration: 600,
171
- timingFunction: e(Oe),
172
- ...n ?? {}
173
- }).fromString(je), Me = "\n 0%, 100% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.15);\n }\n", q = (n) => new t({
174
- duration: 700,
175
- timingFunction: e(W),
176
- ...n ?? {}
177
- }).fromString(Me), J = "\n 0%, 100% {\n transform: rotate(0deg);\n }\n 50% {\n transform: rotate(8deg);\n }\n", Y = (n) => new t({
178
- duration: 800,
179
- timingFunction: e(ke),
180
- ...n ?? {}
181
- }).fromString(J), X = {
182
- fadeIn: i,
183
- slideIn: f,
184
- slideInLeft: I,
185
- slideInRight: z,
186
- rotateIn: d,
187
- blurIn: b,
188
- springScaleIn: G,
189
- springSlideIn: K,
190
- jumpUp: H
191
- }, Z = {
192
- fadeOut: a,
193
- slideOutLeft: L,
194
- slideOutRight: B,
195
- blurOut: x,
196
- warpLeft: v,
197
- warpRight: y,
198
- jumpDown: U
199
- }, Q = {
200
- pulse: o,
201
- shake: s,
202
- bounce: l,
203
- flip: u,
204
- notificationBounce: j,
205
- springPop: q,
206
- springWobble: Y
207
- }, $ = {
208
- heartbeat: m,
209
- glow: g,
210
- spinner: N,
211
- rainbowText: _,
212
- skeletonLoading: S,
213
- gradientBackground: C,
214
- parallaxScroll: P,
215
- hover: V,
216
- typingCursor: D
217
- }, Ne = {
218
- enter: X,
219
- exit: Z,
220
- attention: Q,
221
- loop: $
222
- };
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 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 };
@@ -1,251 +0,0 @@
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 };
@@ -1,25 +0,0 @@
1
- //#region src/animation/decay.ts
2
- var e = 5;
3
- function t(t) {
4
- let n = t.initial ?? 0, r = t.velocity, i = t.friction ?? e;
5
- if (i <= 0) throw Error("decay() requires a friction coefficient > 0.");
6
- let a = n + r / i;
7
- return (e) => {
8
- if (e <= 0) return {
9
- value: n,
10
- velocity: r
11
- };
12
- let t = Math.exp(-i * e);
13
- return {
14
- value: a - r / i * t,
15
- velocity: r * t
16
- };
17
- };
18
- }
19
- function n(t) {
20
- let n = t.friction ?? e;
21
- if (n <= 0) throw Error("decayRest() requires a friction coefficient > 0.");
22
- return (t.initial ?? 0) + t.velocity / n;
23
- }
24
- //#endregion
25
- export { n, t };