Organism · stable · v1.0.0 · owner: Site system lead · contract 19 of 20 points (open: figma)
Do and don't
Do: The demo
Rendered by read-your-stylesheet.tsOpen example: Read your own stylesheet · Do: The demo Use the full-page example to follow page links.
Do: Leads with the finding
Rendered by read-your-stylesheet.tsOpen example: Read your own stylesheet · Do: Leads with the finding Use the full-page example to follow page links.
Don't: Sending code to a server
Rendered by read-your-stylesheet.tsOpen example: Read your own stylesheet · Don't: Sending code to a server Use the full-page example to follow page links.
Don't: Claiming all eight areas
Rendered by read-your-stylesheet.tsOpen example: Read your own stylesheet · Don't: Claiming all eight areas Use the full-page example to follow page links.
Rules
| Rule | Why | Check |
|---|---|---|
| Read your own stylesheet is computed by Loom's code from Loom's own audit code, run in the reader's browser on pasted CSS or tokens, not drawn by hand. | A showcase is proof only if the product's own code produced what it shows. | Automated: scripts/site/interactives/check.ts (recomputes the showcase data and fails on drift) |
| The audit runs in the browser; nothing is sent. | People paste private code only when they know it stays with them. | Automated: tests/site/demos.spec.ts (no network requests during the run) |
API
| Prop | Type | Required | Default | What it does |
|---|---|---|---|---|
lang | en | ja | No | "en" | Root interface locale; changing it requires disposal and preparation. Existing source output and static explanatory copy remain English. |
instanceKey | string | No | Optional deterministic unique key for repeated static specimens; letter first, then letters, digits, underscore or hyphen, up to64 characters. Omit for the existing singleton anchors; duplicate explicit keys are unsupported. |
Contract details
The full contract: identity, anatomy, variants, states, tokens, layout, motion, accessibility, content, tests
Identity
| Aspect | Value |
|---|---|
| Id | read-your-stylesheet |
| Layer | Organisms |
| Category | showcase |
| Owner | Site system lead |
| Status | stable |
| Version | 1.0.0 |
| Source | apps/showcase/site/system/organisms/read-your-stylesheet.ts (private repository; the contract and the render function are this one module) |
| Version | Date | Change |
|---|---|---|
| 1.0.0 | 2026-10-26 | Read your own stylesheet: computed by Loom's code from Loom's own audit code, run in the reader's browser on pasted CSS or tokens. |
Use when
- The See page and its demo page. Why: The reader's own code is the most convincing input.
Do not use when
- To claim a full audit. Why: It reads two of eight areas; the rest need the repository, and it says so.
Anatomy
| Part | What it is |
|---|---|
| root | div.demo[data-demo=mini-audit] |
| input | Textarea and presets |
| lead | The lead finding sentence (ix-read-found) |
| output | Raw colours, contrast and coverage |
| next | The links to a Quick audit and the health check |
Made of: showcase-frame, form-field, control, finding, band-word, arrow-link, caption.
Used in: pages directly.
Variants
| Variant | When | Why |
|---|---|---|
| full | On its demo page and its section. | The whole experience where the claim is made. |
States
| State | Rendered or not applicable |
|---|---|
| default | A preset already read, with its findings |
| hover | Preset chips show hover. |
| focus-visible | The --focus ring on the textarea and chips. |
| active | Running: a status line with the time taken. |
| disabled | Not applicable: Never. |
| loading | Runs in a few milliseconds; the status says 'checked in N ms'. |
| empty | An empty input says what to paste. |
| error | Unparseable input is read as plain text and says so; nothing crashes. |
| current | The chosen preset is pressed. |
| visited | Not applicable: Not a link. |
| expanded | Not applicable: Does not open. |
Tokens
| Part | Token |
|---|---|
| found.rule | --rule --ix-wait |
| pair.fail | --madder-ink word |
| pair.pass | --teal-ink word |
| --read-your-stylesheet-gap-space-7 | var(--space-7) |
| --read-your-stylesheet-gap-space-9 | var(--space-9) |
| --read-your-stylesheet-gap-space-5 | var(--space-5) |
| --read-your-stylesheet-font-type-label | var(--type-label) |
| --read-your-stylesheet-color-ink-2 | var(--ink-2) |
| --read-your-stylesheet-padding-space-6 | var(--space-6) |
| --read-your-stylesheet-color-term-fg | var(--term-fg) |
| --read-your-stylesheet-background-term-bg | var(--term-bg) |
| --read-your-stylesheet-border-line-strong | var(--line-strong) |
| --read-your-stylesheet-border-radius-radius | var(--radius) |
| --read-your-stylesheet-outline-indigo-ink | var(--indigo-ink) |
| --read-your-stylesheet-gap-space-4 | var(--space-4) |
| --read-your-stylesheet-padding-space-2 | var(--space-2) |
| --read-your-stylesheet-padding-space-5 | var(--space-5) |
| --read-your-stylesheet-background-cotton | var(--cotton) |
| --read-your-stylesheet-background-ink | var(--ink) |
| --read-your-stylesheet-color-cotton | var(--cotton) |
| --read-your-stylesheet-gap-space-6 | var(--space-6) |
| --read-your-stylesheet-margin-top-space-4 | var(--space-4) |
| --read-your-stylesheet-font-size-fs-small | var(--fs-small) |
| --read-your-stylesheet-margin-top-space-3 | var(--space-3) |
| --read-your-stylesheet-border-line | var(--line) |
| --read-your-stylesheet-color-teal-ink | var(--teal-ink) |
| --read-your-stylesheet-padding-bottom-space-5 | var(--space-5) |
| --read-your-stylesheet-font-type-h2 | var(--type-h2) |
| --read-your-stylesheet-letter-spacing-ls-h2 | var(--ls-h2) |
| --read-your-stylesheet-margin-right-space-4 | var(--space-4) |
| --read-your-stylesheet-ix-ok-teal-ink | var(--teal-ink) |
| --read-your-stylesheet-ix-wait-saffron-ink | var(--saffron-ink) |
| --read-your-stylesheet-ix-broken-madder-ink | var(--madder-ink) |
| --read-your-stylesheet-ix-action-indigo-ink | var(--indigo-ink) |
| --read-your-stylesheet-border-top-rule | var(--rule) |
| --read-your-stylesheet-margin-space-7 | var(--space-7) |
| --read-your-stylesheet-font-type-h3 | var(--type-h3) |
| --read-your-stylesheet-margin-space-4 | var(--space-4) |
| --read-your-stylesheet-letter-spacing-ls-h3 | var(--ls-h3) |
| --read-your-stylesheet-margin-space-5 | var(--space-5) |
| --read-your-stylesheet-gap-space-3 | var(--space-3) |
Layout
| Aspect | Value |
|---|---|
| breakpoints | Required review at 390, 768, 1024 and 1440 px; execution is not implied by this declaration; columns stack under 768 px and controls fill the row on phones. |
| wrapping | Text wraps; code panes scroll inside their own focusable region. |
| textExpansion | Japanese strings come from the i18n tables and wrap; engine output stays English. |
Spacing and rhythm
| Aspect | Value |
|---|---|
| internal | Inside the Showcase frame's padding, controls and caption at its foot. |
| external | Full width of its section. |
| rhythm | One showcase per section, after the section's claim (D-SITE-008). |
Motion
| Aspect | Value |
|---|---|
| None | Results replace the previous ones when the reader runs the audit; nothing plays. |
Runtime and reuse
stylesheet: /css/site.css. Built Site tokens, core and registered element CSS; preserve modes, focus and responsive rules.
stylesheet: /css/demos.css. Existing legacy demo styles where the rendered specimen uses them.
font: /fonts/. Self-hosted files referenced by Site @font-face, with licences; Japanese locale overrides remain applicable.
data: /i18n/ja.json. Required for a Japanese root; English interface fallbacks are authored in source. Root language changes require disposal and fresh preparation.
Static fallback: Original build-time specimen remains readable before loading and after chunk/initialization failure; enhancement controls retain authored hidden state.
Before DOM initialization the configured host awaits apps/showcase/site/demos/mini-audit.ts#prepare for this root with a mount-owned AbortSignal. Preparation must throw on missing/invalid data; disposal/replacement aborts pending work, and a stale result cannot initialize or claim ready.
Configured initializer: apps/showcase/site/demos/mini-audit.ts#init. The host owns transactional static-markup restoration and runtime state.
Consumer module (imports relative to the configured source root): import { createRuntimeHost } from "./src/workflows/runtime-host"; import { SITE_RUNTIMES } from "./apps/showcase/site/runtime-registry"; const definition = SITE_RUNTIMES.find(entry => entry.binding.id === "mini-audit"); if (!definition || definition.binding.lifecycle.kind !== "managed") throw new Error("Managed runtime binding unavailable"); const host = createRuntimeHost([definition]); export function mountRuntime(container: ParentNode) { return host.mountAll(container); }After inserting the rendered markup, call mountRuntime(container) for the container holding [data-demo="mini-audit"]. Retain the returned disposal function and call it before removing, replacing or remounting, including every Storybook args render. The configured host restores captured static markup/attributes on disposal or caught load/initialization failure; retry starts a fresh managed remount.
Accessibility passport
| Aspect | Value |
|---|---|
| role | region with a heading, or a figure |
| name | Its heading or caption |
| keyboard | Tab to the controls; Space plays or pauses; arrows move the steps; End shows the last step. |
| focus | Controls in reading order; focus never moves on its own. |
| screenReader | Manual frame selection and pause announce their settled content. Explicit Play announces the final settled summary once; autoplay and system interruption/disposal stay silent. Legacy initializers outside the shared player remain explicitly unassessed. |
| contrast | Ink on surface 14:1; state dyes only as marks with words. |
| target | Controls are 44 px. |
Content
| Slot | Length | Voice |
|---|---|---|
| lead | 1 sentence | The finding first: '8 raw colours…' |
Good: “8 raw colours. Each one is a decision about colour that nobody made at the system level.”
Bad: “Your CSS is bad”
Japanese: Interface translated; findings stay English with a note.
Icons and illustrations
None: this element uses no icon or illustration of its own.
Decisions and exceptions
Usage
40 uses across the built pages (measured by npm run site:system).
Tests
| Aspect | Value |
|---|---|
| unit | tests/unit/site-system.test.ts: renders every do and don't example through the registry and checks the classes it owns |
| visual | Not yet: there are no screenshot baselines; the Library page is checked for sideways scroll at 1440 px by tests/site/system.spec.ts |
| a11y | tests/site/system.spec.ts: axe (0 serious or critical) on the element's Library page in light and dark |
| parity | scripts/site/system/check.ts: Library examples are rendered by the same render function the site imports |
Figma
not-yet: The Loom Site Figma library is the last stage of the plan; this element is not mapped yet.