AI media harness for planning, generating, and editing locally
TypeScript
Make Settings a full-screen page
Bittidb0deed19299
diff --git a/docs/generator-weights.md b/docs/generator-weights.mdindex 204c9d6..eacbf19 100644--- a/docs/generator-weights.md+++ b/docs/generator-weights.md@@ -1,5 +1,9 @@# Generator weights+Settings opens as a full-screen page with sections in the left sidebar. The+sidebar stays available while editing generators and LoRAs. **Back** or Escape+returns to the previous screen, preserving the open project's edits.+## LoRAsSettings → Generators includes a separate **LoRAs** library. **TaoMate 3-Step**diff --git a/src/App.test.tsx b/src/App.test.tsxindex 3be58b0..5fe234f 100644--- a/src/App.test.tsx+++ b/src/App.test.tsx@@ -159,6 +159,17 @@ describe("project library controls", () => {expect(await screen.findByRole("heading", { name: "What should we create today?" })).not.toBeNull();expect(screen.getByText("Ceramic lamp film")).not.toBeNull();expect(screen.queryByText("First scene")).toBeNull();+ const draft = screen.getByRole("textbox", { name: /Ask Slop about/ });+ fireEvent.change(draft, { target: { value: "Keep this unfinished idea" } });+ fireEvent.click(screen.getByRole("button", { name: "Settings" }));+ const settings = screen.getByRole("main", { name: "Settings" });+ expect(screen.queryByRole("textbox", { name: /Ask Slop about/ })).toBeNull();+ expect(screen.queryByRole("dialog", { name: "Settings" })).toBeNull();+ fireEvent.keyDown(settings, { key: "Escape" });+ expect(screen.queryByRole("main", { name: "Settings" })).toBeNull();+ expect(screen.getByRole("textbox", { name: /Ask Slop about/ })).toBe(draft);+ expect(draft).toHaveValue("Keep this unfinished idea");+ await waitFor(() => expect(screen.getByRole("button", { name: "Settings" })).toHaveFocus());});it("creates an empty project when the new-project form is left blank", async () => {diff --git a/src/App.tsx b/src/App.tsxindex 6e34772..cb86c98 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -56,8 +56,7 @@ function App() {const [newProjectOpen, setNewProjectOpen] = useState(false);const [projectToDelete, setProjectToDelete] = useState<ProjectRecord | null>(null);const [deletingProject, setDeletingProject] = useState(false);- /* Settings is an overlay rather than a view of its own so opening it from- inside a project cannot unmount the editor and throw away unsaved edits.+ /* Settings hides the workspace without unmounting the editor, preserving edits.Closing it bumps `settingsRevision`, which is what tells an open project tolook for the video engine again — the whole point of the screen is fixingthe engine paths, and the Generator would otherwise go on reporting the@@ -78,7 +77,12 @@ function App() {const updateNotice = ["available", "restart"].includes(updateState.stage) && !settingsOpen? <button className="secondary-button update-notice" onClick={() => { setSettingsInitialTab("updates"); setSettingsOpen(true); }}>{updateState.stage === "restart" ? "Restart to finish updating Slopus" : `Slopus ${updateState.version} is available`}</button> : null;const [settingsRevision, setSettingsRevision] = useState(0);- const closeSettings = () => { setSettingsOpen(false); setSettingsRevision((value) => value + 1); };+ const settingsButton = useRef<HTMLButtonElement>(null);+ const closeSettings = () => {+ setSettingsOpen(false);+ setSettingsRevision((value) => value + 1);+ requestAnimationFrame(() => settingsButton.current?.focus());+ };/* What is installed on this computer. Probed ONCE here rather than everytime a project opens: it launches two agent CLIs and loads the engine DLL,which is seconds of work, and the answer is the same for every project.@@ -147,7 +151,7 @@ function App() {}, []);useEffect(() => {- // Re-probed when the settings overlay closes, because that is where the+ // Re-probed when the settings page closes, because that is where the// engine paths get fixed.let live = true;setRuntime(null);@@ -163,6 +167,7 @@ function App() {useEffect(() => {const focusSearch = (event: KeyboardEvent) => {+ if (settingsOpen) return;if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "k") {event.preventDefault();searchInput.current?.focus();@@ -170,7 +175,7 @@ function App() {};window.addEventListener("keydown", focusSearch);return () => window.removeEventListener("keydown", focusSearch);- }, []);+ }, [settingsOpen]);const filteredProjects = useMemo(() => {const normalized = query.trim().toLowerCase();@@ -240,7 +245,7 @@ function App() {paths it holds are what makes generation work at all, and finding out theyare wrong happens inside a project, not in the library. */const settingsLauncher = (- <button className="settings-launcher" type="button" onClick={() => { setSettingsInitialTab("engine"); setSettingsOpen(true); }} title="Settings" aria-label="Settings">+ <button ref={settingsButton} className="settings-launcher" type="button" onClick={() => { setSettingsInitialTab("engine"); setSettingsOpen(true); }} title="Settings" aria-label="Settings"><Settings size={22} aria-hidden="true" /></button>);@@ -256,10 +261,12 @@ function App() {if (activeProject) {return <>+ <div hidden={settingsOpen}><ProjectWorkspace key={projectQueueKey(activeProject)} project={activeProject} initialView={activeProjectInitialView} runtime={runtime} workQueue={workQueue} onGeneratorRuntimeChange={(slopfab) => setRuntime((current) => ({ providers: current?.providers ?? CHECKING_PROVIDERS, slopfab }))} onBack={() => setActiveProject(null)} onSave={async () => { await workQueue.project(activeProject).save(); }} />{settingsLauncher}{queueLauncher}{queuePanel}+ </div>{settingsOpen && <SettingsView onClose={closeSettings} updates={updatePanel} initialTab={settingsInitialTab} />}{updateNotice}<UpdateProgress updater={updater} />@@ -271,6 +278,7 @@ function App() {return (<div className="app-shell">+ <div hidden={settingsOpen}><main className="library"><header className="library__topbar"><Brand />@@ -317,6 +325,7 @@ function App() {{queueLauncher}{queuePanel}{newProjectOpen && <PromptComposer busy={busy} onCreate={createFromPrompt} onClose={() => setNewProjectOpen(false)} />}+ </div>{settingsOpen && <SettingsView onClose={closeSettings} updates={updatePanel} initialTab={settingsInitialTab} />}{updateNotice}<UpdateProgress updater={updater} />diff --git a/src/components/SettingsView.test.tsx b/src/components/SettingsView.test.tsxindex 792abea..524ab6d 100644--- a/src/components/SettingsView.test.tsx+++ b/src/components/SettingsView.test.tsx@@ -2,7 +2,6 @@import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";import { invoke } from "@tauri-apps/api/core";-import { readFileSync } from "node:fs";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { SettingsView } from "./SettingsView";import { loadGeneratorTemplateSettings } from "../lib/settings";@@ -23,16 +22,15 @@ const open = () => render(<SettingsView onClose={() => undefined} />);const tab = (name: string) => screen.getByRole("tab", { name: new RegExp(`^${name}`) });const editDefaultGenerator = () => fireEvent.click(screen.getByRole("button", { name: "Edit Default generator" }));-/* jsdom does no layout, so the one thing that can be checked here is that the- rule which makes the two tabs the same height is still in the sheet: the- panels differ by hundreds of pixels, and a shrink-to-fit dialog moved the tab- row out from under the pointer that had just clicked it. */-describe("the frame the tabs sit in", () => {- it("gives the dialog a height of its own rather than letting the open tab set it", () => {- const css = readFileSync("src/styles/shell.css", "utf8");- const rule = css.slice(css.indexOf(".settings-view {"), css.indexOf(".settings-view__body"));- expect(rule).toMatch(/^\s*height: min\(/m);- expect(rule).not.toMatch(/^\s*max-height:/m);+describe("the settings page", () => {+ it("opens a focused page with vertical navigation and a Back action", () => {+ const onClose = vi.fn();+ render(<SettingsView onClose={onClose} />);+ expect(document.activeElement).toBe(screen.getByRole("main", { name: "Settings" }));+ expect(screen.queryByRole("dialog")).toBeNull();+ expect(screen.getByRole("tablist").getAttribute("aria-orientation")).toBe("vertical");+ fireEvent.click(screen.getByRole("button", { name: "Close settings" }));+ expect(onClose).toHaveBeenCalledOnce();});});@@ -188,10 +186,14 @@ describe("the settings screen", () => {// somewhere that says what it is.expect(screen.getByRole("tabpanel").getAttribute("aria-labelledby")).toBe("settings-tab-appearance");- fireEvent.keyDown(tab("Appearance"), { key: "ArrowRight" });+ fireEvent.keyDown(tab("Appearance"), { key: "ArrowDown" });expect(tab("Diagnostics").getAttribute("aria-selected")).toBe("true");- fireEvent.keyDown(tab("Diagnostics"), { key: "ArrowLeft" });+ fireEvent.keyDown(tab("Diagnostics"), { key: "ArrowUp" });expect(tab("Appearance").getAttribute("aria-selected")).toBe("true");+ fireEvent.keyDown(tab("Appearance"), { key: "Home" });+ expect(document.activeElement).toBe(tab("Generator"));+ fireEvent.keyDown(tab("Generator"), { key: "End" });+ expect(document.activeElement).toBe(tab("Updates"));});it("counts the paths still to set on the engine tab, from either tab", () => {@@ -234,16 +236,21 @@ describe("the settings screen", () => {expect(screen.queryByRole("button", { name: /Clear generator paths/ })).toBeNull();});- it("replaces the settings tabs with the Generators back button while editing", () => {+ it("keeps sidebar tabs available while editing and allows navigating out of the editor", () => {open();expect(screen.queryByText("Changes are saved as you type.")).toBeNull();editDefaultGenerator();const back = screen.getByRole("button", { name: "Generators" });- expect(screen.queryByRole("tab", { name: "Appearance" })).toBeNull();- expect(back.closest(".settings-tabs")).not.toBeNull();+ expect(screen.getByRole("tab", { name: "Appearance" })).toBeTruthy();+ expect(back.closest(".settings-view__body")).not.toBeNull();fireEvent.click(back);expect(screen.getByRole("tab", { name: "Appearance" })).toBeTruthy();+ editDefaultGenerator();+ fireEvent.click(tab("Appearance"));+ expect(screen.getByRole("radiogroup", { name: "Appearance" })).toBeTruthy();+ fireEvent.click(tab("Generator"));+ expect(screen.queryByLabelText("Generator name")).toBeNull();});it("creates a generator with 20 steps, edits it on its own page, and can make it the default", () => {diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsxindex f99c92c..67dfe85 100644--- a/src/components/SettingsView.tsx+++ b/src/components/SettingsView.tsx@@ -1,5 +1,5 @@import { AdditionalSafetensorsEditor } from "./AdditionalSafetensorsEditor";-import { AlertCircle, Check, ChevronLeft, Download, FolderOpen, FolderSearch, LoaderCircle, Monitor, Moon, Plus, RefreshCw, RotateCcw, Sun, Trash2, Video, X } from "lucide-react";+import { AlertCircle, Check, ChevronLeft, Download, FolderOpen, FolderSearch, LoaderCircle, Monitor, Moon, Plus, RefreshCw, RotateCcw, Sun, Trash2, Video } from "lucide-react";import { useCallback, useEffect, useRef, useState, useSyncExternalStore, type ReactNode } from "react";import { revealDiagnosticLog } from "../lib/diagnostics";import { isTauri } from "../lib/persistence";@@ -249,11 +249,7 @@ function DiagnosticsSetting({ desktop, status, onBackendChange }: { desktop: boo</>;}-/* Two things live on this screen and they have nothing to do with each other:- how the app looks, and where this computer keeps the model files. Stacked,- they made a screen taller than the window — five path fields is a long list —- so whichever one the user came for was below the fold half the time. One tab- each, and neither scrolls on an ordinary window. */+/* Sidebar navigation remains available inside generator and LoRA editors. */const TABS = [{ id: "engine", label: "Generator" },{ id: "llms", label: "Agents" },@@ -268,6 +264,9 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onClbefore anything can be rendered, and its status line answers "is Slopusready?" without a click. */const [tab, setTab] = useState<TabId>(initialTab);+ const page = useRef<HTMLElement>(null);+ const body = useRef<HTMLDivElement>(null);+ useEffect(() => { page.current?.focus(); }, []);const [templateSettings, setTemplateSettings] = useState<GeneratorTemplateSettings>(() => loadGeneratorTemplateSettings());const downloadState = useSyncExternalStore(subscribeWeightDownloads, getWeightDownloadState);const downloadPercent = downloadState ? weightDownloadProgress(downloadState) : 0;@@ -341,11 +340,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onClsetTemplateSettings(next);};- useEffect(() => {- const close = (event: KeyboardEvent) => { if (event.key === "Escape") onClose(); };- window.addEventListener("keydown", close);- return () => window.removeEventListener("keydown", close);- }, [onClose]);+ useEffect(() => { if (body.current) body.current.scrollTop = 0; }, [tab, editingTemplateId, editingLoraId]);const browse = async (field: EnginePathField) => {setError(null);@@ -420,22 +415,25 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl};const missing = generatorPathFields(selectedTemplate).filter((field) => field.required && pathState(field, settings[field.id], status) !== "found");+ const selectTab = (id: TabId) => {+ setTab(id);+ setEditingTemplateId(null);+ setEditingLoraId(null);+ };return (- <div className="settings-overlay" role="dialog" aria-modal="true" aria-labelledby="settings-heading">- <div className="settings-view">+ <main className="settings-view" ref={page} tabIndex={-1} aria-labelledby="settings-heading" onKeyDown={(event) => {+ // The mounted editor must not receive shortcuts while Settings has focus.+ event.stopPropagation();+ if (event.key === "Escape" && !event.defaultPrevented) onClose();+ }}><header className="settings-view__head">+ <button type="button" className="secondary-button" onClick={onClose} aria-label="Close settings"><ChevronLeft size={18} /> Back</button><h1 id="settings-heading">Settings</h1>- <button className="icon-button icon-button--strong" onClick={onClose} aria-label="Close settings"><X size={18} /></button></header>- {/* A tab is a button that says which panel it opens, so it is a real- tablist rather than two buttons that happen to swap the content:- the arrow keys move between them, and the panel below is named by- the tab that opened it. */}- {editingTemplateId || editingLoraId ? <div className="settings-tabs settings-tabs--editor">- <button type="button" className="generator-editor__back" onClick={() => { setEditingTemplateId(null); setEditingLoraId(null); }}><ChevronLeft size={16} /> Generators</button>- </div> : <div className="settings-tabs" role="tablist" aria-label="Settings sections">+ <aside className="settings-sidebar" aria-label="Settings navigation">+ <div className="settings-tabs" role="tablist" aria-label="Settings sections" aria-orientation="vertical">{TABS.map((item, index) => (<buttonkey={item.id}@@ -446,11 +444,13 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onClaria-controls={`settings-panel-${item.id}`}tabIndex={tab === item.id ? 0 : -1}className={tab === item.id ? "active" : ""}- onClick={() => setTab(item.id)}+ onClick={() => selectTab(item.id)}onKeyDown={(event) => {- if (event.key !== "ArrowRight" && event.key !== "ArrowLeft") return;- const next = TABS[(index + (event.key === "ArrowRight" ? 1 : TABS.length - 1)) % TABS.length];- setTab(next.id);+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;+ event.preventDefault();+ const next = TABS[event.key === "Home" ? 0 : event.key === "End" ? TABS.length - 1+ : (index + (event.key === "ArrowDown" ? 1 : TABS.length - 1)) % TABS.length];+ selectTab(next.id);document.getElementById(`settings-tab-${next.id}`)?.focus();}}>@@ -460,9 +460,12 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl{item.id === "engine" && missing.length > 0 && <em title={`${missing.length} model ${missing.length === 1 ? "path" : "paths"} still to set`}>{missing.length}</em>}</button>))}- </div>}+ </div>+ </aside>- <div className="settings-view__body">+ <div className="settings-view__content">+ <div className="settings-view__body" ref={body}>+ {tab === "engine" && (editingTemplateId || editingLoraId) && <button type="button" className="secondary-button generator-editor__back" onClick={() => { setEditingTemplateId(null); setEditingLoraId(null); }}><ChevronLeft size={16} /> Generators</button>}{tab === "updates" && <section className="settings-section" id="settings-panel-updates" role="tabpanel" aria-labelledby="settings-tab-updates">{updates ?? <p>Updates are available in the desktop app.</p>}</section>}@@ -496,8 +499,8 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl{tab === "engine" && <sectionclassName="settings-section"id="settings-panel-engine"- role={editingTemplateId || editingLoraId ? "region" : "tabpanel"}- aria-labelledby={editingLoraId ? "lora-editor-heading" : editingTemplateId ? "generator-editor-heading" : "settings-tab-engine"}+ role="tabpanel"+ aria-labelledby="settings-tab-engine">{!editingTemplateId && !editingLoraId && <ReferenceIconSetting />}{editingLoraId ? <LoraEditor key={editingLoraId} loraId={editingLoraId} onDone={() => setEditingLoraId(null)} /> : !editingTemplateId ? <>{generatorSections.filter((section) => section.id === "generators" || section.templates.length > 0).map((section) => <section key={section.id} className="generator-templates" aria-labelledby={`${section.id}-heading`}>@@ -643,7 +646,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl{error && <div className="toast" role="alert"><strong>Couldn’t update generator settings</strong><span>{error}</span><button onClick={() => setError(null)}>Dismiss</button></div>}</div>- </div>+ </main>);}diff --git a/src/styles/shell.css b/src/styles/shell.cssindex f8aa38e..c33db91 100644--- a/src/styles/shell.css+++ b/src/styles/shell.css@@ -92,83 +92,72 @@background: var(--glass-hover);}-/* --- Settings ---------------------------------------------------------------- An overlay rather than a route: opening it from inside a project must not- unmount the editor and throw away unsaved edits. */--.settings-overlay {+/* --- Settings page --------------------------------------------------------- */+.settings-view {position: fixed;z-index: 60;inset: 0;- overflow-y: auto;- display: grid;- align-content: center;- padding: var(--space-7) var(--space-5);- background: var(--scrim);- backdrop-filter: blur(10px);-}--/* The screen is a panel with a fixed frame, not a document: the title, the- tabs and the footer stay put and only the panel between them scrolls. The- whole thing used to be one long column inside a scrolling overlay, so the- close button and "changes are saved as you type" both left the screen as- soon as the engine paths did. dvh rather than vh because a mobile-style- toolbar must not push the footer under the edge; vh first for anything that- does not know the unit. */-.settings-view {- width: min(880px, 100%);- /* ONE height, whichever tab is open. The two panels are nothing like the same- length — five path fields against three theme cards — and a dialog that- halved in height when the tab changed pulled the tab row itself out from- under the pointer that had just clicked it. The viewport cap still wins on- a short window, and the body scrolls inside whatever height that leaves. */- height: min(860px, calc(100vh - var(--space-7) * 2));- height: min(860px, calc(100dvh - var(--space-7) * 2));- margin: 0 auto;+ height: 100vh;+ height: 100dvh;+ min-width: 0;display: grid;- grid-template-rows: auto auto minmax(0, 1fr) auto;- padding: var(--space-6);- border: 1px solid var(--line-strong);- border-radius: var(--radius-xl);+ grid-template-columns: clamp(160px, 19vw, 250px) minmax(0, 1fr);+ grid-template-rows: auto minmax(0, 1fr);+ overflow: hidden;background: var(--panel);- box-shadow: var(--shadow);}-/* The only part that scrolls, and on an ordinary window it does not have to:- one tab's worth of settings fits. */+.settings-view__content {+ min-width: 0;+ min-height: 0;+ display: flex;+ flex-direction: column;+ overflow: hidden;+}+.settings-view__body {+ flex: 1;+ min-height: 0;+ overflow: auto;+ overscroll-behavior: contain;+ padding: var(--space-6) clamp(16px, 3vw, 48px);+}++.settings-view__body > .generator-editor__back {+ margin-bottom: var(--space-4);+}++.settings-sidebar {min-height: 0;overflow-y: auto;- /* Room for the focus ring on the first and last controls, which a clipped- overflow would otherwise cut in half. */- padding: 2px;- margin: 0 -2px;+ padding: var(--space-4) var(--space-3);+ border-right: 1px solid var(--line);+ background: var(--wash-1);}.settings-view__head {+ grid-column: 1 / -1;display: flex;- align-items: flex-start;- justify-content: space-between;+ align-items: center;gap: var(--space-4);+ padding: var(--space-4) var(--space-5);+ border-bottom: 1px solid var(--line);}.settings-view__head h1 {- margin: var(--space-2) 0 0;+ margin: 0;font-size: var(--text-2xl);font-weight: var(--weight-semibold);line-height: var(--leading-tight);letter-spacing: var(--tracking-hero);}-/* --- Tabs -------------------------------------------------------------------- One row, each tab naming the panel below it. They carry the whole job the- section headings used to do, so those are gone with them. */+/* --- Sidebar tabs ---------------------------------------------------------- */.settings-tabs {display: flex;+ flex-direction: column;gap: var(--space-1);- margin: var(--space-5) 0 var(--space-4);- border-bottom: 1px solid var(--line);}.settings-tabs button {@@ -176,8 +165,11 @@display: flex;align-items: center;gap: var(--space-2);- padding: var(--space-2) var(--space-3) var(--space-3);+ min-height: var(--control-lg);+ padding: var(--space-3);border: 0;+ border-radius: var(--radius-sm);+ text-align: left;color: var(--text-muted);background: none;font-size: var(--text-base);@@ -188,27 +180,28 @@.settings-tabs button:hover {color: var(--text-secondary);+ background: var(--wash-1);}.settings-tabs button.active {color: var(--text-primary);+ background: var(--accent-soft);}-/* Drawn over the row's own line rather than beside it, so the selected tab- reads as attached to the panel underneath. */.settings-tabs button.active::after {content: "";position: absolute;- left: var(--space-2);- right: var(--space-2);- bottom: -1px;- height: 2px;+ left: 0;+ top: var(--space-2);+ bottom: var(--space-2);+ width: 2px;border-radius: 2px;background: var(--accent-bright);}/* How many paths still need setting, readable from the other tab. */.settings-tabs button em {+ margin-left: auto;min-width: 18px;padding: 0 var(--space-1);border-radius: var(--radius-xs);@@ -777,6 +770,11 @@.weight-source-add input { flex: 1; }.weight-download-status { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-3) 0; color: var(--text-secondary); font-size: var(--text-sm); }.weight-download-status span { flex: 1 1 100%; }+.settings-view__content > .weight-download-status {+ flex-shrink: 0;+ padding: var(--space-3) clamp(16px, 3vw, 48px);+ border-top: 1px solid var(--line);+}.settings-path__row .secondary-button {flex: 0 0 auto;@@ -805,8 +803,8 @@}.settings-view__foot {- margin-top: var(--space-6);- padding-top: var(--space-4);+ flex-shrink: 0;+ padding: var(--space-4) clamp(16px, 3vw, 48px);display: flex;align-items: center;justify-content: space-between;@@ -823,16 +821,14 @@/* --- Responsive ------------------------------------------------------------ */@media (max-width: 650px) {- .settings-overlay {- padding: var(--space-4) var(--space-3);- }-.settings-view {- height: min(860px, calc(100vh - var(--space-4) * 2));- height: min(860px, calc(100dvh - var(--space-4) * 2));- padding: var(--space-5) var(--space-4);+ grid-template-columns: 124px minmax(0, 1fr);}+ .settings-sidebar { padding: var(--space-3) var(--space-1); }+ .settings-tabs button { padding: var(--space-2); font-size: var(--text-sm); }+ .settings-view__body { padding: var(--space-4) var(--space-3); }+.settings-path {grid-template-columns: minmax(0, 1fr);gap: var(--space-2);