M3.9: hamburger app menu
A slim header bar in MainLayout with a menu button (Lucide menu) whose dropdown lists every command with a menuPath, grouped File, Edit, View, Go, Help, with shortcuts and dimmed disabled entries. Keyboard: arrows, Home/End, Enter/Space, Escape/Tab, type-ahead. menu.open (Alt+M) opens it, also over uiCommand. It is an exclusive modal and a launcher under the one-modal rule. Menu paths for the user-facing engine and UI commands (buffer.close as File/Close Tab). Catalog strings, Vitest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
78709dd76b
commit
27ad30369c
14 changed files with 1004 additions and 25 deletions
|
|
@ -45,13 +45,13 @@ let mounted: VueWrapper[];
|
|||
*/
|
||||
function listing(): unknown[] {
|
||||
const registered = calls.find((c) => c.command === "ui.registerCommands")?.params as
|
||||
| { commands: { id: string; labelKey: string; defaultShortcut?: string }[] }
|
||||
| { commands: { id: string; labelKey: string; menuPath?: string; defaultShortcut?: string }[] }
|
||||
| undefined;
|
||||
const ui = (registered?.commands ?? []).map((c) => ({
|
||||
id: c.id,
|
||||
label: c.labelKey,
|
||||
labelKey: c.labelKey,
|
||||
menuPath: null,
|
||||
menuPath: c.menuPath ?? null,
|
||||
defaultShortcut: c.defaultShortcut ?? null,
|
||||
params: "",
|
||||
enabled: true,
|
||||
|
|
@ -166,7 +166,7 @@ describe("command store", () => {
|
|||
expect(store.infos.filter((c) => c.ui === true).map((c) => c.id)).toEqual(UI_COMMANDS.map((c) => c.id));
|
||||
expect(store.entries.map((e) => e.id)).not.toContain("buffer.edit");
|
||||
const toggle = store.entries.find((e) => e.id === "view.toggleProjectTree");
|
||||
expect(toggle).toEqual({ id: "view.toggleProjectTree", label: "Show or Hide Project", shortcut: "Ctrl+1", enabled: false });
|
||||
expect(toggle).toEqual({ id: "view.toggleProjectTree", label: "Show or Hide Project", shortcut: "Ctrl+1", enabled: false, menuPath: "View/Project", ui: true });
|
||||
});
|
||||
|
||||
it("keeps the UI commands when the engine refuses them, with an error toast", async () => {
|
||||
|
|
@ -265,6 +265,7 @@ describe("CommandPalette", () => {
|
|||
"goto.fileOpen",
|
||||
"goto.symbolOpen",
|
||||
"project.openDialog",
|
||||
"menu.open",
|
||||
"app.quit",
|
||||
"editor.reveal",
|
||||
"settings.open",
|
||||
|
|
@ -286,7 +287,7 @@ describe("CommandPalette", () => {
|
|||
const wrapper = await mountPalette();
|
||||
await press(PALETTE_KEY);
|
||||
await type(wrapper, "o");
|
||||
expect(rows(wrapper).slice(0, 3)).toEqual(["project.openDialog", "find.open", "palette.open"]);
|
||||
expect(rows(wrapper).slice(0, 3)).toEqual(["project.openDialog", "menu.open", "find.open"]);
|
||||
await type(wrapper, "open f");
|
||||
expect(rows(wrapper)[0]).toBe("project.openDialog");
|
||||
await press({ key: "ArrowDown" });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue