S005: overlay layer, menu with submenu, modal dialog, toast stack

Menus, dialogs and toasts draw on an own full-window layer so they can
play exit motion; gallery pages show them open for screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
astar76 2026-11-18 10:06:17 -06:00
commit c94b868b2e

View file

@ -42,5 +42,12 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
- Not verified: per-mount `.Trash-$uid` trash and cross-device move (no second filesystem inside the scratchpad). Workspace `cargo fmt --check` fails only on S005's in-progress `crates/tunal/src/main.rs`.
- Later: trash `directorysizes` cache; orphan `.trashinfo` cleanup on empty; trash watch for live trash view; checking free space before copy.
## S005 — Menus, dialogs and toasts
- Done: `components/overlay.slint` `Overlay { open, modal, enter/exit-duration; out progress; dismissed; place() }` (full-window layer, scrim, outside click/scroll swallowed, hidden once its exit ends). `Menu { items: [MenuItem { text, icon, shortcut, disabled, separator, submenu: [MenuEntry] }], leading-icons; activated(index, sub-index), closed; open-at(x, y), expand(i), close() }`: scale + fade from the anchor, flips/clamps at window edges, arrows skip separators/disabled, Right/Left/Enter/Space/Esc, hover opens the submenu. `Dialog { title, body, actions: [DialogAction { text, kind }], default-action, cancel-action, dialog-width, content-focus; action(i), focus-content; show(), close() }` + children slot: scrim fade, scale-in, Enter/Esc/scrim click, Tab wraps inside. `ToastStack { toasts: [ToastData { message, action, cancellable, progress-kind: ToastProgress, progress, closing }], toast-width; action(i), cancelled(i), removed(i) }`: slide/fade in and out, animated re-stack, auto-dismiss after `Motion.toast-timeout` (paused on hover), determinate bar / indeterminate sweep. `Tooltip` moved to `tooltip.slint`, fades in. `StateLayer.has-focus` + `grab-focus(ring)`. Tokens: `Theme.float-shadow-*`, `scrim-opacity`, `window-margin`; `Motion.enter-scale`, `toast-timeout`, `indeterminate-period`; 9 icons. `tunal --gallery --page menu|dialog`.
- Overlay API: put `ToastStack`, `Dialog`, `Menu` last in the window (`width: 100%; height: 100%`), then `menu.open-at(btn.absolute-position.x, btn.absolute-position.y + btn.height)`, `dialog.show()` / `close()` from `action`, append `ToastData` to the model and remove it on `removed(i)` (D-029).
- Verified: workspace build, clippy -D warnings, fmt --check, literal grep empty; looked at menu/dialog pages light + dark at 960×640, menu flipped at 720×480, controls page unchanged. Keys injected once through a temporary, uncommitted `dispatch_event` hook: arrow skip and wrap, Esc closing submenu then menu, Enter activating, dialog Tab/Shift+Tab wrap, Enter default, Esc cancel.
- Not done: motion (scale, slide, re-stack, sweep) not watched live (screenshots force reduced motion; software renderer ignores `transform-scale`, D-025); pointer outside-click and hover-open not exercised. Dialog content should hold one focus stop: a `TextField` with text has two (input + clear), so Shift+Tab from its clear button wraps to the last action.
- Later: focus doesn't return to the opener by itself (use `closed` / after `close()`); a menu opened from a button flips to end at the anchor point, not above the button.
## Later
-