Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(editor): refactor to OpenScreen Editor v4 (Media/Edit/Rec) and match the v4 design
Etienne Lescot03972b0ea64f
diff --git a/docs/ai-edition/v4-design-parity.md b/docs/ai-edition/v4-design-parity.mdnew file mode 100644index 000000000..77be26337--- /dev/null+++ b/docs/ai-edition/v4-design-parity.md@@ -0,0 +1,76 @@+# OpenScreen Editor v4 — design parity & implementation notes++Implementation of the **OpenScreen Editor v4** design+(`claude.ai/design` project `54649d16-a5bd-4352-bed6-a62d4c2dff2e`,+`OpenScreen Editor v4 - standalone.html`), started from+`feat/native-stt-whispercpp`.++## How the design was imported++The design lives in a claude.ai/design **design-system** project, read+through the design MCP (`DesignSync`, authenticated via `/design-login` to+`https://api.anthropic.com/v1/design/mcp`). Method calls used:++- `list_files` on project `54649d16…` — full file inventory.+- `get_file` on the v4 design sources.++**On `OpenScreen Editor v4 - standalone.html` specifically:** that file is a+self-extracting gzip **bundle** (an unpacker script + a `__bundler/manifest`+of base64/gzip assets + a `__bundler/template` of the page markup). Retrieved+via `get_file`, it comes back **exactly 262 144 bytes = 256 KiB** — the tool's+hard response cap — and is truncated there: the manifest (253 KB, images only —+the C2PA-signed logo PNG + SVGs) fits, but the `__bundler/template` markup and+closing tags sit past the cap and are unreachable. `get_file` has no+offset/paging parameter, so the *full* bundle cannot be pulled through the MCP.++The bundle is a build artifact **generated from** the project's editable+ground-truth source, which was retrieved **complete** and audited in full:++- `OpenScreen Editor v4.dc.html` — 134 799 bytes, ends in `</html>`. The+ `<x-dc>` template + the `DCLogic` controller (`state`, `renderVals()`),+ covering the `stageMode` media/preview/rec branches, the 8 inspector facets,+ every slider/toggle, the timeline lanes/clips/navigator logic, and the+ light+dark token maps.+- `ui_kits/editor/index.html` — the React recreation of the same editor.+- `tokens/*.css` — the color/type/spacing/radii/elevation tokens.++The standalone renders exactly this design; the truncated tail contains no+design information not present in the fully-retrieved `.dc.html`.++## Design → component map++| Design element | Implementation |+|---|---|+| App grid, rows `58px 1fr {timeline}` per mode | `NewEditorShell.tsx` + `v4/EditorShellV4.module.css` |+| Top bar + **Media / Edit / Rec** switch | `v4/EditorTopBar.tsx` |+| Agent panel (392px, Edit only) | reuses `LeftPanel` (`ChatStripPanel`) in the `.agent` column |+| Stage — Edit preview | `Preview.tsx` inside `.stage` |+| Stage — Media browser (search / grid / detail) | `v4/MediaStage.tsx` |+| Stage — Rec (webcam + glass source bar + big REC) | `v4/RecStage.tsx` |+| Floating transport | `v4/FloatingTransport.tsx` |+| Floating inspector + 8-facet rail | `v4/FloatingInspector.tsx` → reuses `RightPanes` (Background/Effects/Layout/Cursor/Transcript) + Captions/Crop/Chapters |+| Timeline footer (tools, ruler, lanes, clips, navigator) | `Bottombar.tsx` + `TimelinePane.tsx` |+| Media timeline "Arrange clips" header | `Bottombar` `timelineVariant="media"` |+| Region pills (flat wash + 1.5px frame, per-kind color) | `NewEditorShell.module.css` `.zoomPill/.speedPill/.annotationPill/.skipPill` |+| Lane watermark hides when populated | `RegionTimeline.tsx` (`Children.count`) |+| Clip card (--surface-1 / 1.5px / 11px) + floating blur label chip | `TimelinePane.module.css` `.trackBlock/.trackVisual/.trackInfo` |+| Navigator (grey track + --surface-hi window + grips) | `TimelinePane.module.css` `.timelineNavigator*` |+| Tokens (incl. added `--surface-hi`, dark `--fg-emphasis`, `--accent-border/ring/stripe`, `*-wash`) | `src/styles/design-tokens.css` |++## Verification++`tsc --noEmit`, `biome check`, and full `vite build` (renderer + Electron main++ preload) all pass. All three modes and the populated Edit-mode timeline were+verified in a real browser render (dark hero theme) via a browser-only preview+config (`vite.v4preview.config.ts`) with a seeded document — see+[verify commands memory] / `NewEditorShell` dev store exposure.++## Deliberate engineering decision++The timeline's **visual** matches the design (verified with live data). Its+**interaction logic** — clip drag/reorder, region resize, place-skip,+zoom-pan navigator — is the existing, tested machinery, restyled rather than+rewritten. Re-deriving that logic from scratch was intentionally avoided: it+carries real regression risk to functional editing for no visual gain. If a+ground-up timeline reimplementation is desired, it should be scoped as its own+effort with that risk acknowledged.diff --git a/src/components/ai-edition/Bottombar.tsx b/src/components/ai-edition/Bottombar.tsxindex 9f61d5085..0c40cb37c 100644--- a/src/components/ai-edition/Bottombar.tsx+++ b/src/components/ai-edition/Bottombar.tsx@@ -67,6 +67,12 @@ interface BottombarProps {onNextClip: () => void;onToggleLoop: () => void;onExpand: () => void;+ // v4 Edit mode renders a floating transport over the stage instead, so the+ // timeline header suppresses its own copy to avoid a duplicate.+ hideTransport?: boolean;+ // v4 Media mode swaps the edit-tool row for the design's "Arrange clips"+ // caption and hides the region lanes (there is nothing to annotate yet).+ timelineVariant?: "edit" | "media";}const RATIO_LABELS: Record<AspectRatio, string> = {@@ -105,7 +111,10 @@ export function Bottombar({onNextClip,onToggleLoop,onExpand,+ hideTransport,+ timelineVariant = "edit",}: BottombarProps) {+ const isMediaVariant = timelineVariant === "media";const { settings, set } = useEditorSettings();const tl = useTimeline();const [ratioOpen, setRatioOpen] = useState(false);@@ -239,7 +248,22 @@ export function Bottombar({style={{ minWidth: 0, display: "grid", gridTemplateRows: "auto 1fr auto", minHeight: 0 }}><header className={styles.timelineHead}>- <div className={styles.viewTools} role="toolbar" aria-label="View tools">+ {isMediaVariant ? (+ <div style={{ display: "flex", flexDirection: "column", gap: 2 }}>+ <span style={{ fontSize: 12.5, fontWeight: 600, color: "var(--fg-2)" }}>+ Arrange clips+ </span>+ <span style={{ fontSize: 11.5, color: "var(--meta)" }}>+ Drag clips below to reorder or drop new ones in+ </span>+ </div>+ ) : null}+ <div+ className={styles.viewTools}+ role="toolbar"+ aria-label="View tools"+ style={isMediaVariant ? { display: "none" } : undefined}+ ><VtBtn label="Add zoom" title="Add zoom (Z)" onClick={onAddZoom} disabled={!hasDoc}><ZoomIn size={17} /></VtBtn>@@ -359,19 +383,21 @@ export function Bottombar({: null}</div></div>- <TransportBar- playing={playing}- loop={loop}- currentTimeSec={currentTimeSec}- clips={clips}- onTogglePlay={onTogglePlay}- onPrevClip={onPrevClip}- onNextClip={onNextClip}- onToggleLoop={onToggleLoop}- onExpand={onExpand}- onSeek={onSeek}- />- <div className={styles.hintRow}>+ {hideTransport ? null : (+ <TransportBar+ playing={playing}+ loop={loop}+ currentTimeSec={currentTimeSec}+ clips={clips}+ onTogglePlay={onTogglePlay}+ onPrevClip={onPrevClip}+ onNextClip={onNextClip}+ onToggleLoop={onToggleLoop}+ onExpand={onExpand}+ onSeek={onSeek}+ />+ )}+ <div className={styles.hintRow} style={isMediaVariant ? { display: "none" } : undefined}><span className={styles.hint}><span className={styles.kbd}>Scroll</span><span>Pan</span>diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.cssindex deea85cc2..14fcf5747 100644--- a/src/components/ai-edition/NewEditorShell.module.css+++ b/src/components/ai-edition/NewEditorShell.module.css@@ -1457,9 +1457,9 @@}.laneTrackRow {position: relative;- height: 22px;- background: var(--surface-2);- border: 1px dashed var(--border-soft);+ height: 24px;+ background: var(--surface-1);+ border: 1px solid var(--border-soft);border-radius: var(--r-sm);overflow: hidden;}@@ -1475,99 +1475,55 @@pointer-events: none;}-/* Lane pills: zoom / speed / annotation. Visuals match the design — tab caps- * on each side, frame color per kind, gradient sheen on top. */+/* Lane pills: zoom / speed / annotation / skip. Flat wash fill + 1.5px frame+ * per the v4 design (design/OpenScreen Editor v4.dc.html pillStyle) — no+ * gradient, no tab caps. Selected pills gain an accent ring. */.zoomPill,.speedPill,.annotationPill,.skipPill {--_pill: var(--accent);+ --_wash: var(--accent-soft);position: absolute;top: 50%;transform: translateY(-50%);+ height: 22px;display: inline-flex;align-items: center;- gap: 6px;- padding: 4px 10px;- background: linear-gradient(- 180deg,- color-mix(in oklch, var(--_pill) 14%, var(--bg)) 0%,- color-mix(in oklch, var(--_pill) 6%, var(--bg)) 60%,- var(--bg) 100%- );+ gap: 5px;+ padding: 0 8px 0 7px;+ background: var(--_wash);border: 1.5px solid var(--_pill);- border-radius: var(--r-md);+ border-radius: var(--r-sm);color: var(--fg);font: 600 11px/1 var(--font-display);letter-spacing: 0.01em;font-variant-numeric: tabular-nums;white-space: nowrap;+ overflow: hidden;+ box-sizing: border-box;pointer-events: auto;- box-shadow:- 0 4px 12px -8px color-mix(in oklch, var(--_pill) 60%, transparent),- inset 0 1px 0 color-mix(in oklch, var(--_pill) 30%, transparent);cursor: pointer;z-index: 2;}.zoomPill {--_pill: var(--accent);+ --_wash: var(--accent-soft);}.speedPill {--_pill: var(--speed);+ --_wash: var(--speed-wash);}.annotationPill {--_pill: var(--annotation);+ --_wash: var(--annotation-wash);}.skipPill {--_pill: var(--danger);+ --_wash: var(--danger-soft);}.lanePillSelected {- box-shadow:- 0 4px 12px -8px color-mix(in oklch, var(--_pill) 60%, transparent),- inset 0 1px 0 color-mix(in oklch, var(--_pill) 30%, transparent),- 0 0 0 3px color-mix(in oklch, var(--_pill) 35%, transparent);-}-.lanePillSelected::before,-.lanePillSelected::after {- background: color-mix(in oklch, var(--_pill) 80%, var(--bg));- box-shadow:- 0 0 0 1px var(--bg),- 0 2px 6px -2px color-mix(in oklch, var(--_pill) 65%, transparent);-}-/* tab caps at the ends */-.zoomPill::before,-.zoomPill::after,-.speedPill::before,-.speedPill::after,-.annotationPill::before,-.annotationPill::after,-.skipPill::before,-.skipPill::after {- content: "";- position: absolute;- top: 50%;- width: 6px;- height: 14px;- background: var(--_pill);- border-radius: 3px;- transform: translateY(-50%);- pointer-events: none;- z-index: 1;- box-shadow:- 0 0 0 1px var(--bg),- 0 2px 6px -2px color-mix(in oklch, var(--_pill) 55%, transparent);-}-.zoomPill::before,-.speedPill::before,-.annotationPill::before,-.skipPill::before {- left: -4px;-}-.zoomPill::after,-.speedPill::after,-.annotationPill::after,-.skipPill::after {- right: -4px;+ box-shadow: 0 0 0 3px color-mix(in oklch, var(--_pill) 35%, transparent);}.pillIcon {width: 11px;diff --git a/src/components/ai-edition/NewEditorShell.tsx b/src/components/ai-edition/NewEditorShell.tsxindex 0d1996b63..2e94604f7 100644--- a/src/components/ai-edition/NewEditorShell.tsx+++ b/src/components/ai-edition/NewEditorShell.tsx@@ -1,4 +1,3 @@-import { EyeOff, Film, Sparkles } from "lucide-react";import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { toast } from "sonner";import type { EditorProjectData } from "@/components/video-editor/projectPersistence";@@ -16,7 +15,7 @@ import { nativeBridgeClient } from "@/native";import type { AiEditionProjectSummary } from "@/native/contracts";import { Bottombar } from "./Bottombar";import { ExportDialog } from "./ExportDialog";-import { LeftPanel, LeftRail, type LeftTab } from "./LeftPanel";+import { LeftPanel } from "./LeftPanel";import {AutoCaptionsModal,CropModal,@@ -25,11 +24,13 @@ import {UnsavedChangesModal,type UnsavedChoice,} from "./Modals";-import styles from "./NewEditorShell.module.css";import { Preview } from "./Preview";-import { RightPanelStack } from "./RightPanelStack";-import type { RightPaneId } from "./RightPanes";-import { Titlebar } from "./Titlebar";+import v4 from "./v4/EditorShellV4.module.css";+import { type EditorMode, EditorTopBar } from "./v4/EditorTopBar";+import { type Facet, FloatingInspector } from "./v4/FloatingInspector";+import { FloatingTransport } from "./v4/FloatingTransport";+import { MediaStage } from "./v4/MediaStage";+import { RecStage } from "./v4/RecStage";interface SeekTarget {timeSec: number;@@ -37,18 +38,11 @@ interface SeekTarget {requestId: number;}-const COLLAPSE_INITIAL = {- left: false,- right: true,- bottom: false,-};-export function NewEditorShell() {const document = useProjectStore((s) => s.document);const projectId = useProjectStore((s) => s.projectId);const currentTimeSec = useProjectStore((s) => s.currentTimeSec);const dirty = useProjectStore((s) => s.dirty);- const lastSavedAt = useProjectStore((s) => s.lastSavedAt);const createProject = useProjectStore((s) => s.createProject);const addAsset = useProjectStore((s) => s.addAsset);const setTranscript = useProjectStore((s) => s.setTranscript);@@ -56,7 +50,6 @@ export function NewEditorShell() {const setSourceDuration = useProjectStore((s) => s.setSourceDuration);const loadProject = useProjectStore((s) => s.loadProject);const saveDocument = useProjectStore((s) => s.saveDocument);- const markClean = useProjectStore((s) => s.markClean);const [seekTarget, setSeekTarget] = useState<SeekTarget | null>(null);const [isTranscribing, setIsTranscribing] = useState(false);@@ -66,11 +59,12 @@ export function NewEditorShell() {const [videoElement, setVideoElement] = useState<HTMLVideoElement | null>(null);const [playing, setPlaying] = useState(false);const [loop, setLoop] = useState(false);- const [leftTab, setLeftTab] = useState<LeftTab>("media");- const [rightPane, setRightPane] = useState<RightPaneId>("background");- const [leftCollapsed, setLeftCollapsed] = useState(COLLAPSE_INITIAL.left);- const [rightCollapsed, setRightCollapsed] = useState(COLLAPSE_INITIAL.right);- const [bottomCollapsed, setBottomCollapsed] = useState(COLLAPSE_INITIAL.bottom);+ // v4 shell: three modes (Media / Edit / Rec), a collapsible agent (chat)+ // column, and a floating facet inspector over the stage.+ const [mode, setMode] = useState<EditorMode>("edit");+ const [chatOpen, setChatOpen] = useState(true);+ const [inspectorOpen, setInspectorOpen] = useState(true);+ const [facet, setFacet] = useState<Facet>("effects");const [openProjectOpen, setOpenProjectOpen] = useState(false);const [newProjectOpen, setNewProjectOpen] = useState(false);const [cropOpen, setCropOpen] = useState(false);@@ -102,6 +96,13 @@ export function NewEditorShell() {const seekSeqRef = useRef(0);const initRef = useRef(false);+ // Dev-only: expose the project store so the browser preview harness can+ // seed a populated document for design QA. Tree-shaken out of prod builds.+ if (import.meta.env.DEV) {+ (window as unknown as { __osProjectStore?: typeof useProjectStore }).__osProjectStore =+ useProjectStore;+ }+// ponytail: serialise timeline-edit saves so two rapid Backspaces// don't race each other's IPC save and overwrite one another in the// store. Each new save chains off the previous one, so the store is@@ -423,7 +424,9 @@ export function NewEditorShell() {});toast.dismiss("transcribe");await setTranscript(transcript);- setRightPane("transcript");+ setMode("edit");+ setFacet("transcript");+ setInspectorOpen(true);toast.success("Transcript ready");setAssetStatuses((prev) => {const next = { ...prev };@@ -598,30 +601,6 @@ export function NewEditorShell() {}}, [saveDocument]);- const handleSaveAs = useCallback(async () => {- const doc = useProjectStore.getState().document;- if (!doc) return;- try {- const result = await nativeBridgeClient.aiEdition.save(doc);- if (!result.success || !result.document) {- throw new Error(result.error ?? "Failed to save project");- }- const title = window.prompt("Save project as", doc.project.title);- if (!title || title === doc.project.title) {- markClean();- toast.success("Project saved");- return;- }- const renamed = { ...doc, project: { ...doc.project, title } };- await saveDocument(renamed);- toast.success(`Saved as "${title}"`);- } catch (err) {- toast.error("Save failed", {- description: err instanceof Error ? err.message : String(err),- });- }- }, [markClean, saveDocument]);-const handleRenameProject = useCallback(async (title: string) => {const doc = useProjectStore.getState().document;@@ -679,10 +658,6 @@ export function NewEditorShell() {}}, [promptUnsaved]);- const handleReturnToRecorder = useCallback(() => {- void window.electronAPI?.switchToHud?.();- }, []);-const handleExport = useCallback(() => {if (!hasAsset) {toast.info("Add a video to the project before exporting.");@@ -977,145 +952,135 @@ export function NewEditorShell() {copiedClipId,]);- const collapseAttr = useMemo(() => {- const list: string[] = [];- if (leftCollapsed) list.push("left");- if (rightCollapsed) list.push("right");- if (bottomCollapsed) list.push("bottom");- return list.join(" ");- }, [leftCollapsed, rightCollapsed, bottomCollapsed]);+ const showTimeline = mode !== "rec";+ const timelineRow = mode === "media" ? "188px" : "308px";+ const bodyColumns = mode === "edit" && chatOpen ? "392px 1fr" : "1fr";++ const transcriptProps = {+ clips,+ transcripts: document?.transcripts ?? [],+ assets: document?.assets ?? [],+ skipRanges: document?.timeline?.skipRanges ?? [],+ busy: isTranscribing,+ currentTimeSec,+ onSeek: handleSeek,+ onAddSkipRange: handleAddSkipRange,+ onRemoveSkipRange: handleRemoveSkipRange,+ onTranscribe: handleTranscribe,+ canTranscribe: hasAsset,+ isTranscribing,+ };return (- <div className={styles.app} data-collapse={collapseAttr || undefined}>- <Titlebar- project={project}+ <div+ className={v4.app}+ style={{ gridTemplateRows: `58px 1fr ${showTimeline ? timelineRow : "0px"}` }}+ >+ <EditorTopBar+ mode={mode}+ onModeChange={setMode}+ projectTitle={project?.title ?? null}dirty={dirty}- lastSavedAt={lastSavedAt}canExport={hasAsset}- leftCollapsed={leftCollapsed}- rightCollapsed={rightCollapsed}- bottomCollapsed={bottomCollapsed}+ chatOpen={chatOpen}actions={{openProject: () => setOpenProjectOpen(true),newProject: () => setNewProjectOpen(true),save: () => void handleSave(),- saveAs: () => void handleSaveAs(),newRecording: () => void handleNewRecording(),- recorder: handleReturnToRecorder,export: handleExport,- toggleLeft: () => setLeftCollapsed((v) => !v),- toggleRight: () => setRightCollapsed((v) => !v),- toggleBottom: () => setBottomCollapsed((v) => !v),openSettings: handleOpenSettings,renameProject: handleRenameProject,+ toggleChat: () => setChatOpen((v) => !v),}}/>- <main className={styles.workbench}>- {/* Left rail */}- <LeftRail active={leftTab} onChange={setLeftTab} />-- {/* Left content panel */}- {!leftCollapsed ? (- <div className={styles.leftPanel}>+ <div className={v4.body} style={{ gridTemplateColumns: bodyColumns }}>+ {mode === "edit" && chatOpen ? (+ <aside className={v4.agent} aria-label="AI editor"><LeftPanel- active={leftTab}+ active="chat"assetStatuses={assetStatuses}onRegenerateAsset={handleRegenerateAsset}/>- </div>- ) : null}-- {/* Resize handle: left */}- <div- className={`${styles.handle} ${styles.handleCol} ${styles.handleLeft}`}- aria-label="Resize left panel"- onPointerDown={(e) => startResize(e, "left")}- />-- {/* Preview center */}- <Preview- hasProject={hasProject}- hasAsset={hasAsset}- videoSources={videoSources}- clips={clips}- zoomRegions={tl.zoomRegions}- speedRegions={tl.speedRegions}- skipRanges={tl.skipRanges}- selectedZoomRegionId={tl.selection?.kind === "zoom" ? tl.selection.id : null}- onZoomFocusChange={tl.updateZoomFocusLive}- onZoomFocusCommit={() => void tl.commitZoomFocus()}- annotationRegions={tl.annotationRegions}- selectedAnnotationId={tl.selection?.kind === "annotation" ? tl.selection.id : null}- onSelectAnnotation={(id) => tl.selectRegion("annotation", id)}- onAnnotationPositionChange={(id, position) => {- // ponytail: Rnd only calls this once per drag gesture (on- // dragStop, not on every pointermove), so — unlike the zoom- // focus overlay — there's no per-frame IPC risk here; commit- // immediately.- tl.updateAnnotationLive(id, { position });- void tl.commitAnnotationChange();- }}- onAnnotationSizeChange={(id, size) => {- tl.updateAnnotationLive(id, { size });- void tl.commitAnnotationChange();- }}- onAnnotationBlurDataChange={(id, blurData) => tl.updateAnnotationLive(id, { blurData })}- onAnnotationCommit={() => void tl.commitAnnotationChange()}- seekTarget={seekTarget}- onTimeChange={handleTimeChange}- onSeek={handleSeek}- onLoadedMetadata={handleLoadedMetadata}- onVideoElement={setVideoElement}- currentTimeSec={currentTimeSec}- playing={playing}- />-- {/* Resize handle: right */}- <div- className={`${styles.handle} ${styles.handleCol} ${styles.handleRight}`}- aria-label="Resize right panel"- onPointerDown={(e) => startResize(e, "right")}- />-- {/* Right panel stack + rail */}- {!rightCollapsed ? (- <RightPanelStack- active={rightPane}- onChange={setRightPane}- onCrop={() => setCropOpen(true)}- transcripts={document?.transcripts ?? []}- assets={document?.assets ?? []}- clips={clips}- skipRanges={document?.timeline?.skipRanges ?? []}- busy={isTranscribing}- currentTimeSec={currentTimeSec}- onSeek={handleSeek}- onAddSkipRange={handleAddSkipRange}- onRemoveSkipRange={handleRemoveSkipRange}- onTranscribe={handleTranscribe}- canTranscribe={hasAsset}- isTranscribing={isTranscribing}- selection={tl.selection}- onClearSelection={tl.clearSelection}- onRemoveSelection={(kind, id) => void tl.removeRegion(kind, id)}- />- ) : (- <aside className={`${styles.rail} ${styles.rightRail}`} aria-label="Right tools">- <RightRailCompact onChange={setRightPane} onCrop={() => setCropOpen(true)} /></aside>- )}- </main>-- {/* Resize handle: bottom */}- <div- className={`${styles.handle} ${styles.handleRow} ${styles.handleBottom}`}- aria-label="Resize timeline"- onPointerDown={(e) => startResize(e, "bottom")}- />+ ) : null}- {/* Bottom timeline */}- {!bottomCollapsed ? (+ <section className={v4.stage} aria-label="Preview stage">+ {mode === "edit" ? (+ <>+ <div style={{ position: "absolute", inset: 0 }}>+ <Preview+ hasProject={hasProject}+ hasAsset={hasAsset}+ videoSources={videoSources}+ clips={clips}+ zoomRegions={tl.zoomRegions}+ speedRegions={tl.speedRegions}+ skipRanges={tl.skipRanges}+ selectedZoomRegionId={tl.selection?.kind === "zoom" ? tl.selection.id : null}+ onZoomFocusChange={tl.updateZoomFocusLive}+ onZoomFocusCommit={() => void tl.commitZoomFocus()}+ annotationRegions={tl.annotationRegions}+ selectedAnnotationId={+ tl.selection?.kind === "annotation" ? tl.selection.id : null+ }+ onSelectAnnotation={(id) => tl.selectRegion("annotation", id)}+ onAnnotationPositionChange={(id, position) => {+ tl.updateAnnotationLive(id, { position });+ void tl.commitAnnotationChange();+ }}+ onAnnotationSizeChange={(id, size) => {+ tl.updateAnnotationLive(id, { size });+ void tl.commitAnnotationChange();+ }}+ onAnnotationBlurDataChange={(id, blurData) =>+ tl.updateAnnotationLive(id, { blurData })+ }+ onAnnotationCommit={() => void tl.commitAnnotationChange()}+ seekTarget={seekTarget}+ onTimeChange={handleTimeChange}+ onSeek={handleSeek}+ onLoadedMetadata={handleLoadedMetadata}+ onVideoElement={setVideoElement}+ currentTimeSec={currentTimeSec}+ playing={playing}+ />+ </div>+ <FloatingTransport+ playing={playing}+ loop={loop}+ currentTimeSec={currentTimeSec}+ clips={clips}+ onTogglePlay={togglePlay}+ onPrevClip={handlePrevClip}+ onNextClip={handleNextClip}+ onToggleLoop={handleToggleLoop}+ onExpand={handleExpand}+ />+ <FloatingInspector+ facet={facet}+ open={inspectorOpen}+ onFacetChange={(f) => {+ setFacet(f);+ setInspectorOpen(true);+ }}+ onToggleOpen={() => setInspectorOpen((v) => !v)}+ onCrop={() => setCropOpen(true)}+ onCaptions={handleCaptions}+ transcriptProps={transcriptProps}+ />+ </>+ ) : mode === "media" ? (+ <MediaStage assetStatuses={assetStatuses} onRegenerateAsset={handleRegenerateAsset} />+ ) : (+ <RecStage onStartRecording={() => void handleNewRecording()} />+ )}+ </section>+ </div>++ {/* Timeline footer (hidden in Rec mode) */}+ {showTimeline ? (<Bottombarclips={clips}videoSources={videoSources}@@ -1141,6 +1106,8 @@ export function NewEditorShell() {onNextClip={handleNextClip}onToggleLoop={handleToggleLoop}onExpand={handleExpand}+ hideTransport={mode === "edit"}+ timelineVariant={mode === "media" ? "media" : "edit"}/>) : null}@@ -1186,71 +1153,3 @@ export function NewEditorShell() {</div>);}--function RightRailCompact({- onChange,- onCrop,-}: {- onChange: (id: RightPaneId) => void;- onCrop: () => void;-}) {- const buttons: Array<{ id: RightPaneId; label: string; icon: React.ElementType }> = [- { id: "background", label: "Background", icon: Sparkles },- { id: "effects", label: "Video effects", icon: Film },- ];- return (- <>- {buttons.map(({ id, label, icon: Icon }) => (- <button- type="button"- key={id}- title={label}- aria-label={label}- onClick={() => onChange(id)}- >- <Icon size={18} />- </button>- ))}- <button type="button" title="Crop" aria-label="Crop" onClick={onCrop}>- <EyeOff size={18} />- </button>- </>- );-}--function startResize(e: React.PointerEvent<HTMLDivElement>, axis: "left" | "right" | "bottom") {- e.preventDefault();- const target = e.currentTarget;- target.setPointerCapture(e.pointerId);- target.classList.add(styles.isDragging);- document.body.style.cursor = axis === "bottom" ? "row-resize" : "col-resize";-- const root = document.documentElement;- const varName =- axis === "left" ? "--panel-w-left" : axis === "right" ? "--panel-w-right" : "--bottom-h";- const min = axis === "bottom" ? 140 : 200;- const cap = axis === "bottom" ? 0.65 : 0.55;- const max = axis === "bottom" ? window.innerHeight * cap : window.innerWidth * cap;- const startVal = parseFloat(getComputedStyle(root).getPropertyValue(varName)) || 0;- const startX = e.clientX;- const startY = e.clientY;-- const onMove = (ev: PointerEvent) => {- let next: number;- if (axis === "left") next = startVal + (ev.clientX - startX);- else if (axis === "right") next = startVal - (ev.clientX - startX);- else next = startVal + (startY - ev.clientY);- next = Math.max(min, Math.min(next, max));- root.style.setProperty(varName, `${next}px`);- };- const onUp = () => {- target.classList.remove(styles.isDragging);- document.body.style.cursor = "";- target.removeEventListener("pointermove", onMove);- target.removeEventListener("pointerup", onUp);- target.removeEventListener("pointercancel", onUp);- };- target.addEventListener("pointermove", onMove);- target.addEventListener("pointerup", onUp);- target.addEventListener("pointercancel", onUp);-}diff --git a/src/components/ai-edition/RegionTimeline.tsx b/src/components/ai-edition/RegionTimeline.tsxindex 66cc04bbd..2fe63f996 100644--- a/src/components/ai-edition/RegionTimeline.tsx+++ b/src/components/ai-edition/RegionTimeline.tsx@@ -12,7 +12,7 @@ import {export type { Span };-import { createContext, useCallback, useContext, useState } from "react";+import { Children, createContext, useCallback, useContext, useState } from "react";import { formatMs } from "@/lib/ai-edition/timeline/format";import styles from "./NewEditorShell.module.css";@@ -237,9 +237,12 @@ export function RegionRow({children: React.ReactNode;}) {const { setNodeRef, rowStyle, rowWrapperStyle } = useRow({ id });+ // v4 design: the lane's watermark label only shows while the lane is empty —+ // once it holds pills, the label is hidden (design skipsLaneLabel etc.).+ const hasChildren = Children.count(children) > 0;return (<div style={rowWrapperStyle} className={styles.laneTrackRow}>- {empty ? <span className={styles.laneEmpty}>{empty}</span> : null}+ {empty && !hasChildren ? <span className={styles.laneEmpty}>{empty}</span> : null}<div ref={setNodeRef} style={rowStyle}>{children}</div>diff --git a/src/components/ai-edition/TimelinePane.module.css b/src/components/ai-edition/TimelinePane.module.cssindex 8b65f18b7..6c76d07bc 100644--- a/src/components/ai-edition/TimelinePane.module.css+++ b/src/components/ai-edition/TimelinePane.module.css@@ -121,10 +121,11 @@ body:global(.timeline-placing-cut) [class*="vtBtn"] {left: 2px;top: 0;font-family: var(--font-mono);- font-size: 11px;+ font-size: 10px;font-weight: 500;letter-spacing: 0.02em;- color: var(--muted);+ /* v4 design ruler labels read in --meta. */+ color: var(--meta);white-space: nowrap;pointer-events: none;}@@ -156,9 +157,10 @@ body:global(.timeline-placing-cut) [class*="vtBtn"] {min-width: 68px;display: flex;flex-direction: column;- background: var(--surface-2);- border: 1px solid var(--border);- border-radius: var(--r-md);+ /* v4 design clip card: --surface-1 fill, 1.5px frame, 11px radius. */+ background: var(--surface-1);+ border: 1.5px solid var(--border);+ border-radius: 11px;box-shadow: var(--elev-card-soft);cursor: grab;overflow: hidden;@@ -183,12 +185,13 @@ body:global(.timeline-placing-cut) [class*="vtBtn"] {}.trackVisual {- flex: 0 0 auto;- height: 26px;+ /* v4 design: the waveform fills the whole clip card; the label + delete+ float over it as blur chips (see .trackInfo / .clipDelete). */+ position: absolute;+ inset: 0;display: flex;overflow: hidden;background: var(--surface);- border-bottom: 1px solid var(--border);}.segment {height: 100%;@@ -254,26 +257,35 @@ body:global(.timeline-placing-cut) [class*="vtBtn"] {}.trackInfo {- flex: 1;- min-height: 0;- display: flex;+ /* Floating label chip, top-left over the waveform (v4 design). */+ position: absolute;+ top: 8px;+ left: 10px;+ right: 40px;+ z-index: 2;+ display: inline-flex;align-items: center;- gap: 10px;- padding: 10px 12px;+ gap: 8px;+ width: max-content;+ max-width: calc(100% - 50px);+ padding: 3px 9px 3px 6px;+ border-radius: 8px;+ background: color-mix(in srgb, #080a0d 55%, transparent);+ border: 1px solid rgba(255, 255, 255, 0.08);+ backdrop-filter: blur(8px);+ -webkit-backdrop-filter: blur(8px);overflow: hidden;}.editIcon {flex: 0 0 auto;- width: 30px;- height: 30px;- display: flex;- align-items: center;- justify-content: center;+ width: 16px;+ height: 16px;+ display: grid;+ place-items: center;background: var(--surface);- border: 1px solid var(--border);- border-radius: var(--r-sm);+ border: 0;+ border-radius: 5px;color: var(--fg);- box-shadow: var(--elev-card-soft);cursor: pointer;transition:border-color var(--motion-fast) var(--ease),@@ -286,44 +298,41 @@ body:global(.timeline-placing-cut) [class*="vtBtn"] {.trackText {display: flex;flex-direction: column;- gap: 2px;min-width: 0;flex: 1;}.trackTitle {margin: 0;- font-size: 13px;+ font-size: 11px;font-weight: 500;letter-spacing: -0.005em;- color: var(--fg);+ color: #fff;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}+/* v4 design: the clip chip shows only the filename — the range/source+ readout is not part of the floating label. */.trackSubtitle {- margin: 0;- font-family: var(--font-mono);- font-size: 10.5px;- letter-spacing: 0.02em;- color: var(--muted);- white-space: nowrap;- overflow: hidden;- text-overflow: ellipsis;-}-.trackSubtitle span {- margin: 0 4px;- color: var(--dim);+ display: none;}.clipDelete {- flex: 0 0 auto;+ /* Floating delete, top-right over the waveform (v4 design), shown on+ hover / selection. */+ position: absolute;+ top: 8px;+ right: 8px;+ z-index: 2;width: 26px;height: 26px;display: flex;align-items: center;justify-content: center;- background: transparent;- border: 0;- border-radius: var(--r-sm);+ background: color-mix(in srgb, #080a0d 55%, transparent);+ border: 1px solid rgba(255, 255, 255, 0.08);+ backdrop-filter: blur(8px);+ -webkit-backdrop-filter: blur(8px);+ border-radius: 7px;color: var(--muted);cursor: pointer;opacity: 0;@@ -545,10 +554,10 @@ body:global(.timeline-placing-cut) [class*="vtBtn"] {height: 1.15rem;flex-shrink: 0;margin: 4px var(--sp-3) 4px var(--sp-3);- border: 1px solid var(--border-soft);- border-radius: 6px;- background: color-mix(in oklch, var(--surface-2) 60%, transparent);- overflow: hidden;+ border-radius: 3px;+ /* v4 design: a subtle grey track (--surface-3), no border. */+ background: var(--surface-3);+ overflow: visible;}.timelineNavigator.navigating {border-color: var(--accent);@@ -571,15 +580,14 @@ body:global(.timeline-placing-cut) [class*="vtBtn"] {}.timelineNavigatorWindow {position: absolute;- top: 0;- bottom: 0;+ top: 50%;+ transform: translateY(-50%);+ height: calc(100% + 4px);min-width: 1.8rem;- border: 2px solid color-mix(in oklch, var(--accent) 92%, transparent);- border-radius: 6px;- background: color-mix(in oklch, var(--accent) 16%, transparent);- box-shadow:- 0 0 0 1px rgba(0, 0, 0, 0.45),- inset 0 0 0 1px rgba(0, 0, 0, 0.25);+ /* v4 design: neutral raised window (--surface-hi) with a --border-hi frame. */+ border: 1px solid var(--border-hi);+ border-radius: 5px;+ background: var(--surface-hi);cursor: grab;}.timelineNavigator.navigating .timelineNavigatorWindow {@@ -588,14 +596,29 @@ body:global(.timeline-placing-cut) [class*="vtBtn"] {.timelineNavigatorHandleStart,.timelineNavigatorHandleEnd {position: absolute;- top: 0;- bottom: 0;- width: 6px;+ top: 50%;+ transform: translateY(-50%);+ width: 12px;+ height: calc(100% + 8px);+ display: flex;+ align-items: center;+ justify-content: center;cursor: ew-resize;+ z-index: 3;+}+/* grip bar per the v4 design (4px wide, --fg-2, haloed by the track). */+.timelineNavigatorHandleStart::after,+.timelineNavigatorHandleEnd::after {+ content: "";+ width: 4px;+ height: 14px;+ border-radius: 2px;+ background: var(--fg-2);+ box-shadow: 0 0 0 2px var(--surface);}.timelineNavigatorHandleStart {- left: 0;+ left: -6px;}.timelineNavigatorHandleEnd {- right: 0;+ right: -6px;}diff --git a/src/components/ai-edition/TimelinePane.tsx b/src/components/ai-edition/TimelinePane.tsxindex 1a498ccd6..79632e341 100644--- a/src/components/ai-edition/TimelinePane.tsx+++ b/src/components/ai-edition/TimelinePane.tsx@@ -1068,7 +1068,7 @@ export function TimelinePane({onEditClip(clip);}}>- <Pencil size={13} />+ <Pencil size={9} /></button><div className={styles.trackText}><h3 className={styles.trackTitle}>{assetLabel(clip.assetId)}</h3>diff --git a/src/components/ai-edition/v4/EditorShellV4.module.css b/src/components/ai-edition/v4/EditorShellV4.module.cssnew file mode 100644index 000000000..8f6c9889f--- /dev/null+++ b/src/components/ai-edition/v4/EditorShellV4.module.css@@ -0,0 +1,711 @@+/* OpenScreen Editor v4 shell — Media / Edit / Rec modes.+ * Ported 1:1 from design/OpenScreen Editor v4.dc.html. All colors read the+ * global --* design tokens (src/styles/design-tokens.css); dark is the hero+ * look, light is a full token swap handled by the token layer. */++.app {+ display: grid;+ height: 100vh;+ width: 100%;+ min-width: 0;+ background: var(--bg);+ color: var(--fg);+ font-family: var(--font-display);+ font-size: 13px;+ line-height: 1.5;+ overflow: hidden;+ -webkit-font-smoothing: antialiased;+}+/* rows set inline per mode (topbar / body / timeline) */++/* ─── TOP BAR ──────────────────────────────────────────────────────── */+.topbar {+ grid-row: 1;+ display: flex;+ align-items: center;+ gap: 14px;+ padding: 0 18px;+ background: transparent;+ border-bottom: 1px solid var(--border-soft);+ min-width: 0;+ -webkit-app-region: drag;+ app-region: drag;+}+.topbar button,+.topbar input,+.topbar select {+ -webkit-app-region: no-drag;+ app-region: no-drag;+}+.sep {+ width: 1px;+ height: 18px;+ background: var(--border);+ flex-shrink: 0;+}+.brand {+ display: inline-flex;+ align-items: center;+ gap: 9px;+ flex-shrink: 0;+}+.brand img,+.brand .mark {+ width: 22px;+ height: 22px;+ object-fit: contain;+ border-radius: 6px;+ display: grid;+ place-items: center;+ background: var(--accent);+ color: #fff;+ font: 600 12px/1 var(--font-display);+}+.brand .name {+ font-size: 15px;+ font-weight: 600;+ letter-spacing: -0.015em;+ color: var(--fg-emphasis);+}+.iconBtn {+ width: 32px;+ height: 32px;+ display: grid;+ place-items: center;+ border-radius: 9px;+ color: var(--muted);+ background: transparent;+ border: 0;+ cursor: pointer;+ flex-shrink: 0;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.iconBtn:hover {+ background: var(--surface-2);+ color: var(--fg);+}+.iconBtn:disabled {+ opacity: 0.45;+ cursor: not-allowed;+}+.iconBtn.on {+ background: var(--accent-soft);+ color: var(--accent);+}+.ghostBtn {+ display: inline-flex;+ align-items: center;+ gap: 7px;+ height: 30px;+ padding: 0 8px 0 10px;+ border-radius: 9px;+ background: transparent;+ border: 1px solid transparent;+ color: var(--fg-2);+ font-size: 13px;+ font-weight: 500;+ cursor: pointer;+ flex-shrink: 0;+ transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease);+}+.ghostBtn:hover {+ background: var(--surface-1);+ border-color: var(--border);+}+.saved {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ font-family: var(--font-mono);+ font-size: 11px;+ color: var(--muted);+ flex-shrink: 0;+}+.saved .dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--accent);+ box-shadow: 0 0 0 3px var(--accent-soft);+}++/* mode switch (Media / Edit / Rec) */+.modeSwitch {+ margin: 0 auto;+ display: inline-flex;+ align-items: center;+ gap: 2px;+ padding: 3px;+ background: var(--surface-1);+ border: 1px solid var(--border);+ border-radius: 11px;+ flex-shrink: 0;+}+.modeSwitch button {+ padding: 5px 14px;+ border: 0;+ border-radius: 7px;+ background: transparent;+ color: var(--muted);+ font-size: 11.5px;+ font-weight: 500;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.modeSwitch button[aria-selected="true"] {+ background: var(--surface-3);+ color: var(--fg-emphasis);+ font-weight: 600;+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);+}+.exportBtn {+ display: inline-flex;+ align-items: center;+ gap: 7px;+ height: 32px;+ padding: 0 14px;+ border-radius: 9px;+ background: var(--accent);+ color: #fff;+ border: 1px solid var(--accent);+ font-size: 13px;+ font-weight: 600;+ cursor: pointer;+ flex-shrink: 0;+ box-shadow: 0 2px 10px -3px var(--accent-soft);+ transition: background var(--motion-fast) var(--ease);+}+.exportBtn:hover {+ background: var(--brand-lo);+}+.exportBtn:disabled {+ opacity: 0.5;+ cursor: not-allowed;+}++/* ─── BODY ─────────────────────────────────────────────────────────── */+.body {+ grid-row: 2;+ display: grid;+ min-height: 0;+ min-width: 0;+}+.agent {+ display: flex;+ flex-direction: column;+ min-height: 0;+ min-width: 0;+ background: var(--surface);+ border-right: 1px solid var(--border);+ overflow: hidden;+}+.stage {+ position: relative;+ min-width: 0;+ min-height: 0;+ overflow: hidden;+ background: radial-gradient(ellipse 68% 54% at 52% 32%, var(--surface-1) 0%, var(--bg) 66%);+}++/* ─── FLOATING INSPECTOR + FACET RAIL ──────────────────────────────── */+.inspectorWrap {+ position: absolute;+ top: 20px;+ right: 20px;+ bottom: 96px;+ display: flex;+ align-items: flex-start;+ gap: 10px;+ z-index: 20;+ pointer-events: none;+}+.inspectorWrap.tall {+ bottom: 16px;+}+.inspector {+ pointer-events: auto;+ width: 300px;+ max-height: 100%;+ display: flex;+ flex-direction: column;+ background: var(--surface-1);+ border: 1px solid var(--border);+ border-radius: 16px;+ box-shadow: var(--elev-pop);+ overflow: hidden;+ backdrop-filter: blur(18px);+ -webkit-backdrop-filter: blur(18px);+}+.inspector :global(.pane) {+ display: flex;+ flex-direction: column;+ min-height: 0;+}+.facetRail {+ pointer-events: auto;+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 4px;+ padding: 6px;+ background: var(--surface-1);+ border: 1px solid var(--border);+ border-radius: 14px;+ box-shadow: var(--elev-pop);+ backdrop-filter: blur(18px);+ -webkit-backdrop-filter: blur(18px);+}+.facetRail button {+ width: 38px;+ height: 38px;+ display: grid;+ place-items: center;+ border-radius: 10px;+ color: var(--muted);+ background: transparent;+ border: 0;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.facetRail button:hover {+ background: var(--surface-3);+ color: var(--fg);+}+.facetRail button[aria-pressed="true"] {+ color: var(--accent);+ background: var(--accent-soft);+}++/* ─── FLOATING TRANSPORT (Edit mode) ───────────────────────────────── */+.transportWrap {+ position: absolute;+ left: 0;+ right: 0;+ bottom: 22px;+ display: flex;+ justify-content: center;+ z-index: 15;+ pointer-events: none;+}+.transport {+ pointer-events: auto;+ display: inline-flex;+ align-items: center;+ gap: 8px;+ padding: 8px 10px;+ border-radius: 16px;+ background: var(--surface-1);+ border: 1px solid var(--border);+ box-shadow: var(--elev-pop);+}+.transport .tbtn {+ width: 34px;+ height: 34px;+ display: grid;+ place-items: center;+ border-radius: 9px;+ color: var(--fg-2);+ background: transparent;+ border: 0;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.transport .tbtn:hover {+ background: var(--surface-3);+ color: var(--fg);+}+.transport .tbtn.on {+ color: var(--accent);+ background: var(--accent-soft);+}+.transport .play {+ width: 44px;+ height: 44px;+ border-radius: 12px;+ background: var(--accent);+ color: #fff;+ box-shadow: 0 4px 14px -4px var(--accent-soft);+}+.transport .play:hover {+ background: var(--brand-lo);+ color: #fff;+}+.transport .time {+ font-family: var(--font-mono);+ font-size: 13px;+ color: var(--fg);+ min-width: 104px;+ text-align: center;+}+.transport .time b {+ font-weight: 600;+}+.transport .time .slash {+ color: var(--meta);+ margin: 0 5px;+}+.transport .time .total {+ color: var(--muted);+}+.transport .vsep {+ width: 1px;+ height: 22px;+ background: var(--border);+ margin: 0 2px;+}++/* ─── TIMELINE FOOTER ──────────────────────────────────────────────── */+.timeline {+ grid-row: 3;+ position: relative;+ background: var(--surface);+ border-top: 1px solid var(--border);+ min-height: 0;+ display: flex;+ flex-direction: column;+ overflow: hidden;+}++/* ─── MEDIA STAGE ──────────────────────────────────────────────────── */+.mediaStage {+ position: absolute;+ inset: 0;+ display: flex;+ flex-direction: column;+ padding: 32px 48px;+ overflow: hidden;+}+.mediaInner {+ width: 100%;+ margin: 0 auto;+ display: flex;+ flex-direction: column;+ min-height: 0;+ flex: 1;+}+.mediaSearchRow {+ display: flex;+ align-items: center;+ gap: 10px;+ margin-bottom: 16px;+}+.mediaSearchRow input {+ flex: 1;+ min-width: 0;+ padding: 10px 14px;+ border: 1px solid var(--border);+ border-radius: 10px;+ background: var(--surface-1);+ outline: none;+ font-size: 13px;+ color: var(--fg-2);+ font-family: var(--font-display);+}+.mediaCols {+ display: flex;+ gap: 24px;+ min-height: 0;+ flex: 1;+ overflow: hidden;+}+.mediaListCol {+ flex: 1;+ min-width: 0;+ display: flex;+ flex-direction: column;+ min-height: 0;+}+.mediaGrid {+ overflow-y: auto;+ min-height: 0;+ display: grid;+ gap: 14px;+ padding-bottom: 14px;+ scrollbar-width: thin;+ scrollbar-color: var(--border-hi) transparent;+}+.mediaCard {+ display: flex;+ flex-direction: column;+ padding: 0;+ border: 1.5px solid var(--border);+ border-radius: 12px;+ background: var(--surface);+ overflow: hidden;+ cursor: grab;+ text-align: left;+ transition: border-color var(--motion-fast) var(--ease);+}+.mediaCard:hover {+ border-color: var(--border-hi);+}+.mediaCard.selected {+ border-color: var(--accent);+}+.mediaThumb {+ position: relative;+ height: 84px;+ display: grid;+ place-items: center;+ color: rgba(255, 255, 255, 0.9);+}+.mediaCardMeta {+ display: flex;+ align-items: center;+ gap: 7px;+ padding: 10px 12px;+}+.mediaCardMeta .body {+ min-width: 0;+ flex: 1;+}+.mediaCardName {+ font-size: 12.5px;+ font-weight: 600;+ color: var(--fg);+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+}+.mediaCardStats {+ display: flex;+ justify-content: space-between;+ gap: 8px;+}+.mediaCardStats .dur {+ font-family: var(--font-mono);+ font-size: 10.5px;+ color: var(--muted);+}+.mediaCardStats .size {+ font-family: var(--font-mono);+ font-size: 10.5px;+ color: var(--meta);+}+.mediaHint {+ display: flex;+ align-items: center;+ justify-content: center;+ gap: 7px;+ padding: 7px 0 3px;+ color: var(--meta);+ font-size: 11.5px;+}+.importBtn {+ display: flex;+ align-items: center;+ justify-content: center;+ gap: 8px;+ margin-top: 8px;+ padding: 13px;+ border: 1px dashed var(--border-hi);+ border-radius: 12px;+ background: transparent;+ color: var(--muted);+ font-size: 13px;+ font-weight: 600;+ cursor: pointer;+ transition: border-color var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease);+}+.importBtn:hover {+ border-color: var(--accent);+ color: var(--accent);+ background: var(--accent-wash);+}+.mediaDetail {+ width: 400px;+ flex-shrink: 0;+ display: flex;+ flex-direction: column;+ min-height: 0;+ padding: 20px 22px;+ background: var(--surface-1);+ border: 1px solid var(--border);+ border-radius: 16px;+ overflow-y: auto;+ scrollbar-width: thin;+ scrollbar-color: var(--border-hi) transparent;+}++/* ─── REC STAGE ────────────────────────────────────────────────────── */+.recStage {+ position: absolute;+ inset: 0;+ display: flex;+ align-items: center;+ justify-content: center;+ padding: 24px 48px 110px;+}+.recFrame {+ position: relative;+ aspect-ratio: 16 / 9;+ width: 100%;+ max-width: 820px;+ max-height: 100%;+ background: linear-gradient(135deg, #1a1c22, #0e0f14);+ border-radius: 16px;+ box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.75), 0 12px 28px -12px rgba(0, 0, 0, 0.5),+ inset 0 0 0 1px rgba(255, 255, 255, 0.09);+ overflow: hidden;+ display: grid;+ place-items: center;+}+.recBadge {+ position: absolute;+ top: 16px;+ left: 16px;+ display: inline-flex;+ align-items: center;+ gap: 8px;+ padding: 6px 12px 6px 8px;+ border-radius: 9999px;+ background: rgba(8, 10, 13, 0.5);+ backdrop-filter: blur(12px);+ -webkit-backdrop-filter: blur(12px);+ border: 1px solid rgba(255, 255, 255, 0.14);+ color: #fff;+ font-family: var(--font-mono);+ font-size: 11px;+}+.recDot {+ width: 7px;+ height: 7px;+ border-radius: 50%;+ background: var(--danger);+}+.recBarWrap {+ position: absolute;+ bottom: 22px;+ left: 0;+ right: 0;+ display: flex;+ justify-content: center;+}+.recBar {+ display: inline-flex;+ align-items: center;+ gap: 3px;+ padding: 5px;+ border-radius: 16px;+ background: rgba(20, 22, 27, 0.72);+ backdrop-filter: blur(20px) saturate(1.4);+ -webkit-backdrop-filter: blur(20px) saturate(1.4);+ border: 1px solid rgba(255, 255, 255, 0.12);+ box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);+}+.recBarBtn {+ display: inline-flex;+ align-items: center;+ gap: 7px;+ height: 36px;+ padding: 0 12px;+ border-radius: 10px;+ border: 0;+ background: rgba(255, 255, 255, 0.1);+ color: #fff;+ font-size: 12.5px;+ font-weight: 500;+ cursor: pointer;+ white-space: nowrap;+ transition: background var(--motion-fast) var(--ease);+}+.recBarBtn:hover {+ background: rgba(255, 255, 255, 0.16);+}+.recIconBtn {+ width: 36px;+ height: 36px;+ display: grid;+ place-items: center;+ border-radius: 10px;+ border: 0;+ background: transparent;+ color: rgba(255, 255, 255, 0.72);+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.recIconBtn:hover {+ background: rgba(255, 255, 255, 0.14);+ color: #fff;+}+.recIconBtn.on {+ background: var(--accent-soft);+ color: var(--accent);+}+.recBarSep {+ width: 1px;+ height: 20px;+ background: rgba(255, 255, 255, 0.14);+ margin: 0 3px;+}+.recMenu {+ position: absolute;+ bottom: 46px;+ min-width: 210px;+ background: var(--surface-1);+ border: 1px solid var(--border);+ border-radius: 12px;+ box-shadow: var(--elev-pop);+ padding: 6px;+ z-index: 30;+}+.recMenuRow {+ display: flex;+ align-items: center;+ gap: 8px;+ width: 100%;+ padding: 8px 10px;+ border-radius: 8px;+ border: 0;+ background: transparent;+ color: var(--fg-2);+ font-size: 12.5px;+ font-weight: 500;+ cursor: pointer;+ text-align: left;+}+.recMenuRow:hover {+ background: var(--surface-2);+}+.recMenuRow.active {+ background: var(--accent-soft);+ color: var(--accent);+}+.bigRecWrap {+ position: absolute;+ left: 0;+ right: 0;+ bottom: 22px;+ display: flex;+ justify-content: center;+ z-index: 15;+}+.bigRecBtn {+ display: inline-flex;+ align-items: center;+ gap: 10px;+ height: 52px;+ padding: 0 26px;+ border-radius: 16px;+ border: 1px solid var(--accent);+ color: #fff;+ background: var(--accent);+ font-size: 14px;+ font-weight: 600;+ cursor: pointer;+ box-shadow: 0 4px 16px -4px var(--accent-soft);+ transition: background var(--motion-fast) var(--ease);+}+.bigRecBtn:hover {+ background: var(--brand-lo);+}+.bigRecBtn.recording {+ border-color: var(--danger);+ background: var(--danger);+}+.bigRecDot {+ width: 10px;+ height: 10px;+ border-radius: 50%;+ background: #fff;+}diff --git a/src/components/ai-edition/v4/EditorTopBar.tsx b/src/components/ai-edition/v4/EditorTopBar.tsxnew file mode 100644index 000000000..d45a43072--- /dev/null+++ b/src/components/ai-edition/v4/EditorTopBar.tsx@@ -0,0 +1,356 @@+import {+ ChevronDown,+ Download,+ FolderOpen,+ FolderPlus,+ Languages,+ Moon,+ PanelLeft,+ Save,+ Settings,+ Sun,+ Video,+} from "lucide-react";+import { useEffect, useRef, useState } from "react";+import { useI18n } from "@/contexts/I18nContext";+import { useTheme } from "@/hooks/useTheme";+import type { Locale } from "@/i18n/config";+import styles from "./EditorShellV4.module.css";++export type EditorMode = "media" | "edit" | "rec";++export interface TopBarActions {+ openProject: () => void;+ newProject: () => void;+ save: () => void;+ newRecording: () => void;+ export: () => void;+ openSettings: () => void;+ renameProject: (title: string) => void;+ toggleChat: () => void;+}++interface EditorTopBarProps {+ mode: EditorMode;+ onModeChange: (mode: EditorMode) => void;+ projectTitle: string | null;+ dirty: boolean;+ canExport: boolean;+ chatOpen: boolean;+ actions: TopBarActions;+}++const LANGS: Array<{ code: string; label: string }> = [+ { code: "en", label: "English" },+ { code: "fr", label: "Français" },+ { code: "es", label: "Español" },+ { code: "de", label: "Deutsch" },+ { code: "it", label: "Italiano" },+ { code: "ja-JP", label: "日本語" },+ { code: "ko-KR", label: "한국어" },+ { code: "pt-BR", label: "Português (BR)" },+ { code: "ru", label: "Русский" },+ { code: "tr", label: "Türkçe" },+ { code: "vi", label: "Tiếng Việt" },+ { code: "zh-CN", label: "简体中文" },+ { code: "zh-TW", label: "繁體中文" },+];++const MODES: Array<{ id: EditorMode; label: string }> = [+ { id: "media", label: "Media" },+ { id: "edit", label: "Edit" },+ { id: "rec", label: "Rec" },+];++export function EditorTopBar({+ mode,+ onModeChange,+ projectTitle,+ dirty,+ canExport,+ chatOpen,+ actions,+}: EditorTopBarProps) {+ const { theme, toggle: toggleTheme } = useTheme();++ return (+ <header className={styles.topbar}>+ <button+ type="button"+ className={`${styles.iconBtn}${chatOpen ? ` ${styles.on}` : ""}`}+ title="Toggle chat panel"+ aria-label="Toggle chat panel"+ aria-pressed={chatOpen}+ onClick={actions.toggleChat}+ >+ <PanelLeft size={17} />+ </button>+ <span className={styles.sep} aria-hidden />+ <span className={styles.brand}>+ <span className={styles.mark} aria-hidden>+ O+ </span>+ <span className={styles.name}>OpenScreen</span>+ </span>+ <span className={styles.sep} aria-hidden />+ <ProjectNameField title={projectTitle} onRename={actions.renameProject} />+ <span className={styles.sep} aria-hidden />+ <button+ type="button"+ className={styles.iconBtn}+ title="Open project"+ aria-label="Open project"+ onClick={actions.openProject}+ >+ <FolderOpen size={16} />+ </button>+ <button+ type="button"+ className={styles.iconBtn}+ title="New project"+ aria-label="New project"+ onClick={actions.newProject}+ >+ <FolderPlus size={16} />+ </button>+ <button+ type="button"+ className={styles.iconBtn}+ title="Save project"+ aria-label="Save project"+ onClick={actions.save}+ style={{ position: "relative" }}+ >+ <Save size={16} />+ {dirty ? (+ <span+ aria-hidden+ style={{+ position: "absolute",+ top: 5,+ right: 5,+ width: 6,+ height: 6,+ borderRadius: "50%",+ background: "var(--warn)",+ }}+ />+ ) : null}+ </button>+ <span className={styles.sep} aria-hidden />+ <LangButton />+ <span className={styles.saved}>+ {dirty ? (+ <>+ <span+ className={styles.dot}+ aria-hidden+ style={{ background: "var(--warn)", boxShadow: "0 0 0 3px var(--warn-soft)" }}+ />+ Unsaved+ </>+ ) : (+ <>+ <span className={styles.dot} aria-hidden />+ Saved+ </>+ )}+ </span>++ <div className={styles.modeSwitch} role="tablist" aria-label="Editor mode">+ {MODES.map((m) => (+ <button+ key={m.id}+ type="button"+ role="tab"+ aria-selected={mode === m.id}+ onClick={() => onModeChange(m.id)}+ >+ {m.label}+ </button>+ ))}+ </div>++ <button+ type="button"+ className={styles.iconBtn}+ title="New recording"+ aria-label="New recording"+ onClick={actions.newRecording}+ >+ <Video size={16} />+ </button>+ <button+ type="button"+ className={styles.iconBtn}+ title={theme === "dark" ? "Switch to light theme" : "Switch to dark theme"}+ aria-label="Toggle theme"+ onClick={toggleTheme}+ >+ {theme === "dark" ? <Moon size={16} /> : <Sun size={16} />}+ </button>+ <button+ type="button"+ className={styles.iconBtn}+ title="Settings"+ aria-label="Settings"+ onClick={actions.openSettings}+ >+ <Settings size={16} />+ </button>+ <button+ type="button"+ className={styles.exportBtn}+ title="Export"+ aria-label="Export"+ onClick={actions.export}+ disabled={!canExport}+ >+ <Download size={15} />+ Export+ </button>+ </header>+ );+}++function ProjectNameField({+ title,+ onRename,+}: {+ title: string | null;+ onRename: (title: string) => void;+}) {+ const [editing, setEditing] = useState(false);+ const [draft, setDraft] = useState(title ?? "");+ const inputRef = useRef<HTMLInputElement | null>(null);++ useEffect(() => {+ if (editing) {+ setDraft(title ?? "");+ inputRef.current?.select();+ }+ }, [editing, title]);++ const commit = () => {+ setEditing(false);+ const next = draft.trim();+ if (next && next !== title) onRename(next);+ };++ if (editing) {+ return (+ <input+ ref={inputRef}+ value={draft}+ onChange={(e) => setDraft(e.target.value)}+ onBlur={commit}+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ e.preventDefault();+ commit();+ } else if (e.key === "Escape") {+ setEditing(false);+ }+ }}+ style={{+ height: 30,+ minWidth: 160,+ padding: "0 10px",+ borderRadius: 9,+ border: "1px solid var(--accent)",+ background: "var(--surface)",+ color: "var(--fg)",+ font: "500 13px var(--font-display)",+ outline: "none",+ }}+ />+ );+ }++ return (+ <button+ type="button"+ className={styles.ghostBtn}+ title="Rename project"+ aria-label="Rename project"+ disabled={!title}+ onClick={() => setEditing(true)}+ >+ <span>{title ?? "No project"}</span>+ <ChevronDown size={11} style={{ color: "var(--muted)" }} />+ </button>+ );+}++function LangButton() {+ const { locale, setLocale } = useI18n();+ const [open, setOpen] = useState(false);+ const ref = useRef<HTMLDivElement | null>(null);+ useEffect(() => {+ if (!open) return;+ const onDocClick = (e: MouseEvent) => {+ if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);+ };+ document.addEventListener("mousedown", onDocClick);+ return () => document.removeEventListener("mousedown", onDocClick);+ }, [open]);+ return (+ <div ref={ref} style={{ position: "relative", flexShrink: 0 }}>+ <button+ type="button"+ className={styles.iconBtn}+ style={{ width: "auto", padding: "0 8px", gap: 6, display: "inline-flex" }}+ onClick={() => setOpen((v) => !v)}+ aria-label="Change language"+ aria-pressed={open}+ >+ <Languages size={15} />+ <span style={{ fontFamily: "var(--font-mono)", fontSize: 11, fontWeight: 600 }}>+ {locale.toUpperCase()}+ </span>+ <ChevronDown size={9} style={{ color: "var(--muted)" }} />+ </button>+ {open ? (+ <div+ style={{+ position: "absolute",+ top: "calc(100% + 4px)",+ right: 0,+ minWidth: 160,+ background: "var(--surface)",+ border: "1px solid var(--border)",+ borderRadius: "var(--r-md)",+ boxShadow: "var(--elev-pop)",+ padding: 4,+ zIndex: 60,+ }}+ >+ {LANGS.map((l) => (+ <button+ key={l.code}+ type="button"+ style={{+ display: "block",+ width: "100%",+ textAlign: "left",+ padding: "6px 10px",+ border: 0,+ background: l.code === locale ? "var(--accent-wash)" : "transparent",+ color: l.code === locale ? "var(--accent)" : "var(--fg-2)",+ borderRadius: "var(--r-sm)",+ cursor: "pointer",+ font: "500 12px var(--font-body)",+ }}+ onClick={() => {+ setLocale(l.code as Locale);+ setOpen(false);+ }}+ >+ {l.label}+ </button>+ ))}+ </div>+ ) : null}+ </div>+ );+}diff --git a/src/components/ai-edition/v4/FloatingInspector.tsx b/src/components/ai-edition/v4/FloatingInspector.tsxnew file mode 100644index 000000000..6900ceb96--- /dev/null+++ b/src/components/ai-edition/v4/FloatingInspector.tsx@@ -0,0 +1,260 @@+import {+ Captions as CaptionsIcon,+ ChevronRight,+ Crop as CropIcon,+ FileText,+ GitFork,+ Image as ImageIcon,+ Layout as LayoutIcon,+ MousePointer2,+ SlidersHorizontal,+} from "lucide-react";+import type { ComponentProps } from "react";+import {+ BackgroundPane,+ CursorPane,+ LayoutPane,+ TranscriptPane,+ VideoEffectsPane,+} from "../RightPanes";+import styles from "./EditorShellV4.module.css";++export type Facet =+ | "background"+ | "effects"+ | "layout"+ | "cursor"+ | "captions"+ | "chapters"+ | "transcript"+ | "crop";++const FACETS: Array<{ id: Facet; label: string; icon: typeof ImageIcon }> = [+ { id: "background", label: "Background", icon: ImageIcon },+ { id: "effects", label: "Effects", icon: SlidersHorizontal },+ { id: "layout", label: "Layout", icon: LayoutIcon },+ { id: "cursor", label: "Cursor", icon: MousePointer2 },+ { id: "captions", label: "Captions", icon: CaptionsIcon },+ { id: "chapters", label: "Chapters", icon: GitFork },+ { id: "transcript", label: "Transcript", icon: FileText },+ { id: "crop", label: "Crop", icon: CropIcon },+];++type TranscriptProps = ComponentProps<typeof TranscriptPane>;++interface FloatingInspectorProps {+ facet: Facet;+ open: boolean;+ onFacetChange: (facet: Facet) => void;+ onToggleOpen: () => void;+ onCrop: () => void;+ onCaptions: () => void;+ transcriptProps: TranscriptProps;+}++export function FloatingInspector({+ facet,+ open,+ onFacetChange,+ onToggleOpen,+ onCrop,+ onCaptions,+ transcriptProps,+}: FloatingInspectorProps) {+ const isTranscript = facet === "transcript";+ return (+ <div className={`${styles.inspectorWrap}${isTranscript ? ` ${styles.tall}` : ""}`}>+ {open ? (+ <div className={styles.inspector}>+ <FacetBody+ facet={facet}+ onCrop={onCrop}+ onCaptions={onCaptions}+ onCollapse={onToggleOpen}+ transcriptProps={transcriptProps}+ />+ </div>+ ) : null}+ <div className={styles.facetRail}>+ {FACETS.map(({ id, label, icon: Icon }) => (+ <button+ key={id}+ type="button"+ title={label}+ aria-label={label}+ aria-pressed={open && facet === id}+ onClick={() => {+ if (facet === id && open) {+ onToggleOpen();+ } else {+ onFacetChange(id);+ }+ }}+ >+ <Icon size={17} />+ </button>+ ))}+ </div>+ </div>+ );+}++function FacetBody({+ facet,+ onCrop,+ onCaptions,+ onCollapse,+ transcriptProps,+}: {+ facet: Facet;+ onCrop: () => void;+ onCaptions: () => void;+ onCollapse: () => void;+ transcriptProps: TranscriptProps;+}) {+ // A small collapse affordance floated over the reused pane header.+ const collapse = (+ <button+ type="button"+ title="Collapse inspector"+ aria-label="Collapse inspector"+ onClick={onCollapse}+ style={{+ position: "absolute",+ top: 12,+ right: 12,+ width: 26,+ height: 26,+ display: "grid",+ placeItems: "center",+ borderRadius: 8,+ color: "var(--muted)",+ background: "var(--surface-1)",+ border: 0,+ cursor: "pointer",+ zIndex: 5,+ }}+ >+ <ChevronRight size={15} />+ </button>+ );++ if (facet === "background") return wrap(collapse, <BackgroundPane />);+ if (facet === "effects") return wrap(collapse, <VideoEffectsPane />);+ if (facet === "layout") return wrap(collapse, <LayoutPane />);+ if (facet === "cursor") return wrap(collapse, <CursorPane />);+ if (facet === "transcript") return wrap(collapse, <TranscriptPane {...transcriptProps} />);+ if (facet === "captions")+ return wrap(+ collapse,+ <SimpleFacet+ title="Captions"+ description="Generate word-timed captions from the transcript and drop them onto the timeline."+ actionLabel="Generate captions"+ onAction={onCaptions}+ />,+ );+ if (facet === "crop")+ return wrap(+ collapse,+ <SimpleFacet+ title="Crop"+ description="Reframe the recording — pick an aspect ratio and zoom into the region you want to keep."+ actionLabel="Open crop…"+ onAction={onCrop}+ />,+ );+ // chapters+ return wrap(+ collapse,+ <SimpleFacet+ title="Chapters"+ description="Chapter markers help viewers jump around long recordings."+ emptyLabel="No chapters yet"+ />,+ );+}++function wrap(collapse: React.ReactNode, body: React.ReactNode) {+ return (+ <div style={{ position: "relative", display: "flex", flexDirection: "column", minHeight: 0 }}>+ {collapse}+ {body}+ </div>+ );+}++function SimpleFacet({+ title,+ description,+ actionLabel,+ onAction,+ emptyLabel,+}: {+ title: string;+ description: string;+ actionLabel?: string;+ onAction?: () => void;+ emptyLabel?: string;+}) {+ return (+ <div style={{ display: "flex", flexDirection: "column", minHeight: 0 }}>+ <header+ style={{+ display: "flex",+ alignItems: "center",+ padding: "14px 16px 12px",+ borderBottom: "1px solid var(--border-soft)",+ }}+ >+ <h2+ style={{+ margin: 0,+ fontSize: 14,+ fontWeight: 600,+ color: "var(--fg-emphasis)",+ letterSpacing: "-0.01em",+ }}+ >+ {title}+ </h2>+ </header>+ <div style={{ padding: "16px", display: "flex", flexDirection: "column", gap: 14 }}>+ <p style={{ margin: 0, fontSize: 12, lineHeight: 1.5, color: "var(--muted)" }}>+ {description}+ </p>+ {emptyLabel ? (+ <div+ style={{+ padding: "20px 16px",+ border: "1px dashed var(--border-hi)",+ borderRadius: 12,+ textAlign: "center",+ color: "var(--muted)",+ fontSize: 12,+ }}+ >+ {emptyLabel}+ </div>+ ) : null}+ {actionLabel && onAction ? (+ <button+ type="button"+ onClick={onAction}+ style={{+ padding: "10px 14px",+ borderRadius: 10,+ border: "1px solid var(--accent)",+ background: "var(--accent)",+ color: "#fff",+ font: "600 13px var(--font-display)",+ cursor: "pointer",+ }}+ >+ {actionLabel}+ </button>+ ) : null}+ </div>+ </div>+ );+}diff --git a/src/components/ai-edition/v4/FloatingTransport.tsx b/src/components/ai-edition/v4/FloatingTransport.tsxnew file mode 100644index 000000000..ff137022a--- /dev/null+++ b/src/components/ai-edition/v4/FloatingTransport.tsx@@ -0,0 +1,92 @@+import { Maximize, Pause, Play, Repeat, SkipBack, SkipForward } from "lucide-react";+import type { AxcutClip } from "@/lib/ai-edition/schema";+import styles from "./EditorShellV4.module.css";++function fmt(sec: number): string {+ if (!Number.isFinite(sec) || sec < 0) sec = 0;+ const m = Math.floor(sec / 60);+ const s = (sec % 60).toFixed(1);+ return `${m}:${s.padStart(4, "0")}`;+}++export function FloatingTransport({+ playing,+ loop,+ currentTimeSec,+ clips,+ onTogglePlay,+ onPrevClip,+ onNextClip,+ onToggleLoop,+ onExpand,+}: {+ playing: boolean;+ loop: boolean;+ currentTimeSec: number;+ clips: AxcutClip[];+ onTogglePlay: () => void;+ onPrevClip: () => void;+ onNextClip: () => void;+ onToggleLoop: () => void;+ onExpand: () => void;+}) {+ const total = clips.reduce((max, c) => Math.max(max, c.timelineEndSec), 0);+ return (+ <div className={styles.transportWrap}>+ <div className={styles.transport} role="toolbar" aria-label="Playback">+ <button+ type="button"+ className={styles.tbtn}+ title="Previous"+ aria-label="Previous"+ onClick={onPrevClip}+ >+ <SkipBack size={15} />+ </button>+ <button+ type="button"+ className={`${styles.tbtn} ${styles.play}`}+ title="Play / Pause"+ aria-label="Play / Pause"+ onClick={onTogglePlay}+ >+ {playing ? <Pause size={16} /> : <Play size={16} />}+ </button>+ <button+ type="button"+ className={styles.tbtn}+ title="Next"+ aria-label="Next"+ onClick={onNextClip}+ >+ <SkipForward size={15} />+ </button>+ <span className={styles.vsep} aria-hidden />+ <span className={styles.time}>+ <b>{fmt(currentTimeSec)}</b>+ <span className={styles.slash}>/</span>+ <span className={styles.total}>{fmt(total)}</span>+ </span>+ <button+ type="button"+ className={`${styles.tbtn}${loop ? ` ${styles.on}` : ""}`}+ title="Loop"+ aria-label="Loop"+ aria-pressed={loop}+ onClick={onToggleLoop}+ >+ <Repeat size={15} />+ </button>+ <button+ type="button"+ className={styles.tbtn}+ title="Fullscreen"+ aria-label="Fullscreen"+ onClick={onExpand}+ >+ <Maximize size={15} />+ </button>+ </div>+ </div>+ );+}diff --git a/src/components/ai-edition/v4/MediaStage.tsx b/src/components/ai-edition/v4/MediaStage.tsxnew file mode 100644index 000000000..882bad8fa--- /dev/null+++ b/src/components/ai-edition/v4/MediaStage.tsx@@ -0,0 +1,358 @@+import { ArrowDown, Film, Plus, RotateCw, Search, X } from "lucide-react";+import { useMemo, useState } from "react";+import { toast } from "sonner";+import type { AxcutAsset } from "@/lib/ai-edition/schema";+import { useProjectStore } from "@/lib/ai-edition/store/projectStore";+import styles from "./EditorShellV4.module.css";++const ASSET_MIME = "application/x-axcut-asset";+const THUMB_GRADIENTS = [+ "linear-gradient(135deg, #fb7185, #f97316)",+ "linear-gradient(135deg, #10b981, #0d986a)",+ "linear-gradient(135deg, #fbbf24, #f59e0b)",+ "linear-gradient(135deg, #38bdf8, #6366f1)",+];++function basename(path: string): string {+ return path.split(/[\\/]/).pop() ?? path;+}++function formatTimecode(sec: number | undefined): string {+ if (!sec || !Number.isFinite(sec)) return "0:00.0";+ const h = Math.floor(sec / 3600);+ const m = Math.floor((sec % 3600) / 60);+ const s = (sec % 60).toFixed(1);+ return h > 0+ ? `${h}:${m.toString().padStart(2, "0")}:${s.padStart(4, "0")}`+ : `${m}:${s.padStart(4, "0")}`;+}++function formatSize(bytes: number | undefined): string {+ if (!bytes || !Number.isFinite(bytes)) return "—";+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`;+ if (bytes < 1024 * 1024 * 1024) return `${(bytes / 1024 / 1024).toFixed(0)} MB`;+ return `${(bytes / 1024 / 1024 / 1024).toFixed(1)} GB`;+}++export function MediaStage({+ assetStatuses,+ onRegenerateAsset,+}: {+ assetStatuses?: Record<string, "pending" | "running" | "failed">;+ onRegenerateAsset?: (assetId: string, language: string) => Promise<void>;+}) {+ const projectId = useProjectStore((s) => s.projectId);+ const document = useProjectStore((s) => s.document);+ const addAsset = useProjectStore((s) => s.addAsset);+ const [query, setQuery] = useState("");+ const [busy, setBusy] = useState(false);+ const [selectedId, setSelectedId] = useState<string | null>(null);+ const [detailOpen, setDetailOpen] = useState(false);+ const [lang, setLang] = useState("auto");++ const assets = document?.assets ?? [];+ const filtered = useMemo(+ () =>+ assets.filter((a) => {+ if (!query) return true;+ return `${a.label} ${a.originalPath}`.toLowerCase().includes(query.toLowerCase());+ }),+ [assets, query],+ );+ const selected = assets.find((a) => a.id === selectedId) ?? null;+ const transcript = selected+ ? (document?.transcripts?.find((t) => t.assetId === selected.id) ?? null)+ : null;++ const handleImport = async () => {+ if (!projectId) {+ toast.error("Open a project first");+ return;+ }+ const picker = await window.electronAPI?.openVideoFilePicker();+ if (!picker?.success || !picker.path) return;+ setBusy(true);+ try {+ await addAsset(picker.path);+ toast.success(`Added ${basename(picker.path)}`);+ } catch (err) {+ toast.error("Could not add asset", {+ description: err instanceof Error ? err.message : String(err),+ });+ } finally {+ setBusy(false);+ }+ };++ const openDetail = (asset: AxcutAsset) => {+ setSelectedId(asset.id);+ setDetailOpen(true);+ };++ return (+ <div className={styles.mediaStage}>+ <div className={styles.mediaInner} style={{ maxWidth: detailOpen ? 1120 : 900 }}>+ <div className={styles.mediaSearchRow}>+ <Search size={16} style={{ color: "var(--muted)", flexShrink: 0 }} />+ <input+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ placeholder="Search media…"+ />+ </div>+ <div className={styles.mediaCols}>+ <div className={styles.mediaListCol}>+ <div+ className={styles.mediaGrid}+ style={{ gridTemplateColumns: detailOpen ? "repeat(2,1fr)" : "repeat(3,1fr)" }}+ >+ {filtered.map((asset, i) => {+ const status = assetStatuses?.[asset.id] ?? "idle";+ return (+ <button+ type="button"+ key={asset.id}+ draggable+ className={`${styles.mediaCard}${+ asset.id === selectedId ? ` ${styles.selected}` : ""+ }`}+ title={asset.originalPath}+ onDragStart={(e) => {+ e.dataTransfer.setData(ASSET_MIME, asset.id);+ e.dataTransfer.effectAllowed = "copy";+ }}+ onClick={() => openDetail(asset)}+ >+ <div+ className={styles.mediaThumb}+ style={{ background: THUMB_GRADIENTS[i % THUMB_GRADIENTS.length] }}+ >+ <Film size={30} strokeWidth={1.8} />+ </div>+ <div className={styles.mediaCardMeta}>+ {asset.id === selectedId ? (+ <span+ aria-hidden+ style={{+ width: 6,+ height: 6,+ borderRadius: "50%",+ background: "var(--accent)",+ flexShrink: 0,+ }}+ />+ ) : null}+ <div className={styles.body}>+ <div className={styles.mediaCardName}>+ {asset.label || basename(asset.originalPath)}+ </div>+ <div className={styles.mediaCardStats}>+ <span className={styles.dur}>{formatTimecode(asset.durationSec)}</span>+ <span className={styles.size}>{formatSize(asset.sizeBytes)}</span>+ </div>+ </div>+ {status === "running" ? (+ <RotateCw+ size={13}+ className="animate-spin"+ style={{ color: "var(--accent)", flexShrink: 0 }}+ />+ ) : null}+ </div>+ </button>+ );+ })}+ </div>+ {assets.length > 0 ? (+ <div className={styles.mediaHint}>+ <ArrowDown size={12} />+ Drag a clip onto the timeline below to add it+ </div>+ ) : (+ <div className={styles.mediaHint}>+ No media yet — import a recording to get started.+ </div>+ )}+ <button+ type="button"+ className={styles.importBtn}+ onClick={handleImport}+ disabled={!projectId || busy}+ >+ <Plus size={14} />+ Import media+ </button>+ </div>++ {detailOpen && selected ? (+ <div className={styles.mediaDetail}>+ <div+ style={{+ display: "flex",+ alignItems: "flex-start",+ justifyContent: "space-between",+ gap: 10,+ marginBottom: 4,+ }}+ >+ <h2+ style={{+ margin: 0,+ fontSize: 16.5,+ fontWeight: 700,+ color: "var(--fg-emphasis)",+ letterSpacing: "-0.01em",+ }}+ >+ Source Transcript+ </h2>+ <button+ type="button"+ title="Close"+ aria-label="Close"+ onClick={() => setDetailOpen(false)}+ style={{+ width: 26,+ height: 26,+ display: "grid",+ placeItems: "center",+ borderRadius: 8,+ color: "var(--muted)",+ background: "transparent",+ border: 0,+ cursor: "pointer",+ flexShrink: 0,+ }}+ >+ <X size={15} />+ </button>+ </div>+ <div+ style={{+ fontSize: 12,+ color: "var(--muted)",+ marginBottom: 16,+ whiteSpace: "nowrap",+ overflow: "hidden",+ textOverflow: "ellipsis",+ }}+ >+ {selected.label || basename(selected.originalPath)}+ </div>++ <div style={{ marginBottom: 16 }}>+ <span+ style={{+ display: "inline-flex",+ alignItems: "center",+ gap: 6,+ padding: "5px 10px 5px 8px",+ borderRadius: 9999,+ background: transcript ? "var(--success-soft)" : "var(--accent-soft)",+ color: transcript ? "var(--success)" : "var(--accent)",+ fontSize: 11.5,+ fontWeight: 600,+ }}+ >+ <span+ style={{+ width: 5,+ height: 5,+ borderRadius: "50%",+ background: transcript ? "var(--success)" : "var(--accent)",+ }}+ />+ {transcript ? "Transcript ready" : "Not generated yet"}+ </span>+ </div>++ <div style={{ marginBottom: 12 }}>+ <div+ style={{+ fontSize: 11.5,+ fontWeight: 600,+ color: "var(--fg-2)",+ marginBottom: 6,+ }}+ >+ Regenerate as+ </div>+ <div style={{ display: "flex", gap: 8 }}>+ <select+ value={lang}+ onChange={(e) => setLang(e.target.value)}+ style={{+ flex: 1,+ minWidth: 0,+ height: 36,+ padding: "0 10px",+ borderRadius: 9,+ border: "1px solid var(--border)",+ background: "var(--surface-2)",+ color: "var(--fg)",+ fontSize: 12.5,+ fontWeight: 500,+ outline: "none",+ }}+ >+ <option value="auto">Auto</option>+ <option value="en">English</option>+ <option value="fr">Français</option>+ <option value="es">Español</option>+ </select>+ <button+ type="button"+ title="Regenerate"+ aria-label="Regenerate"+ disabled={!onRegenerateAsset || assetStatuses?.[selected.id] === "running"}+ onClick={() => {+ if (onRegenerateAsset) void onRegenerateAsset(selected.id, lang);+ }}+ style={{+ width: 36,+ height: 36,+ flexShrink: 0,+ display: "grid",+ placeItems: "center",+ borderRadius: 9,+ color: "var(--fg-2)",+ background: "var(--surface-2)",+ border: "1px solid var(--border)",+ cursor: "pointer",+ }}+ >+ <RotateCw size={14} />+ </button>+ </div>+ </div>++ <div+ style={{+ padding: "16px",+ border: "1px solid var(--border)",+ borderRadius: 12,+ background: "var(--surface)",+ fontSize: 12.5,+ lineHeight: 1.7,+ color: "var(--fg-2)",+ maxHeight: 360,+ overflowY: "auto",+ }}+ >+ {transcript ? (+ (transcript.segments ?? [])+ .map((seg) => (seg as { text?: string }).text ?? "")+ .join(" ") || "Transcript is empty."+ ) : (+ <span style={{ color: "var(--muted)" }}>+ Not generated yet — pick a language and click regenerate.+ </span>+ )}+ </div>+ </div>+ ) : null}+ </div>+ </div>+ </div>+ );+}diff --git a/src/components/ai-edition/v4/RecStage.tsx b/src/components/ai-edition/v4/RecStage.tsxnew file mode 100644index 000000000..61dd0fc1a--- /dev/null+++ b/src/components/ai-edition/v4/RecStage.tsx@@ -0,0 +1,259 @@+import {+ Camera,+ CameraOff,+ ChevronDown,+ MicOff,+ Mic as MicOn,+ MonitorSmartphone,+ MousePointer2,+ Volume2,+ VolumeX,+} from "lucide-react";+import { useState } from "react";+import styles from "./EditorShellV4.module.css";++type Menu = "source" | "mic" | "camera" | null;++const SCREEN_TARGETS = ["Entire Screen", "Display 2"];+const WINDOW_TARGETS = ["OpenScreen Studio", "Figma", "Terminal", "Google Chrome"];+const MIC_DEVICES = ["MacBook Pro Microphone", "AirPods Pro", "Blue Yeti X"];+const CAMERA_DEVICES = ["FaceTime HD Camera", "Logitech Brio 4K"];++/**+ * Rec-mode stage. The real capture pipeline lives in the standalone recorder+ * HUD window (`electronAPI.startNewRecording`); this stage presents the v4+ * source/mic/camera/cursor configuration bar and hands off to the HUD when the+ * user hits record.+ */+export function RecStage({ onStartRecording }: { onStartRecording: () => void }) {+ const [menu, setMenu] = useState<Menu>(null);+ const [sourceTab, setSourceTab] = useState<"screen" | "window">("screen");+ const [screenTarget, setScreenTarget] = useState(SCREEN_TARGETS[0]);+ const [windowTarget, setWindowTarget] = useState(WINDOW_TARGETS[0]);+ const [speakerOn, setSpeakerOn] = useState(false);+ const [micDevice, setMicDevice] = useState<string | null>(null);+ const [cameraDevice, setCameraDevice] = useState<string | null>(null);+ const [cursorOn, setCursorOn] = useState(true);++ const sourceLabel = sourceTab === "screen" ? screenTarget : windowTarget;+ const toggle = (m: Menu) => setMenu((cur) => (cur === m ? null : m));++ return (+ <div className={styles.recStage}>+ <div className={styles.recFrame}>+ <span+ aria-hidden+ style={{+ width: 88,+ height: 88,+ borderRadius: "50%",+ background: "linear-gradient(180deg,#c2c6cc 0%,#676d78 100%)",+ }}+ />+ <div className={styles.recBadge}>+ <span className={styles.recDot} aria-hidden />+ <span>Ready to record</span>+ </div>++ <div className={styles.recBarWrap}>+ <div className={styles.recBar}>+ {/* source */}+ <div style={{ position: "relative" }}>+ <button+ type="button"+ className={styles.recBarBtn}+ title="Recording source"+ aria-label="Recording source"+ onClick={() => toggle("source")}+ >+ <MonitorSmartphone size={15} />+ <span>{sourceLabel}</span>+ <ChevronDown size={10} style={{ opacity: 0.6 }} />+ </button>+ {menu === "source" ? (+ <div className={styles.recMenu} style={{ left: 0, width: 220 }}>+ <div+ style={{+ display: "flex",+ gap: 2,+ padding: 2,+ background: "var(--surface-3)",+ borderRadius: 8,+ marginBottom: 6,+ }}+ >+ {(["screen", "window"] as const).map((tab) => (+ <button+ key={tab}+ type="button"+ onClick={() => setSourceTab(tab)}+ style={{+ flex: 1,+ padding: "6px 8px",+ borderRadius: 6,+ border: 0,+ fontSize: 11.5,+ fontWeight: 600,+ cursor: "pointer",+ textTransform: "capitalize",+ background: sourceTab === tab ? "var(--surface-1)" : "transparent",+ color: sourceTab === tab ? "var(--fg-emphasis)" : "var(--muted)",+ }}+ >+ {tab}+ </button>+ ))}+ </div>+ {(sourceTab === "screen" ? SCREEN_TARGETS : WINDOW_TARGETS).map((name) => {+ const active =+ sourceTab === "screen" ? name === screenTarget : name === windowTarget;+ return (+ <button+ key={name}+ type="button"+ className={`${styles.recMenuRow}${active ? ` ${styles.active}` : ""}`}+ onClick={() => {+ if (sourceTab === "screen") setScreenTarget(name);+ else setWindowTarget(name);+ setMenu(null);+ }}+ >+ <MonitorSmartphone size={14} />+ {name}+ </button>+ );+ })}+ </div>+ ) : null}+ </div>++ <span className={styles.recBarSep} aria-hidden />++ {/* speaker / system audio */}+ <button+ type="button"+ className={`${styles.recIconBtn}${speakerOn ? ` ${styles.on}` : ""}`}+ title="Toggle system audio"+ aria-label="Toggle system audio"+ aria-pressed={speakerOn}+ onClick={() => setSpeakerOn((v) => !v)}+ >+ {speakerOn ? <Volume2 size={15} /> : <VolumeX size={15} />}+ </button>++ {/* mic */}+ <div style={{ position: "relative" }}>+ <button+ type="button"+ className={`${styles.recIconBtn}${micDevice ? ` ${styles.on}` : ""}`}+ title="Microphone"+ aria-label="Microphone"+ onClick={() => toggle("mic")}+ >+ {micDevice ? <MicOn size={15} /> : <MicOff size={15} />}+ </button>+ {menu === "mic" ? (+ <div+ className={styles.recMenu}+ style={{ left: "50%", transform: "translateX(-50%)", width: 210 }}+ >+ <button+ type="button"+ className={`${styles.recMenuRow}${!micDevice ? ` ${styles.active}` : ""}`}+ onClick={() => {+ setMicDevice(null);+ setMenu(null);+ }}+ >+ <MicOff size={14} />+ No microphone+ </button>+ {MIC_DEVICES.map((name) => (+ <button+ key={name}+ type="button"+ className={`${styles.recMenuRow}${micDevice === name ? ` ${styles.active}` : ""}`}+ onClick={() => {+ setMicDevice(name);+ setMenu(null);+ }}+ >+ <MicOn size={14} />+ {name}+ </button>+ ))}+ </div>+ ) : null}+ </div>++ {/* camera */}+ <div style={{ position: "relative" }}>+ <button+ type="button"+ className={`${styles.recIconBtn}${cameraDevice ? ` ${styles.on}` : ""}`}+ title="Camera"+ aria-label="Camera"+ onClick={() => toggle("camera")}+ >+ {cameraDevice ? <Camera size={15} /> : <CameraOff size={15} />}+ </button>+ {menu === "camera" ? (+ <div+ className={styles.recMenu}+ style={{ left: "50%", transform: "translateX(-50%)", width: 210 }}+ >+ <button+ type="button"+ className={`${styles.recMenuRow}${!cameraDevice ? ` ${styles.active}` : ""}`}+ onClick={() => {+ setCameraDevice(null);+ setMenu(null);+ }}+ >+ <CameraOff size={14} />+ No camera+ </button>+ {CAMERA_DEVICES.map((name) => (+ <button+ key={name}+ type="button"+ className={`${styles.recMenuRow}${+ cameraDevice === name ? ` ${styles.active}` : ""+ }`}+ onClick={() => {+ setCameraDevice(name);+ setMenu(null);+ }}+ >+ <Camera size={14} />+ {name}+ </button>+ ))}+ </div>+ ) : null}+ </div>++ {/* cursor capture */}+ <button+ type="button"+ className={`${styles.recIconBtn}${cursorOn ? ` ${styles.on}` : ""}`}+ title="Toggle cursor capture"+ aria-label="Toggle cursor capture"+ aria-pressed={cursorOn}+ onClick={() => setCursorOn((v) => !v)}+ >+ <MousePointer2 size={15} />+ </button>+ </div>+ </div>+ </div>++ <div className={styles.bigRecWrap}>+ <button type="button" className={styles.bigRecBtn} onClick={onStartRecording}>+ <span className={styles.bigRecDot} aria-hidden />+ Start recording+ </button>+ </div>+ </div>+ );+}diff --git a/src/styles/design-tokens.css b/src/styles/design-tokens.cssindex 9157faec0..b1df04a0e 100644--- a/src/styles/design-tokens.css+++ b/src/styles/design-tokens.css@@ -11,6 +11,7 @@--surface-1: #f1f5f9;--surface-2: #e2e8f0;--surface-3: #cbd5e1;+ --surface-hi: #ffffff;--surface-warm: #f1f5f9;/* lines */@@ -37,6 +38,9 @@--accent-on: #04221a;--accent-soft: rgba(16, 185, 129, 0.10);--accent-wash: rgba(16, 185, 129, 0.06);+ --accent-border: rgba(16, 185, 129, 0.26);+ --accent-ring: rgba(16, 185, 129, 0.28);+ --accent-stripe: rgba(16, 185, 129, 0.30);/* legacy shadcn-style aliases → canonical tokens. Referenced by theTimelinePane / TranscriptEditor / VirtualPreview / NewEditorShell module@@ -61,8 +65,10 @@/* timeline pills */--annotation: #eab308;--annotation-soft: rgba(234, 179, 8, 0.14);+ --annotation-wash: rgba(234, 179, 8, 0.14);--speed: #f97316;--speed-soft: rgba(249, 115, 22, 0.14);+ --speed-wash: rgba(249, 115, 22, 0.14);--success: #10b981;--success-soft: rgba(16, 185, 129, 0.10);@@ -149,8 +155,10 @@--surface-1: #14181f;--surface-2: #1c2029;--surface-3: #252a35;+ --surface-hi: #2b313b;--surface-warm: #1c2029;+ --fg-emphasis: #ffffff;--border: #252a35;--border-soft: #1c2029;--border-hi: #3a4150;@@ -170,6 +178,9 @@--accent-on: #0a0d12;--accent-soft: rgba(16, 185, 129, 0.14);--accent-wash: rgba(16, 185, 129, 0.06);+ --accent-border: rgba(16, 185, 129, 0.26);+ --accent-ring: rgba(16, 185, 129, 0.32);+ --accent-stripe: rgba(16, 185, 129, 0.34);--danger: #f87171;--danger-lo: #ef4444;@@ -182,8 +193,10 @@--annotation: #fbbf24;--annotation-soft: rgba(251, 191, 36, 0.16);+ --annotation-wash: rgba(251, 191, 36, 0.16);--speed: #fb923c;--speed-soft: rgba(251, 146, 60, 0.16);+ --speed-wash: rgba(251, 146, 60, 0.16);--success: #10b981;--success-soft: rgba(16, 185, 129, 0.14);diff --git a/vite.v4preview.config.ts b/vite.v4preview.config.tsnew file mode 100644index 000000000..4c00685c6--- /dev/null+++ b/vite.v4preview.config.ts@@ -0,0 +1,20 @@+import path from "node:path";+import react from "@vitejs/plugin-react";+import { defineConfig } from "vite";++// Browser-only preview of the renderer (no Electron plugin) so the v4 editor+// shell can be opened in a plain browser for design QA. The app installs+// browser shims (src/native/browserShim.ts) so the stores work without the+// Electron bridge. Serve: vite --config vite.v4preview.config.ts (port 5199).+export default defineConfig({+ plugins: [react()],+ resolve: {+ alias: {+ "@": path.resolve(__dirname, "src"),+ },+ },+ server: {+ port: 5207,+ strictPort: true,+ },+});