S015: Material You foundation: M3 schemes, Outfit, icons, springs, widgets, gallery
Fixes R1-01 (icon glyphs) and R1-02 (clock contrast). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
d6cdaa3411
commit
07b357deaf
3 changed files with 2292 additions and 308 deletions
|
|
@ -10,3 +10,4 @@
|
|||
- D-006 — 2026-11-11 — egui's epaint is vendored (`vendor/epaint`, 0.37.0 + a patch rendering glyphs single-threaded) via `[patch.crates-io]`. — Servo's canvas enables vello_cpu/multithreading, which makes stock epaint 0.37.0 panic on every glyph; no fixed release exists. — any plan that upgrades egui: drop the patch once epaint fixes it, keep `theme::tests::egui_draws_text`
|
||||
- D-007 — 2026-11-11 — Run order changed: after S005 the UI redesign (S015–S021) runs next, then the rest of Verify and Gaps (S006–S014). S015's dependency on S014 is replaced by S005. Phase 1 review items R1-01 (icons), R1-02 (clock), R1-05 and R1-06 (old-Nacre feel, animations, "unslop" look) are redesign input; R1-03 (YouTube) and R1-04 (captchas, caching) go to S006/S007. — The user chose it after the phase 1 review. — S006–S021
|
||||
- D-008 — 2026-11-11 — One painter per window, shared by all its tabs (not one per tab). Picture-in-picture reloads the page in a dedicated web view and seeks the video (page state is lost). — Per-tab painters cost ~56 MB + 6 threads each (15 tabs: 1128 MB vs 341 MB) with equal frame time; the 4 GB target PC. The user chose it (option B in S005). — S005, any plan touching painters or PiP
|
||||
- D-009 — 2026-11-11 — Material You colours come from the `material-colors` crate pinned at `=0.4.2` (MCU port: HCT, tonal palettes, all scheme variants), not an own port. Icons are Material Symbols Outlined, cut to the names in `tools/icons.txt` by `tools/icons.py` (55 KB, FILL and wght axes kept). — 0.5.0 needs Rust 1.97 and the project allows 1.88; the crate matches MCU's reference colours (theme tests). The user's old Nacre used Material Symbols too. — S015–S020: add an icon by editing tools/icons.txt and running the tool
|
||||
|
|
|
|||
|
|
@ -140,6 +140,86 @@ picture-in-picture, extensions, password capture, printing.
|
|||
- Hardware acceleration switch: Servo needs GL; "Off" selects software GL (LIBGL_ALWAYS_SOFTWARE) on next start.
|
||||
- Printing: "Save page as PDF/PNG" through a full-page screenshot.
|
||||
|
||||
## UI system (S015)
|
||||
|
||||
Everything the interface draws takes its colours, radii, sizes and springs from `src/theme.rs`; widgets live in
|
||||
`src/ui/widgets.rs`, Expressive shapes in `src/ui/paint.rs`, icons in `src/ui/icons.rs`. `nacre://gallery`
|
||||
(`src/ui/pages/gallery.rs`, not linked from the UI) shows all of it; `SMOKE_SIZE=1400x2800 tools/smoke.sh
|
||||
tests/smoke/gallery.txt` shoots it dark and light. Rules: the `app-taste` skill. No one-off colour, radius or duration.
|
||||
|
||||
**Tokens reach widgets through the egui context.** `theme::apply(ctx, &palette, &settings)` (called by
|
||||
`App::style_window` whenever the theme, seed or settings change) stores `theme::Tokens { palette, roundness, motion }`
|
||||
and sets egui visuals, text styles and spacing. From any `Ui`: `theme::palette(ui.ctx())`,
|
||||
`theme::radius(ui.ctx(), theme::L)`, `theme::spring(...)`. Fonts are set once per window: `ui::fonts()` in
|
||||
`window.rs`.
|
||||
|
||||
**Colour** (`theme::Palette`, from the `material-colors` crate, D-009). `Palette::new(seed, dark, variant, contrast)`
|
||||
builds the M3 scheme; `variant` is a `theme::VARIANTS` key (tonal_spot default), `contrast` -1..1. Seeds:
|
||||
`theme::seed` (website colour if chroma ≥ 12 and tone 8..95, else fallback; system accent; preset; custom).
|
||||
- M3 roles: `primary`, `on_primary`, `primary_container`, `on_primary_container`, `inverse_primary`, `secondary*`,
|
||||
`tertiary*` (same four each), `error`, `on_error`, `error_container`, `on_error_container`, `surface`,
|
||||
`surface_dim`, `surface_bright`, `surface_container_lowest`, `surface_container_low`, `surface_container`, `surface_container_high`,
|
||||
`surface_container_highest`, `on_surface`,
|
||||
`on_surface_variant`, `outline`, `outline_variant`, `inverse_surface`, `inverse_on_surface`, `scrim`, `shadow`.
|
||||
- Extra: `warning`, `success` (fixed hues at primary's tones).
|
||||
- Old names kept as aliases for existing code: `accent` = primary, `on_accent` = on_primary, `accent_soft` =
|
||||
secondary_container, `surface_high` = surface_container_high, `surface_low` = surface_container_lowest (the page
|
||||
background), `text` = on_surface, `text_weak` = on_surface_variant. New code uses the M3 names.
|
||||
- Usage: page background `surface_container_lowest`; cards `surface_container`; floating surfaces
|
||||
`surface_container_high`; fields `surface_container_highest`; hairlines `outline_variant`; selection
|
||||
`secondary_container` + `on_secondary_container`; main action `primary`.
|
||||
- State layers: `theme::layer(base, over, amount)` mixes opaque; constants `HOVER` 0.08, `FOCUS` 0.10, `PRESS` 0.10,
|
||||
`DRAG` 0.16, `DISABLED_CONTENT` 0.38, `DISABLED_CONTAINER` 0.12 (content colour over the container).
|
||||
|
||||
**Shape and space.** Radii `XS` 4, `S` 8, `M` 12, `L` 16, `XL` 28, `FULL` (pill); always read through
|
||||
`theme::radius(ctx, token)` (Roundness setting: Subtle ×0.5, Default ×1, Round ×1.4) and convert with
|
||||
`theme::corner_radius(f32)`. Spacing `GAP_XS` 4, `GAP_S` 8, `GAP_M` 12, `GAP_L` 16, `GAP_XL` 24. Heights
|
||||
`CONTROL_SMALL` 32 (icon buttons), `CONTROL` 40 (buttons, segmented), `ROW` 56 (list rows). Cards use `L`, chrome
|
||||
pills `FULL`, small egui widgets `S` (`theme::corner`).
|
||||
|
||||
**Type.** Outfit (OFL, `assets/fonts/Outfit[wght].ttf`, one variable font) at `theme::Weight` Thin 200, Light 300,
|
||||
Regular 400 (egui's Proportional), Medium 500, SemiBold 600; `theme::font(size, weight)`. Sizes `SMALL` 12, `BODY` 14,
|
||||
`TITLE` 18, `HEADLINE` 24, `DISPLAY` 64 (clock: Thin, primary). egui text styles: Small/Body/Button/Heading(24
|
||||
Medium)/Monospace 13. Outfit is Latin only: every family falls back to Material Symbols, then egui's Ubuntu-Light
|
||||
(Cyrillic, Greek). No CJK font is bundled.
|
||||
|
||||
**Icons.** Material Symbols Outlined (Apache 2.0), cut to `tools/icons.txt` by `tools/icons.py` into
|
||||
`assets/fonts/MaterialSymbolsOutlined-Nacre.ttf` (FILL and wght axes kept). Use the constants `icons::HOME` etc.
|
||||
(`icons::ALL` lists them). To add one: add its name (fonts.google.com/icons) to `tools/icons.txt`, run
|
||||
`python tools/icons.py`. Draw with `widgets::icon(ui, center, glyph, size, filled, colour)` or
|
||||
`theme::icon_font(size, filled)`; filled (FILL 1) is for selected states. Icons also work inside text (`format!("{}
|
||||
Open folder", icons::FOLDER_OPEN)`) through the fallback. Sizes `ICON` 20, `ICON_LARGE` 32. Never emoji.
|
||||
|
||||
**Motion.** `theme::spring(ctx, id, target, spring) -> f32`: per-id state in egui memory, retargets keeping
|
||||
velocity, starts at the target on first use, repaints only while moving, returns the target at once with Motion off.
|
||||
`theme::effect(ctx, id, on) -> 0..1` is the colour/opacity spring. Presets (stiffness/damping ratio): `FAST`
|
||||
1400/0.62 (press, small controls), `DEFAULT` 700/0.68 (panels, movement), `SLOW` 300/0.74 (big transitions),
|
||||
`EFFECT` 900/1.0 (colour, opacity; never overshoots). Motion setting = time factor (Off 0, Fast 0.6, Normal 1,
|
||||
Slow 1.8; stiffness ÷ factor²); `theme::animation_time` drives egui's own animations (0.1 s × factor).
|
||||
|
||||
**Widgets** (`ui::widgets`; all have hover state layer, press squeeze, focus ring in `secondary`, disabled 38 %):
|
||||
- `button(ui, ButtonKind::{Filled, Tonal, Outlined, Text}, Option<icon>, label) -> Response`: 40 px pill, press
|
||||
morphs to radius `S`.
|
||||
- `icon_button(ui, icon, tooltip)`, `icon_toggle(ui, icon, tooltip, on)`: 32 px circle, press squashes to a squircle;
|
||||
selected = `secondary_container` fill and filled icon.
|
||||
- `switch(ui, &mut bool) -> changed`: M3 switch, handle travels (FAST) and grows with a check when on, hover halo.
|
||||
- `segmented(ui, &mut T, &[(T, label)]) -> changed`: equal-width segments, selected = tonal fill + check that slides in.
|
||||
- `card(ui, |ui| ...)`: `surface_container`, radius `L`; rows inside get hairlines between them (not above the first).
|
||||
- `row(ui, title, description, |ui| control)`, `switch_row`, `link_row(ui, title, description) -> clicked` (whole
|
||||
row is the button, chevron at the end), `section(ui, title)` (group title in `primary`, above a card).
|
||||
- `text_field`, `number`, `page_column`, `glyph(toolbar key) -> icon`.
|
||||
|
||||
**Shapes** (`ui::paint`): `cookie(painter, center, radius, lobes, rotation, fill, stroke)`,
|
||||
`cookie_image(painter, texture, center, radius, lobes, rotation)` (artwork in a cookie), `cookie_points`,
|
||||
`wavy_line(painter, x0, x1, y, amplitude, wavelength, phase, stroke)`, `wavy_progress(painter, rect, fraction,
|
||||
amplitude, phase, &palette)` (amplitude 0 = flat, animate it with a spring when playing/paused; advance `phase` only
|
||||
while something plays), `shadow(painter, rect, radius, dark)` (one soft shadow for floating surfaces; egui's
|
||||
`window_shadow`/`popup_shadow` are set to match).
|
||||
|
||||
**What egui can't do here:** no text blur or text shadows; no per-glyph variable axes inside one label (a weight is
|
||||
a font family); shadows are tessellator-blurred rectangles only (not arbitrary shapes); `Ui::id`/`Id::new` are
|
||||
deprecated in 0.37 but still used across the code.
|
||||
|
||||
## Feature checklist
|
||||
|
||||
See `docs/FEATURES.md`; every row names the file that implements it and its review state.
|
||||
|
|
|
|||
|
|
@ -54,6 +54,20 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
|
|||
- Not done: real-GPU check (S010). PiP loses page state (in DESIGN engine limits). Split view now impossible.
|
||||
- Later: status field `painters` counts web views, not painters; rename. malloc_trim after discard.
|
||||
|
||||
## S015 — Material You foundation (2026-11-11)
|
||||
- Done: `theme.rs` M3 schemes from `material-colors =0.4.2` (D-009) with all roles + old aliases; `theme::apply` stores
|
||||
tokens (palette, roundness, motion) in the egui context; shape/space/type tokens; springs (FAST/DEFAULT/SLOW/EFFECT,
|
||||
Motion setting scales or disables). Outfit variable font (5 weights) + Material Symbols subset (`tools/icons.py`,
|
||||
139 icons, 55 KB). `widgets.rs` restyled (buttons, icon buttons, switch, segmented, card, rows), `ui/paint.rs`
|
||||
(cookie, wavy line/progress, shadow), hidden `nacre://gallery` + `tests/smoke/gallery.txt`. DESIGN.md § UI system.
|
||||
- Fixed: R1-01 (every emoji/Unicode glyph in src/ui now an icon constant); R1-02 (strong text used on_primary =
|
||||
white in light theme; clock now Thin Outfit in primary).
|
||||
- Verified: 38 unit tests (reference colours #555992/#BEC2FF/#65558F/#CFBDFE, contrast ≥ 4.5 for 12 presets light and
|
||||
dark, widget click/Tab+Space/hover-settle); gallery.txt and launch.txt exit 0, shots checked by eye.
|
||||
- Not done: focus ring and pressed states not seen in screenshots (tests only); no real-GPU check; no CJK font.
|
||||
- Later: chrome toolbar glyphs still drawn at text size via egui Buttons (S016); `egui::Ui::id`/`Id::new`
|
||||
deprecation warnings across src/ui.
|
||||
|
||||
## Later
|
||||
- Reader mode, split view, translate, real gamepad rumble (D-002: not planned for now).
|
||||
- Packaging and first release (D-001: plan when the user asks).
|
||||
|
|
|
|||
Loading…
Reference in a new issue