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