Theming-isolation prototype for ADR-S4. Demonstrates host theme injection without global CSS leakage, runtime class collisions, duplicated providers, or inaccessible overrides.
tokens.css— the kit-owned token contract (9 categories of role-name custom properties, §S0.9.c). Scoped to[data-workbench-theme]— not bare:root— so kit defaults never enter the global scope.archetypes.css— four host archetype value profiles (§S0.9.e), each scoped to[data-workbench-archetype="…"].
Isolation guarantees (§S0.9.d)#
- No global CSS leakage. Every declaration lives under
[data-workbench-theme], so a host that does not opt in is untouched. The kit never writes to:root. - No runtime class collisions. The kit exposes custom-property names
(
--wk-*), not utility classes; a host's class names can never collide with a token name. - No duplicated providers. A host mounts exactly one element carrying
data-workbench-theme(+ optionaldata-workbench-archetype/data-density). Nesting a second scope simply re-scopes its subtree — the cascade resolves it; there is no separate JS provider to duplicate. - No inaccessible overrides.
prefers-reduced-motion,forced-colors, and[data-density]are handled at the contract level, so a host override cannot silently defeat them — the media queries re-apply under the scoped selector.
Usage sketch#
html
<div
data-workbench-theme
data-workbench-archetype="operator"
data-density="compact"
>
<!-- shared kit components read var(--wk-color-*, --wk-space-*, --wk-motion-*) -->
</div>
The value profile is chosen by the host; the token names come from the kit. This realizes §S0.9.b (contract kit-owned, values host-owned) as running CSS.