M1.8: command palette, global keymap, UI commands

- Engine: ui.registerCommands (validated, replaces the previous set),
  UI commands in listCommands with ui: true and labelKey, running one
  through the engine emits uiCommand {id, params}.
- Frontend: ui/src/commands/ (keymap by key code, fuzzy ranking, Pinia
  commands store with handlers, recents and error toasts), the command
  palette (Mod+Shift+P), UI commands palette.open, settings.open (Mod+,,
  disabled until M1.9b) and view.toggleProjectTree (Mod+1). The editor's
  shortcuts.ts moved into the global keymap.
- Tests: engine and control-channel tests for registration and
  uiCommand, Vitest for keymap, ranking, store, palette and App wiring.
- Docs: architecture, ui-parity, target-app-parity, gaps, roadmap,
  ROADMAP, README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-16 16:59:43 +02:00
parent 2f8fef876b
commit 184b8a3468
33 changed files with 2282 additions and 233 deletions

View file

@ -1,6 +1,8 @@
/**
* Tests for the root component: it loads product information on mount and
* shows it, or the error, in the status bar.
* shows it, or the error, in the status bar, and it wires the UI commands:
* `Mod+1` hides and shows the Project tool window, `Mod+Shift+P` opens the
* palette.
*/
import { flushPromises, mount } from "@vue/test-utils";
import { createPinia, setActivePinia } from "pinia";
@ -39,4 +41,25 @@ describe("App", () => {
expect(bar.text()).toBe("engine unavailable");
expect(bar.classes()).toContain("status-bar--error");
});
it("toggles the project tree and opens the palette from the keyboard", async () => {
invoke.mockImplementation((command: string) =>
Promise.resolve(command === "engine_list_commands" ? [] : null),
);
const wrapper = mount(App, { attachTo: document.body });
await flushPromises();
const press = async (init: KeyboardEventInit): Promise<void> => {
window.dispatchEvent(new KeyboardEvent("keydown", { bubbles: true, cancelable: true, ...init }));
await flushPromises();
};
expect(wrapper.find("[data-test=tool-window]").exists()).toBe(true);
await press({ key: "1", code: "Digit1", ctrlKey: true });
expect(wrapper.find("[data-test=tool-window]").exists()).toBe(false);
expect(wrapper.find("[data-test=tool-window-stripe]").exists()).toBe(true);
await press({ key: "1", code: "Digit1", ctrlKey: true });
expect(wrapper.find("[data-test=tool-window]").exists()).toBe(true);
await press({ key: "P", code: "KeyP", ctrlKey: true, shiftKey: true });
expect(wrapper.find("[data-test=palette]").exists()).toBe(true);
wrapper.unmount();
});
});