From f275e9b2fef2f583867db0eb9bbf5d47f44ef46a Mon Sep 17 00:00:00 2001 From: BigSimmo <87357024+BigSimmo@users.noreply.github.com> Date: Fri, 7 Aug 2026 14:18:43 +0800 Subject: [PATCH] refactor(tokens): migrate production letterspacing onto the named scale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completes the work #1663 set up. #1655 and #1658 have landed, so `ui-primitives.tsx` and the answer surface are free to touch. 68 arbitrary `tracking-[…]` call sites across 40 production files fold onto the five named roles. That is every statically resolvable site the contract can see; the ratchet now reports `arbitrary tracking 0`, down from 68. Fold applied, as committed in globals.css: -0.008 / -0.01 / -0.035 / -0.04 -> tracking-display (6 sites) 0.01 / 0.02 -> tracking-normal (2) 0.04 / 0.05 / 0.06 -> tracking-label (47) 0.08 / 0.09 -> tracking-eyebrow (8) 0.1 / 0.11 / 0.12 -> tracking-kicker (7) Largest single move is 0.04em; almost all are 0.01-0.02em. Baseline tightened from 68 to 0 with the per-path map cleared, so the family cannot regrow at all rather than regrowing up to the old ceiling. Every other metric in the baseline was left untouched by construction — the edit sets only `arbitraryTracking`. `*-mockups.tsx` and `*-mockups/` directories are deliberately untouched: design scratch, gate-exempt, and migrating them would triple the diff for no enforcement gain. `tracking-[var(--quantity-unit-tracking)]` is the sanctioned token form and stays. Verification: check:design-system-contract exit 0 (`arbitrary tracking 0`) · typecheck 0 · lint 0 · full unit suite 5 473 passed, 14 skipped. Three test files fail, none caused by this diff: - tests/installed-lock-parity.test.ts — playwright 1.62.0 vs locked 1.62.1, environmental, issue #149. - tests/pr-handoff-stop.test.ts and tests/mode-nav-addon-slot.dom.test.tsx — both arrived on main after this session's earlier clean full run, from #1649 and #1647. They fail for Windows-environment reasons: simulated `jq` absence, and an assertion comparing repo-relative POSIX paths against absolute Windows paths. The mode-nav assertion compares path FORMAT over an identical two-file set, so it is content-independent and a class rename cannot produce it. Co-Authored-By: Claude Opus 5 --- scripts/design-system-contract-baseline.json | 45 +------------------ src/app/reference/colour-coding/page.tsx | 4 +- src/components/AccessibleTable.tsx | 4 +- src/components/ClinicalDashboard.tsx | 2 +- src/components/calculators/bedside-sheet.tsx | 2 +- .../calculators/clinical-console.tsx | 2 +- src/components/calculators/directory-grid.tsx | 6 +-- src/components/calculators/guided-flow.tsx | 8 ++-- src/components/calculators/search-detail.tsx | 8 ++-- src/components/calculators/search-page.tsx | 2 +- .../account-setup-dialog.tsx | 2 +- .../clinical-dashboard/cross-mode-links.tsx | 2 +- .../clinical-dashboard/differentials-home.tsx | 8 ++-- .../clinical-dashboard/document-results.tsx | 2 +- .../document-search-results.tsx | 4 +- .../clinical-dashboard/evidence-panels.tsx | 2 +- .../favourites-command-library-page.tsx | 2 +- .../library-health-strip.tsx | 2 +- .../medication-prescribing-workspace.tsx | 2 +- .../clinical-dashboard/output-panel.tsx | 4 +- .../clinical-dashboard/search-pins-menu.tsx | 2 +- .../clinical-dashboard/settings-dialog.tsx | 2 +- .../universal-search-command-surface.tsx | 2 +- .../differential-detail-page.tsx | 2 +- ...ifferential-presentation-workflow-page.tsx | 2 +- .../document-clinical-summary.tsx | 6 +-- .../document-overview-landing.tsx | 2 +- .../document-viewer/section-nav.tsx | 4 +- .../document-viewer/source-panels.tsx | 10 ++--- src/components/dsm/dsm-comparison-page.tsx | 2 +- .../factsheets/factsheet-detail-page.tsx | 16 +++---- .../factsheets/factsheets-search-page.tsx | 4 +- src/components/mode-nav/mode-nav.tsx | 2 +- src/components/patient-safety-plan.tsx | 4 +- src/components/pwa-lifecycle.tsx | 2 +- .../services/services-navigator-page.tsx | 4 +- src/components/specifiers/specifier-ui.tsx | 2 +- .../screens/recommend-screen.tsx | 2 +- .../therapy-compass/screens/sheets-screen.tsx | 2 +- .../therapy-compass/therapy-card.tsx | 2 +- src/components/ui-primitives.tsx | 3 +- 41 files changed, 70 insertions(+), 120 deletions(-) diff --git a/scripts/design-system-contract-baseline.json b/scripts/design-system-contract-baseline.json index e95303ff02..c94e56b7f3 100644 --- a/scripts/design-system-contract-baseline.json +++ b/scripts/design-system-contract-baseline.json @@ -10,7 +10,7 @@ "legacyPaletteUtilities": 2, "darkColorOverrides": 3, "legacyShadowAliases": 231, - "arbitraryTracking": 68, + "arbitraryTracking": 0, "layoutTransitionExceptions": 12, "textSoftConsumers": 0 }, @@ -148,48 +148,7 @@ "src/components/ui/tooltip.tsx": 1, "src/components/ui-primitives.tsx": 6 }, - "arbitraryTracking": { - "src/app/reference/colour-coding/page.tsx": 1, - "src/components/AccessibleTable.tsx": 2, - "src/components/calculators/bedside-sheet.tsx": 1, - "src/components/calculators/clinical-console.tsx": 1, - "src/components/calculators/directory-grid.tsx": 3, - "src/components/calculators/guided-flow.tsx": 4, - "src/components/calculators/search-detail.tsx": 4, - "src/components/calculators/search-page.tsx": 1, - "src/components/clinical-dashboard/account-setup-dialog.tsx": 1, - "src/components/clinical-dashboard/cross-mode-links.tsx": 1, - "src/components/clinical-dashboard/differentials-home.tsx": 3, - "src/components/clinical-dashboard/document-results.tsx": 1, - "src/components/clinical-dashboard/document-search-results.tsx": 2, - "src/components/clinical-dashboard/evidence-panels.tsx": 1, - "src/components/clinical-dashboard/favourites-command-library-page.tsx": 1, - "src/components/clinical-dashboard/library-health-strip.tsx": 1, - "src/components/clinical-dashboard/medication-prescribing-workspace.tsx": 1, - "src/components/clinical-dashboard/output-panel.tsx": 2, - "src/components/clinical-dashboard/search-pins-menu.tsx": 1, - "src/components/clinical-dashboard/settings-dialog.tsx": 1, - "src/components/clinical-dashboard/universal-search-command-surface.tsx": 1, - "src/components/ClinicalDashboard.tsx": 1, - "src/components/differentials/differential-detail-page.tsx": 1, - "src/components/differentials/differential-presentation-workflow-page.tsx": 1, - "src/components/document-viewer/document-clinical-summary.tsx": 3, - "src/components/document-viewer/document-overview-landing.tsx": 1, - "src/components/document-viewer/section-nav.tsx": 2, - "src/components/document-viewer/source-panels.tsx": 5, - "src/components/dsm/dsm-comparison-page.tsx": 1, - "src/components/factsheets/factsheet-detail-page.tsx": 6, - "src/components/factsheets/factsheets-search-page.tsx": 2, - "src/components/mode-nav/mode-nav.tsx": 1, - "src/components/patient-safety-plan.tsx": 2, - "src/components/pwa-lifecycle.tsx": 1, - "src/components/services/services-navigator-page.tsx": 2, - "src/components/specifiers/specifier-ui.tsx": 1, - "src/components/therapy-compass/screens/recommend-screen.tsx": 1, - "src/components/therapy-compass/screens/sheets-screen.tsx": 1, - "src/components/therapy-compass/therapy-card.tsx": 1, - "src/components/ui-primitives.tsx": 1 - }, + "arbitraryTracking": {}, "layoutTransitionExceptions": { "src/app/globals.css": 4, "src/components/calculators/guided-flow.tsx": 1, diff --git a/src/app/reference/colour-coding/page.tsx b/src/app/reference/colour-coding/page.tsx index 306d8b6a08..c218be7e2e 100644 --- a/src/app/reference/colour-coding/page.tsx +++ b/src/app/reference/colour-coding/page.tsx @@ -63,9 +63,7 @@ export default function ColourCodingReferencePage() {
-

