Create polished demo videos without editing skills. Mac/Windows/Linux
fix: address ui overhaul review feedback
webadderallf2b13c82442b
diff --git a/README.zh-CN.md b/README.zh-CN.mdindex 28b3f59b..e84897ea 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -389,12 +389,6 @@ Recordly 基于 **AGPL 3.0** 发布。----## 扩展系统--Recordly 提供扩展系统,可用于添加设备边框、点击特效、渲染钩子、声音和设置面板。内置扩展位于 `public/builtin-extensions/`。--完整 API 参考和示例请见 [EXTENSIONS.md](./EXTENSIONS.md)。----# 致谢diff --git a/biome.json b/biome.jsonindex 798cd272..30eb475d 100644--- a/biome.json+++ b/biome.json@@ -44,7 +44,7 @@"noUnsafeOptionalChaining": "error","noUnusedLabels": "error","noUnusedVariables": "error",- "useExhaustiveDependencies": "off",+ "useExhaustiveDependencies": "warn","useHookAtTopLevel": "error","useIsNan": "error","useValidForDirection": "error",@@ -159,11 +159,14 @@}},{- "includes": ["src/components/ui/**/*.tsx"],+ "includes": ["electron/electron-env.d.ts"],"linter": {"rules": {"style": {- "useComponentExportOnlyModules": "off"+ "noNamespace": "off"+ },+ "suspicious": {+ "noExplicitAny": "off"}}}@@ -173,11 +176,27 @@"linter": {"rules": {"correctness": {- "noEmptyPattern": "off",+ "noEmptyPattern": "off"+ },+ "suspicious": {+ "noEmptyBlockStatements": "off"+ }+ }+ }+ },+ {+ "includes": [+ "src/components/video-editor/audio.test.ts",+ "src/lib/exporter/frameRenderer.test.ts",+ "src/lib/exporter/localMediaSource.test.ts",+ "src/lib/exporter/modernFrameRenderer.test.ts"+ ],+ "linter": {+ "rules": {+ "correctness": {"noUnusedVariables": "off"},"suspicious": {- "noEmptyBlockStatements": "off","noExplicitAny": "off"}}diff --git a/electron/electron-env.d.ts b/electron/electron-env.d.tsindex 1ccdbbfc..c6929171 100644--- a/electron/electron-env.d.ts+++ b/electron/electron-env.d.ts@@ -1,180 +1,188 @@-/// <reference types="vite-plugin-electron/electron-env" />--declare namespace NodeJS {- interface ProcessEnv {- /**- * The built directory structure- *- * ```tree- * ├─┬─┬ dist- * │ │ └── index.html- * │ │- * │ ├─┬ dist-electron- * │ │ ├── main.js- * │ │ └── preload.js- * │- * ```- */- APP_ROOT: string;- /** /dist/ or /public/ */- VITE_PUBLIC: string;- }-}--// Used in Renderer process, expose in `preload.ts`-interface NativeCaptureDiagnostics {- backend: "windows-wgc" | "mac-screencapturekit" | "browser-store" | "ffmpeg";- phase: "availability" | "start" | "stop" | "mux";- timestamp: string;- sourceId?: string | null;- sourceType?: "screen" | "window" | "unknown";- displayId?: number | null;- displayBounds?: { x: number; y: number; width: number; height: number } | null;- windowHandle?: number | null;- helperPath?: string | null;- outputPath?: string | null;- systemAudioPath?: string | null;- microphonePath?: string | null;- osRelease?: string;- supported?: boolean;- helperExists?: boolean;- fileSizeBytes?: number | null;- processOutput?: string;- error?: string;-}--interface UpdateToastState {- version: string;- detail: string;- phase: "available" | "downloading" | "ready" | "error";- delayMs: number;- isPreview?: boolean;- progressPercent?: number;- primaryAction?: "download-update" | "install-update" | "retry-check";-}--interface UpdateStatusSummary {- status: "idle" | "checking" | "up-to-date" | "available" | "downloading" | "ready" | "error";- currentVersion: string;- availableVersion: string | null;- detail?: string;-}--interface Window {- electronAPI: {- hudOverlaySetIgnoreMouse: (ignore: boolean) => void;- hudOverlayDrag: (phase: "start" | "move" | "end", screenX: number, screenY: number) => void;- hudOverlayHide: () => void;- hudOverlayClose: () => void;- setHudOverlayExpanded: (expanded: boolean) => void;- setHudOverlayCompactWidth: (width: number) => void;- setHudOverlayMeasuredHeight: (height: number, expanded: boolean) => void;- getHudOverlayCaptureProtection: () => Promise<{ success: boolean; enabled: boolean }>;- setHudOverlayCaptureProtection: (- enabled: boolean,- ) => Promise<{ success: boolean; enabled: boolean }>;- getSources: (opts: Electron.SourcesOptions) => Promise<ProcessedDesktopSource[]>;- switchToEditor: () => Promise<void>;- openSourceSelector: () => Promise<void>;- selectSource: (source: any) => Promise<any>;- showSourceHighlight: (source: any) => Promise<{ success: boolean }>;- getSelectedSource: () => Promise<any>;- onSelectedSourceChanged: (callback: (source: any) => void) => () => void;- startNativeScreenRecording: (- source: any,- options?: {- capturesSystemAudio?: boolean;- capturesMicrophone?: boolean;- microphoneDeviceId?: string;- microphoneLabel?: string;- },- ) => Promise<{ success: boolean; path?: string; message?: string; error?: string; userNotified?: boolean; microphoneFallbackRequired?: boolean }>;- stopNativeScreenRecording: () => Promise<{- success: boolean;- path?: string;- message?: string;- error?: string;- }>;- recoverNativeScreenRecording: () => Promise<{- success: boolean;- path?: string;- message?: string;- error?: string;- }>;- getLastNativeCaptureDiagnostics: () => Promise<{- success: boolean;- diagnostics?: NativeCaptureDiagnostics | null;- }>;- pauseNativeScreenRecording: () => Promise<{- success: boolean;- message?: string;- error?: string;- }>;- resumeNativeScreenRecording: () => Promise<{- success: boolean;- message?: string;- error?: string;- }>;- startFfmpegRecording: (- source: any,- ) => Promise<{ success: boolean; path?: string; message?: string; error?: string }>;- stopFfmpegRecording: () => Promise<{- success: boolean;- path?: string;- message?: string;- error?: string;- }>;- storeRecordedVideo: (- videoData: ArrayBuffer,- fileName: string,- ) => Promise<{ success: boolean; path?: string; message?: string }>;- storeMicrophoneSidecar: (- audioData: ArrayBuffer,- videoPath: string,- ) => Promise<{ success: boolean; path?: string; error?: string }>;- getRecordedVideoPath: () => Promise<{ success: boolean; path?: string; message?: string }>;- listAssetDirectory: (relativeDir: string) => Promise<{- success: boolean;- files?: string[];- error?: string;- }>;- readLocalFile: (- filePath: string,- ) => Promise<{ success: boolean; data?: Uint8Array; error?: string }>;- generateWallpaperThumbnail: (- filePath: string,- ) => Promise<{ success: boolean; data?: Uint8Array; error?: string }>;- nativeVideoExportStart: (options: {- width: number;- height: number;- frameRate: number;- bitrate: number;- encodingMode: "fast" | "balanced" | "quality";- }) => Promise<{- success: boolean;- sessionId?: string;- encoderName?: string;- error?: string;- }>;- nativeVideoExportWriteFrame: (- sessionId: string,- frameData: Uint8Array,- ) => Promise<{ success: boolean; error?: string }>;- nativeVideoExportFinish: (- sessionId: string,- options?: {- audioMode?: "none" | "copy-source" | "trim-source" | "edited-track";- audioSourcePath?: string | null;- trimSegments?: Array<{ startMs: number; endMs: number }>;- editedAudioData?: ArrayBuffer;- editedAudioMimeType?: string | null;- },- ) => Promise<{- success: boolean;- data?: Uint8Array;- encoderName?: string;- error?: string;- }>;+/// <reference types="vite-plugin-electron/electron-env" />++declare namespace NodeJS {+ interface ProcessEnv {+ /**+ * The built directory structure+ *+ * ```tree+ * ├─┬─┬ dist+ * │ │ └── index.html+ * │ │+ * │ ├─┬ dist-electron+ * │ │ ├── main.js+ * │ │ └── preload.js+ * │+ * ```+ */+ APP_ROOT: string;+ /** /dist/ or /public/ */+ VITE_PUBLIC: string;+ }+}++// Used in Renderer process, expose in `preload.ts`+interface NativeCaptureDiagnostics {+ backend: "windows-wgc" | "mac-screencapturekit" | "browser-store" | "ffmpeg";+ phase: "availability" | "start" | "stop" | "mux";+ timestamp: string;+ sourceId?: string | null;+ sourceType?: "screen" | "window" | "unknown";+ displayId?: number | null;+ displayBounds?: { x: number; y: number; width: number; height: number } | null;+ windowHandle?: number | null;+ helperPath?: string | null;+ outputPath?: string | null;+ systemAudioPath?: string | null;+ microphonePath?: string | null;+ osRelease?: string;+ supported?: boolean;+ helperExists?: boolean;+ fileSizeBytes?: number | null;+ processOutput?: string;+ error?: string;+}++interface UpdateToastState {+ version: string;+ detail: string;+ phase: "available" | "downloading" | "ready" | "error";+ delayMs: number;+ isPreview?: boolean;+ progressPercent?: number;+ primaryAction?: "download-update" | "install-update" | "retry-check";+}++interface UpdateStatusSummary {+ status: "idle" | "checking" | "up-to-date" | "available" | "downloading" | "ready" | "error";+ currentVersion: string;+ availableVersion: string | null;+ detail?: string;+}++interface Window {+ electronAPI: {+ hudOverlaySetIgnoreMouse: (ignore: boolean) => void;+ hudOverlayDrag: (phase: "start" | "move" | "end", screenX: number, screenY: number) => void;+ hudOverlayHide: () => void;+ hudOverlayClose: () => void;+ setHudOverlayExpanded: (expanded: boolean) => void;+ setHudOverlayCompactWidth: (width: number) => void;+ setHudOverlayMeasuredHeight: (height: number, expanded: boolean) => void;+ getHudOverlayCaptureProtection: () => Promise<{ success: boolean; enabled: boolean }>;+ setHudOverlayCaptureProtection: (+ enabled: boolean,+ ) => Promise<{ success: boolean; enabled: boolean }>;+ getSources: (opts: Electron.SourcesOptions) => Promise<ProcessedDesktopSource[]>;+ switchToEditor: () => Promise<void>;+ openSourceSelector: () => Promise<void>;+ selectSource: (source: any) => Promise<any>;+ showSourceHighlight: (source: any) => Promise<{ success: boolean }>;+ getSelectedSource: () => Promise<any>;+ onSelectedSourceChanged: (callback: (source: any) => void) => () => void;+ startNativeScreenRecording: (+ source: any,+ options?: {+ capturesSystemAudio?: boolean;+ capturesMicrophone?: boolean;+ microphoneDeviceId?: string;+ microphoneLabel?: string;+ },+ ) => Promise<{+ success: boolean;+ path?: string;+ message?: string;+ error?: string;+ userNotified?: boolean;+ microphoneFallbackRequired?: boolean;+ }>;+ stopNativeScreenRecording: () => Promise<{+ success: boolean;+ path?: string;+ message?: string;+ error?: string;+ }>;+ recoverNativeScreenRecording: () => Promise<{+ success: boolean;+ path?: string;+ message?: string;+ error?: string;+ }>;+ getLastNativeCaptureDiagnostics: () => Promise<{+ success: boolean;+ diagnostics?: NativeCaptureDiagnostics | null;+ }>;+ pauseNativeScreenRecording: () => Promise<{+ success: boolean;+ message?: string;+ error?: string;+ }>;+ resumeNativeScreenRecording: () => Promise<{+ success: boolean;+ message?: string;+ error?: string;+ }>;+ startFfmpegRecording: (+ source: any,+ ) => Promise<{ success: boolean; path?: string; message?: string; error?: string }>;+ stopFfmpegRecording: () => Promise<{+ success: boolean;+ path?: string;+ message?: string;+ error?: string;+ }>;+ storeRecordedVideo: (+ videoData: ArrayBuffer,+ fileName: string,+ ) => Promise<{ success: boolean; path?: string; message?: string }>;+ storeMicrophoneSidecar: (+ audioData: ArrayBuffer,+ videoPath: string,+ ) => Promise<{ success: boolean; path?: string; error?: string }>;+ getRecordedVideoPath: () => Promise<{ success: boolean; path?: string; message?: string }>;+ listAssetDirectory: (relativeDir: string) => Promise<{+ success: boolean;+ files?: string[];+ error?: string;+ }>;+ getAssetBasePath: () => Promise<string | null>;+ readLocalFile: (+ filePath: string,+ ) => Promise<{ success: boolean; data?: Uint8Array; error?: string }>;+ generateWallpaperThumbnail: (+ filePath: string,+ ) => Promise<{ success: boolean; data?: Uint8Array; error?: string }>;+ nativeVideoExportStart: (options: {+ width: number;+ height: number;+ frameRate: number;+ bitrate: number;+ encodingMode: "fast" | "balanced" | "quality";+ }) => Promise<{+ success: boolean;+ sessionId?: string;+ encoderName?: string;+ error?: string;+ }>;+ nativeVideoExportWriteFrame: (+ sessionId: string,+ frameData: Uint8Array,+ ) => Promise<{ success: boolean; error?: string }>;+ nativeVideoExportFinish: (+ sessionId: string,+ options?: {+ audioMode?: "none" | "copy-source" | "trim-source" | "edited-track";+ audioSourcePath?: string | null;+ trimSegments?: Array<{ startMs: number; endMs: number }>;+ editedAudioData?: ArrayBuffer;+ editedAudioMimeType?: string | null;+ },+ ) => Promise<{+ success: boolean;+ data?: Uint8Array;+ encoderName?: string;+ error?: string;+ }>;nativeVideoExportCancel: (sessionId: string,) => Promise<{ success: boolean; error?: string }>;@@ -195,332 +203,357 @@ interface Window {getVideoAudioFallbackPaths: (videoPath: string,) => Promise<{ success: boolean; paths: string[]; error?: string }>;- setRecordingState: (recording: boolean) => Promise<void>;- getCursorTelemetry: (videoPath?: string) => Promise<{- success: boolean;- samples: CursorTelemetryPoint[];- message?: string;- error?: string;- }>;- getSystemCursorAssets: () => Promise<{- success: boolean;- cursors: Record<string, SystemCursorAsset>;- error?: string;- }>;- onStopRecordingFromTray: (callback: () => void) => () => void;- onRecordingStateChanged: (- callback: (state: { recording: boolean; sourceName: string }) => void,- ) => () => void;- onRecordingInterrupted: (- callback: (state: { reason: string; message: string }) => void,- ) => () => void;- onCursorStateChanged: (- callback: (state: { cursorType: CursorTelemetryPoint["cursorType"] }) => void,- ) => () => void;- openExternalUrl: (url: string) => Promise<{ success: boolean; error?: string }>;- getAccessibilityPermissionStatus: () => Promise<{- success: boolean;- trusted: boolean;- prompted: boolean;- error?: string;- }>;- requestAccessibilityPermission: () => Promise<{- success: boolean;- trusted: boolean;- prompted: boolean;- error?: string;- }>;- getScreenRecordingPermissionStatus: () => Promise<{- success: boolean;- status: string;- error?: string;- }>;- openScreenRecordingPreferences: () => Promise<{ success: boolean; error?: string }>;- openAccessibilityPreferences: () => Promise<{ success: boolean; error?: string }>;- saveExportedVideo: (- videoData: ArrayBuffer,- fileName: string,- ) => Promise<{ success: boolean; path?: string; message?: string; canceled?: boolean }>;- writeExportedVideoToPath: (- videoData: ArrayBuffer,- outputPath: string,- ) => Promise<{ success: boolean; path?: string; message?: string; error?: string; canceled?: boolean }>;- openVideoFilePicker: () => Promise<{ success: boolean; path?: string; canceled?: boolean }>;- openAudioFilePicker: () => Promise<{ success: boolean; path?: string; canceled?: boolean }>;- openWhisperExecutablePicker: () => Promise<{- success: boolean;- path?: string;- canceled?: boolean;- error?: string;- }>;- openWhisperModelPicker: () => Promise<{- success: boolean;- path?: string;- canceled?: boolean;- error?: string;- }>;- getWhisperSmallModelStatus: () => Promise<{- success: boolean;- exists: boolean;- path?: string | null;- error?: string;- }>;- downloadWhisperSmallModel: () => Promise<{- success: boolean;- path?: string;- alreadyDownloaded?: boolean;- error?: string;- }>;- deleteWhisperSmallModel: () => Promise<{ success: boolean; error?: string }>;- onWhisperSmallModelDownloadProgress: (- callback: (state: {- status: "idle" | "downloading" | "downloaded" | "error";- progress: number;- path?: string | null;- error?: string;- }) => void,- ) => () => void;- generateAutoCaptions: (options: {- videoPath: string;- whisperExecutablePath?: string;- whisperModelPath: string;- language?: string;- }) => Promise<{- success: boolean;- cues?: AutoCaptionCue[];- message?: string;- error?: string;- }>;- setCurrentVideoPath: (path: string) => Promise<{ success: boolean }>;- setCurrentRecordingSession: (session: {- videoPath: string;- webcamPath?: string | null;- timeOffsetMs?: number;- }) => Promise<{ success: boolean }>;- getCurrentRecordingSession: () => Promise<{- success: boolean;- session?: { videoPath: string; webcamPath?: string | null; timeOffsetMs?: number };- }>;- getCurrentVideoPath: () => Promise<{ success: boolean; path?: string }>;- clearCurrentVideoPath: () => Promise<{ success: boolean }>;- deleteRecordingFile: (- filePath: string,- ) => Promise<{ success: boolean; error?: string }>;- saveProjectFile: (- projectData: unknown,- suggestedName?: string,- existingProjectPath?: string,- thumbnailDataUrl?: string | null,- ) => Promise<{- success: boolean;- path?: string;- message?: string;- canceled?: boolean;- error?: string;- }>;- loadProjectFile: () => Promise<{- success: boolean;- path?: string;- project?: unknown;- message?: string;- canceled?: boolean;- error?: string;- }>;- loadCurrentProjectFile: () => Promise<{- success: boolean;- path?: string;- project?: unknown;- message?: string;- canceled?: boolean;- error?: string;- }>;- getProjectsDirectory: () => Promise<{- success: boolean;- path?: string;- error?: string;- }>;- listProjectFiles: () => Promise<{- success: boolean;- projectsDir?: string | null;- entries: Array<{- path: string;- name: string;- updatedAt: number;- thumbnailPath: string | null;- isCurrent: boolean;- isInProjectsDirectory: boolean;- }>;- error?: string;- }>;- openProjectFileAtPath: (filePath: string) => Promise<{- success: boolean;- path?: string;- project?: unknown;- message?: string;- canceled?: boolean;- error?: string;- }>;- openProjectsDirectory: () => Promise<{- success: boolean;- path?: string;- message?: string;- error?: string;- }>;- installDownloadedUpdate: () => Promise<{ success: boolean }>;- downloadAvailableUpdate: () => Promise<{ success: boolean; message?: string }>;- deferDownloadedUpdate: (delayMs?: number) => Promise<{- success: boolean;- message?: string;- }>;- dismissUpdateToast: () => Promise<{ success: boolean }>;- skipUpdateVersion: () => Promise<{ success: boolean; message?: string }>;- getCurrentUpdateToastPayload: () => Promise<UpdateToastState | null>;- getUpdateStatusSummary: () => Promise<UpdateStatusSummary>;- previewUpdateToast: () => Promise<{ success: boolean }>;- checkForAppUpdates: () => Promise<{ success: boolean; logPath: string }>;- onUpdateToastStateChanged: (callback: (payload: UpdateToastState | null) => void) => () => void;- onUpdateReadyToast: (callback: (payload: {- version: string;- detail: string;- delayMs: number;- isPreview?: boolean;- }) => void) => () => void;- onMenuLoadProject: (callback: () => void) => () => void;- onMenuSaveProject: (callback: () => void) => () => void;- onMenuSaveProjectAs: (callback: () => void) => () => void;- getPlatform: () => Promise<string>;- revealInFolder: (- filePath: string,- ) => Promise<{ success: boolean; error?: string; message?: string }>;- openRecordingsFolder: () => Promise<{ success: boolean; error?: string; message?: string }>;- getRecordingsDirectory: () => Promise<{- success: boolean;- path: string;- isDefault: boolean;- error?: string;- }>;- chooseRecordingsDirectory: () => Promise<{- success: boolean;- canceled?: boolean;- path?: string;- isDefault?: boolean;- message?: string;- error?: string;- }>;- getShortcuts: () => Promise<Record<string, unknown> | null>;- saveShortcuts: (shortcuts: unknown) => Promise<{ success: boolean; error?: string }>;- setHasUnsavedChanges: (hasChanges: boolean) => void;- onRequestSaveBeforeClose: (callback: () => Promise<boolean>) => () => void;- isNativeWindowsCaptureAvailable: () => Promise<{ available: boolean }>;- muxNativeWindowsRecording: (pauseSegments?: Array<{ startMs: number; endMs: number }>) => Promise<{- success: boolean;- path?: string;- message?: string;- error?: string;- }>;- /** Returns the app version from package.json */- getAppVersion: () => Promise<string>;- /** Hide the OS cursor before browser capture starts. */- hideOsCursor: () => Promise<{ success: boolean }>;- /** Recording preferences (mic, system audio) */- getRecordingPreferences: () => Promise<{ success: boolean; microphoneEnabled: boolean; microphoneDeviceId?: string; systemAudioEnabled: boolean }>;- setRecordingPreferences: (prefs: { microphoneEnabled?: boolean; microphoneDeviceId?: string; systemAudioEnabled?: boolean }) => Promise<{ success: boolean; error?: string }>;- /** Countdown timer before recording */- getCountdownDelay: () => Promise<{ success: boolean; delay: number }>;- setCountdownDelay: (delay: number) => Promise<{ success: boolean; error?: string }>;- startCountdown: (seconds: number) => Promise<{ success: boolean; cancelled?: boolean }>;- cancelCountdown: () => Promise<{ success: boolean }>;- getActiveCountdown: () => Promise<{ success: boolean; seconds: number | null }>;- onCountdownTick: (callback: (seconds: number) => void) => () => void;- extensionsDiscover: () => Promise<any[]>;- extensionsList: () => Promise<any[]>;- extensionsGet: (id: string) => Promise<any | null>;- extensionsEnable: (id: string) => Promise<{ success: boolean; error?: string }>;- extensionsDisable: (id: string) => Promise<{ success: boolean; error?: string }>;- extensionsInstallFromFolder: () => Promise<{- success: boolean;- extension?: any;- message?: string;- error?: string;- canceled?: boolean;- }>;- extensionsUninstall: (id: string) => Promise<{ success: boolean; error?: string }>;- extensionsGetDirectory: () => Promise<{ success: boolean; path?: string; error?: string }>;- extensionsOpenDirectory: () => Promise<{ success: boolean; path?: string; error?: string }>;- extensionsMarketplaceSearch: (params: {- query?: string;- tags?: string[];- sort?: string;- page?: number;- pageSize?: number;- }) => Promise<any>;- extensionsMarketplaceGet: (id: string) => Promise<any | null>;- extensionsMarketplaceInstall: (- extensionId: string,- downloadUrl: string,- ) => Promise<{ success: boolean; error?: string }>;- extensionsMarketplaceSubmit: (- extensionId: string,- ) => Promise<{ success: boolean; reviewId?: string; error?: string }>;- extensionsReviewsList: (params: {- status?: string;- page?: number;- pageSize?: number;- }) => Promise<{ reviews: any[]; total: number }>;- extensionsReviewUpdate: (- reviewId: string,- status: string,- notes?: string,- ) => Promise<{ success: boolean; error?: string }>;- };-}--interface ProcessedDesktopSource {- id: string;- name: string;- display_id: string;- thumbnail: string | null;- appIcon: string | null;- originalName?: string;- sourceType?: "screen" | "window";- appName?: string;- windowTitle?: string;-}--interface CursorTelemetryPoint {- timeMs: number;- cx: number;- cy: number;- interactionType?: "move" | "click" | "double-click" | "right-click" | "middle-click" | "mouseup";- cursorType?:- | "arrow"- | "text"- | "pointer"- | "crosshair"- | "open-hand"- | "closed-hand"- | "resize-ew"- | "resize-ns"- | "not-allowed";-}--interface SystemCursorAsset {- dataUrl: string;- hotspotX: number;- hotspotY: number;- width: number;- height: number;-}--interface AutoCaptionCue {- id: string;- startMs: number;- endMs: number;- text: string;- words?: Array<{- text: string;- startMs: number;- endMs: number;- leadingSpace?: boolean;- }>;-}+ setRecordingState: (recording: boolean) => Promise<void>;+ getCursorTelemetry: (videoPath?: string) => Promise<{+ success: boolean;+ samples: CursorTelemetryPoint[];+ message?: string;+ error?: string;+ }>;+ getSystemCursorAssets: () => Promise<{+ success: boolean;+ cursors: Record<string, SystemCursorAsset>;+ error?: string;+ }>;+ onStopRecordingFromTray: (callback: () => void) => () => void;+ onRecordingStateChanged: (+ callback: (state: { recording: boolean; sourceName: string }) => void,+ ) => () => void;+ onRecordingInterrupted: (+ callback: (state: { reason: string; message: string }) => void,+ ) => () => void;+ onCursorStateChanged: (+ callback: (state: { cursorType: CursorTelemetryPoint["cursorType"] }) => void,+ ) => () => void;+ openExternalUrl: (url: string) => Promise<{ success: boolean; error?: string }>;+ getAccessibilityPermissionStatus: () => Promise<{+ success: boolean;+ trusted: boolean;+ prompted: boolean;+ error?: string;+ }>;+ requestAccessibilityPermission: () => Promise<{+ success: boolean;+ trusted: boolean;+ prompted: boolean;+ error?: string;+ }>;+ getScreenRecordingPermissionStatus: () => Promise<{+ success: boolean;+ status: string;+ error?: string;+ }>;+ openScreenRecordingPreferences: () => Promise<{ success: boolean; error?: string }>;+ openAccessibilityPreferences: () => Promise<{ success: boolean; error?: string }>;+ saveExportedVideo: (+ videoData: ArrayBuffer,+ fileName: string,+ ) => Promise<{ success: boolean; path?: string; message?: string; canceled?: boolean }>;+ writeExportedVideoToPath: (+ videoData: ArrayBuffer,+ outputPath: string,+ ) => Promise<{+ success: boolean;+ path?: string;+ message?: string;+ error?: string;+ canceled?: boolean;+ }>;+ openVideoFilePicker: () => Promise<{ success: boolean; path?: string; canceled?: boolean }>;+ openAudioFilePicker: () => Promise<{ success: boolean; path?: string; canceled?: boolean }>;+ openWhisperExecutablePicker: () => Promise<{+ success: boolean;+ path?: string;+ canceled?: boolean;+ error?: string;+ }>;+ openWhisperModelPicker: () => Promise<{+ success: boolean;+ path?: string;+ canceled?: boolean;+ error?: string;+ }>;+ getWhisperSmallModelStatus: () => Promise<{+ success: boolean;+ exists: boolean;+ path?: string | null;+ error?: string;+ }>;+ downloadWhisperSmallModel: () => Promise<{+ success: boolean;+ path?: string;+ alreadyDownloaded?: boolean;+ error?: string;+ }>;+ deleteWhisperSmallModel: () => Promise<{ success: boolean; error?: string }>;+ onWhisperSmallModelDownloadProgress: (+ callback: (state: {+ status: "idle" | "downloading" | "downloaded" | "error";+ progress: number;+ path?: string | null;+ error?: string;+ }) => void,+ ) => () => void;+ generateAutoCaptions: (options: {+ videoPath: string;+ whisperExecutablePath?: string;+ whisperModelPath: string;+ language?: string;+ }) => Promise<{+ success: boolean;+ cues?: AutoCaptionCue[];+ message?: string;+ error?: string;+ }>;+ setCurrentVideoPath: (path: string) => Promise<{ success: boolean }>;+ setCurrentRecordingSession: (session: {+ videoPath: string;+ webcamPath?: string | null;+ timeOffsetMs?: number;+ }) => Promise<{ success: boolean }>;+ getCurrentRecordingSession: () => Promise<{+ success: boolean;+ session?: { videoPath: string; webcamPath?: string | null; timeOffsetMs?: number };+ }>;+ getCurrentVideoPath: () => Promise<{ success: boolean; path?: string }>;+ clearCurrentVideoPath: () => Promise<{ success: boolean }>;+ deleteRecordingFile: (filePath: string) => Promise<{ success: boolean; error?: string }>;+ saveProjectFile: (+ projectData: unknown,+ suggestedName?: string,+ existingProjectPath?: string,+ thumbnailDataUrl?: string | null,+ ) => Promise<{+ success: boolean;+ path?: string;+ message?: string;+ canceled?: boolean;+ error?: string;+ }>;+ loadProjectFile: () => Promise<{+ success: boolean;+ path?: string;+ project?: unknown;+ message?: string;+ canceled?: boolean;+ error?: string;+ }>;+ loadCurrentProjectFile: () => Promise<{+ success: boolean;+ path?: string;+ project?: unknown;+ message?: string;+ canceled?: boolean;+ error?: string;+ }>;+ getProjectsDirectory: () => Promise<{+ success: boolean;+ path?: string;+ error?: string;+ }>;+ listProjectFiles: () => Promise<{+ success: boolean;+ projectsDir?: string | null;+ entries: Array<{+ path: string;+ name: string;+ updatedAt: number;+ thumbnailPath: string | null;+ isCurrent: boolean;+ isInProjectsDirectory: boolean;+ }>;+ error?: string;+ }>;+ openProjectFileAtPath: (filePath: string) => Promise<{+ success: boolean;+ path?: string;+ project?: unknown;+ message?: string;+ canceled?: boolean;+ error?: string;+ }>;+ openProjectsDirectory: () => Promise<{+ success: boolean;+ path?: string;+ message?: string;+ error?: string;+ }>;+ installDownloadedUpdate: () => Promise<{ success: boolean }>;+ downloadAvailableUpdate: () => Promise<{ success: boolean; message?: string }>;+ deferDownloadedUpdate: (delayMs?: number) => Promise<{+ success: boolean;+ message?: string;+ }>;+ dismissUpdateToast: () => Promise<{ success: boolean }>;+ skipUpdateVersion: () => Promise<{ success: boolean; message?: string }>;+ getCurrentUpdateToastPayload: () => Promise<UpdateToastState | null>;+ getUpdateStatusSummary: () => Promise<UpdateStatusSummary>;+ previewUpdateToast: () => Promise<{ success: boolean }>;+ checkForAppUpdates: () => Promise<{ success: boolean; logPath: string }>;+ onUpdateToastStateChanged: (+ callback: (payload: UpdateToastState | null) => void,+ ) => () => void;+ onUpdateReadyToast: (+ callback: (payload: {+ version: string;+ detail: string;+ delayMs: number;+ isPreview?: boolean;+ }) => void,+ ) => () => void;+ onMenuLoadProject: (callback: () => void) => () => void;+ onMenuSaveProject: (callback: () => void) => () => void;+ onMenuSaveProjectAs: (callback: () => void) => () => void;+ getPlatform: () => Promise<string>;+ revealInFolder: (+ filePath: string,+ ) => Promise<{ success: boolean; error?: string; message?: string }>;+ openRecordingsFolder: () => Promise<{ success: boolean; error?: string; message?: string }>;+ getRecordingsDirectory: () => Promise<{+ success: boolean;+ path: string;+ isDefault: boolean;+ error?: string;+ }>;+ chooseRecordingsDirectory: () => Promise<{+ success: boolean;+ canceled?: boolean;+ path?: string;+ isDefault?: boolean;+ message?: string;+ error?: string;+ }>;+ getShortcuts: () => Promise<Record<string, unknown> | null>;+ saveShortcuts: (shortcuts: unknown) => Promise<{ success: boolean; error?: string }>;+ setHasUnsavedChanges: (hasChanges: boolean) => void;+ onRequestSaveBeforeClose: (callback: () => Promise<boolean>) => () => void;+ isNativeWindowsCaptureAvailable: () => Promise<{ available: boolean }>;+ muxNativeWindowsRecording: (+ pauseSegments?: Array<{ startMs: number; endMs: number }>,+ ) => Promise<{+ success: boolean;+ path?: string;+ message?: string;+ error?: string;+ }>;+ /** Returns the app version from package.json */+ getAppVersion: () => Promise<string>;+ /** Hide the OS cursor before browser capture starts. */+ hideOsCursor: () => Promise<{ success: boolean }>;+ /** Recording preferences (mic, system audio) */+ getRecordingPreferences: () => Promise<{+ success: boolean;+ microphoneEnabled: boolean;+ microphoneDeviceId?: string;+ systemAudioEnabled: boolean;+ }>;+ setRecordingPreferences: (prefs: {+ microphoneEnabled?: boolean;+ microphoneDeviceId?: string;+ systemAudioEnabled?: boolean;+ }) => Promise<{ success: boolean; error?: string }>;+ /** Countdown timer before recording */+ getCountdownDelay: () => Promise<{ success: boolean; delay: number }>;+ setCountdownDelay: (delay: number) => Promise<{ success: boolean; error?: string }>;+ startCountdown: (seconds: number) => Promise<{ success: boolean; cancelled?: boolean }>;+ cancelCountdown: () => Promise<{ success: boolean }>;+ getActiveCountdown: () => Promise<{ success: boolean; seconds: number | null }>;+ onCountdownTick: (callback: (seconds: number) => void) => () => void;+ extensionsDiscover: () => Promise<any[]>;+ extensionsList: () => Promise<any[]>;+ extensionsGet: (id: string) => Promise<any | null>;+ extensionsEnable: (id: string) => Promise<{ success: boolean; error?: string }>;+ extensionsDisable: (id: string) => Promise<{ success: boolean; error?: string }>;+ extensionsInstallFromFolder: () => Promise<{+ success: boolean;+ extension?: any;+ message?: string;+ error?: string;+ canceled?: boolean;+ }>;+ extensionsUninstall: (id: string) => Promise<{ success: boolean; error?: string }>;+ extensionsGetDirectory: () => Promise<{ success: boolean; path?: string; error?: string }>;+ extensionsOpenDirectory: () => Promise<{ success: boolean; path?: string; error?: string }>;+ extensionsMarketplaceSearch: (params: {+ query?: string;+ tags?: string[];+ sort?: string;+ page?: number;+ pageSize?: number;+ }) => Promise<any>;+ extensionsMarketplaceGet: (id: string) => Promise<any | null>;+ extensionsMarketplaceInstall: (+ extensionId: string,+ downloadUrl: string,+ ) => Promise<{ success: boolean; error?: string }>;+ extensionsMarketplaceSubmit: (+ extensionId: string,+ ) => Promise<{ success: boolean; reviewId?: string; error?: string }>;+ extensionsReviewsList: (params: {+ status?: string;+ page?: number;+ pageSize?: number;+ }) => Promise<{ reviews: any[]; total: number }>;+ extensionsReviewUpdate: (+ reviewId: string,+ status: string,+ notes?: string,+ ) => Promise<{ success: boolean; error?: string }>;+ };+}++interface ProcessedDesktopSource {+ id: string;+ name: string;+ display_id: string;+ thumbnail: string | null;+ appIcon: string | null;+ originalName?: string;+ sourceType?: "screen" | "window";+ appName?: string;+ windowTitle?: string;+}++interface CursorTelemetryPoint {+ timeMs: number;+ cx: number;+ cy: number;+ interactionType?:+ | "move"+ | "click"+ | "double-click"+ | "right-click"+ | "middle-click"+ | "mouseup";+ cursorType?:+ | "arrow"+ | "text"+ | "pointer"+ | "crosshair"+ | "open-hand"+ | "closed-hand"+ | "resize-ew"+ | "resize-ns"+ | "not-allowed";+}++interface SystemCursorAsset {+ dataUrl: string;+ hotspotX: number;+ hotspotY: number;+ width: number;+ height: number;+}++interface AutoCaptionCue {+ id: string;+ startMs: number;+ endMs: number;+ text: string;+ words?: Array<{+ text: string;+ startMs: number;+ endMs: number;+ leadingSpace?: boolean;+ }>;+}diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.tsindex 68398a08..9b09148c 100644--- a/electron/ipc/handlers.ts+++ b/electron/ipc/handlers.ts@@ -12,6 +12,7 @@ import type { SaveDialogOptions, WebContents } from 'electron'import { app, BrowserWindow, desktopCapturer, dialog, ipcMain, shell, systemPreferences } from 'electron'import { RECORDINGS_DIR, USER_DATA_PATH } from '../appPaths'import { hideCursor, showCursor } from '../cursorHider'+import { closeCountdownWindow, createCountdownWindow, getCountdownWindow } from '../windows'import {buildNativeVideoExportArgs,buildTrimmedSourceAudioFilter,@@ -22,7 +23,6 @@ import {type NativeExportEncodingMode,type NativeVideoExportFinishOptions,} from './nativeVideoExport'-import { closeCountdownWindow, createCountdownWindow, getCountdownWindow } from '../windows'import { resolveWindowsCaptureDisplay } from './windowsCaptureSelection'const execFileAsync = promisify(execFile)@@ -910,7 +910,7 @@ async function pruneAutoRecordings(exemptPaths: string[] = []) {// Clean up companion audio files left from recording (macOS .m4a, Windows .wav)const base = entry.filePath.replace(/\.(mp4|mov|webm)$/i, '')for (const suffix of ['.system.m4a', '.mic.m4a', '.system.wav', '.mic.wav', '.mic.webm', '.system.webm']) {- await fs.rm(base + suffix, { force: true }).catch(() => {})+ await fs.rm(base + suffix, { force: true }).catch(() => undefined)}} catch (error) {console.warn('Failed to prune old auto recording:', entry.filePath, error)@@ -987,7 +987,7 @@ function getBundledWhisperExecutableCandidates() {}function getNativeCaptureHelperBinaryPath() {- return path.join(app.getPath('userData'), 'native-tools', 'openscreen-screencapturekit-helper')+ return path.join(app.getPath('userData'), 'native-tools', 'recordly-screencapturekit-helper')}function getSystemCursorHelperSourcePath() {@@ -995,7 +995,7 @@ function getSystemCursorHelperSourcePath() {}function getSystemCursorHelperBinaryPath() {- return path.join(app.getPath('userData'), 'native-tools', 'openscreen-system-cursors')+ return path.join(app.getPath('userData'), 'native-tools', 'recordly-system-cursors')}function getNativeCursorMonitorSourcePath() {@@ -1003,7 +1003,7 @@ function getNativeCursorMonitorSourcePath() {}function getNativeCursorMonitorBinaryPath() {- return path.join(app.getPath('userData'), 'native-tools', 'openscreen-native-cursor-monitor')+ return path.join(app.getPath('userData'), 'native-tools', 'recordly-native-cursor-monitor')}function getNativeWindowListSourcePath() {@@ -1011,7 +1011,7 @@ function getNativeWindowListSourcePath() {}function getNativeWindowListBinaryPath() {- return path.join(app.getPath('userData'), 'native-tools', 'openscreen-window-list')+ return path.join(app.getPath('userData'), 'native-tools', 'recordly-window-list')}type NativeMacWindowSource = {@@ -1088,7 +1088,7 @@ async function ensureNativeCaptureHelperBinary() {getNativeCaptureHelperSourcePath(),getNativeCaptureHelperBinaryPath(),'native ScreenCaptureKit helper',- 'openscreen-screencapturekit-helper'+ 'recordly-screencapturekit-helper')}@@ -1097,7 +1097,7 @@ async function ensureNativeWindowListBinary() {getNativeWindowListSourcePath(),getNativeWindowListBinaryPath(),'native ScreenCaptureKit window list helper',- 'openscreen-window-list'+ 'recordly-window-list')}@@ -1154,7 +1154,7 @@ async function getSystemCursorAssets() {sourcePath,getSystemCursorHelperBinaryPath(),'system cursor helper',- 'openscreen-system-cursors'+ 'recordly-system-cursors')const { stdout } = await execFileAsync(binaryPath, [], { timeout: 15000, maxBuffer: 20 * 1024 * 1024 })@@ -1211,15 +1211,48 @@ function resolveSystemFfmpegBinaryPath() {return candidate || null}+type HookCursorEvent = {+ button?: number+ mouseButton?: number+ x?: number+ y?: number+ screenX?: number+ screenY?: number+ data?: {+ button?: number+ mouseButton?: number+ x?: number+ y?: number+ screenX?: number+ screenY?: number+ }+}++type HookEventName = 'mousedown' | 'mouseup' | 'mousemove'++type HookCursorHandler = (event: HookCursorEvent) => void++type UiohookLike = {+ on?: (eventName: HookEventName, listener: HookCursorHandler) => void+ off?: (eventName: HookEventName, listener: HookCursorHandler) => void+ removeListener?: (eventName: HookEventName, listener: HookCursorHandler) => void+ start?: () => void+ stop?: () => void+ uIOhook?: UiohookLike+ uiohook?: UiohookLike+ Uiohook?: UiohookLike+ default?: UiohookLike+}+function loadUiohookModule() {- const moduleExports = nodeRequire('uiohook-napi')+ const moduleExports = nodeRequire('uiohook-napi') as UiohookLikereturn (- (moduleExports as any)?.uIOhook- ?? (moduleExports as any)?.uiohook- ?? (moduleExports as any)?.Uiohook- ?? (moduleExports as any)?.default?.uIOhook- ?? (moduleExports as any)?.default?.uiohook- ?? (moduleExports as any)?.default+ moduleExports.uIOhook+ ?? moduleExports.uiohook+ ?? moduleExports.Uiohook+ ?? moduleExports.default?.uIOhook+ ?? moduleExports.default?.uiohook+ ?? moduleExports.default?? moduleExports)}@@ -1228,7 +1261,7 @@ function getFfmpegBinaryPath() {const ffmpegStatic = loadFfmpegStatic()if (ffmpegStatic && typeof ffmpegStatic === 'string') {const bundledPath = app.isPackaged- ? ffmpegStatic.replace(/\.asar([\/\\])/, '.asar.unpacked$1')+ ? ffmpegStatic.replace(/\.asar([/\\])/, '.asar.unpacked$1'): ffmpegStaticif (existsSync(bundledPath)) {@@ -2698,7 +2731,7 @@ async function muxNativeWindowsVideoWithAudio(videoPath: string, systemAudioPathconst stat = await fs.stat(audioPath)if (stat.size <= 0) {console.warn(`[mux-win] Skipping ${label} audio: file is empty (${audioPath})`)- await fs.rm(audioPath, { force: true }).catch(() => {})+ await fs.rm(audioPath, { force: true }).catch(() => undefined)continue}inputs.push('-i', audioPath)@@ -2831,7 +2864,7 @@ async function muxNativeWindowsVideoWithAudio(videoPath: string, systemAudioPath// Clean up audio filesfor (const audioPath of [systemAudioPath, micAudioPath]) {if (audioPath) {- await fs.rm(audioPath, { force: true }).catch(() => {})+ await fs.rm(audioPath, { force: true }).catch(() => undefined)}}}@@ -3020,7 +3053,7 @@ async function muxNativeMacRecordingWithAudio(const stat = await fs.stat(audioPath)if (stat.size <= 0) {console.warn(`[mux] Skipping ${label} audio: file is empty (${audioPath})`)- await fs.rm(audioPath, { force: true }).catch(() => {})+ await fs.rm(audioPath, { force: true }).catch(() => undefined)continue}inputs.push('-i', audioPath)@@ -3148,7 +3181,7 @@ async function muxNativeMacRecordingWithAudio(for (const audioPath of [systemAudioPath, microphonePath]) {if (audioPath) {- await fs.rm(audioPath, { force: true }).catch(() => {})+ await fs.rm(audioPath, { force: true }).catch(() => undefined)}}}@@ -3223,7 +3256,7 @@ async function ensureNativeCursorMonitorBinary() {getNativeCursorMonitorSourcePath(),getNativeCursorMonitorBinaryPath(),'native cursor monitor helper',- 'openscreen-native-cursor-monitor'+ 'recordly-native-cursor-monitor')}@@ -3406,7 +3439,7 @@ function normalizeHookMouseButton(rawButton: unknown): 1 | 2 | 3 {return 1}-function getHookMouseButton(event: any): 1 | 2 | 3 {+function getHookMouseButton(event: HookCursorEvent | null | undefined): 1 | 2 | 3 {return normalizeHookMouseButton(event?.button?? event?.mouseButton@@ -3563,7 +3596,7 @@ function getNormalizedCursorPoint() {return { cx, cy }}-function getHookCursorScreenPoint(event: any): { x: number; y: number } | null {+function getHookCursorScreenPoint(event: HookCursorEvent | null | undefined): { x: number; y: number } | null {const rawX = event?.x ?? event?.data?.x ?? event?.screenX ?? event?.data?.screenXconst rawY = event?.y ?? event?.data?.y ?? event?.screenY ?? event?.data?.screenY@@ -3759,7 +3792,7 @@ async function startInteractionCapture() {return}- const onMouseDown = (event: any) => {+ const onMouseDown = (event: HookCursorEvent) => {if (!isCursorCaptureActive) {return}@@ -3793,7 +3826,7 @@ async function startInteractionCapture() {pushCursorSample(point.cx, point.cy, timeMs, interactionType)}- const onMouseUp = (_event: any) => {+ const onMouseUp = (_event: HookCursorEvent) => {if (!isCursorCaptureActive) {return}@@ -3807,7 +3840,7 @@ async function startInteractionCapture() {pushCursorSample(point.cx, point.cy, timeMs, 'mouseup')}- const onMouseMove = (event: any) => {+ const onMouseMove = (event: HookCursorEvent) => {if (process.platform !== 'linux' || !isCursorCaptureActive) {return}@@ -5339,7 +5372,7 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh}await fs.writeFile(thumbPath, jpegData)})// Keep the queue moving even if one fails- thumbGenerationQueue = generation.catch(() => {})+ thumbGenerationQueue = generation.catch(() => undefined)await generationreturn { success: true, data: jpegData! }@@ -6242,7 +6275,7 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh}await fs.unlink(filePath);// Also delete the cursor telemetry sidecar if it existsconst telemetryPath = getTelemetryPathForVideo(filePath);- await fs.unlink(telemetryPath).catch(() => {});+ await fs.unlink(telemetryPath).catch(() => undefined);if (currentVideoPath === filePath) {currentVideoPath = null;currentRecordingSession = null;diff --git a/package-lock.json b/package-lock.jsonindex 8367a4c0..34292cd5 100644--- a/package-lock.json+++ b/package-lock.json@@ -52,7 +52,6 @@"fix-webm-duration": "^1.0.6","gif.js": "^0.2.0","gsap": "^3.13.0",- "lucide-react": "^0.545.0","mediabunny": "^1.25.1","motion": "^12.23.24","mp4box": "^2.2.0",@@ -9402,16 +9401,6 @@"yallist": "^3.0.2"}},- "node_modules/lucide-react": {- "version": "0.545.0",- "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.545.0.tgz",- "integrity": "sha512-7r1/yUuflQDSt4f1bpn5ZAocyIxcTyVyBBChSVtBKn5M+392cPmI5YJMWOJKk/HUWGm5wg83chlAZtCcGbEZtw==",- "dev": true,- "license": "ISC",- "peerDependencies": {- "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"- }- },"node_modules/lzma-native": {"version": "8.0.6","resolved": "https://registry.npmjs.org/lzma-native/-/lzma-native-8.0.6.tgz",diff --git a/package.json b/package.jsonindex d9e99cb9..5068609c 100644--- a/package.json+++ b/package.json@@ -80,7 +80,6 @@"fix-webm-duration": "^1.0.6","gif.js": "^0.2.0","gsap": "^3.13.0",- "lucide-react": "^0.545.0","mediabunny": "^1.25.1","motion": "^12.23.24","mp4box": "^2.2.0",diff --git a/scripts/benchmark-export-queues.mjs b/scripts/benchmark-export-queues.mjsindex 3028ab12..92bd72ee 100644--- a/scripts/benchmark-export-queues.mjs+++ b/scripts/benchmark-export-queues.mjs@@ -463,7 +463,7 @@ function calculateDelta(referenceValue, nextValue) {return {deltaMs: nextValue - referenceValue,deltaPercent:- referenceValue > 0 ? ((nextValue - referenceValue) / referenceValue) * 100 : 0,+ referenceValue > 0 ? ((nextValue - referenceValue) / referenceValue) * 100 : null,};}@@ -951,18 +951,20 @@ async function main() {const baseline = result.summaries[0];const tuned = result.summaries[1];- const deltaMs = tuned.averageElapsedMs - baseline.averageElapsedMs;- const percent =- baseline.averageElapsedMs > 0 ? (deltaMs / baseline.averageElapsedMs) * 100 : 0;- const medianDeltaMs = tuned.medianElapsedMs - baseline.medianElapsedMs;- const medianPercent =- baseline.medianElapsedMs > 0 ? (medianDeltaMs / baseline.medianElapsedMs) * 100 : 0;+ const { deltaMs, deltaPercent: percent } = calculateDelta(+ baseline.averageElapsedMs,+ tuned.averageElapsedMs,+ );+ const { deltaMs: medianDeltaMs, deltaPercent: medianPercent } = calculateDelta(+ baseline.medianElapsedMs,+ tuned.medianElapsedMs,+ );const backendLabel = result.request.backend ?? "default";console.log(- `[benchmark-export-queues] ${backendLabel} tuned vs baseline: ${deltaMs}ms (${percent.toFixed(1)}%)`,+ `[benchmark-export-queues] ${backendLabel} tuned vs baseline: ${deltaMs}ms (${typeof percent === "number" ? percent.toFixed(1) : "-"}%)`,);console.log(- `[benchmark-export-queues] ${backendLabel} tuned vs baseline (median): ${medianDeltaMs}ms (${medianPercent.toFixed(1)}%)`,+ `[benchmark-export-queues] ${backendLabel} tuned vs baseline (median): ${medianDeltaMs}ms (${typeof medianPercent === "number" ? medianPercent.toFixed(1) : "-"}%)`,);}} finally {diff --git a/scripts/build-windows-capture.mjs b/scripts/build-windows-capture.mjsindex 3ae981b2..76f7e477 100644--- a/scripts/build-windows-capture.mjs+++ b/scripts/build-windows-capture.mjs@@ -20,6 +20,7 @@ const bundledDir = path.join();const bundledExePath = path.join(bundledDir, "wgc-capture.exe");const helperId = "wgc-capture";+const generatorArch = process.arch === "arm64" ? "ARM64" : "x64";if (process.platform !== "win32") {console.log(@@ -120,7 +121,7 @@ function clearCmakeCache() {console.log("[build-windows-capture] Configuring CMake...");try {clearCmakeCache();- execSync(`${cmake} .. -G "Visual Studio 17 2022" -A x64`, {+ execSync(`${cmake} .. -G "Visual Studio 17 2022" -A ${generatorArch}`, {cwd: buildDir,stdio: "inherit",timeout: 120000,@@ -129,7 +130,7 @@ try {console.log("[build-windows-capture] VS 2022 generator not found, trying VS 2019...");try {clearCmakeCache();- execSync(`${cmake} .. -G "Visual Studio 16 2019" -A x64`, {+ execSync(`${cmake} .. -G "Visual Studio 16 2019" -A ${generatorArch}`, {cwd: buildDir,stdio: "inherit",timeout: 120000,diff --git a/scripts/i18n-check.mjs b/scripts/i18n-check.mjsindex cff56c29..bb93a4c6 100644--- a/scripts/i18n-check.mjs+++ b/scripts/i18n-check.mjs@@ -4,10 +4,13 @@ import path from "node:path";const root = process.cwd();const localesDir = path.join(root, "src", "i18n", "locales");-const locales = fs.readdirSync(localesDir).filter((entry) => {- const fullPath = path.join(localesDir, entry);- return fs.statSync(fullPath).isDirectory();-});+const locales = fs+ .readdirSync(localesDir)+ .filter((entry) => {+ const fullPath = path.join(localesDir, entry);+ return fs.statSync(fullPath).isDirectory();+ })+ .sort((left, right) => left.localeCompare(right));if (!locales.includes("en")) {console.error('i18n-check: expected base locale directory "en"');@@ -15,7 +18,12 @@ if (!locales.includes("en")) {}function loadJson(filePath) {- return JSON.parse(fs.readFileSync(filePath, "utf8"));+ try {+ return JSON.parse(fs.readFileSync(filePath, "utf8"));+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ throw new Error(`i18n-check: failed to load ${path.relative(root, filePath)}: ${message}`);+ }}function collectKeyPaths(obj, prefix = "") {@@ -42,7 +50,10 @@ function collectKeyPaths(obj, prefix = "") {}const baseLocaleDir = path.join(localesDir, "en");-const namespaceFiles = fs.readdirSync(baseLocaleDir).filter((file) => file.endsWith(".json"));+const namespaceFiles = fs+ .readdirSync(baseLocaleDir)+ .filter((file) => file.endsWith(".json"))+ .sort((left, right) => left.localeCompare(right));let hasErrors = false;diff --git a/src/components/launch/SourceSelector.tsx b/src/components/launch/SourceSelector.tsxindex b9929695..fec7af9b 100644--- a/src/components/launch/SourceSelector.tsx+++ b/src/components/launch/SourceSelector.tsx@@ -1,4 +1,4 @@-import { useEffect, useState } from "react";+import { type KeyboardEvent as ReactKeyboardEvent, useEffect, useState } from "react";import { MdCheck } from "react-icons/md";import { useScopedT } from "../../contexts/I18nContext";import { Button } from "../ui/button";@@ -111,6 +111,18 @@ export function SourceSelector() {}, [loading, screenSources.length, windowSources.length]);const handleSourceSelect = (source: DesktopSource) => setSelectedSource(source);+ const handleSourceKeyDown = (+ event: ReactKeyboardEvent<HTMLDivElement>,+ source: DesktopSource,+ ) => {+ if (event.key !== "Enter" && event.key !== " ") {+ return;+ }++ event.preventDefault();+ handleSourceSelect(source);+ };+const handleShare = async () => {if (selectedSource) await window.electronAPI.selectSource(selectedSource);};@@ -159,37 +171,47 @@ export function SourceSelector() {>{screenSources.length === 0 && (<div className="col-span-2 text-center text-xs text-zinc-500 py-8">- No screens available+ {t("sourceSelector.noScreensAvailable")}</div>)}- {screenSources.map((source) => (- <Card- key={source.id}- className={`${styles.sourceCard} ${selectedSource?.id === source.id ? styles.selected : ""} cursor-pointer h-fit p-2 scale-95`}- style={{ margin: 8, width: "90%", maxWidth: 220 }}- onClick={() => handleSourceSelect(source)}- >- <div className="p-1">- <div className="relative mb-1">- <img- src={source.thumbnail || ""}- alt={source.name}- className="w-full aspect-video object-cover rounded border border-zinc-800"- />- {selectedSource?.id === source.id && (- <div className="absolute -top-1 -right-1">- <div className="w-4 h-4 bg-[#2563EB] rounded-full flex items-center justify-center shadow-md">- <MdCheck className={styles.icon} />+ {screenSources.map((source) => {+ const isSelected = selectedSource?.id === source.id;++ return (+ <Card+ key={source.id}+ className={`${styles.sourceCard} ${isSelected ? styles.selected : ""} cursor-pointer h-fit p-2 scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2563EB] focus-visible:ring-offset-2 focus-visible:ring-offset-transparent`}+ style={{ margin: 8, width: "90%", maxWidth: 220 }}+ onClick={() => handleSourceSelect(source)}+ onKeyDown={(event) =>+ handleSourceKeyDown(event, source)+ }+ role="button"+ tabIndex={0}+ aria-pressed={isSelected}+ >+ <div className="p-1">+ <div className="relative mb-1">+ <img+ src={source.thumbnail || ""}+ alt={source.name}+ className="w-full aspect-video object-cover rounded border border-zinc-800"+ />+ {isSelected && (+ <div className="absolute -top-1 -right-1">+ <div className="w-4 h-4 bg-[#2563EB] rounded-full flex items-center justify-center shadow-md">+ <MdCheck className={styles.icon} />+ </div></div>- </div>- )}- </div>- <div className={styles.name + " truncate"}>- {source.name}+ )}+ </div>+ <div className={styles.name + " truncate"}>+ {source.name}+ </div></div>- </div>- </Card>- ))}+ </Card>+ );+ })}</div></TabsContent><TabsContent value="windows" className="h-full">@@ -201,63 +223,77 @@ export function SourceSelector() {>{windowSources.length === 0 && (<div className="col-span-2 text-center text-xs text-zinc-500 py-8">- No windows available+ {t("sourceSelector.noWindowsAvailable")}</div>)}- {windowSources.map((source) => (- <Card- key={source.id}- className={`${styles.sourceCard} ${selectedSource?.id === source.id ? styles.selected : ""} cursor-pointer h-fit p-2 scale-95`}- style={{ margin: 8, width: "90%", maxWidth: 220 }}- onClick={() => handleSourceSelect(source)}- >- <div className="p-1">- <div className="relative mb-1">- {source.thumbnail ? (- <img- src={source.thumbnail}- alt={source.name}- className="w-full aspect-video object-cover rounded border border-gray-700"- />- ) : (- <div className="w-full aspect-video rounded border border-gray-700 bg-zinc-900/80 flex flex-col items-center justify-center text-zinc-400 gap-2">- {source.appIcon ? (- <img- src={source.appIcon}- alt="App icon"- className="w-8 h-8 rounded-md"- />- ) : (- <div className="w-8 h-8 rounded-md bg-zinc-800 border border-zinc-700" />- )}- <div className="text-[10px] uppercase tracking-[0.2em] text-zinc-500">- {t("sourceSelector.windowPlaceholder")}+ {windowSources.map((source) => {+ const isSelected = selectedSource?.id === source.id;++ return (+ <Card+ key={source.id}+ className={`${styles.sourceCard} ${isSelected ? styles.selected : ""} cursor-pointer h-fit p-2 scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2563EB] focus-visible:ring-offset-2 focus-visible:ring-offset-transparent`}+ style={{ margin: 8, width: "90%", maxWidth: 220 }}+ onClick={() => handleSourceSelect(source)}+ onKeyDown={(event) =>+ handleSourceKeyDown(event, source)+ }+ role="button"+ tabIndex={0}+ aria-pressed={isSelected}+ >+ <div className="p-1">+ <div className="relative mb-1">+ {source.thumbnail ? (+ <img+ src={source.thumbnail}+ alt={source.name}+ className="w-full aspect-video object-cover rounded border border-gray-700"+ />+ ) : (+ <div className="w-full aspect-video rounded border border-gray-700 bg-zinc-900/80 flex flex-col items-center justify-center text-zinc-400 gap-2">+ {source.appIcon ? (+ <img+ src={source.appIcon}+ alt="App icon"+ className="w-8 h-8 rounded-md"+ />+ ) : (+ <div className="w-8 h-8 rounded-md bg-zinc-800 border border-zinc-700" />+ )}+ <div className="text-[10px] uppercase tracking-[0.2em] text-zinc-500">+ {t(+ "sourceSelector.windowPlaceholder",+ )}+ </div></div>- </div>- )}- {selectedSource?.id === source.id && (- <div className="absolute -top-1 -right-1">- <div className="w-4 h-4 bg-blue-600 rounded-full flex items-center justify-center shadow-md">- <MdCheck className={styles.icon} />+ )}+ {isSelected && (+ <div className="absolute -top-1 -right-1">+ <div className="w-4 h-4 bg-blue-600 rounded-full flex items-center justify-center shadow-md">+ <MdCheck className={styles.icon} />+ </div></div>+ )}+ </div>+ <div className="flex items-center gap-1">+ {source.appIcon && (+ <img+ src={source.appIcon}+ alt="App icon"+ className={+ styles.icon + " flex-shrink-0"+ }+ />+ )}+ <div className={styles.name + " truncate"}>+ {source.name}</div>- )}- </div>- <div className="flex items-center gap-1">- {source.appIcon && (- <img- src={source.appIcon}- alt="App icon"- className={styles.icon + " flex-shrink-0"}- />- )}- <div className={styles.name + " truncate"}>- {source.name}</div></div>- </div>- </Card>- ))}+ </Card>+ );+ })}</div></TabsContent></div>diff --git a/src/components/launch/UpdateToastWindow.tsx b/src/components/launch/UpdateToastWindow.tsxindex cb293129..da37bfa1 100644--- a/src/components/launch/UpdateToastWindow.tsx+++ b/src/components/launch/UpdateToastWindow.tsx@@ -1,8 +1,8 @@import {+ WarningCircle as AlertCircle,DownloadSimple as Download,- Rocket,Spinner as LoaderCircle,- WarningCircle as AlertCircle,+ Rocket,} from "@phosphor-icons/react";import { useEffect, useRef, useState } from "react";@@ -56,6 +56,9 @@ function getPrimaryActionLabel(payload: UpdateToastPayload) {export function UpdateToastWindow() {const [payload, setPayload] = useState<UpdateToastPayload | null>(null);const [dragOffsetX, setDragOffsetX] = useState(0);+ const dragResetKey = payload+ ? `${payload.phase}:${payload.version}:${payload.progressPercent ?? ""}:${payload.detail}:${payload.delayMs}:${payload.isPreview ? "1" : "0"}:${payload.primaryAction ?? ""}`+ : "empty";const dragState = useRef<{pointerId: number | null;startX: number;@@ -100,10 +103,8 @@ export function UpdateToastWindow() {}, []);useEffect(() => {- if (payload) {- void payload.phase;- void payload.version;- void payload.progressPercent;+ if (!dragResetKey) {+ return;}setDragOffsetX(0);@@ -112,7 +113,7 @@ export function UpdateToastWindow() {startX: 0,active: false,};- }, [payload]);+ }, [dragResetKey]);const cardStyle = {background: "#0d1117",diff --git a/src/components/ui/content-clamp.tsx b/src/components/ui/content-clamp.tsxindex c0600c19..6e6d18f8 100644--- a/src/components/ui/content-clamp.tsx+++ b/src/components/ui/content-clamp.tsx@@ -15,9 +15,9 @@ function ContentClamp({ children, className, truncateLength = 50, ...props }: Coconst isTruncated = text.length > truncateLength;const [open, setOpen] = React.useState(false);- const timeoutRef = React.useRef<NodeJS.Timeout | null>(null);+ const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);- const handleMouseEnter = () => {+ const openPopover = () => {if (timeoutRef.current) {clearTimeout(timeoutRef.current);timeoutRef.current = null;@@ -25,12 +25,21 @@ function ContentClamp({ children, className, truncateLength = 50, ...props }: CosetOpen(true);};- const handleMouseLeave = () => {+ const scheduleClose = () => {timeoutRef.current = setTimeout(() => {setOpen(false);}, 100);};+ const handleKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {+ if (event.key !== "Enter" && event.key !== " ") {+ return;+ }++ event.preventDefault();+ setOpen((currentOpen) => !currentOpen);+ };+React.useEffect(() => {return () => {if (timeoutRef.current) {@@ -53,10 +62,20 @@ function ContentClamp({ children, className, truncateLength = 50, ...props }: Co<Popover open={open} onOpenChange={setOpen}><PopoverTrigger asChild><span- className={className}- onMouseEnter={handleMouseEnter}- onMouseLeave={handleMouseLeave}- onClick={(e) => e.preventDefault()}+ className={cn("cursor-help", className)}+ onMouseEnter={openPopover}+ onMouseLeave={scheduleClose}+ onFocus={openPopover}+ onBlur={scheduleClose}+ onClick={(event) => {+ event.preventDefault();+ setOpen((currentOpen) => !currentOpen);+ }}+ onKeyDown={handleKeyDown}+ role="button"+ tabIndex={0}+ aria-haspopup="dialog"+ aria-expanded={open}{...props}>{truncatedText}@@ -66,8 +85,8 @@ function ContentClamp({ children, className, truncateLength = 50, ...props }: CoclassName="w-auto max-w-sm rounded-lg border border-white bg-popover p-3 text-sm text-popover-foreground"sideOffset={8}animated={false}- onMouseEnter={handleMouseEnter}- onMouseLeave={handleMouseLeave}+ onMouseEnter={openPopover}+ onMouseLeave={scheduleClose}onPointerDownOutside={(e) => e.preventDefault()}onClick={(e) => e.stopPropagation()}>diff --git a/src/components/video-editor/AddCustomFontDialog.tsx b/src/components/video-editor/AddCustomFontDialog.tsxindex 1ecbc629..65e901c6 100644--- a/src/components/video-editor/AddCustomFontDialog.tsx+++ b/src/components/video-editor/AddCustomFontDialog.tsx@@ -15,6 +15,7 @@ import { Label } from "@/components/ui/label";import {addCustomFont,type CustomFont,+ DuplicateFontError,generateFontId,isValidGoogleFontsUrl,parseFontFamilyFromImport,@@ -32,6 +33,19 @@ export function AddCustomFontDialog({ onFontAdded }: AddCustomFontDialogProps) {const [fontName, setFontName] = useState("");const [loading, setLoading] = useState(false);+ const resetForm = () => {+ setImportUrl("");+ setFontName("");+ setLoading(false);+ };++ const handleOpenChange = (nextOpen: boolean) => {+ setOpen(nextOpen);+ if (!nextOpen) {+ resetForm();+ }+ };+const handleImportUrlChange = (url: string) => {setImportUrl(url);@@ -45,18 +59,21 @@ export function AddCustomFontDialog({ onFontAdded }: AddCustomFontDialogProps) {};const handleAdd = async () => {+ const normalizedImportUrl = importUrl.trim();+ const normalizedFontName = fontName.trim();+// Validate inputs- if (!importUrl.trim()) {+ if (!normalizedImportUrl) {toast.error(t("addFont.enterUrl"));return;}- if (!isValidGoogleFontsUrl(importUrl)) {+ if (!isValidGoogleFontsUrl(normalizedImportUrl)) {toast.error(t("addFont.invalidUrl"));return;}- if (!fontName.trim()) {+ if (!normalizedFontName) {toast.error(t("addFont.enterName"));return;}@@ -65,19 +82,18 @@ export function AddCustomFontDialog({ onFontAdded }: AddCustomFontDialogProps) {try {// Extract font family from URL- const fontFamily = parseFontFamilyFromImport(importUrl);+ const fontFamily = parseFontFamilyFromImport(normalizedImportUrl);if (!fontFamily) {toast.error(t("addFont.extractFailed"));- setLoading(false);return;}// Create custom font objectconst newFont: CustomFont = {- id: generateFontId(fontName),- name: fontName.trim(),+ id: generateFontId(normalizedFontName),+ name: normalizedFontName,fontFamily: fontFamily,- importUrl: importUrl.trim(),+ importUrl: normalizedImportUrl,};// Add font (this will load and verify it) - throws if it fails@@ -88,14 +104,19 @@ export function AddCustomFontDialog({ onFontAdded }: AddCustomFontDialogProps) {onFontAdded(newFont);}- toast.success(t("addFont.addSuccess", undefined, { name: fontName }));+ toast.success(t("addFont.addSuccess", undefined, { name: normalizedFontName }));// Reset and close- setImportUrl("");- setFontName("");- setOpen(false);+ handleOpenChange(false);} catch (error) {console.error("Failed to add custom font:", error);+ if (error instanceof DuplicateFontError) {+ toast.error(t("addFont.addFailed"), {+ description: t("addFont.alreadyAdded", "This font has already been added."),+ });+ return;+ }+const errorMessage = error instanceof Error ? error.message : "Failed to load font";toast.error(t("addFont.addFailed"), {description: errorMessage.includes("timeout")@@ -108,7 +129,7 @@ export function AddCustomFontDialog({ onFontAdded }: AddCustomFontDialogProps) {};return (- <Dialog open={open} onOpenChange={setOpen}>+ <Dialog open={open} onOpenChange={handleOpenChange}><DialogTrigger asChild><Buttonvariant="outline"@@ -159,7 +180,7 @@ export function AddCustomFontDialog({ onFontAdded }: AddCustomFontDialogProps) {<div className="flex justify-end gap-2 mt-6"><Buttonvariant="outline"- onClick={() => setOpen(false)}+ onClick={() => handleOpenChange(false)}className="bg-white/5 border-white/10 text-slate-200 hover:bg-white/10">{t("addFont.cancel")}diff --git a/src/components/video-editor/AnnotationOverlay.tsx b/src/components/video-editor/AnnotationOverlay.tsxindex 8d219327..32a8fa9d 100644--- a/src/components/video-editor/AnnotationOverlay.tsx+++ b/src/components/video-editor/AnnotationOverlay.tsx@@ -175,7 +175,7 @@ export function AnnotationOverlay({)}style={{zIndex: isSelectedBoost ? zIndex + 1000 : zIndex, // Boost selected annotation to ensure it's on top- pointerEvents: isSelected ? "auto" : "none",+ pointerEvents: "auto",border: isSelected ? "2px solid rgba(37, 99, 235, 0.8)" : "none",backgroundColor: isSelected ? "rgba(37, 99, 235, 0.1)" : "transparent",boxShadow: isSelected ? "0 0 0 1px rgba(37, 99, 235, 0.35)" : "none",diff --git a/src/components/video-editor/AnnotationSettingsPanel.tsx b/src/components/video-editor/AnnotationSettingsPanel.tsxindex e887de46..33e9859c 100644--- a/src/components/video-editor/AnnotationSettingsPanel.tsx+++ b/src/components/video-editor/AnnotationSettingsPanel.tsx@@ -1,19 +1,19 @@-import Block from "@uiw/react-color-block";import {AlignCenterHorizontal as AlignCenter,AlignLeft,AlignRight,- BoundingBox as SquareDashed,+ TextB as Bold,CaretDown as ChevronDown,- Info,ImageSquare as ImageIcon,- TextB as Bold,+ Info,TextItalic as Italic,+ BoundingBox as SquareDashed,+ Trash as Trash2,TextT as Type,TextUnderline as Underline,- Trash as Trash2,UploadSimple as Upload,} from "@phosphor-icons/react";+import Block from "@uiw/react-color-block";import { useEffect, useMemo, useRef, useState } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";@@ -556,6 +556,11 @@ export function AnnotationSettingsPanel({};onFigureDataChange?.(newFigureData);}}+ aria-label={t(+ "annotations.arrowDirectionOption",+ "Arrow direction: {{direction}}",+ { direction: direction.replace(/-/g, " ") },+ )}className={cn("h-16 rounded-lg border flex items-center justify-center transition-all p-2",annotation.figureData?.arrowDirection === directiondiff --git a/src/components/video-editor/CropControl.tsx b/src/components/video-editor/CropControl.tsxindex 11ceacc9..0e00d8d9 100644--- a/src/components/video-editor/CropControl.tsx+++ b/src/components/video-editor/CropControl.tsx@@ -35,16 +35,26 @@ export function CropControl({ videoElement, cropRegion, onCropChange }: CropContcanvas.width = videoElement.videoWidth || 1920;canvas.height = videoElement.videoHeight || 1080;+ let animationFrameId = 0;+ let isCancelled = false;+const draw = () => {+ if (isCancelled) {+ return;+ }+if (videoElement.readyState >= 2) {ctx.clearRect(0, 0, canvas.width, canvas.height);ctx.drawImage(videoElement, 0, 0, canvas.width, canvas.height);}- requestAnimationFrame(draw);+ animationFrameId = requestAnimationFrame(draw);};- const rafId = requestAnimationFrame(draw);- return () => cancelAnimationFrame(rafId);+ animationFrameId = requestAnimationFrame(draw);+ return () => {+ isCancelled = true;+ cancelAnimationFrame(animationFrameId);+ };}, [videoElement]);const getContainerRect = () => {@@ -61,8 +71,12 @@ export function CropControl({ videoElement, cropRegion, onCropChange }: CropContconst handlePointerDown = (e: React.PointerEvent, handle: DragHandle) => {e.stopPropagation();e.preventDefault();- setIsDragging(handle);const rect = getContainerRect();+ if (rect.width <= 0 || rect.height <= 0) {+ return;+ }++ setIsDragging(handle);setDragStart({x: (e.clientX - rect.left) / rect.width,y: (e.clientY - rect.top) / rect.height,@@ -76,6 +90,10 @@ export function CropControl({ videoElement, cropRegion, onCropChange }: CropContif (!isDragging) return;const rect = getContainerRect();+ if (rect.width <= 0 || rect.height <= 0) {+ return;+ }+const currentX = (e.clientX - rect.left) / rect.width;const currentY = (e.clientY - rect.top) / rect.height;const deltaX = currentX - dragStart.x;diff --git a/src/components/video-editor/ExportSettingsMenu.tsx b/src/components/video-editor/ExportSettingsMenu.tsxindex eee761d5..82e483a2 100644--- a/src/components/video-editor/ExportSettingsMenu.tsx+++ b/src/components/video-editor/ExportSettingsMenu.tsx@@ -91,6 +91,7 @@ export function ExportSettingsMenu({key={option.value}type="button"onClick={() => onExportFormatChange?.(option.value)}+ aria-pressed={isActive}className={cn("relative flex-1 overflow-hidden rounded-xl border py-2 text-xs font-medium transition-colors",isActive@@ -132,6 +133,7 @@ export function ExportSettingsMenu({key={option.value}type="button"onClick={() => onExportQualityChange?.(option.value)}+ aria-pressed={isActive}className="relative rounded-lg px-1 py-1 text-[11px] font-medium transition-colors">{isActive ? (@@ -196,6 +198,7 @@ export function ExportSettingsMenu({key={option.value}type="button"onClick={() => onExportEncodingModeChange?.(option.value)}+ aria-pressed={isActive}className="relative rounded-lg px-1 py-1 text-[11px] font-medium transition-colors">{isActive ? (@@ -236,6 +239,7 @@ export function ExportSettingsMenu({key={rate}type="button"onClick={() => onMp4FrameRateChange?.(rate)}+ aria-pressed={isActive}className="relative rounded-lg px-1 py-1 text-[11px] font-medium transition-colors">{isActive ? (@@ -287,6 +291,7 @@ export function ExportSettingsMenu({key={option.value}type="button"onClick={() => onExportPipelineModelChange?.(option.value)}+ aria-pressed={isActive}className="relative rounded-lg px-1 py-1 text-[11px] font-medium transition-colors">{isActive ? (@@ -338,6 +343,7 @@ export function ExportSettingsMenu({key={rate.value}type="button"onClick={() => onGifFrameRateChange?.(rate.value)}+ aria-pressed={isActive}className="relative rounded-lg text-[11px] font-medium transition-colors">{isActive ? (@@ -377,6 +383,7 @@ export function ExportSettingsMenu({onClick={() =>onGifSizePresetChange?.(key as GifSizePreset)}+ aria-pressed={isActive}className="relative rounded-lg text-[11px] font-medium transition-colors">{isActive ? (diff --git a/src/components/video-editor/ExtensionManager.tsx b/src/components/video-editor/ExtensionManager.tsxindex 5520411c..49ea2b90 100644--- a/src/components/video-editor/ExtensionManager.tsx+++ b/src/components/video-editor/ExtensionManager.tsx@@ -14,12 +14,12 @@ import {DownloadSimple as Download,ArrowSquareOut as ExternalLink,FolderOpen,- MagnifyingGlass as Search,+ Spinner as Loader2,Plus,PuzzlePiece as Puzzle,ArrowClockwise as RefreshCw,+ MagnifyingGlass as Search,ShieldWarning as ShieldAlert,- Spinner as Loader2,Tag,Trash as Trash2,} from "@phosphor-icons/react";@@ -650,14 +650,14 @@ export default function ExtensionManager() {if (success) {toast.success(t("toast.installedAndEnabled"));}- }, [installFromFolder]);+ }, [installFromFolder, t]);const handleToggleExtension = useCallback(async (id: string) => {try {await toggleExtension(id);} catch {- toast.error(t("toast.enableFailed"));+ toast.error(t("toast.enableFailed", "Failed to update extension state"));}},[toggleExtension, t],@@ -676,7 +676,7 @@ export default function ExtensionManager() {toast.error(t("toast.uninstallFailed", undefined, { name }));}},- [uninstall],+ [uninstall, t],);// Marketplace search@@ -713,14 +713,14 @@ export default function ExtensionManager() {} finally {setIsRefreshing(false);}- }, [activeTab, handleSearch, refresh]);+ }, [activeTab, handleSearch, refresh, t]);// Auto-search when switching to browse tabuseEffect(() => {if (activeTab === "browse" && marketplaceResults.length === 0 && !marketplaceLoading) {handleSearch();}- }, [activeTab]); // eslint-disable-line react-hooks/exhaustive-deps+ }, [activeTab, handleSearch, marketplaceLoading, marketplaceResults.length]);// Marketplace installconst handleMarketplaceInstall = useCallback(@@ -750,7 +750,7 @@ export default function ExtensionManager() {});}},- [marketplaceInstall],+ [marketplaceInstall, t],);return (diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsxindex 5fe6d9c0..db6d3f68 100644--- a/src/components/video-editor/SettingsPanel.tsx+++ b/src/components/video-editor/SettingsPanel.tsx@@ -1,4 +1,4 @@-import { Palette, Trash2, Upload, X } from "lucide-react";+import { Palette, Trash as Trash2, UploadSimple as Upload, X } from "@phosphor-icons/react";import { AnimatePresence, LayoutGroup, motion } from "motion/react";import { useEffect, useMemo, useRef, useState } from "react";import { toast } from "sonner";@@ -13,11 +13,15 @@ import {import { Switch } from "@/components/ui/switch";import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";import { getAssetPath, getRenderableAssetUrl, getWallpaperThumbnailUrl } from "@/lib/assetPath";-import { cn } from "@/lib/utils";-import { extensionHost, type FrameInstance } from "@/lib/extensions";import type { ExtensionSettingField } from "@/lib/extensions";+import { extensionHost, type FrameInstance } from "@/lib/extensions";+import { cn } from "@/lib/utils";import type { BuiltInWallpaper } from "@/lib/wallpapers";-import { BUILT_IN_WALLPAPERS, getAvailableWallpapers, isVideoWallpaperSource } from "@/lib/wallpapers";+import {+ BUILT_IN_WALLPAPERS,+ getAvailableWallpapers,+ isVideoWallpaperSource,+} from "@/lib/wallpapers";import { type AspectRatio } from "@/utils/aspectRatioUtils";import minimalCursorUrl from "../../../Minimal Cursor.svg";import tahoeCursorUrl from "../../assets/cursors/Cursor=Default.svg";@@ -137,14 +141,20 @@ function getBackgroundTabForWallpaper(value: string): BackgroundTab {function SectionLabel({ children }: { children: React.ReactNode }) {return (- <p className="text-[10px] font-semibold uppercase tracking-widest text-slate-400">{children}</p>+ <p className="text-[10px] font-semibold uppercase tracking-widest text-slate-400">+ {children}+ </p>);}/*** Renders extension-contributed settings fields (toggle, slider, select, color, text).*/-function ExtensionSettingsSection({ extensionId, label, fields }: {+function ExtensionSettingsSection({+ extensionId,+ label,+ fields,+}: {extensionId: string;label: string;fields: ExtensionSettingField[];@@ -153,19 +163,29 @@ function ExtensionSettingsSection({ extensionId, label, fields }: {return (<div className="flex flex-col gap-1.5 mt-2 pt-2 border-t border-white/[0.06]">- <p className="text-[10px] font-semibold uppercase tracking-widest text-slate-500">{label}</p>+ <p className="text-[10px] font-semibold uppercase tracking-widest text-slate-500">+ {label}+ </p>{fields.map((field) => {- const value = extensionHost.getExtensionSetting(extensionId, field.id) ?? field.defaultValue;+ const value =+ extensionHost.getExtensionSetting(extensionId, field.id) ?? field.defaultValue;- if (field.type === 'toggle') {+ if (field.type === "toggle") {return (- <div key={field.id} className="flex items-center justify-between rounded-lg bg-white/[0.03] px-2.5 py-1.5">+ <div+ key={field.id}+ className="flex items-center justify-between rounded-lg bg-white/[0.03] px-2.5 py-1.5"+ ><span className="text-[11px] text-slate-300">{field.label}</span><Switchchecked={Boolean(value)}onCheckedChange={(checked) => {- extensionHost.setExtensionSetting(extensionId, field.id, checked);- forceUpdate(n => n + 1);+ extensionHost.setExtensionSetting(+ extensionId,+ field.id,+ checked,+ );+ forceUpdate((n) => n + 1);}}className="data-[state=checked]:bg-[#2563EB] scale-75"/>@@ -173,48 +193,70 @@ function ExtensionSettingsSection({ extensionId, label, fields }: {);}- if (field.type === 'slider') {+ if (field.type === "slider") {return (- <div key={field.id} className="flex items-center justify-between gap-2 rounded-lg bg-white/[0.03] px-2.5 py-1.5">- <span className="text-[11px] text-slate-300 flex-shrink-0">{field.label}</span>+ <div+ key={field.id}+ className="flex items-center justify-between gap-2 rounded-lg bg-white/[0.03] px-2.5 py-1.5"+ >+ <span className="text-[11px] text-slate-300 flex-shrink-0">+ {field.label}+ </span><div className="flex items-center gap-1.5"><inputtype="range"min={field.min ?? 0}max={field.max ?? 1}step={field.step ?? 0.01}- value={typeof value === 'number' ? value : field.defaultValue as number}+ value={+ typeof value === "number"+ ? value+ : (field.defaultValue as number)+ }onChange={(e) => {- extensionHost.setExtensionSetting(extensionId, field.id, parseFloat(e.target.value));- forceUpdate(n => n + 1);+ extensionHost.setExtensionSetting(+ extensionId,+ field.id,+ parseFloat(e.target.value),+ );+ forceUpdate((n) => n + 1);}}className="w-20 h-1 accent-[#2563EB]"/><span className="text-[10px] text-slate-500 w-8 text-right font-mono">- {(typeof value === 'number' ? value : 0).toFixed(1)}+ {(typeof value === "number" ? value : 0).toFixed(1)}</span></div></div>);}- if (field.type === 'select' && field.options) {+ if (field.type === "select" && field.options) {return (- <div key={field.id} className="flex items-center justify-between gap-2 rounded-lg bg-white/[0.03] px-2.5 py-1.5">- <span className="text-[11px] text-slate-300 flex-shrink-0">{field.label}</span>+ <div+ key={field.id}+ className="flex items-center justify-between gap-2 rounded-lg bg-white/[0.03] px-2.5 py-1.5"+ >+ <span className="text-[11px] text-slate-300 flex-shrink-0">+ {field.label}+ </span><Selectvalue={String(value)}onValueChange={(v) => {extensionHost.setExtensionSetting(extensionId, field.id, v);- forceUpdate(n => n + 1);+ forceUpdate((n) => n + 1);}}><SelectTrigger className="h-6 w-24 text-[10px] border-white/10 bg-white/[0.03]"><SelectValue /></SelectTrigger><SelectContent>- {field.options.map(opt => (- <SelectItem key={opt.value} value={opt.value} className="text-[10px]">+ {field.options.map((opt) => (+ <SelectItem+ key={opt.value}+ value={opt.value}+ className="text-[10px]"+ >{opt.label}</SelectItem>))}@@ -224,16 +266,25 @@ function ExtensionSettingsSection({ extensionId, label, fields }: {);}- if (field.type === 'color') {+ if (field.type === "color") {return (- <div key={field.id} className="flex items-center justify-between gap-2 rounded-lg bg-white/[0.03] px-2.5 py-1.5">- <span className="text-[11px] text-slate-300 flex-shrink-0">{field.label}</span>+ <div+ key={field.id}+ className="flex items-center justify-between gap-2 rounded-lg bg-white/[0.03] px-2.5 py-1.5"+ >+ <span className="text-[11px] text-slate-300 flex-shrink-0">+ {field.label}+ </span><inputtype="color"value={String(value)}onChange={(e) => {- extensionHost.setExtensionSetting(extensionId, field.id, e.target.value);- forceUpdate(n => n + 1);+ extensionHost.setExtensionSetting(+ extensionId,+ field.id,+ e.target.value,+ );+ forceUpdate((n) => n + 1);}}className="w-7 h-5 rounded border border-white/10 cursor-pointer bg-transparent"/>@@ -241,16 +292,25 @@ function ExtensionSettingsSection({ extensionId, label, fields }: {);}- if (field.type === 'text') {+ if (field.type === "text") {return (- <div key={field.id} className="flex items-center justify-between gap-2 rounded-lg bg-white/[0.03] px-2.5 py-1.5">- <span className="text-[11px] text-slate-300 flex-shrink-0">{field.label}</span>+ <div+ key={field.id}+ className="flex items-center justify-between gap-2 rounded-lg bg-white/[0.03] px-2.5 py-1.5"+ >+ <span className="text-[11px] text-slate-300 flex-shrink-0">+ {field.label}+ </span><inputtype="text"value={String(value)}onChange={(e) => {- extensionHost.setExtensionSetting(extensionId, field.id, e.target.value);- forceUpdate(n => n + 1);+ extensionHost.setExtensionSetting(+ extensionId,+ field.id,+ e.target.value,+ );+ forceUpdate((n) => n + 1);}}className="w-24 h-6 rounded bg-white/[0.06] border border-white/10 px-1.5 text-[10px] text-slate-200"/>@@ -571,11 +631,11 @@ function CursorStylePreview({}) {const previewSrc =style === "tahoe"- ? previewUrls.tahoe ?? tahoeCursorUrl+ ? (previewUrls.tahoe ?? tahoeCursorUrl): style === "figma"- ? previewUrls.figma ?? minimalCursorUrl+ ? (previewUrls.figma ?? minimalCursorUrl): style === "mono"- ? previewUrls.mono ?? tahoeCursorUrl+ ? (previewUrls.mono ?? tahoeCursorUrl): previewUrls[style];if (style === "tahoe") {@@ -590,14 +650,7 @@ function CursorStylePreview({}if (style === "figma") {- return (- <img- src={previewSrc}- alt=""- className="h-7 w-7 object-contain"- draggable={false}- />- );+ return <img src={previewSrc} alt="" className="h-7 w-7 object-contain" draggable={false} />;}if (style === "dot") {@@ -707,8 +760,9 @@ export function SettingsPanel({const initialEditorPreferences = useMemo(() => loadEditorPreferences(), []);const [builtInWallpapers, setBuiltInWallpapers] =useState<BuiltInWallpaper[]>(BUILT_IN_WALLPAPERS);- const [extensionWallpapers, setExtensionWallpapers] =- useState<ReturnType<typeof extensionHost.getContributedWallpapers>>([]);+ const [extensionWallpapers, setExtensionWallpapers] = useState<+ ReturnType<typeof extensionHost.getContributedWallpapers>+ >([]);const [wallpaperPreviewPaths, setWallpaperPreviewPaths] = useState<string[]>([]);const [extensionWallpaperPreviewUrls, setExtensionWallpaperPreviewUrls] = useState<Record<string, string>@@ -759,7 +813,9 @@ export function SettingsPanel({} catch {if (mounted) {setBuiltInWallpapers(BUILT_IN_WALLPAPERS);- setWallpaperPreviewPaths(BUILT_IN_WALLPAPERS.map((wallpaper) => wallpaper.publicPath));+ setWallpaperPreviewPaths(+ BUILT_IN_WALLPAPERS.map((wallpaper) => wallpaper.publicPath),+ );}}})();@@ -776,18 +832,26 @@ export function SettingsPanel({const cursorStyles = extensionHost.getContributedCursorStyles();const [wallpaperPreviewEntries, cursorPreviewEntries] = await Promise.all([Promise.all(- wallpapers.map(async (wallpaper) => [- wallpaper.id,- isVideoWallpaperSource(wallpaper.resolvedThumbnailUrl)- ? wallpaper.resolvedThumbnailUrl- : await getWallpaperThumbnailUrl(wallpaper.resolvedThumbnailUrl),- ] as const),+ wallpapers.map(+ async (wallpaper) =>+ [+ wallpaper.id,+ isVideoWallpaperSource(wallpaper.resolvedThumbnailUrl)+ ? wallpaper.resolvedThumbnailUrl+ : await getWallpaperThumbnailUrl(+ wallpaper.resolvedThumbnailUrl,+ ),+ ] as const,+ ),),Promise.all(- cursorStyles.map(async (cursorStyle) => [- cursorStyle.id,- await getRenderableAssetUrl(cursorStyle.resolvedDefaultUrl),- ] as const),+ cursorStyles.map(+ async (cursorStyle) =>+ [+ cursorStyle.id,+ await getRenderableAssetUrl(cursorStyle.resolvedDefaultUrl),+ ] as const,+ ),),]);@@ -847,7 +911,9 @@ export function SettingsPanel({}, []);// Extension-contributed settings panels- const [extensionPanels, setExtensionPanels] = useState<ReturnType<typeof extensionHost.getSettingsPanels>>([]);+ const [extensionPanels, setExtensionPanels] = useState<+ ReturnType<typeof extensionHost.getSettingsPanels>+ >([]);useEffect(() => {const update = () => setExtensionPanels(extensionHost.getSettingsPanels());update();@@ -876,8 +942,9 @@ export function SettingsPanel({const defaultWebcam = initialEditorPreferences.webcam;const [internalActiveEffectSection] = useState<EditorEffectSection>("scene");const activeEffectSection = activeEffectSectionProp ?? internalActiveEffectSection;- const [extensionCursorStyles, setExtensionCursorStyles] =- useState<ReturnType<typeof extensionHost.getContributedCursorStyles>>([]);+ const [extensionCursorStyles, setExtensionCursorStyles] = useState<+ ReturnType<typeof extensionHost.getContributedCursorStyles>+ >([]);const [builtInCursorPreviewUrls, setBuiltInCursorPreviewUrls] = useState<Partial<Record<string, string>>>({});@@ -977,9 +1044,8 @@ export function SettingsPanel({const imageWallpapers = builtInWallpapers.filter((wallpaper) => !isVideoWallpaperSource(wallpaper.publicPath),);- const builtInTiles = (wallpaperPreviewPaths.length > 0- ? wallpaperPreviewPaths- : builtInWallpaperPaths+ const builtInTiles = (+ wallpaperPreviewPaths.length > 0 ? wallpaperPreviewPaths : builtInWallpaperPaths).filter((path) => !isVideoWallpaperSource(path)).map((previewPath, index) => {@@ -1113,8 +1179,13 @@ export function SettingsPanel({preload="metadata"className="h-full w-full select-none object-cover [transform:translateZ(0)]"draggable={false}- onMouseEnter={(e) => e.currentTarget.play().catch(() => {})}- onMouseLeave={(e) => { e.currentTarget.pause(); e.currentTarget.currentTime = 0; }}+ onMouseEnter={(e) => {+ void e.currentTarget.play().catch(() => undefined);+ }}+ onMouseLeave={(e) => {+ e.currentTarget.pause();+ e.currentTarget.currentTime = 0;+ }}/>) : (<img@@ -1133,7 +1204,6 @@ export function SettingsPanel({</div>);-const handleDeleteClick = () => {if (selectedZoomId && onZoomDelete) {onZoomDelete(selectedZoomId);@@ -1295,11 +1365,13 @@ export function SettingsPanel({const handleVideoUpload = async () => {try {- const result = await (window as any).electronAPI.openVideoFilePicker();+ const result = await window.electronAPI.openVideoFilePicker();if (!result?.success || !result.path) return;- const filePath = result.path as string;+ const filePath = result.path;if (!isVideoWallpaperSource(filePath)) {- toast.error("Unsupported format", { description: "Please select a video file (mp4, webm, mov, etc.)" });+ toast.error("Unsupported format", {+ description: "Please select a video file (mp4, webm, mov, etc.)",+ });return;}setCustomImages((prev) => [filePath, ...prev]);@@ -1317,9 +1389,9 @@ export function SettingsPanel({if (selected === imageUrl) {onWallpaperChange(builtInWallpaperPaths[0] ??- extensionWallpaperPaths[0] ??- BUILT_IN_WALLPAPERS[0]?.publicPath ??- "",+ extensionWallpaperPaths[0] ??+ BUILT_IN_WALLPAPERS[0]?.publicPath ??+ "",);}};@@ -1378,13 +1450,19 @@ export function SettingsPanel({<motion.spanlayoutId="background-picker-pill"className="absolute inset-0 rounded-lg bg-[#2563EB]"- transition={{ type: "spring", stiffness: 420, damping: 34 }}+ transition={{+ type: "spring",+ stiffness: 420,+ damping: 34,+ }}/>) : null}<spanclassName={cn("relative z-10",- isActive ? "text-white" : "text-slate-400 hover:text-slate-200",+ isActive+ ? "text-white"+ : "text-slate-400 hover:text-slate-200",)}>{option.label}@@ -1428,7 +1506,11 @@ export function SettingsPanel({return renderWallpaperImageTile(imageUrl, isSelected, {key: `custom-${idx}`,ariaLabel: isVideoWallpaperSource(imageUrl)- ? imageUrl.split(/[\\/]/).pop() ?? tSettings("background.video", "Video background")+ ? (imageUrl.split(/[\\/]/).pop() ??+ tSettings(+ "background.video",+ "Video background",+ )): undefined,title: isVideoWallpaperSource(imageUrl)? imageUrl.split(/[\\/]/).pop()@@ -1436,7 +1518,9 @@ export function SettingsPanel({onClick: () => onWallpaperChange(imageUrl),children: (<button- onClick={(e) => handleRemoveCustomImage(imageUrl, e)}+ onClick={(e) =>+ handleRemoveCustomImage(imageUrl, e)+ }className="absolute top-0.5 right-0.5 w-3 h-3 bg-red-500/90 hover:bg-red-500 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10"><X className="w-2 h-2 text-white" />@@ -1446,13 +1530,20 @@ export function SettingsPanel({})}{imageWallpaperTiles.map((tile) => {- const isSelected = getWallpaperTileState(tile.value, tile.previewUrl);- return renderWallpaperImageTile(tile.previewUrl, isSelected, {- key: tile.key,- ariaLabel: tile.label,- title: tile.label,- onClick: () => onWallpaperChange(tile.value),- });+ const isSelected = getWallpaperTileState(+ tile.value,+ tile.previewUrl,+ );+ return renderWallpaperImageTile(+ tile.previewUrl,+ isSelected,+ {+ key: tile.key,+ ariaLabel: tile.label,+ title: tile.label,+ onClick: () => onWallpaperChange(tile.value),+ },+ );})}</div></div>@@ -1468,35 +1559,53 @@ export function SettingsPanel({</Button><div className="grid grid-cols-8 gap-1.5">- {customImages.filter(isVideoWallpaperSource).map((videoUrl, idx) => {- const isSelected = getWallpaperTileState(videoUrl);- return renderWallpaperImageTile(videoUrl, isSelected, {- key: `custom-video-${idx}`,- ariaLabel: videoUrl.split(/[\\/]/).pop() ?? "Video background",- title: videoUrl.split(/[\\/]/).pop(),- onClick: () => onWallpaperChange(videoUrl),- children: (- <button- onClick={(e) => handleRemoveCustomImage(videoUrl, e)}- className="absolute top-0.5 right-0.5 w-3 h-3 bg-red-500/90 hover:bg-red-500 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10"- >- <X className="w-2 h-2 text-white" />- </button>- ),- });- })}+ {customImages+ .filter(isVideoWallpaperSource)+ .map((videoUrl, idx) => {+ const isSelected = getWallpaperTileState(videoUrl);+ return renderWallpaperImageTile(+ videoUrl,+ isSelected,+ {+ key: `custom-video-${idx}`,+ ariaLabel:+ videoUrl.split(/[\\/]/).pop() ??+ "Video background",+ title: videoUrl.split(/[\\/]/).pop(),+ onClick: () => onWallpaperChange(videoUrl),+ children: (+ <button+ onClick={(e) =>+ handleRemoveCustomImage(+ videoUrl,+ e,+ )+ }+ className="absolute top-0.5 right-0.5 w-3 h-3 bg-red-500/90 hover:bg-red-500 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10"+ >+ <X className="w-2 h-2 text-white" />+ </button>+ ),+ },+ );+ })}{videoWallpaperTiles.map((wallpaper) => {const isSelected = getWallpaperTileState(wallpaper.value,wallpaper.previewUrl,);- return renderWallpaperImageTile(wallpaper.previewUrl, isSelected, {- key: wallpaper.key,- ariaLabel: wallpaper.label,- title: wallpaper.label,- onClick: () => onWallpaperChange(wallpaper.value),- });+ return renderWallpaperImageTile(+ wallpaper.previewUrl,+ isSelected,+ {+ key: wallpaper.key,+ ariaLabel: wallpaper.label,+ title: wallpaper.label,+ onClick: () =>+ onWallpaperChange(wallpaper.value),+ },+ );})}</div></div>@@ -1514,7 +1623,8 @@ export function SettingsPanel({/><div className="grid grid-cols-8 gap-1.5">{visibleColorPalette.map((color) => {- const isSelected = selected.toLowerCase() === color.toLowerCase();+ const isSelected =+ selected.toLowerCase() === color.toLowerCase();return (<buttonkey={color}@@ -1535,7 +1645,9 @@ export function SettingsPanel({className={wallpaperTileClass(isHexWallpaper(selected) &&!visibleColorPalette.some(- (color) => color.toLowerCase() === selected.toLowerCase(),+ (color) =>+ color.toLowerCase() ===+ selected.toLowerCase(),),)}style={{@@ -1585,17 +1697,21 @@ export function SettingsPanel({return (<AnnotationSettingsPanelannotation={selectedAnnotation}- onContentChange={(content) => onAnnotationContentChange(selectedAnnotation.id, content)}+ onContentChange={(content) =>+ onAnnotationContentChange(selectedAnnotation.id, content)+ }onTypeChange={(type) => onAnnotationTypeChange(selectedAnnotation.id, type)}onStyleChange={(style) => onAnnotationStyleChange(selectedAnnotation.id, style)}onFigureDataChange={onAnnotationFigureDataChange- ? (figureData) => onAnnotationFigureDataChange(selectedAnnotation.id, figureData)+ ? (figureData) =>+ onAnnotationFigureDataChange(selectedAnnotation.id, figureData): undefined}onBlurIntensityChange={onAnnotationBlurIntensityChange- ? (intensity) => onAnnotationBlurIntensityChange(selectedAnnotation.id, intensity)+ ? (intensity) =>+ onAnnotationBlurIntensityChange(selectedAnnotation.id, intensity): undefined}onBlurColorChange={@@ -1982,7 +2098,9 @@ export function SettingsPanel({<Selectvalue={autoCaptionSettings.animationStyle}onValueChange={(value) =>- updateAutoCaptionSettings({ animationStyle: value as AutoCaptionAnimation })+ updateAutoCaptionSettings({+ animationStyle: value as AutoCaptionAnimation,+ })}><SelectTrigger className="h-9 w-[160px] rounded-xl border-white/10 bg-white/5 text-sm text-slate-200 hover:bg-white/10">@@ -2004,7 +2122,9 @@ export function SettingsPanel({<inputtype="color"value={autoCaptionSettings.textColor}- onChange={(event) => updateAutoCaptionSettings({ textColor: event.target.value })}+ onChange={(event) =>+ updateAutoCaptionSettings({ textColor: event.target.value })+ }className="h-7 w-10 rounded border border-white/10 bg-transparent"/></label>@@ -2111,7 +2231,9 @@ export function SettingsPanel({<section className="flex flex-col gap-2"><div className="flex items-center justify-between gap-3"><div className="flex items-center gap-3">- <SectionLabel>{tSettings("sections.cursor", "Cursor")}</SectionLabel>+ <SectionLabel>+ {tSettings("sections.cursor", "Cursor")}+ </SectionLabel><buttontype="button"onClick={resetCursorSection}@@ -2194,7 +2316,9 @@ export function SettingsPanel({max={2}step={0.01}onChange={(v) => onCursorSmoothingChange?.(v)}- formatValue={(v) => (v <= 0 ? tSettings("effects.off") : v.toFixed(2))}+ formatValue={(v) =>+ v <= 0 ? tSettings("effects.off") : v.toFixed(2)+ }parseInput={(text) => parseFloat(text)}/><SliderControl@@ -2220,7 +2344,10 @@ export function SettingsPanel({parseInput={(text) => parseFloat(text.replace(/×$/, ""))}/><SliderControl- label={tSettings("effects.cursorClickBounceDuration", "Bounce Speed")}+ label={tSettings(+ "effects.cursorClickBounceDuration",+ "Bounce Speed",+ )}value={cursorClickBounceDuration}defaultValue={DEFAULT_CURSOR_CLICK_BOUNCE_DURATION}min={60}@@ -2238,7 +2365,9 @@ export function SettingsPanel({max={toCursorSwaySliderValue(2)}step={toCursorSwaySliderValue(0.05)}onChange={(v) => onCursorSwayChange?.(fromCursorSwaySliderValue(v))}- formatValue={(v) => (v <= 0 ? tSettings("effects.off") : `${v.toFixed(2)}×`)}+ formatValue={(v) =>+ v <= 0 ? tSettings("effects.off") : `${v.toFixed(2)}×`+ }parseInput={(text) => {const normalized = text.trim().toLowerCase();if (normalized === "off") return 0;@@ -2305,7 +2434,9 @@ export function SettingsPanel({<Buttonkey={option.preset}type="button"- onClick={() => applyWebcamPositionPreset(option.preset)}+ onClick={() =>+ applyWebcamPositionPreset(option.preset)+ }className={cn("h-8 rounded-lg border px-0 text-sm font-semibold transition-all",isActive@@ -2320,12 +2451,17 @@ export function SettingsPanel({</div><div className="mt-2 flex items-center justify-between rounded-lg bg-black/10 px-2.5 py-1.5"><span className="text-[10px] text-slate-400">- {tSettings("effects.webcamCustomPosition", "Custom position")}+ {tSettings(+ "effects.webcamCustomPosition",+ "Custom position",+ )}</span><Switchchecked={webcamPositionPreset === "custom"}onCheckedChange={(checked) =>- applyWebcamPositionPreset(checked ? "custom" : DEFAULT_WEBCAM_POSITION_PRESET)+ applyWebcamPositionPreset(+ checked ? "custom" : DEFAULT_WEBCAM_POSITION_PRESET,+ )}className="data-[state=checked]:bg-[#2563EB] scale-75"/>@@ -2340,7 +2476,12 @@ export function SettingsPanel({min={0}max={100}step={1}- onChange={(v) => updateWebcam({ positionPreset: "custom", positionX: v / 100 })}+ onChange={(v) =>+ updateWebcam({+ positionPreset: "custom",+ positionX: v / 100,+ })+ }formatValue={(v) => `${Math.round(v)}%`}parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/>@@ -2351,7 +2492,12 @@ export function SettingsPanel({min={0}max={100}step={1}- onChange={(v) => updateWebcam({ positionPreset: "custom", positionY: v / 100 })}+ onChange={(v) =>+ updateWebcam({+ positionPreset: "custom",+ positionY: v / 100,+ })+ }formatValue={(v) => `${Math.round(v)}%`}parseInput={(text) => parseFloat(text.replace(/%$/, ""))}/>@@ -2397,7 +2543,8 @@ export function SettingsPanel({{tSettings("effects.webcamFootage")}</div><div className="mt-0.5 text-[10px] text-slate-500">- {webcamFileName ?? tSettings("effects.webcamFootageDescription")}+ {webcamFileName ??+ tSettings("effects.webcamFootageDescription")}</div></div><div className="flex items-center gap-1.5">@@ -2432,9 +2579,11 @@ export function SettingsPanel({);default: {// Handle extension-contributed standalone section pages (ext:extensionId/panelId)- if (activeEffectSection?.startsWith('ext:')) {+ if (activeEffectSection?.startsWith("ext:")) {const panels = extensionPanels.filter(- p => !p.panel.parentSection && `ext:${p.extensionId}/${p.panel.id}` === activeEffectSection,+ (p) =>+ !p.panel.parentSection &&+ `ext:${p.extensionId}/${p.panel.id}` === activeEffectSection,);if (panels.length > 0) {const p = panels[0];@@ -2457,7 +2606,10 @@ export function SettingsPanel({return (<div className="flex-[2] w-[332px] min-w-[280px] max-w-[332px] bg-[#161619] border border-white/10 rounded-2xl flex flex-col shadow-xl h-full overflow-hidden">- <div className="flex-1 min-h-0 overflow-y-auto custom-scrollbar p-4 pb-0" style={{ scrollbarGutter: 'stable' }}>+ <div+ className="flex-1 min-h-0 overflow-y-auto custom-scrollbar p-4 pb-0"+ style={{ scrollbarGutter: "stable" }}+ ><AnimatePresence mode="wait" initial={false}><motion.divkey={activeEffectSection}@@ -2471,18 +2623,30 @@ export function SettingsPanel({</AnimatePresence></div>- <div className={cn(- "flex-shrink-0 border-t border-white/10 bg-[#151518] p-4 pt-3",- !selectedZoomId && !selectedTrimId && !selectedSpeedId && !selectedClipId && "hidden"- )}>+ <div+ className={cn(+ "flex-shrink-0 border-t border-white/10 bg-[#151518] p-4 pt-3",+ !selectedZoomId &&+ !selectedTrimId &&+ !selectedSpeedId &&+ !selectedClipId &&+ "hidden",+ )}+ >{selectedZoomId && (<div className="mb-4"><div className="mb-3 flex items-center justify-between">- <span className="text-sm font-medium text-slate-200">{tSettings("zoom.level")}</span>+ <span className="text-sm font-medium text-slate-200">+ {tSettings("zoom.level")}+ </span><div className="flex items-center gap-2">{selectedZoomDepth && (<span className="rounded-full bg-[#2563EB]/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-[#2563EB]">- {ZOOM_DEPTH_OPTIONS.find((o) => o.depth === selectedZoomDepth)?.label}+ {+ ZOOM_DEPTH_OPTIONS.find(+ (o) => o.depth === selectedZoomDepth,+ )?.label+ }</span>)}</div>@@ -2491,10 +2655,10 @@ export function SettingsPanel({<div className="flex rounded-lg border border-white/10 bg-white/5 p-0.5"><buttontype="button"- onClick={() => onZoomModeChange?.('auto')}+ onClick={() => onZoomModeChange?.("auto")}className={cn("flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-all",- selectedZoomMode === 'auto'+ selectedZoomMode === "auto"? "bg-[#2563EB] text-white shadow-sm": "text-slate-400 hover:text-slate-200",)}@@ -2503,10 +2667,10 @@ export function SettingsPanel({</button><buttontype="button"- onClick={() => onZoomModeChange?.('manual')}+ onClick={() => onZoomModeChange?.("manual")}className={cn("flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-all",- selectedZoomMode === 'manual'+ selectedZoomMode === "manual"? "bg-[#2563EB] text-white shadow-sm": "text-slate-400 hover:text-slate-200",)}@@ -2515,7 +2679,7 @@ export function SettingsPanel({</button></div><p className="mt-1.5 text-[10px] text-slate-500">- {selectedZoomMode === 'manual'+ {selectedZoomMode === "manual"? "Set a fixed focus point for this zoom": "Camera follows cursor automatically"}</p>@@ -2535,7 +2699,9 @@ export function SettingsPanel({: "border-white/5 bg-white/5 text-slate-400 hover:bg-white/10 hover:border-white/10 hover:text-slate-200",)}>- <span className="text-xs font-semibold">{option.label}</span>+ <span className="text-xs font-semibold">+ {option.label}+ </span></Button>);})}@@ -2574,8 +2740,8 @@ export function SettingsPanel({</span>{selectedSpeedValue && (<span className="rounded-full bg-[#d97706]/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-[#d97706]">- {SPEED_OPTIONS.find((o) => o.speed === selectedSpeedValue)?.label ??- `${selectedSpeedValue}×`}+ {SPEED_OPTIONS.find((o) => o.speed === selectedSpeedValue)+ ?.label ?? `${selectedSpeedValue}×`}</span>)}</div>@@ -2594,7 +2760,9 @@ export function SettingsPanel({: "border-white/5 bg-white/5 text-slate-400 hover:bg-white/10 hover:border-white/10 hover:text-slate-200",)}>- <span className="text-xs font-semibold">{option.label}</span>+ <span className="text-xs font-semibold">+ {option.label}+ </span></Button>);})}@@ -2645,7 +2813,9 @@ export function SettingsPanel({: "border-white/5 bg-white/5 text-slate-400 hover:bg-white/10 hover:border-white/10 hover:text-slate-200",)}>- <span className="text-[10px] font-semibold">{option.label}</span>+ <span className="text-[10px] font-semibold">+ {option.label}+ </span></Button>);})}@@ -2663,6 +2833,5 @@ export function SettingsPanel({)}</div></div>-);}diff --git a/src/components/video-editor/ShortcutsConfigDialog.tsx b/src/components/video-editor/ShortcutsConfigDialog.tsxindex ac5713c2..a1eee6d0 100644--- a/src/components/video-editor/ShortcutsConfigDialog.tsx+++ b/src/components/video-editor/ShortcutsConfigDialog.tsx@@ -1,4 +1,4 @@-import { ArrowCounterClockwise as RotateCcw, Keyboard } from "@phosphor-icons/react";+import { Keyboard, ArrowCounterClockwise as RotateCcw } from "@phosphor-icons/react";import { useCallback, useEffect, useState } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";@@ -86,7 +86,7 @@ export function ShortcutsConfigDialog() {window.addEventListener("keydown", handleCapture, { capture: true });return () => window.removeEventListener("keydown", handleCapture, { capture: true });- }, [captureFor, t]);+ }, [captureFor, draft, t]);const handleSwap = useCallback(() => {if (!conflict || conflict.conflictWith.type !== "configurable") return;diff --git a/src/components/video-editor/SliderControl.tsx b/src/components/video-editor/SliderControl.tsxindex 6ad188ed..6f0b84eb 100644--- a/src/components/video-editor/SliderControl.tsx+++ b/src/components/video-editor/SliderControl.tsx@@ -59,6 +59,8 @@ export function SliderControl({step={step}value={value}onChange={(e) => onChange(Number(e.target.value))}+ aria-label={label}+ aria-valuetext={formatValue(value)}className="absolute inset-0 h-full w-full cursor-ew-resize opacity-0"/></div>diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsxindex 18d36f98..b54cd82f 100644--- a/src/components/video-editor/VideoEditor.tsx+++ b/src/components/video-editor/VideoEditor.tsx@@ -1,21 +1,20 @@-import type { Span } from "dnd-timeline";import {Camera,- Captions,- Download,+ Subtitles as Captions,+ DownloadSimple as Download,FolderOpen,- MousePointer2,- Puzzle,- Redo2,- Save,- Sparkles,- Undo2,+ CursorClick as MousePointer2,+ PuzzlePiece as Puzzle,+ ArrowClockwise as Redo2,+ FloppyDisk as Save,+ Sparkle as Sparkles,+ ArrowCounterClockwise as Undo2,X,-} from "lucide-react";+} from "@phosphor-icons/react";+import type { Span } from "dnd-timeline";import { AnimatePresence, LayoutGroup, motion } from "motion/react";import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { toast } from "sonner";-import { ExtensionIcon } from "./ExtensionIcon";import { Button } from "@/components/ui/button";import {DropdownMenu,@@ -49,6 +48,7 @@ import {VideoExporter,} from "@/lib/exporter";import { resolveMediaElementSource } from "@/lib/exporter/localMediaSource";+import { extensionHost } from "@/lib/extensions";import {clampMediaTimeToDuration,estimateCompanionAudioStartDelaySeconds,@@ -59,6 +59,8 @@ import { type AspectRatio, getAspectRatioValue } from "@/utils/aspectRatioUtils"import { resolveAutoCaptionSourcePath } from "./autoCaptionSource";import { CropControl } from "./CropControl";import { ExportSettingsMenu } from "./ExportSettingsMenu";+import { ExtensionIcon } from "./ExtensionIcon";+import ExtensionManager from "./ExtensionManager";import { loadEditorPreferences, saveEditorPreferences } from "./editorPreferences";import PlaybackControls from "./PlaybackControls";import ProjectBrowserDialog, { type ProjectLibraryEntry } from "./ProjectBrowserDialog";@@ -72,8 +74,6 @@ import {validateProjectData,} from "./projectPersistence";import { type EditorEffectSection, SettingsPanel } from "./SettingsPanel";-import ExtensionManager from "./ExtensionManager";-import { extensionHost } from "@/lib/extensions";import {APP_HEADER_ICON_BUTTON_CLASS,DiscordLinkButton,@@ -89,14 +89,17 @@ import {type AudioRegion,type AutoCaptionSettings,type CaptionCue,+ type ClipRegion,type CropRegion,type CursorStyle,type CursorTelemetryPoint,clampFocusToDepth,+ clipsToTrims,DEFAULT_ANNOTATION_POSITION,DEFAULT_ANNOTATION_SIZE,DEFAULT_ANNOTATION_STYLE,DEFAULT_AUTO_CAPTION_SETTINGS,+ DEFAULT_AUTO_ZOOM_DEPTH,DEFAULT_CONNECTED_ZOOM_DURATION_MS,DEFAULT_CONNECTED_ZOOM_EASING,DEFAULT_CONNECTED_ZOOM_GAP_MS,@@ -106,8 +109,6 @@ import {DEFAULT_PLAYBACK_SPEED,DEFAULT_WEBCAM_OVERLAY,DEFAULT_ZOOM_DEPTH,- DEFAULT_AUTO_ZOOM_DEPTH,- type ZoomMode,DEFAULT_ZOOM_IN_DURATION_MS,DEFAULT_ZOOM_IN_EASING,DEFAULT_ZOOM_IN_OVERLAP_MS,@@ -117,11 +118,10 @@ import {type PlaybackSpeed,type SpeedRegion,type TrimRegion,- type ClipRegion,- clipsToTrims,type WebcamOverlaySettings,type ZoomDepth,type ZoomFocus,+ type ZoomMode,type ZoomRegion,type ZoomTransitionEasing,} from "./types";@@ -186,7 +186,10 @@ async function writeSmokeExportReport(reportBytes.byteOffset,reportBytes.byteOffset + reportBytes.byteLength,) as ArrayBuffer;- await window.electronAPI.writeExportedVideoToPath(reportBuffer, `${outputPath}.report.json`);+ await window.electronAPI.writeExportedVideoToPath(+ reportBuffer,+ `${outputPath}.report.json`,+ );} catch (error) {console.error("[smoke-export] Failed to write report", error);}@@ -254,16 +257,16 @@ function getSmokeExportConfig(search: string): SmokeExportConfig {: enabled && params.get("smokeEncodingMode") === "quality"? "quality": undefined,- shadowIntensity: enabled- ? parseSmokeExportNonNegativeNumber(params.get("smokeShadowIntensity"))- : undefined,- webcamInputPath: enabled ? params.get("smokeWebcamInput") : null,- webcamShadow: enabled- ? parseSmokeExportNonNegativeNumber(params.get("smokeWebcamShadow"))- : undefined,- webcamSize: enabled- ? parseSmokeExportNonNegativeNumber(params.get("smokeWebcamSize"))- : undefined,+ shadowIntensity: enabled+ ? parseSmokeExportNonNegativeNumber(params.get("smokeShadowIntensity"))+ : undefined,+ webcamInputPath: enabled ? params.get("smokeWebcamInput") : null,+ webcamShadow: enabled+ ? parseSmokeExportNonNegativeNumber(params.get("smokeWebcamShadow"))+ : undefined,+ webcamSize: enabled+ ? parseSmokeExportNonNegativeNumber(params.get("smokeWebcamSize"))+ : undefined,pipelineModel:enabled && params.get("smokePipelineModel") === "modern"? "modern"@@ -278,9 +281,15 @@ function getSmokeExportConfig(search: string): SmokeExportConfig {: enabled && params.get("smokeBackendPreference") === "breeze"? "breeze": undefined,- maxEncodeQueue: enabled ? parseSmokeExportNumber(params.get("smokeMaxEncodeQueue")) : undefined,- maxDecodeQueue: enabled ? parseSmokeExportNumber(params.get("smokeMaxDecodeQueue")) : undefined,- maxPendingFrames: enabled ? parseSmokeExportNumber(params.get("smokeMaxPendingFrames")) : undefined,+ maxEncodeQueue: enabled+ ? parseSmokeExportNumber(params.get("smokeMaxEncodeQueue"))+ : undefined,+ maxDecodeQueue: enabled+ ? parseSmokeExportNumber(params.get("smokeMaxDecodeQueue"))+ : undefined,+ maxPendingFrames: enabled+ ? parseSmokeExportNumber(params.get("smokeMaxPendingFrames"))+ : undefined,};}@@ -465,7 +474,9 @@ export default function VideoEditor() {const [currentTime, setCurrentTime] = useState(0);const [duration, setDuration] = useState(0);const [wallpaper, setWallpaper] = useState<string>(initialEditorPreferences.wallpaper);- const [shadowIntensity, setShadowIntensity] = useState(initialEditorPreferences.shadowIntensity);+ const [shadowIntensity, setShadowIntensity] = useState(+ initialEditorPreferences.shadowIntensity,+ );const [backgroundBlur, setBackgroundBlur] = useState(initialEditorPreferences.backgroundBlur);const [zoomMotionBlur, setZoomMotionBlur] = useState(initialEditorPreferences.zoomMotionBlur);const [connectZooms, setConnectZooms] = useState(initialEditorPreferences.connectZooms);@@ -499,7 +510,9 @@ export default function VideoEditor() {initialEditorPreferences.cursorStyle ?? DEFAULT_CURSOR_STYLE,);const [cursorSize, setCursorSize] = useState(initialEditorPreferences.cursorSize);- const [cursorSmoothing, setCursorSmoothing] = useState(initialEditorPreferences.cursorSmoothing);+ const [cursorSmoothing, setCursorSmoothing] = useState(+ initialEditorPreferences.cursorSmoothing,+ );const [zoomSmoothness, setZoomSmoothness] = useState(0.5);const [zoomClassicMode, setZoomClassicMode] = useState(false);const [cursorMotionBlur, setCursorMotionBlur] = useState(@@ -542,7 +555,9 @@ export default function VideoEditor() {const [whisperModelPath, setWhisperModelPath] = useState<string | null>(initialEditorPreferences.whisperModelPath,);- const [downloadedWhisperModelPath, setDownloadedWhisperModelPath] = useState<string | null>(null);+ const [downloadedWhisperModelPath, setDownloadedWhisperModelPath] = useState<string | null>(+ null,+ );const [whisperModelDownloadStatus, setWhisperModelDownloadStatus] = useState<"idle" | "downloading" | "downloaded" | "error">(initialEditorPreferences.whisperModelPath ? "downloaded" : "idle");@@ -554,7 +569,9 @@ export default function VideoEditor() {const [showExportDropdown, setShowExportDropdown] = useState(false);const [previewVolume, setPreviewVolume] = useState(1);const [sourceAudioFallbackPaths, setSourceAudioFallbackPaths] = useState<string[]>([]);- const [aspectRatio, setAspectRatio] = useState<AspectRatio>(initialEditorPreferences.aspectRatio);+ const [aspectRatio, setAspectRatio] = useState<AspectRatio>(+ initialEditorPreferences.aspectRatio,+ );const [activeEffectSection, setActiveEffectSection] = useState<EditorEffectSection>("scene");const [exportQuality, setExportQuality] = useState<ExportQuality>(initialEditorPreferences.exportQuality,@@ -562,8 +579,9 @@ export default function VideoEditor() {const [exportEncodingMode, setExportEncodingMode] = useState<ExportEncodingMode>(initialEditorPreferences.exportEncodingMode,);- const [exportBackendPreference, setExportBackendPreference] =- useState<ExportBackendPreference>(initialEditorPreferences.exportBackendPreference);+ const [exportBackendPreference, setExportBackendPreference] = useState<ExportBackendPreference>(+ initialEditorPreferences.exportBackendPreference,+ );const [exportPipelineModel, setExportPipelineModel] = useState<ExportPipelineModel>(initialEditorPreferences.exportPipelineModel,);@@ -624,6 +642,10 @@ export default function VideoEditor() {}, []);useEffect(() => {+ if (videoPath === autoSuggestedVideoPathRef.current) {+ return;+ }+autoSuggestedVideoPathRef.current = null;pendingFreshRecordingAutoSuggestTelemetryCountRef.current = 0;if (pendingFreshRecordingAutoSuggestTimeoutRef.current !== null) {@@ -756,7 +778,10 @@ export default function VideoEditor() {await frameRenderer.renderFrame(videoFrame, frameTimestampUs);return frameRenderer.getCanvas().toDataURL("image/png");} catch (thumbnailRenderError) {- console.warn("Unable to render thumbnail from composed frame:", thumbnailRenderError);+ console.warn(+ "Unable to render thumbnail from composed frame:",+ thumbnailRenderError,+ );} finally {videoFrame?.close();frameRenderer?.destroy();@@ -775,7 +800,9 @@ export default function VideoEditor() {}const sourceWidth =- drawableSource instanceof HTMLVideoElement ? drawableSource.videoWidth : drawableSource.width;+ drawableSource instanceof HTMLVideoElement+ ? drawableSource.videoWidth+ : drawableSource.width;const sourceHeight =drawableSource instanceof HTMLVideoElement? drawableSource.videoHeight@@ -816,14 +843,14 @@ export default function VideoEditor() {cursorSize,cursorSmoothing,zoomSmoothness,+ zoomClassicMode,cursorStyle,cursorSway,cursorTelemetry,padding,shadowIntensity,showCursor,- speedRegions,- clipRegions,+ effectiveSpeedRegions,wallpaper,webcam,zoomInDurationMs,@@ -926,37 +953,41 @@ export default function VideoEditor() {supportedMp4SourceDimensions.width,]);- const ensureSupportedMp4SourceDimensions = useCallback(async (frameRate: ExportMp4FrameRate) => {- const result = await probeSupportedMp4Dimensions({- width: desiredMp4SourceDimensions.width,- height: desiredMp4SourceDimensions.height,- frameRate,- codec: DEFAULT_MP4_CODEC,- getBitrate: getSourceQualityBitrate,- });-- if (!result.encoderPath) {- throw new Error(- `Video encoding not supported on this system. Tried codec ${DEFAULT_MP4_CODEC} at ${frameRate} FPS up to ${desiredMp4SourceDimensions.width}x${desiredMp4SourceDimensions.height}.`,- );- }+ const ensureSupportedMp4SourceDimensions = useCallback(+ async (frameRate: ExportMp4FrameRate) => {+ const result = await probeSupportedMp4Dimensions({+ width: desiredMp4SourceDimensions.width,+ height: desiredMp4SourceDimensions.height,+ frameRate,+ codec: DEFAULT_MP4_CODEC,+ getBitrate: getSourceQualityBitrate,+ });- setSupportedMp4SourceDimensions((current) => {- if (- current.width === result.width &&- current.height === result.height &&- current.capped === result.capped &&- current.encoderPath?.codec === result.encoderPath?.codec &&- current.encoderPath?.hardwareAcceleration === result.encoderPath?.hardwareAcceleration- ) {- return current;+ if (!result.encoderPath) {+ throw new Error(+ `Video encoding not supported on this system. Tried codec ${DEFAULT_MP4_CODEC} at ${frameRate} FPS up to ${desiredMp4SourceDimensions.width}x${desiredMp4SourceDimensions.height}.`,+ );}- return result;- });+ setSupportedMp4SourceDimensions((current) => {+ if (+ current.width === result.width &&+ current.height === result.height &&+ current.capped === result.capped &&+ current.encoderPath?.codec === result.encoderPath?.codec &&+ current.encoderPath?.hardwareAcceleration ===+ result.encoderPath?.hardwareAcceleration+ ) {+ return current;+ }- return result;- }, [desiredMp4SourceDimensions.height, desiredMp4SourceDimensions.width]);+ return result;+ });++ return result;+ },+ [desiredMp4SourceDimensions.height, desiredMp4SourceDimensions.width],+ );useEffect(() => {let cancelled = false;@@ -1006,8 +1037,8 @@ export default function VideoEditor() {const update = () => {const panels = extensionHost.getSettingsPanels();const standalone = panels- .filter(p => !p.panel.parentSection)- .map(p => ({+ .filter((p) => !p.panel.parentSection)+ .map((p) => ({id: `ext:${p.extensionId}/${p.panel.id}` as EditorEffectSection,label: p.panel.label,icon: p.panel.icon || (Puzzle as typeof Puzzle | string),@@ -1128,7 +1159,8 @@ export default function VideoEditor() {void (async () => {try {- const result = await window.electronAPI.getVideoAudioFallbackPaths(currentSourcePath);+ const result =+ await window.electronAPI.getVideoAudioFallbackPaths(currentSourcePath);if (cancelled) {return;}@@ -1147,7 +1179,9 @@ export default function VideoEditor() {const projectDisplayName = useMemo(() => {const fileName =- currentProjectPath?.split(/[\\/]/).pop() ?? currentSourcePath?.split(/[\\/]/).pop() ?? "";+ currentProjectPath?.split(/[\\/]/).pop() ??+ currentSourcePath?.split(/[\\/]/).pop() ??+ "";const withoutExtension = fileName.replace(/\.recordly$/i, "").replace(/\.[^.]+$/, "");return withoutExtension || t("editor.project.untitled", "Untitled");}, [currentProjectPath, currentSourcePath, t]);@@ -1230,6 +1264,7 @@ export default function VideoEditor() {cursorSway,borderRadius,padding,+ frame,webcam,zoomRegions,trimRegions,@@ -1320,7 +1355,8 @@ export default function VideoEditor() {cloned.audioRegions.map((region) => region.id),);nextAnnotationZIndexRef.current =- cloned.annotationRegions.reduce((max, region) => Math.max(max, region.zIndex), 0) + 1;+ cloned.annotationRegions.reduce((max, region) => Math.max(max, region.zIndex), 0) ++ 1;},[cloneSnapshot],);@@ -1415,8 +1451,8 @@ export default function VideoEditor() {setWebcam(normalizedEditor.webcam);setZoomRegions(normalizedEditor.zoomRegions);setTrimRegions(normalizedEditor.trimRegions);- setClipRegions((normalizedEditor as any).clipRegions ?? []);- clipInitializedRef.current = ((normalizedEditor as any).clipRegions ?? []).length > 0;+ setClipRegions(normalizedEditor.clipRegions);+ clipInitializedRef.current = normalizedEditor.clipRegions.length > 0;setSpeedRegions(normalizedEditor.speedRegions);setAnnotationRegions(normalizedEditor.annotationRegions);setAudioRegions(normalizedEditor.audioRegions);@@ -1450,7 +1486,7 @@ export default function VideoEditor() {);nextClipIdRef.current = deriveNextId("clip",- ((normalizedEditor as any).clipRegions ?? []).map((region: ClipRegion) => region.id),+ normalizedEditor.clipRegions.map((region) => region.id),);nextSpeedIdRef.current = deriveNextId("speed",@@ -1477,7 +1513,9 @@ export default function VideoEditor() {syncHistoryButtons();setLastSavedSnapshot(- cloneStructured(createProjectData(sourcePath, buildPersistedEditorState(normalizedEditor))),+ cloneStructured(+ createProjectData(sourcePath, buildPersistedEditorState(normalizedEditor)),+ ),);await refreshProjectLibrary();return true;@@ -1638,10 +1676,14 @@ export default function VideoEditor() {setBorderRadius(initialEditorPreferences.borderRadius);setAspectRatio(initialEditorPreferences.aspectRatio);setExportFormat(initialEditorPreferences.exportFormat);- setMp4FrameRate(initialEditorPreferences.mp4FrameRate ?? DEFAULT_MP4_EXPORT_FRAME_RATE);+ setMp4FrameRate(+ initialEditorPreferences.mp4FrameRate ?? DEFAULT_MP4_EXPORT_FRAME_RATE,+ );setExportQuality(initialEditorPreferences.exportQuality);setExportEncodingMode(initialEditorPreferences.exportEncodingMode);- setExportBackendPreference(initialEditorPreferences.exportBackendPreference);+ setExportBackendPreference(+ initialEditorPreferences.exportBackendPreference,+ );setExportPipelineModel(initialEditorPreferences.exportPipelineModel);setGifFrameRate(initialEditorPreferences.gifFrameRate);setGifLoop(initialEditorPreferences.gifLoop);@@ -1692,8 +1734,7 @@ export default function VideoEditor() {}loadInitialData();-- }, [applyLoadedProject, smokeExportConfig.enabled, smokeExportConfig.inputPath]);+ }, [applyLoadedProject, initialEditorPreferences, smokeExportConfig]);useEffect(() => {saveEditorPreferences({@@ -1755,8 +1796,6 @@ export default function VideoEditor() {cursorStyle,cursorSize,cursorSmoothing,- zoomSmoothness,- zoomClassicMode,cursorMotionBlur,cursorClickBounce,cursorClickBounceDuration,@@ -1894,7 +1933,9 @@ export default function VideoEditor() {sessionResult?.success && sessionResult.session?.videoPath? sessionResult.session.videoPath: null,- currentVideoPath: currentVideoResult.success ? (currentVideoResult.path ?? null) : null,+ currentVideoPath: currentVideoResult.success+ ? (currentVideoResult.path ?? null)+ : null,});}@@ -1926,7 +1967,9 @@ export default function VideoEditor() {if (!result.success || !result.cues) {toast.error(- result.message || getErrorMessage(result.error) || "Failed to generate captions",+ result.message ||+ getErrorMessage(result.error) ||+ "Failed to generate captions",);return;}@@ -2297,47 +2340,59 @@ export default function VideoEditor() {}}, []);- const handleZoomAdded = useCallback((span: Span) => {- const id = `zoom-${nextZoomIdRef.current++}`;- const newRegion: ZoomRegion = {- id,- startMs: Math.round(span.start),- endMs: Math.round(span.end),- depth: DEFAULT_ZOOM_DEPTH,- focus: { cx: 0.5, cy: 0.5 },- mode: "manual",- };- if (videoPath && pendingFreshRecordingAutoZoomPathRef.current === videoPath) {- autoSuggestedVideoPathRef.current = videoPath;- pendingFreshRecordingAutoZoomPathRef.current = null;- }- setZoomRegions((prev) => [...prev, newRegion]);- setSelectedZoomId(id);- setSelectedTrimId(null);- setSelectedAnnotationId(null);- extensionHost.emitEvent({ type: 'timeline:region-added', data: { id, startMs: newRegion.startMs, endMs: newRegion.endMs } });- }, [videoPath]);+ const handleZoomAdded = useCallback(+ (span: Span) => {+ const id = `zoom-${nextZoomIdRef.current++}`;+ const newRegion: ZoomRegion = {+ id,+ startMs: Math.round(span.start),+ endMs: Math.round(span.end),+ depth: DEFAULT_ZOOM_DEPTH,+ focus: { cx: 0.5, cy: 0.5 },+ mode: "manual",+ };+ if (videoPath && pendingFreshRecordingAutoZoomPathRef.current === videoPath) {+ autoSuggestedVideoPathRef.current = videoPath;+ pendingFreshRecordingAutoZoomPathRef.current = null;+ }+ setZoomRegions((prev) => [...prev, newRegion]);+ setSelectedZoomId(id);+ setSelectedTrimId(null);+ setSelectedAnnotationId(null);+ extensionHost.emitEvent({+ type: "timeline:region-added",+ data: { id, startMs: newRegion.startMs, endMs: newRegion.endMs },+ });+ },+ [videoPath],+ );- const handleZoomSuggested = useCallback((span: Span, focus: ZoomFocus) => {- const id = `zoom-${nextZoomIdRef.current++}`;- const newRegion: ZoomRegion = {- id,- startMs: Math.round(span.start),- endMs: Math.round(span.end),- depth: DEFAULT_AUTO_ZOOM_DEPTH,- focus: clampFocusToDepth(focus, DEFAULT_AUTO_ZOOM_DEPTH),- mode: "auto",- };- if (videoPath && pendingFreshRecordingAutoZoomPathRef.current === videoPath) {- autoSuggestedVideoPathRef.current = videoPath;- pendingFreshRecordingAutoZoomPathRef.current = null;- }- setZoomRegions((prev) => [...prev, newRegion]);- setSelectedZoomId(id);- setSelectedTrimId(null);- setSelectedAnnotationId(null);- extensionHost.emitEvent({ type: 'timeline:region-added', data: { id, startMs: newRegion.startMs, endMs: newRegion.endMs } });- }, [videoPath]);+ const handleZoomSuggested = useCallback(+ (span: Span, focus: ZoomFocus) => {+ const id = `zoom-${nextZoomIdRef.current++}`;+ const newRegion: ZoomRegion = {+ id,+ startMs: Math.round(span.start),+ endMs: Math.round(span.end),+ depth: DEFAULT_AUTO_ZOOM_DEPTH,+ focus: clampFocusToDepth(focus, DEFAULT_AUTO_ZOOM_DEPTH),+ mode: "auto",+ };+ if (videoPath && pendingFreshRecordingAutoZoomPathRef.current === videoPath) {+ autoSuggestedVideoPathRef.current = videoPath;+ pendingFreshRecordingAutoZoomPathRef.current = null;+ }+ setZoomRegions((prev) => [...prev, newRegion]);+ setSelectedZoomId(id);+ setSelectedTrimId(null);+ setSelectedAnnotationId(null);+ extensionHost.emitEvent({+ type: "timeline:region-added",+ data: { id, startMs: newRegion.startMs, endMs: newRegion.endMs },+ });+ },+ [videoPath],+ );useEffect(() => {if (@@ -2474,11 +2529,7 @@ export default function VideoEditor() {(mode: ZoomMode) => {if (!selectedZoomId) return;setZoomRegions((prev) =>- prev.map((region) =>- region.id === selectedZoomId- ? { ...region, mode }- : region,- ),+ prev.map((region) => (region.id === selectedZoomId ? { ...region, mode } : region)),);},[selectedZoomId],@@ -2490,7 +2541,7 @@ export default function VideoEditor() {if (selectedZoomId === id) {setSelectedZoomId(null);}- extensionHost.emitEvent({ type: 'timeline:region-removed', data: { id } });+ extensionHost.emitEvent({ type: "timeline:region-removed", data: { id } });},[selectedZoomId],);@@ -2514,67 +2565,72 @@ export default function VideoEditor() {}}, []);- const handleClipSplit = useCallback(- (splitMs: number) => {- setClipRegions((prev) => {- const target = prev.find((c) => splitMs > c.startMs && splitMs < c.endMs);- if (!target) return prev;- const leftId = `clip-${nextClipIdRef.current++}`;- const rightId = `clip-${nextClipIdRef.current++}`;- const left: ClipRegion = { id: leftId, startMs: target.startMs, endMs: Math.round(splitMs), speed: target.speed };- const right: ClipRegion = { id: rightId, startMs: Math.round(splitMs), endMs: target.endMs, speed: target.speed };- return prev.flatMap((c) => (c.id === target.id ? [left, right] : [c]));- });- },- [],- );+ const handleClipSplit = useCallback((splitMs: number) => {+ setClipRegions((prev) => {+ const target = prev.find((c) => splitMs > c.startMs && splitMs < c.endMs);+ if (!target) return prev;+ const leftId = `clip-${nextClipIdRef.current++}`;+ const rightId = `clip-${nextClipIdRef.current++}`;+ const left: ClipRegion = {+ id: leftId,+ startMs: target.startMs,+ endMs: Math.round(splitMs),+ speed: target.speed,+ };+ const right: ClipRegion = {+ id: rightId,+ startMs: Math.round(splitMs),+ endMs: target.endMs,+ speed: target.speed,+ };+ return prev.flatMap((c) => (c.id === target.id ? [left, right] : [c]));+ });+ }, []);- const handleClipSpanChange = useCallback((id: string, span: Span) => {- const oldClip = clipRegions.find((c) => c.id === id);- const newStart = Math.round(span.start);- const newEnd = Math.round(span.end);-- if (oldClip) {- const startDelta = newStart - oldClip.startMs;- const endDelta = newEnd - oldClip.endMs;- const isMove = Math.abs(startDelta - endDelta) < 1 && Math.abs(startDelta) > 0;-- if (isMove) {- const delta = startDelta;- setZoomRegions((prev) =>- prev.map((zoom) => {- const overlaps = zoom.startMs < oldClip.endMs && zoom.endMs > oldClip.startMs;- if (overlaps) {- return {- ...zoom,- startMs: zoom.startMs + delta,- endMs: zoom.endMs + delta,- };- }- return zoom;- }),- );+ const handleClipSpanChange = useCallback(+ (id: string, span: Span) => {+ const oldClip = clipRegions.find((c) => c.id === id);+ const newStart = Math.round(span.start);+ const newEnd = Math.round(span.end);++ if (oldClip) {+ const startDelta = newStart - oldClip.startMs;+ const endDelta = newEnd - oldClip.endMs;+ const isMove = Math.abs(startDelta - endDelta) < 1 && Math.abs(startDelta) > 0;++ if (isMove) {+ const delta = startDelta;+ setZoomRegions((prev) =>+ prev.map((zoom) => {+ const overlaps =+ zoom.startMs < oldClip.endMs && zoom.endMs > oldClip.startMs;+ if (overlaps) {+ return {+ ...zoom,+ startMs: zoom.startMs + delta,+ endMs: zoom.endMs + delta,+ };+ }+ return zoom;+ }),+ );+ }}- }- setClipRegions((prev) =>- prev.map((clip) =>- clip.id === id- ? { ...clip, startMs: newStart, endMs: newEnd }- : clip,- ),- );- }, [clipRegions]);+ setClipRegions((prev) =>+ prev.map((clip) =>+ clip.id === id ? { ...clip, startMs: newStart, endMs: newEnd } : clip,+ ),+ );+ },+ [clipRegions],+ );const handleClipSpeedChange = useCallback((speed: number) => {if (!selectedClipId) return;setClipRegions((prev) =>- prev.map((clip) =>- clip.id === selectedClipId- ? { ...clip, speed }- : clip,- ),+ prev.map((clip) => (clip.id === selectedClipId ? { ...clip, speed } : clip)),);},[selectedClipId],@@ -2694,7 +2750,9 @@ export default function VideoEditor() {(speed: PlaybackSpeed) => {if (!selectedSpeedId) return;setSpeedRegions((prev) =>- prev.map((region) => (region.id === selectedSpeedId ? { ...region, speed } : region)),+ prev.map((region) =>+ region.id === selectedSpeedId ? { ...region, speed } : region,+ ),);},[selectedSpeedId],@@ -3192,7 +3250,9 @@ export default function VideoEditor() {const result = await window.electronAPI.revealInFolder(filePath);if (!result.success) {const errorMessage =- result.error || result.message || "Failed to reveal item in folder.";+ result.error ||+ result.message ||+ "Failed to reveal item in folder.";toast.error(errorMessage);}} catch (err) {@@ -3220,7 +3280,7 @@ export default function VideoEditor() {setExportProgress(null);setExportError(null);clearPendingExportSave();- extensionHost.emitEvent({ type: 'export:start' });+ extensionHost.emitEvent({ type: "export:start" });const smokeExportStartedAt = smokeExportConfig.enabled ? performance.now() : null;let keepExportDialogOpen = false;@@ -3348,7 +3408,7 @@ export default function VideoEditor() {? await window.electronAPI.writeExportedVideoToPath(arrayBuffer,smokeExportConfig.outputPath,- )+ ): await window.electronAPI.saveExportedVideo(arrayBuffer, fileName);if (saveResult.canceled) {@@ -3391,28 +3451,30 @@ export default function VideoEditor() {// MP4 Exportconst quality = settings.quality ?? exportQuality;const encodingMode = smokeExportConfig.enabled- ? smokeExportConfig.encodingMode ?? settings.encodingMode ?? exportEncodingMode- : settings.encodingMode ?? exportEncodingMode;+ ? (smokeExportConfig.encodingMode ??+ settings.encodingMode ??+ exportEncodingMode)+ : (settings.encodingMode ?? exportEncodingMode);const selectedMp4FrameRate = settings.mp4FrameRate ?? mp4FrameRate;const pipelineModel = smokeExportConfig.enabled- ? smokeExportConfig.pipelineModel ??- (smokeExportConfig.useNativeExport ? "modern" : "legacy")- : settings.pipelineModel ?? exportPipelineModel;+ ? (smokeExportConfig.pipelineModel ??+ (smokeExportConfig.useNativeExport ? "modern" : "legacy"))+ : (settings.pipelineModel ?? exportPipelineModel);const backendPreference =pipelineModel === "legacy"? "webcodecs": smokeExportConfig.enabled- ? smokeExportConfig.backendPreference ??- (smokeExportConfig.useNativeExport ? "breeze" : "webcodecs")+ ? (smokeExportConfig.backendPreference ??+ (smokeExportConfig.useNativeExport ? "breeze" : "webcodecs")): "auto";- const supportedSourceDimensions = await ensureSupportedMp4SourceDimensions(- selectedMp4FrameRate,- );- const { width: exportWidth, height: exportHeight } = calculateMp4ExportDimensions(- supportedSourceDimensions.width,- supportedSourceDimensions.height,- quality,- );+ const supportedSourceDimensions =+ await ensureSupportedMp4SourceDimensions(selectedMp4FrameRate);+ const { width: exportWidth, height: exportHeight } =+ calculateMp4ExportDimensions(+ supportedSourceDimensions.width,+ supportedSourceDimensions.height,+ quality,+ );let bitrate: number;if (quality === "source") {@@ -3504,9 +3566,9 @@ export default function VideoEditor() {const exporter =pipelineModel === "modern"? new ModernVideoExporter({- ...exporterConfig,- backendPreference,- })+ ...exporterConfig,+ backendPreference,+ }): new VideoExporter(exporterConfig);exporterRef.current = exporter;@@ -3527,7 +3589,7 @@ export default function VideoEditor() {? await window.electronAPI.writeExportedVideoToPath(arrayBuffer,smokeExportConfig.outputPath,- )+ ): await window.electronAPI.saveExportedVideo(arrayBuffer, fileName);if (saveResult.canceled) {@@ -3654,7 +3716,7 @@ export default function VideoEditor() {window.close();}} finally {- extensionHost.emitEvent({ type: 'export:complete' });+ extensionHost.emitEvent({ type: "export:complete" });setIsExporting(false);exporterRef.current = null;setShowExportDropdown(keepExportDialogOpen);@@ -3666,8 +3728,7 @@ export default function VideoEditor() {videoPath,wallpaper,trimRegions,- speedRegions,- clipRegions,+ effectiveSpeedRegions,shadowIntensity,backgroundBlur,zoomMotionBlur,@@ -3694,8 +3755,8 @@ export default function VideoEditor() {audioRegions,sourceAudioFallbackPaths,exportEncodingMode,- exportBackendPreference,exportPipelineModel,+ mp4FrameRate,borderRadius,padding,cropRegion,@@ -3703,6 +3764,7 @@ export default function VideoEditor() {annotationRegions,autoCaptions,autoCaptionSettings,+ frame,isPlaying,exportQuality,effectiveZoomRegions,@@ -3710,12 +3772,7 @@ export default function VideoEditor() {markExportAsSaving,remountPreview,showExportSuccessToast,- smokeExportConfig.enabled,- smokeExportConfig.useNativeExport,- smokeExportConfig.maxDecodeQueue,- smokeExportConfig.maxEncodeQueue,- smokeExportConfig.maxPendingFrames,- smokeExportConfig.outputPath,+ smokeExportConfig,],);@@ -3932,19 +3989,24 @@ export default function VideoEditor() {const isExportSaving = exportProgress?.phase === "saving";const isExportFinalizing = exportProgress?.phase === "finalizing";- const isRenderingAudio = isExportFinalizing && typeof exportProgress?.audioProgress === "number";+ const isRenderingAudio =+ isExportFinalizing && typeof exportProgress?.audioProgress === "number";const exportFinalizingProgress = isExportFinalizing? Math.min(typeof exportProgress?.renderProgress === "number"? exportProgress.renderProgress: (exportProgress?.percentage ?? 99),99,- )+ ): null;const isLightningExportInProgress =- exportFormat === "mp4" && exportPipelineModel === "modern" && (isExporting || exportProgress !== null);+ exportFormat === "mp4" &&+ exportPipelineModel === "modern" &&+ (isExporting || exportProgress !== null);const isLegacyExportInProgress =- exportFormat === "mp4" && exportPipelineModel === "legacy" && (isExporting || exportProgress !== null);+ exportFormat === "mp4" &&+ exportPipelineModel === "legacy" &&+ (isExporting || exportProgress !== null);const exportRenderSpeedLabel =typeof exportProgress?.renderFps === "number" &&Number.isFinite(exportProgress.renderFps) &&@@ -3963,11 +4025,7 @@ export default function VideoEditor() {}const rendererLabel =- renderBackend === "webgpu"- ? "WebGPU"- : renderBackend === "webgl"- ? "WebGL"- : null;+ renderBackend === "webgpu" ? "WebGPU" : renderBackend === "webgl" ? "WebGL" : null;const encoderLabel =encodeBackend === "ffmpeg"? "Breeze"@@ -3977,7 +4035,7 @@ export default function VideoEditor() {const pathLabel =rendererLabel && encoderLabel? `${rendererLabel} + ${encoderLabel}`- : rendererLabel ?? encoderLabel;+ : (rendererLabel ?? encoderLabel);if (!pathLabel) {return encoderName ?? null;@@ -4098,7 +4156,9 @@ export default function VideoEditor() {<span className="text-sm font-semibold tracking-tight text-white/90">{projectDisplayName}</span>- <span className="text-xs font-medium tracking-tight text-slate-500">.recordly</span>+ <span className="text-xs font-medium tracking-tight text-slate-500">+ .recordly+ </span></div><divclassName="flex items-center gap-2 justify-self-end pr-3"@@ -4120,12 +4180,16 @@ export default function VideoEditor() {onClick={handleSaveProject}className="inline-flex h-8 min-w-[96px] items-center justify-center gap-1.5 rounded-[5px] bg-white px-4 text-black transition-colors hover:bg-white/92">- <span className={`${hasUnsavedChanges ? "flex" : "hidden"} size-2 relative`}>+ <span+ className={`${hasUnsavedChanges ? "flex" : "hidden"} size-2 relative`}+ ><span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-[#2563EB] opacity-75"></span><span className="relative inline-flex size-2 rounded-full bg-[#2563EB]"></span></span><Save className="h-4 w-4" />- <span className="text-sm font-semibold tracking-tight">{t("common.actions.save")}</span>+ <span className="text-sm font-semibold tracking-tight">+ {t("common.actions.save")}+ </span></Button><div className="mx-1 h-5 w-px bg-white/10" /><DropdownMenu@@ -4158,7 +4222,10 @@ export default function VideoEditor() {{t("editor.exportStatus.exporting", "Exporting")}</p><p className="text-xs text-slate-400">- {t("editor.exportStatus.renderingFile", "Rendering your file.")}+ {t(+ "editor.exportStatus.renderingFile",+ "Rendering your file.",+ )}</p>{isLightningExportInProgress ? (<p className="mt-1 flex items-center gap-1 text-[11px] text-slate-500">@@ -4176,7 +4243,8 @@ export default function VideoEditor() {) : null}{isLegacyExportInProgress ? (<p className="mt-1 text-[11px] text-slate-500">- Export too slow? Cancel and try Lightning export!+ Export too slow? Cancel and try Lightning+ export!</p>) : null}</div>@@ -4196,19 +4264,28 @@ export default function VideoEditor() {<divclassName="h-full bg-[#2563EB] transition-all duration-300 ease-out"style={{- width: `${Math.min(isRenderingAudio ? (exportProgress.audioProgress ?? 0) * 100 : (exportFinalizingProgress ?? (exportProgress?.percentage ?? 8)), 100)}%`,+ width: `${Math.min(isRenderingAudio ? (exportProgress.audioProgress ?? 0) * 100 : (exportFinalizingProgress ?? exportProgress?.percentage ?? 8), 100)}%`,}}/>)}</div>- <p className="mt-2 text-xs text-slate-400">{exportPercentLabel}</p>+ <p className="mt-2 text-xs text-slate-400">+ {exportPercentLabel}+ </p>{isRenderingAudio ? (- <p className="mt-1 text-[11px] text-slate-500">Audio requires real-time playback for speed/overlay edits</p>+ <p className="mt-1 text-[11px] text-slate-500">+ Audio requires real-time playback for speed/overlay+ edits+ </p>) : exportRenderSpeedLabel ? (- <p className="mt-1 text-[11px] text-slate-500">{exportRenderSpeedLabel}</p>+ <p className="mt-1 text-[11px] text-slate-500">+ {exportRenderSpeedLabel}+ </p>) : null}{exportRuntimeLabel ? (- <p className="mt-1 text-[11px] text-slate-500">Path: {exportRuntimeLabel}</p>+ <p className="mt-1 text-[11px] text-slate-500">+ Path: {exportRuntimeLabel}+ </p>) : null}</div>) : exportError ? (@@ -4217,9 +4294,13 @@ export default function VideoEditor() {{t("editor.exportStatus.issue", "Export issue")}</p>{exportRuntimeLabel ? (- <p className="mt-1 text-[11px] text-slate-500">Path: {exportRuntimeLabel}</p>+ <p className="mt-1 text-[11px] text-slate-500">+ Path: {exportRuntimeLabel}+ </p>) : null}- <p className="mt-1 whitespace-pre-line text-xs leading-relaxed text-slate-400">{exportError}</p>+ <p className="mt-1 whitespace-pre-line text-xs leading-relaxed text-slate-400">+ {exportError}+ </p><div className="mt-4 flex gap-2">{hasPendingExportSave ? (<Button@@ -4252,7 +4333,9 @@ export default function VideoEditor() {)}</p>{exportRuntimeLabel ? (- <p className="mt-1 text-[11px] text-slate-500">Path: {exportRuntimeLabel}</p>+ <p className="mt-1 text-[11px] text-slate-500">+ Path: {exportRuntimeLabel}+ </p>) : null}<p className="mt-3 truncate text-xs text-slate-500">{exportedFilePath.split("/").pop()}@@ -4307,290 +4390,352 @@ export default function VideoEditor() {<div className="relative flex min-h-0 flex-1 flex-col gap-3 p-4">{/* Top section: Video Preview + Settings */}<div className="flex min-h-0 flex-1 gap-3">- {/* Left Column - Video Preview */}- <div className="order-2 flex h-full min-w-0 flex-[7] flex-col">- <div className="relative flex h-full flex-col overflow-hidden">- {/* Video preview */}- <div- className="flex w-full min-h-0 flex-1 items-stretch"- style={{ flex: "1 1 auto", margin: "6px 0 0" }}- >- <div className="flex w-11 flex-shrink-0 items-center justify-center pl-1">- <LayoutGroup id="preview-icon-rail">- <div className="flex flex-col items-center gap-3">- {editorSectionButtons.map((section) => {- const isActive = activeEffectSection === section.id;- return (- <motion.button- key={section.id}- type="button"- onClick={() => setActiveEffectSection(section.id)}- title={section.label}- className="group relative flex h-8 w-8 items-center justify-center text-white/75 outline-none transition-colors hover:text-white focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0"- animate={{ scale: isActive ? 1.06 : 1, opacity: isActive ? 1 : 0.82 }}- transition={{ type: "spring", stiffness: 420, damping: 28 }}- >- <motion.span- animate={{ color: isActive ? "#2563EB" : "rgba(255,255,255,0.75)" }}- transition={{ duration: 0.16 }}- >- {typeof section.icon === "string" ? (- <ExtensionIcon icon={section.icon} className="h-4 w-4" />- ) : (- <section.icon className="h-4 w-4" />- )}- </motion.span>- <AnimatePresence initial={false}>- {isActive ? (- <motion.span- layoutId="preview-active-dot"- className="absolute -left-1 h-1.5 w-1.5 rounded-full bg-[#2563EB]"- initial={{ opacity: 0, scale: 0.6 }}- animate={{ opacity: 1, scale: 1 }}- exit={{ opacity: 0, scale: 0.6 }}- transition={{ type: "spring", stiffness: 500, damping: 32 }}- />- ) : null}- </AnimatePresence>- </motion.button>- );- })}- </div>- </LayoutGroup>- </div>- <div className="flex min-w-0 flex-1 items-center justify-center pl-2 pr-1">- <div- className="relative overflow-hidden rounded-[30px]"- style={{- width: "auto",- height: "100%",- aspectRatio: getAspectRatioValue(- aspectRatio,- (() => {- const previewVideo = videoPlaybackRef.current?.video;- if (previewVideo && previewVideo.videoHeight > 0) {- return previewVideo.videoWidth / previewVideo.videoHeight;+ {/* Left Column - Video Preview */}+ <div className="order-2 flex h-full min-w-0 flex-[7] flex-col">+ <div className="relative flex h-full flex-col overflow-hidden">+ {/* Video preview */}+ <div+ className="flex w-full min-h-0 flex-1 items-stretch"+ style={{ flex: "1 1 auto", margin: "6px 0 0" }}+ >+ <div className="flex w-11 flex-shrink-0 items-center justify-center pl-1">+ <LayoutGroup id="preview-icon-rail">+ <div className="flex flex-col items-center gap-3">+ {editorSectionButtons.map((section) => {+ const isActive = activeEffectSection === section.id;+ return (+ <motion.button+ key={section.id}+ type="button"+ onClick={() =>+ setActiveEffectSection(section.id)}- return 16 / 9;- })(),- ),- maxWidth: "100%",- margin: "0 auto",- boxSizing: "border-box",- }}- >- <VideoPlayback- key={`${videoPath || "no-video"}:${previewVersion}`}- aspectRatio={aspectRatio}- ref={videoPlaybackRef}- videoPath={videoPath || ""}- onDurationChange={setDuration}- onPreviewReadyChange={setIsPreviewReady}- onTimeUpdate={setCurrentTime}- currentTime={currentTime}- onPlayStateChange={setIsPlaying}- onError={setError}- wallpaper={wallpaper}- zoomRegions={effectiveZoomRegions}- selectedZoomId={selectedZoomId}- onSelectZoom={handleSelectZoom}- onZoomFocusChange={handleZoomFocusChange}- isPlaying={isPlaying}- showShadow={shadowIntensity > 0}- shadowIntensity={shadowIntensity}- backgroundBlur={backgroundBlur}- zoomMotionBlur={zoomMotionBlur}- connectZooms={connectZooms}- zoomInDurationMs={zoomInDurationMs}- zoomInOverlapMs={zoomInOverlapMs}- zoomOutDurationMs={zoomOutDurationMs}- connectedZoomGapMs={connectedZoomGapMs}- connectedZoomDurationMs={connectedZoomDurationMs}- zoomInEasing={zoomInEasing}- zoomOutEasing={zoomOutEasing}- connectedZoomEasing={connectedZoomEasing}- borderRadius={borderRadius}- padding={padding}- frame={frame}- cropRegion={cropRegion}- webcam={webcam}- webcamVideoPath={webcam.sourcePath ? toFileUrl(webcam.sourcePath) : null}- trimRegions={trimRegions}- speedRegions={effectiveSpeedRegions}- annotationRegions={annotationRegions}- autoCaptions={autoCaptions}- autoCaptionSettings={autoCaptionSettings}- selectedAnnotationId={selectedAnnotationId}- onSelectAnnotation={handleSelectAnnotation}- onAnnotationPositionChange={handleAnnotationPositionChange}- onAnnotationSizeChange={handleAnnotationSizeChange}- cursorTelemetry={effectiveCursorTelemetry}- showCursor={showCursor}- cursorStyle={cursorStyle}- cursorSize={cursorSize}- cursorSmoothing={cursorSmoothing}- zoomSmoothness={zoomSmoothness}- zoomClassicMode={zoomClassicMode}- cursorMotionBlur={cursorMotionBlur}- cursorClickBounce={cursorClickBounce}- cursorClickBounceDuration={cursorClickBounceDuration}- cursorSway={cursorSway}- volume={hasSourceAudioFallback ? 0 : previewVolume}- />+ title={section.label}+ className="group relative flex h-8 w-8 items-center justify-center text-white/75 outline-none transition-colors hover:text-white focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0"+ animate={{+ scale: isActive ? 1.06 : 1,+ opacity: isActive ? 1 : 0.82,+ }}+ transition={{+ type: "spring",+ stiffness: 420,+ damping: 28,+ }}+ >+ <motion.span+ animate={{+ color: isActive+ ? "#2563EB"+ : "rgba(255,255,255,0.75)",+ }}+ transition={{ duration: 0.16 }}+ >+ {typeof section.icon === "string" ? (+ <ExtensionIcon+ icon={section.icon}+ className="h-4 w-4"+ />+ ) : (+ <section.icon className="h-4 w-4" />+ )}+ </motion.span>+ <AnimatePresence initial={false}>+ {isActive ? (+ <motion.span+ layoutId="preview-active-dot"+ className="absolute -left-1 h-1.5 w-1.5 rounded-full bg-[#2563EB]"+ initial={{+ opacity: 0,+ scale: 0.6,+ }}+ animate={{+ opacity: 1,+ scale: 1,+ }}+ exit={{+ opacity: 0,+ scale: 0.6,+ }}+ transition={{+ type: "spring",+ stiffness: 500,+ damping: 32,+ }}+ />+ ) : null}+ </AnimatePresence>+ </motion.button>+ );+ })}</div>- </div>+ </LayoutGroup></div>- {/* Playback controls */}- <div- className="w-full flex justify-center items-center"- style={{- height: "48px",- flexShrink: 0,- padding: "6px 12px",- margin: "6px 0 6px 0",- }}- >- <div style={{ width: "100%", maxWidth: "700px" }}>- <PlaybackControls- isPlaying={isPlaying}+ <div className="flex min-w-0 flex-1 items-center justify-center pl-2 pr-1">+ <div+ className="relative overflow-hidden rounded-[30px]"+ style={{+ width: "auto",+ height: "100%",+ aspectRatio: getAspectRatioValue(+ aspectRatio,+ (() => {+ const previewVideo =+ videoPlaybackRef.current?.video;+ if (+ previewVideo &&+ previewVideo.videoHeight > 0+ ) {+ return (+ previewVideo.videoWidth /+ previewVideo.videoHeight+ );+ }+ return 16 / 9;+ })(),+ ),+ maxWidth: "100%",+ margin: "0 auto",+ boxSizing: "border-box",+ }}+ >+ <VideoPlayback+ key={`${videoPath || "no-video"}:${previewVersion}`}+ aspectRatio={aspectRatio}+ ref={videoPlaybackRef}+ videoPath={videoPath || ""}+ onDurationChange={setDuration}+ onPreviewReadyChange={setIsPreviewReady}+ onTimeUpdate={setCurrentTime}currentTime={currentTime}- duration={duration}- onTogglePlayPause={togglePlayPause}- onSeek={handleSeek}- volume={previewVolume}- onVolumeChange={setPreviewVolume}+ onPlayStateChange={setIsPlaying}+ onError={setError}+ wallpaper={wallpaper}+ zoomRegions={effectiveZoomRegions}+ selectedZoomId={selectedZoomId}+ onSelectZoom={handleSelectZoom}+ onZoomFocusChange={handleZoomFocusChange}+ isPlaying={isPlaying}+ showShadow={shadowIntensity > 0}+ shadowIntensity={shadowIntensity}+ backgroundBlur={backgroundBlur}+ zoomMotionBlur={zoomMotionBlur}+ connectZooms={connectZooms}+ zoomInDurationMs={zoomInDurationMs}+ zoomInOverlapMs={zoomInOverlapMs}+ zoomOutDurationMs={zoomOutDurationMs}+ connectedZoomGapMs={connectedZoomGapMs}+ connectedZoomDurationMs={connectedZoomDurationMs}+ zoomInEasing={zoomInEasing}+ zoomOutEasing={zoomOutEasing}+ connectedZoomEasing={connectedZoomEasing}+ borderRadius={borderRadius}+ padding={padding}+ frame={frame}+ cropRegion={cropRegion}+ webcam={webcam}+ webcamVideoPath={+ webcam.sourcePath+ ? toFileUrl(webcam.sourcePath)+ : null+ }+ trimRegions={trimRegions}+ speedRegions={effectiveSpeedRegions}+ annotationRegions={annotationRegions}+ autoCaptions={autoCaptions}+ autoCaptionSettings={autoCaptionSettings}+ selectedAnnotationId={selectedAnnotationId}+ onSelectAnnotation={handleSelectAnnotation}+ onAnnotationPositionChange={+ handleAnnotationPositionChange+ }+ onAnnotationSizeChange={handleAnnotationSizeChange}+ cursorTelemetry={effectiveCursorTelemetry}+ showCursor={showCursor}+ cursorStyle={cursorStyle}+ cursorSize={cursorSize}+ cursorSmoothing={cursorSmoothing}+ zoomSmoothness={zoomSmoothness}+ zoomClassicMode={zoomClassicMode}+ cursorMotionBlur={cursorMotionBlur}+ cursorClickBounce={cursorClickBounce}+ cursorClickBounceDuration={cursorClickBounceDuration}+ cursorSway={cursorSway}+ volume={hasSourceAudioFallback ? 0 : previewVolume}/></div></div></div>- </div>+ {/* Playback controls */}+ <div+ className="w-full flex justify-center items-center"+ style={{+ height: "48px",+ flexShrink: 0,+ padding: "6px 12px",+ margin: "6px 0 6px 0",+ }}+ >+ <div style={{ width: "100%", maxWidth: "700px" }}>+ <PlaybackControls+ isPlaying={isPlaying}+ currentTime={currentTime}+ duration={duration}+ onTogglePlayPause={togglePlayPause}+ onSeek={handleSeek}+ volume={previewVolume}+ onVolumeChange={setPreviewVolume}+ />+ </div>+ </div>+ </div>+ </div>- {/* Left section: settings panel */}- <div className="order-1 flex">- {activeEffectSection === "extensions" ? (- <ExtensionManager />- ) : (- <SettingsPanel- panelMode="editor"- activeEffectSection={activeEffectSection}- selected={wallpaper}- onWallpaperChange={setWallpaper}- selectedZoomDepth={- selectedZoomId ? zoomRegions.find((z) => z.id === selectedZoomId)?.depth : null- }- onZoomDepthChange={(depth) => selectedZoomId && handleZoomDepthChange(depth)}- selectedZoomId={selectedZoomId}- selectedZoomMode={- selectedZoomId ? (zoomRegions.find((z) => z.id === selectedZoomId)?.mode ?? 'auto') : null- }- onZoomModeChange={(mode) => selectedZoomId && handleZoomModeChange(mode)}- onZoomDelete={handleZoomDelete}- selectedTrimId={selectedTrimId}- onTrimDelete={handleTrimDelete}- selectedClipId={selectedClipId}- selectedClipSpeed={- selectedClipId ? (clipRegions.find((c) => c.id === selectedClipId)?.speed ?? 1) : null- }- onClipSpeedChange={(speed) => selectedClipId && handleClipSpeedChange(speed)}- onClipDelete={handleClipDelete}- shadowIntensity={shadowIntensity}- onShadowChange={setShadowIntensity}- backgroundBlur={backgroundBlur}- onBackgroundBlurChange={setBackgroundBlur}- zoomMotionBlur={zoomMotionBlur}- onZoomMotionBlurChange={setZoomMotionBlur}- connectZooms={connectZooms}- onConnectZoomsChange={setConnectZooms}- zoomInDurationMs={zoomInDurationMs}- onZoomInDurationMsChange={setZoomInDurationMs}- zoomInOverlapMs={zoomInOverlapMs}- onZoomInOverlapMsChange={setZoomInOverlapMs}- zoomOutDurationMs={zoomOutDurationMs}- onZoomOutDurationMsChange={setZoomOutDurationMs}- connectedZoomGapMs={connectedZoomGapMs}- onConnectedZoomGapMsChange={setConnectedZoomGapMs}- connectedZoomDurationMs={connectedZoomDurationMs}- onConnectedZoomDurationMsChange={setConnectedZoomDurationMs}- zoomInEasing={zoomInEasing}- onZoomInEasingChange={setZoomInEasing}- zoomOutEasing={zoomOutEasing}- onZoomOutEasingChange={setZoomOutEasing}- connectedZoomEasing={connectedZoomEasing}- onConnectedZoomEasingChange={setConnectedZoomEasing}- showCursor={showCursor}- onShowCursorChange={setShowCursor}- loopCursor={loopCursor}- onLoopCursorChange={setLoopCursor}- cursorStyle={cursorStyle}- onCursorStyleChange={setCursorStyle}- cursorSize={cursorSize}- onCursorSizeChange={setCursorSize}- cursorSmoothing={cursorSmoothing}- onCursorSmoothingChange={setCursorSmoothing}- zoomSmoothness={zoomSmoothness}- onZoomSmoothnessChange={setZoomSmoothness}- zoomClassicMode={zoomClassicMode}- onZoomClassicModeChange={setZoomClassicMode}- cursorMotionBlur={cursorMotionBlur}- onCursorMotionBlurChange={setCursorMotionBlur}- cursorClickBounce={cursorClickBounce}- onCursorClickBounceChange={setCursorClickBounce}- cursorClickBounceDuration={cursorClickBounceDuration}- onCursorClickBounceDurationChange={setCursorClickBounceDuration}- cursorSway={cursorSway}- onCursorSwayChange={setCursorSway}- borderRadius={borderRadius}- onBorderRadiusChange={setBorderRadius}- webcam={webcam}- onWebcamChange={setWebcam}- onUploadWebcam={handleUploadWebcam}- onClearWebcam={handleClearWebcam}- padding={padding}- onPaddingChange={setPadding}- frame={frame}- onFrameChange={setFrame}- cropRegion={cropRegion}- onCropChange={setCropRegion}- aspectRatio={aspectRatio}- onAspectRatioChange={setAspectRatio}- selectedAnnotationId={selectedAnnotationId}- annotationRegions={annotationRegions}- autoCaptions={autoCaptions}- autoCaptionSettings={autoCaptionSettings}- whisperExecutablePath={whisperExecutablePath}- whisperModelPath={whisperModelPath}- whisperModelDownloadStatus={whisperModelDownloadStatus}- whisperModelDownloadProgress={whisperModelDownloadProgress}- isGeneratingCaptions={isGeneratingCaptions}- onAutoCaptionSettingsChange={setAutoCaptionSettings}- onPickWhisperExecutable={handlePickWhisperExecutable}- onPickWhisperModel={handlePickWhisperModel}- onGenerateAutoCaptions={handleGenerateAutoCaptions}- onClearAutoCaptions={handleClearAutoCaptions}- onDownloadWhisperSmallModel={handleDownloadWhisperSmallModel}- onDeleteWhisperSmallModel={handleDeleteWhisperSmallModel}- onAnnotationContentChange={handleAnnotationContentChange}- onAnnotationTypeChange={handleAnnotationTypeChange}- onAnnotationStyleChange={handleAnnotationStyleChange}- onAnnotationFigureDataChange={handleAnnotationFigureDataChange}- onAnnotationBlurIntensityChange={handleAnnotationBlurIntensityChange}- onAnnotationBlurColorChange={handleAnnotationBlurColorChange}- onAnnotationDelete={handleAnnotationDelete}- selectedSpeedId={selectedSpeedId}- selectedSpeedValue={- selectedSpeedId- ? (speedRegions.find((r) => r.id === selectedSpeedId)?.speed ?? null)- : null- }- onSpeedChange={handleSpeedChange}- onSpeedDelete={handleSpeedDelete}- />- )}- </div>+ {/* Left section: settings panel */}+ <div className="order-1 flex">+ {activeEffectSection === "extensions" ? (+ <ExtensionManager />+ ) : (+ <SettingsPanel+ panelMode="editor"+ activeEffectSection={activeEffectSection}+ selected={wallpaper}+ onWallpaperChange={setWallpaper}+ selectedZoomDepth={+ selectedZoomId+ ? zoomRegions.find((z) => z.id === selectedZoomId)?.depth+ : null+ }+ onZoomDepthChange={(depth) =>+ selectedZoomId && handleZoomDepthChange(depth)+ }+ selectedZoomId={selectedZoomId}+ selectedZoomMode={+ selectedZoomId+ ? (zoomRegions.find((z) => z.id === selectedZoomId)?.mode ??+ "auto")+ : null+ }+ onZoomModeChange={(mode) =>+ selectedZoomId && handleZoomModeChange(mode)+ }+ onZoomDelete={handleZoomDelete}+ selectedTrimId={selectedTrimId}+ onTrimDelete={handleTrimDelete}+ selectedClipId={selectedClipId}+ selectedClipSpeed={+ selectedClipId+ ? (clipRegions.find((c) => c.id === selectedClipId)+ ?.speed ?? 1)+ : null+ }+ onClipSpeedChange={(speed) =>+ selectedClipId && handleClipSpeedChange(speed)+ }+ onClipDelete={handleClipDelete}+ shadowIntensity={shadowIntensity}+ onShadowChange={setShadowIntensity}+ backgroundBlur={backgroundBlur}+ onBackgroundBlurChange={setBackgroundBlur}+ zoomMotionBlur={zoomMotionBlur}+ onZoomMotionBlurChange={setZoomMotionBlur}+ connectZooms={connectZooms}+ onConnectZoomsChange={setConnectZooms}+ zoomInDurationMs={zoomInDurationMs}+ onZoomInDurationMsChange={setZoomInDurationMs}+ zoomInOverlapMs={zoomInOverlapMs}+ onZoomInOverlapMsChange={setZoomInOverlapMs}+ zoomOutDurationMs={zoomOutDurationMs}+ onZoomOutDurationMsChange={setZoomOutDurationMs}+ connectedZoomGapMs={connectedZoomGapMs}+ onConnectedZoomGapMsChange={setConnectedZoomGapMs}+ connectedZoomDurationMs={connectedZoomDurationMs}+ onConnectedZoomDurationMsChange={setConnectedZoomDurationMs}+ zoomInEasing={zoomInEasing}+ onZoomInEasingChange={setZoomInEasing}+ zoomOutEasing={zoomOutEasing}+ onZoomOutEasingChange={setZoomOutEasing}+ connectedZoomEasing={connectedZoomEasing}+ onConnectedZoomEasingChange={setConnectedZoomEasing}+ showCursor={showCursor}+ onShowCursorChange={setShowCursor}+ loopCursor={loopCursor}+ onLoopCursorChange={setLoopCursor}+ cursorStyle={cursorStyle}+ onCursorStyleChange={setCursorStyle}+ cursorSize={cursorSize}+ onCursorSizeChange={setCursorSize}+ cursorSmoothing={cursorSmoothing}+ onCursorSmoothingChange={setCursorSmoothing}+ zoomSmoothness={zoomSmoothness}+ onZoomSmoothnessChange={setZoomSmoothness}+ zoomClassicMode={zoomClassicMode}+ onZoomClassicModeChange={setZoomClassicMode}+ cursorMotionBlur={cursorMotionBlur}+ onCursorMotionBlurChange={setCursorMotionBlur}+ cursorClickBounce={cursorClickBounce}+ onCursorClickBounceChange={setCursorClickBounce}+ cursorClickBounceDuration={cursorClickBounceDuration}+ onCursorClickBounceDurationChange={setCursorClickBounceDuration}+ cursorSway={cursorSway}+ onCursorSwayChange={setCursorSway}+ borderRadius={borderRadius}+ onBorderRadiusChange={setBorderRadius}+ webcam={webcam}+ onWebcamChange={setWebcam}+ onUploadWebcam={handleUploadWebcam}+ onClearWebcam={handleClearWebcam}+ padding={padding}+ onPaddingChange={setPadding}+ frame={frame}+ onFrameChange={setFrame}+ cropRegion={cropRegion}+ onCropChange={setCropRegion}+ aspectRatio={aspectRatio}+ onAspectRatioChange={setAspectRatio}+ selectedAnnotationId={selectedAnnotationId}+ annotationRegions={annotationRegions}+ autoCaptions={autoCaptions}+ autoCaptionSettings={autoCaptionSettings}+ whisperExecutablePath={whisperExecutablePath}+ whisperModelPath={whisperModelPath}+ whisperModelDownloadStatus={whisperModelDownloadStatus}+ whisperModelDownloadProgress={whisperModelDownloadProgress}+ isGeneratingCaptions={isGeneratingCaptions}+ onAutoCaptionSettingsChange={setAutoCaptionSettings}+ onPickWhisperExecutable={handlePickWhisperExecutable}+ onPickWhisperModel={handlePickWhisperModel}+ onGenerateAutoCaptions={handleGenerateAutoCaptions}+ onClearAutoCaptions={handleClearAutoCaptions}+ onDownloadWhisperSmallModel={handleDownloadWhisperSmallModel}+ onDeleteWhisperSmallModel={handleDeleteWhisperSmallModel}+ onAnnotationContentChange={handleAnnotationContentChange}+ onAnnotationTypeChange={handleAnnotationTypeChange}+ onAnnotationStyleChange={handleAnnotationStyleChange}+ onAnnotationFigureDataChange={handleAnnotationFigureDataChange}+ onAnnotationBlurIntensityChange={+ handleAnnotationBlurIntensityChange+ }+ onAnnotationBlurColorChange={handleAnnotationBlurColorChange}+ onAnnotationDelete={handleAnnotationDelete}+ selectedSpeedId={selectedSpeedId}+ selectedSpeedValue={+ selectedSpeedId+ ? (speedRegions.find((r) => r.id === selectedSpeedId)+ ?.speed ?? null)+ : null+ }+ onSpeedChange={handleSpeedChange}+ onSpeedDelete={handleSpeedDelete}+ />+ )}+ </div></div>{/* Timeline section - full width */}- <div className="min-h-[200px] flex-shrink-0 bg-[#17171a] rounded-2xl border border-white/10 shadow-lg overflow-auto flex flex-col" style={{ height: "33%" }}>+ <div+ className="min-h-[200px] flex-shrink-0 bg-[#17171a] rounded-2xl border border-white/10 shadow-lg overflow-auto flex flex-col"+ style={{ height: "33%" }}+ ><TimelineEditorvideoDuration={duration}currentTime={currentTime}@@ -4652,8 +4797,12 @@ export default function VideoEditor() {<div className="fixed left-1/2 top-1/2 z-[60] max-h-[90vh] w-[90vw] max-w-5xl -translate-x-1/2 -translate-y-1/2 overflow-auto rounded-2xl border border-white/10 bg-[#09090b] p-8 shadow-2xl animate-in zoom-in-95 duration-200"><div className="mb-6 flex items-center justify-between"><div>- <span className="text-xl font-bold text-slate-200">{t("settings.crop.title")}</span>- <p className="mt-2 text-sm text-slate-400">{t("settings.crop.instruction")}</p>+ <span className="text-xl font-bold text-slate-200">+ {t("settings.crop.title")}+ </span>+ <p className="mt-2 text-sm text-slate-400">+ {t("settings.crop.instruction")}+ </p></div><Buttonvariant="ghost"diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.tsindex 96977a38..75c3a4cd 100644--- a/src/components/video-editor/projectPersistence.ts+++ b/src/components/video-editor/projectPersistence.ts@@ -18,6 +18,7 @@ import {type AutoCaptionSettings,type CaptionCue,type CaptionCueWord,+ type ClipRegion,type CropRegion,type CursorStyle,DEFAULT_ANNOTATION_POSITION,@@ -57,7 +58,6 @@ import {getDefaultCaptionFontFamily,type SpeedRegion,type TrimRegion,- type ClipRegion,type WebcamOverlaySettings,type ZoomRegion,type ZoomTransitionEasing,@@ -304,10 +304,16 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Proconst normalizedZoomRegions: ZoomRegion[] = Array.isArray(editor.zoomRegions)? editor.zoomRegions- .filter((region): region is ZoomRegion => Boolean(region && typeof region.id === "string"))+ .filter((region): region is ZoomRegion =>+ Boolean(region && typeof region.id === "string"),+ ).map((region) => {- const rawStart = isFiniteNumber(region.startMs) ? Math.round(region.startMs) : 0;- const rawEnd = isFiniteNumber(region.endMs) ? Math.round(region.endMs) : rawStart + 1000;+ const rawStart = isFiniteNumber(region.startMs)+ ? Math.round(region.startMs)+ : 0;+ const rawEnd = isFiniteNumber(region.endMs)+ ? Math.round(region.endMs)+ : rawStart + 1000;const startMs = Math.max(0, Math.min(rawStart, rawEnd));const endMs = Math.max(startMs + 1, rawEnd);@@ -315,10 +321,20 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Proid: region.id,startMs,endMs,- depth: [1, 2, 3, 4, 5, 6].includes(region.depth) ? region.depth : DEFAULT_ZOOM_DEPTH,+ depth: [1, 2, 3, 4, 5, 6].includes(region.depth)+ ? region.depth+ : DEFAULT_ZOOM_DEPTH,focus: {- cx: clamp(isFiniteNumber(region.focus?.cx) ? region.focus.cx : 0.5, 0, 1),- cy: clamp(isFiniteNumber(region.focus?.cy) ? region.focus.cy : 0.5, 0, 1),+ cx: clamp(+ isFiniteNumber(region.focus?.cx) ? region.focus.cx : 0.5,+ 0,+ 1,+ ),+ cy: clamp(+ isFiniteNumber(region.focus?.cy) ? region.focus.cy : 0.5,+ 0,+ 1,+ ),},};})@@ -326,10 +342,16 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Proconst normalizedTrimRegions: TrimRegion[] = Array.isArray(editor.trimRegions)? editor.trimRegions- .filter((region): region is TrimRegion => Boolean(region && typeof region.id === "string"))+ .filter((region): region is TrimRegion =>+ Boolean(region && typeof region.id === "string"),+ ).map((region) => {- const rawStart = isFiniteNumber(region.startMs) ? Math.round(region.startMs) : 0;- const rawEnd = isFiniteNumber(region.endMs) ? Math.round(region.endMs) : rawStart + 1000;+ const rawStart = isFiniteNumber(region.startMs)+ ? Math.round(region.startMs)+ : 0;+ const rawEnd = isFiniteNumber(region.endMs)+ ? Math.round(region.endMs)+ : rawStart + 1000;const startMs = Math.max(0, Math.min(rawStart, rawEnd));const endMs = Math.max(startMs + 1, rawEnd);return {@@ -340,29 +362,42 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro}): [];- const normalizedClipRegions: ClipRegion[] = Array.isArray((editor as any).clipRegions)- ? ((editor as any).clipRegions as ClipRegion[])- .filter((region): region is ClipRegion => Boolean(region && typeof region.id === "string"))+ const normalizedClipRegions: ClipRegion[] = Array.isArray(editor.clipRegions)+ ? editor.clipRegions+ .filter((region): region is ClipRegion =>+ Boolean(region && typeof region.id === "string"),+ ).map((region) => {- const rawStart = isFiniteNumber(region.startMs) ? Math.round(region.startMs) : 0;- const rawEnd = isFiniteNumber(region.endMs) ? Math.round(region.endMs) : rawStart + 1000;+ const rawStart = isFiniteNumber(region.startMs)+ ? Math.round(region.startMs)+ : 0;+ const rawEnd = isFiniteNumber(region.endMs)+ ? Math.round(region.endMs)+ : rawStart + 1000;const startMs = Math.max(0, Math.min(rawStart, rawEnd));const endMs = Math.max(startMs + 1, rawEnd);return {id: region.id,startMs,endMs,- speed: isFiniteNumber((region as any).speed) ? (region as any).speed : 1,+ speed: isFiniteNumber(region.speed) ? region.speed : 1,+ muted: Boolean(region.muted),};}): [];const normalizedSpeedRegions: SpeedRegion[] = Array.isArray(editor.speedRegions)? editor.speedRegions- .filter((region): region is SpeedRegion => Boolean(region && typeof region.id === "string"))+ .filter((region): region is SpeedRegion =>+ Boolean(region && typeof region.id === "string"),+ ).map((region) => {- const rawStart = isFiniteNumber(region.startMs) ? Math.round(region.startMs) : 0;- const rawEnd = isFiniteNumber(region.endMs) ? Math.round(region.endMs) : rawStart + 1000;+ const rawStart = isFiniteNumber(region.startMs)+ ? Math.round(region.startMs)+ : 0;+ const rawEnd = isFiniteNumber(region.endMs)+ ? Math.round(region.endMs)+ : rawStart + 1000;const startMs = Math.max(0, Math.min(rawStart, rawEnd));const endMs = Math.max(startMs + 1, rawEnd);@@ -392,8 +427,12 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): ProBoolean(region && typeof region.id === "string"),).map((region, index) => {- const rawStart = isFiniteNumber(region.startMs) ? Math.round(region.startMs) : 0;- const rawEnd = isFiniteNumber(region.endMs) ? Math.round(region.endMs) : rawStart + 1000;+ const rawStart = isFiniteNumber(region.startMs)+ ? Math.round(region.startMs)+ : 0;+ const rawEnd = isFiniteNumber(region.endMs)+ ? Math.round(region.endMs)+ : rawStart + 1000;const startMs = Math.max(0, Math.min(rawStart, rawEnd));const endMs = Math.max(startMs + 1, rawEnd);@@ -401,10 +440,19 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Proid: region.id,startMs,endMs,- type: region.type === "image" || region.type === "figure" || region.type === "blur" ? region.type : "text",+ type:+ region.type === "image" ||+ region.type === "figure" ||+ region.type === "blur"+ ? region.type+ : "text",content: typeof region.content === "string" ? region.content : "",- textContent: typeof region.textContent === "string" ? region.textContent : undefined,- imageContent: typeof region.imageContent === "string" ? region.imageContent : undefined,+ textContent:+ typeof region.textContent === "string" ? region.textContent : undefined,+ imageContent:+ typeof region.imageContent === "string"+ ? region.imageContent+ : undefined,position: {x: clamp(isFiniteNumber(region.position?.x)@@ -439,7 +487,9 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro},style: {...DEFAULT_ANNOTATION_STYLE,- ...(region.style && typeof region.style === "object" ? region.style : {}),+ ...(region.style && typeof region.style === "object"+ ? region.style+ : {}),},zIndex: isFiniteNumber(region.zIndex) ? region.zIndex : index + 1,figureData: region.figureData@@ -448,10 +498,14 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro...region.figureData,}: undefined,- blurIntensity: isFiniteNumber(region.blurIntensity)- ? clamp(region.blurIntensity, 1, 100)+ blurIntensity: isFiniteNumber(region.blurIntensity)+ ? clamp(region.blurIntensity, 1, 100): 20,- blurColor: typeof region.blurColor === "string" ? region.blurColor : undefined,+ blurColor:+ typeof region.blurColor === "string" ? region.blurColor : undefined,+ trackIndex: isFiniteNumber(region.trackIndex)+ ? Math.max(0, Math.floor(region.trackIndex))+ : 0,};}): [];@@ -460,10 +514,16 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro(editor as Partial<ProjectEditorState>).audioRegions,)? ((editor as Partial<ProjectEditorState>).audioRegions as AudioRegion[])- .filter((region): region is AudioRegion => Boolean(region && typeof region.id === "string"))+ .filter((region): region is AudioRegion =>+ Boolean(region && typeof region.id === "string"),+ ).map((region) => {- const rawStart = isFiniteNumber(region.startMs) ? Math.round(region.startMs) : 0;- const rawEnd = isFiniteNumber(region.endMs) ? Math.round(region.endMs) : rawStart + 1000;+ const rawStart = isFiniteNumber(region.startMs)+ ? Math.round(region.startMs)+ : 0;+ const rawEnd = isFiniteNumber(region.endMs)+ ? Math.round(region.endMs)+ : rawStart + 1000;const startMs = Math.max(0, Math.min(rawStart, rawEnd));const endMs = Math.max(startMs + 1, rawEnd);@@ -473,6 +533,9 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): ProendMs,audioPath: typeof region.audioPath === "string" ? region.audioPath : "",volume: isFiniteNumber(region.volume) ? clamp(region.volume, 0, 1) : 1,+ trackIndex: isFiniteNumber(region.trackIndex)+ ? Math.max(0, Math.floor(region.trackIndex))+ : 0,};}): [];@@ -484,7 +547,9 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro.filter((cue): cue is CaptionCue => Boolean(cue && typeof cue.id === "string")).map((cue) => {const rawStart = isFiniteNumber(cue.startMs) ? Math.round(cue.startMs) : 0;- const rawEnd = isFiniteNumber(cue.endMs) ? Math.round(cue.endMs) : rawStart + 1000;+ const rawEnd = isFiniteNumber(cue.endMs)+ ? Math.round(cue.endMs)+ : rawStart + 1000;const startMs = Math.max(0, Math.min(rawStart, rawEnd));const endMs = Math.max(startMs + 1, rawEnd);const words: CaptionCueWord[] | undefined = Array.isArray(cue.words)@@ -499,8 +564,16 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Proconst rawWordEnd = isFiniteNumber(word.endMs)? Math.round(word.endMs): rawWordStart + 1;- const normalizedWordStart = clamp(rawWordStart, startMs, endMs - 1);- const normalizedWordEnd = clamp(rawWordEnd, normalizedWordStart + 1, endMs);+ const normalizedWordStart = clamp(+ rawWordStart,+ startMs,+ endMs - 1,+ );+ const normalizedWordEnd = clamp(+ rawWordEnd,+ normalizedWordStart + 1,+ endMs,+ );return {text: word.text.trim(),@@ -533,7 +606,8 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro? rawAutoCaptionSettings.enabled: DEFAULT_AUTO_CAPTION_SETTINGS.enabled,language:- typeof rawAutoCaptionSettings.language === "string" && rawAutoCaptionSettings.language.trim()+ typeof rawAutoCaptionSettings.language === "string" &&+ rawAutoCaptionSettings.language.trim()? rawAutoCaptionSettings.language.trim(): DEFAULT_AUTO_CAPTION_SETTINGS.language,fontFamily: getDefaultCaptionFontFamily(),@@ -627,12 +701,11 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): ProcursorSmoothing: isFiniteNumber(editor.cursorSmoothing)? clamp(editor.cursorSmoothing, 0, 2): DEFAULT_CURSOR_SMOOTHING,- zoomSmoothness: isFiniteNumber((editor as any).zoomSmoothness)- ? clamp((editor as any).zoomSmoothness as number, 0, 1)+ zoomSmoothness: isFiniteNumber(editor.zoomSmoothness)+ ? clamp(editor.zoomSmoothness, 0, 1): 0.5,- zoomClassicMode: typeof (editor as any).zoomClassicMode === 'boolean'- ? (editor as any).zoomClassicMode- : false,+ zoomClassicMode:+ typeof editor.zoomClassicMode === "boolean" ? editor.zoomClassicMode : false,cursorMotionBlur: isFiniteNumber((editor as Partial<ProjectEditorState>).cursorMotionBlur)? clamp((editor as Partial<ProjectEditorState>).cursorMotionBlur as number, 0, 2): DEFAULT_CURSOR_MOTION_BLUR,@@ -642,7 +715,11 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): ProcursorClickBounceDuration: isFiniteNumber((editor as Partial<ProjectEditorState>).cursorClickBounceDuration,)- ? clamp((editor as Partial<ProjectEditorState>).cursorClickBounceDuration as number, 60, 500)+ ? clamp(+ (editor as Partial<ProjectEditorState>).cursorClickBounceDuration as number,+ 60,+ 500,+ ): DEFAULT_CURSOR_CLICK_BOUNCE_DURATION,cursorSway: isFiniteNumber((editor as Partial<ProjectEditorState>).cursorSway)? clamp((editor as Partial<ProjectEditorState>).cursorSway as number, 0, 2)@@ -666,9 +743,12 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): ProautoCaptionSettings: normalizedAutoCaptionSettings,webcam: {enabled:- typeof webcam.enabled === "boolean" ? webcam.enabled : DEFAULT_WEBCAM_OVERLAY.enabled,+ typeof webcam.enabled === "boolean"+ ? webcam.enabled+ : DEFAULT_WEBCAM_OVERLAY.enabled,sourcePath: webcamSourcePath,- mirror: typeof webcam.mirror === "boolean" ? webcam.mirror : DEFAULT_WEBCAM_OVERLAY.mirror,+ mirror:+ typeof webcam.mirror === "boolean" ? webcam.mirror : DEFAULT_WEBCAM_OVERLAY.mirror,positionPreset:webcam.positionPreset === "top-left" ||webcam.positionPreset === "top-center" ||@@ -710,11 +790,15 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): ProcornerRadius: isFiniteNumber(webcam.cornerRadius)? clamp(webcam.cornerRadius, 0, 160): DEFAULT_WEBCAM_CORNER_RADIUS,- shadow: isFiniteNumber(webcam.shadow) ? clamp(webcam.shadow, 0, 1) : DEFAULT_WEBCAM_SHADOW,+ shadow: isFiniteNumber(webcam.shadow)+ ? clamp(webcam.shadow, 0, 1)+ : DEFAULT_WEBCAM_SHADOW,timeOffsetMs: isFiniteNumber(webcam.timeOffsetMs)? Math.round(webcam.timeOffsetMs): DEFAULT_WEBCAM_TIME_OFFSET_MS,- margin: isFiniteNumber(webcam.margin) ? clamp(webcam.margin, 0, 96) : DEFAULT_WEBCAM_MARGIN,+ margin: isFiniteNumber(webcam.margin)+ ? clamp(webcam.margin, 0, 96)+ : DEFAULT_WEBCAM_MARGIN,},aspectRatio:typeof editor.aspectRatio === "string" &&diff --git a/src/components/video-editor/timeline/Item.tsx b/src/components/video-editor/timeline/Item.tsxindex a68a38ae..0b595cbe 100644--- a/src/components/video-editor/timeline/Item.tsx+++ b/src/components/video-editor/timeline/Item.tsx@@ -1,20 +1,27 @@+import {+ FilmSlate as Film,+ Gauge,+ ChatCircleText as MessageSquare,+ MusicNote as Music,+ Scissors,+ MagnifyingGlassPlus as ZoomIn,+} from "@phosphor-icons/react";import type { Span } from "dnd-timeline";import { useItem } from "dnd-timeline";-import { Film, Gauge, MessageSquare, Music, Scissors, ZoomIn } from "lucide-react";import { useMemo } from "react";import { cn } from "@/lib/utils";import glassStyles from "./ItemGlass.module.css";interface ItemProps {- id: string;- span: Span;- rowId: string;- children: React.ReactNode;- isSelected?: boolean;- onSelect?: () => void;- zoomDepth?: number;- speedValue?: number;- variant?: 'zoom' | 'trim' | 'clip' | 'annotation' | 'speed' | 'audio';+ id: string;+ span: Span;+ rowId: string;+ children: React.ReactNode;+ isSelected?: boolean;+ onSelect?: () => void;+ zoomDepth?: number;+ speedValue?: number;+ variant?: "zoom" | "trim" | "clip" | "annotation" | "speed" | "audio";}// Map zoom depth to multiplier labels@@ -54,133 +61,145 @@ export default function Item({data: { rowId },});- const isZoom = variant === 'zoom';- const isTrim = variant === 'trim';- const isClip = variant === 'clip';- const isSpeed = variant === 'speed';- const isAudio = variant === 'audio';+ const isZoom = variant === "zoom";+ const isTrim = variant === "trim";+ const isClip = variant === "clip";+ const isSpeed = variant === "speed";+ const isAudio = variant === "audio";- const glassClass = isZoom- ? glassStyles.glassPurple- : isTrim- ? glassStyles.glassRed- : isClip- ? glassStyles.glassCyan- : isSpeed- ? glassStyles.glassAmber- : isAudio- ? glassStyles.glassDarkGreen- : glassStyles.glassYellow;+ const glassClass = isZoom+ ? glassStyles.glassPurple+ : isTrim+ ? glassStyles.glassRed+ : isClip+ ? glassStyles.glassCyan+ : isSpeed+ ? glassStyles.glassAmber+ : isAudio+ ? glassStyles.glassDarkGreen+ : glassStyles.glassYellow;- const endCapColor = isZoom- ? '#a855f7'- : isTrim- ? '#ef4444'- : isClip- ? '#06b6d4'- : isSpeed- ? '#d97706'- : isAudio- ? '#166534'- : '#B4A046';+ const endCapColor = isZoom+ ? "#a855f7"+ : isTrim+ ? "#ef4444"+ : isClip+ ? "#06b6d4"+ : isSpeed+ ? "#d97706"+ : isAudio+ ? "#166534"+ : "#B4A046";const timeLabel = useMemo(() => `${formatMs(span.start)} – ${formatMs(span.end)}`,[span.start, span.end],);- const MIN_ITEM_PX = 6;- const safeItemStyle = { ...itemStyle, minWidth: MIN_ITEM_PX, height: "100%" };+ const MIN_ITEM_PX = 6;+ const safeItemStyle = { ...itemStyle, minWidth: MIN_ITEM_PX, height: "100%" };- return (- <div- ref={setNodeRef}- style={safeItemStyle}- {...listeners}- {...attributes}- onPointerDownCapture={() => onSelect?.()}- className="group h-full"- >- <div className="h-full" style={{ ...itemContentStyle, minWidth: 24, height: "100%" }}>- <div- className={cn(- glassClass,- "w-full h-full overflow-hidden flex items-center justify-center gap-1.5 cursor-grab active:cursor-grabbing relative",- isSelected && glassStyles.selected- )}- style={{ height: "100%", minHeight: 22, color: '#fff', minWidth: 24 }}- onClick={(event) => {- event.stopPropagation();- onSelect?.();- }}- >- <div- className={cn(glassStyles.zoomEndCap, glassStyles.left)}- style={{ cursor: 'col-resize', pointerEvents: 'auto', width: 8, opacity: 0.9, background: endCapColor }}- title="Resize left"- />- <div- className={cn(glassStyles.zoomEndCap, glassStyles.right)}- style={{ cursor: 'col-resize', pointerEvents: 'auto', width: 8, opacity: 0.9, background: endCapColor }}- title="Resize right"- />- {/* Content */}- <div className="relative z-10 flex flex-col items-center justify-center text-white/90 opacity-80 group-hover:opacity-100 transition-opacity select-none overflow-hidden">- <div className="flex items-center gap-1.5">- {isZoom ? (- <>- <ZoomIn className="w-3.5 h-3.5 shrink-0" />- <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">- {ZOOM_LABELS[zoomDepth] || `${zoomDepth}×`}- </span>- </>- ) : isTrim ? (- <>- <Scissors className="w-3.5 h-3.5 shrink-0" />- <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">- Trim- </span>- </>- ) : isClip ? (- <>- <Film className="w-3.5 h-3.5 shrink-0" />- <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">- Clip- </span>- </>- ) : isSpeed ? (- <>- <Gauge className="w-3.5 h-3.5 shrink-0" />- <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">- {speedValue !== undefined ? `${speedValue}×` : 'Speed'}- </span>- </>- ) : isAudio ? (- <>- <Music className="w-3.5 h-3.5 shrink-0" />- <span className="text-[11px] font-semibold tracking-tight truncate max-w-full">- {children}- </span>- </>- ) : (- <>- <MessageSquare className="w-3.5 h-3.5 shrink-0" />- <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">- {children}- </span>- </>- )}- </div>- <span- className={`text-[9px] tabular-nums tracking-tight whitespace-nowrap transition-opacity ${- isSelected ? 'opacity-60' : 'opacity-0 group-hover:opacity-40'- }`}- >- {timeLabel}- </span>- </div>- </div>- </div>- </div>- );+ return (+ <div+ ref={setNodeRef}+ style={safeItemStyle}+ {...listeners}+ {...attributes}+ onPointerDownCapture={() => onSelect?.()}+ className="group h-full"+ >+ <div className="h-full" style={{ ...itemContentStyle, minWidth: 24, height: "100%" }}>+ <div+ className={cn(+ glassClass,+ "w-full h-full overflow-hidden flex items-center justify-center gap-1.5 cursor-grab active:cursor-grabbing relative",+ isSelected && glassStyles.selected,+ )}+ style={{ height: "100%", minHeight: 22, color: "#fff", minWidth: 24 }}+ onClick={(event) => {+ event.stopPropagation();+ onSelect?.();+ }}+ >+ <div+ className={cn(glassStyles.zoomEndCap, glassStyles.left)}+ style={{+ cursor: "col-resize",+ pointerEvents: "auto",+ width: 8,+ opacity: 0.9,+ background: endCapColor,+ }}+ title="Resize left"+ />+ <div+ className={cn(glassStyles.zoomEndCap, glassStyles.right)}+ style={{+ cursor: "col-resize",+ pointerEvents: "auto",+ width: 8,+ opacity: 0.9,+ background: endCapColor,+ }}+ title="Resize right"+ />+ {/* Content */}+ <div className="relative z-10 flex flex-col items-center justify-center text-white/90 opacity-80 group-hover:opacity-100 transition-opacity select-none overflow-hidden">+ <div className="flex items-center gap-1.5">+ {isZoom ? (+ <>+ <ZoomIn className="w-3.5 h-3.5 shrink-0" />+ <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">+ {ZOOM_LABELS[zoomDepth] || `${zoomDepth}×`}+ </span>+ </>+ ) : isTrim ? (+ <>+ <Scissors className="w-3.5 h-3.5 shrink-0" />+ <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">+ Trim+ </span>+ </>+ ) : isClip ? (+ <>+ <Film className="w-3.5 h-3.5 shrink-0" />+ <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">+ Clip+ </span>+ </>+ ) : isSpeed ? (+ <>+ <Gauge className="w-3.5 h-3.5 shrink-0" />+ <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">+ {speedValue !== undefined ? `${speedValue}×` : "Speed"}+ </span>+ </>+ ) : isAudio ? (+ <>+ <Music className="w-3.5 h-3.5 shrink-0" />+ <span className="text-[11px] font-semibold tracking-tight truncate max-w-full">+ {children}+ </span>+ </>+ ) : (+ <>+ <MessageSquare className="w-3.5 h-3.5 shrink-0" />+ <span className="text-[11px] font-semibold tracking-tight whitespace-nowrap">+ {children}+ </span>+ </>+ )}+ </div>+ <span+ className={`text-[9px] tabular-nums tracking-tight whitespace-nowrap transition-opacity ${+ isSelected ? "opacity-60" : "opacity-0 group-hover:opacity-40"+ }`}+ >+ {timeLabel}+ </span>+ </div>+ </div>+ </div>+ </div>+ );}diff --git a/src/components/video-editor/timeline/TimelineEditor.tsx b/src/components/video-editor/timeline/TimelineEditor.tsxindex 144913c4..ddcee9ce 100644--- a/src/components/video-editor/timeline/TimelineEditor.tsx+++ b/src/components/video-editor/timeline/TimelineEditor.tsx@@ -1,5 +1,27 @@-import { useCallback, useEffect, useMemo, useRef, useState, type KeyboardEvent as ReactKeyboardEvent, type WheelEvent } from "react";+import {+ Check,+ CaretDown as ChevronDown,+ Crop,+ ChatCircleText as MessageSquare,+ MusicNote as Music,+ Plus,+ Scissors,+ Sparkle as WandSparkles,+ MagnifyingGlassPlus as ZoomIn,+} from "@phosphor-icons/react";+import type { Range, Span } from "dnd-timeline";import { useTimelineContext } from "dnd-timeline";+import {+ type KeyboardEvent as ReactKeyboardEvent,+ useCallback,+ useEffect,+ useMemo,+ useRef,+ useState,+ type WheelEvent,+} from "react";+import { toast } from "sonner";+import { v4 as uuidv4 } from "uuid";import { Button } from "@/components/ui/button";import {DropdownMenu,@@ -7,26 +29,36 @@ import {DropdownMenuItem,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";-import { Plus, Scissors, ZoomIn, MessageSquare, ChevronDown, Check, WandSparkles, Music, Crop } from "lucide-react";-import { toast } from "sonner";-import { cn } from "@/lib/utils";-import { v4 as uuidv4 } from 'uuid';import { useScopedT } from "@/contexts/I18nContext";import { useShortcuts } from "@/contexts/ShortcutsContext";import { matchesShortcut } from "@/lib/shortcuts";-import { ASPECT_RATIOS, type AspectRatio, getAspectRatioLabel, isCustomAspectRatio } from "@/utils/aspectRatioUtils";+import { cn } from "@/lib/utils";+import {+ ASPECT_RATIOS,+ type AspectRatio,+ getAspectRatioLabel,+ isCustomAspectRatio,+} from "@/utils/aspectRatioUtils";import { formatShortcut } from "@/utils/platformUtils";import { loadEditorPreferences, saveEditorPreferences } from "../editorPreferences";-import TimelineWrapper from "./TimelineWrapper";-import Row from "./Row";+import { toFileUrl } from "../projectPersistence";+import type {+ AnnotationRegion,+ AudioRegion,+ ClipRegion,+ CursorTelemetryPoint,+ SpeedRegion,+ TrimRegion,+ ZoomFocus,+ ZoomRegion,+} from "../types";+import AudioWaveform from "./AudioWaveform";import Item from "./Item";import KeyframeMarkers from "./KeyframeMarkers";-import type { Range, Span } from "dnd-timeline";-import type { ZoomRegion, TrimRegion, ClipRegion, AnnotationRegion, SpeedRegion, AudioRegion, CursorTelemetryPoint, ZoomFocus } from "../types";-import { toFileUrl } from "../projectPersistence";+import Row from "./Row";+import TimelineWrapper from "./TimelineWrapper";+import { type AudioPeaksData, useAudioPeaks } from "./useAudioPeaks";import { buildInteractionZoomSuggestions } from "./zoomSuggestionUtils";-import { useAudioPeaks, type AudioPeaksData } from "./useAudioPeaks";-import AudioWaveform from "./AudioWaveform";const ZOOM_ROW_ID = "row-zoom";const CLIP_ROW_ID = "row-clip";@@ -35,55 +67,55 @@ const AUDIO_ROW_ID = "row-audio";const FALLBACK_RANGE_MS = 1000;const TARGET_MARKER_COUNT = 12;interface TimelineEditorProps {- videoDuration: number;- currentTime: number;- onSeek?: (time: number) => void;- cursorTelemetry?: CursorTelemetryPoint[];- autoSuggestZoomsTrigger?: number;- onAutoSuggestZoomsConsumed?: () => void;- disableSuggestedZooms?: boolean;- zoomRegions: ZoomRegion[];- onZoomAdded: (span: Span) => void;- onZoomSuggested?: (span: Span, focus: ZoomFocus) => void;- onZoomSpanChange: (id: string, span: Span) => void;- onZoomDelete: (id: string) => void;- selectedZoomId: string | null;- onSelectZoom: (id: string | null) => void;- trimRegions?: TrimRegion[];- onTrimAdded?: (span: Span) => void;- onTrimSpanChange?: (id: string, span: Span) => void;- onTrimDelete?: (id: string) => void;- selectedTrimId?: string | null;- onSelectTrim?: (id: string | null) => void;- clipRegions?: ClipRegion[];- onClipSplit?: (splitMs: number) => void;- onClipSpanChange?: (id: string, span: Span) => void;- onClipDelete?: (id: string) => void;- selectedClipId?: string | null;- onSelectClip?: (id: string | null) => void;- annotationRegions?: AnnotationRegion[];- onAnnotationAdded?: (span: Span) => void;- onAnnotationSpanChange?: (id: string, span: Span) => void;- onAnnotationDelete?: (id: string) => void;- selectedAnnotationId?: string | null;- onSelectAnnotation?: (id: string | null) => void;- speedRegions?: SpeedRegion[];- onSpeedAdded?: (span: Span) => void;- onSpeedSpanChange?: (id: string, span: Span) => void;- onSpeedDelete?: (id: string) => void;- selectedSpeedId?: string | null;- onSelectSpeed?: (id: string | null) => void;- audioRegions?: AudioRegion[];- onAudioAdded?: (span: Span, audioPath: string) => void;- onAudioSpanChange?: (id: string, span: Span) => void;- onAudioDelete?: (id: string) => void;- selectedAudioId?: string | null;- onSelectAudio?: (id: string | null) => void;- aspectRatio: AspectRatio;- onAspectRatioChange: (aspectRatio: AspectRatio) => void;- onOpenCropEditor?: () => void;- isCropped?: boolean;- videoPath?: string | null;+ videoDuration: number;+ currentTime: number;+ onSeek?: (time: number) => void;+ cursorTelemetry?: CursorTelemetryPoint[];+ autoSuggestZoomsTrigger?: number;+ onAutoSuggestZoomsConsumed?: () => void;+ disableSuggestedZooms?: boolean;+ zoomRegions: ZoomRegion[];+ onZoomAdded: (span: Span) => void;+ onZoomSuggested?: (span: Span, focus: ZoomFocus) => void;+ onZoomSpanChange: (id: string, span: Span) => void;+ onZoomDelete: (id: string) => void;+ selectedZoomId: string | null;+ onSelectZoom: (id: string | null) => void;+ trimRegions?: TrimRegion[];+ onTrimAdded?: (span: Span) => void;+ onTrimSpanChange?: (id: string, span: Span) => void;+ onTrimDelete?: (id: string) => void;+ selectedTrimId?: string | null;+ onSelectTrim?: (id: string | null) => void;+ clipRegions?: ClipRegion[];+ onClipSplit?: (splitMs: number) => void;+ onClipSpanChange?: (id: string, span: Span) => void;+ onClipDelete?: (id: string) => void;+ selectedClipId?: string | null;+ onSelectClip?: (id: string | null) => void;+ annotationRegions?: AnnotationRegion[];+ onAnnotationAdded?: (span: Span) => void;+ onAnnotationSpanChange?: (id: string, span: Span) => void;+ onAnnotationDelete?: (id: string) => void;+ selectedAnnotationId?: string | null;+ onSelectAnnotation?: (id: string | null) => void;+ speedRegions?: SpeedRegion[];+ onSpeedAdded?: (span: Span) => void;+ onSpeedSpanChange?: (id: string, span: Span) => void;+ onSpeedDelete?: (id: string) => void;+ selectedSpeedId?: string | null;+ onSelectSpeed?: (id: string | null) => void;+ audioRegions?: AudioRegion[];+ onAudioAdded?: (span: Span, audioPath: string) => void;+ onAudioSpanChange?: (id: string, span: Span) => void;+ onAudioDelete?: (id: string) => void;+ selectedAudioId?: string | null;+ onSelectAudio?: (id: string | null) => void;+ aspectRatio: AspectRatio;+ onAspectRatioChange: (aspectRatio: AspectRatio) => void;+ onOpenCropEditor?: () => void;+ isCropped?: boolean;+ videoPath?: string | null;}interface TimelineScaleConfig {@@ -93,13 +125,13 @@ interface TimelineScaleConfig {}interface TimelineRenderItem {- id: string;- rowId: string;- span: Span;- label: string;- zoomDepth?: number;- speedValue?: number;- variant: 'zoom' | 'trim' | 'clip' | 'annotation' | 'speed' | 'audio';+ id: string;+ rowId: string;+ span: Span;+ label: string;+ zoomDepth?: number;+ speedValue?: number;+ variant: "zoom" | "trim" | "clip" | "annotation" | "speed" | "audio";}const SCALE_CANDIDATES = [@@ -396,7 +428,7 @@ function TimelineAxis({return (<div- className="h-8 bg-[#161619] border-b border-white/10 relative overflow-hidden select-none"+ className="h-8 bg-[#161619] border-b border-white/10 relative overflow-hidden select-none"style={{[sideProperty === "right" ? "marginRight" : "marginLeft"]: `${sidebarWidth}px`,}}@@ -433,7 +465,9 @@ function TimelineAxis({<spanclassName={cn("text-[10px] font-medium tabular-nums tracking-tight",- marker.time === currentTimeMs ? "text-[#2563EB]" : "text-slate-500",+ marker.time === currentTimeMs+ ? "text-[#2563EB]"+ : "text-slate-500",)}>{marker.label}@@ -447,47 +481,47 @@ function TimelineAxis({}function Timeline({- items,- videoDurationMs,- currentTimeMs,- onSeek,- onSelectZoom,- onSelectTrim,- onSelectClip,- onSelectAnnotation,- onSelectSpeed,- onSelectAudio,- selectedZoomId,- selectedTrimId: _selectedTrimId,- selectedClipId,- selectedAnnotationId,- selectedSpeedId: _selectedSpeedId,- selectedAudioId,- selectAllBlocksActive = false,- onClearBlockSelection,- keyframes = [],- audioPeaks,+ items,+ videoDurationMs,+ currentTimeMs,+ onSeek,+ onSelectZoom,+ onSelectTrim,+ onSelectClip,+ onSelectAnnotation,+ onSelectSpeed,+ onSelectAudio,+ selectedZoomId,+ selectedTrimId: _selectedTrimId,+ selectedClipId,+ selectedAnnotationId,+ selectedSpeedId: _selectedSpeedId,+ selectedAudioId,+ selectAllBlocksActive = false,+ onClearBlockSelection,+ keyframes = [],+ audioPeaks,}: {- items: TimelineRenderItem[];- videoDurationMs: number;- currentTimeMs: number;- onSeek?: (time: number) => void;- onSelectZoom?: (id: string | null) => void;- onSelectTrim?: (id: string | null) => void;- onSelectClip?: (id: string | null) => void;- onSelectAnnotation?: (id: string | null) => void;- onSelectSpeed?: (id: string | null) => void;- onSelectAudio?: (id: string | null) => void;- selectedZoomId: string | null;- selectedTrimId?: string | null;- selectedClipId?: string | null;- selectedAnnotationId?: string | null;- selectedSpeedId?: string | null;- selectedAudioId?: string | null;- selectAllBlocksActive?: boolean;- onClearBlockSelection?: () => void;- keyframes?: { id: string; time: number }[];- audioPeaks?: AudioPeaksData | null;+ items: TimelineRenderItem[];+ videoDurationMs: number;+ currentTimeMs: number;+ onSeek?: (time: number) => void;+ onSelectZoom?: (id: string | null) => void;+ onSelectTrim?: (id: string | null) => void;+ onSelectClip?: (id: string | null) => void;+ onSelectAnnotation?: (id: string | null) => void;+ onSelectSpeed?: (id: string | null) => void;+ onSelectAudio?: (id: string | null) => void;+ selectedZoomId: string | null;+ selectedTrimId?: string | null;+ selectedClipId?: string | null;+ selectedAnnotationId?: string | null;+ selectedSpeedId?: string | null;+ selectedAudioId?: string | null;+ selectAllBlocksActive?: boolean;+ onClearBlockSelection?: () => void;+ keyframes?: { id: string; time: number }[];+ audioPeaks?: AudioPeaksData | null;}) {const { setTimelineRef, style, sidebarWidth, range, pixelsToValue } = useTimelineContext();const localTimelineRef = useRef<HTMLDivElement | null>(null);@@ -504,15 +538,15 @@ function Timeline({(e: React.MouseEvent<HTMLDivElement>) => {if (!onSeek || videoDurationMs <= 0) return;- // Only clear selection if clicking on empty space (not on items)- // This is handled by event propagation - items stop propagation- onSelectZoom?.(null);- onSelectTrim?.(null);- onSelectClip?.(null);- onSelectAnnotation?.(null);- onSelectSpeed?.(null);- onSelectAudio?.(null);- onClearBlockSelection?.();+ // Only clear selection if clicking on empty space (not on items)+ // This is handled by event propagation - items stop propagation+ onSelectZoom?.(null);+ onSelectTrim?.(null);+ onSelectClip?.(null);+ onSelectAnnotation?.(null);+ onSelectSpeed?.(null);+ onSelectAudio?.(null);+ onClearBlockSelection?.();const rect = e.currentTarget.getBoundingClientRect();const clickX = e.clientX - rect.left - sidebarWidth;@@ -523,20 +557,35 @@ function Timeline({const absoluteMs = Math.max(0, Math.min(range.start + relativeMs, videoDurationMs));const timeInSeconds = absoluteMs / 1000;- onSeek(timeInSeconds);- }, [onSeek, onSelectZoom, onSelectTrim, onSelectClip, onSelectAnnotation, onSelectSpeed, onSelectAudio, videoDurationMs, sidebarWidth, range.start, pixelsToValue]);+ onSeek(timeInSeconds);+ },+ [+ onSeek,+ onSelectZoom,+ onSelectTrim,+ onSelectClip,+ onSelectAnnotation,+ onSelectSpeed,+ onSelectAudio,+ onClearBlockSelection,+ videoDurationMs,+ sidebarWidth,+ range.start,+ pixelsToValue,+ ],+ );- const zoomItems = items.filter(item => item.rowId === ZOOM_ROW_ID);+ const zoomItems = items.filter((item) => item.rowId === ZOOM_ROW_ID);- const clipItems = items.filter(item => item.rowId === CLIP_ROW_ID);- const annotationItems = items.filter(item => item.rowId === ANNOTATION_ROW_ID);- const audioItems = items.filter(item => item.rowId === AUDIO_ROW_ID);+ const clipItems = items.filter((item) => item.rowId === CLIP_ROW_ID);+ const annotationItems = items.filter((item) => item.rowId === ANNOTATION_ROW_ID);+ const audioItems = items.filter((item) => item.rowId === AUDIO_ROW_ID);return (<divref={setRefs}style={style}- className="select-none bg-[#17171a] h-full min-h-0 relative cursor-pointer group flex flex-col"+ className="select-none bg-[#17171a] h-full min-h-0 relative cursor-pointer group flex flex-col"onClick={handleTimelineClick}><div className="absolute inset-0 bg-[linear-gradient(to_right,#ffffff03_1px,transparent_1px)] bg-[length:20px_100%] pointer-events-none" />@@ -549,1141 +598,1325 @@ function Timeline({keyframes={keyframes}/>- <div className="relative z-10 flex flex-1 min-h-0 flex-col">- <Row id={CLIP_ROW_ID} isEmpty={clipItems.length === 0} hint="Press C to split clip">- {audioPeaks && <AudioWaveform peaks={audioPeaks} />}- {clipItems.map((item) => (- <Item- id={item.id}- key={item.id}- rowId={item.rowId}- span={item.span}- isSelected={selectAllBlocksActive || item.id === selectedClipId}- onSelect={() => onSelectClip?.(item.id)}- variant="clip"- >- {item.label}- </Item>- ))}- </Row>-- <Row id={ZOOM_ROW_ID} isEmpty={zoomItems.length === 0} hint="Press Z to add zoom">- {zoomItems.map((item) => (- <Item- id={item.id}- key={item.id}- rowId={item.rowId}- span={item.span}- isSelected={selectAllBlocksActive || item.id === selectedZoomId}- onSelect={() => onSelectZoom?.(item.id)}- zoomDepth={item.zoomDepth}- variant="zoom"- >- {item.label}- </Item>- ))}- </Row>--- <Row- id={ANNOTATION_ROW_ID}- isEmpty={annotationItems.length === 0}- hint="Press A to add annotation"- >- {annotationItems.map((item) => (- <Item- id={item.id}- key={item.id}- rowId={item.rowId}- span={item.span}- isSelected={selectAllBlocksActive || item.id === selectedAnnotationId}- onSelect={() => onSelectAnnotation?.(item.id)}- variant="annotation"- >- {item.label}- </Item>- ))}- </Row>-- <Row id={AUDIO_ROW_ID} isEmpty={audioItems.length === 0} hint="Click music icon to add audio">- {audioItems.map((item) => (- <Item- id={item.id}- key={item.id}- rowId={item.rowId}- span={item.span}- isSelected={selectAllBlocksActive || item.id === selectedAudioId}- onSelect={() => onSelectAudio?.(item.id)}- variant="audio"- >- {item.label}- </Item>- ))}- </Row>- </div>- </div>- );+ <div className="relative z-10 flex flex-1 min-h-0 flex-col">+ <Row id={CLIP_ROW_ID} isEmpty={clipItems.length === 0} hint="Press C to split clip">+ {audioPeaks && <AudioWaveform peaks={audioPeaks} />}+ {clipItems.map((item) => (+ <Item+ id={item.id}+ key={item.id}+ rowId={item.rowId}+ span={item.span}+ isSelected={selectAllBlocksActive || item.id === selectedClipId}+ onSelect={() => onSelectClip?.(item.id)}+ variant="clip"+ >+ {item.label}+ </Item>+ ))}+ </Row>++ <Row id={ZOOM_ROW_ID} isEmpty={zoomItems.length === 0} hint="Press Z to add zoom">+ {zoomItems.map((item) => (+ <Item+ id={item.id}+ key={item.id}+ rowId={item.rowId}+ span={item.span}+ isSelected={selectAllBlocksActive || item.id === selectedZoomId}+ onSelect={() => onSelectZoom?.(item.id)}+ zoomDepth={item.zoomDepth}+ variant="zoom"+ >+ {item.label}+ </Item>+ ))}+ </Row>++ <Row+ id={ANNOTATION_ROW_ID}+ isEmpty={annotationItems.length === 0}+ hint="Press A to add annotation"+ >+ {annotationItems.map((item) => (+ <Item+ id={item.id}+ key={item.id}+ rowId={item.rowId}+ span={item.span}+ isSelected={selectAllBlocksActive || item.id === selectedAnnotationId}+ onSelect={() => onSelectAnnotation?.(item.id)}+ variant="annotation"+ >+ {item.label}+ </Item>+ ))}+ </Row>++ <Row+ id={AUDIO_ROW_ID}+ isEmpty={audioItems.length === 0}+ hint="Click music icon to add audio"+ >+ {audioItems.map((item) => (+ <Item+ id={item.id}+ key={item.id}+ rowId={item.rowId}+ span={item.span}+ isSelected={selectAllBlocksActive || item.id === selectedAudioId}+ onSelect={() => onSelectAudio?.(item.id)}+ variant="audio"+ >+ {item.label}+ </Item>+ ))}+ </Row>+ </div>+ </div>+ );}export default function TimelineEditor({- videoDuration,- currentTime,- onSeek,- cursorTelemetry = [],- autoSuggestZoomsTrigger = 0,- onAutoSuggestZoomsConsumed,- disableSuggestedZooms = false,- zoomRegions,- onZoomAdded,- onZoomSuggested,- onZoomSpanChange,- onZoomDelete,- selectedZoomId,- onSelectZoom,- trimRegions = [],- onTrimAdded,- onTrimSpanChange,- onTrimDelete,- selectedTrimId,- onSelectTrim,- clipRegions = [],- onClipSplit,- onClipSpanChange,- onClipDelete,- selectedClipId,- onSelectClip,- annotationRegions = [],- onAnnotationAdded,- onAnnotationSpanChange,- onAnnotationDelete,- selectedAnnotationId,- onSelectAnnotation,- speedRegions = [],- onSpeedAdded,- onSpeedSpanChange,- onSpeedDelete,- selectedSpeedId,- onSelectSpeed,- audioRegions = [],- onAudioAdded,- onAudioSpanChange,- onAudioDelete,- selectedAudioId,- onSelectAudio,- aspectRatio,- onAspectRatioChange,- onOpenCropEditor,- isCropped = false,- videoPath,+ videoDuration,+ currentTime,+ onSeek,+ cursorTelemetry = [],+ autoSuggestZoomsTrigger = 0,+ onAutoSuggestZoomsConsumed,+ disableSuggestedZooms = false,+ zoomRegions,+ onZoomAdded,+ onZoomSuggested,+ onZoomSpanChange,+ onZoomDelete,+ selectedZoomId,+ onSelectZoom,+ trimRegions = [],+ onTrimAdded,+ onTrimSpanChange,+ onTrimDelete,+ selectedTrimId,+ onSelectTrim,+ clipRegions = [],+ onClipSplit,+ onClipSpanChange,+ onClipDelete,+ selectedClipId,+ onSelectClip,+ annotationRegions = [],+ onAnnotationAdded,+ onAnnotationSpanChange,+ onAnnotationDelete,+ selectedAnnotationId,+ onSelectAnnotation,+ speedRegions = [],+ onSpeedAdded,+ onSpeedSpanChange,+ onSpeedDelete,+ selectedSpeedId,+ onSelectSpeed,+ audioRegions = [],+ onAudioAdded,+ onAudioSpanChange,+ onAudioDelete,+ selectedAudioId,+ onSelectAudio,+ aspectRatio,+ onAspectRatioChange,+ onOpenCropEditor,+ isCropped = false,+ videoPath,}: TimelineEditorProps) {- const t = useScopedT("settings");- const initialEditorPreferences = useMemo(() => loadEditorPreferences(), []);- const totalMs = useMemo(() => Math.max(0, Math.round(videoDuration * 1000)), [videoDuration]);- const currentTimeMs = useMemo(() => Math.round(currentTime * 1000), [currentTime]);- const timelineScale = useMemo(() => calculateTimelineScale(videoDuration), [videoDuration]);- const safeMinDurationMs = useMemo(- () => (totalMs > 0 ? Math.min(timelineScale.minItemDurationMs, totalMs) : timelineScale.minItemDurationMs),- [timelineScale.minItemDurationMs, totalMs],- );-- const [range, setRange] = useState<Range>(() => createInitialRange(totalMs));- const [keyframes, setKeyframes] = useState<{ id: string; time: number }[]>([]);- const [selectedKeyframeId, setSelectedKeyframeId] = useState<string | null>(null);- const [selectAllBlocksActive, setSelectAllBlocksActive] = useState(false);- const [customAspectWidth, setCustomAspectWidth] = useState(initialEditorPreferences.customAspectWidth);- const [customAspectHeight, setCustomAspectHeight] = useState(initialEditorPreferences.customAspectHeight);- const [scrollLabels, setScrollLabels] = useState({- pan: 'Shift + Ctrl + Scroll',- zoom: 'Ctrl + Scroll'- });- const isTimelineFocusedRef = useRef(false);- const timelineContainerRef = useRef<HTMLDivElement>(null);- const { shortcuts: keyShortcuts, isMac } = useShortcuts();- const audioPeaks = useAudioPeaks(videoPath);-- useEffect(() => {- setRange(createInitialRange(totalMs));- }, [totalMs]);-- useEffect(() => {- if (aspectRatio === 'native') {- return;- }- const [width, height] = aspectRatio.split(':');- if (width && height) {- setCustomAspectWidth(width);- setCustomAspectHeight(height);- }- }, [aspectRatio]);-- useEffect(() => {- saveEditorPreferences({- customAspectWidth,- customAspectHeight,- });- }, [customAspectHeight, customAspectWidth]);-- const applyCustomAspectRatio = useCallback(() => {- const width = Number.parseInt(customAspectWidth, 10);- const height = Number.parseInt(customAspectHeight, 10);- if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {- toast.error('Custom aspect ratio must be positive numbers.');- return;- }- onAspectRatioChange(`${width}:${height}` as AspectRatio);- }, [customAspectHeight, customAspectWidth, onAspectRatioChange]);-- const handleCustomAspectRatioKeyDown = useCallback((event: ReactKeyboardEvent<HTMLInputElement>) => {- // Prevent Radix DropdownMenu typeahead from selecting preset items while typing.- event.stopPropagation();- if (event.key === 'Enter') {- event.preventDefault();- applyCustomAspectRatio();- }- }, [applyCustomAspectRatio]);-- useEffect(() => {- formatShortcut(['shift', 'mod', 'Scroll']).then(pan => {- formatShortcut(['mod', 'Scroll']).then(zoom => {- setScrollLabels({ pan, zoom });- });- });- }, []);-- // Add keyframe at current playhead position- const addKeyframe = useCallback(() => {- if (totalMs === 0) return;- const time = Math.max(0, Math.min(currentTimeMs, totalMs));- if (keyframes.some(kf => Math.abs(kf.time - time) < 1)) return;- setKeyframes(prev => [...prev, { id: uuidv4(), time }]);- }, [currentTimeMs, totalMs, keyframes]);-- // Delete selected keyframe- const deleteSelectedKeyframe = useCallback(() => {- if (!selectedKeyframeId) return;- setKeyframes(prev => prev.filter(kf => kf.id !== selectedKeyframeId));- setSelectedKeyframeId(null);- }, [selectedKeyframeId]);-- // Move keyframe to new time position- const handleKeyframeMove = useCallback((id: string, newTime: number) => {- setKeyframes(prev => prev.map(kf => kf.id === id ? { ...kf, time: Math.max(0, Math.min(newTime, totalMs)) } : kf));- }, [totalMs]);-- // Delete selected zoom item- const deleteSelectedZoom = useCallback(() => {- if (!selectedZoomId) return;- onZoomDelete(selectedZoomId);- onSelectZoom(null);- }, [selectedZoomId, onZoomDelete, onSelectZoom]);-- // Delete selected trim item- const deleteSelectedTrim = useCallback(() => {- if (!selectedTrimId || !onTrimDelete || !onSelectTrim) return;- onTrimDelete(selectedTrimId);- onSelectTrim(null);- }, [selectedTrimId, onTrimDelete, onSelectTrim]);-- const deleteSelectedClip = useCallback(() => {- if (!selectedClipId || !onClipDelete || !onSelectClip) return;- onClipDelete(selectedClipId);- onSelectClip(null);- }, [selectedClipId, onClipDelete, onSelectClip]);-- const deleteSelectedAnnotation = useCallback(() => {- if (!selectedAnnotationId || !onAnnotationDelete || !onSelectAnnotation) return;- onAnnotationDelete(selectedAnnotationId);- onSelectAnnotation(null);- }, [selectedAnnotationId, onAnnotationDelete, onSelectAnnotation]);-- const deleteSelectedSpeed = useCallback(() => {- if (!selectedSpeedId || !onSpeedDelete || !onSelectSpeed) return;- onSpeedDelete(selectedSpeedId);- onSelectSpeed(null);- }, [selectedSpeedId, onSpeedDelete, onSelectSpeed]);-- const deleteSelectedAudio = useCallback(() => {- if (!selectedAudioId || !onAudioDelete || !onSelectAudio) return;- onAudioDelete(selectedAudioId);- onSelectAudio(null);- }, [selectedAudioId, onAudioDelete, onSelectAudio]);-- const clearSelectedBlocks = useCallback(() => {- onSelectZoom(null);- onSelectTrim?.(null);- onSelectClip?.(null);- onSelectAnnotation?.(null);- onSelectSpeed?.(null);- onSelectAudio?.(null);- setSelectAllBlocksActive(false);- }, [onSelectAnnotation, onSelectAudio, onSelectClip, onSelectSpeed, onSelectTrim, onSelectZoom]);-- const hasAnyTimelineBlocks =- zoomRegions.length > 0 ||- trimRegions.length > 0 ||- clipRegions.length > 0 ||- annotationRegions.length > 0 ||- speedRegions.length > 0 ||- audioRegions.length > 0;-- const deleteAllBlocks = useCallback(() => {- const zoomIds = zoomRegions.map((region) => region.id);- const trimIds = trimRegions.map((region) => region.id);- const clipIds = clipRegions.map((region) => region.id);- const annotationIds = annotationRegions.map((region) => region.id);- const speedIds = speedRegions.map((region) => region.id);- const audioIds = audioRegions.map((region) => region.id);-- zoomIds.forEach((id) => onZoomDelete(id));- trimIds.forEach((id) => onTrimDelete?.(id));- clipIds.forEach((id) => onClipDelete?.(id));- annotationIds.forEach((id) => onAnnotationDelete?.(id));- speedIds.forEach((id) => onSpeedDelete?.(id));- audioIds.forEach((id) => onAudioDelete?.(id));-- clearSelectedBlocks();- setSelectedKeyframeId(null);- }, [- annotationRegions,- audioRegions,- clearSelectedBlocks,- clipRegions,- onAnnotationDelete,- onAudioDelete,- onClipDelete,- onSpeedDelete,- onTrimDelete,- onZoomDelete,- speedRegions,- trimRegions,- zoomRegions,- ]);-- const handleSelectZoom = useCallback((id: string | null) => {- setSelectAllBlocksActive(false);- onSelectZoom(id);- }, [onSelectZoom]);-- const handleSelectTrim = useCallback((id: string | null) => {- setSelectAllBlocksActive(false);- onSelectTrim?.(id);- }, [onSelectTrim]);-- const handleSelectClip = useCallback((id: string | null) => {- setSelectAllBlocksActive(false);- onSelectClip?.(id);- }, [onSelectClip]);-- const handleSelectAnnotation = useCallback((id: string | null) => {- setSelectAllBlocksActive(false);- onSelectAnnotation?.(id);- }, [onSelectAnnotation]);-- const handleSelectSpeed = useCallback((id: string | null) => {- setSelectAllBlocksActive(false);- onSelectSpeed?.(id);- }, [onSelectSpeed]);-- const handleSelectAudio = useCallback((id: string | null) => {- setSelectAllBlocksActive(false);- onSelectAudio?.(id);- }, [onSelectAudio]);-- useEffect(() => {- setRange(createInitialRange(totalMs));- }, [totalMs]);-- // Normalize regions only when timeline bounds change (not on every region edit).- // Using refs to read current regions avoids a dependency-loop that re-fires- // this effect on every drag/resize and races with dnd-timeline's internal state.- const zoomRegionsRef = useRef(zoomRegions);- const trimRegionsRef = useRef(trimRegions);- const speedRegionsRef = useRef(speedRegions);- const audioRegionsRef = useRef(audioRegions);- zoomRegionsRef.current = zoomRegions;- trimRegionsRef.current = trimRegions;- speedRegionsRef.current = speedRegions;- audioRegionsRef.current = audioRegions;-- useEffect(() => {- if (totalMs === 0 || safeMinDurationMs <= 0) {- return;- }-- zoomRegionsRef.current.forEach((region) => {- const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));- const minEnd = clampedStart + safeMinDurationMs;- const clampedEnd = Math.min(totalMs, Math.max(minEnd, region.endMs));- const normalizedStart = Math.max(0, Math.min(clampedStart, totalMs - safeMinDurationMs));- const normalizedEnd = Math.max(minEnd, Math.min(clampedEnd, totalMs));-- if (normalizedStart !== region.startMs || normalizedEnd !== region.endMs) {- onZoomSpanChange(region.id, { start: normalizedStart, end: normalizedEnd });- }- });-- trimRegionsRef.current.forEach((region) => {- const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));- const minEnd = clampedStart + safeMinDurationMs;- const clampedEnd = Math.min(totalMs, Math.max(minEnd, region.endMs));- const normalizedStart = Math.max(0, Math.min(clampedStart, totalMs - safeMinDurationMs));- const normalizedEnd = Math.max(minEnd, Math.min(clampedEnd, totalMs));-- if (normalizedStart !== region.startMs || normalizedEnd !== region.endMs) {- onTrimSpanChange?.(region.id, { start: normalizedStart, end: normalizedEnd });- }- });-- speedRegionsRef.current.forEach((region) => {- const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));- const minEnd = clampedStart + safeMinDurationMs;- const clampedEnd = Math.min(totalMs, Math.max(minEnd, region.endMs));- const normalizedStart = Math.max(0, Math.min(clampedStart, totalMs - safeMinDurationMs));- const normalizedEnd = Math.max(minEnd, Math.min(clampedEnd, totalMs));-- if (normalizedStart !== region.startMs || normalizedEnd !== region.endMs) {- onSpeedSpanChange?.(region.id, { start: normalizedStart, end: normalizedEnd });- }- });-- audioRegionsRef.current.forEach((region) => {- const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));- const minEnd = clampedStart + safeMinDurationMs;- const clampedEnd = Math.min(totalMs, Math.max(minEnd, region.endMs));- const normalizedStart = Math.max(0, Math.min(clampedStart, totalMs - safeMinDurationMs));- const normalizedEnd = Math.max(minEnd, Math.min(clampedEnd, totalMs));-- if (normalizedStart !== region.startMs || normalizedEnd !== region.endMs) {- onAudioSpanChange?.(region.id, { start: normalizedStart, end: normalizedEnd });- }- });- // Only re-run when the timeline scale changes, not on every region edit- }, [totalMs, safeMinDurationMs, onZoomSpanChange, onTrimSpanChange, onSpeedSpanChange, onAudioSpanChange]);-- const hasOverlap = useCallback((newSpan: Span, excludeId?: string): boolean => {- // Determine which row the item belongs to- const isZoomItem = zoomRegions.some(r => r.id === excludeId);- const isTrimItem = trimRegions.some(r => r.id === excludeId);- const isClipItem = clipRegions.some(r => r.id === excludeId);- const isAnnotationItem = annotationRegions.some(r => r.id === excludeId);- const isSpeedItem = speedRegions.some(r => r.id === excludeId);- const isAudioItem = audioRegions.some(r => r.id === excludeId);-- if (isAnnotationItem) {- return false;- }-- // Helper to check overlap against a specific set of regions- const checkOverlap = (regions: (ZoomRegion | TrimRegion | ClipRegion | SpeedRegion | AudioRegion)[]) => {- return regions.some((region) => {- if (region.id === excludeId) return false;- // True overlap: regions actually intersect (not just adjacent)- return newSpan.end > region.startMs && newSpan.start < region.endMs;- });- };-- if (isZoomItem) {- return checkOverlap(zoomRegions);- }-- if (isTrimItem) {- return checkOverlap(trimRegions);- }-- if (isClipItem) {- return checkOverlap(clipRegions);- }-- if (isSpeedItem) {- return checkOverlap(speedRegions);- }-- if (isAudioItem) {- return checkOverlap(audioRegions);- }-- return false;- }, [zoomRegions, trimRegions, clipRegions, annotationRegions, speedRegions, audioRegions]);-- // Keep newly added timeline regions at the original short default instead of- // scaling them with the full recording length.- const defaultRegionDurationMs = useMemo(- () => Math.min(1000, totalMs),- [totalMs],- );-- const handleAddZoom = useCallback(() => {- if (!videoDuration || videoDuration === 0 || totalMs === 0) {- return;- }-- const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);- if (defaultDuration <= 0) {- return;- }-- // Always place zoom at playhead- const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));- // Find the next zoom region after the playhead- const sorted = [...zoomRegions].sort((a, b) => a.startMs - b.startMs);- const nextRegion = sorted.find(region => region.startMs > startPos);- const gapToNext = nextRegion ? nextRegion.startMs - startPos : totalMs - startPos;-- // Check if playhead is inside any zoom region- const isOverlapping = sorted.some(region => startPos >= region.startMs && startPos < region.endMs);- if (isOverlapping || gapToNext <= 0) {- toast.error("Cannot place zoom here", {- description: "Zoom already exists at this location or not enough space available.",- });- return;- }-- const actualDuration = Math.min(defaultRegionDurationMs, gapToNext);- onZoomAdded({ start: startPos, end: startPos + actualDuration });- }, [videoDuration, totalMs, currentTimeMs, zoomRegions, onZoomAdded, defaultRegionDurationMs]);-- const handleSuggestZooms = useCallback(() => {- if (!videoDuration || videoDuration === 0 || totalMs === 0) {- return;- }-- if (disableSuggestedZooms) {- toast.info("Suggested zooms are unavailable while cursor looping is enabled.");- return;- }-- if (!onZoomSuggested) {- toast.error("Zoom suggestion handler unavailable");- return;- }-- if (cursorTelemetry.length < 2) {- toast.info("No cursor telemetry available", {- description: "Record a screencast first to generate cursor-based suggestions.",- });- return;- }-- const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);- if (defaultDuration <= 0) {- return;- }-- const result = buildInteractionZoomSuggestions({- cursorTelemetry,- totalMs,- defaultDurationMs: defaultDuration,- reservedSpans: zoomRegions- .map((region) => ({ start: region.startMs, end: region.endMs }))- .sort((a, b) => a.start - b.start),- });-- if (result.status === 'no-telemetry') {- toast.info("No usable cursor telemetry", {- description: "The recording does not include enough cursor movement data.",- });- return;- }-- if (result.status === 'no-interactions') {- toast.info("No clear interaction moments found", {- description: "Try a recording with pauses or clicks around important actions.",- });- return;- }-- if (result.status === 'no-slots' || result.suggestions.length === 0) {- toast.info("No auto-zoom slots available", {- description: "Detected dwell points overlap existing zoom regions.",- });- return;- }-- for (const region of result.suggestions) {- onZoomSuggested({ start: region.start, end: region.end }, region.focus);- }-- toast.success(`Added ${result.suggestions.length} interaction-based zoom suggestion${result.suggestions.length === 1 ? "" : "s"}`);- }, [- videoDuration,- totalMs,- defaultRegionDurationMs,- zoomRegions,- disableSuggestedZooms,- onZoomSuggested,- cursorTelemetry,- ]);-- useEffect(() => {- if (autoSuggestZoomsTrigger <= 0) {- return;- }-- onAutoSuggestZoomsConsumed?.();-- handleSuggestZooms();- }, [autoSuggestZoomsTrigger, handleSuggestZooms, onAutoSuggestZoomsConsumed]);-- const handleAddTrim = useCallback(() => {- if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onTrimAdded) {- return;- }-- const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);- if (defaultDuration <= 0) {- return;- }-- // Always place trim at playhead- const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));- // Find the next trim region after the playhead- const sorted = [...trimRegions].sort((a, b) => a.startMs - b.startMs);- const nextRegion = sorted.find(region => region.startMs > startPos);- const gapToNext = nextRegion ? nextRegion.startMs - startPos : totalMs - startPos;-- // Check if playhead is inside any trim region- const isOverlapping = sorted.some(region => startPos >= region.startMs && startPos < region.endMs);- if (isOverlapping || gapToNext <= 0) {- toast.error("Cannot place trim here", {- description: "Trim already exists at this location or not enough space available.",- });- return;- }-- const actualDuration = Math.min(defaultRegionDurationMs, gapToNext);- onTrimAdded({ start: startPos, end: startPos + actualDuration });- }, [videoDuration, totalMs, currentTimeMs, trimRegions, onTrimAdded, defaultRegionDurationMs]);-- const handleSplitClip = useCallback(() => {- if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onClipSplit) {- return;- }- onClipSplit(currentTimeMs);- }, [videoDuration, totalMs, currentTimeMs, onClipSplit]);-- const handleAddSpeed = useCallback(() => {- if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onSpeedAdded) {- return;- }-- const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);- if (defaultDuration <= 0) {- return;- }-- // Always place speed region at playhead- const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));- // Find the next speed region after the playhead- const sorted = [...speedRegions].sort((a, b) => a.startMs - b.startMs);- const nextRegion = sorted.find(region => region.startMs > startPos);- const gapToNext = nextRegion ? nextRegion.startMs - startPos : totalMs - startPos;-- // Check if playhead is inside any speed region- const isOverlapping = sorted.some(region => startPos >= region.startMs && startPos < region.endMs);- if (isOverlapping || gapToNext <= 0) {- toast.error("Cannot place speed here", {- description: "Speed region already exists at this location or not enough space available.",- });- return;- }-- const actualDuration = Math.min(defaultRegionDurationMs, gapToNext);- onSpeedAdded({ start: startPos, end: startPos + actualDuration });- }, [videoDuration, totalMs, currentTimeMs, speedRegions, onSpeedAdded, defaultRegionDurationMs]);-- const handleAddAudio = useCallback(async () => {- if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onAudioAdded) {- return;- }-- const result = await (window as any).electronAPI.openAudioFilePicker();- if (!result?.success || !result.path) {- return;- }-- const audioPath = result.path;-- // Load the audio file to get its full duration- const audioDurationMs = await new Promise<number>((resolve) => {- const audio = new Audio(toFileUrl(audioPath));- audio.addEventListener('loadedmetadata', () => {- resolve(Math.round(audio.duration * 1000));- });- audio.addEventListener('error', () => {- resolve(0);- });- });-- if (audioDurationMs <= 0) {- toast.error("Could not read audio file", {- description: "The selected file may be corrupted or in an unsupported format.",- });- return;- }-- const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));- const sorted = [...audioRegions].sort((a, b) => a.startMs - b.startMs);- const nextRegion = sorted.find(region => region.startMs > startPos);- const gapToNext = nextRegion ? nextRegion.startMs - startPos : totalMs - startPos;-- const isOverlapping = sorted.some(region => startPos >= region.startMs && startPos < region.endMs);- if (isOverlapping || gapToNext <= 0) {- toast.error("Cannot place audio here", {- description: "Audio region already exists at this location or not enough space available.",- });- return;- }-- // Use full audio duration, but clamp to available gap and video length- const actualDuration = Math.min(audioDurationMs, gapToNext, totalMs - startPos);- onAudioAdded({ start: startPos, end: startPos + actualDuration }, result.path);- }, [videoDuration, totalMs, currentTimeMs, audioRegions, onAudioAdded]);-- const handleAddAnnotation = useCallback(() => {- if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onAnnotationAdded) {- return;- }-- const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);- if (defaultDuration <= 0) {- return;- }-- // Multiple annotations can exist at the same timestamp- const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));- const endPos = Math.min(startPos + defaultDuration, totalMs);-- onAnnotationAdded({ start: startPos, end: endPos });- }, [videoDuration, totalMs, currentTimeMs, onAnnotationAdded, defaultRegionDurationMs]);-- useEffect(() => {- const handleKeyDown = (e: KeyboardEvent) => {- if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {- return;- }-- if (matchesShortcut(e, { key: 'a', ctrl: true }, isMac)) {- if (!hasAnyTimelineBlocks || !isTimelineFocusedRef.current) {- return;- }-- e.preventDefault();- setSelectedKeyframeId(null);- setSelectAllBlocksActive(true);- return;- }-- if (matchesShortcut(e, keyShortcuts.addKeyframe, isMac)) {- addKeyframe();- }- if (matchesShortcut(e, keyShortcuts.addZoom, isMac)) {- handleAddZoom();- }- if (matchesShortcut(e, keyShortcuts.addTrim, isMac)) {- handleAddTrim();- }- if (matchesShortcut(e, keyShortcuts.splitClip, isMac)) {- handleSplitClip();- }- if (matchesShortcut(e, keyShortcuts.addAnnotation, isMac)) {- handleAddAnnotation();- }- if (matchesShortcut(e, keyShortcuts.addSpeed, isMac)) {- handleAddSpeed();- }-- // Tab: Cycle through overlapping annotations at current time- if (e.key === 'Tab' && annotationRegions.length > 0) {- const currentTimeMs = Math.round(currentTime * 1000);- const overlapping = annotationRegions- .filter(a => currentTimeMs >= a.startMs && currentTimeMs <= a.endMs)- .sort((a, b) => a.zIndex - b.zIndex); // Sort by z-index-- if (overlapping.length > 0) {- e.preventDefault();-- if (!selectedAnnotationId || !overlapping.some(a => a.id === selectedAnnotationId)) {- onSelectAnnotation?.(overlapping[0].id);- } else {- // Cycle to next annotation- const currentIndex = overlapping.findIndex(a => a.id === selectedAnnotationId);- const nextIndex = e.shiftKey- ? (currentIndex - 1 + overlapping.length) % overlapping.length // Shift+Tab = backward- : (currentIndex + 1) % overlapping.length; // Tab = forward- onSelectAnnotation?.(overlapping[nextIndex].id);- }- }- }- // Delete key or Ctrl+D / Cmd+D- if (e.key === 'Delete' || e.key === 'Backspace' || matchesShortcut(e, keyShortcuts.deleteSelected, isMac)) {- if (selectAllBlocksActive) {- e.preventDefault();- deleteAllBlocks();- } else if (selectedKeyframeId) {- deleteSelectedKeyframe();- } else if (selectedZoomId) {- deleteSelectedZoom();- } else if (selectedTrimId) {- deleteSelectedTrim();- } else if (selectedClipId) {- deleteSelectedClip();- } else if (selectedAnnotationId) {- deleteSelectedAnnotation();- } else if (selectedSpeedId) {- deleteSelectedSpeed();- } else if (selectedAudioId) {- deleteSelectedAudio();- }- }- };- window.addEventListener('keydown', handleKeyDown);- return () => window.removeEventListener('keydown', handleKeyDown);- }, [addKeyframe, handleAddZoom, handleAddTrim, handleSplitClip, handleAddAnnotation, handleAddSpeed, deleteAllBlocks, deleteSelectedKeyframe, deleteSelectedZoom, deleteSelectedTrim, deleteSelectedClip, deleteSelectedAnnotation, deleteSelectedSpeed, deleteSelectedAudio, selectedKeyframeId, selectedZoomId, selectedTrimId, selectedClipId, selectedAnnotationId, selectedSpeedId, selectedAudioId, annotationRegions, currentTime, hasAnyTimelineBlocks, onSelectAnnotation, keyShortcuts, isMac, selectAllBlocksActive]);-- const clampedRange = useMemo<Range>(() => {- if (totalMs === 0) {- return range;- }-- return {- start: Math.max(0, Math.min(range.start, totalMs)),- end: Math.min(range.end, totalMs),- };- }, [range, totalMs]);-- const timelineItems = useMemo<TimelineRenderItem[]>(() => {- const zooms: TimelineRenderItem[] = zoomRegions.map((region, index) => ({- id: region.id,- rowId: ZOOM_ROW_ID,- span: { start: region.startMs, end: region.endMs },- label: `Zoom ${index + 1}`,- zoomDepth: region.depth,- variant: 'zoom',- }));-- const clips: TimelineRenderItem[] = clipRegions.map((region, index) => ({- id: region.id,- rowId: CLIP_ROW_ID,- span: { start: region.startMs, end: region.endMs },- label: `Clip ${index + 1}`,- variant: 'clip',- }));-- const annotations: TimelineRenderItem[] = annotationRegions.map((region) => {- let label: string;-- if (region.type === 'text') {- // Show text preview- const preview = region.content.trim() || 'Empty text';- label = preview.length > 20 ? `${preview.substring(0, 20)}...` : preview;- } else if (region.type === 'image') {- label = 'Image';- } else {- label = 'Annotation';- }-- return {- id: region.id,- rowId: ANNOTATION_ROW_ID,- span: { start: region.startMs, end: region.endMs },- label,- variant: 'annotation',- };- });-- const audios: TimelineRenderItem[] = audioRegions.map((region) => {- const fileName = region.audioPath.split(/[\\/]/).pop()?.replace(/\.[^.]+$/, '') || 'Audio';- return {- id: region.id,- rowId: AUDIO_ROW_ID,- span: { start: region.startMs, end: region.endMs },- label: fileName,- variant: 'audio',- };- });-- return [...zooms, ...clips, ...annotations, ...audios];- }, [zoomRegions, clipRegions, annotationRegions, audioRegions]);-- // Flat list of draggable row spans for neighbour-clamping during drag/resize.- const allRegionSpans = useMemo(() => {- const zooms = zoomRegions.map((r) => ({ id: r.id, start: r.startMs, end: r.endMs, rowId: ZOOM_ROW_ID }));- const clips = clipRegions.map((r) => ({ id: r.id, start: r.startMs, end: r.endMs, rowId: CLIP_ROW_ID }));- const audios = audioRegions.map((r) => ({ id: r.id, start: r.startMs, end: r.endMs, rowId: AUDIO_ROW_ID }));- return [...zooms, ...clips, ...audios];- }, [zoomRegions, clipRegions, audioRegions]);-- const handleItemSpanChange = useCallback((id: string, span: Span) => {- // Check if it's a zoom, trim, clip, speed, or annotation item- if (zoomRegions.some(r => r.id === id)) {- onZoomSpanChange(id, span);- } else if (clipRegions.some(r => r.id === id)) {- onClipSpanChange?.(id, span);- } else if (annotationRegions.some(r => r.id === id)) {- onAnnotationSpanChange?.(id, span);- } else if (audioRegions.some(r => r.id === id)) {- onAudioSpanChange?.(id, span);- }- }, [zoomRegions, clipRegions, annotationRegions, audioRegions, onZoomSpanChange, onClipSpanChange, onAnnotationSpanChange, onAudioSpanChange]);-- const panTimelineRange = useCallback((deltaMs: number) => {- if (!Number.isFinite(deltaMs) || deltaMs === 0 || totalMs <= 0) {- return;- }-- setRange((previous) => {- const visibleSpan = Math.max(1, previous.end - previous.start);- const maxStart = Math.max(0, totalMs - visibleSpan);- const nextStart = Math.max(0, Math.min(previous.start + deltaMs, maxStart));-- return {- start: nextStart,- end: nextStart + visibleSpan,- };- });- }, [totalMs]);-- const handleTimelineWheel = useCallback((event: WheelEvent<HTMLDivElement>) => {- if (event.ctrlKey || event.metaKey || totalMs <= 0) {- return;- }-- const rawHorizontalDelta = Math.abs(event.deltaX) > 0- ? event.deltaX- : event.shiftKey && Math.abs(event.deltaY) > 0- ? event.deltaY- : 0;-- if (rawHorizontalDelta === 0) {- return;- }-- const containerWidth = timelineContainerRef.current?.clientWidth ?? 0;- const visibleRangeMs = clampedRange.end - clampedRange.start;-- if (containerWidth <= 0 || visibleRangeMs <= 0) {- return;- }-- event.preventDefault();-- const horizontalDeltaPx = normalizeWheelDeltaToPixels(rawHorizontalDelta, event.deltaMode);- const deltaMs = (horizontalDeltaPx / containerWidth) * visibleRangeMs;-- panTimelineRange(deltaMs);- }, [clampedRange.end, clampedRange.start, panTimelineRange, totalMs]);-- if (!videoDuration || videoDuration === 0) {- return (- <div className="flex-1 flex flex-col items-center justify-center rounded-lg bg-[#17171a] gap-3">- <div className="w-12 h-12 rounded-full bg-white/5 flex items-center justify-center">- <Plus className="w-6 h-6 text-slate-600" />- </div>- <div className="text-center">- <p className="text-sm font-medium text-slate-300">No Video Loaded</p>- <p className="text-xs text-slate-500 mt-1">Drag and drop a video to start editing</p>- </div>- </div>- );- }-- return (- <div className="flex-1 min-h-0 flex flex-col bg-[#17171a] overflow-auto">- <div className="flex items-center gap-2 px-4 py-2 border-b border-white/10 bg-[#161619]">- <div className="flex items-center gap-1">- <Button- onClick={handleAddZoom}- variant="ghost"- size="icon"- className="h-7 w-7 text-slate-400 hover:text-[#2563EB] hover:bg-[#2563EB]/10 transition-all"- title="Add Zoom (Z)"- >- <ZoomIn className="w-4 h-4" />- </Button>- <Button- onClick={handleSuggestZooms}- variant="ghost"- size="icon"- className="h-7 w-7 text-slate-400 hover:text-[#2563EB] hover:bg-[#2563EB]/10 transition-all"- title="Suggest Zooms from Cursor"- >- <WandSparkles className="w-4 h-4" />- </Button>- <Button- onClick={handleAddAnnotation}- variant="ghost"- size="icon"- className="h-7 w-7 text-slate-400 hover:text-[#B4A046] hover:bg-[#B4A046]/10 transition-all"- title="Add Annotation (A)"- >- <MessageSquare className="w-4 h-4" />- </Button>- <Button- onClick={handleAddAudio}- variant="ghost"- size="icon"- className="h-7 w-7 text-slate-400 hover:text-[#a855f7] hover:bg-[#a855f7]/10 transition-all"- title="Add Audio"- >- <Music className="w-4 h-4" />- </Button>- <Button- onClick={handleSplitClip}- variant="ghost"- size="icon"- className="h-7 w-7 text-slate-400 hover:text-white hover:bg-white/10 transition-all"- title="Split Clip (C)"- >- <Scissors className="w-4 h-4" />- </Button>- </div>- <div className="flex items-center gap-2">- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button- variant="ghost"- size="sm"- className="h-7 px-2 text-xs text-slate-400 hover:text-slate-200 hover:bg-white/10 transition-all gap-1"- >- <span className="font-medium">{getAspectRatioLabel(aspectRatio)}</span>- <ChevronDown className="w-3 h-3" />- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end" className="bg-[#1a1a1c] border-white/10">- {ASPECT_RATIOS.map((ratio) => (- <DropdownMenuItem- key={ratio}- onClick={() => onAspectRatioChange(ratio)}- className="text-slate-300 hover:text-white hover:bg-white/10 cursor-pointer flex items-center justify-between gap-3"- >- <span>{getAspectRatioLabel(ratio)}</span>- {aspectRatio === ratio && <Check className="w-3 h-3 text-[#2563EB]" />}- </DropdownMenuItem>- ))}- <div className="mx-1 my-1 h-px bg-white/10" />- <div className="px-2 py-1.5 flex items-center gap-2 text-slate-300">- <span className="text-sm">Custom</span>- <input- type="text"- inputMode="numeric"- value={customAspectWidth}- onChange={(event) => setCustomAspectWidth(event.target.value.replace(/\D/g, ''))}- onKeyDown={handleCustomAspectRatioKeyDown}- className="w-12 h-7 rounded border border-white/15 bg-black/20 px-1.5 text-sm text-slate-100 focus:outline-none focus:ring-1 focus:ring-[#2563EB]"- aria-label="Custom aspect width"- />- <span className="text-slate-500">:</span>- <input- type="text"- inputMode="numeric"- value={customAspectHeight}- onChange={(event) => setCustomAspectHeight(event.target.value.replace(/\D/g, ''))}- onKeyDown={handleCustomAspectRatioKeyDown}- className="w-12 h-7 rounded border border-white/15 bg-black/20 px-1.5 text-sm text-slate-100 focus:outline-none focus:ring-1 focus:ring-[#2563EB]"- aria-label="Custom aspect height"- />- <Button- variant="ghost"- size="sm"- onClick={applyCustomAspectRatio}- className="h-7 px-2 text-xs text-slate-300 hover:text-white hover:bg-white/10"- >- Set- </Button>- {isCustomAspectRatio(aspectRatio) && <Check className="w-3 h-3 text-[#2563EB] ml-auto" />}- </div>- </DropdownMenuContent>- </DropdownMenu>- <div className="w-[1px] h-4 bg-white/10" />- <Button- variant="ghost"- size="sm"- onClick={() => onOpenCropEditor?.()}- className="h-7 px-2 text-xs text-slate-400 hover:text-slate-200 hover:bg-white/10 transition-all gap-1.5"- >- <Crop className="w-3.5 h-3.5" />- <span className="font-medium">{t("sections.crop", "Crop")}</span>- {isCropped ? <span className="h-1.5 w-1.5 rounded-full bg-[#2563EB]" /> : null}- </Button>- </div>- <div className="flex-1" />- <div className="flex items-center gap-4 text-[10px] text-slate-500 font-medium">- <span className="flex items-center gap-1.5">- <kbd className="px-1.5 py-0.5 bg-white/5 border border-white/10 rounded text-[#2563EB] font-sans">Side Scroll</kbd>- <span>Pan</span>- </span>- <span className="flex items-center gap-1.5">- <kbd className="px-1.5 py-0.5 bg-white/5 border border-white/10 rounded text-[#2563EB] font-sans">{scrollLabels.pan}</kbd>- <span>Pan</span>- </span>- <span className="flex items-center gap-1.5">- <kbd className="px-1.5 py-0.5 bg-white/5 border border-white/10 rounded text-[#2563EB] font-sans">{scrollLabels.zoom}</kbd>- <span>Zoom</span>- </span>- </div>- </div>- <div- ref={timelineContainerRef}- className="flex-1 min-h-0 overflow-auto bg-[#17171a] relative"- tabIndex={0}- onFocus={() => {- isTimelineFocusedRef.current = true;- }}- onBlur={() => {- isTimelineFocusedRef.current = false;- }}- onMouseDown={() => {- timelineContainerRef.current?.focus();- isTimelineFocusedRef.current = true;- }}- onClick={() => {- setSelectedKeyframeId(null);- setSelectAllBlocksActive(false);- }}- onWheel={handleTimelineWheel}- >- <TimelineWrapper- range={clampedRange}- videoDuration={videoDuration}- hasOverlap={hasOverlap}- onRangeChange={setRange}- minItemDurationMs={timelineScale.minItemDurationMs}- minVisibleRangeMs={timelineScale.minVisibleRangeMs}- onItemSpanChange={handleItemSpanChange}- allRegionSpans={allRegionSpans}- >- <KeyframeMarkers- keyframes={keyframes}- selectedKeyframeId={selectedKeyframeId}- setSelectedKeyframeId={setSelectedKeyframeId}- onKeyframeMove={handleKeyframeMove}- videoDurationMs={totalMs}- timelineRef={timelineContainerRef}- />- <Timeline- items={timelineItems}- videoDurationMs={totalMs}- currentTimeMs={currentTimeMs}- onSeek={onSeek}- onSelectZoom={handleSelectZoom}- onSelectTrim={handleSelectTrim}- onSelectClip={handleSelectClip}- onSelectAnnotation={handleSelectAnnotation}- onSelectSpeed={handleSelectSpeed}- onSelectAudio={handleSelectAudio}- selectedZoomId={selectedZoomId}- selectedTrimId={selectedTrimId}- selectedClipId={selectedClipId}- selectedAnnotationId={selectedAnnotationId}- selectedSpeedId={selectedSpeedId}- selectedAudioId={selectedAudioId}- selectAllBlocksActive={selectAllBlocksActive}- onClearBlockSelection={clearSelectedBlocks}- keyframes={keyframes}- audioPeaks={audioPeaks}- />- </TimelineWrapper>- </div>- </div>- );+ const t = useScopedT("settings");+ const initialEditorPreferences = useMemo(() => loadEditorPreferences(), []);+ const totalMs = useMemo(() => Math.max(0, Math.round(videoDuration * 1000)), [videoDuration]);+ const currentTimeMs = useMemo(() => Math.round(currentTime * 1000), [currentTime]);+ const timelineScale = useMemo(() => calculateTimelineScale(videoDuration), [videoDuration]);+ const safeMinDurationMs = useMemo(+ () =>+ totalMs > 0+ ? Math.min(timelineScale.minItemDurationMs, totalMs)+ : timelineScale.minItemDurationMs,+ [timelineScale.minItemDurationMs, totalMs],+ );++ const [range, setRange] = useState<Range>(() => createInitialRange(totalMs));+ const [keyframes, setKeyframes] = useState<{ id: string; time: number }[]>([]);+ const [selectedKeyframeId, setSelectedKeyframeId] = useState<string | null>(null);+ const [selectAllBlocksActive, setSelectAllBlocksActive] = useState(false);+ const [customAspectWidth, setCustomAspectWidth] = useState(+ initialEditorPreferences.customAspectWidth,+ );+ const [customAspectHeight, setCustomAspectHeight] = useState(+ initialEditorPreferences.customAspectHeight,+ );+ const [scrollLabels, setScrollLabels] = useState({+ pan: "Shift + Ctrl + Scroll",+ zoom: "Ctrl + Scroll",+ });+ const isTimelineFocusedRef = useRef(false);+ const timelineContainerRef = useRef<HTMLDivElement>(null);+ const { shortcuts: keyShortcuts, isMac } = useShortcuts();+ const audioPeaks = useAudioPeaks(videoPath);++ useEffect(() => {+ setRange(createInitialRange(totalMs));+ }, [totalMs]);++ useEffect(() => {+ if (aspectRatio === "native") {+ return;+ }+ const [width, height] = aspectRatio.split(":");+ if (width && height) {+ setCustomAspectWidth(width);+ setCustomAspectHeight(height);+ }+ }, [aspectRatio]);++ useEffect(() => {+ saveEditorPreferences({+ customAspectWidth,+ customAspectHeight,+ });+ }, [customAspectHeight, customAspectWidth]);++ const applyCustomAspectRatio = useCallback(() => {+ const width = Number.parseInt(customAspectWidth, 10);+ const height = Number.parseInt(customAspectHeight, 10);+ if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {+ toast.error("Custom aspect ratio must be positive numbers.");+ return;+ }+ onAspectRatioChange(`${width}:${height}` as AspectRatio);+ }, [customAspectHeight, customAspectWidth, onAspectRatioChange]);++ const handleCustomAspectRatioKeyDown = useCallback(+ (event: ReactKeyboardEvent<HTMLInputElement>) => {+ // Prevent Radix DropdownMenu typeahead from selecting preset items while typing.+ event.stopPropagation();+ if (event.key === "Enter") {+ event.preventDefault();+ applyCustomAspectRatio();+ }+ },+ [applyCustomAspectRatio],+ );++ useEffect(() => {+ formatShortcut(["shift", "mod", "Scroll"]).then((pan) => {+ formatShortcut(["mod", "Scroll"]).then((zoom) => {+ setScrollLabels({ pan, zoom });+ });+ });+ }, []);++ // Add keyframe at current playhead position+ const addKeyframe = useCallback(() => {+ if (totalMs === 0) return;+ const time = Math.max(0, Math.min(currentTimeMs, totalMs));+ if (keyframes.some((kf) => Math.abs(kf.time - time) < 1)) return;+ setKeyframes((prev) => [...prev, { id: uuidv4(), time }]);+ }, [currentTimeMs, totalMs, keyframes]);++ // Delete selected keyframe+ const deleteSelectedKeyframe = useCallback(() => {+ if (!selectedKeyframeId) return;+ setKeyframes((prev) => prev.filter((kf) => kf.id !== selectedKeyframeId));+ setSelectedKeyframeId(null);+ }, [selectedKeyframeId]);++ // Move keyframe to new time position+ const handleKeyframeMove = useCallback(+ (id: string, newTime: number) => {+ setKeyframes((prev) =>+ prev.map((kf) =>+ kf.id === id ? { ...kf, time: Math.max(0, Math.min(newTime, totalMs)) } : kf,+ ),+ );+ },+ [totalMs],+ );++ // Delete selected zoom item+ const deleteSelectedZoom = useCallback(() => {+ if (!selectedZoomId) return;+ onZoomDelete(selectedZoomId);+ onSelectZoom(null);+ }, [selectedZoomId, onZoomDelete, onSelectZoom]);++ // Delete selected trim item+ const deleteSelectedTrim = useCallback(() => {+ if (!selectedTrimId || !onTrimDelete || !onSelectTrim) return;+ onTrimDelete(selectedTrimId);+ onSelectTrim(null);+ }, [selectedTrimId, onTrimDelete, onSelectTrim]);++ const deleteSelectedClip = useCallback(() => {+ if (!selectedClipId || !onClipDelete || !onSelectClip) return;+ onClipDelete(selectedClipId);+ onSelectClip(null);+ }, [selectedClipId, onClipDelete, onSelectClip]);++ const deleteSelectedAnnotation = useCallback(() => {+ if (!selectedAnnotationId || !onAnnotationDelete || !onSelectAnnotation) return;+ onAnnotationDelete(selectedAnnotationId);+ onSelectAnnotation(null);+ }, [selectedAnnotationId, onAnnotationDelete, onSelectAnnotation]);++ const deleteSelectedSpeed = useCallback(() => {+ if (!selectedSpeedId || !onSpeedDelete || !onSelectSpeed) return;+ onSpeedDelete(selectedSpeedId);+ onSelectSpeed(null);+ }, [selectedSpeedId, onSpeedDelete, onSelectSpeed]);++ const deleteSelectedAudio = useCallback(() => {+ if (!selectedAudioId || !onAudioDelete || !onSelectAudio) return;+ onAudioDelete(selectedAudioId);+ onSelectAudio(null);+ }, [selectedAudioId, onAudioDelete, onSelectAudio]);++ const clearSelectedBlocks = useCallback(() => {+ onSelectZoom(null);+ onSelectTrim?.(null);+ onSelectClip?.(null);+ onSelectAnnotation?.(null);+ onSelectSpeed?.(null);+ onSelectAudio?.(null);+ setSelectAllBlocksActive(false);+ }, [+ onSelectAnnotation,+ onSelectAudio,+ onSelectClip,+ onSelectSpeed,+ onSelectTrim,+ onSelectZoom,+ ]);++ const hasAnyTimelineBlocks =+ zoomRegions.length > 0 ||+ trimRegions.length > 0 ||+ clipRegions.length > 0 ||+ annotationRegions.length > 0 ||+ speedRegions.length > 0 ||+ audioRegions.length > 0;++ const deleteAllBlocks = useCallback(() => {+ const zoomIds = zoomRegions.map((region) => region.id);+ const trimIds = trimRegions.map((region) => region.id);+ const clipIds = clipRegions.map((region) => region.id);+ const annotationIds = annotationRegions.map((region) => region.id);+ const speedIds = speedRegions.map((region) => region.id);+ const audioIds = audioRegions.map((region) => region.id);++ zoomIds.forEach((id) => onZoomDelete(id));+ trimIds.forEach((id) => onTrimDelete?.(id));+ clipIds.forEach((id) => onClipDelete?.(id));+ annotationIds.forEach((id) => onAnnotationDelete?.(id));+ speedIds.forEach((id) => onSpeedDelete?.(id));+ audioIds.forEach((id) => onAudioDelete?.(id));++ clearSelectedBlocks();+ setSelectedKeyframeId(null);+ }, [+ annotationRegions,+ audioRegions,+ clearSelectedBlocks,+ clipRegions,+ onAnnotationDelete,+ onAudioDelete,+ onClipDelete,+ onSpeedDelete,+ onTrimDelete,+ onZoomDelete,+ speedRegions,+ trimRegions,+ zoomRegions,+ ]);++ const handleSelectZoom = useCallback(+ (id: string | null) => {+ setSelectAllBlocksActive(false);+ onSelectZoom(id);+ },+ [onSelectZoom],+ );++ const handleSelectTrim = useCallback(+ (id: string | null) => {+ setSelectAllBlocksActive(false);+ onSelectTrim?.(id);+ },+ [onSelectTrim],+ );++ const handleSelectClip = useCallback(+ (id: string | null) => {+ setSelectAllBlocksActive(false);+ onSelectClip?.(id);+ },+ [onSelectClip],+ );++ const handleSelectAnnotation = useCallback(+ (id: string | null) => {+ setSelectAllBlocksActive(false);+ onSelectAnnotation?.(id);+ },+ [onSelectAnnotation],+ );++ const handleSelectSpeed = useCallback(+ (id: string | null) => {+ setSelectAllBlocksActive(false);+ onSelectSpeed?.(id);+ },+ [onSelectSpeed],+ );++ const handleSelectAudio = useCallback(+ (id: string | null) => {+ setSelectAllBlocksActive(false);+ onSelectAudio?.(id);+ },+ [onSelectAudio],+ );++ useEffect(() => {+ setRange(createInitialRange(totalMs));+ }, [totalMs]);++ // Normalize regions only when timeline bounds change (not on every region edit).+ // Using refs to read current regions avoids a dependency-loop that re-fires+ // this effect on every drag/resize and races with dnd-timeline's internal state.+ const zoomRegionsRef = useRef(zoomRegions);+ const trimRegionsRef = useRef(trimRegions);+ const speedRegionsRef = useRef(speedRegions);+ const audioRegionsRef = useRef(audioRegions);+ zoomRegionsRef.current = zoomRegions;+ trimRegionsRef.current = trimRegions;+ speedRegionsRef.current = speedRegions;+ audioRegionsRef.current = audioRegions;++ useEffect(() => {+ if (totalMs === 0 || safeMinDurationMs <= 0) {+ return;+ }++ zoomRegionsRef.current.forEach((region) => {+ const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));+ const minEnd = clampedStart + safeMinDurationMs;+ const clampedEnd = Math.min(totalMs, Math.max(minEnd, region.endMs));+ const normalizedStart = Math.max(+ 0,+ Math.min(clampedStart, totalMs - safeMinDurationMs),+ );+ const normalizedEnd = Math.max(minEnd, Math.min(clampedEnd, totalMs));++ if (normalizedStart !== region.startMs || normalizedEnd !== region.endMs) {+ onZoomSpanChange(region.id, { start: normalizedStart, end: normalizedEnd });+ }+ });++ trimRegionsRef.current.forEach((region) => {+ const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));+ const minEnd = clampedStart + safeMinDurationMs;+ const clampedEnd = Math.min(totalMs, Math.max(minEnd, region.endMs));+ const normalizedStart = Math.max(+ 0,+ Math.min(clampedStart, totalMs - safeMinDurationMs),+ );+ const normalizedEnd = Math.max(minEnd, Math.min(clampedEnd, totalMs));++ if (normalizedStart !== region.startMs || normalizedEnd !== region.endMs) {+ onTrimSpanChange?.(region.id, { start: normalizedStart, end: normalizedEnd });+ }+ });++ speedRegionsRef.current.forEach((region) => {+ const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));+ const minEnd = clampedStart + safeMinDurationMs;+ const clampedEnd = Math.min(totalMs, Math.max(minEnd, region.endMs));+ const normalizedStart = Math.max(+ 0,+ Math.min(clampedStart, totalMs - safeMinDurationMs),+ );+ const normalizedEnd = Math.max(minEnd, Math.min(clampedEnd, totalMs));++ if (normalizedStart !== region.startMs || normalizedEnd !== region.endMs) {+ onSpeedSpanChange?.(region.id, { start: normalizedStart, end: normalizedEnd });+ }+ });++ audioRegionsRef.current.forEach((region) => {+ const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));+ const minEnd = clampedStart + safeMinDurationMs;+ const clampedEnd = Math.min(totalMs, Math.max(minEnd, region.endMs));+ const normalizedStart = Math.max(+ 0,+ Math.min(clampedStart, totalMs - safeMinDurationMs),+ );+ const normalizedEnd = Math.max(minEnd, Math.min(clampedEnd, totalMs));++ if (normalizedStart !== region.startMs || normalizedEnd !== region.endMs) {+ onAudioSpanChange?.(region.id, { start: normalizedStart, end: normalizedEnd });+ }+ });+ // Only re-run when the timeline scale changes, not on every region edit+ }, [+ totalMs,+ safeMinDurationMs,+ onZoomSpanChange,+ onTrimSpanChange,+ onSpeedSpanChange,+ onAudioSpanChange,+ ]);++ const hasOverlap = useCallback(+ (newSpan: Span, excludeId?: string): boolean => {+ // Determine which row the item belongs to+ const isZoomItem = zoomRegions.some((r) => r.id === excludeId);+ const isTrimItem = trimRegions.some((r) => r.id === excludeId);+ const isClipItem = clipRegions.some((r) => r.id === excludeId);+ const isAnnotationItem = annotationRegions.some((r) => r.id === excludeId);+ const isSpeedItem = speedRegions.some((r) => r.id === excludeId);+ const isAudioItem = audioRegions.some((r) => r.id === excludeId);++ if (isAnnotationItem) {+ return false;+ }++ // Helper to check overlap against a specific set of regions+ const checkOverlap = (+ regions: (ZoomRegion | TrimRegion | ClipRegion | SpeedRegion | AudioRegion)[],+ ) => {+ return regions.some((region) => {+ if (region.id === excludeId) return false;+ // True overlap: regions actually intersect (not just adjacent)+ return newSpan.end > region.startMs && newSpan.start < region.endMs;+ });+ };++ if (isZoomItem) {+ return checkOverlap(zoomRegions);+ }++ if (isTrimItem) {+ return checkOverlap(trimRegions);+ }++ if (isClipItem) {+ return checkOverlap(clipRegions);+ }++ if (isSpeedItem) {+ return checkOverlap(speedRegions);+ }++ if (isAudioItem) {+ return checkOverlap(audioRegions);+ }++ return false;+ },+ [zoomRegions, trimRegions, clipRegions, annotationRegions, speedRegions, audioRegions],+ );++ // Keep newly added timeline regions at the original short default instead of+ // scaling them with the full recording length.+ const defaultRegionDurationMs = useMemo(() => Math.min(1000, totalMs), [totalMs]);++ const handleAddZoom = useCallback(() => {+ if (!videoDuration || videoDuration === 0 || totalMs === 0) {+ return;+ }++ const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);+ if (defaultDuration <= 0) {+ return;+ }++ // Always place zoom at playhead+ const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));+ // Find the next zoom region after the playhead+ const sorted = [...zoomRegions].sort((a, b) => a.startMs - b.startMs);+ const nextRegion = sorted.find((region) => region.startMs > startPos);+ const gapToNext = nextRegion ? nextRegion.startMs - startPos : totalMs - startPos;++ // Check if playhead is inside any zoom region+ const isOverlapping = sorted.some(+ (region) => startPos >= region.startMs && startPos < region.endMs,+ );+ if (isOverlapping || gapToNext <= 0) {+ toast.error("Cannot place zoom here", {+ description: "Zoom already exists at this location or not enough space available.",+ });+ return;+ }++ const actualDuration = Math.min(defaultRegionDurationMs, gapToNext);+ onZoomAdded({ start: startPos, end: startPos + actualDuration });+ }, [videoDuration, totalMs, currentTimeMs, zoomRegions, onZoomAdded, defaultRegionDurationMs]);++ const handleSuggestZooms = useCallback(() => {+ if (!videoDuration || videoDuration === 0 || totalMs === 0) {+ return;+ }++ if (disableSuggestedZooms) {+ toast.info("Suggested zooms are unavailable while cursor looping is enabled.");+ return;+ }++ if (!onZoomSuggested) {+ toast.error("Zoom suggestion handler unavailable");+ return;+ }++ if (cursorTelemetry.length < 2) {+ toast.info("No cursor telemetry available", {+ description: "Record a screencast first to generate cursor-based suggestions.",+ });+ return;+ }++ const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);+ if (defaultDuration <= 0) {+ return;+ }++ const result = buildInteractionZoomSuggestions({+ cursorTelemetry,+ totalMs,+ defaultDurationMs: defaultDuration,+ reservedSpans: zoomRegions+ .map((region) => ({ start: region.startMs, end: region.endMs }))+ .sort((a, b) => a.start - b.start),+ });++ if (result.status === "no-telemetry") {+ toast.info("No usable cursor telemetry", {+ description: "The recording does not include enough cursor movement data.",+ });+ return;+ }++ if (result.status === "no-interactions") {+ toast.info("No clear interaction moments found", {+ description: "Try a recording with pauses or clicks around important actions.",+ });+ return;+ }++ if (result.status === "no-slots" || result.suggestions.length === 0) {+ toast.info("No auto-zoom slots available", {+ description: "Detected dwell points overlap existing zoom regions.",+ });+ return;+ }++ for (const region of result.suggestions) {+ onZoomSuggested({ start: region.start, end: region.end }, region.focus);+ }++ toast.success(+ `Added ${result.suggestions.length} interaction-based zoom suggestion${result.suggestions.length === 1 ? "" : "s"}`,+ );+ }, [+ videoDuration,+ totalMs,+ defaultRegionDurationMs,+ zoomRegions,+ disableSuggestedZooms,+ onZoomSuggested,+ cursorTelemetry,+ ]);++ useEffect(() => {+ if (autoSuggestZoomsTrigger <= 0) {+ return;+ }++ onAutoSuggestZoomsConsumed?.();++ handleSuggestZooms();+ }, [autoSuggestZoomsTrigger, handleSuggestZooms, onAutoSuggestZoomsConsumed]);++ const handleAddTrim = useCallback(() => {+ if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onTrimAdded) {+ return;+ }++ const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);+ if (defaultDuration <= 0) {+ return;+ }++ // Always place trim at playhead+ const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));+ // Find the next trim region after the playhead+ const sorted = [...trimRegions].sort((a, b) => a.startMs - b.startMs);+ const nextRegion = sorted.find((region) => region.startMs > startPos);+ const gapToNext = nextRegion ? nextRegion.startMs - startPos : totalMs - startPos;++ // Check if playhead is inside any trim region+ const isOverlapping = sorted.some(+ (region) => startPos >= region.startMs && startPos < region.endMs,+ );+ if (isOverlapping || gapToNext <= 0) {+ toast.error("Cannot place trim here", {+ description: "Trim already exists at this location or not enough space available.",+ });+ return;+ }++ const actualDuration = Math.min(defaultRegionDurationMs, gapToNext);+ onTrimAdded({ start: startPos, end: startPos + actualDuration });+ }, [videoDuration, totalMs, currentTimeMs, trimRegions, onTrimAdded, defaultRegionDurationMs]);++ const handleSplitClip = useCallback(() => {+ if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onClipSplit) {+ return;+ }+ onClipSplit(currentTimeMs);+ }, [videoDuration, totalMs, currentTimeMs, onClipSplit]);++ const handleAddSpeed = useCallback(() => {+ if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onSpeedAdded) {+ return;+ }++ const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);+ if (defaultDuration <= 0) {+ return;+ }++ // Always place speed region at playhead+ const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));+ // Find the next speed region after the playhead+ const sorted = [...speedRegions].sort((a, b) => a.startMs - b.startMs);+ const nextRegion = sorted.find((region) => region.startMs > startPos);+ const gapToNext = nextRegion ? nextRegion.startMs - startPos : totalMs - startPos;++ // Check if playhead is inside any speed region+ const isOverlapping = sorted.some(+ (region) => startPos >= region.startMs && startPos < region.endMs,+ );+ if (isOverlapping || gapToNext <= 0) {+ toast.error("Cannot place speed here", {+ description:+ "Speed region already exists at this location or not enough space available.",+ });+ return;+ }++ const actualDuration = Math.min(defaultRegionDurationMs, gapToNext);+ onSpeedAdded({ start: startPos, end: startPos + actualDuration });+ }, [+ videoDuration,+ totalMs,+ currentTimeMs,+ speedRegions,+ onSpeedAdded,+ defaultRegionDurationMs,+ ]);++ const handleAddAudio = useCallback(async () => {+ if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onAudioAdded) {+ return;+ }++ const result = await window.electronAPI.openAudioFilePicker();+ if (!result?.success || !result.path) {+ return;+ }++ const audioPath = result.path;++ // Load the audio file to get its full duration+ const audioDurationMs = await new Promise<number>((resolve) => {+ const audio = new Audio(toFileUrl(audioPath));+ audio.addEventListener("loadedmetadata", () => {+ resolve(Math.round(audio.duration * 1000));+ });+ audio.addEventListener("error", () => {+ resolve(0);+ });+ });++ if (audioDurationMs <= 0) {+ toast.error("Could not read audio file", {+ description: "The selected file may be corrupted or in an unsupported format.",+ });+ return;+ }++ const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));+ const sorted = [...audioRegions].sort((a, b) => a.startMs - b.startMs);+ const nextRegion = sorted.find((region) => region.startMs > startPos);+ const gapToNext = nextRegion ? nextRegion.startMs - startPos : totalMs - startPos;++ const isOverlapping = sorted.some(+ (region) => startPos >= region.startMs && startPos < region.endMs,+ );+ if (isOverlapping || gapToNext <= 0) {+ toast.error("Cannot place audio here", {+ description:+ "Audio region already exists at this location or not enough space available.",+ });+ return;+ }++ // Use full audio duration, but clamp to available gap and video length+ const actualDuration = Math.min(audioDurationMs, gapToNext, totalMs - startPos);+ onAudioAdded({ start: startPos, end: startPos + actualDuration }, result.path);+ }, [videoDuration, totalMs, currentTimeMs, audioRegions, onAudioAdded]);++ const handleAddAnnotation = useCallback(() => {+ if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onAnnotationAdded) {+ return;+ }++ const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);+ if (defaultDuration <= 0) {+ return;+ }++ // Multiple annotations can exist at the same timestamp+ const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));+ const endPos = Math.min(startPos + defaultDuration, totalMs);++ onAnnotationAdded({ start: startPos, end: endPos });+ }, [videoDuration, totalMs, currentTimeMs, onAnnotationAdded, defaultRegionDurationMs]);++ useEffect(() => {+ const handleKeyDown = (e: KeyboardEvent) => {+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {+ return;+ }++ if (matchesShortcut(e, { key: "a", ctrl: true }, isMac)) {+ if (!hasAnyTimelineBlocks || !isTimelineFocusedRef.current) {+ return;+ }++ e.preventDefault();+ setSelectedKeyframeId(null);+ setSelectAllBlocksActive(true);+ return;+ }++ if (matchesShortcut(e, keyShortcuts.addKeyframe, isMac)) {+ addKeyframe();+ }+ if (matchesShortcut(e, keyShortcuts.addZoom, isMac)) {+ handleAddZoom();+ }+ if (matchesShortcut(e, keyShortcuts.addTrim, isMac)) {+ handleAddTrim();+ }+ if (matchesShortcut(e, keyShortcuts.splitClip, isMac)) {+ handleSplitClip();+ }+ if (matchesShortcut(e, keyShortcuts.addAnnotation, isMac)) {+ handleAddAnnotation();+ }+ if (matchesShortcut(e, keyShortcuts.addSpeed, isMac)) {+ handleAddSpeed();+ }++ // Tab: Cycle through overlapping annotations at current time+ if (e.key === "Tab" && annotationRegions.length > 0) {+ const currentTimeMs = Math.round(currentTime * 1000);+ const overlapping = annotationRegions+ .filter((a) => currentTimeMs >= a.startMs && currentTimeMs <= a.endMs)+ .sort((a, b) => a.zIndex - b.zIndex); // Sort by z-index++ if (overlapping.length > 0) {+ e.preventDefault();++ if (+ !selectedAnnotationId ||+ !overlapping.some((a) => a.id === selectedAnnotationId)+ ) {+ onSelectAnnotation?.(overlapping[0].id);+ } else {+ // Cycle to next annotation+ const currentIndex = overlapping.findIndex(+ (a) => a.id === selectedAnnotationId,+ );+ const nextIndex = e.shiftKey+ ? (currentIndex - 1 + overlapping.length) % overlapping.length // Shift+Tab = backward+ : (currentIndex + 1) % overlapping.length; // Tab = forward+ onSelectAnnotation?.(overlapping[nextIndex].id);+ }+ }+ }+ // Delete key or Ctrl+D / Cmd+D+ if (+ e.key === "Delete" ||+ e.key === "Backspace" ||+ matchesShortcut(e, keyShortcuts.deleteSelected, isMac)+ ) {+ if (selectAllBlocksActive) {+ e.preventDefault();+ deleteAllBlocks();+ } else if (selectedKeyframeId) {+ deleteSelectedKeyframe();+ } else if (selectedZoomId) {+ deleteSelectedZoom();+ } else if (selectedTrimId) {+ deleteSelectedTrim();+ } else if (selectedClipId) {+ deleteSelectedClip();+ } else if (selectedAnnotationId) {+ deleteSelectedAnnotation();+ } else if (selectedSpeedId) {+ deleteSelectedSpeed();+ } else if (selectedAudioId) {+ deleteSelectedAudio();+ }+ }+ };+ window.addEventListener("keydown", handleKeyDown);+ return () => window.removeEventListener("keydown", handleKeyDown);+ }, [+ addKeyframe,+ handleAddZoom,+ handleAddTrim,+ handleSplitClip,+ handleAddAnnotation,+ handleAddSpeed,+ deleteAllBlocks,+ deleteSelectedKeyframe,+ deleteSelectedZoom,+ deleteSelectedTrim,+ deleteSelectedClip,+ deleteSelectedAnnotation,+ deleteSelectedSpeed,+ deleteSelectedAudio,+ selectedKeyframeId,+ selectedZoomId,+ selectedTrimId,+ selectedClipId,+ selectedAnnotationId,+ selectedSpeedId,+ selectedAudioId,+ annotationRegions,+ currentTime,+ hasAnyTimelineBlocks,+ onSelectAnnotation,+ keyShortcuts,+ isMac,+ selectAllBlocksActive,+ ]);++ const clampedRange = useMemo<Range>(() => {+ if (totalMs === 0) {+ return range;+ }++ return {+ start: Math.max(0, Math.min(range.start, totalMs)),+ end: Math.min(range.end, totalMs),+ };+ }, [range, totalMs]);++ const timelineItems = useMemo<TimelineRenderItem[]>(() => {+ const zooms: TimelineRenderItem[] = zoomRegions.map((region, index) => ({+ id: region.id,+ rowId: ZOOM_ROW_ID,+ span: { start: region.startMs, end: region.endMs },+ label: `Zoom ${index + 1}`,+ zoomDepth: region.depth,+ variant: "zoom",+ }));++ const clips: TimelineRenderItem[] = clipRegions.map((region, index) => ({+ id: region.id,+ rowId: CLIP_ROW_ID,+ span: { start: region.startMs, end: region.endMs },+ label: `Clip ${index + 1}`,+ variant: "clip",+ }));++ const annotations: TimelineRenderItem[] = annotationRegions.map((region) => {+ let label: string;++ if (region.type === "text") {+ // Show text preview+ const preview = region.content.trim() || "Empty text";+ label = preview.length > 20 ? `${preview.substring(0, 20)}...` : preview;+ } else if (region.type === "image") {+ label = "Image";+ } else {+ label = "Annotation";+ }++ return {+ id: region.id,+ rowId: ANNOTATION_ROW_ID,+ span: { start: region.startMs, end: region.endMs },+ label,+ variant: "annotation",+ };+ });++ const audios: TimelineRenderItem[] = audioRegions.map((region) => {+ const fileName =+ region.audioPath+ .split(/[\\/]/)+ .pop()+ ?.replace(/\.[^.]+$/, "") || "Audio";+ return {+ id: region.id,+ rowId: AUDIO_ROW_ID,+ span: { start: region.startMs, end: region.endMs },+ label: fileName,+ variant: "audio",+ };+ });++ return [...zooms, ...clips, ...annotations, ...audios];+ }, [zoomRegions, clipRegions, annotationRegions, audioRegions]);++ // Flat list of draggable row spans for neighbour-clamping during drag/resize.+ const allRegionSpans = useMemo(() => {+ const zooms = zoomRegions.map((r) => ({+ id: r.id,+ start: r.startMs,+ end: r.endMs,+ rowId: ZOOM_ROW_ID,+ }));+ const clips = clipRegions.map((r) => ({+ id: r.id,+ start: r.startMs,+ end: r.endMs,+ rowId: CLIP_ROW_ID,+ }));+ const audios = audioRegions.map((r) => ({+ id: r.id,+ start: r.startMs,+ end: r.endMs,+ rowId: AUDIO_ROW_ID,+ }));+ return [...zooms, ...clips, ...audios];+ }, [zoomRegions, clipRegions, audioRegions]);++ const handleItemSpanChange = useCallback(+ (id: string, span: Span) => {+ // Check if it's a zoom, trim, clip, speed, or annotation item+ if (zoomRegions.some((r) => r.id === id)) {+ onZoomSpanChange(id, span);+ } else if (clipRegions.some((r) => r.id === id)) {+ onClipSpanChange?.(id, span);+ } else if (annotationRegions.some((r) => r.id === id)) {+ onAnnotationSpanChange?.(id, span);+ } else if (audioRegions.some((r) => r.id === id)) {+ onAudioSpanChange?.(id, span);+ }+ },+ [+ zoomRegions,+ clipRegions,+ annotationRegions,+ audioRegions,+ onZoomSpanChange,+ onClipSpanChange,+ onAnnotationSpanChange,+ onAudioSpanChange,+ ],+ );++ const panTimelineRange = useCallback(+ (deltaMs: number) => {+ if (!Number.isFinite(deltaMs) || deltaMs === 0 || totalMs <= 0) {+ return;+ }++ setRange((previous) => {+ const visibleSpan = Math.max(1, previous.end - previous.start);+ const maxStart = Math.max(0, totalMs - visibleSpan);+ const nextStart = Math.max(0, Math.min(previous.start + deltaMs, maxStart));++ return {+ start: nextStart,+ end: nextStart + visibleSpan,+ };+ });+ },+ [totalMs],+ );++ const handleTimelineWheel = useCallback(+ (event: WheelEvent<HTMLDivElement>) => {+ if (event.ctrlKey || event.metaKey || totalMs <= 0) {+ return;+ }++ const rawHorizontalDelta =+ Math.abs(event.deltaX) > 0+ ? event.deltaX+ : event.shiftKey && Math.abs(event.deltaY) > 0+ ? event.deltaY+ : 0;++ if (rawHorizontalDelta === 0) {+ return;+ }++ const containerWidth = timelineContainerRef.current?.clientWidth ?? 0;+ const visibleRangeMs = clampedRange.end - clampedRange.start;++ if (containerWidth <= 0 || visibleRangeMs <= 0) {+ return;+ }++ event.preventDefault();++ const horizontalDeltaPx = normalizeWheelDeltaToPixels(+ rawHorizontalDelta,+ event.deltaMode,+ );+ const deltaMs = (horizontalDeltaPx / containerWidth) * visibleRangeMs;++ panTimelineRange(deltaMs);+ },+ [clampedRange.end, clampedRange.start, panTimelineRange, totalMs],+ );++ if (!videoDuration || videoDuration === 0) {+ return (+ <div className="flex-1 flex flex-col items-center justify-center rounded-lg bg-[#17171a] gap-3">+ <div className="w-12 h-12 rounded-full bg-white/5 flex items-center justify-center">+ <Plus className="w-6 h-6 text-slate-600" />+ </div>+ <div className="text-center">+ <p className="text-sm font-medium text-slate-300">No Video Loaded</p>+ <p className="text-xs text-slate-500 mt-1">+ Drag and drop a video to start editing+ </p>+ </div>+ </div>+ );+ }++ return (+ <div className="flex-1 min-h-0 flex flex-col bg-[#17171a] overflow-auto">+ <div className="flex items-center gap-2 px-4 py-2 border-b border-white/10 bg-[#161619]">+ <div className="flex items-center gap-1">+ <Button+ onClick={handleAddZoom}+ variant="ghost"+ size="icon"+ className="h-7 w-7 text-slate-400 hover:text-[#2563EB] hover:bg-[#2563EB]/10 transition-all"+ title="Add Zoom (Z)"+ >+ <ZoomIn className="w-4 h-4" />+ </Button>+ <Button+ onClick={handleSuggestZooms}+ variant="ghost"+ size="icon"+ className="h-7 w-7 text-slate-400 hover:text-[#2563EB] hover:bg-[#2563EB]/10 transition-all"+ title="Suggest Zooms from Cursor"+ >+ <WandSparkles className="w-4 h-4" />+ </Button>+ <Button+ onClick={handleAddAnnotation}+ variant="ghost"+ size="icon"+ className="h-7 w-7 text-slate-400 hover:text-[#B4A046] hover:bg-[#B4A046]/10 transition-all"+ title="Add Annotation (A)"+ >+ <MessageSquare className="w-4 h-4" />+ </Button>+ <Button+ onClick={handleAddAudio}+ variant="ghost"+ size="icon"+ className="h-7 w-7 text-slate-400 hover:text-[#a855f7] hover:bg-[#a855f7]/10 transition-all"+ title="Add Audio"+ >+ <Music className="w-4 h-4" />+ </Button>+ <Button+ onClick={handleSplitClip}+ variant="ghost"+ size="icon"+ className="h-7 w-7 text-slate-400 hover:text-white hover:bg-white/10 transition-all"+ title="Split Clip (C)"+ >+ <Scissors className="w-4 h-4" />+ </Button>+ </div>+ <div className="flex items-center gap-2">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ variant="ghost"+ size="sm"+ className="h-7 px-2 text-xs text-slate-400 hover:text-slate-200 hover:bg-white/10 transition-all gap-1"+ >+ <span className="font-medium">+ {getAspectRatioLabel(aspectRatio)}+ </span>+ <ChevronDown className="w-3 h-3" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="bg-[#1a1a1c] border-white/10">+ {ASPECT_RATIOS.map((ratio) => (+ <DropdownMenuItem+ key={ratio}+ onClick={() => onAspectRatioChange(ratio)}+ className="text-slate-300 hover:text-white hover:bg-white/10 cursor-pointer flex items-center justify-between gap-3"+ >+ <span>{getAspectRatioLabel(ratio)}</span>+ {aspectRatio === ratio && (+ <Check className="w-3 h-3 text-[#2563EB]" />+ )}+ </DropdownMenuItem>+ ))}+ <div className="mx-1 my-1 h-px bg-white/10" />+ <div className="px-2 py-1.5 flex items-center gap-2 text-slate-300">+ <span className="text-sm">Custom</span>+ <input+ type="text"+ inputMode="numeric"+ value={customAspectWidth}+ onChange={(event) =>+ setCustomAspectWidth(event.target.value.replace(/\D/g, ""))+ }+ onKeyDown={handleCustomAspectRatioKeyDown}+ className="w-12 h-7 rounded border border-white/15 bg-black/20 px-1.5 text-sm text-slate-100 focus:outline-none focus:ring-1 focus:ring-[#2563EB]"+ aria-label="Custom aspect width"+ />+ <span className="text-slate-500">:</span>+ <input+ type="text"+ inputMode="numeric"+ value={customAspectHeight}+ onChange={(event) =>+ setCustomAspectHeight(event.target.value.replace(/\D/g, ""))+ }+ onKeyDown={handleCustomAspectRatioKeyDown}+ className="w-12 h-7 rounded border border-white/15 bg-black/20 px-1.5 text-sm text-slate-100 focus:outline-none focus:ring-1 focus:ring-[#2563EB]"+ aria-label="Custom aspect height"+ />+ <Button+ variant="ghost"+ size="sm"+ onClick={applyCustomAspectRatio}+ className="h-7 px-2 text-xs text-slate-300 hover:text-white hover:bg-white/10"+ >+ Set+ </Button>+ {isCustomAspectRatio(aspectRatio) && (+ <Check className="w-3 h-3 text-[#2563EB] ml-auto" />+ )}+ </div>+ </DropdownMenuContent>+ </DropdownMenu>+ <div className="w-[1px] h-4 bg-white/10" />+ <Button+ variant="ghost"+ size="sm"+ onClick={() => onOpenCropEditor?.()}+ className="h-7 px-2 text-xs text-slate-400 hover:text-slate-200 hover:bg-white/10 transition-all gap-1.5"+ >+ <Crop className="w-3.5 h-3.5" />+ <span className="font-medium">{t("sections.crop", "Crop")}</span>+ {isCropped ? (+ <span className="h-1.5 w-1.5 rounded-full bg-[#2563EB]" />+ ) : null}+ </Button>+ </div>+ <div className="flex-1" />+ <div className="flex items-center gap-4 text-[10px] text-slate-500 font-medium">+ <span className="flex items-center gap-1.5">+ <kbd className="px-1.5 py-0.5 bg-white/5 border border-white/10 rounded text-[#2563EB] font-sans">+ Side Scroll+ </kbd>+ <span>Pan</span>+ </span>+ <span className="flex items-center gap-1.5">+ <kbd className="px-1.5 py-0.5 bg-white/5 border border-white/10 rounded text-[#2563EB] font-sans">+ {scrollLabels.pan}+ </kbd>+ <span>Pan</span>+ </span>+ <span className="flex items-center gap-1.5">+ <kbd className="px-1.5 py-0.5 bg-white/5 border border-white/10 rounded text-[#2563EB] font-sans">+ {scrollLabels.zoom}+ </kbd>+ <span>Zoom</span>+ </span>+ </div>+ </div>+ <div+ ref={timelineContainerRef}+ className="flex-1 min-h-0 overflow-auto bg-[#17171a] relative"+ tabIndex={0}+ onFocus={() => {+ isTimelineFocusedRef.current = true;+ }}+ onBlur={() => {+ isTimelineFocusedRef.current = false;+ }}+ onMouseDown={() => {+ timelineContainerRef.current?.focus();+ isTimelineFocusedRef.current = true;+ }}+ onClick={() => {+ setSelectedKeyframeId(null);+ setSelectAllBlocksActive(false);+ }}+ onWheel={handleTimelineWheel}+ >+ <TimelineWrapper+ range={clampedRange}+ videoDuration={videoDuration}+ hasOverlap={hasOverlap}+ onRangeChange={setRange}+ minItemDurationMs={timelineScale.minItemDurationMs}+ minVisibleRangeMs={timelineScale.minVisibleRangeMs}+ onItemSpanChange={handleItemSpanChange}+ allRegionSpans={allRegionSpans}+ >+ <KeyframeMarkers+ keyframes={keyframes}+ selectedKeyframeId={selectedKeyframeId}+ setSelectedKeyframeId={setSelectedKeyframeId}+ onKeyframeMove={handleKeyframeMove}+ videoDurationMs={totalMs}+ timelineRef={timelineContainerRef}+ />+ <Timeline+ items={timelineItems}+ videoDurationMs={totalMs}+ currentTimeMs={currentTimeMs}+ onSeek={onSeek}+ onSelectZoom={handleSelectZoom}+ onSelectTrim={handleSelectTrim}+ onSelectClip={handleSelectClip}+ onSelectAnnotation={handleSelectAnnotation}+ onSelectSpeed={handleSelectSpeed}+ onSelectAudio={handleSelectAudio}+ selectedZoomId={selectedZoomId}+ selectedTrimId={selectedTrimId}+ selectedClipId={selectedClipId}+ selectedAnnotationId={selectedAnnotationId}+ selectedSpeedId={selectedSpeedId}+ selectedAudioId={selectedAudioId}+ selectAllBlocksActive={selectAllBlocksActive}+ onClearBlockSelection={clearSelectedBlocks}+ keyframes={keyframes}+ audioPeaks={audioPeaks}+ />+ </TimelineWrapper>+ </div>+ </div>+ );}diff --git a/src/i18n/locales/en/launch.json b/src/i18n/locales/en/launch.jsonindex 2f84052b..6155d26e 100644--- a/src/i18n/locales/en/launch.json+++ b/src/i18n/locales/en/launch.json@@ -56,6 +56,8 @@"loadingSources": "Loading sources...","screens": "Screens","windows": "Windows",+ "noScreensAvailable": "No screens available",+ "noWindowsAvailable": "No windows available","windowsNote": "Only visible (non-minimized) windows can be recorded.","windowPlaceholder": "Window","cancel": "Cancel",diff --git a/src/i18n/locales/es/launch.json b/src/i18n/locales/es/launch.jsonindex 32350e7c..b72b2404 100644--- a/src/i18n/locales/es/launch.json+++ b/src/i18n/locales/es/launch.json@@ -56,6 +56,8 @@"loadingSources": "Cargando fuentes...","screens": "Pantallas","windows": "Ventanas",+ "noScreensAvailable": "No hay pantallas disponibles",+ "noWindowsAvailable": "No hay ventanas disponibles","windowsNote": "Solo se pueden grabar las ventanas visibles (no minimizadas).","windowPlaceholder": "Ventana","cancel": "Cancelar",diff --git a/src/i18n/locales/ko/launch.json b/src/i18n/locales/ko/launch.jsonindex bfe0a403..3981a5d7 100644--- a/src/i18n/locales/ko/launch.json+++ b/src/i18n/locales/ko/launch.json@@ -27,6 +27,8 @@"noMicrophonesFound": "마이크를 찾을 수 없습니다","webcam": "웹캠","turnOffWebcam": "웹캠 끄기",+ "hideFloatingWebcamPreview": "플로팅 미리보기 숨기기",+ "showFloatingWebcamPreview": "플로팅 미리보기 표시","selectWebcamToEnable": "사용할 웹캠을 선택하세요","noWebcamsFound": "웹캠을 찾을 수 없습니다","recordingsFolder": "녹화 폴더",@@ -54,6 +56,8 @@"loadingSources": "소스를 불러오는 중...","screens": "화면","windows": "창",+ "noScreensAvailable": "사용 가능한 화면이 없습니다",+ "noWindowsAvailable": "사용 가능한 창이 없습니다","windowsNote": "보이는 창(최소화되지 않은 창)만 녹화할 수 있습니다.","windowPlaceholder": "창","cancel": "취소",diff --git a/src/i18n/locales/ko/settings.json b/src/i18n/locales/ko/settings.jsonindex edf926d0..502f97c9 100644--- a/src/i18n/locales/ko/settings.json+++ b/src/i18n/locales/ko/settings.json@@ -146,6 +146,7 @@"high": "높음","original": "원본"},+ "fpsTitle": "FPS","loop": "반복","outputDimensions": "출력: {{dimensions}}px","sizePresetOriginalShort": "원본",diff --git a/src/i18n/locales/nl/launch.json b/src/i18n/locales/nl/launch.jsonindex 785c6098..3abb6a43 100644--- a/src/i18n/locales/nl/launch.json+++ b/src/i18n/locales/nl/launch.json@@ -27,6 +27,8 @@"noMicrophonesFound": "Geen microfoons gevonden","webcam": "Webcam","turnOffWebcam": "Webcam uitschakelen",+ "hideFloatingWebcamPreview": "Zwevende preview verbergen",+ "showFloatingWebcamPreview": "Zwevende preview tonen","selectWebcamToEnable": "Selecteer een webcam om in te schakelen","noWebcamsFound": "Geen webcams gevonden","recordingsFolder": "Opnamepad",@@ -54,6 +56,8 @@"loadingSources": "Bronnen laden...","screens": "Schermen","windows": "Vensters",+ "noScreensAvailable": "Geen schermen beschikbaar",+ "noWindowsAvailable": "Geen vensters beschikbaar","windowsNote": "Alleen zichtbare (niet-geminimaliseerde) vensters kunnen worden opgenomen.","windowPlaceholder": "Venster","cancel": "Annuleren",diff --git a/src/i18n/locales/zh-CN/launch.json b/src/i18n/locales/zh-CN/launch.jsonindex 05fef71f..17be557f 100644--- a/src/i18n/locales/zh-CN/launch.json+++ b/src/i18n/locales/zh-CN/launch.json@@ -56,6 +56,8 @@"loadingSources": "正在加载源...","screens": "屏幕","windows": "窗口",+ "noScreensAvailable": "没有可用的屏幕",+ "noWindowsAvailable": "没有可用的窗口","windowsNote": "仅可录制可见(非最小化)窗口。","windowPlaceholder": "窗口","cancel": "取消",diff --git a/src/index.css b/src/index.cssindex b3ec7cdf..61638d83 100644--- a/src/index.css+++ b/src/index.css@@ -4,8 +4,13 @@@layer base {/* Disable Electron/Chromium focus highlight (yellow/orange ring) */- *:focus {+ *:focus:not(:focus-visible) {outline: none !important;+ }++ *:focus-visible {+ outline: 2px solid rgb(var(--brand-accent-rgb));+ outline-offset: 2px;-webkit-tap-highlight-color: transparent;}@@ -80,6 +85,7 @@}body {@apply bg-background text-foreground;+-webkit-user-select: none;user-select: none;font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;diff --git a/src/lib/assetPath.ts b/src/lib/assetPath.tsindex 2346f7cd..8aed2ad9 100644--- a/src/lib/assetPath.ts+++ b/src/lib/assetPath.ts@@ -13,27 +13,28 @@ function ensureTrailingSlash(value: string): string {export async function getAssetPath(relativePath: string): Promise<string> {const encodedRelativePath = encodeRelativeAssetPath(relativePath);+ const isWebContext =+ typeof window !== "undefined" && Boolean(window.location?.protocol?.startsWith("http"));++ if (isWebContext) {+ return `/${encodedRelativePath}`;+ }try {if (typeof window !== "undefined") {- // If running in a dev server (http/https), prefer the web-served path- if (- window.location &&- window.location.protocol &&- window.location.protocol.startsWith("http")- ) {- return `/${encodedRelativePath}`;- }-if (typeof window.electronAPI?.getAssetBasePath === "function") {const base = await window.electronAPI.getAssetBasePath();- if (base) {- return new URL(encodedRelativePath, ensureTrailingSlash(base)).toString();+ if (!base) {+ throw new Error(`Failed to resolve asset base path for ${relativePath}`);}++ return new URL(encodedRelativePath, ensureTrailingSlash(base)).toString();}}- } catch {- // ignore and use fallback+ } catch (error) {+ if (!isWebContext) {+ throw error;+ }}// Fallback for web/dev server: public/wallpapers are served at '/wallpapers/...'diff --git a/src/lib/customFonts.ts b/src/lib/customFonts.tsindex 4eede969..4c60b1b5 100644--- a/src/lib/customFonts.ts+++ b/src/lib/customFonts.ts@@ -11,6 +11,13 @@ const STORAGE_KEY = "recordly_custom_fonts";const LEGACY_STORAGE_KEY = "openscreen_custom_fonts";const loadedFonts = new Set<string>();+export class DuplicateFontError extends Error {+ constructor(fontName: string) {+ super(`Font \"${fontName}\" has already been added`);+ this.name = "DuplicateFontError";+ }+}+// Load custom fonts from localStorageexport function getCustomFonts(): CustomFont[] {try {@@ -36,10 +43,15 @@ export function saveCustomFonts(fonts: CustomFont[]): void {// Add a new custom font (throws error if font fails to load)export async function addCustomFont(font: CustomFont): Promise<CustomFont[]> {const fonts = getCustomFonts();- const exists = fonts.some((f) => f.id === font.id || f.fontFamily === font.fontFamily);+ const normalizedFontFamily = font.fontFamily.trim().toLowerCase();+ const exists = fonts.some(+ (existingFont) =>+ existingFont.id === font.id ||+ existingFont.fontFamily.trim().toLowerCase() === normalizedFontFamily,+ );if (exists) {- return fonts;+ throw new DuplicateFontError(font.name);}// Try to load the font first - this will throw if it fails@@ -98,7 +110,10 @@ export function loadFont(font: CustomFont): Promise<void> {loadedFonts.add(font.id);resolve();})- .catch(reject);+ .catch((error) => {+ style.remove();+ reject(error);+ });} catch (error) {console.error("Failed to load font:", font, error);reject(error);@@ -179,7 +194,12 @@ export function parseFontFamilyFromImport(importUrl: string): string | null {export function isValidGoogleFontsUrl(url: string): boolean {try {const urlObj = new URL(url);- return urlObj.hostname === "fonts.googleapis.com" && urlObj.searchParams.has("family");+ return (+ urlObj.protocol === "https:" &&+ urlObj.hostname === "fonts.googleapis.com" &&+ /^\/css2?$/.test(urlObj.pathname) &&+ urlObj.searchParams.has("family")+ );} catch {return false;}diff --git a/src/utils/platformUtils.ts b/src/utils/platformUtils.tsindex 37d5a6dc..4816b33d 100644--- a/src/utils/platformUtils.ts+++ b/src/utils/platformUtils.ts@@ -1,5 +1,26 @@let cachedPlatform: string | null = null;+function getNavigatorFallbackPlatform(): string {+ if (typeof navigator === "undefined") {+ return "win32";+ }++ const navigatorWithUAData = navigator as Navigator & {+ userAgentData?: { platform?: string };+ };+ const platformSource = navigatorWithUAData.userAgentData?.platform ?? navigator.userAgent ?? "";++ if (/mac|iphone|ipad|ipod/i.test(platformSource)) {+ return "darwin";+ }++ if (/linux/i.test(platformSource)) {+ return "linux";+ }++ return "win32";+}+/*** Gets the current platform from Electron*/@@ -12,11 +33,7 @@ const getPlatform = async (): Promise<string> => {return platform;} catch (error) {console.warn("Failed to get platform from Electron, falling back to navigator:", error);- // Fallback for development/testing- let fallbackPlatform = "win32";- if (typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/.test(navigator.platform)) {- fallbackPlatform = "darwin";- }+ const fallbackPlatform = getNavigatorFallbackPlatform();cachedPlatform = fallbackPlatform;return fallbackPlatform;}diff --git a/tsconfig.json b/tsconfig.jsonindex 4a7aee40..9383adf2 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -5,10 +5,8 @@"lib": ["ES2020", "DOM", "DOM.Iterable"],"module": "ESNext","skipLibCheck": true,- "ignoreDeprecations": "5.0",- "baseUrl": ".","paths": {- "@/*": ["src/*"]+ "@/*": ["./src/*"]},/* Bundler mode */diff --git a/vite.config.ts b/vite.config.tsindex 5d512c04..4e584028 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -24,8 +24,8 @@ export default defineConfig({// Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.input: path.join(__dirname, "electron/preload.ts"),},- // Ployfill the Electron and Node.js API for Renderer process.- // If you want use Node.js in Renderer process, the `nodeIntegration` needs to be enabled in the Main process.+ // Polyfill the Electron and Node.js API for the renderer process.+ // If you want to use Node.js in the renderer process, enable `nodeIntegration` in the main process.// See https://github.com/electron-vite/vite-plugin-electron-rendererrenderer:process.env.NODE_ENV === "test"@@ -42,7 +42,6 @@ export default defineConfig({optimizeDeps: {entries: ["index.html"],exclude: [- "lucide-react","react-icons/bs","react-icons/fa","react-icons/fa6",