AI media harness for planning, generating, and editing locally
TypeScript
References: item header with art chip, sections, library in the well, shared empty states
Bittid22338f99df9
diff --git a/src/components/workspace/ReferencesView.test.tsx b/src/components/workspace/ReferencesView.test.tsxindex a130d47..cfe6c88 100644--- a/src/components/workspace/ReferencesView.test.tsx+++ b/src/components/workspace/ReferencesView.test.tsx@@ -225,7 +225,7 @@ describe("Reference type presets", () => {it("renames the selected reference from the inspector header", () => {const state = setup();const name = screen.getByRole("textbox", { name: "Reference name" });- const header = name.closest("header");+ const header = name.closest<HTMLElement>(".ui-item-header");expect(name).toHaveValue("Hero");expect(header).not.toBeNull();@@ -470,9 +470,11 @@ describe("Reference library views and selection", () => {expect(open).toHaveBeenCalledWith(initial.generationJobs[0].id);});- it("says so in one line when nothing is selected", () => {+ it("shows the shared empty state when nothing is selected", () => {setup({ ...project(), references: [] });+ expect(screen.getByText("Nothing selected")).toBeInTheDocument();expect(screen.getByText("Select a reference to see its details.")).toBeInTheDocument();- expect(screen.getByText("No references yet.")).toBeInTheDocument();+ expect(screen.getByText("No references yet")).toBeInTheDocument();+ expect(screen.getByRole("button", { name: "New reference" })).toBeInTheDocument();});});diff --git a/src/components/workspace/ReferencesView.tsx b/src/components/workspace/ReferencesView.tsxindex fe63870..4b704ff 100644--- a/src/components/workspace/ReferencesView.tsx+++ b/src/components/workspace/ReferencesView.tsx@@ -1,6 +1,6 @@-import { ArrowDown, ArrowUp, ChevronLeft, ChevronRight, ExternalLink, FileText, FolderOpen, ImagePlus, LayoutGrid, List, Pencil, Plus, RefreshCw, Search, Trash2 } from "lucide-react";+import { ArrowDown, ArrowUp, ChevronLeft, ChevronRight, ExternalLink, FileText, FolderOpen, ImagePlus, Images, LayoutGrid, List, MousePointerClick, Pencil, Plus, RefreshCw, Search, Trash2 } from "lucide-react";import { invoke } from "@tauri-apps/api/core";-import { useEffect, useId, useMemo, useRef, useState, useSyncExternalStore, type KeyboardEvent, type MouseEvent } from "react";+import { useEffect, useMemo, useRef, useState, useSyncExternalStore, type KeyboardEvent, type MouseEvent } from "react";import { isReferenceDescribed, projectItemPath, referenceImages, type ProjectConfig, type ProjectReference, type ProjectReferenceImage } from "../../lib/project";import { activeReferenceRefmods } from "../../lib/project";import {@@ -33,7 +33,7 @@ import { DebugPromptDialog } from "./DebugPromptDialog";import { referenceIconPrompt } from "../../lib/referenceIcons";import { loadDebugOptionsEnabled, subscribeDebugOptions } from "../../lib/settings";import {- CommandBar, CommandBarButton, CommandBarSeparator, ComboBox, ContentDialog, InfoBar, PropRow, SelectorBar, Splitter, StatusBar,+ CommandBar, CommandBarButton, CommandBarSeparator, ComboBox, ContentDialog, EmptyState, InfoBar, ItemHeader, PropRow, PropSection, SelectorBar, Splitter, StatusBar,tooltipProps, useContextMenu, usePaneSize, type MenuEntry,} from "../ui";import { isMenuKey } from "./SceneBoard";@@ -110,12 +110,11 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,const [presetSearch, setPresetSearch] = useState("");const [view, setView] = useState<LibraryView>(readView);const [sort, setSort] = useState<{ key: SortKey; descending: boolean }>({ key: "name", descending: false });- const inspectorPane = usePaneSize("references.inspector", 380, { min: 280, max: 640 });+ const inspectorPane = usePaneSize("references.inspector", 340, { min: 280, max: 560 });const root = useRef<HTMLDivElement>(null);const library = useRef<HTMLDivElement>(null);const nameInput = useRef<HTMLInputElement>(null);const menu = useContextMenu();- const inspectorTitleId = useId();const selected = config.references.find((ref) => ref.id === selectedId);const selectedImages = selected ? referenceImages(selected) : [];@@ -442,13 +441,18 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,<section ref={library} className="reference-library" aria-labelledby="reference-library-heading"><h2 className="sr-only" id="reference-library-heading">Reference library</h2>{config.references.length === 0- ? <p className="reference-library__empty">No references yet.</p>+ ? <EmptyState+ icon={<Images />}+ title="No references yet"+ description="A reference keeps a character, a place or a look the same in every scene that uses it."+ action={<button type="button" className="secondary-button" onClick={openNewReference}>New reference</button>}+ />: view === "icons"? <div className="reference-grid" role="listbox" aria-label="References" aria-multiselectable="true" aria-orientation="horizontal">{ordered.map((ref) => <divkey={ref.id}role="option"- className={`reference-tile${selectedIds.has(ref.id) ? " reference-tile--selected" : ""}`}+ className="reference-tile ui-selectable ui-selectable--card"aria-label={`${ref.name} ${referenceKindLabel(ref)}`}data-tooltip={isReferenceDescribed(ref) ? ref.description : `${ref.name} · not described yet`}{...itemProps(ref)}@@ -490,121 +494,154 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,<Splitter {...inspectorPane.splitterProps} reverse aria-label="Resize inspector" aria-controls="reference-inspector" />- <aside id="reference-inspector" className="reference-inspector" aria-labelledby={selected ? undefined : inspectorTitleId} aria-label={selected ? `Reference: ${selected.name}` : undefined}>- {selected ? <header className="reference-inspector__head">- <h2><input+ <aside id="reference-inspector" className="reference-inspector" aria-label={selected ? `Reference: ${selected.name}` : "Reference details"}>+ {/* The selected reference heads the pane: its art is the chip, its name+ is editable in place, and the meta line says what it is. */}+ {selected && <ItemHeader+ chip={art(selected)}+ name={<inputref={nameInput}- className="panel-title__name reference-title__name"+ className="ui-item-header__input"value={selected.name}aria-label="Reference name"aria-keyshortcuts="F2"onChange={(event) => update(selected.id, { name: event.target.value || "Untitled reference" })}- /></h2>- <button className="icon-button" onClick={() => remove([selected.id])} aria-label="Delete reference" {...tooltipProps("Delete reference", "Delete")}><Trash2 size={16} aria-hidden="true" /></button>- </header> : <header className="reference-inspector__head"><h2 id={inspectorTitleId} className="reference-inspector__title">Details</h2></header>}+ />}+ meta={[+ selectedType === "custom" ? "Uncategorized" : referenceTypeLabel(selectedType),+ referenceKindLabel(selected),+ jobs.length === 0 ? "Not used" : jobs.length === 1 ? "1 scene" : `${jobs.length} scenes`,+ ].join(" · ")}+ actions={<button className="icon-button" onClick={() => remove([selected.id])} aria-label="Delete reference" {...tooltipProps("Delete reference", "Delete")}><Trash2 size={16} aria-hidden="true" /></button>}+ />}<div className="reference-inspector__scroll">{selected ? <>- {selected.kind === "video" && <section className="reference-video" aria-label="Video reference">- <ReferenceVideo key={`${selected.id}:${selected.sourcePath ?? selected.relativePath}`} folderPath={folderPath} reference={selected}- onChange={(video) => update(selected.id, { video })} />- <button className="secondary-button" onClick={() => update(selected.id, { kind: "text", sourcePath: null, relativePath: null, video: undefined })}><Trash2 size={16} aria-hidden="true" /> Remove video</button>- </section>}- {(selected.kind !== "video" || showImages || hasRefmods) && <div className={`reference-detail-art${showImages || selected.iconRelativePath || (!hasRefmods && selectedPresetIcon) ? " reference-detail-art--photo" : " reference-detail-art--text"}${showImages ? " reference-detail-art--images" : (!hasRefmods && selectedPresetIcon) || selected.iconRelativePath ? " reference-detail-art--preset" : ""}`}>- {showImages- ? <div className="reference-detail-images"><ReferenceImage key={selectedImage.id} folderPath={folderPath} relativePath={selectedImage.relativePath} sourcePath={selectedImage.sourcePath} alt={selectedImage.name} /></div>- : selected.iconRelativePath- ? <ReferenceImage className="reference-detail-preset-icon" folderPath={folderPath} relativePath={selected.iconRelativePath} alt={`${selected.name} reference icon`} />- : !hasRefmods && selectedPresetIcon- ? <PresetIcon className="reference-detail-preset-icon" preset={selectedPresetIcon} alt={`${selected.name} reference icon`} />- : <span><FileText size={16} aria-hidden="true" /></span>}- {/* A caption only where there is no picture to look at. */}- {!showImages && !selected.iconRelativePath && (hasRefmods || !selectedPresetIcon) && <em>{referenceKindLabel(selected)}</em>}- {showImages && <button type="button" className="reference-image-remove" aria-label="Remove reference image" {...tooltipProps(`Remove ${selectedImage.name}`)} onClick={removeImage}><Trash2 size={14} aria-hidden="true" /></button>}- {!showImages && onRegenerateIcon && <button- type="button"- className="reference-icon-refresh"- aria-label="Regenerate reference icon"- data-tooltip={pendingIconIds.has(selected.id) ? "Icon generation queued or running" : canGenerateIcon ? "Regenerate reference icon" : hasRefmods ? "Enable a refmod to generate an icon" : "Add a prompt to generate an icon"}- disabled={!canGenerateIcon || pendingIconIds.has(selected.id)}- onClick={() => {- setIconError(null);- try { onRegenerateIcon(selected.id); }- catch (reason) { setIconError(reason instanceof Error ? reason.message : String(reason)); }- }}- ><RefreshCw size={14} aria-hidden="true" /></button>}- </div>}- {showImages && <div className="reference-image-controls" role="group" aria-label="Reference images">- <button type="button" className="icon-button" aria-label="Previous reference image" data-tooltip="Previous image" disabled={currentImagePage === 0} onClick={() => setImagePage(currentImagePage - 1)}><ChevronLeft size={16} aria-hidden="true" /></button>- <span aria-live="polite">Image {currentImagePage + 1} of {selectedImages.length}</span>- <button type="button" className="icon-button" aria-label="Next reference image" data-tooltip="Next image" disabled={currentImagePage === selectedImages.length - 1} onClick={() => setImagePage(currentImagePage + 1)}><ChevronRight size={16} aria-hidden="true" /></button>- </div>}- <div className="reference-fields">- <label><span>Prompt</span><textarea className="text-field" disabled={hasRefmods} value={selected.description} placeholder="Describe what should stay consistent — the traits, materials, colours, or wardrobe Slopus should preserve across shots." onChange={(event) => update(selected.id, { description: event.target.value, content: event.target.value || null, subcategory: selectedSubcategory })} /></label>- {hasRefmods ? <p>Remove the refmods to edit the prompt or add files.</p>- : !isReferenceDescribed(selected) && <p>{selected.kind === "video"- ? "The clip is sent as a reference. Add a prompt to describe what to keep."- : selectedImages.length > 0- ? "Not described yet — the picture is sent, but nothing tells the engine what to keep."- : "Not described yet — it won’t be used until you add a definition."}</p>}- </div>- {hasRefmods && <section className="reference-refmods" aria-label="Refmod attachments">- <header>- <h3>Refmods</h3>- <button type="button" className="icon-button" aria-label="Remove refmods" data-tooltip="Remove all refmods" onClick={() => update(selected.id, { iconRelativePath: undefined, refmods: [] })}><Trash2 size={16} aria-hidden="true" /></button>- </header>- <p>Needs a Ref2VA generator. Strength 0 turns a refmod off; more copies use more GPU memory.</p>- {selected.refmods!.map((refmod) => <div key={refmod.id}>- <b data-tooltip={refmod.name}>{refmod.name}</b>- <PropRow label="Strength" htmlFor={`${refmod.id}-strength`}><input id={`${refmod.id}-strength`} className="text-field" aria-label={`${refmod.name} strength`} type="number" min={0} max={1} step={0.05} value={refmod.strength} onChange={(event) => {- const strength = Number(event.target.value);- if (event.target.value && Number.isFinite(strength) && strength >= 0 && strength <= 1) update(selected.id, { iconRelativePath: undefined, refmods: selected.refmods!.map((entry) => entry.id === refmod.id ? { ...entry, strength } : entry) });- }} /></PropRow>- <PropRow label="Copies" htmlFor={`${refmod.id}-copies`}><input id={`${refmod.id}-copies`} className="text-field" aria-label={`${refmod.name} copies`} type="number" min={1} max={10} step={1} value={refmod.copies} onChange={(event) => {- const copies = Number(event.target.value);- if (Number.isInteger(copies) && copies >= 1 && copies <= 10) update(selected.id, { iconRelativePath: undefined, refmods: selected.refmods!.map((entry) => entry.id === refmod.id ? { ...entry, copies } : entry) });- }} /></PropRow>- </div>)}- </section>}- {selectedLocation && <section className="reference-location-settings" aria-label="Location settings">- {LOCATION_SETTING_GROUPS.map((group) => <PropRow key={group.id} label={group.label}>- <ComboBox- aria-label={group.label}- disabled={hasRefmods}- value={selectedLocation.settings[group.id] ?? ""}- options={[{ value: "", label: "None" }, ...group.options.map((option) => ({ value: option.id, label: option.label }))]}- onChange={(value) => {- const prompt = composeLocationPrompt(selectedLocation.preset, { ...selectedLocation.settings, [group.id]: value || undefined });- update(selected.id, { description: prompt, content: prompt });+ {selected.kind === "video" && <PropSection title="Video clip" persistKey="references.video">+ <section className="reference-video" aria-label="Video reference">+ <ReferenceVideo key={`${selected.id}:${selected.sourcePath ?? selected.relativePath}`} folderPath={folderPath} reference={selected}+ onChange={(video) => update(selected.id, { video })} />+ <button className="secondary-button" onClick={() => update(selected.id, { kind: "text", sourcePath: null, relativePath: null, video: undefined })}><Trash2 size={16} aria-hidden="true" /> Remove video</button>+ </section>+ </PropSection>}+ {/* The picture at a readable size, where the chip is only a glance:+ paging through the images, removing one, regenerating the icon. */}+ {(selected.kind !== "video" || showImages || hasRefmods) && <PropSection+ title="Preview"+ persistKey="references.preview"+ summary={showImages ? `${currentImagePage + 1} of ${selectedImages.length}` : undefined}+ >+ <div className={`reference-detail-art${showImages || selected.iconRelativePath || (!hasRefmods && selectedPresetIcon) ? " reference-detail-art--photo" : " reference-detail-art--text"}${showImages ? " reference-detail-art--images" : (!hasRefmods && selectedPresetIcon) || selected.iconRelativePath ? " reference-detail-art--preset" : ""}`}>+ {showImages+ ? <div className="reference-detail-images"><ReferenceImage key={selectedImage.id} folderPath={folderPath} relativePath={selectedImage.relativePath} sourcePath={selectedImage.sourcePath} alt={selectedImage.name} /></div>+ : selected.iconRelativePath+ ? <ReferenceImage className="reference-detail-preset-icon" folderPath={folderPath} relativePath={selected.iconRelativePath} alt={`${selected.name} reference icon`} />+ : !hasRefmods && selectedPresetIcon+ ? <PresetIcon className="reference-detail-preset-icon" preset={selectedPresetIcon} alt={`${selected.name} reference icon`} />+ : <span><FileText size={16} aria-hidden="true" /></span>}+ {/* A caption only where there is no picture to look at. */}+ {!showImages && !selected.iconRelativePath && (hasRefmods || !selectedPresetIcon) && <em>{referenceKindLabel(selected)}</em>}+ {showImages && <button type="button" className="reference-image-remove" aria-label="Remove reference image" {...tooltipProps(`Remove ${selectedImage.name}`)} onClick={removeImage}><Trash2 size={14} aria-hidden="true" /></button>}+ {!showImages && onRegenerateIcon && <button+ type="button"+ className="reference-icon-refresh"+ aria-label="Regenerate reference icon"+ data-tooltip={pendingIconIds.has(selected.id) ? "Icon generation queued or running" : canGenerateIcon ? "Regenerate reference icon" : hasRefmods ? "Enable a refmod to generate an icon" : "Add a prompt to generate an icon"}+ disabled={!canGenerateIcon || pendingIconIds.has(selected.id)}+ onClick={() => {+ setIconError(null);+ try { onRegenerateIcon(selected.id); }+ catch (reason) { setIconError(reason instanceof Error ? reason.message : String(reason)); }}}- />- </PropRow>)}- </section>}- <section className="reference-type" aria-label="Reference classification">- <PropRow label="Category">- <ComboBox- aria-label="Category"- value={selectedType}- options={[- ...(selectedType === "custom" ? [{ value: "custom", label: "Uncategorized", disabled: true }] : []),- ...REFERENCE_TYPES.map((type) => ({ value: type.id, label: type.label })),- ]}- onChange={(value) => update(selected.id, { intendedUse: [value as PresetReferenceType], subcategory: "" })}- />- </PropRow>- {selectedType !== "custom" && <PropRow label="Subcategory">- <ComboBox- aria-label="Subcategory"- value={selectedSubcategory}- options={[{ value: "", label: "None" }, ...referenceSubcategories(selectedType).map((subcategory) => ({ value: subcategory, label: subcategory }))]}- onChange={(value) => update(selected.id, { subcategory: value })}- />- </PropRow>}- </section>- <section className="reference-used-by">- <h3>Used by <span>{jobs.length}</span></h3>- {jobs.length ? jobs.map((job) => <button type="button" key={job.id} onClick={() => onOpenGenerator?.(job.id)} data-tooltip={`Open ${job.title}`}><b>{job.title}</b><ChevronRight size={16} aria-hidden="true" /></button>) : <p>No scenes yet.</p>}- </section>- </> : <p className="reference-empty">Select a reference to see its details.</p>}+ ><RefreshCw size={14} aria-hidden="true" /></button>}+ </div>+ {showImages && <div className="reference-image-controls" role="group" aria-label="Reference images">+ <button type="button" className="icon-button" aria-label="Previous reference image" data-tooltip="Previous image" disabled={currentImagePage === 0} onClick={() => setImagePage(currentImagePage - 1)}><ChevronLeft size={16} aria-hidden="true" /></button>+ <span aria-live="polite">Image {currentImagePage + 1} of {selectedImages.length}</span>+ <button type="button" className="icon-button" aria-label="Next reference image" data-tooltip="Next image" disabled={currentImagePage === selectedImages.length - 1} onClick={() => setImagePage(currentImagePage + 1)}><ChevronRight size={16} aria-hidden="true" /></button>+ </div>}+ </PropSection>}+ <PropSection title="Prompt" persistKey="references.prompt" summary={hasRefmods ? "Locked by refmods" : isReferenceDescribed(selected) ? undefined : "Not described"}>+ <div className="reference-fields">+ {/* The section header names the field on screen. */}+ <label><span className="sr-only">Prompt</span><textarea className="text-field" disabled={hasRefmods} value={selected.description} placeholder="Describe what should stay consistent — the traits, materials, colours, or wardrobe Slopus should preserve across shots." onChange={(event) => update(selected.id, { description: event.target.value, content: event.target.value || null, subcategory: selectedSubcategory })} /></label>+ {hasRefmods ? <p>Remove the refmods to edit the prompt or add files.</p>+ : !isReferenceDescribed(selected) && <p>{selected.kind === "video"+ ? "The clip is sent as a reference. Add a prompt to describe what to keep."+ : selectedImages.length > 0+ ? "Not described yet — the picture is sent, but nothing tells the engine what to keep."+ : "Not described yet — it won’t be used until you add a definition."}</p>}+ </div>+ </PropSection>+ {hasRefmods && <PropSection+ title="Refmods"+ persistKey="references.refmods"+ summary={selected.refmods!.length}+ actions={<button type="button" className="icon-button prop-row__button" aria-label="Remove refmods" data-tooltip="Remove all refmods" onClick={() => update(selected.id, { iconRelativePath: undefined, refmods: [] })}><Trash2 size={16} aria-hidden="true" /></button>}+ >+ <section className="reference-refmods" aria-label="Refmod attachments">+ <p>Needs a Ref2VA generator. Strength 0 turns a refmod off; more copies use more GPU memory.</p>+ {selected.refmods!.map((refmod) => <div key={refmod.id}>+ <b data-tooltip={refmod.name}>{refmod.name}</b>+ <PropRow label="Strength" htmlFor={`${refmod.id}-strength`}><input id={`${refmod.id}-strength`} className="text-field" aria-label={`${refmod.name} strength`} type="number" min={0} max={1} step={0.05} value={refmod.strength} onChange={(event) => {+ const strength = Number(event.target.value);+ if (event.target.value && Number.isFinite(strength) && strength >= 0 && strength <= 1) update(selected.id, { iconRelativePath: undefined, refmods: selected.refmods!.map((entry) => entry.id === refmod.id ? { ...entry, strength } : entry) });+ }} /></PropRow>+ <PropRow label="Copies" htmlFor={`${refmod.id}-copies`}><input id={`${refmod.id}-copies`} className="text-field" aria-label={`${refmod.name} copies`} type="number" min={1} max={10} step={1} value={refmod.copies} onChange={(event) => {+ const copies = Number(event.target.value);+ if (Number.isInteger(copies) && copies >= 1 && copies <= 10) update(selected.id, { iconRelativePath: undefined, refmods: selected.refmods!.map((entry) => entry.id === refmod.id ? { ...entry, copies } : entry) });+ }} /></PropRow>+ </div>)}+ </section>+ </PropSection>}+ {selectedLocation && <PropSection title="Location" persistKey="references.location">+ <section className="reference-location-settings" aria-label="Location settings">+ {LOCATION_SETTING_GROUPS.map((group) => <PropRow key={group.id} label={group.label}>+ <ComboBox+ aria-label={group.label}+ disabled={hasRefmods}+ value={selectedLocation.settings[group.id] ?? ""}+ options={[{ value: "", label: "None" }, ...group.options.map((option) => ({ value: option.id, label: option.label }))]}+ onChange={(value) => {+ const prompt = composeLocationPrompt(selectedLocation.preset, { ...selectedLocation.settings, [group.id]: value || undefined });+ update(selected.id, { description: prompt, content: prompt });+ }}+ />+ </PropRow>)}+ </section>+ </PropSection>}+ <PropSection title="Classification" persistKey="references.classification">+ <section className="reference-type" aria-label="Reference classification">+ <PropRow label="Category">+ <ComboBox+ aria-label="Category"+ value={selectedType}+ options={[+ ...(selectedType === "custom" ? [{ value: "custom", label: "Uncategorized", disabled: true }] : []),+ ...REFERENCE_TYPES.map((type) => ({ value: type.id, label: type.label })),+ ]}+ onChange={(value) => update(selected.id, { intendedUse: [value as PresetReferenceType], subcategory: "" })}+ />+ </PropRow>+ {selectedType !== "custom" && <PropRow label="Subcategory">+ <ComboBox+ aria-label="Subcategory"+ value={selectedSubcategory}+ options={[{ value: "", label: "None" }, ...referenceSubcategories(selectedType).map((subcategory) => ({ value: subcategory, label: subcategory }))]}+ onChange={(value) => update(selected.id, { subcategory: value })}+ />+ </PropRow>}+ </section>+ </PropSection>+ <PropSection title="Used by" persistKey="references.used-by" summary={jobs.length}>+ <div className="reference-used-by">+ {jobs.length ? jobs.map((job) => <button type="button" key={job.id} onClick={() => onOpenGenerator?.(job.id)} data-tooltip={`Open ${job.title}`}><b>{job.title}</b><ChevronRight size={16} aria-hidden="true" /></button>) : <p>No scenes yet.</p>}+ </div>+ </PropSection>+ </> : <EmptyState+ icon={<MousePointerClick />}+ title="Nothing selected"+ description="Select a reference to see its details."+ />}</div>{debugEnabled && selected && <div className="debug-prompt"><button type="button" className="secondary-button debug-prompt__toggle" aria-haspopup="dialog" aria-expanded={showDebugIconPrompt} onClick={() => setShowDebugIconPrompt(true)}>Debug icon prompt</button>diff --git a/src/components/workspace/ReferencesView.video.test.tsx b/src/components/workspace/ReferencesView.video.test.tsxindex 5bb38af..e63ac40 100644--- a/src/components/workspace/ReferencesView.video.test.tsx+++ b/src/components/workspace/ReferencesView.video.test.tsx@@ -37,7 +37,7 @@ it("attaches mixed files through Add file and renders an icon with an enabled reexpect(screen.queryByRole("button", { name: "Add images" })).not.toBeInTheDocument();expect(screen.queryByRole("button", { name: "Add video" })).not.toBeInTheDocument();fireEvent.click(screen.getByRole("button", { name: "Add file" }));- await screen.findByRole("heading", { name: "Refmods" });+ await screen.findByRole("button", { name: /^Refmods/ });const icon = screen.getByRole("button", { name: "Regenerate reference icon" });expect(icon.closest(".reference-detail-art")).not.toBeNull();expect(icon).toBeEnabled();@@ -58,7 +58,7 @@ it("attaches mixed files through Add file and renders an icon with an enabled reexpect(screen.getByLabelText("Prompt")).toBeDisabled();expect(screen.getByRole("button", { name: "Add file" })).toBeDisabled();const removeRefmods = screen.getByRole("button", { name: "Remove refmods" });- expect(removeRefmods.closest("header")).toContainElement(screen.getByRole("heading", { name: "Refmods" }));+ expect(removeRefmods.closest(".ui-prop-section__header")).toContainElement(screen.getByRole("button", { name: /^Refmods/ }));expect(removeRefmods).toHaveTextContent("");fireEvent.click(removeRefmods);expect(latest.references[0].refmods).toEqual([]);diff --git a/src/styles/references.css b/src/styles/references.cssindex 439eb48..ddf66cd 100644--- a/src/styles/references.css+++ b/src/styles/references.css@@ -12,13 +12,13 @@user's (usePaneSize → --pane-references-inspector); there are no widthbreakpoints, so a narrow window narrows the library instead. */.references-view {- --pane-references-inspector: 380px; /* usePaneSize sets the real width inline */+ --pane-references-inspector: var(--pane-side-default); /* usePaneSize sets the real width inline */height: 100%;min-height: 0;display: grid;/* Floors on both sides so a narrow view (agent pane open) keeps the list. */- grid-template-columns: minmax(240px, 1fr) auto minmax(260px, var(--pane-references-inspector));- background: var(--layer);+ grid-template-columns: minmax(240px, 1fr) auto minmax(280px, var(--pane-references-inspector));+ background: var(--surface-pane);}.references-main {@@ -29,10 +29,13 @@flex-direction: column;}+/* The command bar is chrome, like the Generator's: a 36px strip with the+ divider where it meets the library's well. */.references-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);}.references-main > .ui-infobar {@@ -40,18 +43,17 @@margin: var(--space-2) var(--space-3) 0;}+/* The library is where the references are laid out, so it sits in the well.+ The icon grid keeps its own gutter; the details table runs edge to edge so+ its header strip does. */.reference-library {flex: 1 1 auto;min-width: 0;min-height: 0;+ display: flex;+ flex-direction: column;overflow-y: auto;- padding: var(--space-2) var(--space-3);-}--.reference-library__empty {- margin: var(--space-2) 0;- color: var(--text-muted);- font-size: var(--text-sm);+ background: var(--surface-well);}.references-status {@@ -59,14 +61,16 @@}/* --- Icons view ---------------------------------------------------------------- Auto-filling 120px tiles: a square picture and a 12px name. Hover is a fill;- selection an accent fill with an accent edge, like any Windows grid view.+ Auto-filling 120px tiles: a square picture and a 12px name. Rest, hover and+ selection are the shared selectable-card rule (.ui-selectable--card): a+ fill under the mouse, an accent fill and ring when selected.========================================================================== */.reference-grid {display: grid;grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));gap: var(--space-2);+ padding: var(--space-2) var(--space-3);}.reference-tile {@@ -78,17 +82,6 @@border: 1px solid transparent;border-radius: var(--radius-sm);color: var(--text-primary);- transition: var(--transition-control);-}--.reference-tile:hover {- background: var(--fill-subtle-hover);-}--.reference-tile--selected,-.reference-tile--selected:hover {- border-color: var(--accent);- background: var(--accent-soft);}.reference-tile:focus-visible {@@ -138,6 +131,7 @@/* --- Details view ---------------------------------------------------------------28px rows, sortable columns, the same fill/accent selection as the icons.+ The column header is a chrome strip, pinned while the rows scroll.========================================================================== */.reference-details {@@ -159,26 +153,32 @@z-index: 1;padding: 0;border-bottom: 1px solid var(--line);- background: var(--layer);+ background: var(--surface-chrome);font-weight: var(--weight-regular);text-align: left;}.reference-details th button {width: 100%;- height: 28px;+ height: var(--section-row);display: flex;align-items: center;gap: var(--space-1);padding: 0 var(--space-2);border: 0;- border-radius: var(--radius-sm);+ border-radius: 0;color: var(--text-secondary);background: none;font: inherit;+ font-weight: var(--weight-semibold);text-align: left;}+.reference-details th:first-child button,+.reference-details td:first-child {+ padding-left: var(--space-3);+}+.reference-details th button:hover {color: var(--text-primary);background: var(--fill-subtle-hover);@@ -247,53 +247,49 @@background: var(--panel);}-/* The selected reference owns the pane header, like the editable scene and- shot names in the Generator: 14px semibold, 40px. */-.reference-inspector__head {- flex: 0 0 auto;- min-height: var(--space-7);+/* Its sections run edge to edge, the first straight under the item header;+ with nothing selected, the empty state centres in it. */+.reference-inspector__scroll {+ min-height: 0;+ flex: 1 1 auto;display: flex;- align-items: center;- gap: var(--space-1);- padding: 0 var(--space-1) 0 var(--space-2);- border-bottom: 1px solid var(--line);+ flex-direction: column;+ overflow-y: auto;}-.reference-inspector__head h2 {- min-width: 0;- flex: 1 1 auto;- margin: 0;- color: var(--text-primary);- font-size: var(--text-base);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);+/* The reference's art as the item header's 28px chip: the same picture the+ tile shows, filling the chip, with no room for a caption. */+.reference-inspector .ui-item-header__chip .reference-art {+ width: 100%;+ height: 100%;+ aspect-ratio: auto;+ border-radius: 0;}-.reference-inspector__title {- padding-left: var(--space-2);+.reference-inspector .ui-item-header__chip .reference-art > svg {+ width: 16px;+ height: 16px;}-.reference-inspector__scroll {- min-height: 0;- flex: 1 1 auto;- overflow-y: auto;+.reference-inspector .ui-item-header__chip .reference-image-fallback em {+ display: none;}-/* Nothing selected: one caption line, not a centred hero. */-.reference-empty {- margin: 0;- padding: var(--space-3);- color: var(--text-muted);- font-size: var(--text-xs);+.reference-inspector .ui-item-header__chip .reference-image-fallback > svg {+ width: 16px;+ height: 16px;}+/* The Preview section: the picture at a readable size, on a plate. Smaller+ than the full-width art it replaced, now that the chip names the reference+ at a glance: images and icons are held to 160px tall. */.reference-detail-art {position: relative;height: 128px;display: grid;place-items: center;overflow: hidden;- border-bottom: 1px solid var(--line);+ border-radius: var(--radius-sm);background: var(--panel-3);}@@ -313,9 +309,11 @@}.reference-detail-art.reference-detail-art--preset {- width: 100%;+ width: 160px;+ max-width: 100%;height: auto;aspect-ratio: 1;+ justify-self: center;}.reference-detail-art--preset > .reference-image-fallback {@@ -336,7 +334,9 @@display: block;width: 100%;height: auto;+ max-height: 160px;padding: 0;+ object-fit: contain;}.reference-detail-images .reference-image-fallback { min-height: 128px; }@@ -347,7 +347,7 @@display: flex;justify-content: flex-start;gap: var(--space-2);- padding: 0 var(--space-3);+ padding: 0 var(--space-1);background: transparent;}@@ -425,8 +425,6 @@align-items: center;justify-content: center;gap: var(--space-2);- padding: var(--space-1) var(--space-3);- border-bottom: 1px solid var(--line);}.reference-image-controls > span {@@ -459,9 +457,10 @@display: none;}+/* The sections' bodies: each block used to draw its own bottom rule and+ padding; the PropSection header above it now does both. */.reference-fields {- padding: var(--space-2) var(--space-3) var(--space-3);- border-bottom: 1px solid var(--line);+ padding-top: var(--space-1);}.reference-fields label {@@ -469,17 +468,6 @@margin: 0;}-.reference-fields label > span,-.reference-used-by h3,-.reference-refmods h3 {- display: block;- margin: 0 0 var(--space-1);- color: var(--text-secondary);- font-size: var(--text-xs);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);-}-.reference-fields textarea {width: 100%;height: 160px;@@ -502,8 +490,6 @@.reference-location-settings {display: grid;gap: 2px;- padding: var(--space-2) var(--space-3);- border-bottom: 1px solid var(--line);}.reference-refmods,@@ -516,19 +502,7 @@.reference-refmods {gap: var(--space-2);- padding: var(--space-2) var(--space-3);- border-bottom: 1px solid var(--line);-}--.reference-refmods > header {- display: flex;- align-items: center;- justify-content: space-between;- gap: var(--space-2);-}--.reference-refmods > header h3 {- margin: 0;+ padding-top: var(--space-1);}.reference-refmods > div > b {@@ -547,13 +521,8 @@}.reference-used-by {- padding: var(--space-2) var(--space-3) var(--space-3);-}--.reference-used-by h3 span {- float: right;- color: var(--text-muted);- font-weight: var(--weight-regular);+ display: grid;+ margin-left: calc(-1 * var(--space-2));}.reference-used-by > button {@@ -588,6 +557,7 @@.reference-used-by > p {margin: 0;+ padding: var(--space-1) var(--space-2);color: var(--text-muted);font-size: var(--text-xs);}@@ -597,7 +567,7 @@.reference-video {display: grid;gap: var(--space-3);- padding: var(--space-3);+ padding: var(--space-1) 0;}.reference-video-dialog .reference-video {