@tenphi/tasty 0.0.0-snapshot.1c5dff6 → 0.0.0-snapshot.1f1c00a
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 +377 -238
- package/dist/babel-rZcEwPLM.d.ts +82 -0
- package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
- package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
- package/dist/chunks/build-config-CL4eRu2z.js +42 -0
- package/dist/chunks/build-config-CL4eRu2z.js.map +1 -0
- package/dist/chunks/collector-D2ARGT2L.js +208 -0
- package/dist/chunks/collector-D2ARGT2L.js.map +1 -0
- package/dist/chunks/config-engine-DEmmPPdp.js +272 -0
- package/dist/chunks/config-engine-DEmmPPdp.js.map +1 -0
- package/dist/chunks/css-definitions-DotDkIXt.js +876 -0
- package/dist/chunks/css-definitions-DotDkIXt.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/chunks/debug-D8pg9RGI.js +502 -0
- package/dist/chunks/debug-D8pg9RGI.js.map +1 -0
- package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
- package/dist/chunks/dsl-DRhFWQzo.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-BpxlOTbO.js +562 -0
- package/dist/chunks/react-runtime-BpxlOTbO.js.map +1 -0
- package/dist/chunks/runtime-engine-CKFXUH-A.js +2416 -0
- package/dist/chunks/runtime-engine-CKFXUH-A.js.map +1 -0
- package/dist/chunks/runtime-state-BxaLhVdP.js +127 -0
- package/dist/chunks/runtime-state-BxaLhVdP.js.map +1 -0
- package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +61 -58
- package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
- package/dist/chunks/style-engine-BBbBuSkT.js +5260 -0
- package/dist/chunks/style-engine-BBbBuSkT.js.map +1 -0
- package/dist/{zero/extractor.js → chunks/zero-engine-gJrKBRiw.js} +126 -66
- package/dist/chunks/zero-engine-gJrKBRiw.js.map +1 -0
- package/dist/collector-w4mBj5gd.d.ts +164 -0
- package/dist/config-CZWCzBr6.d.ts +1349 -0
- package/dist/core/index.d.ts +5 -33
- package/dist/core/index.js +9 -26
- package/dist/index-G9JuwM9p.d.ts +1920 -0
- package/dist/index.d.ts +5 -48
- package/dist/index.js +11 -33
- package/dist/{utils/merge-styles.d.ts → merge-styles-VXwJ0Frr.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 +127 -0
- package/dist/ssr/astro.js +221 -0
- package/dist/ssr/astro.js.map +1 -0
- package/dist/ssr/index.d.ts +36 -0
- package/dist/ssr/index.js +10 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/next-config.d.ts +64 -0
- package/dist/ssr/next-config.js +128 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +46 -0
- package/dist/ssr/next.js +60 -0
- package/dist/ssr/next.js.map +1 -0
- package/dist/static/index.d.ts +90 -5
- package/dist/static/index.js +31 -4
- package/dist/static/index.js.map +1 -0
- package/dist/static/inject.d.ts +4 -0
- package/dist/static/inject.js +17 -0
- package/dist/static/inject.js.map +1 -0
- package/dist/types-JEY8PVYP.d.ts +1567 -0
- package/dist/zero/babel.d.ts +2 -113
- package/dist/zero/babel.js +230 -106
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +80 -3
- package/dist/zero/index.js +2 -4
- package/dist/zero/next.d.ts +57 -33
- package/dist/zero/next.js +93 -59
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +39 -0
- package/docs/adoption.md +323 -0
- package/docs/ai-agents.md +250 -0
- package/docs/comparison.md +448 -0
- package/docs/configuration.md +684 -56
- package/docs/debug.md +170 -343
- package/docs/design-system.md +455 -0
- package/docs/dsl.md +1065 -0
- package/docs/getting-started.md +240 -0
- package/docs/injector.md +159 -53
- package/docs/methodology.md +648 -0
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +765 -0
- package/docs/plugins.md +353 -0
- package/docs/react-api.md +683 -0
- package/docs/runtime-benchmarks.md +388 -0
- package/docs/ssr.md +610 -0
- package/docs/styles.md +211 -63
- package/docs/tasty-static.md +273 -67
- package/package.json +182 -58
- package/tasty.config.ts +6 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -8
- package/dist/chunks/cacheKey.js +0 -70
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -260
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/renderChunk.js +0 -61
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/config.d.ts +0 -288
- package/dist/config.js +0 -403
- package/dist/config.js.map +0 -1
- package/dist/debug.d.ts +0 -204
- package/dist/debug.js +0 -733
- package/dist/debug.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -27
- package/dist/hooks/useGlobalStyles.js +0 -56
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -56
- package/dist/hooks/useKeyframes.js +0 -54
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -79
- package/dist/hooks/useProperty.js +0 -91
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -53
- package/dist/hooks/useRawCSS.js +0 -28
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -40
- package/dist/hooks/useStyles.js +0 -169
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -157
- package/dist/injector/index.js +0 -154
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -139
- package/dist/injector/injector.js +0 -417
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -135
- package/dist/injector/sheet-manager.js +0 -728
- package/dist/injector/sheet-manager.js.map +0 -1
- package/dist/injector/types.d.ts +0 -144
- 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 -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 -660
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -856
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -451
- 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 -371
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -69
- package/dist/properties/index.js +0 -221
- 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 -83
- package/dist/properties/property-type-resolver.js.map +0 -1
- package/dist/states/index.d.ts +0 -49
- package/dist/states/index.js +0 -416
- 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 -23
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/createStyle.js +0 -77
- 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 -73
- package/dist/styles/predefined.js +0 -241
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -47
- package/dist/styles/preset.js +0 -126
- 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 -23
- package/dist/styles/scrollbar.js +0 -34
- 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/styledScrollbar.d.ts +0 -47
- package/dist/styles/styledScrollbar.js +0 -38
- package/dist/styles/styledScrollbar.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 -498
- 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 -982
- package/dist/tasty.js +0 -206
- package/dist/tasty.js.map +0 -1
- package/dist/tokens/typography.d.ts +0 -19
- package/dist/tokens/typography.js +0 -237
- package/dist/tokens/typography.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -26
- 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/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -9
- 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/hsl-to-rgb.js +0 -38
- package/dist/utils/hsl-to-rgb.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/okhsl-to-rgb.js +0 -296
- package/dist/utils/okhsl-to-rgb.js.map +0 -1
- package/dist/utils/process-tokens.d.ts +0 -31
- package/dist/utils/process-tokens.js +0 -171
- 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 -177
- package/dist/utils/styles.js +0 -730
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -36
- package/dist/utils/typography.js +0 -53
- 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/usage.md +0 -695
package/docs/debug.md
CHANGED
|
@@ -6,68 +6,63 @@ Runtime CSS inspection and diagnostics for the Tasty styling system. Inspect inj
|
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
`tastyDebug` is a diagnostic object that exposes
|
|
9
|
+
`tastyDebug` is a diagnostic object that exposes Tasty's runtime CSS state. It is designed for development use and can be installed on `window` explicitly when needed.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
All methods **log to the console by default**. Pass `{ raw: true }` to suppress logging and only return data.
|
|
12
12
|
|
|
13
|
-
> **Note:**
|
|
13
|
+
> **Note (2.0.0+):** Class names use a content-addressed base36 hash format (e.g. `t3a5f`) instead of the previous sequential `t{number}` format. Cross-environment hydration reads the rendered class list from `window.__TASTY__` (the legacy `window.__TASTY_SSR_CACHE__` global was removed in 2.0.0).
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
|
-
// Auto-installed in dev mode. Otherwise:
|
|
21
20
|
import { tastyDebug } from '@tenphi/tasty';
|
|
22
21
|
tastyDebug.install();
|
|
23
22
|
|
|
24
23
|
// Print a quick-start guide
|
|
25
24
|
tastyDebug.help();
|
|
26
25
|
|
|
27
|
-
// Get a comprehensive overview logged
|
|
28
|
-
tastyDebug.summary(
|
|
26
|
+
// Get a comprehensive overview (logged automatically)
|
|
27
|
+
tastyDebug.summary();
|
|
29
28
|
|
|
30
|
-
// See all active CSS
|
|
31
|
-
tastyDebug.
|
|
29
|
+
// See all active CSS
|
|
30
|
+
tastyDebug.css('active');
|
|
32
31
|
|
|
33
32
|
// Inspect a specific element
|
|
34
33
|
tastyDebug.inspect('.my-button');
|
|
35
34
|
|
|
36
|
-
//
|
|
37
|
-
tastyDebug.
|
|
35
|
+
// Silent mode — return data only, no console output
|
|
36
|
+
const data = tastyDebug.summary({ raw: true });
|
|
38
37
|
```
|
|
39
38
|
|
|
40
39
|
---
|
|
41
40
|
|
|
42
|
-
##
|
|
43
|
-
|
|
44
|
-
### `CSSTarget`
|
|
41
|
+
## Options
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
All methods accept a shared options object:
|
|
47
44
|
|
|
48
45
|
```typescript
|
|
49
|
-
|
|
50
|
-
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
| 'unused' // CSS with refCount = 0 (cached but not actively used)
|
|
54
|
-
| 'page' // ALL CSS on the page, including non-tasty stylesheets
|
|
55
|
-
| string // A tasty class ('t123') or a CSS selector ('.my-class')
|
|
56
|
-
| string[] // Array of tasty classes (['t0', 't5', 't12'])
|
|
57
|
-
| Element; // A DOM element
|
|
46
|
+
interface DebugOptions {
|
|
47
|
+
root?: Document | ShadowRoot; // Target root (default: document)
|
|
48
|
+
raw?: boolean; // Suppress console logging (default: false)
|
|
49
|
+
}
|
|
58
50
|
```
|
|
59
51
|
|
|
60
|
-
|
|
52
|
+
When `raw` is `false` (the default), results are logged to the console **and** returned. When `raw` is `true`, results are returned silently.
|
|
61
53
|
|
|
62
|
-
|
|
54
|
+
### Environments Without a DOM
|
|
63
55
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
`tastyDebug` reads the document, so on a server — SSR, a Node REPL, a test
|
|
57
|
+
runner in the `node` environment — there is nothing for it to read. Every
|
|
58
|
+
method returns its empty result (`''`, an empty `InspectResult`, a summary of
|
|
59
|
+
zeroes, `metrics: null`) instead of throwing, and explains itself once with a
|
|
60
|
+
console warning. `{ raw: true }` suppresses that warning along with the rest of
|
|
61
|
+
the logging.
|
|
62
|
+
|
|
63
|
+
To see the styles a server render produced, read the `ServerStyleCollector`
|
|
64
|
+
instead — `collector.getCSS()` and `collector.getRenderedClassNames()`. See
|
|
65
|
+
[SSR](./ssr.md).
|
|
71
66
|
|
|
72
67
|
---
|
|
73
68
|
|
|
@@ -75,45 +70,48 @@ interface CssOptions {
|
|
|
75
70
|
|
|
76
71
|
### `css(target, opts?): string`
|
|
77
72
|
|
|
78
|
-
Retrieves CSS text for a given target.
|
|
73
|
+
Retrieves CSS text for a given target. Logs the result with rule count and size.
|
|
79
74
|
|
|
80
|
-
|
|
81
|
-
// All tasty CSS
|
|
82
|
-
tastyDebug.css('all');
|
|
83
|
-
|
|
84
|
-
// Only CSS for classes currently in the DOM
|
|
85
|
-
tastyDebug.css('active');
|
|
75
|
+
**Targets:**
|
|
86
76
|
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
| Target | Description |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `'all'` | All tasty CSS (component + global + raw) |
|
|
80
|
+
| `'active'` | CSS for classes currently in the DOM |
|
|
81
|
+
| `'unused'` | CSS for injected classes no element carries (cached but not rendered) |
|
|
82
|
+
| `'global'` | Only global CSS (from `injectGlobal`) |
|
|
83
|
+
| `'page'` | All CSS on the page (including non-tasty) |
|
|
84
|
+
| `'t3a5f'` | CSS for a specific tasty class (class names are `t` + base36 hash) |
|
|
85
|
+
| `['t3a5f', 't9k2']` | CSS for multiple tasty classes |
|
|
86
|
+
| `'.my-button'` | CSS affecting a DOM element (by selector) |
|
|
87
|
+
| `element` | CSS affecting a DOM element (by reference) |
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
tastyDebug.css('global');
|
|
89
|
+
**Extra options:**
|
|
92
90
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// CSS
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// CSS for multiple tasty classes
|
|
100
|
-
tastyDebug.css(['t0', 't5', 't12']);
|
|
91
|
+
```typescript
|
|
92
|
+
interface CSSOptions extends DebugOptions {
|
|
93
|
+
prettify?: boolean; // Format output (default: true)
|
|
94
|
+
source?: boolean; // Read original CSS instead of live CSSOM (default: false, dev-mode only)
|
|
95
|
+
}
|
|
96
|
+
```
|
|
101
97
|
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
```typescript
|
|
99
|
+
// Active CSS with stats
|
|
100
|
+
tastyDebug.css('active');
|
|
104
101
|
|
|
105
|
-
//
|
|
106
|
-
const
|
|
107
|
-
tastyDebug.css(el);
|
|
102
|
+
// Specific class, silent
|
|
103
|
+
const css = tastyDebug.css('t3a5f', { raw: true });
|
|
108
104
|
|
|
109
|
-
//
|
|
110
|
-
tastyDebug.css('
|
|
105
|
+
// Compare original vs browser-parsed CSS (dev mode only)
|
|
106
|
+
tastyDebug.css('t3a5f'); // live CSSOM
|
|
107
|
+
tastyDebug.css('t3a5f', { source: true }); // original output
|
|
111
108
|
|
|
112
109
|
// Shadow DOM
|
|
113
|
-
const shadowRoot = host.shadowRoot;
|
|
114
110
|
tastyDebug.css('all', { root: shadowRoot });
|
|
115
111
|
```
|
|
116
112
|
|
|
113
|
+
The `source` option reads from `RuleInfo.cssText`, which is only populated when `devMode` is active (development environment or `localStorage.TASTY_DEBUG = 'true'`). In production without debug mode, it falls back to the live CSSOM with a warning.
|
|
114
|
+
|
|
117
115
|
---
|
|
118
116
|
|
|
119
117
|
### `inspect(target, opts?): InspectResult`
|
|
@@ -123,309 +121,177 @@ Inspects a DOM element and returns detailed information about its tasty styles,
|
|
|
123
121
|
```typescript
|
|
124
122
|
interface InspectResult {
|
|
125
123
|
element?: Element | null;
|
|
126
|
-
classes: string[];
|
|
127
|
-
chunks:
|
|
128
|
-
css: string;
|
|
129
|
-
size: number;
|
|
130
|
-
rules: number;
|
|
124
|
+
classes: string[]; // Tasty classes on the element
|
|
125
|
+
chunks: DebugChunkInfo[]; // Chunk assignment per class
|
|
126
|
+
css: string; // Prettified CSS
|
|
127
|
+
size: number; // CSS size in characters
|
|
128
|
+
rules: number; // Number of CSS rule blocks
|
|
131
129
|
}
|
|
132
130
|
|
|
133
|
-
interface
|
|
134
|
-
className: string;
|
|
131
|
+
interface DebugChunkInfo {
|
|
132
|
+
className: string;
|
|
135
133
|
chunkName: string | null; // e.g., 'appearance', 'font', 'dimension'
|
|
136
134
|
}
|
|
137
135
|
```
|
|
138
136
|
|
|
139
137
|
```typescript
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
console.log(result.chunks); // [{className: 't3', chunkName: 'appearance'}, ...]
|
|
144
|
-
console.log(result.rules); // 5
|
|
145
|
-
console.log(result.css); // prettified CSS
|
|
146
|
-
|
|
147
|
-
// By element reference
|
|
148
|
-
const el = document.querySelector('[data-element="Title"]');
|
|
149
|
-
tastyDebug.inspect(el);
|
|
150
|
-
|
|
151
|
-
// Shadow DOM
|
|
152
|
-
tastyDebug.inspect('.shadow-component', { root: shadowRoot });
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
### `cache(opts?): CacheStatus`
|
|
158
|
-
|
|
159
|
-
Returns the current state of the style cache: which classes are active, which are unused, and performance metrics.
|
|
160
|
-
|
|
161
|
-
```typescript
|
|
162
|
-
interface CacheStatus {
|
|
163
|
-
classes: {
|
|
164
|
-
active: string[]; // Classes with refCount > 0 and present in DOM
|
|
165
|
-
unused: string[]; // Classes with refCount = 0 but still in cache
|
|
166
|
-
all: string[]; // Union of active and unused
|
|
167
|
-
};
|
|
168
|
-
metrics: CacheMetrics | null;
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
```typescript
|
|
173
|
-
const status = tastyDebug.cache();
|
|
138
|
+
tastyDebug.inspect('.my-card');
|
|
139
|
+
// Logs: inspect div — 3 classes, 5 rules, 1.2KB
|
|
140
|
+
// Chunks: t3a5f→appearance, t9k2→font, tb71→dimension
|
|
174
141
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
console.log(
|
|
142
|
+
// Silent
|
|
143
|
+
const result = tastyDebug.inspect('.my-card', { raw: true });
|
|
144
|
+
console.log(result.classes); // ['t3a5f', 't9k2', 'tb71']
|
|
145
|
+
console.log(result.rules); // 5
|
|
178
146
|
```
|
|
179
147
|
|
|
180
148
|
---
|
|
181
149
|
|
|
182
|
-
### `
|
|
150
|
+
### `summary(opts?): Summary`
|
|
183
151
|
|
|
184
|
-
|
|
152
|
+
One-shot overview of the entire Tasty CSS state. Logs a compact report.
|
|
185
153
|
|
|
186
154
|
```typescript
|
|
187
|
-
|
|
155
|
+
interface Summary {
|
|
156
|
+
activeClasses: string[];
|
|
157
|
+
unusedClasses: string[];
|
|
158
|
+
totalStyledClasses: string[];
|
|
159
|
+
|
|
160
|
+
activeCSSSize: number;
|
|
161
|
+
unusedCSSSize: number;
|
|
162
|
+
globalCSSSize: number;
|
|
163
|
+
rawCSSSize: number;
|
|
164
|
+
keyframesCSSSize: number;
|
|
165
|
+
propertyCSSSize: number;
|
|
166
|
+
totalCSSSize: number;
|
|
167
|
+
|
|
168
|
+
activeRuleCount: number;
|
|
169
|
+
unusedRuleCount: number;
|
|
170
|
+
globalRuleCount: number;
|
|
171
|
+
rawRuleCount: number;
|
|
172
|
+
keyframesRuleCount: number;
|
|
173
|
+
propertyRuleCount: number;
|
|
174
|
+
totalRuleCount: number;
|
|
188
175
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
### `metrics(opts?): CacheMetrics | null`
|
|
196
|
-
|
|
197
|
-
Returns performance metrics for the style cache. Only available when `devMode` is enabled.
|
|
198
|
-
|
|
199
|
-
```typescript
|
|
200
|
-
interface CacheMetrics {
|
|
201
|
-
hits: number; // Successful cache hits
|
|
202
|
-
misses: number; // New styles injected (cache misses)
|
|
203
|
-
bulkCleanups: number; // Number of bulk cleanup operations
|
|
204
|
-
totalInsertions: number; // Lifetime style insertions
|
|
205
|
-
totalUnused: number; // Total styles marked as unused
|
|
206
|
-
stylesCleanedUp: number; // Total styles removed by cleanup
|
|
207
|
-
startTime: number; // Metrics collection start timestamp
|
|
208
|
-
unusedHits?: number; // Reactivations of cached unused styles
|
|
209
|
-
cleanupHistory: {
|
|
210
|
-
timestamp: number;
|
|
211
|
-
classesDeleted: number;
|
|
212
|
-
cssSize: number;
|
|
213
|
-
rulesDeleted: number;
|
|
214
|
-
}[];
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
const m = tastyDebug.metrics();
|
|
220
|
-
|
|
221
|
-
if (m) {
|
|
222
|
-
const hitRate = ((m.hits + (m.unusedHits || 0)) / (m.hits + m.misses)) * 100;
|
|
223
|
-
console.log(`Cache hit rate: ${hitRate.toFixed(1)}%`);
|
|
224
|
-
console.log(`Total insertions: ${m.totalInsertions}`);
|
|
225
|
-
console.log(`Bulk cleanups: ${m.bulkCleanups}`);
|
|
176
|
+
metrics: CacheMetrics | null;
|
|
177
|
+
definedProperties: string[];
|
|
178
|
+
definedKeyframes: { name: string; refCount: number }[];
|
|
179
|
+
chunkBreakdown: ChunkBreakdown;
|
|
226
180
|
}
|
|
227
181
|
```
|
|
228
182
|
|
|
229
|
-
### `resetMetrics(opts?): void`
|
|
230
|
-
|
|
231
|
-
Resets all performance metrics counters.
|
|
232
|
-
|
|
233
183
|
```typescript
|
|
234
|
-
|
|
184
|
+
// Logged automatically
|
|
185
|
+
tastyDebug.summary();
|
|
186
|
+
// Output:
|
|
187
|
+
// Active: 42 classes, 186 rules, 12.4KB
|
|
188
|
+
// Unused: 3 classes, 8 rules, 0.5KB
|
|
189
|
+
// Global: 12 rules, 1.1KB
|
|
190
|
+
// Total: 45 classes, 206 rules, 14.0KB
|
|
191
|
+
// Cache: 94.2% hit rate (312 lookups)
|
|
192
|
+
|
|
193
|
+
// Silent
|
|
194
|
+
const s = tastyDebug.summary({ raw: true });
|
|
195
|
+
console.log(s.totalRuleCount); // 206
|
|
235
196
|
```
|
|
236
197
|
|
|
237
198
|
---
|
|
238
199
|
|
|
239
200
|
### `chunks(opts?): ChunkBreakdown`
|
|
240
201
|
|
|
241
|
-
|
|
202
|
+
Breakdown of styles by chunk type.
|
|
242
203
|
|
|
243
204
|
```typescript
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
205
|
+
interface ChunkBreakdown {
|
|
206
|
+
byChunk: Record<string, {
|
|
207
|
+
classes: string[];
|
|
208
|
+
cssSize: number;
|
|
209
|
+
ruleCount: number;
|
|
210
|
+
}>;
|
|
211
|
+
totalChunkTypes: number;
|
|
212
|
+
totalClasses: number;
|
|
251
213
|
}
|
|
252
|
-
|
|
253
|
-
// Log a formatted breakdown to the console
|
|
254
|
-
tastyDebug.chunks({ log: true });
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
Chunk types: `combined` (non-chunked), `appearance`, `font`, `dimension`, `display`, `layout`, `position`, `misc`, `subcomponents`.
|
|
258
|
-
|
|
259
|
-
---
|
|
260
|
-
|
|
261
|
-
### `getGlobalTypeCSS(type, opts?): { css: string; ruleCount: number; size: number }`
|
|
262
|
-
|
|
263
|
-
Retrieves CSS for a specific global injection type.
|
|
264
|
-
|
|
265
|
-
```typescript
|
|
266
|
-
// CSS injected via injectGlobal()
|
|
267
|
-
const global = tastyDebug.getGlobalTypeCSS('global');
|
|
268
|
-
|
|
269
|
-
// CSS injected via injectRawCSS() / useRawCSS()
|
|
270
|
-
const raw = tastyDebug.getGlobalTypeCSS('raw');
|
|
271
|
-
|
|
272
|
-
// @keyframes CSS
|
|
273
|
-
const keyframes = tastyDebug.getGlobalTypeCSS('keyframes');
|
|
274
|
-
|
|
275
|
-
// @property CSS
|
|
276
|
-
const properties = tastyDebug.getGlobalTypeCSS('property');
|
|
277
|
-
|
|
278
|
-
console.log(`Global: ${global.ruleCount} rules, ${global.size}B`);
|
|
279
|
-
console.log(`Raw: ${raw.ruleCount} rules, ${raw.size}B`);
|
|
280
|
-
console.log(`Keyframes: ${keyframes.ruleCount} rules, ${keyframes.size}B`);
|
|
281
|
-
console.log(`Properties: ${properties.ruleCount} rules, ${properties.size}B`);
|
|
282
214
|
```
|
|
283
215
|
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
### `defs(opts?): Definitions`
|
|
287
|
-
|
|
288
|
-
Returns all defined `@property` and `@keyframes` entries.
|
|
289
|
-
|
|
290
216
|
```typescript
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
217
|
+
tastyDebug.chunks();
|
|
218
|
+
// Output:
|
|
219
|
+
// appearance: 24 cls, 48 rules, 3.2KB
|
|
220
|
+
// font: 18 cls, 18 rules, 1.1KB
|
|
221
|
+
// dimension: 31 cls, 45 rules, 2.4KB
|
|
295
222
|
```
|
|
296
223
|
|
|
297
|
-
|
|
298
|
-
const defs = tastyDebug.defs();
|
|
299
|
-
|
|
300
|
-
console.log('Properties:', defs.properties);
|
|
301
|
-
// ['--primary-color', '--surface-color', ...]
|
|
302
|
-
|
|
303
|
-
console.log('Keyframes:', defs.keyframes);
|
|
304
|
-
// [{ name: 'fadeIn', refCount: 2 }, { name: 'pulse', refCount: 1 }]
|
|
305
|
-
```
|
|
224
|
+
Chunk types: `combined`, `appearance`, `font`, `dimension`, `display`, `layout`, `position`, `misc`, `subcomponents`.
|
|
306
225
|
|
|
307
226
|
---
|
|
308
227
|
|
|
309
|
-
### `
|
|
228
|
+
### `cache(opts?): CacheStatus`
|
|
310
229
|
|
|
311
|
-
|
|
230
|
+
Cache state and performance metrics.
|
|
312
231
|
|
|
313
232
|
```typescript
|
|
314
|
-
interface
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
233
|
+
interface CacheStatus {
|
|
234
|
+
classes: {
|
|
235
|
+
active: string[];
|
|
236
|
+
unused: string[];
|
|
237
|
+
all: string[];
|
|
238
|
+
};
|
|
239
|
+
metrics: CacheMetrics | null;
|
|
321
240
|
}
|
|
322
241
|
```
|
|
323
242
|
|
|
324
|
-
The returned `Summary` object contains:
|
|
325
|
-
|
|
326
|
-
- **Classes**: `activeClasses`, `unusedClasses`, `totalStyledClasses`
|
|
327
|
-
- **CSS sizes**: `activeCSSSize`, `unusedCSSSize`, `globalCSSSize`, `rawCSSSize`, `keyframesCSSSize`, `propertyCSSSize`, `totalCSSSize`
|
|
328
|
-
- **CSS payloads**: `activeCSS`, `unusedCSS`, `globalCSS`, `rawCSS`, `keyframesCSS`, `propertyCSS`, `allCSS`
|
|
329
|
-
- **Rule counts**: `globalRuleCount`, `rawRuleCount`, `keyframesRuleCount`, `propertyRuleCount`
|
|
330
|
-
- **Page CSS** (when `includePageCSS` is set): `page.cssSize`, `page.ruleCount`, `page.stylesheetCount`, `page.skippedStylesheets`
|
|
331
|
-
- **Metrics & definitions**: `metrics`, `definedProperties`, `definedKeyframes`, `propertyCount`, `keyframeCount`
|
|
332
|
-
- **Cleanup summary**: `cleanupSummary.totalCleanups`, `cleanupSummary.totalClassesDeleted`, `cleanupSummary.lastCleanup`, etc.
|
|
333
|
-
- **Chunk breakdown**: `chunkBreakdown.byChunk`, `chunkBreakdown.totalChunkTypes`
|
|
334
|
-
|
|
335
243
|
```typescript
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
//
|
|
340
|
-
const s = tastyDebug.summary();
|
|
341
|
-
console.log(`Active: ${s.activeClasses.length} classes, ${s.activeCSSSize}B`);
|
|
342
|
-
console.log(`Unused: ${s.unusedClasses.length} classes, ${s.unusedCSSSize}B`);
|
|
343
|
-
console.log(`Total CSS: ${s.totalCSSSize}B`);
|
|
344
|
-
|
|
345
|
-
// Include page-level CSS stats
|
|
346
|
-
const withPage = tastyDebug.summary({ includePageCSS: true });
|
|
347
|
-
console.log(`Page CSS: ${withPage.page?.cssSize}B across ${withPage.page?.stylesheetCount} stylesheets`);
|
|
244
|
+
tastyDebug.cache();
|
|
245
|
+
// Output:
|
|
246
|
+
// Active: 42, Unused: 3
|
|
247
|
+
// Hits: 294, Misses: 18, Rate: 94.2%
|
|
348
248
|
```
|
|
349
249
|
|
|
350
250
|
---
|
|
351
251
|
|
|
352
|
-
### `
|
|
353
|
-
|
|
354
|
-
Returns all CSS on the page across all stylesheets (not only tasty-generated CSS).
|
|
355
|
-
|
|
356
|
-
```typescript
|
|
357
|
-
// Get all page CSS
|
|
358
|
-
const css = tastyDebug.pageCSS();
|
|
359
|
-
|
|
360
|
-
// Log it
|
|
361
|
-
tastyDebug.pageCSS({ log: true });
|
|
362
|
-
|
|
363
|
-
// Raw (unformatted)
|
|
364
|
-
tastyDebug.pageCSS({ prettify: false });
|
|
365
|
-
|
|
366
|
-
// Exclude cross-origin stylesheet placeholders
|
|
367
|
-
tastyDebug.pageCSS({ includeCrossOrigin: false });
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
### `pageStats(opts?): PageStats`
|
|
252
|
+
### `cleanup(opts?): void`
|
|
371
253
|
|
|
372
|
-
|
|
254
|
+
Removes every injected style that is neither carried by an element nor pinned by
|
|
255
|
+
an outstanding `inject()` handle — the same set `summary()` reports as unused.
|
|
256
|
+
Equivalent to `gc({ force: true })`.
|
|
373
257
|
|
|
374
258
|
```typescript
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
console.log(`${stats.ruleCount} rules, ${stats.skippedStylesheets} skipped (CORS)`);
|
|
259
|
+
tastyDebug.cleanup();
|
|
260
|
+
tastyDebug.cleanup({ root: shadowRoot });
|
|
378
261
|
```
|
|
379
262
|
|
|
380
263
|
---
|
|
381
264
|
|
|
382
|
-
### `
|
|
265
|
+
### `help(): void`
|
|
383
266
|
|
|
384
|
-
|
|
267
|
+
Prints a quick-start guide to the console.
|
|
385
268
|
|
|
386
269
|
```typescript
|
|
387
|
-
|
|
388
|
-
tastyDebug.log('active');
|
|
389
|
-
|
|
390
|
-
// Log CSS for a specific class
|
|
391
|
-
tastyDebug.log('t42');
|
|
392
|
-
|
|
393
|
-
// Log with custom title
|
|
394
|
-
tastyDebug.log('active', { title: 'Button styles' });
|
|
395
|
-
|
|
396
|
-
// Log CSS for an element
|
|
397
|
-
tastyDebug.log('.my-card');
|
|
270
|
+
tastyDebug.help();
|
|
398
271
|
```
|
|
399
272
|
|
|
400
|
-
The output includes:
|
|
401
|
-
- Rule count, line count, and byte size
|
|
402
|
-
- Sub-element breakdown (detects `[data-element="..."]` selectors)
|
|
403
|
-
- Full CSS in a collapsible group
|
|
404
|
-
|
|
405
273
|
---
|
|
406
274
|
|
|
407
|
-
### `
|
|
275
|
+
### `install(): void`
|
|
408
276
|
|
|
409
|
-
|
|
277
|
+
Attaches `tastyDebug` to `window.tastyDebug`.
|
|
410
278
|
|
|
411
279
|
```typescript
|
|
412
|
-
tastyDebug
|
|
280
|
+
import { tastyDebug } from '@tenphi/tasty';
|
|
281
|
+
tastyDebug.install();
|
|
413
282
|
```
|
|
414
283
|
|
|
415
284
|
---
|
|
416
285
|
|
|
417
|
-
|
|
286
|
+
## Shadow DOM Support
|
|
418
287
|
|
|
419
|
-
|
|
288
|
+
All methods accept a `root` option to target a Shadow DOM:
|
|
420
289
|
|
|
421
290
|
```typescript
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
tastyDebug.
|
|
426
|
-
|
|
427
|
-
// Then use from the browser console:
|
|
428
|
-
// > tastyDebug.summary({ log: true })
|
|
291
|
+
const shadowRoot = host.shadowRoot;
|
|
292
|
+
tastyDebug.css('all', { root: shadowRoot });
|
|
293
|
+
tastyDebug.inspect('.shadow-component', { root: shadowRoot });
|
|
294
|
+
tastyDebug.summary({ root: shadowRoot });
|
|
429
295
|
```
|
|
430
296
|
|
|
431
297
|
---
|
|
@@ -435,71 +301,32 @@ tastyDebug.install();
|
|
|
435
301
|
### Debugging a component's styles
|
|
436
302
|
|
|
437
303
|
```typescript
|
|
438
|
-
// 1.
|
|
304
|
+
// 1. Inspect the element
|
|
439
305
|
tastyDebug.inspect('.my-button');
|
|
440
|
-
// → { classes: ['t3', 't7'], chunks: [...], css: '...', rules: 4 }
|
|
441
306
|
|
|
442
307
|
// 2. See CSS for a specific class
|
|
443
|
-
tastyDebug.
|
|
308
|
+
tastyDebug.css('t3a5f');
|
|
444
309
|
|
|
445
|
-
// 3.
|
|
446
|
-
tastyDebug.
|
|
447
|
-
// → [{ className: 't3', chunkName: 'appearance' }, { className: 't7', chunkName: 'font' }]
|
|
310
|
+
// 3. Compare original vs browser-parsed (dev mode)
|
|
311
|
+
tastyDebug.css('t3a5f', { source: true });
|
|
448
312
|
```
|
|
449
313
|
|
|
450
314
|
### Checking cache efficiency
|
|
451
315
|
|
|
452
316
|
```typescript
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
317
|
+
const { metrics } = tastyDebug.cache({ raw: true });
|
|
318
|
+
if (metrics) {
|
|
319
|
+
const total = metrics.hits + metrics.misses;
|
|
320
|
+
const rate = total > 0 ? ((metrics.hits / total) * 100).toFixed(1) : 0;
|
|
321
|
+
console.log(`Cache hit rate: ${rate}%`);
|
|
322
|
+
}
|
|
457
323
|
```
|
|
458
324
|
|
|
459
325
|
### Monitoring CSS growth
|
|
460
326
|
|
|
461
327
|
```typescript
|
|
462
|
-
const s = tastyDebug.summary();
|
|
463
|
-
console.log(`Total
|
|
464
|
-
console.log(`Active: ${
|
|
465
|
-
console.log(`Unused
|
|
466
|
-
|
|
467
|
-
// Compare with total page CSS
|
|
468
|
-
const page = tastyDebug.pageStats();
|
|
469
|
-
const ratio = ((s.totalCSSSize / page.cssSize) * 100).toFixed(1);
|
|
470
|
-
console.log(`Tasty is ${ratio}% of total page CSS`);
|
|
328
|
+
const s = tastyDebug.summary({ raw: true });
|
|
329
|
+
console.log(`Total: ${s.totalRuleCount} rules, ${(s.totalCSSSize / 1024).toFixed(1)}KB`);
|
|
330
|
+
console.log(`Active: ${s.activeRuleCount} rules`);
|
|
331
|
+
console.log(`Unused: ${s.unusedRuleCount} rules`);
|
|
471
332
|
```
|
|
472
|
-
|
|
473
|
-
### Analyzing chunk distribution
|
|
474
|
-
|
|
475
|
-
```typescript
|
|
476
|
-
tastyDebug.chunks({ log: true });
|
|
477
|
-
// → Formatted breakdown:
|
|
478
|
-
// • appearance: 24 classes, 3.2KB, 48 rules
|
|
479
|
-
// • font: 18 classes, 1.1KB, 18 rules
|
|
480
|
-
// • dimension: 31 classes, 2.4KB, 45 rules
|
|
481
|
-
// • ...
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
---
|
|
485
|
-
|
|
486
|
-
## Shadow DOM Support
|
|
487
|
-
|
|
488
|
-
All methods accept a `root` option to target a Shadow DOM instead of the main document:
|
|
489
|
-
|
|
490
|
-
```typescript
|
|
491
|
-
const shadowRoot = host.shadowRoot;
|
|
492
|
-
|
|
493
|
-
tastyDebug.css('all', { root: shadowRoot });
|
|
494
|
-
tastyDebug.inspect('.shadow-component', { root: shadowRoot });
|
|
495
|
-
tastyDebug.summary({ root: shadowRoot, log: true });
|
|
496
|
-
tastyDebug.chunks({ root: shadowRoot, log: true });
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
---
|
|
500
|
-
|
|
501
|
-
## Integration with Tasty
|
|
502
|
-
|
|
503
|
-
`tastyDebug` reads directly from the [Style Injector](./injector.md)'s internal registries. It does not inject, modify, or intercept any styles. The `cleanup()` method is the only method with side effects — it triggers the injector's garbage collection for unused styles.
|
|
504
|
-
|
|
505
|
-
For most development, you'll use the [Tasty style system](./usage.md) to create components and the debug utilities to inspect the resulting CSS at runtime.
|