Create polished demo videos without editing skills. Mac/Windows/Linux
feat(ui): integrate recording library and cloud account into HeroUI editor
webadderalle41ce83cd38c
diff --git a/electron/electron-env.d.ts b/electron/electron-env.d.tsindex 61bf1fd2..e780f1a9 100644--- a/electron/electron-env.d.ts+++ b/electron/electron-env.d.ts@@ -752,6 +752,25 @@ interface Window {}>;getCurrentVideoPath: () => Promise<{ success: boolean; path?: string }>;clearCurrentVideoPath: () => Promise<{ success: boolean }>;+ getRecordingThumbnail: (filePath: string) => Promise<import("../src/types/recordingLibrary").LibraryResult<string>>;+ listRecordings: () => Promise<+ import("../src/types/recordingLibrary").LibraryResult<+ import("../src/types/recordingLibrary").RecordingLibraryEntry[]+ >+ >;+ setRecordingsRemoved: (+ paths: string[],+ removed: boolean,+ ) => Promise<import("../src/types/recordingLibrary").LibraryResult<null>>;+ importRecording: (+ currentPath: string,+ recordingPath: string,+ webcam?: import("../src/types/recordingLibrary").RecordingWebcamSource,+ ) => Promise<+ import("../src/types/recordingLibrary").LibraryResult<+ import("../src/types/recordingLibrary").RecordingImportResult+ >+ >;deleteRecordingFile: (filePath: string) => Promise<{ success: boolean; error?: string }>;getLocalMediaUrl: (filePath: string,@@ -869,10 +888,36 @@ interface Window {callback: (chrome: { trafficLightsVisible: boolean }) => void,) => () => void;getPlatform: () => Promise<string>;+ isWindowFullscreen: () => Promise<boolean>;+ onWindowFullscreenChanged: (callback: (isFullscreen: boolean) => void) => () => void;getLinuxWindowSystem: () => Promise<"wayland" | "x11" | null>;+ getPendingAuthCallbackUrl: () => Promise<string | null>;+ onAuthCallbackUrl: (callback: (url: string) => void) => () => void;revealInFolder: (filePath: string,) => Promise<{ success: boolean; error?: string; message?: string }>;+ cloudShareUpload: (input: {+ filePath: string;+ endpoint: string;+ token?: string;+ title?: string;+ notes?: string;+ uploadId?: string;+ }) => Promise<{+ success: boolean;+ uploadId?: string;+ shareUrl?: string;+ canceled?: boolean;+ error?: string;+ }>;+ cloudShareCancel: (uploadId: string) => Promise<{ success: boolean }>;+ onCloudShareProgress: (+ callback: (progress: {+ uploadId: string;+ uploadedBytes: number;+ totalBytes: number;+ }) => void,+ ) => () => void;openRecordingsFolder: () => Promise<{ success: boolean; error?: string; message?: string }>;getRecordingsDirectory: () => Promise<{success: boolean;diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.tsindex 2a0f998e..e87e677e 100644--- a/electron/ipc/handlers.ts+++ b/electron/ipc/handlers.ts@@ -2,6 +2,7 @@ import { BrowserWindow } from "electron";import { registerAnnouncementHandlers } from "./register/announcements";import { registerAssetHandlers } from "./register/assets";import { registerCaptionHandlers } from "./register/captions";+import { registerCloudShareHandlers } from "./register/cloudShare";import { registerExportHandlers } from "./register/export";import { registerPermissionHandlers } from "./register/permissions";import { registerProjectHandlers } from "./register/project";@@ -69,6 +70,7 @@ export function registerIpcHandlers(registerAssetHandlers();registerExportHandlers();registerCaptionHandlers();+ registerCloudShareHandlers();registerProjectHandlers();registerSettingsHandlers();}diff --git a/electron/ipc/register/project.ts b/electron/ipc/register/project.tsindex ff309a19..d108ae72 100644--- a/electron/ipc/register/project.ts+++ b/electron/ipc/register/project.ts@@ -1,3 +1,6 @@+import { getRecordingThumbnail } from "../recording/thumbnail";+import { listRecordings, setRecordingsRemoved } from "../recording/library";+import { importRecording } from "../recording/importRecording";import { randomUUID } from "node:crypto";import { constants as fsConstants } from "node:fs";import fs from "node:fs/promises";@@ -211,6 +214,32 @@ async function ensureNamedProjectSaveDoesNotOverwriteDifferentProject(}export function registerProjectHandlers() {+ ipcMain.handle("get-recording-thumbnail", async (_, file: string) => {+ try { return { success: true, value: await getRecordingThumbnail(file) }; }+ catch (error) { return { success: false, error: String(error) }; }+ });+ ipcMain.handle("list-recordings", async () => {+ try {+ return { success: true, value: await listRecordings() };+ } catch (error) {+ return { success: false, error: String(error) };+ }+ });+ ipcMain.handle("set-recordings-removed", async (_, paths: string[], removed: boolean) => {+ try {+ await setRecordingsRemoved(paths, removed);+ return { success: true, value: null };+ } catch (error) {+ return { success: false, error: String(error) };+ }+ });+ ipcMain.handle("import-recording", async (_, currentPath: string, recordingPath: string, webcam?: import("../../../src/types/recordingLibrary").RecordingWebcamSource) => {+ try {+ return { success: true, value: await importRecording(currentPath, recordingPath, webcam) };+ } catch (error) {+ return { success: false, error: String(error) };+ }+ });ipcMain.handle("reveal-in-folder", async (_, filePath: string) => {try {// shell.showItemInFolder doesn't return a value, it throws on errordiff --git a/electron/ipc/register/settings.ts b/electron/ipc/register/settings.tsindex 7fea305e..91de5ea3 100644--- a/electron/ipc/register/settings.ts+++ b/electron/ipc/register/settings.ts@@ -43,6 +43,7 @@ function getBrowserMicrophoneProfileFromEnv() {}export function registerSettingsHandlers() {+ ipcMain.handle("get-window-fullscreen", (event) => BrowserWindow.fromWebContents(event.sender)?.isFullScreen() ?? false);ipcMain.handle("app:getVersion", () => {return app.getVersion();});diff --git a/electron/main.ts b/electron/main.tsindex 89072667..915873c2 100644--- a/electron/main.ts+++ b/electron/main.ts@@ -1,3 +1,4 @@+import { clearRecordingTrashUndo } from "./ipc/recording/library";import fs from "node:fs/promises";import path from "node:path";import { fileURLToPath, pathToFileURL } from "node:url";@@ -16,6 +17,7 @@ import {Tray,} from "electron";import { RECORDINGS_DIR } from "./appPaths";+import { createAuthCallbackController } from "./authCallback";import { showCursor } from "./cursorHider";import { getGpuSwitches } from "./gpuSwitches";import {@@ -189,6 +191,11 @@ if (!hasSingleInstanceLock) {app.quit();}+const authCallbacks = createAuthCallbackController({+ isDev: IS_DEV,+ focusApp: () => focusOrCreateMainWindow(),+});+function closeEditorWindowBypassingUnsavedPrompt(window: BrowserWindow | null) {if (!window || window.isDestroyed()) {return;@@ -865,6 +872,8 @@ function createSourceSelectorWindowWrapper() {// explicitly with Cmd + Q.app.on("before-quit", () => {isAppQuitting = true;+ authCallbacks.close();+ void clearRecordingTrashUndo().catch((error) => console.warn("Could not clear recording undo cache", error));killWindowsCaptureProcess();showCursor();cleanupNativeVideoExportSessions();@@ -883,12 +892,23 @@ app.on("activate", () => {focusOrCreateMainWindow();});-app.on("second-instance", () => {+app.on("second-instance", (_event, commandLine) => {+ const authCallback = authCallbacks.find(commandLine);+ if (authCallback) authCallbacks.dispatch(authCallback);focusOrCreateMainWindow();});// Register all IPC handlers when app is readyapp.whenReady().then(async () => {+ authCallbacks.startDevServer();+ if (process.defaultApp && process.argv[1]) {+ app.setAsDefaultProtocolClient(authCallbacks.protocol, process.execPath, [path.resolve(process.argv[1])]);+ } else {+ app.setAsDefaultProtocolClient(authCallbacks.protocol);+ }+ const startupAuthCallback = authCallbacks.find(process.argv);+ if (startupAuthCallback) authCallbacks.dispatch(startupAuthCallback);+if (process.platform === "win32") {app.setAppUserModelId("dev.recordly.app");}diff --git a/electron/preload.ts b/electron/preload.tsindex f854fe07..684b034c 100644--- a/electron/preload.ts+++ b/electron/preload.ts@@ -787,6 +787,12 @@ contextBridge.exposeInMainWorld("electronAPI", {clearCurrentVideoPath: () => {return ipcRenderer.invoke("clear-current-video-path");},+ getRecordingThumbnail: (filePath: string) => ipcRenderer.invoke("get-recording-thumbnail", filePath),+ listRecordings: () => ipcRenderer.invoke("list-recordings"),+ setRecordingsRemoved: (paths: string[], removed: boolean) =>+ ipcRenderer.invoke("set-recordings-removed", paths, removed),+ importRecording: (currentPath: string, recordingPath: string, webcam?: import("../src/types/recordingLibrary").RecordingWebcamSource) =>+ ipcRenderer.invoke("import-recording", currentPath, recordingPath, webcam),deleteRecordingFile: (filePath: string) => {return ipcRenderer.invoke("delete-recording-file", filePath);},@@ -952,12 +958,50 @@ contextBridge.exposeInMainWorld("electronAPI", {getPlatform: () => {return ipcRenderer.invoke("get-platform");},+ isWindowFullscreen: () => {+ return ipcRenderer.invoke("get-window-fullscreen");+ },+ onWindowFullscreenChanged: (callback: (isFullscreen: boolean) => void) => {+ const listener = (_event: Electron.IpcRendererEvent, isFullscreen: boolean) =>+ callback(isFullscreen);+ ipcRenderer.on("window-fullscreen-changed", listener);+ return () => ipcRenderer.removeListener("window-fullscreen-changed", listener);+ },getLinuxWindowSystem: () => {return ipcRenderer.invoke("get-linux-window-system");},+ getPendingAuthCallbackUrl: () => ipcRenderer.invoke("auth:get-pending-callback"),+ onAuthCallbackUrl: (callback: (url: string) => void) => {+ const listener = (_event: Electron.IpcRendererEvent, url: string) => callback(url);+ ipcRenderer.on("auth:callback", listener);+ return () => ipcRenderer.removeListener("auth:callback", listener);+ },revealInFolder: (filePath: string) => {return ipcRenderer.invoke("reveal-in-folder", filePath);},+ cloudShareUpload: (input: {+ filePath: string;+ endpoint: string;+ token?: string;+ title?: string;+ notes?: string;+ uploadId?: string;+ }) => ipcRenderer.invoke("cloud-share-upload", input),+ cloudShareCancel: (uploadId: string) => ipcRenderer.invoke("cloud-share-cancel", uploadId),+ onCloudShareProgress: (+ callback: (progress: {+ uploadId: string;+ uploadedBytes: number;+ totalBytes: number;+ }) => void,+ ) => {+ const listener = (+ _event: Electron.IpcRendererEvent,+ progress: { uploadId: string; uploadedBytes: number; totalBytes: number },+ ) => callback(progress);+ ipcRenderer.on("cloud-share-progress", listener);+ return () => ipcRenderer.removeListener("cloud-share-progress", listener);+ },openRecordingsFolder: () => {return ipcRenderer.invoke("open-recordings-folder");},diff --git a/electron/windows.ts b/electron/windows.tsindex de948903..06083afa 100644--- a/electron/windows.ts+++ b/electron/windows.ts@@ -984,6 +984,14 @@ export function createEditorWindow(): BrowserWindow {console.log("[editor-window] focus");});+ win.on("enter-full-screen", () => {+ if (!win.isDestroyed()) win.webContents.send("window-fullscreen-changed", true);+ });++ win.on("leave-full-screen", () => {+ if (!win.isDestroyed()) win.webContents.send("window-fullscreen-changed", false);+ });+if (VITE_DEV_SERVER_URL) {const query = new URLSearchParams(getEditorWindowQuery());win.loadURL(`${VITE_DEV_SERVER_URL}?${query.toString()}`);diff --git a/src/components/launch/LaunchWindow.module.css b/src/components/launch/LaunchWindow.module.cssindex 96a5f6fd..e429372a 100644--- a/src/components/launch/LaunchWindow.module.css+++ b/src/components/launch/LaunchWindow.module.css@@ -54,6 +54,9 @@width: 300px;max-height: 400px;overflow-y: auto;+ overflow-x: hidden;+ scrollbar-width: thin;+ scrollbar-color: var(--launch-border-strong) transparent;pointer-events: auto;}diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsxindex f78408f9..03e19315 100644--- a/src/components/launch/LaunchWindow.tsx+++ b/src/components/launch/LaunchWindow.tsx@@ -231,7 +231,7 @@ function LaunchWindowContent() {onOpen={beginInteractiveHudAction}trigger={<Button- variant="outline"+ variant="ghost"size="lg"className={` ${styles.electronNoDrag} group gap-2 px-3 min-w-0 max-w-[180px] shrink-0 ${openId === "sources" ? "border-[var(--launch-border-strong)] bg-[var(--launch-hover)]" : ""} `}title={selectedSource}diff --git a/src/components/launch/SourceSelector.tsx b/src/components/launch/SourceSelector.tsxindex 8e96b231..c47b81ed 100644--- a/src/components/launch/SourceSelector.tsx+++ b/src/components/launch/SourceSelector.tsx@@ -56,6 +56,7 @@ export const SourceSelectorContent = ({const isSelected = selectedSource === source.name;return (<ToggleButton+ variant="ghost"isSelected={isSelected}key={`${source.id}-${index}`}className={cn(@@ -157,7 +158,7 @@ export const SourceSelectorContent = ({/*** SourceSelector - A rich source selection component with thumbnails- * Uses Radix UI Popover for positioning and accessibility+ * Uses the shared HeroUI popover for positioning and accessibility*/export const SourceSelector = React.memo(function SourceSelector({screenSources: propsScreenSources,@@ -293,7 +294,7 @@ export const SourceSelector = React.memo(function SourceSelector({)) : (<Button- variant="outline"+ variant="ghost"size="lg"onPointerEnter={prefetchSources}onFocusCapture={prefetchSources}diff --git a/src/components/launch/UpdateToastWindow.tsx b/src/components/launch/UpdateToastWindow.tsxindex 27c87d1f..8eeb1be0 100644--- a/src/components/launch/UpdateToastWindow.tsx+++ b/src/components/launch/UpdateToastWindow.tsx@@ -1,5 +1,4 @@import { Card, Chip, ProgressBar } from "@heroui/react";-import { Button } from "@/components/ui/button";import {ArrowClockwiseIcon,CheckCircleIcon,@@ -7,10 +6,11 @@ import {WarningCircleIcon,} from "@phosphor-icons/react";import { useEffect, useState } from "react";+import { Button } from "@/components/ui/button";import { useI18n } from "@/contexts/I18nContext";import styles from "./UpdateToastWindow.module.css";-type UpdateToastPayload = {+export type UpdateToastPayload = {version: string;detail: string;phase: "available" | "downloading" | "ready" | "error";@@ -90,11 +90,17 @@ function PhaseIcon({ payload }: { payload: UpdateToastPayload }) {}}-export function UpdateToastWindow() {- const [payload, setPayload] = useState<UpdateToastPayload | null>(null);+export function UpdateToastWindow({+ payload: suppliedPayload,+}: {+ payload?: UpdateToastPayload;+} = {}) {+ const [livePayload, setPayload] = useState<UpdateToastPayload | null>(null);+ const payload = suppliedPayload ?? livePayload;const { t } = useI18n();useEffect(() => {+ if (suppliedPayload) return;let mounted = true;const refresh = () => {void window.electronAPI.getCurrentUpdateToastPayload().then((nextPayload) => {@@ -111,7 +117,7 @@ export function UpdateToastWindow() {clearInterval(pollTimer);dispose();};- }, []);+ }, [suppliedPayload]);if (!payload) {return <div className={styles.window} />;diff --git a/src/components/launch/popovers/PopoverScaffold.tsx b/src/components/launch/popovers/PopoverScaffold.tsxindex b6859355..848ca7b2 100644--- a/src/components/launch/popovers/PopoverScaffold.tsx+++ b/src/components/launch/popovers/PopoverScaffold.tsx@@ -62,6 +62,7 @@ export function MicDeviceRow({return (<ToggleButton+ variant="ghost"isSelected={selected}className="w-full justify-start gap-3"onClick={onSelect}diff --git a/src/components/ui/popover.tsx b/src/components/ui/popover.tsxindex adad21b4..376ff44c 100644--- a/src/components/ui/popover.tsx+++ b/src/components/ui/popover.tsx@@ -1,6 +1,7 @@import { Popover as HeroPopover } from "@heroui/react";import { createContext, useContext, useState, type ComponentProps, type ReactNode } from "react";import { cn } from "@/lib/utils";+import { useUNSAFE_PortalContext } from "react-aria";const ModalContext = createContext(true);const CloseContext = createContext<(() => void) | undefined>(undefined);export function Popover({@@ -56,6 +57,7 @@ export function PopoverContent({...props}: ContentProps) {const modal = useContext(ModalContext);+ const scopedPortalContainer = useUNSAFE_PortalContext().getContainer?.();const close = useContext(CloseContext);const placement = (align === "center" ? side : `${side} ${align}`) as ComponentProps<typeof HeroPopover.Content@@ -70,7 +72,9 @@ export function PopoverContent({containerPadding={collisionPadding}isNonModal={!modal}UNSTABLE_portalContainer={- usePortal ? undefined : (document.getElementById("root") ?? undefined)+ usePortal+ ? undefined+ : (scopedPortalContainer ?? document.getElementById("root") ?? undefined)}className="max-w-[calc(100vw-24px)]">diff --git a/src/components/video-editor/ProjectBrowserDialog.tsx b/src/components/video-editor/ProjectBrowserDialog.tsxindex 4c7c727b..9b686795 100644--- a/src/components/video-editor/ProjectBrowserDialog.tsx+++ b/src/components/video-editor/ProjectBrowserDialog.tsx@@ -1,5 +1,5 @@import { Card, Popover } from "@heroui/react";-import { useEffect, useMemo, useRef } from "react";+import { useEffect, useRef } from "react";import { Button } from "@/components/ui/button";import { toFileUrl } from "./projectPersistence";@@ -34,7 +34,6 @@ export default function ProjectBrowserDialog({renderMode = "floating",}: ProjectBrowserDialogProps) {const panelRef = useRef<HTMLDivElement>(null);- const visibleEntries = useMemo(() => entries.slice(0, 24), [entries]);useEffect(() => {if (!open) {onPanelHeightChange?.(0);@@ -55,7 +54,7 @@ export default function ProjectBrowserDialog({const content = (<Cardref={panelRef}- className="w-[340px] max-w-[calc(100vw-24px)] rounded-none bg-transparent p-4 shadow-none"+ className={`${renderMode === "inline" ? "w-full" : "w-[340px]"} min-w-0 max-w-[calc(100vw-24px)] rounded-none bg-transparent p-3 shadow-none`}><Card.Header className="flex-row items-center justify-between gap-3"><Card.Title>Projects</Card.Title>@@ -65,10 +64,10 @@ export default function ProjectBrowserDialog({</Button>)}</Card.Header>- <Card.Content className="max-h-80 overflow-auto min-w-0">- {visibleEntries.length ? (+ <Card.Content className="custom-scrollbar max-h-80 overflow-y-auto overflow-x-hidden min-w-0">+ {entries.length ? (<div className="space-y-1">- {visibleEntries.map((entry) => (+ {entries.map((entry) => (<Buttonkey={entry.path}variant="ghost"diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsxindex 11ee260a..d5711df8 100644--- a/src/components/video-editor/SettingsPanel.tsx+++ b/src/components/video-editor/SettingsPanel.tsx@@ -64,14 +64,12 @@ import {ADVANCED_VERTICAL_PADDING_MAX,DEFAULT_AUTO_CAPTION_SETTINGS,DEFAULT_CROP_REGION,- DEFAULT_CURSOR_CLICK_BOUNCE,DEFAULT_CURSOR_CLICK_BOUNCE_DURATION,DEFAULT_CURSOR_CLICK_EFFECT,DEFAULT_CURSOR_CLICK_EFFECT_COLOR,DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS,DEFAULT_CURSOR_CLICK_EFFECT_OPACITY,DEFAULT_CURSOR_CLICK_EFFECT_SCALE,- DEFAULT_CURSOR_SIZE,DEFAULT_CURSOR_STYLE,DEFAULT_CURSOR_SWAY,DEFAULT_PADDING,@@ -1133,7 +1131,6 @@ export function SettingsPanel({);const removeBackgroundEnabled = aspectRatio === "native" && isZeroPadding(padding);- const [backgroundDirection, setBackgroundDirection] = useState(1);const [backgroundTab, setBackgroundTab] = useState<BackgroundTab>(() =>getBackgroundTabForWallpaper(selected),);@@ -1227,7 +1224,7 @@ export function SettingsPanel({key: wallpaper ? `builtin/${wallpaper.id}` : previewPath,label: wallpaper?.label ?? `Wallpaper ${index + 1}`,value: wallpaper?.publicPath ?? previewPath,- previewUrl: previewPath,+ previewUrl: wallpaperPreviewPaths.length ? previewPath : "",};});@@ -1606,13 +1603,11 @@ export function SettingsPanel({<SliderControllabel={tSettings("effects.backgroundBlur")}value={backgroundBlur}- defaultValue={initialEditorPreferences.backgroundBlur}min={0}max={8}step={0.25}onChange={(v) => onBackgroundBlurChange?.(v)}formatValue={(v) => `${v.toFixed(1)}px`}- parseInput={(text) => parseFloat(text.replace(/px$/, ""))}/></section>@@ -1622,10 +1617,6 @@ export function SettingsPanel({value={backgroundTab}onValueChange={(value) => {if (value) {- const order = ["image", "video", "color", "gradient"];- setBackgroundDirection(- order.indexOf(value) > order.indexOf(backgroundTab) ? 1 : -1,- );setBackgroundTab(value as typeof backgroundTab);}}}@@ -1650,124 +1641,105 @@ export function SettingsPanel({))}</ChoiceGroup>- <div className="pt-4 overflow-hidden">- <AnimatePresence mode="wait" initial={false} custom={backgroundDirection}>- <motion.div- key={backgroundTab}- custom={backgroundDirection}- variants={{- enter: (direction: number) => ({- x: `${direction * 100}%`,- opacity: 0,- }),- center: { x: 0, opacity: 1 },- exit: (direction: number) => ({- x: `${direction * -100}%`,- opacity: 0,- }),- }}- initial="enter"- animate="center"- exit="exit"- transition={{ duration: 0.2, ease: "easeOut" }}- >- {backgroundTab === "image" || backgroundTab === "video" ? (- <>- <input- type="file"- ref={fileInputRef}- onChange={handleImageUpload}- accept=".jpg,.jpeg,image/jpeg"- className="hidden"- />- <WallpaperGrid- addLabel={- backgroundTab === "image"- ? tSettings(- "background.addWallpaper",- "Add wallpaper",- )- : tSettings(- "background.addVideoWallpaper",- "Add video wallpaper",- )- }- onAdd={- backgroundTab === "image"- ? () => fileInputRef.current?.click()- : handleVideoUpload- }- onSelect={onWallpaperChange}- onRemove={handleRemoveCustomImage}- isSelected={getWallpaperTileState}- items={[- ...customImages- .filter(- (url) =>- isVideoWallpaperSource(url) ===- (backgroundTab === "video"),+ <input+ type="file"+ ref={fileInputRef}+ onChange={handleImageUpload}+ accept=".jpg,.jpeg,image/jpeg"+ className="hidden"+ />+ <div className="grid pt-4 overflow-hidden" data-testid="background-slider">+ <div+ key={backgroundTab}+ data-background-panel={backgroundTab}+ className="editor-section-enter min-w-0"+ >+ {backgroundTab === "image" || backgroundTab === "video" ? (+ <>+ <WallpaperGrid+ addLabel={+ backgroundTab === "image"+ ? tSettings("background.addWallpaper", "Add wallpaper")+ : tSettings(+ "background.addVideoWallpaper",+ "Add video wallpaper",)- .map((url, index) => ({- key: `custom-${index}`,- value: url,- previewUrl: url,- label: isVideoWallpaperSource(url)- ? (url.split(/[\\/]/).pop() ??- "Custom video wallpaper")- : `${tSettings("background.customWallpaper", "Custom wallpaper")} ${index + 1}`,- removable: true,- })),- ...(backgroundTab === "image"- ? imageWallpaperTiles- : videoWallpaperTiles),- ]}+ }+ onAdd={+ backgroundTab === "image"+ ? () => fileInputRef.current?.click()+ : handleVideoUpload+ }+ onSelect={onWallpaperChange}+ onRemove={handleRemoveCustomImage}+ isSelected={getWallpaperTileState}+ items={[+ ...customImages+ .filter(+ (url) =>+ isVideoWallpaperSource(url) ===+ (backgroundTab === "video"),+ )+ .map((url, index) => ({+ key: `custom-${index}`,+ value: url,+ previewUrl: url,+ label: isVideoWallpaperSource(url)+ ? (url.split(/[\\/]/).pop() ??+ "Custom video wallpaper")+ : `${tSettings("background.customWallpaper", "Custom wallpaper")} ${index + 1}`,+ removable: true,+ })),+ ...(backgroundTab === "image"+ ? imageWallpaperTiles+ : videoWallpaperTiles),+ ]}+ />+ </>+ ) : backgroundTab === "color" ? (+ <div className="mt-0 space-y-4">+ <div className="flex flex-col gap-3">+ <ColorPalette+ color={selectedColor}+ colors={visibleColorPalette}+ onChange={({ hex }) => {+ setSelectedColor(hex);+ onWallpaperChange(hex);+ }}+ />+ <ColorControl+ label="Custom color"+ value={selectedColor}+ onChange={(color) => {+ setSelectedColor(color);+ onWallpaperChange(color);+ }}/>- </>- ) : backgroundTab === "color" ? (- <div className="mt-0 space-y-4">- <div className="flex flex-col gap-3">- <ColorPalette- color={selectedColor}- colors={visibleColorPalette}- onChange={({ hex }) => {- setSelectedColor(hex);- onWallpaperChange(hex);- }}- />- <ColorControl- label="Custom color"- value={selectedColor}- onChange={(color) => {- setSelectedColor(color);- onWallpaperChange(color);- }}- />- </div>- </div>- ) : (- <div className="mt-0 grid grid-cols-5 gap-2">- {GRADIENTS.map((g, idx) => (- <Button- variant="ghost"- key={g}- className={wallpaperTileClass(gradient === g)}- aria-label={`Gradient ${idx + 1}`}- onClick={() => {- setGradient(g);- onWallpaperChange(g);- }}- role="button"- >- <div- className="absolute inset-[1px] overflow-hidden rounded-[8px]"- style={{ background: g }}- />- </Button>- ))}</div>- )}- </motion.div>- </AnimatePresence>+ </div>+ ) : (+ <div className="mt-0 grid grid-cols-5 gap-2">+ {GRADIENTS.map((g, idx) => (+ <Button+ variant="ghost"+ key={g}+ className={wallpaperTileClass(gradient === g)}+ aria-label={`Gradient ${idx + 1}`}+ onClick={() => {+ setGradient(g);+ onWallpaperChange(g);+ }}+ role="button"+ >+ <div+ className="absolute inset-[1px] overflow-hidden rounded-[8px]"+ style={{ background: g }}+ />+ </Button>+ ))}+ </div>+ )}+ </div></div></div></div>@@ -1849,24 +1821,20 @@ export function SettingsPanel({<SliderControllabel={tSettings("effects.shadow")}value={shadowIntensity}- defaultValue={initialEditorPreferences.shadowIntensity}min={0}max={1}step={0.01}onChange={(v) => onShadowChange?.(v)}formatValue={(v) => `${Math.round(v * 100)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100}/><SliderControllabel={tSettings("effects.radius", "Radius")}value={borderRadius}- defaultValue={initialEditorPreferences.borderRadius}min={0}max={50}step={0.1}onChange={(v) => onBorderRadiusChange?.(v)}formatValue={(v) => `${v}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/><div className="flex flex-col gap-3 pt-0.5">{advanced && (@@ -1884,59 +1852,49 @@ export function SettingsPanel({<SliderControllabel={tSettings("effects.padding")}value={padding.top}- defaultValue={DEFAULT_PADDING.top}min={0}max={100}step={1}onChange={(v) => handlePaddingSideChange("top", v)}formatValue={(v) => `${v}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/>) : (<div className="grid grid-cols-2 gap-x-3 gap-y-1.5"><SliderControllabel={tSettings("effects.paddingTop", "Top")}value={padding.top}- defaultValue={DEFAULT_PADDING.top}min={0}max={ADVANCED_VERTICAL_PADDING_MAX}step={1}onChange={(v) => handlePaddingSideChange("top", v)}formatValue={(v) => `${v}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/><SliderControllabel={tSettings("effects.paddingBottom", "Bottom")}value={padding.bottom}- defaultValue={DEFAULT_PADDING.bottom}min={0}max={ADVANCED_VERTICAL_PADDING_MAX}step={1}onChange={(v) => handlePaddingSideChange("bottom", v)}formatValue={(v) => `${v}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/><SliderControllabel={tSettings("effects.paddingLeft", "Left")}value={padding.left}- defaultValue={DEFAULT_PADDING.left}min={0}max={100}step={1}onChange={(v) => handlePaddingSideChange("left", v)}formatValue={(v) => `${v}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/><SliderControllabel={tSettings("effects.paddingRight", "Right")}value={padding.right}- defaultValue={DEFAULT_PADDING.right}min={0}max={100}step={1}onChange={(v) => handlePaddingSideChange("right", v)}formatValue={(v) => `${v}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/></div>)}@@ -1975,46 +1933,38 @@ export function SettingsPanel({<SliderControllabel={tSettings("crop.top", "Top")}value={cropTop}- defaultValue={0}min={0}max={50}step={1}onChange={(v) => setCropInset("top", v)}formatValue={(v) => `${Math.round(v)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/><SliderControllabel={tSettings("crop.bottom", "Bottom")}value={cropBottom}- defaultValue={0}min={0}max={50}step={1}onChange={(v) => setCropInset("bottom", v)}formatValue={(v) => `${Math.round(v)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/><SliderControllabel={tSettings("crop.left", "Left")}value={cropLeft}- defaultValue={0}min={0}max={50}step={1}onChange={(v) => setCropInset("left", v)}formatValue={(v) => `${Math.round(v)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/><SliderControllabel={tSettings("crop.right", "Right")}value={cropRight}- defaultValue={0}min={0}max={50}step={1}onChange={(v) => setCropInset("right", v)}formatValue={(v) => `${Math.round(v)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/></div></section>@@ -2202,13 +2152,11 @@ export function SettingsPanel({<SliderControllabel={tSettings("captions.fontSize", "Font size")}value={autoCaptionSettings.fontSize}- defaultValue={DEFAULT_AUTO_CAPTION_SETTINGS.fontSize}min={16}max={72}step={1}onChange={(value) => updateAutoCaptionSettings({ fontSize: value })}formatValue={(value) => `${Math.round(value)}px`}- parseInput={(text) => parseFloat(text.replace(/px$/, ""))}/><div className="flex items-center justify-between py-2"><span className="text-sm font-medium text-foreground">@@ -2225,7 +2173,6 @@ export function SettingsPanel({<SliderControllabel={tSettings("captions.rowCount", "Rows")}value={autoCaptionSettings.maxRows}- defaultValue={DEFAULT_AUTO_CAPTION_SETTINGS.maxRows}min={1}max={4}step={1}@@ -2233,40 +2180,34 @@ export function SettingsPanel({updateAutoCaptionSettings({ maxRows: Math.round(value) })}formatValue={(value) => `${Math.round(value)}`}- parseInput={(text) => parseFloat(text)}/>)}{advanced && (<SliderControllabel={tSettings("captions.bottomOffset", "Bottom offset")}value={autoCaptionSettings.bottomOffset}- defaultValue={DEFAULT_AUTO_CAPTION_SETTINGS.bottomOffset}min={0}max={30}step={1}onChange={(value) => updateAutoCaptionSettings({ bottomOffset: value })}formatValue={(value) => `${Math.round(value)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/>)}{advanced && (<SliderControllabel={tSettings("captions.maxWidth", "Max width")}value={autoCaptionSettings.maxWidth}- defaultValue={DEFAULT_AUTO_CAPTION_SETTINGS.maxWidth}min={40}max={95}step={1}onChange={(value) => updateAutoCaptionSettings({ maxWidth: value })}formatValue={(value) => `${Math.round(value)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/>)}{advanced && (<SliderControllabel={tSettings("captions.boxRadius", "Box radius")}value={autoCaptionSettings.boxRadius}- defaultValue={DEFAULT_AUTO_CAPTION_SETTINGS.boxRadius}min={0}max={40}step={0.5}@@ -2274,14 +2215,12 @@ export function SettingsPanel({formatValue={(value) =>`${Number.isInteger(value) ? value.toFixed(0) : value.toFixed(1)}px`}- parseInput={(text) => parseFloat(text.replace(/px$/, ""))}/>)}{advanced && (<SliderControllabel={tSettings("captions.backgroundOpacity", "Background opacity")}value={autoCaptionSettings.backgroundOpacity}- defaultValue={DEFAULT_AUTO_CAPTION_SETTINGS.backgroundOpacity}min={0}max={1}step={0.01}@@ -2289,7 +2228,6 @@ export function SettingsPanel({updateAutoCaptionSettings({ backgroundOpacity: value })}formatValue={(value) => `${Math.round(value * 100)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100}/>)}</div>@@ -2505,9 +2443,6 @@ export function SettingsPanel({"Camera stiffness",)}value={cameraSpringStiffnessMultiplier}- defaultValue={- initialEditorPreferences.cameraSpringStiffnessMultiplier- }min={0.25}max={3}step={0.01}@@ -2515,7 +2450,6 @@ export function SettingsPanel({onCameraSpringStiffnessMultiplierChange?.(value)}formatValue={(value) => `${value.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/><SliderControllabel={tSettings(@@ -2523,15 +2457,11 @@ export function SettingsPanel({"Camera damping",)}value={cameraSpringDampingMultiplier}- defaultValue={- initialEditorPreferences.cameraSpringDampingMultiplier- }min={0.25}max={3}step={0.01}onChange={(value) => onCameraSpringDampingMultiplierChange?.(value)}formatValue={(value) => `${value.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/><SliderControllabel={tSettings(@@ -2539,13 +2469,11 @@ export function SettingsPanel({"Camera mass",)}value={cameraSpringMassMultiplier}- defaultValue={initialEditorPreferences.cameraSpringMassMultiplier}min={0.25}max={3}step={0.01}onChange={(value) => onCameraSpringMassMultiplierChange?.(value)}formatValue={(value) => `${value.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/></div>@@ -2567,9 +2495,6 @@ export function SettingsPanel({"Spring stiffness",)}value={cursorSpringStiffnessMultiplier}- defaultValue={- initialEditorPreferences.cursorSpringStiffnessMultiplier- }min={0.25}max={3}step={0.01}@@ -2577,7 +2502,6 @@ export function SettingsPanel({onCursorSpringStiffnessMultiplierChange?.(value)}formatValue={(value) => `${value.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/><SliderControllabel={tSettings(@@ -2585,15 +2509,11 @@ export function SettingsPanel({"Spring damping",)}value={cursorSpringDampingMultiplier}- defaultValue={- initialEditorPreferences.cursorSpringDampingMultiplier- }min={0.25}max={3}step={0.01}onChange={(value) => onCursorSpringDampingMultiplierChange?.(value)}formatValue={(value) => `${value.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/><SliderControllabel={tSettings(@@ -2601,13 +2521,11 @@ export function SettingsPanel({"Spring mass",)}value={cursorSpringMassMultiplier}- defaultValue={initialEditorPreferences.cursorSpringMassMultiplier}min={0.25}max={3}step={0.01}onChange={(value) => onCursorSpringMassMultiplierChange?.(value)}formatValue={(value) => `${value.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/></div></section>@@ -2671,50 +2589,41 @@ export function SettingsPanel({</ChoiceGroup></>)}- <div className="flex items-center justify-between gap-3">- <SectionLabel>{tSettings("zoom.globalSettings", "Animation")}</SectionLabel>- <Button- variant="ghost"- size="sm"- className="text-xs text-muted"- type="button"- onClick={resetZoomSection}- >- {t("common.actions.reset", "Reset")}- </Button>- </div>{advanced && (- <div className="flex items-center justify-between py-2">- <span className="text-xs text-muted-foreground">- {tSettings("effects.classicZoom", "Classic Animation")}- </span>- <Switch- aria-label={tSettings("effects.classicZoom", "Classic Animation")}- checked={zoomClassicMode}- onCheckedChange={(v) => onZoomClassicModeChange?.(v)}- />- </div>- )}- {!zoomClassicMode && (- <div className="text-xs text-muted-foreground">- {tSettings(- "effects.motionPresetsZoomHint",- "Zoom motion presets are available in Settings.",+ <>+ <div className="flex items-center justify-between gap-3">+ <SectionLabel>+ {tSettings("zoom.globalSettings", "Animation")}+ </SectionLabel>+ <Button+ variant="ghost"+ size="sm"+ className="text-xs text-muted"+ type="button"+ onClick={resetZoomSection}+ >+ {t("common.actions.reset", "Reset")}+ </Button>+ </div>+ <div className="flex items-center justify-between py-2">+ <span className="text-xs text-muted-foreground">+ {tSettings("effects.classicZoom", "Classic Animation")}+ </span>+ <Switch+ aria-label={tSettings("effects.classicZoom", "Classic Animation")}+ checked={zoomClassicMode}+ onCheckedChange={(v) => onZoomClassicModeChange?.(v)}+ />+ </div>+ {!zoomClassicMode && (+ <div className="text-xs text-muted-foreground">+ {tSettings(+ "effects.motionPresetsZoomHint",+ "Zoom motion presets are available in Settings.",+ )}+ </div>)}- </div>- )}- {selectedZoomId && (- <Button- onClick={() => {- if (selectedZoomId && onZoomDelete) onZoomDelete(selectedZoomId);- }}- variant="destructive-soft"- size="sm"- className="mt-1 h-9 w-full gap-2 text-xs"- >- <Trash2 className="h-3 w-3" />- {tSettings("zoom.deleteZoom")}- </Button>+ </>)}</section>);@@ -2739,13 +2648,11 @@ export function SettingsPanel({<SliderControllabel={tSettings("audio.volume", "Volume")}value={selectedAudioVolume ?? 1}- defaultValue={1}min={0}max={1}step={0.01}onChange={(v) => onAudioVolumeChange?.(v)}formatValue={(v) => `${Math.round(v * 100)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100}/><div className="flex items-center justify-between py-2"><span className="text-xs text-muted-foreground">@@ -2762,20 +2669,17 @@ export function SettingsPanel({const clipSectionContent = (<section className="flex flex-col gap-3">- <SectionLabel>{tSettings("clip.title", "Clip")}</SectionLabel><SliderControllabel={tSettings("speed.label", "Speed")}value={Math.min(clipSpeedRange.max,Math.max(clipSpeedRange.min, selectedClipSpeed ?? 1),)}- defaultValue={1}min={clipSpeedRange.min}max={clipSpeedRange.max}step={0.25}onChange={(value) => onClipSpeedChange?.(value)}formatValue={(value) => `${value}×`}- parseInput={(text) => Number.parseFloat(text)}/>{selectedClipSpeed != null &&(selectedClipSpeed < clipSpeedRange.min ||@@ -2808,7 +2712,6 @@ export function SettingsPanel({const captionSectionContent = (<section className="flex flex-col gap-4">- <SectionLabel>{tSettings("sections.caption", "Caption")}</SectionLabel>{selectedCaptionId !== null ? (<CaptionListPanelcues={autoCaptions}@@ -2930,13 +2833,11 @@ export function SettingsPanel({<SliderControllabel={tSettings("effects.cursorSize")}value={cursorSize}- defaultValue={DEFAULT_CURSOR_SIZE}min={0.5}max={10}step={0.05}onChange={(v) => onCursorSizeChange?.(v)}formatValue={(v) => `${v.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/><CursorClickEffectCardstitle={tSettings(@@ -2980,13 +2881,11 @@ export function SettingsPanel({"Effect Size",)}value={cursorClickEffectScale}- defaultValue={DEFAULT_CURSOR_CLICK_EFFECT_SCALE}min={0.5}max={2}step={0.05}onChange={(v) => onCursorClickEffectScaleChange?.(v)}formatValue={(v) => `${v.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/><SliderControllabel={tSettings(@@ -2994,15 +2893,11 @@ export function SettingsPanel({"Effect Opacity",)}value={cursorClickEffectOpacity}- defaultValue={DEFAULT_CURSOR_CLICK_EFFECT_OPACITY}min={0}max={1}step={0.01}onChange={(v) => onCursorClickEffectOpacityChange?.(v)}formatValue={(v) => `${Math.round(v * 100)}%`}- parseInput={(text) =>- parseFloat(text.replace(/%$/, "")) / 100- }/><SliderControllabel={tSettings(@@ -3010,28 +2905,22 @@ export function SettingsPanel({"Effect Duration",)}value={cursorClickEffectDurationMs}- defaultValue={DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS}min={120}max={1200}step={10}onChange={(v) => onCursorClickEffectDurationMsChange?.(v)}formatValue={(v) => `${Math.round(v)} ms`}- parseInput={(text) =>- parseFloat(text.replace(/ms$/i, "").trim())- }/></div>) : null}<SliderControllabel={tSettings("effects.cursorClickBounce")}value={cursorClickBounce}- defaultValue={DEFAULT_CURSOR_CLICK_BOUNCE}min={0}max={5}step={0.05}onChange={(v) => onCursorClickBounceChange?.(v)}formatValue={(v) => `${v.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/>{advanced && (<SliderControl@@ -3040,22 +2929,17 @@ export function SettingsPanel({"Bounce Speed",)}value={cursorClickBounceDuration}- defaultValue={DEFAULT_CURSOR_CLICK_BOUNCE_DURATION}min={60}max={500}step={5}onChange={(v) => onCursorClickBounceDurationChange?.(v)}formatValue={(v) => `${Math.round(v)} ms`}- parseInput={(text) =>- parseFloat(text.replace(/ms$/i, "").trim())- }/>)}{advanced && (<SliderControllabel={tSettings("effects.cursorSway")}value={toCursorSwaySliderValue(cursorSway)}- defaultValue={toCursorSwaySliderValue(DEFAULT_CURSOR_SWAY)}min={0}max={toCursorSwaySliderValue(2)}step={toCursorSwaySliderValue(0.05)}@@ -3065,11 +2949,6 @@ export function SettingsPanel({formatValue={(v) =>v <= 0 ? tSettings("effects.off") : `${v.toFixed(2)}×`}- parseInput={(text) => {- const normalized = text.trim().toLowerCase();- if (normalized === "off") return 0;- return parseFloat(text.replace(/×$/, ""));- }}/>)}{advanced && showDevMotionControls ? (@@ -3147,25 +3026,21 @@ export function SettingsPanel({<SliderControllabel={tSettings("effects.webcamWidth", "Webcam Width")}value={webcamWidth}- defaultValue={DEFAULT_WEBCAM_SIZE}min={10}max={100}step={1}onChange={(v) => updateWebcam({ width: v, size: v })}formatValue={(v) => `${Math.round(v)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/>{advanced && (<SliderControllabel={tSettings("effects.webcamHeight", "Webcam Height")}value={webcamHeight}- defaultValue={DEFAULT_WEBCAM_SIZE}min={10}max={100}step={1}onChange={(v) => updateWebcam({ height: v })}formatValue={(v) => `${Math.round(v)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/>)}{advanced && (@@ -3264,7 +3139,6 @@ export function SettingsPanel({<SliderControllabel={tSettings("effects.webcamHorizontal", "Horizontal")}value={webcamPositionX * 100}- defaultValue={DEFAULT_WEBCAM_POSITION_X * 100}min={0}max={100}step={1}@@ -3275,12 +3149,10 @@ export function SettingsPanel({})}formatValue={(v) => `${Math.round(v)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/><SliderControllabel={tSettings("effects.webcamVertical", "Vertical")}value={webcamPositionY * 100}- defaultValue={DEFAULT_WEBCAM_POSITION_Y * 100}min={0}max={100}step={1}@@ -3291,7 +3163,6 @@ export function SettingsPanel({})}formatValue={(v) => `${Math.round(v)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/></>) : null}@@ -3299,37 +3170,31 @@ export function SettingsPanel({<SliderControllabel={tSettings("effects.webcamMargin", "Margin")}value={webcam?.margin ?? DEFAULT_WEBCAM_MARGIN}- defaultValue={DEFAULT_WEBCAM_MARGIN}min={0}max={96}step={1}onChange={(v) => updateWebcam({ margin: v })}formatValue={(v) => `${Math.round(v)}px`}- parseInput={(text) => parseFloat(text.replace(/px$/, ""))}/>)}<SliderControllabel={tSettings("effects.webcamRoundness")}value={webcam?.roundness ?? DEFAULT_WEBCAM_ROUNDNESS}- defaultValue={DEFAULT_WEBCAM_ROUNDNESS}min={0}max={100}step={1}onChange={(v) => updateWebcam({ roundness: v })}formatValue={(v) => `${Math.round(v)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/>{advanced && (<SliderControllabel={tSettings("effects.webcamShadow")}value={webcam?.shadow ?? DEFAULT_WEBCAM_SHADOW}- defaultValue={DEFAULT_WEBCAM_SHADOW}min={0}max={1}step={0.01}onChange={(v) => updateWebcam({ shadow: v })}formatValue={(v) => `${Math.round(v * 100)}%`}- parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100}/>)}<div className="py-2">diff --git a/src/components/video-editor/SliderControl.tsx b/src/components/video-editor/SliderControl.tsxindex 71e96623..c24600c2 100644--- a/src/components/video-editor/SliderControl.tsx+++ b/src/components/video-editor/SliderControl.tsx@@ -4,14 +4,11 @@ interface SliderControlProps {label: string;ariaLabel?: string;value: number;- defaultValue: number;min: number;max: number;step: number;onChange: (value: number) => void;formatValue: (value: number) => string;- parseInput: (text: string) => number | null;- accentColor?: "purple" | "blue";}export const SliderControl = memo(function SliderControl({label,diff --git a/src/components/video-editor/editorPreferences.test.ts b/src/components/video-editor/editorPreferences.test.tsindex 78481563..1a88a793 100644--- a/src/components/video-editor/editorPreferences.test.ts+++ b/src/components/video-editor/editorPreferences.test.ts@@ -501,3 +501,16 @@ describe("editorPreferences", () => {expect(saveEditorPresets([])).toBe(false);});});+++describe("source-specific webcam metadata", () => {+ it("does not copy imported source ranges into a reusable style preset", () => {+ vi.stubGlobal("localStorage", createStorageMock());+ saveEditorPresets([{ id: "webcam", name: "Webcam", createdAt: "2026-09-20T00:00:00Z", updatedAt: "2026-09-20T00:00:00Z", snapshot: {+ ...DEFAULT_EDITOR_PREFERENCES, cropRegion: DEFAULT_CROP_REGION, autoCaptionSettings: DEFAULT_AUTO_CAPTION_SETTINGS,+ webcam: { ...DEFAULT_EDITOR_PREFERENCES.webcam, sourcePath: "/imported-webcam.mp4", visibleRanges: [{ startMs: 1000, endMs: 2000 }] },+ } as never }]);+ expect(loadEditorPresets()[0].snapshot.webcam).not.toHaveProperty("visibleRanges");+ expect(loadEditorPresets()[0].snapshot.webcam).not.toHaveProperty("sourcePath");+ });+});diff --git a/src/components/video-editor/editorPreferences.ts b/src/components/video-editor/editorPreferences.tsindex bca8b266..f696f0a9 100644--- a/src/components/video-editor/editorPreferences.ts+++ b/src/components/video-editor/editorPreferences.ts@@ -65,7 +65,7 @@ type PartialEditorControls = Partial<PersistedEditorControls>;type PresetAutoCaptionSettings = ProjectEditorState["autoCaptionSettings"];type PresetCropRegion = ProjectEditorState["cropRegion"];-type PresetWebcamSettings = Omit<ProjectEditorState["webcam"], "sourcePath">;+type PresetWebcamSettings = Omit<ProjectEditorState["webcam"], "sourcePath" | "visibleRanges">;export interface EditorPresetSnapshot extends Omit<PersistedEditorControls, "webcam"> {borderRadiusUnit: "percent";@@ -214,7 +214,11 @@ function normalizeEditorPresetSnapshot(candidate: unknown): EditorPresetSnapshotnormalizedPreferences,normalizedPreferences,);- const { sourcePath: _sourcePath, ...webcam } = normalizedControls.webcam;+ const {+ sourcePath: _sourcePath,+ visibleRanges: _visibleRanges,+ ...webcam+ } = normalizedControls.webcam;return {...normalizedControls,diff --git a/src/components/video-editor/layout/EditorHeader.tsx b/src/components/video-editor/layout/EditorHeader.tsxindex 6d3e9970..2bf6550a 100644--- a/src/components/video-editor/layout/EditorHeader.tsx+++ b/src/components/video-editor/layout/EditorHeader.tsx@@ -1,6 +1,7 @@import { Input } from "@/components/ui/input";import {FolderOpen,+ FilmStrip,ArrowClockwise as Redo2,ArrowCounterClockwise as Undo2,} from "@phosphor-icons/react";@@ -18,6 +19,8 @@ import { EditorExportMenu } from "./EditorExportMenu";import { EditorPresetMenu } from "./EditorPresetMenu";type Props = {+ videosOpen?: boolean;+ onToggleVideos?: () => void;t: ReturnType<typeof useI18n>["t"];headerLeftControlsPaddingClass: string;project: ReturnType<typeof useProjectState>;@@ -48,6 +51,10 @@ type Props = {handleStartExportFromDropdown: () => void;revealExportedFile: () => void;exportMessage: string | null;+ prepareExportForShare: () => Promise<string | undefined>;+ onRequestShareSignIn: () => void;+ shareRequestNonce: number;+ authToken?: string;};export function EditorHeader(props: Props) {@@ -100,6 +107,16 @@ export function EditorHeader(props: Props) {className={`editor-header-start flex items-center justify-self-start gap-1 ${headerLeftControlsPaddingClass}`}style={{ WebkitAppRegion: "no-drag" } as CSSProperties}>+ <Button+ type="button"+ variant="secondary"+ className="[--button-bg:var(--surface)] [--button-fg:var(--foreground)] mr-2 inline-flex h-9 min-w-[104px] items-center justify-center gap-2 px-4.5"+ aria-expanded={props.videosOpen}+ onClick={props.onToggleVideos}+ >+ <FilmStrip className="h-4 w-4" />+ <span className="text-sm font-semibold tracking-tight">Videos</span>+ </Button><Buttonref={projectBrowserTriggerRef}type="button"@@ -219,6 +236,11 @@ export function EditorHeader(props: Props) {handleStartExportFromDropdown={handleStartExportFromDropdown}revealExportedFile={revealExportedFile}exportMessage={exportMessage}+ projectTitle={projectDisplayName}+ prepareExportForShare={props.prepareExportForShare}+ onRequestShareSignIn={props.onRequestShareSignIn}+ shareRequestNonce={props.shareRequestNonce}+ authToken={props.authToken}/></div></header>diff --git a/src/components/video-editor/layout/EditorPreviewPanel.tsx b/src/components/video-editor/layout/EditorPreviewPanel.tsxindex 3dd99847..cf0bc9c6 100644--- a/src/components/video-editor/layout/EditorPreviewPanel.tsx+++ b/src/components/video-editor/layout/EditorPreviewPanel.tsx@@ -18,6 +18,7 @@ import {} from "@phosphor-icons/react";import type { Dispatch, RefObject, SetStateAction } from "react";import { Button } from "@/components/ui/button";+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";import {DropdownMenu,DropdownMenuContent,@@ -70,7 +71,7 @@ type Props = {setIsPreviewReady: Dispatch<SetStateAction<boolean>>;setCurrentTime: Dispatch<SetStateAction<number>>;setIsPlaying: Dispatch<SetStateAction<boolean>>;- setError: Dispatch<SetStateAction<string | null>>;+ setError: (message: string | null) => void;};function formatTime(seconds: number) {@@ -341,32 +342,45 @@ export function EditorPreviewPanel(props: Props) {</div></div>- <div className="editor-playback-volume z-10 ml-auto flex items-center gap-2">- <div className="flex items-center gap-1.5">- <Button- variant="ghost"- type="button"- title={t("editor.playback.muteUnmute")}- onClick={() => setPreviewVolume(previewVolume <= 0.001 ? 1 : 0)}+ <div className="editor-playback-volume z-10 ml-auto flex items-center">+ <Popover>+ <PopoverTrigger asChild>+ <Button+ variant="ghost"+ size="icon"+ aria-label={t("editor.playback.volume", "Preview volume")}+ title={t("editor.playback.volume", "Preview volume")}+ >+ {previewVolume <= 0.001 ? (+ <SpeakerX className="size-3.5" />+ ) : previewVolume < 0.5 ? (+ <SpeakerLow className="size-3.5" />+ ) : (+ <SpeakerHigh className="size-3.5" />+ )}+ </Button>+ </PopoverTrigger>+ <PopoverContent+ side="top"+ sideOffset={10}+ aria-label="Preview volume"+ className="flex w-14 flex-col items-center gap-3 p-3">- {previewVolume <= 0.001 ? (- <SpeakerX className="h-3.5 w-3.5" />- ) : previewVolume < 0.5 ? (- <SpeakerLow className="h-3.5 w-3.5" />- ) : (- <SpeakerHigh className="h-3.5 w-3.5" />- )}- </Button>- <Slider- aria-label={t("editor.playback.volume", "Preview volume")}- min={0}- max={1}- step={0.01}- value={[previewVolume]}- onValueChange={([value]) => setPreviewVolume(value)}- className="w-24"- />- </div>+ <span className="text-[10px] tabular-nums text-muted-foreground">+ {Math.round(previewVolume * 100)}%+ </span>+ <Slider+ aria-label={t("editor.playback.volume", "Preview volume")}+ orientation="vertical"+ min={0}+ max={1}+ step={0.01}+ value={[previewVolume]}+ onValueChange={([value]) => setPreviewVolume(value)}+ className="h-28"+ />+ </PopoverContent>+ </Popover></div></div></div>diff --git a/src/components/video-editor/layout/EditorShell.tsx b/src/components/video-editor/layout/EditorShell.tsxindex ea735827..55654adf 100644--- a/src/components/video-editor/layout/EditorShell.tsx+++ b/src/components/video-editor/layout/EditorShell.tsx@@ -1,5 +1,11 @@+import { RecordlySignInDialog, type SignInReason } from "@/components/auth/RecordlySignInDialog";+import { useRecordlyAuth } from "@/components/auth/useRecordlyAuth";+import { useVideoSourceRecovery } from "../hooks/useVideoSourceRecovery";+import { useRecordingLibrary } from "../library/useRecordingLibrary";+import { RecordingLibraryPanel } from "../library/RecordingLibraryPanel";+import { RECORDING_DRAG_TYPE } from "@/types/recordingLibrary";import { Button } from "@/components/ui/button";-import type { ComponentProps } from "react";+import { useCallback, useEffect, useRef, useState, type ComponentProps } from "react";import { EditorAnnouncementBanner } from "@/components/announcements/EditorAnnouncementBanner";import { Toaster } from "@/components/ui/toast";import type { useI18n } from "@/contexts/I18nContext";@@ -47,6 +53,22 @@ type Props = {};export function EditorShell(props: Props) {+ const [signInOpen, setSignInOpen] = useState(false);+ const [signInReason, setSignInReason] = useState<SignInReason>("account");+ const [shareRequestNonce, setShareRequestNonce] = useState(0);+ const auth = useRecordlyAuth();+ const requestSignIn = (reason: SignInReason) => {+ if (reason === "share" && auth.user) {+ setShareRequestNonce((value) => value + 1);+ return;+ }+ setSignInReason(reason);+ setSignInOpen(true);+ };+ const handleAuthenticated = useCallback(() => {+ setSignInOpen(false);+ if (signInReason === "share") setShareRequestNonce((value) => value + 1);+ }, [signInReason]);const {t,project,@@ -69,6 +91,23 @@ export function EditorShell(props: Props) {effectiveShowCursor,previewAspectRatioValue,} = props;+ const library = useRecordingLibrary(project, timeline, ui, appearance);+ // biome-ignore lint/correctness/useExhaustiveDependencies: Changing the active inspector closes the Videos view.+ useEffect(() => {+ library.setOpen(false);+ }, [ui.activeEffectSection, library.setOpen]);+ const timelinePanelRef = useRef<HTMLDivElement>(null);+ const wasImporting = useRef(false);+ useEffect(() => {+ if (wasImporting.current && !library.importing) timelinePanelRef.current?.focus();+ wasImporting.current = library.importing;+ }, [library.importing]);+ const { setIsPreviewReady, setPreviewVersion } = ui;+ const remountRecoveredVideo = useCallback(() => {+ setIsPreviewReady(false);+ setPreviewVersion((version) => version + 1);+ }, [setIsPreviewReady, setPreviewVersion]);+ const handlePreviewError = useVideoSourceRecovery(project, remountRecoveredVideo);const {snapshot,history,@@ -123,6 +162,15 @@ export function EditorShell(props: Props) {return (<><EditorLoadingSkeleton />+ <RecordlySignInDialog+ open={signInOpen}+ onOpenChange={setSignInOpen}+ reason={signInReason}+ user={auth.user}+ configured={auth.configured}+ callbackError={auth.callbackError}+ onAuthenticated={handleAuthenticated}+ />{editorDialogs}<Toaster className="pointer-events-auto" /></>@@ -142,6 +190,15 @@ export function EditorShell(props: Props) {Open Projects</Button></div>+ <RecordlySignInDialog+ open={signInOpen}+ onOpenChange={setSignInOpen}+ reason={signInReason}+ user={auth.user}+ configured={auth.configured}+ callbackError={auth.callbackError}+ onAuthenticated={handleAuthenticated}+ />{editorDialogs}<Toaster className="pointer-events-auto" /></div>@@ -150,6 +207,8 @@ export function EditorShell(props: Props) {return (<div className="flex h-screen flex-col overflow-hidden bg-editor-bg text-foreground selection:bg-accent/20"><EditorHeader+ videosOpen={library.open}+ onToggleVideos={() => library.setOpen((open) => !open)}t={t}headerLeftControlsPaddingClass={headerLeftControlsPaddingClass}project={project}@@ -178,16 +237,77 @@ export function EditorShell(props: Props) {handleCancelExport={dialogActions.handleCancelExport}handleRetrySaveExport={dialogActions.handleRetrySaveExport}handleStartExportFromDropdown={dialogActions.handleStartExportFromDropdown}+ prepareExportForShare={dialogActions.prepareExportForShare}+ onRequestShareSignIn={() => requestSignIn("share")}+ shareRequestNonce={shareRequestNonce}+ authToken={auth.accessToken}revealExportedFile={dialogActions.revealExportedFile}exportMessage={exportMessage}/><EditorAnnouncementBanner />- <div className="relative flex min-h-0 flex-1 flex-col">+ <div+ className="relative flex min-h-0 flex-1 flex-col"+ onPointerDownCapture={(event) => {+ if ((event.target as HTMLElement).closest("[data-timeline-item]"))+ library.setOpen(false);+ }}+ onDragOver={(event) => {+ if (event.dataTransfer.types.includes(RECORDING_DRAG_TYPE)) {+ event.preventDefault();+ event.dataTransfer.dropEffect = "copy";+ }+ }}+ onDrop={(event) => {+ const path = event.dataTransfer.getData(RECORDING_DRAG_TYPE);+ if (!path) return;+ event.preventDefault();+ event.stopPropagation();+ const timelinePanel = (event.target as HTMLElement).closest(+ "[data-timeline-panel]",+ );+ let index: number | undefined;+ if (timelinePanel) {+ const clips = [+ ...timelinePanel.querySelectorAll<HTMLElement>(+ '[data-timeline-item][data-variant="clip"]',+ ),+ ].sort((a, b) => Number(a.dataset.startMs) - Number(b.dataset.startMs));+ index = clips.findIndex((clip) => {+ const rect = clip.getBoundingClientRect();+ return event.clientX < rect.left + rect.width / 2;+ });+ if (index < 0) index = clips.length;+ }+ let paths: unknown;+ try {+ paths = JSON.parse(path);+ } catch {+ paths = [path];+ }+ if (+ Array.isArray(paths) &&+ paths.every((value) => typeof value === "string" && value.length > 0)+ )+ void library.addToTimeline(paths, index);+ }}+ ><div className="relative z-10 flex min-h-0 flex-1 pt-3"><EditorSidebar+ onAccountClick={() => requestSignIn("account")}+ panelContent={+ library.open ? <RecordingLibraryPanel library={library} /> : undefined+ }t={t}activeSection={ui.activeEffectSection}- setActiveSection={ui.setActiveEffectSection}+ setActiveSection={(section) => {+ library.setOpen(false);+ timeline.setSelectedAnnotationId(null);+ timeline.setSelectedZoomId(null);+ timeline.setSelectedClipId(null);+ timeline.setSelectedAudioId(null);+ timeline.setSelectedCaptionId(null);+ ui.setActiveEffectSection(section);+ }}settingsPanelProps={settingsPanelProps}/><EditorPreviewPanel@@ -222,10 +342,11 @@ export function EditorShell(props: Props) {setIsPreviewReady={ui.setIsPreviewReady}setCurrentTime={ui.setCurrentTime}setIsPlaying={ui.setIsPlaying}- setError={project.setError}+ setError={handlePreviewError}/></div><EditorTimelinePanel+ panelRef={timelinePanelRef}timelineRef={ui.timelineRef}timeline={timeline}projection={projection}@@ -247,6 +368,29 @@ export function EditorShell(props: Props) {handleSelectAnnotation={handleSelectAnnotation}/></div>+ {library.importing && (+ <div+ className="fixed inset-0 z-[100] flex items-center justify-center bg-background/80"+ role="status"+ aria-live="polite"+ >+ <div className="rounded-xl border border-separator bg-background p-6 text-center">+ <p className="font-medium">Adding video…</p>+ <p className="mt-2 text-sm text-muted-foreground">+ Preparing footage and audio for your timeline.+ </p>+ </div>+ </div>+ )}+ <RecordlySignInDialog+ open={signInOpen}+ onOpenChange={setSignInOpen}+ reason={signInReason}+ user={auth.user}+ configured={auth.configured}+ callbackError={auth.callbackError}+ onAuthenticated={handleAuthenticated}+ />{editorDialogs}<CropEditorDialogopen={ui.showCropModal}diff --git a/src/components/video-editor/layout/EditorSidebar.tsx b/src/components/video-editor/layout/EditorSidebar.tsxindex ab1d1174..d9ba746d 100644--- a/src/components/video-editor/layout/EditorSidebar.tsx+++ b/src/components/video-editor/layout/EditorSidebar.tsx@@ -1,30 +1,36 @@import {+ UserCircle,Camera,ClosedCaptioning,Cursor,Gear,- PuzzlePiece,FrameCorners,- UserCircle,} from "@phosphor-icons/react";import { ToggleButtonGroup, ToggleButton, Tooltip, Card, Switch, Label } from "@heroui/react";-import { Button } from "@/components/ui/button";-import type { ComponentProps, Dispatch, SetStateAction } from "react";+import type { ComponentProps, ReactNode } from "react";import { useMemo, useState } from "react";-import { toast } from "@/components/ui/toast";import type { useI18n } from "@/contexts/I18nContext";import ExtensionManager from "../ExtensionManager";import { SettingsPanel } from "../SettingsPanel";import type { EditorEffectSection } from "../types";type Props = {+ panelContent?: ReactNode;+ onAccountClick?: () => void;t: ReturnType<typeof useI18n>["t"];activeSection: EditorEffectSection;- setActiveSection: Dispatch<SetStateAction<EditorEffectSection>>;+ setActiveSection: (section: EditorEffectSection) => void;settingsPanelProps: ComponentProps<typeof SettingsPanel>;};-export function EditorSidebar({ t, activeSection, setActiveSection, settingsPanelProps }: Props) {+export function EditorSidebar({+ t,+ activeSection,+ setActiveSection,+ settingsPanelProps,+ panelContent,+ onAccountClick,+}: Props) {const [advancedSections, setAdvancedSections] = useState<Record<string, boolean>>({});const advanced = advancedSections[activeSection] ?? false;const hasAdvanced =@@ -51,11 +57,6 @@ export function EditorSidebar({ t, activeSection, setActiveSection, settingsPanelabel: t("settings.sections.settings", "Settings"),icon: Gear,},- {- id: "extensions" as const,- label: t("settings.sections.extensions", "Extensions"),- icon: PuzzlePiece,- },],[t],);@@ -71,7 +72,7 @@ export function EditorSidebar({ t, activeSection, setActiveSection, settingsPaneclassName="w-full items-center gap-2"selectionMode="single"disallowEmptySelection- selectedKeys={[activeSection]}+ selectedKeys={panelContent ? [] : [activeSection]}onSelectionChange={(keys) => {const key = Array.from(keys)[0];if (key) setActiveSection(key as EditorEffectSection);@@ -91,57 +92,65 @@ export function EditorSidebar({ t, activeSection, setActiveSection, settingsPane</Tooltip>))}</ToggleButtonGroup>- <Button- variant="ghost"- size="icon"- className="mt-auto"- aria-label={t("editor.account.title", "Account")}- onClick={() =>- toast.info(t("editor.account.comingSoon", "Account coming soon"))- }- >- <UserCircle />- </Button>+ <Tooltip>+ <ToggleButton+ variant="ghost"+ isIconOnly+ className="mt-auto"+ aria-label="Recordly account"+ onPress={onAccountClick}+ >+ <UserCircle className="size-5" />+ </ToggleButton>+ <Tooltip.Content placement="right">Account</Tooltip.Content>+ </Tooltip></nav>- <aside className="editor-inspector [--text-sm:0.8125rem] [--text-base:0.8125rem] flex w-[320px] min-h-0 flex-col">+ <aside+ aria-label={panelContent ? "Videos" : undefined}+ className="editor-inspector [--text-sm:0.8125rem] [--text-base:0.8125rem] flex w-[320px] min-h-0 flex-col"+ ><Card className="min-h-0 flex-1 gap-0 overflow-hidden p-0">- <header className="flex min-h-14 shrink-0 items-center justify-between gap-3 px-5 py-3">- <Card.Title className="text-[14px]">- {settingsPanelProps.selectedAnnotationId- ? t("timeline.annotation.label", "Annotation")- : (sections.find((section) => section.id === activeSection)- ?.label ??- t(- `settings.sections.${activeSection}`,- activeSection.charAt(0).toUpperCase() +- activeSection.slice(1),- ))}- </Card.Title>- {hasAdvanced && (- <Switch- size="sm"- isSelected={advanced}- onChange={(value) =>- setAdvancedSections((current) => ({- ...current,- [activeSection]: value,- }))- }- aria-label="Advanced settings"- >- <Switch.Content>- <Label className="text-xs">Advanced</Label>- <Switch.Control>- <Switch.Thumb />- </Switch.Control>- </Switch.Content>- </Switch>- )}- </header>- {activeSection === "extensions" ? (- <ExtensionManager />- ) : (- <SettingsPanel {...settingsPanelProps} advanced={advanced} />+ {panelContent ?? (+ <>+ <header className="flex min-h-14 shrink-0 items-center justify-between gap-3 px-5 py-3">+ <Card.Title className="text-[14px]">+ {settingsPanelProps.selectedAnnotationId+ ? t("timeline.annotation.label", "Annotation")+ : (sections.find((section) => section.id === activeSection)+ ?.label ??+ t(+ `settings.sections.${activeSection}`,+ activeSection.charAt(0).toUpperCase() ++ activeSection.slice(1),+ ))}+ </Card.Title>+ {hasAdvanced && (+ <Switch+ size="sm"+ isSelected={advanced}+ onChange={(value) =>+ setAdvancedSections((current) => ({+ ...current,+ [activeSection]: value,+ }))+ }+ aria-label="Advanced settings"+ >+ <Switch.Content>+ <Label className="text-xs">Advanced</Label>+ <Switch.Control>+ <Switch.Thumb />+ </Switch.Control>+ </Switch.Content>+ </Switch>+ )}+ </header>+ {activeSection === "extensions" ? (+ <ExtensionManager />+ ) : (+ <SettingsPanel {...settingsPanelProps} advanced={advanced} />+ )}+ </>)}</Card></aside>diff --git a/src/components/video-editor/layout/EditorTimelinePanel.tsx b/src/components/video-editor/layout/EditorTimelinePanel.tsxindex 1970a315..a3491f49 100644--- a/src/components/video-editor/layout/EditorTimelinePanel.tsx+++ b/src/components/video-editor/layout/EditorTimelinePanel.tsx@@ -12,6 +12,7 @@ import type { useTimelineState } from "../state/useTimelineState";import TimelineEditor, { type TimelineEditorHandle } from "../timeline/TimelineEditor";type Props = {+ panelRef?: RefObject<HTMLDivElement | null>;timelineRef: RefObject<TimelineEditorHandle | null>;timeline: ReturnType<typeof useTimelineState>;projection: ReturnType<typeof useTimelineProjection>;@@ -58,7 +59,10 @@ export function EditorTimelinePanel(props: Props) {return (<div- className="flex flex-shrink-0 flex-col bg-transparent px-4 pb-4 pt-2"+ ref={props.panelRef}+ tabIndex={-1}+ data-timeline-panel+ className="outline-none flex flex-shrink-0 flex-col bg-transparent px-4 pb-4 pt-2"style={{ height: "22%", minHeight: 180, maxHeight: 280 }}><TimelineEditor@@ -84,6 +88,7 @@ export function EditorTimelinePanel(props: Props) {trimRegions={timeline.trimRegions}clipRegions={timeline.clipRegions}onClipSplit={clipCommands.handleClipSplit}+ onClipDelete={clipCommands.handleClipDelete}onClipSpanChange={clipCommands.handleClipSpanChange}selectedClipId={timeline.selectedClipId}onSelectClip={clipCommands.handleSelectClip}@@ -110,7 +115,11 @@ export function EditorTimelinePanel(props: Props) {cue.sourceCueId === timeline.selectedCaptionId &¤tTime * 1000 >= cue.startMs &¤tTime * 1000 < cue.endMs,- )?.id ?? null+ )?.id ??+ projection.effectiveCaptionRegions.find(+ (cue) => cue.sourceCueId === timeline.selectedCaptionId,+ )?.id ??+ null}onSelectCaption={(id) => {const fragment = projection.effectiveCaptionRegions.find(diff --git a/src/components/video-editor/layout/EditorVideoPreview.tsx b/src/components/video-editor/layout/EditorVideoPreview.tsxindex 1f92a134..06ff3e1e 100644--- a/src/components/video-editor/layout/EditorVideoPreview.tsx+++ b/src/components/video-editor/layout/EditorVideoPreview.tsx@@ -36,7 +36,7 @@ type Props = {setIsPreviewReady: Dispatch<SetStateAction<boolean>>;setCurrentTime: Dispatch<SetStateAction<number>>;setIsPlaying: Dispatch<SetStateAction<boolean>>;- setError: Dispatch<SetStateAction<string | null>>;+ setError: (message: string | null) => void;handlers: Handlers;};diff --git a/src/components/video-editor/library/RecordingLibraryPanel.tsx b/src/components/video-editor/library/RecordingLibraryPanel.tsxnew file mode 100644index 00000000..222604a1--- /dev/null+++ b/src/components/video-editor/library/RecordingLibraryPanel.tsx@@ -0,0 +1,289 @@+import { RecordingThumbnail } from "./RecordingThumbnail";+import { useEffect, useRef, useState } from "react";+import { Checkbox, Label, Dropdown, SearchField, Button as HeroButton } from "@heroui/react";+import {+ FilmStrip,+ Plus,+ X,+ Trash,+ ArrowCounterClockwise,+ DotsThree,+ FolderOpen,+} from "@phosphor-icons/react";+import { Button } from "@/components/ui/button";+import { RECORDING_DRAG_TYPE } from "@/types/recordingLibrary";+import { cn } from "@/lib/utils";+import type { useRecordingLibrary } from "./useRecordingLibrary";++export function RecordingLibraryPanel({+ library,+}: {+ library: ReturnType<typeof useRecordingLibrary>;+}) {+ const panelRef = useRef<HTMLElement>(null);+ const [query, setQuery] = useState("");+ // biome-ignore lint/correctness/useExhaustiveDependencies: restore focus when removal unmounts the focused recording.+ useEffect(() => {+ if (library.open) panelRef.current?.focus();+ }, [library.open, library.entries.length]);+ if (!library.open) return null;+ const entries = library.entries.filter((entry) =>+ entry.name.toLocaleLowerCase().includes(query.toLocaleLowerCase()),+ );+ const allSelected =+ entries.length > 0 && entries.every((entry) => library.selected.has(entry.path));+ const toggle = (path: string, selected: boolean) =>+ library.setSelected((previous) => {+ const next = new Set(previous);+ if (selected) next.add(path);+ else next.delete(path);+ return next;+ });+ return (+ <section+ ref={panelRef}+ tabIndex={-1}+ aria-label="Videos library"+ data-recording-library+ className="outline-none flex min-h-0 flex-1 flex-col"+ onKeyDown={(event) => {+ if (event.key === "Escape") {+ event.preventDefault();+ library.setOpen(false);+ }+ const isInput = event.target instanceof HTMLInputElement;+ if (+ !isInput &&+ (event.metaKey || event.ctrlKey) &&+ event.key.toLowerCase() === "z" &&+ !event.shiftKey+ ) {+ event.preventDefault();+ event.stopPropagation();+ void library.undo();+ }+ if (+ !isInput &&+ (event.key === "Delete" || event.key === "Backspace") &&+ library.selected.size+ ) {+ event.preventDefault();+ event.stopPropagation();+ void library.remove([...library.selected]);+ }+ }}+ >+ <header className="flex min-h-14 shrink-0 items-center gap-2 px-5 py-3">+ <h2 className="flex-1 text-[14px] font-semibold">Videos</h2>+ <Dropdown>+ <HeroButton+ isIconOnly+ variant="ghost"+ size="sm"+ aria-label="Video library actions"+ >+ <DotsThree className="size-5" />+ </HeroButton>+ <Dropdown.Popover placement="bottom end">+ <Dropdown.Menu aria-label="Video library actions">+ <Dropdown.Item+ id="folder"+ textValue="Open recordings folder"+ onAction={() => void window.electronAPI.openRecordingsFolder()}+ >+ <FolderOpen className="size-4" />+ <Label>Open recordings folder</Label>+ </Dropdown.Item>+ <Dropdown.Item+ id="trash"+ textValue="Move all to Trash"+ variant="danger"+ isDisabled={+ !library.entries.length || library.busy || library.importing+ }+ onAction={() =>+ void library.remove(library.entries.map((entry) => entry.path))+ }+ >+ <Trash className="size-4" />+ <Label>Move all to Trash</Label>+ </Dropdown.Item>+ </Dropdown.Menu>+ </Dropdown.Popover>+ </Dropdown>+ <Button+ variant="ghost"+ size="icon"+ className="size-7"+ aria-label="Close Videos"+ onClick={() => library.setOpen(false)}+ >+ <X />+ </Button>+ </header>+ <div className="px-5 pb-3">+ <SearchField aria-label="Search videos" value={query} onChange={setQuery}>+ <SearchField.Group>+ <SearchField.SearchIcon />+ <SearchField.Input placeholder="Search videos" />+ <SearchField.ClearButton />+ </SearchField.Group>+ </SearchField>+ </div>+ <div className="flex min-h-10 items-center gap-2 px-5 pb-2">+ <Checkbox+ aria-label="Select all videos"+ isSelected={allSelected}+ isIndeterminate={!allSelected && library.selected.size > 0}+ isDisabled={!entries.length || library.busy || library.importing}+ onChange={(checked) =>+ library.setSelected((previous) => {+ const next = new Set(previous);+ for (const entry of entries) {+ if (checked) next.add(entry.path);+ else next.delete(entry.path);+ }+ return next;+ })+ }+ >+ <Checkbox.Content>+ <Checkbox.Control>+ <Checkbox.Indicator />+ </Checkbox.Control>+ </Checkbox.Content>+ </Checkbox>+ <span className="flex-1 text-xs text-muted-foreground">+ {library.selected.size+ ? `${library.selected.size} selected`+ : `${entries.length} ${entries.length === 1 ? "recording" : "recordings"}`}+ </span>+ {library.selected.size > 0 && (+ <Button+ variant="ghost"+ size="icon"+ className="size-7"+ aria-label="Move selected videos to Trash"+ title="Move selected to Trash"+ disabled={library.busy || library.importing}+ onClick={() => void library.remove([...library.selected])}+ >+ <Trash className="size-4" />+ </Button>+ )}+ </div>+ <div className="custom-scrollbar min-h-0 flex-1 space-y-1 overflow-y-auto overflow-x-hidden px-3 pb-3">+ {library.loading && (+ <p role="status" className="px-2 py-4 text-xs text-muted-foreground">+ Loading videos…+ </p>+ )}+ {library.error && (+ <div role="alert" className="p-2 text-xs">+ <p>{library.error}</p>+ <Button variant="ghost" size="sm" onClick={() => void library.refresh()}>+ Retry+ </Button>+ </div>+ )}+ {!library.loading && !library.error && !entries.length && (+ <div className="flex flex-col items-center gap-2 px-5 py-12 text-center text-muted-foreground">+ <FilmStrip className="size-7" />+ <p className="text-sm">+ {query ? "No matching videos" : "Your recordings appear here"}+ </p>+ <p className="text-xs">+ {query ? "Try another search." : "Record a video to get started."}+ </p>+ </div>+ )}+ {entries.map((entry) => (+ <div+ key={entry.path}+ data-recording-path={entry.path}+ draggable={!library.busy && !library.importing}+ onDragStart={(event) => {+ const paths = library.selected.has(entry.path)+ ? library.entries+ .filter((item) => library.selected.has(item.path))+ .map((item) => item.path)+ : [entry.path];+ event.dataTransfer.setData(RECORDING_DRAG_TYPE, JSON.stringify(paths));+ event.dataTransfer.effectAllowed = "copy";+ }}+ className={cn(+ "group flex items-center gap-3 rounded-xl px-2 py-3 transition-colors hover:bg-default",+ library.selected.has(entry.path) && "bg-default",+ )}+ >+ <Checkbox+ aria-label={`Select ${entry.name}`}+ isDisabled={library.busy || library.importing}+ isSelected={library.selected.has(entry.path)}+ onChange={(checked) => toggle(entry.path, checked)}+ >+ <Checkbox.Content>+ <Checkbox.Control>+ <Checkbox.Indicator />+ </Checkbox.Control>+ </Checkbox.Content>+ </Checkbox>+ <button+ type="button"+ className="flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-focus"+ disabled={library.busy || library.importing}+ onClick={() => toggle(entry.path, !library.selected.has(entry.path))}+ onDoubleClick={() => void library.addToTimeline(entry.path)}+ title={entry.name}+ >+ <RecordingThumbnail entry={entry} />+ <span className="min-w-0">+ <span+ title={entry.name}+ className="block truncate text-xs font-medium"+ >+ {entry.name}+ </span>+ <span className="mt-1 block text-[11px] text-muted-foreground">+ {new Date(entry.createdAt).toLocaleDateString(undefined, {+ month: "short",+ day: "numeric",+ })}{" "}+ · {(entry.bytes / 1024 / 1024).toFixed(1)} MB+ </span>+ </span>+ </button>+ <Button+ variant="ghost"+ size="icon"+ className="size-7 shrink-0"+ aria-label={`Add ${entry.name} to timeline`}+ title="Add to timeline"+ disabled={library.busy || library.importing}+ onClick={() => void library.addToTimeline(entry.path)}+ >+ <Plus className="size-4" />+ </Button>+ </div>+ ))}+ </div>+ <footer className="flex items-center gap-2 px-5 py-3 text-[11px] text-muted-foreground">+ <span className="flex-1">+ {library.canUndo ? "Moved to Trash" : "Drag to the timeline or click + to add."}+ </span>+ {library.canUndo && (+ <Button+ variant="ghost"+ size="sm"+ disabled={library.busy || library.importing}+ onClick={() => void library.undo()}+ title="Undo (⌘Z / Ctrl+Z)"+ >+ <ArrowCounterClockwise className="size-3.5" />+ Undo+ </Button>+ )}+ </footer>+ </section>+ );+}diff --git a/src/components/video-editor/library/RecordingThumbnail.tsx b/src/components/video-editor/library/RecordingThumbnail.tsxnew file mode 100644index 00000000..8eddce50--- /dev/null+++ b/src/components/video-editor/library/RecordingThumbnail.tsx@@ -0,0 +1,63 @@+import { useEffect, useRef, useState } from "react";+import { FilmStrip } from "@phosphor-icons/react";+import type { RecordingLibraryEntry } from "@/types/recordingLibrary";++export function RecordingThumbnail({ entry }: { entry: RecordingLibraryEntry }) {+ const host = useRef<HTMLSpanElement>(null);+ const [src, setSrc] = useState<string>();+ const [failed, setFailed] = useState(false);+ // biome-ignore lint/correctness/useExhaustiveDependencies: changed file metadata invalidates the cached still.+ useEffect(() => {+ let active = true;+ setSrc(undefined);+ setFailed(false);+ const observer = new IntersectionObserver(+ (entries) => {+ if (!entries.some((entry) => entry.isIntersecting)) return;+ observer.disconnect();+ void window.electronAPI+ .getRecordingThumbnail(entry.path)+ .then((result) => {+ if (!active) return;+ if (result.success) setSrc(result.value);+ else setFailed(true);+ })+ .catch(() => {+ if (active) setFailed(true);+ });+ },+ { rootMargin: "80px" },+ );+ if (host.current) observer.observe(host.current);+ return () => {+ active = false;+ observer.disconnect();+ };+ }, [entry.path, entry.createdAt, entry.bytes]);+ return (+ <span+ ref={host}+ className="flex h-9 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-default text-muted-foreground"+ >+ {src ? (+ <img+ src={src}+ alt={`Preview of ${entry.name}`}+ className="size-full object-cover"+ draggable={false}+ onError={() => {+ setSrc(undefined);+ setFailed(true);+ }}+ />+ ) : failed ? (+ <FilmStrip className="size-5" aria-label="Preview unavailable" />+ ) : (+ <span+ className="size-full animate-pulse bg-default"+ aria-label="Loading preview image"+ />+ )}+ </span>+ );+}diff --git a/src/components/video-editor/library/useRecordingLibrary.ts b/src/components/video-editor/library/useRecordingLibrary.tsnew file mode 100644index 00000000..6896a9c2--- /dev/null+++ b/src/components/video-editor/library/useRecordingLibrary.ts@@ -0,0 +1,218 @@+import type { useAppearanceState } from "../state/useAppearanceState";+import { useCallback, useEffect, useRef, useState } from "react";+import { toast } from "@/components/ui/toast";+import type { RecordingLibraryEntry } from "@/types/recordingLibrary";+import { packClipSequence, rippleRegionAnchors, rippleRegions } from "../clipSequence";+import {+ type ZoomRegion,+ sortClipRegions,+ DEFAULT_AUTO_ZOOM_DEPTH,+ clampFocusToDepth,+} from "../types";+import { buildInteractionZoomSuggestions } from "../timeline/zoomSuggestionUtils";+import type { useProjectState } from "../state/useProjectState";+import type { useTimelineState } from "../state/useTimelineState";+import type { useEditorUiState } from "../state/useEditorUiState";++export function useRecordingLibrary(+ project: ReturnType<typeof useProjectState>,+ timeline: ReturnType<typeof useTimelineState>,+ ui: ReturnType<typeof useEditorUiState>,+ appearance: ReturnType<typeof useAppearanceState>,+) {+ const [open, setOpen] = useState(false);+ const [entries, setEntries] = useState<RecordingLibraryEntry[]>([]);+ const [selected, setSelected] = useState<Set<string>>(new Set());+ const [loading, setLoading] = useState(false);+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const [removed, setRemoved] = useState<string[][]>([]);+ const lock = useRef(false);+ const current = useRef({ project, timeline, ui, appearance });+ current.current = { project, timeline, ui, appearance };+ const refresh = useCallback(async () => {+ setLoading(true);+ setError(null);+ try {+ const result = await window.electronAPI.listRecordings();+ if (!result.success) throw new Error(result.error);+ setEntries(result.value);+ setSelected(+ (previous) =>+ new Set(+ [...previous].filter((path) =>+ result.value.some((entry) => entry.path === path),+ ),+ ),+ );+ } catch (error) {+ setError(String(error));+ } finally {+ setLoading(false);+ }+ }, []);+ // biome-ignore lint/correctness/useExhaustiveDependencies: opening another project resets the media-server access list.+ useEffect(() => {+ if (open) void refresh();+ }, [open, refresh, project.videoSourcePath]);+ const remove = async (paths: string[]) => {+ if (lock.current || !paths.length) return;+ lock.current = true;+ setBusy(true);+ try {+ const result = await window.electronAPI.setRecordingsRemoved(paths, true);+ if (!result.success) throw new Error(result.error);+ setRemoved((previous) => [...previous, paths]);+ setEntries((previous) => previous.filter((entry) => !paths.includes(entry.path)));+ setSelected(new Set());+ } catch (error) {+ toast.error(`Could not remove videos: ${String(error)}`);+ } finally {+ lock.current = false;+ setBusy(false);+ }+ };+ const undo = async () => {+ const paths = removed[removed.length - 1];+ if (lock.current || !paths) return;+ lock.current = true;+ setBusy(true);+ try {+ const result = await window.electronAPI.setRecordingsRemoved(paths, false);+ if (!result.success) throw new Error(result.error);+ setRemoved((previous) => previous.slice(0, -1));+ await refresh();+ } catch (error) {+ toast.error(`Could not restore videos: ${String(error)}`);+ } finally {+ lock.current = false;+ setBusy(false);+ }+ };+ const [importing, setImporting] = useState(false);+ const addToTimeline = async (paths: string | string[], index?: number) => {+ const source = current.current.project.videoSourcePath;+ if (lock.current || !source) return;+ lock.current = true;+ setImporting(true);+ current.current.ui.videoPlaybackRef.current?.pause();+ current.current.ui.setIsPlaying(false);+ try {+ const initial = current.current;+ const before = sortClipRegions(initial.timeline.clipRegions);+ let sequence = before;+ let media;+ let webcam = initial.appearance.webcam;+ let sourcePath = source;+ let insertAt = Math.min(before.length, Math.max(0, index ?? before.length));+ const addedZooms: ZoomRegion[] = [];+ let id = "";+ for (const path of [...new Set(typeof paths === "string" ? [paths] : paths)]) {+ const result = await window.electronAPI.importRecording(sourcePath, path, webcam);+ if (!result.success) throw new Error(result.error);+ if (current.current.project.videoSourcePath !== source)+ throw new Error(+ "The project changed while importing. Add the recordings again.",+ );+ media = result.value;+ sourcePath = media.path;+ if (media.webcam) webcam = { ...webcam, ...media.webcam, enabled: true };+ id = `clip-${initial.ui.nextClipIdRef.current++}`;+ const next = sequence.map((clip) => ({+ ...clip,+ sourceMinMs: clip.sourceMinMs ?? 0,+ sourceMaxMs: clip.sourceMaxMs ?? media!.sourceStartMs,+ }));+ next.splice(insertAt++, 0, {+ id,+ startMs: 0,+ endMs: media.durationMs,+ sourceStartMs: media.sourceStartMs,+ sourceMinMs: media.sourceStartMs,+ sourceMaxMs: media.sourceStartMs + media.durationMs,+ speed: 1,+ });+ sequence = packClipSequence(next);+ if (current.current.appearance.autoApplyFreshRecordingAutoZooms) {+ const telemetry = await window.electronAPI.getCursorTelemetry(media.path);+ const start = media.sourceStartMs;+ const duration = media.durationMs;+ const offset = sequence.find((clip) => clip.id === id)!.startMs;+ const suggestions = buildInteractionZoomSuggestions({+ cursorTelemetry: (telemetry.success ? telemetry.samples : [])+ .filter(+ (point) => point.timeMs >= start && point.timeMs < start + duration,+ )+ .map((point) => ({ ...point, timeMs: point.timeMs - start })),+ totalMs: duration,+ defaultDurationMs: Math.min(1000, duration),+ reservedSpans: [],+ }).suggestions;+ addedZooms.push(+ ...suggestions.map((zoom) => ({+ id: `zoom-${initial.ui.nextZoomIdRef.current++}`,+ startMs: offset + zoom.start,+ endMs: offset + zoom.end,+ depth: DEFAULT_AUTO_ZOOM_DEPTH,+ focus: clampFocusToDepth(zoom.focus, DEFAULT_AUTO_ZOOM_DEPTH),+ mode: "auto" as const,+ })),+ );+ }+ }+ if (!media) return;+ const { project, timeline, ui, appearance } = current.current;+ if (project.videoSourcePath !== source)+ throw new Error("The project changed while importing. Add the recordings again.");+ ui.clipInitializedRef.current = true;+ ui.autoFullTrackClipIdRef.current = null;+ ui.autoFullTrackClipEndMsRef.current = null;+ ui.setCurrentTime((sequence.find((clip) => clip.id === id)?.startMs ?? 0) / 1000);+ ui.setDuration(media.totalDurationMs / 1000);+ timeline.setClipRegions(sequence);+ timeline.setZoomRegions((current) => [+ ...rippleRegions(current, before, sequence),+ ...addedZooms,+ ]);+ timeline.setAnnotationRegions((current) => rippleRegions(current, before, sequence));+ timeline.setAudioRegions((current) => rippleRegionAnchors(current, before, sequence));+ timeline.setSelectedClipId(id);+ if (media.webcam)+ appearance.setWebcam((previous) => ({+ ...previous,+ ...webcam,+ enabled: true,+ }));+ project.setVideoSourcePath(media.path);+ project.setVideoPath(media.url);+ ui.setIsPreviewReady(false);+ ui.setPreviewVersion((version) => version + 1);+ toast.success(+ typeof paths === "string"+ ? "Video added to timeline"+ : `${paths.length} videos added to timeline`,+ );+ } catch (error) {+ toast.error(`Could not add video: ${String(error)}`);+ } finally {+ lock.current = false;+ setImporting(false);+ }+ };+ return {+ open,+ setOpen,+ entries,+ selected,+ setSelected,+ loading,+ busy,+ error,+ refresh,+ remove,+ undo,+ canUndo: removed.length > 0,+ importing,+ addToTimeline,+ };+}diff --git a/src/index.css b/src/index.cssindex eef479e6..46e22823 100644--- a/src/index.css+++ b/src/index.css@@ -137,21 +137,38 @@}@container (max-width: 110px) {+ .zoom-icon,.zoom-mode {display: none;}}-@container (max-width: 48px) {- .zoom-icon {- display: none;+@container (min-height: 40px) and (min-width: 110px) {+ .zoom-mode {+ display: block;+ margin-left: 0;+ font-size: 10px;+ text-align: center;+ }+}+@container (max-height: 39px) {+ .zoom-mode {+ margin-left: 4px;}}-@container (max-width: 28px) {- .zoom-value {- display: none;+@keyframes editor-section-enter {+ from {+ opacity: 0;}- .zoom-icon {- display: block;+ to {+ opacity: 1;+ }+}+.editor-section-enter {+ animation: editor-section-enter 180ms ease-out;+}+@media (prefers-reduced-motion: reduce) {+ .editor-section-enter {+ animation: none;}}diff --git a/tests/ui/editor-refinements.spec.ts b/tests/ui/editor-refinements.spec.tsindex eeb73c76..a93c32b2 100644--- a/tests/ui/editor-refinements.spec.ts+++ b/tests/ui/editor-refinements.spec.ts@@ -22,7 +22,7 @@ async function clickOutside(page: Page) {await page.mouse.click(1000, 300);}-test("clip filmstrip decodes different source frames and zoom blocks stay compact", async ({+test("clip filmstrip decodes different source frames and zoom blocks use the available height", async ({page,}) => {test.setTimeout(60000);@@ -38,8 +38,8 @@ test("clip filmstrip decodes different source frames and zoom blocks stay compacawait page.getByRole("button", { name: "Add Zoom (Z)", exact: true }).click();const zoom = page.locator('[data-timeline-item][data-variant="zoom"] .timeline-block');await expect(zoom).toBeVisible();- expect((await zoom.boundingBox())!.height).toBeLessThanOrEqual(30);- await expect(page.locator(".timeline-axis")).toHaveCSS("border-bottom-width", "0px");+ expect((await zoom.boundingBox())!.height).toBeGreaterThan(50);+ await expect(page.locator(".timeline-axis")).toHaveCount(0);await page.screenshot({path: "test-results/editor-filmstrip-zoom.png",animations: "disabled",diff --git a/tests/ui/fixtures/recording-thumbnail.jpg b/tests/ui/fixtures/recording-thumbnail.jpgnew file mode 100644index 00000000..e2100de6Binary files /dev/null and b/tests/ui/fixtures/recording-thumbnail.jpg differdiff --git a/tests/ui/videos-library.spec.ts b/tests/ui/videos-library.spec.tsnew file mode 100644index 00000000..a2b28998--- /dev/null+++ b/tests/ui/videos-library.spec.ts@@ -0,0 +1,361 @@+import { expect, test, type Page } from "@playwright/test";+import { installDesktopBridge } from "./bridge";++async function setup(page: Page) {+ await installDesktopBridge(page, "filmstrip.mp4");+ await page.addInitScript(() => {+ const removed = new Set<string>();+ const entries = ["first.mp4", "second.mp4"].map((name, i) => ({+ name,+ path: `/recordings/${name}`,+ bytes: 1024 * 1024,+ createdAt: Date.now() - i * 1000,+ url: `${location.origin}/tests/ui/fixtures/filmstrip.mp4`,+ }));+ window.electronAPI.getRecordingThumbnail = async () => ({+ success: true,+ value: `${location.origin}/tests/ui/fixtures/recording-thumbnail.jpg`,+ });+ window.electronAPI.listRecordings = async () => ({+ success: true,+ value: entries.filter((entry) => !removed.has(entry.path)),+ });+ window.electronAPI.setRecordingsRemoved = async (paths, hide) => {+ for (const path of paths) {+ if (hide) removed.add(path);+ else removed.delete(path);+ }+ return { success: true, value: null };+ };+ window.electronAPI.importRecording = async (_current, path) => {+ document.documentElement.dataset.importedPath = path;+ // Playback remains real HTML video; backend media composition has its own FFmpeg integration test.+ return {+ success: true,+ value: {+ path: `${location.origin}/tests/ui/fixtures/filmstrip.mp4`,+ url: `${location.origin}/tests/ui/fixtures/filmstrip.mp4`,+ sourceStartMs: 2000,+ durationMs: 1000,+ totalDurationMs: 6000,+ webcam: {+ sourcePath: `${location.origin}/tests/ui/fixtures/filmstrip.mp4`,+ timeOffsetMs: 0,+ visibleRanges: [{ startMs: 2000, endMs: 3000 }],+ },+ },+ };+ };+ });+ await page.goto("/?windowType=editor");+ await expect(page.locator('[data-variant="clip"]')).toHaveAttribute("data-end-ms", "6000", {+ timeout: 20000,+ });+ await expect(page.locator('[data-variant="clip"] img').first()).toBeVisible();+ await expect(page.getByLabel("Loading preview")).toHaveCount(0);+ await page.getByRole("button", { name: "Videos", exact: true }).click();+ await expect(page.getByLabel("Select first.mp4")).toBeVisible();+}++test("Videos supports selection, remove all, undo and real timeline drag insertion", async ({+ page,+}) => {+ const errors: string[] = [];+ page.on("pageerror", (error) => errors.push(error.message));+ await setup(page);+ const panel = page.getByRole("complementary", { name: "Videos" });+ await expect(panel.locator("video")).toHaveCount(0);+ await expect(panel.getByRole("img", { name: "Preview of first.mp4" })).toBeVisible();+ await expect+ .poll(() =>+ panel+ .getByRole("img", { name: "Preview of first.mp4" })+ .evaluate((image: HTMLImageElement) => image.naturalWidth),+ )+ .toBeGreaterThan(0);+ await expect(panel.getByText("first.mp4", { exact: true })).toBeVisible();+ const videosButton = page.getByRole("button", { name: "Videos", exact: true });+ expect((await videosButton.boundingBox())!.x).toBeLessThan(+ (await page.getByRole("button", { name: "Open projects", exact: true }).boundingBox())!.x,+ );+ expect((await panel.boundingBox())!.x).toBeLessThan(100);+ await expect(videosButton).toHaveClass(/button--secondary/);+ await panel+ .locator('[data-recording-path="/recordings/first.mp4"] [data-slot="checkbox-control"]')+ .click();+ await expect(page.getByLabel("Select first.mp4")).toBeChecked();+ await panel.getByRole("button", { name: "Move selected videos to Trash", exact: true }).click();+ await expect(page.getByLabel("Select first.mp4")).toHaveCount(0);+ await page.keyboard.press("Meta+z");+ await expect(page.getByLabel("Select first.mp4")).toBeVisible();+ await panel.getByRole("button", { name: "Video library actions", exact: true }).click();+ await page.getByRole("menuitem", { name: "Move all to Trash", exact: true }).click();+ await expect(panel.getByText("Your recordings appear here")).toBeVisible();+ await page.keyboard.press("Control+z");+ await expect(page.getByLabel("Select second.mp4")).toBeVisible();+ const card = panel.locator('[data-recording-path="/recordings/second.mp4"]');+ const clip = page.locator('[data-variant="clip"]');+ await card.dragTo(clip, { targetPosition: { x: 5, y: 15 } });+ await expect(page.locator("html")).toHaveAttribute(+ "data-imported-path",+ "/recordings/second.mp4",+ );+ await expect(clip).toHaveCount(2);+ await expect(clip.first()).toHaveAttribute("data-end-ms", "1000");+ await expect(clip.last()).toHaveAttribute("data-start-ms", "1000");+ await expect(page.locator("[data-webcam-overlay]")).toBeVisible();+ await expect(page.getByLabel("Loading preview")).toHaveCount(0);+ await page.keyboard.press("Meta+z");+ await expect(clip).toHaveCount(1);+ await expect(clip).toHaveAttribute("data-end-ms", "6000");+ await expect(page.locator("[data-webcam-overlay]")).toBeHidden();+ await page.keyboard.press("Meta+Shift+z");+ await expect(clip).toHaveCount(2);+ await panel.getByRole("searchbox", { name: "Search videos" }).fill("first");+ await expect(panel.locator("[data-recording-path]")).toHaveCount(1);+ await panel.getByRole("searchbox", { name: "Search videos" }).fill("");+ await expect(panel.locator("[data-recording-path]")).toHaveCount(2);+ await expect(panel.getByRole("img", { name: "Preview of second.mp4" })).toBeVisible();+ await page.screenshot({ path: "test-results/videos-panel.png", animations: "disabled" });+ await page.getByRole("radio", { name: "Scene", exact: true }).click();+ await expect(panel).toHaveCount(0);+ await expect(page.getByRole("slider", { name: "Blur", exact: true })).toBeVisible();+ expect(errors).toEqual([]);+});++test("generating captions leaves the current media session intact and shows the cues", async ({+ page,+}) => {+ await installDesktopBridge(page, "filmstrip.mp4");+ await page.addInitScript(() => {+ window.electronAPI.getCurrentVideoPath = async () => ({+ success: true,+ path: "/recordings/caption-test.mp4",+ });+ window.electronAPI.getLocalMediaUrl = async () => ({+ success: true,+ url: `${location.origin}/tests/ui/fixtures/filmstrip.mp4`,+ });+ window.electronAPI.getWhisperSmallModelStatus = async () => ({+ success: true,+ exists: true,+ path: "/models/small.bin",+ });+ window.electronAPI.generateAutoCaptions = async () => ({+ success: true,+ cues: [{ id: "cue-1", startMs: 0, endMs: 4000, text: "Generated caption is visible" }],+ });+ window.electronAPI.setCurrentVideoPath = async () => {+ document.documentElement.dataset.sessionReset = "true";+ return { success: true };+ };+ });+ await page.goto("/?windowType=editor");+ await expect(page.locator('[data-variant="clip"] img').first()).toBeVisible();+ await page.getByRole("radio", { name: "Captions", exact: true }).click();+ await page.getByRole("button", { name: "Generate Captions", exact: true }).click();+ await expect(+ page.getByRole("button", { name: "Edit current caption", exact: true }),+ ).toHaveText("Generated caption is visible");+ await expect(page.locator("html")).not.toHaveAttribute("data-session-reset", "true");+ await page.getByRole("button", { name: "Play", exact: true }).click();+ await expect+ .poll(() =>+ page+ .locator('video[aria-hidden="true"]')+ .evaluate((node: HTMLVideoElement) => node.currentTime),+ )+ .toBeGreaterThan(0.1);+ await expect(page.getByText(/Failed to load video/)).toHaveCount(0);+});++test("preview recovers once when a local video URL fails to load", async ({ page }) => {+ await installDesktopBridge(page, "filmstrip.mp4");+ await page.addInitScript(() => {+ let requests = 0;+ window.electronAPI.getCurrentVideoPath = async () => ({+ success: true,+ path: "/recordings/first.mp4",+ });+ window.electronAPI.getLocalMediaUrl = async () => ({+ success: true,+ url:+ ++requests === 1+ ? `${location.origin}/missing-source.mp4`+ : `${location.origin}/tests/ui/fixtures/filmstrip.mp4`,+ });+ });+ await page.route("**/missing-source.mp4", (route) => route.abort("connectionfailed"));+ await page.goto("/?windowType=editor");+ await expect(page.locator('[data-variant="clip"]')).toHaveAttribute("data-end-ms", "6000");+ await expect(page.getByLabel("Loading preview")).toHaveCount(0);+ await expect(page.getByText(/Failed to load video/)).toHaveCount(0);+});++test("HUD project list fits its popover and scrolls only vertically", async ({ page }) => {+ await page.setViewportSize({ width: 980, height: 600 });+ await installDesktopBridge(page);+ await page.addInitScript(() => {+ window.electronAPI.listProjectFiles = async () => ({+ success: true,+ projects: [],+ entries: Array.from({ length: 30 }, (_, i) => ({+ path: `/projects/${i}.recordly`,+ name: `An extremely long project name that should never force sideways scrolling ${i}`,+ updatedAt: Date.now(),+ thumbnailPath: null,+ isCurrent: false,+ isInProjectsDirectory: true,+ })),+ });+ });+ await page.goto("/?windowType=hud-overlay");+ await page.getByRole("button", { name: /More/ }).click();+ await page+ .getByRole("dialog", { name: "Options" })+ .getByRole("button", { name: "Open project", exact: true })+ .click();+ const entry = page.getByRole("button", { name: /An extremely long project/ });+ await expect(entry).toHaveCount(30);+ const content = entry.first().locator("xpath=../..");+ expect(await content.evaluate((node) => node.scrollWidth <= node.clientWidth)).toBe(true);+ expect(await content.evaluate((node) => getComputedStyle(node).overflowX)).toBe("hidden");+ expect(await content.evaluate((node) => getComputedStyle(node).scrollbarWidth)).toBe("thin");+ await entry.last().scrollIntoViewIfNeeded();+ await expect(entry.last()).toBeVisible();+ await page.screenshot({ path: "test-results/hud-projects-vertical.png" });+});++test("HUD source controls have no default gray fill or outline", async ({ page }) => {+ await installDesktopBridge(page);+ await page.addInitScript(() => {+ window.electronAPI.getSources = async () => [+ { id: "screen:1:0", name: "Built-in Display", thumbnail: "", display_id: "1" },+ { id: "window:2:0", name: "Another Window", thumbnail: "", display_id: "" },+ ];+ });+ await page.goto("/?windowType=hud-overlay");+ const source = page.getByRole("button", { name: "Built-in Display", exact: true });+ expect(await source.evaluate((node) => getComputedStyle(node).borderWidth)).toBe("0px");+ await source.click();+ const row = page.locator(".source-selector-item").filter({ hasText: "Another Window" });+ await expect(row).toBeVisible();+ await page.mouse.move(1, 1);+ await expect(row).toHaveCSS("background-color", "rgba(0, 0, 0, 0)");+});++test("Videos shows original filenames and truncates long names beside real still previews", async ({+ page,+}) => {+ await setup(page);+ await page.evaluate(() => {+ window.electronAPI.listRecordings = async () => ({+ success: true,+ value: [+ "recording-1789866953739.mp4",+ "client-onboarding-walkthrough-with-a-very-long-file-name.mp4",+ ].map((name) => ({+ path: `/recordings/${name}`,+ name,+ bytes: 1024,+ createdAt: Date.now(),+ url: "",+ })),+ });+ });+ const toggle = page.getByRole("button", { name: "Videos", exact: true });+ await toggle.click();+ await toggle.click();+ const panel = page.getByRole("complementary", { name: "Videos" });+ await expect(panel.getByText("recording-1789866953739.mp4", { exact: true })).toBeVisible();+ const name = panel.getByText("client-onboarding-walkthrough-with-a-very-long-file-name.mp4", {+ exact: true,+ });+ await expect(name).toBeVisible();+ expect(+ await name.evaluate((node) => ({+ overflow: getComputedStyle(node).textOverflow,+ clipped: node.scrollWidth > node.clientWidth,+ })),+ ).toEqual({ overflow: "ellipsis", clipped: true });+ await expect(panel.locator("img")).toHaveCount(2);+ await expect+ .poll(() =>+ panel+ .locator("img")+ .evaluateAll((images) =>+ images.every((image) => (image as HTMLImageElement).naturalWidth > 0),+ ),+ )+ .toBe(true);+ expect(await panel.evaluate((node) => node.scrollWidth <= node.clientWidth + 1)).toBe(true);+ await page.screenshot({ path: "test-results/videos-filenames.png", animations: "disabled" });+});++for (const enabled of [true, false]) {+ test(`selected recordings drag together; imported click zooms ${enabled ? "on" : "off"}`, async ({+ page,+ }) => {+ await setup(page);+ await page.evaluate((enabled) => {+ const prefs = JSON.parse(localStorage.getItem("recordly.editor.preferences") || "{}");+ localStorage.setItem(+ "recordly.editor.preferences",+ JSON.stringify({ ...prefs, autoApplyFreshRecordingAutoZooms: enabled }),+ );+ }, enabled);+ await page.reload();+ await expect(page.locator('[data-variant="clip"]')).toHaveCount(1);+ await page.getByRole("button", { name: "Videos", exact: true }).click();+ await page.evaluate(() => {+ let count = 0;+ window.electronAPI.importRecording = async (current, path) => {+ count++;+ document.documentElement.dataset.importOrder =+ (document.documentElement.dataset.importOrder || "") + path + ";";+ document.documentElement.dataset.importSource = current;+ return {+ success: true,+ value: {+ path: `/sequence-${count}.mp4`,+ url: `${location.origin}/tests/ui/fixtures/filmstrip.mp4`,+ sourceStartMs: 6000 + (count - 1) * 1000,+ durationMs: 1000,+ totalDurationMs: 6000 + count * 1000,+ },+ };+ };+ window.electronAPI.getCursorTelemetry = async () => ({+ success: true,+ samples: [+ { timeMs: 6500, cx: 0.4, cy: 0.4, interactionType: "click" },+ { timeMs: 7500, cx: 0.6, cy: 0.6, interactionType: "click" },+ ],+ });+ });+ const panel = page.getByRole("complementary", { name: "Videos" });+ await panel.locator('[data-slot="checkbox-control"]').first().click();+ await expect(page.getByLabel("Select first.mp4")).toBeChecked();+ await expect(page.getByLabel("Select second.mp4")).toBeChecked();+ await panel+ .locator('[data-recording-path="/recordings/second.mp4"]')+ .dragTo(page.locator('[data-variant="clip"]'), { targetPosition: { x: 5, y: 15 } });+ await expect(page.locator('[data-variant="clip"]')).toHaveCount(3);+ await expect(page.locator("html")).toHaveAttribute(+ "data-import-order",+ "/recordings/first.mp4;/recordings/second.mp4;",+ );+ await expect(page.locator("html")).toHaveAttribute("data-import-source", "/sequence-1.mp4");+ await expect(page.locator('[data-variant="zoom"]')).toHaveCount(enabled ? 2 : 0);+ if (enabled) {+ await expect(page.locator('[data-variant="zoom"]').first()).toHaveAttribute(+ "data-start-ms",+ "0",+ );+ await expect(page.locator('[data-variant="zoom"]').nth(1)).toHaveAttribute(+ "data-start-ms",+ "1000",+ );+ }+ });+}