Put the global actions in a bottom bar and the tools in the ribbon

Decision 3 correction and the owner's ribbon direction of 2026-10-28.

- One bar at the bottom of the side pane holds the workspace switcher,
  Help, and Settings, as in Obsidian. The switcher opens the workspace
  list above it. The header has no workspace button.
- While the side pane is closed, the workspace switcher, Help, and
  Settings move to the bottom of the left ribbon, so they stay
  reachable.
- New browser tab, Terminal, Plug-in views, and Commands moved from the
  header to the top of the left ribbon, so the tabs have more room.
  Their menus open at the right of the ribbon. The header keeps Save,
  the outline toggle, and the window controls. A detached tab window
  has no ribbon and keeps these tools in its header.
- Docs: decision 3 and the ribbon tools in UI-050, ui-design.md, and
  the user guide.

Tests: layout/titleBar checks the bottom bar, the ribbon fallback, and
the header buttons. workspace/openAndCreate uses the ribbon switcher in
a narrow window. tree/renameUndo reads the tools in the ribbon.
This commit is contained in:
Knotty Wyvern
2026-10-28 23:57:19 -07:00
parent eeddd880e1
commit c271e2bae1
13 changed files with 155 additions and 81 deletions
+5 -3
View File
@@ -942,11 +942,13 @@ Native shell, background image, and desktop acceptance remain open.
- Status: Implemented for user review
- Decision source: Owner decisions 3, 7, and 12 of 2026-10-27 (interface review issues 3, 8, and 15), stage 5-4.
- Previous rule: The workspace button, Help, and Settings sat in the footer of the left pane, so they left the window with the pane. The plugin ribbon had no width without plugin entries. Tabs could shrink to 69 pixels, with no list and no sign of hidden tabs. The fixed drag area was 40 pixels. Every platform got rounded 40-pixel caption buttons, and macOS got Windows caption buttons.
- New rule: The workspace button sits at the left end of the header. It shows the workspace name and opens the workspace list below it. The left ribbon is always present: plugin views at the top, Help and Settings at the bottom. Tabs keep 120 pixels and scroll, with fades at the ends and a ⌄ list of all tabs that marks pinned and unsaved tabs. The header keeps a drag area of 120 pixels after the tabs. In a narrow header, the tabs shrink first, and the drag area keeps at least 48 pixels. Windows and Linux get square caption buttons, 46 pixels wide and full height. macOS keeps its native traffic lights through an overlay title bar, and each title bar leaves `--rs-titlebar-inset-start` (78 pixels) free for them.
- New rule: A bar at the bottom of the side pane holds the workspace switcher, Help, and Settings, as in Obsidian. The switcher shows the workspace name and opens the workspace list above it. The left ribbon is always present and holds plugin views. While the side pane is closed, the workspace switcher, Help, and Settings move to the bottom of the ribbon. Tabs keep 120 pixels and scroll, with fades at the ends and a ⌄ list of all tabs that marks pinned and unsaved tabs. The header keeps a drag area of 120 pixels after the tabs. In a narrow header, the tabs shrink first, and the drag area keeps at least 48 pixels. Windows and Linux get square caption buttons, 46 pixels wide and full height. macOS keeps its native traffic lights through an overlay title bar, and each title bar leaves `--rs-titlebar-inset-start` (78 pixels) free for them.
- Snap Layouts: The custom title bar has no native caption buttons, so a hit test cannot show the flyout. When the pointer rests 500 ms on maximize, the host presses Win+Z for the focused window. This is the method of the existing Win+H dictation command.
- Reason: Global actions must stay reachable when the side pane closes. A tab label must stay readable. Each platform keeps its own window conventions.
- Scope: The main header, the left ribbon, the tab bars, the Settings and Browser window title bars, and the window builders of the host.
- Shared implementation: `WorkbenchHeader.svelte`, `PluginRibbon.svelte`, `TabBar.svelte`, `WindowControls.svelte`, `src-tauri/src/window_frame.rs`, `src-tauri/tauri.macos.conf.json`, and the `--rs-titlebar-inset-start` token.
- Ribbon tools (2026-10-28, owner direction): New browser tab, Terminal, Plug-in views, and Commands moved from the header to the top of the left ribbon, so the tabs have more room. Save, the outline toggle, and the window controls stay in the header. A detached tab window has no ribbon and keeps these tools in its header.
- Correction (2026-10-28): The first version put the workspace button in the header and Help and Settings in the ribbon. The owner meant one bar at the bottom left, as in Obsidian. The record of decision 3 said "left ribbon", which I read as the vertical ribbon.
- Scope: The main header, the side pane, the left ribbon, the tab bars, the Settings and Browser window title bars, and the window builders of the host.
- Shared implementation: `WorkbenchHeader.svelte`, `LeftPane.svelte`, `PluginRibbon.svelte`, `TabBar.svelte`, `WindowControls.svelte`, `src-tauri/src/window_frame.rs`, `src-tauri/tauri.macos.conf.json`, and the `--rs-titlebar-inset-start` token.
- Evidence: `tests/smoke/layout/titleBar.smoke.mjs` and the Rust command list test.
- Replaces / replaced by: The left pane footer, and the ribbon rule "The ribbon has no width when it has no entries."
- Limits: Browser checks use desktop service mocks. Snap Layouts, the native drag area, and the macOS title bar need native acceptance. The macOS code path was not compiled here. On Windows 10, Win+Z does nothing.
+4 -3
View File
@@ -146,13 +146,14 @@ Decisions: [UI-002](design-decisions.md#ui-002--share-the-requested-dropdown-des
## Window and navigation
- The main header holds the workspace button, navigation, document tabs, actions, and window controls. The workspace button names the window and opens the workspace list.
- The left ribbon stays visible when the side pane is closed. It holds plugin views at the top and Help and Settings at the bottom.
- The main header holds navigation, document tabs, Save, the outline toggle, and window controls. The other tools are in the left ribbon, so the tabs keep their room. A detached tab window has no ribbon, so its header keeps those tools.
- A bar at the bottom of the side pane holds the workspace switcher, Help, and Settings, as in Obsidian. The switcher names the workspace and opens the workspace list above it.
- The left ribbon is always present. It holds the tools (New browser tab, Terminal, Plug-in views, and Commands), then a line, then the plugin view shortcuts. Its menus open at its right. While the side pane is closed, the workspace switcher, Help, and Settings move to the bottom of the ribbon, so they stay reachable.
- Tabs keep a minimum width of 120 pixels and scroll. Fades show tabs out of view, and ⌄ lists all tabs. A drag area of 120 pixels sits after the tabs. In a narrow header, the tabs shrink first, and the drag area keeps at least 48 pixels.
- Windows and Linux title bars use square caption buttons, 46 pixels wide and full height. Rest the pointer on maximize for Snap Layouts on Windows 11. macOS keeps its native traffic lights, and title bars leave `--rs-titlebar-inset-start` free for them.
- Files, Search, Bookmarks, and installed sidebar views such as Git share the top navigation group. The active navigation button shows which view fills the left pane.
- Plugin editor views can use the left ribbon.
- The built-in browser opens from its own toolbar action. Project Management opens from Plug-in views. Keep Plug-in views in the toolbar, away from the new-tab button.
- The built-in browser opens from its own ribbon action. Project Management opens from Plug-in views. Keep Plug-in views in the ribbon, away from the new-tab button.
- Document and plugin tabs share the tab bar. The new-tab button follows the tabs. Tabs keep their order and pin state when a plugin replaces its view.
- The main window keeps an empty New tab after its last tab closes. A secondary window closes with its last tab. The unsaved-edit and active-terminal confirmations still apply, and Cancel keeps the tab open.
- Sidebar widths and visibility persist across window sessions. A different editor does not restore a hidden outline.
+4 -4
View File
@@ -22,7 +22,7 @@ This guide explains how to work with files, documents, tabs, settings, and the b
A workspace is a folder on your computer. RuneStone reads and writes its files directly.
1. Select the workspace name at the left end of the title bar, or press Ctrl+O.
1. Select the workspace name at the bottom of the sidebar, or press Ctrl+O. When the sidebar is hidden, select ⇕ at the bottom of the left ribbon.
2. Choose a recent workspace, **Open another folder…**, or **New workspace…**.
Each workspace opens in its own window. The current window keeps its documents and terminals.
@@ -191,7 +191,7 @@ If a write fails, your edits stay in the tab. RuneStone does not lock files, so
## Change settings
Select the gear at the bottom of the left ribbon, or press Ctrl+,. Use the search field to find a setting.
Select the gear at the bottom of the sidebar, or press Ctrl+,. When the sidebar is hidden, the gear is at the bottom of the left ribbon. Use the search field to find a setting.
Settings apply at once to all workspaces on this computer and update all open windows. A text field applies when you leave it.
| Category | Settings |
@@ -209,7 +209,7 @@ Reopen a document to update its editor tooltips after a language change.
RuneStone includes a Chromium-based browser. It needs no plugin.
1. Select the globe button at the top right of the window to open a **New browser tab**.
1. Select the globe button in the left ribbon to open a **New browser tab**.
2. Type an address or a search.
Use **Settings → Browser** to set the homepage and search engine, manage profiles, block ads, and clear cookies, cache, or history.
@@ -254,6 +254,6 @@ The [Terminal guide](guides/terminal.md) lists the terminal shortcuts.
## Get help
Press F1, or select the question mark at the bottom of the left ribbon, for **Help and about**. It shows the app version, basic steps, and every shortcut.
Press F1, or select the question mark at the bottom of the sidebar or of the left ribbon, for **Help and about**. It shows the app version, basic steps, and every shortcut.
When you report a problem, include the app version, operating system, steps, expected result, and error text.
+55 -3
View File
@@ -1,6 +1,11 @@
<script lang="ts">
// The left pane: a plugin sidebar view, or the files, search, and bookmarks views.
// The left pane: a plugin sidebar view, or the files, search, and bookmarks views, and the bar at its bottom with
// the workspace switcher, Help, and Settings. When the pane is closed, the left ribbon shows these three (PluginRibbon.svelte).
import { t } from "$lib/i18n";
import Icon from "$lib/ui/Icon.svelte";
import IconButton from "$lib/ui/IconButton.svelte";
import { attachTooltip } from "$lib/ui/tooltip";
import { commandShortcut } from "./workbenchKeys";
import PluginEditor from "$lib/plugins/PluginEditor.svelte";
import BrowserSlot from "$lib/plugins/BrowserSlot.svelte";
import { pluginSidebar } from "$lib/plugins/external";
@@ -19,14 +24,24 @@
activePath: string | null;
searchRequest: { text: string; id: number } | null;
fileTree?: FileTree;
workspaceAnchor?: HTMLElement;
onChooseWorkspace: () => void;
onHelp: () => void;
onSettings: () => void;
onOpenFile: (entry: TreeEntry, line?: number, target?: "current" | "new") => void;
onCreated: (entry: TreeEntry) => void;
onSaveTemplate: (entry: TreeEntry) => void;
onManageTemplates: () => void;
onStatus: (message: string) => void;
};
let { workspace, session, leftView, keysActive, showInternal, activePath, searchRequest, fileTree = $bindable(),
onOpenFile, onCreated, onSaveTemplate, onManageTemplates, onStatus }: Props = $props();
let { workspace, session, leftView, keysActive, showInternal, activePath, searchRequest, fileTree = $bindable(), workspaceAnchor = $bindable(),
onOpenFile, onCreated, onSaveTemplate, onManageTemplates, onStatus, onChooseWorkspace, onHelp, onSettings }: Props = $props();
function tooltip(node: HTMLElement, text: string) {
let current = text;
const dispose = attachTooltip(node, () => current);
return { update(value: string) { current = value; }, destroy: dispose };
}
</script>
<aside class="left">
@@ -63,6 +78,14 @@
{/if}
</div>
</div>
<div class="left-footer">
<button class="workspace-button" bind:this={workspaceAnchor} onclick={onChooseWorkspace}
use:tooltip={$t("Open folder ({shortcut})", { shortcut: commandShortcut("open-workspace") })}>
<Icon icon="chevrons-up-down" /><span class="ws">{workspace ? workspace.name : $t("Open folder")}</span>
</button>
<IconButton icon="help" label={$t("Help and about ({shortcut})", { shortcut: commandShortcut("help") })} onclick={onHelp} />
<IconButton icon="settings" label={$t("Settings ({shortcut})", { shortcut: commandShortcut("settings") })} onclick={onSettings} />
</div>
</aside>
<style>
@@ -123,4 +146,33 @@
margin: 12px;
color: var(--rs-text-dim);
}
.left-footer {
display: flex;
flex: 0 0 auto;
align-items: center;
gap: 4px;
padding: 6px;
border-top: 1px solid var(--rs-border);
}
.workspace-button {
display: flex;
flex: 1;
align-items: center;
gap: 8px;
min-width: 0;
min-height: 32px;
padding: 0 10px;
border: 1px solid transparent;
border-radius: var(--rs-control-radius);
background: var(--rs-bg-active);
color: var(--rs-text-strong);
font: 600 13px var(--rs-font-ui);
text-align: left;
}
.workspace-button:hover { border-color: var(--rs-border); }
.workspace-button :global(svg) { width: 16px; height: 16px; flex-shrink: 0; color: var(--rs-text-dim); }
.ws { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.left-footer :global(.icon-btn) { width: 32px; height: 32px; flex-basis: 32px; }
</style>
+31 -4
View File
@@ -1,18 +1,38 @@
<script lang="ts">
// The left ribbon. It stays visible when the side pane is closed: plugin views at the top, Help and Settings at the bottom.
// The left ribbon: the app tools (new browser tab, terminal, plug-in views, commands), then the plugin view shortcuts.
// While the side pane is closed, the workspace switcher, Help, and Settings
// move from the bar at the bottom of the pane (LeftPane.svelte) to the bottom of the ribbon, so they stay reachable.
import { t } from "$lib/i18n";
import IconButton from "$lib/ui/IconButton.svelte";
import PluginAccessMenu from "$lib/plugins/PluginAccessMenu.svelte";
import { openPluginView, pluginEditorActive, pluginSidebar, pluginView } from "$lib/plugins/external";
import { commandShortcut } from "./workbenchKeys";
let { items, onHelp, onSettings }: {
let { items, actions, workspaceAnchor = $bindable(), onChooseWorkspace, onHelp, onSettings,
canOpenBrowser, browserOpening, onOpenBrowser, terminalEnabled, terminalOpen, onToggleTerminal }: {
items: { owner: string; id: string; title: string; icon?: string }[];
canOpenBrowser: boolean;
browserOpening: boolean;
onOpenBrowser: () => void;
terminalEnabled: boolean;
terminalOpen: boolean;
onToggleTerminal: () => void;
/** True while the side pane is closed. */
actions: boolean;
workspaceAnchor?: HTMLElement;
onChooseWorkspace: () => void;
onHelp: () => void;
onSettings: () => void;
} = $props();
</script>
<div class="plugin-ribbon">
<div class="ribbon-tools">
{#if canOpenBrowser}<IconButton icon="globe" label={$t("New browser tab")} side="right" disabled={browserOpening} onclick={onOpenBrowser} />{/if}
{#if terminalEnabled}<IconButton icon="terminal" label={$t("Terminal")} side="right" active={terminalOpen} onclick={onToggleTerminal} />{/if}
<PluginAccessMenu surface="open" compact side="right" />
<PluginAccessMenu surface="commands" compact side="right" />
</div>
<nav aria-label={$t("Plugin shortcuts")} hidden={items.length === 0}>
{#each items as item (`${item.owner}:${item.id}`)}
<IconButton
@@ -24,10 +44,13 @@
/>
{/each}
</nav>
{#if actions}
<div class="ribbon-actions">
<div class="ribbon-workspace" bind:this={workspaceAnchor}><IconButton icon="chevrons-up-down" label={$t("Open folder ({shortcut})", { shortcut: commandShortcut("open-workspace") })} side="right" onclick={onChooseWorkspace} /></div>
<IconButton icon="help" label={$t("Help and about ({shortcut})", { shortcut: commandShortcut("help") })} side="right" onclick={onHelp} />
<IconButton icon="settings" label={$t("Settings ({shortcut})", { shortcut: commandShortcut("settings") })} side="right" onclick={onSettings} />
</div>
{/if}
</div>
<style>
@@ -37,7 +60,6 @@
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
gap: 4px;
min-height: 0;
padding: 6px 5px;
@@ -45,9 +67,14 @@
border-right: 1px solid var(--rs-border);
}
nav, .ribbon-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 0; }
nav, .ribbon-tools, .ribbon-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 0; }
.ribbon-tools { flex-shrink: 0; }
.ribbon-tools:empty { display: none; }
/* A line separates the app tools from the plugin view shortcuts. */
.ribbon-tools:not(:empty) + nav:not([hidden]) { margin-top: 2px; padding-top: 6px; border-top: 1px solid var(--rs-border); }
nav { overflow-y: auto; }
nav[hidden] { display: none; }
.ribbon-actions { margin-top: auto; flex-shrink: 0; }
.ribbon-workspace { display: flex; }
.plugin-ribbon :global(.icon-btn) { width: 32px; height: 32px; flex-basis: 32px; }
</style>
+7 -5
View File
@@ -90,7 +90,7 @@
}
let settings = $state<AppSettings>({ ...DEFAULT_SETTINGS });
let settingsReady = $state(false);
let workspaceAnchor: HTMLButtonElement | undefined = $state();
let workspaceAnchor: HTMLElement | undefined = $state();
const desktop = isTauri();
const transferredWindow = /^[0-9a-f-]{36}$/i.test(new URLSearchParams(location.search).get("tabTransfer") ?? "");
// The documents of the open workspace. Their buffers are reactive, so the tabs read them directly.
@@ -1290,9 +1290,6 @@
<WorkbenchHeader
detached={transferredWindow}
{desktop}
workspaceName={workspace?.name ?? null}
bind:workspaceAnchor
onChooseWorkspace={chooseWorkspace}
{leftOpen}
{leftView}
{sidebarNavigation}
@@ -1312,11 +1309,13 @@
onError={(message) => error = message}
/>
{#if !transferredWindow}<PluginRibbon items={ribbonNavigation} onHelp={() => preferences = "help"} onSettings={() => void openSettings()} />{/if}
{#if !transferredWindow}<PluginRibbon items={ribbonNavigation} actions={!leftOpen} bind:workspaceAnchor
canOpenBrowser={!!browserContribution?.newTab} {browserOpening} onOpenBrowser={() => void openBrowser()} {terminalEnabled} {terminalOpen} onToggleTerminal={toggleTerminal} onChooseWorkspace={chooseWorkspace} onHelp={() => preferences = "help"} onSettings={() => void openSettings()} />{/if}
{#if leftOpen && !transferredWindow}
<LeftPane
bind:fileTree
bind:workspaceAnchor
{workspace}
{session}
{leftView}
@@ -1329,6 +1328,9 @@
onSaveTemplate={(entry) => { void saveTemplate(entry); }}
onManageTemplates={() => templateManager = true}
onStatus={(message) => { status = message; error = null; }}
onChooseWorkspace={chooseWorkspace}
onHelp={() => preferences = "help"}
onSettings={() => void openSettings()}
/>
<!-- svelte-ignore a11y_no_noninteractive_tabindex, a11y_no_noninteractive_element_interactions (A focusable separator is the splitter pattern.) -->
+7 -41
View File
@@ -1,10 +1,9 @@
<script lang="ts">
// The workbench header: the workspace button, the side pane buttons, the working tabs, the actions, and the window controls.
// The workbench header: the side pane buttons, the working tabs, Save, the outline toggle, and the window controls.
// The other tools are in the left ribbon (PluginRibbon.svelte). A detached tab window has no ribbon, so its header keeps them.
import type { ComponentProps } from "svelte";
import { t } from "$lib/i18n";
import Icon from "$lib/ui/Icon.svelte";
import IconButton from "$lib/ui/IconButton.svelte";
import { attachTooltip } from "$lib/ui/tooltip";
import WindowControls from "$lib/ui/WindowControls.svelte";
import PluginTools from "$lib/plugins/PluginTools.svelte";
import PluginAccessMenu from "$lib/plugins/PluginAccessMenu.svelte";
@@ -16,9 +15,6 @@
type Props = {
detached: boolean;
desktop: boolean;
workspaceName: string | null;
workspaceAnchor?: HTMLButtonElement;
onChooseWorkspace: () => void;
leftOpen: boolean;
leftView: LeftView;
sidebarNavigation: { owner: string; id: string; title: string; icon?: string }[];
@@ -37,24 +33,13 @@
onToggleRight: () => void;
onError: (message: string) => void;
};
let { detached, desktop, workspaceName, workspaceAnchor = $bindable(), onChooseWorkspace, leftOpen, leftView, sidebarNavigation, onSelectLeft, tabBar, onNewTab, canOpenBrowser, browserOpening, onOpenBrowser,
let { detached, desktop, leftOpen, leftView, sidebarNavigation, onSelectLeft, tabBar, onNewTab, canOpenBrowser, browserOpening, onOpenBrowser,
saveDisabled, onSave, terminalEnabled, terminalOpen, onToggleTerminal, rightOpen, onToggleRight, onError }: Props = $props();
function tooltip(node: HTMLElement, text: string) {
let current = text;
const dispose = attachTooltip(node, () => current);
return { update(value: string) { current = value; }, destroy: dispose };
}
</script>
<header class="header" data-tauri-drag-region>
<div class="header-left" data-tauri-drag-region>
{#if !detached}
<!-- The workspace button names the window and opens the workspace list. -->
<button class="workspace-button" bind:this={workspaceAnchor} onclick={onChooseWorkspace}
use:tooltip={$t("Open folder ({shortcut})", { shortcut: commandShortcut("open-workspace") })}>
<Icon icon="folder-open" /><span class="ws">{workspaceName ?? $t("Open folder")}</span><Icon icon="chevron-down" />
</button>
<IconButton icon="files" label={$t("Files")} active={leftOpen && !$pluginSidebar && leftView === "files"} onclick={() => onSelectLeft("files")} />
<IconButton icon="search" label={$t("Search")} active={leftOpen && !$pluginSidebar && leftView === "search"} onclick={() => onSelectLeft("search")} />
<IconButton icon="bookmark" label={$t("Bookmarks")} active={leftOpen && !$pluginSidebar && leftView === "bookmarks"} onclick={() => onSelectLeft("bookmarks")} />
@@ -74,12 +59,14 @@
{#if desktop}<div class="window-drag-space" data-tauri-drag-region aria-hidden="true"></div>{/if}
</div>
<div class="header-right" data-tauri-drag-region>
{#if detached}
{#if canOpenBrowser}<IconButton icon="globe" label={$t("New browser tab")} disabled={browserOpening} onclick={onOpenBrowser} />{/if}
<PluginAccessMenu surface="open" compact />
<PluginTools />
<PluginAccessMenu surface="commands" compact />
<IconButton icon="save" label={$t("Save")} disabled={saveDisabled} onclick={onSave} />
{#if terminalEnabled}<IconButton icon="terminal" label={$t("Terminal")} active={terminalOpen} onclick={onToggleTerminal} />{/if}
{/if}
<PluginTools />
<IconButton icon="save" label={$t("Save")} disabled={saveDisabled} onclick={onSave} />
{#if !detached}<IconButton icon="panel-right" label={rightOpen ? $t("Hide outline") : $t("Show outline")} active={rightOpen} onclick={onToggleRight} />{/if}
{#if desktop}<WindowControls {onError} />{/if}
</div>
@@ -110,27 +97,6 @@
/* The macOS traffic lights sit at the start of the header (src/lib/theme/tokens.css). */
.header-left { justify-content: flex-start; padding-left: calc(4px + var(--rs-titlebar-inset-start)); }
.workspace-button {
display: inline-flex;
flex: 0 1 auto;
align-items: center;
gap: 6px;
min-width: 32px;
max-width: 180px;
height: 28px;
margin-right: 4px;
padding: 0 6px;
border: 1px solid transparent;
border-radius: var(--rs-control-radius);
background: transparent;
color: var(--rs-text);
font: 600 12px var(--rs-font-ui);
}
.workspace-button:hover { background: var(--rs-bg-active); border-color: var(--rs-border); }
.workspace-button :global(svg) { width: 16px; height: 16px; flex-shrink: 0; color: var(--rs-text-dim); }
.workspace-button :global(svg:last-child) { width: 12px; height: 12px; }
.ws { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* In a window below the minimum width, the center clips its content instead of drawing under the right group. */
.header-center {
overflow: hidden;
+5 -3
View File
@@ -6,7 +6,8 @@
import ContextMenu from "$lib/layout/ContextMenu.svelte";
import type { MenuItem } from "$lib/layout/menuTypes";
import { installedPlugins, pluginTools, pluginNavigation, openPluginView, runPluginCommand } from "./external";
let { surface, compact = false }: { surface: "commands" | "open"; compact?: boolean } = $props();
// `side` places the menu below the button (the header) or at its right (the left ribbon).
let { surface, compact = false, side = "bottom" }: { surface: "commands" | "open"; compact?: boolean; side?: "bottom" | "right" } = $props();
let anchor = $state<HTMLButtonElement>();
let position = $state<{ x: number; y: number } | null>(null);
let error = $state("");
@@ -30,9 +31,9 @@
</script>
{#if tools.length}
<button class="access-button" class:compact bind:this={anchor} use:tooltip aria-label={label} aria-haspopup="menu" aria-expanded={position !== null}
<button class="access-button" class:compact class:ribbon={side === "right"} bind:this={anchor} use:tooltip aria-label={label} aria-haspopup="menu" aria-expanded={position !== null}
onpointerdown={() => pointerWasOpen = position !== null}
onclick={event => { const close = event.detail > 0 ? pointerWasOpen : position !== null; const bounds = anchor!.getBoundingClientRect(); position = close ? null : { x: bounds.left, y: bounds.bottom + 4 }; }}>
onclick={event => { const close = event.detail > 0 ? pointerWasOpen : position !== null; const bounds = anchor!.getBoundingClientRect(); position = close ? null : side === "right" ? { x: bounds.right + 4, y: bounds.top } : { x: bounds.left, y: bounds.bottom + 4 }; }}>
<Icon icon={surface === "open" ? "puzzle" : "code"} />{#if !compact}<span>{label}</span>{/if}
</button>
{/if}
@@ -44,5 +45,6 @@
.access-button:hover, .access-button[aria-expanded="true"] { background: var(--rs-bg-active); }
.access-button:focus-visible { outline: 2px solid var(--rs-focus); outline-offset: -2px; }
.access-button.compact { position: relative; width: 28px; height: 28px; min-height: 28px; padding: 5px; }
.access-button.ribbon { justify-content: center; width: 32px; height: 32px; min-height: 32px; padding: 0; }
.error { position: fixed; top: 48px; right: 12px; z-index: 60; max-width: 420px; padding: 12px; background: var(--rs-bg); color: var(--rs-error); border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); }
</style>
+2
View File
@@ -32,6 +32,8 @@
<circle cx="5" cy="12" r="1" /><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" />
{:else if icon === "chevron-down"}
<path d="m6 9 6 6 6-6" />
{:else if icon === "chevrons-up-down"}
<path d="m7 15 5 5 5-5M7 9l5-5 5 5" />
{:else if icon === "maximize"}
<path d="M8 3H3v5M16 3h5v5M21 16v5h-5M8 21H3v-5" />
{:else if icon === "minimize"}
+1
View File
@@ -22,6 +22,7 @@
| "split"
| "more"
| "chevron-down"
| "chevrons-up-down"
| "up"
| "down"
| "maximize"
+24 -7
View File
@@ -1,4 +1,4 @@
// The title bar: the workspace button, the left ribbon, readable tabs with a list of all tabs, the drag area, caption buttons, Snap Layouts, and the macOS layout.
// The title bar and the side pane: the bottom bar with the workspace switcher, Help, and Settings, the ribbon fallback, readable tabs with a list of all tabs, the drag area, caption buttons, Snap Layouts, and the macOS layout.
import assert from "node:assert/strict";
import { mockTauri, openPage, outputDir, runSmoke, smokeUrl } from "../_harness/index.mjs";
@@ -26,22 +26,39 @@ await runSmoke("layout/titleBar", async ({ browser }) => {
const box = locator => locator.evaluate(node => { const rect = node.getBoundingClientRect(); return { x: rect.x, right: rect.right, width: rect.width, height: rect.height, bottom: rect.bottom }; });
await page.goto(smokeUrl);
// The workspace button is the first control of the header. It opens the workspace list below it.
// The bar at the bottom of the side pane holds the workspace switcher, Help, and Settings, as in Obsidian.
// The switcher opens the workspace list above it.
const workspace = page.getByRole("button", { name: "Field work", exact: true });
await workspace.waitFor();
// Auto-save stays off, so the edited tab keeps its unsaved mark.
await page.evaluate(() => window.__TEST__.writeSettings("general", { autosaveEnabled: false, autosaveSeconds: 5 }));
assert.equal(await page.locator("header.header button").first().evaluate(node => node.classList.contains("workspace-button")), true);
const footer = page.locator("aside.left .left-footer");
assert.equal(await footer.locator(".workspace-button").count(), 1);
assert.equal(await footer.getByRole("button", { name: "Help and about (F1)", exact: true }).count(), 1);
assert.equal(await footer.getByRole("button", { name: "Settings (Ctrl+,)", exact: true }).count(), 1);
assert.equal(await page.locator("header.header .workspace-button").count(), 0);
// The header right keeps only Save, the outline toggle, and the window controls. The other tools are in the left ribbon.
assert.deepEqual(await page.locator(".header-right").getByRole("button").evaluateAll(nodes => nodes.map(node => node.getAttribute("aria-label"))),
["Save", "Hide outline", "Minimize window", "Maximize window", "Close window"]);
const ribbon = page.locator(".plugin-ribbon");
assert.equal(await ribbon.getByRole("button", { name: "Settings (Ctrl+,)", exact: true }).count(), 0, "The ribbon has no second copy while the pane is open");
await workspace.click();
const picker = page.getByRole("dialog", { name: "Workspaces" });
await picker.waitFor();
assert.ok(await picker.evaluate((node, bottom) => node.getBoundingClientRect().top >= bottom, (await box(workspace)).bottom));
assert.ok(await picker.evaluate((node, top) => node.getBoundingClientRect().bottom <= top, (await workspace.boundingBox()).y));
await page.screenshot({ path: `${output}/bottom-bar.png` });
await page.keyboard.press("Escape");
// Help and Settings stay in the left ribbon when the side pane closes.
// While the side pane is closed, the workspace switcher, Help, and Settings move to the bottom of the ribbon.
await page.keyboard.press("Control+\\");
await page.locator("aside.left").waitFor({ state: "detached" });
const ribbon = page.locator(".plugin-ribbon");
const ribbonSwitcher = ribbon.getByRole("button", { name: "Open folder (Ctrl+O)", exact: true });
await ribbonSwitcher.click();
await picker.waitFor();
const switcherBox = await ribbonSwitcher.boundingBox(), pickerBox = await picker.boundingBox();
assert.ok(pickerBox.y + pickerBox.height <= switcherBox.y + 1 && pickerBox.x < 100, JSON.stringify({ switcherBox, pickerBox }));
await page.screenshot({ path: `${output}/ribbon-fallback.png` });
await page.keyboard.press("Escape");
await ribbon.getByRole("button", { name: "Help and about (F1)", exact: true }).click();
await page.getByRole("dialog", { name: "Help and about" }).waitFor();
await page.getByRole("button", { name: "Close help", exact: true }).click();
@@ -117,5 +134,5 @@ await runSmoke("layout/titleBar", async ({ browser }) => {
assert.match(await mac.getByRole("button", { name: "Settings (⌘,)", exact: true }).getAttribute("aria-label"), /⌘/);
await mac.locator("header.header").screenshot({ path: `${output}/header-mac.png` });
assert.deepEqual([...page.errors, ...mac.errors], []);
console.log("PASS: workspace button, permanent ribbon, readable tabs with fades and a list, fixed drag area, square caption buttons, Snap Layouts request, macOS layout, both themes, narrow window.");
console.log("PASS: bottom bar of the side pane, ribbon fallback, readable tabs with fades and a list, fixed drag area, square caption buttons, Snap Layouts request, macOS layout, both themes, narrow window.");
});
+4 -3
View File
@@ -133,11 +133,12 @@ await runSmoke('tree/renameUndo', async ({ browser }) => {
const registry = await import(performance.getEntriesByType('resource').find(entry => new URL(entry.name).pathname === '/src/lib/plugins/registry.ts').name);
registry.pluginHost.get('browser').newTab = async () => { window.__TEST__.browserOpened = true; };
});
await page.locator('.header-right').getByRole('button', { name: 'New browser tab', exact: true }).click();
// The app tools are in the left ribbon. Plugin view shortcuts stay out of it in this test (src/lib/layout/PluginRibbon.svelte).
await page.locator('.plugin-ribbon').getByRole('button', { name: 'New browser tab', exact: true }).click();
assert.equal(await page.evaluate(() => window.__TEST__.browserOpened), true);
assert.equal(await page.locator('.header-right').getByRole('button', { name: 'Project Management', exact: true }).count(), 0);
assert.equal(await page.locator('.plugin-ribbon .ribbon-tools').getByRole('button', { name: 'Project Management', exact: true }).count(), 0);
assert.equal(await page.locator('.header-left').getByRole('button', { name: 'Source control', exact: true }).count(), 1);
assert.equal(await page.locator('.header-right').getByRole('button', { name: 'Source control', exact: true }).count(), 0);
assert.equal(await page.locator('.plugin-ribbon .ribbon-tools').getByRole('button', { name: 'Source control', exact: true }).count(), 0);
await page.getByRole('button', { name: 'Plug-in views', exact: true }).click();
assert.equal(await page.getByRole('menuitem', { name: /Project Management/ }).count(), 1);
assert.equal(await page.getByRole('menuitem', { name: /New browser tab/ }).count(), 0);
@@ -53,8 +53,9 @@ await runSmoke("workspace/openAndCreate", async ({ page }) => {
const view = window.__EditorView.findFromDOM(document.querySelector(".source-editor .cm-content"));
view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: "My pending edit" } });
});
// The workspace button at the left of the header names the workspace (src/lib/layout/WorkbenchHeader.svelte).
const trigger = page.locator(".workspace-button");
// The workspace switcher sits in the bar at the bottom of the side pane (src/lib/layout/LeftPane.svelte).
// When the side pane gives way in a narrow window, the switcher is at the bottom of the left ribbon.
const trigger = page.locator(".workspace-button, .ribbon-workspace button").first();
const menu = page.getByRole("dialog", { name: "Workspaces", exact: true });
await page.evaluate(() => window.__TEST__.reorder());
await trigger.click();
@@ -118,7 +119,6 @@ await runSmoke("workspace/openAndCreate", async ({ page }) => {
if (theme === 'dark') {
await page.keyboard.press('Enter');
await menu.getByText('D:\\Missing', { exact: true }).waitFor({ state: 'detached' });
assert.equal(await page.locator('.ws').textContent(), 'Notes', 'History removal does not close the current workspace');
await page.keyboard.press('Escape');
await trigger.click();
assert.equal(await menu.getByText('D:\\Missing', { exact: true }).count(), 0, 'Removed paths stay absent after reopening');
@@ -126,6 +126,7 @@ await runSmoke("workspace/openAndCreate", async ({ page }) => {
await page.keyboard.press('Escape');
}
await page.setViewportSize({ width: 1100, height: 800 });
assert.equal(await page.locator('.ws').textContent(), 'Notes', 'History removal does not close the current workspace');
await page.evaluate(() => window.__TEST__.clear());
await trigger.click();
await menu.getByText("No recent workspaces yet.").waitFor();