merge: 合并主分支更新 (shot brief 展示、README 截图)

This commit is contained in:
happymy
2026-09-13 08:26:02 +08:00
12 changed files with 460 additions and 66 deletions
@@ -37,6 +37,8 @@ export const icons = {
'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>',
paperclip:
'<path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/>',
copy:
'<rect x="8" y="8" width="14" height="14" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/>',
'external-link':
'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><path d="M15 3h6v6"/><path d="M10 14 21 3"/>',
@@ -1,13 +1,10 @@
<script module lang="ts">
import type { Clip, Scene } from '$lib/api';
/** One entry in the strip: a renderable clip pinned to its parent scene. */
export interface FilmstripClip {
clip: {
id: number;
clip_path: string | null;
duration_sec: number | null;
chain_from_prev?: number | boolean | null;
};
scene: import('$lib/api').Scene;
clip: Clip;
scene: Scene;
index: number;
label: string;
}
@@ -19,7 +16,6 @@
* Renders CLIPS (playback order, `#3.2` labels) with scene-divider grouping.
* Never sticky; fixed height; keyboard Left/Right/Home/End.
*/
import type { Scene } from '$lib/api';
import Button from '$lib/components/ui/Button.svelte';
import Icon from '$lib/components/ui/Icon.svelte';
import { t } from '$lib/i18n.svelte';
@@ -93,11 +89,11 @@
class:selected={selectedClipId === entry.clip.id}
class:chained={entry.index > 0}
onclick={() => onSelectClip(entry.clip.id)}
title={t('filmstrip.clipTitle', {
scene: `${entry.scene.order_index} · ${entry.scene.heading || t('filmstrip.scene')}`,
shot: entry.index + 1,
time: formatClock(entry.clip.duration_sec || 5),
})}
title={t('filmstrip.clipTitle', {
scene: `${entry.scene.order_index} · ${entry.scene.heading || t('filmstrip.scene')}`,
shot: entry.index + 1,
time: formatClock(entry.clip.duration_sec || 5),
}) + (entry.clip.description ? `\n${entry.clip.description}` : '')}
>
<span class="bar" aria-hidden="true"></span>
<span class="thumb" aria-hidden="true">
@@ -0,0 +1,290 @@
<script lang="ts">
/**
* ShotBrief — the selected clip's production brief in the Video composer.
*
* Clips are render units: each performs one beat of a scene. Without this
* panel the per-clip content (what the camera sees, the shot size, the
* dialog lines it carries) was only visible in the monitor's empty state —
* truncated, and gone as soon as a render existed. Surfacing it here is
* what tells a user what to write into the workflow's prompt field.
*/
import type { Clip, Scene } from '$lib/api';
import Icon from '$lib/components/ui/Icon.svelte';
import { t } from '$lib/i18n.svelte';
interface Props {
clip: Clip;
scene: Scene;
/** Display label, e.g. '#3.2'. */
label: string;
formatClock: (sec: number) => string;
}
let { clip, scene, label, formatClock }: Props = $props();
let open = $state(false);
let copied = $state(false);
let copyTimer: ReturnType<typeof setTimeout> | null = null;
const description = $derived((clip.description ?? '').trim());
/** Un-expanded (legacy) clips carry no per-shot description — fall back to the scene action. */
const sceneLevel = $derived(!description && Boolean((scene.action ?? '').trim()));
const body = $derived(description || (scene.action ?? '').trim());
/** Same contract as the backend's `_clip_dialog`: 1-based indexes into the non-empty dialog lines. */
const coveredLines = $derived.by(() => {
const covered = clip.dialog_lines_covered;
if (!covered || covered.length === 0) return [];
const lines = (scene.dialog ?? '').split(/\r?\n/).filter((l) => l.trim());
return covered
.filter((i) => Number.isInteger(i) && i >= 1 && i <= lines.length)
.map((i) => lines[i - 1]);
});
const shotSizeLabel = $derived(
clip.shot_size ? clip.shot_size.replace(/([A-Z])/g, ' $1').trim() : '',
);
async function copyBody() {
if (!body) return;
try {
await navigator.clipboard.writeText(body);
copied = true;
if (copyTimer) clearTimeout(copyTimer);
copyTimer = setTimeout(() => (copied = false), 1500);
} catch {
/* clipboard blocked (insecure context) — leave the button as-is */
}
}
</script>
<div class="brief">
<div class="head">
<span class="label mono">{label}</span>
{#if shotSizeLabel}
<span class="pill">{shotSizeLabel}</span>
{/if}
<span class="dur mono">{formatClock(clip.duration_sec || 5)}</span>
<span class="grow"></span>
<button
type="button"
class="icon-btn"
disabled={!body}
title={copied ? t('shotBrief.copied') : t('shotBrief.copyTitle')}
aria-label={t('shotBrief.copyTitle')}
onclick={copyBody}
>
<Icon name={copied ? 'check' : 'copy'} size={13} />
<span class="icon-btn-text">{copied ? t('shotBrief.copied') : t('shotBrief.copy')}</span>
</button>
<button
type="button"
class="icon-btn"
class:open
aria-expanded={open}
title={open ? t('shotBrief.collapse') : t('shotBrief.expand')}
onclick={() => (open = !open)}
>
<Icon name={open ? 'chevron-up' : 'chevron-down'} size={13} />
</button>
</div>
<p class="desc" class:clamped={!open}>
{#if body}
{body}
{:else}
<span class="muted">{t('shotBrief.noDesc')}</span>
{/if}
</p>
{#if open}
{#if sceneLevel}
<p class="note">
{t('shotBrief.notePre')}
<span class="mono">{t('shotBrief.breakIntoShots')}</span>
{t('shotBrief.notePost')}
</p>
{/if}
{#if coveredLines.length}
<div class="block">
<span class="k">{t('shotBrief.dialogKey')}</span>
<pre class="dialog">{coveredLines.join('\n')}</pre>
</div>
{/if}
{#if (scene.characters ?? []).length}
<div class="block">
<span class="k">{t('shotBrief.characters')}</span>
<div class="chips">
{#each scene.characters as c (c.id)}
<span class="chip">{c.name}</span>
{/each}
</div>
</div>
{/if}
{/if}
</div>
<style>
.brief {
flex-shrink: 0;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--bg-surface);
padding: 8px 10px;
margin: 0;
}
.head {
display: flex;
align-items: center;
gap: 8px;
min-height: 20px;
}
.label {
font-size: 12px;
font-weight: 700;
color: var(--accent);
flex-shrink: 0;
}
.pill {
padding: 1px 8px;
border-radius: 999px;
border: 1px solid var(--border);
background: var(--bg-elevated);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--text-secondary);
flex-shrink: 0;
}
.dur {
font-size: 11px;
font-weight: 600;
color: var(--text-muted);
flex-shrink: 0;
}
.grow {
flex: 1;
min-width: 0;
}
.icon-btn {
display: inline-flex;
align-items: center;
gap: 4px;
height: 24px;
padding: 0 8px;
font: inherit;
font-size: 11px;
font-weight: 600;
color: var(--text-secondary);
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
cursor: pointer;
flex-shrink: 0;
}
.icon-btn:hover:not(:disabled),
.icon-btn.open {
color: var(--text-primary);
border-color: var(--text-muted);
}
.icon-btn:disabled {
opacity: 0.5;
cursor: default;
}
.icon-btn:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.icon-btn-text {
line-height: 1;
}
.desc {
margin: 6px 0 0;
font-size: 12.5px;
line-height: 1.45;
color: var(--text-secondary);
white-space: pre-wrap;
word-break: break-word;
}
.desc.clamped {
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.muted {
color: var(--text-muted);
}
.note {
margin: 8px 0 0;
font-size: 11.5px;
line-height: 1.45;
color: var(--text-muted);
}
.block {
margin-top: 8px;
}
.block .k {
display: block;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--text-muted);
margin-bottom: 4px;
}
.dialog {
margin: 0;
padding: 6px 8px;
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
font-family: var(--font-mono);
font-size: 11.5px;
line-height: 1.45;
white-space: pre-wrap;
color: var(--text-primary);
max-height: 90px;
overflow-y: auto;
}
.chips {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.chip {
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: 999px;
padding: 1px 9px;
font-size: 11px;
color: var(--text-secondary);
}
.mono {
font-family: var(--font-mono);
}
</style>
@@ -14,7 +14,8 @@
import PromptPreviewModal from './PromptPreviewModal.svelte';
import SceneFilmstrip, { type FilmstripClip } from './SceneFilmstrip.svelte';
import SceneScriptDrawer from './SceneScriptDrawer.svelte';
import { t } from '$lib/i18n.svelte';
import { t } from '$lib/i18n.svelte';
import ShotBrief from './ShotBrief.svelte';
type Thumb = { kind: 'image' | 'video'; src: string } | null;
@@ -145,34 +146,36 @@
</script>
<div class="workspace">
<div class="hero">
<ClipMonitor
{previewPath}
{status}
heading={(selectedClip?.clip.description || selected.heading || t('clipMonitor.untitled')).slice(0, 80)}
orderIndex={selected.order_index}
label={selectedClip?.label}
idLabel={selectedClip ? t('videoEdit.clipId', { id: selectedClip.clip.id }) : t('videoEdit.sceneId', { id: selected.id })}
sceneId={selectedClip?.scene.id ?? selected?.id}
{progress}
{error}
{errorLong}
<div class="preview-col">
<div class="hero">
<ClipMonitor
{previewPath}
{status}
heading={(selectedClip?.clip.description || selected.heading || t('clipMonitor.untitled')).slice(0, 80)}
orderIndex={selected.order_index}
label={selectedClip?.label}
idLabel={selectedClip ? t('videoEdit.clipId', { id: selectedClip.clip.id }) : selected ? t('videoEdit.sceneId', { id: selected.id }) : undefined}
sceneId={selectedClip?.scene.id ?? selected?.id}
{progress}
{error}
{errorLong}
/>
</div>
<SceneFilmstrip
clips={filmClips}
{selectedClipId}
{statusOfClip}
{thumbForClip}
{formatClock}
{onSelectClip}
{onStep}
/>
<SceneScriptDrawer scene={selected} {status} {formatClock} />
</div>
<SceneFilmstrip
clips={filmClips}
{selectedClipId}
{statusOfClip}
{thumbForClip}
{formatClock}
{onSelectClip}
{onStep}
/>
<SceneScriptDrawer scene={selected} {status} {formatClock} />
<div class="composer-dock">
<aside class="dock-col" aria-label={t('videoEdit.dockAria')}>
{#if workflow}
{#if generateDisabled}
<div class="continue-warning" role="alert">
@@ -183,7 +186,7 @@
</div>
</div>
{:else if clipSource?.enabled}
<div class="clip-source-row">
<div class="clip-source-row">
<span class="clip-source-label" id="clip-source-label">{t('videoEdit.videoSource')}</span>
<button
type="button"
@@ -236,21 +239,29 @@
applying={applying}
/>
{/if}
{#if selectedClip}
<ShotBrief
clip={selectedClip.clip}
scene={selectedClip.scene}
label={selectedClip.label}
{formatClock}
/>
{/if}
<OmniComposer
inputs={workflow.input_schema}
bind:values={formValues}
{workflow}
{workflows}
onWorkflowChange={onWorkflowChange}
{assetOptions}
{allowUpload}
generateLabel={generateLabel || t('videoEdit.generateLabel')}
{submitting}
disabled={generateDisabled}
generateDisabledHint={generateDisabledReason}
onChange={onFormChange}
onSubmit={onPreviewPrompt ?? onGenerate}
/>
{assetOptions}
{allowUpload}
generateLabel={generateLabel || t('videoEdit.generateLabel')}
{submitting}
disabled={generateDisabled}
generateDisabledHint={generateDisabledReason}
onChange={onFormChange}
onSubmit={onPreviewPrompt ?? onGenerate}
/>
{:else}
<div class="no-wf">
<p class="empty-title">{t('videoEdit.noWf')}</p>
@@ -259,22 +270,33 @@
</p>
</div>
{/if}
</div>
</aside>
</div>
<style>
/* Two columns: the player + strip own the left, every generation input
lives in the right inspector so it can't push the player out of view. */
.workspace {
flex: 1;
min-height: 0;
display: flex;
flex-direction: row;
gap: 12px;
overflow: hidden;
}
.preview-col {
flex: 1 1 auto;
min-width: 0;
display: flex;
flex-direction: column;
gap: 10px;
overflow: hidden;
}
.hero {
flex: 1;
min-height: 140px;
flex: 1 1 auto;
min-height: 200px;
display: flex;
align-items: stretch;
justify-content: stretch;
@@ -282,21 +304,45 @@
width: 100%;
}
.composer-dock {
flex-shrink: 0;
min-height: 0;
/* Inspector — scrolls on its own so the player keeps the height. */
.dock-col {
flex: 0 0 clamp(300px, 34%, 400px);
min-width: 280px;
display: flex;
flex-direction: column;
gap: 8px;
overflow-y: auto;
overscroll-behavior: contain;
padding-right: 2px;
}
.composer-dock :global(.omni-shell) {
.dock-col :global(.omni-shell) {
flex-shrink: 0;
}
/* Very narrow: stack, player first. */
@media (max-width: 900px) {
.workspace {
flex-direction: column;
overflow-y: auto;
}
.preview-col {
overflow: visible;
}
.dock-col {
flex: 0 0 auto;
overflow: visible;
}
}
.continue-warning {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 10px 12px;
margin: 0 0 8px;
margin: 0;
border-radius: var(--radius-md);
border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--border));
background: color-mix(in srgb, var(--warning) 10%, var(--bg-surface));
@@ -325,7 +371,7 @@
display: flex;
align-items: center;
gap: 8px;
margin: 0 0 8px;
margin: 0;
}
.clip-source-label {
@@ -338,7 +384,8 @@
display: inline-flex;
align-items: center;
gap: 8px;
max-width: 360px;
max-width: 100%;
min-width: 0;
padding: 6px 12px;
font: inherit;
font-size: 13px;
@@ -369,7 +416,7 @@
}
.asset-hint {
margin: 0 0 8px;
margin: 0;
font-size: 12px;
color: var(--text-muted);
line-height: 1.4;
@@ -378,7 +425,7 @@
.job-inputs-row {
display: flex;
justify-content: flex-end;
margin: 0 0 6px;
margin: 0;
}
.job-inputs-trigger {
+14
View File
@@ -745,6 +745,20 @@ export const en = {
'videoEdit.assetHint': 'Pick the generation target',
'videoEdit.continueHint': 'Continue with the selected workflow',
'videoEdit.viewPrompt': 'View prompt',
'videoEdit.dockAria': 'Clip generation inputs',
// --- Shot brief ---
'shotBrief.copyTitle': 'Copy shot description',
'shotBrief.copied': 'Copied',
'shotBrief.copy': 'Copy',
'shotBrief.collapse': 'Collapse shot brief',
'shotBrief.expand': 'Expand shot brief',
'shotBrief.noDesc': 'No shot description — this clip inherited the scene defaults.',
'shotBrief.notePre': 'This clip has no per-shot description yet — the text above is the full scene action. Use',
'shotBrief.breakIntoShots': 'Break into shots',
'shotBrief.notePost': 'in the Script stage to split it into coverage.',
'shotBrief.dialogKey': 'Dialog in this shot',
'shotBrief.characters': 'Characters',
// --- Prompt preview modal ---
'promptPreview.title': 'Prompt preview',
+14
View File
@@ -745,6 +745,20 @@ export const zh: Dict = {
'videoEdit.assetHint': '选择生成目标',
'videoEdit.continueHint': '使用所选工作流继续',
'videoEdit.viewPrompt': '查看提示词',
'videoEdit.dockAria': '片段生成输入',
// --- Shot brief ---
'shotBrief.copyTitle': '复制镜头描述',
'shotBrief.copied': '已复制',
'shotBrief.copy': '复制',
'shotBrief.collapse': '收起镜头简报',
'shotBrief.expand': '展开镜头简报',
'shotBrief.noDesc': '此镜头没有描述——沿用了场次默认值。',
'shotBrief.notePre': '此镜头暂无独立描述——上方文本即完整场次动作。可在剧本舞台使用',
'shotBrief.breakIntoShots': '拆分为镜头',
'shotBrief.notePost': '将其拆分为覆盖镜头。',
'shotBrief.dialogKey': '本镜头对白',
'shotBrief.characters': '角色',
// --- Prompt preview modal ---
'promptPreview.title': '提示词预览',