Repository navigation
Description
Task
T-085a· Milestone M8 — Dashboard · Size S · Priority P0 · Epic #8Implements FR-DSH-008 · NFR-ACC-001
Branch
feat/t-085a-web-design-tokens-fonts-base— one task = one branch = one PR (doc 32 §6)
Summary
Implement the 'Field Notebook' design system foundation: web/src/styles/tokens.css (light + dark themes exactly per doc 13 §1.1), tokens.json (single source also consumed by the backend report theme, T-078a), self-hosted fonts (no CDN), base.css, print.css, and a unit test asserting WCAG AA contrast for every text/background token pair.
Context / motivation
Every screen and the static report depend on these tokens; doing them first prevents per-screen colour drift.
Scope
In scope
scripts/gen_tokens.ts(or plain JSON → CSS generation) so CSS and JSON can never diverge.- Theme switching via
data-themeattribute +prefers-color-schemedefault.
Out of scope
- Components (T-086a–c).
Implementation guidance
- Source of truth
web/src/styles/tokens.json({"light": {"--paper": "#…", …}, "dark": {…}, "font": {…}, "space": {…}, "radius": {…}, "motion": {…}}) holding exactly the values in doc 13 §1.1–1.3.web/scripts/gen-tokens.ts(pnpm gen:tokens, also run inprebuild) emitstokens.css(:root[data-theme="light"]{…}/[data-theme="dark"]{…}plus aprefers-color-scheme: darkdefault) and copies the JSON tobackend/src/roboprobe/reporting/assets/tokens.jsonfor the report theme (T-078a). - Fonts (doc 13 §1.2) self-hosted as WOFF2 in
web/public/fonts/with@font-face+font-display: swap; record licences (OFL) inweb/public/fonts/LICENSES.md. base.css: modern reset, focus ringoutline: 2px solid var(--margin-line)on:focus-visible,prefers-reduced-motiondisables transitions.print.css: A4, hide MarginRail,break-before: pageutility.- The contrast test computes WCAG relative luminance in TS (no dependency) for a declared list of foreground/background pairs (
tokens.pairs.json) in both themes. - stylelint:
stylelint-config-standard+color-no-hex(ignoringsrc/styles/tokens.css) and a disallowed-list rule for raw px font sizes outside tokens. - Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff
PLR2004); public APIs typed (mypy strict) and documented.
Configuration keys
From the configuration reference (doc 27). Keys marked (new) must be added to the typed settings models and appear in the generated reference (T-003c).
- defaultTheme / ROBOPROBE_WEB_DEFAULT_THEME (web runtime config)
Acceptance criteria
- Contrast test passes for all pairs (≥ 4.5:1 body, ≥ 3:1 large/UI).
- Fonts load offline (no external requests in the built bundle).
- stylelint rejects raw hex in feature CSS.
-
pnpm gen:tokensis idempotent (second run produces no diff; CI check). - Dark theme passes the same contrast pairs.
-
prefers-reduced-motionrespected. - Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
- Docs, config reference and CHANGELOG
Unreleasedupdated where behaviour, keys or interfaces changed. - Definition of Done (doc 32 §3) satisfied.
Tests required
web/src/styles/tokens.test.ts.- Snapshot of generated
tokens.css.
Dependencies
Blocked by: #13 (T-007)
Blocks: #163 (T-085b), #166 (T-086a), #167 (T-086b), #174 (T-089b), #175 (T-089c)
Parallelization notes
Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:
web/src/styles/**web/public/fonts/**web/.stylelintrc.json
Parallel with T-085c (API client).
Definition of Done
Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-085a (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.
References
Design docs: doc 13 §1 · doc 13 §1.1 · doc 13 §1.2 · doc 13 §1.3 · doc 16 §4 · doc 27 §4.11
Requirements: FR-DSH-008 · NFR-ACC-001 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsReady
Activity
feat(web): design tokens, self-hosted fonts, base/print CSS and contr…