Repository navigation
diagram: finish design-token consolidation + dark-mode token parity - #802
Conversation
Completes the design-token sweep begun by the frontend UX audit (#799) and folds in the component-library dark-mode parity it overlapped (#709). theme.css gains a full neutral text/border/action/surface palette plus brand variants, each with [data-theme="dark"] values, so the component library and editor chrome theme from one source instead of ~30 files of scattered literals. - Shadows: renamed --shadow-sm/md/lg to a single MUI-elevation scheme (--shadow-1/2/3) and added the distinct --shadow-4/8/16/24 used by the AppBar, menus, drawer, and dialogs; inline elevation strings adopt them. - Colors: migrated every hardcoded #fff/grey/divider and the rgba(0,0,0,x) MUI-opacity values onto tokens. Near-duplicate greys/dividers normalize onto a tight scale (documented in theme.css), trading a few sub-perceptible shifts for one coherent palette; surfaces vs. always-light contrast ink are kept separate so dark mode flips the former without inverting button text. - Typography: editor-chrome and detail-panel text moves from raw px to rem (honoring browser zoom) via a new caption (0.75rem) variant and token. - Toolbar: the app's fixed-AppBar spacer and Toolbar's dense min-height both derive from --toolbar-dense-height so they cannot drift apart. Guard tests assert the component library stays literal-free, every var(--token) resolves to a definition, the chrome tokens carry dark values, and the toolbar/caption couplings hold. Login's branded Google button, the ErrorToast severity palette, and canvas tool-icon greys are left as deliberate, self-contained exceptions.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1834fe2f27
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| z-index: 1300; | ||
| background: #fff; | ||
| border: 1px solid rgba(0, 0, 0, 0.23); | ||
| background: var(--color-surface); |
There was a problem hiding this comment.
Set a foreground on tokenized autocomplete popups
When [data-theme="dark"] is applied high enough to affect this portaled listbox, --color-surface becomes dark here but the popup/options never set color, so option labels inherit the page/default black text instead of --color-text-primary and become hard to read on the dark surface. Add a foreground token on the listbox or option rows when switching the popup surface to the theme token.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #802 +/- ##
=======================================
Coverage 90.83% 90.83%
=======================================
Files 224 224
Lines 142627 142627
=======================================
+ Hits 129560 129562 +2
+ Misses 13067 13065 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ReviewNo findings. Verified the consolidation preserves semantics across the board:
Overall correctnessCorrect. The patch is a pure refactor with token-level identity for the shadows, documented intentional shifts for the consolidated greys/hover weights, and new guard tests that lock the consolidation in place. |
Addresses a codex review finding on the Autocomplete popup and its siblings: surfaces switched to var(--color-surface) but kept relying on inherited (default-black) text, so under [data-theme="dark"] the surface flips dark while option/content text stays black and becomes unreadable. Portaled popups (Autocomplete, Drawer) can't inherit a foreground from the editor root at all. Each affected surface now owns var(--color-text-primary) alongside its background: the Autocomplete listbox, Drawer panel, Accordion, the variable / module / error detail cards (covering the recessed field-bg wells and KaTeX, which render with currentColor), the Snapshotter card, the search bar (native input), and the hosted-editor error box. In light mode this softens those surfaces' inherited text from pure black to the 0.87 MUI primary already used by their tokenized siblings (sub-perceptible); in dark mode the text flips with the surface.
|
@codex review |
|
Reviewed the diff end-to-end. The token consolidation is consistent: every component-CSS literal removed maps to a defined token, the dark block carries values for all the chrome tokens introduced, the rgb-equivalents of the old hex literals match the new alpha-over-surface tokens (#999 ≡ rgba(0,0,0,0.4) on white, #666 ≡ rgba(0,0,0,0.6) on white, etc.), the few documented shifts (breadcrumb hover 0.08→0.04, checkbox border 0.54→0.6, standard input underline 0.42→0.23) are intentional normalizations, and the four guard tests (component literal-free, all var(--*) references defined, no retired shadow names, Editor/ModuleDetails rem-only, dense-toolbar/caption coupling) plausibly cover the contract. No findings. Overall correctness: correct. |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Finishes the design-token consolidation begun by the frontend UX audit (#799) and folds in the component-library dark-mode parity it overlapped (#709), so both are resolved together.
src/diagram/theme.cssbecomes a complete light and dark token system, and ~30 stylesheets consume it instead of hardcoding literals.What changed
#fffsurface, the named greys/dividers, and the pervasivergba(0,0,0,x)MUI-opacity values now resolve through tokens. Near-duplicate greys/dividers are normalized onto a tight scale (text-primary/muted/light/disabled,divider/border/border-input); a few sub-perceptible shifts result (e.g.#999/#aaa→light, breadcrumb hover0.08→0.04), each documented intheme.css. Surfaces and always-light contrast ink are kept distinct (--color-surfaceflips in dark;--color-contrast-textdoes not) so button/AppBar text stays white. Every new token has a[data-theme="dark"]value.--shadow-sm/md/lg→--shadow-1/2/3, plus the distinct--shadow-4/8/16/24(AppBar/Menu/Drawer/Dialog). Inline elevation strings adopt the tokens.caption(0.75rem) token and app typography variant.--toolbar-dense-heightdrives bothToolbar .densemin-height andHome .toolbarSpacerso they cannot drift.Notes on scope
Dark-mode chrome tokens are infrastructure: nothing in the shipping app sets
data-theme="dark"on the editor chrome yet (only StaticDiagram's canvas does), so light rendering is unchanged. Deliberate literal exceptions, left with rationale: Login's branded Google sign-in button, the ErrorToast severity palette (intentionally brighter than the status tokens), and canvas tool-icon greys.Tests
New guard tests (
src/diagram/tests/theme-tokens.test.ts,src/app/tests/design-tokens.test.ts) assert the component library stays literal-free, everyvar(--token)resolves to a definition, the chrome tokens carry dark values, no retired shadow names remain, Editor/ModuleDetails are rem-only, and the toolbar/caption couplings hold. Full diagram (1189) and app (98) jest suites, eslint, and tsc all pass.Fixes #799
Fixes #709
🤖 Generated with Claude Code