wrolpi/app/src/components/ui
Roland b68eff6ed9 ui: the navbar measures its foreground instead of assuming one
The bar's background is the one surface a user picks -- twelve colour names,
which each theme resolves to twelve of its own colours.  Forty-eight
backgrounds, and the links and status icons were drawn on all of them in a
single token, `--btn-text`, which is near-black in three of the four themes.

Night's `--brown` is #451212.  A near-black glyph on it is 1.33:1.  Nine of
night's twelve colours and seven of amber's sat below 4.5:1, and twelve of the
forty-eight below 3:1 -- icons the same colour as the bar behind them.

So the foreground is measured against the background the theme actually
resolved, choosing between that theme's own `--btn-text`, `--black` and
`--white`.  Its own, not literal ones: a white pixel in night mode undoes the
dark adaptation the theme exists to protect, so night's "white" is #ff8a8a.
Measuring at runtime rather than shipping an `--on-red` token per colour also
means the custom YAML themes still ahead get this for free.

Nothing is below 3:1 any more and the worst case is 3.27:1, up from 1.33:1.
No combination is worse than it was.

Ten of the forty-eight are still under 4.5:1 and no foreground will lift them:
a monochrome theme resolves all twelve names onto one ramp, and a mid-tone of a
hue cannot carry text of that same hue.  That shortfall is in the palette, so
/theme-sample now draws all twelve bars with the measured ratio printed beside
each one, calling out the ten -- it is a decision to make while looking at them.

The WCAG primitives move to themes/contrast so theme code can measure a colour
without importing Common.js, which pulls in half the component library.
Common.js forwards `contrastRatio` with a delegating function rather than a bare
re-export: six specs mock it with `{...jest.requireActual('./Common')}`, the
spread invokes every getter, and those spreads run re-entrantly while the module
is still evaluating -- a re-export getter fires before its import binding exists
and takes the whole suite down.

Tested: navColors.test.js measures all forty-eight against the palette parsed
out of tokens.css, and holds Nav.js to the call by source since neither bar is
reachable from a test that could measure it.  ui-layout.cy.js measures the
painted result in a real browser in all four themes and holds it against the
number the component reports.  Reverting to the fixed foreground reddens four
jest cases and three cypress ones.

1115 jest / 62 suites, 177 in ui-layout.cy.js, clean npm run build.
2026-08-02 14:59:22 -06:00
..
Button.tsx ui: an icon button is the same height as the button beside it 2026-08-02 11:52:59 -06:00
DataTable.tsx ui: give tables a real header, drop the column grid, quiet the row rules 2026-08-01 17:10:03 -06:00
Feedback.tsx ui: semantic roles, so night and amber can tell severity apart at all 2026-08-01 17:54:22 -06:00
Icon.tsx ui: map the twelve icon names that were rendering as question marks 2026-08-01 16:30:20 -06:00
index.ts ui: nine leaf files off Semantic, and the components they needed 2026-07-30 11:55:39 -06:00
Inputs.tsx fix: break the import cycle that put useCalculators in the TDZ 2026-08-02 12:41:23 -06:00
Navigation.tsx ui: nine leaf files off Semantic, and the components they needed 2026-07-30 11:55:39 -06:00
Overlays.tsx ui: migrate the extension pages and Configs; five components they needed 2026-07-30 09:15:04 -06:00
SearchBox.tsx ui: fix the cypress failures, and two real defects behind them 2026-07-30 12:54:24 -06:00
Surfaces.tsx ui: cards get legible titles, contained posters, and meta beside the title 2026-08-02 11:52:59 -06:00
ThemePicker.tsx ui: media filtering is a per-theme setting, not a night-mode hardcode 2026-07-30 09:15:04 -06:00
toast.test.js ui: semantic roles, so night and amber can tell severity apart at all 2026-08-01 17:54:22 -06:00
toast.ts ui: semantic roles, so night and amber can tell severity apart at all 2026-08-01 17:54:22 -06:00
ui-layout.cy.js ui: the navbar measures its foreground instead of assuming one 2026-08-02 14:59:22 -06:00
ui.css ui: centre the pagination strip 2026-08-02 13:11:31 -06:00
ui.test.js ui: cards get legible titles, contained posters, and meta beside the title 2026-08-02 11:52:59 -06:00