Update editor, themes, menus, backgrounds, and release tooling

This commit is contained in:
Knotty Wyvern
2026-10-14 16:19:51 -07:00
parent f6eaa52949
commit edef2520af
113 changed files with 5722 additions and 386 deletions
+38 -28
View File
@@ -3,8 +3,8 @@
import type { GitLineInfo } from "$lib/git/contracts";
import EditorHost from "$lib/editor/EditorHost.svelte";
import LiveWriter from "$lib/editor/LiveWriter.svelte";
import { onDestroy, tick } from "svelte";
import { retainEditorSessions } from "$lib/editor/sessions";
import { tick } from "svelte";
import IconButton from "$lib/ui/IconButton.svelte";
import ImageViewer from "./ImageViewer.svelte";
import MarkdownView from "./MarkdownView.svelte";
import ModeSwitcher from "$lib/ui/ModeSwitcher.svelte";
@@ -13,6 +13,8 @@
import type { Chrome, OpenBuffer } from "$lib/workspace/types";
import type { TableContextActions } from "$lib/editor/tableCellActions";
import type { DocumentLinkActions } from "$lib/editor/linkMenu";
type Props = {
buffer: OpenBuffer | null;
tabs: OpenBuffer[];
@@ -33,9 +35,12 @@
browserOpening?: boolean;
hasWorkspace: boolean;
tableActions?: TableContextActions;
linkActions?: DocumentLinkActions;
active?: boolean;
onCloseSplit?: () => void;
};
let { buffer, tabs, chrome, reading, focusLine, onChange, onRenameTitle, onInsertImage, onToggleReading, onToggleChrome, onOpenLink, onOpenWorkspace, onNewFile, onNewNote, onQuickOpen, onOpenBrowser, browserOpening = false, hasWorkspace, tableActions }: Props = $props();
let { buffer, tabs, chrome, reading, focusLine, onChange, onRenameTitle, onInsertImage, onToggleReading, onToggleChrome, onOpenLink, onOpenWorkspace, onNewFile, onNewNote, onQuickOpen, onOpenBrowser, browserOpening = false, hasWorkspace, tableActions, linkActions, active = true, onCloseSplit }: Props = $props();
let selectedLine = $state(1);
let lineInfo = $state<GitLineInfo | null>(null);
const git = $derived.by(() => { void $pluginHost; return pluginHost.get("git"); });
@@ -60,7 +65,15 @@
let previewMode = $state<"split" | "preview">("split");
let modeControls = $state<HTMLDivElement>();
let titleFocusId = $state<string | null>(null);
const shouldFocusOnMount = () => !modeControls?.contains(document.activeElement);
let element: HTMLDivElement | undefined = $state();
let writerEditor: LiveWriter | undefined = $state();
let sourceEditor: EditorHost | undefined = $state();
const shouldFocusOnMount = () => active && !modeControls?.contains(document.activeElement);
export function focusEditor() {
if (reading) element?.querySelector<HTMLElement>(".reading")?.focus({ preventScroll: true });
else if (writerEditor) writerEditor.focus();
else sourceEditor?.focus();
}
export function focusTitle(id: string) {
titleFocusId = id;
}
@@ -70,10 +83,8 @@
const previewScroll = new Map<string, { top: number; left: number }>();
$effect(() => {
const ids = tabs.map(tab => tab.id);
retainEditorSessions(ids);
for (const id of previewScroll.keys()) if (!ids.includes(id)) previewScroll.delete(id);
});
onDestroy(() => retainEditorSessions([]));
function rememberPreviewScroll(node: HTMLDivElement, id: string) {
const saved = previewScroll.get(id);
@@ -117,21 +128,23 @@
{#if !buffer || buffer.kind === "empty"}
<div class="empty">
<h1>{buffer?.kind === "empty" ? "New tab" : "One project. Notes, code, terminal."}</h1>
<p>{hasWorkspace ? "Open a file to get started, or create a note or script." : "Open a folder to work with your own files."}</p>
{#if onCloseSplit}<IconButton icon="close" label="Close split" onclick={onCloseSplit} />{/if}
<div class="welcome-actions">
{#if onOpenBrowser}<button onclick={onOpenBrowser} disabled={browserOpening}><Icon icon="globe" /> {browserOpening ? "Opening browser…" : "Open browser"}</button>{/if}
<button onclick={onOpenWorkspace}><Icon icon="folder-open" /> Open folder <kbd>Ctrl O</kbd></button>
{#if hasWorkspace}
<button onclick={onNewFile}><Icon icon="file-plus" /> New file <kbd>Ctrl N</kbd></button>
{#if onNewNote}<button onclick={onNewNote}><Icon icon="pen" /> New note</button>{/if}
<button onclick={onQuickOpen}><Icon icon="search" /> Find a file <kbd>Ctrl P</kbd></button>
<div class="welcome-row">
<button onclick={onNewFile}><Icon icon="file-plus" /> New file <kbd>Ctrl N</kbd></button>
{#if onNewNote}<button onclick={onNewNote}><Icon icon="pen" /> New note</button>{/if}
<button onclick={onQuickOpen}><Icon icon="search" /> Find file <kbd>Ctrl P</kbd></button>
</div>
{/if}
<div class="welcome-row">
<button onclick={onOpenWorkspace}><Icon icon="folder-open" /> Open folder <kbd>Ctrl O</kbd></button>
{#if onOpenBrowser}<button onclick={onOpenBrowser} disabled={browserOpening}><Icon icon="globe" /> {browserOpening ? "Opening browser…" : "Open browser"}</button>{/if}
</div>
</div>
<p class="hint">Save · Ctrl S &nbsp; Terminal · Ctrl ` &nbsp; Find in file · Ctrl F</p>
</div>
{:else}
<div class="editor">
<div class="editor" class:pane-active={active} bind:this={element}>
<div class="chrome-bar">
<span class="breadcrumb" title={buffer.relPath}>{buffer.relPath}</span>
{#if lineInfo}
@@ -140,6 +153,7 @@
</span>
{/if}
<div class="actions" bind:this={modeControls}>
{#if onCloseSplit}<IconButton icon="close" label="Close split" onclick={onCloseSplit} />{/if}
{#if canPreview}
<ModeSwitcher
label="Document view"
@@ -171,17 +185,17 @@
<div class="editor-wrap" class:hidden={reading && canPreview && previewMode === "preview"}>
{#key buffer.id}
{#if !isIde && canPreview && !reading}
<LiveWriter {buffer} {onChange} {onRenameTitle} {onInsertImage} {onOpenLink} {focusLine} {tableActions} {shouldFocusOnMount} onSelectionLine={(line) => selectedLine = line}
<LiveWriter bind:this={writerEditor} {buffer} {onChange} {onRenameTitle} {onInsertImage} {onOpenLink} {linkActions} {focusLine} {tableActions} {shouldFocusOnMount} onSelectionLine={(line) => selectedLine = line}
focusTitle={titleFocusId === buffer.id} onTitleFocused={() => { titleFocusId = null; }} />
{:else}
<EditorHost {buffer} {chrome} {onChange} {onInsertImage} {onOpenLink} {focusLine} {tableActions} {shouldFocusOnMount} onSelectionLine={(line) => selectedLine = line} />
<EditorHost bind:this={sourceEditor} {buffer} {chrome} {onChange} {onInsertImage} {onOpenLink} {linkActions} {focusLine} {tableActions} {shouldFocusOnMount} onSelectionLine={(line) => selectedLine = line} />
{/if}
{/key}
</div>
{#if reading && canPreview}
{#key buffer.id}
<div class="md-page" use:rememberPreviewScroll={buffer.id}>
<MarkdownView noteRel={buffer.relPath} contents={buffer.contents} {onOpenLink} />
<MarkdownView noteRel={buffer.relPath} contents={buffer.contents} {onOpenLink} {linkActions} onSearch={tableActions?.onSearch} />
</div>
{/key}
{/if}
@@ -195,11 +209,12 @@
.line-history span { overflow: hidden; text-overflow: ellipsis; }
.line-history :global(svg) { width: 14px; height: 14px; flex-shrink: 0; }
.breadcrumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: auto; }
.welcome-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.welcome-actions button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); background: var(--rs-bg); padding: 10px 14px; }
.welcome-actions { display: flex; flex-direction: column; gap: 12px; max-width: 100%; }
.welcome-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; max-width: 100%; }
.welcome-actions button { flex-wrap: wrap; justify-content: center; max-width: 100%; }
.welcome-actions button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); background: var(--rs-image-control-bg); padding: 10px 14px; }
.welcome-actions button:hover { background: var(--rs-image-control-hover-bg); }
kbd { margin-left: 12px; color: var(--rs-text-dim); font-size: 11px; }
h1 { color: var(--rs-text-strong); font-size: 24px; font-weight: 500; }
.hint { margin-top: 32px; font-size: 12px; }
.hidden { display: none; }
.split .md-page { border-left: 1px solid var(--rs-border); }
.editor { container-type: inline-size; }
@@ -214,11 +229,6 @@
}
.empty {
background-color: var(--rs-new-tab-bg, var(--rs-bg));
background-image: var(--rs-background-image, var(--rs-new-tab-image, none));
background-size: 100% 100%, var(--rs-background-size, cover);
background-position: center, var(--rs-background-position, center);
background-repeat: no-repeat;
overflow: auto;
box-sizing: border-box;
align-items: center;
@@ -227,7 +237,6 @@
padding: 24px;
text-align: center;
}
.empty h1,.empty>p{background:color-mix(in srgb,var(--rs-bg) 92%,transparent);padding:8px 14px;border-radius:var(--rs-control-radius)}
.chrome-bar {
display: flex;
@@ -251,6 +260,7 @@
}
.body {
background: var(--rs-workarea-editor-bg);
flex: 1;
display: flex;
min-height: 0;