- Tone key -

+

Tone key

{SEMANTIC_TONES.map((tone) => (
-

+

{drawerGroupTitle}

{settingsState.documentsDrawerOpen ? ( diff --git a/src/components/calculators/bedside-sheet.tsx b/src/components/calculators/bedside-sheet.tsx index f171d21139..9b388b964f 100644 --- a/src/components/calculators/bedside-sheet.tsx +++ b/src/components/calculators/bedside-sheet.tsx @@ -67,7 +67,7 @@ function SheetSection({ {calc.abbrev} - + {domainLabels[calc.domain]} diff --git a/src/components/calculators/clinical-console.tsx b/src/components/calculators/clinical-console.tsx index 6646da0a00..57a84de8b1 100644 --- a/src/components/calculators/clinical-console.tsx +++ b/src/components/calculators/clinical-console.tsx @@ -158,7 +158,7 @@ export function CalculatorsClinicalConsoleMockup() { const DomainIcon = domainIcons[domain]; return (
-

+

diff --git a/src/components/calculators/directory-grid.tsx b/src/components/calculators/directory-grid.tsx index 662366f6b0..147ea8da9d 100644 --- a/src/components/calculators/directory-grid.tsx +++ b/src/components/calculators/directory-grid.tsx @@ -48,7 +48,7 @@ function ExpandedCalculator({