@tenphi/tasty 0.0.0-snapshot.d5c5a10 → 0.0.0-snapshot.d656d18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +197 -141
- package/dist/babel-_RVkw0iE.d.ts +83 -0
- package/dist/{ssr/async-storage.js → chunks/async-storage-DKK-wTD4.js} +17 -8
- package/dist/chunks/async-storage-DKK-wTD4.js.map +1 -0
- package/dist/chunks/collector-DBGcmUEq.js +326 -0
- package/dist/chunks/collector-DBGcmUEq.js.map +1 -0
- package/dist/chunks/css-resources-Cyl_axbI.js +149 -0
- package/dist/chunks/css-resources-Cyl_axbI.js.map +1 -0
- package/dist/{zero/extractor.js → chunks/css-writer-PFzrSPeu.js} +149 -26
- package/dist/chunks/css-writer-PFzrSPeu.js.map +1 -0
- package/dist/{debug.js → chunks/debug-BUwqo6vC.js} +193 -65
- package/dist/chunks/debug-BUwqo6vC.js.map +1 -0
- package/dist/chunks/dsl-CXvoaLnj.js +2097 -0
- package/dist/chunks/dsl-CXvoaLnj.js.map +1 -0
- package/dist/chunks/hydrate-6YoHZP6A.js +37 -0
- package/dist/chunks/hydrate-6YoHZP6A.js.map +1 -0
- package/dist/chunks/react-runtime-B3CmvDEQ.js +1525 -0
- package/dist/chunks/react-runtime-B3CmvDEQ.js.map +1 -0
- package/dist/chunks/runtime-engine-Y00VWjrS.js +4719 -0
- package/dist/chunks/runtime-engine-Y00VWjrS.js.map +1 -0
- package/dist/{utils/merge-styles.js → chunks/shared-utils-OIg0N_dp.js} +43 -6
- package/dist/chunks/shared-utils-OIg0N_dp.js.map +1 -0
- package/dist/chunks/style-engine-CqSmIlud.js +7196 -0
- package/dist/chunks/style-engine-CqSmIlud.js.map +1 -0
- package/dist/collector-CVdVIy7s.d.ts +163 -0
- package/dist/config-BI0y21JV.d.ts +1367 -0
- package/dist/core/index.d.ts +5 -34
- package/dist/core/index.js +7 -27
- package/dist/index-BzAC3p06.d.ts +1616 -0
- package/dist/index-CrT0bsiI.d.ts +1980 -0
- package/dist/index.d.ts +5 -51
- package/dist/index.js +8 -36
- package/dist/{utils/merge-styles.d.ts → merge-styles-BFktNP8J.d.ts} +3 -3
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +19 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +18 -0
- package/dist/ssr/astro-middleware-static.js +18 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +19 -0
- package/dist/ssr/astro-middleware.js +19 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +117 -11
- package/dist/ssr/astro.js +268 -33
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/index.d.ts +37 -5
- package/dist/ssr/index.js +7 -9
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +66 -0
- package/dist/ssr/next-config.js +115 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +14 -7
- package/dist/ssr/next.js +39 -20
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +91 -5
- package/dist/static/index.js +49 -4
- package/dist/static/index.js.map +1 -0
- package/dist/static/inject.d.ts +5 -0
- package/dist/static/inject.js +17 -0
- package/dist/static/inject.js.map +1 -0
- package/dist/zero/babel.d.ts +2 -167
- package/dist/zero/babel.js +160 -57
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +81 -3
- package/dist/zero/index.js +2 -4
- package/dist/zero/next.d.ts +13 -1
- package/dist/zero/next.js +6 -5
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +20 -12
- package/docs/adoption.md +59 -32
- package/docs/ai-agents.md +229 -0
- package/docs/comparison.md +76 -48
- package/docs/configuration.md +566 -69
- package/docs/debug.md +37 -23
- package/docs/design-system.md +63 -32
- package/docs/dsl.md +527 -180
- package/docs/getting-started.md +62 -41
- package/docs/injector.md +157 -51
- package/docs/methodology.md +116 -35
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +741 -0
- package/docs/plugins.md +353 -0
- package/docs/react-api.md +681 -0
- package/docs/runtime-benchmarks.md +351 -0
- package/docs/ssr.md +356 -130
- package/docs/styles.md +127 -26
- package/docs/tasty-static.md +219 -70
- package/package.json +108 -23
- package/tasty.config.ts +6 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -8
- package/dist/chunks/cacheKey.js +0 -78
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -259
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/renderChunk.js +0 -60
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/config.d.ts +0 -366
- package/dist/config.js +0 -504
- package/dist/config.js.map +0 -1
- package/dist/counter-style/index.js +0 -51
- package/dist/counter-style/index.js.map +0 -1
- package/dist/debug.d.ts +0 -89
- package/dist/debug.js.map +0 -1
- package/dist/font-face/index.js +0 -63
- package/dist/font-face/index.js.map +0 -1
- package/dist/hooks/resolve-ssr-collector.js +0 -15
- package/dist/hooks/resolve-ssr-collector.js.map +0 -1
- package/dist/hooks/useCounterStyle.d.ts +0 -50
- package/dist/hooks/useCounterStyle.js +0 -47
- package/dist/hooks/useCounterStyle.js.map +0 -1
- package/dist/hooks/useFontFace.d.ts +0 -43
- package/dist/hooks/useFontFace.js +0 -71
- package/dist/hooks/useFontFace.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -30
- package/dist/hooks/useGlobalStyles.js +0 -79
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -56
- package/dist/hooks/useKeyframes.js +0 -65
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -79
- package/dist/hooks/useProperty.js +0 -110
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -53
- package/dist/hooks/useRawCSS.js +0 -36
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -45
- package/dist/hooks/useStyles.js +0 -270
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -183
- package/dist/injector/index.js +0 -180
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -166
- package/dist/injector/injector.js +0 -465
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -136
- package/dist/injector/sheet-manager.js +0 -731
- package/dist/injector/sheet-manager.js.map +0 -1
- package/dist/injector/types.d.ts +0 -204
- package/dist/keyframes/index.js +0 -206
- package/dist/keyframes/index.js.map +0 -1
- package/dist/parser/classify.js +0 -320
- package/dist/parser/classify.js.map +0 -1
- package/dist/parser/const.js +0 -33
- package/dist/parser/const.js.map +0 -1
- package/dist/parser/lru.js +0 -109
- package/dist/parser/lru.js.map +0 -1
- package/dist/parser/parser.d.ts +0 -25
- package/dist/parser/parser.js +0 -116
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/tokenizer.js +0 -69
- package/dist/parser/tokenizer.js.map +0 -1
- package/dist/parser/types.d.ts +0 -51
- package/dist/parser/types.js +0 -46
- package/dist/parser/types.js.map +0 -1
- package/dist/pipeline/conditions.d.ts +0 -134
- package/dist/pipeline/conditions.js +0 -406
- package/dist/pipeline/conditions.js.map +0 -1
- package/dist/pipeline/exclusive.js +0 -231
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -53
- package/dist/pipeline/index.js +0 -699
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1105
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -447
- package/dist/pipeline/parseStateKey.js.map +0 -1
- package/dist/pipeline/simplify.js +0 -516
- package/dist/pipeline/simplify.js.map +0 -1
- package/dist/pipeline/warnings.js +0 -18
- package/dist/pipeline/warnings.js.map +0 -1
- package/dist/plugins/okhsl-plugin.d.ts +0 -35
- package/dist/plugins/okhsl-plugin.js +0 -98
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -76
- package/dist/properties/index.js +0 -223
- package/dist/properties/index.js.map +0 -1
- package/dist/properties/property-type-resolver.d.ts +0 -24
- package/dist/properties/property-type-resolver.js +0 -91
- package/dist/properties/property-type-resolver.js.map +0 -1
- package/dist/ssr/async-storage.d.ts +0 -17
- package/dist/ssr/async-storage.js.map +0 -1
- package/dist/ssr/collect-auto-properties.js +0 -40
- package/dist/ssr/collect-auto-properties.js.map +0 -1
- package/dist/ssr/collector.d.ts +0 -102
- package/dist/ssr/collector.js +0 -227
- package/dist/ssr/collector.js.map +0 -1
- package/dist/ssr/context.d.ts +0 -8
- package/dist/ssr/context.js +0 -14
- package/dist/ssr/context.js.map +0 -1
- package/dist/ssr/format-global-rules.js +0 -22
- package/dist/ssr/format-global-rules.js.map +0 -1
- package/dist/ssr/format-keyframes.js +0 -70
- package/dist/ssr/format-keyframes.js.map +0 -1
- package/dist/ssr/format-property.js +0 -50
- package/dist/ssr/format-property.js.map +0 -1
- package/dist/ssr/format-rules.js +0 -70
- package/dist/ssr/format-rules.js.map +0 -1
- package/dist/ssr/hydrate.d.ts +0 -22
- package/dist/ssr/hydrate.js +0 -50
- package/dist/ssr/hydrate.js.map +0 -1
- package/dist/ssr/ssr-collector-ref.js +0 -12
- package/dist/ssr/ssr-collector-ref.js.map +0 -1
- package/dist/states/index.d.ts +0 -49
- package/dist/states/index.js +0 -171
- package/dist/states/index.js.map +0 -1
- package/dist/static/tastyStatic.d.ts +0 -46
- package/dist/static/tastyStatic.js +0 -31
- package/dist/static/tastyStatic.js.map +0 -1
- package/dist/static/types.d.ts +0 -49
- package/dist/static/types.js +0 -24
- package/dist/static/types.js.map +0 -1
- package/dist/styles/align.d.ts +0 -15
- package/dist/styles/align.js +0 -14
- package/dist/styles/align.js.map +0 -1
- package/dist/styles/border.d.ts +0 -25
- package/dist/styles/border.js +0 -114
- package/dist/styles/border.js.map +0 -1
- package/dist/styles/color.d.ts +0 -14
- package/dist/styles/color.js +0 -27
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/createStyle.js +0 -80
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -97
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/display.d.ts +0 -37
- package/dist/styles/display.js +0 -67
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -58
- package/dist/styles/fade.js.map +0 -1
- package/dist/styles/fill.d.ts +0 -42
- package/dist/styles/fill.js +0 -52
- package/dist/styles/fill.js.map +0 -1
- package/dist/styles/flow.d.ts +0 -16
- package/dist/styles/flow.js +0 -12
- package/dist/styles/flow.js.map +0 -1
- package/dist/styles/gap.d.ts +0 -31
- package/dist/styles/gap.js +0 -37
- package/dist/styles/gap.js.map +0 -1
- package/dist/styles/height.d.ts +0 -17
- package/dist/styles/height.js +0 -20
- package/dist/styles/height.js.map +0 -1
- package/dist/styles/index.d.ts +0 -2
- package/dist/styles/index.js +0 -9
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/inset.d.ts +0 -52
- package/dist/styles/inset.js +0 -150
- package/dist/styles/inset.js.map +0 -1
- package/dist/styles/justify.d.ts +0 -15
- package/dist/styles/justify.js +0 -14
- package/dist/styles/justify.js.map +0 -1
- package/dist/styles/list.d.ts +0 -16
- package/dist/styles/list.js +0 -98
- package/dist/styles/list.js.map +0 -1
- package/dist/styles/margin.d.ts +0 -24
- package/dist/styles/margin.js +0 -104
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -65
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -104
- package/dist/styles/padding.js.map +0 -1
- package/dist/styles/predefined.d.ts +0 -71
- package/dist/styles/predefined.js +0 -238
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -47
- package/dist/styles/preset.js +0 -112
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -14
- package/dist/styles/radius.js +0 -51
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -25
- package/dist/styles/scrollbar.js +0 -48
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -24
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -158
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/types.d.ts +0 -545
- package/dist/styles/width.d.ts +0 -17
- package/dist/styles/width.js +0 -20
- package/dist/styles/width.js.map +0 -1
- package/dist/tasty.d.ts +0 -119
- package/dist/tasty.js +0 -232
- package/dist/tasty.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -22
- package/dist/utils/cache-wrapper.js.map +0 -1
- package/dist/utils/case-converter.js +0 -8
- package/dist/utils/case-converter.js.map +0 -1
- package/dist/utils/color-math.d.ts +0 -46
- package/dist/utils/color-math.js +0 -749
- package/dist/utils/color-math.js.map +0 -1
- package/dist/utils/color-space.d.ts +0 -5
- package/dist/utils/color-space.js +0 -229
- package/dist/utils/color-space.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -11
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/css-types.d.ts +0 -7
- package/dist/utils/dotize.d.ts +0 -26
- package/dist/utils/dotize.js +0 -122
- package/dist/utils/dotize.js.map +0 -1
- package/dist/utils/filter-base-props.d.ts +0 -15
- package/dist/utils/filter-base-props.js +0 -45
- package/dist/utils/filter-base-props.js.map +0 -1
- package/dist/utils/get-display-name.d.ts +0 -7
- package/dist/utils/get-display-name.js +0 -10
- package/dist/utils/get-display-name.js.map +0 -1
- package/dist/utils/has-keys.js +0 -13
- package/dist/utils/has-keys.js.map +0 -1
- package/dist/utils/is-dev-env.js +0 -19
- package/dist/utils/is-dev-env.js.map +0 -1
- package/dist/utils/is-valid-element-type.js +0 -15
- package/dist/utils/is-valid-element-type.js.map +0 -1
- package/dist/utils/merge-styles.js.map +0 -1
- package/dist/utils/mod-attrs.d.ts +0 -8
- package/dist/utils/mod-attrs.js +0 -21
- package/dist/utils/mod-attrs.js.map +0 -1
- package/dist/utils/process-tokens.d.ts +0 -21
- package/dist/utils/process-tokens.js +0 -91
- package/dist/utils/process-tokens.js.map +0 -1
- package/dist/utils/resolve-recipes.d.ts +0 -17
- package/dist/utils/resolve-recipes.js +0 -147
- package/dist/utils/resolve-recipes.js.map +0 -1
- package/dist/utils/selector-transform.js +0 -32
- package/dist/utils/selector-transform.js.map +0 -1
- package/dist/utils/string.js +0 -8
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/styles.d.ts +0 -100
- package/dist/utils/styles.js +0 -222
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -47
- package/dist/utils/typography.js +0 -43
- package/dist/utils/typography.js.map +0 -1
- package/dist/utils/warnings.d.ts +0 -16
- package/dist/utils/warnings.js +0 -16
- package/dist/utils/warnings.js.map +0 -1
- package/dist/zero/css-writer.d.ts +0 -45
- package/dist/zero/css-writer.js +0 -74
- package/dist/zero/css-writer.js.map +0 -1
- package/dist/zero/extractor.d.ts +0 -24
- package/dist/zero/extractor.js.map +0 -1
- package/docs/PIPELINE.md +0 -519
- package/docs/runtime.md +0 -485
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CHUNK_NAMES } from "./
|
|
3
|
-
import { getCssTextForNode, injector } from "./injector/index.js";
|
|
4
|
-
|
|
1
|
+
import { $ as getNamePrefix, Dt as tastyClassRegex, O as getCSSTextForNode, P as injector, vt as flushStyles } from "./runtime-engine-Y00VWjrS.js";
|
|
2
|
+
import { P as CHUNK_NAMES } from "./style-engine-CqSmIlud.js";
|
|
5
3
|
//#region src/debug.ts
|
|
6
4
|
function fmtSize(bytes) {
|
|
7
5
|
return bytes > 1024 ? `${(bytes / 1024).toFixed(1)}KB` : `${bytes}B`;
|
|
@@ -10,28 +8,97 @@ function countRules(css) {
|
|
|
10
8
|
return (css.match(/\{[^}]*\}/g) || []).length;
|
|
11
9
|
}
|
|
12
10
|
function sortTastyClasses(classes) {
|
|
13
|
-
return Array.from(classes).sort((a, b) =>
|
|
11
|
+
return Array.from(classes).sort((a, b) => a.localeCompare(b));
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
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
|
+
function defaultRoot() {
|
|
23
|
+
return typeof document === "undefined" ? null : document;
|
|
17
24
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
let warnedNoDom = false;
|
|
26
|
+
/** Say once why the numbers are empty. Silent under `{ raw: true }`. */
|
|
27
|
+
function warnNoDom(raw) {
|
|
28
|
+
if (raw || warnedNoDom) return;
|
|
29
|
+
warnedNoDom = true;
|
|
30
|
+
console.warn("[Tasty] tastyDebug reads the DOM and this environment has none, so the result is empty. During SSR, read the ServerStyleCollector instead.");
|
|
31
|
+
}
|
|
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
|
+
function getRegistry(root = defaultRoot()) {
|
|
42
|
+
if (!root) return void 0;
|
|
43
|
+
flushStyles();
|
|
44
|
+
return injector.instance._sheetManager?.getRegistry(root);
|
|
24
45
|
}
|
|
25
|
-
function findDomTastyClasses(root =
|
|
46
|
+
function findDomTastyClasses(root = defaultRoot()) {
|
|
47
|
+
if (!root) return [];
|
|
26
48
|
const classes = /* @__PURE__ */ new Set();
|
|
27
|
-
|
|
49
|
+
const elements = root.querySelectorAll?.("[class]") || [];
|
|
50
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
51
|
+
elements.forEach((el) => {
|
|
28
52
|
const attr = el.getAttribute("class");
|
|
29
53
|
if (attr) {
|
|
30
|
-
for (const cls of attr.split(/\s+/)) if (
|
|
54
|
+
for (const cls of attr.split(/\s+/)) if (classRegex.test(cls)) classes.add(cls);
|
|
31
55
|
}
|
|
32
56
|
});
|
|
33
57
|
return sortTastyClasses(classes);
|
|
34
58
|
}
|
|
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
|
+
function getAllCSS(root = defaultRoot()) {
|
|
65
|
+
const registry = getRegistry(root);
|
|
66
|
+
const sheetManager = injector.instance._sheetManager;
|
|
67
|
+
if (!root || !registry || !sheetManager) return "";
|
|
68
|
+
return sheetManager.getOwnedCSSInOrder(registry, root).join("\n");
|
|
69
|
+
}
|
|
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
|
+
function cssTextForClasses(classNames, root) {
|
|
75
|
+
if (!root) return "";
|
|
76
|
+
return injector.instance.getCSSTextForClasses(classNames, { root });
|
|
77
|
+
}
|
|
78
|
+
function getInjectorMetrics(root) {
|
|
79
|
+
if (!root) return null;
|
|
80
|
+
return injector.instance.getMetrics({ root });
|
|
81
|
+
}
|
|
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
|
+
function getUnusedClasses(root = defaultRoot()) {
|
|
91
|
+
if (!root) return [];
|
|
92
|
+
return sortTastyClasses(injector.instance.getUnusedClasses({ root }));
|
|
93
|
+
}
|
|
94
|
+
/** Every class this injector holds CSS for in `root`. */
|
|
95
|
+
function getOwnedClasses(root = defaultRoot()) {
|
|
96
|
+
const registry = getRegistry(root);
|
|
97
|
+
if (!registry) return [];
|
|
98
|
+
const owned = [];
|
|
99
|
+
for (const [className, info] of registry.rules) if (info.sheetIndex >= 0) owned.push(className);
|
|
100
|
+
return sortTastyClasses(owned);
|
|
101
|
+
}
|
|
35
102
|
function prettifyCSS(css) {
|
|
36
103
|
if (!css || !css.trim()) return "";
|
|
37
104
|
const out = [];
|
|
@@ -92,15 +159,15 @@ function extractChunkName(cacheKey) {
|
|
|
92
159
|
}
|
|
93
160
|
return null;
|
|
94
161
|
}
|
|
95
|
-
function getChunkForClass(className, root =
|
|
162
|
+
function getChunkForClass(className, root = defaultRoot()) {
|
|
96
163
|
const registry = getRegistry(root);
|
|
97
164
|
if (!registry) return null;
|
|
98
165
|
for (const [key, cn] of registry.cacheKeyToClassName) if (cn === className) return extractChunkName(key);
|
|
99
166
|
return null;
|
|
100
167
|
}
|
|
101
|
-
function buildChunkBreakdown(root =
|
|
168
|
+
function buildChunkBreakdown(root = defaultRoot()) {
|
|
102
169
|
const registry = getRegistry(root);
|
|
103
|
-
if (!registry) return {
|
|
170
|
+
if (!root || !registry) return {
|
|
104
171
|
byChunk: {},
|
|
105
172
|
totalChunkTypes: 0,
|
|
106
173
|
totalClasses: 0
|
|
@@ -114,7 +181,7 @@ function buildChunkBreakdown(root = document) {
|
|
|
114
181
|
ruleCount: 0
|
|
115
182
|
};
|
|
116
183
|
byChunk[chunk].classes.push(className);
|
|
117
|
-
const css = injector.instance.
|
|
184
|
+
const css = injector.instance.getCSSTextForClasses([className], { root });
|
|
118
185
|
byChunk[chunk].cssSize += css.length;
|
|
119
186
|
byChunk[chunk].ruleCount += countRules(css);
|
|
120
187
|
}
|
|
@@ -126,18 +193,41 @@ function buildChunkBreakdown(root = document) {
|
|
|
126
193
|
totalClasses
|
|
127
194
|
};
|
|
128
195
|
}
|
|
129
|
-
|
|
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
|
+
const GLOBAL_RULE_PREFIXES = {
|
|
202
|
+
global: "global:",
|
|
203
|
+
property: "property:",
|
|
204
|
+
fontFace: "fontface:",
|
|
205
|
+
counterStyle: "counterstyle:",
|
|
206
|
+
function: "function:"
|
|
207
|
+
};
|
|
208
|
+
function getGlobalTypeCSS(type, root = defaultRoot()) {
|
|
130
209
|
const registry = getRegistry(root);
|
|
131
|
-
if (!registry) return {
|
|
210
|
+
if (!root || !registry) return {
|
|
132
211
|
css: "",
|
|
133
212
|
ruleCount: 0,
|
|
134
213
|
size: 0
|
|
135
214
|
};
|
|
136
215
|
const chunks = [];
|
|
137
216
|
let rc = 0;
|
|
217
|
+
if (type === "raw") {
|
|
218
|
+
const css = injector.instance.getRawCSSText({ root });
|
|
219
|
+
const sheetManager = injector.instance._sheetManager;
|
|
220
|
+
return {
|
|
221
|
+
css: prettifyCSS(css),
|
|
222
|
+
ruleCount: sheetManager?.getRawRuleCount(root) ?? 0,
|
|
223
|
+
size: css.length
|
|
224
|
+
};
|
|
225
|
+
}
|
|
138
226
|
if (type === "keyframes") for (const [, entry] of registry.keyframesCache) {
|
|
139
227
|
const info = entry.info;
|
|
140
|
-
const
|
|
228
|
+
const sheetInfo = registry.sheets[info.sheetIndex];
|
|
229
|
+
const sm = injector.instance._sheetManager;
|
|
230
|
+
const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;
|
|
141
231
|
if (ss && info.ruleIndex < ss.cssRules.length) {
|
|
142
232
|
const rule = ss.cssRules[info.ruleIndex];
|
|
143
233
|
if (rule) {
|
|
@@ -150,10 +240,12 @@ function getGlobalTypeCSS(type, root = document) {
|
|
|
150
240
|
}
|
|
151
241
|
}
|
|
152
242
|
else {
|
|
153
|
-
const prefix = type
|
|
243
|
+
const prefix = GLOBAL_RULE_PREFIXES[type];
|
|
154
244
|
for (const [key, ri] of registry.globalRules) {
|
|
155
245
|
if (!key.startsWith(prefix)) continue;
|
|
156
|
-
const
|
|
246
|
+
const sheetInfo = registry.sheets[ri.sheetIndex];
|
|
247
|
+
const sm = injector.instance._sheetManager;
|
|
248
|
+
const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;
|
|
157
249
|
if (ss) {
|
|
158
250
|
const start = Math.max(0, ri.ruleIndex);
|
|
159
251
|
const end = Math.min(ss.cssRules.length - 1, ri.endRuleIndex ?? ri.ruleIndex);
|
|
@@ -177,7 +269,7 @@ function getGlobalTypeCSS(type, root = document) {
|
|
|
177
269
|
size: raw.length
|
|
178
270
|
};
|
|
179
271
|
}
|
|
180
|
-
function getSourceCssForClasses(classNames, root =
|
|
272
|
+
function getSourceCssForClasses(classNames, root = defaultRoot()) {
|
|
181
273
|
const registry = getRegistry(root);
|
|
182
274
|
if (!registry) return null;
|
|
183
275
|
const chunks = [];
|
|
@@ -191,7 +283,7 @@ function getSourceCssForClasses(classNames, root = document) {
|
|
|
191
283
|
}
|
|
192
284
|
return found ? chunks.join("\n") : null;
|
|
193
285
|
}
|
|
194
|
-
function getDefs(root =
|
|
286
|
+
function getDefs(root = defaultRoot()) {
|
|
195
287
|
const registry = getRegistry(root);
|
|
196
288
|
let properties = [];
|
|
197
289
|
if (registry?.injectedProperties) properties = Array.from(registry.injectedProperties.keys()).sort();
|
|
@@ -221,40 +313,45 @@ const CHUNK_ORDER = [
|
|
|
221
313
|
];
|
|
222
314
|
const tastyDebug = {
|
|
223
315
|
css(target, opts) {
|
|
224
|
-
const { root =
|
|
316
|
+
const { root = defaultRoot(), prettify = true, raw = false, source = false } = opts || {};
|
|
317
|
+
if (!root) {
|
|
318
|
+
warnNoDom(raw);
|
|
319
|
+
return "";
|
|
320
|
+
}
|
|
225
321
|
let css = "";
|
|
226
|
-
|
|
322
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
323
|
+
if (source && typeof target === "string" && classRegex.test(target)) {
|
|
227
324
|
const src = getSourceCssForClasses([target], root);
|
|
228
325
|
if (src) css = src;
|
|
229
326
|
else {
|
|
230
|
-
if (!raw) console.warn("
|
|
231
|
-
css = injector.instance.
|
|
327
|
+
if (!raw) console.warn("[Tasty] source CSS not available (requires dev mode or TASTY_DEBUG=true). Falling back to live CSSOM.");
|
|
328
|
+
css = injector.instance.getCSSTextForClasses([target], { root });
|
|
232
329
|
}
|
|
233
330
|
} else if (source && Array.isArray(target)) {
|
|
234
331
|
const src = getSourceCssForClasses(target, root);
|
|
235
332
|
if (src) css = src;
|
|
236
333
|
else {
|
|
237
|
-
if (!raw) console.warn("
|
|
238
|
-
css = injector.instance.
|
|
334
|
+
if (!raw) console.warn("[Tasty] source CSS not available. Falling back to live CSSOM.");
|
|
335
|
+
css = injector.instance.getCSSTextForClasses(target, { root });
|
|
239
336
|
}
|
|
240
|
-
} else if (typeof target === "string") if (target === "all") css =
|
|
337
|
+
} else if (typeof target === "string") if (target === "all") css = getAllCSS(root);
|
|
241
338
|
else if (target === "global") {
|
|
242
339
|
css = getGlobalTypeCSS("global", root).css;
|
|
243
340
|
return css;
|
|
244
341
|
} else if (target === "active") {
|
|
245
342
|
const active = findDomTastyClasses(root);
|
|
246
|
-
css = injector.instance.
|
|
343
|
+
css = injector.instance.getCSSTextForClasses(active, { root });
|
|
247
344
|
} else if (target === "unused") {
|
|
248
345
|
const unused = getUnusedClasses(root);
|
|
249
|
-
css = injector.instance.
|
|
346
|
+
css = injector.instance.getCSSTextForClasses(unused, { root });
|
|
250
347
|
} else if (target === "page") css = getPageCSS(root);
|
|
251
|
-
else if (
|
|
348
|
+
else if (classRegex.test(target)) css = injector.instance.getCSSTextForClasses([target], { root });
|
|
252
349
|
else {
|
|
253
350
|
const el = root.querySelector?.(target);
|
|
254
|
-
if (el) css =
|
|
351
|
+
if (el) css = getCSSTextForNode(el, { root });
|
|
255
352
|
}
|
|
256
|
-
else if (Array.isArray(target)) css = injector.instance.
|
|
257
|
-
else if (target instanceof Element) css =
|
|
353
|
+
else if (Array.isArray(target)) css = injector.instance.getCSSTextForClasses(target, { root });
|
|
354
|
+
else if (target instanceof Element) css = getCSSTextForNode(target, { root });
|
|
258
355
|
const result = prettify ? prettifyCSS(css) : css;
|
|
259
356
|
if (!raw) {
|
|
260
357
|
const label = Array.isArray(target) ? `[${target.join(", ")}]` : target;
|
|
@@ -266,8 +363,9 @@ const tastyDebug = {
|
|
|
266
363
|
return result;
|
|
267
364
|
},
|
|
268
365
|
inspect(target, opts) {
|
|
269
|
-
const { root =
|
|
270
|
-
const element = typeof target === "string" ? root.querySelector?.(target) : target;
|
|
366
|
+
const { root = defaultRoot(), raw = false } = opts || {};
|
|
367
|
+
const element = !root ? null : typeof target === "string" ? root.querySelector?.(target) : target;
|
|
368
|
+
if (!root) warnNoDom(raw);
|
|
271
369
|
if (!element) {
|
|
272
370
|
const empty = {
|
|
273
371
|
element: null,
|
|
@@ -277,15 +375,17 @@ const tastyDebug = {
|
|
|
277
375
|
size: 0,
|
|
278
376
|
rules: 0
|
|
279
377
|
};
|
|
280
|
-
if (!raw) console.warn("
|
|
378
|
+
if (!raw && root) console.warn("[Tasty] debug.inspect: element not found");
|
|
281
379
|
return empty;
|
|
282
380
|
}
|
|
283
|
-
const
|
|
381
|
+
const classList = element.getAttribute("class") || "";
|
|
382
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
383
|
+
const tastyClasses = classList.split(/\s+/).filter((cls) => classRegex.test(cls));
|
|
284
384
|
const chunks = tastyClasses.map((className) => ({
|
|
285
385
|
className,
|
|
286
386
|
chunkName: getChunkForClass(className, root)
|
|
287
387
|
}));
|
|
288
|
-
const css =
|
|
388
|
+
const css = getCSSTextForNode(element, { root: root ?? void 0 });
|
|
289
389
|
const rules = countRules(css);
|
|
290
390
|
const result = {
|
|
291
391
|
element,
|
|
@@ -308,37 +408,60 @@ const tastyDebug = {
|
|
|
308
408
|
return result;
|
|
309
409
|
},
|
|
310
410
|
summary(opts) {
|
|
311
|
-
const { root =
|
|
411
|
+
const { root = defaultRoot(), raw = false } = opts || {};
|
|
412
|
+
if (!root) warnNoDom(raw);
|
|
312
413
|
const activeClasses = findDomTastyClasses(root);
|
|
313
414
|
const unusedClasses = getUnusedClasses(root);
|
|
314
|
-
const
|
|
315
|
-
const
|
|
316
|
-
const
|
|
317
|
-
const
|
|
415
|
+
const ownedClasses = getOwnedClasses(root);
|
|
416
|
+
const totalStyledClasses = sortTastyClasses(new Set([...activeClasses, ...ownedClasses]));
|
|
417
|
+
const unusedSet = new Set(unusedClasses);
|
|
418
|
+
const activeSet = new Set(activeClasses);
|
|
419
|
+
const hotClasses = ownedClasses.filter((className) => !activeSet.has(className) && !unusedSet.has(className));
|
|
420
|
+
const hotCSS = cssTextForClasses(hotClasses, root);
|
|
421
|
+
const activeCSS = cssTextForClasses(activeClasses, root);
|
|
422
|
+
const unusedCSS = cssTextForClasses(unusedClasses, root);
|
|
423
|
+
const allCSS = getAllCSS(root);
|
|
318
424
|
const activeRuleCount = countRules(activeCSS);
|
|
319
425
|
const unusedRuleCount = countRules(unusedCSS);
|
|
320
426
|
const globalData = getGlobalTypeCSS("global", root);
|
|
321
427
|
const rawData = getGlobalTypeCSS("raw", root);
|
|
322
428
|
const kfData = getGlobalTypeCSS("keyframes", root);
|
|
323
429
|
const propData = getGlobalTypeCSS("property", root);
|
|
324
|
-
const
|
|
325
|
-
|
|
430
|
+
const atRuleData = [
|
|
431
|
+
"fontFace",
|
|
432
|
+
"counterStyle",
|
|
433
|
+
"function"
|
|
434
|
+
].reduce((all, type) => {
|
|
435
|
+
const data = getGlobalTypeCSS(type, root);
|
|
436
|
+
return {
|
|
437
|
+
css: data.css ? `${all.css}\n${data.css}`.trim() : all.css,
|
|
438
|
+
ruleCount: all.ruleCount + data.ruleCount,
|
|
439
|
+
size: all.size + data.size
|
|
440
|
+
};
|
|
441
|
+
}, {
|
|
442
|
+
css: "",
|
|
443
|
+
ruleCount: 0,
|
|
444
|
+
size: 0
|
|
445
|
+
});
|
|
446
|
+
const totalRuleCount = activeRuleCount + unusedRuleCount + countRules(hotCSS) + globalData.ruleCount + atRuleData.ruleCount + rawData.ruleCount + kfData.ruleCount + propData.ruleCount;
|
|
447
|
+
const metrics = getInjectorMetrics(root);
|
|
326
448
|
const defs = getDefs(root);
|
|
327
449
|
const chunkBreakdown = buildChunkBreakdown(root);
|
|
328
450
|
const summary = {
|
|
329
451
|
activeClasses,
|
|
330
452
|
unusedClasses,
|
|
453
|
+
hotClasses,
|
|
331
454
|
totalStyledClasses,
|
|
332
455
|
activeCSSSize: activeCSS.length,
|
|
333
456
|
unusedCSSSize: unusedCSS.length,
|
|
334
|
-
globalCSSSize: globalData.size,
|
|
457
|
+
globalCSSSize: globalData.size + atRuleData.size,
|
|
335
458
|
rawCSSSize: rawData.size,
|
|
336
459
|
keyframesCSSSize: kfData.size,
|
|
337
460
|
propertyCSSSize: propData.size,
|
|
338
461
|
totalCSSSize: allCSS.length,
|
|
339
462
|
activeRuleCount,
|
|
340
463
|
unusedRuleCount,
|
|
341
|
-
globalRuleCount: globalData.ruleCount,
|
|
464
|
+
globalRuleCount: globalData.ruleCount + atRuleData.ruleCount,
|
|
342
465
|
rawRuleCount: rawData.ruleCount,
|
|
343
466
|
keyframesRuleCount: kfData.ruleCount,
|
|
344
467
|
propertyRuleCount: propData.ruleCount,
|
|
@@ -352,7 +475,8 @@ const tastyDebug = {
|
|
|
352
475
|
console.group("Tasty Summary");
|
|
353
476
|
console.log(`Active: ${activeClasses.length} classes, ${activeRuleCount} rules, ${fmtSize(activeCSS.length)}`);
|
|
354
477
|
console.log(`Unused: ${unusedClasses.length} classes, ${unusedRuleCount} rules, ${fmtSize(unusedCSS.length)}`);
|
|
355
|
-
console.log(`
|
|
478
|
+
if (hotClasses.length) console.log(`Held: ${hotClasses.length} classes, ${countRules(hotCSS)} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`);
|
|
479
|
+
console.log(`Global: ${globalData.ruleCount + atRuleData.ruleCount} rules, ${fmtSize(globalData.size + atRuleData.size)}`);
|
|
356
480
|
if (rawData.ruleCount) console.log(`Raw: ${rawData.ruleCount} rules, ${fmtSize(rawData.size)}`);
|
|
357
481
|
if (kfData.ruleCount) console.log(`Keyframes: ${kfData.ruleCount} rules, ${fmtSize(kfData.size)}`);
|
|
358
482
|
if (propData.ruleCount) console.log(`@property: ${propData.ruleCount} rules, ${fmtSize(propData.size)}`);
|
|
@@ -377,7 +501,8 @@ const tastyDebug = {
|
|
|
377
501
|
return summary;
|
|
378
502
|
},
|
|
379
503
|
chunks(opts) {
|
|
380
|
-
const { root =
|
|
504
|
+
const { root = defaultRoot(), raw = false } = opts || {};
|
|
505
|
+
if (!root) warnNoDom(raw);
|
|
381
506
|
const breakdown = buildChunkBreakdown(root);
|
|
382
507
|
if (!raw) {
|
|
383
508
|
console.group(`Chunks (${breakdown.totalChunkTypes} types, ${breakdown.totalClasses} classes)`);
|
|
@@ -391,15 +516,16 @@ const tastyDebug = {
|
|
|
391
516
|
return breakdown;
|
|
392
517
|
},
|
|
393
518
|
cache(opts) {
|
|
394
|
-
const { root =
|
|
519
|
+
const { root = defaultRoot(), raw = false } = opts || {};
|
|
520
|
+
if (!root) warnNoDom(raw);
|
|
395
521
|
const active = findDomTastyClasses(root);
|
|
396
522
|
const unused = getUnusedClasses(root);
|
|
397
|
-
const metrics =
|
|
523
|
+
const metrics = getInjectorMetrics(root);
|
|
398
524
|
const status = {
|
|
399
525
|
classes: {
|
|
400
526
|
active,
|
|
401
527
|
unused,
|
|
402
|
-
all: [...active, ...
|
|
528
|
+
all: sortTastyClasses(new Set([...active, ...getOwnedClasses(root)]))
|
|
403
529
|
},
|
|
404
530
|
metrics
|
|
405
531
|
};
|
|
@@ -416,7 +542,9 @@ const tastyDebug = {
|
|
|
416
542
|
return status;
|
|
417
543
|
},
|
|
418
544
|
cleanup(opts) {
|
|
419
|
-
|
|
545
|
+
const root = opts?.root ?? defaultRoot();
|
|
546
|
+
if (!root) return;
|
|
547
|
+
injector.instance.cleanup(root);
|
|
420
548
|
},
|
|
421
549
|
help() {
|
|
422
550
|
console.log(`tastyDebug API:
|
|
@@ -438,7 +566,8 @@ Options: { raw: true } suppresses logging, { root: shadowRoot } targets Shadow D
|
|
|
438
566
|
}
|
|
439
567
|
}
|
|
440
568
|
};
|
|
441
|
-
function getPageCSS(root =
|
|
569
|
+
function getPageCSS(root = defaultRoot()) {
|
|
570
|
+
if (!root) return "";
|
|
442
571
|
const chunks = [];
|
|
443
572
|
try {
|
|
444
573
|
if ("styleSheets" in root) for (const sheet of Array.from(root.styleSheets)) try {
|
|
@@ -447,8 +576,7 @@ function getPageCSS(root = document) {
|
|
|
447
576
|
} catch {}
|
|
448
577
|
return chunks.join("\n");
|
|
449
578
|
}
|
|
450
|
-
if (typeof window !== "undefined" && isDevEnv()) tastyDebug.install();
|
|
451
|
-
|
|
452
579
|
//#endregion
|
|
453
|
-
export { tastyDebug };
|
|
454
|
-
|
|
580
|
+
export { tastyDebug as t };
|
|
581
|
+
|
|
582
|
+
//# sourceMappingURL=debug-BUwqo6vC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-BUwqo6vC.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 elements.forEach((el) => {\n const attr = el.getAttribute('class');\n if (attr) {\n for (const cls of attr.split(/\\s+/)) {\n if (classRegex.test(cls)) classes.add(cls);\n }\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 at-rules & comma selectors\n// ---------------------------------------------------------------------------\n\nfunction prettifyCSS(css: string): string {\n if (!css || !css.trim()) return '';\n\n const out: string[] = [];\n let depth = 0;\n const indent = () => ' '.repeat(depth);\n\n let normalized = css.replace(/\\s+/g, ' ').trim();\n // Ensure braces are surrounded by spaces for splitting\n normalized = normalized.replace(/\\s*\\{\\s*/g, ' { ');\n normalized = normalized.replace(/\\s*\\}\\s*/g, ' } ');\n normalized = normalized.replace(/;\\s*/g, '; ');\n\n const tokens = normalized.split(/\\s+/);\n let buf = '';\n\n for (const t of tokens) {\n if (t === '{') {\n // buf contains the selector / at-rule header\n const header = buf.trim();\n if (header) {\n // Split comma-separated selectors onto their own lines\n // but only if the comma is outside parentheses\n const parts = splitOutsideParens(header, ',');\n if (parts.length > 1) {\n out.push(\n parts\n .map((p, idx) =>\n idx === 0\n ? `${indent()}${p.trim()},`\n : `${indent()}${p.trim()}${idx < parts.length - 1 ? ',' : ''}`,\n )\n .join('\\n') + ' {',\n );\n } else {\n out.push(`${indent()}${header} {`);\n }\n } else {\n out.push(`${indent()}{`);\n }\n depth++;\n buf = '';\n } else if (t === '}') {\n // Flush any trailing declarations\n if (buf.trim()) {\n for (const decl of buf.split(';').filter((s) => s.trim())) {\n out.push(`${indent()}${decl.trim()};`);\n }\n buf = '';\n }\n depth = Math.max(0, depth - 1);\n out.push(`${indent()}}`);\n } else if (t.endsWith(';')) {\n buf += ` ${t}`;\n const full = buf.trim();\n if (full) out.push(`${indent()}${full}`);\n buf = '';\n } else {\n buf += ` ${t}`;\n }\n }\n if (buf.trim()) out.push(buf.trim());\n\n return out\n .filter((l) => l.trim())\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n}\n\n/** Split `str` by `sep` only when not inside parentheses */\nfunction splitOutsideParens(str: string, sep: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let start = 0;\n for (let i = 0; i < str.length; i++) {\n const ch = str[i];\n if (ch === '(') depth++;\n else if (ch === ')') depth--;\n else if (depth === 0 && str.startsWith(sep, i)) {\n parts.push(str.slice(start, i));\n start = i + sep.length;\n }\n }\n parts.push(str.slice(start));\n return parts;\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 if (!byChunk[chunk])\n byChunk[chunk] = { classes: [], cssSize: 0, ruleCount: 0 };\n byChunk[chunk].classes.push(className);\n const css = injector.instance.getCSSTextForClasses([className], { root });\n byChunk[chunk].cssSize += css.length;\n byChunk[chunk].ruleCount += countRules(css);\n }\n\n for (const entry of Object.values(byChunk)) {\n entry.classes = sortTastyClasses(entry.classes);\n }\n\n const totalClasses = Object.values(byChunk).reduce(\n (s, e) => s + e.classes.length,\n 0,\n );\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): { 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 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 const sheetManager = injector.instance._sheetManager;\n\n return {\n css: 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 sm = injector.instance._sheetManager;\n const ss = sheetInfo && sm ? sm.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 sm = injector.instance._sheetManager;\n const ss = sheetInfo && sm ? sm.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 { css: prettifyCSS(raw), ruleCount: rc, size: raw.length };\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\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 = injector.instance.getCSSTextForClasses([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 = injector.instance.getCSSTextForClasses(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 = injector.instance.getCSSTextForClasses(active, { root });\n } else if (target === 'unused') {\n const unused = getUnusedClasses(root);\n css = injector.instance.getCSSTextForClasses(unused, { root });\n } else if (target === 'page') {\n css = getPageCSS(root);\n } else if (classRegex.test(target)) {\n css = injector.instance.getCSSTextForClasses([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 = injector.instance.getCSSTextForClasses(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);\n const rawData = getGlobalTypeCSS('raw', root);\n const kfData = getGlobalTypeCSS('keyframes', root);\n const propData = getGlobalTypeCSS('property', root);\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 (all, type) => {\n const data = getGlobalTypeCSS(type, root);\n return {\n css: data.css ? `${all.css}\\n${data.css}`.trim() : all.css,\n ruleCount: all.ruleCount + data.ruleCount,\n size: all.size + data.size,\n };\n },\n { css: '', ruleCount: 0, size: 0 },\n );\n\n const totalRuleCount =\n activeRuleCount +\n unusedRuleCount +\n countRules(hotCSS) +\n globalData.ruleCount +\n atRuleData.ruleCount +\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: globalData.size + atRuleData.size,\n rawCSSSize: rawData.size,\n keyframesCSSSize: kfData.size,\n propertyCSSSize: propData.size,\n totalCSSSize: allCSS.length,\n activeRuleCount,\n unusedRuleCount,\n globalRuleCount: globalData.ruleCount + atRuleData.ruleCount,\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, ${countRules(hotCSS)} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`,\n );\n console.log(\n `Global: ${globalData.ruleCount + atRuleData.ruleCount} rules, ${fmtSize(globalData.size + atRuleData.size)}`,\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 for (const name of CHUNK_ORDER) {\n const d = chunkBreakdown.byChunk[name];\n if (d)\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n for (const [name, d] of Object.entries(chunkBreakdown.byChunk)) {\n if (!CHUNK_ORDER.includes(name as (typeof CHUNK_ORDER)[number]))\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\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 for (const name of CHUNK_ORDER) {\n const d = breakdown.byChunk[name];\n if (d)\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n for (const [name, d] of Object.entries(breakdown.byChunk)) {\n if (!CHUNK_ORDER.includes(name as (typeof CHUNK_ORDER)[number]))\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\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,Q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