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.
179 lines
5.7 KiB
Svelte
179 lines
5.7 KiB
Svelte
<script lang="ts">
|
|
// 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";
|
|
import type { WorkspaceSession } from "$lib/workspace/session.svelte";
|
|
import type { TreeEntry, WorkspaceInfo } from "$lib/workspace/types";
|
|
import FileTree from "./FileTree.svelte";
|
|
import SearchPane from "./SearchPane.svelte";
|
|
import BookmarksPane from "./BookmarksPane.svelte";
|
|
|
|
type Props = {
|
|
workspace: WorkspaceInfo | null;
|
|
session: WorkspaceSession;
|
|
leftView: "files" | "search" | "bookmarks";
|
|
keysActive: boolean;
|
|
showInternal: boolean;
|
|
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(), 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">
|
|
<div class="left-body">
|
|
{#if $pluginSidebar}
|
|
{#key $pluginSidebar.key}<PluginEditor view={$pluginSidebar} />{/key}
|
|
{/if}
|
|
<div class="native-left" class:sidebar-covered={!!$pluginSidebar}>
|
|
{#if !workspace}
|
|
{#if leftView === "bookmarks"}<BrowserSlot kind="bookmarks" />{:else}<p class="placeholder">{$t("No folder is open.")}</p>{/if}
|
|
{:else}
|
|
<div class="left-stack">
|
|
<div class="left-layer" class:shown={leftView === "files"}>
|
|
<FileTree
|
|
bind:this={fileTree}
|
|
workspaceRoot={workspace.root}
|
|
{showInternal}
|
|
{onSaveTemplate}
|
|
{onManageTemplates}
|
|
{activePath}
|
|
onOpenFile={(entry, newTab) => onOpenFile(entry, undefined, newTab ? "new" : "current")}
|
|
{session}
|
|
{keysActive}
|
|
{onCreated}
|
|
{onStatus}
|
|
/>
|
|
</div>
|
|
{#if leftView === "search"}
|
|
<SearchPane {searchRequest} onOpen={(entry, line) => onOpenFile(entry, line)} />
|
|
{:else if leftView === "bookmarks"}
|
|
<BookmarksPane {session} onOpen={(entry) => onOpenFile(entry)} />
|
|
{/if}
|
|
</div>
|
|
{/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>
|
|
.left {
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-width: 0;
|
|
min-height: 0;
|
|
overflow: hidden;
|
|
background: var(--rs-workarea-sidebar-bg);
|
|
}
|
|
|
|
.left-body {
|
|
flex: 1;
|
|
min-height: 0;
|
|
overflow: hidden;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.left-body > :global(*) {
|
|
flex: 1;
|
|
min-height: 0;
|
|
}
|
|
|
|
.native-left { display: flex; flex-direction: column; min-height: 0; }
|
|
.native-left.sidebar-covered { display: none; }
|
|
|
|
.left-stack {
|
|
flex: 1;
|
|
min-height: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.left-layer {
|
|
display: none;
|
|
flex: 1;
|
|
min-height: 0;
|
|
}
|
|
|
|
.left-layer.shown {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.left-layer.shown > :global(*) {
|
|
flex: 1;
|
|
min-height: 0;
|
|
}
|
|
|
|
.left-stack > :global(.pane) {
|
|
flex: 1;
|
|
min-height: 0;
|
|
}
|
|
|
|
.placeholder {
|
|
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>
|