Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Merge branch 'main' into desktop-tailwind-v4
Ilya7e1f2173dadb
diff --cc apps/desktop/src/routes/(window-chrome)/new-main/CameraSelect.tsxindex fa9f77821,59d874fd2..295c7493c--- a/apps/desktop/src/routes/(window-chrome)/new-main/CameraSelect.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/CameraSelect.tsx@@@ -83,11 -102,16 +102,16 @@@ export default function CameraSelect(pr!cameraWindowOpen() &&!props.hidePreviewButton;+ const showSettingsShortcut = () =>+ props.value !== null && permissionGranted() && !!props.onOpenSettings;++ const isDisabled = () => !!currentRecording.data || props.disabled;+return (- <div class="flex flex-col gap-1 items-stretch text-(--text-primary)">- <div class="flex flex-col items-stretch text-[--text-primary]">++ <div class="flex flex-col items-stretch text-(--text-primary)"><buttontype="button"- disabled={!!currentRecording.data || props.disabled}+ disabled={isDisabled()}onClick={() => {if (!permissionGranted()) {requestPermission("camera", props.permissions?.camera);diff --cc apps/desktop/src/routes/(window-chrome)/new-main/MicrophoneSelect.tsxindex 502bdcbbd,7e41d0fad..4084064b0--- a/apps/desktop/src/routes/(window-chrome)/new-main/MicrophoneSelect.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/MicrophoneSelect.tsx@@@ -53,12 -62,19 +62,19 @@@ export default function MicrophoneSelecconst audioLevel = () =>(1 - Math.max((dbs() ?? 0) + DB_SCALE, 0) / DB_SCALE) ** 0.5;+ const showLevel = () => props.value !== null && dbs() !== undefined;++ const showSettingsShortcut = () =>+ props.value !== null && permissionGranted() && !!props.onOpenSettings;++ const isDisabled = () => !!currentRecording.data || props.disabled;+return (- <div class="flex flex-col gap-1 items-stretch text-(--text-primary)">- <div class="flex flex-col items-stretch text-[--text-primary]">++ <div class="flex flex-col items-stretch text-(--text-primary)"><buttontype="button"- disabled={!!currentRecording.data || props.disabled}- class="flex overflow-hidden relative z-10 flex-row gap-2 items-center px-2 w-full h-[42px] rounded-lg border border-gray-5 transition-colors cursor-default disabled:opacity-70 bg-gray-3 disabled:text-gray-11 KSelect"+ disabled={isDisabled()}+ class={cx(DEVICE_ROW_CLASS, "KSelect")}onClick={() => {if (!permissionGranted()) {requestPermission("microphone", props.permissions?.microphone);diff --cc apps/desktop/src/routes/(window-chrome)/new-main/index.tsxindex aefb782ef,d0ea2d8d7..78b851c63--- a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx@@@ -147,45 -202,59 +202,59 @@@ const createDisplaySignature =type TargetMenuPanelProps =| {-- variant: "display";-- targets?: CaptureDisplayWithThumbnail[];-- onSelect: (target: CaptureDisplayWithThumbnail) => void;-- }++ variant: "display";++ targets?: CaptureDisplayWithThumbnail[];++ onSelect: (target: CaptureDisplayWithThumbnail) => void;++ }| {-- variant: "window";-- targets?: CaptureWindowWithThumbnail[];-- onSelect: (target: CaptureWindowWithThumbnail) => void;-- }++ variant: "window";++ targets?: CaptureWindowWithThumbnail[];++ onSelect: (target: CaptureWindowWithThumbnail) => void;++ }| {-- variant: "recording";-- targets?: RecordingWithPath[];-- onSelect: (target: RecordingWithPath) => void;-- onViewAll: () => void;-- uploadProgress?: Record<string, number>;-- reuploadingPaths?: Set<string>;-- onReupload?: (path: string) => void;-- onRefetch?: () => void;-- }++ variant: "recording";++ targets?: RecordingWithPath[];++ onSelect: (target: RecordingWithPath) => void;++ onViewAll: () => void;++ uploadProgress?: Record<string, number>;++ reuploadingPaths?: Set<string>;++ onReupload?: (path: string) => void;++ onRefetch?: () => void;++ }| {-- variant: "screenshot";-- targets?: ScreenshotWithPath[];-- onSelect: (target: ScreenshotWithPath) => void;-- onViewAll: () => void;-- }++ variant: "screenshot";++ targets?: ScreenshotWithPath[];++ onSelect: (target: ScreenshotWithPath) => void;++ onViewAll: () => void;++ }| {-- variant: "camera";-- targets?: CameraWithDetails[];-- selectedTarget: CameraWithDetails | null;-- onSelect: (target: CameraWithDetails | null) => void;-- permissions?: OSPermissionsCheck;- deviceSettings?: RecordingDeviceSettingsStore;- onCameraSettingsChange: (- camera: CameraWithDetails,- settings: CameraDeviceSettings,- ) => void;- compatibilityStudioMode: boolean;- initialSettingsTarget?: CameraWithDetails | null;-- }++ variant: "camera";++ targets?: CameraWithDetails[];++ selectedTarget: CameraWithDetails | null;++ onSelect: (target: CameraWithDetails | null) => void;++ permissions?: OSPermissionsCheck;++ deviceSettings?: RecordingDeviceSettingsStore;++ onCameraSettingsChange: (++ camera: CameraWithDetails,++ settings: CameraDeviceSettings,++ ) => void;++ compatibilityStudioMode: boolean;++ initialSettingsTarget?: CameraWithDetails | null;++ }| {-- variant: "microphone";-- targets?: MicrophoneWithDetails[];-- selectedTarget: MicrophoneWithDetails | null;-- onSelect: (target: MicrophoneWithDetails | null) => void;-- permissions?: OSPermissionsCheck;- deviceSettings?: RecordingDeviceSettingsStore;- onMicrophoneSettingsChange: (- key: string,- settings: MicrophoneDeviceSettings,- ) => void;- compatibilityStudioMode: boolean;- initialSettingsTarget?: MicrophoneWithDetails | null;-- };++ variant: "microphone";++ targets?: MicrophoneWithDetails[];++ selectedTarget: MicrophoneWithDetails | null;++ onSelect: (target: MicrophoneWithDetails | null) => void;++ permissions?: OSPermissionsCheck;++ deviceSettings?: RecordingDeviceSettingsStore;++ onMicrophoneSettingsChange: (++ key: string,++ settings: MicrophoneDeviceSettings,++ ) => void;++ compatibilityStudioMode: boolean;++ initialSettingsTarget?: MicrophoneWithDetails | null;++ };type SharedTargetMenuProps = {isLoading: boolean;@@@ -196,27 -265,41 +265,41 @@@type DeviceListPanelProps =| {-- variant: "camera";-- targets: CameraWithDetails[];-- selectedTarget: CameraWithDetails | null;-- onSelect: (target: CameraWithDetails | null) => void;-- isLoading?: boolean;-- errorMessage?: string;-- disabled?: boolean;-- emptyMessage?: string;-- permissions?: OSPermissionsCheck;- deviceSettings?: RecordingDeviceSettingsStore;- onCameraSettingsChange: (- camera: CameraWithDetails,- settings: CameraDeviceSettings,- ) => void;- compatibilityStudioMode: boolean;- initialSettingsTarget?: CameraWithDetails | null;-- }++ variant: "camera";++ targets: CameraWithDetails[];++ selectedTarget: CameraWithDetails | null;++ onSelect: (target: CameraWithDetails | null) => void;++ isLoading?: boolean;++ errorMessage?: string;++ disabled?: boolean;++ emptyMessage?: string;++ permissions?: OSPermissionsCheck;++ deviceSettings?: RecordingDeviceSettingsStore;++ onCameraSettingsChange: (++ camera: CameraWithDetails,++ settings: CameraDeviceSettings,++ ) => void;++ compatibilityStudioMode: boolean;++ initialSettingsTarget?: CameraWithDetails | null;++ }| {-- variant: "microphone";-- targets: MicrophoneWithDetails[];-- selectedTarget: MicrophoneWithDetails | null;-- onSelect: (target: MicrophoneWithDetails | null) => void;-- isLoading?: boolean;-- errorMessage?: string;-- disabled?: boolean;-- emptyMessage?: string;-- permissions?: OSPermissionsCheck;- deviceSettings?: RecordingDeviceSettingsStore;- onMicrophoneSettingsChange: (- key: string,- settings: MicrophoneDeviceSettings,- ) => void;- compatibilityStudioMode: boolean;- initialSettingsTarget?: MicrophoneWithDetails | null;-- };++ variant: "microphone";++ targets: MicrophoneWithDetails[];++ selectedTarget: MicrophoneWithDetails | null;++ onSelect: (target: MicrophoneWithDetails | null) => void;++ isLoading?: boolean;++ errorMessage?: string;++ disabled?: boolean;++ emptyMessage?: string;++ permissions?: OSPermissionsCheck;++ deviceSettings?: RecordingDeviceSettingsStore;++ onMicrophoneSettingsChange: (++ key: string,++ settings: MicrophoneDeviceSettings,++ ) => void;++ compatibilityStudioMode: boolean;++ initialSettingsTarget?: MicrophoneWithDetails | null;++ };function CameraListItem(props: {camera: CameraWithDetails;@@@ -233,13 -319,9 +319,9 @@@};return (- <button- ref={props.ref}- type="button"- disabled={props.disabled}- onClick={props.onSelect}+ <divclass={cx(- "flex flex-col gap-0.5 px-3 py-2.5 rounded-lg text-sm text-left outline-hidden",- "group flex items-stretch rounded-lg text-sm outline-none overflow-hidden transition-colors",++ "group flex items-stretch rounded-lg text-sm outline-hidden overflow-hidden transition-colors",props.isSelected? "bg-blue-500 text-white": props.isFocused@@@ -292,13 -405,9 +405,9 @@@ function MicrophoneListItem(props:};return (- <button- ref={props.ref}- type="button"- disabled={props.disabled}- onClick={props.onSelect}+ <divclass={cx(- "relative overflow-hidden flex flex-col gap-0.5 px-3 py-2.5 rounded-lg text-sm text-left outline-hidden",- "relative overflow-hidden flex items-stretch rounded-lg text-sm outline-none",++ "relative overflow-hidden flex items-stretch rounded-lg text-sm outline-hidden",props.isSelected? "bg-blue-500 text-white": props.isFocused@@@ -316,26 -425,352 +425,352 @@@}}/></Show>- <div class="relative flex items-center gap-3 w-full">- <IconCapMicrophone class="size-4 shrink-0" />- <span class="truncate flex-1">{props.mic.name}</span>- <Show when={props.isSelected}>- <IconLucideCheck class="size-4 shrink-0" />+ <button+ ref={props.ref}+ type="button"+ disabled={props.disabled}+ onClick={props.onSelect}+ class="relative flex flex-col gap-0.5 px-3 py-2.5 min-w-0 flex-1 text-left outline-none"+ >+ <div class="relative flex items-center gap-3 w-full">+ <IconCapMicrophone class="size-4 shrink-0" />+ <span class="truncate flex-1">{props.mic.name}</span>+ <Show when={props.isSelected}>+ <IconLucideCheck class="size-4 shrink-0" />+ </Show>+ </div>+ <Show when={formatDetails()}>+ {(details) => (+ <span+ class={cx(+ "relative text-[11px] pl-7 truncate max-w-full",+ props.isSelected ? "text-white/70" : "text-gray-10",+ )}+ >+ {details()}+ </span>+ )}</Show>- </div>- <Show when={formatDetails()}>- {(details) => (- <span- class={cx(- "relative text-[11px] pl-7",- props.isSelected ? "text-white/70" : "text-gray-10",- )}- >- {details()}- </span>+ </button>+ <button+ type="button"+ disabled={props.disabled}+ title="Device settings"+ aria-label="Device settings"+ onPointerDown={(event) => event.stopPropagation()}+ onClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ props.onSettings();+ }}+ class={cx(+ "relative w-10 shrink-0 flex items-center justify-center outline-none transition-colors before:absolute before:inset-y-1.5 before:left-0 before:w-px",+ props.isSelected+ ? "text-white/80 hover:text-white hover:bg-white/10 before:bg-white/20"+ : "text-gray-10 hover:text-gray-12 hover:bg-gray-5 before:bg-gray-6",)}- </Show>- </button>+ >+ <IconLucideSettings class="size-4" />+ </button>+ </div>+ );+ }++ function CameraSettingsPanel(props: {+ camera: CameraWithDetails;+ value?: CameraDeviceSettings;+ onChange: (settings: CameraDeviceSettings) => void;+ onBack: () => void;+ compatibilityStudioMode: boolean;+ }) {+ const formats = createMemo(() => {+ const formats = props.camera.formats ?? [];+ const seen = new Set<string>();+ return formats+ .filter((format) => {+ const key = `${format.width}:${format.height}:${Math.round(format.frameRate)}`;+ if (seen.has(key)) return false;+ seen.add(key);+ return true;+ })+ .sort(+ (a, b) =>+ b.width * b.height - a.width * a.height || b.frameRate - a.frameRate,+ );+ });++ const defaultSetting = createMemo<CameraDeviceSettings | undefined>(() => {+ if (props.camera.bestFormat) {+ const { width, height, frameRate } = props.camera.bestFormat;+ return { width, height, frameRate };+ }+ const first = formats()[0];+ if (!first) return undefined;+ return {+ width: first.width,+ height: first.height,+ frameRate: first.frameRate,+ };+ });++ const isDefaultSelected = () => {+ const value = props.value;+ return (+ !value ||+ (value.width === undefined &&+ value.height === undefined &&+ value.frameRate === undefined)+ );+ };++ const isSelected = (format: CameraDeviceSettings) =>+ props.value?.width === format.width &&+ props.value?.height === format.height &&+ Math.round(props.value?.frameRate ?? 0) ===- Math.round(format.frameRate ?? 0);++ Math.round(format.frameRate ?? 0);++ return (+ <div class="flex flex-col gap-3">+ <div class="flex items-center gap-2 px-1">+ <button+ type="button"+ onClick={props.onBack}+ class="flex items-center justify-center size-7 rounded-md text-gray-11 hover:text-gray-12 hover:bg-gray-4"+ aria-label="Back"+ >+ <IconLucideArrowLeft class="size-4" />+ </button>+ <IconLucideSettings class="size-4 text-gray-11 shrink-0" />+ <div class="min-w-0 flex-1">+ <div class="text-sm font-medium text-gray-12 truncate">+ {props.camera.display_name}+ </div>+ <div class="text-[11px] text-gray-10">Camera settings</div>+ </div>+ </div>+ <div class="flex flex-col gap-1">+ <button+ type="button"+ onClick={() => props.onChange({})}+ class={cx(+ "flex items-center gap-3 px-3 py-2.5 rounded-lg text-left text-sm outline-none",+ isDefaultSelected()+ ? "bg-blue-500 text-white"+ : "text-gray-12 hover:bg-gray-4",+ )}+ >+ <div class="flex-1 min-w-0">+ <div class="truncate">Default</div>+ <Show when={defaultSetting()}>+ {(setting) => (+ <div+ class={cx(+ "text-[11px] truncate",+ isDefaultSelected() ? "text-white/70" : "text-gray-10",+ )}+ >+ {formatCameraSetting(setting())}+ </div>+ )}+ </Show>+ </div>+ <Show when={isDefaultSelected()}>+ <IconLucideCheck class="size-4 shrink-0" />+ </Show>+ </button>+ <Show when={formats().length > 0}>+ <For each={formats()}>+ {(format) => {+ const setting = () => ({+ width: format.width,+ height: format.height,+ frameRate: format.frameRate,+ });+ const high = () => isHighCameraSetting(setting());+ return (+ <button+ type="button"+ onClick={() => props.onChange(setting())}+ class={cx(+ "flex items-center gap-3 px-3 py-2.5 rounded-lg text-left text-sm outline-none",+ isSelected(setting())+ ? "bg-blue-500 text-white"+ : "text-gray-12 hover:bg-gray-4",+ )}+ >+ <div class="flex-1 min-w-0">+ <div class="truncate">{formatCameraSetting(setting())}</div>+ <Show when={props.compatibilityStudioMode && high()}>+ <div+ class={cx(+ "text-[11px]",+ isSelected(setting())+ ? "text-white/70"+ : "text-amber-11",+ )}+ >+ Compatibility mode may reduce this setting.+ </div>+ </Show>+ </div>+ <Show when={isSelected(setting())}>+ <IconLucideCheck class="size-4 shrink-0" />+ </Show>+ </button>+ );+ }}+ </For>+ </Show>+ </div>+ </div>+ );+ }++ function MicrophoneSettingsPanel(props: {+ mic: MicrophoneWithDetails;+ value?: MicrophoneDeviceSettings;+ onChange: (settings: MicrophoneDeviceSettings) => void;+ onBack: () => void;+ compatibilityStudioMode: boolean;+ }) {+ const formats = createMemo(() => {+ const formats =+ props.mic.formats && props.mic.formats.length > 0+ ? props.mic.formats+ : props.mic.sampleRate && props.mic.channels+ ? [{ sampleRate: props.mic.sampleRate, channels: props.mic.channels }]+ : [];+ const seen = new Set<string>();+ return formats+ .filter((format) => {+ const key = `${format.sampleRate}:${format.channels}`;+ if (seen.has(key)) return false;+ seen.add(key);+ return true;+ })+ .sort((a, b) => b.sampleRate - a.sampleRate || b.channels - a.channels);+ });++ const defaultSetting = createMemo<MicrophoneDeviceSettings | undefined>(+ () => {+ if (props.mic.sampleRate && props.mic.channels) {+ return {+ sampleRate: props.mic.sampleRate,+ channels: props.mic.channels,+ };+ }+ const first = formats()[0];+ if (!first) return undefined;+ return { sampleRate: first.sampleRate, channels: first.channels };+ },+ );++ const isDefaultSelected = () => {+ const value = props.value;+ return (+ !value || (value.sampleRate === undefined && value.channels === undefined)+ );+ };++ const isSelected = (format: MicrophoneDeviceSettings) =>+ props.value?.sampleRate === format.sampleRate &&+ props.value?.channels === format.channels;++ return (+ <div class="flex flex-col gap-3">+ <div class="flex items-center gap-2 px-1">+ <button+ type="button"+ onClick={props.onBack}+ class="flex items-center justify-center size-7 rounded-md text-gray-11 hover:text-gray-12 hover:bg-gray-4"+ aria-label="Back"+ >+ <IconLucideArrowLeft class="size-4" />+ </button>+ <IconLucideSettings class="size-4 text-gray-11 shrink-0" />+ <div class="min-w-0 flex-1">+ <div class="text-sm font-medium text-gray-12 truncate">+ {props.mic.name}+ </div>+ <div class="text-[11px] text-gray-10">Microphone settings</div>+ </div>+ </div>+ <div class="flex flex-col gap-1">+ <button+ type="button"+ onClick={() => props.onChange({})}+ class={cx(+ "flex items-center gap-3 px-3 py-2.5 rounded-lg text-left text-sm outline-none",+ isDefaultSelected()+ ? "bg-blue-500 text-white"+ : "text-gray-12 hover:bg-gray-4",+ )}+ >+ <div class="flex-1 min-w-0">+ <div class="truncate">Default</div>+ <Show when={defaultSetting()}>+ {(setting) => (+ <div+ class={cx(+ "text-[11px] truncate",+ isDefaultSelected() ? "text-white/70" : "text-gray-10",+ )}+ >+ {formatMicrophoneSetting(setting())}+ </div>+ )}+ </Show>+ </div>+ <Show when={isDefaultSelected()}>+ <IconLucideCheck class="size-4 shrink-0" />+ </Show>+ </button>+ <Show when={formats().length > 0}>+ <For each={formats()}>+ {(format) => {+ const setting = () => ({+ sampleRate: format.sampleRate,+ channels: format.channels,+ });+ const high = () => isHighMicrophoneSetting(setting());+ return (+ <button+ type="button"+ onClick={() => props.onChange(setting())}+ class={cx(+ "flex items-center gap-3 px-3 py-2.5 rounded-lg text-left text-sm outline-none",+ isSelected(setting())+ ? "bg-blue-500 text-white"+ : "text-gray-12 hover:bg-gray-4",+ )}+ >+ <div class="flex-1 min-w-0">+ <div class="truncate">+ {formatMicrophoneSetting(setting())}+ </div>+ <Show when={props.compatibilityStudioMode && high()}>+ <div+ class={cx(+ "text-[11px]",+ isSelected(setting())+ ? "text-white/70"+ : "text-amber-11",+ )}+ >+ Compatibility mode may reduce this setting.+ </div>+ </Show>+ </div>+ <Show when={isSelected(setting())}>+ <IconLucideCheck class="size-4 shrink-0" />+ </Show>+ </button>+ );+ }}+ </For>+ </Show>+ </div>+ </div>);}@@@ -1091,7 -1654,7 +1654,7 @@@ function Page()await commands.uploadExportedVideo(path,"Reupload",-- new Channel<UploadProgress>(() => {}),++ new Channel<UploadProgress>(() => { }),null,);} finally {@@@ -1516,8 -2095,8 +2095,7 @@@await commands.stopRecording();} catch (error) {await dialog.message(-- `Failed to stop recording: ${-- error instanceof Error ? error.message : String(error)++ `Failed to stop recording: ${error instanceof Error ? error.message : String(error)}`,{ title: "Stop Recording", kind: "error" },);@@@ -1585,7 -2188,7 +2187,7 @@@class={cx("flex flex-1 overflow-hidden rounded-lg border border-gray-5 bg-gray-3 ring-1 ring-transparent ring-offset-2 ring-offset-gray-1 transition focus-within:ring-blue-9 focus-within:ring-offset-2 focus-within:ring-offset-gray-1",(rawOptions.targetMode === "display" || displayMenuOpen()) &&-- "ring-blue-9",++ "ring-blue-9",)}><TargetTypeButton@@@ -1626,7 -2230,7 +2229,7 @@@class={cx("flex flex-1 overflow-hidden rounded-lg border border-gray-5 bg-gray-3 ring-1 ring-transparent ring-offset-2 ring-offset-gray-1 transition focus-within:ring-blue-9 focus-within:ring-offset-2 focus-within:ring-offset-gray-1",(rawOptions.targetMode === "window" || windowMenuOpen()) &&-- "ring-blue-9",++ "ring-blue-9",)}><TargetTypeButton@@@ -1701,7 -2306,7 +2305,7 @@@}}-- await signIn.mutateAsync(abort).catch(() => {});++ await signIn.mutateAsync(abort).catch(() => { });for (const win of await getAllWebviewWindows()) {if (win.label.startsWith("target-select-overlay")) {@@@ -1732,9 -2337,9 +2336,9 @@@await commands.showWindow({ Settings: { page: "general" } });getCurrentWindow().hide();}}- class="flex items-center justify-center size-5 -ml-[1.5px] focus:outline-hidden"- class="flex items-center justify-center size-5 focus:outline-none"++ class="flex items-center justify-center size-5 focus:outline-hidden">- <IconCapSettings class="transition-colors text-gray-11 size-4 hover:text-gray-12" />+ <IconLucideSettings class="transition-colors text-gray-11 size-4 hover:text-gray-12" /></button></Tooltip><Tooltip content={<span>Screenshots</span>}>