@mkbabb/keyframes.js 5.2.0 → 5.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.
@@ -1,287 +0,0 @@
1
- import { n as e } from "./presets-DeDJYL4G.js";
2
- import { c as t, f as n, i as r, r as i, s as a } from "./sequence-s0bL7Uul.js";
3
- import { i as o, r as s, t as c } from "./delegation-BQYCrP2p.js";
4
- import { extractTimelineOptions as l, parseAnimationRange as u, parseAnimationTimeline as d, parseCSSStylesheet as f, serializeTimelineOptions as p } from "@mkbabb/value.js";
5
- //#region src/animation/scroll/range.ts
6
- var m = {
7
- entry: o.entry,
8
- cover: o.cover,
9
- contain: o.contain,
10
- exit: o.exit,
11
- normal: {
12
- start: 0,
13
- end: 1
14
- },
15
- "entry-crossing": {
16
- start: 0,
17
- end: .25
18
- },
19
- "exit-crossing": {
20
- start: .75,
21
- end: 1
22
- }
23
- };
24
- function h(e) {
25
- if (e == null) return null;
26
- let t = e.trim();
27
- if (t.endsWith("%")) {
28
- let e = Number.parseFloat(t.slice(0, -1));
29
- return Number.isFinite(e) ? e / 100 : null;
30
- }
31
- return null;
32
- }
33
- function g(e, t) {
34
- if (e == null) return t;
35
- let n = h(e.offset);
36
- if (n != null) {
37
- if (e.phase != null && e.phase !== "normal") {
38
- let t = m[e.phase];
39
- return t.start + n * (t.end - t.start);
40
- }
41
- return n;
42
- }
43
- return e.phase == null ? t : m[e.phase].start;
44
- }
45
- function _(e) {
46
- if (e == null) return {
47
- start: 0,
48
- end: 1
49
- };
50
- let t = g(e.start, 0), n = g(e.end, 1);
51
- return n > t ? {
52
- start: t,
53
- end: n
54
- } : {
55
- start: 0,
56
- end: 1
57
- };
58
- }
59
- //#endregion
60
- //#region src/animation/scroll/scene.ts
61
- var v = class {
62
- resolvedRange;
63
- snapPoints;
64
- snapSpring;
65
- scrubSeconds;
66
- smoother;
67
- rawScroll = 0;
68
- localProgress = 0;
69
- wasInside = !1;
70
- subscribers = new Map([["enter", /* @__PURE__ */ new Set()], ["leave", /* @__PURE__ */ new Set()]]);
71
- constructor(e = {}) {
72
- if (this.resolvedRange = _(e.range), this.scrubSeconds = e.scrub ?? 0, this.snapPoints = e.snap != null && e.snap.length > 0 ? e.snap : void 0, this.scrubSeconds > 0) {
73
- let r = n(1 / (this.scrubSeconds * 60 + 1), .01, 1);
74
- this.smoother = new t({
75
- damping: r,
76
- clamp: !0,
77
- ...e.smoothing
78
- });
79
- }
80
- this.snapPoints != null && (this.snapSpring = new a({ ...e.snapSpring }));
81
- }
82
- get range() {
83
- return this.resolvedRange;
84
- }
85
- scrollProgress(e) {
86
- this.rawScroll = n(e, 0, 1);
87
- let { start: t, end: r } = this.resolvedRange, i = r - t, a = i > 0 ? n((this.rawScroll - t) / i, 0, 1) : 0, o = this.rawScroll >= t && this.rawScroll <= r;
88
- return o && !this.wasInside && this.fire("enter", a), !o && this.wasInside && this.fire("leave", a), this.wasInside = o, this.smoother ? (this.smoother.setTarget(a), this.localProgress = this.smoother.current) : this.localProgress = a, this.localProgress;
89
- }
90
- tick(e) {
91
- return this.smoother && (this.smoother.tickDt(e), this.localProgress = this.smoother.current), this.localProgress;
92
- }
93
- get progress() {
94
- return this.localProgress;
95
- }
96
- get settled() {
97
- return this.smoother == null || this.smoother.settled;
98
- }
99
- snapTo(e = 0) {
100
- if (this.snapPoints == null || this.snapSpring == null) return null;
101
- let t = n(i({
102
- initial: this.localProgress,
103
- velocity: e
104
- }), 0, 1), r = this.snapPoints[0], a = Math.abs(t - r);
105
- for (let e of this.snapPoints) {
106
- let n = Math.abs(t - e);
107
- n < a && (a = n, r = e);
108
- }
109
- return this.snapSpring.reset(this.localProgress, e), this.snapSpring.target = r, r;
110
- }
111
- tickSnap(e) {
112
- return this.snapSpring && !this.snapSpring.settled && (this.snapSpring.tickDt(e), this.localProgress = this.snapSpring.value), this.localProgress;
113
- }
114
- on(e, t) {
115
- let n = this.subscribers.get(e);
116
- return n.add(t), () => n.delete(t);
117
- }
118
- fire(e, t) {
119
- for (let n of this.subscribers.get(e)) n(t);
120
- }
121
- };
122
- function y(e = {}) {
123
- return new v(e);
124
- }
125
- //#endregion
126
- //#region src/animation/scroll/dispatch.ts
127
- function b(e) {
128
- let { animation: t, nativeSpec: n, scrub: i, snap: a, velocity: o } = e;
129
- if (i) return {
130
- backend: "js",
131
- reason: "scrub smoothing requested (native scroll has no SmoothProgress smoother)"
132
- };
133
- if (a) return {
134
- backend: "js",
135
- reason: "physics snap requested (native scroll has no decay/spring settle)"
136
- };
137
- if (o) return {
138
- backend: "js",
139
- reason: "scroll velocity / non-DOM driving requested (JS-only capability)"
140
- };
141
- if (t == null || n == null) return {
142
- backend: "js",
143
- reason: "non-DOM target or no native timeline spec (the universal JS driver)"
144
- };
145
- let l = s(t);
146
- if (!l.eligible) return {
147
- backend: "js",
148
- reason: l.reason
149
- };
150
- if (r(n) == null) return {
151
- backend: "js",
152
- reason: "native scroll/view timeline unavailable (feature absent)"
153
- };
154
- let u = c(t, n);
155
- return u.attached ? {
156
- backend: "native",
157
- attachment: u
158
- } : {
159
- backend: "js",
160
- reason: u.reason
161
- };
162
- }
163
- function x(e) {
164
- let t = ["position: sticky;"];
165
- return e?.bottom == null ? t.push(`top: ${e?.top ?? 0}px;`) : t.push(`bottom: ${e.bottom}px;`), t.join(" ");
166
- }
167
- //#endregion
168
- //#region src/animation/scroll/trigger.ts
169
- function S() {
170
- let e = globalThis.CSS;
171
- if (e == null || typeof e.supports != "function") return !1;
172
- try {
173
- return e.supports("animation-trigger-behavior", "once") || e.supports("animation-trigger", "once");
174
- } catch {
175
- return !1;
176
- }
177
- }
178
- var C = class {
179
- type;
180
- triggerRange;
181
- _state = "idle";
182
- _direction = "forward";
183
- _playhead = 0;
184
- _cycles = 0;
185
- wasInside = !1;
186
- everEntered = !1;
187
- constructor(e = {}) {
188
- this.type = e.type ?? "once", this.triggerRange = _(e.range);
189
- }
190
- get state() {
191
- return this._state;
192
- }
193
- get direction() {
194
- return this._direction;
195
- }
196
- get playhead() {
197
- return this._playhead;
198
- }
199
- get cycles() {
200
- return this._cycles;
201
- }
202
- get range() {
203
- return this.triggerRange;
204
- }
205
- get usesNative() {
206
- return S();
207
- }
208
- triggerProgress(e) {
209
- let t = n(e, 0, 1), { start: r, end: i } = this.triggerRange, a = i - r, o = a > 0 ? n((t - r) / a, 0, 1) : 0, s = t >= r && t <= i, c = s && !this.wasInside, l = !s && this.wasInside, u = l && t > i;
210
- switch (this.type) {
211
- case "repeat":
212
- this.stepRepeat(s, c, l, o);
213
- break;
214
- case "alternate":
215
- this.stepAlternate(s, c, l, o);
216
- break;
217
- case "state":
218
- this.stepState(s, o);
219
- break;
220
- default:
221
- this.stepOnce(c, u, o);
222
- break;
223
- }
224
- return this.wasInside = s, this._state;
225
- }
226
- reset() {
227
- this._state = "idle", this._direction = "forward", this._playhead = 0, this._cycles = 0, this.wasInside = !1, this.everEntered = !1;
228
- }
229
- stepOnce(e, t, n) {
230
- this._state !== "done" && (e && this._state === "idle" && (this._state = "active", this._direction = "forward", this._cycles = 1), this._state === "active" && (this._playhead = n, t && (this._state = "done", this._playhead = 1)));
231
- }
232
- stepRepeat(e, t, n, r) {
233
- t ? (this._state = "active", this._direction = "forward", this._cycles += 1, this._playhead = r) : n ? (this._state = "idle", this._playhead = 0) : e && (this._playhead = r);
234
- }
235
- stepAlternate(e, t, n, r) {
236
- t ? (this._direction = this._cycles % 2 == 0 ? "forward" : "backward", this._state = "active", this._cycles += 1, this._playhead = this.directedPlayhead(r)) : n ? this._state = "done" : e && (this._playhead = this.directedPlayhead(r));
237
- }
238
- stepState(e, t) {
239
- e ? (this._state = "active", this._direction = "forward", this._playhead = t, this.everEntered = !0) : this._state = this.everEntered ? "done" : "idle";
240
- }
241
- directedPlayhead(e) {
242
- return this._direction === "forward" ? e : 1 - e;
243
- }
244
- };
245
- function w(e = {}) {
246
- return new C("trigger" in e && e.trigger != null ? e.trigger : e);
247
- }
248
- //#endregion
249
- //#region src/animation/scroll/grammar.ts
250
- function T(e) {
251
- return d(e);
252
- }
253
- function E(e) {
254
- return u(e);
255
- }
256
- function D(e) {
257
- return l(typeof e == "string" ? f(e) : e);
258
- }
259
- function O(e) {
260
- return p(e);
261
- }
262
- function k(e) {
263
- let t = D(e);
264
- return {
265
- options: t,
266
- declarations: O(t)
267
- };
268
- }
269
- //#endregion
270
- //#region src/animation/scroll/index.ts
271
- var A = /* @__PURE__ */ e({
272
- ScrollScene: () => v,
273
- TriggerScene: () => C,
274
- createScrollScene: () => y,
275
- createTriggerScene: () => w,
276
- dispatchScrollBackend: () => b,
277
- parseScrollCSS: () => D,
278
- parseScrollRange: () => E,
279
- parseScrollTimeline: () => T,
280
- pinCSS: () => x,
281
- resolveRange: () => _,
282
- roundTripScrollCSS: () => k,
283
- serializeScrollOptions: () => O,
284
- supportsNativeTrigger: () => S
285
- });
286
- //#endregion
287
- export { k as a, w as c, x as d, v as f, T as i, S as l, _ as m, D as n, O as o, y as p, E as r, C as s, A as t, b as u };
@@ -1,39 +0,0 @@
1
- import { n as e } from "./presets-DeDJYL4G.js";
2
- import { t } from "./engine-CPK_udUQ.js";
3
- import { r as n } from "./delegation-BQYCrP2p.js";
4
- import { a as r } from "./view-transition-BPJQxUTC.js";
5
- import { extractKeyframes as i, parseCSSStylesheet as a } from "@mkbabb/value.js";
6
- //#region src/animation/validate.ts
7
- var o = /* @__PURE__ */ e({
8
- explain: () => u,
9
- validate: () => c
10
- }), s = (e) => new t().fromString(e);
11
- async function c(e, t = {}) {
12
- let i = s(e), a = [...i.diagnostics], o = a.some((e) => e.code === "PARSE_ERROR" || e.code === "EMPTY_PARSE"), c = e.trim().length > 0 && !o, l = await r([i], t.compile ?? {}), u = n(i);
13
- return {
14
- parseable: c,
15
- eligible: l.eligible,
16
- refusals: l.refusals,
17
- diagnostics: a,
18
- waapi: u
19
- };
20
- }
21
- var l = (e) => {
22
- try {
23
- return [...i(a(e)).keys()];
24
- } catch {
25
- return [];
26
- }
27
- };
28
- async function u(e, t = {}) {
29
- let n = await c(e, t), r = l(e), i = r.length > 0 ? r.join(", ") : "(no @keyframes block)", a = [];
30
- a.push(`@keyframes ${i}:`), a.push(` parseable: ${n.parseable ? "yes" : "no"}`), a.push(` compile-eligible: ${n.eligible ? "yes" : "no"}`);
31
- for (let e of n.refusals) a.push(` – ${e.reason}: ${e.message}`);
32
- if (a.push(` waapi-eligible: ${n.waapi.eligible ? "yes" : "no"}`), n.waapi.eligible || a.push(` – ${n.waapi.reason}`), n.diagnostics.length > 0) {
33
- a.push(" diagnostics:");
34
- for (let e of n.diagnostics) a.push(` – ${e.code}: ${e.message}`);
35
- }
36
- return a.join("\n");
37
- }
38
- //#endregion
39
- export { c as n, o as r, u as t };
@@ -1,305 +0,0 @@
1
- import { n as e } from "./presets-DeDJYL4G.js";
2
- import { t } from "./sequence-s0bL7Uul.js";
3
- import { i as n } from "./engine-CPK_udUQ.js";
4
- import { n as r } from "./group-HM7N4uOE.js";
5
- import { o as i } from "./scroll-BEyCx0b_.js";
6
- import { t as a } from "./easing-serialize-D4LZCB6i.js";
7
- import { c as o, l as s, o as c, r as l, s as u } from "./format-BdIvdLzG.js";
8
- import { i as d, n as f } from "./backward-color-BtbRcnna.js";
9
- import { camelCaseToHyphen as p, formatCSS as m, reverseCSSTime as h, unflattenObjectToString as g } from "@mkbabb/value.js";
10
- //#region src/animation/compile/backward/backward-walk.ts
11
- function _(e) {
12
- let t = [];
13
- for (let r of Object.keys(e.animations)) {
14
- 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";
15
- t.push({
16
- animation: i.animation,
17
- name: b(n(i.animation)),
18
- composition: c,
19
- weighted: o,
20
- ...s ? { staticWeight: i.layer.weight } : {},
21
- delay: 0
22
- });
23
- }
24
- return t;
25
- }
26
- function v(e) {
27
- return e.entries.map((e) => ({
28
- animation: e.animation,
29
- name: b(n(e.animation)),
30
- composition: "replace",
31
- weighted: !1,
32
- delay: e.at
33
- }));
34
- }
35
- function y(e) {
36
- return e.map((e, t) => {
37
- let r = "animation" in e ? e.animation : e;
38
- return {
39
- animation: r,
40
- name: b(n(r) || `anim-${t}`),
41
- composition: "replace",
42
- weighted: !1,
43
- delay: 0
44
- };
45
- });
46
- }
47
- function b(e) {
48
- let t = e.replace(/[^a-zA-Z0-9_-]/g, "-");
49
- return /^[a-zA-Z_]/.test(t) ? t : `a${t}`;
50
- }
51
- //#endregion
52
- //#region src/animation/compile/backward/densify.ts
53
- var x = (e) => {
54
- let t = /([\d.]+)\s*%/.exec(String(e));
55
- return t ? parseFloat(t[1]) : 0;
56
- };
57
- function S(e, t, n, r) {
58
- let i = e.parsedVars[t] ?? {}, o = Object.fromEntries(Object.entries(i).filter(([e]) => !r.has(e))), s = Object.entries(g(o)).map(([e, t]) => `${p(e)}: ${t};`), c = e.templateFrames[t], l = c.timingFunction ? a(c.timingFunction) : n;
59
- l !== n && s.push(`animation-timing-function: ${l};`);
60
- let u = c.composition;
61
- return u != null && u !== "replace" && s.push(`animation-composition: ${u};`), s;
62
- }
63
- function C(e, t, n) {
64
- let r = a(e.options.timingFunction), i = new Set(n.keys), o = /* @__PURE__ */ new Map(), s = [], c = (e) => {
65
- let t = o.get(e);
66
- return t || (t = [], o.set(e, t), s.push(e)), t;
67
- };
68
- for (let [e, t] of n.byPct) c(e).push(...t);
69
- e.templateFrames.forEach((t, n) => {
70
- let a = S(e, n, r, i);
71
- a.length > 0 && c(x(t.start)).push(...a);
72
- }), s.sort((e, t) => e - t);
73
- let l = "";
74
- for (let e of s) l += `${e}% {\n ${o.get(e).join("\n ")}\n}\n`;
75
- return `@keyframes ${t} {\n${l}}`;
76
- }
77
- //#endregion
78
- //#region src/animation/compile/backward/backward.ts
79
- var w = .04, T = 16;
80
- function E(e) {
81
- for (let t = 0; t < e.templateFrames.length; t++) {
82
- let n = e.parsedVars[t] ?? {};
83
- for (let [e, t] of Object.entries(n)) if (!Array.isArray(t) || t.length === 0) return e;
84
- }
85
- }
86
- function D(e, t, n) {
87
- let { animation: r, name: i } = e;
88
- if (e.weighted) return n.push({
89
- name: i,
90
- reason: "weighted-blend",
91
- 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"
92
- }), null;
93
- for (let e of r.frames) if (!r.usesDefaultRenderer(e.transform)) return n.push({
94
- name: i,
95
- reason: "custom-renderer",
96
- 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"
97
- }), null;
98
- let a = E(r);
99
- if (a) return n.push({
100
- name: i,
101
- reason: "computed-unit-drift",
102
- message: `computed-unit drift on "${a}" — the declared value cannot be re-emitted as a faithful authored string; the JS playback is the only faithful path`
103
- }), null;
104
- let l = f(r, t.densifyStops ?? 16, t.deltaEEpsilon ?? .04);
105
- if (l && "refused" in l) return n.push({
106
- name: i,
107
- reason: "perceptual-oklab",
108
- message: `perceptual oklab color track exceeds the densify ΔE-ε threshold (ΔE ${d(l.delta)} > ${t.deltaEEpsilon ?? .04}) — a faithful pure-CSS twin is not available; the JS playback is the only faithful path`
109
- }), null;
110
- let p;
111
- if (e.staticWeight != null) {
112
- let t = u(r, i, e.staticWeight);
113
- if ("refused" in t) return n.push({
114
- name: i,
115
- reason: "weighted-blend",
116
- 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`
117
- }), null;
118
- p = t.block;
119
- }
120
- let m = p ?? (l && "byPct" in l ? C(r, i, l) : c(r, i)), g;
121
- try {
122
- g = s(r.options, i);
123
- } catch {
124
- return n.push({
125
- name: i,
126
- reason: "custom-renderer",
127
- 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"
128
- }), null;
129
- }
130
- let _ = o(e.composition), v = _ ? `\n ${_}` : "", y = e.delay > 0 ? `\n animation-delay: ${h(e.delay)};` : "", b = O(r);
131
- return `${m}\n\n${`${t.selectorFor ? t.selectorFor(i) : `.${i}`} {\n animation: ${g};${v}${y}${b}\n}`}`;
132
- }
133
- function O(e) {
134
- let t = e.scrollOptions;
135
- if (t == null) return "";
136
- let n = i(t), r = "";
137
- for (let [e, t] of Object.entries(n)) t != null && (r += `\n ${e}: ${t};`);
138
- return r;
139
- }
140
- async function k(e, n = {}) {
141
- let i = e instanceof r ? _(e) : e instanceof t ? v(e) : y(e), a = /* @__PURE__ */ new Map();
142
- for (let e of i) {
143
- let t = a.get(e.name) ?? 0;
144
- a.set(e.name, t + 1), t > 0 && (e.name = `${e.name}-${t + 1}`);
145
- }
146
- n.staggerDelays && i.forEach((e, t) => {
147
- let r = n.staggerDelays[t];
148
- typeof r == "number" && r > 0 && (e.delay += r);
149
- });
150
- let o = [], s = [];
151
- for (let e of i) {
152
- let t = D(e, n, o);
153
- t && s.push(t);
154
- }
155
- let c = o.length === 0;
156
- if (s.length === 0) return {
157
- css: "",
158
- eligible: c,
159
- refusals: o
160
- };
161
- let l = s.join("\n\n"), u;
162
- try {
163
- u = await m(l, n.printWidth);
164
- } catch {
165
- u = l;
166
- }
167
- return {
168
- css: u,
169
- eligible: c,
170
- refusals: o
171
- };
172
- }
173
- //#endregion
174
- //#region src/animation/compile/view-transition.ts
175
- var A = /* @__PURE__ */ e({ compileToViewTransition: () => L }), j = new Set([
176
- "transform",
177
- "opacity",
178
- "filter",
179
- "backdrop-filter",
180
- "mix-blend-mode",
181
- "clip-path"
182
- ]), M = /\b-?\d*\.?\d+cq(w|h|i|b|min|max)\b/i;
183
- function N(e) {
184
- let t = a(e.options.timingFunction), n = [];
185
- for (let r = 0; r < e.templateFrames.length; r++) {
186
- let i = l(e, r, t);
187
- for (let e of i.matchAll(/([\w-]+)\s*:\s*([^;]+);/g)) n.push({
188
- prop: e[1].trim(),
189
- value: e[2].trim()
190
- });
191
- }
192
- return n;
193
- }
194
- var P = (e) => e.split(".")[0].replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
195
- function F(e, t, n, r, i, a) {
196
- let o = [], s = `${t}-${e}`;
197
- if (r.scrollOptions != null) return o.push({
198
- name: s,
199
- reason: "vt-scroll-grammar",
200
- message: `scroll grammar on the ${e} role has no defined behavior on a time-driven ::view-transition pseudo (animation-timeline is undefined there) — the JS ScrollScene driver is the only faithful path`
201
- }), {
202
- chunk: null,
203
- refusals: o
204
- };
205
- for (let { prop: t, value: n } of N(r)) {
206
- if (M.test(n) || /\bvar\(/.test(n)) return o.push({
207
- name: s,
208
- reason: "vt-element-scoped-computed",
209
- message: `"${t}" is element-scoped (${M.test(n) ? "a container-query unit" : "a var()"}) — the ::view-transition pseudo tree hangs off the ROOT, so an element-scoped custom property / container context does not reach it`
210
- }), {
211
- chunk: null,
212
- refusals: o
213
- };
214
- if (!j.has(P(t))) return o.push({
215
- name: s,
216
- reason: "vt-snapshot-inapplicable",
217
- message: `"${t}" does not apply to a replaced-content ::view-transition-${e} snapshot (only transform/opacity/filter/mix-blend-mode animate there) — refused per property, never silently dropped`
218
- }), {
219
- chunk: null,
220
- refusals: o
221
- };
222
- }
223
- let c = `${i}::view-transition-${e}(${n})`, l = {
224
- animation: r,
225
- name: s,
226
- composition: "replace",
227
- weighted: !1,
228
- delay: 0
229
- }, u = [], d = D(l, {
230
- ...a.densifyStops == null ? {} : { densifyStops: a.densifyStops },
231
- ...a.deltaEEpsilon == null ? {} : { deltaEEpsilon: a.deltaEEpsilon },
232
- selectorFor: () => c
233
- }, u);
234
- for (let e of u) o.push(e);
235
- return {
236
- chunk: d,
237
- refusals: o
238
- };
239
- }
240
- function I(e) {
241
- let t = e.group;
242
- if (t != null) return "options" in t && "templateFrames" in t ? {
243
- duration: t.options.duration,
244
- easing: a(t.options.timingFunction)
245
- } : {
246
- duration: t.duration,
247
- easing: a(t.timingFunction)
248
- };
249
- let n = e.new ?? e.old;
250
- return n == null ? null : {
251
- duration: n.options.duration,
252
- easing: a(n.options.timingFunction)
253
- };
254
- }
255
- async function L(e, t = {}) {
256
- let n = [], r = [], i = [], a = t.types, o = a && a.length > 0 ? `:root:active-view-transition-type(${a.join(", ")})` : "", s = t.emitGroup ?? !0, c = /* @__PURE__ */ new Map();
257
- for (let t of Object.keys(e)) {
258
- let e = b(t), n = c.get(e);
259
- n ? n.push(t) : c.set(e, [t]);
260
- }
261
- let l = /* @__PURE__ */ new Set();
262
- for (let [e, t] of c) if (t.length > 1) for (let r of t) l.add(r), n.push({
263
- name: r,
264
- reason: "vt-name-collision",
265
- message: `"${r}" collapses to the CSS ident "${e}" already used by ${t.filter((e) => e !== r).map((e) => `"${e}"`).join(", ")} — the ≤1-element-per-view-transition-name platform rule is violated; a REFUSAL, not a silent rename (rename the colliding key)`
266
- });
267
- for (let [a, c] of Object.entries(e)) {
268
- if (l.has(a)) continue;
269
- let e = b(a), u = c.class ? `.${b(c.class)}` : e;
270
- i.push(e);
271
- for (let i of ["old", "new"]) {
272
- let a = c[i];
273
- if (a == null) continue;
274
- let { chunk: s, refusals: l } = F(i, e, u, a, o, t);
275
- for (let e of l) n.push(e);
276
- s && r.push(s);
277
- }
278
- if (s && (c.old != null || c.new != null || c.group != null)) {
279
- let e = I(c);
280
- e != null && r.push(`${o}::view-transition-group(${u}) {\n animation-duration: ${h(e.duration)};\n animation-timing-function: ${e.easing};\n}`);
281
- }
282
- }
283
- t.crossDocument && r.unshift("@view-transition {\n navigation: auto;\n}"), (t.reducedMotion ?? !0) && r.push("@media (prefers-reduced-motion: reduce) {\n ::view-transition-group(*),\n ::view-transition-old(*),\n ::view-transition-new(*) {\n animation: none !important;\n }\n}");
284
- let u = n.length === 0;
285
- if (r.length === 0) return {
286
- css: "",
287
- eligible: u,
288
- refusals: n,
289
- names: i
290
- };
291
- let d = r.join("\n\n"), f;
292
- try {
293
- f = await m(d, t.printWidth);
294
- } catch {
295
- f = d;
296
- }
297
- return {
298
- css: f,
299
- eligible: u,
300
- refusals: n,
301
- names: i
302
- };
303
- }
304
- //#endregion
305
- export { k as a, T as i, A as n, w as r, L as t };