Skip to content
Toolkit

ADR-0044: The two-file allowlist becomes three — 30-primitives.css joins the component layer

  • Status: Accepted
  • Date: 2026-08-21
  • Deciders: Renaissance workstream 002, phase 03 first slice (open-items ledger row 113 / LEDGER "layout primitives" row); resolves the decision deferred by ADR-0035 and measured by ADR-0042; applies ADR-0023

Context

dist/studio.components.css — the layer a consumer carrying its own component CSS imports alone — was built from exactly two source files, 50-components.css and 55-components-extended.css. The two-file allowlist is not an accident of history: it is the layer's safety argument. Every selector in those files stays inside the .lk-/.studio- namespace, so the layer cannot restyle a consumer's own markup, and build-css.mjs checks that on every build rather than asserting it.

Meanwhile @studio/react exports seven layout primitives — Stack, Cluster, Grid, Container, Split, Switcher, Frame — whose ten classes live in 30-primitives.css, outside the allowlist. So every layout primitive the React package exports rendered unstyled for a component-layer consumer: the third instance of the ADR-0023 trap after .lk-seg and .lk-btn--danger, recorded by ADR-0035, dispositioned as ten rows in layer-classes.json by ADR-0042's gate, and named by SESSION.md as a blocker on phase 03 — promoting .stack (167 positions, 73 files) and the 50 hand-rolled <form>s cannot start while <Stack> is a bare flexless <div> in this app.

The ledger row was explicit that this is "a decision, not a patch": widening the allowlist weakens nothing only if the added file meets the same containment bar the original two set.

Decision

30-primitives.css joins the component-layer allowlist, ordered first, so the standalone layer concatenates primitives → components → extended in the same relative order as the full bundle and the cascade cannot differ between the two.

It qualifies on the allowlist's own terms, checked rather than asserted:

  • Seven rules, every selector rooted in a .lk- class. No element subjects, no resets, no :root, no @keyframes.
  • Its two non-class parts never leave their subject: .lk-switcher > * and .lk-frame > img sit behind a child combinator, the exact containment idiom the namespace check codifies for .lk-prose > * + *.
  • Its one at-rule is a @media wrapper whose inner selectors are .lk- compounds; the prelude carries no selector.

The build's namespace check now runs over the three-file concatenation and passes — the proof the ledger row demanded before any widening.

The criterion this sets for the next widening: a source file may join the allowlist only when (a) @studio/react emits classes the layer does not define, and (b) the whole file passes the namespace check as-is. A file that fails (b) does not get a carve-out or a partial extraction into the allowlist; its classes get a component-owned restatement instead — the ADR-0039 rule, which is why 80-code.css (whose :root subjects fail the check) stays out and .tok-* reached the layer inside .lk-code's own block. Shell files fail (a)-adjacent judgement rather than mechanics: their 62 classes are latent for every current consumer, and importing "the component layer" should not silently ship a shell.

Consequences

  • The ten primitive classes are now defined in the standalone layer: check:layer-completeness moves from 293 emitted / 193 defined / 100 dispositioned to 293 / 203 / 93, and the ten 30-primitives.css disposition rows are deleted under its own staleness rule (L2).
  • Every layout primitive @studio/react exports is styled in this app with no app-side change — index.css already imports @studio/core/css/components.
  • Phase 03's named blocker is gone. The .stack promotion can now convert call sites to <Stack> and delete app rules as it goes, under the normal per-conversion method.
  • Primitives are tuned by custom properties (--gap, --min, --aside, --ratio, --measure) with token defaults (var(--space-4) etc.), so a component-layer consumer without Studio's token layer gets the property-initial fallback, not a break — same degradation contract as the rest of the layer.
  • The component layer is no longer "the two files"; comments and ADRs that used the phrase as a definition now date from before this ADR. build-css.mjs's own comment is updated; the historical uses stand.

Source: docs/decisions/0044-the-two-file-allowlist-becomes-three.md

Library