From b2348d0fe82e8a80f2599c6a9051ad190fe2ee32 Mon Sep 17 00:00:00 2001 From: Knotty Wyvern Date: Wed, 28 Oct 2026 18:40:50 -0700 Subject: [PATCH] Split the workbench markup into region components Phase 5-1. Workbench.svelte keeps the state and the commands. Six components now draw its regions, each with its own styles: - WorkbenchHeader: the side pane buttons, the working tabs, the actions, and the window controls. - PluginRibbon: the ribbon of plugin views. - LeftPane: the plugin sidebar, files, search, bookmarks, and the workspace footer. - DocumentArea: the plugin editor panes, the document panes, and the save conflict banners. - RightPane: the outline and the backlinks. - StatusBar: the status line. Each component keeps the root element of its region, so the shell grid places them as before. Workbench.svelte has about 450 fewer lines. There is no visible change. pnpm check passes. pnpm test: 451 of 451 pass. Full smoke suite: 95 passed, 2 known. plugins/access failed one time and passed on retry and 3 of 3 times alone. --- docs/development.md | 2 +- src/lib/layout/DocumentArea.svelte | 161 ++++++++ src/lib/layout/LeftPane.svelte | 171 ++++++++ src/lib/layout/PluginRibbon.svelte | 39 ++ src/lib/layout/RightPane.svelte | 33 ++ src/lib/layout/StatusBar.svelte | 35 ++ src/lib/layout/Workbench.svelte | 559 +++++--------------------- src/lib/layout/WorkbenchHeader.svelte | 131 ++++++ 8 files changed, 677 insertions(+), 454 deletions(-) create mode 100644 src/lib/layout/DocumentArea.svelte create mode 100644 src/lib/layout/LeftPane.svelte create mode 100644 src/lib/layout/PluginRibbon.svelte create mode 100644 src/lib/layout/RightPane.svelte create mode 100644 src/lib/layout/StatusBar.svelte create mode 100644 src/lib/layout/WorkbenchHeader.svelte diff --git a/docs/development.md b/docs/development.md index bdbe3c8..7310c3d 100644 --- a/docs/development.md +++ b/docs/development.md @@ -80,7 +80,7 @@ A new command needs an entry in `generate_handler!` in `lib.rs`, in the command | Folder | Responsibility | | --- | --- | -| `layout/` | The app shell (`Workbench.svelte`), the file tree, tabs, panes, Settings, and dialogs | +| `layout/` | The app shell: `Workbench.svelte` holds the state and the commands, and `WorkbenchHeader`, `PluginRibbon`, `LeftPane`, `DocumentArea`, `RightPane`, and `StatusBar` draw its regions. Also the file tree, tabs, panes, Settings, and dialogs | | `editor/` | The document editor (`DocumentEditor.svelte`) with its Write and Source configurations, Markdown lists, tables, links, images, and editor menus | | `formulas/` | Table formulas: the parser and evaluator (`engine.ts`), the rendered results, the formula help, and the `tableFormulas` setting (`index.ts`) | | `workspace/` | Tauri wrappers, document buffers, the workspace session (`session.svelte.ts`: marks, renames, change events, and the note index), paths, templates, and tab transfer (`tabTransfer.ts`) | diff --git a/src/lib/layout/DocumentArea.svelte b/src/lib/layout/DocumentArea.svelte new file mode 100644 index 0000000..490d5c4 --- /dev/null +++ b/src/lib/layout/DocumentArea.svelte @@ -0,0 +1,161 @@ + + +
+
+ {#each $pluginEditors as pane (pane.key)} + {@const bounds = pluginBounds[pane.key]} + +
{ if ($pluginView?.key !== pane.key) selectPluginEditor(pane); }} + onpointerdown={() => { if ($pluginView?.key !== pane.key) selectPluginEditor(pane); }}> + {#if split && bounds} + tab.id === pane.key)} /> + {/if} + +
+ {/each} +
+
+
1}> + {#each documentViews as pane (pane.id)} + +
onFocusPane(pane.id)} + onfocusin={() => onFocusPane(pane.id)}> + {#if pane.buffer?.diskError} + + {:else if pane.buffer?.diskContents != null} + +
{$t("View disk version")}
{pane.buffer.diskContents}
+ {/if} + 1 ? () => onCloseSplit(pane.id) : undefined} + {hasWorkspace} + {onOpenWorkspace} + {onNewFile} + {onNewNote} + {onQuickOpen} + {onOpenBrowser} + {browserOpening} + buffer={pane.buffer} + chrome={pane.buffer?.chromeOverride ?? pane.buffer?.chrome ?? "Writing"} + reading={pane.reading} + focusLine={activePane === pane.id ? focusLine : null} + {onChange} + onInsertImage={file => onInsertImage(file, pane.buffer)} + {onRenameTitle} + tableActions={tableActions(pane)} + linkActions={linkActions(pane)} + onToggleReading={() => onToggleReading(pane)} + onToggleChrome={() => onToggleChrome(pane)} + onOpenLink={(kind, target) => onOpenLink(pane, kind, target)} + /> +
+ {/each} +
+
+
+ + diff --git a/src/lib/layout/LeftPane.svelte b/src/lib/layout/LeftPane.svelte new file mode 100644 index 0000000..2f693e0 --- /dev/null +++ b/src/lib/layout/LeftPane.svelte @@ -0,0 +1,171 @@ + + + + + diff --git a/src/lib/layout/PluginRibbon.svelte b/src/lib/layout/PluginRibbon.svelte new file mode 100644 index 0000000..fb4bec8 --- /dev/null +++ b/src/lib/layout/PluginRibbon.svelte @@ -0,0 +1,39 @@ + + + + + diff --git a/src/lib/layout/RightPane.svelte b/src/lib/layout/RightPane.svelte new file mode 100644 index 0000000..a935f6a --- /dev/null +++ b/src/lib/layout/RightPane.svelte @@ -0,0 +1,33 @@ + + + + + diff --git a/src/lib/layout/StatusBar.svelte b/src/lib/layout/StatusBar.svelte new file mode 100644 index 0000000..b0e5b10 --- /dev/null +++ b/src/lib/layout/StatusBar.svelte @@ -0,0 +1,35 @@ + + + + + diff --git a/src/lib/layout/Workbench.svelte b/src/lib/layout/Workbench.svelte index 1f32059..bc708f9 100644 --- a/src/lib/layout/Workbench.svelte +++ b/src/lib/layout/Workbench.svelte @@ -1,9 +1,7 @@ + +
+
+ {#if !detached} + onSelectLeft("files")} /> + onSelectLeft("search")} /> + onSelectLeft("bookmarks")} /> + {#each sidebarNavigation as item (`${item.owner}:${item.id}`)} + openPluginView(item.owner, item.id)} + /> + {/each} + {/if} +
+
+ + + {#if desktop}
{/if} +
+
+ {#if canOpenBrowser}{/if} + + + + + {#if terminalEnabled}{/if} + {#if !detached}{/if} + {#if desktop}{/if} +
+
+ +