AI media harness for planning, generating, and editing locally
TypeScript
Rebuild the timeline as a dense Fluent editor with zoom, shortcuts and menus
Bittidc2c12c09db5
diff --git a/src/components/workspace/ClipEffects.test.tsx b/src/components/workspace/ClipEffects.test.tsxindex b4b1e65..ceafe6a 100644--- a/src/components/workspace/ClipEffects.test.tsx+++ b/src/components/workspace/ClipEffects.test.tsx@@ -1,10 +1,12 @@// @vitest-environment jsdom-import { cleanup, fireEvent, render, screen, within, waitFor } from "@testing-library/react";+import { act, cleanup, fireEvent, render, screen, within, waitFor } from "@testing-library/react";import { useState } from "react";import { afterEach, describe, expect, it, vi } from "vitest";import { timelineClipSchema, type TimelineClip } from "../../lib/project";import { ClipEffects } from "./ClipEffects";+vi.mock("@tauri-apps/api/core", () => ({ invoke: vi.fn() }));+afterEach(cleanup);const original: TimelineClip = {id: "clip", assetId: "asset", trackId: "video", label: "Clip", startMs: 0,@@ -14,96 +16,144 @@ function Harness() {const [clip, setClip] = useState(original);return <><ClipEffects clip={clip} disabled={false} onChange={(patch) => setClip((current) => timelineClipSchema.parse({ ...current, ...patch }))} /><output data-testid="saved">{JSON.stringify(clip)}</output></>;}+const saved = () => JSON.parse(screen.getByTestId("saved").textContent!);+const add = (name: string) => {+ fireEvent.click(screen.getByRole("button", { name: "Add effect" }));+ fireEvent.click(within(screen.getByRole("group", { name: "Available effects" })).getByRole("button", { name }));+};+const remove = (name: string) => {+ fireEvent.click(screen.getByRole("button", { name: `${name} options` }));+ fireEvent.click(screen.getByRole("menuitem", { name: /Remove/ }));+};++/* pickFile and readLutFile both go through invoke once the page believes it is+ inside Tauri: pick_file answers with a path, read_lut_file with its text. */+async function inTauri(answers: Record<string, (args: unknown) => unknown>, body: () => Promise<void>) {+ const { invoke } = await import("@tauri-apps/api/core");+ (window as unknown as Record<string, unknown>).__TAURI_INTERNALS__ = {};+ vi.mocked(invoke).mockImplementation(async (command: string, args?: unknown) => answers[command]?.(args) as never);+ try { await body(); } finally {+ delete (window as unknown as Record<string, unknown>).__TAURI_INTERNALS__;+ vi.mocked(invoke).mockReset();+ }+}++const CUBE = "LUT_3D_SIZE 2\n0 0 0\n1 0 0\n0 1 0\n1 1 0\n0 0 1\n1 0 1\n0 1 1\n1 1 1";describe("clip effects", () => {- it("adds, edits and removes the new effects independently", () => {+ it("adds, edits and removes effects independently", () => {render(<Harness />);- for (const name of [/Sharpen Enhance/, /Gaussian Blur Soften/, /Color Correction Adjust/, /Vignette Darken/]) {- fireEvent.click(screen.getByRole("button", { name: "Add Effect" }));- fireEvent.click(screen.getByRole("button", { name }));- }+ for (const name of ["Sharpen", "Gaussian blur", "Colour correction", "Vignette"]) add(name);fireEvent.change(screen.getByLabelText("Sharpen amount"), { target: { value: "120" } });fireEvent.change(screen.getByLabelText("Blur radius"), { target: { value: "6.5" } });fireEvent.change(screen.getByLabelText("Exposure"), { target: { value: "-1.2" } });fireEvent.change(screen.getByLabelText("Saturation"), { target: { value: "0" } });fireEvent.change(screen.getByLabelText("Vignette amount"), { target: { value: "75" } });- expect(JSON.parse(screen.getByTestId("saved").textContent!)).toMatchObject({+ expect(saved()).toMatchObject({sharpen: { amount: 120 }, blur: { radius: 6.5 }, colorCorrection: { exposure: -1.2, saturation: 0 }, vignette: { amount: 75 },});- fireEvent.click(screen.getByRole("button", { name: "Remove Gaussian Blur effect" }));- expect(JSON.parse(screen.getByTestId("saved").textContent!).blur).toBeUndefined();+ remove("Gaussian blur");+ expect(saved().blur).toBeUndefined();expect(screen.getByLabelText("Sharpen amount")).toBeTruthy();});- it("imports a LUT, adjusts its strength, and preserves it after an invalid replacement", async () => {+ it("gives each effect a collapsible header with Reset", () => {+ render(<Harness />);+ add("Vignette");+ fireEvent.change(screen.getByLabelText("Vignette amount"), { target: { value: "80" } });+ fireEvent.click(screen.getByRole("button", { name: "Reset Vignette" }));+ expect(saved().vignette).toEqual({ amount: 35 });+ const toggle = screen.getByRole("button", { name: "Vignette" });+ expect(toggle.getAttribute("aria-expanded")).toBe("true");+ fireEvent.click(toggle);+ expect(screen.queryByLabelText("Vignette amount")).toBeNull();+ });++ it("describes each effect in a tooltip rather than a second line", () => {render(<Harness />);- fireEvent.click(screen.getByRole("button", { name: "Add Effect" }));- fireEvent.click(screen.getByRole("button", { name: /3D LUT Apply/ }));- const cube = "LUT_3D_SIZE 2\n0 0 0\n1 0 0\n0 1 0\n1 1 0\n0 0 1\n1 0 1\n0 1 1\n1 1 1";- fireEvent.change(screen.getByLabelText("Import cube LUT"), { target: { files: [{ name: "identity.cube", size: cube.length, text: async () => cube }] } });- await screen.findByText("identity.cube · 2³");- fireEvent.change(screen.getByLabelText("LUT intensity"), { target: { value: "45" } });- fireEvent.change(screen.getByLabelText("Import cube LUT"), { target: { files: [{ name: "bad.cube", size: 4, text: async () => "oops" }] } });- await screen.findByRole("alert");- expect(JSON.parse(screen.getByTestId("saved").textContent!).lut).toMatchObject({ intensity: 45, table: { name: "identity.cube", size: 2 } });+ fireEvent.click(screen.getByRole("button", { name: "Add effect" }));+ const item = within(screen.getByRole("group", { name: "Available effects" })).getByRole("button", { name: "Sharpen" });+ expect(item.getAttribute("data-tooltip")).toBe("Enhance fine edges and detail");+ });++ it("imports a LUT through the native Open dialog, and keeps it after a bad replacement", async () => {+ await inTauri({+ pick_file: () => "C:\\Looks\\identity.cube",+ read_lut_file: (args) => ((args as { path: string }).path.endsWith("identity.cube") ? CUBE : "oops"),+ }, async () => {+ render(<Harness />);+ add("3D LUT");+ fireEvent.click(screen.getByRole("button", { name: "Import LUT" }));+ await screen.findByText("identity.cube · 2³");+ const { invoke } = await import("@tauri-apps/api/core");+ expect(vi.mocked(invoke)).toHaveBeenCalledWith("pick_file", { title: "Import LUT", filters: [{ name: "Cube LUT", extensions: ["cube"] }] });+ fireEvent.change(screen.getByLabelText("LUT intensity"), { target: { value: "45" } });+ vi.mocked(invoke).mockImplementation(async (command: string) => (command === "pick_file" ? "C:\\Looks\\bad.cube" : "oops") as never);+ fireEvent.click(screen.getByRole("button", { name: "Replace LUT" }));+ await screen.findByRole("alert");+ expect(saved().lut).toMatchObject({ intensity: 45, table: { name: "identity.cube", size: 2 } });+ });});it("does not apply an outstanding LUT import to a different clip", async () => {let resolve!: (text: string) => void;const pending = new Promise<string>((done) => { resolve = done; });- const onChange = vi.fn();- const view = render(<ClipEffects clip={{ ...original, lut: { intensity: 100 } }} disabled={false} onChange={onChange} />);- fireEvent.change(screen.getByLabelText("Import cube LUT"), { target: { files: [{ name: "identity.cube", size: 50, text: () => pending }] } });- view.rerender(<ClipEffects clip={{ ...original, id: "other", lut: { intensity: 100 } }} disabled={false} onChange={onChange} />);- resolve("LUT_3D_SIZE 2\n" + "0 0 0\n".repeat(8));- await waitFor(() => expect(screen.queryByRole("status")).toBeNull());- expect(onChange).not.toHaveBeenCalled();+ await inTauri({ pick_file: () => "C:\\Looks\\identity.cube", read_lut_file: () => pending }, async () => {+ const onChange = vi.fn();+ const view = render(<ClipEffects clip={{ ...original, lut: { intensity: 100 } }} disabled={false} onChange={onChange} />);+ fireEvent.click(screen.getByRole("button", { name: "Import LUT" }));+ await screen.findByRole("status");+ view.rerender(<ClipEffects clip={{ ...original, id: "other", lut: { intensity: 100 } }} disabled={false} onChange={onChange} />);+ await act(async () => { resolve("LUT_3D_SIZE 2\n" + "0 0 0\n".repeat(8)); });+ await waitFor(() => expect(screen.queryByRole("status")).toBeNull());+ expect(onChange).not.toHaveBeenCalled();+ });});- it("adds only chosen effects, persists edits, and removes them without changing other effects", () => {+ it("picks a chroma key colour from a swatch and a hex field", () => {+ render(<Harness />);+ add("Chroma key");+ fireEvent.click(screen.getByRole("button", { name: "Chroma key colour" }));+ fireEvent.change(screen.getByLabelText("Hex"), { target: { value: "#123456" } });+ fireEvent.change(screen.getByLabelText("Chroma key tolerance"), { target: { value: "43" } });+ expect(saved()).toMatchObject({ chromaKey: { color: "#123456", tolerance: 43 } });+ expect(screen.getByLabelText("Hue")).toBeTruthy();+ expect(screen.getByRole("slider", { name: "Saturation and brightness" })).toBeTruthy();+ });++ it("adds only chosen effects, and removes them without changing other effects", () => {render(<Harness />);expect(screen.queryByRole("heading", { name: "Look" })).toBeNull();- expect(screen.queryByRole("heading", { name: "Transition" })).toBeNull();- fireEvent.click(screen.getByRole("button", { name: "Add Effect" }));- fireEvent.click(screen.getByRole("button", { name: /Chroma Key Make/ }));- fireEvent.change(screen.getByLabelText("Chroma Key color"), { target: { value: "#123456" } });- fireEvent.change(screen.getByLabelText("Chroma Key tolerance"), { target: { value: "43" } });- fireEvent.click(screen.getByRole("button", { name: "Add Effect" }));+ add("Chroma key");+ fireEvent.click(screen.getByRole("button", { name: "Add effect" }));const picker = screen.getByRole("group", { name: "Available effects" });- expect(within(picker).queryByText("Chroma Key")).toBeNull();- fireEvent.click(within(picker).getByRole("button", { name: /Look Opacity/ }));+ expect(within(picker).queryByRole("button", { name: "Chroma key" })).toBeNull();+ fireEvent.click(within(picker).getByRole("button", { name: "Look" }));fireEvent.change(screen.getByLabelText("Clip opacity"), { target: { value: "65" } });- expect(JSON.parse(screen.getByTestId("saved").textContent!)).toMatchObject({ chromaKey: { color: "#123456", tolerance: 43 }, look: { opacity: 65 } });- fireEvent.click(screen.getByRole("button", { name: "Remove Chroma Key effect" }));- const saved = JSON.parse(screen.getByTestId("saved").textContent!);- expect(saved.chromaKey).toBeUndefined();- expect(saved.look.opacity).toBe(65);- fireEvent.click(screen.getByRole("button", { name: "Add Effect" }));- expect(screen.getByRole("button", { name: /Chroma Key Make/ })).toBeTruthy();+ remove("Chroma key");+ expect(saved().chromaKey).toBeUndefined();+ expect(saved().look.opacity).toBe(65);});- it("keeps existing effects editable and closes the keyboard picker with Escape", () => {+ it("keeps existing effects editable and moves through the picker with the arrow keys", () => {render(<ClipEffects clip={{ ...original, transition: { type: "wipe-left", durationMs: 800 } }} disabled={false} onChange={vi.fn()} />);- expect((screen.getByLabelText("Clip transition") as HTMLSelectElement).value).toBe("wipe-left");- fireEvent.click(screen.getByRole("button", { name: "Add Effect" }));- expect(document.activeElement?.textContent).toContain("Look");+ expect(screen.getByRole("combobox", { name: "Clip transition" }).textContent).toContain("Wipe from left");+ fireEvent.click(screen.getByRole("button", { name: "Add effect" }));+ expect(document.activeElement?.textContent).toBe("Look");fireEvent.keyDown(document.activeElement!, { key: "ArrowDown" });- expect(document.activeElement?.textContent).toContain("Chroma Key");- fireEvent.keyDown(document.activeElement!, { key: "Escape" });- expect(screen.queryByRole("group", { name: "Available effects" })).toBeNull();- expect(document.activeElement).toBe(screen.getByRole("button", { name: "Add Effect" }));+ expect(document.activeElement?.textContent).toBe("Chroma key");});it("disables effects for locked or nonvisual clips and closes the picker when selection changes", () => {const props = { onChange: vi.fn(), clip: original, disabled: false };const view = render(<ClipEffects {...props} />);- fireEvent.click(screen.getByRole("button", { name: "Add Effect" }));+ fireEvent.click(screen.getByRole("button", { name: "Add effect" }));view.rerender(<ClipEffects {...props} clip={{ ...original, id: "next" }} />);expect(screen.queryByRole("group", { name: "Available effects" })).toBeNull();view.rerender(<ClipEffects {...props} disabled clip={{ ...original, chromaKey: { color: "#00ff00", tolerance: 20 } }} />);- expect((screen.getByRole("button", { name: "Add Effect" }) as HTMLButtonElement).disabled).toBe(true);- expect((screen.getByRole("button", { name: "Remove Chroma Key effect" }) as HTMLButtonElement).disabled).toBe(true);- fireEvent.change(screen.getByLabelText("Chroma Key tolerance"), { target: { value: "40" } });+ expect((screen.getByRole("button", { name: "Add effect" }) as HTMLButtonElement).disabled).toBe(true);+ expect((screen.getByRole("button", { name: "Chroma key options" }) as HTMLButtonElement).disabled).toBe(true);+ fireEvent.change(screen.getByLabelText("Chroma key tolerance"), { target: { value: "40" } });expect(props.onChange).not.toHaveBeenCalled();});});diff --git a/src/components/workspace/ClipEffects.tsx b/src/components/workspace/ClipEffects.tsxindex b0c3ac5..607f36b 100644--- a/src/components/workspace/ClipEffects.tsx+++ b/src/components/workspace/ClipEffects.tsx@@ -1,52 +1,89 @@-import { Plus, X } from "lucide-react";-import { useEffect, useId, useRef, useState, type ReactNode } from "react";+import { ChevronRight, Ellipsis, FolderOpen, Plus, RotateCcw } from "lucide-react";+import { useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from "react";import { DEFAULT_CLIP_CHROMA_KEY, DEFAULT_CLIP_LOOK, type TimelineClip } from "../../lib/project";-import { MAX_LUT_FILE_BYTES, parseCube } from "../../lib/effectSettings";+import { parseCube } from "../../lib/effectSettings";+import { readLutFile } from "../../lib/exportPipeline";+import { inTauri, pickFile } from "../../lib/nativeShell";+import { ComboBox, Flyout, PropRow, Slider, tooltipProps, useContextMenu } from "../ui";+import { ColorSwatch } from "./ColorPicker";type EffectId = "look" | "transition" | "chromaKey" | "sharpen" | "blur" | "colorCorrection" | "vignette" | "lut";-type EditorProps = { clip: TimelineClip; update: (patch: Partial<TimelineClip>) => void };+type EditorProps = { clip: TimelineClip; update: (patch: Partial<TimelineClip>) => void; disabled: boolean };type EffectDefinition = {id: EffectId;name: string;description: string;defaults: Partial<TimelineClip>;+ /** What Reset writes. Defaults to `defaults`; the LUT keeps its table. */+ reset?: (clip: TimelineClip) => Partial<TimelineClip>;editor: (props: EditorProps) => ReactNode;};-function Slider({ label, value, min = 0, max = 100, step = 1, suffix = "%", onChange }: {- label: string; value: number; min?: number; max?: number; step?: number; suffix?: string; onChange: (value: number) => void;+/** One numeric parameter as an inspector row: the label scrubs, the slider+ * drags, the value reads in tabular figures, and Reset appears once it moves+ * off its default. */+function Param({ label, value, min = 0, max = 100, step = 1, suffix = "%", defaultValue, ariaLabel, disabled, format, onChange }: {+ label: string; value: number; min?: number; max?: number; step?: number; suffix?: string; defaultValue: number;+ ariaLabel?: string; disabled?: boolean; format?: (value: number) => string; onChange: (value: number) => void;}) {- return <label className="range-field"><span>{label} <b>{value}{suffix}</b></span><input aria-label={label} type="range" min={min} max={max} step={step} value={value} onChange={(event) => onChange(Number(event.target.value))} /></label>;+ return <PropRow+ label={label}+ value={value}+ defaultValue={defaultValue}+ onReset={disabled ? undefined : () => onChange(defaultValue)}+ resetLabel={`Reset ${label.toLowerCase()}`}+ scrub={disabled ? undefined : { value, onChange, step, min, max }}+ >+ <Slider aria-label={ariaLabel ?? label} min={min} max={max} step={step} value={value} disabled={disabled} onChange={(next) => onChange(next)} />+ <span className="clip-effect__value">{format ? format(value) : `${value}${suffix}`}</span>+ </PropRow>;}-function LutEditor(props: EditorProps) {+function LutEditor({ clip, update, disabled }: EditorProps) {const [error, setError] = useState<string | null>(null);const [loading, setLoading] = useState(false);- const latest = useRef(props);- latest.current = props;+ const latest = useRef({ clip, update });+ latest.current = { clip, update };const request = useRef(0);useEffect(() => () => { request.current++; }, []);- const lut = props.clip.lut!;+ const lut = clip.lut!;+ /* The native Open dialog, filtered to .cube files, then Rust reads the text+ (the webview cannot open a path itself). Parsing stays here. A clip that+ changes while the file is being read keeps its own LUT. */+ const browse = async () => {+ const token = ++request.current;+ setError(null);+ try {+ const path = await pickFile({ title: "Import LUT", filters: [{ name: "Cube LUT", extensions: ["cube"] }] });+ if (!path || request.current !== token) return;+ setLoading(true);+ const name = path.split(/[\\/]/).pop() ?? path;+ const table = parseCube(await readLutFile(path), name);+ if (request.current === token) latest.current.update({ lut: { ...latest.current.clip.lut!, table } });+ } catch (reason) {+ if (request.current === token) setError(reason instanceof Error ? reason.message : String(reason));+ } finally {+ if (request.current === token) setLoading(false);+ }+ };return <>- <label><span>{lut.table ? "Replace LUT" : "Import LUT"}</span><input aria-label="Import cube LUT" type="file" accept=".cube" onChange={async (event) => {- const file = event.target.files?.[0];- event.target.value = "";- if (!file) return;- const token = ++request.current;- setError(null); setLoading(true);- try {- if (!file.name.toLowerCase().endsWith(".cube")) throw new Error("Choose a 3D .cube LUT file.");- if (file.size > MAX_LUT_FILE_BYTES) throw new Error("LUT files must be smaller than 16 MB.");- const table = parseCube(await file.text(), file.name);- if (request.current === token) latest.current.update({ lut: { ...latest.current.clip.lut!, table } });- } catch (reason) {- if (request.current === token) setError(reason instanceof Error ? reason.message : String(reason));- } finally { if (request.current === token) setLoading(false); }- }} /></label>- {loading && <p role="status">Reading LUT…</p>}- {lut.table ? <p>{lut.table.name} · {lut.table.size}³</p> : <p>Import a 3D .cube LUT (2–65 points). The LUT is saved with the project.</p>}- {error && <p role="alert">{error}</p>}- <Slider label="LUT intensity" value={lut.intensity} onChange={(intensity) => props.update({ lut: { ...lut, intensity } })} />+ <PropRow label="File">+ <span className="clip-effect__file" {...tooltipProps(lut.table ? `${lut.table.name} · ${lut.table.size}³` : "3D .cube LUT, 2–65 points. Saved with the project.")}>+ {loading ? "Reading…" : lut.table ? lut.table.name : "None"}+ </span>+ <button+ type="button"+ className="secondary-button clip-effect__browse"+ disabled={disabled || loading || !inTauri()}+ aria-label={lut.table ? "Replace LUT" : "Import LUT"}+ {...tooltipProps(inTauri() ? "Choose a .cube file" : "Available in the desktop app")}+ onClick={() => void browse()}+ ><FolderOpen size={14} aria-hidden="true" /> Browse…</button>+ </PropRow>+ {loading && <p className="clip-effect__note" role="status">Reading LUT…</p>}+ {lut.table && <p className="clip-effect__note">{lut.table.name} · {lut.table.size}³</p>}+ {error && <p className="clip-effect__note clip-effect__note--error" role="alert">{error}</p>}+ <Param label="Intensity" ariaLabel="LUT intensity" value={lut.intensity} defaultValue={100} disabled={disabled} onChange={(intensity) => update({ lut: { ...lut, intensity } })} /></>;}@@ -54,112 +91,174 @@ function LutEditor(props: EditorProps) {// the effect is absent; older projects with Look/Transition keep their edits.const EFFECTS: readonly EffectDefinition[] = [{- id: "look", name: "Look", description: "Opacity and color temperature",+ id: "look", name: "Look", description: "Opacity and colour temperature",defaults: { look: DEFAULT_CLIP_LOOK },- editor: ({ clip, update }) => {+ editor: ({ clip, update, disabled }) => {const look = clip.look!;return <>- <label className="range-field"><span>Opacity <b>{look.opacity}%</b></span><input aria-label="Clip opacity" type="range" min="0" max="100" step="1" value={look.opacity} onChange={(event) => update({ look: { ...look, opacity: Number(event.target.value) } })} /></label>- <label className="range-field"><span>Temperature <b>{look.temperature > 0 ? "+" : ""}{look.temperature}</b></span><input aria-label="Clip temperature" type="range" min="-100" max="100" step="1" value={look.temperature} onChange={(event) => update({ look: { ...look, temperature: Number(event.target.value) } })} /></label>+ <Param label="Opacity" ariaLabel="Clip opacity" value={look.opacity} defaultValue={DEFAULT_CLIP_LOOK.opacity} disabled={disabled} onChange={(opacity) => update({ look: { ...look, opacity } })} />+ <Param label="Temperature" ariaLabel="Clip temperature" value={look.temperature} min={-100} max={100} defaultValue={DEFAULT_CLIP_LOOK.temperature} disabled={disabled}+ format={(value) => `${value > 0 ? "+" : ""}${value}`} onChange={(temperature) => update({ look: { ...look, temperature } })} /></>;},},{id: "transition", name: "Transition", description: "Fade or wipe into the clip",defaults: { transition: { type: "fade", durationMs: 500 } },- editor: ({ clip, update }) => {+ editor: ({ clip, update, disabled }) => {const transition = clip.transition!;return <>- <label><span>When this clip begins</span><select aria-label="Clip transition" value={transition.type} onChange={(event) => update({ transition: { ...transition, type: event.target.value as typeof transition.type } })}>- <option value="cut">Cut</option><option value="fade">Fade in</option><option value="wipe-left">Wipe from left</option><option value="wipe-right">Wipe from right</option>- </select></label>- <label className="range-field"><span>Duration <b>{transition.durationMs} ms</b></span><input aria-label="Transition duration" type="range" min="100" max="3000" step="100" value={transition.durationMs} disabled={transition.type === "cut"} onChange={(event) => update({ transition: { ...transition, durationMs: Number(event.target.value) } })} /></label>+ <PropRow label="Type">+ <ComboBox aria-label="Clip transition" value={transition.type} disabled={disabled}+ onChange={(type) => update({ transition: { ...transition, type: type as typeof transition.type } })}+ options={[+ { value: "cut", label: "Cut" }, { value: "fade", label: "Fade in" },+ { value: "wipe-left", label: "Wipe from left" }, { value: "wipe-right", label: "Wipe from right" },+ ]} />+ </PropRow>+ <Param label="Duration" ariaLabel="Transition duration" value={transition.durationMs} min={100} max={3000} step={100} suffix=" ms" defaultValue={500}+ disabled={disabled || transition.type === "cut"} onChange={(durationMs) => update({ transition: { ...transition, durationMs } })} /></>;},},{- id: "chromaKey", name: "Chroma Key", description: "Make a selected color transparent",+ id: "chromaKey", name: "Chroma key", description: "Make a selected colour transparent",defaults: { chromaKey: DEFAULT_CLIP_CHROMA_KEY },- editor: ({ clip, update }) => {+ editor: ({ clip, update, disabled }) => {const key = clip.chromaKey!;return <>- <label className="effect-color"><span>Color</span><input aria-label="Chroma Key color" type="color" value={key.color} onChange={(event) => update({ chromaKey: { ...key, color: event.target.value } })} /><code>{key.color.toUpperCase()}</code></label>- <label className="range-field"><span>Tolerance <b>{key.tolerance}%</b></span><input aria-label="Chroma Key tolerance" type="range" min="0" max="100" step="1" value={key.tolerance} onChange={(event) => update({ chromaKey: { ...key, tolerance: Number(event.target.value) } })} /></label>+ <PropRow label="Colour" value={key.color.toLowerCase()} defaultValue={DEFAULT_CLIP_CHROMA_KEY.color.toLowerCase()}+ onReset={disabled ? undefined : () => update({ chromaKey: { ...key, color: DEFAULT_CLIP_CHROMA_KEY.color } })} resetLabel="Reset colour">+ <ColorSwatch label="Chroma key colour" value={key.color} disabled={disabled} onChange={(color) => update({ chromaKey: { ...key, color } })} />+ <code className="clip-effect__value">{key.color.toUpperCase()}</code>+ </PropRow>+ <Param label="Tolerance" ariaLabel="Chroma key tolerance" value={key.tolerance} defaultValue={DEFAULT_CLIP_CHROMA_KEY.tolerance} disabled={disabled} onChange={(tolerance) => update({ chromaKey: { ...key, tolerance } })} /></>;},},{id: "sharpen", name: "Sharpen", description: "Enhance fine edges and detail",defaults: { sharpen: { amount: 50 } },- editor: ({ clip, update }) => <Slider label="Sharpen amount" value={clip.sharpen!.amount} max={200} onChange={(amount) => update({ sharpen: { amount } })} />,+ editor: ({ clip, update, disabled }) => <Param label="Amount" ariaLabel="Sharpen amount" value={clip.sharpen!.amount} max={200} defaultValue={50} disabled={disabled} onChange={(amount) => update({ sharpen: { amount } })} />,},{- id: "blur", name: "Gaussian Blur", description: "Soften the picture with a Gaussian blur",+ id: "blur", name: "Gaussian blur", description: "Soften the picture with a Gaussian blur",defaults: { blur: { radius: 4 } },- editor: ({ clip, update }) => <Slider label="Blur radius" value={clip.blur!.radius} max={24} step={0.5} suffix=" px" onChange={(radius) => update({ blur: { radius } })} />,+ editor: ({ clip, update, disabled }) => <Param label="Radius" ariaLabel="Blur radius" value={clip.blur!.radius} max={24} step={0.5} suffix=" px" defaultValue={4} disabled={disabled} onChange={(radius) => update({ blur: { radius } })} />,},{- id: "colorCorrection", name: "Color Correction", description: "Adjust exposure, contrast, and saturation",+ id: "colorCorrection", name: "Colour correction", description: "Adjust exposure, contrast and saturation",defaults: { colorCorrection: { exposure: 0, contrast: 0, saturation: 100 } },- editor: ({ clip, update }) => {+ editor: ({ clip, update, disabled }) => {const color = clip.colorCorrection!;return <>- <Slider label="Exposure" value={color.exposure} min={-4} max={4} step={0.1} suffix=" stops" onChange={(exposure) => update({ colorCorrection: { ...color, exposure } })} />- <Slider label="Contrast" value={color.contrast} min={-100} onChange={(contrast) => update({ colorCorrection: { ...color, contrast } })} />- <Slider label="Saturation" value={color.saturation} max={200} onChange={(saturation) => update({ colorCorrection: { ...color, saturation } })} />+ <Param label="Exposure" value={color.exposure} min={-4} max={4} step={0.1} suffix=" stops" defaultValue={0} disabled={disabled} onChange={(exposure) => update({ colorCorrection: { ...color, exposure } })} />+ <Param label="Contrast" value={color.contrast} min={-100} defaultValue={0} disabled={disabled} onChange={(contrast) => update({ colorCorrection: { ...color, contrast } })} />+ <Param label="Saturation" value={color.saturation} max={200} defaultValue={100} disabled={disabled} onChange={(saturation) => update({ colorCorrection: { ...color, saturation } })} /></>;},},{id: "vignette", name: "Vignette", description: "Darken the edges of the picture",defaults: { vignette: { amount: 35 } },- editor: ({ clip, update }) => <Slider label="Vignette amount" value={clip.vignette!.amount} onChange={(amount) => update({ vignette: { amount } })} />,+ editor: ({ clip, update, disabled }) => <Param label="Amount" ariaLabel="Vignette amount" value={clip.vignette!.amount} defaultValue={35} disabled={disabled} onChange={(amount) => update({ vignette: { amount } })} />,},{- id: "lut", name: "3D LUT", description: "Apply a color look from a .cube file",+ id: "lut", name: "3D LUT", description: "Apply a colour look from a .cube file",defaults: { lut: { intensity: 100 } },+ reset: (clip) => ({ lut: { ...clip.lut!, intensity: 100 } }),editor: (props) => <LutEditor key={props.clip.id} {...props} />,},];+/* Each effect is an Expander-style block with a 32px header — chevron and+ name, Reset, and a ⋯ menu — the way Premiere's Effect Controls and+ Clipchamp's effect panel stack them. There is no per-effect bypass: effect+ settings carry no "enabled" flag in the project schema yet. */+function EffectBlock({ effect, clip, disabled, update, onRemove }: {+ effect: EffectDefinition; clip: TimelineClip; disabled: boolean;+ update: (patch: Partial<TimelineClip>) => void; onRemove: () => void;+}) {+ const [open, setOpen] = useState(true);+ const more = useRef<HTMLButtonElement>(null);+ const menu = useContextMenu();+ const reset = () => update(effect.reset?.(clip) ?? effect.defaults);+ return <section className={`clip-effect${open ? " clip-effect--open" : ""}`} aria-label={`${effect.name} effect`}>+ <header className="clip-effect__header">+ <button type="button" className="clip-effect__toggle" aria-expanded={open} onClick={() => setOpen((value) => !value)}>+ <ChevronRight size={12} aria-hidden="true" className="clip-effect__chevron" />+ <h3 className="clip-effect__name">{effect.name}</h3>+ </button>+ <button type="button" className="clip-effect__action" aria-label={`Reset ${effect.name}`} {...tooltipProps("Reset")} disabled={disabled} onClick={reset}>+ <RotateCcw size={14} aria-hidden="true" />+ </button>+ <button+ ref={more}+ type="button"+ className="clip-effect__action"+ aria-label={`${effect.name} options`}+ aria-haspopup="menu"+ {...tooltipProps("More options")}+ disabled={disabled}+ onClick={() => more.current && menu.open(more.current, [+ { label: "Reset", icon: <RotateCcw size={16} />, onSelect: reset },+ { separator: true },+ { label: "Remove", shortcut: "Delete", danger: true, onSelect: onRemove },+ ], { "aria-label": `${effect.name} options`, placement: "bottom-end", focusFirst: true })}+ ><Ellipsis size={14} aria-hidden="true" /></button>+ </header>+ {open && <fieldset className="clip-effect__body" disabled={disabled}>{effect.editor({ clip, update, disabled })}</fieldset>}+ {menu.element}+ </section>;+}+export function ClipEffects({ clip, disabled, onChange }: {clip: TimelineClip;disabled: boolean;onChange: (patch: Partial<TimelineClip>) => void;}) {const [open, setOpen] = useState(false);- const root = useRef<HTMLDivElement>(null);const trigger = useRef<HTMLButtonElement>(null);- const pickerId = useId();+ const list = useRef<HTMLDivElement>(null);const available = EFFECTS.filter((effect) => !clip[effect.id]);const update = (patch: Partial<TimelineClip>) => { if (!disabled) onChange(patch); };useEffect(() => setOpen(false), [clip.id, disabled]);- useEffect(() => {- if (!open) return;- const closeOutside = (event: PointerEvent) => { if (!root.current?.contains(event.target as Node)) setOpen(false); };- document.addEventListener("pointerdown", closeOutside);- root.current?.querySelector<HTMLButtonElement>(".clip-effects__picker button")?.focus();- return () => document.removeEventListener("pointerdown", closeOutside);- }, [open]);- return <>- {EFFECTS.filter((effect) => clip[effect.id]).map((effect) => <section className="inspector-section clip-effect" key={effect.id} aria-label={`${effect.name} effect`}>- <header><h3>{effect.name}</h3><button type="button" className="clip-effect__remove" aria-label={`Remove ${effect.name} effect`} disabled={disabled} onClick={() => update({ [effect.id]: undefined })}><X size={14} /></button></header>- <fieldset disabled={disabled}>{effect.editor({ clip, update })}</fieldset>- </section>)}- <div className="clip-effects" ref={root} onKeyDown={(event) => {- if (event.key === "Escape" && open) { event.stopPropagation(); setOpen(false); trigger.current?.focus(); }- if (open && (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Home" || event.key === "End")) {- event.preventDefault();- const buttons = Array.from(root.current?.querySelectorAll<HTMLButtonElement>(".clip-effects__picker button") ?? []);- const index = buttons.indexOf(document.activeElement as HTMLButtonElement);- const next = event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : (index + (event.key === "ArrowUp" ? -1 : 1) + buttons.length) % buttons.length;- buttons[next]?.focus();- }- }} onBlur={(event) => { if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false); }}>- <button ref={trigger} type="button" className="clip-effects__add" disabled={disabled || available.length === 0} aria-expanded={open} aria-controls={pickerId} onClick={() => setOpen((value) => !value)}><Plus size={16} /> Add Effect</button>- {open && <div id={pickerId} className="clip-effects__picker" role="group" aria-label="Available effects">- {available.map((effect) => <button type="button" key={effect.id} onClick={() => { update(effect.defaults); setOpen(false); trigger.current?.focus(); }}><strong>{effect.name}</strong><span>{effect.description}</span></button>)}- </div>}- </div>- </>;+ const moveFocus = (event: KeyboardEvent<HTMLDivElement>) => {+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;+ event.preventDefault();+ const buttons = Array.from(list.current?.querySelectorAll<HTMLButtonElement>("button") ?? []);+ const index = buttons.indexOf(document.activeElement as HTMLButtonElement);+ const next = event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : (index + (event.key === "ArrowUp" ? -1 : 1) + buttons.length) % buttons.length;+ buttons[next]?.focus();+ };+ return <div className="clip-effects">+ {EFFECTS.filter((effect) => clip[effect.id]).map((effect) => <EffectBlock+ key={effect.id}+ effect={effect}+ clip={clip}+ disabled={disabled}+ update={update}+ onRemove={() => update({ [effect.id]: undefined })}+ />)}+ <button+ ref={trigger}+ type="button"+ className="secondary-button clip-effects__add"+ disabled={disabled || available.length === 0}+ aria-haspopup="dialog"+ aria-expanded={open}+ onClick={() => setOpen((value) => !value)}+ ><Plus size={16} aria-hidden="true" /> Add effect</button>+ <Flyout open={open} anchor={trigger} onClose={() => setOpen(false)} aria-label="Available effects" role="group" placement="top" width={220}>+ <div ref={list} className="clip-effects__picker" onKeyDown={moveFocus}>+ {available.map((effect) => <button+ type="button"+ key={effect.id}+ className="clip-effects__item"+ {...tooltipProps(effect.description)}+ onClick={() => { update(effect.defaults); setOpen(false); trigger.current?.focus(); }}+ >{effect.name}</button>)}+ </div>+ </Flyout>+ </div>;}diff --git a/src/components/workspace/ColorPicker.tsx b/src/components/workspace/ColorPicker.tsxnew file mode 100644index 0000000..1158956--- /dev/null+++ b/src/components/workspace/ColorPicker.tsx@@ -0,0 +1,174 @@+import { Pipette } from "lucide-react";+import { useEffect, useRef, useState, type CSSProperties, type KeyboardEvent, type PointerEvent } from "react";+import { Flyout, tooltipProps } from "../ui";++/* A colour swatch that opens the WinUI ColorPicker shape in a Flyout: a+ saturation/value square, a hue slider, a hex field, and an eyedropper.++ The eyedropper is the browser's own EyeDropper API (Chromium / WebView2),+ which samples any pixel on the screen — so the program monitor, which is+ where the colour to key out actually is. Where the API is missing the button+ is simply not offered.++ The gradients are painted from inline styles rather than from timeline.css:+ they ARE colours (a hue wheel unrolled), not palette choices, and the+ stylesheet guard keeps literal colours out of the sheets. */++interface Hsv { h: number; s: number; v: number }++const clamp01 = (value: number) => Math.min(1, Math.max(0, value));++export function hexToHsv(hex: string): Hsv | null {+ const match = /^#?([0-9a-f]{6})$/i.exec(hex.trim());+ if (!match) return null;+ const value = parseInt(match[1], 16);+ const r = ((value >> 16) & 255) / 255;+ const g = ((value >> 8) & 255) / 255;+ const b = (value & 255) / 255;+ const max = Math.max(r, g, b);+ const delta = max - Math.min(r, g, b);+ let h = 0;+ if (delta > 0) {+ if (max === r) h = ((g - b) / delta) % 6;+ else if (max === g) h = (b - r) / delta + 2;+ else h = (r - g) / delta + 4;+ }+ return { h: ((h * 60) + 360) % 360, s: max === 0 ? 0 : delta / max, v: max };+}++export function hsvToHex({ h, s, v }: Hsv): string {+ const f = (n: number) => {+ const k = (n + h / 60) % 6;+ return v - v * s * Math.max(0, Math.min(k, 4 - k, 1));+ };+ const channel = (value: number) => Math.round(clamp01(value) * 255).toString(16).padStart(2, "0");+ return `#${channel(f(5))}${channel(f(3))}${channel(f(1))}`;+}++interface EyeDropperResult { sRGBHex: string }+type EyeDropperConstructor = new () => { open: () => Promise<EyeDropperResult> };+const eyeDropper = (): EyeDropperConstructor | undefined =>+ (typeof window !== "undefined" ? (window as unknown as { EyeDropper?: EyeDropperConstructor }).EyeDropper : undefined);++export function ColorPicker({ value, onChange }: { value: string; onChange: (hex: string) => void }) {+ /* Hue is kept locally: a grey has no hue of its own, and dragging the square+ down to black must not throw away the hue the user chose. */+ const [hsv, setHsv] = useState<Hsv>(() => hexToHsv(value) ?? { h: 120, s: 1, v: 1 });+ const [draft, setDraft] = useState(value.toUpperCase());+ const area = useRef<HTMLDivElement>(null);+ const dragging = useRef(false);++ useEffect(() => {+ setDraft(value.toUpperCase());+ const next = hexToHsv(value);+ if (next && hsvToHex(hsv).toLowerCase() !== value.toLowerCase()) setHsv(next.s === 0 || next.v === 0 ? { ...next, h: hsv.h } : next);+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [value]);++ const commit = (next: Hsv) => {+ setHsv(next);+ onChange(hsvToHex(next));+ };+ const pick = (event: PointerEvent<HTMLDivElement>) => {+ const rect = area.current?.getBoundingClientRect();+ if (!rect || rect.width <= 0 || rect.height <= 0) return;+ commit({ ...hsv, s: clamp01((event.clientX - rect.left) / rect.width), v: clamp01(1 - (event.clientY - rect.top) / rect.height) });+ };+ const nudge = (event: KeyboardEvent<HTMLDivElement>) => {+ const step = event.shiftKey ? 0.1 : 0.01;+ const moves: Record<string, Partial<Hsv>> = {+ ArrowLeft: { s: clamp01(hsv.s - step) }, ArrowRight: { s: clamp01(hsv.s + step) },+ ArrowUp: { v: clamp01(hsv.v + step) }, ArrowDown: { v: clamp01(hsv.v - step) },+ };+ const move = moves[event.key];+ if (!move) return;+ event.preventDefault();+ commit({ ...hsv, ...move });+ };+ const typed = (text: string) => {+ setDraft(text);+ const normalised = text.trim().startsWith("#") ? text.trim() : `#${text.trim()}`;+ const next = hexToHsv(normalised);+ if (next) { setHsv(next); onChange(normalised.toLowerCase()); }+ };+ const Dropper = eyeDropper();+ const sample = async () => {+ if (!Dropper) return;+ try {+ const { sRGBHex } = await new Dropper().open();+ const next = hexToHsv(sRGBHex);+ if (next) commit(next);+ } catch {+ /* Esc while sampling cancels; nothing changes. */+ }+ };+ const hueColour = hsvToHex({ h: hsv.h, s: 1, v: 1 });++ return <div className="color-picker">+ <div+ ref={area}+ className="color-picker__area"+ role="slider"+ tabIndex={0}+ aria-label="Saturation and brightness"+ aria-valuetext={`Saturation ${Math.round(hsv.s * 100)}%, brightness ${Math.round(hsv.v * 100)}%`}+ style={{ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${hueColour})` }}+ onPointerDown={(event) => { event.currentTarget.setPointerCapture?.(event.pointerId); dragging.current = true; pick(event); }}+ onPointerMove={(event) => { if (dragging.current) pick(event); }}+ onPointerUp={() => { dragging.current = false; }}+ onPointerCancel={() => { dragging.current = false; }}+ onKeyDown={nudge}+ >+ <span className="color-picker__thumb" style={{ left: `${hsv.s * 100}%`, top: `${(1 - hsv.v) * 100}%`, background: hsvToHex(hsv) } as CSSProperties} />+ </div>+ <input+ type="range"+ className="color-picker__hue"+ aria-label="Hue"+ min={0}+ max={359}+ step={1}+ value={Math.round(hsv.h)}+ style={{ "--hue-gradient": "linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)" } as CSSProperties}+ onChange={(event) => commit({ ...hsv, h: Number(event.target.value) })}+ />+ <div className="color-picker__row">+ <span className="color-picker__preview" style={{ background: value }} aria-hidden="true" />+ <input+ className="text-field color-picker__hex"+ aria-label="Hex"+ value={draft}+ spellCheck={false}+ maxLength={7}+ onChange={(event) => typed(event.target.value)}+ onBlur={() => setDraft(value.toUpperCase())}+ />+ {Dropper && <button type="button" className="icon-button color-picker__dropper" aria-label="Pick a colour from the screen" {...tooltipProps("Pick a colour from the screen")} onClick={() => void sample()}>+ <Pipette size={16} aria-hidden="true" />+ </button>}+ </div>+ </div>;+}++/** A 24px swatch that opens the picker in a Flyout. */+export function ColorSwatch({ value, onChange, label, disabled }: { value: string; onChange: (hex: string) => void; label: string; disabled?: boolean }) {+ const button = useRef<HTMLButtonElement>(null);+ const [open, setOpen] = useState(false);+ return <>+ <button+ ref={button}+ type="button"+ className="color-swatch"+ style={{ background: value }}+ aria-label={label}+ aria-haspopup="dialog"+ aria-expanded={open}+ disabled={disabled}+ {...tooltipProps(value.toUpperCase())}+ onClick={() => setOpen((current) => !current)}+ />+ <Flyout open={open} anchor={button} onClose={() => setOpen(false)} aria-label={label} placement="bottom">+ <ColorPicker value={value} onChange={onChange} />+ </Flyout>+ </>;+}diff --git a/src/components/workspace/ProgramLayer.tsx b/src/components/workspace/ProgramLayer.tsxindex caccaf2..2bcd5bb 100644--- a/src/components/workspace/ProgramLayer.tsx+++ b/src/components/workspace/ProgramLayer.tsx@@ -20,12 +20,14 @@ export function previewMediaStyle(frame: ClipFrameStyle): CSSProperties {}/** Prepared clips keep their decoder and effect renderer when made visible. */-export function ProgramLayer({ clip, asset, sources, playheadMs, playing, active, foreground, muted, externalSeek, depth, media, composited }: {+export function ProgramLayer({ clip, asset, sources, playheadMs, playing, rate = 1, active, foreground, muted, externalSeek, depth, media, composited }: {clip: TimelineClip;asset: ProjectAsset | undefined;sources: PreviewSources;playheadMs: number;playing: boolean;+ /** Forward playback speed (J/K/L shuttle). */+ rate?: number;active: boolean;foreground: boolean;muted: boolean;@@ -82,9 +84,10 @@ export function ProgramLayer({ clip, asset, sources, playheadMs, playing, active// Explicit jumps still seek precisely, including during playback.const tolerance = run && !state.externalSeek ? 0.25 : 0.033;if (!element.seeking && Math.abs(element.currentTime - target) > tolerance) element.currentTime = target;+ if (run && element.playbackRate !== rate) element.playbackRate = rate;if (run && element.paused) void element.play().catch(() => undefined);};- useLayoutEffect(sync, [playheadMs, playing, active, externalSeek, clip, url]);+ useLayoutEffect(sync, [playheadMs, playing, rate, active, externalSeek, clip, url]);const loaded = () => {sync();if (video.current) setReady(video.current.readyState >= 2 && !video.current.seeking);diff --git a/src/components/workspace/ProgramMonitor.tsx b/src/components/workspace/ProgramMonitor.tsxindex b870d13..c8fbb89 100644--- a/src/components/workspace/ProgramMonitor.tsx+++ b/src/components/workspace/ProgramMonitor.tsx@@ -47,11 +47,16 @@ const clamp = (value: number, minimum: number, maximum: number) => Math.max(miniconst angleAt = (x: number, y: number, centerX: number, centerY: number) => Math.atan2(y - centerY, x - centerX) * 180 / Math.PI;const normalizedAngle = (value: number) => ((value + 180) % 360 + 360) % 360 - 180;-export function ProgramMonitor({ config, folderPath, playheadMs, playing, onSeek, onPlayingChange, selectedClipId = null, transformEditingDisabled = false, onSelectClip, onTransformChange }: {+export function ProgramMonitor({ config, folderPath, playheadMs, playing, rate = 1, onSeek, onPlayingChange, selectedClipId = null, transformEditingDisabled = false, onSelectClip, onTransformChange }: {config: ProjectConfig;folderPath: string;playheadMs: number;playing: boolean;+ /** Shuttle speed while playing (J/K/L): 1, 2 or 4 forward, negative for+ * reverse. Forward runs the media elements at that playbackRate; reverse+ * runs the clock backwards and seeks the paused elements frame by frame,+ * since a media element cannot play backwards. */+ rate?: number;/** Where playback has reached. The view owns the playhead; this reports the* monitor's monotonic playback clock. */onSeek: (ms: number) => void;@@ -186,14 +191,20 @@ export function ProgramMonitor({ config, folderPath, playheadMs, playing, onSeek/* Media currentTime can be exposed in coarse jumps while Chromium ishandling pointer/hover work. A monotonic local clock keeps the rulersmooth; media is still sought at cuts and explicit user jumps. */- const next = positionRef.current + elapsed;+ const next = positionRef.current + elapsed * rate;// Past the end of everything there is nothing left to show, so playback- // stops there instead of running the clock over an empty ruler.+ // stops there instead of running the clock over an empty ruler. Reverse+ // stops at the head of the timeline.if (next >= contentEndMs) {report(contentEndMs);callbacks.current.onPlayingChange(false);return;}+ if (next <= 0) {+ report(0);+ callbacks.current.onPlayingChange(false);+ return;+ }// Preserve elapsed time across cuts; neither media loads nor React// commits restart the clock or discard the fraction past a boundary.report(next);@@ -201,7 +212,10 @@ export function ProgramMonitor({ config, folderPath, playheadMs, playing, onSeek};frame = requestAnimationFrame(step);return () => cancelAnimationFrame(frame);- }, [playing, contentEndMs, report]);+ }, [playing, rate, contentEndMs, report]);+ /* Media plays forward only. In reverse the elements stay paused and follow+ the clock by seeking, which ProgramLayer does for any paused layer. */+ const mediaPlaying = playing && rate > 0;/* Sound, kept in step with the cut. Each element is put where the playheadsays it should be, and corrected only once it has drifted audibly — a@@ -211,13 +225,15 @@ export function ProgramMonitor({ config, folderPath, playheadMs, playing, onSeekconst element = audioRefs.current.get(audioClip.id);if (!element || element.readyState === 0) continue;const target = sourceTimeMs(audioClip, playheadMs) / 1000;- if (Math.abs(element.currentTime - target) > (playing ? AUDIO_DRIFT_LIMIT_S : SEEK_EPSILON_S)) {+ if (Math.abs(element.currentTime - target) > (mediaPlaying ? AUDIO_DRIFT_LIMIT_S : SEEK_EPSILON_S)) {element.currentTime = Math.max(0, target);}- if (playing) void element.play().catch(() => undefined);- else element.pause();+ if (mediaPlaying) {+ if (element.playbackRate !== rate) element.playbackRate = rate;+ void element.play().catch(() => undefined);+ } else element.pause();}- }, [audioClips, playheadMs, playing]);+ }, [audioClips, playheadMs, mediaPlaying, rate]);const hasClips = tracks.some((track) => track.clips.length > 0);@@ -317,7 +333,8 @@ export function ProgramMonitor({ config, folderPath, playheadMs, playing, onSeekmedia={media}composited={composited}playheadMs={depth >= 0 ? playheadMs : prepareAtMs}- playing={playing}+ playing={mediaPlaying}+ rate={rate}active={depth >= 0}foreground={depth === 0}muted={depth !== 0 || (tracks.find((track) => track.id === layer.trackId)?.muted ?? false)}diff --git a/src/components/workspace/TimelineView.tsx b/src/components/workspace/TimelineView.tsxindex 2706f92..c3e3b11 100644--- a/src/components/workspace/TimelineView.tsx+++ b/src/components/workspace/TimelineView.tsx@@ -1,11 +1,11 @@import { ClipEffects } from "./ClipEffects";import {- Copy, Film, Layers3, LayoutGrid, List, Lock, LockOpen,- Pause, Play, Plus, Scissors, SkipBack, SkipForward, Trash2, Upload,- Volume2, VolumeX, X,+ ChevronFirst, ChevronLast, Copy, Film, Layers3, LayoutGrid, List, Lock, LockOpen,+ PanelLeft, PanelRight, Pause, Play, Plus, Scissors, StepBack, StepForward, Trash2, Upload,+ Volume2, VolumeX, ZoomIn, ZoomOut,} from "lucide-react";-import { useCallback, useEffect, useMemo, useRef, useState } from "react";-import { resolutionLabel } from "../../lib/export";+import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type MutableRefObject } from "react";+import { outputDimensions, resolutionLabel } from "../../lib/export";import { importMediaFiles, isTauri } from "../../lib/persistence";import { loadMediaLayout, saveMediaLayout, type MediaLayout } from "../../lib/settings";import {@@ -20,9 +20,15 @@ import {type TimelineTrack,} from "../../lib/project";import {- clipEndMs, findClip, insertClip, moveClip, removeClip, snapTargets, sourceRoom, trimClip, withTimelineTracks,+ adjacentCut, clipEndMs, findClip, formatTimecode, frameAt, frameStartMs, insertClip, moveClip, parseTimecode, pasteClip,+ removeClip, rulerLabel, rulerScale, scrollAfterZoom, snapTargets, sourceRoom, trimClip, withTimelineTracks,type SnapOptions, type SourceRoom,} from "../../lib/timeline";+import { useShortcut } from "../../lib/commands";+import {+ ComboBox, PropRow, PropSection, SelectorBar, Slider, Splitter, tooltipProps, useContextMenu, usePaneSize,+ type MenuEntry,+} from "../ui";import { MediaThumbnail, type MeasuredMedia } from "./MediaThumbnail";import { ProgramMonitor } from "./ProgramMonitor";import { sceneShape, STATUS_WORD } from "./sceneStatus";@@ -32,10 +38,15 @@ import { TimelineClipThumbnails } from "./TimelineClipThumbnails";import { TimelineClipWaveform } from "./TimelineClipWaveform";const MIN_DURATION = 10_000;-/* One minute fills the visible ruler. Longer films keep that readable scale- and extend sideways inside a scrollable canvas instead of squeezing every- cut into the same width. */-const VISIBLE_TIMELINE_MS = 60_000;+/* The scale a timeline opens at: one minute fills the visible lanes, and a+ shorter film fills them exactly. Ctrl+wheel, the −/= keys and the zoom+ slider change it from there; zooming out stops where the whole canvas fits. */+const DEFAULT_VISIBLE_MS = 60_000;+/* The closest zoom: this many pixels per frame, where the ruler labels every+ frame and a trim can be placed on one. */+const MAX_PX_PER_FRAME = 60;+/* Each −/= press or wheel notch zooms by this factor. */+const ZOOM_STEP = 1.25;/* How long a dropped clip is when the file itself cannot say.A drop normally lasts as long as the footage: the media panel decodes eachfile to draw its thumbnail and records the duration it read there (see@@ -51,16 +62,19 @@ const SCENE_DRAG_TYPE = "application/x-slopus-generator-scene";/* How close two edges have to be ON SCREEN before they snap together. Inpixels, not milliseconds, because that is how close they LOOK — the same- 8px feels the same on a 20-second timeline and a 10-minute one, where a fixed- number of milliseconds would be unusable at one end and invisible at the- other. Converted against the lane's real width at the moment a drag starts. */+ 8px feels the same at every zoom, where a fixed number of milliseconds would+ be unusable at one end and invisible at the other. Converted against the+ lane's real width at the moment a drag starts. */const SNAP_PX = 8;/* Below this, a press is a click. Without it the smallest tremor betweenpointerdown and pointerup would be read as a drag and a clip that was onlybeing selected would be nudged off its cut. */const DRAG_THRESHOLD_PX = 3;+/* J/L shuttle speeds: each further press doubles, up to 4×. */+const SHUTTLE_SPEEDS = [1, 2, 4];type DragMode = "move" | "trim-start" | "trim-end";+type MonitorZoom = "fit" | "50" | "100";/** One drag, from the press that began it. Everything the pointer needs is* measured ONCE, here: the lane's geometry, what may be snapped to, and how@@ -111,29 +125,23 @@ const canvasDuration = (config: ProjectConfig) => {return Math.max(lastClipEnd, config.brief.targetDurationSeconds * 1000, MIN_DURATION);};-/* Roughly seven labels regardless of length, snapped to a readable interval. */-const rulerTicks = (durationMs: number) => {- const totalSeconds = Math.ceil(durationMs / 1000);- const step = [1, 2, 5, 10, 15, 30, 60, 120].find((candidate) => totalSeconds / candidate <= 7) ?? 300;- return Array.from({ length: Math.floor(totalSeconds / step) + 1 }, (_, index) => index * step);+const readFlag = (key: string, fallback: boolean) => {+ try {+ const raw = localStorage.getItem(key);+ return raw === null ? fallback : raw === "1";+ } catch {+ return fallback;+ }};--const rulerLabel = (seconds: number) =>- `${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;-const timecode = (ms: number) => {- const seconds = Math.floor(ms / 1000);- const frames = Math.floor((ms % 1000) / (1000 / 30));- return `00:${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}:${String(frames).padStart(2, "0")}`;+const writeFlag = (key: string, value: boolean) => {+ try { localStorage.setItem(key, value ? "1" : "0"); } catch { /* storage unavailable */ }};-const parseDuration = (value: string, frameRate: number): number | null => {- const parts = value.trim().split(":");- if (parts.length > 3 || parts.some((part) => !/^\d+(\.\d+)?$/.test(part.trim()))) return null;- const numbers = parts.map((part) => Number(part));- const frames = parts.length === 3 ? numbers[2] * (1000 / frameRate) : 0;- const seconds = parts.length === 1 ? numbers[0] : numbers[0] * 60 + numbers[1];- return Math.round(seconds * 1000 + frames);-};+/** Arrow keys, Home and End belong to the control that has focus when it is a+ * slider, a splitter, a tab strip or a list — the timeline only takes them+ * from everywhere else. */+const ownsArrowKeys = (target: EventTarget | null) =>+ target instanceof Element && Boolean(target.closest('input, select, textarea, [role="slider"], [role="separator"], [role="tablist"], [role="listbox"], [role="menu"], [role="combobox"]'));/** How a view hands a project back. An updater rather than a plain value is* the only safe form for a write built from something asynchronous: the@@ -141,6 +149,21 @@ const parseDuration = (value: string, frameRate: number): number | null => {* previous one having already come back down as a prop. */export type ConfigUpdate = ProjectConfig | ((current: ProjectConfig) => ProjectConfig);+/** What a track row needs to call back into the view. Held in a ref so the+ * rows can be memoised: the playhead re-renders the view every frame of+ * playback, and the lanes have no reason to re-render with it. */+interface TrackActions {+ select: (id: string) => void;+ toggle: (id: string, key: "muted" | "locked") => void;+ rename: (id: string, name: string) => void;+ clipPointerDown: (event: React.PointerEvent<HTMLElement>, clip: TimelineClip, mode: DragMode) => void;+ clipMenu: (event: React.MouseEvent<HTMLElement>, clip: TimelineClip) => void;+ laneMenu: (event: React.MouseEvent<HTMLElement>, track: TimelineTrack) => void;+ dragOverLane: (event: React.DragEvent<HTMLDivElement>, track: TimelineTrack) => void;+ dragLeaveLane: (track: TimelineTrack) => void;+ dropLane: (event: React.DragEvent<HTMLDivElement>, track: TimelineTrack) => void;+}+export function TimelineView({ config, folderPath, generationCompletionTimes = {}, onChange, onMeasured, onOpenGenerator }: {config: ProjectConfig;folderPath: string;@@ -154,15 +177,21 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {onOpenGenerator: (jobId?: string) => void;}) {const firstClip = config.timeline.tracks.flatMap((track) => track.clips)[0];+ const fps = config.settings.frameRate;const [selectedId, setSelectedId] = useState(firstClip?.id ?? "");const [playhead, setPlayhead] = useState(firstClip?.startMs ?? 0);const [playing, setPlaying] = useState(false);+ /* Shuttle speed: 1, 2, 4 forward or −1, −2, −4 in reverse (J/K/L). */+ const [rate, setRate] = useState(1);const [panelTab, setPanelTab] = useState<"scenes" | "media">("scenes");/* Grid reads a folder of footage by its pictures, list reads it by itsnames. Which one a cutter wants is a habit, not a per-project choice, soit is remembered on this machine rather than written into the project. */const [mediaLayout, setMediaLayout] = useState<MediaLayout>(loadMediaLayout);- const timelineGrid = useRef<HTMLDivElement>(null);+ const viewRef = useRef<HTMLDivElement>(null);+ const scrollRef = useRef<HTMLDivElement>(null);+ const rulerRef = useRef<HTMLDivElement>(null);+ const clipNameRef = useRef<HTMLInputElement>(null);const [importing, setImporting] = useState(false);const [importError, setImportError] = useState<string | null>(null);/* Which track the pointer is currently over with a compatible asset, so the@@ -175,11 +204,31 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {put there is the only way to know whether this lane can take it. */const [draggedAsset, setDraggedAsset] = useState<ProjectAsset | undefined>(undefined);const [draggedScene, setDraggedScene] = useState<GenerationJob | undefined>(undefined);- const [durationDraft, setDurationDraft] = useState<string | null>(null);- /* What the user is typing into Lasts, while they are typing it. The field+ /* What the user is typing into Duration, while they are typing it. The fieldotherwise shows the clip's own length, and "00:0" on the way to "00:08"must not be snapped back to a formatted timecode mid-keystroke. Null meansnothing is being typed and the clip speaks for itself. */+ const [durationDraft, setDurationDraft] = useState<string | null>(null);+ /* The toolbar clock, while it is being typed into. */+ const [timecodeDraft, setTimecodeDraft] = useState<string | null>(null);+ /* In and out points (I / O), drawn as a shaded range on the ruler. */+ const [inMs, setInMs] = useState<number | null>(null);+ const [outMs, setOutMs] = useState<number | null>(null);+ /* Clips copied with Ctrl+C / Ctrl+X, pasted with Ctrl+V. Local to the+ editor: a clip only means something inside this project. */+ const clipboard = useRef<TimelineClip | null>(null);+ const [hasClipboard, setHasClipboard] = useState(false);+ /* Program monitor: Fit / 50% / 100%, and the title/action-safe guides. */+ const [monitorZoom, setMonitorZoom] = useState<MonitorZoom>("fit");+ const [safeArea, setSafeArea] = useState(false);+ /* The side panes collapse from the toolbar instead of disappearing at a+ window width — a narrow window keeps whatever the user chose to see. */+ const [sourcesOpen, setSourcesOpen] = useState(() => readFlag("slopus.timeline.sources", true));+ const [inspectorOpen, setInspectorOpen] = useState(() => readFlag("slopus.timeline.inspector", true));+ const sourcesPane = usePaneSize("timeline.sources", 296, { min: 200, max: 480 });+ const inspectorPane = usePaneSize("timeline.inspector", 340, { min: 260, max: 560 });+ const timelinePane = usePaneSize("timeline.height", 300, { min: 150, max: 800 });+ const trackPane = usePaneSize("timeline.tracks", 180, { min: 120, max: 320 });/* A drag in flight, and the timeline as it would be if the pointer werereleased right now. The lanes draw the preview, and the release commitsexactly it — the drag and the edit are the same calculation, run twice@@ -189,9 +238,11 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {const previewRef = useRef<TimelineTrack[] | null>(null);const [preview, setPreview] = useState<TimelineTrack[] | null>(null);const [dragging, setDragging] = useState(false);- /* Whether the pointer is currently dragging the playhead along the ruler.- A press alone moves it once; this is what makes the moves keep coming. */+ /* Whether the pointer is dragging the playhead (on the ruler or by its+ head). A press alone moves it once; this is what makes the moves keep+ coming. */const [scrubbing, setScrubbing] = useState(false);+ const menu = useContextMenu();const tracks = config.timeline.tracks;const selected = useMemo(() => tracks.flatMap((track) => track.clips).find((clip) => clip.id === selectedId), [tracks, selectedId]);const selectedTrack = tracks.find((track) => track.id === selected?.trackId);@@ -204,18 +255,81 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {* asked for, however little of it is cut yet). */const contentEndMs = tracks.reduce((end, track) => track.clips.reduce((furthest, clip) => Math.max(furthest, clipEndMs(clip)), end), 0);const duration = useMemo(() => canvasDuration(config), [config]);- const timelineWidth = `${Math.max(100, duration / VISIBLE_TIMELINE_MS * 100)}%`;const mediaAssets = useMemo(() => config.assets.filter((asset) => asset.kind !== "generated"), [config.assets]);const assetsById = useMemo(() => new Map(config.assets.map((asset) => [asset.id, asset])), [config.assets]);const generatedJobsByAssetId = useMemo(() => new Map(config.generationJobs.map((job) => [generationAssetId(job.id), job]),), [config.generationJobs]);- const ticks = useMemo(() => rulerTicks(duration), [duration]);- /* The lanes are ruled at the SAME interval as the ruler above them, so a line- under a clip is a line under a number. They used to be a fixed 14.7% of the- width — a spacing that meant nothing at any duration, and drifted further- from the labels the longer the project got. */- const tickStepMs = (ticks.length > 1 ? ticks[1] - ticks[0] : Math.max(1, Math.ceil(duration / 1000))) * 1000;+ /* V1, V2… and A1, A2… — the track's kind and its place among its kind, the+ label every NLE puts on a track header. */+ const trackLabels = useMemo(() => {+ const counts: Record<string, number> = {};+ return new Map(tracks.map((track) => {+ counts[track.kind] = (counts[track.kind] ?? 0) + 1;+ return [track.id, `${track.kind === "audio" ? "A" : track.kind === "caption" ? "C" : "V"}${counts[track.kind]}`];+ }));+ }, [tracks]);++ /* --- Zoom -----------------------------------------------------------------+ pxPerSecond is the zoom. The lanes are `duration × pxPerSecond` wide and+ every clip is still positioned in percent of that, so a zoom is one width+ change rather than a re-layout of every clip. Until the scroll area has+ been measured (and in jsdom, which lays nothing out) the lanes are simply+ 100% wide. */+ const [viewportPx, setViewportPx] = useState(0);+ const [zoom, setZoom] = useState<number | null>(null);+ const laneViewportPx = Math.max(0, viewportPx - trackPane.size);+ const fitPps = laneViewportPx > 0 ? laneViewportPx / (duration / 1000) : 0;+ const maxPps = fps * MAX_PX_PER_FRAME;+ const minPps = Math.min(fitPps, maxPps);+ const defaultPps = laneViewportPx > 0 ? laneViewportPx / (Math.min(duration, DEFAULT_VISIBLE_MS) / 1000) : 0;+ const pxPerSecond = laneViewportPx > 0 ? Math.min(maxPps, Math.max(minPps, zoom ?? defaultPps)) : 0;+ const lanePx = pxPerSecond > 0 ? (duration / 1000) * pxPerSecond : null;+ /* The ruler's density at this zoom, from frames up to minutes. Unmeasured,+ it assumes a 1000px lane so the labels are still readable. */+ const scale = useMemo(() => rulerScale(lanePx ? pxPerSecond : 1000 / (duration / 1000), fps), [lanePx, pxPerSecond, duration, fps]);+ const pendingScroll = useRef<number | null>(null);+ const zoomState = useRef({ pxPerSecond, minPps, maxPps, trackPx: trackPane.size });+ zoomState.current = { pxPerSecond, minPps, maxPps, trackPx: trackPane.size };++ useEffect(() => {+ const element = scrollRef.current;+ if (!element || typeof ResizeObserver === "undefined") return;+ const observer = new ResizeObserver(() => setViewportPx(element.clientWidth));+ observer.observe(element);+ setViewportPx(element.clientWidth);+ return () => observer.disconnect();+ }, []);++ /** Zoom to `nextPps`, keeping the moment `anchorPx` pixels into the visible+ * lanes where it is. Without an anchor, the playhead if it is on screen,+ * and otherwise the middle of the view. */+ const zoomTo = useCallback((nextPps: number, anchorPx?: number) => {+ const { pxPerSecond: current, minPps: low, maxPps: high } = zoomState.current;+ const element = scrollRef.current;+ if (!element || current <= 0) return;+ const clamped = Math.min(high, Math.max(low, nextPps));+ if (Math.abs(clamped - current) < 1e-6) return;+ const visible = element.clientWidth - zoomState.current.trackPx;+ const playheadPx = (playheadRef.current / 1000) * current - element.scrollLeft;+ const anchor = anchorPx ?? (playheadPx >= 0 && playheadPx <= visible ? playheadPx : visible / 2);+ pendingScroll.current = scrollAfterZoom(element.scrollLeft, anchor, current, clamped);+ setZoom(clamped);+ }, []);+ useLayoutEffect(() => {+ if (pendingScroll.current === null || !scrollRef.current) return;+ scrollRef.current.scrollLeft = pendingScroll.current;+ pendingScroll.current = null;+ }, [pxPerSecond]);+ /* The slider is logarithmic: every notch is the same RATIO of zoom. */+ const zoomSliderValue = lanePx && maxPps > minPps ? Math.round(Math.log(pxPerSecond / minPps) / Math.log(maxPps / minPps) * 100) : 0;+ const zoomFromSlider = (value: number) => {+ if (maxPps <= minPps) return;+ zoomTo(minPps * (maxPps / minPps) ** (value / 100));+ };++ const playheadRef = useRef(playhead);+ playheadRef.current = playhead;useEffect(() => { if (clipCount === 0 && playing) setPlaying(false); }, [clipCount, playing]);@@ -224,80 +338,121 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {because the monitor's animation loop depends on their identity: a newclosure per render would tear its clock down sixty times a second. */const seek = useCallback((ms: number) => setPlayhead(ms), []);- const setPlayingFromMonitor = useCallback((value: boolean) => setPlaying(value), []);-- useEffect(() => { setDurationDraft(null); }, [selectedId]);+ const setPlayingFromMonitor = useCallback((value: boolean) => { setPlaying(value); if (!value) setRate(1); }, []);// Another clip, another length: what was being typed belonged to the old one.+ useEffect(() => { setDurationDraft(null); }, [selectedId]);- /* Wheel over the timeline scrubs it. Registered by hand rather than with- React's onWheel because React attaches wheel listeners passively, and a- passive listener cannot preventDefault — without that the project content- scrolls away under the pointer while the playhead moves.-- A notch is one second; hold Shift for one frame. deltaMode says what the- browser's numbers mean (pixels, lines, or pages), so normalise to notches- instead of treating a trackpad's pixel deltas as a thousand of them. */+ /* The wheel does what it does everywhere else in Windows: scrolls the tracks.+ Shift+wheel scrolls sideways and Ctrl+wheel zooms around the pointer.+ Registered by hand rather than with React's onWheel because React attaches+ wheel listeners passively, and a passive listener cannot preventDefault —+ without that, Ctrl+wheel would zoom the whole page. */useEffect(() => {- const grid = timelineGrid.current;- if (!grid) return;+ const element = scrollRef.current;+ if (!element) return;const onWheel = (event: WheelEvent) => {- // Preserve a trackpad's horizontal gesture for the long timeline's- // native scroll container. Vertical wheel movement remains scrubbing.- if (duration > VISIBLE_TIMELINE_MS && Math.abs(event.deltaX) > Math.abs(event.deltaY)) return;- const raw = Math.abs(event.deltaY) >= Math.abs(event.deltaX) ? event.deltaY : event.deltaX;- if (raw === 0) return;- event.preventDefault();- const notches = event.deltaMode === 0 ? raw / 100 : event.deltaMode === 1 ? raw / 3 : raw;- const stepMs = event.shiftKey ? 1000 / config.settings.frameRate : 1000;- setPlaying(false);- setPlayhead((current) => Math.round(Math.max(0, Math.min(duration, current + notches * stepMs))));+ const unit = event.deltaMode === 1 ? 40 : event.deltaMode === 2 ? element.clientHeight : 1;+ if (event.ctrlKey) {+ event.preventDefault();+ const rect = element.getBoundingClientRect();+ const anchor = Math.max(0, event.clientX - rect.left - zoomState.current.trackPx);+ const delta = (Math.abs(event.deltaY) >= Math.abs(event.deltaX) ? event.deltaY : event.deltaX) * unit;+ zoomTo(zoomState.current.pxPerSecond * Math.exp(-delta * 0.0025), anchor);+ return;+ }+ if (event.shiftKey && Math.abs(event.deltaY) > Math.abs(event.deltaX)) {+ event.preventDefault();+ element.scrollLeft += event.deltaY * unit;+ }};- grid.addEventListener("wheel", onWheel, { passive: false });- return () => grid.removeEventListener("wheel", onWheel);- }, [duration, config.settings.frameRate]);+ element.addEventListener("wheel", onWheel, { passive: false });+ return () => element.removeEventListener("wheel", onWheel);+ }, [zoomTo]);++ /* During playback the view follows the playhead a page at a time, the way+ Premiere's "page scroll" does, so the playhead never runs off the edge. */+ useEffect(() => {+ const element = scrollRef.current;+ if (!playing || !element || !lanePx) return;+ const x = (playhead / duration) * lanePx;+ const visible = element.clientWidth - trackPane.size;+ if (x < element.scrollLeft || x > element.scrollLeft + visible - 16) element.scrollLeft = Math.max(0, x - 32);+ }, [playing, playhead, duration, lanePx, trackPane.size]);/** Any highlight the press just painted, undone. The chrome down here is not* selectable at all (see .pro-timeline), but a gesture can begin on a clip* and travel over the panels above, and a selection that was already in- * progress goes on extending under the pointer. Clearing it at the start of- * a gesture is the difference between dragging a clip and dragging a clip- * through a blue smear. */+ * progress goes on extending under the pointer. */const dropSelection = () => window.getSelection?.()?.removeAllRanges();/** Turn a pointer position on the ruler into a playhead position. A ruler* nothing has laid out has no scale, so it is left alone rather than* sending the playhead to NaN. */- const scrubTo = (ruler: HTMLElement, clientX: number) => {- const rect = ruler.getBoundingClientRect();- if (rect.width <= 0) return;- setPlayhead(Math.round(Math.max(0, Math.min(1, (clientX - rect.left) / rect.width)) * duration));+ const timeAtRuler = (clientX: number): number | null => {+ const rect = rulerRef.current?.getBoundingClientRect();+ if (!rect || rect.width <= 0) return null;+ return Math.round(Math.max(0, Math.min(1, (clientX - rect.left) / rect.width)) * duration);+ };+ const scrubTo = (clientX: number) => {+ const time = timeAtRuler(clientX);+ if (time !== null) setPlayhead(time);+ };+ /* Press to jump, hold and drag to scrub — on the ruler or by the playhead's+ own head. The monitor seeks to wherever this lands, so dragging runs the+ picture past under the pointer. Playback stops first: scrubbing while+ playing would be two things driving one playhead. */+ const beginScrub = (event: React.PointerEvent<HTMLElement>) => {+ if (event.button !== 0) return;+ event.stopPropagation();+ dropSelection();+ setPlaying(false);+ setRate(1);+ setScrubbing(true);+ scrubTo(event.clientX);};+ useEffect(() => {+ if (!scrubbing) return;+ const onMove = (event: PointerEvent) => scrubTo(event.clientX);+ const onUp = () => setScrubbing(false);+ window.addEventListener("pointermove", onMove);+ window.addEventListener("pointerup", onUp);+ window.addEventListener("pointercancel", onUp);+ return () => {+ window.removeEventListener("pointermove", onMove);+ window.removeEventListener("pointerup", onUp);+ window.removeEventListener("pointercancel", onUp);+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [scrubbing, duration]);const chooseMediaLayout = (layout: MediaLayout) => { setMediaLayout(layout); saveMediaLayout(layout); };+ const toggleSources = () => setSourcesOpen((open) => { writeFlag("slopus.timeline.sources", !open); return !open; });+ const toggleInspector = () => setInspectorOpen((open) => { writeFlag("slopus.timeline.inspector", !open); return !open; });/* Every timeline write hands up an UPDATER rather than a finished config,for the same reason measurements do (see recordMeasured, and ConfigUpdate).A finished config is built from the props THIS render closed over, and thetimeline is not always the most recent thing written: the media panel isrecording what its decodes measured the whole time a folder is beingimported, and a drag holds the timeline as it stood when the press began.- Handing up `{ ...config, timeline }` from either would take those- measurements back out again — a rush that had just learned it was 40- seconds long would go back to being an unmeasured file, and the next drop- of it would be a 5-second stand-in. */++ Every edit — drag, trim, split, paste, a typed length — comes through here+ and so through the project's own onChange, which is what the project-level+ undo stack (Ctrl+Z / Ctrl+Y, in ProjectWorkspace) records. The timeline+ keeps no undo of its own. */const updateTracks = (nextTracks: ProjectConfig["timeline"]["tracks"]) =>onChange((current) => withTimelineTracks(current, nextTracks));const renameTrack = (trackId: string, name: string) => updateTracks(tracks.map((track) => track.id === trackId ? { ...track, name } : track));const updateClip = (clipId: string, updates: Partial<TimelineClip>) => updateTracks(tracks.map((track) => ({ ...track, clips: track.clips.map((clip) => clip.id === clipId ? { ...clip, ...updates } : clip) })));+ const TRANSFORM_LIMITS = { scale: [10, 400], rotation: [-180, 180], positionX: [-100, 100], positionY: [-100, 100] } as const;const updateTransform = (key: keyof NonNullable<TimelineClip["transform"]>, value: number) => {if (!selected || !selectedTransform || !Number.isFinite(value)) return;- const limits = { scale: [10, 400], rotation: [-180, 180], positionX: [-100, 100], positionY: [-100, 100] } as const;- const [minimum, maximum] = limits[key];+ const [minimum, maximum] = TRANSFORM_LIMITS[key];updateClip(selected.id, { transform: roundClipTransform({ ...selectedTransform, [key]: Math.max(minimum, Math.min(maximum, value)) }) });};const toggleTrack = (trackId: string, key: "muted" | "locked") => updateTracks(tracks.map((track) => track.id === trackId ? { ...track, [key]: !track[key] } : track));- /* Every removal — the toolbar, the key, the × on the clip itself — goes- through one function, so a locked track refuses all three. */+ /* Every removal — the toolbar, the key, the context menu — goes through one+ function, so a locked track refuses all three. */const deleteClip = (clipId: string) => {const next = removeClip(tracks, clipId);if (!next) return;@@ -305,40 +460,73 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {setSelectedId((current) => (current === clipId ? "" : current));};const removeSelected = () => { if (selected) deleteClip(selected.id); };- const duplicateSelected = () => {- if (!selected || !selectedTrack || selectedTrack.locked) return;+ const duplicateClip = (clip: TimelineClip | undefined) => {+ const track = tracks.find((item) => item.id === clip?.trackId);+ if (!clip || !track || track.locked) return;/* The spread carries sourceStartMs with everything else, so duplicating aclip that was split off the middle of a rush copies THAT range of thefootage, not the head of the file. Only the id, the position on theruler, and the name are new. */- const copy = { ...selected, id: `${selected.id}-copy-${Date.now()}`, label: `${selected.label} copy` };+ const copy = { ...clip, id: `${clip.id}-copy-${Date.now()}`, label: `${clip.label} copy` };// Straight after the original if that is free, and otherwise wherever the// lane has room: a copy laid on top of another clip is not a copy of the// cut, it is two clips claiming one moment.- const next = insertClip(tracks, selected.trackId, copy, selected.startMs + selected.durationMs);+ const next = insertClip(tracks, clip.trackId, copy, clip.startMs + clip.durationMs);if (!next) return;updateTracks(next);setSelectedId(copy.id);};- const splitSelected = () => {- if (!selected || !selectedTrack || selectedTrack.locked || playhead <= selected.startMs || playhead >= selected.startMs + selected.durationMs) return;- const leftDuration = playhead - selected.startMs;- const right: TimelineClip = { ...selected, id: `${selected.id}-split-${Date.now()}`, startMs: playhead, durationMs: selected.durationMs - leftDuration, sourceStartMs: selected.sourceStartMs + leftDuration, label: `${selected.label} · B`, transition: undefined };- updateTracks(tracks.map((track) => track.id === selected.trackId ? { ...track, clips: track.clips.flatMap((clip) => clip.id === selected.id ? [{ ...clip, durationMs: leftDuration, label: `${clip.label} · A` }, right] : [clip]) } : track));+ const duplicateSelected = () => duplicateClip(selected);+ const canSplit = (clip: TimelineClip | undefined) => {+ const track = tracks.find((item) => item.id === clip?.trackId);+ return Boolean(clip && track && !track.locked && playhead > clip.startMs && playhead < clipEndMs(clip));+ };+ const splitClip = (clip: TimelineClip | undefined) => {+ if (!clip || !canSplit(clip)) return;+ const leftDuration = playhead - clip.startMs;+ const right: TimelineClip = { ...clip, id: `${clip.id}-split-${Date.now()}`, startMs: playhead, durationMs: clip.durationMs - leftDuration, sourceStartMs: clip.sourceStartMs + leftDuration, label: `${clip.label} · B`, transition: undefined };+ updateTracks(tracks.map((track) => track.id === clip.trackId ? { ...track, clips: track.clips.flatMap((item) => item.id === clip.id ? [{ ...item, durationMs: leftDuration, label: `${item.label} · A` }, right] : [item]) } : track));setSelectedId(right.id);};- /* Mirrors splitSelected's own guard, one condition for one condition. The- button used to stay live with the playhead outside the clip, so pressing it- silently did nothing. Null means Split will actually cut. */+ const splitSelected = () => splitClip(selected);+ /* Clipboard. Copy holds the clip as it is; Cut is Copy then Delete; Paste+ lays a copy at the playhead (or where the lane was right-clicked) on the+ selected clip's track, falling back to the track it was copied from. */+ const copyClip = (clip: TimelineClip | undefined) => {+ if (!clip) return;+ clipboard.current = clip;+ setHasClipboard(true);+ };+ const cutClip = (clip: TimelineClip | undefined) => {+ if (!clip) return;+ const track = tracks.find((item) => item.id === clip.trackId);+ if (!track || track.locked) return;+ copyClip(clip);+ deleteClip(clip.id);+ };+ const paste = (trackId?: string, atMs = playhead) => {+ const source = clipboard.current;+ if (!source) return;+ const candidates = [trackId, selectedTrack?.id, source.trackId, ...tracks.filter((track) => track.kind === "video").map((track) => track.id)];+ for (const candidate of candidates) {+ if (!candidate) continue;+ const id = `${source.id.replace(/-paste-\d+$/, "")}-paste-${Date.now()}`;+ const next = pasteClip(tracks, source, candidate, atMs, id);+ if (!next) continue;+ updateTracks(next);+ setSelectedId(id);+ return;+ }+ };+ /* Same rule as Split: a disabled control says why it is disabled, and the+ predicate is the handler's own guard rather than a looser approximation. */const splitBlockedBy = !selected? "Select a clip to split it": !selectedTrack || selectedTrack.locked? "This clip’s track is locked"- : playhead <= selected.startMs || playhead >= selected.startMs + selected.durationMs+ : !canSplit(selected)? "Move the playhead inside the selected clip to split it": null;- /* Same rule as Split: a disabled control says why it is disabled, and the- predicate is the handler's own guard rather than a looser approximation. */const duplicateBlockedBy = !selected? "Select a clip to duplicate it": !selectedTrack || selectedTrack.locked ? "This clip’s track is locked" : null;@@ -348,7 +536,99 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {/* Same rule again for the transport: every one of its controls is off for thesame reason, and saying that reason is the difference between a disabledbutton and a broken one. */- const transportBlockedBy = clipCount === 0 ? "Nothing to play yet — add or generate a scene first." : null;+ const transportBlockedBy = clipCount === 0 ? "Nothing to play yet" : null;++ /* --- Transport ------------------------------------------------------------ */++ const frameOf = (ms: number) => frameAt(ms, fps);+ const goTo = (ms: number) => {+ setPlaying(false);+ setRate(1);+ setPlayhead(Math.round(Math.max(0, Math.min(duration, ms))));+ };+ const stepFrames = (frames: number) => goTo(frameStartMs(Math.max(0, frameOf(playhead) + frames), fps));+ const togglePlay = () => {+ if (clipCount === 0) return;+ if (playing) { setPlaying(false); setRate(1); return; }+ // Pressing Play with the playhead already past the last frame used to+ // start playback that immediately stopped, which reads as a broken+ // button. From the end, Play means play it again.+ if (playhead >= contentEndMs) setPlayhead(0);+ setRate(1);+ setPlaying(true);+ };+ /* J / K / L: reverse, stop, forward. Pressing J or L again while it is+ already shuttling that way doubles the speed, up to 4×. */+ const shuttle = (direction: -1 | 1) => {+ if (clipCount === 0) return;+ const current = playing ? rate : 0;+ const speed = Math.sign(current) === direction+ ? SHUTTLE_SPEEDS[Math.min(SHUTTLE_SPEEDS.length - 1, SHUTTLE_SPEEDS.indexOf(Math.abs(current)) + 1)]+ : 1;+ if (direction > 0 && !playing && playhead >= contentEndMs) setPlayhead(0);+ setRate(direction * speed);+ setPlaying(true);+ };+ const markIn = (ms = playhead) => { setInMs(ms); if (outMs !== null && outMs <= ms) setOutMs(null); };+ const markOut = (ms = playhead) => { setOutMs(ms); if (inMs !== null && inMs >= ms) setInMs(null); };+ const clearInOut = () => { setInMs(null); setOutMs(null); };+ const commitTimecode = () => {+ if (timecodeDraft === null) return;+ const parsed = parseTimecode(timecodeDraft, fps);+ setTimecodeDraft(null);+ if (parsed !== null) goTo(parsed);+ };+ const renameSelected = () => {+ if (!selected) return;+ if (!inspectorOpen) toggleInspector();+ requestAnimationFrame(() => { clipNameRef.current?.focus(); clipNameRef.current?.select(); });+ };++ /* --- Keyboard ----------------------------------------------------------------+ Scoped to this view: they fire while focus is anywhere inside it (the+ view itself is focusable, so a click on any empty part of it counts) and+ never from a text field. Ctrl+Z / Ctrl+Y are NOT here: undo is the+ project's, bound once in ProjectWorkspace, and every edit below goes+ through onChange so it lands on that stack. */+ const scope = { scope: viewRef };+ const arrows = (run: () => void) => (event: KeyboardEvent) => { if (ownsArrowKeys(event.target)) return false; run(); };+ useShortcut("Space", (event) => {+ const target = event.target as Element | null;+ if (target instanceof HTMLButtonElement || target?.closest?.('[role="tab"], [role="slider"]')) return false;+ if (clipCount === 0) return false;+ togglePlay();+ }, scope);+ useShortcut("J", () => shuttle(-1), scope);+ useShortcut("K", () => { setPlaying(false); setRate(1); }, scope);+ useShortcut("L", () => shuttle(1), scope);+ useShortcut("ArrowLeft", arrows(() => stepFrames(-1)), scope);+ useShortcut("ArrowRight", arrows(() => stepFrames(1)), scope);+ useShortcut("Shift+ArrowLeft", arrows(() => goTo(playhead - 1000)), scope);+ useShortcut("Shift+ArrowRight", arrows(() => goTo(playhead + 1000)), scope);+ useShortcut("Home", arrows(() => goTo(0)), scope);+ useShortcut("End", arrows(() => goTo(contentEndMs)), scope);+ useShortcut("ArrowUp", arrows(() => { const cut = adjacentCut(tracks, playhead, -1); if (cut !== null) goTo(cut); }), scope);+ useShortcut("ArrowDown", arrows(() => { const cut = adjacentCut(tracks, playhead, 1); if (cut !== null) goTo(cut); }), scope);+ useShortcut("I", () => markIn(), scope);+ useShortcut("O", () => markOut(), scope);+ useShortcut("Ctrl+Shift+X", clearInOut, scope);+ useShortcut("Ctrl+K", splitSelected, scope);+ useShortcut("Ctrl+D", duplicateSelected, scope);+ useShortcut("Ctrl+C", () => { if (!selected) return false; copyClip(selected); }, scope);+ useShortcut("Ctrl+X", () => { if (!selected) return false; cutClip(selected); }, scope);+ useShortcut("Ctrl+V", () => { if (!clipboard.current) return false; paste(); }, scope);+ useShortcut("F2", () => { if (!selected) return false; renameSelected(); }, scope);+ useShortcut(["-", "_"], () => zoomTo(pxPerSecond / ZOOM_STEP), scope);+ useShortcut(["=", "+"], () => zoomTo(pxPerSecond * ZOOM_STEP), scope);+ useShortcut(["Delete", "Backspace"], (event) => {+ /* A focused media card is what Delete means: take the file out of the+ project (and its clips off the timeline). Anywhere else, the clip. */+ const card = (event.target as Element | null)?.closest?.("[data-asset-id]") as HTMLElement | null;+ if (card?.dataset.assetId) { removeMediaAsset(card.dataset.assetId); return; }+ if (!selected) return false;+ removeSelected();+ }, scope);+const importMedia = async () => {setImportError(null);setImporting(true);@@ -409,21 +689,12 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {hasAudio: asset.hasAudio ?? value.hasAudio,});/* Measurements arrive from asynchronous decodes, and two of them can land- between one render and the next. They queue here so that two arriving in- the same render are not written one over the other — but the queue alone- never fixed the real race, which is between two FLUSHES rather than two- measurements. `{ ...config, assets }` is built from the config THIS render- closed over, and the second flush can run before the first write has come- back down as a new prop: it then rebuilds the whole config from the stale- one and the first measurement is gone. With five files decoding at their- own speeds that lost most of them, non-deterministically, and the only cure- was leaving the panel and re-reading every file from disk.-- So nothing here writes a config. It hands up an UPDATER, which the holder- applies to whatever its latest config is — a flush can no longer be stale,- because it no longer carries a config of its own. The queue is drained into- a local BEFORE the updater is built, so the updater stays pure and can be- called twice (StrictMode, a replayed render) without eating the queue. */+ between one render and the next. They queue here, and nothing here writes a+ config: it hands up an UPDATER, which the holder applies to whatever its+ latest config is — a flush can no longer be stale, because it no longer+ carries a config of its own. The queue is drained into a local BEFORE the+ updater is built, so the updater stays pure and can be called twice+ (StrictMode, a replayed render) without eating the queue. */const measurements = useRef(new Map<string, MeasuredMedia>());const [measureTick, setMeasureTick] = useState(0);const recordMeasured = (assetId: string, value: MeasuredMedia) => {@@ -461,7 +732,7 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {const sourceLimitMs = selected && selectedAsset?.kind !== "image" && selectedAsset?.durationMs? Math.max(1, selectedAsset.durationMs - selected.sourceStartMs): null;- const minClipMs = Math.max(1, Math.round(1000 / config.settings.frameRate));+ const minClipMs = Math.max(1, Math.round(1000 / fps));/** What the FILE has left at each end of a clip. A still image and a file* nothing has measured have no source timeline to run out of, and get no* limit rather than a guessed one. */@@ -469,16 +740,16 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {const asset = assetById(clip.assetId);return sourceRoom(clip, asset && asset.kind !== "image" ? asset.durationMs ?? null : null);};+ /* Typing a length is trimming the tail, so it is the same operation the+ right-hand handle performs — same floor of one frame, same ceiling in the+ footage, and the same refusal to grow over the next clip on the track. */const typeDuration = (value: string) => {setDurationDraft(value);- const parsed = selected ? parseDuration(value, config.settings.frameRate) : null;+ const parsed = selected ? parseTimecode(value, fps) : null;if (parsed === null || !selected) return;const next = trimClip(tracks, selected.id, "end", selected.startMs + parsed, { minClipMs, room: roomFor(selected) });if (next) updateTracks(next);};- /* Typing a length is trimming the tail, so it is the same operation the- right-hand handle performs — same floor of one frame, same ceiling in the- footage, and the same refusal to grow over the next clip on the track. *//* Snapping, measured against a lane that is `widthPx` wide. A lane nothinghas laid out yet — jsdom, a panel that has never been painted — gives atolerance of 0, which turns the magnet off instead of inventing a scale. */@@ -588,11 +859,11 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {======================================================================= */const beginDrag = (event: React.PointerEvent<HTMLElement>, clip: TimelineClip, mode: DragMode) => {- // Left button only: a right-click is a context menu, and a middle-click is- // a scroll gesture in most shells.+ // Left button only: a right-click opens the clip's context menu, and a+ // middle-click is a scroll gesture in most shells.if (event.button !== 0) return;const track = tracks.find((item) => item.id === clip.trackId);- if (!track || track.locked) return;+ if (!track || track.locked) { setSelectedId(clip.id); return; }const lane = (event.currentTarget as HTMLElement).closest(".track-lane") as HTMLElement | null;const rect = lane?.getBoundingClientRect();// Nothing has been laid out: there is no scale to turn pixels into time@@ -665,6 +936,7 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {/* Registered once per drag rather than per render: the handlers read thesession out of a ref, so a preview landing mid-drag must not tear thelisteners down and put them back. */+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [dragging, minClipMs]);/* What the lanes draw: the drag if there is one, and the project otherwise.@@ -693,62 +965,157 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {const addScene = () => {// A new project already carries an unstarted draft made from the user's own// words, so open that rather than stacking a near-identical second shot.- // With none left, go to an empty composer.- //- // createProjectConfig does seed that FIRST draft from config.brief.prompt,- // and this is not a disagreement with it. The brief describes the whole- // video, which is a fair opening for the one shot a project starts with —- // there is nothing else to go on, and it is there to be rewritten. Every- // later shot has that same paragraph already spent on the shot before it,- // so repeating it would describe the whole video a second time and call it- // shot two.+ // With none left, go to an empty composer. Every later shot has the brief+ // already spent on the shot before it, so repeating it would describe the+ // whole video a second time and call it shot two.onOpenGenerator(config.generationJobs.find((job) => job.status === "draft")?.id);};+ /* --- Context menus ----------------------------------------------------------- */++ const clipMenuItems = (clip: TimelineClip): MenuEntry[] => {+ const track = tracks.find((item) => item.id === clip.trackId);+ const locked = !track || track.locked;+ return [+ { label: "Cut", shortcut: "Ctrl+X", disabled: locked, onSelect: () => cutClip(clip) },+ { label: "Copy", icon: <Copy size={16} />, shortcut: "Ctrl+C", onSelect: () => copyClip(clip) },+ { label: "Paste", shortcut: "Ctrl+V", disabled: !hasClipboard, onSelect: () => paste(clip.trackId) },+ { separator: true },+ { label: "Split at playhead", icon: <Scissors size={16} />, shortcut: "Ctrl+K", disabled: !canSplit(clip), onSelect: () => splitClip(clip) },+ { label: "Duplicate", shortcut: "Ctrl+D", disabled: locked, onSelect: () => duplicateClip(clip) },+ { label: "Rename", shortcut: "F2", onSelect: () => { setSelectedId(clip.id); renameSelected(); } },+ { separator: true },+ { label: "Delete", icon: <Trash2 size={16} />, shortcut: "Delete", danger: true, disabled: locked, onSelect: () => deleteClip(clip.id) },+ ];+ };+ const laneTimeAt = (event: React.MouseEvent<HTMLElement>) => {+ const rect = event.currentTarget.getBoundingClientRect();+ return rect.width > 0 ? Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width)) * duration : playhead;+ };++ /* The rows call back through a ref so they can be memoised (see+ TrackActions): nothing in a lane changes when only the playhead moves. */+ const actions = useRef<TrackActions>(null as unknown as TrackActions);+ actions.current = {+ select: setSelectedId,+ toggle: toggleTrack,+ rename: renameTrack,+ clipPointerDown: beginDrag,+ clipMenu: (event, clip) => {+ setSelectedId(clip.id);+ menu.open(event, clipMenuItems(clip), { "aria-label": `${clip.label} actions` });+ },+ laneMenu: (event, track) => {+ const at = laneTimeAt(event);+ menu.open(event, [+ { label: "Paste here", shortcut: "Ctrl+V", disabled: !hasClipboard || track.locked, onSelect: () => paste(track.id, at) },+ { separator: true },+ { label: track.muted ? "Unmute track" : "Mute track", onSelect: () => toggleTrack(track.id, "muted") },+ { label: track.locked ? "Unlock track" : "Lock track", onSelect: () => toggleTrack(track.id, "locked") },+ ], { "aria-label": `${track.name} actions` });+ },+ dragOverLane: (event, track) => {+ const hasAsset = event.dataTransfer.types.includes(ASSET_DRAG_TYPE);+ const hasScene = event.dataTransfer.types.includes(SCENE_DRAG_TYPE);+ if ((!hasAsset || !acceptsAsset(track, draggedAsset)) && (!hasScene || !acceptsScene(track, draggedScene))) return;+ event.preventDefault();+ event.dataTransfer.dropEffect = "copy";+ setDropTrackId(track.id);+ },+ dragLeaveLane: (track) => setDropTrackId((current) => current === track.id ? null : current),+ dropLane: (event, track) => {+ event.preventDefault();+ setDropTrackId(null);+ const jobId = event.dataTransfer.getData(SCENE_DRAG_TYPE);+ const rect = event.currentTarget.getBoundingClientRect();+ const ratio = rect.width > 0 ? (event.clientX - rect.left) / rect.width : 0;+ if (jobId) {+ dropScene(track.id, jobId, ratio, rect.width);+ return;+ }+ const assetId = event.dataTransfer.getData(ASSET_DRAG_TYPE);+ if (!assetId) return;+ // A zero-width lane would make the ratio NaN and the clip's start+ // time with it, which zod then refuses to save.+ dropAsset(track.id, assetId, ratio, rect.width);+ },+ };++ const rulerMenu = (event: React.MouseEvent<HTMLElement>) => {+ const at = timeAtRuler(event.clientX) ?? playhead;+ menu.open(event, [+ { label: "Set in point", shortcut: "I", onSelect: () => markIn(at) },+ { label: "Set out point", shortcut: "O", onSelect: () => markOut(at) },+ { separator: true },+ { label: "Clear in and out", shortcut: "Ctrl+Shift+X", disabled: inMs === null && outMs === null, onSelect: clearInOut },+ ], { "aria-label": "Ruler actions" });+ };++ /* --- Program monitor ------------------------------------------------------ */++ const frameSize = outputDimensions(config.settings.resolution, config.settings.aspectRatio);+ const monitorScale = monitorZoom === "fit" ? null : Number(monitorZoom) / 100;+ const stageStyle = {+ "--frame-aspect": frameSize.width / frameSize.height,+ ...(monitorScale ? { width: frameSize.width * monitorScale, height: frameSize.height * monitorScale, flex: "none" } : {}),+ } as React.CSSProperties;++ /* The ruler is memoised (it must not re-render with every playhead frame),+ so it gets handlers whose identity never changes. */+ const rulerHandlers = useRef({ beginScrub, rulerMenu });+ rulerHandlers.current = { beginScrub, rulerMenu };+ const onRulerPointerDown = useCallback((event: React.PointerEvent<HTMLElement>) => rulerHandlers.current.beginScrub(event), []);+ const onRulerMenu = useCallback((event: React.MouseEvent<HTMLElement>) => rulerHandlers.current.rulerMenu(event), []);++ const playheadRatio = Math.max(0, Math.min(1, playhead / duration));+ const panelsClass = `edit-panels${sourcesOpen ? "" : " edit-panels--no-sources"}${inspectorOpen ? "" : " edit-panels--no-inspector"}`;+return (- <div className={`timeline-view ${dragging ? "timeline-view--dragging" : ""}`} tabIndex={0} onKeyDown={(event) => {- /* Delete works from the view itself and from a focused clip — the clip IS- the thing being deleted, and having to leave it first to press the key- is the kind of rule only the code knows. It deliberately does NOT fire- from a text field: a Backspace in the clip's name is an edit. */- const target = event.target as HTMLElement;- const fromClip = target.classList?.contains("timeline-clip");- if ((event.key === "Delete" || event.key === "Backspace") && (event.target === event.currentTarget || fromClip)) removeSelected();- if (event.code === "Space" && (event.target === event.currentTarget || fromClip) && clipCount > 0) { event.preventDefault(); setPlaying((value) => !value); }- }}>+ <div+ ref={viewRef}+ className={`timeline-view ${dragging ? "timeline-view--dragging" : ""}`}+ tabIndex={0}+ style={{ ...sourcesPane.style, ...inspectorPane.style, ...timelinePane.style, ...trackPane.style }}+ >{/* The view had no top-level heading at all, so screen-reader users had- no landmark for it. Sighted users already see the project topbar. */}+ no landmark for it. Sighted users already see the title bar. */}<h1 className="sr-only">Timeline editor</h1>- <div className="edit-panels">- <aside className="scene-panel">- <div className="panel-tabs">- <button className={panelTab === "scenes" ? "active" : ""} onClick={() => setPanelTab("scenes")}><Layers3 size={16} /> Scenes</button>- <button className={panelTab === "media" ? "active" : ""} onClick={() => setPanelTab("media")}><Film size={16} /> Media</button>- </div>+ <div className={panelsClass}>+ {sourcesOpen && <aside className="scene-panel" aria-label="Scenes and media">+ <SelectorBar+ className="panel-tabs"+ aria-label="Scenes and media"+ value={panelTab}+ onChange={setPanelTab}+ items={[+ { value: "scenes", label: "Scenes", icon: <Layers3 size={16} /> },+ { value: "media", label: "Media", icon: <Film size={16} /> },+ ]}+ />{panelTab === "media" && <div className="scene-panel__head"><button- className="media-import-button"+ className="secondary-button media-import-button"onClick={() => void importMedia()}disabled={importing || !isTauri()}- title={isTauri() ? "Add video, sound, or image files — video and sound stay where they are, images are copied in" : "Importing files is available in the desktop app"}+ {...tooltipProps(isTauri() ? "Add video, sound or image files. Video and sound stay where they are; images are copied in." : "Importing files is available in the desktop app")}><Upload size={16} /> Import</button><div className="layout-toggle" role="group" aria-label="Media layout">- <button- className={mediaLayout === "grid" ? "active" : ""}- aria-pressed={mediaLayout === "grid"}- onClick={() => chooseMediaLayout("grid")}- title="Show media as a grid of pictures"- ><LayoutGrid size={16} /><span className="sr-only">Grid</span></button>- <button- className={mediaLayout === "list" ? "active" : ""}- aria-pressed={mediaLayout === "list"}- onClick={() => chooseMediaLayout("list")}- title="Show media as a list"- ><List size={16} /><span className="sr-only">List</span></button>- </div>+ <button+ className={mediaLayout === "grid" ? "active" : ""}+ aria-pressed={mediaLayout === "grid"}+ onClick={() => chooseMediaLayout("grid")}+ {...tooltipProps("Grid")}+ ><LayoutGrid size={16} /><span className="sr-only">Grid</span></button>+ <button+ className={mediaLayout === "list" ? "active" : ""}+ aria-pressed={mediaLayout === "list"}+ onClick={() => chooseMediaLayout("list")}+ {...tooltipProps("List")}+ ><List size={16} /><span className="sr-only">List</span></button>+ </div></div>}{panelTab === "scenes" ? (- <div className="scene-list">+ <div className="scene-list" role="tabpanel" aria-label="Scenes">{config.generationJobs.map((job, index) => {const assetIds = new Set([generationAssetId(job.id),@@ -759,7 +1126,11 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {key={job.id}className="scene-card"draggable+ data-scene-id={job.id}onClick={() => onOpenGenerator(job.id)}+ onContextMenu={(event) => menu.open(event, [+ { label: "Open in Generator", onSelect: () => onOpenGenerator(job.id) },+ ], { "aria-label": `${job.title} actions` })}onDragStart={(event) => {event.dataTransfer.setData(SCENE_DRAG_TYPE, job.id);event.dataTransfer.effectAllowed = "copy";@@ -767,26 +1138,30 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {setDraggedAsset(undefined);}}onDragEnd={() => { setDraggedScene(undefined); setDropTrackId(null); }}- title={`${job.title} — drag onto a track below`}+ {...tooltipProps(`${job.title}. Drag onto a track to use it.`)}><span className="scene-card__thumb">- {job.status !== "draft" && <ShotThumbnail folderPath={folderPath} job={job} seconds={0} shotNumber={1} estimatedCompletionAt={generationCompletionTimes[job.id] ?? null} />}+ {job.status !== "draft" ? <ShotThumbnail folderPath={folderPath} job={job} seconds={0} shotNumber={1} estimatedCompletionAt={generationCompletionTimes[job.id] ?? null} />+ : <Film size={20} className="scene-card__glyph" aria-hidden="true" />}<i>{String(index + 1).padStart(2, "0")}</i><em>{sceneDurationSeconds(job).toFixed(1)}s</em></span><span><b>{job.title}</b><small>{STATUS_WORD[job.status]}{placements > 0 ? ` · ${placements} on timeline` : ""}</small><small>{sceneShape(job)}</small></span></button>;})}- <button className="scene-add" onClick={addScene}><Plus size={18} /> Add or generate a scene</button>+ <button className="secondary-button scene-add" onClick={addScene}><Plus size={16} /> Add scene</button></div>) : (- <div className={`media-grid media-grid--${mediaLayout}`}>+ <div className={`media-grid media-grid--${mediaLayout}`} role="tabpanel" aria-label="Media">{/* Draggable onto the timeline. `draggable` on a <button> is thewhole mechanism — the button still clicks and still takes- focus, so keyboard users are not shut out of selecting it. */}+ focus, so keyboard users are not shut out of selecting it.+ Removing a file is Delete on the focused card, or its context+ menu: no × on every card. */}{mediaAssets.map((asset) => <div className="media-card" key={asset.id}><buttonclassName="media-card__source"draggable+ data-asset-id={asset.id}onDragStart={(event) => {event.dataTransfer.setData(ASSET_DRAG_TYPE, asset.id);event.dataTransfer.effectAllowed = "copy";@@ -794,211 +1169,306 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {setDraggedScene(undefined);}}onDragEnd={() => { setDraggedAsset(undefined); setDropTrackId(null); }}- title={`${asset.name} — drag onto a ${asset.kind === "audio" ? "sound" : "video"} track below`}+ onContextMenu={(event) => menu.open(event, [+ { label: "Remove from project", icon: <Trash2 size={16} />, shortcut: "Delete", danger: true, onSelect: () => removeMediaAsset(asset.id) },+ ], { "aria-label": `${asset.name} actions` })}+ {...tooltipProps(`${asset.name}. Drag onto a track to use it.`)}><MediaThumbnail folderPath={folderPath} asset={asset} onMeasured={(measured) => recordMeasured(asset.id, measured)} /><b>{asset.name}</b>{/* Duration is only claimed when something actually measured it. */}<small>{asset.kind}{asset.durationMs ? ` · ${(asset.durationMs / 1000).toFixed(1)}s` : ""}</small></button>- <button- className="media-card__remove"- aria-label={`Remove ${asset.name} from project`}- title={`Remove ${asset.name} from the project and timeline`}- onClick={() => removeMediaAsset(asset.id)}- ><X size={14} /></button></div>)}{importError && <p className="panel-hint panel-hint--error" role="alert">{importError}</p>}</div>)}- </aside>+ </aside>}+ {sourcesOpen && <Splitter {...sourcesPane.splitterProps} className="edit-panels__splitter" aria-label="Resize media panel" />}<main className="program-panel"><h2 className="sr-only">Program monitor</h2>- <div className="program-canvas">- {/* The real picture now: the clip under the playhead, decoded from- its own file. What used to stand here was a panel explaining- that Slopus could not play footage back — true when it was- written, and no longer. An empty timeline still shows an empty- monitor, which says by itself that nothing is cut yet. */}- {clipCount > 0- ? <ProgramMonitor- config={config}- folderPath={folderPath}- playheadMs={playhead}- playing={playing}- onSeek={seek}- onPlayingChange={setPlayingFromMonitor}- selectedClipId={selectedId}- transformEditingDisabled={selectedTrack?.locked ?? false}- onSelectClip={setSelectedId}- onTransformChange={(clipId, transform) => updateClip(clipId, { transform: roundClipTransform(transform) })}- />- : <div className="program-empty">- <span>Drop a file from Media onto a track below, or generate a scene, and it plays here.</span>- </div>}+ <div className={`program-canvas${monitorScale ? " program-canvas--zoomed" : ""}`}>+ <div className="program-stage" style={stageStyle}>+ {/* The real picture: the clip under the playhead, decoded from+ its own file. An empty timeline still shows an empty monitor+ with one muted line saying why. */}+ {clipCount > 0+ ? <ProgramMonitor+ config={config}+ folderPath={folderPath}+ playheadMs={playhead}+ playing={playing}+ rate={rate}+ onSeek={seek}+ onPlayingChange={setPlayingFromMonitor}+ selectedClipId={selectedId}+ transformEditingDisabled={selectedTrack?.locked ?? false}+ onSelectClip={setSelectedId}+ onTransformChange={(clipId, transform) => updateClip(clipId, { transform: roundClipTransform(transform) })}+ />+ : <div className="program-empty"><span>Drop media on a track, or generate a scene.</span></div>}+ {safeArea && <div className="program-safe" aria-hidden="true"><i className="program-safe__frame"><b className="program-safe__action" /><b className="program-safe__title" /></i></div>}+ </div></div>+ <footer className="program-footer">+ <span className="program-footer__time" aria-label="Playhead">{formatTimecode(playhead, fps)}</span>+ <span className="program-footer__duration" aria-label="Duration">{formatTimecode(contentEndMs, fps)}</span>+ <span className="program-footer__spacer" />+ <ComboBox+ className="program-footer__zoom"+ aria-label="Monitor zoom"+ value={monitorZoom}+ onChange={(value) => setMonitorZoom(value as MonitorZoom)}+ options={[{ value: "fit", label: "Fit" }, { value: "50", label: "50%" }, { value: "100", label: "100%" }]}+ />+ <button+ type="button"+ className={`program-footer__toggle${safeArea ? " active" : ""}`}+ aria-pressed={safeArea}+ aria-label="Safe areas"+ {...tooltipProps("Title and action safe areas")}+ onClick={() => setSafeArea((value) => !value)}+ ><LayoutGrid size={14} aria-hidden="true" /></button>+ </footer></main>- <aside className="clip-inspector" aria-label="Clip inspector">+ {inspectorOpen && <Splitter {...inspectorPane.splitterProps} reverse className="edit-panels__splitter" aria-label="Resize inspector" />}+ {inspectorOpen && <aside className="clip-inspector" aria-label="Clip inspector">{selected ? <>- <section className="inspector-section">+ <div className="inspector-title"><h3 aria-label={selected.label}><input+ ref={clipNameRef}className="clip-title__name"value={selected.label}aria-label="Clip name"- title="Rename this clip"+ {...tooltipProps("Rename", "F2")}onChange={(event) => updateClip(selected.id, { label: event.target.value || "Untitled clip" })}/></h3>- <div className="field-pair">- <label><span>Starts at</span><input value={timecode(selected.startMs).slice(3)} readOnly /></label>- <label><span>Lasts</span><input- value={durationDraft ?? timecode(selected.durationMs).slice(3)}+ </div>+ <PropSection title="Timing" persistKey="timeline.clip.timing">+ <PropRow label="Starts at"><span className="inspector-value">{formatTimecode(selected.startMs, fps)}</span></PropRow>+ <PropRow label="Duration" htmlFor="clip-duration">+ <input+ id="clip-duration"+ className="text-field inspector-timecode"+ value={durationDraft ?? formatTimecode(selected.durationMs, fps)}onChange={(event) => typeDuration(event.target.value)}onBlur={() => setDurationDraft(null)}- title={`How long this clip lasts — minutes:seconds:frames, or just seconds.${sourceLimitMs === null ? "" : ` This footage has ${(sourceLimitMs / 1000).toFixed(1)}s left from where the clip starts in it.`}`}+ {...tooltipProps(`HH:MM:SS:FF, MM:SS or seconds.${sourceLimitMs === null ? "" : ` ${(sourceLimitMs / 1000).toFixed(1)}s of footage left.`}`)}inputMode="decimal"- /></label>- </div>- </section>- <section className="inspector-section">- <h3>Transform</h3>- <div className="field-pair">- <label><span>Scale (%)</span><CommittedNumberInput minimum={10} maximum={400} step="1" value={selectedTransform?.scale ?? 100} disabled={visualControlsDisabled} onCommit={(value) => updateTransform("scale", value)} /></label>- <label><span>Rotation (°)</span><CommittedNumberInput minimum={-180} maximum={180} step="1" value={selectedTransform?.rotation ?? 0} disabled={visualControlsDisabled} onCommit={(value) => updateTransform("rotation", value)} /></label>- </div>- <div className="field-pair">- <label><span>Position X (%)</span><CommittedNumberInput minimum={-100} maximum={100} step="1" value={selectedTransform?.positionX ?? 0} disabled={visualControlsDisabled} onCommit={(value) => updateTransform("positionX", value)} /></label>- <label><span>Position Y (%)</span><CommittedNumberInput minimum={-100} maximum={100} step="1" value={selectedTransform?.positionY ?? 0} disabled={visualControlsDisabled} onCommit={(value) => updateTransform("positionY", value)} /></label>- </div>- </section>- <ClipEffects clip={selected} disabled={visualControlsDisabled} onChange={(patch) => updateClip(selected.id, patch)} />- </> : clipCount === 0- ? <div className="inspector-empty"><MouseSelection /><b>Nothing to edit yet</b><span>Once a scene lands on the timeline, select it here to rename it and check its timing.</span></div>- : <div className="inspector-empty"><MouseSelection /><b>Select a clip to edit it</b><span>Pick any clip on the timeline below to rename it, check its timing, and see how it was made.</span></div>}- </aside>+ />+ </PropRow>+ </PropSection>+ <PropSection title="Transform" persistKey="timeline.clip.transform">+ {([+ ["scale", "Scale", "%", 100],+ ["rotation", "Rotation", "°", 0],+ ["positionX", "Position X", "%", 0],+ ["positionY", "Position Y", "%", 0],+ ] as const).map(([key, label, unit, fallback]) => {+ const value = selectedTransform?.[key] ?? fallback;+ const [minimum, maximum] = TRANSFORM_LIMITS[key];+ return <PropRow+ key={key}+ label={label}+ htmlFor={`clip-${key}`}+ value={value}+ defaultValue={fallback}+ onReset={visualControlsDisabled ? undefined : () => updateTransform(key, fallback)}+ scrub={visualControlsDisabled ? undefined : { value, onChange: (next) => updateTransform(key, next), min: minimum, max: maximum, step: 1 }}+ >+ <CommittedNumberInput id={`clip-${key}`} className="text-field" aria-label={label} minimum={minimum} maximum={maximum} step="1" value={value} disabled={visualControlsDisabled} onCommit={(next) => updateTransform(key, next)} />+ <span className="inspector-unit">{unit}</span>+ </PropRow>;+ })}+ </PropSection>+ <PropSection title="Effects" persistKey="timeline.clip.effects">+ <ClipEffects clip={selected} disabled={visualControlsDisabled} onChange={(patch) => updateClip(selected.id, patch)} />+ </PropSection>+ </> : <div className="inspector-empty">+ <span>{clipCount === 0 ? "Nothing on the timeline yet" : "No clip selected"}</span>+ </div>}+ </aside>}</div>+ <Splitter {...timelinePane.splitterProps} orientation="horizontal" reverse className="timeline-view__splitter" aria-label="Resize timeline" />+<section className="pro-timeline"><header className="timeline-toolbar">- {/* What the timeline IS and where it currently stands, reading left to- right from the panel's own heading: name, clock, format. The clock- used to sit inside the transport cluster, which pushed the buttons- off-centre and put a number nobody is aiming at in the middle of- the row. It is still the only timecode on the screen. */}<div className="timeline-toolbar__lead"><h2>Timeline</h2>- <strong className="transport-time" title="Playhead position">{timecode(playhead)}</strong>- <span className="transport-format">{resolutionLabel(config.settings.resolution, config.settings.aspectRatio)} · {config.settings.frameRate} fps</span>+ {timecodeDraft === null+ ? <button+ type="button"+ className="transport-time"+ aria-label={`Playhead ${formatTimecode(playhead, fps)}. Select to type a time.`}+ {...tooltipProps("Go to time")}+ onClick={() => setTimecodeDraft(formatTimecode(playhead, fps))}+ >{formatTimecode(playhead, fps)}</button>+ : <input+ className="text-field transport-time transport-time--editing"+ aria-label="Go to time"+ autoFocus+ value={timecodeDraft}+ onChange={(event) => setTimecodeDraft(event.target.value)}+ onFocus={(event) => event.currentTarget.select()}+ onBlur={() => setTimecodeDraft(null)}+ onKeyDown={(event) => {+ if (event.key === "Enter") { event.preventDefault(); commitTimecode(); }+ if (event.key === "Escape") { event.preventDefault(); setTimecodeDraft(null); }+ }}+ />}+ <span className="transport-format">{resolutionLabel(config.settings.resolution, config.settings.aspectRatio)} · {fps} fps</span></div>- {/* The transport belongs to the timeline, not to the picture: it drives- the playhead, and the playhead is drawn a few pixels below this row.- Under the monitor it also printed the same timecode this toolbar was- already printing, so one clock was shown twice and could be read as- two. One transport, one timecode, beside the ruler they refer to.-- It is centred on the PICTURE rather than on this row, which are not- the same point: the toolbar runs the full width while the monitor- sits between two side panels of unequal width. See- --video-centre-shift in timeline.css. */}- <div className="timeline-transport">- <button onClick={() => setPlayhead(0)} aria-label="Go to beginning" title={transportBlockedBy ?? "Go to beginning"} disabled={transportBlockedBy !== null}><SkipBack size={18} /></button>- {/* Nothing to play means nothing to play: running the clock over an- empty timeline reads as playback of footage that isn't there. */}- {/* Pressing Play with the playhead already past the last frame used- to start playback that immediately stopped, which reads as a- broken button. From the end, Play means play it again. */}- <button className="play-button" onClick={() => { if (!playing && playhead >= contentEndMs) setPlayhead(0); setPlaying((value) => !value); }} aria-label={playing ? "Pause" : "Play"} disabled={transportBlockedBy !== null} title={transportBlockedBy ?? (playing ? "Pause" : "Play")}>{playing ? <Pause size={18} fill="currentColor" /> : <Play size={18} fill="currentColor" />}</button>- <button onClick={() => setPlayhead(Math.min(duration, playhead + 1000))} aria-label="Step forward one second" title={transportBlockedBy ?? "Step forward one second"} disabled={transportBlockedBy !== null}><SkipForward size={18} /></button>+ {/* Go to start · Frame back · Play/Pause · Frame forward · Go to end —+ the order every NLE uses, flat 28px buttons, no accent fill. */}+ <div className="timeline-transport" role="group" aria-label="Transport">+ <button onClick={() => goTo(0)} aria-label="Go to start" {...tooltipProps(transportBlockedBy ?? "Go to start", transportBlockedBy ? undefined : "Home")} disabled={transportBlockedBy !== null}><ChevronFirst size={16} /></button>+ <button onClick={() => stepFrames(-1)} aria-label="Previous frame" {...tooltipProps(transportBlockedBy ?? "Previous frame", transportBlockedBy ? undefined : "Left")} disabled={transportBlockedBy !== null}><StepBack size={16} /></button>+ <button className="play-button" onClick={togglePlay} aria-label={playing ? "Pause" : "Play"} disabled={transportBlockedBy !== null} {...tooltipProps(transportBlockedBy ?? (playing ? "Pause" : "Play"), transportBlockedBy ? undefined : "Space")}>{playing ? <Pause size={16} /> : <Play size={16} />}</button>+ <button onClick={() => stepFrames(1)} aria-label="Next frame" {...tooltipProps(transportBlockedBy ?? "Next frame", transportBlockedBy ? undefined : "Right")} disabled={transportBlockedBy !== null}><StepForward size={16} /></button>+ <button onClick={() => goTo(contentEndMs)} aria-label="Go to end" {...tooltipProps(transportBlockedBy ?? "Go to end", transportBlockedBy ? undefined : "End")} disabled={transportBlockedBy !== null}><ChevronLast size={16} /></button>+ {playing && rate !== 1 && <span className="transport-rate" aria-live="polite">{rate > 0 ? `${rate}×` : `−${-rate}×`}</span>}</div><div className="timeline-tools">- <button onClick={splitSelected} disabled={splitBlockedBy !== null} title={splitBlockedBy ?? "Split at playhead"}><Scissors size={16} /> Split</button>- <button onClick={duplicateSelected} disabled={duplicateBlockedBy !== null} title={duplicateBlockedBy ?? "Duplicate clip"}><Copy size={16} /> Duplicate</button>- <button onClick={removeSelected} disabled={deleteBlockedBy !== null} title={deleteBlockedBy ?? "Delete selected clip"}><Trash2 size={16} /> Delete</button>+ <button onClick={splitSelected} disabled={splitBlockedBy !== null} {...tooltipProps(splitBlockedBy ?? "Split at playhead", splitBlockedBy ? undefined : "Ctrl+K")}><Scissors size={16} /> Split</button>+ <button onClick={duplicateSelected} disabled={duplicateBlockedBy !== null} {...tooltipProps(duplicateBlockedBy ?? "Duplicate clip", duplicateBlockedBy ? undefined : "Ctrl+D")}><Copy size={16} /> Duplicate</button>+ <button onClick={removeSelected} disabled={deleteBlockedBy !== null} {...tooltipProps(deleteBlockedBy ?? "Delete clip", deleteBlockedBy ? undefined : "Delete")}><Trash2 size={16} /> Delete</button>+ <span className="timeline-tools__separator" aria-hidden="true" />+ <button className="timeline-tools__icon" onClick={() => zoomTo(pxPerSecond / ZOOM_STEP)} disabled={!lanePx || pxPerSecond <= minPps + 1e-6} aria-label="Zoom out" {...tooltipProps("Zoom out", "-")}><ZoomOut size={16} /></button>+ <Slider className="timeline-zoom" aria-label="Timeline zoom" min={0} max={100} step={1} value={zoomSliderValue} disabled={!lanePx} onChange={zoomFromSlider} />+ <button className="timeline-tools__icon" onClick={() => zoomTo(pxPerSecond * ZOOM_STEP)} disabled={!lanePx || pxPerSecond >= maxPps - 1e-6} aria-label="Zoom in" {...tooltipProps("Zoom in", "=")}><ZoomIn size={16} /></button>+ <span className="timeline-tools__separator" aria-hidden="true" />+ <button className={`timeline-tools__icon${sourcesOpen ? " active" : ""}`} onClick={toggleSources} aria-pressed={sourcesOpen} aria-label="Media panel" {...tooltipProps(sourcesOpen ? "Hide media panel" : "Show media panel")}><PanelLeft size={16} /></button>+ <button className={`timeline-tools__icon${inspectorOpen ? " active" : ""}`} onClick={toggleInspector} aria-pressed={inspectorOpen} aria-label="Inspector" {...tooltipProps(inspectorOpen ? "Hide inspector" : "Show inspector")}><PanelRight size={16} /></button></div></header>- <div className={`timeline-grid-scroll${duration > VISIBLE_TIMELINE_MS ? " timeline-grid-scroll--wide" : ""}`}>- <div- className="timeline-grid"- ref={timelineGrid}- style={{ "--lane-grid": `${(tickStepMs / duration) * 100}%`, width: timelineWidth } as React.CSSProperties}- title="Scroll to scrub, or drag along the ruler. Hold Shift to scrub one frame at a time. Clips snap to the cuts around them; Escape abandons a drag.">- <div className="track-corner"><span>Tracks</span></div>- {/* Press to jump, hold and drag to scrub. The monitor seeks to wherever- this lands, so dragging along the ruler runs the picture past under- the pointer — which is what scrubbing IS. Playback stops first:- scrubbing while playing would be two things driving one playhead. */}- <div- className="time-ruler"- onPointerDown={(event) => {- event.currentTarget.setPointerCapture?.(event.pointerId);- dropSelection();- setPlaying(false);- setScrubbing(true);- scrubTo(event.currentTarget, event.clientX);- }}- onPointerMove={(event) => { if (scrubbing) scrubTo(event.currentTarget, event.clientX); }}- onPointerUp={(event) => { event.currentTarget.releasePointerCapture?.(event.pointerId); setScrubbing(false); }}- onPointerCancel={() => setScrubbing(false)}- >- {ticks.map((second) => <span key={second} style={{ left: `${second * 1000 / duration * 100}%` }}><i />{rulerLabel(second)}</span>)}- </div>- {drawnTracks.map((track) => <TrackRow- key={track.id}- track={track}- duration={duration}- folderPath={folderPath}- generatedJobsByAssetId={generatedJobsByAssetId}- assetsById={assetsById}- selectedId={selectedId}- draggingId={dragging ? dragRef.current?.clipId : undefined}- onClipPointerDown={beginDrag}- onDeleteClip={deleteClip}- dropActive={dropTrackId === track.id}- /* A lane that stays dark is indistinguishable from a lane the- pointer simply is not over. Mark incompatible or locked lanes- for the whole drag, not just on hover. */- dropBlocked={(draggedAsset !== undefined && !acceptsAsset(track, draggedAsset))- || (draggedScene !== undefined && !acceptsScene(track, draggedScene))}- onSelect={setSelectedId}- onToggle={toggleTrack}- onRename={renameTrack}- onDragOverLane={(event) => {- const hasAsset = event.dataTransfer.types.includes(ASSET_DRAG_TYPE);- const hasScene = event.dataTransfer.types.includes(SCENE_DRAG_TYPE);- if ((!hasAsset || !acceptsAsset(track, draggedAsset)) && (!hasScene || !acceptsScene(track, draggedScene))) return;- event.preventDefault();- event.dataTransfer.dropEffect = "copy";- setDropTrackId(track.id);- }}- onDragLeaveLane={() => setDropTrackId((current) => current === track.id ? null : current)}- onDropLane={(event) => {- event.preventDefault();- setDropTrackId(null);- const jobId = event.dataTransfer.getData(SCENE_DRAG_TYPE);- const rect = event.currentTarget.getBoundingClientRect();- const ratio = rect.width > 0 ? (event.clientX - rect.left) / rect.width : 0;- if (jobId) {- dropScene(track.id, jobId, ratio, rect.width);- return;- }- const assetId = event.dataTransfer.getData(ASSET_DRAG_TYPE);- if (!assetId) return;- // A zero-width lane would make the ratio NaN and the clip's start- // time with it, which zod then refuses to save.- dropAsset(track.id, assetId, ratio, rect.width);- }}- />)}- <div className="timeline-playhead" style={{ left: `calc(var(--track-column) + (100% - var(--track-column)) * ${playhead / duration})` }}><span /><i /></div>+ <div className="timeline-body">+ <div className="timeline-grid-scroll" ref={scrollRef}>+ <div+ className="timeline-grid"+ style={{+ "--lane-grid": `${(scale.majorMs / duration) * 100}%`,+ width: lanePx ? `calc(var(--track-column) + ${lanePx}px)` : "100%",+ } as React.CSSProperties}+ >+ <div className="track-corner" />+ <TimeRuler+ rulerRef={rulerRef}+ scrollRef={scrollRef}+ durationMs={duration}+ lanePx={lanePx}+ majorMs={scale.majorMs}+ minorMs={scale.minorMs}+ frames={scale.frames}+ fps={fps}+ inMs={inMs}+ outMs={outMs}+ onPointerDown={onRulerPointerDown}+ onContextMenu={onRulerMenu}+ />+ {drawnTracks.map((track) => <TrackRow+ key={track.id}+ track={track}+ label={trackLabels.get(track.id) ?? ""}+ duration={duration}+ folderPath={folderPath}+ generatedJobsByAssetId={generatedJobsByAssetId}+ assetsById={assetsById}+ selectedId={selectedId}+ draggingId={dragging ? dragRef.current?.clipId : undefined}+ dropActive={dropTrackId === track.id}+ /* A lane that stays dark is indistinguishable from a lane the+ pointer simply is not over. Mark incompatible or locked lanes+ for the whole drag, not just on hover. */+ dropBlocked={(draggedAsset !== undefined && !acceptsAsset(track, draggedAsset))+ || (draggedScene !== undefined && !acceptsScene(track, draggedScene))}+ actions={actions}+ />)}+ {/* The playhead: a pentagon head in the ruler that can be dragged,+ and a line through every track. */}+ <div className="timeline-playhead" style={{ left: `calc(var(--track-column) + (100% - var(--track-column)) * ${playheadRatio})` }}>+ <span className="timeline-playhead__head" onPointerDown={beginScrub} aria-hidden="true" />+ </div>+ </div></div>+ <Splitter {...trackPane.splitterProps} className="timeline-track-splitter" aria-label="Resize track headers" /></div></section>+ {menu.element}</div>);}-function TrackRow({ track, duration, folderPath, generatedJobsByAssetId, assetsById, selectedId, draggingId, dropActive, dropBlocked, onSelect, onToggle, onRename, onClipPointerDown, onDeleteClip, onDragOverLane, onDragLeaveLane, onDropLane }: {+/** The time ruler: labels at a density that follows the zoom (frames when+ * zoomed in), minor ticks painted as a background, the in/out range shaded.+ * Only the labels inside the visible stretch are rendered, and it re-renders+ * on scroll by itself — never because the playhead moved. */+const TimeRuler = memo(function TimeRuler({ rulerRef, scrollRef, durationMs, lanePx, majorMs, minorMs, frames, fps, inMs, outMs, onPointerDown, onContextMenu }: {+ rulerRef: MutableRefObject<HTMLDivElement | null>;+ scrollRef: MutableRefObject<HTMLDivElement | null>;+ durationMs: number;+ lanePx: number | null;+ majorMs: number;+ minorMs: number;+ frames: boolean;+ fps: number;+ inMs: number | null;+ outMs: number | null;+ onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;+ onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;+}) {+ const [view, setView] = useState({ left: 0, width: 0 });+ useEffect(() => {+ const element = scrollRef.current;+ if (!element) return;+ let frame = 0;+ const read = () => { frame = 0; setView({ left: element.scrollLeft, width: element.clientWidth }); };+ const onScroll = () => { if (!frame) frame = requestAnimationFrame(read); };+ read();+ element.addEventListener("scroll", onScroll, { passive: true });+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(onScroll);+ observer?.observe(element);+ return () => {+ element.removeEventListener("scroll", onScroll);+ observer?.disconnect();+ if (frame) cancelAnimationFrame(frame);+ };+ }, [scrollRef]);+ const ticks = useMemo(() => {+ let first = 0;+ let last = durationMs;+ if (lanePx && view.width > 0) {+ const msPerPx = durationMs / lanePx;+ first = Math.max(0, (view.left - 200) * msPerPx);+ last = Math.min(durationMs, (view.left + view.width + 200) * msPerPx);+ }+ const result: number[] = [];+ for (let index = Math.floor(first / majorMs); index * majorMs <= last && result.length < 2000; index += 1) result.push(index * majorMs);+ return result;+ }, [durationMs, lanePx, majorMs, view.left, view.width]);+ const percent = (ms: number) => `${(ms / durationMs) * 100}%`;+ return <div+ ref={rulerRef}+ className="time-ruler"+ style={{ backgroundSize: `${(minorMs / durationMs) * 100}% 5px` }}+ onPointerDown={onPointerDown}+ onContextMenu={onContextMenu}+ >+ {(inMs !== null || outMs !== null) && <span+ className="time-ruler__range"+ aria-label="In and out range"+ style={{ left: percent(inMs ?? 0), width: percent((outMs ?? durationMs) - (inMs ?? 0)) }}+ />}+ {ticks.map((ms) => <span key={ms} className="time-ruler__tick" style={{ left: percent(ms) }}>{rulerLabel(ms, fps, frames)}</span>)}+ </div>;+});++const TrackRow = memo(function TrackRow({ track, label, duration, folderPath, generatedJobsByAssetId, assetsById, selectedId, draggingId, dropActive, dropBlocked, actions }: {track: ProjectConfig["timeline"]["tracks"][number];+ /** "V1", "A1"… */+ label: string;duration: number;folderPath: string;generatedJobsByAssetId: ReadonlyMap<string, GenerationJob>;@@ -1009,43 +1479,38 @@ function TrackRow({ track, duration, folderPath, generatedJobsByAssetId, assetsBdraggingId?: string;dropActive: boolean;dropBlocked: boolean;- onSelect: (id: string) => void;- onToggle: (id: string, key: "muted" | "locked") => void;- onRename: (id: string, name: string) => void;- onClipPointerDown: (event: React.PointerEvent<HTMLElement>, clip: TimelineClip, mode: DragMode) => void;- onDeleteClip: (id: string) => void;- onDragOverLane: (event: React.DragEvent<HTMLDivElement>) => void;- onDragLeaveLane: () => void;- onDropLane: (event: React.DragEvent<HTMLDivElement>) => void;+ actions: MutableRefObject<TrackActions>;}) {const named = track.name;+ const kind = track.kind === "audio" ? "audio" : "video";return <>- <div className="track-head">- <span className="track-kind"><Film size={16} /></span>+ <div className={`track-head track-head--${kind}`} onContextMenu={(event) => actions.current.laneMenu(event, track)}>+ <b className="track-label">{label}</b>{/* The name is an editable field, not a label: a project with three videolayers needs the user's own words on them, and an always-live inputneeds no discovery. Blanking it falls back the way a clip name does,because the schema has no room for a nameless track. */}- <div><input+ <inputclassName="track-name"value={track.name}aria-label={`Rename ${named}`}- title="Rename this track"- onChange={(event) => onRename(track.id, event.target.value || "Untitled track")}- /></div>- <button className={track.muted ? "active" : ""} onClick={() => onToggle(track.id, "muted")} aria-label={`${track.muted ? "Unmute" : "Mute"} audio on ${named}`} title={`${track.muted ? "Unmute" : "Mute"} audio on ${named}`}>{track.muted ? <VolumeX size={16} /> : <Volume2 size={16} />}</button>- <button className={track.locked ? "active" : ""} onClick={() => onToggle(track.id, "locked")} aria-label={`${track.locked ? "Unlock" : "Lock"} ${named}`} title={`${track.locked ? "Unlock" : "Lock"} ${named}`}>{track.locked ? <Lock size={16} /> : <LockOpen size={16} />}</button>+ {...tooltipProps("Rename track")}+ onChange={(event) => actions.current.rename(track.id, event.target.value || "Untitled track")}+ />+ <button className={track.muted ? "active" : ""} onClick={() => actions.current.toggle(track.id, "muted")} aria-label={`${track.muted ? "Unmute" : "Mute"} audio on ${named}`} aria-pressed={track.muted} {...tooltipProps(track.muted ? "Unmute" : "Mute")}>{track.muted ? <VolumeX size={14} /> : <Volume2 size={14} />}</button>+ <button className={track.locked ? "active" : ""} onClick={() => actions.current.toggle(track.id, "locked")} aria-label={`${track.locked ? "Unlock" : "Lock"} ${named}`} aria-pressed={track.locked} {...tooltipProps(track.locked ? "Unlock" : "Lock")}>{track.locked ? <Lock size={14} /> : <LockOpen size={14} />}</button></div><div- className={`track-lane ${track.muted ? "muted" : ""} ${dropActive ? "track-lane--drop" : ""} ${dropBlocked ? "track-lane--reject" : ""}`}+ className={`track-lane track-lane--${kind} ${track.muted ? "muted" : ""} ${dropActive ? "track-lane--drop" : ""} ${dropBlocked ? "track-lane--reject" : ""}`}/* Which track this lane IS, readable from the DOM: a clip dragged acrosslanes is hit-tested against the document, and the id is how the answergets back to the model. */data-track-id={track.id}- title={dropBlocked ? (track.locked ? `${track.name} is locked` : `${track.name} cannot take this item`) : undefined}- onDragOver={onDragOverLane}- onDragLeave={onDragLeaveLane}- onDrop={onDropLane}+ {...tooltipProps(dropBlocked ? (track.locked ? `${track.name} is locked` : `${track.name} cannot take this item`) : undefined)}+ onDragOver={(event) => actions.current.dragOverLane(event, track)}+ onDragLeave={() => actions.current.dragLeaveLane(track)}+ onDrop={(event) => actions.current.dropLane(event, track)}+ onContextMenu={(event) => { if (event.target === event.currentTarget) actions.current.laneMenu(event, track); }}>{track.clips.map((clip) => {const asset = assetsById.get(clip.assetId);@@ -1060,67 +1525,56 @@ function TrackRow({ track, duration, folderPath, generatedJobsByAssetId, assetsB&& generation?.outputRelativePath&& !generation.error?.startsWith("Saved without sound"),);+ const isSelected = selectedId === clip.id;return <div- key={clip.id}- className={`clip-slot ${selectedId === clip.id ? "selected" : ""} ${draggingId === clip.id ? "clip-slot--dragging" : ""}`}- style={{ left: `${clip.startMs / duration * 100}%`, width: `${clip.durationMs / duration * 100}%`, "--clip-color": clip.color } as React.CSSProperties}- >- {/* The clip is a div with a button's role rather than a <button>: it- carries two trim handles and a delete control of its own, and a- button inside a button is not a thing a browser or a screen reader- can make sense of. Everything a button gave it is still here —- focus, Enter, the pressed state, a name. */}- <div- className={`timeline-clip ${audioOnly ? "timeline-clip--audio-only" : ""} ${hasAudio ? "timeline-clip--has-audio" : ""} ${selectedId === clip.id ? "selected" : ""} ${track.locked ? "timeline-clip--locked" : ""}`}- role="button"- tabIndex={0}- aria-pressed={selectedId === clip.id}- aria-label={`${clip.label}, ${(clip.durationMs / 1000).toFixed(1)} seconds, on ${track.name}`}- title={track.locked- ? `${clip.label} · ${(clip.durationMs / 1000).toFixed(1)} seconds — ${track.name} is locked`- : `${clip.label} · ${(clip.durationMs / 1000).toFixed(1)} seconds — drag to move it, drag either end to trim it`}- onClick={() => onSelect(clip.id)}- onKeyDown={(event) => { if (event.key === "Enter") onSelect(clip.id); }}- onPointerDown={(event) => onClipPointerDown(event, clip, "move")}+ key={clip.id}+ className={`clip-slot ${isSelected ? "selected" : ""} ${draggingId === clip.id ? "clip-slot--dragging" : ""}`}+ style={{ left: `${clip.startMs / duration * 100}%`, width: `${clip.durationMs / duration * 100}%`, "--clip-color": clip.color } as React.CSSProperties}>- {!audioOnly && generation && <TimelineClipThumbnails- folderPath={folderPath}- job={generation}- clip={clip}- />}- {hasAudio && asset && <TimelineClipWaveform- folderPath={folderPath}- asset={asset}- clip={clip}- cacheVersion={generation?.updatedAt}- />}- </div>- {/* The two ends, which cut rather than move. They stop the press from- reaching the clip body, or every trim would also be a move. A locked- track gets none of them: nothing on it can be changed. */}- {!track.locked && <>- <span- className="clip-handle clip-handle--start"- title={`Trim the start of ${clip.label}`}- onPointerDown={(event) => { event.stopPropagation(); onClipPointerDown(event, clip, "trim-start"); }}- />- <span- className="clip-handle clip-handle--end"- title={`Trim the end of ${clip.label}`}- onPointerDown={(event) => { event.stopPropagation(); onClipPointerDown(event, clip, "trim-end"); }}- />- <button- className="clip-delete"- aria-label={`Delete ${clip.label}`}- title={`Delete ${clip.label}`}- onPointerDown={(event) => event.stopPropagation()}- onClick={(event) => { event.stopPropagation(); onDeleteClip(clip.id); }}- ><X size={12} /></button>- </>}- </div>;+ {/* The clip is a div with a button's role rather than a <button>: it+ carries two trim handles of its own, and a button inside a button+ is not a thing a browser or a screen reader can make sense of. */}+ <div+ className={`timeline-clip ${audioOnly ? "timeline-clip--audio-only" : ""} ${hasAudio ? "timeline-clip--has-audio" : ""} ${isSelected ? "selected" : ""} ${track.locked ? "timeline-clip--locked" : ""}`}+ role="button"+ tabIndex={0}+ aria-pressed={isSelected}+ aria-label={`${clip.label}, ${(clip.durationMs / 1000).toFixed(1)} seconds, on ${track.name}`}+ onClick={() => actions.current.select(clip.id)}+ onKeyDown={(event) => { if (event.key === "Enter") actions.current.select(clip.id); }}+ onPointerDown={(event) => actions.current.clipPointerDown(event, clip, "move")}+ onContextMenu={(event) => actions.current.clipMenu(event, clip)}+ >+ <b className="timeline-clip__title">{clip.label}</b>+ {!audioOnly && generation && <TimelineClipThumbnails+ folderPath={folderPath}+ job={generation}+ clip={clip}+ />}+ {hasAudio && asset && <TimelineClipWaveform+ folderPath={folderPath}+ asset={asset}+ clip={clip}+ cacheVersion={generation?.updatedAt}+ />}+ </div>+ {/* The two ends, which cut rather than move. They stop the press from+ reaching the clip body, or every trim would also be a move. A+ locked track gets neither: nothing on it can be changed. */}+ {!track.locked && <>+ <span+ className="clip-handle clip-handle--start"+ aria-hidden="true"+ onPointerDown={(event) => { event.stopPropagation(); actions.current.clipPointerDown(event, clip, "trim-start"); }}+ />+ <span+ className="clip-handle clip-handle--end"+ aria-hidden="true"+ onPointerDown={(event) => { event.stopPropagation(); actions.current.clipPointerDown(event, clip, "trim-end"); }}+ />+ </>}+ </div>;})}</div></>;-}--function MouseSelection() { return <div className="selection-glyph"><span /><i /></div>; }+});diff --git a/src/styles/timeline.css b/src/styles/timeline.cssindex 573826e..ad8df93 100644--- a/src/styles/timeline.css+++ b/src/styles/timeline.css@@ -2,25 +2,37 @@timeline.css — the edit view: scene/media panels, program monitor, clipinspector, and the multi-track timeline.- Sizing contract (see tokens.css): no literal px type sizes, nothing below- --text-2xs (12px), standard controls --control-md (32px), compact ones- --control-sm (24px).+ Dense scale. An editor is a tool surface, not a form, so it runs smaller+ than the rest of the app — the way Premiere, Resolve and Clipchamp do:+ toolbar 36px, panel tabs 32px, ruler 24px, video tracks 56px, audio tracks+ 40px, transport and track toggles 28px / 20px, captions 12px. The export+ screen (export.css) uses the same scale.++ Every pane is resizable (Splitter + usePaneSize, which set the --pane-*+ variables inline) and the side panes collapse from the timeline toolbar+ rather than vanishing at a window width.========================================================================== */.timeline-view {+ /* Defaults for the pane sizes TimelineView sets inline from usePaneSize. */+ --pane-timeline-sources: 296px;+ --pane-timeline-inspector: 340px;+ --pane-timeline-height: 300px;+ --pane-timeline-tracks: 180px;+ --toolbar-height: 36px;+ --ruler-height: 24px;+ --track-video-height: 56px;+ --track-audio-height: 40px;+height: 100%;min-height: 0;display: grid;- /* 372px = toolbar 48 + ruler 36 + four 72px track rows. The grid scrolls- vertically if a project carries more tracks than that. */- grid-template-rows: minmax(340px, 1fr) 372px;-- --video-centre-shift: -22px;+ grid-template-rows: minmax(120px, 1fr) auto minmax(120px, var(--pane-timeline-height));+ background: var(--layer);}-/* The view itself is focusable (tabIndex={0}) so Space and Delete reach the- editor. It has to SHOW that focus, or the shortcuts are invisible: there is- no inner control that stands in for it. Inset so the ring is not clipped. */+/* The view itself is focusable (tabIndex={0}) so its shortcuts reach the+ editor wherever the user clicked. Inset so the ring is not clipped. */.timeline-view:focus-visible {outline: var(--focus-ring-width) solid var(--focus-outer);outline-offset: -2px;@@ -30,174 +42,115 @@.edit-panels {min-height: 0;display: grid;- grid-template-columns: 296px minmax(520px, 1fr) 340px;- border-bottom: 1px solid var(--line-strong);+ grid-template-columns: var(--pane-timeline-sources) auto minmax(0, 1fr) auto var(--pane-timeline-inspector);}+.edit-panels--no-sources { grid-template-columns: minmax(0, 1fr) auto var(--pane-timeline-inspector); }+.edit-panels--no-inspector { grid-template-columns: var(--pane-timeline-sources) auto minmax(0, 1fr); }+.edit-panels--no-sources.edit-panels--no-inspector { grid-template-columns: minmax(0, 1fr); }+.scene-panel,.clip-inspector {min-width: 0;- overflow: hidden;+ min-height: 0;background: var(--panel);}.scene-panel {- border-right: 1px solid var(--line);+ display: flex;+ flex-direction: column;+ overflow: hidden;}.clip-inspector {- border-left: 1px solid var(--line);overflow-y: auto;}-/* --- Panel tabs ------------------------------------------------------------ */+/* --- Panel tabs ------------------------------------------------------------+ A SelectorBar: text tabs with the 3×16px accent pill under the chosen one. */.panel-tabs {- height: var(--control-lg);- display: grid;- grid-template-columns: 1fr 1fr;+ height: 32px;+ flex: none;+ padding: 0 var(--space-2);border-bottom: 1px solid var(--line);}-.panel-tabs button {- position: relative;- display: flex;- align-items: center;- justify-content: center;- gap: var(--space-2);- min-height: var(--control-lg);- border: 0;- color: var(--text-muted);- background: none;- font-size: var(--text-base);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);-}--.panel-tabs button:hover {- color: var(--text-secondary);-}--.panel-tabs button.active {- color: var(--text-primary);- background: var(--accent-soft);-}--.panel-tabs button.active::after {- content: "";- position: absolute;- inset: auto var(--space-3) -1px;- height: 2px;- background: var(--accent-bright);-}--/* --- Region headings -------------------------------------------------------- The program monitor retains its h2; the asset tabs already name the left- panel's two regions. */--.program-panel > .panel-chrome h2 {- display: flex;- align-items: center;- gap: var(--space-2);- margin: 0;- color: inherit;- font-size: inherit;- font-weight: inherit;- line-height: inherit;+.panel-tabs .ui-selector-bar__item {+ min-height: 0;+ height: 100%;+ font-size: var(--text-xs);+ border-radius: var(--radius-sm);}/* --- Scene panel ----------------------------------------------------------- */.scene-panel__head {- height: var(--control-lg);+ height: 36px;+ flex: none;display: flex;align-items: center;justify-content: space-between;- padding: 0 var(--space-4);- color: var(--text-secondary);- font-size: var(--text-sm);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);+ padding: 0 var(--space-2);}-.media-import-button {+.media-import-button.secondary-button {min-height: var(--control-sm);- display: inline-flex;- align-items: center;+ height: var(--control-sm);gap: var(--space-2);- padding: 0 var(--space-3);- border: 1px solid var(--line-strong);- border-radius: var(--radius-sm);- color: var(--text-primary);- background: var(--wash-1);- font-size: var(--text-sm);- font-weight: var(--weight-semibold);-}--.media-import-button:hover:not(:disabled) {- border-color: var(--line-hover);- background: var(--wash-2);-}--.media-import-button:disabled {- opacity: 0.6;+ padding: 0 var(--space-2);+ font-size: var(--text-xs);}-/* Scenes start directly below the tabs; they do not need a second heading. */.scene-list {- height: calc(100% - var(--control-lg));- padding: 0 var(--space-2) var(--space-4);+ flex: 1 1 auto;+ min-height: 0;+ padding: var(--space-1) var(--space-2) var(--space-3);overflow-y: auto;}.panel-hint {margin: var(--space-2) var(--space-2) var(--space-4);color: var(--text-muted);- font-size: var(--text-base);- line-height: var(--leading-normal);+ font-size: var(--text-xs);+ line-height: var(--leading-snug);}.scene-card {width: 100%;- min-height: 88px;+ min-height: 64px;display: grid;- grid-template-columns: 104px minmax(0, 1fr);- gap: var(--space-3);+ grid-template-columns: 88px minmax(0, 1fr);+ gap: var(--space-2);align-items: center;- margin-bottom: var(--space-1);- padding: var(--space-2);- border: 1px solid transparent;+ margin-bottom: 2px;+ padding: var(--space-1);+ border: 0;border-radius: var(--radius-sm);text-align: left;color: var(--text-muted);background: transparent;+ transition: var(--transition-control);}-.scene-card:hover {- background: var(--panel-2);-}--.scene-card.selected {- border-color: var(--accent-line-strong);- background: var(--accent-soft);- box-shadow: inset 2px 0 var(--accent-bright);-}+.scene-card:hover { background: var(--fill-subtle-hover); }+.scene-card:active { background: var(--fill-subtle-pressed); }+/* Flat placeholder with a glyph: no hatching, no invented art. */.scene-card__thumb {position: relative;- height: 64px;+ height: 50px;+ display: grid;+ place-items: center;overflow: hidden;- border: 1px solid var(--line);border-radius: var(--radius-sm);- background-color: var(--panel-3);- background-image: repeating-linear-gradient(- 135deg,- var(--hatch) 0 6px,- transparent 6px 12px- );+ color: var(--text-faint);+ background: var(--panel-3);}.scene-card__thumb .shot-thumb {+ position: absolute;+ inset: 0;width: 100%;height: 100%;border: 0;@@ -211,20 +164,23 @@object-fit: cover;}+/* Flat badges: a dark plate, 2px corners, no glass. */.scene-card__thumb i,.scene-card__thumb em {position: absolute;z-index: 2;- padding: 2px var(--space-1);- border-radius: var(--radius-xs);- color: var(--text-secondary);- background: var(--glass);- font: var(--weight-medium) var(--text-2xs) / 1.1 var(--font-mono);+ padding: 0 var(--space-1);+ border-radius: 2px;+ color: var(--on-stage);+ background: color-mix(in srgb, var(--stage-bg) 60%, transparent);+ font-size: var(--text-2xs);font-style: normal;+ line-height: 16px;+ font-variant-numeric: tabular-nums;}-.scene-card__thumb i { left: var(--space-1); top: var(--space-1); }-.scene-card__thumb em { right: var(--space-1); bottom: var(--space-1); }+.scene-card__thumb i { left: 2px; top: 2px; }+.scene-card__thumb em { right: 2px; bottom: 2px; }.scene-card > span:last-child,.scene-card b,@@ -238,45 +194,24 @@white-space: nowrap;text-overflow: ellipsis;color: var(--text-primary);- font-size: var(--text-base);+ font-size: var(--text-xs);font-weight: var(--weight-semibold);line-height: var(--leading-snug);}.scene-card small {- margin-top: var(--space-1);+ overflow: hidden;color: var(--text-muted);- font-size: var(--text-sm);+ font-size: var(--text-xs);line-height: var(--leading-snug);+ text-overflow: ellipsis;+ white-space: nowrap;}-.scene-card.selected small {- color: var(--accent-bright);-}--/* The on-ramp to generating: a real primary-sized action, not a hairline. */-.scene-add {+.scene-add.secondary-button {width: 100%;- min-height: var(--control-md);- display: flex;- align-items: center;- justify-content: center;- gap: var(--space-2);margin-top: var(--space-2);- padding: var(--space-2) var(--space-3);- border: 1px dashed var(--accent-line-strong);- border-radius: var(--radius-md);- color: var(--accent-bright);- background: var(--accent-soft);- font-size: var(--text-base);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);-}--.scene-add:hover {- color: var(--text-primary);- border-color: var(--accent-bright);- background: var(--accent-soft-strong);+ gap: var(--space-2);}/* --- Panel layout toggle ---------------------------------------------------@@ -286,46 +221,38 @@.layout-toggle {display: flex;gap: 2px;- padding: 2px;- border: 1px solid var(--line);- border-radius: var(--radius-sm);- background: var(--panel-2);}.layout-toggle button {- width: var(--space-6);- height: var(--space-6);+ width: var(--control-sm);+ height: var(--control-sm);display: grid;place-items: center;padding: 0;border: 0;- border-radius: calc(var(--radius-sm) - 1px);- color: var(--text-muted);+ border-radius: var(--radius-sm);+ color: var(--text-secondary);background: none;+ transition: var(--transition-control);}-.layout-toggle button:hover {- color: var(--text-secondary);-}+.layout-toggle button:hover { background: var(--fill-subtle-hover); }.layout-toggle button.active {color: var(--text-primary);- background: var(--panel-3);+ background: var(--fill-subtle-pressed);}/* --- Media panel ----------------------------------------------------------- */.media-grid {- height: calc(100% - (var(--control-lg) * 2));+ flex: 1 1 auto;+ min-height: 0;overflow-y: auto;display: grid;grid-template-columns: 1fr 1fr;- /* The height above is DEFINITE, so the default `grid-auto-rows: auto` divided- it between the rows instead of letting them size to their content — every- media card collapsed to a ~29px striped slab with its name, kind and- duration clipped away by the `overflow: hidden` below. `max-content` makes- each row as tall as the card it holds and lets the container scroll.- `align-content: start` alone does NOT fix this; the row sizing does. */+ /* The rows size to their cards and the panel scrolls: a definite height+ divided between auto rows used to collapse every card to a sliver. */grid-auto-rows: max-content;align-content: start;gap: var(--space-2);@@ -338,18 +265,18 @@.media-grid .media-card__source {min-width: 0;- /* Floor the hit target even if a card ever renders without its labels. */min-height: var(--control-sm);- padding: 0 0 var(--space-2);+ padding: 0 0 var(--space-1);overflow: hidden;- border: 1px solid var(--line);+ border: 1px solid var(--stroke-card);border-radius: var(--radius-sm);text-align: left;- background: var(--panel-2);+ background: var(--card);+ transition: var(--transition-control);}.media-grid .media-card__source:hover:not(:disabled) {- border-color: var(--line-strong);+ background: var(--card-hover);}.media-grid .media-card__source b,@@ -362,39 +289,30 @@}.media-grid .media-card__source b {- margin-top: var(--space-2);+ margin-top: var(--space-1);color: var(--text-primary);- font-size: var(--text-sm);+ font-size: var(--text-xs);font-weight: var(--weight-semibold);line-height: var(--leading-snug);}.media-grid .media-card__source small {- margin-top: var(--space-1);color: var(--text-muted);font-size: var(--text-xs);line-height: var(--leading-snug);}-/* Same rule as the scene thumb: a labelled placeholder, never invented art. */+/* A flat plate with a glyph until a real frame arrives. */.media-thumb {- height: var(--space-9);+ height: 64px;display: grid;place-items: center;- border-bottom: 1px solid var(--line);- color: var(--text-muted);- background-color: var(--panel-3);- background-image: repeating-linear-gradient(- 135deg,- var(--hatch) 0 6px,- transparent 6px 12px- );+ color: var(--text-faint);+ background: var(--panel-3);}-/* A real frame from the file, drawn to fill the plate the placeholder used. */.media-thumb--poster {padding: 0;- background-image: none;}.media-thumb--poster img {@@ -414,55 +332,35 @@height: 100%;}-.media-grid .media-card__remove {- position: absolute;- z-index: 2;- top: var(--space-1);- right: var(--space-1);- width: var(--control-sm);- min-height: var(--control-sm);- display: grid;- place-items: center;- padding: 0;- border: 1px solid var(--line-strong);- border-radius: var(--radius-pill);- color: var(--text-primary);- background: var(--glass);- box-shadow: var(--shadow-sm);-}--.media-grid .media-card__remove:hover {- color: var(--danger);- border-color: var(--danger);-}--.media-grid .media-card__source[draggable="true"] {- cursor: grab;-}-/* --- Media panel, list layout ---------------------------------------------One row per file: a small still on the left, name and kind beside it. Samebuttons, same drag behaviour — only the shape changes. */.media-grid--list {grid-template-columns: minmax(0, 1fr);+ gap: 2px;}.media-grid--list .media-card__source {display: grid;- grid-template-columns: 72px minmax(0, 1fr);+ grid-template-columns: 64px minmax(0, 1fr);grid-template-rows: auto auto;align-content: center;column-gap: var(--space-2);padding: 0;+ border-color: transparent;+ background: transparent;+}++.media-grid--list .media-card__source:hover:not(:disabled) {+ background: var(--fill-subtle-hover);}.media-grid--list .media-thumb {grid-row: 1 / 3;- width: 72px;- height: var(--space-7);- border-right: 1px solid var(--line);- border-bottom: 0;+ width: 64px;+ height: 36px;+ border-radius: var(--radius-sm);}.media-grid--list .media-card__source b {@@ -476,10 +374,6 @@padding-left: 0;}-.media-grid .media-card__source[draggable="true"]:active {- cursor: grabbing;-}-.panel-hint--error {color: var(--danger);}@@ -490,34 +384,36 @@min-width: 0;min-height: 0;display: grid;- /* One row now: the "Program monitor" header is gone (its heading survives for- screen readers as .sr-only, which takes no space) and the transport moved- down to the timeline toolbar, where the playhead it moves actually is.- Every pixel freed here goes to the picture. */- grid-template-rows: minmax(0, 1fr);- background: var(--bg);+ grid-template-rows: minmax(0, 1fr) 24px;+ background: var(--stage-bg);}+/* A flat stage, no dot grid. At 50% / 100% the stage has a fixed size and+ this scrolls; `margin: auto` on the stage centres it without clipping the+ top-left of a picture larger than the panel. */.program-canvas {min-height: 0;- overflow: auto;+ min-width: 0;+ overflow: hidden;display: flex;- align-items: center;- justify-content: center;- /* No padding: the picture takes the whole panel. The letterboxing inside it- is the project's own frame shape, and a margin around that only made the- monitor smaller for nothing. */- padding: 0;- background-color: var(--bg);- background-image: radial-gradient(var(--grid-line) 0.6px, transparent 0.6px);- background-size: 12px 12px;+ background: var(--stage-bg);+}++.program-canvas--zoomed {+ overflow: auto;+}++.program-stage {+ position: relative;+ width: 100%;+ height: 100%;+ margin: auto;+ container-type: size;}/* The picture itself. The panel is the frame; the shot is fitted inside it andthe rest is the project's background colour, so a 9:16 cut looks 9:16 whileit is being cut rather than being stretched to fill a 16:9 panel. */-/* A monitor, not a card: square corners, no frame of its own, and every pixel- of the panel. What bounds the picture is the picture. */.program-picture {position: relative;width: 100%;@@ -540,15 +436,13 @@will-change: transform, opacity, filter, clip-path;}-/* Timeline-only direct manipulation. The export monitor never receives theediting callbacks, so none of this chrome can appear in an exported preview. */.program-transform {position: absolute;z-index: 3;inset: 10px;- border: 2px solid var(--accent-bright);- outline: 1px solid color-mix(in srgb, var(--bg) 65%, transparent);+ border: 1px solid var(--accent-bright);cursor: move;touch-action: none;transform-origin: center;@@ -567,26 +461,26 @@.program-transform button {position: absolute;z-index: 1;- width: 16px;- height: 16px;+ width: 12px;+ height: 12px;padding: 0;- border: 2px solid var(--accent-bright);- border-radius: var(--radius-pill);+ border: 1px solid var(--accent-bright);+ border-radius: 2px;background: var(--panel);- box-shadow: 0 1px 4px color-mix(in srgb, var(--bg) 65%, transparent);touch-action: none;}.program-transform__rotate {left: 50%;- top: -26px;+ top: -24px;translate: -50% 0;+ border-radius: var(--radius-pill) !important;cursor: grab;}.program-transform__scale {- right: -9px;- bottom: -9px;+ right: -7px;+ bottom: -7px;cursor: nwse-resize;}@@ -595,218 +489,445 @@cursor: grabbing;}-/* What the monitor has to say when there is no picture to show: a gap under the- playhead, a file it could not read, a file still being read. Over the frame+/* What the monitor has to say when there is no picture to show. Over the framerather than instead of it, so the black stays black. */.program-note {position: absolute;display: flex;align-items: center;- gap: var(--space-3);- max-width: min(90%, 520px);- padding: var(--space-3) var(--space-4);- border: 1px solid var(--line-strong);- border-radius: var(--radius-md);- color: var(--text-secondary);- font-size: var(--text-sm);+ gap: var(--space-2);+ max-width: min(90%, 480px);+ padding: var(--space-1) var(--space-2);+ border-radius: var(--radius-sm);+ color: var(--on-stage);+ font-size: var(--text-xs);line-height: var(--leading-snug);- background: color-mix(in srgb, var(--panel) 86%, transparent);+ background: color-mix(in srgb, var(--stage-bg) 72%, transparent);}.program-note--error {- border-color: var(--danger);- color: var(--text-primary);+ color: var(--stage-alert-ink);+ background: var(--stage-alert-bg);}-/* One honest monitor state for both cases: Slopus cannot decode footage in- the editor yet, so it names the real project instead of drawing a stand-in. */+/* An empty timeline: one muted line on the black stage. */.program-empty {- width: min(100%, 640px);- min-height: 196px;- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- padding: var(--space-5) var(--space-6);- border: 1px dashed var(--line-strong);- border-radius: var(--radius-md);+ width: 100%;+ height: 100%;+ display: grid;+ place-items: center;+ padding: var(--space-4);text-align: center;- color: var(--text-muted);- background: linear-gradient(145deg, var(--panel-2), var(--panel));+ color: color-mix(in srgb, var(--on-stage) 62%, transparent);+ font-size: var(--text-xs);+ line-height: var(--leading-snug);+}++/* Title-safe (80%) and action-safe (90%) guides, drawn over the project's+ frame: the frame box is the largest box of the project's aspect that fits+ the stage (container query units), centred like the picture. */+.program-safe {+ position: absolute;+ z-index: 4;+ inset: 0;+ display: grid;+ place-items: center;+ pointer-events: none;}-.program-empty--footage {- border-style: solid;+.program-safe__frame {+ position: relative;+ width: min(100cqw, 100cqh * var(--frame-aspect, 1.7778));+ aspect-ratio: var(--frame-aspect, 1.7778);}-.program-empty strong {- max-width: 85%;- margin: var(--space-3) 0 var(--space-2);- color: var(--text-primary);- font-size: var(--text-lg);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);+.program-safe__action,+.program-safe__title {+ position: absolute;+ border: 1px dashed color-mix(in srgb, var(--on-stage) 55%, transparent);}-.program-empty > span {- max-width: 80%;+.program-safe__action { inset: 5%; }+.program-safe__title { inset: 10%; }++.program-footer {+ min-width: 0;+ display: flex;+ align-items: center;+ gap: var(--space-3);+ padding: 0 var(--space-1) 0 var(--space-2);+ border-top: 1px solid var(--line);color: var(--text-secondary);- font-size: var(--text-base);- line-height: var(--leading-normal);+ background: var(--layer);+ font-size: var(--text-xs);+ font-variant-numeric: tabular-nums;+ line-height: 1;+ white-space: nowrap;}-.program-empty small {- max-width: 80%;- margin-top: var(--space-3);- color: var(--text-muted);- font-size: var(--text-sm);- line-height: var(--leading-normal);-}+.program-footer__time { color: var(--text-primary); }+.program-footer__spacer { flex: 1; }-/* --- Clip inspector -------------------------------------------------------- */+.program-footer .ui-combo {+ height: 20px;+ min-width: 72px;+ padding: 0 var(--space-1) 0 var(--space-2);+ border-radius: var(--radius-sm);+ font-size: var(--text-xs);+}-.inspector-section {- padding: var(--space-4);- border-bottom: 1px solid var(--line);+.program-footer__toggle {+ width: 20px;+ height: 20px;+ display: grid;+ place-items: center;+ padding: 0;+ border: 0;+ border-radius: var(--radius-sm);+ color: var(--text-secondary);+ background: transparent;+ transition: var(--transition-control);}-.inspector-section h3 {- display: flex;- align-items: center;- gap: var(--space-2);- margin: 0;+.program-footer__toggle:hover { background: var(--fill-subtle-hover); }++.program-footer__toggle.active {color: var(--text-primary);- font-size: var(--text-md);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);+ background: var(--fill-subtle-pressed);}-.inspector-section h3 em {- padding: 2px var(--space-2);- border: 1px solid var(--line-strong);- border-radius: var(--radius-pill);- color: var(--text-muted);- background: var(--panel-3);- font-size: var(--text-2xs);- font-style: normal;- font-weight: var(--weight-medium);- line-height: var(--leading-snug);-}+/* --- Clip inspector ----------------------------------------------------------+ PropSection / PropRow: 28px rows, 12px labels that scrub, reset on the right.+ No 40px stacked fields, no spin buttons. */-.inspector-section label {- display: block;- margin-top: var(--space-3);+.inspector-title {+ padding: var(--space-2) var(--space-2) var(--space-1);+ border-bottom: 1px solid var(--line);}-.inspector-section label > span {- display: block;- margin-bottom: var(--space-1);- color: var(--text-secondary);+.inspector-title h3 {+ margin: 0;font-size: var(--text-sm);+ font-weight: var(--weight-semibold);line-height: var(--leading-snug);}-.inspector-section input:not([type="range"]),-.inspector-section select {+/* An editable field that reads as the heading it replaced until it is used. */+.clip-inspector .clip-title__name {width: 100%;- height: var(--field-height);- padding: 0 var(--space-3);- border: 1px solid var(--line);+ min-width: 0;+ height: var(--control-sm);+ padding: 0 var(--space-1);+ border: 1px solid transparent;border-radius: var(--radius-sm);color: var(--text-primary);- background: var(--bg);- font-family: var(--font-sans);- font-size: var(--text-base);+ background: none;+ font: inherit;}-.inspector-section input:focus,-.inspector-section select:focus { border-color: var(--accent); }-.inspector-section input[readonly] { color: var(--text-muted); }-.inspector-section--pending { opacity: 0.72; }-.inspector-section input:disabled,-.inspector-section select:disabled { color: var(--text-faint); }+.clip-inspector .clip-title__name:hover {+ background: var(--fill-subtle-hover);+}-.clip-inspector .inspector-section .clip-title__name {- width: 100%;- min-width: 0;- height: auto;- padding: 2px var(--space-1);- margin-left: calc(var(--space-1) * -1);- border: 1px solid transparent;- border-radius: var(--radius-sm);- color: inherit;- background: none;- font: inherit;+.clip-inspector .clip-title__name:focus {+ border-color: var(--stroke-control);+ border-bottom-color: var(--field-focus-line);+ background: var(--fill-input-focus);+ outline: none;}-.clip-inspector .inspector-section .clip-title__name:hover,-.clip-inspector .inspector-section .clip-title__name:focus {- border-color: var(--accent-bright);- background: var(--panel-2);- outline: none;+.inspector-value {+ color: var(--text-primary);+ font-size: var(--text-xs);+ font-variant-numeric: tabular-nums;}-.field-pair {- display: grid;- grid-template-columns: 1fr 1fr;- gap: var(--space-2);+.inspector-timecode {+ font-variant-numeric: tabular-nums;}-.range-field > span {- display: flex !important;- justify-content: space-between;+.clip-inspector .ui-prop-row__value .text-field {+ height: var(--control-sm);+ min-height: 0;+ padding: 0 var(--space-2);+ font-size: var(--text-xs);}-.range-field b { color: var(--text-primary); font-weight: var(--weight-medium); }-.range-field input { width: 100%; height: var(--control-sm); accent-color: var(--accent-bright); }+.inspector-unit {+ width: 14px;+ flex: none;+ color: var(--text-muted);+ font-size: var(--text-xs);+}.inspector-empty {- min-height: 280px;- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- padding: var(--space-5);+ min-height: 160px;+ display: grid;+ place-items: center;+ padding: var(--space-4);text-align: center;color: var(--text-muted);+ font-size: var(--text-xs);+}++/* --- Effects (ClipEffects) -----------------------------------------------------+ Each effect is an Expander-style block: a 32px header with a chevron and+ name, Reset and a ⋯ menu, over its parameter rows. */++.clip-effects {+ display: grid;+ gap: var(--space-1);}-.inspector-empty b {- margin: var(--space-3) 0 var(--space-2);+.clip-effect {+ border: 1px solid var(--stroke-card);+ border-radius: var(--radius-sm);+ background: var(--card);+}++.clip-effect__header {+ height: 32px;+ display: flex;+ align-items: center;+ gap: 2px;+ padding: 0 var(--space-1) 0 0;+}++.clip-effect__toggle {+ flex: 1;+ min-width: 0;+ height: 100%;+ display: flex;+ align-items: center;+ gap: var(--space-2);+ padding: 0 var(--space-2);+ border: 0;+ border-radius: var(--radius-sm);color: var(--text-primary);- font-size: var(--text-md);- font-weight: var(--weight-semibold);+ background: transparent;+ text-align: left;+ transition: var(--transition-control);+}++.clip-effect__toggle:hover { background: var(--fill-subtle-hover); }++.clip-effect__chevron {+ flex: none;+ color: var(--text-secondary);+ transition: transform var(--motion-normal) var(--ease-decelerate);+}++.clip-effect--open .clip-effect__chevron { transform: rotate(90deg); }++.clip-effect__name {+ min-width: 0;+ margin: 0;+ overflow: hidden;+ font-size: var(--text-xs);+ font-weight: var(--weight-regular);+ line-height: var(--leading-snug);+ text-overflow: ellipsis;+ white-space: nowrap;+}++.clip-effect__action {+ width: 24px;+ height: 24px;+ flex: none;+ display: grid;+ place-items: center;+ padding: 0;+ border: 0;+ border-radius: var(--radius-sm);+ color: var(--text-secondary);+ background: transparent;+ transition: var(--transition-control);+}++.clip-effect__action:hover:not(:disabled) {+ color: var(--text-primary);+ background: var(--fill-subtle-hover);+}++.clip-effect__action:disabled { color: var(--text-disabled); }++.clip-effect__body {+ min-width: 0;+ margin: 0;+ padding: var(--space-1) var(--space-1) var(--space-2) var(--space-2);+ border: 0;+ border-top: 1px solid var(--line);+ display: grid;+ gap: 2px;+}++.clip-effect__body .ui-prop-row {+ grid-template-columns: 84px minmax(0, 1fr) 20px;+}++.clip-effect__body .ui-slider,+.clip-effect__body input[type="range"] {+ flex: 1;+ min-width: 0;+}++.clip-effect__value {+ min-width: 48px;+ flex: none;+ color: var(--text-primary);+ font-size: var(--text-xs);+ font-family: inherit;+ font-variant-numeric: tabular-nums;+ text-align: right;+}++.clip-effect__file {+ flex: 1;+ min-width: 0;+ overflow: hidden;+ color: var(--text-primary);+ font-size: var(--text-xs);+ text-overflow: ellipsis;+ white-space: nowrap;+}++.clip-effect__browse.secondary-button {+ height: var(--control-sm);+ min-height: 0;+ gap: var(--space-1);+ padding: 0 var(--space-2);+ font-size: var(--text-xs);+}++.clip-effect__note {+ margin: 0;+ padding-left: 88px;+ color: var(--text-muted);+ font-size: var(--text-xs);line-height: var(--leading-snug);}-.inspector-empty > span {- max-width: 34ch;- font-size: var(--text-base);- line-height: var(--leading-normal);+.clip-effect__note--error { color: var(--danger); }++.clip-effects__add.secondary-button {+ width: 100%;+ gap: var(--space-2);+ margin-top: var(--space-1);+}++/* The add-effect Flyout: 28px items, the description in each item's tooltip. */+.clip-effects__picker {+ display: grid;+ gap: 2px;+ padding: var(--space-1);+ max-height: min(320px, 50vh);+ overflow-y: auto;}-.selection-glyph {+.clip-effects__item {+ height: 28px;+ display: flex;+ align-items: center;+ padding: 0 var(--space-3);+ border: 0;+ border-radius: var(--radius-sm);+ color: var(--text-primary);+ background: transparent;+ font-size: var(--text-xs);+ text-align: left;+ transition: var(--transition-control);+}++.clip-effects__item:hover,+.clip-effects__item:focus-visible { background: var(--fill-subtle-hover); }++/* --- Colour picker (ColorPicker.tsx) --------------------------------------- */++.color-swatch {+ width: 24px;+ height: 24px;+ flex: none;+ padding: 0;+ border: 1px solid var(--stroke-strong);+ border-radius: var(--radius-sm);+}++.color-swatch:disabled { opacity: 0.5; }++.color-picker {+ /* The hue strip's gradient, set inline by ColorPicker (colours are data+ there, not palette choices). */+ --hue-gradient: none;+ width: 232px;+ display: grid;+ gap: var(--space-3);+ padding: var(--space-3);+}++.color-picker__area {position: relative;- width: var(--control-md);- height: var(--control-md);- border: 1px solid var(--line-strong);- border-radius: var(--radius-md);+ height: 144px;+ border-radius: var(--radius-sm);+ touch-action: none;+ cursor: crosshair;}-.selection-glyph span {+.color-picker__thumb {position: absolute;- inset: var(--space-2);- border: 1px dashed var(--accent-bright);+ width: 14px;+ height: 14px;+ margin: -7px 0 0 -7px;+ border: 2px solid var(--on-stage);+ border-radius: var(--radius-pill);+ box-shadow: 0 0 0 1px var(--stage-bg);+ pointer-events: none;}-.selection-glyph i {- position: absolute;- width: 5px;- height: 5px;- right: var(--space-1);- bottom: var(--space-1);- border-radius: 1px;- background: var(--accent-bright);+.color-picker__hue.color-picker__hue {+ width: 100%;+ height: 12px;+ margin: 0;+ appearance: none;+ border-radius: var(--radius-pill);+ background: var(--hue-gradient);+}++.color-picker__hue::-webkit-slider-runnable-track {+ height: 12px;+ border-radius: var(--radius-pill);+ background: var(--hue-gradient);+}++.color-picker__hue::-webkit-slider-thumb {+ width: 14px;+ height: 14px;+ margin-top: -1px;+ appearance: none;+ border: 2px solid var(--on-stage);+ border-radius: var(--radius-pill);+ background: transparent;+ box-shadow: 0 0 0 1px var(--stage-bg);+}++.color-picker__row {+ display: flex;+ align-items: center;+ gap: var(--space-2);+}++.color-picker__preview {+ width: 24px;+ height: 24px;+ flex: none;+ border: 1px solid var(--stroke-strong);+ border-radius: var(--radius-sm);+}++.color-picker__hex.text-field {+ flex: 1;+ min-width: 0;+ font-family: var(--font-mono);+ text-transform: uppercase;}/* --- Timeline toolbar ------------------------------------------------------ */@@ -814,38 +935,30 @@.pro-timeline {min-height: 0;display: grid;- grid-template-rows: var(--control-lg) minmax(0, 1fr);+ grid-template-rows: var(--toolbar-height) minmax(0, 1fr);background: var(--panel);+ user-select: none;}-/* Three tracks, and the two outer ones are the SAME width whatever they hold —- that is the whole point. With `flex: space-between` the middle group's- position was decided by however wide the heading and the tool buttons- happened to render, so the transport sat wherever it landed (measured 244px- left of the picture's centre). Two equal 1fr rails put the middle track's- centre on the row's centre no matter what the rails contain, and- --video-centre-shift then moves it the rest of the way onto the picture.-- The padding has to be SYMMETRIC for that to hold: it was 12px on the right- and 16px on the left, which would drop the middle 2px off-centre before the- shift was even applied. */+/* Lead | transport | tools. Two equal rails keep the transport on the row's+ centre whatever the rails hold. */.timeline-toolbar {- height: var(--control-lg);+ height: var(--toolbar-height);+ min-width: 0;display: grid;grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);align-items: center;- gap: var(--space-4);- padding: 0 var(--space-4);+ gap: var(--space-3);+ padding: 0 var(--space-2);border-bottom: 1px solid var(--line);+ background: var(--layer);}-/* Heading, clock, format — left-aligned as one run, so the timecode reads as- part of the timeline's own header rather than as a label on the buttons. */.timeline-toolbar__lead {min-width: 0;display: flex;align-items: center;- gap: var(--space-3);+ gap: var(--space-2);}.timeline-toolbar h2 {@@ -855,321 +968,305 @@text-overflow: ellipsis;white-space: nowrap;color: var(--text-primary);- font-size: var(--text-base);+ font-size: var(--text-xs);font-weight: var(--weight-semibold);line-height: var(--leading-snug);}+/* The playhead clock: tabular figures so the row does not twitch under+ playback. Click it to type a time; Enter seeks. */+.transport-time {+ flex: none;+ height: 28px;+ padding: 0 var(--space-2);+ border: 0;+ border-radius: var(--radius-sm);+ color: var(--text-primary);+ background: transparent;+ font-size: var(--text-xs);+ font-variant-numeric: tabular-nums;+ white-space: nowrap;+ transition: var(--transition-control);+}++button.transport-time:hover { background: var(--fill-subtle-hover); }++.transport-time--editing.text-field {+ width: 112px;+ min-height: 0;+ height: var(--control-sm);+}++.transport-format {+ flex: none;+ color: var(--text-muted);+ font-size: var(--text-xs);+ white-space: nowrap;+}+/* --- Transport -------------------------------------------------------------- Moved here from under the program monitor. It drives the playhead, and the- playhead is drawn immediately below this row; keeping it two panels away- also meant printing the same timecode in two places. */--/* Centred on the picture, not on the row. The middle grid track already sits- centred in the toolbar; a margin on ONE side makes the track that much wider- and, because a grid item stretches to its track minus its own margins, slides- the buttons half that margin the other way. Doubling the shift and halving it- again is what lands the cluster's centre exactly on --video-centre-shift.-- A margin rather than a transform so the space is really reserved: a transform- would let the buttons ride over the heading or the tools at narrow widths- instead of pushing them. max() picks the side, since the shift is signed and- a negative margin would pull the cluster the wrong way. */+ Go to start · Frame back · Play/Pause · Frame forward · Go to end. Flat 28px+ squares with 4px corners and a fill-only hover; Play carries no accent — it+ is one control of five. */+.timeline-transport {display: flex;align-items: center;justify-content: center;- gap: var(--space-1);- margin-left: max(0px, calc(var(--video-centre-shift) * 2));- margin-right: max(0px, calc(var(--video-centre-shift) * -2));+ gap: 2px;}-/* Subtle icon buttons, the Fluent media-transport size: 32px square with- 4px corners. Play is the same size and carries the accent fill. */.timeline-transport button {- width: var(--icon-button);- height: var(--icon-button);+ width: 28px;+ height: 28px;flex: 0 0 auto;display: grid;place-items: center;padding: 0;border: 0;border-radius: var(--radius-sm);- color: var(--text-secondary);- background: none;-}--.timeline-transport button:hover:not(:disabled) {color: var(--text-primary);- background: var(--panel-3);-}--.timeline-transport .play-button {- width: var(--icon-button);- height: var(--icon-button);- color: var(--on-accent);- background: var(--accent);-}--.timeline-transport .play-button:hover:not(:disabled) {- background: var(--accent-bright);-}--/* An empty timeline has nothing to play, and the pixels have to say so. They- did not: the fill stayed --accent and only dimmed, which on this background- left Play the brightest control on the page — an invitation to the one click- it cannot honour, with the truth hidden in the DOM and the tooltip. So the- accent goes entirely and the button drops to the flat surface the rest of the- transport already sits on.-- Colour rather than opacity, because 0.4 of --text-secondary lands under the- contrast floor the tokens set: a disabled control still has to be readable,- and its title is the whole explanation of why it is off. */-.timeline-transport button:disabled {- color: var(--text-faint);+ background: transparent;+ transition: var(--transition-control);}-.timeline-transport .play-button:disabled {- color: var(--text-faint);- background: var(--panel-3);-}+.timeline-transport button:hover:not(:disabled) { background: var(--fill-subtle-hover); }+.timeline-transport button:active:not(:disabled) { background: var(--fill-subtle-pressed); }-/* The only timecode on the screen. Tabular figures so the row does not twitch- as the digits change under playback, and no shrinking: the heading beside it- already ellipsises, and a half-eaten clock is worse than a short title. */-.transport-time,-.transport-format {- flex: 0 0 auto;- padding-left: var(--space-3);- border-left: 1px solid var(--line);- white-space: nowrap;-}+/* A disabled control still has to be legible — its tooltip is the whole+ explanation of why it is off. */+.timeline-transport button:disabled { color: var(--text-disabled); }-.transport-time {- color: var(--text-primary);- font: var(--weight-medium) var(--text-sm) / 1 var(--font-mono);+.transport-rate {+ min-width: 28px;+ color: var(--accent-bright);+ font-size: var(--text-xs);font-variant-numeric: tabular-nums;+ text-align: center;}-.transport-format {- color: var(--text-muted);- font: var(--weight-medium) var(--text-xs) / 1 var(--font-mono);-}--/* Flushed to the right edge of the toolbar. The third grid track is a 1fr rail- that exists to balance the lead against it and keep the transport centred, so- left-packed buttons floated in the middle of the row with a gap after them- that read as unused space. The rail stays; only its contents move. */.timeline-tools {min-width: 0;display: flex;align-items: center;justify-content: flex-end;- gap: var(--space-1);+ gap: 2px;}.timeline-tools button {- min-height: var(--control-sm);- min-width: var(--control-sm);+ height: 28px;+ min-width: 28px;+ flex: none;display: flex;align-items: center;justify-content: center;- gap: var(--space-2);- padding: 0 var(--space-3);- border: 1px solid transparent;+ gap: var(--space-1);+ padding: 0 var(--space-2);+ border: 0;border-radius: var(--radius-sm);- color: var(--text-secondary);+ color: var(--text-primary);background: none;- font-size: var(--text-sm);- font-weight: var(--weight-medium);+ font-size: var(--text-xs);line-height: var(--leading-snug);+ transition: var(--transition-control);}-.timeline-tools button:hover:not(:disabled) {- color: var(--text-primary);- border-color: var(--line);- background: var(--panel-3);+.timeline-tools button.timeline-tools__icon { padding: 0; }+.timeline-tools button:hover:not(:disabled) { background: var(--fill-subtle-hover); }+.timeline-tools button:active:not(:disabled),+.timeline-tools button.active { background: var(--fill-subtle-pressed); }+.timeline-tools button:disabled { color: var(--text-disabled); }++.timeline-tools__separator {+ width: 1px;+ height: 16px;+ flex: none;+ margin: 0 var(--space-1);+ background: var(--line);}-/* Same rule as the transport's disabled state, which this row had drifted from:- --text-faint is the dimmest text the tokens allow because it is the last one- that still clears 4.5:1, and multiplying it by 0.55 put it back under the- floor. A disabled button still has to be legible — its title is the only- explanation of why it is off, and nobody hovers what they cannot read. */-.timeline-tools button:disabled {- color: var(--text-faint);+.timeline-zoom {+ width: 88px;+ flex: none;}/* --- Track grid ------------------------------------------------------------ */-.timeline-grid-scroll {+.timeline-body {+ position: relative;min-width: 0;min-height: 0;- overflow-x: hidden;- overflow-y: hidden;}-.timeline-grid-scroll--wide {- overflow-x: auto;+/* Always scrollable both ways: the wheel scrolls the tracks, Shift+wheel+ scrolls sideways, Ctrl+wheel zooms (see TimelineView). */+.timeline-grid-scroll {+ position: absolute;+ inset: 0;+ overflow: auto;}.timeline-grid {- /* Wide enough for a track name to be read in full beside the kind icon and- the two toggles. It was cut to fit the seeded names when those still ended- in ", Video"; the room now goes to names the user types. */- --track-column: 256px;+ --track-column: var(--pane-timeline-tracks);position: relative;display: grid;grid-template-columns: var(--track-column) minmax(0, 1fr);- grid-template-rows: 36px;- grid-auto-rows: 96px;+ grid-template-rows: var(--ruler-height);+ grid-auto-rows: auto;min-width: 100%;min-height: 100%;+ align-content: start;}-/* Track controls remain available while the ruler and clips move sideways. */-.timeline-grid-scroll--wide .track-corner,-.timeline-grid-scroll--wide .track-head {- position: sticky;- left: 0;- z-index: 10;+/* The track-header column's splitter rides on the column's right edge. It+ sits outside the scroll area, so it stays put while the lanes scroll. */+.timeline-track-splitter.ui-splitter {+ position: absolute;+ z-index: 12;+ top: 0;+ bottom: 0;+ left: calc(var(--pane-timeline-tracks) - 2px);}+/* The ruler row stays in view while the tracks scroll under it, and the track+ headers stay in view while the lanes scroll sideways. */.track-corner {- display: flex;- align-items: center;- /* Cover the ruler as it scrolls beneath this sticky header. */- background: var(--panel);- padding-left: var(--space-4);+ position: sticky;+ top: 0;+ left: 0;+ z-index: 11;border-right: 1px solid var(--line);border-bottom: 1px solid var(--line);- color: var(--text-secondary);- font-size: var(--text-xs);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);+ background: var(--layer);}.time-ruler {- position: relative;+ position: sticky;+ top: 0;+ z-index: 8;+ overflow: hidden;border-bottom: 1px solid var(--line);- cursor: crosshair;- background: var(--panel-2);+ background-color: var(--layer);+ /* Minor ticks, painted rather than rendered: the interval is set inline+ from the zoom (background-size), so a frame-level ruler costs nothing. */+ background-image: linear-gradient(90deg, var(--text-faint) 1px, transparent 1px);+ background-repeat: repeat-x;+ background-position: 0 100%;+ cursor: default;}-.time-ruler > span {+.time-ruler__tick {position: absolute;top: 0;height: 100%;- padding-left: var(--space-1);- color: var(--text-muted);- font: var(--weight-medium) var(--text-2xs) / 1 var(--font-mono);+ padding: 3px 0 0 var(--space-1);+ border-left: 1px solid var(--text-muted);+ color: var(--text-secondary);+ font-size: var(--text-2xs);+ font-variant-numeric: tabular-nums;+ line-height: 1;+ white-space: nowrap;+ pointer-events: none;}-.time-ruler > span i {- display: block;- width: 1px;- height: 10px;- margin-left: calc(var(--space-1) * -1);- margin-bottom: var(--space-2);- background: var(--text-faint);+/* The in/out range (I / O). */+.time-ruler__range {+ position: absolute;+ top: 0;+ bottom: 0;+ border-left: 2px solid var(--accent);+ border-right: 2px solid var(--accent);+ background: var(--accent-soft-strong);+ pointer-events: none;}.track-head {+ position: sticky;+ left: 0;+ z-index: 10;min-width: 0;+ height: var(--track-video-height);display: grid;- grid-template-columns: 32px minmax(0, 1fr) var(--control-sm) var(--control-sm);+ grid-template-columns: auto minmax(0, 1fr) 20px 20px;align-items: center;gap: var(--space-1);- padding: 0 var(--space-2);+ padding: 0 var(--space-1) 0 var(--space-2);border-right: 1px solid var(--line);border-bottom: 1px solid var(--line);- background: var(--panel);+ background: var(--layer);}-.track-kind {- width: 32px;- height: 32px;- display: grid;- place-items: center;- border-radius: var(--radius-sm);- color: var(--accent-bright);- background: var(--accent-soft-strong);+.track-head--audio,+.track-lane--audio {+ height: var(--track-audio-height);}-.track-head .track-name,-.track-head small {- display: block;- overflow: hidden;- white-space: nowrap;- text-overflow: ellipsis;+/* "V1", "A1": the track's kind and number, the way every NLE labels a track. */+.track-label {+ min-width: 20px;+ color: var(--text-primary);+ font-size: var(--text-xs);+ font-weight: var(--weight-semibold);}-/* An editable field that reads as the label it replaced until it is focused —- a border around every track name would turn the head into a form. */+/* An editable field that reads as a label until it is used — a border around+ every track name would turn the header into a form. */.track-head .track-name {width: 100%;min-width: 0;- padding: 2px var(--space-1);- margin-left: calc(var(--space-1) * -1);+ height: 20px;+ padding: 0 var(--space-1);border: 1px solid transparent;border-radius: var(--radius-sm);- color: var(--text-primary);+ overflow: hidden;+ color: var(--text-secondary);background: none;font-family: inherit;- font-size: var(--text-sm);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);+ font-size: var(--text-xs);+ line-height: 1;text-overflow: ellipsis;+ white-space: nowrap;}-.track-head .track-name:hover {- border-color: var(--line-strong);-}+.track-head .track-name:hover { background: var(--fill-subtle-hover); }.track-head .track-name:focus {outline: none;- border-color: var(--accent-bright);- background: var(--panel-2);-}--.track-head small {- margin-top: 2px;- color: var(--text-muted);- font-size: var(--text-xs);- line-height: var(--leading-snug);+ color: var(--text-primary);+ border-color: var(--stroke-control);+ border-bottom-color: var(--field-focus-line);+ background: var(--fill-input-focus);}.track-head button {- width: var(--control-sm);- height: var(--control-sm);+ width: 20px;+ height: 20px;display: grid;place-items: center;padding: 0;border: 0;border-radius: var(--radius-sm);- color: var(--text-muted);+ color: var(--text-secondary);background: none;+ transition: var(--transition-control);}-.track-head button:hover,-.track-head button.active {- color: var(--text-primary);- background: var(--panel-3);-}+.track-head button:hover { background: var(--fill-subtle-hover); }.track-head button.active {- color: var(--accent-bright);+ color: var(--text-primary);+ background: var(--fill-subtle-pressed);}.track-lane {position: relative;+ height: var(--track-video-height);overflow: hidden;border-bottom: 1px solid var(--line);- background-color: var(--bg);+ background-color: var(--panel);background-image: linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);- /* Set by the view from the ruler's own tick step, so the lines line up with- the timecodes above. The fallback is only for a lane rendered before the- grid has been measured. */+ /* Set by the view from the ruler's own label interval, so the lines line up+ with the timecodes above at every zoom. */background-size: var(--lane-grid, 14.7%) 100%;}@@ -1178,51 +1275,38 @@}/* Lit while a compatible media file is held over this lane. A drop target the- user cannot see is a drop target the user will not find — and lanes that- refuse the file (a sound over a video track, or a locked track) stay dark,- so the highlight IS the answer to "can this go here?". */+ user cannot see is a drop target the user will not find. */.track-lane--drop {background-color: var(--accent-soft);- box-shadow: inset 0 0 0 1px var(--accent-bright);+ box-shadow: inset 0 0 0 1px var(--accent);}-/* And the other half of the answer: a lane that cannot take what is being- dragged is marked for the whole drag, so "no" is visible before the pointer- ever reaches it. A dark lane alone was indistinguishable from a lane the- pointer merely was not over. */+/* And a lane that cannot take what is being dragged is dimmed for the whole+ drag, so "no" is visible before the pointer ever reaches it. */.track-lane--reject {- background-image: repeating-linear-gradient(- 135deg,- var(--hatch-strong) 0 6px,- transparent 6px 12px- );- opacity: 0.55;+ opacity: 0.45;}-/* --- Clips ----------------------------------------------------------------- */+/* --- Clips -----------------------------------------------------------------+ Flat: the clip colour mixed into the panel, a 1px darker border, 4px+ corners, and an 18px title strip carrying the clip's name. Selected is a+ crisp inner outline. No gradients, sheen, stripes or brightness filters. */-/* The clip and the three controls that ride on it — two trim handles and a- delete — share one box, positioned on the ruler. They are siblings rather- than children of the clip because the clip is itself a control: nesting a- button inside a button is not something a browser or a screen reader can- make sense of. */+/* The clip and the two trim handles that ride on it share one box, positioned+ on the ruler. They are siblings rather than children of the clip because the+ clip is itself a control. */.clip-slot {position: absolute;- top: var(--space-2);- height: 80px;- min-width: 22px;+ top: 3px;+ bottom: 3px;+ min-width: 6px;}-.clip-slot.selected {- z-index: 3;-}+.clip-slot.selected { z-index: 3; }/* The clip being dragged rides over everything, including the clip it is beingdropped next to, so the edge being aimed at stays visible. */-.clip-slot--dragging {- z-index: 5;- filter: brightness(1.06);-}+.clip-slot--dragging { z-index: 5; }.timeline-clip {position: absolute;@@ -1230,37 +1314,49 @@overflow: hidden;padding: 0;cursor: grab;- border: 1px solid color-mix(in srgb, var(--clip-color, var(--clip-video-default)) 70%, var(--clip-edge) 10%);+ border: 1px solid color-mix(in srgb, var(--clip-color, var(--clip-video-default)) 40%, var(--stage-bg));border-radius: var(--radius-sm);text-align: left;color: var(--text-primary);- background: linear-gradient(- 180deg,- color-mix(in srgb, var(--clip-color, var(--clip-video-default)) 72%, var(--clip-shade-top)),- color-mix(in srgb, var(--clip-color, var(--clip-video-default)) 48%, var(--clip-shade-bottom))- );- box-shadow: inset 0 1px var(--clip-sheen);+ background: color-mix(in srgb, var(--clip-color, var(--clip-video-default)) 55%, var(--panel));}-.timeline-clip::before {- content: "";- position: absolute;- z-index: 1;- inset: 0;- background: repeating-linear-gradient(90deg, var(--clip-stripe) 0 18px, transparent 18px 21px);+.timeline-clip--audio-only {+ border-color: color-mix(in srgb, var(--clip-color, var(--clip-audio-default)) 40%, var(--stage-bg));+ background: color-mix(in srgb, var(--clip-color, var(--clip-audio-default)) 55%, var(--panel));+}++.timeline-clip.selected {+ box-shadow: inset 0 0 0 1px var(--text-primary);+}++.timeline-clip__title {+ position: relative;+ z-index: 3;+ display: block;+ height: 18px;+ padding: 0 var(--space-2);+ overflow: hidden;+ color: var(--text-primary);+ background: color-mix(in srgb, var(--stage-bg) 22%, transparent);+ font-size: var(--text-xs);+ font-weight: var(--weight-regular);+ line-height: 17px;+ text-overflow: ellipsis;+ white-space: nowrap;pointer-events: none;}.timeline-clip__thumbnails {position: absolute;z-index: 0;- inset: 0;+ inset: 18px 0 0;overflow: hidden;pointer-events: none;}.timeline-clip--has-audio:not(.timeline-clip--audio-only) .timeline-clip__thumbnails {- bottom: 24px;+ bottom: 12px;}.timeline-clip__thumbnails img {@@ -1272,32 +1368,25 @@user-select: none;}-.timeline-clip--audio-only {- background: linear-gradient(- 180deg,- color-mix(in srgb, var(--clip-color, var(--clip-audio-default)) 62%, var(--clip-audio-shade-top)),- color-mix(in srgb, var(--clip-color, var(--clip-audio-default)) 38%, var(--clip-audio-shade-bottom))- );-}-.clip-audio-visualization {position: absolute;z-index: 2;right: 0;bottom: 0;left: 0;- height: 24px;- padding: 3px 4px;+ height: 12px;+ padding: 1px var(--space-1);overflow: hidden;- border-top: 1px solid color-mix(in srgb, var(--line-strong) 70%, transparent);+ border-top: 1px solid color-mix(in srgb, var(--stage-bg) 30%, transparent);background: color-mix(in srgb, var(--panel) 34%, transparent);transition: opacity var(--motion-fast) linear;pointer-events: none;}.timeline-clip--audio-only .clip-audio-visualization {- top: 0;+ top: 18px;height: auto;+ border-top: 0;background: transparent;}@@ -1320,221 +1409,76 @@opacity: 0.48;}-.timeline-clip:hover {- filter: brightness(1.14);-}-/* Nothing on a locked track moves, so nothing on it offers the hand that saysit would. */.timeline-clip--locked {cursor: default;}-.timeline-clip.selected {- border-color: var(--clip-selected-edge);- box-shadow: 0 0 0 2px var(--accent-bright), inset 0 1px var(--clip-sheen-strong);-}--/* --- Trimming and deleting a clip -------------------------------------------- The handles are hit targets first: 10px of grab area at each end, wider than- the 3px they draw, because a trim that needs a pixel-perfect press is a trim- nobody performs. They sit ON the clip's edges rather than outside them, so- two clips butted together do not put four overlapping handles in the same- few pixels.- ========================================================================== */+/* --- Trimming ------------------------------------------------------------------+ The handles are hit targets first: 8px of grab area at each end, drawn as+ nothing until the pointer is over one, then a 2px inner edge. They sit ON the+ clip's edges, so two clips butted together do not stack four handles. */.clip-handle {position: absolute;z-index: 4;top: 0;bottom: 0;- width: 10px;+ width: 8px;cursor: ew-resize;- border-radius: var(--radius-sm);background: transparent;- transition: var(--transition-control);-}--.clip-handle--start { left: 0; }-.clip-handle--end { right: 0; }--.clip-slot:hover .clip-handle,-.clip-slot.selected .clip-handle {- background: linear-gradient(90deg, var(--clip-sheen-strong), transparent 60%);-}--.clip-slot:hover .clip-handle--end,-.clip-slot.selected .clip-handle--end {- background: linear-gradient(270deg, var(--clip-sheen-strong), transparent 60%);-}--.clip-handle:hover {- background: var(--accent-bright) !important;- opacity: 0.85;-}--.clip-delete {- position: absolute;- z-index: 4;- top: 3px;- right: 3px;- display: none;- place-items: center;- width: 18px;- height: 18px;- padding: 0;- border: 1px solid var(--line-strong);- border-radius: var(--radius-sm);- color: var(--text-primary);- background: color-mix(in srgb, var(--panel) 80%, transparent);-}--/* Only on the clip the pointer is over, or the one being worked on: eighteen- delete buttons across a full timeline is a row of things to hit by mistake.- Focus counts too, so it can be reached from the keyboard at all. */-.clip-slot:hover .clip-delete,-.clip-slot.selected .clip-delete,-.clip-delete:focus-visible {- display: grid;}-.clip-delete:hover {- border-color: var(--danger);- color: var(--danger);-}+.clip-handle--start { left: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }+.clip-handle--end { right: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }-/* A clip narrower than the controls would be nothing but controls. */-.clip-slot[style*="width: 0"] .clip-delete {- display: none;-}+.clip-handle--start:hover { box-shadow: inset 2px 0 0 var(--text-primary); }+.clip-handle--end:hover { box-shadow: inset -2px 0 0 var(--text-primary); }/* Selection is off everywhere outside a text field (see base.css), so a dragonly has to say what it IS. */-.timeline-view--dragging {- cursor: grabbing;-}-+.timeline-view--dragging,.timeline-view--dragging .timeline-clip {cursor: grabbing;}+/* --- Playhead ----------------------------------------------------------------+ A full-height line from the top of the ruler, and a pentagon head (clip-path)+ inside the ruler that can be dragged to scrub. */+.timeline-playhead {position: absolute;z-index: 9;- top: 24px;+ top: 0;bottom: 0;width: 1px;+ margin-left: -0.5px;background: var(--danger);pointer-events: none;}-.timeline-playhead span {+.timeline-playhead__head {position: absolute;- width: 9px;- height: 9px;- left: -4px;- top: -1px;- border-radius: 2px 2px 5px 5px;+ top: 0;+ left: -6px;+ width: 13px;+ height: 16px;background: var(--danger);+ clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);+ cursor: ew-resize;+ pointer-events: auto;}-.timeline-playhead i {- position: absolute;- left: -3px;- top: 10px;- width: 7px;- height: 1px;- background: var(--danger);- opacity: 0.4;-}--/* --- Responsive ------------------------------------------------------------ */--/* The Tauri window may be resized down to 900px (see tauri.conf.json), so the- editor has to survive 900–1180px without ever scrolling sideways. The old- `minmax(460px, 1fr)` centre column alone forced a 1036px floor. Each step- below drops the least essential column; the program monitor always survives.-- 1180px three columns, narrower sides, monitor floor removed- 1040px two columns — the clip inspector goes first- 840px one column — the scene panel goes too (below the 900px window- minimum, kept so an odd DPI/zoom combination still lays out) */--@media (max-width: 1180px) {- .edit-panels {- grid-template-columns: 256px minmax(0, 1fr) 300px;- }-- .timeline-view {- --video-centre-shift: -22px;- }-- .scene-card {- grid-template-columns: 88px minmax(0, 1fr);- }-- /* Keep --track-column and the playhead offset in lockstep: TimelineView- positions the playhead with calc(var(--track-column) + …). */- .timeline-grid {- --track-column: 200px;- }-}--@media (max-width: 1040px) {- .edit-panels {- grid-template-columns: 232px minmax(0, 1fr);- }-- .clip-inspector {- display: none;- }-- .timeline-view {- --video-centre-shift: 0px;- }-- .timeline-grid {- --track-column: 184px;- }-}--@media (max-width: 840px) {- .edit-panels {- grid-template-columns: minmax(0, 1fr);- }-- .scene-panel {- display: none;- }-- .timeline-view {- --video-centre-shift: 0px;- }-- .timeline-grid {- --track-column: 168px;- }-}--/* Optional clip effects share the compact inspector controls. */-.clip-effect > header { display: flex; align-items: center; justify-content: space-between; }-.clip-effect fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }-.clip-effect__remove { display: grid; place-items: center; padding: 4px; border: 0; border-radius: var(--radius-sm); color: var(--text-muted); background: transparent; }-.clip-effect__remove:hover:not(:disabled) { color: var(--text-primary); background: var(--panel-3); }-.clip-effect .effect-color { display: flex; align-items: center; gap: var(--space-2); }-.clip-effect .effect-color > span { margin: 0; margin-right: auto; }-.clip-effect .effect-color input { width: 36px; padding: 3px; }-.effect-color code { font-size: var(--text-xs); color: var(--text-muted); }-.clip-effects { position: relative; padding: var(--space-3) var(--space-4); }-.clip-effects__add { display: flex; align-items: center; justify-content: center; gap: var(--space-2); width: 100%; padding: var(--space-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text-primary); font-size: var(--text-sm); }-.clip-effects__add:hover:not(:disabled) { border-color: var(--accent); background: var(--panel-3); }-.clip-effects__add:disabled, .clip-effect__remove:disabled { opacity: .45; }-.clip-effects__picker { position: absolute; z-index: 5; bottom: calc(100% - var(--space-2)); left: var(--space-4); right: var(--space-4); padding: 4px; border: 1px solid var(--stroke-surface); border-radius: var(--radius-lg); background: var(--acrylic); backdrop-filter: var(--acrylic-filter); box-shadow: var(--shadow-sm); max-height: min(280px, 40vh); overflow-y: auto; }-.clip-effects__picker button { display: flex; flex-direction: column; gap: 3px; width: 100%; border: 0; border-radius: var(--radius-sm); padding: var(--space-2); background: transparent; color: var(--text-primary); text-align: left; }-.clip-effects__picker button:hover, .clip-effects__picker button:focus-visible { outline: none; background: var(--panel-3); }-.clip-effects__picker strong { font-size: var(--text-sm); font-weight: var(--weight-medium); }-.clip-effects__picker span { font-size: var(--text-xs); color: var(--text-muted); }+/* --- Pane splitters ------------------------------------------------------------ */++.edit-panels__splitter.ui-splitter {+ background: var(--panel);+}++.timeline-view__splitter.ui-splitter {+ background: var(--panel);+}.program-media { position: absolute; inset: 0; z-index: 0; pointer-events: none; }.program-composited-picture { position: absolute; inset: 0; pointer-events: none; }