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:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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.) -->
|
||||
|
||||
@@ -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 canOpenBrowser}<IconButton icon="globe" label={$t("New browser tab")} disabled={browserOpening} onclick={onOpenBrowser} />{/if}
|
||||
<PluginAccessMenu surface="open" compact />
|
||||
{#if detached}
|
||||
{#if canOpenBrowser}<IconButton icon="globe" label={$t("New browser tab")} disabled={browserOpening} onclick={onOpenBrowser} />{/if}
|
||||
<PluginAccessMenu surface="open" compact />
|
||||
<PluginAccessMenu surface="commands" compact />
|
||||
{#if terminalEnabled}<IconButton icon="terminal" label={$t("Terminal")} active={terminalOpen} onclick={onToggleTerminal} />{/if}
|
||||
{/if}
|
||||
<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 !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;
|
||||
|
||||
Reference in New Issue
Block a user