From 1e534dfbf2182dafb235eb2a284996d80b4b305c Mon Sep 17 00:00:00 2001 From: BigSimmo <87357024+BigSimmo@users.noreply.github.com> Date: Thu, 27 Aug 2026 14:10:04 +0800 Subject: [PATCH 1/9] fix(design-system): pay down Hazard 1-2 contract debt Remaining Lucide size={15} and 1px shadow spreads were blocking the token contract. Map those to named tokens, drop unused v2 line-height companions, and record leftover Hazard 2/3 items in FIX-GUIDE. Co-authored-by: Cursor --- docs/design-system-contract.md | 2 +- docs/design-system/COMPONENTS.md | 6 +- docs/design-system/FIX-GUIDE.md | 94 +++++++++++++++++++ docs/design-system/GATES.md | 12 +-- docs/design-system/README.md | 1 + docs/design-system/TOKENS.md | 9 +- scripts/design-system-contract-baseline.json | 72 ++++++-------- scripts/design-system-contract-utils.mjs | 31 ++++++ src/app/ckb-v2-tokens.css | 23 +---- src/app/globals.css | 13 ++- .../differential-detail-page.tsx | 4 +- .../specifiers/specifier-builder-page.tsx | 6 +- src/components/specifiers/specifier-ui.tsx | 6 +- .../therapy-compass/screens/brief-screen.tsx | 5 +- .../screens/compare-screen.tsx | 6 +- .../screens/recommend-screen.tsx | 2 +- .../therapy-compass/screens/sheets-screen.tsx | 6 +- .../therapy-compass/therapy-card.tsx | 5 +- tests/ckb-v2-token-contract.test.ts | 13 ++- tests/design-system-contract-utils.test.ts | 46 +++++++++ 20 files changed, 250 insertions(+), 112 deletions(-) create mode 100644 docs/design-system/FIX-GUIDE.md diff --git a/docs/design-system-contract.md b/docs/design-system-contract.md index ce96a3b554..850ab04813 100644 --- a/docs/design-system-contract.md +++ b/docs/design-system-contract.md @@ -29,7 +29,7 @@ npm run check:icon-scale - **Text Roles**: `var(--text)`, `var(--text-muted)`, `var(--text-heading)`, `var(--text-soft)` - **Status & Safety Triads**: `--success-*`, `--warning-*`, `--danger-*`, `--info-*` (reserved exclusively for clinical/system status). - **Focus Ring & Outlines**: `var(--focus)` for all keyboard and visible focus rings. -- **Raw Color Exemptions**: Strict and enumerated in `RAW_COLOR_EXEMPTIONS` in `scripts/design-system-contract-utils.mjs` (e.g., globals token definitions, brand mark SVG builder, diagnostic visualizations, OpenGraph art, printable patient/factsheet paper). +- **Raw Color Exemptions**: Strict and enumerated in `RAW_COLOR_EXEMPTIONS` in `scripts/design-system-contract-utils.mjs` (e.g., globals token definitions, brand mark SVG builder, diagnostic visualizations, OpenGraph art, printable patient/factsheet paper). Medication record accent defaults (`#0f766e` in `src/lib/medications.ts` and `src/lib/medication-records.ts`) are a **scoped** exemption for the Postgres `accent` column default only — not a whole-file blank cheque, and not a mapping onto `--clinical-accent`. ### 2.2 Typography Scale diff --git a/docs/design-system/COMPONENTS.md b/docs/design-system/COMPONENTS.md index e1a2b7cb4e..72afab134c 100644 --- a/docs/design-system/COMPONENTS.md +++ b/docs/design-system/COMPONENTS.md @@ -20,7 +20,7 @@ derived from source, `.design-sync/config.json`, previews, direct contract cover production imports. It intentionally does not claim dark, forced-colours, 320px, print, remote publication, or product adoption without separate evidence. -### 0.1 Registered visual components (54 — local contract; remote status unverified) +### 0.1 Registered visual components (55 — local contract; remote status unverified) Every visual export has one source map entry, a source-derived public `*Props` contract (except the two zero-prop roots), a reference preview, and a direct static publication test. The generated @@ -37,7 +37,7 @@ table under **Generated maturity snapshot** is the canonical list and product-im _Remaining from the original eight in this document:_ `DocumentFrame` is built locally (`src/components/ui/document-frame.tsx`, shell-only in `DocumentViewer`) but is not yet among -the 54 design-sync registered visual exports — registration and full controls remain follow-up. +the 55 design-sync registered visual exports — registration and full controls remain follow-up. `OverlayRoot`, `SegmentedControl`, and the PR 6–8 components are built and represented by the local publication contract. The generated snapshot records their current product-import counts; @@ -86,7 +86,7 @@ print primitives (`PrintHeader`, `PrintFooter`, `CitationFootnote`, `PrintOnly`, | Progress/StageList | all four resolved: `scaleX`, the theme `animate-shimmer` in place of a hardcoded `1.4s`, a step index clamped to ≥1, and an sr-only `role="status"` sibling in place of `aria-live` on the whole `
    ` | **done** | | EmptyState | static live-off default with explicit polite/assertive opt-in | **done** (PR 8) | | AccessibleTable | semantic caption, `MissingValue` cells, dense headers (clipped header keeps its full string as `title`) and the expander (now the registered `Button`, off the local ring-focus recipe) landed; content-role widths remain | PR 6/PR 12 remainder | -| ui-primitives.tsx | 698-line module mixing recipes/actions/feedback/clinical — split. Re-measured 2026-08-12: **157** production files import it (202 including mockups), against the 54 registered components' **31** with product imports; this module, not the registry, is what the product actually runs on. Per-primitive breakdown added 2026-08-21: `Button` **12** importers against 157, with **112** production files still holding a raw `