Create polished demo videos without editing skills. Mac/Windows/Linux
feat: settings tab with language picker, extension fixes, and i18n expansion
webadderall781cb4c38d5b
diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsxindex 5fe6d9c0..33a990d4 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,18 +13,25 @@ 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";import { useI18n, useScopedT } from "../../contexts/I18nContext";+import type { AppLocale } from "../../i18n/config";+import { SUPPORTED_LOCALES } from "../../i18n/config";import { AnnotationSettingsPanel } from "./AnnotationSettingsPanel";import { loadEditorPreferences, saveEditorPreferences } from "./editorPreferences";import { SliderControl } from "./SliderControl";+import { KeyboardShortcutsDialog } from "./TutorialHelp";import type {AnnotationRegion,AnnotationType,@@ -109,10 +116,12 @@ export type EditorEffectSection =| "cursor"| "captions"| "webcam"+ | "settings"| "zoom"| "frame"| "crop"| "extensions"+ | "clip"| `ext:${string}`;function isHexWallpaper(value: string): boolean {@@ -137,14 +146,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 +168,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 +198,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 +271,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 +297,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"/>@@ -279,7 +344,9 @@ interface SettingsPanelProps {onTrimDelete?: (id: string) => void;selectedClipId?: string | null;selectedClipSpeed?: number | null;+ selectedClipMuted?: boolean | null;onClipSpeedChange?: (speed: number) => void;+ onClipMutedChange?: (muted: boolean) => void;onClipDelete?: (id: string) => void;shadowIntensity?: number;onShadowChange?: (intensity: number) => void;@@ -289,6 +356,8 @@ interface SettingsPanelProps {onZoomMotionBlurChange?: (amount: number) => void;connectZooms?: boolean;onConnectZoomsChange?: (enabled: boolean) => void;+ autoApplyFreshRecordingAutoZooms?: boolean;+ onAutoApplyFreshRecordingAutoZoomsChange?: (enabled: boolean) => void;zoomInDurationMs?: number;onZoomInDurationMsChange?: (duration: number) => void;zoomInOverlapMs?: number;@@ -425,6 +494,14 @@ const CAPTION_LANGUAGE_OPTIONS = [{ value: "ko", label: "Korean" },] as const;+const APP_LANGUAGE_LABELS: Record<AppLocale, string> = {+ en: "English",+ es: "Español",+ nl: "Nederlands",+ ko: "한국어",+ "zh-CN": "中文",+};+function loadPreviewImage(url: string) {return new Promise<HTMLImageElement>((resolve, reject) => {const image = new Image();@@ -571,11 +648,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 +667,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") {@@ -631,7 +701,9 @@ export function SettingsPanel({onTrimDelete,selectedClipId,selectedClipSpeed,+ selectedClipMuted,onClipSpeedChange,+ onClipMutedChange,onClipDelete,shadowIntensity = 0.67,onShadowChange,@@ -639,6 +711,10 @@ export function SettingsPanel({onBackgroundBlurChange,zoomMotionBlur = 0,onZoomMotionBlurChange,+ connectZooms = true,+ onConnectZoomsChange,+ autoApplyFreshRecordingAutoZooms = true,+ onAutoApplyFreshRecordingAutoZoomsChange,showCursor = false,onShowCursorChange,loopCursor = false,@@ -702,13 +778,14 @@ export function SettingsPanel({onSpeedDelete,}: SettingsPanelProps) {const tSettings = useScopedT("settings");- const { t } = useI18n();+ const { locale, setLocale, t } = useI18n();const isBackgroundPanel = panelMode === "background";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 +836,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 +855,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 +934,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 +965,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 +1067,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 +1202,11 @@ 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) => e.currentTarget.play().catch(() => undefined)}+ onMouseLeave={(e) => {+ e.currentTarget.pause();+ e.currentTarget.currentTime = 0;+ }}/>) : (<img@@ -1133,25 +1225,12 @@ export function SettingsPanel({</div>);-- const handleDeleteClick = () => {- if (selectedZoomId && onZoomDelete) {- onZoomDelete(selectedZoomId);- }- };-const handleTrimDeleteClick = () => {if (selectedTrimId && onTrimDelete) {onTrimDelete(selectedTrimId);}};- const handleClipDeleteClick = () => {- if (selectedClipId && onClipDelete) {- onClipDelete(selectedClipId);- }- };-const crop = cropRegion ?? {x: 0,y: 0,@@ -1295,11 +1374,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 +1398,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 +1459,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 +1515,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 +1527,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 +1539,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 +1568,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 +1632,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 +1654,9 @@ export function SettingsPanel({className={wallpaperTileClass(isHexWallpaper(selected) &&!visibleColorPalette.some(- (color) => color.toLowerCase() === selected.toLowerCase(),+ (color) =>+ color.toLowerCase() ===+ selected.toLowerCase(),),)}style={{@@ -1585,17 +1706,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={@@ -1610,8 +1735,11 @@ export function SettingsPanel({if (isBackgroundPanel) {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 overflow-y-auto custom-scrollbar p-4">+ <div className="flex-[2] w-[332px] min-w-[280px] max-w-[332px] bg-[#161619] 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="mb-4 flex items-center gap-2"><Palette className="w-4 h-4 text-[#2563EB]" /><span className="text-sm font-medium text-slate-200">@@ -1624,57 +1752,6 @@ export function SettingsPanel({);}- const zoomSectionContent = (- <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.zoom", "Zoom")}</SectionLabel>- <button- type="button"- onClick={resetZoomSection}- className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80"- >- {t("common.actions.reset", "Reset")}- </button>- </div>- </div>- <div className="flex items-center justify-between rounded-lg bg-white/[0.03] px-2.5 py-1.5">- <span className="text-[10px] text-slate-400">- {tSettings("effects.classicZoom", "Classic Animation")}- </span>- <Switch- checked={zoomClassicMode}- onCheckedChange={(v) => onZoomClassicModeChange?.(v)}- className="data-[state=checked]:bg-[#2563EB] scale-75"- />- </div>- {!zoomClassicMode && (- <SliderControl- label={tSettings("effects.zoomSmoothness", "Zoom Smoothness")}- value={zoomSmoothness}- defaultValue={0.5}- min={0}- max={1}- step={0.01}- onChange={(v) => onZoomSmoothnessChange?.(v)}- formatValue={(v) => (v <= 0 ? tSettings("effects.off") : v.toFixed(2))}- parseInput={(text) => parseFloat(text)}- />- )}- <SliderControl- label={tSettings("effects.zoomMotionBlur")}- value={zoomMotionBlur}- defaultValue={DEFAULT_ZOOM_MOTION_BLUR}- min={0}- max={2}- step={0.05}- onChange={(v) => onZoomMotionBlurChange?.(v)}- formatValue={(v) => `${v.toFixed(2)}×`}- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}- />- </section>- );-const frameSectionContent = (<section className="flex flex-col gap-2"><div className="flex items-center justify-between gap-3">@@ -1982,7 +2059,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 +2083,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>@@ -2085,21 +2166,296 @@ export function SettingsPanel({);const effectSectionContent = (() => {+ const settingsSectionContent = (+ <div className="space-y-4">+ <section className="flex flex-col gap-2">+ <SectionLabel>{t("common.app.language", "Language")}</SectionLabel>+ <Select value={locale} onValueChange={(value) => setLocale(value as AppLocale)}>+ <SelectTrigger className="h-10 w-full rounded-xl border-white/10 bg-white/5 text-sm text-slate-200 hover:bg-white/10">+ <SelectValue />+ </SelectTrigger>+ <SelectContent className="border-white/10 bg-[#1a1a1f] text-slate-200">+ {SUPPORTED_LOCALES.map((candidateLocale) => (+ <SelectItem key={candidateLocale} value={candidateLocale}>+ {APP_LANGUAGE_LABELS[candidateLocale]}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </section>++ <section className="flex flex-col gap-1.5">+ <div className="flex items-center justify-between gap-3 rounded-lg bg-white/[0.03] px-2.5 py-2">+ <div>+ <div className="text-[11px] font-medium text-slate-200">+ Auto-apply fresh recording zooms+ </div>+ <div className="mt-0.5 text-[10px] text-slate-500">+ Suggest cursor-follow zooms automatically when you open a new recording.+ </div>+ </div>+ <Switch+ checked={autoApplyFreshRecordingAutoZooms}+ onCheckedChange={onAutoApplyFreshRecordingAutoZoomsChange}+ className="data-[state=checked]:bg-[#2563EB] scale-75"+ />+ </div>+ <div className="flex items-center justify-between gap-3 rounded-lg bg-white/[0.03] px-2.5 py-2">+ <div>+ <div className="text-[11px] font-medium text-slate-200">+ Connect neighboring zooms+ </div>+ <div className="mt-0.5 text-[10px] text-slate-500">+ Smooth consecutive zoom regions into a continuous camera move.+ </div>+ </div>+ <Switch+ checked={connectZooms}+ onCheckedChange={onConnectZoomsChange}+ className="data-[state=checked]:bg-[#2563EB] scale-75"+ />+ </div>+ </section>++ <section className="flex flex-col gap-2">+ <SectionLabel>{tSettings("keyboardShortcuts.title", "Keybinds")}</SectionLabel>+ <KeyboardShortcutsDialog+ triggerLabel={tSettings(+ "keyboardShortcuts.customize",+ "Customise Keybinds",+ )}+ triggerClassName="h-10 w-full justify-start rounded-xl border border-white/10 bg-white/5 px-3 text-sm text-slate-200 hover:bg-white/10 hover:text-white"+ />+ </section>+ </div>+ );+const sceneSectionContent = (<div className="space-y-4">{backgroundSettingsContent}- {zoomSectionContent}{frameSectionContent}{cropSectionContent}{renderExtensionPanelsForSections("scene", "appearance", "zoom", "frame", "crop")}</div>);+ const zoomItemSectionContent = (+ <section className="flex flex-col gap-2">+ {selectedZoomId && (+ <>+ <div className="flex items-center justify-between gap-3">+ <SectionLabel>{tSettings("sections.zoom", "Zoom")}</SectionLabel>+ {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+ }+ </span>+ )}+ </div>+ <div className="mb-1">+ <div className="flex rounded-lg border border-white/10 bg-white/5 p-0.5">+ <button+ type="button"+ onClick={() => onZoomModeChange?.("auto")}+ className={cn(+ "flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-all",+ selectedZoomMode === "auto"+ ? "bg-[#2563EB] text-white shadow-sm"+ : "text-slate-400 hover:text-slate-200",+ )}+ >+ Auto+ </button>+ <button+ type="button"+ onClick={() => onZoomModeChange?.("manual")}+ className={cn(+ "flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-all",+ selectedZoomMode === "manual"+ ? "bg-[#2563EB] text-white shadow-sm"+ : "text-slate-400 hover:text-slate-200",+ )}+ >+ Manual+ </button>+ </div>+ <p className="mt-1.5 text-[10px] text-slate-500">+ {selectedZoomMode === "manual"+ ? "Set a fixed focus point for this zoom"+ : "Camera follows cursor automatically"}+ </p>+ </div>+ <div className="grid grid-cols-6 gap-1.5">+ {ZOOM_DEPTH_OPTIONS.map((option) => {+ const isActive = selectedZoomDepth === option.depth;+ return (+ <Button+ key={option.depth}+ type="button"+ onClick={() => onZoomDepthChange?.(option.depth)}+ className={cn(+ "h-auto w-full rounded-lg border px-1 py-2 text-center shadow-sm transition-all duration-200 ease-out cursor-pointer",+ isActive+ ? "border-[#2563EB] bg-[#2563EB] text-white"+ : "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>+ </Button>+ );+ })}+ </div>+ <div className="h-px bg-white/[0.06] my-1" />+ </>+ )}+ <div className="flex items-center justify-between gap-3">+ <SectionLabel>{tSettings("zoom.globalSettings", "Animation")}</SectionLabel>+ <button+ type="button"+ onClick={resetZoomSection}+ className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80"+ >+ {t("common.actions.reset", "Reset")}+ </button>+ </div>+ <div className="flex items-center justify-between rounded-lg bg-white/[0.03] px-2.5 py-1.5">+ <span className="text-[10px] text-slate-400">+ {tSettings("effects.classicZoom", "Classic Animation")}+ </span>+ <Switch+ checked={zoomClassicMode}+ onCheckedChange={(v) => onZoomClassicModeChange?.(v)}+ className="data-[state=checked]:bg-[#2563EB] scale-75"+ />+ </div>+ {!zoomClassicMode && (+ <SliderControl+ label={tSettings("effects.zoomSmoothness", "Zoom Smoothness")}+ value={zoomSmoothness}+ defaultValue={0.5}+ min={0}+ max={1}+ step={0.01}+ onChange={(v) => onZoomSmoothnessChange?.(v)}+ formatValue={(v) => (v <= 0 ? tSettings("effects.off") : v.toFixed(2))}+ parseInput={(text) => parseFloat(text)}+ />+ )}+ <SliderControl+ label={tSettings("effects.zoomMotionBlur")}+ value={zoomMotionBlur}+ defaultValue={DEFAULT_ZOOM_MOTION_BLUR}+ min={0}+ max={2}+ step={0.05}+ onChange={(v) => onZoomMotionBlurChange?.(v)}+ formatValue={(v) => `${v.toFixed(2)}×`}+ parseInput={(text) => parseFloat(text.replace(/×$/, ""))}+ />+ {selectedZoomId && (+ <Button+ onClick={() => {+ if (selectedZoomId && onZoomDelete) onZoomDelete(selectedZoomId);+ }}+ variant="destructive"+ size="sm"+ className="mt-1 h-8 w-full gap-2 border border-red-500/20 bg-red-500/10 text-xs text-red-400 transition-all hover:border-red-500/30 hover:bg-red-500/20"+ >+ <Trash2 className="h-3 w-3" />+ {tSettings("zoom.deleteZoom")}+ </Button>+ )}+ </section>+ );++ const clipSectionContent = (+ <section className="flex flex-col gap-2">+ <div className="flex items-center justify-between gap-3">+ <SectionLabel>Clip</SectionLabel>+ {selectedClipSpeed != null && selectedClipSpeed !== 1 && (+ <span className="rounded-full bg-[#06b6d4]/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-[#06b6d4]">+ {selectedClipSpeed}×+ </span>+ )}+ </div>+ <div className="flex items-center justify-between rounded-lg bg-white/[0.03] px-2.5 py-1.5">+ <span className="text-[10px] text-slate-400">Mute Audio</span>+ <Switch+ checked={selectedClipMuted ?? false}+ onCheckedChange={(v) => onClipMutedChange?.(v)}+ className="data-[state=checked]:bg-[#06b6d4] scale-75"+ />+ </div>+ <div className="flex items-center gap-3">+ <SectionLabel>Speed</SectionLabel>+ </div>+ <div className="grid grid-cols-4 gap-1.5">+ {[+ { speed: 0.25, label: "0.25×" },+ { speed: 0.5, label: "0.5×" },+ { speed: 0.75, label: "0.75×" },+ { speed: 1, label: "1×" },+ { speed: 1.25, label: "1.25×" },+ { speed: 1.5, label: "1.5×" },+ { speed: 2, label: "2×" },+ { speed: 2.5, label: "2.5×" },+ { speed: 3, label: "3×" },+ { speed: 4, label: "4×" },+ { speed: 5, label: "5×" },+ { speed: 8, label: "8×" },+ { speed: 10, label: "10×" },+ { speed: 15, label: "15×" },+ { speed: 20, label: "20×" },+ { speed: 30, label: "30×" },+ ].map((option) => {+ const isActive = selectedClipSpeed === option.speed;+ return (+ <Button+ key={option.speed}+ type="button"+ onClick={() => onClipSpeedChange?.(option.speed)}+ className={cn(+ "h-auto w-full rounded-lg border px-0.5 py-2 text-center shadow-sm transition-all duration-200 ease-out cursor-pointer",+ isActive+ ? "border-[#06b6d4] bg-[#06b6d4] text-white"+ : "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>+ </Button>+ );+ })}+ </div>+ {selectedClipId && (+ <Button+ onClick={() => {+ if (selectedClipId && onClipDelete) onClipDelete(selectedClipId);+ }}+ variant="destructive"+ size="sm"+ className="mt-1 h-8 w-full gap-2 border border-red-500/20 bg-red-500/10 text-xs text-red-400 transition-all hover:border-red-500/30 hover:bg-red-500/20"+ >+ <Trash2 className="h-3 w-3" />+ Delete Clip+ </Button>+ )}+ </section>+ );+switch (activeEffectSection) {+ case "settings":+ return settingsSectionContent;case "scene":return sceneSectionContent;case "zoom":- return sceneSectionContent;+ return zoomItemSectionContent;+ case "clip":+ return clipSectionContent;case "frame":return sceneSectionContent;case "crop":@@ -2111,7 +2467,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 +2552,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 +2580,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 +2601,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 +2670,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 +2687,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 +2712,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 +2728,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 +2779,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 +2815,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];@@ -2456,8 +2841,11 @@ 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-[2] w-[332px] min-w-[280px] max-w-[332px] bg-[#161619] 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" }}+ ><AnimatePresence mode="wait" initial={false}><motion.divkey={activeEffectSection}@@ -2471,88 +2859,13 @@ 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"- )}>- {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>- <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}- </span>- )}- </div>- </div>- <div className="mb-3">- <div className="flex rounded-lg border border-white/10 bg-white/5 p-0.5">- <button- type="button"- onClick={() => onZoomModeChange?.('auto')}- className={cn(- "flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-all",- selectedZoomMode === 'auto'- ? "bg-[#2563EB] text-white shadow-sm"- : "text-slate-400 hover:text-slate-200",- )}- >- Auto- </button>- <button- type="button"- onClick={() => onZoomModeChange?.('manual')}- className={cn(- "flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-all",- selectedZoomMode === 'manual'- ? "bg-[#2563EB] text-white shadow-sm"- : "text-slate-400 hover:text-slate-200",- )}- >- Manual- </button>- </div>- <p className="mt-1.5 text-[10px] text-slate-500">- {selectedZoomMode === 'manual'- ? "Set a fixed focus point for this zoom"- : "Camera follows cursor automatically"}- </p>- </div>- <div className="grid grid-cols-6 gap-1.5">- {ZOOM_DEPTH_OPTIONS.map((option) => {- const isActive = selectedZoomDepth === option.depth;- return (- <Button- key={option.depth}- type="button"- onClick={() => onZoomDepthChange?.(option.depth)}- className={cn(- "h-auto w-full rounded-lg border px-1 py-2 text-center shadow-sm transition-all duration-200 ease-out cursor-pointer",- isActive- ? "border-[#2563EB] bg-[#2563EB] text-white"- : "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>- </Button>- );- })}- </div>- <Button- onClick={handleDeleteClick}- variant="destructive"- size="sm"- className="mt-2 h-8 w-full gap-2 border border-red-500/20 bg-red-500/10 text-xs text-red-400 transition-all hover:border-red-500/30 hover:bg-red-500/20"- >- <Trash2 className="h-3 w-3" />- {tSettings("zoom.deleteZoom")}- </Button>- </div>+ <div+ className={cn(+ "flex-shrink-0 border-t border-white/10 bg-[#151518] p-4 pt-3",+ !selectedTrimId && !selectedSpeedId && "hidden",)}-- {selectedTrimId && !selectedZoomId && (+ >+ {selectedTrimId && (<div className="mb-4"><ButtononClick={handleTrimDeleteClick}@@ -2574,8 +2887,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 +2907,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>);})}@@ -2610,59 +2925,7 @@ export function SettingsPanel({</Button></div>)}-- {selectedClipId && (- <div className="mb-4">- <div className="mb-3 flex items-center justify-between">- <span className="text-sm font-medium text-slate-200">Clip Speed</span>- {selectedClipSpeed != null && selectedClipSpeed !== 1 && (- <span className="rounded-full bg-[#06b6d4]/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-[#06b6d4]">- {selectedClipSpeed}×- </span>- )}- </div>- <div className="grid grid-cols-8 gap-1.5">- {[- { speed: 0.25, label: "0.25×" },- { speed: 0.5, label: "0.5×" },- { speed: 0.75, label: "0.75×" },- { speed: 1, label: "1×" },- { speed: 1.25, label: "1.25×" },- { speed: 1.5, label: "1.5×" },- { speed: 1.75, label: "1.75×" },- { speed: 2, label: "2×" },- ].map((option) => {- const isActive = selectedClipSpeed === option.speed;- return (- <Button- key={option.speed}- type="button"- onClick={() => onClipSpeedChange?.(option.speed)}- className={cn(- "h-auto w-full rounded-lg border px-0.5 py-2 text-center shadow-sm transition-all duration-200 ease-out cursor-pointer",- isActive- ? "border-[#06b6d4] bg-[#06b6d4] text-white"- : "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>- </Button>- );- })}- </div>- <Button- onClick={handleClipDeleteClick}- variant="destructive"- size="sm"- className="mt-2 h-8 w-full gap-2 border border-red-500/20 bg-red-500/10 text-xs text-red-400 transition-all hover:border-red-500/30 hover:bg-red-500/20"- >- <Trash2 className="h-3 w-3" />- Delete Clip- </Button>- </div>- )}</div></div>-);}diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsxindex 18d36f98..d9759756 100644--- a/src/components/video-editor/VideoEditor.tsx+++ b/src/components/video-editor/VideoEditor.tsx@@ -1,32 +1,47 @@-import type { Span } from "dnd-timeline";import {- Camera,- Captions,- Download,+ ArrowClockwise as Redo2,+ ArrowCounterClockwise as Undo2,+ CaretDown as ChevronDown,+ CaretUp as ChevronUp,+ Check,+ ClosedCaptioning,+ Crop,+ Cursor,+ DownloadSimple as Download,+ FloppyDisk as Save,FolderOpen,- MousePointer2,- Puzzle,- Redo2,- Save,- Sparkles,- Undo2,+ Gear,+ MagicWand as WandSparkles,+ MagnifyingGlassPlus as ZoomIn,+ Pause,+ Play,+ Plus,+ Camera as PhCameraRegular,+ PuzzlePiece,+ Scissors,+ SkipBack,+ SkipForward,+ SpeakerHigh as Volume2,+ SpeakerLow as Volume1,+ SpeakerX as VolumeX,+ Sparkle,+ UserCircle as User,X,-} from "lucide-react";-import { AnimatePresence, LayoutGroup, motion } from "motion/react";+} from "@phosphor-icons/react";+import type { Span } from "dnd-timeline";+import { 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,DropdownMenuContent,+ DropdownMenuItem,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { Toaster } from "@/components/ui/sonner";import { useI18n } from "@/contexts/I18nContext";import { useShortcuts } from "@/contexts/ShortcutsContext";-import type { AppLocale } from "@/i18n/config";-import { SUPPORTED_LOCALES } from "@/i18n/config";import {calculateOutputDimensions,DEFAULT_MP4_CODEC,@@ -55,12 +70,39 @@ import {getMediaSyncPlaybackRate,} from "@/lib/mediaTiming";import { matchesShortcut } from "@/lib/shortcuts";-import { type AspectRatio, getAspectRatioValue } from "@/utils/aspectRatioUtils";+import {+ ASPECT_RATIOS,+ type AspectRatio,+ getAspectRatioLabel,+ getAspectRatioValue,+} from "@/utils/aspectRatioUtils";+import { ExtensionIcon } from "./ExtensionIcon";++const PhCursorFill = (props: { className?: string; weight?: "fill" | "regular" }) => (+ <Cursor weight="fill" className={props.className} />+);+const PhCamera = (props: { className?: string; weight?: "fill" | "regular" }) => (+ <PhCameraRegular weight={props.weight ?? "regular"} className={props.className} />+);+const PhCaptions = (props: { className?: string; weight?: "fill" | "regular" }) => (+ <ClosedCaptioning weight={props.weight ?? "regular"} className={props.className} />+);+const PhPuzzle = (props: { className?: string; weight?: "fill" | "regular" }) => (+ <PuzzlePiece weight={props.weight ?? "regular"} className={props.className} />+);+const PhSparkle = (props: { className?: string; weight?: "fill" | "regular" }) => (+ <Sparkle weight={props.weight ?? "regular"} className={props.className} />+);+const PhSettings = (props: { className?: string; weight?: "fill" | "regular" }) => (+ <Gear weight={props.weight ?? "regular"} className={props.className} />+);++import { extensionHost } from "@/lib/extensions";import { resolveAutoCaptionSourcePath } from "./autoCaptionSource";import { CropControl } from "./CropControl";import { ExportSettingsMenu } from "./ExportSettingsMenu";+import ExtensionManager from "./ExtensionManager";import { loadEditorPreferences, saveEditorPreferences } from "./editorPreferences";-import PlaybackControls from "./PlaybackControls";import ProjectBrowserDialog, { type ProjectLibraryEntry } from "./ProjectBrowserDialog";import {createProjectData,@@ -72,31 +114,31 @@ 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,FeedbackDialog,- KeyboardShortcutsDialog,openExternalLink,RECORDLY_ISSUES_URL,} from "./TutorialHelp";-import TimelineEditor from "./timeline/TimelineEditor";+import TimelineEditor, { type TimelineEditorHandle } from "./timeline/TimelineEditor";import { normalizeCursorTelemetry } from "./timeline/zoomSuggestionUtils";import {type AnnotationRegion,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,22 +148,20 @@ 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,DEFAULT_ZOOM_OUT_DURATION_MS,DEFAULT_ZOOM_OUT_EASING,type FigureData,+ getClipSourceEndMs,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 +226,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 +297,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 +321,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,};}@@ -419,31 +468,6 @@ function getErrorMessage(error: unknown): string {return "Something went wrong";}-function LanguageSwitcher() {- const { locale, setLocale, t } = useI18n();- const idx = SUPPORTED_LOCALES.indexOf(locale as (typeof SUPPORTED_LOCALES)[number]);- const next = SUPPORTED_LOCALES[(idx + 1) % SUPPORTED_LOCALES.length] as AppLocale;- const labels: Record<string, string> = {- en: "EN",- es: "ES",- "zh-CN": "中文",- ko: "한국어",- };- return (- <Button- type="button"- variant="ghost"- size="sm"- onClick={() => setLocale(next)}- className="h-7 rounded-[5px] px-2 text-[11px] font-semibold leading-none text-slate-300 hover:bg-white/10 hover:text-white transition-all"- title={t("common.app.language", "Language")}- aria-label={t("common.app.language", "Language")}- >- <span className="leading-none">{labels[locale] ?? locale.toUpperCase()}</span>- </Button>- );-}-export default function VideoEditor() {const { t } = useI18n();const smokeExportConfig = useMemo(@@ -465,9 +489,14 @@ 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 [autoApplyFreshRecordingAutoZooms, setAutoApplyFreshRecordingAutoZooms] = useState(+ initialEditorPreferences.autoApplyFreshRecordingAutoZooms,+ );const [connectZooms, setConnectZooms] = useState(initialEditorPreferences.connectZooms);const [zoomInDurationMs, setZoomInDurationMs] = useState(initialEditorPreferences.zoomInDurationMs ?? DEFAULT_ZOOM_IN_DURATION_MS,@@ -499,7 +528,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 +573,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 +587,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 +597,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,);@@ -616,9 +652,19 @@ export default function VideoEditor() {const mp4SupportRequestRef = useRef(0);const smokeExportStartedRef = useRef(false);const [historyVersion, setHistoryVersion] = useState(0);+ const timelineRef = useRef<TimelineEditorHandle>(null);++ function formatTime(seconds: number) {+ if (!isFinite(seconds) || isNaN(seconds) || seconds < 0) return "0:00";+ const mins = Math.floor(seconds / 60);+ const secs = Math.floor(seconds % 60);+ return `${mins}:${secs.toString().padStart(2, "0")}`;+ }++ const [timelineCollapsed, setTimelineCollapsed] = useState(false);useEffect(() => {- void window.electronAPI.getPlatform().then((platform) => {+ void window.electronAPI?.getPlatform?.()?.then((platform) => {setAppPlatform(platform);});}, []);@@ -756,7 +802,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 +824,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@@ -926,37 +977,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;@@ -1000,17 +1055,17 @@ export default function VideoEditor() {// Extension-contributed standalone section pages (no parentSection)const [extensionSectionButtons, setExtensionSectionButtons] = useState<- { id: EditorEffectSection; label: string; icon: typeof Puzzle | string }[]+ { id: EditorEffectSection; label: string; icon: typeof PhPuzzle | string }[]>([]);useEffect(() => {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),+ icon: p.panel.icon || (PhPuzzle as typeof PhPuzzle | string),}));setExtensionSectionButtons(standalone);};@@ -1020,34 +1075,39 @@ export default function VideoEditor() {const editorSectionButtons = useMemo(() => [- { id: "scene" as const, label: t("settings.sections.scene", "Scene"), icon: Sparkles },+ { id: "scene" as const, label: t("settings.sections.scene", "Scene"), icon: PhSparkle },{id: "cursor" as const,label: t("settings.sections.cursor", "Cursor"),- icon: MousePointer2,+ icon: PhCursorFill,+ },+ {+ id: "webcam" as const,+ label: t("settings.sections.webcam", "Webcam"),+ icon: PhCamera,},- { id: "webcam" as const, label: t("settings.sections.webcam", "Webcam"), icon: Camera },{id: "captions" as const,label: t("settings.sections.captions", "Captions"),- icon: Captions,+ icon: PhCaptions,+ },+ {+ id: "settings" as const,+ label: t("settings.sections.settings", "Settings"),+ icon: PhSettings,},...extensionSectionButtons,{id: "extensions" as const,label: t("settings.sections.extensions", "Extensions"),- icon: Puzzle,+ icon: PhPuzzle,},],[t, extensionSectionButtons],);useEffect(() => {- if (- activeEffectSection === "zoom" ||- activeEffectSection === "frame" ||- activeEffectSection === "crop"- ) {+ if (activeEffectSection === "frame" || activeEffectSection === "crop") {setActiveEffectSection("scene");}}, [activeEffectSection]);@@ -1128,7 +1188,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 +1208,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]);@@ -1208,6 +1271,7 @@ export default function VideoEditor() {shadowIntensity,backgroundBlur,zoomMotionBlur,+ autoApplyFreshRecordingAutoZooms,connectZooms,zoomInDurationMs,zoomInOverlapMs,@@ -1320,7 +1384,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 +1480,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 +1515,7 @@ export default function VideoEditor() {);nextClipIdRef.current = deriveNextId("clip",- ((normalizedEditor as any).clipRegions ?? []).map((region: ClipRegion) => region.id),+ normalizedEditor.clipRegions.map((region: ClipRegion) => region.id),);nextSpeedIdRef.current = deriveNextId("speed",@@ -1477,7 +1542,9 @@ export default function VideoEditor() {syncHistoryButtons();setLastSavedSnapshot(- cloneStructured(createProjectData(sourcePath, buildPersistedEditorState(normalizedEditor))),+ cloneStructured(+ createProjectData(sourcePath, buildPersistedEditorState(normalizedEditor)),+ ),);await refreshProjectLibrary();return true;@@ -1638,10 +1705,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);@@ -1658,7 +1729,8 @@ export default function VideoEditor() {setVideoPath(sourceVideoUrl);setCurrentProjectPath(null);setLastSavedSnapshot(null);- pendingFreshRecordingAutoZoomPathRef.current = sourceVideoUrl;+ pendingFreshRecordingAutoZoomPathRef.current =+ autoApplyFreshRecordingAutoZooms ? sourceVideoUrl : null;setWebcam((prev) => ({...prev,enabled: Boolean(sessionResult.session?.webcamPath),@@ -1675,7 +1747,8 @@ export default function VideoEditor() {setVideoPath(sourceVideoUrl);setCurrentProjectPath(null);setLastSavedSnapshot(null);- pendingFreshRecordingAutoZoomPathRef.current = sourceVideoUrl;+ pendingFreshRecordingAutoZoomPathRef.current =+ autoApplyFreshRecordingAutoZooms ? sourceVideoUrl : null;setWebcam((prev) => ({...prev,enabled: false,@@ -1692,8 +1765,12 @@ export default function VideoEditor() {}loadInitialData();-- }, [applyLoadedProject, smokeExportConfig.enabled, smokeExportConfig.inputPath]);+ }, [+ applyLoadedProject,+ autoApplyFreshRecordingAutoZooms,+ smokeExportConfig.enabled,+ smokeExportConfig.inputPath,+ ]);useEffect(() => {saveEditorPreferences({@@ -1741,6 +1818,7 @@ export default function VideoEditor() {shadowIntensity,backgroundBlur,zoomMotionBlur,+ autoApplyFreshRecordingAutoZooms,connectZooms,zoomInDurationMs,zoomInOverlapMs,@@ -1894,7 +1972,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 +2006,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;}@@ -2223,7 +2305,45 @@ export default function VideoEditor() {setTrimRegions(clipsToTrims(clipRegions, totalMs));}, [clipRegions, duration]);- const effectiveZoomRegions = zoomRegions;+ const mapTimelineTimeToSourceTime = useCallback(+ (timeMs: number) => {+ for (const clip of clipRegions) {+ if (timeMs < clip.startMs || timeMs > clip.endMs) continue;+ const speed = Number.isFinite(clip.speed) && clip.speed > 0 ? clip.speed : 1;+ return Math.round(clip.startMs + (timeMs - clip.startMs) * speed);+ }+ return Math.round(timeMs);+ },+ [clipRegions],+ );++ const mapSourceTimeToTimelineTime = useCallback(+ (timeMs: number) => {+ for (const clip of clipRegions) {+ const sourceEndMs = getClipSourceEndMs(clip);+ if (timeMs < clip.startMs || timeMs > sourceEndMs) continue;+ const speed = Number.isFinite(clip.speed) && clip.speed > 0 ? clip.speed : 1;+ return Math.round(clip.startMs + (timeMs - clip.startMs) / speed);+ }+ return Math.round(timeMs);+ },+ [clipRegions],+ );++ const effectiveZoomRegions = useMemo<ZoomRegion[]>(+ () =>+ zoomRegions.map((region) => ({+ ...region,+ startMs: mapTimelineTimeToSourceTime(region.startMs),+ endMs: mapTimelineTimeToSourceTime(region.endMs),+ })),+ [zoomRegions, mapTimelineTimeToSourceTime],+ );++ const timelinePlayheadTime = useMemo(+ () => mapSourceTimeToTimelineTime(currentTime * 1000) / 1000,+ [currentTime, mapSourceTimeToTimelineTime],+ );// Merge clip speeds into speed regions so playback + export respect per-clip speedconst effectiveSpeedRegions = useMemo<SpeedRegion[]>(() => {@@ -2232,7 +2352,7 @@ export default function VideoEditor() {.map((clip) => ({id: `clip-speed-${clip.id}`,startMs: clip.startMs,- endMs: clip.endMs,+ endMs: getClipSourceEndMs(clip),speed: clip.speed as SpeedRegion["speed"],}));if (clipDerived.length === 0) return speedRegions;@@ -2268,14 +2388,17 @@ export default function VideoEditor() {function handleSeek(time: number) {const video = videoPlaybackRef.current?.video;if (!video) return;- video.currentTime = time;+ video.currentTime = mapTimelineTimeToSourceTime(time * 1000) / 1000;}const handleSelectZoom = useCallback((id: string | null) => {setSelectedZoomId(id);if (id) {+ setActiveEffectSection("zoom");setSelectedTrimId(null);setSelectedAudioId(null);+ } else {+ setActiveEffectSection((s) => (s === "zoom" ? "scene" : s));}}, []);@@ -2297,47 +2420,57 @@ 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]);+ // Don't auto-select suggested zooms — they follow cursor and don't need user interaction+ extensionHost.emitEvent({+ type: "timeline:region-added",+ data: { id, startMs: newRegion.startMs, endMs: newRegion.endMs },+ });+ },+ [videoPath],+ );useEffect(() => {if (@@ -2474,11 +2607,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 +2619,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],);@@ -2508,73 +2637,111 @@ export default function VideoEditor() {const handleSelectClip = useCallback((id: string | null) => {setSelectedClipId(id);if (id) {+ setActiveEffectSection("clip");setSelectedZoomId(null);setSelectedAnnotationId(null);setSelectedAudioId(null);+ } else {+ setActiveEffectSection((s) => (s === "clip" ? "scene" : s));}}, []);- 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;+ const clip = clipRegions.find((c) => c.id === selectedClipId);+ if (!clip) return;+ const oldSpeed = clip.speed ?? 1;+ const sourceDurationMs = (clip.endMs - clip.startMs) * oldSpeed;+ const newEndMs = Math.round(clip.startMs + sourceDurationMs / speed);+ const scaleFactor = oldSpeed / speed;+setClipRegions((prev) =>- prev.map((clip) =>- clip.id === selectedClipId- ? { ...clip, speed }- : clip,- ),+ prev.map((c) => (c.id === selectedClipId ? { ...c, speed, endMs: newEndMs } : c)),+ );+ // Scale zoom regions that lie within this clip proportionally+ setZoomRegions((prev) =>+ prev.map((zoom) => {+ if (zoom.startMs < clip.startMs || zoom.startMs >= clip.endMs) return zoom;+ return {+ ...zoom,+ startMs: Math.round(+ clip.startMs + (zoom.startMs - clip.startMs) * scaleFactor,+ ),+ endMs: Math.round(clip.startMs + (zoom.endMs - clip.startMs) * scaleFactor),+ };+ }),+ );+ },+ [selectedClipId, clipRegions],+ );++ const handleClipMutedChange = useCallback(+ (muted: boolean) => {+ if (!selectedClipId) return;+ setClipRegions((prev) =>+ prev.map((clip) => (clip.id === selectedClipId ? { ...clip, muted } : clip)),);},[selectedClipId],@@ -2649,7 +2816,7 @@ export default function VideoEditor() {}}, []);- const handleAudioAdded = useCallback((span: Span, audioPath: string) => {+ const handleAudioAdded = useCallback((span: Span, audioPath: string, trackIndex?: number) => {const id = `audio-${nextAudioIdRef.current++}`;const newRegion: AudioRegion = {id,@@ -2657,6 +2824,7 @@ export default function VideoEditor() {endMs: Math.round(span.end),audioPath,volume: 1,+ trackIndex,};setAudioRegions((prev) => [...prev, newRegion]);setSelectedAudioId(id);@@ -2694,13 +2862,15 @@ 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],);- const handleAnnotationAdded = useCallback((span: Span) => {+ const handleAnnotationAdded = useCallback((span: Span, trackIndex = 0) => {const id = `annotation-${nextAnnotationIdRef.current++}`;const zIndex = nextAnnotationZIndexRef.current++; // Assign z-index based on creation orderconst newRegion: AnnotationRegion = {@@ -2713,6 +2883,7 @@ export default function VideoEditor() {size: { ...DEFAULT_ANNOTATION_SIZE },style: { ...DEFAULT_ANNOTATION_STYLE },zIndex,+ trackIndex,};setAnnotationRegions((prev) => [...prev, newRegion]);setSelectedAnnotationId(id);@@ -3192,7 +3363,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 +3393,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 +3521,7 @@ export default function VideoEditor() {? await window.electronAPI.writeExportedVideoToPath(arrayBuffer,smokeExportConfig.outputPath,- )+ ): await window.electronAPI.saveExportedVideo(arrayBuffer, fileName);if (saveResult.canceled) {@@ -3391,28 +3564,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 +3679,9 @@ export default function VideoEditor() {const exporter =pipelineModel === "modern"? new ModernVideoExporter({- ...exporterConfig,- backendPreference,- })+ ...exporterConfig,+ backendPreference,+ }): new VideoExporter(exporterConfig);exporterRef.current = exporter;@@ -3527,7 +3702,7 @@ export default function VideoEditor() {? await window.electronAPI.writeExportedVideoToPath(arrayBuffer,smokeExportConfig.outputPath,- )+ ): await window.electronAPI.saveExportedVideo(arrayBuffer, fileName);if (saveResult.canceled) {@@ -3654,7 +3829,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);@@ -3932,19 +4107,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 +4143,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 +4153,7 @@ export default function VideoEditor() {const pathLabel =rendererLabel && encoderLabel? `${rendererLabel} + ${encoderLabel}`- : rendererLabel ?? encoderLabel;+ : (rendererLabel ?? encoderLabel);if (!pathLabel) {return encoderName ?? null;@@ -4052,7 +4228,6 @@ export default function VideoEditor() {className={`flex items-center gap-1.5 justify-self-start ${headerLeftControlsPaddingClass}`}style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}>- <LanguageSwitcher /><Buttontype="button"variant="ghost"@@ -4065,7 +4240,6 @@ export default function VideoEditor() {<FolderOpen className="h-4 w-4" /></Button><DiscordLinkButton />- <KeyboardShortcutsDialog /><FeedbackDialog /><div className="ml-1 h-5 w-px bg-white/10" /><Button@@ -4098,7 +4272,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 +4296,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>+ <Save className="h-4 w-4" weight="fill" />+ <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 +4338,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 +4359,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 +4380,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 +4410,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 +4449,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()}@@ -4305,60 +4504,302 @@ export default function VideoEditor() {</div><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">+ {/* Settings sidebar */}+ <div className="flex flex-shrink-0 gap-1.5">+ {/* Icon rail */}+ <div className="flex flex-shrink-0 flex-col items-center gap-0.5 px-2 py-2">+ {editorSectionButtons.map((section) => {+ const isActive = activeEffectSection === section.id;+ return (+ <div key={section.id} className="flex items-center">+ <motion.button+ type="button"+ onClick={() => setActiveEffectSection(section.id)}+ title={section.label}+ className="group relative flex h-9 w-9 items-center justify-center rounded-lg outline-none focus:outline-none focus-visible:outline-none"+ animate={{ opacity: isActive ? 1 : 0.55 }}+ transition={{ duration: 0.14 }}+ >+ {isActive && (+ <motion.span+ layoutId="rail-active-bg"+ className="absolute inset-0 rounded-lg bg-white/[0.08]"+ transition={{+ type: "spring",+ stiffness: 450,+ damping: 35,+ }}+ />+ )}+ <motion.span+ className="relative z-10"+ animate={{+ color: isActive+ ? "#2563EB"+ : "rgba(255,255,255,1)",+ }}+ transition={{ duration: 0.14 }}+ >+ {typeof section.icon === "string" ? (+ <ExtensionIcon+ icon={section.icon}+ className="h-[27px] w-[27px]"+ />+ ) : (+ <section.icon+ className="h-[27px] w-[27px]"+ weight={isActive ? "fill" : "regular"}+ />+ )}+ </motion.span>+ </motion.button>+ <div className="ml-1.5 h-1.5 w-1.5 flex-shrink-0">+ {isActive && (+ <motion.span+ layoutId="rail-active-dot"+ className="block h-1.5 w-1.5 rounded-full bg-[#2563EB]"+ initial={{ opacity: 0, scale: 0.5 }}+ animate={{ opacity: 1, scale: 1 }}+ exit={{ opacity: 0, scale: 0.5 }}+ transition={{+ type: "spring",+ stiffness: 500,+ damping: 32,+ }}+ />+ )}+ </div>+ </div>+ );+ })}+ <div className="mt-auto pt-3">+ <motion.button+ type="button"+ onClick={() => toast.info("Account coming soon")}+ title="Account"+ className="group relative flex h-9 w-9 items-center justify-center rounded-lg text-white/55 outline-none transition hover:text-white focus:outline-none focus-visible:outline-none"+ whileHover={{ opacity: 1 }}+ initial={{ opacity: 0.55 }}+ >+ <motion.span+ className="absolute inset-0 rounded-lg bg-white/[0.04] opacity-0 transition group-hover:opacity-100"+ />+ <User className="relative z-10 h-[22px] w-[22px]" />+ </motion.button>+ </div>+ </div>+ {/* Panel */}+ {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+ }+ selectedClipMuted={+ selectedClipId+ ? (clipRegions.find((c) => c.id === selectedClipId)+ ?.muted ?? false)+ : null+ }+ onClipSpeedChange={(speed) =>+ selectedClipId && handleClipSpeedChange(speed)+ }+ onClipMutedChange={(muted) =>+ selectedClipId && handleClipMutedChange(muted)+ }+ onClipDelete={handleClipDelete}+ shadowIntensity={shadowIntensity}+ onShadowChange={setShadowIntensity}+ backgroundBlur={backgroundBlur}+ onBackgroundBlurChange={setBackgroundBlur}+ zoomMotionBlur={zoomMotionBlur}+ onZoomMotionBlurChange={setZoomMotionBlur}+ autoApplyFreshRecordingAutoZooms={autoApplyFreshRecordingAutoZooms}+ onAutoApplyFreshRecordingAutoZoomsChange={+ setAutoApplyFreshRecordingAutoZooms+ }+ 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>+ {/* Right column: preview + timeline */}+ <div className="flex min-h-0 flex-1 flex-col gap-3">+ {/* Preview */}+ <div className="flex min-h-0 flex-1 flex-col">+ <div className="relative flex flex-1 min-h-0 flex-col overflow-hidden">+ {/* Aspect ratio + crop controls above preview */}+ <div className="flex items-center justify-center gap-2 py-1.5 flex-shrink-0">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ variant="ghost"+ size="sm"+ className="h-7 px-2 text-xs text-white hover:text-white 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="center"+ className="bg-[#1a1a1c] border-white/10"+ >+ {ASPECT_RATIOS.map((ratio) => (+ <DropdownMenuItem+ key={ratio}+ onClick={() => setAspectRatio(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>+ ))}+ </DropdownMenuContent>+ </DropdownMenu>+ <div className="w-[1px] h-4 bg-white/20" />+ <Button+ variant="ghost"+ size="sm"+ onClick={handleOpenCropEditor}+ className="h-7 px-2 text-xs text-white hover:text-white hover:bg-white/10 transition-all gap-1.5"+ >+ <Crop className="w-3.5 h-3.5" />+ <span className="font-medium">+ {t("settings.crop.title")}+ </span>+ {isCropped ? (+ <span className="h-1.5 w-1.5 rounded-full bg-[#2563EB]" />+ ) : null}+ </Button>+ </div>{/* Video preview */}<divclassName="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="flex min-w-0 flex-1 items-center justify-center px-1"><divclassName="relative overflow-hidden rounded-[30px]"style={{@@ -4367,9 +4808,16 @@ export default function VideoEditor() {aspectRatio: getAspectRatioValue(aspectRatio,(() => {- const previewVideo = videoPlaybackRef.current?.video;- if (previewVideo && previewVideo.videoHeight > 0) {- return previewVideo.videoWidth / previewVideo.videoHeight;+ const previewVideo =+ videoPlaybackRef.current?.video;+ if (+ previewVideo &&+ previewVideo.videoHeight > 0+ ) {+ return (+ previewVideo.videoWidth /+ previewVideo.videoHeight+ );}return 16 / 9;})(),@@ -4414,7 +4862,11 @@ export default function VideoEditor() {frame={frame}cropRegion={cropRegion}webcam={webcam}- webcamVideoPath={webcam.sourcePath ? toFileUrl(webcam.sourcePath) : null}+ webcamVideoPath={+ webcam.sourcePath+ ? toFileUrl(webcam.sourcePath)+ : null+ }trimRegions={trimRegions}speedRegions={effectiveSpeedRegions}annotationRegions={annotationRegions}@@ -4422,7 +4874,9 @@ export default function VideoEditor() {autoCaptionSettings={autoCaptionSettings}selectedAnnotationId={selectedAnnotationId}onSelectAnnotation={handleSelectAnnotation}- onAnnotationPositionChange={handleAnnotationPositionChange}+ onAnnotationPositionChange={+ handleAnnotationPositionChange+ }onAnnotationSizeChange={handleAnnotationSizeChange}cursorTelemetry={effectiveCursorTelemetry}showCursor={showCursor}@@ -4433,167 +4887,236 @@ export default function VideoEditor() {zoomClassicMode={zoomClassicMode}cursorMotionBlur={cursorMotionBlur}cursorClickBounce={cursorClickBounce}- cursorClickBounceDuration={cursorClickBounceDuration}+ cursorClickBounceDuration={+ cursorClickBounceDuration+ }cursorSway={cursorSway}volume={hasSourceAudioFallback ? 0 : previewVolume}/></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>+ </div>+ {/* Toolbar - sits at bottom of right column, only spans preview width */}+ <div className="relative flex flex-shrink-0 items-center px-1 py-1">+ {/* Left tools */}+ <div className="z-10 flex min-w-0 flex-1 items-center gap-1.5">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ variant="ghost"+ size="sm"+ className="h-7 gap-1 rounded-full border border-white/[0.08] bg-white/[0.04] px-2.5 text-[11px] text-white/65 shadow-[inset_0_1px_0_rgba(255,255,255,0.06)] transition-all hover:bg-white/[0.08] hover:text-white"+ >+ <Plus className="w-3.5 h-3.5" />+ <span className="font-medium">Add Layer</span>+ <ChevronDown className="w-3 h-3" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ align="start"+ className="bg-[#1a1a1c] border-white/10"+ >+ <DropdownMenuItem+ onClick={() => {+ const nextTrackIndex =+ annotationRegions.length > 0+ ? Math.max(+ ...annotationRegions.map(+ (r) => r.trackIndex ?? 0,+ ),+ ) + 1+ : 0;+ timelineRef.current?.addAnnotation(nextTrackIndex);+ }}+ className="text-slate-300 hover:text-white hover:bg-white/10 cursor-pointer"+ >+ Annotation+ </DropdownMenuItem>+ <DropdownMenuItem+ onClick={() => timelineRef.current?.addAudio()}+ className="text-slate-300 hover:text-white hover:bg-white/10 cursor-pointer"+ >+ Audio+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ <div className="w-[1px] h-4 bg-white/10 mx-1" />+ <Button+ onClick={() => timelineRef.current?.addZoom()}+ variant="ghost"+ size="icon"+ className="h-7 w-7 rounded-full text-slate-400 transition-all hover:bg-[#2563EB]/10 hover:text-[#2563EB]"+ title="Add Zoom (Z)"+ >+ <ZoomIn className="w-4 h-4" />+ </Button>+ <Button+ onClick={() => timelineRef.current?.suggestZooms()}+ variant="ghost"+ size="icon"+ className="h-7 w-7 rounded-full text-slate-400 transition-all hover:bg-[#2563EB]/10 hover:text-[#2563EB]"+ title="Suggest Zooms from Cursor"+ >+ <WandSparkles className="w-4 h-4" />+ </Button>+ <Button+ onClick={() => timelineRef.current?.splitClip()}+ variant="ghost"+ size="icon"+ className="h-7 w-7 rounded-full text-slate-400 transition-all hover:bg-white/10 hover:text-white"+ title="Split Clip (C)"+ >+ <Scissors className="w-4 h-4" />+ </Button>+ </div>+ {/* Playback controls - centered */}+ <div className="absolute inset-0 z-10 flex items-center justify-center pointer-events-none">+ <div className="flex items-center gap-1.5 pointer-events-auto">+ <span className="mr-1 text-[10px] font-medium tabular-nums text-slate-400">+ {formatTime(timelinePlayheadTime)}+ </span>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 rounded-full text-slate-400 transition-all hover:bg-white/10 hover:text-white"+ title="Skip Back"+ onClick={() => {+ const currentMs = timelinePlayheadTime * 1000;+ const kfs = timelineRef.current?.keyframes ?? [];+ const prev = [...kfs]+ .reverse()+ .find((k) => k.time < currentMs - 50);+ handleSeek(+ prev+ ? prev.time / 1000+ : Math.max(0, timelinePlayheadTime - 5),+ );+ }}+ >+ <SkipBack className="w-3.5 h-3.5" weight="fill" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className={`h-7 w-7 rounded-full border border-white/10 transition-all shadow-[0_8px_18px_rgba(0,0,0,0.18)] ${isPlaying ? "bg-white/10 text-white hover:bg-white/20" : "bg-white text-black hover:bg-white/90"}`}+ onClick={togglePlayPause}+ title={isPlaying ? "Pause" : "Play"}+ >+ {isPlaying ? (+ <Pause className="w-3.5 h-3.5" weight="fill" />+ ) : (+ <Play className="w-3.5 h-3.5" weight="fill" />+ )}+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 rounded-full text-slate-400 transition-all hover:bg-white/10 hover:text-white"+ title="Skip Forward"+ onClick={() => {+ const currentMs = timelinePlayheadTime * 1000;+ const kfs = timelineRef.current?.keyframes ?? [];+ const next = kfs.find((k) => k.time > currentMs + 50);+ handleSeek(+ next+ ? next.time / 1000+ : Math.min(duration, timelinePlayheadTime + 5),+ );+ }}+ >+ <SkipForward className="w-3.5 h-3.5" weight="fill" />+ </Button>+ <span className="text-[10px] font-medium text-slate-500 tabular-nums ml-1">+ {formatTime(duration)}+ </span>+ </div>+ </div>+ {/* Right: collapse + volume */}+ <div className="z-10 ml-auto flex items-center gap-2">+ <Button+ variant="ghost"+ size="icon"+ title={+ timelineCollapsed ? "Expand Timeline" : "Collapse Timeline"+ }+ className="h-7 w-7 rounded-full text-slate-400 transition-all hover:bg-white/10 hover:text-white"+ onClick={() => {+ timelineRef.current?.toggleCollapsed();+ setTimelineCollapsed((p) => !p);}}>- <div style={{ width: "100%", maxWidth: "700px" }}>- <PlaybackControls- isPlaying={isPlaying}- currentTime={currentTime}- duration={duration}- onTogglePlayPause={togglePlayPause}- onSeek={handleSeek}- volume={previewVolume}- onVolumeChange={setPreviewVolume}+ {timelineCollapsed ? (+ <ChevronUp className="w-3.5 h-3.5" />+ ) : (+ <ChevronDown className="w-3.5 h-3.5" />+ )}+ </Button>+ <div className="flex items-center gap-1.5">+ <button+ type="button"+ className="text-slate-400 hover:text-white transition-colors"+ title="Mute/Unmute"+ onClick={() =>+ setPreviewVolume(previewVolume <= 0.001 ? 1 : 0)+ }+ >+ {previewVolume <= 0.001 ? (+ <VolumeX className="w-3.5 h-3.5" />+ ) : previewVolume < 0.5 ? (+ <Volume1 className="w-3.5 h-3.5" />+ ) : (+ <Volume2 className="w-3.5 h-3.5" />+ )}+ </button>+ <div className="relative flex h-7 w-24 select-none items-center overflow-hidden rounded-full border border-white/[0.06] bg-black/55 shadow-[inset_0_1px_0_rgba(255,255,255,0.06)]">+ <div+ className="absolute inset-y-[3px] left-[3px] right-auto rounded-[10px] bg-white/[0.08]"+ style={{+ width:+ previewVolume > 0+ ? `max(calc(${previewVolume * 100}% - 6px), 1.2rem)`+ : 0,+ }}+ />+ <div+ className="pointer-events-none absolute bottom-[18%] top-[18%] z-10 w-[2px] rounded-full bg-white/95 shadow-[0_0_10px_rgba(37,99,235,0.28)]"+ style={{ left: `calc(${previewVolume * 100}% - 8px)` }}+ />+ <span className="pointer-events-none relative z-10 pl-2 text-[10px] font-medium text-slate-400">+ {Math.round(previewVolume * 100)}%+ </span>+ <input+ type="range"+ min="0"+ max="1"+ step="0.01"+ value={previewVolume}+ onChange={(e) =>+ setPreviewVolume(Number(e.target.value))+ }+ className="absolute inset-0 h-full w-full cursor-ew-resize opacity-0"/></div></div></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>- </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="flex-shrink-0 flex flex-col"+ style={{+ height: timelineCollapsed ? undefined : "15%",+ minHeight: timelineCollapsed ? 0 : 160,+ }}+ ><TimelineEditor+ ref={timelineRef}+ hideToolbarvideoDuration={duration}currentTime={currentTime}+ playheadTime={timelinePlayheadTime}onSeek={handleSeek}videoPath={videoPath}cursorTelemetry={normalizedCursorTelemetry}@@ -4636,9 +5159,10 @@ export default function VideoEditor() {selectedAnnotationId={selectedAnnotationId}onSelectAnnotation={handleSelectAnnotation}aspectRatio={aspectRatio}- onAspectRatioChange={setAspectRatio}- onOpenCropEditor={handleOpenCropEditor}- isCropped={isCropped}+ isPlaying={isPlaying}+ onTogglePlayPause={togglePlayPause}+ volume={previewVolume}+ onVolumeChange={setPreviewVolume}/></div></div>@@ -4652,8 +5176,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/editorPreferences.test.ts b/src/components/video-editor/editorPreferences.test.tsindex 0958f0ad..b74ee159 100644--- a/src/components/video-editor/editorPreferences.test.ts+++ b/src/components/video-editor/editorPreferences.test.ts@@ -97,6 +97,7 @@ describe("editorPreferences", () => {cursorSway: DEFAULT_EDITOR_PREFERENCES.cursorSway,borderRadius: DEFAULT_EDITOR_PREFERENCES.borderRadius,padding: DEFAULT_EDITOR_PREFERENCES.padding,+ frame: DEFAULT_EDITOR_PREFERENCES.frame,aspectRatio: "native",exportEncodingMode: DEFAULT_EDITOR_PREFERENCES.exportEncodingMode,exportBackendPreference: DEFAULT_EDITOR_PREFERENCES.exportBackendPreference,@@ -111,6 +112,8 @@ describe("editorPreferences", () => {customAspectWidth: "21",customAspectHeight: "9",customWallpapers: ["data:image/jpeg;base64,abc"],+ autoApplyFreshRecordingAutoZooms:+ DEFAULT_EDITOR_PREFERENCES.autoApplyFreshRecordingAutoZooms,whisperExecutablePath: DEFAULT_EDITOR_PREFERENCES.whisperExecutablePath,whisperModelPath: DEFAULT_EDITOR_PREFERENCES.whisperModelPath,});@@ -167,6 +170,7 @@ describe("editorPreferences", () => {cursorSway: DEFAULT_EDITOR_PREFERENCES.cursorSway,borderRadius: DEFAULT_EDITOR_PREFERENCES.borderRadius,padding: DEFAULT_EDITOR_PREFERENCES.padding,+ frame: DEFAULT_EDITOR_PREFERENCES.frame,exportEncodingMode: DEFAULT_EDITOR_PREFERENCES.exportEncodingMode,exportBackendPreference: DEFAULT_EDITOR_PREFERENCES.exportBackendPreference,exportPipelineModel: DEFAULT_EDITOR_PREFERENCES.exportPipelineModel,@@ -180,6 +184,8 @@ describe("editorPreferences", () => {customAspectWidth: "21",customAspectHeight: "9",customWallpapers: DEFAULT_EDITOR_PREFERENCES.customWallpapers,+ autoApplyFreshRecordingAutoZooms:+ DEFAULT_EDITOR_PREFERENCES.autoApplyFreshRecordingAutoZooms,whisperExecutablePath: DEFAULT_EDITOR_PREFERENCES.whisperExecutablePath,whisperModelPath: DEFAULT_EDITOR_PREFERENCES.whisperModelPath,});@@ -231,6 +237,7 @@ describe("editorPreferences", () => {cursorSway: 1.5,borderRadius: 18,padding: 30,+ frame: DEFAULT_EDITOR_PREFERENCES.frame,aspectRatio: "4:5",exportEncodingMode: "quality",exportBackendPreference: DEFAULT_EDITOR_PREFERENCES.exportBackendPreference,@@ -244,6 +251,7 @@ describe("editorPreferences", () => {customAspectWidth: "4",customAspectHeight: "5",customWallpapers: ["data:image/jpeg;base64,abc", "data:image/jpeg;base64,abc"],+ autoApplyFreshRecordingAutoZooms: false,});expect(loadEditorPreferences()).toEqual({@@ -271,6 +279,7 @@ describe("editorPreferences", () => {cursorSway: 1.5,borderRadius: 18,padding: 30,+ frame: DEFAULT_EDITOR_PREFERENCES.frame,aspectRatio: "4:5",exportEncodingMode: "quality",exportBackendPreference: DEFAULT_EDITOR_PREFERENCES.exportBackendPreference,@@ -285,6 +294,7 @@ describe("editorPreferences", () => {customAspectWidth: "4",customAspectHeight: "5",customWallpapers: ["data:image/jpeg;base64,abc"],+ autoApplyFreshRecordingAutoZooms: false,whisperExecutablePath: DEFAULT_EDITOR_PREFERENCES.whisperExecutablePath,whisperModelPath: DEFAULT_EDITOR_PREFERENCES.whisperModelPath,});diff --git a/src/components/video-editor/editorPreferences.ts b/src/components/video-editor/editorPreferences.tsindex f7e20bd9..c9be18ab 100644--- a/src/components/video-editor/editorPreferences.ts+++ b/src/components/video-editor/editorPreferences.ts@@ -52,6 +52,7 @@ export interface EditorPreferences extends PersistedEditorControls {customAspectWidth: string;customAspectHeight: string;customWallpapers: string[];+ autoApplyFreshRecordingAutoZooms: boolean;whisperExecutablePath: string | null;whisperModelPath: string | null;}@@ -100,10 +101,15 @@ export const DEFAULT_EDITOR_PREFERENCES: EditorPreferences = {customAspectWidth: "16",customAspectHeight: "9",customWallpapers: [],+ autoApplyFreshRecordingAutoZooms: true,whisperExecutablePath: null,whisperModelPath: null,};+function normalizeBoolean(value: unknown, fallback: boolean): boolean {+ return typeof value === "boolean" ? value : fallback;+}+function normalizePositiveIntegerString(value: unknown, fallback: string): string {if (typeof value !== "string" || value.trim().length === 0) {return fallback;@@ -123,7 +129,9 @@ function normalizeCustomWallpapers(value: unknown, fallback: string[]): string[]}return Array.from(- new Set(value.filter((item): item is string => typeof item === "string" && item.length > 0)),+ new Set(+ value.filter((item): item is string => typeof item === "string" && item.length > 0),+ ),);}@@ -150,12 +158,10 @@ function normalizeEditorControls(zoomInOverlapMs: raw.zoomInOverlapMs ?? fallback.zoomInOverlapMs,zoomOutDurationMs: raw.zoomOutDurationMs ?? fallback.zoomOutDurationMs,connectedZoomGapMs: raw.connectedZoomGapMs ?? fallback.connectedZoomGapMs,- connectedZoomDurationMs:- raw.connectedZoomDurationMs ?? fallback.connectedZoomDurationMs,+ connectedZoomDurationMs: raw.connectedZoomDurationMs ?? fallback.connectedZoomDurationMs,zoomInEasing: raw.zoomInEasing ?? fallback.zoomInEasing,zoomOutEasing: raw.zoomOutEasing ?? fallback.zoomOutEasing,- connectedZoomEasing:- raw.connectedZoomEasing ?? fallback.connectedZoomEasing,+ connectedZoomEasing: raw.connectedZoomEasing ?? fallback.connectedZoomEasing,showCursor: raw.showCursor ?? fallback.showCursor,loopCursor: raw.loopCursor ?? fallback.loopCursor,cursorStyle: raw.cursorStyle ?? fallback.cursorStyle,@@ -250,11 +256,17 @@ export function normalizeEditorPreferences(raw.customAspectHeight,fallback.customAspectHeight,),- customWallpapers: normalizeCustomWallpapers(raw.customWallpapers, fallback.customWallpapers),+ customWallpapers: normalizeCustomWallpapers(+ raw.customWallpapers,+ fallback.customWallpapers,+ ),+ autoApplyFreshRecordingAutoZooms: normalizeBoolean(+ raw.autoApplyFreshRecordingAutoZooms,+ fallback.autoApplyFreshRecordingAutoZooms,+ ),whisperExecutablePath:normalizeNullablePath(raw.whisperExecutablePath) ?? fallback.whisperExecutablePath,- whisperModelPath:- normalizeNullablePath(raw.whisperModelPath) ?? fallback.whisperModelPath,+ whisperModelPath: normalizeNullablePath(raw.whisperModelPath) ?? fallback.whisperModelPath,};}diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.tsindex 96977a38..d5b4357f 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,@@ -151,7 +151,7 @@ export function normalizeExportPipelineModel(value: unknown): ExportPipelineModereturn value;}- return "legacy";+ return "modern";}export function normalizeExportMp4FrameRate(value: unknown): ExportMp4FrameRate {@@ -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,41 @@ 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,};}): [];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 +426,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 +439,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 +486,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 +497,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 +513,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 +532,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 +546,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 +563,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 +605,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 +700,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 +714,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 +742,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 +789,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/contexts/I18nContext.tsx b/src/contexts/I18nContext.tsxindex d893ae07..b9db5fa3 100644--- a/src/contexts/I18nContext.tsx+++ b/src/contexts/I18nContext.tsx@@ -1,261 +1,268 @@import {- createContext,- useCallback,- useContext,- useEffect,- useMemo,- useState,- type ReactNode,-} from 'react'+ createContext,+ type ReactNode,+ useCallback,+ useContext,+ useEffect,+ useMemo,+ useState,+} from "react";import {- DEFAULT_LOCALE,- I18N_NAMESPACES,- SUPPORTED_LOCALES,- type AppLocale,- type I18nNamespace,-} from '@/i18n/config'-import enCommon from '@/i18n/locales/en/common.json'-import enDialogs from '@/i18n/locales/en/dialogs.json'-import enEditor from '@/i18n/locales/en/editor.json'-import enLaunch from '@/i18n/locales/en/launch.json'-import enSettings from '@/i18n/locales/en/settings.json'-import enShortcuts from '@/i18n/locales/en/shortcuts.json'-import enTimeline from '@/i18n/locales/en/timeline.json'-import enExtensions from '@/i18n/locales/en/extensions.json'-import esCommon from '@/i18n/locales/es/common.json'-import esDialogs from '@/i18n/locales/es/dialogs.json'-import esEditor from '@/i18n/locales/es/editor.json'-import esLaunch from '@/i18n/locales/es/launch.json'-import esSettings from '@/i18n/locales/es/settings.json'-import esShortcuts from '@/i18n/locales/es/shortcuts.json'-import esTimeline from '@/i18n/locales/es/timeline.json'-import esExtensions from '@/i18n/locales/es/extensions.json'-import nlCommon from '@/i18n/locales/nl/common.json'-import nlDialogs from '@/i18n/locales/nl/dialogs.json'-import nlEditor from '@/i18n/locales/nl/editor.json'-import nlLaunch from '@/i18n/locales/nl/launch.json'-import nlSettings from '@/i18n/locales/nl/settings.json'-import nlShortcuts from '@/i18n/locales/nl/shortcuts.json'-import nlTimeline from '@/i18n/locales/nl/timeline.json'-import nlExtensions from '@/i18n/locales/nl/extensions.json'-import koCommon from '@/i18n/locales/ko/common.json'-import koDialogs from '@/i18n/locales/ko/dialogs.json'-import koEditor from '@/i18n/locales/ko/editor.json'-import koLaunch from '@/i18n/locales/ko/launch.json'-import koSettings from '@/i18n/locales/ko/settings.json'-import koShortcuts from '@/i18n/locales/ko/shortcuts.json'-import koTimeline from '@/i18n/locales/ko/timeline.json'-import koExtensions from '@/i18n/locales/ko/extensions.json'-import zhCNCommon from '@/i18n/locales/zh-CN/common.json'-import zhCNDialogs from '@/i18n/locales/zh-CN/dialogs.json'-import zhCNEditor from '@/i18n/locales/zh-CN/editor.json'-import zhCNLaunch from '@/i18n/locales/zh-CN/launch.json'-import zhCNSettings from '@/i18n/locales/zh-CN/settings.json'-import zhCNShortcuts from '@/i18n/locales/zh-CN/shortcuts.json'-import zhCNTimeline from '@/i18n/locales/zh-CN/timeline.json'-import zhCNExtensions from '@/i18n/locales/zh-CN/extensions.json'--const LOCALE_STORAGE_KEY = 'recordly.locale'--type LocaleBundle = Record<I18nNamespace, Record<string, unknown>>+ type AppLocale,+ DEFAULT_LOCALE,+ I18N_NAMESPACES,+ type I18nNamespace,+ SUPPORTED_LOCALES,+} from "@/i18n/config";+import enCommon from "@/i18n/locales/en/common.json";+import enDialogs from "@/i18n/locales/en/dialogs.json";+import enEditor from "@/i18n/locales/en/editor.json";+import enExtensions from "@/i18n/locales/en/extensions.json";+import enLaunch from "@/i18n/locales/en/launch.json";+import enSettings from "@/i18n/locales/en/settings.json";+import enShortcuts from "@/i18n/locales/en/shortcuts.json";+import enTimeline from "@/i18n/locales/en/timeline.json";+import esCommon from "@/i18n/locales/es/common.json";+import esDialogs from "@/i18n/locales/es/dialogs.json";+import esEditor from "@/i18n/locales/es/editor.json";+import esExtensions from "@/i18n/locales/es/extensions.json";+import esLaunch from "@/i18n/locales/es/launch.json";+import esSettings from "@/i18n/locales/es/settings.json";+import esShortcuts from "@/i18n/locales/es/shortcuts.json";+import esTimeline from "@/i18n/locales/es/timeline.json";+import koCommon from "@/i18n/locales/ko/common.json";+import koDialogs from "@/i18n/locales/ko/dialogs.json";+import koEditor from "@/i18n/locales/ko/editor.json";+import koExtensions from "@/i18n/locales/ko/extensions.json";+import koLaunch from "@/i18n/locales/ko/launch.json";+import koSettings from "@/i18n/locales/ko/settings.json";+import koShortcuts from "@/i18n/locales/ko/shortcuts.json";+import koTimeline from "@/i18n/locales/ko/timeline.json";+import nlCommon from "@/i18n/locales/nl/common.json";+import nlDialogs from "@/i18n/locales/nl/dialogs.json";+import nlEditor from "@/i18n/locales/nl/editor.json";+import nlExtensions from "@/i18n/locales/nl/extensions.json";+import nlLaunch from "@/i18n/locales/nl/launch.json";+import nlSettings from "@/i18n/locales/nl/settings.json";+import nlShortcuts from "@/i18n/locales/nl/shortcuts.json";+import nlTimeline from "@/i18n/locales/nl/timeline.json";+import zhCNCommon from "@/i18n/locales/zh-CN/common.json";+import zhCNDialogs from "@/i18n/locales/zh-CN/dialogs.json";+import zhCNEditor from "@/i18n/locales/zh-CN/editor.json";+import zhCNExtensions from "@/i18n/locales/zh-CN/extensions.json";+import zhCNLaunch from "@/i18n/locales/zh-CN/launch.json";+import zhCNSettings from "@/i18n/locales/zh-CN/settings.json";+import zhCNShortcuts from "@/i18n/locales/zh-CN/shortcuts.json";+import zhCNTimeline from "@/i18n/locales/zh-CN/timeline.json";++const LOCALE_STORAGE_KEY = "recordly.locale";++type LocaleBundle = Record<I18nNamespace, Record<string, unknown>>;const messages: Record<AppLocale, LocaleBundle> = {- en: {- common: enCommon,- launch: enLaunch,- editor: enEditor,- timeline: enTimeline,- settings: enSettings,- dialogs: enDialogs,- shortcuts: enShortcuts,- extensions: enExtensions,- },- es: {- common: esCommon,- launch: esLaunch,- editor: esEditor,- timeline: esTimeline,- settings: esSettings,- dialogs: esDialogs,- shortcuts: esShortcuts,- extensions: esExtensions,- },- nl: {- common: nlCommon,- launch: nlLaunch,- editor: nlEditor,- timeline: nlTimeline,- settings: nlSettings,- dialogs: nlDialogs,- shortcuts: nlShortcuts,- extensions: nlExtensions,- },- ko: {- common: koCommon,- launch: koLaunch,- editor: koEditor,- timeline: koTimeline,- settings: koSettings,- dialogs: koDialogs,- shortcuts: koShortcuts,- extensions: koExtensions,- },- 'zh-CN': {- common: zhCNCommon,- launch: zhCNLaunch,- editor: zhCNEditor,- timeline: zhCNTimeline,- settings: zhCNSettings,- dialogs: zhCNDialogs,- shortcuts: zhCNShortcuts,- extensions: zhCNExtensions,- },-} as const+ en: {+ common: enCommon,+ launch: enLaunch,+ editor: enEditor,+ timeline: enTimeline,+ settings: enSettings,+ dialogs: enDialogs,+ shortcuts: enShortcuts,+ extensions: enExtensions,+ },+ es: {+ common: esCommon,+ launch: esLaunch,+ editor: esEditor,+ timeline: esTimeline,+ settings: esSettings,+ dialogs: esDialogs,+ shortcuts: esShortcuts,+ extensions: esExtensions,+ },+ nl: {+ common: nlCommon,+ launch: nlLaunch,+ editor: nlEditor,+ timeline: nlTimeline,+ settings: nlSettings,+ dialogs: nlDialogs,+ shortcuts: nlShortcuts,+ extensions: nlExtensions,+ },+ ko: {+ common: koCommon,+ launch: koLaunch,+ editor: koEditor,+ timeline: koTimeline,+ settings: koSettings,+ dialogs: koDialogs,+ shortcuts: koShortcuts,+ extensions: koExtensions,+ },+ "zh-CN": {+ common: zhCNCommon,+ launch: zhCNLaunch,+ editor: zhCNEditor,+ timeline: zhCNTimeline,+ settings: zhCNSettings,+ dialogs: zhCNDialogs,+ shortcuts: zhCNShortcuts,+ extensions: zhCNExtensions,+ },+} as const;interface I18nContextValue {- locale: AppLocale- setLocale: (locale: AppLocale) => void- t: (key: string, fallback?: string, vars?: Record<string, string | number>) => string+ locale: AppLocale;+ setLocale: (locale: AppLocale) => void;+ t: (key: string, fallback?: string, vars?: Record<string, string | number>) => string;}-const I18nContext = createContext<I18nContextValue | null>(null)+const I18nContext = createContext<I18nContextValue | null>(null);function isSupportedLocale(locale: string): locale is AppLocale {- return SUPPORTED_LOCALES.includes(locale as AppLocale)+ return SUPPORTED_LOCALES.includes(locale as AppLocale);}function normalizeLocale(locale: string | null | undefined): AppLocale {- if (!locale) {- return DEFAULT_LOCALE- }-- // Exact match first (e.g. "zh-CN")- if (isSupportedLocale(locale)) return locale-- // Canonicalize case (e.g. "zh-cn" → "zh-CN")- const canonical = SUPPORTED_LOCALES.find(- (l) => l.toLowerCase() === locale.toLowerCase(),- )- if (canonical) return canonical-- // Handle extended subtags like "zh-Hans-CN" → try "zh-CN"- const parts = locale.split('-')- if (parts.length >= 3) {- const langRegion = `${parts[0]}-${parts[parts.length - 1]}`- if (isSupportedLocale(langRegion)) {- return langRegion- }- }-- // Language-only fallback (e.g. "zh" matches "zh-CN")- const lang = parts[0].toLowerCase()- const byLang = SUPPORTED_LOCALES.find((l) => l.split('-')[0].toLowerCase() === lang)- if (byLang) return byLang-- return DEFAULT_LOCALE+ if (!locale) {+ return DEFAULT_LOCALE;+ }++ // Exact match first (e.g. "zh-CN")+ if (isSupportedLocale(locale)) return locale;++ // Canonicalize case (e.g. "zh-cn" → "zh-CN")+ const canonical = SUPPORTED_LOCALES.find((l) => l.toLowerCase() === locale.toLowerCase());+ if (canonical) return canonical;++ // Handle extended subtags like "zh-Hans-CN" → try "zh-CN"+ const parts = locale.split("-");+ if (parts.length >= 3) {+ const langRegion = `${parts[0]}-${parts[parts.length - 1]}`;+ if (isSupportedLocale(langRegion)) {+ return langRegion;+ }+ }++ // Language-only fallback (e.g. "zh" matches "zh-CN")+ const lang = parts[0].toLowerCase();+ const byLang = SUPPORTED_LOCALES.find((l) => l.split("-")[0].toLowerCase() === lang);+ if (byLang) return byLang;++ return DEFAULT_LOCALE;}function getInitialLocale(): AppLocale {- if (typeof window === 'undefined') {- return DEFAULT_LOCALE- }-- const storedLocale = window.localStorage.getItem(LOCALE_STORAGE_KEY)- if (storedLocale) {- return normalizeLocale(storedLocale)- }-- // Product default must be English on first launch unless user explicitly- // selected another locale and we persisted it in localStorage.- return DEFAULT_LOCALE+ if (typeof window === "undefined") {+ return DEFAULT_LOCALE;+ }++ const storedLocale = window.localStorage.getItem(LOCALE_STORAGE_KEY);+ if (storedLocale) {+ return normalizeLocale(storedLocale);+ }++ // Product default must be English on first launch unless user explicitly+ // selected another locale and we persisted it in localStorage.+ return DEFAULT_LOCALE;}function getMessageValue(source: unknown, key: string): string | undefined {- const parts = key.split('.')- let current: unknown = source+ const parts = key.split(".");+ let current: unknown = source;- for (const part of parts) {- if (!current || typeof current !== 'object' || !(part in current)) {- return undefined- }+ for (const part of parts) {+ if (!current || typeof current !== "object" || !(part in current)) {+ return undefined;+ }- current = (current as Record<string, unknown>)[part]- }+ current = (current as Record<string, unknown>)[part];+ }- return typeof current === 'string' ? current : undefined+ return typeof current === "string" ? current : undefined;}function interpolate(template: string, vars?: Record<string, string | number>) {- if (!vars) return template- return template.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g, (_match, key) => {- const value = vars[key]- return value === undefined ? '' : String(value)- })+ if (!vars) return template;+ return template.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g, (_match, key) => {+ const value = vars[key];+ return value === undefined ? "" : String(value);+ });}function parseKey(key: string): { namespace: I18nNamespace; path: string } {- const [first, ...rest] = key.split('.')- if (I18N_NAMESPACES.includes(first as I18nNamespace) && rest.length > 0) {- return { namespace: first as I18nNamespace, path: rest.join('.') }- }- return { namespace: 'common', path: key }+ const [first, ...rest] = key.split(".");+ if (I18N_NAMESPACES.includes(first as I18nNamespace) && rest.length > 0) {+ return { namespace: first as I18nNamespace, path: rest.join(".") };+ }+ return { namespace: "common", path: key };}function translateForLocale(- locale: AppLocale,- key: string,- fallback?: string,- vars?: Record<string, string | number>,+ locale: AppLocale,+ key: string,+ fallback?: string,+ vars?: Record<string, string | number>,) {- const { namespace, path } = parseKey(key)+ const { namespace, path } = parseKey(key);- const rawValue =- getMessageValue(messages[locale][namespace], path)- ?? getMessageValue(messages[DEFAULT_LOCALE][namespace], path)- ?? fallback- ?? key+ const rawValue =+ getMessageValue(messages[locale][namespace], path) ??+ getMessageValue(messages[DEFAULT_LOCALE][namespace], path) ??+ fallback ??+ key;- return interpolate(rawValue, vars)+ return interpolate(rawValue, vars);}export function I18nProvider({ children }: { children: ReactNode }) {- const [locale, setLocaleState] = useState<AppLocale>(getInitialLocale)-- const setLocale = useCallback((nextLocale: AppLocale) => {- setLocaleState(nextLocale)- if (typeof window !== 'undefined') {- window.localStorage.setItem(LOCALE_STORAGE_KEY, nextLocale)- }- }, [])-- useEffect(() => {- document.documentElement.lang = locale- }, [locale])-- const t = useCallback((key: string, fallback?: string, vars?: Record<string, string | number>) => {- return translateForLocale(locale, key, fallback, vars)- }, [locale])-- const value = useMemo<I18nContextValue>(() => ({- locale,- setLocale,- t,- }), [locale, setLocale, t])-- return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>+ const [locale, setLocaleState] = useState<AppLocale>(getInitialLocale);++ const setLocale = useCallback((nextLocale: AppLocale) => {+ setLocaleState(nextLocale);+ if (typeof window !== "undefined") {+ window.localStorage.setItem(LOCALE_STORAGE_KEY, nextLocale);+ }+ }, []);++ useEffect(() => {+ document.documentElement.lang = locale;+ }, [locale]);++ const t = useCallback(+ (key: string, fallback?: string, vars?: Record<string, string | number>) => {+ return translateForLocale(locale, key, fallback, vars);+ },+ [locale],+ );++ const value = useMemo<I18nContextValue>(+ () => ({+ locale,+ setLocale,+ t,+ }),+ [locale, setLocale, t],+ );++ return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>;}export function useI18n() {- const context = useContext(I18nContext)- if (!context) {- throw new Error('useI18n must be used within <I18nProvider>')- }- return context+ const context = useContext(I18nContext);+ if (!context) {+ throw new Error("useI18n must be used within <I18nProvider>");+ }+ return context;}export function useScopedT(namespace: I18nNamespace) {- const { t } = useI18n()- return useCallback((key: string, fallback?: string, vars?: Record<string, string | number>) => {- return t(`${namespace}.${key}`, fallback, vars)- }, [namespace, t])-}\ No newline at end of file+ const { t } = useI18n();+ return useCallback(+ (key: string, fallback?: string, vars?: Record<string, string | number>) => {+ return t(`${namespace}.${key}`, fallback, vars);+ },+ [namespace, t],+ );+}diff --git a/src/contexts/ShortcutsContext.tsx b/src/contexts/ShortcutsContext.tsxindex 7765dea9..84f14175 100644--- a/src/contexts/ShortcutsContext.tsx+++ b/src/contexts/ShortcutsContext.tsx@@ -1,61 +1,75 @@-import { createContext, useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from 'react';-import { DEFAULT_SHORTCUTS, mergeWithDefaults, type ShortcutsConfig } from '@/lib/shortcuts';-import { isMac as getIsMac } from '@/utils/platformUtils';+import {+ createContext,+ type ReactNode,+ useCallback,+ useContext,+ useEffect,+ useMemo,+ useState,+} from "react";+import { DEFAULT_SHORTCUTS, mergeWithDefaults, type ShortcutsConfig } from "@/lib/shortcuts";+import { isMac as getIsMac } from "@/utils/platformUtils";interface ShortcutsContextValue {- shortcuts: ShortcutsConfig;- isMac: boolean;- setShortcuts: (config: ShortcutsConfig) => void;- persistShortcuts: (config?: ShortcutsConfig) => Promise<void>;- isConfigOpen: boolean;- openConfig: () => void;- closeConfig: () => void;+ shortcuts: ShortcutsConfig;+ isMac: boolean;+ setShortcuts: (config: ShortcutsConfig) => void;+ persistShortcuts: (config?: ShortcutsConfig) => Promise<void>;+ isConfigOpen: boolean;+ openConfig: () => void;+ closeConfig: () => void;}const ShortcutsContext = createContext<ShortcutsContextValue | null>(null);export function useShortcuts(): ShortcutsContextValue {- const ctx = useContext(ShortcutsContext);- if (!ctx) throw new Error('useShortcuts must be used within <ShortcutsProvider>');- return ctx;+ const ctx = useContext(ShortcutsContext);+ if (!ctx) throw new Error("useShortcuts must be used within <ShortcutsProvider>");+ return ctx;}export function ShortcutsProvider({ children }: { children: ReactNode }) {- const [shortcuts, setShortcuts] = useState<ShortcutsConfig>(DEFAULT_SHORTCUTS);- const [isMac, setIsMac] = useState(false);- const [isConfigOpen, setIsConfigOpen] = useState(false);-- useEffect(() => {- getIsMac().then(setIsMac).catch(() => {});-- window.electronAPI.getShortcuts?.()- .then((saved) => {- if (saved) {- setShortcuts(mergeWithDefaults(saved as Partial<ShortcutsConfig>));- }- })- .catch(() => {});- }, []);-- const persistShortcuts = useCallback(- async (config?: ShortcutsConfig) => {- await window.electronAPI.saveShortcuts?.(config ?? shortcuts);- },- [shortcuts],- );-- const openConfig = useCallback(() => setIsConfigOpen(true), []);- const closeConfig = useCallback(() => setIsConfigOpen(false), []);-- const value = useMemo<ShortcutsContextValue>(- () => ({ shortcuts, isMac, setShortcuts, persistShortcuts, isConfigOpen, openConfig, closeConfig }),- [shortcuts, isMac, persistShortcuts, isConfigOpen, openConfig, closeConfig],- );-- return (- <ShortcutsContext.Provider value={value}>- {children}- </ShortcutsContext.Provider>- );-}+ const [shortcuts, setShortcuts] = useState<ShortcutsConfig>(DEFAULT_SHORTCUTS);+ const [isMac, setIsMac] = useState(false);+ const [isConfigOpen, setIsConfigOpen] = useState(false);++ useEffect(() => {+ getIsMac()+ .then(setIsMac)+ .catch(() => undefined);++ window.electronAPI+ ?.getShortcuts?.()+ .then((saved) => {+ if (saved) {+ setShortcuts(mergeWithDefaults(saved as Partial<ShortcutsConfig>));+ }+ })+ .catch(() => undefined);+ }, []);++ const persistShortcuts = useCallback(+ async (config?: ShortcutsConfig) => {+ await window.electronAPI?.saveShortcuts?.(config ?? shortcuts);+ },+ [shortcuts],+ );+ const openConfig = useCallback(() => setIsConfigOpen(true), []);+ const closeConfig = useCallback(() => setIsConfigOpen(false), []);++ const value = useMemo<ShortcutsContextValue>(+ () => ({+ shortcuts,+ isMac,+ setShortcuts,+ persistShortcuts,+ isConfigOpen,+ openConfig,+ closeConfig,+ }),+ [shortcuts, isMac, persistShortcuts, isConfigOpen, openConfig, closeConfig],+ );++ return <ShortcutsContext.Provider value={value}>{children}</ShortcutsContext.Provider>;+}diff --git a/src/hooks/useExtensions.ts b/src/hooks/useExtensions.tsindex 0d405542..1c08b5f3 100644--- a/src/hooks/useExtensions.ts+++ b/src/hooks/useExtensions.ts@@ -6,240 +6,277 @@* that need render hooks.*/-import { useCallback, useEffect, useRef, useState } from 'react';-import { extensionHost } from '@/lib/extensions';-import type { ExtensionInfo, MarketplaceSearchResult, ExtensionReview, MarketplaceReviewStatus } from '@/lib/extensions';-import { createExtensionModuleUrl } from '@/lib/extensions/fileUrls';+import { useCallback, useEffect, useRef, useState } from "react";+import type {+ ExtensionInfo,+ ExtensionReview,+ MarketplaceReviewStatus,+ MarketplaceSearchResult,+} from "@/lib/extensions";+import { extensionHost } from "@/lib/extensions";+import { createExtensionModuleUrl } from "@/lib/extensions/fileUrls";-const electronAPI = (window as any).electronAPI;+const electronAPI = typeof window === "undefined" ? undefined : window.electronAPI;export interface UseExtensionsResult {- /** All discovered extensions */- extensions: ExtensionInfo[];- /** Currently active extension IDs */- activeIds: Set<string>;- /** Whether initial discovery is complete */- ready: boolean;- /** Discover/refresh extensions from disk */- refresh: () => Promise<void>;- /** Toggle an extension on/off */- toggleExtension: (id: string) => Promise<void>;- /** Install an extension from a folder */- installFromFolder: () => Promise<boolean>;- /** Uninstall an extension */- uninstall: (id: string) => Promise<boolean>;- /** Open the extensions directory in Finder/Explorer */- openDirectory: () => Promise<void>;- /** Search the marketplace */- marketplaceSearch: (params: {- query?: string;- tags?: string[];- sort?: 'popular' | 'recent' | 'rating';- page?: number;- pageSize?: number;- }) => Promise<MarketplaceSearchResult>;- /** Download and install from marketplace */- marketplaceInstall: (extensionId: string, downloadUrl: string) => Promise<{ success: boolean; error?: string }>;- /** Submit extension for review */- marketplaceSubmit: (extensionId: string) => Promise<{ success: boolean; error?: string }>;- /** Fetch pending reviews (admin) */- fetchReviews: (params: {- status?: MarketplaceReviewStatus;- page?: number;- pageSize?: number;- }) => Promise<{ reviews: ExtensionReview[]; total: number }>;- /** Update review status (admin) */- updateReview: (reviewId: string, status: MarketplaceReviewStatus, notes?: string) => Promise<{ success: boolean }>;+ /** All discovered extensions */+ extensions: ExtensionInfo[];+ /** Currently active extension IDs */+ activeIds: Set<string>;+ /** Whether initial discovery is complete */+ ready: boolean;+ /** Discover/refresh extensions from disk */+ refresh: () => Promise<void>;+ /** Toggle an extension on/off */+ toggleExtension: (id: string) => Promise<void>;+ /** Install an extension from a folder */+ installFromFolder: () => Promise<boolean>;+ /** Uninstall an extension */+ uninstall: (id: string) => Promise<boolean>;+ /** Open the extensions directory in Finder/Explorer */+ openDirectory: () => Promise<void>;+ /** Search the marketplace */+ marketplaceSearch: (params: {+ query?: string;+ tags?: string[];+ sort?: "popular" | "recent" | "rating";+ page?: number;+ pageSize?: number;+ }) => Promise<MarketplaceSearchResult>;+ /** Download and install from marketplace */+ marketplaceInstall: (+ extensionId: string,+ downloadUrl: string,+ ) => Promise<{ success: boolean; error?: string }>;+ /** Submit extension for review */+ marketplaceSubmit: (extensionId: string) => Promise<{ success: boolean; error?: string }>;+ /** Fetch pending reviews (admin) */+ fetchReviews: (params: {+ status?: MarketplaceReviewStatus;+ page?: number;+ pageSize?: number;+ }) => Promise<{ reviews: ExtensionReview[]; total: number }>;+ /** Update review status (admin) */+ updateReview: (+ reviewId: string,+ status: MarketplaceReviewStatus,+ notes?: string,+ ) => Promise<{ success: boolean }>;}export function useExtensions(): UseExtensionsResult {- const [extensions, setExtensions] = useState<ExtensionInfo[]>([]);- const [activeIds, setActiveIds] = useState<Set<string>>(new Set());- const [ready, setReady] = useState(false);- const activatingRef = useRef(new Set<string>());-- const discoverAndSync = useCallback(async (): Promise<ExtensionInfo[]> => {- if (!electronAPI?.extensionsDiscover) return [];-- const discovered: ExtensionInfo[] = await electronAPI.extensionsDiscover();- setExtensions(discovered);- setReady(true);- await extensionHost.syncConfiguredExtensions(discovered);-- return discovered;- }, []);-- const refresh = useCallback(async () => {- await discoverAndSync();- }, [discoverAndSync]);-- // Auto-discover on mount and restore extensions marked active.- useEffect(() => {- void discoverAndSync();- }, [discoverAndSync]);-- // Sync activeIds with extension host (immediate + future changes)- useEffect(() => {- const sync = () => {- const active = extensionHost.getActiveExtensions();- setActiveIds(new Set(active.map(e => e.manifest.id)));- };- // Immediately sync with any already-active extensions- sync();- return extensionHost.onChange(sync);- }, []);-- const toggleExtension = useCallback(async (id: string) => {- if (activatingRef.current.has(id)) return;- activatingRef.current.add(id);-- try {- if (activeIds.has(id)) {- await extensionHost.deactivateExtension(id);- await electronAPI?.extensionsDisable(id);- setExtensions((prev) =>- prev.map((ext) => (ext.manifest.id === id ? { ...ext, status: 'disabled' } : ext)),- );- } else {- const ext = extensions.find(e => e.manifest.id === id);- if (!ext) return;-- try {- await electronAPI?.extensionsEnable(id);-- const moduleUrl = createExtensionModuleUrl(ext.path, ext.manifest.main);- await extensionHost.activateExtension(ext, moduleUrl);- setExtensions((prev) =>- prev.map((candidate) => (candidate.manifest.id === id ? { ...candidate, status: 'active' } : candidate)),- );- } catch (err) {- await electronAPI?.extensionsDisable(id);- setExtensions((prev) =>- prev.map((candidate) => (candidate.manifest.id === id ? { ...candidate, status: 'disabled' } : candidate)),- );- throw err;- }- }- } catch (err) {- console.error(`[extensions] Failed to toggle ${id}:`, err);- } finally {- activatingRef.current.delete(id);- }- }, [activeIds, extensions]);-- const installFromFolder = useCallback(async (): Promise<boolean> => {- if (!electronAPI?.extensionsInstallFromFolder) return false;- const result = await electronAPI.extensionsInstallFromFolder();- if (result?.success) {- const extensionId = result.extension?.manifest?.id;- if (typeof extensionId === 'string') {- await electronAPI?.extensionsEnable(extensionId);- }- await discoverAndSync();- return true;- }- return false;- }, [discoverAndSync]);-- const uninstall = useCallback(async (id: string): Promise<boolean> => {- // Always deactivate — avoids stale closure over activeIds- await extensionHost.deactivateExtension(id);- if (!electronAPI?.extensionsUninstall) return false;- const result = await electronAPI.extensionsUninstall(id);- if (result?.success) {- await discoverAndSync();- return true;- }- return false;- }, [discoverAndSync]);-- const openDirectory = useCallback(async () => {- await electronAPI?.extensionsOpenDirectory();- }, []);-- const marketplaceSearch = useCallback(async (params: {- query?: string;- tags?: string[];- sort?: 'popular' | 'recent' | 'rating';- page?: number;- pageSize?: number;- }): Promise<MarketplaceSearchResult> => {- if (!electronAPI?.extensionsMarketplaceSearch) {- return { extensions: [], total: 0, page: 1, pageSize: 20 };- }-- const result = await electronAPI.extensionsMarketplaceSearch(params) as MarketplaceSearchResult & {- error?: string;- };-- if (result?.error) {- throw new Error(result.error);- }-- return result;- }, []);-- const marketplaceInstall = useCallback(async (extensionId: string, downloadUrl: string) => {- if (!electronAPI?.extensionsMarketplaceInstall) {- return { success: false, error: 'Not available' };- }- const result = await electronAPI.extensionsMarketplaceInstall(extensionId, downloadUrl);- if (result.success) {- await electronAPI?.extensionsEnable(extensionId);- await discoverAndSync();- }- return result;- }, [discoverAndSync]);-- const marketplaceSubmit = useCallback(async (extensionId: string) => {- if (!electronAPI?.extensionsMarketplaceSubmit) {- return { success: false, error: 'Not available' };- }- return electronAPI.extensionsMarketplaceSubmit(extensionId);- }, []);-- const fetchReviews = useCallback(async (params: {- status?: MarketplaceReviewStatus;- page?: number;- pageSize?: number;- }) => {- if (!electronAPI?.extensionsReviewsList) {- return { reviews: [] as ExtensionReview[], total: 0 };- }-- const result = await electronAPI.extensionsReviewsList(params) as {- reviews: ExtensionReview[];- total: number;- error?: string;- };-- if (result?.error) {- throw new Error(result.error);- }-- return result;- }, []);-- const updateReview = useCallback(async (reviewId: string, status: MarketplaceReviewStatus, notes?: string) => {- if (!electronAPI?.extensionsReviewUpdate) {- return { success: false };- }- return electronAPI.extensionsReviewUpdate(reviewId, status, notes);- }, []);-- return {- extensions,- activeIds,- ready,- refresh,- toggleExtension,- installFromFolder,- uninstall,- openDirectory,- marketplaceSearch,- marketplaceInstall,- marketplaceSubmit,- fetchReviews,- updateReview,- };+ const [extensions, setExtensions] = useState<ExtensionInfo[]>([]);+ const [activeIds, setActiveIds] = useState<Set<string>>(new Set());+ const [ready, setReady] = useState(false);+ const activatingRef = useRef(new Set<string>());++ const discoverAndSync = useCallback(async (): Promise<ExtensionInfo[]> => {+ if (!electronAPI?.extensionsDiscover) return [];++ const discovered: ExtensionInfo[] = await electronAPI.extensionsDiscover();+ setExtensions(discovered);+ setReady(true);+ await extensionHost.syncConfiguredExtensions(discovered);++ return discovered;+ }, []);++ const refresh = useCallback(async () => {+ await discoverAndSync();+ }, [discoverAndSync]);++ // Auto-discover on mount and restore extensions marked active.+ useEffect(() => {+ void discoverAndSync();+ }, [discoverAndSync]);++ // Sync activeIds with extension host (immediate + future changes)+ useEffect(() => {+ const sync = () => {+ const active = extensionHost.getActiveExtensions();+ setActiveIds(new Set(active.map((e) => e.manifest.id)));+ };+ // Immediately sync with any already-active extensions+ sync();+ return extensionHost.onChange(sync);+ }, []);++ const toggleExtension = useCallback(+ async (id: string) => {+ if (activatingRef.current.has(id)) return;+ activatingRef.current.add(id);++ try {+ if (activeIds.has(id)) {+ await extensionHost.deactivateExtension(id);+ await electronAPI?.extensionsDisable(id);+ setExtensions((prev) =>+ prev.map((ext) =>+ ext.manifest.id === id ? { ...ext, status: "disabled" } : ext,+ ),+ );+ } else {+ const ext = extensions.find((e) => e.manifest.id === id);+ if (!ext) return;++ try {+ await electronAPI?.extensionsEnable(id);++ const moduleUrl = createExtensionModuleUrl(ext.path, ext.manifest.main);+ await extensionHost.activateExtension(ext, moduleUrl);+ setExtensions((prev) =>+ prev.map((candidate) =>+ candidate.manifest.id === id+ ? { ...candidate, status: "active" }+ : candidate,+ ),+ );+ } catch (err) {+ await electronAPI?.extensionsDisable(id);+ setExtensions((prev) =>+ prev.map((candidate) =>+ candidate.manifest.id === id+ ? { ...candidate, status: "disabled" }+ : candidate,+ ),+ );+ throw err;+ }+ }+ } catch (err) {+ console.error(`[extensions] Failed to toggle ${id}:`, err); throw err; } finally {+ activatingRef.current.delete(id);+ }+ },+ [activeIds, extensions],+ );++ const installFromFolder = useCallback(async (): Promise<boolean> => {+ if (!electronAPI?.extensionsInstallFromFolder) return false;+ const result = await electronAPI.extensionsInstallFromFolder();+ if (result?.success) {+ const extensionId = result.extension?.manifest?.id;+ if (typeof extensionId === "string") {+ await electronAPI?.extensionsEnable(extensionId);+ }+ await discoverAndSync();+ return true;+ }+ return false;+ }, [discoverAndSync]);++ const uninstall = useCallback(+ async (id: string): Promise<boolean> => {+ // Always deactivate — avoids stale closure over activeIds+ await extensionHost.deactivateExtension(id);+ if (!electronAPI?.extensionsUninstall) return false;+ const result = await electronAPI.extensionsUninstall(id);+ if (result?.success) {+ await discoverAndSync();+ return true;+ }+ return false;+ },+ [discoverAndSync],+ );++ const openDirectory = useCallback(async () => {+ await electronAPI?.extensionsOpenDirectory();+ }, []);++ const marketplaceSearch = useCallback(+ async (params: {+ query?: string;+ tags?: string[];+ sort?: "popular" | "recent" | "rating";+ page?: number;+ pageSize?: number;+ }): Promise<MarketplaceSearchResult> => {+ if (!electronAPI?.extensionsMarketplaceSearch) {+ return { extensions: [], total: 0, page: 1, pageSize: 20 };+ }++ const result = (await electronAPI.extensionsMarketplaceSearch(+ params,+ )) as MarketplaceSearchResult & {+ error?: string;+ };++ if (result?.error) {+ throw new Error(result.error);+ }++ return result;+ },+ [],+ );++ const marketplaceInstall = useCallback(+ async (extensionId: string, downloadUrl: string) => {+ if (!electronAPI?.extensionsMarketplaceInstall) {+ return { success: false, error: "Not available" };+ }+ const result = await electronAPI.extensionsMarketplaceInstall(extensionId, downloadUrl);+ if (result.success) {+ await electronAPI?.extensionsEnable(extensionId);+ await discoverAndSync();+ }+ return result;+ },+ [discoverAndSync],+ );++ const marketplaceSubmit = useCallback(async (extensionId: string) => {+ if (!electronAPI?.extensionsMarketplaceSubmit) {+ return { success: false, error: "Not available" };+ }+ return electronAPI.extensionsMarketplaceSubmit(extensionId);+ }, []);++ const fetchReviews = useCallback(+ async (params: { status?: MarketplaceReviewStatus; page?: number; pageSize?: number }) => {+ if (!electronAPI?.extensionsReviewsList) {+ return { reviews: [] as ExtensionReview[], total: 0 };+ }++ const result = (await electronAPI.extensionsReviewsList(params)) as {+ reviews: ExtensionReview[];+ total: number;+ error?: string;+ };++ if (result?.error) {+ throw new Error(result.error);+ }++ return result;+ },+ [],+ );++ const updateReview = useCallback(+ async (reviewId: string, status: MarketplaceReviewStatus, notes?: string) => {+ if (!electronAPI?.extensionsReviewUpdate) {+ return { success: false };+ }+ return electronAPI.extensionsReviewUpdate(reviewId, status, notes);+ },+ [],+ );++ return {+ extensions,+ activeIds,+ ready,+ refresh,+ toggleExtension,+ installFromFolder,+ uninstall,+ openDirectory,+ marketplaceSearch,+ marketplaceInstall,+ marketplaceSubmit,+ fetchReviews,+ updateReview,+ };}diff --git a/src/i18n/config.ts b/src/i18n/config.tsindex ead1a299..7c309d8a 100644--- a/src/i18n/config.ts+++ b/src/i18n/config.ts@@ -1,17 +1,17 @@-export const DEFAULT_LOCALE = 'en' as const+export const DEFAULT_LOCALE = "en" as const;-export const SUPPORTED_LOCALES = ['en', 'es', 'nl', 'ko', 'zh-CN'] as const+export const SUPPORTED_LOCALES = ["en", "es", "nl", "ko", "zh-CN"] as const;export const I18N_NAMESPACES = [- 'common',- 'launch',- 'editor',- 'timeline',- 'settings',- 'dialogs',- 'shortcuts',- 'extensions',-] as const+ "common",+ "launch",+ "editor",+ "timeline",+ "settings",+ "dialogs",+ "shortcuts",+ "extensions",+] as const;-export type AppLocale = (typeof SUPPORTED_LOCALES)[number]-export type I18nNamespace = (typeof I18N_NAMESPACES)[number]\ No newline at end of file+export type AppLocale = (typeof SUPPORTED_LOCALES)[number];+export type I18nNamespace = (typeof I18N_NAMESPACES)[number];diff --git a/src/i18n/locales/en/extensions.json b/src/i18n/locales/en/extensions.jsonindex 20265be4..8678ac62 100644--- a/src/i18n/locales/en/extensions.json+++ b/src/i18n/locales/en/extensions.json@@ -1,59 +1,60 @@{- "title": "Extensions",- "tabs": {- "browse": "Browse",- "installed": "Installed"- },- "actions": {- "submit": "Submit an extension",- "docs": "Extension docs",- "refresh": "Refresh",- "openFolder": "Open extensions folder",- "uninstall": "Uninstall",- "install": "Install",- "installing": "Installing",- "add": "Add",- "retry": "Retry",- "close": "Close",- "folder": "Folder"- },- "status": {- "enabled": "Enabled",- "disabled": "Disabled",- "installed": "Installed"- },- "detail": {- "by": "By {{author}}",- "unknownAuthor": "Unknown author",- "noDescription": "No description",- "downloads": "{{count}} downloads",- "preview": "Preview",- "screenshotAlt": "Screenshot {{number}}",- "description": "Description",- "tags": "Tags",- "permissions": "Permissions",- "location": "Location",- "error": "Error: {{message}}"- },- "empty": {- "title": "No Extensions",- "description": "Install extensions to add frames, cursor effects, and editor tools."- },- "search": {- "placeholder": "Search extensions...",- "noResults": "No extensions found",- "noMarketplace": "No marketplace extensions available yet",- "count": "{{count}} extension",- "countPlural": "{{count}} extensions"- },- "toast": {- "installedAndEnabled": "Extension installed and enabled",- "uninstalled": "Uninstalled {{name}}",- "uninstallFailed": "Failed to uninstall {{name}}",- "searchFailed": "Failed to search marketplace",- "refreshed": "Extensions refreshed",- "refreshFailed": "Failed to refresh extensions",- "marketplaceInstalled": "Installed and enabled {{name}}",- "marketplaceInstallFailed": "Failed to install {{name}}"- }-}+ "title": "Extensions",+ "tabs": {+ "browse": "Browse",+ "installed": "Installed"+ },+ "actions": {+ "submit": "Submit an extension",+ "docs": "Extension docs",+ "refresh": "Refresh",+ "openFolder": "Open extensions folder",+ "uninstall": "Uninstall",+ "install": "Install",+ "installing": "Installing",+ "add": "Add",+ "retry": "Retry",+ "close": "Close",+ "folder": "Folder"+ },+ "status": {+ "enabled": "Enabled",+ "disabled": "Disabled",+ "installed": "Installed"+ },+ "detail": {+ "by": "By {{author}}",+ "unknownAuthor": "Unknown author",+ "noDescription": "No description",+ "downloads": "{{count}} downloads",+ "preview": "Preview",+ "screenshotAlt": "Screenshot {{number}}",+ "description": "Description",+ "tags": "Tags",+ "permissions": "Permissions",+ "location": "Location",+ "error": "Error: {{message}}"+ },+ "empty": {+ "title": "No Extensions",+ "description": "Install extensions to add frames, cursor effects, and editor tools."+ },+ "search": {+ "placeholder": "Search extensions...",+ "noResults": "No extensions found",+ "noMarketplace": "No marketplace extensions available yet",+ "count": "{{count}} extension",+ "countPlural": "{{count}} extensions"+ },+ "toast": {+ "installedAndEnabled": "Extension installed and enabled",+ "uninstalled": "Uninstalled {{name}}",+ "uninstallFailed": "Failed to uninstall {{name}}",+ "searchFailed": "Failed to search marketplace",+ "refreshed": "Extensions refreshed",+ "refreshFailed": "Failed to refresh extensions",+ "marketplaceInstalled": "Installed and enabled {{name}}",+ "marketplaceInstallFailed": "Failed to install {{name}}",+ "enableFailed": "Failed to enable extension"+ }+}\ No newline at end of filediff --git a/src/i18n/locales/es/extensions.json b/src/i18n/locales/es/extensions.jsonindex bf3e2053..7f5deacf 100644--- a/src/i18n/locales/es/extensions.json+++ b/src/i18n/locales/es/extensions.json@@ -1,59 +1,60 @@{- "title": "Extensiones",- "tabs": {- "browse": "Explorar",- "installed": "Instaladas"- },- "actions": {- "submit": "Enviar una extensión",- "docs": "Documentación de extensiones",- "refresh": "Actualizar",- "openFolder": "Abrir carpeta de extensiones",- "uninstall": "Desinstalar",- "install": "Instalar",- "installing": "Instalando",- "add": "Añadir",- "retry": "Reintentar",- "close": "Cerrar",- "folder": "Carpeta"- },- "status": {- "enabled": "Activada",- "disabled": "Desactivada",- "installed": "Instalada"- },- "detail": {- "by": "Por {{author}}",- "unknownAuthor": "Autor desconocido",- "noDescription": "Sin descripción",- "downloads": "{{count}} descargas",- "preview": "Vista previa",- "screenshotAlt": "Captura de pantalla {{number}}",- "description": "Descripción",- "tags": "Etiquetas",- "permissions": "Permisos",- "location": "Ubicación",- "error": "Error: {{message}}"- },- "empty": {- "title": "Sin extensiones",- "description": "Instala extensiones para añadir marcos, efectos de cursor y herramientas de edición."- },- "search": {- "placeholder": "Buscar extensiones...",- "noResults": "No se encontraron extensiones",- "noMarketplace": "Aún no hay extensiones en el marketplace",- "count": "{{count}} extensión",- "countPlural": "{{count}} extensiones"- },- "toast": {- "installedAndEnabled": "Extensión instalada y activada",- "uninstalled": "{{name}} desinstalada",- "uninstallFailed": "Error al desinstalar {{name}}",- "searchFailed": "Error al buscar en el marketplace",- "refreshed": "Extensiones actualizadas",- "refreshFailed": "Error al actualizar extensiones",- "marketplaceInstalled": "{{name}} instalada y activada",- "marketplaceInstallFailed": "Error al instalar {{name}}"- }+ "title": "Extensiones",+ "tabs": {+ "browse": "Explorar",+ "installed": "Instaladas"+ },+ "actions": {+ "submit": "Enviar una extensión",+ "docs": "Documentación de extensiones",+ "refresh": "Actualizar",+ "openFolder": "Abrir carpeta de extensiones",+ "uninstall": "Desinstalar",+ "install": "Instalar",+ "installing": "Instalando",+ "add": "Añadir",+ "retry": "Reintentar",+ "close": "Cerrar",+ "folder": "Carpeta"+ },+ "status": {+ "enabled": "Activada",+ "disabled": "Desactivada",+ "installed": "Instalada"+ },+ "detail": {+ "by": "Por {{author}}",+ "unknownAuthor": "Autor desconocido",+ "noDescription": "Sin descripción",+ "downloads": "{{count}} descargas",+ "preview": "Vista previa",+ "screenshotAlt": "Captura de pantalla {{number}}",+ "description": "Descripción",+ "tags": "Etiquetas",+ "permissions": "Permisos",+ "location": "Ubicación",+ "error": "Error: {{message}}"+ },+ "empty": {+ "title": "Sin extensiones",+ "description": "Instala extensiones para añadir marcos, efectos de cursor y herramientas de edición."+ },+ "search": {+ "placeholder": "Buscar extensiones...",+ "noResults": "No se encontraron extensiones",+ "noMarketplace": "Aún no hay extensiones en el marketplace",+ "count": "{{count}} extensión",+ "countPlural": "{{count}} extensiones"+ },+ "toast": {+ "installedAndEnabled": "Extensión instalada y activada",+ "uninstalled": "{{name}} desinstalada",+ "uninstallFailed": "Error al desinstalar {{name}}",+ "searchFailed": "Error al buscar en el marketplace",+ "refreshed": "Extensiones actualizadas",+ "refreshFailed": "Error al actualizar extensiones",+ "marketplaceInstalled": "{{name}} instalada y activada",+ "enableFailed": "Error al activar la extensión",+ "marketplaceInstallFailed": "Error al instalar {{name}}"+ }}diff --git a/src/i18n/locales/ko/extensions.json b/src/i18n/locales/ko/extensions.jsonindex b0fc8a1f..68f60fbd 100644--- a/src/i18n/locales/ko/extensions.json+++ b/src/i18n/locales/ko/extensions.json@@ -1,59 +1,60 @@{- "title": "확장 프로그램",- "tabs": {- "browse": "둘러보기",- "installed": "설치됨"- },- "actions": {- "submit": "확장 프로그램 제출",- "docs": "확장 프로그램 문서",- "refresh": "새로고침",- "openFolder": "확장 프로그램 폴더 열기",- "uninstall": "제거",- "install": "설치",- "installing": "설치 중",- "add": "추가",- "retry": "다시 시도",- "close": "닫기",- "folder": "폴더"- },- "status": {- "enabled": "활성화",- "disabled": "비활성화",- "installed": "설치됨"- },- "detail": {- "by": "{{author}} 제작",- "unknownAuthor": "알 수 없는 작성자",- "noDescription": "설명 없음",- "downloads": "{{count}}회 다운로드",- "preview": "미리보기",- "screenshotAlt": "스크린샷 {{number}}",- "description": "설명",- "tags": "태그",- "permissions": "권한",- "location": "위치",- "error": "오류: {{message}}"- },- "empty": {- "title": "확장 프로그램 없음",- "description": "프레임, 커서 효과 및 편집 도구를 추가하려면 확장 프로그램을 설치하세요."- },- "search": {- "placeholder": "확장 프로그램 검색...",- "noResults": "확장 프로그램을 찾을 수 없음",- "noMarketplace": "아직 마켓플레이스 확장 프로그램이 없습니다",- "count": "확장 프로그램 {{count}}개",- "countPlural": "확장 프로그램 {{count}}개"- },- "toast": {- "installedAndEnabled": "확장 프로그램이 설치되고 활성화되었습니다",- "uninstalled": "{{name}} 제거됨",- "uninstallFailed": "{{name}} 제거 실패",- "searchFailed": "마켓플레이스 검색 실패",- "refreshed": "확장 프로그램 새로고침 완료",- "refreshFailed": "확장 프로그램 새로고침 실패",- "marketplaceInstalled": "{{name}} 설치 및 활성화됨",- "marketplaceInstallFailed": "{{name}} 설치 실패"- }+ "title": "확장 프로그램",+ "tabs": {+ "browse": "둘러보기",+ "installed": "설치됨"+ },+ "actions": {+ "submit": "확장 프로그램 제출",+ "docs": "확장 프로그램 문서",+ "refresh": "새로고침",+ "openFolder": "확장 프로그램 폴더 열기",+ "uninstall": "제거",+ "install": "설치",+ "installing": "설치 중",+ "add": "추가",+ "retry": "다시 시도",+ "close": "닫기",+ "folder": "폴더"+ },+ "status": {+ "enabled": "활성화",+ "disabled": "비활성화",+ "installed": "설치됨"+ },+ "detail": {+ "by": "{{author}} 제작",+ "unknownAuthor": "알 수 없는 작성자",+ "noDescription": "설명 없음",+ "downloads": "{{count}}회 다운로드",+ "preview": "미리보기",+ "screenshotAlt": "스크린샷 {{number}}",+ "description": "설명",+ "tags": "태그",+ "permissions": "권한",+ "location": "위치",+ "error": "오류: {{message}}"+ },+ "empty": {+ "title": "확장 프로그램 없음",+ "description": "프레임, 커서 효과 및 편집 도구를 추가하려면 확장 프로그램을 설치하세요."+ },+ "search": {+ "placeholder": "확장 프로그램 검색...",+ "noResults": "확장 프로그램을 찾을 수 없음",+ "noMarketplace": "아직 마켓플레이스 확장 프로그램이 없습니다",+ "count": "확장 프로그램 {{count}}개",+ "countPlural": "확장 프로그램 {{count}}개"+ },+ "toast": {+ "installedAndEnabled": "확장 프로그램이 설치되고 활성화되었습니다",+ "uninstalled": "{{name}} 제거됨",+ "uninstallFailed": "{{name}} 제거 실패",+ "searchFailed": "마켓플레이스 검색 실패",+ "refreshed": "확장 프로그램 새로고침 완료",+ "refreshFailed": "확장 프로그램 새로고침 실패",+ "marketplaceInstalled": "{{name}} 설치 및 활성화됨",+ "enableFailed": "확장 프로그램 활성화 실패",+ "marketplaceInstallFailed": "{{name}} 설치 실패"+ }}diff --git a/src/i18n/locales/nl/extensions.json b/src/i18n/locales/nl/extensions.jsonindex 68ffbebd..d6693472 100644--- a/src/i18n/locales/nl/extensions.json+++ b/src/i18n/locales/nl/extensions.json@@ -1,59 +1,60 @@{- "title": "Extensies",- "tabs": {- "browse": "Bladeren",- "installed": "Geïnstalleerd"- },- "actions": {- "submit": "Een extensie indienen",- "docs": "Extensiedocumentatie",- "refresh": "Vernieuwen",- "openFolder": "Extensiemap openen",- "uninstall": "Verwijderen",- "install": "Installeren",- "installing": "Installeren",- "add": "Toevoegen",- "retry": "Opnieuw",- "close": "Sluiten",- "folder": "Map"- },- "status": {- "enabled": "Ingeschakeld",- "disabled": "Uitgeschakeld",- "installed": "Geïnstalleerd"- },- "detail": {- "by": "Door {{author}}",- "unknownAuthor": "Onbekende auteur",- "noDescription": "Geen beschrijving",- "downloads": "{{count}} downloads",- "preview": "Voorbeeld",- "screenshotAlt": "Schermafbeelding {{number}}",- "description": "Beschrijving",- "tags": "Tags",- "permissions": "Machtigingen",- "location": "Locatie",- "error": "Fout: {{message}}"- },- "empty": {- "title": "Geen extensies",- "description": "Installeer extensies om frames, cursoreffecten en bewerkingstools toe te voegen."- },- "search": {- "placeholder": "Extensies zoeken...",- "noResults": "Geen extensies gevonden",- "noMarketplace": "Er zijn nog geen marketplace extensies beschikbaar",- "count": "{{count}} extensie",- "countPlural": "{{count}} extensies"- },- "toast": {- "installedAndEnabled": "Extensie geïnstalleerd en ingeschakeld",- "uninstalled": "{{name}} verwijderd",- "uninstallFailed": "Kan {{name}} niet verwijderen",- "searchFailed": "Kan niet zoeken in marketplace",- "refreshed": "Extensies vernieuwd",- "refreshFailed": "Kan extensies niet vernieuwen",- "marketplaceInstalled": "{{name}} geïnstalleerd en ingeschakeld",- "marketplaceInstallFailed": "Kan {{name}} niet installeren"- }+ "title": "Extensies",+ "tabs": {+ "browse": "Bladeren",+ "installed": "Geïnstalleerd"+ },+ "actions": {+ "submit": "Een extensie indienen",+ "docs": "Extensiedocumentatie",+ "refresh": "Vernieuwen",+ "openFolder": "Extensiemap openen",+ "uninstall": "Verwijderen",+ "install": "Installeren",+ "installing": "Installeren",+ "add": "Toevoegen",+ "retry": "Opnieuw",+ "close": "Sluiten",+ "folder": "Map"+ },+ "status": {+ "enabled": "Ingeschakeld",+ "disabled": "Uitgeschakeld",+ "installed": "Geïnstalleerd"+ },+ "detail": {+ "by": "Door {{author}}",+ "unknownAuthor": "Onbekende auteur",+ "noDescription": "Geen beschrijving",+ "downloads": "{{count}} downloads",+ "preview": "Voorbeeld",+ "screenshotAlt": "Schermafbeelding {{number}}",+ "description": "Beschrijving",+ "tags": "Tags",+ "permissions": "Machtigingen",+ "location": "Locatie",+ "error": "Fout: {{message}}"+ },+ "empty": {+ "title": "Geen extensies",+ "description": "Installeer extensies om frames, cursoreffecten en bewerkingstools toe te voegen."+ },+ "search": {+ "placeholder": "Extensies zoeken...",+ "noResults": "Geen extensies gevonden",+ "noMarketplace": "Er zijn nog geen marketplace extensies beschikbaar",+ "count": "{{count}} extensie",+ "countPlural": "{{count}} extensies"+ },+ "toast": {+ "installedAndEnabled": "Extensie geïnstalleerd en ingeschakeld",+ "uninstalled": "{{name}} verwijderd",+ "uninstallFailed": "Kan {{name}} niet verwijderen",+ "searchFailed": "Kan niet zoeken in marketplace",+ "refreshed": "Extensies vernieuwd",+ "refreshFailed": "Kan extensies niet vernieuwen",+ "marketplaceInstalled": "{{name}} geïnstalleerd en ingeschakeld",+ "enableFailed": "Kan extensie niet inschakelen",+ "marketplaceInstallFailed": "Kan {{name}} niet installeren"+ }}diff --git a/src/i18n/locales/zh-CN/extensions.json b/src/i18n/locales/zh-CN/extensions.jsonindex 59c1d3a7..582223e7 100644--- a/src/i18n/locales/zh-CN/extensions.json+++ b/src/i18n/locales/zh-CN/extensions.json@@ -1,59 +1,60 @@{- "title": "扩展",- "tabs": {- "browse": "浏览",- "installed": "已安装"- },- "actions": {- "submit": "提交扩展",- "docs": "扩展文档",- "refresh": "刷新",- "openFolder": "打开扩展文件夹",- "uninstall": "卸载",- "install": "安装",- "installing": "安装中",- "add": "添加",- "retry": "重试",- "close": "关闭",- "folder": "文件夹"- },- "status": {- "enabled": "已启用",- "disabled": "已禁用",- "installed": "已安装"- },- "detail": {- "by": "由 {{author}} 开发",- "unknownAuthor": "未知作者",- "noDescription": "暂无描述",- "downloads": "{{count}} 次下载",- "preview": "预览",- "screenshotAlt": "截图 {{number}}",- "description": "描述",- "tags": "标签",- "permissions": "权限",- "location": "位置",- "error": "错误:{{message}}"- },- "empty": {- "title": "没有扩展",- "description": "安装扩展以添加相框、光标效果和编辑工具。"- },- "search": {- "placeholder": "搜索扩展...",- "noResults": "未找到扩展",- "noMarketplace": "暂无可用的市场扩展",- "count": "{{count}} 个扩展",- "countPlural": "{{count}} 个扩展"- },- "toast": {- "installedAndEnabled": "扩展已安装并启用",- "uninstalled": "已卸载 {{name}}",- "uninstallFailed": "卸载 {{name}} 失败",- "searchFailed": "搜索市场失败",- "refreshed": "扩展已刷新",- "refreshFailed": "刷新扩展失败",- "marketplaceInstalled": "已安装并启用 {{name}}",- "marketplaceInstallFailed": "安装 {{name}} 失败"- }+ "title": "扩展",+ "tabs": {+ "browse": "浏览",+ "installed": "已安装"+ },+ "actions": {+ "submit": "提交扩展",+ "docs": "扩展文档",+ "refresh": "刷新",+ "openFolder": "打开扩展文件夹",+ "uninstall": "卸载",+ "install": "安装",+ "installing": "安装中",+ "add": "添加",+ "retry": "重试",+ "close": "关闭",+ "folder": "文件夹"+ },+ "status": {+ "enabled": "已启用",+ "disabled": "已禁用",+ "installed": "已安装"+ },+ "detail": {+ "by": "由 {{author}} 开发",+ "unknownAuthor": "未知作者",+ "noDescription": "暂无描述",+ "downloads": "{{count}} 次下载",+ "preview": "预览",+ "screenshotAlt": "截图 {{number}}",+ "description": "描述",+ "tags": "标签",+ "permissions": "权限",+ "location": "位置",+ "error": "错误:{{message}}"+ },+ "empty": {+ "title": "没有扩展",+ "description": "安装扩展以添加相框、光标效果和编辑工具。"+ },+ "search": {+ "placeholder": "搜索扩展...",+ "noResults": "未找到扩展",+ "noMarketplace": "暂无可用的市场扩展",+ "count": "{{count}} 个扩展",+ "countPlural": "{{count}} 个扩展"+ },+ "toast": {+ "installedAndEnabled": "扩展已安装并启用",+ "uninstalled": "已卸载 {{name}}",+ "uninstallFailed": "卸载 {{name}} 失败",+ "searchFailed": "搜索市场失败",+ "refreshed": "扩展已刷新",+ "refreshFailed": "刷新扩展失败",+ "marketplaceInstalled": "已安装并启用 {{name}}",+ "enableFailed": "启用扩展失败",+ "marketplaceInstallFailed": "安装 {{name}} 失败"+ }}diff --git a/src/lib/extensions/cursorCoordinates.ts b/src/lib/extensions/cursorCoordinates.tsindex ffc62694..7df54828 100644--- a/src/lib/extensions/cursorCoordinates.ts+++ b/src/lib/extensions/cursorCoordinates.ts@@ -74,10 +74,7 @@ export function mapSmoothedCursorToCanvasNormalized(return null;}- const mappedCursor = mapCursorToCanvasNormalized(- { cx: cursor.cx, cy: cursor.cy },- params,- );+ const mappedCursor = mapCursorToCanvasNormalized({ cx: cursor.cx, cy: cursor.cy }, params);if (!mappedCursor) {return null;}@@ -89,4 +86,4 @@ export function mapSmoothedCursorToCanvasNormalized(.map((point) => mapCursorToCanvasNormalized(point, params)).filter((point): point is { cx: number; cy: number } => point !== null),};-}\ No newline at end of file+}diff --git a/src/lib/extensions/extensionHost.ts b/src/lib/extensions/extensionHost.tsindex 08936923..a93121f1 100644--- a/src/lib/extensions/extensionHost.ts+++ b/src/lib/extensions/extensionHost.ts@@ -5,6 +5,7 @@* modules, provides the permission-gated host API, and coordinates render hooks.*/+import { createExtensionModuleUrl, resolveExtensionRelativeFileUrl } from "./fileUrls";import type {ContributedCursorStyle,ContributedFrame,@@ -23,7 +24,6 @@ import type {RenderHookFn,RenderHookPhase,} from "./types";-import { createExtensionModuleUrl, resolveExtensionRelativeFileUrl } from "./fileUrls";const EXTENSION_SETTINGS_STORAGE_KEY = "recordly.extension-settings.v1";@@ -156,7 +156,10 @@ export class ExtensionHost {} | null = null;private _zoomState: { scale: number; focusX: number; focusY: number; progress: number } | null =null;- private _shadowConfig: { enabled: boolean; intensity: number } = { enabled: false, intensity: 0 };+ private _shadowConfig: { enabled: boolean; intensity: number } = {+ enabled: false,+ intensity: 0,+ };private _cursorTelemetry: Array<{timeMs: number;cx: number;@@ -172,8 +175,11 @@ export class ExtensionHost {} | null = null;private _keystrokeEvents: Array<{ timeMs: number; key: string; modifiers: string[] }> = [];private _activeFrame: string | null = null;- private _playbackState: { currentTimeMs: number; durationMs: number; isPlaying: boolean } | null =- null;+ private _playbackState: {+ currentTimeMs: number;+ durationMs: number;+ isPlaying: boolean;+ } | null = null;/*** Activate an extension given its info and resolved module URL.@@ -293,7 +299,10 @@ export class ExtensionHost {hook.hook(context);context.ctx.restore();} catch (err) {- console.warn(`[extensions] Render hook error (${hook.extensionId}, ${phase}):`, err);+ console.warn(+ `[extensions] Render hook error (${hook.extensionId}, ${phase}):`,+ err,+ );}}}@@ -459,22 +468,20 @@ export class ExtensionHost {}setSmoothedCursor(- cursor:- | {- timeMs: number;- cx: number;- cy: number;- trail: Array<{ cx: number; cy: number }>;- }- | null,+ cursor: {+ timeMs: number;+ cx: number;+ cy: number;+ trail: Array<{ cx: number; cy: number }>;+ } | null,): void {this._smoothedCursor = cursor? {- timeMs: cursor.timeMs,- cx: cursor.cx,- cy: cursor.cy,- trail: cursor.trail.map((point) => ({ ...point })),- }+ timeMs: cursor.timeMs,+ cx: cursor.cx,+ cy: cursor.cy,+ trail: cursor.trail.map((point) => ({ ...point })),+ }: null;}@@ -805,7 +812,9 @@ export class ExtensionHost {playSound(relativePath: string, options?: { volume?: number }): () => void {requirePermission("audio", "playSound");- const audio = new Audio(resolveExtensionRelativeFileUrl(extensionPath, relativePath));+ const audio = new Audio(+ resolveExtensionRelativeFileUrl(extensionPath, relativePath),+ );audio.volume = Math.max(0, Math.min(1, options?.volume ?? 1));audio.play().catch((err) => {console.warn(`[ext:${extensionId}] Failed to play sound:`, err);@@ -902,7 +911,10 @@ export class ExtensionHost {getCanvasDimensions() {if (!host._videoLayout) return null;- return { width: host._videoLayout.canvasWidth, height: host._videoLayout.canvasHeight };+ return {+ width: host._videoLayout.canvasWidth,+ height: host._videoLayout.canvasHeight,+ };},onSettingChange(callback: (settingId: string, value: unknown) => void): () => void {@@ -931,7 +943,9 @@ export class ExtensionHost {async syncConfiguredExtensions(discovered: ExtensionInfo[]): Promise<void> {const desired = new Map(- discovered.filter((ext) => ext.status === "active").map((ext) => [ext.manifest.id, ext]),+ discovered+ .filter((ext) => ext.status === "active")+ .map((ext) => [ext.manifest.id, ext]),);for (const activeId of Array.from(this.activeExtensions.keys())) {diff --git a/src/lib/extensions/fileUrls.ts b/src/lib/extensions/fileUrls.tsindex ff490c80..9c49dc21 100644--- a/src/lib/extensions/fileUrls.ts+++ b/src/lib/extensions/fileUrls.ts@@ -46,4 +46,4 @@ export function createExtensionModuleUrl(extensionPath: string, entryPoint: striconst base = resolveExtensionRelativeFileUrl(extensionPath, entryPoint);// Cache-bust so re-installs / updates load the fresh modulereturn `${base}?v=${Date.now()}`;-}\ No newline at end of file+}diff --git a/src/lib/extensions/index.ts b/src/lib/extensions/index.tsindex f8af0538..efe080cd 100644--- a/src/lib/extensions/index.ts+++ b/src/lib/extensions/index.ts@@ -1,29 +1,29 @@-export { extensionHost, ExtensionHost } from './extensionHost';+export { ExtensionHost, extensionHost } from "./extensionHost";export type {- ExtensionManifest,- ExtensionInfo,- ExtensionPermission,- ExtensionStatus,- RecordlyExtensionAPI,- RecordlyExtensionModule,- RenderHookPhase,- RenderHookFn,- RenderHookContext,- CursorEffectFn,- CursorEffectContext,- ExtensionEventType,- ExtensionEvent,- ExtensionSettingsPanel,- ExtensionSettingField,- ExtensionContributions,- ContributedCursorStyle,- ContributedSound,- ContributedWallpaper,- ContributedWebcamFrame,- ContributedFrame,- FrameInstance,- MarketplaceExtension,- MarketplaceSearchResult,- MarketplaceReviewStatus,- ExtensionReview,-} from './types';+ ContributedCursorStyle,+ ContributedFrame,+ ContributedSound,+ ContributedWallpaper,+ ContributedWebcamFrame,+ CursorEffectContext,+ CursorEffectFn,+ ExtensionContributions,+ ExtensionEvent,+ ExtensionEventType,+ ExtensionInfo,+ ExtensionManifest,+ ExtensionPermission,+ ExtensionReview,+ ExtensionSettingField,+ ExtensionSettingsPanel,+ ExtensionStatus,+ FrameInstance,+ MarketplaceExtension,+ MarketplaceReviewStatus,+ MarketplaceSearchResult,+ RecordlyExtensionAPI,+ RecordlyExtensionModule,+ RenderHookContext,+ RenderHookFn,+ RenderHookPhase,+} from "./types";diff --git a/src/lib/extensions/renderHooks.ts b/src/lib/extensions/renderHooks.tsindex 8de9d374..70c4c88e 100644--- a/src/lib/extensions/renderHooks.ts+++ b/src/lib/extensions/renderHooks.ts@@ -6,125 +6,137 @@* app renderers and extension-registered hooks.*/-import { extensionHost } from '@/lib/extensions';-import type { RenderHookPhase, RenderHookContext, CursorEffectContext } from '@/lib/extensions';+import type { CursorEffectContext, RenderHookContext, RenderHookPhase } from "@/lib/extensions";+import { extensionHost } from "@/lib/extensions";// ---------------------------------------------------------------------------// Scene pixel helpers — created per-context (capture ctx + videoLayout)// ----------------------------------------------------------------------------function makePixelHelpers(ctx: CanvasRenderingContext2D, videoLayout?: RenderHookContext['videoLayout']) {- const getPixelColor = (x: number, y: number) => {- const px = Math.round(x);- const py = Math.round(y);- const d = ctx.getImageData(px, py, 1, 1).data;- return { r: d[0], g: d[1], b: d[2], a: d[3] };- };+function makePixelHelpers(+ ctx: CanvasRenderingContext2D,+ videoLayout?: RenderHookContext["videoLayout"],+) {+ const getPixelColor = (x: number, y: number) => {+ const px = Math.round(x);+ const py = Math.round(y);+ const d = ctx.getImageData(px, py, 1, 1).data;+ return { r: d[0], g: d[1], b: d[2], a: d[3] };+ };- const sampleGrid = (- sx: number, sy: number, sw: number, sh: number, step: number,- ) => {- let rSum = 0, gSum = 0, bSum = 0, aSum = 0, count = 0;- const clampedW = Math.max(1, Math.round(sw));- const clampedH = Math.max(1, Math.round(sh));- const data = ctx.getImageData(Math.round(sx), Math.round(sy), clampedW, clampedH).data;- for (let y = 0; y < clampedH; y += step) {- for (let x = 0; x < clampedW; x += step) {- const i = (y * clampedW + x) * 4;- rSum += data[i]; gSum += data[i + 1]; bSum += data[i + 2]; aSum += data[i + 3];- count++;- }- }- if (count === 0) return { r: 0, g: 0, b: 0, a: 0 };- return {- r: Math.round(rSum / count),- g: Math.round(gSum / count),- b: Math.round(bSum / count),- a: Math.round(aSum / count),- };- };+ const sampleGrid = (sx: number, sy: number, sw: number, sh: number, step: number) => {+ let rSum = 0,+ gSum = 0,+ bSum = 0,+ aSum = 0,+ count = 0;+ const clampedW = Math.max(1, Math.round(sw));+ const clampedH = Math.max(1, Math.round(sh));+ const data = ctx.getImageData(Math.round(sx), Math.round(sy), clampedW, clampedH).data;+ for (let y = 0; y < clampedH; y += step) {+ for (let x = 0; x < clampedW; x += step) {+ const i = (y * clampedW + x) * 4;+ rSum += data[i];+ gSum += data[i + 1];+ bSum += data[i + 2];+ aSum += data[i + 3];+ count++;+ }+ }+ if (count === 0) return { r: 0, g: 0, b: 0, a: 0 };+ return {+ r: Math.round(rSum / count),+ g: Math.round(gSum / count),+ b: Math.round(bSum / count),+ a: Math.round(aSum / count),+ };+ };- const getMaskRect = () => {- if (videoLayout) return videoLayout.maskRect;- return { x: 0, y: 0, width: ctx.canvas.width, height: ctx.canvas.height };- };+ const getMaskRect = () => {+ if (videoLayout) return videoLayout.maskRect;+ return { x: 0, y: 0, width: ctx.canvas.width, height: ctx.canvas.height };+ };- const getAverageSceneColor = () => {- const m = getMaskRect();- const step = Math.max(1, Math.round(Math.min(m.width, m.height) / 32));- return sampleGrid(m.x, m.y, m.width, m.height, step);- };+ const getAverageSceneColor = () => {+ const m = getMaskRect();+ const step = Math.max(1, Math.round(Math.min(m.width, m.height) / 32));+ return sampleGrid(m.x, m.y, m.width, m.height, step);+ };- const getEdgeAverageColor = (edgeWidth = 4) => {- const m = getMaskRect();- const ew = Math.max(1, edgeWidth);- let rSum = 0, gSum = 0, bSum = 0, aSum = 0, count = 0;+ const getEdgeAverageColor = (edgeWidth = 4) => {+ const m = getMaskRect();+ const ew = Math.max(1, edgeWidth);+ let rSum = 0,+ gSum = 0,+ bSum = 0,+ aSum = 0,+ count = 0;- const bands = [- { x: m.x, y: m.y, w: m.width, h: ew }, // top- { x: m.x, y: m.y + m.height - ew, w: m.width, h: ew }, // bottom- { x: m.x, y: m.y + ew, w: ew, h: m.height - ew * 2 }, // left- { x: m.x + m.width - ew, y: m.y + ew, w: ew, h: m.height - ew * 2 }, // right- ];- const step = Math.max(1, Math.round(Math.min(m.width, m.height) / 64));- for (const b of bands) {- if (b.w <= 0 || b.h <= 0) continue;- const avg = sampleGrid(b.x, b.y, b.w, b.h, step);- const bandSamples = Math.ceil(b.w / step) * Math.ceil(b.h / step);- rSum += avg.r * bandSamples;- gSum += avg.g * bandSamples;- bSum += avg.b * bandSamples;- aSum += avg.a * bandSamples;- count += bandSamples;- }- if (count === 0) return { r: 0, g: 0, b: 0, a: 0 };- return {- r: Math.round(rSum / count),- g: Math.round(gSum / count),- b: Math.round(bSum / count),- a: Math.round(aSum / count),- };- };+ const bands = [+ { x: m.x, y: m.y, w: m.width, h: ew }, // top+ { x: m.x, y: m.y + m.height - ew, w: m.width, h: ew }, // bottom+ { x: m.x, y: m.y + ew, w: ew, h: m.height - ew * 2 }, // left+ { x: m.x + m.width - ew, y: m.y + ew, w: ew, h: m.height - ew * 2 }, // right+ ];+ const step = Math.max(1, Math.round(Math.min(m.width, m.height) / 64));+ for (const b of bands) {+ if (b.w <= 0 || b.h <= 0) continue;+ const avg = sampleGrid(b.x, b.y, b.w, b.h, step);+ const bandSamples = Math.ceil(b.w / step) * Math.ceil(b.h / step);+ rSum += avg.r * bandSamples;+ gSum += avg.g * bandSamples;+ bSum += avg.b * bandSamples;+ aSum += avg.a * bandSamples;+ count += bandSamples;+ }+ if (count === 0) return { r: 0, g: 0, b: 0, a: 0 };+ return {+ r: Math.round(rSum / count),+ g: Math.round(gSum / count),+ b: Math.round(bSum / count),+ a: Math.round(aSum / count),+ };+ };- const getDominantColors = (maxColors = 5) => {- const m = getMaskRect();- const step = Math.max(1, Math.round(Math.min(m.width, m.height) / 24));- const clampedW = Math.max(1, Math.round(m.width));- const clampedH = Math.max(1, Math.round(m.height));- const data = ctx.getImageData(Math.round(m.x), Math.round(m.y), clampedW, clampedH).data;- // Quantize to 5-bit per channel- const buckets = new Map<number, { r: number; g: number; b: number; count: number }>();- for (let y = 0; y < clampedH; y += step) {- for (let x = 0; x < clampedW; x += step) {- const i = (y * clampedW + x) * 4;- const qr = data[i] >> 3;- const qg = data[i + 1] >> 3;- const qb = data[i + 2] >> 3;- const key = (qr << 10) | (qg << 5) | qb;- const existing = buckets.get(key);- if (existing) {- existing.r += data[i];- existing.g += data[i + 1];- existing.b += data[i + 2];- existing.count++;- } else {- buckets.set(key, { r: data[i], g: data[i + 1], b: data[i + 2], count: 1 });- }- }- }- const totalSamples = Array.from(buckets.values()).reduce((s, b) => s + b.count, 0) || 1;- return Array.from(buckets.values())- .sort((a, b) => b.count - a.count)- .slice(0, maxColors)- .map(b => ({- r: Math.round(b.r / b.count),- g: Math.round(b.g / b.count),- b: Math.round(b.b / b.count),- frequency: b.count / totalSamples,- }));- };+ const getDominantColors = (maxColors = 5) => {+ const m = getMaskRect();+ const step = Math.max(1, Math.round(Math.min(m.width, m.height) / 24));+ const clampedW = Math.max(1, Math.round(m.width));+ const clampedH = Math.max(1, Math.round(m.height));+ const data = ctx.getImageData(Math.round(m.x), Math.round(m.y), clampedW, clampedH).data;+ // Quantize to 5-bit per channel+ const buckets = new Map<number, { r: number; g: number; b: number; count: number }>();+ for (let y = 0; y < clampedH; y += step) {+ for (let x = 0; x < clampedW; x += step) {+ const i = (y * clampedW + x) * 4;+ const qr = data[i] >> 3;+ const qg = data[i + 1] >> 3;+ const qb = data[i + 2] >> 3;+ const key = (qr << 10) | (qg << 5) | qb;+ const existing = buckets.get(key);+ if (existing) {+ existing.r += data[i];+ existing.g += data[i + 1];+ existing.b += data[i + 2];+ existing.count++;+ } else {+ buckets.set(key, { r: data[i], g: data[i + 1], b: data[i + 2], count: 1 });+ }+ }+ }+ const totalSamples = Array.from(buckets.values()).reduce((s, b) => s + b.count, 0) || 1;+ return Array.from(buckets.values())+ .sort((a, b) => b.count - a.count)+ .slice(0, maxColors)+ .map((b) => ({+ r: Math.round(b.r / b.count),+ g: Math.round(b.g / b.count),+ b: Math.round(b.b / b.count),+ frequency: b.count / totalSamples,+ }));+ };- return { getPixelColor, getAverageSceneColor, getEdgeAverageColor, getDominantColors };+ return { getPixelColor, getAverageSceneColor, getEdgeAverageColor, getDominantColors };}/**@@ -134,54 +146,54 @@ function makePixelHelpers(ctx: CanvasRenderingContext2D, videoLayout?: RenderHoo* The context is saved/restored around each hook call.*/export function executeExtensionRenderHooks(- phase: RenderHookPhase,- ctx: CanvasRenderingContext2D,- params: {- width: number;- height: number;- timeMs: number;- durationMs: number;- cursor?: { cx: number; cy: number; interactionType?: string } | null;- smoothedCursor?: RenderHookContext['smoothedCursor'];- videoLayout?: RenderHookContext['videoLayout'];- zoom?: RenderHookContext['zoom'];- shadow?: RenderHookContext['shadow'];- sceneTransform?: RenderHookContext['sceneTransform'];- },+ phase: RenderHookPhase,+ ctx: CanvasRenderingContext2D,+ params: {+ width: number;+ height: number;+ timeMs: number;+ durationMs: number;+ cursor?: { cx: number; cy: number; interactionType?: string } | null;+ smoothedCursor?: RenderHookContext["smoothedCursor"];+ videoLayout?: RenderHookContext["videoLayout"];+ zoom?: RenderHookContext["zoom"];+ shadow?: RenderHookContext["shadow"];+ sceneTransform?: RenderHookContext["sceneTransform"];+ },): void {- if (!extensionHost.hasRenderHooks(phase)) return;+ if (!extensionHost.hasRenderHooks(phase)) return;- const helpers = makePixelHelpers(ctx, params.videoLayout);+ const helpers = makePixelHelpers(ctx, params.videoLayout);- const context: RenderHookContext = {- width: params.width,- height: params.height,- timeMs: params.timeMs,- durationMs: params.durationMs,- cursor: params.cursor ?? null,- smoothedCursor: params.smoothedCursor ?? null,- ctx,- videoLayout: params.videoLayout,- zoom: params.zoom,- shadow: params.shadow,- sceneTransform: params.sceneTransform,- getPixelColor: helpers.getPixelColor,- getAverageSceneColor: helpers.getAverageSceneColor,- getEdgeAverageColor: helpers.getEdgeAverageColor,- getDominantColors: helpers.getDominantColors,- };+ const context: RenderHookContext = {+ width: params.width,+ height: params.height,+ timeMs: params.timeMs,+ durationMs: params.durationMs,+ cursor: params.cursor ?? null,+ smoothedCursor: params.smoothedCursor ?? null,+ ctx,+ videoLayout: params.videoLayout,+ zoom: params.zoom,+ shadow: params.shadow,+ sceneTransform: params.sceneTransform,+ getPixelColor: helpers.getPixelColor,+ getAverageSceneColor: helpers.getAverageSceneColor,+ getEdgeAverageColor: helpers.getEdgeAverageColor,+ getDominantColors: helpers.getDominantColors,+ };- extensionHost.executeRenderHooks(phase, context);+ extensionHost.executeRenderHooks(phase, context);}/*** Track active cursor effects (animations that persist across frames).*/interface ActiveCursorEffectInstance {- interactionTimeMs: number;- cx: number;- cy: number;- interactionType: 'click' | 'double-click' | 'right-click' | 'mouseup';+ interactionTimeMs: number;+ cx: number;+ cy: number;+ interactionType: "click" | "double-click" | "right-click" | "mouseup";}const activeCursorInteractions: ActiveCursorEffectInstance[] = [];@@ -191,22 +203,22 @@ const MAX_EFFECT_DURATION_MS = 2000;* Notify that a cursor interaction occurred (call from cursor telemetry handler).*/export function notifyCursorInteraction(- timeMs: number,- cx: number,- cy: number,- interactionType: string,+ timeMs: number,+ cx: number,+ cy: number,+ interactionType: string,): void {- if (!extensionHost.hasCursorEffects()) return;+ if (!extensionHost.hasCursorEffects()) return;- const validTypes = new Set(['click', 'double-click', 'right-click', 'mouseup']);- if (!validTypes.has(interactionType)) return;+ const validTypes = new Set(["click", "double-click", "right-click", "mouseup"]);+ if (!validTypes.has(interactionType)) return;- activeCursorInteractions.push({- interactionTimeMs: timeMs,- cx,- cy,- interactionType: interactionType as ActiveCursorEffectInstance['interactionType'],- });+ activeCursorInteractions.push({+ interactionTimeMs: timeMs,+ cx,+ cy,+ interactionType: interactionType as ActiveCursorEffectInstance["interactionType"],+ });}/**@@ -214,53 +226,53 @@ export function notifyCursorInteraction(* Called after the cursor is drawn in the render pipeline.*/export function executeExtensionCursorEffects(- ctx: CanvasRenderingContext2D,- timeMs: number,- width: number,- height: number,- extra?: {- zoom?: CursorEffectContext['zoom'];- sceneTransform?: CursorEffectContext['sceneTransform'];- videoLayout?: CursorEffectContext['videoLayout'];- },+ ctx: CanvasRenderingContext2D,+ timeMs: number,+ width: number,+ height: number,+ extra?: {+ zoom?: CursorEffectContext["zoom"];+ sceneTransform?: CursorEffectContext["sceneTransform"];+ videoLayout?: CursorEffectContext["videoLayout"];+ },): void {- if (!extensionHost.hasCursorEffects() || activeCursorInteractions.length === 0) return;+ if (!extensionHost.hasCursorEffects() || activeCursorInteractions.length === 0) return;- // Process all active interactions, removing expired ones- for (let i = activeCursorInteractions.length - 1; i >= 0; i--) {- const interaction = activeCursorInteractions[i];- const elapsedMs = timeMs - interaction.interactionTimeMs;+ // Process all active interactions, removing expired ones+ for (let i = activeCursorInteractions.length - 1; i >= 0; i--) {+ const interaction = activeCursorInteractions[i];+ const elapsedMs = timeMs - interaction.interactionTimeMs;- // Remove if too old- if (elapsedMs > MAX_EFFECT_DURATION_MS || elapsedMs < 0) {- activeCursorInteractions.splice(i, 1);- continue;- }+ // Remove if too old+ if (elapsedMs > MAX_EFFECT_DURATION_MS || elapsedMs < 0) {+ activeCursorInteractions.splice(i, 1);+ continue;+ }- const effectCtx: CursorEffectContext = {- timeMs,- cx: interaction.cx,- cy: interaction.cy,- interactionType: interaction.interactionType,- width,- height,- ctx,- elapsedMs,- zoom: extra?.zoom,- sceneTransform: extra?.sceneTransform,- videoLayout: extra?.videoLayout,- };+ const effectCtx: CursorEffectContext = {+ timeMs,+ cx: interaction.cx,+ cy: interaction.cy,+ interactionType: interaction.interactionType,+ width,+ height,+ ctx,+ elapsedMs,+ zoom: extra?.zoom,+ sceneTransform: extra?.sceneTransform,+ videoLayout: extra?.videoLayout,+ };- const stillActive = extensionHost.executeCursorEffects(effectCtx);- if (!stillActive) {- activeCursorInteractions.splice(i, 1);- }- }+ const stillActive = extensionHost.executeCursorEffects(effectCtx);+ if (!stillActive) {+ activeCursorInteractions.splice(i, 1);+ }+ }}/*** Clear all active cursor effect animations (e.g., on seek).*/export function clearCursorEffects(): void {- activeCursorInteractions.length = 0;+ activeCursorInteractions.length = 0;}diff --git a/src/lib/extensions/types.ts b/src/lib/extensions/types.tsindex 5bf6a969..0e6f8ef5 100644--- a/src/lib/extensions/types.ts+++ b/src/lib/extensions/types.ts@@ -297,7 +297,9 @@ export interface RenderHookContext {* Get dominant colors in the video content area.* Returns up to `count` colors sorted by frequency.*/- getDominantColors(count?: number): Array<{ r: number; g: number; b: number; frequency: number }>;+ getDominantColors(+ count?: number,+ ): Array<{ r: number; g: number; b: number; frequency: number }>;}/** Render hook phases — extensions draw in the registered phase */