Context menus, radial menu and rename popover on the UI kit

This commit is contained in:
Nathan Dane
2026-10-20 13:59:01 +02:00
parent 57aad71bbe
commit a3e2fe25bb
19 changed files with 1168 additions and 378 deletions
+11 -2
View File
@@ -13,8 +13,8 @@ These specialised surfaces remain in their owners:
| Start page: `home.rs` | Painted start tiles, thumbnails and links rather than form cards |
| Assistant transcript/composer containers, gallery and docking: `agent_chat/panel.rs` | Conversation/media layout, rich selectable content, drag/docking behavior; matching controls use the kit |
| Native file/program pickers: `file_picker.rs`, host services | Host-native sheets have no egui control surface; load/progress cards use the kit |
| Help menu and command-result ranking/list/pins: `help.rs`, `shortcut_box.rs` | Menu/search layout; search editor uses the kit |
| Ribbon, browser/timeline rows, context menus: `toolbar.rs`, `browser.rs`, `context_menu.rs`, `timeline_left.rs` | Specialised navigation, painting, menus and inline rename interactions |
| Command-result ranking/list/pins: `shortcut_box.rs` | Search layout and ranking; popup shell and matching controls use the kit |
| Ribbon and browser/timeline rows: `toolbar.rs`, `browser.rs`, `timeline_left.rs` | Specialised navigation, canvas painting, drag/drop and inline rename placement; context/overflow menus, their rows and floating rename now use the kit |
| Motion transport, key strips and chart: `dialogs_motion.rs`, `dialogs_motion_plot.rs` | Playback/chart interaction; matching form controls use the kit |
| Generated part thumbnails: `dialogs_parts.rs` | Cached images rather than controls |
| Joint-browser glyphs and flat-pattern canvas: `dialogs_assembly.rs`, `dialogs_sheet.rs` | Model navigation and geometry; dialog/export actions use the kit |
@@ -29,3 +29,12 @@ Immediate commands such as `parameters.graph`, `parameters.move`, `config.rules`
related controls live in Parameters, Configurations and Appearance; the kit creates
no extra command dialogs. Command IDs, model operations and scenario handles are
unchanged by cleanup.
Context menus are covered by `Menu`/`MenuItem`, including browser and history targets,
workspace popup chrome, Appearance submenus, section headings, separators, checks,
disabled/danger rows and ribbon pin rows. The optional marking menu uses the kit's
rounded-sector renderer; its command choices and hold/flick behavior remain owned
by `context_menu.rs`. Floating rename uses kit fields and actions; Properties already
uses the shared Window. No menu-frame or raw-control allowances were added.
The light/dark gallery and CPU evidence cover representative row states and radial
geometry; desktop captures of the live menus remain part of reviewer acceptance.
+21 -1
View File
@@ -1,7 +1,7 @@
# SolidCraft UI kit
`crates/ui-egui/src/ui_kit/` contains the tokenised controls used by feature dialogs,
preferences, manager cards, prompts and the sketch palette. Import through
preferences, manager cards, prompts, context menus and the sketch palette. Import through
`crate::ui_kit::{...}`. The API is crate-visible; implementation modules are private.
## Composition and rules
@@ -55,6 +55,8 @@ table. Panel/Window/Confirm compositions also have dedicated geometry and intera
| Module / element | Use and options | Main tokens |
| --- | --- | --- |
| menu: `Menu`, `MenuItem` | Shared popup, 30 pt rows, 28 pt icon column, clipped labels, right-aligned mono shortcuts, submenu chevrons, checked/unchecked and document swatches, inert 40% disabled rows and danger ink; headings and separators; ribbon drag/pin targets retained | `dialog_body/border/rule`, `radius_xl`, `control_height/radius`, `form_ink/dim/primary/error`, `accent_soft`, typography and spacing |
| radial: `radial_menu` | Eight rounded annular sectors, parallel 4 pt gaps, 9 pt circular corner joins, accent hover, centre label/key; existing hold/flick/release dispatch | `dialog_body/border`, `form_ink/dim/primary`, `accent_soft`, font/spacing tokens |
| panel: `Window`, `WindowPage` | Shared card frame, header, optional page list, bounded content and footer with a left action | `form_header/footer_height`, `form_card_width`, `form_label_width`, `control_height`, `dialog_footer/rule`, `selected_bg/ink`, spacing |
| confirm: `Confirm`, `Tone` | Modal warning/danger/info, title/message, mono detail and ghost/cancel/primary actions | `warning`, `form_error/fill`, `accent_soft`, `form_primary`, `on_accent`, `tab_on_fill_dark`, `font_subtitle`, spacing |
| metrics: `row_height`, `table_row_height`, `header_height` | Shared control/header heights | `control_height`, `space_8`, `form_header_height` |
@@ -307,3 +309,21 @@ of the approved fills. It only styles tab pills; global primary actions still us
`on_accent`. Built-in palette tests require WCAG contrast of at least 4.5:1 for
ink on the card and panel, ink on soft, and pill text on fill in both themes.
Only Mesh separates ink from fill in the light theme.
Context menu adapters retain item IDs, enabled logic and command parameters. `Menu`
owns popup elevation (10 pt corners, 1 pt border), headings, separators, adjacent
submenus and bounded arrow navigation. Enter opens a submenu or chooses its row;
Right opens, Left returns, and Esc dismisses the menu. Appearance includes document
swatches and Remove override through `appearance.assign`; its original action still
opens the full editor. Workspace retains its descriptive cards and scenario handles
on the shared surface. Ribbon rows reuse `MenuItem::paint` while owning drag, focus
and pin interactions. History context menus and ribbon overflow use kit popup chrome.
Rename uses the shared caption, field policy and Cancel/OK actions with its stable
editor ID. No additional translation keys or colour roles are needed.
The menu gallery includes normal, hovered, open, disabled, checked/unchecked,
swatch and danger rows, a submenu and rename. Radial geometry tests measure the
actual side endpoints at both radii and sample all four rounded corners. Optional
CPU-rendered menu evidence can be produced without a window with
`SOLIDCRAFT_MENU_EVIDENCE=/tmp/menus cargo test -p solidcraft-ui-egui --lib menu_board_in_both_themes`.
Desktop interaction and visual acceptance still require a reviewer capture.