M1.10: light theme, live theme switching, editor tokens

- theme::LIGHT next to DARK with the 10 new tokens (editor selection,
  active line, cursor, gutter, match, font size, tab active/modified,
  notice); light fg-muted, accent and error darkened for WCAG AA
- theme.list, theme.systemPreference, themeChanged event when the
  resolved theme changes (settings.set/reset appearance.theme, or the
  OS preference in system mode)
- desktop init script and window background from the stored setting;
  system mode uses a prefers-color-scheme media query for the first frame
- ui/src/theme.ts applies tokens to :root and color-scheme live; editor,
  tabs and notice drop their var() fallbacks
- Vitest WCAG AA contrast check against a Rust-maintained snapshot,
  DOM tests, headless control-channel test
- docs: architecture Themes, parity rows, ui-parity, gaps, roadmaps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-16 15:49:23 +02:00
parent 1ab448de4d
commit cde6e119c6
29 changed files with 1192 additions and 72 deletions

View file

@ -35,6 +35,12 @@ const usedKeys = sourceFiles(SRC).flatMap((file) =>
})),
);
/**
* Keys the source never passes to `t` literally because they arrive at
* runtime from the engine: theme labels from `theme.list`.
*/
const RUNTIME_KEYS = new Set(["theme.lutraDark", "theme.lutraLight"]);
afterEach(() => {
vi.restoreAllMocks();
});
@ -81,7 +87,7 @@ describe("t", () => {
describe("en.json", () => {
it("uses flat dotted keys of known areas with string values", () => {
for (const [key, value] of Object.entries(en)) {
expect(key).toMatch(/^(app|project|editor|common)\.[A-Za-z0-9]+(\.[A-Za-z0-9]+)*$/);
expect(key).toMatch(/^(app|project|editor|common|theme)\.[A-Za-z0-9]+(\.[A-Za-z0-9]+)*$/);
expect(typeof value).toBe("string");
expect(value.trim()).not.toBe("");
}
@ -98,8 +104,12 @@ describe("en.json", () => {
expect(missing).toEqual([]);
});
it("has every runtime key", () => {
expect([...RUNTIME_KEYS].filter((key) => !hasMessage(key))).toEqual([]);
});
it("has no unused keys", () => {
const used = new Set(usedKeys.map(({ key }) => key));
const used = new Set([...usedKeys.map(({ key }) => key), ...RUNTIME_KEYS]);
expect(Object.keys(en).filter((key) => !used.has(key))).toEqual([]);
});
});