Add tabbed video ref picker, stricter agent HITL, and item attach.

Playground creates a new misc. item instead of overwriting one; item generate jobs persist the image path. Notes in docs/changelogs/2026-08-23.md.
This commit is contained in:
Benjiyaya
2026-08-24 04:29:49 +08:00
parent e87a7d3180
commit 71bed77095
30 changed files with 1584 additions and 350 deletions
+4 -2
View File
@@ -275,7 +275,7 @@ export const jobsApi = {
api<{ ok: boolean; job: Job }>(`/api/jobs/projects/${projectId}/export`, { method: 'POST' }),
};
export type PlaygroundAttachTarget = 'character_sheet' | 'location' | 'scene';
export type PlaygroundAttachTarget = 'character_sheet' | 'location' | 'item' | 'scene';
export type UploadKind = 'image' | 'video' | 'audio';
@@ -319,9 +319,11 @@ export const playgroundApi = {
target: PlaygroundAttachTarget;
character_id?: number;
location_id?: number;
item_id?: number;
scene_id?: number;
name?: string;
}) =>
api<{ ok: boolean; path: string; target: string; project_id: number }>(
api<{ ok: boolean; path: string; target: string; project_id: number; item_id?: number }>(
'/api/playground/attach',
{ method: 'POST', body: JSON.stringify(payload) },
),
+48
View File
@@ -0,0 +1,48 @@
/** Shared shape for Omni / video ref pickers. */
export type AssetGroup = 'character' | 'location' | 'item' | 'upload' | 'clip';
export interface AssetOption {
label: string;
path: string;
kind?: 'image' | 'video' | 'audio';
group?: AssetGroup;
}
const GROUP_FROM_SUFFIX: Array<{ re: RegExp; group: AssetGroup }> = [
{ re: /\s·\s*sheet$/i, group: 'character' },
{ re: /\s·\s*environment$/i, group: 'location' },
{ re: /\s·\s*item$/i, group: 'item' },
{ re: /\s·\s*upload$/i, group: 'upload' },
{ re: /^clip\s*#/i, group: 'clip' },
];
export function assetGroup(opt: AssetOption): AssetGroup {
if (opt.group) return opt.group;
for (const { re, group } of GROUP_FROM_SUFFIX) {
if (re.test(opt.label)) return group;
}
return 'upload';
}
/** Strip the " · sheet" style suffix so the tab already names the type. */
export function assetDisplayName(opt: AssetOption): string {
return opt.label.replace(/\s·\s*(sheet|environment|item|upload)\s*$/i, '').trim() || opt.label;
}
export const ASSET_GROUP_TABS: Array<{ id: AssetGroup; label: string }> = [
{ id: 'character', label: 'Characters' },
{ id: 'location', label: 'Environments' },
{ id: 'item', label: 'Misc. Items' },
{ id: 'clip', label: 'Clips' },
{ id: 'upload', label: 'Uploads' },
];
export function tabsForMediaKind(kind: string | undefined): Array<{ id: AssetGroup; label: string }> {
const ids: AssetGroup[] =
kind === 'video'
? ['clip', 'upload']
: kind === 'audio'
? ['upload']
: ['character', 'location', 'item', 'upload'];
return ASSET_GROUP_TABS.filter((t) => ids.includes(t.id));
}
@@ -148,18 +148,25 @@
const chars = $assetsQuery.data?.characters ?? [];
const locs = $assetsQuery.data?.locations ?? [];
const items = $assetsQuery.data?.items ?? [];
const opts: Array<{ label: string; path: string }> = [];
const opts: Array<{ label: string; path: string; group?: 'character' | 'location' | 'item' }> =
[];
for (const c of chars) {
if (c.sheet_path) opts.push({ label: `${c.name} · sheet`, path: c.sheet_path });
if (c.sheet_path) {
opts.push({ label: `${c.name} · sheet`, path: c.sheet_path, group: 'character' });
}
}
for (const loc of locs) {
if (loc.reference_image_path) {
opts.push({ label: `${loc.name} · environment`, path: loc.reference_image_path });
opts.push({
label: `${loc.name} · environment`,
path: loc.reference_image_path,
group: 'location',
});
}
}
for (const it of items) {
if (it.reference_image_path) {
opts.push({ label: `${it.name} · item`, path: it.reference_image_path });
opts.push({ label: `${it.name} · item`, path: it.reference_image_path, group: 'item' });
}
}
return opts;
@@ -29,6 +29,7 @@
let target = $state<PlaygroundAttachTarget>('character_sheet');
let characterId = $state<number | ''>('');
let locationId = $state<number | ''>('');
let itemName = $state('');
let sceneId = $state<number | ''>('');
let message = $state('');
let characters = $state<Character[]>([]);
@@ -99,6 +100,9 @@
} else if (target === 'location') {
if (locationId === '') throw new Error('Pick a location');
payload.location_id = Number(locationId);
} else if (target === 'item') {
const name = itemName.trim();
if (name) payload.name = name;
} else {
if (sceneId === '') throw new Error('Pick a scene');
payload.scene_id = Number(sceneId);
@@ -118,6 +122,14 @@
},
});
function defaultMiscName(filePath: string): string {
const base = filePath.replace(/\\/g, '/').split('/').pop() ?? '';
const stem = base.replace(/\.[^.]+$/, '');
const stripped = stem.replace(/^[0-9a-f]{8}-/i, '');
const pretty = (stripped || stem).replace(/[_-]+/g, ' ').trim();
return pretty || 'New item';
}
const projectList = $derived(($projectsQuery.data ?? []) as Project[]);
// Stage-URL contract: images land on Assets, clips on Video.
@@ -142,7 +154,15 @@
</button>
</div>
{:else if !open}
<Button variant="secondary" onclick={() => (open = true)}>Add to project</Button>
<Button
variant="secondary"
onclick={() => {
itemName = defaultMiscName(path);
open = true;
}}
>
Add to project
</Button>
{:else}
<div class="panel" role="group" aria-label="Add artifact to project">
<label class="field">
@@ -161,6 +181,7 @@
<select class="field-select" bind:value={target}>
<option value="character_sheet">Character sheet</option>
<option value="location">Background / location</option>
<option value="item">Misc. item</option>
</select>
</label>
@@ -177,7 +198,7 @@
<span class="field-hint">No characters in this project yet.</span>
{/if}
</label>
{:else}
{:else if target === 'location'}
<label class="field">
<span class="field-label">Location</span>
<select class="field-select" bind:value={locationId} disabled={projectId === '' || loadingTargets}>
@@ -190,6 +211,17 @@
<span class="field-hint">No locations in this project yet.</span>
{/if}
</label>
{:else}
<label class="field">
<span class="field-label">Name</span>
<input
class="field-input"
type="text"
bind:value={itemName}
placeholder="New misc. item"
/>
<span class="field-hint">Adds a new misc. item. Existing items are left unchanged.</span>
</label>
{/if}
{:else}
<label class="field">
@@ -17,6 +17,7 @@
import { classifyAll, RESOLUTION_PRESETS, resolutionLabel } from '$lib/comfy/classifyInput';
import { createUploadManager } from '$lib/comfy/useUpload.svelte';
import { normalizeInputRole } from '$lib/comfy/parser';
import type { AssetOption } from '$lib/assetPicker';
import { assetUrl } from '$lib/api';
import Icon from '$lib/components/ui/Icon.svelte';
import PillSelect from './omni/PillSelect.svelte';
@@ -30,12 +31,6 @@
kind: string;
}
interface AssetOption {
label: string;
path: string;
kind?: 'image' | 'video' | 'audio';
}
interface Props {
inputs: ComfyDynamicInput[];
values: Record<string, string | number>;
@@ -13,6 +13,7 @@
type Workflow,
} from '$lib/api';
import { compactInputValues } from '$lib/comfy/promptInput';
import type { AssetOption } from '$lib/assetPicker';
import { progressFor } from '$lib/jobProgress';
import SafeMedia from './SafeMedia.svelte';
import VideoEditWorkspace from './video/VideoEditWorkspace.svelte';
@@ -82,9 +83,17 @@
const assetOptions = $derived.by(() => {
const chars = $assetsQuery.data?.characters ?? [];
const locs = $assetsQuery.data?.locations ?? [];
const opts: Array<{ label: string; path: string; kind?: 'image' | 'video' | 'audio' }> = [];
const items = $assetsQuery.data?.items ?? [];
const opts: AssetOption[] = [];
for (const c of chars) {
if (c.sheet_path) opts.push({ label: `${c.name} · sheet`, path: c.sheet_path, kind: 'image' });
if (c.sheet_path) {
opts.push({
label: `${c.name} · sheet`,
path: c.sheet_path,
kind: 'image',
group: 'character',
});
}
}
for (const loc of locs) {
if (loc.reference_image_path) {
@@ -92,6 +101,17 @@
label: `${loc.name} · environment`,
path: loc.reference_image_path,
kind: 'image',
group: 'location',
});
}
}
for (const it of items) {
if (it.reference_image_path) {
opts.push({
label: `${it.name} · item`,
path: it.reference_image_path,
kind: 'image',
group: 'item',
});
}
}
@@ -101,11 +121,12 @@
label: `Clip #${sc.order_index} · ${sc.heading || 'scene'}`,
path: sc.video_path,
kind: 'video',
group: 'clip',
});
}
}
for (const up of $uploadsQuery.data ?? []) {
opts.push({ label: `${up.name} · upload`, path: up.path, kind: up.kind });
opts.push({ label: `${up.name} · upload`, path: up.path, kind: up.kind, group: 'upload' });
}
return opts;
});
@@ -190,6 +211,8 @@
// One POST per scene (the H3 prompt rewrite runs synchronously inside each
// request, so a single all-scenes POST could take minutes and time out).
// The queue worker then renders them strictly in sequence (concurrency 1).
// Do not send continue_motion here: omit it so the backend can treat a
// just-queued previous scene as "ready" and pick First/Next correctly.
let batching = $state(false);
let batchNote = $state('');
@@ -0,0 +1,358 @@
<script lang="ts">
/**
* Tabbed asset picker for Omni media tiles (characters / environments /
* items / uploads / clips). Replaces the old single-column dropdown.
*/
import { assetUrl } from '$lib/api';
import {
assetDisplayName,
assetGroup,
tabsForMediaKind,
type AssetGroup,
type AssetOption,
} from '$lib/assetPicker';
import Button from '$lib/components/ui/Button.svelte';
import Icon from '$lib/components/ui/Icon.svelte';
import Modal from '$lib/components/ui/Modal.svelte';
interface Props {
open?: boolean;
title?: string;
assets?: AssetOption[];
value?: string;
kind?: string;
allowUpload?: boolean;
onselect: (path: string) => void;
onupload?: () => void;
onclear?: () => void;
}
let {
open = $bindable(false),
title = 'Choose reference',
assets = [],
value = '',
kind = 'image',
allowUpload = true,
onselect,
onupload,
onclear,
}: Props = $props();
let tab = $state<AssetGroup>('character');
let query = $state('');
let wasOpen = $state(false);
const tabs = $derived(tabsForMediaKind(kind));
function hideBroken(e: Event) {
const el = e.currentTarget as HTMLElement | null;
if (el) el.style.display = 'none';
}
$effect(() => {
const now = open;
if (now && !wasOpen) {
query = '';
const match = assets.find((a) => a.path === value);
const preferred = match ? assetGroup(match) : null;
const firstWithItems =
tabs.find((t) => assets.some((a) => assetGroup(a) === t.id))?.id ?? tabs[0]?.id;
tab =
(preferred && tabs.some((t) => t.id === preferred) ? preferred : firstWithItems) ??
'upload';
}
wasOpen = now;
});
const q = $derived(query.trim().toLowerCase());
const visible = $derived.by(() => {
const inTab = assets.filter((a) => assetGroup(a) === tab);
if (!q) return inTab;
return inTab.filter(
(a) => a.label.toLowerCase().includes(q) || assetDisplayName(a).toLowerCase().includes(q),
);
});
function countFor(id: AssetGroup): number {
return assets.filter((a) => assetGroup(a) === id).length;
}
const emptyHint = $derived.by(() => {
if (q) return `No matches for “${query.trim()}”.`;
if (tab === 'character') return 'No character sheets yet. Generate them on Assets.';
if (tab === 'location') return 'No environment images yet. Generate them on Assets.';
if (tab === 'item') return 'No misc. item images yet. Generate them on Assets.';
if (tab === 'clip') return 'No scene clips in this film yet.';
return allowUpload ? 'No uploads yet. Use Upload new… below.' : 'No uploads yet.';
});
function pick(path: string) {
onselect(path);
open = false;
}
function upload() {
onupload?.();
open = false;
}
function clear() {
onclear?.();
open = false;
}
</script>
<Modal bind:open {title} size="lg">
<div class="picker">
{#if tabs.length > 1}
<div class="tabs" role="tablist" aria-label="Asset type">
{#each tabs as t (t.id)}
<button
type="button"
role="tab"
id="asset-tab-{t.id}"
aria-selected={tab === t.id}
class:active={tab === t.id}
onclick={() => (tab = t.id)}
>
{t.label}
<span class="count">{countFor(t.id)}</span>
</button>
{/each}
</div>
{/if}
<label class="search">
<Icon name="search" size={14} />
<input
type="search"
placeholder="Search in {tabs.find((t) => t.id === tab)?.label ?? 'this list'}…"
bind:value={query}
aria-label="Search assets"
/>
</label>
<div class="grid-wrap" role="tabpanel" aria-labelledby="asset-tab-{tab}">
{#if visible.length === 0}
<p class="empty">{emptyHint}</p>
{:else}
<div class="grid">
{#each visible as opt (opt.path)}
{@const selected = opt.path === value}
{@const src = assetUrl(opt.path)}
{@const isVideo = (opt.kind ?? kind) === 'video'}
<button
type="button"
class="card"
class:selected
onclick={() => pick(opt.path)}
title={opt.label}
>
<div class="thumb">
{#if isVideo}
<!-- svelte-ignore a11y_media_has_caption -->
<video src={src} muted playsinline preload="metadata" onerror={hideBroken}></video>
{:else if (opt.kind ?? kind) === 'audio'}
<Icon name="music" size={28} />
{:else}
<img src={src} alt="" onerror={hideBroken} />
{/if}
{#if selected}
<span class="check"><Icon name="check" size={12} /></span>
{/if}
</div>
<span class="name">{assetDisplayName(opt)}</span>
</button>
{/each}
</div>
{/if}
</div>
</div>
{#snippet footer()}
{#if value && onclear}
<Button variant="ghost" onclick={clear}>Clear slot</Button>
{/if}
{#if allowUpload}
<Button variant="secondary" onclick={upload}>
<Icon name="upload" size={14} />
Upload new…
</Button>
{/if}
<Button variant="ghost" onclick={() => (open = false)}>Cancel</Button>
{/snippet}
</Modal>
<style>
.picker {
display: flex;
flex-direction: column;
gap: 12px;
min-height: 320px;
}
.tabs {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.tabs button {
display: inline-flex;
align-items: center;
gap: 6px;
background: var(--bg-elevated);
border: 1px solid var(--border);
color: var(--text-secondary);
border-radius: var(--radius-sm);
padding: 7px 12px;
cursor: pointer;
min-height: 34px;
font: inherit;
font-size: 13px;
}
.tabs button.active {
background: var(--accent);
border-color: var(--accent);
color: #fff;
}
.tabs button:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.count {
font-size: 11px;
opacity: 0.8;
font-variant-numeric: tabular-nums;
}
.search {
display: flex;
align-items: center;
gap: 8px;
padding: 0 10px;
min-height: 36px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--bg-elevated);
color: var(--text-muted);
}
.search input {
flex: 1;
min-width: 0;
border: none;
background: transparent;
color: var(--text-primary);
font: inherit;
font-size: 13px;
outline: none;
}
.search:focus-within {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-glow);
}
.grid-wrap {
overflow-y: auto;
overscroll-behavior: contain;
max-height: min(52vh, 480px);
min-height: 200px;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
gap: 10px;
}
.card {
display: flex;
flex-direction: column;
gap: 6px;
padding: 0;
border: none;
background: transparent;
color: inherit;
font: inherit;
text-align: left;
cursor: pointer;
}
.thumb {
position: relative;
aspect-ratio: 1;
border-radius: var(--radius-md);
border: 1.5px solid var(--border);
background: var(--bg-elevated);
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-muted);
}
.card:hover .thumb {
border-color: var(--text-muted);
}
.card.selected .thumb {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-glow);
}
.card:focus-visible .thumb {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.thumb img,
.thumb video {
width: 100%;
height: 100%;
object-fit: cover;
}
.check {
position: absolute;
top: 6px;
right: 6px;
width: 20px;
height: 20px;
border-radius: 9999px;
background: var(--accent);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
.name {
font-size: 12px;
color: var(--text-secondary);
line-height: 1.3;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 2px;
}
.card.selected .name {
color: var(--text-primary);
font-weight: 600;
}
.empty {
margin: 48px 8px;
text-align: center;
color: var(--text-muted);
font-size: 13px;
line-height: 1.45;
}
</style>
@@ -1,22 +1,17 @@
<script lang="ts">
/**
* MediaTile — square thumbnail for image/ref/audio inputs.
*
* Asset picker menu is portaled to document.body so OmniComposer
* overflow:hidden cannot clip it (same fix as PillSelect).
* Clicking opens a tabbed asset picker modal (characters / environments /
* items / uploads) instead of a clipped dropdown.
*/
import { assetUrl } from '$lib/api';
import type { AssetOption } from '$lib/assetPicker';
import type { ComfyDynamicInput } from '$lib/comfy/types';
import AssetPickerModal from './AssetPickerModal.svelte';
import Icon from '$lib/components/ui/Icon.svelte';
import Spinner from '$lib/components/ui/Spinner.svelte';
import { acceptForKind } from '$lib/comfy/useUpload.svelte';
interface AssetOption {
label: string;
path: string;
kind?: 'image' | 'video' | 'audio';
}
interface Props {
input: ComfyDynamicInput;
value: string;
@@ -43,19 +38,15 @@
let fileInput = $state<HTMLInputElement | null>(null);
let dragOver = $state(false);
let showAssetMenu = $state(false);
let tileEl = $state<HTMLElement | null>(null);
let menuEl = $state<HTMLElement | null>(null);
let menuPos = $state({ top: 0, left: 0, maxHeight: 280, minWidth: 200 });
let pickerOpen = $state(false);
function openPicker(e: MouseEvent) {
e.stopPropagation();
function openPicker() {
if (uploadingName) return;
if (matchingAssets.length) {
showAssetMenu = !showAssetMenu;
} else if (allowUpload) {
fileInput?.click();
if (matchingAssets.length || allowUpload) {
pickerOpen = true;
return;
}
fileInput?.click();
}
function onFileChosen(e: Event) {
@@ -83,74 +74,10 @@
const isImageKind = $derived(input.kind === 'image' || input.kind === 'image_url');
const isVideoKind = $derived(input.kind === 'video');
const matchingAssets = $derived(
assetOptions.filter((o) => !o.kind || o.kind === input.kind || (isImageKind && o.kind === 'image')),
assetOptions.filter(
(o) => !o.kind || o.kind === input.kind || (isImageKind && o.kind === 'image'),
),
);
const hasAssets = $derived(matchingAssets.length > 0);
function placeMenu() {
if (!tileEl || !menuEl) return;
const rect = tileEl.getBoundingClientRect();
const gap = 6;
const pad = 8;
const spaceBelow = window.innerHeight - rect.bottom - gap - pad;
const spaceAbove = rect.top - gap - pad;
const preferred = Math.min(320, Math.max(menuEl.scrollHeight, 80));
const openUp = spaceBelow < Math.min(preferred, 160) && spaceAbove > spaceBelow;
const maxHeight = Math.max(120, openUp ? spaceAbove : spaceBelow);
const h = Math.min(menuEl.scrollHeight, maxHeight);
const minWidth = Math.max(200, rect.width);
let top = openUp ? rect.top - h - gap : rect.bottom + gap;
let left = rect.left;
left = Math.max(pad, Math.min(left, window.innerWidth - minWidth - pad));
top = Math.max(pad, Math.min(top, window.innerHeight - Math.min(h, maxHeight) - pad));
menuPos = { top, left, maxHeight, minWidth };
}
function onWindowClick(e: MouseEvent) {
if (!showAssetMenu) return;
const t = e.target as Node;
if (tileEl?.contains(t) || menuEl?.contains(t)) return;
showAssetMenu = false;
}
function onKey(e: KeyboardEvent) {
if (e.key === 'Escape') showAssetMenu = false;
}
$effect(() => {
if (!showAssetMenu || !menuEl) return;
document.body.appendChild(menuEl);
return () => {
menuEl?.remove();
};
});
$effect(() => {
if (!showAssetMenu) return;
const t = window.setTimeout(() => {
placeMenu();
window.addEventListener('click', onWindowClick);
window.addEventListener('keydown', onKey);
window.addEventListener('resize', placeMenu);
window.addEventListener('scroll', placeMenu, true);
}, 0);
return () => {
clearTimeout(t);
window.removeEventListener('click', onWindowClick);
window.removeEventListener('keydown', onKey);
window.removeEventListener('resize', placeMenu);
window.removeEventListener('scroll', placeMenu, true);
};
});
$effect(() => {
if (showAssetMenu && menuEl && tileEl) {
void assetOptions.length;
requestAnimationFrame(placeMenu);
}
});
const displayLabel = $derived(
input.role === 'character'
@@ -167,7 +94,7 @@
const accept = $derived(acceptForKind(input.kind));
</script>
<div class="tile-wrap" bind:this={tileEl}>
<div class="tile-wrap">
<input
bind:this={fileInput}
type="file"
@@ -176,8 +103,6 @@
onchange={onFileChosen}
/>
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="tile"
class:filled={!!value}
@@ -191,11 +116,17 @@
ondragover={(e) => e.preventDefault()}
ondrop={onDrop}
onclick={openPicker}
onkeydown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
openPicker();
}
}}
role="button"
tabindex="0"
title={displayLabel}
aria-haspopup={matchingAssets.length ? 'menu' : undefined}
aria-expanded={matchingAssets.length ? showAssetMenu : undefined}
aria-haspopup="dialog"
aria-expanded={pickerOpen}
>
{#if uploadingName}
<div class="tile-uploading">
@@ -238,48 +169,17 @@
{/if}
</div>
{#if showAssetMenu && hasAssets}
<div
bind:this={menuEl}
class="asset-menu"
style="top: {menuPos.top}px; left: {menuPos.left}px; max-height: {menuPos.maxHeight}px; min-width: {menuPos.minWidth}px"
role="menu"
>
{#each matchingAssets as opt (opt.path)}
<button
type="button"
class="asset-item"
class:active={opt.path === value}
role="menuitem"
onclick={(e) => {
e.stopPropagation();
onselectAsset(opt.path);
showAssetMenu = false;
}}
>
<span class="item-label">{opt.label}</span>
{#if opt.path === value}
<Icon name="check" size={14} />
{/if}
</button>
{/each}
{#if allowUpload}
<button
type="button"
class="asset-item upload-opt"
role="menuitem"
onclick={(e) => {
e.stopPropagation();
showAssetMenu = false;
fileInput?.click();
}}
>
<Icon name="upload" size={12} />
Upload new…
</button>
{/if}
</div>
{/if}
<AssetPickerModal
bind:open={pickerOpen}
title="Choose {displayLabel}"
assets={matchingAssets}
{value}
kind={input.kind}
{allowUpload}
onselect={onselectAsset}
onupload={() => fileInput?.click()}
onclear={value ? onclear : undefined}
/>
<style>
.tile-wrap {
@@ -395,64 +295,6 @@
font-weight: 600;
}
.asset-menu {
position: fixed;
z-index: 10000;
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
box-shadow:
0 8px 24px rgba(0, 0, 0, 0.5),
0 0 0 1px rgba(0, 0, 0, 0.3);
padding: 4px;
display: flex;
flex-direction: column;
gap: 2px;
overflow-y: auto;
overscroll-behavior: contain;
}
.asset-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 8px 12px;
border-radius: var(--radius-sm);
background: transparent;
border: none;
color: var(--text-secondary);
font-size: 12px;
font-family: var(--font-body);
cursor: pointer;
text-align: left;
width: 100%;
}
.item-label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.asset-item:hover {
background: var(--bg-elevated);
color: var(--text-primary);
}
.asset-item.active {
color: var(--accent);
font-weight: 600;
}
.upload-opt {
color: var(--text-muted);
border-top: 1px solid var(--border);
margin-top: 2px;
padding-top: 10px;
border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.sr-only {
position: absolute;
width: 1px;
@@ -5,6 +5,7 @@
interface Props {
open?: boolean;
title?: string;
size?: 'md' | 'lg';
dismissible?: boolean;
onclose?: () => void;
footer?: Snippet;
@@ -14,6 +15,7 @@
let {
open = $bindable(false),
title,
size = 'md',
dismissible = true,
onclose,
footer,
@@ -96,7 +98,7 @@
<div class="modal-backdrop" onclick={handleBackdropClick}>
<div
bind:this={panel}
class="modal-panel"
class="modal-panel size-{size}"
role="dialog"
aria-modal="true"
aria-labelledby={title ? titleId : undefined}
@@ -158,6 +160,9 @@
outline: none;
animation: modal-rise 180ms ease-out;
}
.modal-panel.size-lg {
width: min(920px, 100%);
}
.modal-header {
display: flex;
align-items: center;
@@ -20,6 +20,7 @@
status: string;
heading: string;
orderIndex: number;
sceneId?: number;
progress?: Progress | null;
error?: string;
errorLong?: boolean;
@@ -30,6 +31,7 @@
status,
heading,
orderIndex,
sceneId,
progress = null,
error = '',
errorLong = false,
@@ -52,6 +54,9 @@
{:else}
<div class="empty">
<span class="slate">#{orderIndex}</span>
{#if sceneId != null}
<p class="sid">scene_id {sceneId}</p>
{/if}
<p class="title">{heading || 'Untitled'}</p>
{#if status === 'pending' || status === 'running'}
<div class="busy" aria-busy="true">
@@ -84,6 +89,12 @@
{/if}
</div>
<div class="ids">
<span>#{orderIndex}</span>
{#if sceneId != null}
<span class="ids-db">id {sceneId}</span>
{/if}
</div>
{#if previewUrl}
<div class="foot">
<a class="dl" href={previewUrl} download>
@@ -143,6 +154,15 @@
margin-bottom: 6px;
}
.sid {
margin: 0 0 8px;
font-family: var(--font-mono);
font-size: 11px;
font-weight: 600;
letter-spacing: 0.04em;
color: var(--text-muted);
}
.title {
margin: 0 0 8px;
font-size: 14px;
@@ -204,6 +224,23 @@
overflow-y: auto;
}
.ids {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 2px 0;
font-family: var(--font-mono);
font-size: 12px;
font-weight: 700;
color: var(--accent);
flex-shrink: 0;
}
.ids-db {
font-weight: 600;
color: var(--text-muted);
}
.foot {
display: flex;
justify-content: flex-end;
@@ -73,7 +73,7 @@
class:selected={selectedId === scene.id}
class:chained={chained(scene)}
onclick={() => onSelect(scene.id)}
title={`${scene.heading || 'Scene'} · ${formatClock(scene.duration_sec || 5)}`}
title={`#${scene.order_index} · id ${scene.id} · ${scene.heading || 'Scene'} · ${formatClock(scene.duration_sec || 5)}`}
>
<span class="bar" aria-hidden="true"></span>
<span class="thumb" aria-hidden="true">
@@ -88,7 +88,7 @@
</span>
<span class="meta">
<span class="num">#{scene.order_index}</span>
<span class="dur">{formatClock(scene.duration_sec || 5)}</span>
<span class="sid">id {scene.id}</span>
</span>
</button>
{/each}
@@ -99,7 +99,7 @@
<Icon name="chevron-left" size={14} /> Prev
</Button>
<span class="pos">
{selected ? `Scene ${selected.order_index} of ${scenes.length}` : '—'}
{selected ? `#${selected.order_index} of ${scenes.length} · id ${selected.id}` : '—'}
</span>
<Button variant="ghost" size="sm" disabled={!selected} onclick={() => onStep(1)}>
Next <Icon name="chevron-right" size={14} />
@@ -232,9 +232,10 @@
color: var(--accent);
}
.dur {
.sid {
font-family: var(--font-mono);
font-size: 10px;
font-size: 9px;
font-weight: 600;
color: var(--text-muted);
}
@@ -248,7 +249,7 @@
.pos {
font-size: 12px;
color: var(--text-secondary);
min-width: 12ch;
min-width: 22ch;
text-align: center;
}
</style>
@@ -21,6 +21,7 @@
<div class="meta-wrap">
<div class="row">
<span class="num mono">#{scene.order_index}</span>
<span class="sid mono">id {scene.id}</span>
<span class="heading" title={scene.heading || 'Untitled scene'}>
{scene.heading || 'Untitled scene'}
</span>
@@ -98,6 +99,13 @@
flex-shrink: 0;
}
.sid {
font-size: 11px;
font-weight: 600;
color: var(--text-muted);
flex-shrink: 0;
}
.heading {
flex: 1;
min-width: 0;
@@ -6,18 +6,13 @@
*/
import type { Scene, Workflow } from '$lib/api';
import OmniComposer from '$lib/components/OmniComposer.svelte';
import type { AssetOption } from '$lib/assetPicker';
import ClipMonitor from './ClipMonitor.svelte';
import SceneFilmstrip from './SceneFilmstrip.svelte';
import SceneScriptDrawer from './SceneScriptDrawer.svelte';
type Thumb = { kind: 'image' | 'video'; src: string } | null;
interface AssetOption {
label: string;
path: string;
kind?: 'image' | 'video' | 'audio';
}
interface Progress {
progress?: number;
message?: string;
@@ -89,6 +84,7 @@
{status}
heading={selected.heading || 'Untitled'}
orderIndex={selected.order_index}
sceneId={selected.id}
{progress}
{error}
{errorLong}