The markup contract (@cascivo/css)

cascivo's components are described by one contract: stable cv-<unit>-<local> class names, a cv-<unit> alias on each root, and the data-* attributes that select variants and states. The contract is plain CSS, so it works from HTML, htmx, Solid, Rust templates or any framework. React renders the same names.

Use it

import '@cascivo/themes/light.css'
import '@cascivo/css/cascivo.css' // all units; or '@cascivo/css/button.css' for one
import { classes as c } from '@cascivo/css'

c.button.root // 'cv-button-button' (the root class)
c.button.alias // 'cv-button' (same root, same specificity)
c.button.label // 'cv-button-label'
c.button.lable // type error: the map is typed from contract.json
<button class="cv-button-button" data-variant="primary" data-state="idle">
  <span class="cv-button-label">Save</span>
</button>

Tiers

TierMeaningRust emitter (cascivo-html)
staticMarkup onlyyes, with a parity case
nativeNative elements do the behaviour (<details>, form controls)yes, with a parity case
behaviourNeeds JS (menus, overlays, pickers). Markup is in the contract; behaviour is Phase 4no

Six static units have no emitter yet and are listed with a reason in packages/components/test/html-conformance/parity-coverage-allowlist.json: code-snippet, indicator, inline-citation, input-group, qr-code, relative-time.

Where it comes from (gate G2)

Each component's <name>.meta.ts declares contractTier (static, native or behaviour, see Tiers) and anatomy: every part, its element and the data-* attributes and values it accepts. pnpm contract:generate (in regen) builds contract.json from them and throws on an invalid tier or anatomy (scripts/contract/anatomy.ts, tested in pnpm contract:check). The check runs both ways: every class in the CSS module is an anatomy part and every part is a class, and the data-variant/data-size/data-state values agree with the meta.

Versioning (gate G1)

packages/css/contract.baseline.json is the contract of the last published @cascivo/css. scripts/contract/semver.test.ts (in pnpm contract:check, part of ready and CI) diffs contract.json against it.

Parity (gate G3)

Every static and native unit has a cascivo-html emitter, a React-vs-Rust parity case and a PARITY_COMPONENTS row, or an allowlist entry with a reason (scripts/checks/parity-coverage.test.ts). The allowlist may only shrink: an entry for a unit that gained an emitter fails as stale.

Rules

As Markdown: /docs/contract.md

← All guides