API
Debug
`<ui-debug>`: a development-time audit of every style utility and attribute on the page.
Installation
pnpm dlx zazz-ui add debugnpx zazz-ui add debugyarn dlx zazz-ui add debugbunx zazz-ui add debugRun zazz-ui init first if the project has no zazz/ folder yet.
Example
Add it once, at the end of <body>, in the pages you develop on. It audits the whole page and logs its findings to the console. On a hostname it doesn't list, it removes itself and logs one warning saying so (data-debug-warnings="false" silences that), so the tag can stay in a shared template.
<ui-debug data-debug-domains="localhost, staging.example.com"></ui-debug>Behavior
primitives/debug/audit-core.js
The DOM-free audit behind <ui-debug> and the html lint rules. Works on AuditNode, a five-method view of an element, so the browser (a live Element) and the linter (an html-eslint Tag) run the same checks and raise the same messages. Each finding names its rule and, where it can, the span of the declaration it is about (offsets into the style attribute) and a suggested rewrite.
primitives/debug/debug.js
<ui-debug>: audits utilities in style attributes. Development only. On a listed domain the element walks every element once, and again on mutation, and warns about the mistakes the generated gates cannot report: an unknown utility, a wrong mode, a tier without a base, a modifier the family lacks, a base utility that flattens a state a primitive's hook covers, a raw property shadowing a utility, a whitespace form the gates cannot match, and a data-<name>-* attribute outside its identity. On an unlisted domain it removes itself and logs DEBUG_WARNING once. Identities and hooks are read from the page's stylesheets, so the audit needs no manifest. The checks live in audit-core.ts, which the html lint rules (@zazz-ui/eslint-plugin) share.
Attributes
| Attribute | Kind | Values | Notes |
|---|---|---|---|
data-debug-domains | Config | free value | Configuration the kit's script reads. |
data-debug-warnings | Config | false | Configuration the kit's script reads. |