@tenphi/tasty 0.0.0-snapshot.d656d18 → 0.0.0-snapshot.d6d38ac
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/dist/{babel-_RVkw0iE.d.ts → babel-Zs1Q03qt.d.ts} +2 -2
- package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
- package/dist/chunks/{async-storage-DKK-wTD4.js.map → async-storage-CG5HnUT5.js.map} +1 -1
- package/dist/chunks/build-config-CUQVwdWF.js +42 -0
- package/dist/chunks/build-config-CUQVwdWF.js.map +1 -0
- package/dist/chunks/{collector-DBGcmUEq.js → collector-B0LTHw6Z.js} +6 -124
- package/dist/chunks/collector-B0LTHw6Z.js.map +1 -0
- package/dist/chunks/config-engine-C3pF9EK9.js +267 -0
- package/dist/chunks/config-engine-C3pF9EK9.js.map +1 -0
- package/dist/chunks/css-definitions-D_it4XZH.js +875 -0
- package/dist/chunks/css-definitions-D_it4XZH.js.map +1 -0
- package/dist/chunks/{css-resources-Cyl_axbI.js → css-resources-BN8apgxt.js} +1 -8
- package/dist/chunks/{css-resources-Cyl_axbI.js.map → css-resources-BN8apgxt.js.map} +1 -1
- package/dist/chunks/{debug-BUwqo6vC.js → debug-C9LeNVoJ.js} +69 -150
- package/dist/chunks/debug-C9LeNVoJ.js.map +1 -0
- package/dist/chunks/{dsl-CXvoaLnj.js → dsl-C5yuAn41.js} +62 -786
- package/dist/chunks/dsl-C5yuAn41.js.map +1 -0
- package/dist/chunks/hydration-TRcz5vnk.js +41 -0
- package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
- package/dist/chunks/react-runtime-O-OUrKLH.js +557 -0
- package/dist/chunks/react-runtime-O-OUrKLH.js.map +1 -0
- package/dist/chunks/runtime-engine-DvnE2g-E.js +2437 -0
- package/dist/chunks/runtime-engine-DvnE2g-E.js.map +1 -0
- package/dist/chunks/runtime-state-BTDqSYBk.js +127 -0
- package/dist/chunks/runtime-state-BTDqSYBk.js.map +1 -0
- package/dist/chunks/{shared-utils-OIg0N_dp.js → shared-utils-DWA4LjIa.js} +24 -62
- package/dist/chunks/shared-utils-DWA4LjIa.js.map +1 -0
- package/dist/chunks/{style-engine-CqSmIlud.js → style-engine-C1ECBZxR.js} +671 -2736
- package/dist/chunks/style-engine-C1ECBZxR.js.map +1 -0
- package/dist/chunks/{css-writer-PFzrSPeu.js → zero-engine-B6EnYcXY.js} +3 -120
- package/dist/chunks/zero-engine-B6EnYcXY.js.map +1 -0
- package/dist/{collector-CVdVIy7s.d.ts → collector-hl5KNH7k.d.ts} +6 -4
- package/dist/{config-BI0y21JV.d.ts → config-DWL1ZYue.d.ts} +15 -24
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +9 -7
- package/dist/{index-CrT0bsiI.d.ts → index-D9N9GV24.d.ts} +17 -50
- package/dist/index.d.ts +5 -5
- package/dist/index.js +10 -7
- package/dist/{merge-styles-BFktNP8J.d.ts → merge-styles-C_oMoJVd.d.ts} +2 -2
- package/dist/ssr/astro-client.js +1 -14
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-static.js +0 -11
- package/dist/ssr/astro-middleware-static.js.map +1 -1
- package/dist/ssr/astro-middleware.js +0 -12
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.js +5 -85
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/index.d.ts +6 -6
- package/dist/ssr/index.js +4 -4
- package/dist/ssr/next-config.d.ts +1 -1
- package/dist/ssr/next-config.js +29 -20
- package/dist/ssr/next-config.js.map +1 -1
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +5 -36
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +1 -19
- package/dist/static/index.js.map +1 -1
- package/dist/{index-BzAC3p06.d.ts → types-jKZNpias.d.ts} +807 -807
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +25 -95
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +1 -1
- package/dist/zero/index.js +1 -1
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +0 -31
- package/dist/zero/next.js.map +1 -1
- package/docs/pipeline.md +3 -0
- package/docs/runtime-benchmarks.md +91 -62
- package/package.json +28 -10
- package/dist/chunks/async-storage-DKK-wTD4.js +0 -44
- package/dist/chunks/collector-DBGcmUEq.js.map +0 -1
- package/dist/chunks/css-writer-PFzrSPeu.js.map +0 -1
- package/dist/chunks/debug-BUwqo6vC.js.map +0 -1
- package/dist/chunks/dsl-CXvoaLnj.js.map +0 -1
- package/dist/chunks/hydrate-6YoHZP6A.js +0 -37
- package/dist/chunks/hydrate-6YoHZP6A.js.map +0 -1
- package/dist/chunks/react-runtime-B3CmvDEQ.js +0 -1525
- package/dist/chunks/react-runtime-B3CmvDEQ.js.map +0 -1
- package/dist/chunks/runtime-engine-Y00VWjrS.js +0 -4719
- package/dist/chunks/runtime-engine-Y00VWjrS.js.map +0 -1
- package/dist/chunks/shared-utils-OIg0N_dp.js.map +0 -1
- package/dist/chunks/style-engine-CqSmIlud.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { k as tastyClassRegex } from "./css-definitions-D_it4XZH.js";
|
|
2
|
+
import { j as CHUNK_NAMES } from "./style-engine-C1ECBZxR.js";
|
|
3
|
+
import { B as getNamePrefix, D as injector, Y as flushStyles, x as getCSSTextForNode } from "./runtime-engine-DvnE2g-E.js";
|
|
3
4
|
//#region src/debug.ts
|
|
4
5
|
function fmtSize(bytes) {
|
|
5
6
|
return bytes > 1024 ? `${(bytes / 1024).toFixed(1)}KB` : `${bytes}B`;
|
|
@@ -10,34 +11,15 @@ function countRules(css) {
|
|
|
10
11
|
function sortTastyClasses(classes) {
|
|
11
12
|
return Array.from(classes).sort((a, b) => a.localeCompare(b));
|
|
12
13
|
}
|
|
13
|
-
/**
|
|
14
|
-
* The root these helpers read, or `null` where there is no DOM.
|
|
15
|
-
*
|
|
16
|
-
* `document` used to be a default parameter value, and a default is evaluated
|
|
17
|
-
* at the call site — so every read below threw a bare `ReferenceError` under
|
|
18
|
-
* Node, taking out five of the eight public methods. A debug utility must not
|
|
19
|
-
* be able to fail an SSR render because a call was left in, so the DOM-less
|
|
20
|
-
* case reports an empty result and says why.
|
|
21
|
-
*/
|
|
22
14
|
function defaultRoot() {
|
|
23
15
|
return typeof document === "undefined" ? null : document;
|
|
24
16
|
}
|
|
25
17
|
let warnedNoDom = false;
|
|
26
|
-
/** Say once why the numbers are empty. Silent under `{ raw: true }`. */
|
|
27
18
|
function warnNoDom(raw) {
|
|
28
19
|
if (raw || warnedNoDom) return;
|
|
29
20
|
warnedNoDom = true;
|
|
30
21
|
console.warn("[Tasty] tastyDebug reads the DOM and this environment has none, so the result is empty. During SSR, read the ServerStyleCollector instead.");
|
|
31
22
|
}
|
|
32
|
-
/**
|
|
33
|
-
* The registry for `root`, with every queued write landed first.
|
|
34
|
-
*
|
|
35
|
-
* Every injector read API is a flush point, and the reads below reach past
|
|
36
|
-
* those APIs straight into the registry and the sheet manager. Without this
|
|
37
|
-
* they would report a batch window's contents as absent — a rule that is
|
|
38
|
-
* enqueued but not yet in a sheet is missing from `globalRules`, from the
|
|
39
|
-
* sheets, and from anything counting either.
|
|
40
|
-
*/
|
|
41
23
|
function getRegistry(root = defaultRoot()) {
|
|
42
24
|
if (!root) return void 0;
|
|
43
25
|
flushStyles();
|
|
@@ -48,29 +30,19 @@ function findDomTastyClasses(root = defaultRoot()) {
|
|
|
48
30
|
const classes = /* @__PURE__ */ new Set();
|
|
49
31
|
const elements = root.querySelectorAll?.("[class]") || [];
|
|
50
32
|
const classRegex = tastyClassRegex(getNamePrefix());
|
|
51
|
-
elements
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
33
|
+
for (const element of elements) {
|
|
34
|
+
const attribute = element.getAttribute("class");
|
|
35
|
+
if (!attribute) continue;
|
|
36
|
+
for (const className of attribute.split(/\s+/)) if (classRegex.test(className)) classes.add(className);
|
|
37
|
+
}
|
|
57
38
|
return sortTastyClasses(classes);
|
|
58
39
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Everything this injector holds in `root`, in the order the engine applies it,
|
|
61
|
-
* with the sources kept byte-for-byte — trimming would report a total smaller
|
|
62
|
-
* than one of its own parts whenever raw CSS has edge whitespace.
|
|
63
|
-
*/
|
|
64
40
|
function getAllCSS(root = defaultRoot()) {
|
|
65
41
|
const registry = getRegistry(root);
|
|
66
42
|
const sheetManager = injector.instance._sheetManager;
|
|
67
43
|
if (!root || !registry || !sheetManager) return "";
|
|
68
44
|
return sheetManager.getOwnedCSSInOrder(registry, root).join("\n");
|
|
69
45
|
}
|
|
70
|
-
/**
|
|
71
|
-
* The injector's own readers fall back to `document` when `root` is omitted, so
|
|
72
|
-
* they have to be reached with a real root or not at all.
|
|
73
|
-
*/
|
|
74
46
|
function cssTextForClasses(classNames, root) {
|
|
75
47
|
if (!root) return "";
|
|
76
48
|
return injector.instance.getCSSTextForClasses(classNames, { root });
|
|
@@ -79,19 +51,10 @@ function getInjectorMetrics(root) {
|
|
|
79
51
|
if (!root) return null;
|
|
80
52
|
return injector.instance.getMetrics({ root });
|
|
81
53
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Injected classes that no element carries and nobody pinned — the exact set
|
|
84
|
-
* `gc({ force: true })` would delete.
|
|
85
|
-
*
|
|
86
|
-
* Deliberately borrowed from the injector rather than recomputed here: the two
|
|
87
|
-
* drifted apart once before, when this file still read "unused" off the pin
|
|
88
|
-
* counts the render path had stopped maintaining.
|
|
89
|
-
*/
|
|
90
54
|
function getUnusedClasses(root = defaultRoot()) {
|
|
91
55
|
if (!root) return [];
|
|
92
56
|
return sortTastyClasses(injector.instance.getUnusedClasses({ root }));
|
|
93
57
|
}
|
|
94
|
-
/** Every class this injector holds CSS for in `root`. */
|
|
95
58
|
function getOwnedClasses(root = defaultRoot()) {
|
|
96
59
|
const registry = getRegistry(root);
|
|
97
60
|
if (!registry) return [];
|
|
@@ -103,54 +66,19 @@ function prettifyCSS(css) {
|
|
|
103
66
|
if (!css || !css.trim()) return "";
|
|
104
67
|
const out = [];
|
|
105
68
|
let depth = 0;
|
|
106
|
-
const
|
|
107
|
-
let
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const header = buf.trim();
|
|
115
|
-
if (header) {
|
|
116
|
-
const parts = splitOutsideParens(header, ",");
|
|
117
|
-
if (parts.length > 1) out.push(parts.map((p, idx) => idx === 0 ? `${indent()}${p.trim()},` : `${indent()}${p.trim()}${idx < parts.length - 1 ? "," : ""}`).join("\n") + " {");
|
|
118
|
-
else out.push(`${indent()}${header} {`);
|
|
119
|
-
} else out.push(`${indent()}{`);
|
|
120
|
-
depth++;
|
|
121
|
-
buf = "";
|
|
122
|
-
} else if (t === "}") {
|
|
123
|
-
if (buf.trim()) {
|
|
124
|
-
for (const decl of buf.split(";").filter((s) => s.trim())) out.push(`${indent()}${decl.trim()};`);
|
|
125
|
-
buf = "";
|
|
126
|
-
}
|
|
127
|
-
depth = Math.max(0, depth - 1);
|
|
128
|
-
out.push(`${indent()}}`);
|
|
129
|
-
} else if (t.endsWith(";")) {
|
|
130
|
-
buf += ` ${t}`;
|
|
131
|
-
const full = buf.trim();
|
|
132
|
-
if (full) out.push(`${indent()}${full}`);
|
|
133
|
-
buf = "";
|
|
134
|
-
} else buf += ` ${t}`;
|
|
135
|
-
if (buf.trim()) out.push(buf.trim());
|
|
136
|
-
return out.filter((l) => l.trim()).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
137
|
-
}
|
|
138
|
-
/** Split `str` by `sep` only when not inside parentheses */
|
|
139
|
-
function splitOutsideParens(str, sep) {
|
|
140
|
-
const parts = [];
|
|
141
|
-
let depth = 0;
|
|
142
|
-
let start = 0;
|
|
143
|
-
for (let i = 0; i < str.length; i++) {
|
|
144
|
-
const ch = str[i];
|
|
145
|
-
if (ch === "(") depth++;
|
|
146
|
-
else if (ch === ")") depth--;
|
|
147
|
-
else if (depth === 0 && str.startsWith(sep, i)) {
|
|
148
|
-
parts.push(str.slice(start, i));
|
|
149
|
-
start = i + sep.length;
|
|
69
|
+
const lines = css.replace(/\s+/g, " ").trim().replaceAll(" {", "{").replaceAll("{", " {\n").replaceAll("}", "\n}\n").replaceAll(";", ";\n").split("\n");
|
|
70
|
+
for (let line of lines) {
|
|
71
|
+
line = line.trim();
|
|
72
|
+
if (!line) continue;
|
|
73
|
+
if (line === "}") {
|
|
74
|
+
const last = out.at(-1);
|
|
75
|
+
if (last && !/[;{}]$/.test(last)) out[out.length - 1] += ";";
|
|
76
|
+
depth = Math.max(0, depth - 1);
|
|
150
77
|
}
|
|
78
|
+
out.push(`${" ".repeat(depth)}${line}`);
|
|
79
|
+
if (line.endsWith("{")) depth++;
|
|
151
80
|
}
|
|
152
|
-
|
|
153
|
-
return parts;
|
|
81
|
+
return out.join("\n");
|
|
154
82
|
}
|
|
155
83
|
function extractChunkName(cacheKey) {
|
|
156
84
|
for (const part of cacheKey.split("\0")) {
|
|
@@ -175,29 +103,27 @@ function buildChunkBreakdown(root = defaultRoot()) {
|
|
|
175
103
|
const byChunk = {};
|
|
176
104
|
for (const [cacheKey, className] of registry.cacheKeyToClassName) {
|
|
177
105
|
const chunk = extractChunkName(cacheKey) || "unknown";
|
|
178
|
-
|
|
106
|
+
const entry = byChunk[chunk] ??= {
|
|
179
107
|
classes: [],
|
|
180
108
|
cssSize: 0,
|
|
181
109
|
ruleCount: 0
|
|
182
110
|
};
|
|
183
|
-
|
|
184
|
-
const css =
|
|
185
|
-
|
|
186
|
-
|
|
111
|
+
entry.classes.push(className);
|
|
112
|
+
const css = cssTextForClasses([className], root);
|
|
113
|
+
entry.cssSize += css.length;
|
|
114
|
+
entry.ruleCount += countRules(css);
|
|
187
115
|
}
|
|
188
|
-
|
|
189
|
-
const
|
|
116
|
+
const entries = Object.values(byChunk);
|
|
117
|
+
for (const entry of entries) entry.classes = sortTastyClasses(entry.classes);
|
|
118
|
+
const totalClasses = entries.reduce((sum, entry) => {
|
|
119
|
+
return sum + entry.classes.length;
|
|
120
|
+
}, 0);
|
|
190
121
|
return {
|
|
191
122
|
byChunk,
|
|
192
123
|
totalChunkTypes: Object.keys(byChunk).length,
|
|
193
124
|
totalClasses
|
|
194
125
|
};
|
|
195
126
|
}
|
|
196
|
-
/**
|
|
197
|
-
* Every prefix `registry.globalRules` is keyed by. Anything missing here is a
|
|
198
|
-
* rule the summary would hold but never count, which is how the totals stopped
|
|
199
|
-
* adding up the first time.
|
|
200
|
-
*/
|
|
201
127
|
const GLOBAL_RULE_PREFIXES = {
|
|
202
128
|
global: "global:",
|
|
203
129
|
property: "property:",
|
|
@@ -205,7 +131,7 @@ const GLOBAL_RULE_PREFIXES = {
|
|
|
205
131
|
counterStyle: "counterstyle:",
|
|
206
132
|
function: "function:"
|
|
207
133
|
};
|
|
208
|
-
function getGlobalTypeCSS(type, root = defaultRoot()) {
|
|
134
|
+
function getGlobalTypeCSS(type, root = defaultRoot(), includeCSS = true) {
|
|
209
135
|
const registry = getRegistry(root);
|
|
210
136
|
if (!root || !registry) return {
|
|
211
137
|
css: "",
|
|
@@ -213,12 +139,12 @@ function getGlobalTypeCSS(type, root = defaultRoot()) {
|
|
|
213
139
|
size: 0
|
|
214
140
|
};
|
|
215
141
|
const chunks = [];
|
|
142
|
+
const sheetManager = injector.instance._sheetManager;
|
|
216
143
|
let rc = 0;
|
|
217
144
|
if (type === "raw") {
|
|
218
145
|
const css = injector.instance.getRawCSSText({ root });
|
|
219
|
-
const sheetManager = injector.instance._sheetManager;
|
|
220
146
|
return {
|
|
221
|
-
css: prettifyCSS(css),
|
|
147
|
+
css: includeCSS ? prettifyCSS(css) : "",
|
|
222
148
|
ruleCount: sheetManager?.getRawRuleCount(root) ?? 0,
|
|
223
149
|
size: css.length
|
|
224
150
|
};
|
|
@@ -226,8 +152,7 @@ function getGlobalTypeCSS(type, root = defaultRoot()) {
|
|
|
226
152
|
if (type === "keyframes") for (const [, entry] of registry.keyframesCache) {
|
|
227
153
|
const info = entry.info;
|
|
228
154
|
const sheetInfo = registry.sheets[info.sheetIndex];
|
|
229
|
-
const
|
|
230
|
-
const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;
|
|
155
|
+
const ss = sheetInfo && sheetManager ? sheetManager.getCSSSheet(sheetInfo) : null;
|
|
231
156
|
if (ss && info.ruleIndex < ss.cssRules.length) {
|
|
232
157
|
const rule = ss.cssRules[info.ruleIndex];
|
|
233
158
|
if (rule) {
|
|
@@ -244,8 +169,7 @@ function getGlobalTypeCSS(type, root = defaultRoot()) {
|
|
|
244
169
|
for (const [key, ri] of registry.globalRules) {
|
|
245
170
|
if (!key.startsWith(prefix)) continue;
|
|
246
171
|
const sheetInfo = registry.sheets[ri.sheetIndex];
|
|
247
|
-
const
|
|
248
|
-
const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;
|
|
172
|
+
const ss = sheetInfo && sheetManager ? sheetManager.getCSSSheet(sheetInfo) : null;
|
|
249
173
|
if (ss) {
|
|
250
174
|
const start = Math.max(0, ri.ruleIndex);
|
|
251
175
|
const end = Math.min(ss.cssRules.length - 1, ri.endRuleIndex ?? ri.ruleIndex);
|
|
@@ -264,7 +188,7 @@ function getGlobalTypeCSS(type, root = defaultRoot()) {
|
|
|
264
188
|
}
|
|
265
189
|
const raw = chunks.join("\n");
|
|
266
190
|
return {
|
|
267
|
-
css: prettifyCSS(raw),
|
|
191
|
+
css: includeCSS ? prettifyCSS(raw) : "",
|
|
268
192
|
ruleCount: rc,
|
|
269
193
|
size: raw.length
|
|
270
194
|
};
|
|
@@ -311,6 +235,13 @@ const CHUNK_ORDER = [
|
|
|
311
235
|
CHUNK_NAMES.MISC,
|
|
312
236
|
CHUNK_NAMES.SUBCOMPONENTS
|
|
313
237
|
];
|
|
238
|
+
function logChunkEntries(breakdown) {
|
|
239
|
+
for (const name of CHUNK_ORDER) {
|
|
240
|
+
const data = breakdown.byChunk[name];
|
|
241
|
+
if (data) console.log(` ${name}: ${data.classes.length} cls, ${data.ruleCount} rules, ${fmtSize(data.cssSize)}`);
|
|
242
|
+
}
|
|
243
|
+
for (const [name, data] of Object.entries(breakdown.byChunk)) if (!CHUNK_ORDER.includes(name)) console.log(` ${name}: ${data.classes.length} cls, ${data.ruleCount} rules, ${fmtSize(data.cssSize)}`);
|
|
244
|
+
}
|
|
314
245
|
const tastyDebug = {
|
|
315
246
|
css(target, opts) {
|
|
316
247
|
const { root = defaultRoot(), prettify = true, raw = false, source = false } = opts || {};
|
|
@@ -325,32 +256,28 @@ const tastyDebug = {
|
|
|
325
256
|
if (src) css = src;
|
|
326
257
|
else {
|
|
327
258
|
if (!raw) console.warn("[Tasty] source CSS not available (requires dev mode or TASTY_DEBUG=true). Falling back to live CSSOM.");
|
|
328
|
-
css =
|
|
259
|
+
css = cssTextForClasses([target], root);
|
|
329
260
|
}
|
|
330
261
|
} else if (source && Array.isArray(target)) {
|
|
331
262
|
const src = getSourceCssForClasses(target, root);
|
|
332
263
|
if (src) css = src;
|
|
333
264
|
else {
|
|
334
265
|
if (!raw) console.warn("[Tasty] source CSS not available. Falling back to live CSSOM.");
|
|
335
|
-
css =
|
|
266
|
+
css = cssTextForClasses(target, root);
|
|
336
267
|
}
|
|
337
268
|
} else if (typeof target === "string") if (target === "all") css = getAllCSS(root);
|
|
338
269
|
else if (target === "global") {
|
|
339
270
|
css = getGlobalTypeCSS("global", root).css;
|
|
340
271
|
return css;
|
|
341
|
-
} else if (target === "active")
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
const unused = getUnusedClasses(root);
|
|
346
|
-
css = injector.instance.getCSSTextForClasses(unused, { root });
|
|
347
|
-
} else if (target === "page") css = getPageCSS(root);
|
|
348
|
-
else if (classRegex.test(target)) css = injector.instance.getCSSTextForClasses([target], { root });
|
|
272
|
+
} else if (target === "active") css = cssTextForClasses(findDomTastyClasses(root), root);
|
|
273
|
+
else if (target === "unused") css = cssTextForClasses(getUnusedClasses(root), root);
|
|
274
|
+
else if (target === "page") css = getPageCSS(root);
|
|
275
|
+
else if (classRegex.test(target)) css = cssTextForClasses([target], root);
|
|
349
276
|
else {
|
|
350
277
|
const el = root.querySelector?.(target);
|
|
351
278
|
if (el) css = getCSSTextForNode(el, { root });
|
|
352
279
|
}
|
|
353
|
-
else if (Array.isArray(target)) css =
|
|
280
|
+
else if (Array.isArray(target)) css = cssTextForClasses(target, root);
|
|
354
281
|
else if (target instanceof Element) css = getCSSTextForNode(target, { root });
|
|
355
282
|
const result = prettify ? prettifyCSS(css) : css;
|
|
356
283
|
if (!raw) {
|
|
@@ -423,27 +350,27 @@ const tastyDebug = {
|
|
|
423
350
|
const allCSS = getAllCSS(root);
|
|
424
351
|
const activeRuleCount = countRules(activeCSS);
|
|
425
352
|
const unusedRuleCount = countRules(unusedCSS);
|
|
426
|
-
const globalData = getGlobalTypeCSS("global", root);
|
|
427
|
-
const rawData = getGlobalTypeCSS("raw", root);
|
|
428
|
-
const kfData = getGlobalTypeCSS("keyframes", root);
|
|
429
|
-
const propData = getGlobalTypeCSS("property", root);
|
|
353
|
+
const globalData = getGlobalTypeCSS("global", root, false);
|
|
354
|
+
const rawData = getGlobalTypeCSS("raw", root, false);
|
|
355
|
+
const kfData = getGlobalTypeCSS("keyframes", root, false);
|
|
356
|
+
const propData = getGlobalTypeCSS("property", root, false);
|
|
430
357
|
const atRuleData = [
|
|
431
358
|
"fontFace",
|
|
432
359
|
"counterStyle",
|
|
433
360
|
"function"
|
|
434
|
-
].reduce((
|
|
435
|
-
const data = getGlobalTypeCSS(type, root);
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
size: all.size + data.size
|
|
440
|
-
};
|
|
361
|
+
].reduce((total, type) => {
|
|
362
|
+
const data = getGlobalTypeCSS(type, root, false);
|
|
363
|
+
total.ruleCount += data.ruleCount;
|
|
364
|
+
total.size += data.size;
|
|
365
|
+
return total;
|
|
441
366
|
}, {
|
|
442
|
-
css: "",
|
|
443
367
|
ruleCount: 0,
|
|
444
368
|
size: 0
|
|
445
369
|
});
|
|
446
|
-
const
|
|
370
|
+
const hotRuleCount = countRules(hotCSS);
|
|
371
|
+
const globalRuleCount = globalData.ruleCount + atRuleData.ruleCount;
|
|
372
|
+
const globalCSSSize = globalData.size + atRuleData.size;
|
|
373
|
+
const totalRuleCount = activeRuleCount + unusedRuleCount + hotRuleCount + globalRuleCount + rawData.ruleCount + kfData.ruleCount + propData.ruleCount;
|
|
447
374
|
const metrics = getInjectorMetrics(root);
|
|
448
375
|
const defs = getDefs(root);
|
|
449
376
|
const chunkBreakdown = buildChunkBreakdown(root);
|
|
@@ -454,14 +381,14 @@ const tastyDebug = {
|
|
|
454
381
|
totalStyledClasses,
|
|
455
382
|
activeCSSSize: activeCSS.length,
|
|
456
383
|
unusedCSSSize: unusedCSS.length,
|
|
457
|
-
globalCSSSize
|
|
384
|
+
globalCSSSize,
|
|
458
385
|
rawCSSSize: rawData.size,
|
|
459
386
|
keyframesCSSSize: kfData.size,
|
|
460
387
|
propertyCSSSize: propData.size,
|
|
461
388
|
totalCSSSize: allCSS.length,
|
|
462
389
|
activeRuleCount,
|
|
463
390
|
unusedRuleCount,
|
|
464
|
-
globalRuleCount
|
|
391
|
+
globalRuleCount,
|
|
465
392
|
rawRuleCount: rawData.ruleCount,
|
|
466
393
|
keyframesRuleCount: kfData.ruleCount,
|
|
467
394
|
propertyRuleCount: propData.ruleCount,
|
|
@@ -475,8 +402,8 @@ const tastyDebug = {
|
|
|
475
402
|
console.group("Tasty Summary");
|
|
476
403
|
console.log(`Active: ${activeClasses.length} classes, ${activeRuleCount} rules, ${fmtSize(activeCSS.length)}`);
|
|
477
404
|
console.log(`Unused: ${unusedClasses.length} classes, ${unusedRuleCount} rules, ${fmtSize(unusedCSS.length)}`);
|
|
478
|
-
if (hotClasses.length) console.log(`Held: ${hotClasses.length} classes, ${
|
|
479
|
-
console.log(`Global: ${
|
|
405
|
+
if (hotClasses.length) console.log(`Held: ${hotClasses.length} classes, ${hotRuleCount} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`);
|
|
406
|
+
console.log(`Global: ${globalRuleCount} rules, ${fmtSize(globalCSSSize)}`);
|
|
480
407
|
if (rawData.ruleCount) console.log(`Raw: ${rawData.ruleCount} rules, ${fmtSize(rawData.size)}`);
|
|
481
408
|
if (kfData.ruleCount) console.log(`Keyframes: ${kfData.ruleCount} rules, ${fmtSize(kfData.size)}`);
|
|
482
409
|
if (propData.ruleCount) console.log(`@property: ${propData.ruleCount} rules, ${fmtSize(propData.size)}`);
|
|
@@ -488,11 +415,7 @@ const tastyDebug = {
|
|
|
488
415
|
}
|
|
489
416
|
if (chunkBreakdown.totalChunkTypes > 0) {
|
|
490
417
|
console.groupCollapsed(`Chunks (${chunkBreakdown.totalChunkTypes} types, ${chunkBreakdown.totalClasses} classes)`);
|
|
491
|
-
|
|
492
|
-
const d = chunkBreakdown.byChunk[name];
|
|
493
|
-
if (d) console.log(` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`);
|
|
494
|
-
}
|
|
495
|
-
for (const [name, d] of Object.entries(chunkBreakdown.byChunk)) if (!CHUNK_ORDER.includes(name)) console.log(` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`);
|
|
418
|
+
logChunkEntries(chunkBreakdown);
|
|
496
419
|
console.groupEnd();
|
|
497
420
|
}
|
|
498
421
|
if (defs.properties.length || defs.keyframes.length) console.log(`Defs: ${defs.properties.length} @property, ${defs.keyframes.length} @keyframes`);
|
|
@@ -506,11 +429,7 @@ const tastyDebug = {
|
|
|
506
429
|
const breakdown = buildChunkBreakdown(root);
|
|
507
430
|
if (!raw) {
|
|
508
431
|
console.group(`Chunks (${breakdown.totalChunkTypes} types, ${breakdown.totalClasses} classes)`);
|
|
509
|
-
|
|
510
|
-
const d = breakdown.byChunk[name];
|
|
511
|
-
if (d) console.log(` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`);
|
|
512
|
-
}
|
|
513
|
-
for (const [name, d] of Object.entries(breakdown.byChunk)) if (!CHUNK_ORDER.includes(name)) console.log(` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`);
|
|
432
|
+
logChunkEntries(breakdown);
|
|
514
433
|
console.groupEnd();
|
|
515
434
|
}
|
|
516
435
|
return breakdown;
|
|
@@ -579,4 +498,4 @@ function getPageCSS(root = defaultRoot()) {
|
|
|
579
498
|
//#endregion
|
|
580
499
|
export { tastyDebug as t };
|
|
581
500
|
|
|
582
|
-
//# sourceMappingURL=debug-
|
|
501
|
+
//# sourceMappingURL=debug-C9LeNVoJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-C9LeNVoJ.js","names":[],"sources":["../../src/debug.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { CHUNK_NAMES } from './chunks/definitions';\nimport { getNamePrefix } from './config';\nimport { flushStyles, getCSSTextForNode, injector } from './injector';\nimport type { CacheMetrics, RootRegistry } from './injector/types';\nimport { tastyClassRegex } from './utils/name-prefix';\n\ndeclare global {\n interface Window {\n tastyDebug?: typeof tastyDebug;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype CSSTarget =\n 'all' | 'global' | 'active' | 'unused' | 'page' | string | string[] | Element;\n\nexport interface DebugOptions {\n root?: Document | ShadowRoot;\n /** Suppress console logging and return data only (default: false) */\n raw?: boolean;\n}\n\nexport interface CSSOptions extends DebugOptions {\n prettify?: boolean;\n /** Read from stored source CSS (dev-mode only) instead of live CSSOM */\n source?: boolean;\n}\n\nexport interface DebugChunkInfo {\n className: string;\n chunkName: string | null;\n}\n\nexport interface InspectResult {\n element?: Element | null;\n classes: string[];\n chunks: DebugChunkInfo[];\n css: string;\n size: number;\n rules: number;\n}\n\nexport interface CacheStatus {\n classes: {\n active: string[];\n unused: string[];\n all: string[];\n };\n metrics: CacheMetrics | null;\n}\n\nexport interface ChunkBreakdown {\n byChunk: Record<\n string,\n { classes: string[]; cssSize: number; ruleCount: number }\n >;\n totalChunkTypes: number;\n totalClasses: number;\n}\n\nexport interface Summary {\n activeClasses: string[];\n /** Classes `gc({ force: true })` would delete right now. */\n unusedClasses: string[];\n /**\n * Held but in neither list: nothing renders them, yet collection will not\n * take them — inside the grace window, or pinned by an `inject()` handle.\n */\n hotClasses: string[];\n totalStyledClasses: string[];\n\n activeCSSSize: number;\n unusedCSSSize: number;\n globalCSSSize: number;\n rawCSSSize: number;\n keyframesCSSSize: number;\n propertyCSSSize: number;\n totalCSSSize: number;\n\n activeRuleCount: number;\n unusedRuleCount: number;\n globalRuleCount: number;\n rawRuleCount: number;\n keyframesRuleCount: number;\n propertyRuleCount: number;\n totalRuleCount: number;\n\n metrics: CacheMetrics | null;\n definedProperties: string[];\n definedKeyframes: { name: string; refCount: number }[];\n chunkBreakdown: ChunkBreakdown;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction fmtSize(bytes: number): string {\n return bytes > 1024 ? `${(bytes / 1024).toFixed(1)}KB` : `${bytes}B`;\n}\n\nfunction countRules(css: string): number {\n return (css.match(/\\{[^}]*\\}/g) || []).length;\n}\n\nfunction sortTastyClasses(classes: Iterable<string>): string[] {\n // Class names use a base36 hash format (e.g. `t3a5f`), so sort lexicographically.\n return Array.from(classes).sort((a, b) => a.localeCompare(b));\n}\n\n/** A DOM root to read, or `null` when the environment has no DOM at all. */\ntype DebugRoot = Document | ShadowRoot | null;\n\n/**\n * The root these helpers read, or `null` where there is no DOM.\n *\n * `document` used to be a default parameter value, and a default is evaluated\n * at the call site — so every read below threw a bare `ReferenceError` under\n * Node, taking out five of the eight public methods. A debug utility must not\n * be able to fail an SSR render because a call was left in, so the DOM-less\n * case reports an empty result and says why.\n */\nfunction defaultRoot(): DebugRoot {\n return typeof document === 'undefined' ? null : document;\n}\n\nlet warnedNoDom = false;\n\n/** Say once why the numbers are empty. Silent under `{ raw: true }`. */\nfunction warnNoDom(raw: boolean): void {\n if (raw || warnedNoDom) return;\n warnedNoDom = true;\n console.warn(\n '[Tasty] tastyDebug reads the DOM and this environment has none, so the ' +\n 'result is empty. During SSR, read the ServerStyleCollector instead.',\n );\n}\n\n/**\n * The registry for `root`, with every queued write landed first.\n *\n * Every injector read API is a flush point, and the reads below reach past\n * those APIs straight into the registry and the sheet manager. Without this\n * they would report a batch window's contents as absent — a rule that is\n * enqueued but not yet in a sheet is missing from `globalRules`, from the\n * sheets, and from anything counting either.\n */\nfunction getRegistry(\n root: DebugRoot = defaultRoot(),\n): RootRegistry | undefined {\n if (!root) return undefined;\n flushStyles();\n\n return injector.instance._sheetManager?.getRegistry(root);\n}\n\nfunction findDomTastyClasses(root: DebugRoot = defaultRoot()): string[] {\n if (!root) return [];\n const classes = new Set<string>();\n const elements = (root as Document).querySelectorAll?.('[class]') || [];\n const classRegex = tastyClassRegex(getNamePrefix());\n for (const element of elements) {\n const attribute = element.getAttribute('class');\n if (!attribute) continue;\n for (const className of attribute.split(/\\s+/)) {\n if (classRegex.test(className)) classes.add(className);\n }\n }\n return sortTastyClasses(classes);\n}\n\n/**\n * Everything this injector holds in `root`, in the order the engine applies it,\n * with the sources kept byte-for-byte — trimming would report a total smaller\n * than one of its own parts whenever raw CSS has edge whitespace.\n */\nfunction getAllCSS(root: DebugRoot = defaultRoot()): string {\n const registry = getRegistry(root);\n const sheetManager = injector.instance._sheetManager;\n // `getRegistry` already returns nothing for a null root; the `!root` is what\n // narrows the type for the call below.\n if (!root || !registry || !sheetManager) return '';\n\n return sheetManager.getOwnedCSSInOrder(registry, root).join('\\n');\n}\n\n/**\n * The injector's own readers fall back to `document` when `root` is omitted, so\n * they have to be reached with a real root or not at all.\n */\nfunction cssTextForClasses(classNames: string[], root: DebugRoot): string {\n if (!root) return '';\n\n return injector.instance.getCSSTextForClasses(classNames, { root });\n}\n\nfunction getInjectorMetrics(root: DebugRoot): CacheMetrics | null {\n if (!root) return null;\n\n return injector.instance.getMetrics({ root });\n}\n\n/**\n * Injected classes that no element carries and nobody pinned — the exact set\n * `gc({ force: true })` would delete.\n *\n * Deliberately borrowed from the injector rather than recomputed here: the two\n * drifted apart once before, when this file still read \"unused\" off the pin\n * counts the render path had stopped maintaining.\n */\nfunction getUnusedClasses(root: DebugRoot = defaultRoot()): string[] {\n if (!root) return [];\n\n return sortTastyClasses(injector.instance.getUnusedClasses({ root }));\n}\n\n/** Every class this injector holds CSS for in `root`. */\nfunction getOwnedClasses(root: DebugRoot = defaultRoot()): string[] {\n const registry = getRegistry(root);\n if (!registry) return [];\n\n const owned: string[] = [];\n for (const [className, info] of registry.rules) {\n // A negative sheet index marks a class whose CSS this injector does not\n // hold: server-rendered, pre-allocated, or queued.\n if (info.sheetIndex >= 0) owned.push(className);\n }\n\n return sortTastyClasses(owned);\n}\n\n// ---------------------------------------------------------------------------\n// prettifyCSS — readable output for nested rules\n// ---------------------------------------------------------------------------\n\nfunction prettifyCSS(css: string): string {\n if (!css || !css.trim()) return '';\n\n const out: string[] = [];\n let depth = 0;\n\n const lines = css\n .replace(/\\s+/g, ' ')\n .trim()\n .replaceAll(' {', '{')\n .replaceAll('{', ' {\\n')\n .replaceAll('}', '\\n}\\n')\n .replaceAll(';', ';\\n')\n .split('\\n');\n\n for (let line of lines) {\n line = line.trim();\n if (!line) continue;\n\n if (line === '}') {\n const last = out.at(-1);\n if (last && !/[;{}]$/.test(last)) {\n out[out.length - 1] += ';';\n }\n depth = Math.max(0, depth - 1);\n }\n out.push(`${' '.repeat(depth)}${line}`);\n if (line.endsWith('{')) depth++;\n }\n\n return out.join('\\n');\n}\n\n// ---------------------------------------------------------------------------\n// Chunk helpers\n// ---------------------------------------------------------------------------\n\nfunction extractChunkName(cacheKey: string): string | null {\n for (const part of cacheKey.split('\\0')) {\n if (part.startsWith('[states:')) continue;\n if (!part.includes(':') && part.length > 0) return part;\n }\n return null;\n}\n\nfunction getChunkForClass(\n className: string,\n root: DebugRoot = defaultRoot(),\n): string | null {\n const registry = getRegistry(root);\n if (!registry) return null;\n for (const [key, cn] of registry.cacheKeyToClassName) {\n if (cn === className) return extractChunkName(key);\n }\n return null;\n}\n\nfunction buildChunkBreakdown(root: DebugRoot = defaultRoot()): ChunkBreakdown {\n const registry = getRegistry(root);\n if (!root || !registry)\n return { byChunk: {}, totalChunkTypes: 0, totalClasses: 0 };\n\n const byChunk: ChunkBreakdown['byChunk'] = {};\n for (const [cacheKey, className] of registry.cacheKeyToClassName) {\n const chunk = extractChunkName(cacheKey) || 'unknown';\n const entry = (byChunk[chunk] ??= {\n classes: [],\n cssSize: 0,\n ruleCount: 0,\n });\n entry.classes.push(className);\n const css = cssTextForClasses([className], root);\n entry.cssSize += css.length;\n entry.ruleCount += countRules(css);\n }\n\n const entries = Object.values(byChunk);\n for (const entry of entries) {\n entry.classes = sortTastyClasses(entry.classes);\n }\n\n const totalClasses = entries.reduce((sum, entry) => {\n return sum + entry.classes.length;\n }, 0);\n return {\n byChunk,\n totalChunkTypes: Object.keys(byChunk).length,\n totalClasses,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Global-type CSS helper (internal only)\n// ---------------------------------------------------------------------------\n\n/**\n * Every prefix `registry.globalRules` is keyed by. Anything missing here is a\n * rule the summary would hold but never count, which is how the totals stopped\n * adding up the first time.\n */\nconst GLOBAL_RULE_PREFIXES = {\n global: 'global:',\n property: 'property:',\n fontFace: 'fontface:',\n counterStyle: 'counterstyle:',\n function: 'function:',\n} as const;\n\nfunction getGlobalTypeCSS(\n type: keyof typeof GLOBAL_RULE_PREFIXES | 'raw' | 'keyframes',\n root: DebugRoot = defaultRoot(),\n includeCSS = true,\n): { css: string; ruleCount: number; size: number } {\n const registry = getRegistry(root);\n if (!root || !registry) return { css: '', ruleCount: 0, size: 0 };\n\n const chunks: string[] = [];\n const sheetManager = injector.instance._sheetManager;\n let rc = 0;\n\n if (type === 'raw') {\n // Raw blocks are kept by the sheet manager, not in `globalRules`, so the\n // prefix scan below never sees them — and their rules are counted from the\n // parsed sheet, since one raw block is one string but any number of rules.\n const css = injector.instance.getRawCSSText({ root });\n\n return {\n css: includeCSS ? prettifyCSS(css) : '',\n ruleCount: sheetManager?.getRawRuleCount(root) ?? 0,\n size: css.length,\n };\n }\n\n if (type === 'keyframes') {\n for (const [, entry] of registry.keyframesCache) {\n const info = entry.info;\n const sheetInfo = registry.sheets[info.sheetIndex];\n const ss =\n sheetInfo && sheetManager ? sheetManager.getCSSSheet(sheetInfo) : null;\n if (ss && info.ruleIndex < ss.cssRules.length) {\n const rule = ss.cssRules[info.ruleIndex];\n if (rule) {\n chunks.push(rule.cssText);\n rc++;\n }\n } else if (info.cssText) {\n chunks.push(info.cssText);\n rc++;\n }\n }\n } else {\n const prefix = GLOBAL_RULE_PREFIXES[type];\n for (const [key, ri] of registry.globalRules) {\n if (!key.startsWith(prefix)) continue;\n const sheetInfo = registry.sheets[ri.sheetIndex];\n const ss =\n sheetInfo && sheetManager ? sheetManager.getCSSSheet(sheetInfo) : null;\n if (ss) {\n const start = Math.max(0, ri.ruleIndex);\n const end = Math.min(\n ss.cssRules.length - 1,\n (ri.endRuleIndex as number) ?? ri.ruleIndex,\n );\n if (start >= 0 && end >= start && start < ss.cssRules.length) {\n for (let i = start; i <= end; i++) {\n const rule = ss.cssRules[i];\n if (rule) {\n chunks.push(rule.cssText);\n rc++;\n }\n }\n }\n } else if (ri.cssText?.length) {\n chunks.push(...ri.cssText);\n rc += ri.cssText.length;\n }\n }\n }\n\n const raw = chunks.join('\\n');\n return {\n css: includeCSS ? prettifyCSS(raw) : '',\n ruleCount: rc,\n size: raw.length,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Source CSS (dev-mode RuleInfo.cssText)\n// ---------------------------------------------------------------------------\n\nfunction getSourceCssForClasses(\n classNames: string[],\n root: DebugRoot = defaultRoot(),\n): string | null {\n const registry = getRegistry(root);\n if (!registry) return null;\n\n const chunks: string[] = [];\n let found = false;\n for (const cls of classNames) {\n const info = registry.rules.get(cls);\n if (info?.cssText?.length) {\n chunks.push(...info.cssText);\n found = true;\n }\n }\n return found ? chunks.join('\\n') : null;\n}\n\n// ---------------------------------------------------------------------------\n// Definitions helper (internal)\n// ---------------------------------------------------------------------------\n\nfunction getDefs(root: DebugRoot = defaultRoot()) {\n const registry = getRegistry(root);\n let properties: string[] = [];\n if (registry?.injectedProperties) {\n properties = Array.from(\n (registry.injectedProperties as Map<string, string>).keys(),\n ).sort();\n }\n\n const keyframes: { name: string; refCount: number }[] = [];\n if (registry) {\n for (const entry of registry.keyframesCache.values()) {\n keyframes.push({ name: entry.name, refCount: entry.refCount });\n }\n keyframes.sort((a, b) => a.name.localeCompare(b.name));\n }\n\n return { properties, keyframes };\n}\n\n// ---------------------------------------------------------------------------\n// Chunk display order\n// ---------------------------------------------------------------------------\n\nconst CHUNK_ORDER = [\n CHUNK_NAMES.COMBINED,\n CHUNK_NAMES.APPEARANCE,\n CHUNK_NAMES.FONT,\n CHUNK_NAMES.DIMENSION,\n CHUNK_NAMES.DISPLAY,\n CHUNK_NAMES.LAYOUT,\n CHUNK_NAMES.POSITION,\n CHUNK_NAMES.MISC,\n CHUNK_NAMES.SUBCOMPONENTS,\n];\n\nfunction logChunkEntries(breakdown: ChunkBreakdown): void {\n for (const name of CHUNK_ORDER) {\n const data = breakdown.byChunk[name];\n if (data)\n console.log(\n ` ${name}: ${data.classes.length} cls, ${data.ruleCount} rules, ${fmtSize(data.cssSize)}`,\n );\n }\n for (const [name, data] of Object.entries(breakdown.byChunk)) {\n if (!CHUNK_ORDER.includes(name as (typeof CHUNK_ORDER)[number]))\n console.log(\n ` ${name}: ${data.classes.length} cls, ${data.ruleCount} rules, ${fmtSize(data.cssSize)}`,\n );\n }\n}\n\n// ---------------------------------------------------------------------------\n// tastyDebug API\n// ---------------------------------------------------------------------------\n\nexport const tastyDebug = {\n css(target: CSSTarget, opts?: CSSOptions): string {\n const {\n root = defaultRoot(),\n prettify = true,\n raw = false,\n source = false,\n } = opts || {};\n if (!root) {\n warnNoDom(raw);\n\n return '';\n }\n let css = '';\n\n const classRegex = tastyClassRegex(getNamePrefix());\n if (source && typeof target === 'string' && classRegex.test(target)) {\n const src = getSourceCssForClasses([target], root);\n if (src) {\n css = src;\n } else {\n if (!raw) {\n console.warn(\n '[Tasty] source CSS not available (requires dev mode or TASTY_DEBUG=true). Falling back to live CSSOM.',\n );\n }\n css = cssTextForClasses([target], root);\n }\n } else if (source && Array.isArray(target)) {\n const src = getSourceCssForClasses(target, root);\n if (src) {\n css = src;\n } else {\n if (!raw) {\n console.warn(\n '[Tasty] source CSS not available. Falling back to live CSSOM.',\n );\n }\n css = cssTextForClasses(target, root);\n }\n } else if (typeof target === 'string') {\n if (target === 'all') {\n // Documented as component + global + raw, and raw has its own sheet.\n css = getAllCSS(root);\n } else if (target === 'global') {\n css = getGlobalTypeCSS('global', root).css;\n return css; // already prettified\n } else if (target === 'active') {\n const active = findDomTastyClasses(root);\n css = cssTextForClasses(active, root);\n } else if (target === 'unused') {\n const unused = getUnusedClasses(root);\n css = cssTextForClasses(unused, root);\n } else if (target === 'page') {\n css = getPageCSS(root);\n } else if (classRegex.test(target)) {\n css = cssTextForClasses([target], root);\n } else {\n const el = (root as Document).querySelector?.(target);\n if (el) css = getCSSTextForNode(el, { root });\n }\n } else if (Array.isArray(target)) {\n css = cssTextForClasses(target, root);\n } else if (target instanceof Element) {\n css = getCSSTextForNode(target, { root });\n }\n\n const result = prettify ? prettifyCSS(css) : css;\n\n if (!raw) {\n const label = Array.isArray(target) ? `[${target.join(', ')}]` : target;\n const rc = countRules(css);\n console.group(`CSS for ${label} (${rc} rules, ${fmtSize(css.length)})`);\n console.log(result || '(empty)');\n console.groupEnd();\n }\n\n return result;\n },\n\n inspect(target: string | Element, opts?: DebugOptions): InspectResult {\n const { root = defaultRoot(), raw = false } = opts || {};\n const element = !root\n ? null\n : typeof target === 'string'\n ? (root as Document).querySelector?.(target)\n : target;\n if (!root) warnNoDom(raw);\n\n if (!element) {\n const empty: InspectResult = {\n element: null,\n classes: [],\n chunks: [],\n css: '',\n size: 0,\n rules: 0,\n };\n // With no DOM at all, `warnNoDom` above already said why; \"element not\n // found\" would only misdirect.\n if (!raw && root)\n console.warn('[Tasty] debug.inspect: element not found');\n return empty;\n }\n\n const classList = element.getAttribute('class') || '';\n const classRegex = tastyClassRegex(getNamePrefix());\n const tastyClasses = classList\n .split(/\\s+/)\n .filter((cls) => classRegex.test(cls));\n\n const chunks: DebugChunkInfo[] = tastyClasses.map((className) => ({\n className,\n chunkName: getChunkForClass(className, root),\n }));\n\n const css = getCSSTextForNode(element, { root: root ?? undefined });\n const rules = countRules(css);\n\n const result: InspectResult = {\n element,\n classes: tastyClasses,\n chunks,\n css: prettifyCSS(css),\n size: css.length,\n rules,\n };\n\n if (!raw) {\n const tag = element.tagName.toLowerCase();\n const id = element.id ? `#${element.id}` : '';\n console.group(\n `inspect ${tag}${id} — ${tastyClasses.length} classes, ${rules} rules, ${fmtSize(css.length)}`,\n );\n if (chunks.length) {\n console.log(\n 'Chunks:',\n chunks.map((c) => `${c.className}→${c.chunkName || '?'}`).join(', '),\n );\n }\n console.groupCollapsed('CSS');\n console.log(result.css || '(empty)');\n console.groupEnd();\n console.groupEnd();\n }\n\n return result;\n },\n\n summary(opts?: DebugOptions): Summary {\n const { root = defaultRoot(), raw = false } = opts || {};\n if (!root) warnNoDom(raw);\n\n const activeClasses = findDomTastyClasses(root);\n const unusedClasses = getUnusedClasses(root);\n // Everything, not just the two bands above: a class that went cold a\n // moment ago is in neither, and dropping it here is the accounting failure\n // this whole change started from.\n const ownedClasses = getOwnedClasses(root);\n const totalStyledClasses = sortTastyClasses(\n new Set([...activeClasses, ...ownedClasses]),\n );\n const unusedSet = new Set(unusedClasses);\n const activeSet = new Set(activeClasses);\n const hotClasses = ownedClasses.filter(\n (className) => !activeSet.has(className) && !unusedSet.has(className),\n );\n const hotCSS = cssTextForClasses(hotClasses, root);\n\n const activeCSS = cssTextForClasses(activeClasses, root);\n const unusedCSS = cssTextForClasses(unusedClasses, root);\n const allCSS = getAllCSS(root);\n\n const activeRuleCount = countRules(activeCSS);\n const unusedRuleCount = countRules(unusedCSS);\n\n const globalData = getGlobalTypeCSS('global', root, false);\n const rawData = getGlobalTypeCSS('raw', root, false);\n const kfData = getGlobalTypeCSS('keyframes', root, false);\n const propData = getGlobalTypeCSS('property', root, false);\n // Folded into the global line rather than given their own: they are all\n // at-rules injected once and kept forever, and leaving them out of the\n // total is what made it not a total.\n const atRuleData = (\n ['fontFace', 'counterStyle', 'function'] as const\n ).reduce(\n (total, type) => {\n const data = getGlobalTypeCSS(type, root, false);\n total.ruleCount += data.ruleCount;\n total.size += data.size;\n return total;\n },\n { ruleCount: 0, size: 0 },\n );\n\n const hotRuleCount = countRules(hotCSS);\n const globalRuleCount = globalData.ruleCount + atRuleData.ruleCount;\n const globalCSSSize = globalData.size + atRuleData.size;\n\n const totalRuleCount =\n activeRuleCount +\n unusedRuleCount +\n hotRuleCount +\n globalRuleCount +\n rawData.ruleCount +\n kfData.ruleCount +\n propData.ruleCount;\n\n const metrics = getInjectorMetrics(root);\n const defs = getDefs(root);\n const chunkBreakdown = buildChunkBreakdown(root);\n\n const summary: Summary = {\n activeClasses,\n unusedClasses,\n hotClasses,\n totalStyledClasses,\n activeCSSSize: activeCSS.length,\n unusedCSSSize: unusedCSS.length,\n globalCSSSize,\n rawCSSSize: rawData.size,\n keyframesCSSSize: kfData.size,\n propertyCSSSize: propData.size,\n totalCSSSize: allCSS.length,\n activeRuleCount,\n unusedRuleCount,\n globalRuleCount,\n rawRuleCount: rawData.ruleCount,\n keyframesRuleCount: kfData.ruleCount,\n propertyRuleCount: propData.ruleCount,\n totalRuleCount,\n metrics,\n definedProperties: defs.properties,\n definedKeyframes: defs.keyframes,\n chunkBreakdown,\n };\n\n if (!raw) {\n console.group('Tasty Summary');\n console.log(\n `Active: ${activeClasses.length} classes, ${activeRuleCount} rules, ${fmtSize(activeCSS.length)}`,\n );\n console.log(\n `Unused: ${unusedClasses.length} classes, ${unusedRuleCount} rules, ${fmtSize(unusedCSS.length)}`,\n );\n if (hotClasses.length)\n console.log(\n `Held: ${hotClasses.length} classes, ${hotRuleCount} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`,\n );\n console.log(\n `Global: ${globalRuleCount} rules, ${fmtSize(globalCSSSize)}`,\n );\n if (rawData.ruleCount)\n console.log(\n `Raw: ${rawData.ruleCount} rules, ${fmtSize(rawData.size)}`,\n );\n if (kfData.ruleCount)\n console.log(\n `Keyframes: ${kfData.ruleCount} rules, ${fmtSize(kfData.size)}`,\n );\n if (propData.ruleCount)\n console.log(\n `@property: ${propData.ruleCount} rules, ${fmtSize(propData.size)}`,\n );\n console.log(\n `Total: ${totalStyledClasses.length} classes, ${totalRuleCount} rules, ${fmtSize(allCSS.length)}`,\n );\n\n if (metrics) {\n const total = metrics.hits + metrics.misses;\n const rate = total > 0 ? ((metrics.hits / total) * 100).toFixed(1) : 0;\n console.log(`Cache: ${rate}% hit rate (${total} lookups)`);\n }\n\n if (chunkBreakdown.totalChunkTypes > 0) {\n console.groupCollapsed(\n `Chunks (${chunkBreakdown.totalChunkTypes} types, ${chunkBreakdown.totalClasses} classes)`,\n );\n logChunkEntries(chunkBreakdown);\n console.groupEnd();\n }\n\n if (defs.properties.length || defs.keyframes.length) {\n console.log(\n `Defs: ${defs.properties.length} @property, ${defs.keyframes.length} @keyframes`,\n );\n }\n\n console.groupEnd();\n }\n\n return summary;\n },\n\n chunks(opts?: DebugOptions): ChunkBreakdown {\n const { root = defaultRoot(), raw = false } = opts || {};\n if (!root) warnNoDom(raw);\n const breakdown = buildChunkBreakdown(root);\n\n if (!raw) {\n console.group(\n `Chunks (${breakdown.totalChunkTypes} types, ${breakdown.totalClasses} classes)`,\n );\n logChunkEntries(breakdown);\n console.groupEnd();\n }\n\n return breakdown;\n },\n\n cache(opts?: DebugOptions): CacheStatus {\n const { root = defaultRoot(), raw = false } = opts || {};\n if (!root) warnNoDom(raw);\n const active = findDomTastyClasses(root);\n const unused = getUnusedClasses(root);\n const metrics = getInjectorMetrics(root);\n\n // `all` is everything held, not the two bands above: a class that went cold\n // a moment ago is in neither, and it is still taking up a sheet.\n const all = sortTastyClasses(\n new Set([...active, ...getOwnedClasses(root)]),\n );\n\n const status: CacheStatus = {\n classes: { active, unused, all },\n metrics,\n };\n\n if (!raw) {\n console.group('Cache');\n console.log(`Active: ${active.length}, Unused: ${unused.length}`);\n if (metrics) {\n const total = metrics.hits + metrics.misses;\n const rate = total > 0 ? ((metrics.hits / total) * 100).toFixed(1) : 0;\n console.log(\n `Hits: ${metrics.hits}, Misses: ${metrics.misses}, Rate: ${rate}%`,\n );\n }\n console.groupEnd();\n }\n\n return status;\n },\n\n cleanup(opts?: { root?: Document | ShadowRoot }): void {\n const root = opts?.root ?? defaultRoot();\n if (!root) return;\n injector.instance.cleanup(root);\n },\n\n help(): void {\n console.log(`tastyDebug API:\n .summary() — overview (classes, rules, sizes)\n .css(\"active\") — CSS for classes in DOM\n .css(\"t42\") — CSS for a specific class\n .css(\"t42\",{source:1})— original CSS before browser parsing (dev only)\n .css(\".selector\") — CSS for a DOM element\n .inspect(\".selector\") — element details (classes, chunks, rules)\n .chunks() — style chunk breakdown\n .cache() — cache status and metrics\n .cleanup() — force unused style cleanup\nOptions: { raw: true } suppresses logging, { root: shadowRoot } targets Shadow DOM`);\n },\n\n install(): void {\n if (typeof window !== 'undefined' && window.tastyDebug !== tastyDebug) {\n window.tastyDebug = tastyDebug;\n console.log('tastyDebug installed. Run tastyDebug.help() for commands.');\n }\n },\n};\n\n// ---------------------------------------------------------------------------\n// Page CSS (minimal, kept internal)\n// ---------------------------------------------------------------------------\n\nfunction getPageCSS(root: DebugRoot = defaultRoot()): string {\n if (!root) return '';\n const chunks: string[] = [];\n try {\n if ('styleSheets' in root) {\n for (const sheet of Array.from((root as Document).styleSheets)) {\n try {\n if (sheet.cssRules)\n chunks.push(\n Array.from(sheet.cssRules)\n .map((r) => r.cssText)\n .join('\\n'),\n );\n } catch {\n /* cross-origin */\n }\n }\n }\n } catch {\n /* ignore */\n }\n return chunks.join('\\n');\n}\n"],"mappings":";;;;AAqGA,SAAS,QAAQ,OAAuB;CACtC,OAAO,QAAQ,OAAO,IAAI,QAAQ,KAAA,CAAM,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;AACpE;AAEA,SAAS,WAAW,KAAqB;CACvC,QAAQ,IAAI,MAAM,YAAY,KAAK,CAAC,EAAA,CAAG;AACzC;AAEA,SAAS,iBAAiB,SAAqC;CAE7D,OAAO,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AAC9D;AAcA,SAAS,cAAyB;CAChC,OAAO,OAAO,aAAa,cAAc,OAAO;AAClD;AAEA,IAAI,cAAc;AAGlB,SAAS,UAAU,KAAoB;CACrC,IAAI,OAAO,aAAa;CACxB,cAAc;CACd,QAAQ,KACN,4IAEF;AACF;AAWA,SAAS,YACP,OAAkB,YAAY,GACJ;CAC1B,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,YAAY;CAEZ,OAAO,SAAS,SAAS,eAAe,YAAY,IAAI;AAC1D;AAEA,SAAS,oBAAoB,OAAkB,YAAY,GAAa;CACtE,IAAI,CAAC,MAAM,OAAO,CAAC;CACnB,MAAM,0BAAU,IAAI,IAAY;CAChC,MAAM,WAAY,KAAkB,mBAAmB,SAAS,KAAK,CAAC;CACtE,MAAM,aAAa,gBAAgB,cAAc,CAAC;CAClD,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,YAAY,QAAQ,aAAa,OAAO;EAC9C,IAAI,CAAC,WAAW;EAChB,KAAK,MAAM,aAAa,UAAU,MAAM,KAAK,GAC3C,IAAI,WA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