Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
feat(studio): give timeline clips a Filmstrip name band (#4897)
Miguel Ángel0b1f5979fd14
diff --git a/docs/contracts/2026-10-01-timeline-filmstrip.html b/docs/contracts/2026-10-01-timeline-filmstrip.htmlnew file mode 100644index 0000000000..1040bbd7b2--- /dev/null+++ b/docs/contracts/2026-10-01-timeline-filmstrip.html@@ -0,0 +1,98 @@+<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Filmstrip contract</title><style>+:root{color-scheme:light dark;+ --bg:#fbfbfa;--card:#ffffff;--line:#e6e4df;--ink:#1c1c1a;--dim:#6b6b66;--faint:#9a9a94;+ --go:#178a5a;--go-bg:#e8f6ee;--warn:#a6690a;--warn-bg:#fbf1dc;--bad:#c0392b;--bad-bg:#fbe7e4;--info:#2a5db0;--info-bg:#e8eefb;+ --mono:ui-monospace,SFMono-Regular,Menlo,monospace;--sans:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,sans-serif}+@media (prefers-color-scheme:dark){:root{--bg:#111213;--card:#191b1d;--line:#2a2d31;--ink:#ecebe8;--dim:#a2a29c;--faint:#6f6f6a;+ --go:#5fd39a;--go-bg:#12291f;--warn:#e6b35a;--warn-bg:#2b2311;--bad:#ff7b6b;--bad-bg:#2d1714;--info:#7fa9ff;--info-bg:#15203a}}+*{box-sizing:border-box}+body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.55 var(--sans)}+.wrap{max-width:900px;margin:0 auto;padding:56px 24px 96px}+header h1{font-size:30px;line-height:1.15;letter-spacing:-.4px;margin:0 0 10px}+header .what{font-size:18px;color:var(--dim);margin:0 0 18px;max-width:70ch}+.strip{display:flex;gap:10px;flex-wrap:wrap;align-items:center;font:13px var(--mono);color:var(--faint)}+.strip .sep{opacity:.5}+.pill{display:inline-flex;align-items:center;gap:6px;font:600 12px/1 var(--mono);padding:6px 10px;border-radius:999px;white-space:nowrap}+.pill.go{color:var(--go);background:var(--go-bg)}.pill.warn{color:var(--warn);background:var(--warn-bg)}+.pill.bad{color:var(--bad);background:var(--bad-bg)}.pill.info{color:var(--info);background:var(--info-bg)}+.pill b{font-size:13px}+section{margin-top:56px}+h2{font-size:22px;letter-spacing:-.3px;margin:0 0 6px}+.sub{color:var(--dim);margin:0 0 18px;font-size:15px}+.card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:20px 22px;margin:14px 0}+.breath{border-left:4px solid var(--go);font-size:18px;line-height:1.5}+.breath b{color:var(--go)}+.plain{color:var(--dim);font-size:15px;margin:0 0 10px}+.plain::before{content:"In plain words ";font:600 11px var(--mono);letter-spacing:1px;color:var(--faint);text-transform:uppercase}+pre{background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:14px 16px;overflow:auto;font:13px/1.55 var(--mono);margin:10px 0}+code{font:13px var(--mono);background:var(--bg);border:1px solid var(--line);border-radius:5px;padding:1px 6px}+.cite{font:12px var(--mono);color:var(--faint);margin-top:8px;display:block}+.states{display:flex;gap:8px;margin:12px 0 4px;flex-wrap:wrap}+table{width:100%;border-collapse:collapse;margin:10px 0;font-size:14.5px}+th{text-align:left;font:600 11px/1.4 var(--mono);text-transform:uppercase;letter-spacing:.7px;color:var(--faint);border-bottom:1px solid var(--line);padding:8px 10px}+td{padding:10px;border-bottom:1px solid var(--line);vertical-align:top}+tr:last-child td{border-bottom:0}+td.k{font:13px var(--mono);white-space:nowrap}+.decision{border-left:4px solid var(--info)}+.decision h3{margin:0 0 8px;font-size:17px}+.decision .ask{color:var(--info);font-weight:600}+blockquote{margin:12px 0;padding:8px 0 8px 16px;border-left:2px solid var(--line);color:var(--dim);font-style:italic;font-size:14.5px}+blockquote .src{display:block;font-style:normal;font:12px var(--mono);color:var(--faint);margin-top:6px}+ul,ol{padding-left:22px}li{margin:6px 0}+.mermaid{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:18px;margin:14px 0;overflow:auto}+.mermaid svg{max-width:100%}+footer{margin-top:72px;padding-top:16px;border-top:1px solid var(--line);font:12px/1.7 var(--mono);color:var(--faint)}+</style></head><body><div class="wrap"><header><h1>Filmstrip timeline clips</h1><p class="what">Frames edge to edge, cropped to fill, with the name in its own 15px band above the picture.</p><div class="strip"><span class="pill go">audited <b>4 boundaries</b></span><span class="pill warn">trusting <b>0</b></span><span class="pill bad">not exercised <b>4</b></span><span class="pill info">decisions <b>0</b></span><span>Studio @ 45b8e171e2792c89cc63b4d136de41eae6194b25</span></div></header>+<section><div class="card breath"><b>In one breath.</b> Studio owns the name and picture wrapper; thumbnail components own cropping; a host can replace the content and override the CSS tokens.</div></section>+<section><h2>Where the value travels</h2><div class="mermaid">flowchart LR+A[App or host] --> B[TimelinePane] --> C[TimelineClip]+C --> D[renderClipChildren]+D --> E[useRenderClipContent]+E --> F[Thumbnail components]+G[Host CSS overrides] --> C+classDef audited fill:#e8f6ee,stroke:#178a5a,color:#0f3d28+class A,B,C,D,E,F,G audited+</div><p class="sub">Source reachability is audited. No running build has been exercised.</p></section>+<section><h2>The contract, per boundary</h2><div class="card"><h3>1. Clip-content callback</h3><p class="plain">The same callback builds picture content for Studio and embedding hosts.</p><pre>renderClipContent(element, clipStyle, context)++if (!pid) return null;++return createElement(CompositionThumbnail, {+ previewUrl: buildProjectApiPath(pid, `/preview/comp/${encodePreviewPath(compSrc)}`),+ label: "",+ labelColor: style.label,</pre><span class="cite">producer: src/hooks/useRenderClipContent.ts:136,166; accepting call: src/player/components/timelineClipChildren.tsx:67; app handoff: src/App.tsx:530; pane: src/components/nle/TimelinePane.tsx:107; package export: src/index.ts:67</span><div class="states"><span class="pill go">exists: yes</span><span class="pill go">reachable: source audited</span><span class="pill go">written/read: yes</span><span class="pill bad">runtime: not exercised</span></div></div><div class="card"><h3>2. Picture wrapper and name</h3><p class="plain">The clip button supplies the name separately. The content wrapper currently fills the whole button.</p><pre>const showLabel = ladder === "labeled";+{showLabel && <span className="timeline-clip__label">{displayLabel}</span>}++<div+ className="absolute inset-0 overflow-hidden"+ style={{ borderRadius: "inherit", pointerEvents: "none" }}+></pre><span class="cite">name producer and consumer: src/player/components/TimelineClip.tsx:74,212; content consumer: src/player/components/timelineClipChildren.tsx:63; name paint: src/styles/components.css:334</span><div class="states"><span class="pill go">exists: yes</span><span class="pill go">reachable: source audited</span><span class="pill go">written/read: yes</span><span class="pill bad">runtime: not exercised</span></div></div><div class="card"><h3>3. Frame layout and fit</h3><p class="plain">Video and image tiles already fill their rectangles. Composition tiles contain the picture, which leaves letterboxing.</p><pre>const frameW = Math.max(minFrameWidth, Math.round(clipHeight * safeAspect));+const frameCount = measured ? Math.max(1, Math.ceil(containerWidth / frameW)) : 1;++// CompositionThumbnail rendered image class:+className="absolute inset-0 h-full w-full object-contain"</pre><span class="cite">layout producer: src/player/components/thumbnailUtils.ts:75; consumer: CompositionThumbnail.tsx:161; image consumer: CompositionThumbnail.tsx:185; video and image fit: VideoThumbnail.tsx:138, ImageThumbnail.tsx:61</span><div class="states"><span class="pill go">exists: yes</span><span class="pill go">reachable: source audited</span><span class="pill go">written/read: yes</span><span class="pill bad">runtime: not exercised</span></div></div><div class="card"><h3>4. Theme and host overrides</h3><p class="plain">Changing the Studio defaults alone does not change an embedding host that writes its own token values or selection styles.</p><pre>--timeline-clip-radius: 8px;+--timeline-clip-audio-radius: 21px;++clipRadius: "var(--timeline-clip-radius)",++.timeline-clip.is-selected {+ outline: 1.5px solid var(--timeline-clip-selection);+ outline-offset: -1.5px;+}</pre><span class="cite">token producer: src/styles/theme.css:122; token consumer: src/player/components/timelineTheme.ts:73, TimelineClip.tsx:109; selection consumer: src/styles/components.css:307; package exports: package.json:39-43. Host override audit is local only; runtime propagation has not been tested.</span><div class="states"><span class="pill go">exists: yes</span><span class="pill go">reachable: source audited</span><span class="pill go">written/read: yes</span><span class="pill bad">runtime: not exercised</span></div></div></section>+<section><h2>How it says no</h2><table><thead><tr><th>Signal</th><th>Owner</th><th>Meaning</th></tr></thead><tbody><tr><td>null</td><td>useRenderClipContent:142</td><td>No active project. No picture returned.</td></tr><tr><td>Hidden thumbnail mode</td><td>useRenderClipContent:148</td><td>Pictures are suppressed; sound content follows the existing waveform path.</td></tr><tr><td>Loading or error snapshot</td><td>Thumbnail component</td><td>A picture is not ready. The band must keep its geometry while the existing loading/error state paints below.</td></tr><tr><td>Under 60px</td><td>clipWidthLadder</td><td>The baseline hides the label. The approved Filmstrip keeps the name band for visual clips; audio retains the width ladder. The full name remains on the button's accessible label and title.</td></tr></tbody></table></section>+<section><h2>Approved specification</h2><div class="card"><p>Match the selected Filmstrip prototype: a dark 15px name band, no picture dimming, zero frame gap, a 1px selection ring, and 12px corners on video and image clips. Audio keeps its current radius. Composition pictures keep contain fitting.</p><p>The band-colour ambiguity is resolved. No open product decision remains.</p></div></section><section><h2>Coverage, honestly</h2><table><tr><th>Audited</th><td>The callback producer, both app and host handoffs, picture wrapper, thumbnail layout, CSS paint, package exports, and host overrides.</td></tr><tr><th>Trusting</th><td>None of the load-bearing claims above rely on comments or mocks.</td></tr><tr><th>Not exercised</th><td>Studio and host rendered builds, browser layout, selection/trim/fade hit targets, light and dark contrast, narrow clips.</td></tr></table></section>+<section><h2>What would prove this page wrong</h2><ul><li>A running fixture whose name overlaps its picture after reserving the band at the clip wrapper.</li><li>A host build still painting 8px corners or its existing 2px plus 3px selection ring after the Studio release. This would expose a missed override.</li><li>A composition picture cropped to fill instead of retaining contain fitting.</li></ul></section>+<footer>Source audit, 2026-10-01. Runtime verification remains outstanding. This page records the pre-implementation boundary audit and the resolved specification.</footer></div><script type="module">+try {+ const m = await import("https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs");+ const dark = matchMedia("(prefers-color-scheme: dark)").matches;+ m.default.initialize({ startOnLoad: false, theme: dark ? "dark" : "neutral", securityLevel: "loose",+ themeVariables: { fontFamily: "ui-monospace, Menlo, monospace", fontSize: "13px" } });+ await m.default.run({ querySelector: ".mermaid" });+} catch (e) {+ for (const el of document.querySelectorAll(".mermaid")) {+ const pre = document.createElement("pre"); pre.textContent = el.textContent.trim(); el.replaceWith(pre);+ }+}+</script>+</body></html>diff --git a/packages/studio/package.json b/packages/studio/package.jsonindex 6570605f44..99d5f3f270 100644--- a/packages/studio/package.json+++ b/packages/studio/package.json@@ -76,6 +76,7 @@"typecheck": "tsc --noEmit","test": "vitest run","test:edit-accuracy": "bun tests/e2e/edit-accuracy/run.mjs",+ "test:filmstrip-controls": "node tests/e2e/filmstrip-controls.mjs","test:webmcp-edit-loop": "node tests/e2e/webmcp-edit-loop.mjs","test:timeline-virtualization": "TIMELINE_ROW_VIRTUALIZATION=on TIMELINE_ELEMENT_COUNT=50000 node tests/e2e/timeline-virtualization.mjs","test:watch": "vitest",diff --git a/packages/studio/src/player/components/ClipBadges.tsx b/packages/studio/src/player/components/ClipBadges.tsxindex 3e3c514b9a..e8192668ae 100644--- a/packages/studio/src/player/components/ClipBadges.tsx+++ b/packages/studio/src/player/components/ClipBadges.tsx@@ -44,21 +44,21 @@ export const ClipBadges = memo(function ClipBadges({};return (<span- className="pointer-events-none absolute right-1.5 top-0.5 z-[3] flex gap-1"+ className="pointer-events-none absolute right-1.5 top-0.5 z-[31] flex max-w-[calc(100%-12px)] gap-1 overflow-hidden"data-testid="clip-badges">{volume && (<span- className={`${BADGE_CLASS} border-white/20 text-white/90`}+ className={`${BADGE_CLASS} min-w-0 overflow-hidden border-white/20 text-white/90`}title={volume}data-badge="volume"><SpeakerGlyph muted={volume === "Muted"} />- {volume === "Muted" ? null : <span>{volume}</span>}+ {volume === "Muted" ? null : <span className="truncate">{volume}</span>}</span>)}<span- className={`${BADGE_CLASS} pointer-events-auto cursor-pointer ${hasEffects ? FX_ON : FX_OFF}`}+ className={`${BADGE_CLASS} pointer-events-auto shrink-0 cursor-pointer ${hasEffects ? FX_ON : FX_OFF}`}title={hasEffects ? effects.join(" · ") : "No effects"}data-badge="fx"data-fx-active={hasEffects ? "true" : "false"}diff --git a/packages/studio/src/player/components/TimelineClip.filmstrip.test.tsx b/packages/studio/src/player/components/TimelineClip.filmstrip.test.tsxnew file mode 100644index 0000000000..f8004be882--- /dev/null+++ b/packages/studio/src/player/components/TimelineClip.filmstrip.test.tsx@@ -0,0 +1,156 @@+// @vitest-environment happy-dom++import React, { act } from "react";+import { compile } from "tailwindcss";+import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";+import { loadStylesheet, STYLES_DIR } from "../../styles/styleSources";+import { cleanupMounted, trackedRoot } from "../../components/ui/mountHost.testHelpers";+import { TimelineClip } from "./TimelineClip";+import { renderClipChildren } from "./timelineClipChildren";+import { usePlayerStore, type TimelineElement } from "../store/playerStore";++let css: string;++beforeAll(async () => {+ css = (+ await compile('@import "tailwindcss";\n@import "./theme.css";\n@import "./components.css";', {+ base: STYLES_DIR,+ loadStylesheet: async (id, base) => loadStylesheet(id, base),+ })+ ).build(["absolute", "inset-0", "overflow-hidden"]);+});++afterEach(() => {+ cleanupMounted();+ usePlayerStore.getState().setLintFindingsByElement(new Map());+ document.body.innerHTML = "";+});++function render(tag: string, overrides: Partial<TimelineElement> = {}, picture = true) {+ const host = document.createElement("div");+ document.body.append(host);+ const root = trackedRoot(host);+ const element: TimelineElement = {+ id: "clip",+ label: "City",+ tag,+ start: 0,+ duration: 1,+ track: 0,+ ...overrides,+ };+ const renderContent = picture ? () => <img alt="" /> : undefined;+ act(() => {+ root.render(+ <TimelineClip+ el={element}+ pps={200}+ clipY={0}+ clipHeight={42}+ isSelected+ isHovered={false}+ hasCustomContent={picture}+ capabilities={{ canMove: true, canTrimStart: true, canTrimEnd: true }}+ isComposition={false}+ onHoverStart={vi.fn()}+ onHoverEnd={vi.fn()}+ onClick={vi.fn()}+ onDoubleClick={vi.fn()}+ >+ {renderClipChildren(+ element,+ { clip: "#222", label: "#fff", accent: "#fff" },+ renderContent,+ undefined,+ )}+ </TimelineClip>,+ );+ });+ return host;+}++describe("Filmstrip clips", () => {+ it.each(["video", "img"])("reserves a 15px name band above %s pictures", (tag) => {+ const host = render(tag);+ const name = host.querySelector(".timeline-clip__name");+ const picture = host.querySelector(".timeline-clip__content");+ expect(name?.textContent).toBe("City");+ expect(picture).not.toBeNull();+ expect(picture?.querySelector("img")).not.toBeNull();+ expect(css).toMatch(/--timeline-clip-band-height:\s*15px;/);+ expect(css).toMatch(+ /\.timeline-clip:not\(\.is-audio\) \.timeline-clip__label\s*\{[^}]*height:\s*var\(--timeline-clip-band-height\)/,+ );+ expect(css).toMatch(+ /\.timeline-clip:not\(\.is-audio\) \.timeline-clip__content\s*\{[^}]*top:\s*var\(--timeline-clip-band-height\);[^}]*border-top-left-radius:\s*0;/,+ );+ });++ it("keeps applied-state badges above the opaque name band", () => {+ const host = render("video", { hasAudio: true, volume: 1.8 });+ expect(host.querySelector('[data-badge="volume"]')?.textContent).toBe("180%");+ const badges = host.querySelector('[data-testid="clip-badges"]');+ expect(badges?.classList.contains("z-[31]")).toBe(true);+ expect(badges?.classList.contains("max-w-[calc(100%-12px)]")).toBe(true);+ expect(badges?.classList.contains("overflow-hidden")).toBe(true);+ expect(badges?.parentElement?.classList.contains("timeline-clip__label")).toBe(true);+ expect(css).toMatch(+ /\.timeline-clip:not\(\.is-audio\) \.timeline-clip__name\s*\{[^}]*flex:\s*1;[^}]*min-width:\s*0;[^}]*overflow:\s*hidden;/,+ );+ expect(css).toMatch(+ /\.timeline-clip:not\(\.is-audio\) \.timeline-clip__label\s*\{[^}]*z-index:\s*auto;/,+ );+ });++ it("keeps fallback lint warnings clear of the name band and menu badge", () => {+ usePlayerStore+ .getState()+ .setLintFindingsByElement(new Map([["clip", { count: 1, messages: ["Lint warning"] }]]));+ const host = render("div", { duration: 0.3 }, false);+ const name = host.querySelector(".timeline-clip__name");+ const warning = host.querySelector<HTMLElement>('[title="Lint warning"]');+ expect(warning).not.toBeNull();+ expect(warning?.style.bottom).toBe("7px");+ expect(warning?.style.top).toBe("");+ expect(css).toMatch(/\.timeline-clip__timecode\s*\{[^}]*right:\s*16px;/);+ expect(+ (name?.compareDocumentPosition(warning!) ?? 0) & Node.DOCUMENT_POSITION_FOLLOWING,+ ).toBeTruthy();+ expect(css).toMatch(+ /\.timeline-clip:not\(\.is-audio\) \.timeline-clip__label\s*\{[^}]*z-index:\s*auto;/,+ );+ });++ it.each([0.02, 0.295])(+ "keeps the name band without badge targets on a narrow visual clip (%ss)",+ (duration) => {+ const host = render("video", { duration, hasAudio: true, volume: 1.8 });+ expect(host.querySelector(".timeline-clip__name")?.textContent).toBe("City");+ expect(host.querySelector('[data-testid="clip-badges"]')).toBeNull();+ expect(css).toMatch(/padding:\s*0 min\(6px,\s*25%\);/);+ expect(css).toMatch(/padding-left:\s*min\(8px,\s*25%\);/);+ },+ );++ it("lets audio keep its full-height content and pill radius", () => {+ const host = render("audio");+ const clip = host.querySelector(".timeline-clip");+ const picture = host.querySelector(".timeline-clip__content");+ expect(clip?.classList.contains("is-audio")).toBe(true);+ expect(picture?.classList.contains("inset-0")).toBe(true);+ expect(css).toMatch(/--timeline-clip-audio-radius:\s*21px;/);+ expect(clip instanceof HTMLElement && clip.style.borderRadius).toBe(+ "var(--timeline-clip-audio-radius)",+ );+ });++ it("exports a single 1px selection ring around a 12px visual clip", () => {+ const clip = render("video").querySelector(".timeline-clip");+ expect(clip?.classList.contains("is-selected")).toBe(true);+ expect(css).toMatch(/--timeline-clip-radius:\s*12px;/);+ expect(css).toMatch(+ /\.timeline-clip\.is-selected,\s*\.timeline-clip\[data-active\]\.is-selected\s*\{[^}]*outline:\s*1px solid var\(--timeline-clip-selection\);[^}]*outline-offset:\s*0;/,+ );+ expect(css).toMatch(/\.timeline-clip:not\(\.is-audio\)\s*\{\s*border-width:\s*0;/);+ });+});diff --git a/packages/studio/src/player/components/TimelineClip.test.tsx b/packages/studio/src/player/components/TimelineClip.test.tsxindex 8a9ebe7f8c..35ebc22b0e 100644--- a/packages/studio/src/player/components/TimelineClip.test.tsx+++ b/packages/studio/src/player/components/TimelineClip.test.tsx@@ -127,7 +127,7 @@ describe("TimelineClip", () => {element: { id: "hero", label: "Hero", tag: "div", start: 1, duration: 1, track: 0 },});- expect(host.querySelector(".timeline-clip__label")?.textContent).toBe("Hero");+ expect(host.querySelector(".timeline-clip__name")?.textContent).toBe("Hero");expect(host.querySelector(".timeline-clip__timecode")).toBeNull();act(() => root.unmount());@@ -145,7 +145,7 @@ describe("TimelineClip", () => {playbackRate: 1.5,},});- expect(fast.host.querySelector(".timeline-clip__label")?.textContent).toBe("Hero [150%]");+ expect(fast.host.querySelector(".timeline-clip__name")?.textContent).toBe("Hero [150%]");act(() => fast.root.unmount());const automation = JSON.stringify({version: 1,@@ -170,18 +170,18 @@ describe("TimelineClip", () => {automation,},});- expect(ramp.host.querySelector(".timeline-clip__label")?.textContent).toBe("Hero [ramp]");+ expect(ramp.host.querySelector(".timeline-clip__name")?.textContent).toBe("Hero [ramp]");act(() => ramp.root.unmount());});- it("drops the label chip under 60px even when the clip is selected", () => {+ it("keeps the name band under 60px even when the clip is selected", () => {const { host, root } = renderClip({element: { id: "fx", label: "FX", tag: "div", start: 0, duration: 1, track: 0 },pps: 59,isSelected: true,});- expect(host.querySelector(".timeline-clip__label")).toBeNull();+ expect(host.querySelector(".timeline-clip__name")?.textContent).toBe("FX");expect(host.querySelector(".timeline-clip__timecode")).toBeNull();expect(host.querySelector(".timeline-clip")?.getAttribute("data-ladder")).toBe("picture");@@ -193,7 +193,7 @@ describe("TimelineClip", () => {element: { id: "wide", label: "City", tag: "video", start: 0, duration: 1, track: 0 },pps: 200,});- expect(labeled.host.querySelector(".timeline-clip__label")?.textContent).toBe("City");+ expect(labeled.host.querySelector(".timeline-clip__name")?.textContent).toBe("City");expect(labeled.host.querySelector(".timeline-clip")?.getAttribute("data-ladder")).toBe("labeled",);@@ -207,7 +207,7 @@ describe("TimelineClip", () => {pps: 23,isSelected: true,});- expect(frame.host.querySelector(".timeline-clip__label")).toBeNull();+ expect(frame.host.querySelector(".timeline-clip__name")?.textContent).toBe("City");expect(frame.host.querySelector(".timeline-clip")?.getAttribute("data-ladder")).toBe("frame");act(() => frame.root.unmount());});diff --git a/packages/studio/src/player/components/TimelineClip.tsx b/packages/studio/src/player/components/TimelineClip.tsxindex c5d959c883..2fcdc48859 100644--- a/packages/studio/src/player/components/TimelineClip.tsx+++ b/packages/studio/src/player/components/TimelineClip.tsx@@ -1,6 +1,7 @@import { memo, type CSSProperties, type ReactNode } from "react";import type { TimelineElement } from "../store/playerStore";import {+ CLIP_TRIM_HIT_PX,clipWidthLadder,defaultTimelineTheme,getClipHandleOpacity,@@ -70,9 +71,10 @@ export const TimelineClip = memo(function TimelineClip({const widthPx = Math.max(el.duration * pps, 4);const handleOpacity = getClipHandleOpacity({ isHovered, isSelected, isDragging });const displayLabel = `${el.label || el.id || el.tag}${clipSpeedSuffix(el.playbackRate, el.automation)}`;+ const isAudioClip = isAudioTimelineElement(el);const ladder = clipWidthLadder(widthPx);const showHandles = handleOpacity > 0.01 && (widthPx >= 32 || isSelected);- const showLabel = ladder === "labeled";+ const showLabel = !isAudioClip || ladder === "labeled";const showDefaultText = !hasCustomContent && ladder === "labeled";const startLabel = el.start.toFixed(1);const endLabel = (el.start + el.duration).toFixed(1);@@ -88,9 +90,12 @@ export const TimelineClip = memo(function TimelineClip({} as CSSProperties;const linkColor = linkLabelColor(el.link);if (linkColor) Object.assign(themeVariables, { "--clip-link-color": linkColor });- const isAudioClip = isAudioTimelineElement(el);const hasFades = (isAudioClip || Boolean(el.hasAudio)) && !isGestureActor;const fade = useClipFadeDraft(el);+ const badges =+ ladder === "labeled" && !isGestureActor ? (+ <ClipBadges el={el} onOpenMenu={onContextMenu} />+ ) : null;const clipClassName = ["timeline-clip","absolute",@@ -141,7 +146,7 @@ export const TimelineClip = memo(function TimelineClip({title={isComposition? `${el.compositionSrc} • Double-click to open`- : `${displayLabel} • ${el.start.toFixed(1)}s – ${(el.start + el.duration).toFixed(1)}s`+ : `${displayLabel} • ${startLabel}s – ${endLabel}s`}onPointerEnter={onHoverStart}onPointerLeave={onHoverEnd}@@ -160,7 +165,7 @@ export const TimelineClip = memo(function TimelineClip({left: 0,top: 0,bottom: 0,- width: 14,+ width: CLIP_TRIM_HIT_PX,cursor: "col-resize",zIndex: 4,}}@@ -190,7 +195,7 @@ export const TimelineClip = memo(function TimelineClip({right: 0,top: 0,bottom: 0,- width: 14,+ width: CLIP_TRIM_HIT_PX,cursor: "col-resize",zIndex: 4,}}@@ -210,8 +215,13 @@ export const TimelineClip = memo(function TimelineClip({/></div>)}- {showLabel && <span className="timeline-clip__label">{displayLabel}</span>}- {showLabel && !isGestureActor && <ClipBadges el={el} onOpenMenu={onContextMenu} />}+ {showLabel && (+ <span className="timeline-clip__label">+ <span className="timeline-clip__name">{displayLabel}</span>+ {!isAudioClip && badges}+ </span>+ )}+ {isAudioClip && badges}{!isGestureActor && el.syncOrigin && <OutOfSyncBadge el={el} />}{showDefaultText && (<span className="timeline-clip__timecode">diff --git a/packages/studio/src/player/components/TimelineClipFades.tsx b/packages/studio/src/player/components/TimelineClipFades.tsxindex ee24790d0f..c6c82a5884 100644--- a/packages/studio/src/player/components/TimelineClipFades.tsx+++ b/packages/studio/src/player/components/TimelineClipFades.tsx@@ -20,6 +20,7 @@ import { usePlayerStore, type TimelineElement } from "../store/playerStore";import { Tooltip } from "../../components/ui";import { useTimelineEditContextOptional } from "../../contexts/TimelineEditContext";import { releasedOutsideWindow } from "./timelinePointerRelease";+import { CLIP_TRIM_HIT_PX } from "./timelineTheme";import {collectTimelineSnapTargets,snapTimelineTime,@@ -135,14 +136,29 @@ export function TimelineClipFades({const visible =fades.fadeIn > 0 || fades.fadeOut > 0 || showHandles || dragging !== null || focused !== null;const rootRef = useRef<HTMLDivElement | null>(null);- const [clipBox, setClipBox] = useState({ height: 0, radius: 0 });+ const [clipBox, setClipBox] = useState<{+ height: number;+ width: number;+ radius: number;+ toolsLeft: number | null;+ }>({ height: 0, width: 0, radius: 0, toolsLeft: null });useLayoutEffect(() => {- const clip = rootRef.current?.parentElement;- if (!clip) return;+ const root = rootRef.current;+ const clip = root?.parentElement;+ if (!root || !clip) return;const radius = parseFloat(getComputedStyle(clip).borderTopLeftRadius) || 0;- const height = clip.clientHeight;+ const { clientHeight: height, clientWidth: width } = root;+ const fx = clip.querySelector('[data-badge="fx"]');+ const toolsLeft = fx+ ? fx.getBoundingClientRect().left - root.getBoundingClientRect().left+ : null;setClipBox((box) =>- box.height === height && box.radius === radius ? box : { height, radius },+ box.height === height &&+ box.width === width &&+ box.radius === radius &&+ box.toolsLeft === toolsLeft+ ? box+ : { height, width, radius, toolsLeft },);}, [widthPx, visible]);@@ -332,13 +348,20 @@ export function TimelineClipFades({const handlesVisible = showHandles || dragging !== null || focused !== null;if (!visible) return null;- const hitWidth = Math.min(HANDLE_HIT, widthPx / 2);+ const clipWidth = clipBox.toolsLeft === null ? widthPx : clipBox.width;+ const edgeInset = clipBox.toolsLeft === null ? 0 : CLIP_TRIM_HIT_PX;+ // Reserve FX horizontally so fades keep their top-edge lane above compact keyframe centres.+ const rightEdge =+ clipBox.toolsLeft === null ? clipWidth : Math.min(clipWidth - edgeInset, clipBox.toolsLeft);+ const hitWidth = Math.min(HANDLE_HIT, (rightEdge - edgeInset) / 2);const tabX = (edge: FadeEdge) => {- const knee = edge === "in" ? inPx : widthPx - outPx;- const inset = Math.min(TAB_INSET, widthPx / 2);- return Math.min(widthPx - inset, Math.max(inset, knee));+ const knee = edge === "in" ? inPx : clipWidth - outPx;+ const tabInset = edgeInset === 0 ? TAB_INSET : TAB_WIDTH;+ const inset = Math.min(tabInset, (rightEdge - edgeInset) / 2);+ return Math.min(rightEdge - inset, Math.max(edgeInset + inset, knee));};- const boxLeft = (x: number) => Math.min(widthPx - hitWidth, Math.max(0, x - hitWidth / 2));+ const boxLeft = (x: number) =>+ Math.min(rightEdge - hitWidth, Math.max(edgeInset, x - hitWidth / 2));const [inX, outX] = [tabX("in"), tabX("out")];const mid = (inX + outX) / 2;// A handle with no 0.01 s step to move is not drawn, unless in use: its twin owns the spot.@@ -350,14 +373,14 @@ export function TimelineClipFades({const overlap = drawn("in") && drawn("out") && boxLeft(inX) + hitWidth > boxLeft(outX);const handleGeometry = (edge: FadeEdge) => {const x = edge === "in" ? inX : outX;- // Boxes that would overlap meet at the midpoint between the two tabs.const [left, right] = !overlap? [boxLeft(x), boxLeft(x) + hitWidth]: edge === "in"- ? [Math.max(0, mid - hitWidth), mid]- : [mid, Math.min(widthPx, mid + hitWidth)];- const edgeY = topEdgeY(x, widthPx, clipBox.height, clipBox.radius);- return { left, width: right - left, tabLeft: x - left, top: edgeY + 1 - TAB_CENTER_IN_HIT };+ ? [Math.max(edgeInset, mid - hitWidth), mid]+ : [mid, Math.min(rightEdge, mid + hitWidth)];+ const edgeY = topEdgeY(x, clipWidth, clipBox.height, clipBox.radius);+ const top = edgeY + 1 - TAB_CENTER_IN_HIT;+ return { left, width: right - left, tabLeft: x - left, top };};const handleStyle = (geometry: { left: number; top: number; width: number }): CSSProperties => ({position: "absolute",diff --git a/packages/studio/src/player/components/TimelineGestureOverlay.tsx b/packages/studio/src/player/components/TimelineGestureOverlay.tsxindex fe41abc1e8..d73f0f62af 100644--- a/packages/studio/src/player/components/TimelineGestureOverlay.tsx+++ b/packages/studio/src/player/components/TimelineGestureOverlay.tsx@@ -1,5 +1,4 @@-import { memo, type ReactNode } from "react";-import type { TimelineElement } from "../store/playerStore";+import { memo } from "react";import type { TimelineTheme } from "./timelineTheme";import { getRenderedTimelineElement } from "./timelineTheme";import { TimelineClip } from "./TimelineClip";@@ -9,7 +8,7 @@ import { getTimelineDragOverlayPosition } from "./timelineClipDragPreview";import type { DraggedClipState } from "./timelineClipDragTypes";import type { TrackVisualStyle } from "./timelineIcons";import { isTimelineClipActive } from "./useTimelineActiveClips";-import type { TimelineClipRenderContext } from "./TimelineTypes";+import type { TimelineProps } from "./TimelineTypes";interface TimelineGestureOverlayProps {drag: DraggedClipState | null;@@ -20,12 +19,8 @@ interface TimelineGestureOverlayProps {currentTime: number;theme: TimelineTheme;getTrackStyle: (tag: string) => TrackVisualStyle;- renderClipContent?: (- element: TimelineElement,- style: { clip: string; label: string },- context: TimelineClipRenderContext,- ) => ReactNode;- renderClipOverlay?: (element: TimelineElement) => ReactNode;+ renderClipContent?: TimelineProps["renderClipContent"];+ renderClipOverlay?: TimelineProps["renderClipOverlay"];}/** Stable canvas child that owns the live drag actor independently of source rows. */diff --git a/packages/studio/src/player/components/timelineClipChildren.tsx b/packages/studio/src/player/components/timelineClipChildren.tsxindex 84afbe7e3a..3b238680f1 100644--- a/packages/studio/src/player/components/timelineClipChildren.tsx+++ b/packages/studio/src/player/components/timelineClipChildren.tsx@@ -2,7 +2,7 @@ import { useState, type ReactNode } from "react";import { usePlayerStore, type TimelineElement } from "../store/playerStore";import type { TimelineTimeRange } from "../lib/timelineClipIndex";import type { TrackVisualStyle } from "./timelineIcons";-import type { TimelineClipRenderContext } from "./TimelineTypes";+import type { TimelineProps, TimelineClipRenderContext } from "./TimelineTypes";export function resolveClipRenderContext(element: TimelineElement,@@ -23,7 +23,7 @@ function ClipLintDot({ element }: { element: TimelineElement }) {return (<spanclassName="absolute w-1.5 h-1.5 rounded-full bg-warning-ink"- style={{ top: 7, right: 7 }}+ style={{ bottom: 7, right: 7 }}title={lint.messages.join("\n")}/>);@@ -42,14 +42,8 @@ export function ClipContentOnceShown({ hold, children }: { hold: boolean; childrexport function renderClipChildren(element: TimelineElement,clipStyle: TrackVisualStyle,- renderClipContent:- | ((- element: TimelineElement,- style: { clip: string; label: string },- context: TimelineClipRenderContext,- ) => ReactNode)- | undefined,- renderClipOverlay: ((element: TimelineElement) => ReactNode) | undefined,+ renderClipContent: TimelineProps["renderClipContent"],+ renderClipOverlay: TimelineProps["renderClipOverlay"],context: TimelineClipRenderContext = { priority: "visible", rich: false },): ReactNode {return (@@ -58,11 +52,11 @@ export function renderClipChildren({!renderClipContent && <ClipLintDot element={element} />}{renderClipContent && (// The picture can paint above the trim handles, so it takes no input and presses reach them.- // borderRadius: inherit clips it to the clip's rounded corners; the clip itself is+ // The content inherits the clip's rounded corners; the clip itself is// overflow-visible because keyframe diamonds hang outside its bounds.<div- className="absolute inset-0 overflow-hidden"- style={{ borderRadius: "inherit", pointerEvents: "none" }}+ className="timeline-clip__content absolute inset-0 overflow-hidden"+ style={{ pointerEvents: "none" }}>{renderClipContent(element, clipStyle, context)}</div>diff --git a/packages/studio/src/player/components/timelineLaneProps.ts b/packages/studio/src/player/components/timelineLaneProps.tsindex a2893929d5..1c8f77bfa0 100644--- a/packages/studio/src/player/components/timelineLaneProps.ts+++ b/packages/studio/src/player/components/timelineLaneProps.ts@@ -1,4 +1,3 @@-import { type ReactNode } from "react";import type { GsapAnimation } from "@hyperframes/core/gsap-parser";import type { MusicBeatAnalysis } from "@hyperframes/core/beats";import type { TimelineElement, KeyframeCacheEntry } from "../store/playerStore";@@ -13,7 +12,7 @@ import type { TimelineVirtualRow } from "./useTimelineVirtualRows";import type { MultiDragPreviewInput } from "./timelineMultiDragPreview";import type { TimelineEditCallbacks } from "./timelineCallbacks";import type { TimelineLogicalRow } from "./timelineKeyboardNavigation";-import type { TimelineClipRenderContext } from "./TimelineTypes";+import type { TimelineProps } from "./TimelineTypes";import type { TimelineTrackGroupInfo } from "./useTimelineTrackDerivations";/**@@ -52,12 +51,8 @@ export interface TimelineLaneBaseProps {blockedClipRef: React.RefObject<BlockedClipState | null>;suppressClickRef: React.RefObject<boolean>;scrollRef: React.RefObject<HTMLDivElement | null>;- renderClipContent?: (- element: TimelineElement,- style: { clip: string; label: string },- context: TimelineClipRenderContext,- ) => ReactNode;- renderClipOverlay?: (element: TimelineElement) => ReactNode;+ renderClipContent?: TimelineProps["renderClipContent"];+ renderClipOverlay?: TimelineProps["renderClipOverlay"];onDrillDown?: (element: TimelineElement) => void;onSelectElement?: (element: TimelineElement | null) => void;setHoveredClip: (key: string | null) => void;diff --git a/packages/studio/src/player/components/timelineMotionStyles.test.ts b/packages/studio/src/player/components/timelineMotionStyles.test.tsindex d2dd18deb4..06a0046966 100644--- a/packages/studio/src/player/components/timelineMotionStyles.test.ts+++ b/packages/studio/src/player/components/timelineMotionStyles.test.ts@@ -60,7 +60,7 @@ describe("timeline motion styles", () => {const timelineClipMotionRule = expectRule(motionMediaCss, ".timeline-clip");expect(expectDeclaration(timelineClipMotionRule, "transition")).toBe(- "background-color 120ms ease-out",+ "background-color var(--timeline-clip-hover-duration) ease-out",);});@@ -72,10 +72,9 @@ describe("timeline motion styles", () => {const audioClipHoverRule = expectRule(studioCss, ".timeline-clip.is-audio.is-hovered");const audioClipDraggingRule = expectRule(studioCss, ".timeline-clip.is-audio.is-dragging");const activeTimelineClipRule = expectRule(studioCss, ".timeline-clip[data-active]");- const selectedTimelineClipRule = expectRule(studioCss, ".timeline-clip.is-selected");- const activeSelectedTimelineClipRule = expectRule(+ const selectedTimelineClipRule = expectRule(studioCss,- ".timeline-clip[data-active].is-selected",+ ".timeline-clip.is-selected,\n.timeline-clip[data-active].is-selected",);const bloomOverlayRule = expectRule(studioCss, ".timeline-clip::before");const activeBloomOverlayRule = expectRule(studioCss, ".timeline-clip[data-active]::before");@@ -92,7 +91,7 @@ describe("timeline motion styles", () => {expect(timelineClipTimecodeRule).toContain("color: var(--timeline-tick-text)");expect(themeCss).toContain("--timeline-clip-label-shadow: 0 1px 2px rgba(0, 0, 0, 0.85)");expect(themeCss).toContain("--timeline-clip-selection-highlight: rgb(255 255 255 / 0.55)");- expect(themeCss).toContain("--timeline-clip-radius: 8px");+ expect(themeCss).toContain("--timeline-clip-radius: 12px");expect(themeCss).toContain("--timeline-clip-audio-radius: 21px");expect(themeCss).toContain("--timeline-clip-highlight: rgb(255 255 255 / 0.08)");expect(themeCss).toContain("--timeline-clip-shadow: 0 2px 6px rgb(0 0 0 / 0.3)");@@ -104,14 +103,8 @@ describe("timeline motion styles", () => {expect(audioClipRule).toContain("border-color: var(--timeline-clip-audio-border)");expect(audioClipHoverRule).toContain("background-color: var(--timeline-clip-audio-bg-hover)");expect(audioClipDraggingRule).toContain("var(--timeline-clip-audio-bg-dragging)");- expect(selectedTimelineClipRule).toContain(- "outline: 1.5px solid var(--timeline-clip-selection)",- );- expect(selectedTimelineClipRule).toContain("outline-offset: -1.5px");- expect(activeSelectedTimelineClipRule).toContain(- "outline: 1.5px solid var(--timeline-clip-selection)",- );- expect(activeSelectedTimelineClipRule).toContain("outline-offset: -1.5px");+ expect(selectedTimelineClipRule).toContain("outline: 1px solid var(--timeline-clip-selection)");+ expect(selectedTimelineClipRule).toContain("outline-offset: 0");expect(activeTimelineClipRule).not.toContain("background: linear-gradient");expect(activeTimelineClipRule).toContain("border-color: var(--clip-border-active)");expect(activeTimelineClipRule).not.toContain("box-shadow");diff --git a/packages/studio/src/player/components/timelineTheme.ts b/packages/studio/src/player/components/timelineTheme.tsindex ca6d4202e0..276a770687 100644--- a/packages/studio/src/player/components/timelineTheme.ts+++ b/packages/studio/src/player/components/timelineTheme.ts@@ -1,5 +1,7 @@import type { TimelineElement } from "../store/playerStore";+export const CLIP_TRIM_HIT_PX = 14;+export interface TimelineTrackStyle {clip: string;accent: string;diff --git a/packages/studio/src/styles/components.css b/packages/studio/src/styles/components.cssindex f08933159c..159649110a 100644--- a/packages/studio/src/styles/components.css+++ b/packages/studio/src/styles/components.css@@ -160,6 +160,35 @@var(--timeline-clip-shadow);}+.timeline-clip:not(.is-audio) {+ border-width: 0;+}++.timeline-clip__content {+ border-radius: inherit;+}++.timeline-clip:not(.is-audio) .timeline-clip__content {+ top: var(--timeline-clip-band-height);+ border-top-left-radius: 0;+ border-top-right-radius: 0;+}++.timeline-clip::after {+ content: "";+ position: absolute;+ inset: 0;+ z-index: 7;+ border-radius: inherit;+ background: var(--timeline-clip-chip-text);+ opacity: 0;+ pointer-events: none;+}++.timeline-clip.is-hovered::after {+ opacity: 0.1;+}+.timeline-transition {position: absolute;width: 0;@@ -304,24 +333,10 @@border-color: var(--clip-border-hover);}-.timeline-clip.is-selected {- outline: 1.5px solid var(--timeline-clip-selection);- outline-offset: -1.5px;-}--.timeline-clip.is-selected::after {- content: "";- position: absolute;- inset: 0;- z-index: 4;- border-radius: inherit;- box-shadow: inset 0 0 0 1px var(--timeline-clip-selection-highlight);- pointer-events: none;-}-+.timeline-clip.is-selected,.timeline-clip[data-active].is-selected {- outline: 1.5px solid var(--timeline-clip-selection);- outline-offset: -1.5px;+ outline: 1px solid var(--timeline-clip-selection);+ outline-offset: 0;}.timeline-clip.is-dragging {@@ -351,6 +366,38 @@white-space: nowrap;}+.timeline-clip:not(.is-audio) .timeline-clip__label {+ display: flex;+ z-index: auto;+ top: 0;+ left: 0;+ width: 100%;+ max-width: 100%;+ height: var(--timeline-clip-band-height);+ overflow: visible;+ padding: 0 min(6px, 25%);+ border-radius: inherit;+ border-bottom-left-radius: 0;+ border-bottom-right-radius: 0;+ background: var(--timeline-clip-band-bg);+ font-weight: 600;+ line-height: var(--timeline-clip-band-height);+}++.timeline-clip:not(.is-audio) .timeline-clip__name {+ flex: 1;+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+}++.timeline-clip:not(.is-audio) .timeline-clip__label [data-testid="clip-badges"] {+ position: static;+ flex-shrink: 0;+ max-width: 100%;+ margin-top: 2px;+}+/* Link groups share a label colour on the border and the name chip. */.timeline-clip[data-link-color] {border-color: var(--clip-link-color);@@ -358,7 +405,7 @@.timeline-clip[data-link-color] .timeline-clip__label {box-shadow: inset 3px 0 0 var(--clip-link-color);- padding-left: 8px;+ padding-left: min(8px, 25%);}.timeline-clip.is-audio .timeline-clip__label {@@ -371,6 +418,7 @@position: absolute;bottom: 6px;left: 12px;+ right: 16px;overflow: hidden;color: var(--timeline-tick-text);font-family: var(--font-mono);@@ -383,7 +431,11 @@@media (prefers-reduced-motion: no-preference) {.timeline-clip {- transition: background-color 120ms ease-out;+ transition: background-color var(--timeline-clip-hover-duration) ease-out;+ }++ .timeline-clip::after {+ transition: opacity var(--timeline-clip-hover-duration) ease-out;}.timeline-clip__handle-bar {diff --git a/packages/studio/src/styles/theme.css b/packages/studio/src/styles/theme.cssindex bb5a48cfd6..1f7b987e4b 100644--- a/packages/studio/src/styles/theme.css+++ b/packages/studio/src/styles/theme.css@@ -119,7 +119,10 @@--timeline-clip-audio-muted-bg: rgb(72, 74, 78);--timeline-clip-selection: light-dark(#0f766e, rgba(255, 255, 255, 0.85));--timeline-clip-selection-highlight: rgb(255 255 255 / 0.55);- --timeline-clip-radius: 8px;+ --timeline-clip-radius: 12px;+ --timeline-clip-band-height: 15px;+ --timeline-clip-band-bg: rgb(12 12 14);+ --timeline-clip-hover-duration: 60ms;--timeline-clip-audio-radius: 21px;--timeline-clip-highlight: rgb(255 255 255 / 0.08);--timeline-clip-shadow: 0 2px 6px rgb(0 0 0 / 0.3);diff --git a/packages/studio/tests/e2e/filmstrip-controls.mjs b/packages/studio/tests/e2e/filmstrip-controls.mjsnew file mode 100644index 0000000000..cc555f4f0d--- /dev/null+++ b/packages/studio/tests/e2e/filmstrip-controls.mjs@@ -0,0 +1,175 @@+#!/usr/bin/env node+// Disposable project: zero-fade audio and a 2 s video with a collapsed opacity keyframe at 1 s.+import assert from "node:assert/strict";+import { launchStudioChrome } from "./chrome-executable.mjs";++const STUDIO_URL = process.env.STUDIO_URL;+assert(STUDIO_URL, "STUDIO_URL must point at the disposable filmstrip fixture");+const { browser } = await launchStudioChrome();+const evidence = [];+try {+ const page = await browser.newPage();+ page.setDefaultNavigationTimeout(60_000);+ await page.setViewport({ width: 1440, height: 900 });+ await page.goto(STUDIO_URL, { waitUntil: "domcontentloaded" });+ for (const kind of ["video", "audio"]) {+ const selector =+ kind === "audio"+ ? '.timeline-clip.is-audio:has([data-badge="fx"])'+ : '.timeline-clip:not(.is-audio):has([data-badge="volume"])';+ await page.waitForSelector(selector, { timeout: 60_000 });+ const clip = await page.$(selector);+ await clip.hover();+ const fx = await clip.$('[data-badge="fx"]');+ const handle = await clip.$('[data-testid="clip-fade-handle-out"]');+ assert(fx && handle, `${kind} must expose FX and an editable fade-out handle`);+ assert.equal(await handle.evaluate((node) => node.getAttribute("aria-valuenow")), "0");+ const geometry = await clip.evaluate((node) => {+ const fx = node.querySelector('[data-badge="fx"]');+ const fade = node.querySelector('[data-testid="clip-fade-handle-out"]');+ const f = fx.getBoundingClientRect();+ const h = fade.getBoundingClientRect();+ const c = node.getBoundingClientRect();+ const trims = [...node.querySelectorAll(".timeline-clip__handle-bar")]+ .map((bar) => bar.parentElement.getBoundingClientRect())+ .sort((a, b) => a.left - b.left);+ const fxReached = [2, f.width / 2, f.width - 2].every((x) => {+ const hit = document.elementFromPoint(f.left + x, f.top + f.height / 2);+ return fx.contains(hit);+ });+ return {+ fxReached,+ fadeClearFx: h.right <= f.left || h.top >= f.bottom,+ fadeInsideClip: h.bottom <= c.bottom,+ trimClear: trims.length === 2 && h.left >= trims[0].right && h.right <= trims[1].left,+ fadeHitHeight: h.height,+ };+ });+ assert(geometry.fxReached, `${kind} FX must receive the pointer across its full width`);+ assert(geometry.fadeClearFx, `${kind} fade target must clear FX`);+ assert(geometry.fadeInsideClip, `${kind} fade target must stay inside its clip`);+ assert(geometry.trimClear, `${kind} fade target must clear trim grips`);+ assert(geometry.fadeHitHeight >= 15, `${kind} fade target must fit its visible tab`);+ const fxBox = await fx.boundingBox();+ await page.mouse.click(fxBox.x + fxBox.width / 2, fxBox.y + fxBox.height / 2);+ await page.waitForSelector('[role="menu"][aria-label="Clip actions"]', { timeout: 10_000 });+ await page.keyboard.press("Escape");+ await page.waitForSelector('[role="menu"][aria-label="Clip actions"]', { hidden: true });+ await clip.hover();+ const dragHandle = await page.waitForSelector(+ `${selector} [data-testid="clip-fade-handle-out"]`,+ );+ const fadeBox = await dragHandle.boundingBox();+ assert(fadeBox, `${kind} fade must expose its fresh target after closing FX`);+ const x = fadeBox.x + fadeBox.width / 2;+ const y = fadeBox.y + fadeBox.height / 2;+ await page.mouse.move(x, y);+ await page.mouse.down();+ await page.mouse.move(x - 40, y, { steps: 8 });+ const preview = Number(await dragHandle.evaluate((node) => node.getAttribute("aria-valuenow")));+ assert(preview > 0, `${kind} fade must preview during a pointer drag`);+ await page.mouse.up();+ const saveStatus = await page.evaluate(async () => {+ const moduleUrl = new URL("/src/utils/studioPendingEdits.ts", window.location.href);+ const { flushStudioPendingEdits } = await import(moduleUrl.href);+ return (await flushStudioPendingEdits()).status;+ });+ assert.equal(saveStatus, "clean", `${kind} fade save must settle successfully`);+ await page.reload({ waitUntil: "domcontentloaded" });+ await page.waitForSelector(selector, { timeout: 60_000 });+ await (await page.$(selector)).hover();+ await page.waitForFunction(+ (selector, value) =>+ Number(document.querySelector(selector)?.getAttribute("aria-valuenow")) === value,+ { timeout: 10_000 },+ `${selector} [data-testid="clip-fade-handle-out"]`,+ preview,+ );+ if (kind === "video") {+ const currentClip = await page.$(selector);+ const disclosureSelector = "button[aria-controls][aria-expanded]";+ await page.waitForFunction(+ (selector, disclosureSelector) =>+ document+ .querySelector(selector)+ ?.closest("[data-timeline-row]")+ ?.querySelector(disclosureSelector),+ { timeout: 10_000 },+ selector,+ disclosureSelector,+ );+ const disclosureHandle = await currentClip.evaluateHandle(+ (node, disclosureSelector) =>+ node.closest("[data-timeline-row]").querySelector(disclosureSelector),+ disclosureSelector,+ );+ const disclosure = disclosureHandle.asElement();+ assert(disclosure, "video must expose its keyframe lane disclosure");+ if ((await disclosure.evaluate((node) => node.getAttribute("aria-expanded"))) === "true") {+ await disclosure.click();+ }+ await page.waitForFunction(+ (selector, disclosureSelector) =>+ document+ .querySelector(selector)+ ?.closest("[data-timeline-row]")+ ?.querySelector(disclosureSelector)+ ?.getAttribute("aria-expanded") === "false",+ {},+ selector,+ disclosureSelector,+ );+ await currentClip.hover();+ const fadeIn = await currentClip.$('[data-testid="clip-fade-handle-in"]');+ await fadeIn.focus();+ for (let step = 0; step < 10; step++) await page.keyboard.press("ArrowRight");+ await page.waitForFunction(+ (selector) => Number(document.querySelector(selector)?.getAttribute("aria-valuenow")) === 1,+ {},+ `${selector} [data-testid="clip-fade-handle-in"]`,+ );+ const separated = await currentClip.evaluate((node) => {+ const fade = node.querySelector('[data-testid="clip-fade-handle-in"]');+ const f = fade.getBoundingClientRect();+ const clip = node.getBoundingClientRect();+ const diamond = [...document.querySelectorAll('button[aria-label*="keyframe at"]')].find(+ (d) => {+ const r = d.getBoundingClientRect();+ return (+ Math.abs(r.left + r.width / 2 - (clip.left + clip.width / 2)) < 1 &&+ r.top >= clip.top &&+ r.bottom <= clip.bottom+ );+ },+ );+ const fadeHit = document.elementFromPoint(f.left + f.width / 2, f.top + f.height / 2);+ const result = {+ diamondExists: Boolean(diamond),+ fadeReached: fade.contains(fadeHit),+ diamondReached: false,+ };+ if (diamond) {+ const d = diamond.getBoundingClientRect();+ const diamondHit = document.elementFromPoint(d.left + d.width / 2, d.top + d.height / 2);+ result.diamondReached = diamond.contains(diamondHit);+ }+ return result;+ });+ assert.deepEqual(+ separated,+ { diamondExists: true, fadeReached: true, diamondReached: true },+ "middle fade and collapsed keyframe must each receive their own centre pointer",+ );+ }+ evidence.push({+ kind,+ ...geometry,+ menuOpened: true,+ fadePreview: preview,+ fadeCommitted: true,+ });+ }+} finally {+ await browser.close();+}+console.log(JSON.stringify({ evidence }, null, 2));