Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Simplify timeline media

Bitti9c7b1cef5b99
diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.ts
index 87a8d1b..ab38071 100644
--- a/src/components/ProjectWorkspace.test.ts
+++ b/src/components/ProjectWorkspace.test.ts
@@ -167,7 +167,7 @@ describe("project workspace timecode", () => {
// Save is the only save state left in the topbar — the standing "All
// changes saved" pill is gone — so it is off until there is something to
// write. Make an edit first, or the click lands on a disabled button.
- fireEvent.change(screen.getByLabelText("Name"), { target: { value: "Opening shot, retimed" } });
+ fireEvent.change(screen.getAllByTitle("Rename this track")[0], { target: { value: "Opening shots" } });
fireEvent.click(screen.getByRole("button", { name: "Save" }));
const alert = await screen.findByRole("alert");
expect(alert.textContent).toContain("Couldn’t save project");
@@ -274,6 +274,25 @@ describe("project workspace timecode", () => {
expect(within(media).getByText("Room tone")).not.toBeNull();
});
+ it("removes project media and every timeline use of it", () => {
+ const base = projectWithMedia();
+ const config = parseProjectConfig({
+ ...base,
+ timeline: { tracks: base.timeline.tracks.map((track) => track.id === STORY_TRACK_ID ? { ...track, clips: [{
+ id: "clip-macro-a", assetId: "asset-macro", trackId: track.id, startMs: 0, durationMs: 2_000, sourceStartMs: 0, label: "Macro A", color: null, status: "approved",
+ }, {
+ id: "clip-macro-b", assetId: "asset-macro", trackId: track.id, startMs: 3_000, durationMs: 2_000, sourceStartMs: 2_000, label: "Macro B", color: null, status: "approved",
+ }] } : track) },
+ });
+ const { onChange } = mediaPanel(config);
+
+ fireEvent.click(screen.getByRole("button", { name: "Remove Macro footage from project" }));
+ const next = wrote(onChange.mock.calls[0][0], config);
+ expect(next.assets.map((asset) => asset.id)).toEqual(["asset-room"]);
+ expect(next.timeline.tracks.flatMap((track) => track.clips).some((clip) => clip.assetId === "asset-macro")).toBe(false);
+ expect(parseProjectConfig(next)).toBeTruthy();
+ });
+
it("drops an ungenerated Generator scene onto a video track as a valid draft clip", () => {
const config = projectWithMedia();
const onChange = vi.fn();
@@ -431,54 +450,6 @@ describe("project workspace timecode", () => {
expect(droppedClip(second.onChange, unknown).durationMs).toBe(5_000);
});
- it("retimes the selected clip from the Lasts field, and will not run past the footage", () => {
- const config = withClip(measuredVideo(projectWithMedia(), 40_000), {});
- /* Every edit is fed back in, the way the holder does it in the app. It has
- to be: a typed length is now a trim of the clip’s tail, and a trim is
- measured against the clip AS IT STANDS — how much footage is left in the
- file after it, what sits next to it on the track. A harness that
- swallowed the writes would ask every keystroke about a clip that had
- already been replaced. */
- let current = config;
- const onChange = vi.fn((next: ProjectConfig | ((value: ProjectConfig) => ProjectConfig)) => {
- current = typeof next === "function" ? next(current) : next;
- rerender(createElement(TimelineView, { config: current, folderPath: "C:\\Ceramic Lamp", onChange, onOpenGenerator: () => undefined }));
- });
- const { rerender } = render(createElement(TimelineView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenGenerator: () => undefined }));
- const lasts = screen.getByTitle(/^How long this clip lasts/) as HTMLInputElement;
- // It was readOnly, which made the only stated way to fix a clip's length a
- // field that could not be typed into.
- expect(lasts.readOnly).toBe(false);
- expect(lasts.value).toBe("00:40:00");
- const lastDuration = () => current.timeline.tracks.flatMap((track) => track.clips)[0].durationMs;
-
- // Plain seconds, and the minutes:seconds:frames the field itself prints.
- fireEvent.change(lasts, { target: { value: "8" } });
- expect(lastDuration()).toBe(8_000);
- fireEvent.change(lasts, { target: { value: "00:12:15" } });
- // 15 frames at the project's 24 fps is 625 ms, not half a second.
- expect(lastDuration()).toBe(12_625);
- expect(parseProjectConfig(current)).toBeTruthy();
-
- // Half-typed text is not a length, and must not be turned into one.
- const before = onChange.mock.calls.length;
- fireEvent.change(lasts, { target: { value: "00:" } });
- expect(onChange.mock.calls.length).toBe(before);
- expect(lasts.value).toBe("00:");
-
- // Clamped at both ends: a clip cannot be shorter than one frame — 42 ms at
- // 24 fps — and cannot play footage the file does not have.
- fireEvent.change(lasts, { target: { value: "0" } });
- expect(lastDuration()).toBe(42);
- fireEvent.change(lasts, { target: { value: "90" } });
- expect(lastDuration()).toBe(40_000);
- expect(parseProjectConfig(current)).toBeTruthy();
-
- // Off the field, the clip's own length is what it shows again.
- fireEvent.blur(lasts);
- expect(lasts.value).toBe("00:40:00");
- });
-
/* --- Dragging clips on the timeline --------------------------------------
jsdom lays nothing out and has no PointerEvent, so both are supplied here:
diff --git a/src/components/workspace/ShotThumbnail.test.tsx b/src/components/workspace/ShotThumbnail.test.tsx
index 6e7b85f..b0cf65f 100644
--- a/src/components/workspace/ShotThumbnail.test.tsx
+++ b/src/components/workspace/ShotThumbnail.test.tsx
@@ -85,6 +85,17 @@ const rendered = (folder: string): GenerationJob => {
};
describe("a shot's picture", () => {
+ it("can draw the exact first frame for a scene card", async () => {
+ const folder = "C:\\Exact first frame";
+ const job = rendered(folder);
+ await withFakeFile({ seconds: 9 }, async (seen) => {
+ render(<ShotThumbnail folderPath={folder} job={job} seconds={0} shotNumber={1} posterOffsetSeconds={0} />);
+ const picture = await screen.findByRole("img", { name: "Shot 1 of First scene" }) as HTMLImageElement;
+ expect(seen.seeks).toEqual([]);
+ expect(picture.src).toContain("frame-0");
+ });
+ });
+
it("takes each shot's own frame out of the scene's file, opening that file once", async () => {
/* One .mp4 holds the whole scene, so a component that read the file per
card would pull the same few hundred megabytes through the webview once
diff --git a/src/components/workspace/ShotThumbnail.tsx b/src/components/workspace/ShotThumbnail.tsx
index 43abdff..4eb51f3 100644
--- a/src/components/workspace/ShotThumbnail.tsx
+++ b/src/components/workspace/ShotThumbnail.tsx
@@ -235,16 +235,18 @@ function placeholder(job: GenerationJob, failed: boolean): { icon: ReactNode; wo
}
}
-export function ShotThumbnail({ folderPath, job, seconds, shotNumber }: {
+export function ShotThumbnail({ folderPath, job, seconds, shotNumber, posterOffsetSeconds = POSTER_OFFSET_SECONDS }: {
folderPath: string;
/** The scene this shot belongs to: it owns the file and the status. */
job: GenerationJob;
/** Where the shot starts, in seconds from the head of the scene. */
seconds: number;
shotNumber: number;
+ /** Scene cards use frame zero; shot cards offset past a possible fade-in. */
+ posterOffsetSeconds?: number;
}) {
const relativePath = job.status === "completed" ? job.outputRelativePath : null;
- const at = seconds + POSTER_OFFSET_SECONDS;
+ const at = seconds + posterOffsetSeconds;
const [result, setResult] = useState<PosterResult>(() =>
relativePath ? { poster: POSTERS.get(posterKey(fileKey(folderPath, relativePath), at)) ?? null, failed: false } : NOTHING);
diff --git a/src/components/workspace/TimelineView.tsx b/src/components/workspace/TimelineView.tsx
index 8c444bb..47e0dd8 100644
--- a/src/components/workspace/TimelineView.tsx
+++ b/src/components/workspace/TimelineView.tsx
@@ -23,16 +23,16 @@ import {
import { MediaThumbnail, type MeasuredMedia } from "./MediaThumbnail";
import { ProgramMonitor } from "./ProgramMonitor";
import { sceneShape, STATUS_WORD } from "./sceneStatus";
+import { ShotThumbnail } from "./ShotThumbnail";
const MIN_DURATION = 10_000;
-const NOT_YET = "Not available yet. This control doesn’t change your project.";
/* 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 each
file to draw its thumbnail and records the duration it read there (see
MediaThumbnail), so a 40-second rush drops as 40 seconds. This default
covers the two cases where there is no such number — a still image, which
has no length of its own, and a file the browser opened but could not
- measure. In both, the Lasts field in the inspector sets the truth. */
+ measure. */
const DROPPED_CLIP_MS = 5_000;
/* The drag payload is the asset id. A custom type keeps files dragged in from
the desktop, and text dragged from anywhere else, out of the drop handler. */
@@ -115,20 +115,6 @@ const timecode = (ms: number) => {
return `00:${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}:${String(frames).padStart(2, "0")}`;
};
-/* The Lasts field read back. It prints MM:SS:FF, so that is what it takes;
- two parts are the minutes and seconds of it, and a bare number is seconds,
- because "8" and "8.5" are what people actually type into a length box.
- Null means this is not a length yet — half-typed, or not a number at all —
- and half-typed text must never be turned into a clip length. */
-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);
-};
-
/** 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
* holder applies it to its LATEST config, so a write does not depend on the
@@ -172,7 +158,6 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG
otherwise 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 means
nothing is being typed and the clip speaks for itself. */
- const [durationDraft, setDurationDraft] = useState<string | null>(null);
/* A drag in flight, and the timeline as it would be if the pointer were
released right now. The lanes draw the preview, and the release commits
exactly it — the drag and the edit are the same calculation, run twice
@@ -213,7 +198,6 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG
const setPlayingFromMonitor = useCallback((value: boolean) => setPlaying(value), []);
// 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
@@ -270,7 +254,6 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG
const updateTracks = (nextTracks: ProjectConfig["timeline"]["tracks"]) =>
onChange((current) => ({ ...current, timeline: { tracks: 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 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. */
@@ -431,10 +414,6 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG
because zod wants a positive whole number of milliseconds and a clip
shorter than a frame cannot be shown. A still has no source length, so it
is only bounded from below. */
- const selectedAsset = selected ? assetById(selected.assetId) : undefined;
- 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));
/** 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
@@ -446,14 +425,6 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG
/* 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;
- if (parsed === null || !selected) return;
- const next = trimClip(tracks, selected.id, "end", selected.startMs + parsed, { minClipMs, room: roomFor(selected) });
- if (next) updateTracks(next);
- };
-
/* Snapping, measured against a lane that is `widthPx` wide. A lane nothing
has laid out yet — jsdom, a panel that has never been painted — gives a
tolerance of 0, which turns the magnet off instead of inventing a scale. */
@@ -653,6 +624,23 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG
read. */
const drawnTracks = preview ?? tracks;
+ const removeMediaAsset = (assetId: string) => {
+ const removedClipIds = new Set(tracks.flatMap((track) => track.clips)
+ .filter((clip) => clip.assetId === assetId)
+ .map((clip) => clip.id));
+ onChange((current) => ({
+ ...current,
+ assets: current.assets.filter((asset) => asset.id !== assetId),
+ timeline: {
+ tracks: current.timeline.tracks.map((track) => ({
+ ...track,
+ clips: track.clips.filter((clip) => clip.assetId !== assetId),
+ })),
+ },
+ }));
+ setSelectedId((current) => removedClipIds.has(current) ? "" : current);
+ };
+
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.
@@ -729,7 +717,10 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG
onDragEnd={() => { setDraggedScene(undefined); setDropTrackId(null); }}
title={`${job.title} — drag onto a video track below`}
>
- <span className="scene-card__thumb"><i>{String(index + 1).padStart(2, "0")}</i><em>{sceneDurationSeconds(job).toFixed(1)}s</em></span>
+ <span className="scene-card__thumb">
+ <ShotThumbnail folderPath={folderPath} job={job} seconds={0} shotNumber={1} posterOffsetSeconds={0} />
+ <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>;
})}
@@ -740,23 +731,31 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG
{/* Draggable onto the timeline. `draggable` on a <button> is the
whole mechanism — the button still clicks and still takes
focus, so keyboard users are not shut out of selecting it. */}
- {mediaAssets.map((asset) => <button
- key={asset.id}
- draggable
- onDragStart={(event) => {
- event.dataTransfer.setData(ASSET_DRAG_TYPE, asset.id);
- event.dataTransfer.effectAllowed = "copy";
- setDraggedAsset(asset);
- setDraggedScene(undefined);
- }}
- onDragEnd={() => { setDraggedAsset(undefined); setDropTrackId(null); }}
- title={`${asset.name} — drag onto a ${asset.kind === "audio" ? "sound" : "video"} track below`}
- >
- <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>)}
+ {mediaAssets.map((asset) => <div className="media-card" key={asset.id}>
+ <button
+ className="media-card__source"
+ draggable
+ onDragStart={(event) => {
+ event.dataTransfer.setData(ASSET_DRAG_TYPE, asset.id);
+ event.dataTransfer.effectAllowed = "copy";
+ setDraggedAsset(asset);
+ setDraggedScene(undefined);
+ }}
+ onDragEnd={() => { setDraggedAsset(undefined); setDropTrackId(null); }}
+ title={`${asset.name} — drag onto a ${asset.kind === "audio" ? "sound" : "video"} track below`}
+ >
+ <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>)}
<button
className="media-import"
onClick={() => void importMedia()}
@@ -796,49 +795,6 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG
</div>
</main>
- <aside className="clip-inspector">
- <div className="panel-chrome"><h2>Clip details</h2></div>
- {selected ? <>
- <div className="inspector-summary"><span className="clip-chip" style={{ background: selected.color ?? undefined }}><Film size={18} /></span><div><b>{selected.label}</b><small>{selectedTrack?.name} · {selected.status}</small></div></div>
- <section className="inspector-section">
- <h3>Clip</h3>
- <label><span>Name</span><input value={selected.label} onChange={(event) => updateClip(selected.id, { label: event.target.value || "Untitled clip" })} /></label>
- <div className="field-pair">
- <label><span>Starts at</span><input value={timecode(selected.startMs).slice(3)} readOnly /></label>
- {/* The one field here that has to be editable: a clip is only
- as long as the cut says, and until this took typing there
- was no way at all to change a clip's length except to split
- it, which can only ever shorten. Typed as minutes, seconds,
- and frames, or as plain seconds. */}
- <label><span>Lasts</span><input
- value={durationDraft ?? timecode(selected.durationMs).slice(3)}
- 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.`}`}
- inputMode="decimal"
- /></label>
- </div>
- </section>
- <section className="inspector-section inspector-section--pending">
- <h3>Transform <em>Not available yet</em></h3>
- <div className="field-pair">
- <label><span>Scale</span><input defaultValue="100%" disabled title={NOT_YET} /></label>
- <label><span>Rotation</span><input defaultValue="0°" disabled title={NOT_YET} /></label>
- </div>
- <div className="field-pair">
- <label><span>Position X</span><input defaultValue="0" disabled title={NOT_YET} /></label>
- <label><span>Position Y</span><input defaultValue="0" disabled title={NOT_YET} /></label>
- </div>
- </section>
- <section className="inspector-section inspector-section--pending">
- <h3>Look <em>Not available yet</em></h3>
- <label className="range-field"><span>Opacity <b>100%</b></span><input type="range" defaultValue="100" disabled title={NOT_YET} /></label>
- <label className="range-field"><span>Temperature <b>+4</b></span><input type="range" defaultValue="54" disabled title={NOT_YET} /></label>
- </section>
- </> : 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>
</div>
<section className="pro-timeline">
@@ -1056,5 +1012,3 @@ function TrackRow({ track, duration, selectedId, draggingId, dropActive, dropBlo
</div>
</>;
}
-
-function MouseSelection() { return <div className="selection-glyph"><span /><i /></div>; }
diff --git a/src/styles/timeline.css b/src/styles/timeline.css
index ac41abc..427b163 100644
--- a/src/styles/timeline.css
+++ b/src/styles/timeline.css
@@ -14,19 +14,9 @@
vertically if a project carries more tracks than that. */
grid-template-rows: minmax(340px, 1fr) 372px;
- /* How far the CENTRE OF THE PICTURE sits from the centre of a full-width row,
- signed: negative is to the left. The timeline toolbar runs the whole width
- while the program monitor is the middle column of .edit-panels between two
- side panels of DIFFERENT widths, so the two centres are not the same point
- and "centred in the toolbar" is not "centred under the video".
-
- It is exactly half the difference between the side columns:
- (296 - 340) / 2 = -22px
- Anything that changes .edit-panels' columns must change this in the same
- rule, the way --track-column and the playhead offset are kept in lockstep.
- Measured in the shipped app at 1440px: monitor 296…1100 (centre 698),
- toolbar 0…1440 (centre 720). */
- --video-centre-shift: -22px;
+ /* The program monitor begins after the 296px scene panel and runs to the
+ right edge, so its centre is 148px right of the full-width toolbar's. */
+ --video-centre-shift: 148px;
}
/* The view itself is focusable (tabIndex={0}) so Space and Delete reach the
@@ -40,12 +30,11 @@
.edit-panels {
min-height: 0;
display: grid;
- grid-template-columns: 296px minmax(520px, 1fr) 340px;
+ grid-template-columns: 296px minmax(520px, 1fr);
border-bottom: 1px solid var(--line-strong);
}
-.scene-panel,
-.clip-inspector {
+.scene-panel {
min-width: 0;
overflow: hidden;
background: var(--panel);
@@ -55,11 +44,6 @@
border-right: 1px solid var(--line);
}
-.clip-inspector {
- border-left: 1px solid var(--line);
- overflow-y: auto;
-}
-
/* --- Panel tabs ------------------------------------------------------------ */
.panel-tabs {
@@ -107,8 +91,7 @@
used to sit in the panel chrome, so they inherit the exact same look. */
.scene-panel__head h2,
-.program-panel > .panel-chrome h2,
-.clip-inspector > .panel-chrome h2 {
+.program-panel > .panel-chrome h2 {
display: flex;
align-items: center;
gap: var(--space-2);
@@ -173,8 +156,6 @@
box-shadow: inset 2px 0 var(--accent-bright);
}
-/* A neutral slot, not a fake frame: PolStudio cannot render clip thumbnails
- yet, so this shows only real data (scene number and duration). */
.scene-card__thumb {
position: relative;
height: 64px;
@@ -189,6 +170,20 @@
);
}
+.scene-card__thumb .shot-thumb {
+ width: 100%;
+ height: 100%;
+ border: 0;
+ border-radius: 0;
+}
+
+.scene-card__thumb .shot-thumb img {
+ width: 100%;
+ height: 100%;
+ display: block;
+ object-fit: cover;
+}
+
.scene-card__thumb i,
.scene-card__thumb em {
position: absolute;
@@ -315,7 +310,8 @@
grid-column: 1 / -1;
}
-.media-grid button {
+.media-grid .media-card__source,
+.media-grid .media-import {
min-width: 0;
/* Floor the hit target even if a card ever renders without its labels. */
min-height: var(--control-sm);
@@ -327,12 +323,15 @@
background: var(--panel-2);
}
-.media-grid button:hover:not(:disabled) {
+.media-grid .media-card__source:hover:not(:disabled),
+.media-grid .media-import:hover:not(:disabled) {
border-color: var(--line-strong);
}
-.media-grid button b,
-.media-grid button small {
+.media-grid .media-card__source b,
+.media-grid .media-card__source small,
+.media-grid .media-import b,
+.media-grid .media-import small {
display: block;
padding: 0 var(--space-2);
overflow: hidden;
@@ -340,7 +339,8 @@
text-overflow: ellipsis;
}
-.media-grid button b {
+.media-grid .media-card__source b,
+.media-grid .media-import b {
margin-top: var(--space-2);
color: var(--text-primary);
font-size: var(--text-sm);
@@ -348,7 +348,8 @@
line-height: var(--leading-snug);
}
-.media-grid button small {
+.media-grid .media-card__source small,
+.media-grid .media-import small {
margin-top: var(--space-1);
color: var(--text-muted);
font-size: var(--text-xs);
@@ -383,7 +384,39 @@
object-fit: cover;
}
-.media-grid button[draggable="true"] {
+.media-card {
+ position: relative;
+ min-width: 0;
+}
+
+.media-card__source {
+ width: 100%;
+ 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;
}
@@ -395,7 +428,7 @@
grid-template-columns: minmax(0, 1fr);
}
-.media-grid--list button {
+.media-grid--list .media-card__source {
display: grid;
grid-template-columns: 72px minmax(0, 1fr);
grid-template-rows: auto auto;
@@ -412,18 +445,18 @@
border-bottom: 0;
}
-.media-grid--list button b {
+.media-grid--list .media-card__source b {
align-self: end;
margin-top: 0;
padding-left: 0;
}
-.media-grid--list button small {
+.media-grid--list .media-card__source small {
align-self: start;
padding-left: 0;
}
-.media-grid button[draggable="true"]:active {
+.media-grid .media-card__source[draggable="true"]:active {
cursor: grabbing;
}
@@ -613,203 +646,6 @@
line-height: var(--leading-normal);
}
-/* --- Clip inspector -------------------------------------------------------- */
-
-.inspector-summary {
- display: flex;
- gap: var(--space-3);
- align-items: center;
- padding: var(--space-3) var(--space-4);
- border-bottom: 1px solid var(--line);
-}
-
-.clip-chip {
- width: var(--control-md);
- height: var(--control-md);
- flex: 0 0 auto;
- display: grid;
- place-items: center;
- border-radius: var(--radius-sm);
- color: var(--text-primary);
- box-shadow: inset 0 0 0 1px var(--line-strong);
-}
-
-.inspector-summary > div {
- min-width: 0;
-}
-
-.inspector-summary b,
-.inspector-summary small {
- display: block;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-}
-
-.inspector-summary b {
- color: var(--text-primary);
- font-size: var(--text-base);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
-}
-
-.inspector-summary small {
- margin-top: var(--space-1);
- color: var(--text-muted);
- font-size: var(--text-sm);
- line-height: var(--leading-snug);
- text-transform: capitalize;
-}
-
-.inspector-section {
- padding: var(--space-4);
- border-bottom: 1px solid var(--line);
-}
-
-.inspector-section h3 {
- display: flex;
- align-items: center;
- gap: var(--space-2);
- margin: 0;
- color: var(--text-primary);
- font-size: var(--text-md);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
-}
-
-/* Honest badge: the fields below exist to show intent, but nothing is wired. */
-.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);
-}
-
-.inspector-section label {
- display: block;
- margin-top: var(--space-3);
-}
-
-.inspector-section label > span {
- display: block;
- margin-bottom: var(--space-1);
- color: var(--text-secondary);
- font-size: var(--text-sm);
- line-height: var(--leading-snug);
-}
-
-.inspector-section input:not([type="range"]) {
- width: 100%;
- height: var(--field-height);
- padding: 0 var(--space-3);
- border: 1px solid var(--line);
- border-radius: var(--radius-sm);
- /* No outline reset here: the Name field is the only editable control in the
- inspector, and base.css's :focus-visible ring is its sole focus signal. */
- color: var(--text-primary);
- background: var(--bg);
- font-family: var(--font-sans);
- font-size: var(--text-base);
-}
-
-.inspector-section input:focus {
- border-color: var(--accent);
-}
-
-.inspector-section input[readonly] {
- color: var(--text-muted);
-}
-
-.inspector-section--pending {
- opacity: 0.72;
-}
-
-.inspector-section input:disabled {
- color: var(--text-faint);
- cursor: not-allowed;
-}
-
-.field-pair {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: var(--space-2);
-}
-
-.range-field > span {
- display: flex !important;
- justify-content: space-between;
-}
-
-.range-field b {
- color: var(--text-primary);
- font-weight: var(--weight-medium);
-}
-
-/* Sliders get a full 36px grab area rather than the old 2px hairline. */
-.range-field input {
- width: 100%;
- height: var(--control-sm);
- accent-color: var(--accent-bright);
-}
-
-.range-field input:disabled {
- cursor: not-allowed;
-}
-
-.inspector-empty {
- min-height: 280px;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: var(--space-5);
- text-align: center;
- color: var(--text-muted);
-}
-
-.inspector-empty b {
- margin: var(--space-3) 0 var(--space-2);
- color: var(--text-primary);
- font-size: var(--text-md);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
-}
-
-.inspector-empty > span {
- max-width: 34ch;
- font-size: var(--text-base);
- line-height: var(--leading-normal);
-}
-
-.selection-glyph {
- position: relative;
- width: var(--control-md);
- height: var(--control-md);
- border: 1px solid var(--line-strong);
- border-radius: var(--radius-md);
-}
-
-.selection-glyph span {
- position: absolute;
- inset: var(--space-2);
- border: 1px dashed var(--accent-bright);
-}
-
-.selection-glyph i {
- position: absolute;
- width: 5px;
- height: 5px;
- right: var(--space-1);
- bottom: var(--space-1);
- border-radius: 1px;
- background: var(--accent-bright);
-}
-
/* --- Timeline toolbar ------------------------------------------------------ */
.pro-timeline {
@@ -1409,22 +1245,20 @@
/* 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.
+ below narrows or removes the scene panel; 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
+ 1180px narrower scene panel, monitor floor removed
+ 1040px scene panel narrows again
+ 840px one column — the scene panel goes (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;
+ grid-template-columns: 256px minmax(0, 1fr);
}
- /* (256 - 300) / 2 — the columns shrank by the same 40px on both sides, so
- the picture's centre has not moved relative to the row. */
.timeline-view {
- --video-centre-shift: -22px;
+ --video-centre-shift: 128px;
}
.scene-card {
@@ -1443,23 +1277,8 @@
grid-template-columns: 232px minmax(0, 1fr);
}
- /* Everything here is either read-only or already disabled, and the clip name
- stays editable from the timeline clip itself, so this is the safe cut. */
- .clip-inspector {
- display: none;
- }
-
- /* With the inspector gone the picture runs to the right edge, so its centre
- is (232 - 0) / 2 = 116px RIGHT of the row's centre — and that is the one
- width where the toolbar cannot pay for it. Measured at 1040, 1000 and 900:
- the two 1fr rails have already collapsed onto the heading and the four tool
- buttons with only the 16px gaps left over, so the row has ZERO slack.
- Reserving 232px of empty middle there would push the tool buttons off the
- end. The transport takes the row's own centre instead, 116px from the
- picture; below 840px there is one column left and the two centres agree
- again on their own. */
.timeline-view {
- --video-centre-shift: 0px;
+ --video-centre-shift: 116px;
}
.timeline-grid {
@@ -1476,6 +1295,10 @@
display: none;
}
+ .timeline-view {
+ --video-centre-shift: 0px;
+ }
+
.timeline-grid {
--track-column: 168px;
}