AI media harness for planning, generating, and editing locally
TypeScript
Generator: board in the well, chrome command bar, item header and shot sections
Bitti0c7613c381a3
diff --git a/src/components/ReferenceNavigation.integration.test.tsx b/src/components/ReferenceNavigation.integration.test.tsxindex 5f28c69..7758799 100644--- a/src/components/ReferenceNavigation.integration.test.tsx+++ b/src/components/ReferenceNavigation.integration.test.tsx@@ -21,6 +21,6 @@ it("shows only titles in Used by and opens the selected generation", () => {expect(within(usage).queryByRole("button", { name: "First scene" })).not.toBeInTheDocument();fireEvent.click(row);expect(screen.queryByRole("textbox", { name: "Reference name" })).not.toBeInTheDocument();- expect(container.querySelector<HTMLInputElement>(".job-title__name")?.value).toBe("The forest encounter");+ expect(screen.getByRole<HTMLInputElement>("textbox", { name: "Rename The forest encounter" }).value).toBe("The forest encounter");expect(screen.getByRole("region", { name: "This scene" })).toBeInTheDocument();});diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsxindex 81de31d..21a7140 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -734,7 +734,7 @@ describe("Generator scene controls", () => {const state = setup();fireEvent.click(screen.getByRole("button", { name: "Shot 2 of First scene" }));fireEvent.change(screen.getByRole("textbox", { name: "Rename shot 2" }), { target: { value: "Doorway reveal" } });- const shotHeader = screen.getByRole("textbox", { name: "Rename shot 2" }).closest("header");+ const shotHeader = screen.getByRole("textbox", { name: "Rename shot 2" }).closest(".ui-item-header");const removeButton = within(shotHeader!).getByRole("button", { name: "Delete shot 2" });expect(removeButton).toHaveClass("icon-button");expect(removeButton).toHaveTextContent("");diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsxindex ca9990e..29b073d 100644--- a/src/components/workspace/GeneratorView.tsx+++ b/src/components/workspace/GeneratorView.tsx@@ -3,19 +3,19 @@ import { loadLoras, subscribeLoras } from "../../lib/loras";import { refreshDownloadedLoras } from "../../lib/weightDownloads";import { characterReplaceBlocker, poseBlocker, isVideoTransition, videoTransitionBlocker, usableVideoReferences, type SceneType } from "../../lib/project";import { referenceRefmodInputs } from "../../lib/project";-import { LayoutGrid, List, Plus, Square, Trash2, WandSparkles } from "lucide-react";+import { Clapperboard, LayoutGrid, List, Plus, Sparkles, Square, Trash2, WandSparkles } from "lucide-react";import { invoke } from "@tauri-apps/api/core";import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";import { useShortcut } from "../../lib/commands";import { askNative } from "../../lib/nativeShell";-import { CommandBar, CommandBarButton, CommandBarSeparator, ComboBox, Splitter, StatusBar, tooltipProps, usePaneSize } from "../ui";+import { CommandBar, CommandBarButton, CommandBarSeparator, ComboBox, EmptyState, ItemHeader, Splitter, StatusBar, tooltipProps, usePaneSize } from "../ui";import { actionReferenceIds, compileGenerationJobPrompt, compileGenerationJobSegments, createDraftGenerationJob, danglingReferenceTokens, GENERATION_FRAME_RATE, RANDOM_GENERATION_SEED, sceneDurationSeconds, sceneFrameInputs, sceneGenerationReferences, sceneGenerationSeed, sceneGenerationSnapshot, sceneGenerationSteps, sceneShots, SCENE_MAX_SECONDS, SCENE_MIN_SECONDS, projectItemPath, usableReferenceImages, type GenerationJob, type ProjectConfig, type ProjectReference, type SceneShot } from "../../lib/project";import { generationDimensions } from "../../lib/export";import { isTauri } from "../../lib/persistence";import { getEngineStatus, type SlopfabGenerationRequest, type SlopfabStatus } from "../../lib/runtime";import { SceneBoard, type BoardDensity, type GeneratorSelection } from "./SceneBoard";import { SceneInspector, ShotInspector, STEP_SECONDS, writeShots } from "./SceneEditor";-import { statusIcon } from "./sceneStatus";+import { STATUS_BADGE, type SceneIndicatorStatus } from "./sceneStatus";import { forgetShotPosters } from "./ShotThumbnail";import { purgeTimelineThumbnails } from "../../lib/timelineThumbnails";import { defaultGeneratorTemplate, loadDebugOptionsEnabled, loadGeneratorTemplateSettings, saveGeneratorTemplateSettings, subscribeDebugOptions, subscribeGeneratorTemplates, templateNeedsDownload, type GeneratorTemplate } from "../../lib/settings";@@ -77,7 +77,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCosetDensity(next);try { localStorage.setItem(DENSITY_KEY, next); } catch { /* storage unavailable */ }};- const inspectorPane = usePaneSize("generator.inspector", 380, { min: 280, max: 640 });+ const inspectorPane = usePaneSize("generator.inspector", 340, { min: 280, max: 560 });const root = useRef<HTMLDivElement>(null);const titleInput = useRef<HTMLInputElement>(null);const [showDebugPrompt, setShowDebugPrompt] = useState(false);@@ -138,6 +138,9 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoconst selectedShots = useMemo(() => (selected ? sceneShots(selected) : []), [selected]);const shotIndex = selectedShots.findIndex((shot) => shot.id === selection.shotId);const openShot = !animate && shotIndex >= 0 ? selectedShots[shotIndex] : null;+ const shotEndsAt = selected && openShot+ ? shotIndex + 1 < selectedShots.length ? selectedShots[shotIndex + 1].startSeconds : sceneDurationSeconds(selected)+ : 0;const active = jobs.filter((job) => job.status === "generating" || job.status === "ready");const queued = jobs.filter((job) => job.status === "queued");@@ -561,7 +564,12 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoonRemoveScene={(job) => void confirmRemoveScene(job)}onRemoveShot={(job, shotId) => void confirmRemoveShot(job, shotId)}/>- : <p className="generator-board__empty">No scenes yet.</p>}+ : <EmptyState+ icon={<Clapperboard />}+ title="No scenes yet"+ description="Add a scene, then write what happens in each of its shots."+ action={<button type="button" className="secondary-button" onClick={newScene}>Add a scene</button>}+ />}</div><StatusBar@@ -580,31 +588,36 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo{selected && <aside id="generator-inspector" className="generator-panel" aria-label={openShot ? `${openShot.name ?? `Shot ${shotIndex + 1}`} of ${selected.title}` : `Scene: ${selected.title}`}>{openShot? <>- <header className="panel-head">- {/* The way back up: the scene this shot belongs to, which is the- same thing its header on the board opens. */}- <button type="button" className="panel-head__up" data-tooltip={`Back to ${selected.title}`} onClick={() => setSelection({ jobId: selected.id, shotId: null })}>- {selected.title}- </button>- <span className="panel-head__sep" aria-hidden="true">›</span>- <h2 className="panel-head__title"><input+ {/* The open shot heads the pane. Its meta line leads back up to the+ scene it belongs to, which is the same thing its header on the+ board opens. */}+ <ItemHeader+ color="var(--clip-generated)"+ icon={<Clapperboard size={16} />}+ name={<inputref={titleInput}- className="panel-title__name shot-title__name"+ className="ui-item-header__input"value={openShot.name ?? ""}placeholder={`Shot ${shotIndex + 1}`}aria-label={`Rename shot ${shotIndex + 1}`}aria-keyshortcuts="F2"onChange={(event) => patchShot(selected, openShot.id, { name: event.target.value || null })}- /></h2>- {selectedShots.length > 1 && <button+ />}+ meta={<>+ {`Shot ${shotIndex + 1} · ${seconds(shotEndsAt - openShot.startSeconds)} · in `}+ <button type="button" className="generator-panel__up" data-tooltip={`Back to ${selected.title}`} onClick={() => setSelection({ jobId: selected.id, shotId: null })}>+ {selected.title}+ </button>+ </>}+ actions={selectedShots.length > 1 && <buttontype="button"- className="icon-button panel-head__delete"+ className="icon-button"aria-label={`Delete shot ${shotIndex + 1}`}aria-keyshortcuts="Delete"{...tooltipProps("Delete shot", "Delete")}onClick={() => void confirmRemoveShot(selected, openShot.id)}><Trash2 size={16} aria-hidden="true" /></button>}- </header>+ /><div className="panel-scroll"><ShotInspectorkey={openShot.id}@@ -612,7 +625,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoshots={selectedShots}shot={openShot}index={shotIndex}- endsAt={shotIndex + 1 < selectedShots.length ? selectedShots[shotIndex + 1].startSeconds : sceneDurationSeconds(selected)}+ endsAt={shotEndsAt}duration={sceneDurationSeconds(selected)}references={isVideoTransition(selected) ? sceneGenerationReferences(selected, config.references) : config.references}disabled={false}@@ -621,28 +634,30 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo</div></>: <>- <header className="panel-head">- {selected.status !== "draft" && selectedIndicator && <span className={`status-icon status-icon--${selectedIndicator}`}>{statusIcon(selectedIndicator)}</span>}- {/* The title is the one part of a scene Slopus writes for the- user, so it has to be theirs to change. Blanking it falls back- rather than saving a nameless scene the schema would reject. */}- <h2 className="panel-head__title"><input+ {/* The title is the one part of a scene Slopus writes for the user,+ so it has to be theirs to change. Blanking it falls back rather+ than saving a nameless scene the schema would reject. */}+ <ItemHeader+ color="var(--clip-generated)"+ icon={<Sparkles size={16} />}+ name={<inputref={titleInput}- className="panel-title__name job-title__name"+ className="ui-item-header__input"value={selected.title}aria-label={`Rename ${selected.title}`}aria-keyshortcuts="F2"onChange={(event) => updateJob(selected.id, { title: event.target.value || "Untitled scene", updatedAt: new Date().toISOString() })}- /></h2>- <button+ />}+ meta={sceneMeta(selected, selectedShots.length, selectedIndicator)}+ actions={<buttontype="button"- className="icon-button panel-head__delete"+ className="icon-button"aria-label={`Delete scene ${selected.title}`}aria-keyshortcuts="Delete"{...tooltipProps("Delete scene", "Delete")}onClick={() => void confirmRemoveScene(selected)}- ><Trash2 size={16} aria-hidden="true" /></button>- </header>+ ><Trash2 size={16} aria-hidden="true" /></button>}+ /><div className="panel-scroll"><SceneInspector@@ -729,6 +744,16 @@ export function templateSceneBlocker(type: SceneType, template: GeneratorTemplatreturn null;}+const seconds = (value: number): string => `${value.toFixed(1)} s`;++/** The scene header's meta line: "Scene · 2 shots · 6.0 s · Finished". A+ * draft says nothing about its state, the same as its line on the board. */+const sceneMeta = (job: GenerationJob, shots: number, indicator: SceneIndicatorStatus | undefined) => {+ const parts = ["Scene", shots === 1 ? "1 shot" : `${shots} shots`, seconds(sceneDurationSeconds(job))];+ if (job.status !== "draft" && indicator) parts.push(STATUS_BADGE[indicator]);+ return parts.join(" · ");+};+/** The status bar's one line: "3 scenes · 1 rendering · 2 waiting". */const boardSummary = (active: number, waiting: number, total: number) => {if (total === 0) return "No scenes";diff --git a/src/components/workspace/SceneEditor.tsx b/src/components/workspace/SceneEditor.tsxindex 0d5c1a1..3a9e628 100644--- a/src/components/workspace/SceneEditor.tsx+++ b/src/components/workspace/SceneEditor.tsx@@ -1,5 +1,5 @@import { ImagePlus, X } from "lucide-react";-import { useId, useMemo, useRef, useState } from "react";+import { useId, useMemo, useRef, useState, type ReactNode } from "react";import { ComboBox, InfoBar, PropRow, PropSection } from "../ui";import {actionReferenceIds,@@ -167,7 +167,16 @@ export function ShotInspector({ job, shots, shot, index, endsAt, duration, referonChange({ action: store(`${before}${lead}${token}${trail}${after}`) });};- return <section className="shot-inspector" aria-label={`Shot ${shotNumber}`}>+ /* Open on its own, a shot is three sections: the shot itself, the+ references its line can cite, and its settings. Inside the Pose scene's+ section (promptOnly) it is just the fields, with no headers of its own. */+ const group = (title: string, key: string, summary: ReactNode, children: ReactNode) => promptOnly+ ? children+ : <PropSection title={title} persistKey={`generator.shot.${key}`} summary={summary}>{children}</PropSection>;+ const chosenSettings = selectedShotTagOptions(settings).length;++ return <section className={`shot-inspector${promptOnly ? " shot-inspector--flat" : ""}`} aria-label={`Shot ${shotNumber}`}>+ {group("Shot", "shot", `${seconds(shot.startSeconds)} – ${seconds(endsAt)}`, <>{!promptOnly && <PropRow label="Starts at" htmlFor={`shot-start-${shot.id}`}><inputid={`shot-start-${shot.id}`}@@ -247,23 +256,25 @@ export function ShotInspector({ job, shots, shot, index, endsAt, duration, refer/></PropRow></div>}+ </>}+ </>)}- <ReferencePalette+ {job.sceneType !== "character-replace" && group("References", "references", citable.length || undefined, <ReferencePalette+ labelled={promptOnly}citable={citable}numbered={numbered}dangling={dangling}referenceById={referenceById}disabled={disabled}onInsert={insertAtCaret}- />+ />)}- {!promptOnly && <ShotSettings+ {job.sceneType !== "character-replace" && !promptOnly && group("Settings", "settings", chosenSettings || undefined, <ShotSettingssettings={settings}disabled={disabled}shotNumber={shotNumber}onChange={(next) => onChange({ settings: normalizeShotTagSelection(next) })}- />}- </>}+ />)}</section>;}@@ -358,7 +369,7 @@ export function SceneInspector({ job, shots, references, previousScene, defaultSreturn <section className="scene-inspector" aria-label="This scene"><div role="region" aria-label="Scene" className="scene-settings">- <PropSection title="Scene" persistKey="generator.scene">+ <PropSection title="Scene" persistKey="generator.scene" summary={SCENE_TYPES.find((type) => type.value === sceneType)?.label}><PropRow label="Scene type" htmlFor={`${id}-type`}><ComboBox id={`${id}-type`} aria-label="Scene type" value={sceneType} disabled={disabled} options={SCENE_TYPES}onChange={(value) => onChange({ sceneType: value as SceneType, usePreviousSceneLastFrame: undefined,@@ -485,7 +496,7 @@ export function SceneInspector({ job, shots, references, previousScene, defaultS</PropSection></div><div role="region" aria-label="Generation" className="scene-settings">- <PropSection title="Generation" persistKey="generator.generation">+ <PropSection title="Generation" persistKey="generator.generation" summary={`${sceneGenerationSteps(job, defaultSteps)} steps`}>{animate && <p className="prop-caption">Animate output is limited to 14.375 seconds; longer scenes are shortened to fit.</p>}<PropRow label="Steps" htmlFor={`${id}-steps`}><CommittedNumberInput@@ -586,7 +597,6 @@ function ShotSettings({ settings, disabled, shotNumber, onChange }: {const group = pending ? shotTagGroup(pending) : undefined;return <div className="shot-settings">- <span className="shot-card__sublabel">Settings</span><ul className="shot-settings__chips">{chosen.map(({ group: owner, option }) => <li key={`${owner.id}-${option.id}`}><span className="setting-tag" data-tooltip={`Adds “${option.term}” to the prompt`}>@@ -636,7 +646,9 @@ function ShotSettings({ settings, disabled, shotNumber, onChange }: {/* --- The references this scene can use ------------------------------------ */-function ReferencePalette({ citable, numbered, dangling, referenceById, disabled, onInsert }: {+function ReferencePalette({ labelled, citable, numbered, dangling, referenceById, disabled, onInsert }: {+ /** Name the palette itself, where no section header does it. */+ labelled: boolean;citable: ProjectReference[];numbered: ProjectReference[];dangling: string[];@@ -645,7 +657,7 @@ function ReferencePalette({ citable, numbered, dangling, referenceById, disabledonInsert: (referenceId: string) => void;}) {return <div className="reference-palette">- <span className="shot-card__sublabel">References</span>+ {labelled && <span className="shot-card__sublabel">References</span>}{citable.length === 0 && <span className="reference-palette__lead">None yet — add one under References.</span>}<ul>{citable.map((reference) => {diff --git a/src/styles/generator.css b/src/styles/generator.cssindex ab5b1bc..cf805e6 100644--- a/src/styles/generator.css+++ b/src/styles/generator.css@@ -13,14 +13,14 @@breakpoints any more: a narrow window narrows the board, and the splitteris how the inspector gets out of the way. */.generator-view {- --pane-generator-inspector: 380px; /* usePaneSize sets the real width inline */+ --pane-generator-inspector: var(--pane-side-default); /* usePaneSize sets the real width inline */height: 100%;min-height: 0;display: grid;/* Floors on both sides: with the agent pane open in a 900px window the viewis ~540px wide, and a fixed inspector squeezed the scene list to nothing. */- grid-template-columns: minmax(280px, 1fr) auto minmax(260px, var(--pane-generator-inspector));- background: var(--layer);+ grid-template-columns: minmax(280px, 1fr) auto minmax(280px, var(--pane-generator-inspector));+ background: var(--surface-pane);}/* Nothing to inspect until there is a scene, so the board takes the width. */@@ -38,10 +38,13 @@flex-direction: column;}+/* The command bar is chrome: a 36px strip with the divider where it meets+ the board's well. */.generator-command {flex: 0 0 auto;- min-height: var(--space-7);- border-bottom: 1px solid var(--line);+ min-height: var(--chrome-row);+ border-bottom: 1px solid var(--stroke-divider);+ background: var(--surface-chrome);}/* "Generate all" is the screen's one accent button, as in the mock: an accent@@ -64,17 +67,15 @@color: var(--danger);}+/* The board is where the shots are laid out, so it sits in the well; the+ scene headers across it are chrome, edge to edge. */.generator-board {flex: 1 1 auto;min-height: 0;+ display: flex;+ flex-direction: column;overflow-y: auto;- padding: var(--space-2) var(--space-3);-}--.generator-board__empty {- margin: var(--space-2) 0;- color: var(--text-muted);- font-size: var(--text-sm);+ background: var(--surface-well);}.generator-status {@@ -632,131 +633,38 @@min-height: 0;display: flex;flex-direction: column;- background: var(--panel);-}--/* A 40px pane header: the (editable) name at 14px semibold, a delete button- at the trailing edge; a shot's header leads with its scene as the way back- up. */-.panel-head {- flex: 0 0 auto;- min-width: 0;- min-height: var(--space-7);- display: flex;- align-items: center;- gap: var(--space-1);- padding: 0 var(--space-1) 0 var(--space-2);- border-bottom: 1px solid var(--line);-}--.panel-head__title {- flex: 1 1 auto;- min-width: 0;- margin: 0;- font-size: var(--text-base);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);-}--/* Reads as the heading it sits in until it is hovered or focused; focus is- the TextBox underline. */-.panel-title__name {- width: 100%;- min-width: 0;- height: var(--control-md);- padding: 0 var(--space-2);- border: 1px solid transparent;- border-radius: var(--radius-sm);- color: var(--text-primary);- background: none;- font: inherit;- text-overflow: ellipsis;-}--.panel-title__name:hover:not(:focus) {- background: var(--fill-subtle-hover);+ background: var(--surface-pane);}-.panel-title__name:focus {- border-color: var(--stroke-control);- border-bottom-color: var(--field-focus-line);- outline: none;- background: var(--fill-input-focus);- box-shadow: inset 0 -1px 0 var(--field-focus-line);-}--.panel-title__name::placeholder {- color: var(--text-primary);- opacity: 1;-}--.panel-head__up {- flex: 0 1 auto;+/* The open item heads the pane (ItemHeader). A shot's meta line ends with+ its scene as a quiet link back up. */+.generator-panel__up {min-width: 0;- max-width: 45%;- height: var(--control-sm);- padding: 0 var(--space-1);- overflow: hidden;+ padding: 0;border: 0;border-radius: var(--radius-sm);color: var(--text-secondary);background: none;- font-size: var(--text-base);- text-align: left;- text-overflow: ellipsis;- white-space: nowrap;+ font: inherit;+ text-decoration: underline;+ text-decoration-color: var(--line);+ text-underline-offset: 2px;}-.panel-head__up:hover {+.generator-panel__up:hover {color: var(--text-primary);- background: var(--fill-subtle-hover);-}--.panel-head__sep {- flex: 0 0 auto;- color: var(--text-muted);-}--.panel-head__delete {- flex: 0 0 auto;-}--.status-icon {- width: var(--control-sm);- height: var(--control-sm);- flex: 0 0 auto;- display: grid;- place-items: center;- color: var(--accent-bright);-}--.status-icon--generating svg,-.status-icon--ready svg {- animation: spin 1.4s linear infinite;-}--.status-icon--completed { color: var(--success); }-.status-icon--changed { color: var(--warning); }--.status-icon--failed,-.status-icon--cancelled {- color: var(--danger);-}--.status-icon--draft {- color: var(--text-muted);+ text-decoration-color: currentColor;}/* The pane's scrolling middle. It takes what the head and the debug row- leave, and scrolls inside it. */+ leave, and scrolls inside it. Its sections run edge to edge, the first one+ straight under the item header. */.panel-scroll {flex: 1 1 auto;min-width: 0;min-height: 0;display: flex;flex-direction: column;- gap: var(--space-3);- padding: var(--space-2) var(--space-3) var(--space-3);overflow-y: auto;}@@ -764,14 +672,33 @@.scene-inspector {display: flex;flex-direction: column;+}++/* A shot's prompt inside the Pose scene's own section: no headers of its+ own, just the fields one under another. */+.shot-inspector--flat {gap: var(--space-3);}+/* The fields in a section breathe a little more than a stack of rows. */+.shot-inspector .ui-prop-section__content,+.scene-settings .ui-prop-section__content {+ gap: var(--space-1);+}++/* Each scene section is the first child of its region, so the shared rule+ drops its top line; the second one needs it back when the first is open+ (a collapsed header already draws that line underneath). */+.scene-settings:has(> .ui-prop-section--open) + .scene-settings > .ui-prop-section > .ui-prop-section__header {+ border-top-color: var(--line);+}+/* Inspector rows (PropRow) inside the pane, and the caption that explains- one: 12px secondary, indented to line up with the row's value column. */+ one: 12px secondary, indented to line up with the row's value column —+ the label column plus the row's gap, less the 6px the row hangs out by. */.prop-caption {margin: 0 0 var(--space-1);- padding-left: calc(104px + var(--space-2));+ padding-left: calc(var(--prop-label) + var(--space-2) - 6px);color: var(--text-muted);font-size: var(--text-xs);line-height: var(--leading-snug);@@ -791,10 +718,6 @@flex: 0 0 auto;}-.scene-settings .ui-prop-section__content {- padding-inline: 0;-}-/* The full-width fields: a 12px label over a textarea. */.shot-card__sublabel,.scene-settings__field > span {@@ -896,12 +819,9 @@background: var(--danger-soft);}-/* --- Settings on a shot ---------------------------------------------------- */--.shot-settings {- padding-top: var(--space-3);- border-top: 1px solid var(--line);-}+/* --- Settings on a shot ------------------------------------------------------+ Its own section in the shot's pane; the header names it and counts what is+ set. */.shot-settings__chips {display: flex;@@ -971,12 +891,8 @@line-height: var(--leading-snug);}-/* --- References that can be dropped into a line ---------------------------- */--.reference-palette {- padding-top: var(--space-3);- border-top: 1px solid var(--line);-}+/* --- References that can be dropped into a line ------------------------------+ A section of the shot's pane, or (inside the Pose scene) a labelled block. */.reference-palette__lead {display: block;