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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user