Keep global actions visible and follow each platform's title bar

Phase 5-4.

- 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. The left pane footer is gone.
- Tabs keep 120 pixels and scroll. Fades show tabs out of view, and a
  list button names all tabs, with pinned and unsaved marks. The
  active tab now scrolls into view with its close button.
- A drag area of 120 pixels follows the tabs. In a narrow header, the
  tabs shrink first, and the drag area keeps at least 48 pixels.
- Caption buttons are square, 46 pixels wide, and full height. When the
  pointer rests on maximize, the new window_snap_layouts command opens
  Snap Layouts with Win+Z for the focused window.
- macOS keeps its native traffic lights: tauri.macos.conf.json and the
  runtime window builders use an overlay title bar. Title bars leave
  --rs-titlebar-inset-start free for the traffic lights.
- 3 new catalog rows and 1 removed row, in French, Japanese, and
  Simplified Chinese.
- Docs: UI-050, the user guide, and ui-design.md.

Tests: the new layout/titleBar. Tests that used the left pane footer,
the rounded caption buttons, the 600-pixel theme editor pane, or a
ribbon of no width now follow the new layout.
This commit is contained in:
Knotty Wyvern
2026-10-28 20:21:20 -07:00
parent 9cf82503d0
commit c8cf56b224
31 changed files with 438 additions and 125 deletions
+2 -2
View File
@@ -110,9 +110,9 @@
<style>
.browser-window { height: 100vh; display: flex; flex-direction: column; background: var(--rs-bg); }
.header { display: flex; align-items: center; height: 36px; flex-shrink: 0; background: var(--rs-bg-elevated); border-bottom: 1px solid var(--rs-border); }
.header { display: flex; align-items: center; height: 36px; flex-shrink: 0; padding-left: var(--rs-titlebar-inset-start); background: var(--rs-bg-elevated); border-bottom: 1px solid var(--rs-border); }
.header :global(.tabs) { flex: 0 1 auto; min-width: 80px; height: 100%; border-bottom: 0; }
.window-drag-space { flex: 1; min-width: 40px; align-self: stretch; }
.window-drag-space { flex: 1; min-width: 120px; align-self: stretch; }
.pages { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.pane { position: absolute; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.pane.inactive { display: none; }
+3 -49
View File
@@ -1,7 +1,6 @@
<script lang="ts">
// The left pane: a plugin sidebar view, or the files, search, and bookmarks views, and the workspace footer.
// The left pane: a plugin sidebar view, or the files, search, and bookmarks views.
import { t } from "$lib/i18n";
import IconButton from "$lib/ui/IconButton.svelte";
import PluginEditor from "$lib/plugins/PluginEditor.svelte";
import BrowserSlot from "$lib/plugins/BrowserSlot.svelte";
import { pluginSidebar } from "$lib/plugins/external";
@@ -10,7 +9,6 @@
import FileTree from "./FileTree.svelte";
import SearchPane from "./SearchPane.svelte";
import BookmarksPane from "./BookmarksPane.svelte";
import { commandShortcut } from "./workbenchKeys";
type Props = {
workspace: WorkspaceInfo | null;
@@ -21,18 +19,14 @@
activePath: string | null;
searchRequest: { text: string; id: number } | null;
fileTree?: FileTree;
workspaceAnchor?: HTMLDivElement;
onOpenFile: (entry: TreeEntry, line?: number, target?: "current" | "new") => void;
onCreated: (entry: TreeEntry) => void;
onSaveTemplate: (entry: TreeEntry) => void;
onManageTemplates: () => void;
onStatus: (message: string) => void;
onChooseWorkspace: () => void;
onHelp: () => void;
onSettings: () => void;
};
let { workspace, session, leftView, keysActive, showInternal, activePath, searchRequest, fileTree = $bindable(), workspaceAnchor = $bindable(),
onOpenFile, onCreated, onSaveTemplate, onManageTemplates, onStatus, onChooseWorkspace, onHelp, onSettings }: Props = $props();
let { workspace, session, leftView, keysActive, showInternal, activePath, searchRequest, fileTree = $bindable(),
onOpenFile, onCreated, onSaveTemplate, onManageTemplates, onStatus }: Props = $props();
</script>
<aside class="left">
@@ -69,16 +63,6 @@
{/if}
</div>
</div>
<div class="left-footer">
<div class="footer-start" bind:this={workspaceAnchor}>
<IconButton icon="folder-open" label={$t("Open folder")} onclick={onChooseWorkspace} />
<span class="ws">{workspace ? workspace.name : $t("No workspace")}</span>
</div>
<div class="footer-actions">
<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>
</div>
</aside>
<style>
@@ -135,36 +119,6 @@
min-height: 0;
}
.left-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 4px 6px;
border-top: 1px solid var(--rs-border);
flex: 0 0 auto;
}
.footer-start {
flex: 1;
display: flex;
align-items: center;
gap: 2px;
min-width: 0;
}
.footer-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.footer-actions :global(.icon-btn) { width: 32px; height: 32px; flex-basis: 32px; }
.ws {
color: var(--rs-text-dim);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
flex: 1;
}
.placeholder {
margin: 12px;
color: var(--rs-text-dim);
+29 -15
View File
@@ -1,23 +1,34 @@
<script lang="ts">
// The left ribbon of plugin views. The shell gives it width only when a plugin uses it.
// The left ribbon. It stays visible when the side pane is closed: plugin views at the top, Help and Settings at the bottom.
import { t } from "$lib/i18n";
import IconButton from "$lib/ui/IconButton.svelte";
import { openPluginView, pluginEditorActive, pluginSidebar, pluginView } from "$lib/plugins/external";
import { commandShortcut } from "./workbenchKeys";
let { items }: { items: { owner: string; id: string; title: string; icon?: string }[] } = $props();
let { items, onHelp, onSettings }: {
items: { owner: string; id: string; title: string; icon?: string }[];
onHelp: () => void;
onSettings: () => void;
} = $props();
</script>
<nav class="plugin-ribbon" aria-label={$t("Plugin shortcuts")} hidden={items.length === 0}>
{#each items as item (`${item.owner}:${item.id}`)}
<IconButton
icon={item.icon === "list" || item.icon === "kanban" || item.icon === "globe" || item.icon === "git" ? item.icon : "puzzle"}
label={item.title}
side="right"
active={($pluginSidebar?.owner === item.owner && $pluginSidebar?.id === item.id) || $pluginView?.owner === item.owner && $pluginView?.id === item.id && !$pluginView?.document && ($pluginView?.placement === "dialog" || $pluginEditorActive)}
onclick={() => openPluginView(item.owner, item.id)}
/>
{/each}
</nav>
<div class="plugin-ribbon">
<nav aria-label={$t("Plugin shortcuts")} hidden={items.length === 0}>
{#each items as item (`${item.owner}:${item.id}`)}
<IconButton
icon={item.icon === "list" || item.icon === "kanban" || item.icon === "globe" || item.icon === "git" ? item.icon : "puzzle"}
label={item.title}
side="right"
active={($pluginSidebar?.owner === item.owner && $pluginSidebar?.id === item.id) || $pluginView?.owner === item.owner && $pluginView?.id === item.id && !$pluginView?.document && ($pluginView?.placement === "dialog" || $pluginEditorActive)}
onclick={() => openPluginView(item.owner, item.id)}
/>
{/each}
</nav>
<div class="ribbon-actions">
<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>
</div>
<style>
.plugin-ribbon {
@@ -26,14 +37,17 @@
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
gap: 4px;
min-height: 0;
padding: 6px 5px;
overflow-y: auto;
background: var(--rs-workarea-sidebar-bg);
border-right: 1px solid var(--rs-border);
}
.plugin-ribbon[hidden] { display: block; visibility: hidden; padding: 0; border: 0; }
nav, .ribbon-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 0; }
nav { overflow-y: auto; }
nav[hidden] { display: none; }
.ribbon-actions { margin-top: auto; flex-shrink: 0; }
.plugin-ribbon :global(.icon-btn) { width: 32px; height: 32px; flex-basis: 32px; }
</style>
+1 -1
View File
@@ -203,7 +203,7 @@
dialog.standalone { width: 100vw; height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
dialog.help { width: min(650px, calc(100vw - 32px)); }
header { height: var(--rs-titlebar-height); padding: 0 4px 0 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rs-border); background: var(--rs-bg-elevated); }
header.window-header { padding-right: 0; user-select: none; }
header.window-header { padding-right: 0; padding-left: calc(12px + var(--rs-titlebar-inset-start)); user-select: none; }
h1 { font-size: 13px; font-weight: 600; margin: 0; }
.body { display: flex; height: calc(100% - var(--rs-titlebar-height)); min-height: 0; }
aside { width: 220px; flex-shrink: 0; padding: 12px 8px; background: var(--rs-bg-elevated); border-right: 1px solid var(--rs-border); display: flex; flex-direction: column; overflow: auto; }
+63 -2
View File
@@ -149,9 +149,40 @@
$effect(() => {
const path = activePath;
if (path) void tick().then(() => tabButton(path)?.scrollIntoView({ block: "nearest", inline: "nearest" }));
// Scroll the whole tab into view, with its close button.
if (path) void tick().then(() => tabButton(path)?.closest(".tab")?.scrollIntoView({ block: "nearest", inline: "nearest" }));
});
// Fades at the ends of the tab strip show that more tabs are out of view.
let fadeStart = $state(false), fadeEnd = $state(false);
function measureOverflow() {
fadeStart = bar.scrollLeft > 1;
fadeEnd = bar.scrollLeft + bar.clientWidth < bar.scrollWidth - 1;
}
$effect(() => {
void tabs.length;
const observer = new ResizeObserver(measureOverflow);
observer.observe(bar);
measureOverflow();
return () => observer.disconnect();
});
// The list of all tabs: the current tab is checked, and the rows name pinned and unsaved tabs.
let allTabsButton = $state<HTMLButtonElement>();
function showAllTabs() {
if (menu && menuAnchor === allTabsButton) { closeMenu(true); return; }
cancelDrag();
closeMenu();
menuAnchor = allTabsButton;
const bounds = allTabsButton!.getBoundingClientRect();
menu = actionMenu(bounds.left, bounds.bottom + 2, tabs.map(tab => ({
label: tab.name, radio: true, checked: tab.relPath === activePath, icon: tab.pinned ? "pin" as const : undefined,
shortcut: tab.dirty ? $t("Unsaved") : undefined,
// As with a click on the tab, the workbench then focuses the document.
run: () => { closeMenu(); onSelect(tab.relPath); },
})), () => closeMenu(true), $t("All tabs"));
}
async function move(path: string, index: number) {
onMove(path, index);
await tick();
@@ -321,7 +352,7 @@
ondragleave={(event) => { if (!event.relatedTarget) clearTransferTarget(); }}
ondragend={clearTransferTarget} />
<div bind:this={bar} class="tabs" class:receiving role="tablist" aria-label={$t("Working tabs")} tabindex="-1"
<div bind:this={bar} class="tabs" class:receiving class:fade-start={fadeStart} class:fade-end={fadeEnd} onscroll={measureOverflow} role="tablist" aria-label={$t("Working tabs")} tabindex="-1"
ondragover={dragOver} ondrop={dropTab}
ondragleave={(event) => { if (!(event.relatedTarget instanceof Node) || !bar.contains(event.relatedTarget)) { receiving = false; dropBefore = dropAfter = null; } }}>
{#each tabs as tab (tab.id)}
@@ -370,6 +401,12 @@
</div>
{/each}
</div>
{#if tabs.length > 1}
<button bind:this={allTabsButton} type="button" class="all-tabs" aria-label={$t("All tabs")} aria-haspopup="menu" use:tabTooltip={$t("All tabs")}
onpointerdown={(event) => event.stopPropagation()} onclick={showAllTabs}>
<svg viewBox="0 0 24 24" aria-hidden="true">{@html actionIcons.chevron}</svg>
</button>
{/if}
<span class="sr-only" role="status">{announcement}</span>
<style>
@@ -381,12 +418,20 @@
box-shadow: inset 0 -1px var(--rs-border);
}
.tabs:empty { min-width: 80px; }
.tabs.fade-start, .tabs.fade-end {
--fade-start: 0px;
--fade-end: 0px;
mask-image: linear-gradient(to right, transparent, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent);
}
.tabs.fade-start { --fade-start: 24px; }
.tabs.fade-end { --fade-end: 24px; }
.tabs.receiving, .tabs.receiving .tab { box-shadow: inset 0 -2px var(--rs-accent); }
.tab {
position: relative;
display: flex;
align-items: center;
min-width: 120px;
max-width: 220px;
flex-shrink: 0;
border-radius: var(--rs-item-selection-radius) var(--rs-item-selection-radius) 0 0;
@@ -462,4 +507,20 @@
color: var(--rs-text-strong);
background: var(--rs-bg);
}
.all-tabs {
display: inline-flex;
flex: 0 0 28px;
align-items: center;
justify-content: center;
align-self: center;
height: 28px;
padding: 0;
border: 1px solid transparent;
border-radius: var(--rs-control-radius);
background: transparent;
color: var(--rs-text-dim);
}
.all-tabs:hover { background: var(--rs-bg-active); border-color: var(--rs-border); color: var(--rs-text-strong); }
.all-tabs svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform: rotate(90deg); }
</style>
+7 -8
View File
@@ -89,7 +89,7 @@
}
let settings = $state<AppSettings>({ ...DEFAULT_SETTINGS });
let settingsReady = $state(false);
let workspaceAnchor: HTMLDivElement | undefined = $state();
let workspaceAnchor: HTMLButtonElement | 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.
@@ -1093,7 +1093,7 @@
const shell = event.currentTarget as HTMLElement;
const rect = shell.getBoundingClientRect();
if (dragging === "left") {
leftWidth = Math.min(480, Math.max(160, event.clientX - rect.left - (ribbonNavigation.length ? 44 : 0)));
leftWidth = Math.min(480, Math.max(160, event.clientX - rect.left - 44));
}
if (dragging === "right") {
rightWidth = Math.min(480, Math.max(160, rect.right - event.clientX));
@@ -1209,7 +1209,7 @@
<div
class="shell"
class:detached={transferredWindow}
class:has-ribbon={!transferredWindow && ribbonNavigation.length > 0}
class:has-ribbon={!transferredWindow}
class:left-open={!transferredWindow && leftOpen}
class:right-open={!transferredWindow && rightOpen}
role="application"
@@ -1225,6 +1225,9 @@
<WorkbenchHeader
detached={transferredWindow}
{desktop}
workspaceName={workspace?.name ?? null}
bind:workspaceAnchor
onChooseWorkspace={chooseWorkspace}
{leftOpen}
{leftView}
{sidebarNavigation}
@@ -1244,12 +1247,11 @@
onError={(message) => error = message}
/>
{#if !transferredWindow}<PluginRibbon items={ribbonNavigation} />{/if}
{#if !transferredWindow}<PluginRibbon items={ribbonNavigation} onHelp={() => preferences = "help"} onSettings={() => void openSettings()} />{/if}
{#if leftOpen && !transferredWindow}
<LeftPane
bind:fileTree
bind:workspaceAnchor
{workspace}
{session}
{leftView}
@@ -1262,9 +1264,6 @@
onSaveTemplate={(entry) => { void saveTemplate(entry); }}
onManageTemplates={() => templateManager = true}
onStatus={(message) => { status = message; error = null; }}
onChooseWorkspace={chooseWorkspace}
onHelp={() => preferences = "help"}
onSettings={() => void openSettings()}
/>
<div
+51 -8
View File
@@ -1,8 +1,10 @@
<script lang="ts">
// The workbench header: the side pane buttons, the working tabs, the actions, and the window controls.
// The workbench header: the workspace button, the side pane buttons, the working tabs, the actions, and the window controls.
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";
@@ -14,6 +16,9 @@
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 }[];
@@ -32,13 +37,24 @@
onToggleRight: () => void;
onError: (message: string) => void;
};
let { detached, desktop, leftOpen, leftView, sidebarNavigation, onSelectLeft, tabBar, onNewTab, canOpenBrowser, browserOpening, onOpenBrowser,
let { detached, desktop, workspaceName, workspaceAnchor = $bindable(), onChooseWorkspace, 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")} />
@@ -55,7 +71,7 @@
<div class="header-center" data-tauri-drag-region>
<TabBar {...tabBar} />
<IconButton icon="plus" label={$t("New tab ({shortcut})", { shortcut: commandShortcut("new-tab") })} onclick={onNewTab} />
{#if desktop}<div class="window-drag-space" data-tauri-drag-region></div>{/if}
{#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 canOpenBrowser}<IconButton icon="globe" label={$t("New browser tab")} disabled={browserOpening} onclick={onOpenBrowser} />{/if}
@@ -91,8 +107,33 @@
min-width: 0;
padding: 0 4px;
}
/* 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;
display: flex;
align-items: center;
justify-content: flex-start;
@@ -105,15 +146,17 @@
.header-left, .header-center, .header-right { height: 100%; }
/* The left group spans the ribbon and the open left pane (the shell sets the widths). */
:global(.shell.left-open) .header-left { width: calc(var(--ribbon-width) + var(--left) + 1px); padding-left: calc(var(--ribbon-width) + 4px); }
:global(.shell.left-open) .header-left { width: calc(var(--ribbon-width) + var(--left) + 1px); }
.header-left :global(.icon-btn), .header-right :global(.icon-btn) { flex-shrink: 0; }
.header-right { justify-content: flex-end; }
.window-drag-space { flex: 0 0 40px; align-self: stretch; }
/* A drag area keeps the window movable when the tabs fill the header: 120 pixels, and at least 48 in a narrow header. */
.window-drag-space { flex: 0 1 120px; min-width: 48px; align-self: stretch; }
/* The tab strip keeps room for one readable tab. It shrinks first, so the drag area shrinks only after it. */
.header-center :global(.tabs) {
flex: 0 1 auto;
flex: 0 1000 auto;
align-self: stretch;
min-width: 0;
min-width: 120px;
min-height: 28px;
background: transparent;
border-bottom: 0;
@@ -121,7 +164,7 @@
.header-center :global(.tab) {
flex: 0 1 180px;
width: 180px;
min-width: 96px;
min-width: 120px;
max-width: 180px;
background: transparent;
}
+4 -1
View File
@@ -46,7 +46,10 @@
function position() {
const rect = anchor?.getBoundingClientRect();
menu.style.left = `${Math.max(8, Math.min(rect?.left ?? (innerWidth - menu.offsetWidth) / 2, innerWidth - menu.offsetWidth - 8))}px`;
menu.style.top = `${Math.max(8, (rect?.top ?? (innerHeight + menu.offsetHeight) / 2) - menu.offsetHeight - 8)}px`;
// The list opens below an anchor in the title bar, and above an anchor lower in the window.
const below = rect ? rect.bottom + 4 : (innerHeight - menu.offsetHeight) / 2;
const top = rect && rect.top > innerHeight / 2 ? rect.top - menu.offsetHeight - 8 : below;
menu.style.top = `${Math.max(8, Math.min(top, innerHeight - menu.offsetHeight - 8))}px`;
}
function close() { menu.hidePopover(); returnFocus?.focus(); }