AI media harness for planning, generating, and editing locally
TypeScript
One selection rule for the app, and a lane grid that matches the ruler
Bittib2fb2d4b24ae
diff --git a/src/components/workspace/ProgramMonitor.test.tsx b/src/components/workspace/ProgramMonitor.test.tsxindex 03b0b72..e3d3c53 100644--- a/src/components/workspace/ProgramMonitor.test.tsx+++ b/src/components/workspace/ProgramMonitor.test.tsx@@ -48,10 +48,14 @@ const monitor = (config: ProjectConfig, playheadMs: number) => render();describe("the program monitor", () => {- it("says a gap is a gap rather than showing the last shot it played", () => {- monitor(project([clip()]), 9_000);- expect(screen.getByText("Nothing under the playhead here.")).toBeTruthy();+ it("shows a gap as the empty frame it will be exported as, and says nothing about it", () => {+ const { container } = monitor(project([clip()]), 9_000);+ // No element for a clip that is not there, and no panel over the picture+ // either: the background colour IS the answer, and it is the same colour+ // the encoder writes for those frames.expect(document.querySelector("video")).toBeNull();+ expect(container.querySelector(".program-note")).toBeNull();+ expect((container.querySelector(".program-picture") as HTMLElement).style.backgroundColor).toBeTruthy();});it("is honest that the browser preview cannot read the project's footage", () => {diff --git a/src/components/workspace/ProgramMonitor.tsx b/src/components/workspace/ProgramMonitor.tsxindex 7ff8bbd..e52c870 100644--- a/src/components/workspace/ProgramMonitor.tsx+++ b/src/components/workspace/ProgramMonitor.tsx@@ -287,11 +287,12 @@ export function ProgramMonitor({ config, folderPath, playheadMs, playing, onSeekconst hasClips = tracks.some((track) => track.clips.length > 0);- /* What the monitor can say, in the order the user needs it: nothing cut yet,- nothing under the playhead, no way to read the file, or the picture. */+ /* What the monitor can say, in the order the user needs it: no way to read+ the file, or the file still being read. A GAP says nothing at all — the+ empty frame in the project's own background colour is exactly what the+ export writes there, and a panel over it only hid the answer. */let overlay: React.ReactNode = null;- if (!hasClips) overlay = null;- else if (!clip) overlay = <div className="program-note"><Film size={22} /><span>Nothing under the playhead here.</span></div>;+ if (!hasClips || !clip) overlay = null;else if (!isTauri()) {overlay = <div className="program-note"><Film size={22} /><span>Playback needs the desktop app — the browser preview has no project folder to read the footage from.</span></div>;} else if (error) {diff --git a/src/components/workspace/TimelineView.tsx b/src/components/workspace/TimelineView.tsxindex 35b19aa..8b08b02 100644--- a/src/components/workspace/TimelineView.tsx+++ b/src/components/workspace/TimelineView.tsx@@ -185,6 +185,11 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenGconst sceneClips = tracks.filter((track) => track.kind === "video").flatMap((track) => track.clips);const duration = useMemo(() => canvasDuration(config), [config]);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;useEffect(() => { if (clipCount === 0 && playing) setPlaying(false); }, [clipCount, playing]);@@ -592,7 +597,7 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG};return (- <div className={`timeline-view ${dragging ? "timeline-view--dragging" : ""} ${scrubbing ? "timeline-view--scrubbing" : ""}`} tabIndex={0} onKeyDown={(event) => {+ <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 ISthe thing being deleted, and having to leave it first to press the keyis the kind of rule only the code knows. It deliberately does NOT fire@@ -784,7 +789,11 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG<button onClick={removeSelected} disabled={deleteBlockedBy !== null} title={deleteBlockedBy ?? "Delete selected clip"}><Trash2 size={16} /> Delete</button></div></header>- <div className="timeline-grid" ref={timelineGrid} 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="timeline-grid"+ ref={timelineGrid}+ style={{ "--lane-grid": `${(tickStepMs / duration) * 100}%` } 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 whereverthis lands, so dragging along the ruler runs the picture past underdiff --git a/src/lib/theme.test.ts b/src/lib/theme.test.tsindex 5907bd0..ad0af3a 100644--- a/src/lib/theme.test.ts+++ b/src/lib/theme.test.ts@@ -234,6 +234,9 @@ describe("every stylesheet resolves through the palette", () => {into a list of tokens nothing sets any more. */const setByComponents: Record<string, string> = {"--clip-color": "src/components/workspace/TimelineView.tsx",+ // The lane grid's interval, computed from the ruler's own tick step so the+ // lines under the clips fall where the timecodes above them are.+ "--lane-grid": "src/components/workspace/TimelineView.tsx",};for (const [token, source] of Object.entries(setByComponents)) {diff --git a/src/styles/base.css b/src/styles/base.cssindex a146cd1..1585fcc 100644--- a/src/styles/base.css+++ b/src/styles/base.css@@ -30,6 +30,21 @@ body,body {min-height: 100vh;overflow-x: hidden;+ /* Nothing in an editor is selected by dragging across it. Every surface here+ is a control — clips are dragged, panels are scrolled, the ruler is+ scrubbed — and a gesture that misses one used to leave a blue smear across+ whatever it crossed. Selection belongs to the places text is TYPED, which+ the rule below gives it back to. */+ user-select: none;+}++/* Where text is written, it is text: selecting, double-clicking a word and+ dragging through a value all keep working. */+input,+textarea,+select,+[contenteditable="true"] {+ user-select: text;}/* --- Prose defaults -------------------------------------------------------- */diff --git a/src/styles/timeline.css b/src/styles/timeline.cssindex 70f3206..ac41abc 100644--- a/src/styles/timeline.css+++ b/src/styles/timeline.css@@ -817,20 +817,6 @@display: grid;grid-template-rows: var(--control-lg) minmax(0, 1fr);background: var(--panel);- /* None of this is text anyone reads by selecting it: the heading, the- timecode, the format, the ruler's numbers and the clips' own labels are- chrome. Every gesture down here is a drag — scrubbing the ruler, moving a- clip, trimming one — and a drag over selectable chrome paints it blue.- Turned off permanently rather than for the duration of a drag, because the- browser starts a selection on the press, before a class applied by a- re-render can reach the DOM. */- user-select: none;-}--/* Except what really is text being edited: a track's name is typed into, and- typing means selecting. */-.pro-timeline input {- user-select: text;}/* Three tracks, and the two outer ones are the SAME width whatever they hold —@@ -1169,7 +1155,10 @@border-bottom: 1px solid var(--line);background-color: var(--bg);background-image: linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);- background-size: 14.7% 100%;+ /* 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. */+ background-size: var(--lane-grid, 14.7%) 100%;}.track-lane.muted {@@ -1346,16 +1335,8 @@display: none;}-/* A drag that leaves the timeline is still a drag: the pointer crosses the- monitor and the inspector on its way, and those DO hold readable text, so- they are frozen for the length of the gesture rather than for good. Scrubbing- the ruler counts — the pointer can wander anywhere while the playhead is- being pulled along. */-.timeline-view--dragging,-.timeline-view--scrubbing {- user-select: none;-}-+/* Selection is off everywhere outside a text field (see base.css), so a drag+ only has to say what it IS. */.timeline-view--dragging {cursor: grabbing;}