# zRuntime Reference > Extracted directly from `src/js/runtime/` and `registry/runtime/`. For token-efficient AI consumption, start with [runtime.compact.md](https://next.0build.dev/docs/runtime.compact.md). ## `window.zRuntime` API | Property / Method | Kind | Signature | Description | | --- | --- | --- | --- | | `zRuntime.debug` | config | `boolean (default: false)` | Boolean flag enabling per-plugin diagnostics in the browser console during development. | | `zRuntime.customRules` | config | `Rule[]` | Array of custom `Rule` definitions merged ahead of style generation (matching selectors replace built-ins). | | `zRuntime.safelist` | config | `(string \| SafelistDescriptor)[]` | Array of class strings or descriptor objects to pre-generate even when absent from the initial DOM. | | `zRuntime.refresh` | method | `() => void` | Clears the internal rule cache and runs style generation from scratch. | | `zRuntime.regenerate` | method | `() => void` | Re-runs style generation while preserving the existing rule cache. | | `zRuntime.getCache` | method | `() => Map` | Returns the internal `Map` of compiled CSS rules keyed by class, state, theme, and breakpoint. | | `zRuntime.getRules` | method | `() => Rule[]` | Returns the merged array of active built-in and custom `Rule` definitions. | | `zRuntime.decoder` | helper | `function` | Parses a raw utility class token into a structured `ParsedClass` descriptor. | | `zRuntime.encoder` | helper | `function` | Serializes a `ParsedClass` descriptor back into a utility class token string. | | `zRuntime.escaper` | helper | `function` | Escapes special CSS selector characters (such as `:`, `[`, `]`, `/`) for generated rules. | | `zRuntime.variable` | helper | `function` | Computes the expected CSS custom property name for a class, breakpoint, theme, and state. | ## DOM Events | Event | Description | | --- | --- | | `z-runtime:init` | Dispatched on `document` when the CLS-prevention plugin initializes. | | `z-runtime:ready` | Dispatched on `document` after runtime styles have been injected and `z-not-ready` has swapped to `z-ready`. | ## Breakpoints | Prefix | Min-width | | --- | --- | | `sm:` | `40rem` | | `md:` | `48rem` | | `lg:` | `64rem` | | `xl:` | `80rem` | | `2xl:` | `96rem` | ## Pseudo-classes `:hover`, `:active`, `:focus`, `:focus-visible`, `:focus-within`, `:target`, `:checked`, `:disabled`, `:group-hover` ## Pseudo-elements `::before`, `::after` ## Colors & Intensities - **Colors (26):** `red`, `orange`, `amber`, `yellow`, `lime`, `green`, `emerald`, `teal`, `cyan`, `sky`, `blue`, `indigo`, `violet`, `purple`, `fuchsia`, `pink`, `rose`, `slate`, `gray`, `zinc`, `neutral`, `stone`, `taupe`, `mauve`, `mist`, `olive` - **Intensities (11):** `50`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900`, `950` - **Cascade layers:** `@layer components`, `@layer styles`, `@layer utilities` ## Built-in Plugins (Execution Order) | Plugin | Source | Hooks | Config Keys | Events | Description | | --- | --- | --- | --- | --- | --- | | `cls-prevention` | `src/js/runtime/plugins/cls-prevention.ts` | `onInit`, `onAfterInject` | — | `z-runtime:init`, `z-runtime:ready` | Dispatches `z-runtime:init` / `z-runtime:ready` and swaps `z-not-ready` to `z-ready` on `` after CSS injection. | | `custom-rules` | `src/js/runtime/plugins/custom-rules.ts` | `onRulesLoad` | `customRules` | — | Validates and merges `window.zRuntime.customRules` into the active rule list. | | `inline-vars` | `src/js/runtime/plugins/inline-vars.ts` | `onElementScan` | — | — | Expands `class=value` shorthands (colors, `/o` opacity, auto-bracketed scale redirects) into inline CSS variables and reports missing variables in debug mode. | | `dom-extractor` | `src/js/runtime/plugins/dom-extractor.ts` | `onElementScan` | — | — | Scans `[class]` elements for interactive pseudo-class/pseudo-element tokens and warns when paired `content-before`/`content-after` classes are missing. | | `safelist` | `src/js/runtime/plugins/safelist.ts` | `onAdditionalClasses` | `safelist` | — | Expands `window.zRuntime.safelist` strings and `{ class, states, prefixes, dark }` combinations into compiled classes. | | `arbitrary-properties` | `src/js/runtime/plugins/arbitrary-properties.ts` | `onElementScan` | — | — | Parses `[property]={value}` tokens (including dark, breakpoint, and state variants) and registers one-off rules into `@layer utilities`. | ## `ZRuntimePlugin` Lifecycle Hooks | Hook | Signature | Description | | --- | --- | --- | | `onInit` | `(core: ZRuntimeCore) => void` | Runs immediately when a plugin is registered via `.use(plugin)`. | | `onRulesLoad` | `(rules: Rule[], core: ZRuntimeCore) => Rule[]` | Transforms or extends the active `Rule[]` array at the start of `generate()`. | | `onElementScan` | `(element: Element, rules: Rule[], core: ZRuntimeCore) => ParsedClass[]` | Inspects each `[class]` DOM element and returns `ParsedClass[]` entries to compile. | | `onAdditionalClasses` | `(core: ZRuntimeCore) => ParsedClass[]` | Provides extra `ParsedClass[]` entries not present in the DOM (such as safelists). | | `onBeforeInject` | `(generatedCss: GeneratedCSS, core: ZRuntimeCore) => GeneratedCSS` | Transforms the grouped `GeneratedCSS` layers right before `