AI media harness for planning, generating, and editing locally
TypeScript
Export: stage preview, resizable settings pane with sections and pinned actions
Bitti2940f6994efc
diff --git a/src/components/workspace/ExportView.test.tsx b/src/components/workspace/ExportView.test.tsxindex 27909b7..87ecea7 100644--- a/src/components/workspace/ExportView.test.tsx+++ b/src/components/workspace/ExportView.test.tsx@@ -86,12 +86,19 @@ describe("the export view where nothing can encode", () => {});describe("the shape of the export screen", () => {- it("is a docked form: preview, a settings column, and a footer with the actions", () => {+ it("is a docked form: preview, a resizable settings pane, and the actions at its foot", () => {const { container } = render(<ExportView config={project([clip("a", 0, 2_000)])} folderPath="/tmp/project" onClose={() => undefined} />);expect(screen.getByRole("region", { name: "Video preview" })).toBeTruthy();- expect(screen.getByRole("heading", { name: "Settings" })).toBeTruthy();- const footer = container.querySelector(".export-footer") as HTMLElement;- expect(within(footer).getAllByRole("button").map((button) => button.textContent)).toEqual(["Cancel", "Export"]);+ const pane = screen.getByRole("region", { name: "Export settings" });+ // No title header: the pane opens on its first section.+ expect(within(pane).queryByRole("heading")).toBeNull();+ expect(pane.querySelector(".ui-prop-section")).toBe(pane.querySelector(".export-settings__scroll")!.firstElementChild);+ expect(within(pane).getByRole("button", { name: /Output/ }).getAttribute("aria-expanded")).toBe("true");+ expect(within(pane).getByRole("button", { name: /Summary/ })).toBeTruthy();+ expect(screen.getByRole("separator", { name: "Resize export settings" }).getAttribute("aria-valuenow")).toBe("340");+ expect(container.querySelector(".export-footer")).toBeNull();+ const foot = pane.querySelector(".export-settings__foot") as HTMLElement;+ expect(within(foot).getAllByRole("button").map((button) => button.textContent)).toEqual(["Cancel", "Export"]);// No hero title on the page, and labels in sentence case.expect(container.querySelector("h1")?.classList.contains("sr-only")).toBe(true);expect(screen.getByText("Save to")).toBeTruthy();diff --git a/src/components/workspace/ExportView.tsx b/src/components/workspace/ExportView.tsxindex fd4de16..85f0861 100644--- a/src/components/workspace/ExportView.tsx+++ b/src/components/workspace/ExportView.tsx@@ -39,7 +39,7 @@ import { askNative, messageNative, revealInExplorer } from "../../lib/nativeShelimport { formatTimecode, frameAt, frameStartMs } from "../../lib/timeline";import { ProgramMonitor } from "./ProgramMonitor";import { PROJECT_RESOLUTIONS, type ProjectConfig, type Resolution } from "../../lib/project";-import { ComboBox, InfoBar, ProgressBar, Slider, tooltipProps } from "../ui";+import { ComboBox, InfoBar, ProgressBar, PropRow, PropSection, Slider, Splitter, tooltipProps, usePaneSize } from "../ui";/* The ladder a project can be created at, plus the project's own size when thatis one of the names from before the ladder was rebuilt. Dropping the legacy@@ -76,16 +76,18 @@ interface Destination {}/* A docked form, the way Clipchamp and Premiere's export page are laid out:- the picture on the left, a 340px settings column on the right separated by a- divider, and the actions at the bottom right. The run itself lives in- lib/exportJob.ts, so leaving this screen no longer cancels it. */+ the picture on the stage at the left, a resizable settings pane on the right+ that opens straight on its first section, and the actions at the pane's+ foot. The run itself lives in lib/exportJob.ts, so leaving this screen no+ longer cancels it. */export function ExportView({ config, folderPath, onClose }: {config: ProjectConfig;folderPath: string;- /** Leaves the Export screen (the footer's Cancel while nothing is running). */+ /** Leaves the Export screen (the pane foot's Cancel while nothing is running). */onClose?: () => void;}) {const [settings, setSettings] = useState<ExportSettings>(() => defaultExportSettings(config));+ const settingsPane = usePaneSize("export.settings", 340, { min: 280, max: 560 });const plan = useMemo(() => buildExportPlan(config, settings), [config, settings]);const bitrate = useMemo(() => bitrateFor(plan.width, plan.height, plan.frameRate, settings.quality),@@ -328,7 +330,7 @@ export function ExportView({ config, folderPath, onClose }: {const empty = plan.frameCount === 0;const transportDisabled = empty;- return <div className="export-view">+ return <div className="export-view" style={settingsPane.style}><h1 className="sr-only">Export</h1><div className="export-body"><section className="export-preview" aria-label="Video preview">@@ -399,141 +401,145 @@ export function ExportView({ config, folderPath, onClose }: {{empty && <p className="export-stage__caption">Nothing on the timeline yet</p>}</section>- <section className="export-settings" aria-labelledby="export-settings-heading">- <h2 id="export-settings-heading" className="export-settings__heading">Settings</h2>- <div className="export-form">- <div className="export-row">- <span className="export-row__label" id="export-destination-label">Save to</span>- <div className="export-destination">- <span className="export-destination__path" {...tooltipProps(destination?.path)}>- {destination ? destination.path : support.desktop ? "Choose a file…" : "Available in the desktop app"}- </span>- <button- type="button"- className="secondary-button export-destination__browse"- disabled={runningHere || !support.desktop}- aria-describedby="export-destination-label"- onClick={() => void browse()}- >Browse…</button>- </div>- </div>-- <div className="export-row">- <label className="export-row__label" htmlFor="export-resolution">Resolution</label>- <ComboBox- id="export-resolution"- value={settings.resolution}- disabled={runningHere}- onChange={(value) => setSettings({ ...settings, resolution: value as Resolution })}- options={resolutionChoices(config.settings.resolution).map((resolution) => {- const size = outputDimensions(resolution, config.settings.aspectRatio);- return { value: resolution, label: `${size.width} × ${size.height}` };- })}- />- </div>-- <div className="export-row">- <label className="export-row__label" htmlFor="export-frame-rate">Frame rate</label>- <ComboBox- id="export-frame-rate"- value={String(settings.frameRate)}- disabled={runningHere}- onChange={(value) => setSettings({ ...settings, frameRate: Number(value) as FrameRate })}- options={FRAME_RATES.map((rate) => ({ value: String(rate), label: `${rate} fps` }))}- />+ <Splitter {...settingsPane.splitterProps} reverse aria-label="Resize export settings" aria-controls="export-settings" />++ {/* No title: the pane opens on its first section, like every inspector. */}+ <section id="export-settings" className="export-settings" aria-label="Export settings">+ <div className="export-settings__scroll">+ <PropSection title="Output" persistKey="export.output">+ <PropRow label={<span id="export-destination-label">Save to</span>}>+ <div className="export-destination">+ <span className="export-destination__path" {...tooltipProps(destination?.path)}>+ {destination ? destination.path : support.desktop ? "Choose a file…" : "Available in the desktop app"}+ </span>+ <button+ type="button"+ className="secondary-button export-destination__browse"+ disabled={runningHere || !support.desktop}+ aria-describedby="export-destination-label"+ onClick={() => void browse()}+ >Browse…</button>+ </div>+ </PropRow>++ <PropRow label="Resolution" htmlFor="export-resolution">+ <ComboBox+ id="export-resolution"+ value={settings.resolution}+ disabled={runningHere}+ onChange={(value) => setSettings({ ...settings, resolution: value as Resolution })}+ options={resolutionChoices(config.settings.resolution).map((resolution) => {+ const size = outputDimensions(resolution, config.settings.aspectRatio);+ return { value: resolution, label: `${size.width} × ${size.height}` };+ })}+ />+ </PropRow>++ <PropRow label="Frame rate" htmlFor="export-frame-rate">+ <ComboBox+ id="export-frame-rate"+ value={String(settings.frameRate)}+ disabled={runningHere}+ onChange={(value) => setSettings({ ...settings, frameRate: Number(value) as FrameRate })}+ options={FRAME_RATES.map((rate) => ({ value: String(rate), label: `${rate} fps` }))}+ />+ </PropRow>++ <PropRow label="Format" htmlFor="export-codec">+ <ComboBox+ id="export-codec"+ value={settings.codec}+ disabled={runningHere}+ onChange={(value) => setSettings({ ...settings, codec: value as OutputCodecId })}+ options={OUTPUT_CODECS.map((codec) => {+ const probe = probes?.find((candidate) => candidate.id === codec.id);+ const unsupported = probe ? !probe.supported : false;+ return { value: codec.id, label: `MP4 · ${codec.label}${unsupported ? " (not supported here)" : ""}`, disabled: unsupported };+ })}+ />+ </PropRow>++ <PropRow label="Quality" htmlFor="export-quality">+ <ComboBox+ id="export-quality"+ value={settings.quality}+ disabled={runningHere}+ onChange={(value) => setSettings({ ...settings, quality: value as QualityId })}+ options={QUALITY_PRESETS.map((preset) => ({+ value: preset.id,+ label: `${preset.label} · ${(bitrateFor(plan.width, plan.height, plan.frameRate, preset.id) / 1_000_000).toFixed(1)} Mbit/s`,+ }))}+ />+ </PropRow>+ </PropSection>++ {/* Facts on the same --prop-label column as the rows above; a dl+ rather than PropRows because nothing here is a field. */}+ <PropSection title="Summary" persistKey="export.summary" summary={formatBytes(estimatedBytes(bitrate, plan.durationMs))}>+ <dl className="export-summary">+ {summary.map(([term, value, detail]) => <div key={term}>+ <dt>{term}</dt>+ <dd>{value}{detail && <small>{detail}</small>}</dd>+ </div>)}+ </dl>+ </PropSection>++ <div className="export-messages">+ {destinationError && <InfoBar severity="error" title="Save location" message={destinationError} onClose={() => setDestinationError(null)} />}+ {blockers.length > 0 && <InfoBar severity="error" title="Can’t export yet">+ <ul className="export-reasons">{blockers.map((blocker) => <li key={blocker}>{blocker}</li>)}</ul>+ </InfoBar>}+ {outcome?.kind === "saved" && outcome.audioProblems.length > 0 && <InfoBar severity="warning" title="Left out of the soundtrack">+ <ul className="export-reasons">{outcome.audioProblems.map((problem) => <li key={problem}>{problem}</li>)}</ul>+ </InfoBar>}+ {/* These clips ARE in the file. Part of each one is silence because+ the sound behind it ran out. */}+ {outcome?.kind === "saved" && outcome.audioShortfalls.length > 0 && <InfoBar severity="warning" title="Sound ran out before the clip ended">+ <ul className="export-reasons">{outcome.audioShortfalls.map((shortfall) => <li key={shortfall}>{shortfall}</li>)}</ul>+ </InfoBar>}</div>+ </div>- <div className="export-row">- <label className="export-row__label" htmlFor="export-codec">Format</label>- <ComboBox- id="export-codec"- value={settings.codec}- disabled={runningHere}- onChange={(value) => setSettings({ ...settings, codec: value as OutputCodecId })}- options={OUTPUT_CODECS.map((codec) => {- const probe = probes?.find((candidate) => candidate.id === codec.id);- const unsupported = probe ? !probe.supported : false;- return { value: codec.id, label: `MP4 · ${codec.label}${unsupported ? " (not supported here)" : ""}`, disabled: unsupported };- })}- />+ {/* The pane's foot, pinned under the scrolling sections: the run's+ progress or outcome, then Cancel / Export. */}+ <div className="export-settings__foot">+ <div className="export-settings__status" aria-live="polite">+ {progress && <div className="export-progress" role="status">+ <span className="export-progress__line">{progressLine}</span>+ <ProgressBar value={percent} aria-label="Export progress" />+ </div>}+ {!progress && outcome?.kind === "saved" && <InfoBar+ severity="success"+ title="Exported"+ message={`Exported to ${outcome.path}`}+ action={<>+ <button type="button" className="secondary-button" onClick={() => openFile(outcome.path)}>Open</button>+ <button type="button" className="secondary-button" onClick={() => showInFolder(outcome.path)}>Show in folder</button>+ </>}+ onClose={dismissExportOutcome}+ />}+ {!progress && outcome?.kind === "cancelled" && <InfoBar+ severity="informational"+ title="Export cancelled"+ message="Nothing was written."+ onClose={dismissExportOutcome}+ />}+ {!progress && outcome?.kind === "failed" && <InfoBar severity="error" title="Export failed" message={outcome.message} onClose={dismissExportOutcome} />}</div>-- <div className="export-row">- <label className="export-row__label" htmlFor="export-quality">Quality</label>- <ComboBox- id="export-quality"- value={settings.quality}- disabled={runningHere}- onChange={(value) => setSettings({ ...settings, quality: value as QualityId })}- options={QUALITY_PRESETS.map((preset) => ({- value: preset.id,- label: `${preset.label} · ${(bitrateFor(plan.width, plan.height, plan.frameRate, preset.id) / 1_000_000).toFixed(1)} Mbit/s`,- }))}- />+ <div className="export-settings__actions">+ {runningHere+ ? <button type="button" className="secondary-button" onClick={cancelExportJob} {...tooltipProps("Stop encoding. Nothing has been written yet.")}>Cancel</button>+ : onClose && <button type="button" className="secondary-button" onClick={onClose}>Cancel</button>}+ <button+ type="button"+ className="primary-button"+ disabled={!canExport}+ onClick={() => void start()}+ {...tooltipProps(canExport ? undefined : runningHere ? "Export is running" : blockers[0])}+ >{runningHere ? "Exporting…" : "Export"}</button></div></div>-- <h2 className="export-settings__heading">Summary</h2>- <dl className="export-summary">- {summary.map(([term, value, detail]) => <div key={term}>- <dt>{term}</dt>- <dd>{value}{detail && <small>{detail}</small>}</dd>- </div>)}- </dl>-- <div className="export-messages">- {destinationError && <InfoBar severity="error" title="Save location" message={destinationError} onClose={() => setDestinationError(null)} />}- {blockers.length > 0 && <InfoBar severity="error" title="Can’t export yet">- <ul className="export-reasons">{blockers.map((blocker) => <li key={blocker}>{blocker}</li>)}</ul>- </InfoBar>}- {outcome?.kind === "saved" && outcome.audioProblems.length > 0 && <InfoBar severity="warning" title="Left out of the soundtrack">- <ul className="export-reasons">{outcome.audioProblems.map((problem) => <li key={problem}>{problem}</li>)}</ul>- </InfoBar>}- {/* These clips ARE in the file. Part of each one is silence because- the sound behind it ran out. */}- {outcome?.kind === "saved" && outcome.audioShortfalls.length > 0 && <InfoBar severity="warning" title="Sound ran out before the clip ended">- <ul className="export-reasons">{outcome.audioShortfalls.map((shortfall) => <li key={shortfall}>{shortfall}</li>)}</ul>- </InfoBar>}- </div></section></div>-- <footer className="export-footer">- <div className="export-footer__status" aria-live="polite">- {progress && <div className="export-progress" role="status">- <span className="export-progress__line">{progressLine}</span>- <ProgressBar value={percent} aria-label="Export progress" />- </div>}- {!progress && outcome?.kind === "saved" && <InfoBar- severity="success"- title="Exported"- message={`Exported to ${outcome.path}`}- action={<>- <button type="button" className="secondary-button" onClick={() => openFile(outcome.path)}>Open</button>- <button type="button" className="secondary-button" onClick={() => showInFolder(outcome.path)}>Show in folder</button>- </>}- onClose={dismissExportOutcome}- />}- {!progress && outcome?.kind === "cancelled" && <InfoBar- severity="informational"- title="Export cancelled"- message="Nothing was written."- onClose={dismissExportOutcome}- />}- {!progress && outcome?.kind === "failed" && <InfoBar severity="error" title="Export failed" message={outcome.message} onClose={dismissExportOutcome} />}- </div>- <div className="export-footer__actions">- {runningHere- ? <button type="button" className="secondary-button" onClick={cancelExportJob} {...tooltipProps("Stop encoding. Nothing has been written yet.")}>Cancel</button>- : onClose && <button type="button" className="secondary-button" onClick={onClose}>Cancel</button>}- <button- type="button"- className="primary-button"- disabled={!canExport}- onClick={() => void start()}- {...tooltipProps(canExport ? undefined : runningHere ? "Export is running" : blockers[0])}- >{runningHere ? "Exporting…" : "Export"}</button>- </div>- </footer></div>;}diff --git a/src/styles/export.css b/src/styles/export.cssindex 23ec53b..f97ddc8 100644--- a/src/styles/export.css+++ b/src/styles/export.css@@ -2,28 +2,30 @@export.css — the Export screen: a docked form, not a page.The layout every Windows editor uses for its export step (Clipchamp's export- page, Premiere's Export tab): the picture on the left, a 340px settings- column on the right separated from it by a divider, and a footer with the- run's status on the left and Cancel / Export on the right. No hero title, no- cards, no stat tiles — labels in sentence case, values beside them.-- Dense scale, shared with the timeline (see timeline.css): controls 24–32px,- the transport bar 36px, 12px captions.+ page, Premiere's Export tab): the picture on the stage at the left, and a+ resizable settings pane on the right (usePaneSize → --pane-export-settings)+ that opens straight on its first section and keeps the run's status and+ Cancel / Export pinned at its foot. No hero title, no cards, no stat tiles —+ labels in the --prop-label column, values beside them.++ Dense scale, shared with the timeline (see timeline.css): 24px transport+ buttons in a 36px bar, 12px captions.========================================================================== */.export-view {+ --pane-export-settings: var(--pane-side-default); /* usePaneSize sets the real width inline */height: 100%;min-height: 0;container: export-view / inline-size;display: grid;- grid-template-rows: minmax(0, 1fr) auto;- background: var(--layer);+ grid-template-rows: minmax(0, 1fr);+ background: var(--surface-pane);}.export-body {min-height: 0;display: grid;- grid-template-columns: minmax(0, 1fr) 340px;+ grid-template-columns: minmax(0, 1fr) auto var(--pane-export-settings);}/* --- Preview ----------------------------------------------------------------- */@@ -36,7 +38,7 @@align-items: center;justify-content: center;padding: var(--space-4);- background: var(--panel);+ background: var(--surface-stage);}/* The stage is the frame plus its transport bar. It is also the element that@@ -49,7 +51,8 @@display: flex;flex-direction: column;overflow: hidden;- border: 1px solid var(--line);+ /* --line would vanish on black in light theme; the stage has its own ink. */+ border: 1px solid color-mix(in srgb, var(--on-stage) 16%, transparent);border-radius: var(--radius-sm);/* Black in both themes: the frame paints the project's own background, anda matching surround would hide where the picture ends. Everything painted@@ -77,30 +80,31 @@.export-stage__caption {margin: var(--space-2) 0 0;- color: var(--text-muted);+ color: var(--on-stage);font-size: var(--text-xs);line-height: var(--leading-snug);}/* --- Transport ----------------------------------------------------------------- Windowed: a static 36px bar under the picture — flat 28px buttons, a Fluent- slider, and "00:00:12:05 / 00:01:30:00". No scrim, no shadows, no scale. */+ Windowed: a static 36px chrome bar under the picture — flat 24px buttons+ like the timeline's, a Fluent slider, and "00:00:12:05 / 00:01:30:00". No+ scrim, no shadows, no scale. */.export-transport {- height: 36px;+ height: var(--chrome-row);flex: none;display: flex;align-items: center;gap: 2px;padding: 0 var(--space-2);- border-top: 1px solid var(--line);+ border-top: 1px solid var(--stroke-divider);color: var(--text-primary);- background: var(--layer);+ background: var(--surface-chrome);}.export-transport__button {- width: 28px;- height: 28px;+ width: var(--control-sm);+ height: var(--control-sm);flex: none;display: grid;place-items: center;@@ -184,54 +188,34 @@}}-/* --- Settings column ------------------------------------------------------------ */+/* --- Settings pane ---------------------------------------------------------------+ Sections scroll; the foot with the actions stays put under them. */.export-settings {min-width: 0;min-height: 0;- overflow-y: auto;- padding: var(--space-3) var(--space-4) var(--space-4);- border-left: 1px solid var(--line);- background: var(--layer);-}--.export-settings__heading {- margin: var(--space-2) 0 var(--space-2);- color: var(--text-primary);- font-size: var(--text-sm);- font-weight: var(--weight-semibold);- line-height: var(--leading-snug);-}--.export-settings__heading:not(:first-child) {- margin-top: var(--space-4);- padding-top: var(--space-3);- border-top: 1px solid var(--line);-}--.export-form {- display: grid;- gap: var(--space-2);+ display: flex;+ flex-direction: column;+ background: var(--surface-pane);}-/* Label above the field, in sentence case: the Fluent form layout at 340px. */-.export-row {- min-width: 0;- display: grid;- gap: var(--space-1);+.export-settings__scroll {+ flex: 1 1 auto;+ min-height: 0;+ overflow-y: auto;}-.export-row__label {- color: var(--text-secondary);- font-size: var(--text-xs);- line-height: var(--leading-snug);+/* Inspector side padding: 12px, the same as every PropSection's rows. */+.export-settings .ui-prop-section__content {+ padding-inline: var(--space-3);}-.export-row .ui-combo {+.export-settings .ui-prop-row .ui-combo {width: 100%;}.export-destination {+ flex: 1;min-width: 0;display: flex;align-items: center;@@ -251,22 +235,27 @@text-align: left;}-.export-destination__browse {+/* Compact, like the 24px combo boxes in the rows under it. */+.export-destination__browse.secondary-button {flex: none;+ min-height: var(--control-sm);+ height: var(--control-sm);}-/* The summary as a label/value list, one line per fact. */+/* The summary as a label/value list, one line per fact, on the PropRow grid:+ the --prop-label column, the value, and the empty reset column. */.export-summary {margin: 0;display: grid;- gap: var(--space-2);+ gap: var(--space-1);+ padding-block: var(--space-1);}.export-summary > div {min-width: 0;display: grid;- grid-template-columns: 104px minmax(0, 1fr);- gap: var(--space-2);+ grid-template-columns: var(--prop-label) minmax(0, 1fr) 20px;+ column-gap: var(--space-2);}.export-summary dt {@@ -294,7 +283,11 @@.export-messages {display: grid;gap: var(--space-2);- margin-top: var(--space-3);+ padding: var(--space-3);+}++.export-messages:empty {+ display: none;}.export-reasons {@@ -308,36 +301,35 @@margin-top: var(--space-1);}-/* --- Footer ---------------------------------------------------------------------- */+/* --- Pane foot ---------------------------------------------------------------------+ On chrome under a divider, like a pane footer: progress or the outcome,+ then Cancel / Export at the trailing edge. */-.export-footer {- min-height: 64px;- display: flex;- align-items: center;- gap: var(--space-4);- padding: var(--space-3) var(--space-4);- border-top: 1px solid var(--line);- background: var(--layer-alt);+.export-settings__foot {+ flex: none;+ display: grid;+ gap: var(--space-3);+ padding: var(--space-3);+ border-top: 1px solid var(--stroke-divider);+ background: var(--surface-chrome);}-.export-footer__status {- flex: 1 1 auto;- min-width: 0;+.export-settings__status:empty {+ display: none;}-.export-footer__actions {- flex: none;+.export-settings__actions {display: flex;+ justify-content: flex-end;gap: var(--space-2);}-.export-footer__actions .primary-button,-.export-footer__actions .secondary-button {+.export-settings__actions .primary-button,+.export-settings__actions .secondary-button {min-width: 96px;}.export-progress {- max-width: 560px;display: grid;gap: var(--space-2);}@@ -358,8 +350,12 @@grid-template-rows: minmax(0, 45%) minmax(0, 1fr);}+ /* Stacked there is no width to drag. */+ .export-body > .ui-splitter {+ display: none;+ }+.export-settings {- border-left: 0;- border-top: 1px solid var(--line);+ border-top: 1px solid var(--stroke-divider);}}