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:
parent
1ab448de4d
commit
cde6e119c6
29 changed files with 1192 additions and 72 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Architecture
|
||||
|
||||
> **Status:** M0 decisions recorded, M1 workspace, desktop bridge, tabs and editor, message catalog, engine construction and settings documented · **Last updated:** 2026-10-16
|
||||
> **Status:** M0 decisions recorded, M1 workspace, desktop bridge, tabs and editor, message catalog, engine construction, settings and themes documented · **Last updated:** 2026-10-16
|
||||
|
||||
## Overview
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ As built in M0:
|
|||
|
||||
The frontend calls `run(id, params)` over Tauri IPC (`engine_execute`, `engine_list_commands`) and subscribes to state events. Buffer contents live in the engine; CodeMirror sends edits as transactions and receives authoritative changes back.
|
||||
|
||||
Theme tokens are defined in Rust (`lutra_engine::theme`) and rendered as CSS custom properties (`--lt-*`). The desktop injects them with the window's initialization script, so the first frame is already themed and the frontend needs no round trip. Components use only `var(--lt-…)`.
|
||||
Theme tokens are defined in Rust (`lutra_engine::theme`) and rendered as CSS custom properties (`--lt-*`). The desktop injects the stored theme with the window's initialization script, so the first frame is already themed and the frontend needs no round trip. Components use only `var(--lt-…)`; switching is described under Themes.
|
||||
|
||||
### Workspace (M1.3)
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
- Line breaks: the engine keeps text as on disk and counts `\r\n` as two UTF-16 units; CodeMirror counts every break as one position. `EngineText` remembers which breaks are `\r\n` and converts positions when building edits; inserted breaks are sent with the buffer's line ending, so a CRLF file stays CRLF in memory. Text without `\r\n` (the common case) needs no table.
|
||||
- Save, save all and close run from the engine's default shortcuts (`file.save` `Mod+S`, `file.saveAll` `Mod+Alt+S`, `buffer.close` `Mod+W`), loaded with `listCommands` and matched by key code, with the active buffer as context. Saving and closing wait until the sync has no pending edits.
|
||||
- Closing a dirty tab asks Save / Don't Save / Cancel; `buffer.close` without `force` failing with `unsaved_changes` also leads to the question. Lutra saves only on request for now (no autosave).
|
||||
- Theme: the editor reads colours only from `--lt-*` tokens. Tokens the theme does not have yet are read as `var(--lt-new-token, <fallback from existing tokens>)` so they take effect once added in Rust.
|
||||
- Theme: the editor reads colours only from `--lt-*` tokens, including the editor tokens from M1.10 (selection, active line, cursor, gutter, match, editor font size); no fallbacks remain.
|
||||
|
||||
### Message catalog (M1.11)
|
||||
|
||||
|
|
@ -121,6 +121,17 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
- Commands: `settings.list` → `[{key, type: enum|int, default, enumValues?, min?, max?, labelKey, descriptionKey, section}]` (catalog keys `settings.<key>.label` / `.description`; `section` is an id shown with `settings.section.<id>`), `settings.get {keys?}` → `{values}`, `settings.set {key, value}` → `{value}`, `settings.reset {key}` → `{value}`. Unknown keys and bad values fail with `invalid_params`; a write failure fails with `failed` and changes nothing.
|
||||
- Events: `settingsChanged {keys}` when an effective value changes; `notification {id, level: info|warning|error, messageKey?, message?, params?}` (ids `n1`, `n2`…).
|
||||
|
||||
### Themes (M1.10)
|
||||
|
||||
- `lutra_engine::theme` defines `DARK` (`lutra-dark`) and `LIGHT` (`lutra-light`) with the same token names, plus shared font tokens. Besides the base colours (`bg`, `editor-bg`, `fg`, `fg-muted`, `border`, `accent`, `error`, `statusbar-*`) both define `editor-selection-bg`, `editor-active-line-bg`, `editor-cursor`, `editor-gutter-bg`, `editor-gutter-fg`, `editor-match-bg`, `tab-active-bg`, `tab-modified`, `notice-bg`; `font-size-editor` is shared (14px). Values are opaque `#rrggbb` derived from the palette (selection, match and notice are the accent mixed into the background); the designer may change values, never names.
|
||||
- `appearance.theme` selects the theme: a theme id or `system`. `theme::resolve(setting, system_dark)` picks the theme; `system` follows the OS preference the frontend reports, and counts as dark until it has.
|
||||
- Commands: `theme.list` → `[{id, label, dark}]` (`label` is a catalog key, `theme.lutraDark`/`theme.lutraLight`); `theme.systemPreference {dark}` stores the OS preference and returns the resolved theme `{id, dark, tokens}`. Switching goes through `settings.set appearance.theme` (or `settings.reset`).
|
||||
- Event: `themeChanged {id, dark, tokens: {"--lt-…": value}}` (every token, shared ones included) whenever the resolved theme changes: after `settingsChanged` for `appearance.theme`, or after `theme.systemPreference` in system mode. A change that resolves to the same theme (`lutra-dark` → `system` on a dark OS) emits nothing.
|
||||
- First frame: the desktop reads `appearance.theme` before creating the window and passes `theme::init_script(setting)`, which installs `<style id="lt-theme">`. For `system` the CSS is the dark theme plus the light one inside `@media (prefers-color-scheme: light)`, so the first frame follows the OS without a round trip; the native window background is set from the resolved theme (`Window::theme()` for system).
|
||||
- Live switch: `ui/src/theme.ts` (`startTheme`, called by `App.vue`) reports `matchMedia("(prefers-color-scheme: dark)")` now and on every change, applies the result and every `themeChanged`: tokens go onto `:root`'s inline style (which wins over the injected style element), `color-scheme` is set, and `data-theme` holds the id. No reload.
|
||||
- Accessibility: `ui/tests/theme/contrast.test.ts` checks every text/background pair the components draw with against WCAG AA (4.5:1 text, 3:1 cursor and modified dot) in both themes. It reads `ui/tests/theme/themes.json`, which the Rust test `theme::tests::ui_snapshot_is_current` keeps equal to the Rust definition (`LUTRA_UPDATE_SNAPSHOTS=1` rewrites it). `ui/tests/theme/theme.test.ts` fails on a `var(--lt-x)` the themes lack and on a fallback for a token they define.
|
||||
- Not themed yet: the native title bar follows the OS, not the Lutra theme; spacing and size tokens (`--lt-space-*`, `--lt-radius`, `--lt-row-height`…) are still CSS fallbacks in components; `editor.fontSize` does not drive `--lt-font-size-editor` yet.
|
||||
|
||||
## Decisions (M0)
|
||||
|
||||
| Question | Decision | Why |
|
||||
|
|
@ -138,6 +149,7 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-16 | minor | M1.10: themes (light theme, editor tokens, theme.list, theme.systemPreference, themeChanged, init script from the setting, live switch, contrast test) |
|
||||
| 2026-10-16 | minor | M1.9a: engine construction (EngineConfig, with_config) and settings (file, commands, settingsChanged, notification) |
|
||||
| 2026-10-15 | minor | M1.11: message catalog (`t`, lint rule, catalog test, engine messages stay English) |
|
||||
| 2026-10-15 | minor | M1.6: tabs and editor (buffer sync, CRLF offsets, shortcuts from command specs) |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Gaps
|
||||
|
||||
> **Status:** M0 closed G1; G2 under way (text buffer, engine buffers, tabs and editor in the app); G3 project tree works in the app, settings backend landed; G14 English UI catalog in place · **Last updated:** 2026-10-16
|
||||
> **Status:** M0 closed G1; G2 under way (text buffer, engine buffers, tabs and editor in the app); G3 project tree works in the app, settings backend and theme switching landed; G14 English UI catalog in place · **Last updated:** 2026-10-16
|
||||
|
||||
Every known shortfall, ranked. This is the work list: unless the owner gives a task, take the highest open gap. Hours are agent wall-clock hours for one agent, all estimated.
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ Every known shortfall, ranked. This is the work list: unless the owner gives a t
|
|||
|---|---|---|---|
|
||||
| G1 | ~~Foundation: workspace, quality gate, command registry, guard, control channel~~ closed 2026-10-14 | M0 | done (~2 h measured) |
|
||||
| G2 | Editor core: ~~engine buffers, save~~ (M1.3), ~~editor UI with tabs, undo, multi-caret~~ (M1.6, CodeMirror basics), recovery journal, tab management (preview, pin, split, close others, reopen), conflict UI for files changed on disk, autosave option | M1 | ~18 h |
|
||||
| G3 | Project model: ~~VFS~~ (M1.2: listing, ignore rules, native file watching with polling fallback, safe file IO), ~~project tree wiring~~ (M1.5 UI, M1.3 engine, M1.4 bridge: folder picker, live tree), tree toolbar and options, showing truncated listings, error notifications for the folder picker, ~~tabs~~ (M1.6); command palette, settings (backend: M1.9a; dialog: M1.9b), theme switching | M1 | ~24 h |
|
||||
| G3 | Project model: ~~VFS~~ (M1.2: listing, ignore rules, native file watching with polling fallback, safe file IO), ~~project tree wiring~~ (M1.5 UI, M1.3 engine, M1.4 bridge: folder picker, live tree), tree toolbar and options, showing truncated listings, error notifications for the folder picker, ~~tabs~~ (M1.6); command palette, settings (backend: M1.9a; dialog: M1.9b), ~~theme switching~~ (M1.10: light/dark, live, system mode; picker comes with the dialog) | M1 | ~24 h |
|
||||
| G4 | Syntax and structure: tree-sitter PHP, Lezer highlighting, file structure | M2 | ~15 h |
|
||||
| G5 | Search and navigation: find in files, go to file/class/symbol, first index | M2 | ~35 h |
|
||||
| G6 | Language server: completion, diagnostics, definition, hover, rename via Phpactor | M3 | ~45 h |
|
||||
|
|
@ -39,6 +39,7 @@ Known smaller items from M0:
|
|||
|---|---|---|
|
||||
| 2026-10-15 | minor | G14 note: English message catalog (M1.11) |
|
||||
| 2026-10-15 | minor | G2 shrunk: tabs and editor (M1.6) |
|
||||
| 2026-10-16 | minor | G3: theme switching (M1.10) |
|
||||
| 2026-10-16 | minor | G3: settings backend (M1.9a) |
|
||||
| 2026-10-15 | minor | G3 shrunk: project tree wired to the engine (M1.4) |
|
||||
| 2026-10-14 | minor | G2 shrunk, G3 note: engine workspace (M1.3) |
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
# Milestones
|
||||
|
||||
> **Status:** M0 done, M1 in progress · **Last updated:** 2026-10-15
|
||||
> **Status:** M0 done, M1 in progress · **Last updated:** 2026-10-16
|
||||
|
||||
Hours are agent wall-clock hours for one agent; M0 and M1 so far are measured, the rest estimated. Since cycle C1 (factor 0.07) M1–M3 are scaled ×0.1; M4–M6 keep their first raw estimates (multiply by ~0.1 for the calibrated value).
|
||||
|
||||
| Milestone | Goal | State | Hours |
|
||||
|---|---|---|---:|
|
||||
| M0 | Foundation: workspace, lints, quality gate, command registry, control channel, empty window | done 2026-10-14 (CI workflow written, not yet run: hosted on Forgejo, runners unknown) | ~2 (measured) |
|
||||
| M1 | Editor and project: open folder, tree, tabs, editor, save, recovery, palette, settings, themes | in progress (M1.1 text, M1.2 VFS, M1.5 tree UI, M1.3 engine workspace, M1.4 desktop bridge, M1.6 tabs and editor, M1.11 message catalog) | ~6 (2.5 measured for M1.1–M1.6) |
|
||||
| M1 | Editor and project: open folder, tree, tabs, editor, save, recovery, palette, settings, themes | in progress (M1.1 text, M1.2 VFS, M1.5 tree UI, M1.3 engine workspace, M1.4 desktop bridge, M1.6 tabs and editor, M1.11 message catalog, M1.9a settings backend, M1.10 themes) | ~6 (2.5 measured for M1.1–M1.6) |
|
||||
| M2 | Syntax and search: highlighting, structure, find in files, go to file/class/symbol | not started | ~5 |
|
||||
| M3 | LSP, terminal, CLI: completion, diagnostics, go to definition, hover, rename; terminal; `lutra` CLI and MCP — **MVP** | not started | ~8 |
|
||||
| M4 | Git: status, diff, commit, branches, log, blame, conflicts | not started | ~150 |
|
||||
|
|
@ -31,6 +31,7 @@ By the raw estimates the alpha gate needs M1–M4 plus cross-platform verificati
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-16 | minor | M1.9a settings backend, M1.10 themes |
|
||||
| 2026-10-15 | minor | M1.11 message catalog |
|
||||
| 2026-10-15 | minor | Cycle C1 review: M1–M3 hours recalibrated ×0.1, M0 CI note |
|
||||
| 2026-10-15 | minor | M1.6 tabs and editor |
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ Hours are the estimated agent wall-clock hours for one agent to reach behaviour
|
|||
| HTTP client | 1 | 0% | everything | ~60 (est.) | — |
|
||||
| Web languages | 2 | 0% | everything | ~200 (est.) | — |
|
||||
| Docker and remote | 1 | 0% | everything | ~120 (est.) | — |
|
||||
| Settings, keymaps, themes | 1 | 2% (est.) | settings UI, keymaps, theme switching (theme tokens exist in `lutra_engine::theme`; M1.9a: settings backend with 3 keys, persistence, `settings.*` commands, no UI yet) | ~60 (est.) | — |
|
||||
| Settings, keymaps, themes | 1 | 4% (est.) | settings UI, keymaps, colour scheme editor, custom and imported themes, per-language colours (M1.9a: settings backend with 3 keys, persistence, `settings.*` commands, no UI yet; M1.10: light and dark themes with live switching and a system mode, chosen through the setting only) | ~60 (est.) | — |
|
||||
| Plug-ins | 0.5 | 0% | everything | ~120 (est.) | — |
|
||||
| AI features | 0.5 | 0% | everything | ~60 (est.) | — |
|
||||
|
||||
|
|
@ -56,11 +56,13 @@ The project tree is the first user-visible feature (Project view 8%, estimated);
|
|||
` / `
|
||||
` / `
|
||||
` detection with a keep-the-file's-ending save policy. 23 unit tests and 6 proptests (round-trips on emoji, ZWJ sequences, CJK and combining marks; random edit batches checked against a `String` model, never panicking).
|
||||
- M1.10 themes (2026-10-16): Lutra Dark and Lutra Light with the same tokens, including real editor, tab and notice tokens; `appearance.theme` switches live without a reload, `system` follows the OS preference, and the window starts in the stored theme. Both themes pass a WCAG AA contrast test for every text/background pair in use. Checked by engine, control-channel and Vitest DOM tests; not yet looked at in the running app (gaming mode). No theme picker yet (settings dialog, M1.9b).
|
||||
|
||||
## Revision history
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-16 | minor | M1.10: Settings row 2% → 4% (est.), light/dark themes with live switching |
|
||||
| 2026-10-16 | minor | M1.9a: Settings row 0% → 2% (est.), settings backend without UI |
|
||||
| 2026-10-15 | minor | Calibration note after cycle C1 (factor 0.07) |
|
||||
| 2026-10-15 | minor | Editor core 0% → 8% (estimated): tabs and editor in the app (M1.6) |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# UI parity checklist
|
||||
|
||||
> **Status:** main window layout (M1.5), project tree running against the engine (M1.4), editor tabs with a CodeMirror editor (M1.6) · **Last updated:** 2026-10-15
|
||||
> **Status:** main window layout (M1.5), project tree running against the engine (M1.4), editor tabs with a CodeMirror editor (M1.6), light and dark themes (M1.10) · **Last updated:** 2026-10-16
|
||||
|
||||
- [ ] Main window: tool window stripes, editor area, status bar, navigation bar
|
||||
- M1.5 (2026-10-14): left tool window with header, hide button, collapsed stripe with a show button, resizable by pointer and keyboard; editor area placeholder; status bar. Missing: stripes with several tool windows, bottom/right docking, navigation bar, layout persistence. Not checked in the running app yet (needs M1.4).
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
- [ ] Settings dialog with search
|
||||
- [ ] Keymap editor (Lutra's own default keymap; no copied keymaps)
|
||||
- [ ] Light and dark themes from theme tokens
|
||||
- M1.10 (2026-10-16): Lutra Dark and Lutra Light from Rust tokens, switched live through `appearance.theme` (no reload), `system` follows the OS preference, the first frame uses the stored theme; the editor (selection, active line, cursor, gutter, matches), tabs and notices have their own tokens; WCAG AA contrast checked by Vitest for every text pair in both themes. Covered by Vitest DOM and control-channel tests; live check pending (gaming mode). Missing: a theme picker (settings dialog, M1.9b; command palette, M1.8), the native title bar following the theme, editor font size from `editor.fontSize`, colour scheme editor, high-contrast theme, design review of the values.
|
||||
- [ ] Notifications and background task indicator
|
||||
- [ ] Structure tool window
|
||||
- [ ] Problems tool window
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-16 | minor | Themes partial (M1.10) |
|
||||
| 2026-10-15 | minor | Editor tabs partial (M1.6) |
|
||||
| 2026-10-15 | minor | Project tool window runs against the engine (M1.4) |
|
||||
| 2026-10-14 | minor | Notes on main window and project tool window (M1.5) |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue