@tenphi/tasty 0.0.0-snapshot.db103fd → 0.0.0-snapshot.db2ef70
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 +441 -362
- package/dist/babel-types-Dc5zghyE.d.ts +18 -0
- package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
- package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
- package/dist/chunks/build-config-D9Iq8QQm.js +60 -0
- package/dist/chunks/build-config-D9Iq8QQm.js.map +1 -0
- package/dist/chunks/collector-Cb8ah2JF.js +210 -0
- package/dist/chunks/collector-Cb8ah2JF.js.map +1 -0
- package/dist/chunks/config-engine-CMYFZYQh.js +272 -0
- package/dist/chunks/config-engine-CMYFZYQh.js.map +1 -0
- package/dist/chunks/config-file-DlZXJMj8.js +25 -0
- package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
- package/dist/chunks/css-definitions-B4aWBkH3.js +910 -0
- package/dist/chunks/css-definitions-B4aWBkH3.js.map +1 -0
- package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
- package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
- package/dist/{debug.js → chunks/debug-D2Pu7Xhy.js} +196 -147
- package/dist/chunks/debug-D2Pu7Xhy.js.map +1 -0
- package/dist/chunks/dsl-CsFl9LGn.js +1458 -0
- package/dist/chunks/dsl-CsFl9LGn.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-DHiopXCu.js +691 -0
- package/dist/chunks/react-runtime-DHiopXCu.js.map +1 -0
- package/dist/chunks/runtime-engine-NGCofNXy.js +2435 -0
- package/dist/chunks/runtime-engine-NGCofNXy.js.map +1 -0
- package/dist/chunks/runtime-state-lZjMbvwV.js +152 -0
- package/dist/chunks/runtime-state-lZjMbvwV.js.map +1 -0
- package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +60 -56
- package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
- package/dist/chunks/style-engine-DnkV_4Jg.js +5602 -0
- package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
- package/dist/chunks/zero-engine-DcwaCvFs.js +310 -0
- package/dist/chunks/zero-engine-DcwaCvFs.js.map +1 -0
- package/dist/collector-D2OT6I2G.d.ts +164 -0
- package/dist/config-C4ftFxgI.d.ts +1367 -0
- package/dist/core/index.d.ts +5 -33
- package/dist/core/index.js +9 -26
- package/dist/hydrate-CRyjjAyl.d.ts +22 -0
- package/dist/index-DxQNRj50.d.ts +1964 -0
- package/dist/index.d.ts +5 -50
- package/dist/index.js +11 -35
- package/dist/{utils/merge-styles.d.ts → merge-styles-D39qBtox.d.ts} +3 -4
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +6 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware-extract-static.d.ts +10 -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 +10 -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 +17 -0
- package/dist/ssr/astro-middleware-static.js +7 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +18 -0
- package/dist/ssr/astro-middleware.js +7 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +110 -12
- package/dist/ssr/astro.js +205 -48
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/client.d.ts +2 -0
- package/dist/ssr/client.js +2 -0
- package/dist/ssr/index.d.ts +17 -5
- package/dist/ssr/index.js +6 -7
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +64 -0
- package/dist/ssr/next-config.js +123 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +13 -12
- package/dist/ssr/next.js +38 -47
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +90 -5
- package/dist/static/index.js +31 -3
- package/dist/static/index.js.map +1 -0
- package/dist/static/inject.d.ts +1 -2
- package/dist/static/inject.js.map +1 -1
- package/dist/types-CYQIhUg1.d.ts +1569 -0
- package/dist/zero/babel.d.ts +12 -121
- package/dist/zero/babel.js +126 -149
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +136 -3
- package/dist/zero/index.js +25 -3
- package/dist/zero/index.js.map +1 -0
- package/dist/zero/next.d.ts +4 -5
- package/dist/zero/next.js +3 -38
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +23 -12
- package/docs/adoption.md +72 -37
- package/docs/ai-agents.md +259 -0
- package/docs/comparison.md +83 -54
- package/docs/configuration.md +712 -81
- package/docs/debug.md +39 -24
- package/docs/design-system.md +174 -41
- package/docs/dsl.md +733 -195
- package/docs/getting-started.md +132 -52
- package/docs/injector.md +197 -90
- package/docs/methodology.md +154 -48
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +768 -0
- package/docs/plugins.md +333 -0
- package/docs/react-api.md +746 -0
- package/docs/runtime-benchmarks.md +388 -0
- package/docs/ssr.md +403 -151
- package/docs/styles.md +248 -49
- package/docs/tasty-static.md +298 -118
- package/package.json +152 -40
- package/tasty.config.ts +7 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -7
- package/dist/chunks/cacheKey.d.ts +0 -1
- package/dist/chunks/cacheKey.js +0 -77
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -258
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/index.d.ts +0 -1
- package/dist/chunks/renderChunk.d.ts +0 -1
- package/dist/chunks/renderChunk.js +0 -59
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/config.d.ts +0 -366
- package/dist/config.js +0 -503
- 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/index.d.ts +0 -7
- package/dist/hooks/resolve-ssr-collector.js +0 -14
- package/dist/hooks/resolve-ssr-collector.js.map +0 -1
- package/dist/hooks/useCounterStyle.d.ts +0 -50
- package/dist/hooks/useCounterStyle.js +0 -46
- package/dist/hooks/useCounterStyle.js.map +0 -1
- package/dist/hooks/useFontFace.d.ts +0 -43
- package/dist/hooks/useFontFace.js +0 -70
- package/dist/hooks/useFontFace.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -30
- package/dist/hooks/useGlobalStyles.js +0 -78
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -56
- package/dist/hooks/useKeyframes.js +0 -64
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -79
- package/dist/hooks/useProperty.js +0 -109
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -53
- package/dist/hooks/useRawCSS.js +0 -35
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -45
- package/dist/hooks/useStyles.js +0 -237
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -183
- package/dist/injector/index.js +0 -179
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -166
- package/dist/injector/injector.js +0 -464
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -136
- package/dist/injector/sheet-manager.js +0 -733
- 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 -319
- package/dist/parser/classify.js.map +0 -1
- package/dist/parser/const.js +0 -49
- 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 -115
- 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 -230
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -55
- package/dist/pipeline/index.js +0 -708
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1103
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -446
- package/dist/pipeline/parseStateKey.js.map +0 -1
- package/dist/pipeline/simplify.js +0 -515
- 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/index.d.ts +0 -2
- package/dist/plugins/okhsl-plugin.d.ts +0 -35
- package/dist/plugins/okhsl-plugin.js +0 -97
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -76
- package/dist/properties/index.js +0 -222
- 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 -90
- 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 +0 -34
- package/dist/ssr/async-storage.js.map +0 -1
- package/dist/ssr/collect-auto-properties.js +0 -39
- package/dist/ssr/collect-auto-properties.js.map +0 -1
- package/dist/ssr/collector.d.ts +0 -102
- package/dist/ssr/collector.js +0 -226
- package/dist/ssr/collector.js.map +0 -1
- package/dist/ssr/context.d.ts +0 -8
- package/dist/ssr/context.js +0 -13
- 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 -69
- package/dist/ssr/format-keyframes.js.map +0 -1
- package/dist/ssr/format-property.js +0 -49
- package/dist/ssr/format-property.js.map +0 -1
- package/dist/ssr/format-rules.js +0 -73
- package/dist/ssr/format-rules.js.map +0 -1
- package/dist/ssr/hydrate.d.ts +0 -22
- package/dist/ssr/hydrate.js +0 -49
- 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 -170
- package/dist/states/index.js.map +0 -1
- package/dist/static/tastyStatic.d.ts +0 -46
- package/dist/static/tastyStatic.js +0 -30
- 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 -113
- package/dist/styles/border.js.map +0 -1
- package/dist/styles/color.d.ts +0 -14
- package/dist/styles/color.js +0 -26
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/createStyle.js +0 -79
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -96
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/display.d.ts +0 -37
- package/dist/styles/display.js +0 -66
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -57
- package/dist/styles/fade.js.map +0 -1
- package/dist/styles/fill.d.ts +0 -42
- package/dist/styles/fill.js +0 -51
- 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 -36
- package/dist/styles/gap.js.map +0 -1
- package/dist/styles/height.d.ts +0 -17
- package/dist/styles/height.js +0 -19
- package/dist/styles/height.js.map +0 -1
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.js +0 -8
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/inset.d.ts +0 -52
- package/dist/styles/inset.js +0 -149
- 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 -103
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -64
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -103
- package/dist/styles/padding.js.map +0 -1
- package/dist/styles/predefined.d.ts +0 -71
- package/dist/styles/predefined.js +0 -237
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -52
- package/dist/styles/preset.js +0 -126
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -12
- package/dist/styles/radius.js +0 -71
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -25
- package/dist/styles/scrollbar.js +0 -46
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -23
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -157
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/types.d.ts +0 -549
- package/dist/styles/width.d.ts +0 -17
- package/dist/styles/width.js +0 -19
- package/dist/styles/width.js.map +0 -1
- package/dist/tasty.d.ts +0 -119
- package/dist/tasty.js +0 -231
- package/dist/tasty.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -21
- 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 -228
- package/dist/utils/color-space.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -10
- 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 -6
- package/dist/utils/mod-attrs.js +0 -20
- 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 -90
- 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 -146
- 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 -99
- package/dist/utils/styles.js +0 -220
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -47
- package/dist/utils/typography.js +0 -51
- 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 -73
- package/dist/zero/css-writer.js.map +0 -1
- package/dist/zero/extractor.d.ts +0 -24
- package/dist/zero/extractor.js +0 -266
- package/dist/zero/extractor.js.map +0 -1
- package/docs/PIPELINE.md +0 -519
- package/docs/runtime.md +0 -485
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CHUNK_NAMES } from "./
|
|
3
|
-
import {
|
|
1
|
+
import { j as tastyClassRegex } from "./css-definitions-B4aWBkH3.js";
|
|
2
|
+
import { P as CHUNK_NAMES } from "./style-engine-DnkV_4Jg.js";
|
|
3
|
+
import { A as injector, H as getNamePrefix, Z as flushStyles, w as getCSSTextForNode } from "./runtime-engine-NGCofNXy.js";
|
|
4
4
|
//#region src/debug.ts
|
|
5
5
|
function fmtSize(bytes) {
|
|
6
6
|
return bytes > 1024 ? `${(bytes / 1024).toFixed(1)}KB` : `${bytes}B`;
|
|
@@ -9,80 +9,76 @@ function countRules(css) {
|
|
|
9
9
|
return (css.match(/\{[^}]*\}/g) || []).length;
|
|
10
10
|
}
|
|
11
11
|
function sortTastyClasses(classes) {
|
|
12
|
-
return Array.from(classes).sort((a, b) =>
|
|
12
|
+
return Array.from(classes).sort((a, b) => a.localeCompare(b));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
14
|
+
function defaultRoot() {
|
|
15
|
+
return typeof document === "undefined" ? null : document;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
let warnedNoDom = false;
|
|
18
|
+
function warnNoDom(raw) {
|
|
19
|
+
if (raw || warnedNoDom) return;
|
|
20
|
+
warnedNoDom = true;
|
|
21
|
+
console.warn("[Tasty] tastyDebug reads the DOM and this environment has none, so the result is empty. During SSR, read the ServerStyleCollector instead.");
|
|
22
|
+
}
|
|
23
|
+
function getRegistry(root = defaultRoot()) {
|
|
24
|
+
if (!root) return void 0;
|
|
25
|
+
flushStyles();
|
|
26
|
+
return injector.instance._sheetManager?.getRegistry(root);
|
|
23
27
|
}
|
|
24
|
-
function findDomTastyClasses(root =
|
|
28
|
+
function findDomTastyClasses(root = defaultRoot()) {
|
|
29
|
+
if (!root) return [];
|
|
25
30
|
const classes = /* @__PURE__ */ new Set();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const elements = root.querySelectorAll?.("[class]") || [];
|
|
32
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
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
|
+
}
|
|
32
38
|
return sortTastyClasses(classes);
|
|
33
39
|
}
|
|
40
|
+
function getAllCSS(root = defaultRoot()) {
|
|
41
|
+
const registry = getRegistry(root);
|
|
42
|
+
const sheetManager = injector.instance._sheetManager;
|
|
43
|
+
if (!root || !registry || !sheetManager) return "";
|
|
44
|
+
return sheetManager.getOwnedCSSInOrder(registry, root).join("\n");
|
|
45
|
+
}
|
|
46
|
+
function cssTextForClasses(classNames, root) {
|
|
47
|
+
if (!root) return "";
|
|
48
|
+
return injector.instance.getCSSTextForClasses(classNames, { root });
|
|
49
|
+
}
|
|
50
|
+
function getInjectorMetrics(root) {
|
|
51
|
+
if (!root) return null;
|
|
52
|
+
return injector.instance.getMetrics({ root });
|
|
53
|
+
}
|
|
54
|
+
function getUnusedClasses(root = defaultRoot()) {
|
|
55
|
+
if (!root) return [];
|
|
56
|
+
return sortTastyClasses(injector.instance.getUnusedClasses({ root }));
|
|
57
|
+
}
|
|
58
|
+
function getOwnedClasses(root = defaultRoot()) {
|
|
59
|
+
const registry = getRegistry(root);
|
|
60
|
+
if (!registry) return [];
|
|
61
|
+
const owned = [];
|
|
62
|
+
for (const [className, info] of registry.rules) if (info.sheetIndex >= 0) owned.push(className);
|
|
63
|
+
return sortTastyClasses(owned);
|
|
64
|
+
}
|
|
34
65
|
function prettifyCSS(css) {
|
|
35
66
|
if (!css || !css.trim()) return "";
|
|
36
67
|
const out = [];
|
|
37
68
|
let depth = 0;
|
|
38
|
-
const
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const header = buf.trim();
|
|
47
|
-
if (header) {
|
|
48
|
-
const parts = splitOutsideParens(header, ",");
|
|
49
|
-
if (parts.length > 1) out.push(parts.map((p, idx) => idx === 0 ? `${indent()}${p.trim()},` : `${indent()}${p.trim()}${idx < parts.length - 1 ? "," : ""}`).join("\n") + " {");
|
|
50
|
-
else out.push(`${indent()}${header} {`);
|
|
51
|
-
} else out.push(`${indent()}{`);
|
|
52
|
-
depth++;
|
|
53
|
-
buf = "";
|
|
54
|
-
} else if (t === "}") {
|
|
55
|
-
if (buf.trim()) {
|
|
56
|
-
for (const decl of buf.split(";").filter((s) => s.trim())) out.push(`${indent()}${decl.trim()};`);
|
|
57
|
-
buf = "";
|
|
58
|
-
}
|
|
59
|
-
depth = Math.max(0, depth - 1);
|
|
60
|
-
out.push(`${indent()}}`);
|
|
61
|
-
} else if (t.endsWith(";")) {
|
|
62
|
-
buf += ` ${t}`;
|
|
63
|
-
const full = buf.trim();
|
|
64
|
-
if (full) out.push(`${indent()}${full}`);
|
|
65
|
-
buf = "";
|
|
66
|
-
} else buf += ` ${t}`;
|
|
67
|
-
if (buf.trim()) out.push(buf.trim());
|
|
68
|
-
return out.filter((l) => l.trim()).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
69
|
-
}
|
|
70
|
-
/** Split `str` by `sep` only when not inside parentheses */
|
|
71
|
-
function splitOutsideParens(str, sep) {
|
|
72
|
-
const parts = [];
|
|
73
|
-
let depth = 0;
|
|
74
|
-
let start = 0;
|
|
75
|
-
for (let i = 0; i < str.length; i++) {
|
|
76
|
-
const ch = str[i];
|
|
77
|
-
if (ch === "(") depth++;
|
|
78
|
-
else if (ch === ")") depth--;
|
|
79
|
-
else if (depth === 0 && str.startsWith(sep, i)) {
|
|
80
|
-
parts.push(str.slice(start, i));
|
|
81
|
-
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);
|
|
82
77
|
}
|
|
78
|
+
out.push(`${" ".repeat(depth)}${line}`);
|
|
79
|
+
if (line.endsWith("{")) depth++;
|
|
83
80
|
}
|
|
84
|
-
|
|
85
|
-
return parts;
|
|
81
|
+
return out.join("\n");
|
|
86
82
|
}
|
|
87
83
|
function extractChunkName(cacheKey) {
|
|
88
84
|
for (const part of cacheKey.split("\0")) {
|
|
@@ -91,15 +87,15 @@ function extractChunkName(cacheKey) {
|
|
|
91
87
|
}
|
|
92
88
|
return null;
|
|
93
89
|
}
|
|
94
|
-
function getChunkForClass(className, root =
|
|
90
|
+
function getChunkForClass(className, root = defaultRoot()) {
|
|
95
91
|
const registry = getRegistry(root);
|
|
96
92
|
if (!registry) return null;
|
|
97
93
|
for (const [key, cn] of registry.cacheKeyToClassName) if (cn === className) return extractChunkName(key);
|
|
98
94
|
return null;
|
|
99
95
|
}
|
|
100
|
-
function buildChunkBreakdown(root =
|
|
96
|
+
function buildChunkBreakdown(root = defaultRoot()) {
|
|
101
97
|
const registry = getRegistry(root);
|
|
102
|
-
if (!registry) return {
|
|
98
|
+
if (!root || !registry) return {
|
|
103
99
|
byChunk: {},
|
|
104
100
|
totalChunkTypes: 0,
|
|
105
101
|
totalClasses: 0
|
|
@@ -107,36 +103,56 @@ function buildChunkBreakdown(root = document) {
|
|
|
107
103
|
const byChunk = {};
|
|
108
104
|
for (const [cacheKey, className] of registry.cacheKeyToClassName) {
|
|
109
105
|
const chunk = extractChunkName(cacheKey) || "unknown";
|
|
110
|
-
|
|
106
|
+
const entry = byChunk[chunk] ??= {
|
|
111
107
|
classes: [],
|
|
112
108
|
cssSize: 0,
|
|
113
109
|
ruleCount: 0
|
|
114
110
|
};
|
|
115
|
-
|
|
116
|
-
const css =
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
entry.classes.push(className);
|
|
112
|
+
const css = cssTextForClasses([className], root);
|
|
113
|
+
entry.cssSize += css.length;
|
|
114
|
+
entry.ruleCount += countRules(css);
|
|
119
115
|
}
|
|
120
|
-
|
|
121
|
-
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);
|
|
122
121
|
return {
|
|
123
122
|
byChunk,
|
|
124
123
|
totalChunkTypes: Object.keys(byChunk).length,
|
|
125
124
|
totalClasses
|
|
126
125
|
};
|
|
127
126
|
}
|
|
128
|
-
|
|
127
|
+
const GLOBAL_RULE_PREFIXES = {
|
|
128
|
+
global: "global:",
|
|
129
|
+
property: "property:",
|
|
130
|
+
fontFace: "fontface:",
|
|
131
|
+
counterStyle: "counterstyle:",
|
|
132
|
+
function: "function:"
|
|
133
|
+
};
|
|
134
|
+
function getGlobalTypeCSS(type, root = defaultRoot(), includeCSS = true) {
|
|
129
135
|
const registry = getRegistry(root);
|
|
130
|
-
if (!registry) return {
|
|
136
|
+
if (!root || !registry) return {
|
|
131
137
|
css: "",
|
|
132
138
|
ruleCount: 0,
|
|
133
139
|
size: 0
|
|
134
140
|
};
|
|
135
141
|
const chunks = [];
|
|
142
|
+
const sheetManager = injector.instance._sheetManager;
|
|
136
143
|
let rc = 0;
|
|
144
|
+
if (type === "raw") {
|
|
145
|
+
const css = injector.instance.getRawCSSText({ root });
|
|
146
|
+
return {
|
|
147
|
+
css: includeCSS ? prettifyCSS(css) : "",
|
|
148
|
+
ruleCount: sheetManager?.getRawRuleCount(root) ?? 0,
|
|
149
|
+
size: css.length
|
|
150
|
+
};
|
|
151
|
+
}
|
|
137
152
|
if (type === "keyframes") for (const [, entry] of registry.keyframesCache) {
|
|
138
153
|
const info = entry.info;
|
|
139
|
-
const
|
|
154
|
+
const sheetInfo = registry.sheets[info.sheetIndex];
|
|
155
|
+
const ss = sheetInfo && sheetManager ? sheetManager.getCSSSheet(sheetInfo) : null;
|
|
140
156
|
if (ss && info.ruleIndex < ss.cssRules.length) {
|
|
141
157
|
const rule = ss.cssRules[info.ruleIndex];
|
|
142
158
|
if (rule) {
|
|
@@ -149,10 +165,11 @@ function getGlobalTypeCSS(type, root = document) {
|
|
|
149
165
|
}
|
|
150
166
|
}
|
|
151
167
|
else {
|
|
152
|
-
const prefix = type
|
|
168
|
+
const prefix = GLOBAL_RULE_PREFIXES[type];
|
|
153
169
|
for (const [key, ri] of registry.globalRules) {
|
|
154
170
|
if (!key.startsWith(prefix)) continue;
|
|
155
|
-
const
|
|
171
|
+
const sheetInfo = registry.sheets[ri.sheetIndex];
|
|
172
|
+
const ss = sheetInfo && sheetManager ? sheetManager.getCSSSheet(sheetInfo) : null;
|
|
156
173
|
if (ss) {
|
|
157
174
|
const start = Math.max(0, ri.ruleIndex);
|
|
158
175
|
const end = Math.min(ss.cssRules.length - 1, ri.endRuleIndex ?? ri.ruleIndex);
|
|
@@ -171,12 +188,12 @@ function getGlobalTypeCSS(type, root = document) {
|
|
|
171
188
|
}
|
|
172
189
|
const raw = chunks.join("\n");
|
|
173
190
|
return {
|
|
174
|
-
css: prettifyCSS(raw),
|
|
191
|
+
css: includeCSS ? prettifyCSS(raw) : "",
|
|
175
192
|
ruleCount: rc,
|
|
176
193
|
size: raw.length
|
|
177
194
|
};
|
|
178
195
|
}
|
|
179
|
-
function getSourceCssForClasses(classNames, root =
|
|
196
|
+
function getSourceCssForClasses(classNames, root = defaultRoot()) {
|
|
180
197
|
const registry = getRegistry(root);
|
|
181
198
|
if (!registry) return null;
|
|
182
199
|
const chunks = [];
|
|
@@ -190,7 +207,7 @@ function getSourceCssForClasses(classNames, root = document) {
|
|
|
190
207
|
}
|
|
191
208
|
return found ? chunks.join("\n") : null;
|
|
192
209
|
}
|
|
193
|
-
function getDefs(root =
|
|
210
|
+
function getDefs(root = defaultRoot()) {
|
|
194
211
|
const registry = getRegistry(root);
|
|
195
212
|
let properties = [];
|
|
196
213
|
if (registry?.injectedProperties) properties = Array.from(registry.injectedProperties.keys()).sort();
|
|
@@ -218,42 +235,51 @@ const CHUNK_ORDER = [
|
|
|
218
235
|
CHUNK_NAMES.MISC,
|
|
219
236
|
CHUNK_NAMES.SUBCOMPONENTS
|
|
220
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
|
+
}
|
|
221
245
|
const tastyDebug = {
|
|
222
246
|
css(target, opts) {
|
|
223
|
-
const { root =
|
|
247
|
+
const { root = defaultRoot(), prettify = true, raw = false, source = false } = opts || {};
|
|
248
|
+
if (!root) {
|
|
249
|
+
warnNoDom(raw);
|
|
250
|
+
return "";
|
|
251
|
+
}
|
|
224
252
|
let css = "";
|
|
225
|
-
|
|
253
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
254
|
+
if (source && typeof target === "string" && classRegex.test(target)) {
|
|
226
255
|
const src = getSourceCssForClasses([target], root);
|
|
227
256
|
if (src) css = src;
|
|
228
257
|
else {
|
|
229
|
-
if (!raw) console.warn("
|
|
230
|
-
css =
|
|
258
|
+
if (!raw) console.warn("[Tasty] source CSS not available (requires dev mode or TASTY_DEBUG=true). Falling back to live CSSOM.");
|
|
259
|
+
css = cssTextForClasses([target], root);
|
|
231
260
|
}
|
|
232
261
|
} else if (source && Array.isArray(target)) {
|
|
233
262
|
const src = getSourceCssForClasses(target, root);
|
|
234
263
|
if (src) css = src;
|
|
235
264
|
else {
|
|
236
|
-
if (!raw) console.warn("
|
|
237
|
-
css =
|
|
265
|
+
if (!raw) console.warn("[Tasty] source CSS not available. Falling back to live CSSOM.");
|
|
266
|
+
css = cssTextForClasses(target, root);
|
|
238
267
|
}
|
|
239
|
-
} else if (typeof target === "string")
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
css =
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
else if (Array.isArray(target)) css = injector.instance.getCssTextForClasses(target, { root });
|
|
256
|
-
else if (target instanceof Element) css = getCssTextForNode(target, { root });
|
|
268
|
+
} else if (typeof target === "string") {
|
|
269
|
+
if (target === "all") css = getAllCSS(root);
|
|
270
|
+
else if (target === "global") {
|
|
271
|
+
css = getGlobalTypeCSS("global", root).css;
|
|
272
|
+
return css;
|
|
273
|
+
} else if (target === "active") css = cssTextForClasses(findDomTastyClasses(root), root);
|
|
274
|
+
else if (target === "unused") css = cssTextForClasses(getUnusedClasses(root), root);
|
|
275
|
+
else if (target === "page") css = getPageCSS(root);
|
|
276
|
+
else if (classRegex.test(target)) css = cssTextForClasses([target], root);
|
|
277
|
+
else {
|
|
278
|
+
const el = root.querySelector?.(target);
|
|
279
|
+
if (el) css = getCSSTextForNode(el, { root });
|
|
280
|
+
}
|
|
281
|
+
} else if (Array.isArray(target)) css = cssTextForClasses(target, root);
|
|
282
|
+
else if (target instanceof Element) css = getCSSTextForNode(target, { root });
|
|
257
283
|
const result = prettify ? prettifyCSS(css) : css;
|
|
258
284
|
if (!raw) {
|
|
259
285
|
const label = Array.isArray(target) ? `[${target.join(", ")}]` : target;
|
|
@@ -265,8 +291,9 @@ const tastyDebug = {
|
|
|
265
291
|
return result;
|
|
266
292
|
},
|
|
267
293
|
inspect(target, opts) {
|
|
268
|
-
const { root =
|
|
269
|
-
const element = typeof target === "string" ? root.querySelector?.(target) : target;
|
|
294
|
+
const { root = defaultRoot(), raw = false } = opts || {};
|
|
295
|
+
const element = !root ? null : typeof target === "string" ? root.querySelector?.(target) : target;
|
|
296
|
+
if (!root) warnNoDom(raw);
|
|
270
297
|
if (!element) {
|
|
271
298
|
const empty = {
|
|
272
299
|
element: null,
|
|
@@ -276,15 +303,17 @@ const tastyDebug = {
|
|
|
276
303
|
size: 0,
|
|
277
304
|
rules: 0
|
|
278
305
|
};
|
|
279
|
-
if (!raw) console.warn("
|
|
306
|
+
if (!raw && root) console.warn("[Tasty] debug.inspect: element not found");
|
|
280
307
|
return empty;
|
|
281
308
|
}
|
|
282
|
-
const
|
|
309
|
+
const classList = element.getAttribute("class") || "";
|
|
310
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
311
|
+
const tastyClasses = classList.split(/\s+/).filter((cls) => classRegex.test(cls));
|
|
283
312
|
const chunks = tastyClasses.map((className) => ({
|
|
284
313
|
className,
|
|
285
314
|
chunkName: getChunkForClass(className, root)
|
|
286
315
|
}));
|
|
287
|
-
const css =
|
|
316
|
+
const css = getCSSTextForNode(element, { root: root ?? void 0 });
|
|
288
317
|
const rules = countRules(css);
|
|
289
318
|
const result = {
|
|
290
319
|
element,
|
|
@@ -307,37 +336,60 @@ const tastyDebug = {
|
|
|
307
336
|
return result;
|
|
308
337
|
},
|
|
309
338
|
summary(opts) {
|
|
310
|
-
const { root =
|
|
339
|
+
const { root = defaultRoot(), raw = false } = opts || {};
|
|
340
|
+
if (!root) warnNoDom(raw);
|
|
311
341
|
const activeClasses = findDomTastyClasses(root);
|
|
312
342
|
const unusedClasses = getUnusedClasses(root);
|
|
313
|
-
const
|
|
314
|
-
const
|
|
315
|
-
const
|
|
316
|
-
const
|
|
343
|
+
const ownedClasses = getOwnedClasses(root);
|
|
344
|
+
const totalStyledClasses = sortTastyClasses(/* @__PURE__ */ new Set([...activeClasses, ...ownedClasses]));
|
|
345
|
+
const unusedSet = new Set(unusedClasses);
|
|
346
|
+
const activeSet = new Set(activeClasses);
|
|
347
|
+
const hotClasses = ownedClasses.filter((className) => !activeSet.has(className) && !unusedSet.has(className));
|
|
348
|
+
const hotCSS = cssTextForClasses(hotClasses, root);
|
|
349
|
+
const activeCSS = cssTextForClasses(activeClasses, root);
|
|
350
|
+
const unusedCSS = cssTextForClasses(unusedClasses, root);
|
|
351
|
+
const allCSS = getAllCSS(root);
|
|
317
352
|
const activeRuleCount = countRules(activeCSS);
|
|
318
353
|
const unusedRuleCount = countRules(unusedCSS);
|
|
319
|
-
const globalData = getGlobalTypeCSS("global", root);
|
|
320
|
-
const rawData = getGlobalTypeCSS("raw", root);
|
|
321
|
-
const kfData = getGlobalTypeCSS("keyframes", root);
|
|
322
|
-
const propData = getGlobalTypeCSS("property", root);
|
|
323
|
-
const
|
|
324
|
-
|
|
354
|
+
const globalData = getGlobalTypeCSS("global", root, false);
|
|
355
|
+
const rawData = getGlobalTypeCSS("raw", root, false);
|
|
356
|
+
const kfData = getGlobalTypeCSS("keyframes", root, false);
|
|
357
|
+
const propData = getGlobalTypeCSS("property", root, false);
|
|
358
|
+
const atRuleData = [
|
|
359
|
+
"fontFace",
|
|
360
|
+
"counterStyle",
|
|
361
|
+
"function"
|
|
362
|
+
].reduce((total, type) => {
|
|
363
|
+
const data = getGlobalTypeCSS(type, root, false);
|
|
364
|
+
total.ruleCount += data.ruleCount;
|
|
365
|
+
total.size += data.size;
|
|
366
|
+
return total;
|
|
367
|
+
}, {
|
|
368
|
+
ruleCount: 0,
|
|
369
|
+
size: 0
|
|
370
|
+
});
|
|
371
|
+
const hotRuleCount = countRules(hotCSS);
|
|
372
|
+
const globalRuleCount = globalData.ruleCount + atRuleData.ruleCount;
|
|
373
|
+
const globalCSSSize = globalData.size + atRuleData.size;
|
|
374
|
+
const totalRuleCount = activeRuleCount + unusedRuleCount + hotRuleCount + globalRuleCount + rawData.ruleCount + kfData.ruleCount + propData.ruleCount;
|
|
375
|
+
const metrics = getInjectorMetrics(root);
|
|
325
376
|
const defs = getDefs(root);
|
|
326
377
|
const chunkBreakdown = buildChunkBreakdown(root);
|
|
327
378
|
const summary = {
|
|
328
379
|
activeClasses,
|
|
329
380
|
unusedClasses,
|
|
381
|
+
hotClasses,
|
|
330
382
|
totalStyledClasses,
|
|
331
383
|
activeCSSSize: activeCSS.length,
|
|
332
384
|
unusedCSSSize: unusedCSS.length,
|
|
333
|
-
globalCSSSize
|
|
385
|
+
globalCSSSize,
|
|
334
386
|
rawCSSSize: rawData.size,
|
|
335
387
|
keyframesCSSSize: kfData.size,
|
|
336
388
|
propertyCSSSize: propData.size,
|
|
337
389
|
totalCSSSize: allCSS.length,
|
|
338
390
|
activeRuleCount,
|
|
339
391
|
unusedRuleCount,
|
|
340
|
-
globalRuleCount
|
|
392
|
+
globalRuleCount,
|
|
341
393
|
rawRuleCount: rawData.ruleCount,
|
|
342
394
|
keyframesRuleCount: kfData.ruleCount,
|
|
343
395
|
propertyRuleCount: propData.ruleCount,
|
|
@@ -351,7 +403,8 @@ const tastyDebug = {
|
|
|
351
403
|
console.group("Tasty Summary");
|
|
352
404
|
console.log(`Active: ${activeClasses.length} classes, ${activeRuleCount} rules, ${fmtSize(activeCSS.length)}`);
|
|
353
405
|
console.log(`Unused: ${unusedClasses.length} classes, ${unusedRuleCount} rules, ${fmtSize(unusedCSS.length)}`);
|
|
354
|
-
console.log(`
|
|
406
|
+
if (hotClasses.length) console.log(`Held: ${hotClasses.length} classes, ${hotRuleCount} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`);
|
|
407
|
+
console.log(`Global: ${globalRuleCount} rules, ${fmtSize(globalCSSSize)}`);
|
|
355
408
|
if (rawData.ruleCount) console.log(`Raw: ${rawData.ruleCount} rules, ${fmtSize(rawData.size)}`);
|
|
356
409
|
if (kfData.ruleCount) console.log(`Keyframes: ${kfData.ruleCount} rules, ${fmtSize(kfData.size)}`);
|
|
357
410
|
if (propData.ruleCount) console.log(`@property: ${propData.ruleCount} rules, ${fmtSize(propData.size)}`);
|
|
@@ -363,11 +416,7 @@ const tastyDebug = {
|
|
|
363
416
|
}
|
|
364
417
|
if (chunkBreakdown.totalChunkTypes > 0) {
|
|
365
418
|
console.groupCollapsed(`Chunks (${chunkBreakdown.totalChunkTypes} types, ${chunkBreakdown.totalClasses} classes)`);
|
|
366
|
-
|
|
367
|
-
const d = chunkBreakdown.byChunk[name];
|
|
368
|
-
if (d) console.log(` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`);
|
|
369
|
-
}
|
|
370
|
-
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)}`);
|
|
419
|
+
logChunkEntries(chunkBreakdown);
|
|
371
420
|
console.groupEnd();
|
|
372
421
|
}
|
|
373
422
|
if (defs.properties.length || defs.keyframes.length) console.log(`Defs: ${defs.properties.length} @property, ${defs.keyframes.length} @keyframes`);
|
|
@@ -376,29 +425,27 @@ const tastyDebug = {
|
|
|
376
425
|
return summary;
|
|
377
426
|
},
|
|
378
427
|
chunks(opts) {
|
|
379
|
-
const { root =
|
|
428
|
+
const { root = defaultRoot(), raw = false } = opts || {};
|
|
429
|
+
if (!root) warnNoDom(raw);
|
|
380
430
|
const breakdown = buildChunkBreakdown(root);
|
|
381
431
|
if (!raw) {
|
|
382
432
|
console.group(`Chunks (${breakdown.totalChunkTypes} types, ${breakdown.totalClasses} classes)`);
|
|
383
|
-
|
|
384
|
-
const d = breakdown.byChunk[name];
|
|
385
|
-
if (d) console.log(` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`);
|
|
386
|
-
}
|
|
387
|
-
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)}`);
|
|
433
|
+
logChunkEntries(breakdown);
|
|
388
434
|
console.groupEnd();
|
|
389
435
|
}
|
|
390
436
|
return breakdown;
|
|
391
437
|
},
|
|
392
438
|
cache(opts) {
|
|
393
|
-
const { root =
|
|
439
|
+
const { root = defaultRoot(), raw = false } = opts || {};
|
|
440
|
+
if (!root) warnNoDom(raw);
|
|
394
441
|
const active = findDomTastyClasses(root);
|
|
395
442
|
const unused = getUnusedClasses(root);
|
|
396
|
-
const metrics =
|
|
443
|
+
const metrics = getInjectorMetrics(root);
|
|
397
444
|
const status = {
|
|
398
445
|
classes: {
|
|
399
446
|
active,
|
|
400
447
|
unused,
|
|
401
|
-
all: [...active, ...
|
|
448
|
+
all: sortTastyClasses(/* @__PURE__ */ new Set([...active, ...getOwnedClasses(root)]))
|
|
402
449
|
},
|
|
403
450
|
metrics
|
|
404
451
|
};
|
|
@@ -415,14 +462,16 @@ const tastyDebug = {
|
|
|
415
462
|
return status;
|
|
416
463
|
},
|
|
417
464
|
cleanup(opts) {
|
|
418
|
-
|
|
465
|
+
const root = opts?.root ?? defaultRoot();
|
|
466
|
+
if (!root) return;
|
|
467
|
+
injector.instance.cleanup(root);
|
|
419
468
|
},
|
|
420
469
|
help() {
|
|
421
470
|
console.log(`tastyDebug API:
|
|
422
471
|
.summary() — overview (classes, rules, sizes)
|
|
423
472
|
.css("active") — CSS for classes in DOM
|
|
424
|
-
.css("
|
|
425
|
-
.css("
|
|
473
|
+
.css("t3a5f") — CSS for a specific class
|
|
474
|
+
.css("t3a5f",{source:true}) — original CSS before browser parsing (dev only)
|
|
426
475
|
.css(".selector") — CSS for a DOM element
|
|
427
476
|
.inspect(".selector") — element details (classes, chunks, rules)
|
|
428
477
|
.chunks() — style chunk breakdown
|
|
@@ -437,7 +486,8 @@ Options: { raw: true } suppresses logging, { root: shadowRoot } targets Shadow D
|
|
|
437
486
|
}
|
|
438
487
|
}
|
|
439
488
|
};
|
|
440
|
-
function getPageCSS(root =
|
|
489
|
+
function getPageCSS(root = defaultRoot()) {
|
|
490
|
+
if (!root) return "";
|
|
441
491
|
const chunks = [];
|
|
442
492
|
try {
|
|
443
493
|
if ("styleSheets" in root) for (const sheet of Array.from(root.styleSheets)) try {
|
|
@@ -446,8 +496,7 @@ function getPageCSS(root = document) {
|
|
|
446
496
|
} catch {}
|
|
447
497
|
return chunks.join("\n");
|
|
448
498
|
}
|
|
449
|
-
if (typeof window !== "undefined" && isDevEnv()) tastyDebug.install();
|
|
450
499
|
//#endregion
|
|
451
|
-
export { tastyDebug };
|
|
500
|
+
export { tastyDebug as t };
|
|
452
501
|
|
|
453
|
-
//# sourceMappingURL=debug.js.map
|
|
502
|
+
//# sourceMappingURL=debug-D2Pu7Xhy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-D2Pu7Xhy.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(\"t3a5f\") — CSS for a specific class\n .css(\"t3a5f\",{source:true}) — 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,O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