M1.15: one modal at a time, restore dialog follows outside restores

- Modal rule (ui/src/commands/modals.ts): palette, settings dialog and the
  close question are exclusive; opening one closes the other. Running any
  command but palette.open (keyboard, palette, uiCommand) closes the
  palette. The restore dialog is queued: hidden while another modal is
  open, back with its list intact afterwards.
- recovery.restore / recovery.discard emit recoveryResolved {paths}; the
  restore dialog drops the settled paths and closes when none are left.
  Rust was needed: discard gave the UI no signal, and a restored entry
  stays in the journal as the buffer's own entry.
- Dimmed restored text (C2 screenshot 09) was the dialog overlay, not an
  editor style; no editor change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-16 21:49:38 +02:00
parent d12a517009
commit 1a38e68480
13 changed files with 442 additions and 12 deletions

View file

@ -16,9 +16,12 @@
* so a change over the control channel shows while the dialog is open.
* - **Keyboard:** Escape closes, Tab and Shift+Tab stay inside the dialog,
* and the focus returns to where it was.
* - **One modal:** opening the dialog closes the palette or the close
* question (see `commands/modals.ts`).
*/
import { X } from "@lucide/vue";
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref } from "vue";
import { useModalsStore } from "../../commands/modals";
import { useCommandsStore } from "../../commands/store";
import { t } from "../../i18n";
import {
@ -34,6 +37,7 @@ import {
const commands = useCommandsStore();
const settings = useSettingsStore();
const modals = useModalsStore();
/** Whether the dialog is shown. */
const open = ref(false);
@ -200,6 +204,7 @@ function choose(id: string): void {
/** Opens the dialog (or focuses its search field) and reloads the settings. */
async function show(): Promise<void> {
modals.opened("settings", close);
if (!open.value) {
const active = document.activeElement;
returnFocus = active instanceof HTMLElement ? active : null;
@ -217,6 +222,7 @@ function close(): void {
return;
}
open.value = false;
modals.closed("settings");
for (const key of Object.keys(drafts)) {
Reflect.deleteProperty(drafts, key);
}