Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

format

Ilya542216f4eece
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
index 61496f6e1..7cc3878e7 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
@@ -182,7 +182,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
const scrollToSection = (section: string) => {
try {
localStorage.removeItem("cap.settings.scrollToSection");
- } catch { }
+ } catch {}
const attempt = (remaining: number) => {
const target = document.getElementById(`settings-section-${section}`);
const container = scrollContainerRef;
@@ -209,7 +209,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
let pending: string | null = null;
try {
pending = localStorage.getItem("cap.settings.scrollToSection");
- } catch { }
+ } catch {}
if (pending) {
scrollToSection(pending);
}
@@ -218,7 +218,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
scrollToSection(event.payload.section);
});
onCleanup(() => {
- unlisten.then((cb) => cb()).catch(() => { });
+ unlisten.then((cb) => cb()).catch(() => {});
});
});
@@ -349,11 +349,11 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
// Helper function to render select dropdown for recording behaviors
const SelectSettingItem = <
T extends
- | MainWindowRecordingStartBehaviour
- | PostStudioRecordingBehaviour
- | PostDeletionBehaviour
- | StudioRecordingQuality
- | number,
+ | MainWindowRecordingStartBehaviour
+ | PostStudioRecordingBehaviour
+ | PostDeletionBehaviour
+ | StudioRecordingQuality
+ | number,
>(props: {
label: string;
description: string;
diff --git a/apps/desktop/src/routes/camera.tsx b/apps/desktop/src/routes/camera.tsx
index e09082cea..cbff80637 100644
--- a/apps/desktop/src/routes/camera.tsx
+++ b/apps/desktop/src/routes/camera.tsx
@@ -213,11 +213,11 @@ function NativeCameraPreviewPage(props: { disconnected: Accessor<boolean> }) {
isCameraOnlyMode()
? getCameraOnlyInitialState()
: {
- size: CAMERA_DEFAULT_SIZE,
- shape: "round",
- mirrored: false,
- backgroundBlur: "off" as BackgroundBlurMode,
- },
+ size: CAMERA_DEFAULT_SIZE,
+ shape: "round",
+ mirrored: false,
+ backgroundBlur: "off" as BackgroundBlurMode,
+ },
),
{ name: "cameraWindowState" },
);
@@ -246,7 +246,7 @@ function NativeCameraPreviewPage(props: { disconnected: Accessor<boolean> }) {
const handleVisibilityChange = () => {
if (!document.hidden) {
setTimeout(() => {
- commands.refreshCameraFeed().catch(() => { });
+ commands.refreshCameraFeed().catch(() => {});
}, 500);
}
};
@@ -570,11 +570,11 @@ function LegacyCameraPreviewPage(props: { disconnected: Accessor<boolean> }) {
isCameraOnlyMode()
? getCameraOnlyInitialState()
: {
- size: CAMERA_DEFAULT_SIZE,
- shape: "round",
- mirrored: false,
- backgroundBlur: "off" as BackgroundBlurMode,
- },
+ size: CAMERA_DEFAULT_SIZE,
+ shape: "round",
+ mirrored: false,
+ backgroundBlur: "off" as BackgroundBlurMode,
+ },
),
{ name: "cameraWindowState" },
);
@@ -757,7 +757,7 @@ function LegacyCameraPreviewPage(props: { disconnected: Accessor<boolean> }) {
setIsWindowVisible(!document.hidden);
if (!document.hidden) {
lastFrameTime = Date.now();
- commands.refreshCameraFeed().catch(() => { });
+ commands.refreshCameraFeed().catch(() => {});
}
};
document.addEventListener("visibilitychange", handleVisibilityChange);
@@ -896,7 +896,7 @@ function LegacyCameraPreviewPage(props: { disconnected: Accessor<boolean> }) {
Date.now() - lastFrameTime > STALL_TIMEOUT_MS
) {
lastFrameTime = Date.now();
- commands.refreshCameraFeed().catch(() => { });
+ commands.refreshCameraFeed().catch(() => {});
if (ws) ws.close();
ws = createSocket();
}
diff --git a/apps/desktop/src/routes/editor/CaptionsTab.tsx b/apps/desktop/src/routes/editor/CaptionsTab.tsx
index de40d6acd..73d88b786 100644
--- a/apps/desktop/src/routes/editor/CaptionsTab.tsx
+++ b/apps/desktop/src/routes/editor/CaptionsTab.tsx
@@ -138,7 +138,7 @@ export function CaptionsTab() {
const selectedCaptionIndex = () =>
editorState.timeline.selection?.type === "caption" &&
- editorState.timeline.selection.indices.length === 1
+ editorState.timeline.selection.indices.length === 1
? editorState.timeline.selection.indices[0]
: -1;
diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
index eab539341..c8780f55d 100644
--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx
+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
@@ -305,11 +305,11 @@ const findCursorPreset = (
(option) =>
option.preset &&
Math.abs(option.preset.tension - values.tension) <=
- CURSOR_PRESET_TOLERANCE.tension &&
+ CURSOR_PRESET_TOLERANCE.tension &&
Math.abs(option.preset.mass - values.mass) <=
- CURSOR_PRESET_TOLERANCE.mass &&
+ CURSOR_PRESET_TOLERANCE.mass &&
Math.abs(option.preset.friction - values.friction) <=
- CURSOR_PRESET_TOLERANCE.friction,
+ CURSOR_PRESET_TOLERANCE.friction,
);
return preset?.value ?? null;
@@ -450,7 +450,7 @@ export function ConfigSidebar() {
class={cx(
"flex justify-center relative border-transparent border z-10 items-center rounded-md size-9 transition will-change-transform",
state.selectedTab !== item.id &&
- "group-hover:border-gray-300 group-disabled:border-none",
+ "group-hover:border-gray-300 group-disabled:border-none",
)}
>
<Dynamic component={item.icon} />
@@ -1737,13 +1737,17 @@ function BackgroundConfig(props: { scrollRef: HTMLDivElement }) {
ref={setBackgroundRef}
class="flex overflow-x-auto overscroll-contain relative z-10 flex-row gap-2 items-center mb-3 text-xs hide-scroll"
style={{
- "-webkit-mask-image": `linear-gradient(to right, transparent, black ${scrollX() > 0 ? "24px" : "0"
- }, black calc(100% - ${reachedEndOfScroll() ? "0px" : "24px"
- }), transparent)`,
-
- "mask-image": `linear-gradient(to right, transparent, black ${scrollX() > 0 ? "24px" : "0"
- }, black calc(100% - ${reachedEndOfScroll() ? "0px" : "24px"
- }), transparent);`,
+ "-webkit-mask-image": `linear-gradient(to right, transparent, black ${
+ scrollX() > 0 ? "24px" : "0"
+ }, black calc(100% - ${
+ reachedEndOfScroll() ? "0px" : "24px"
+ }), transparent)`,
+
+ "mask-image": `linear-gradient(to right, transparent, black ${
+ scrollX() > 0 ? "24px" : "0"
+ }, black calc(100% - ${
+ reachedEndOfScroll() ? "0px" : "24px"
+ }), transparent);`,
}}
>
<For each={Object.entries(BACKGROUND_THEMES)}>
@@ -1770,10 +1774,10 @@ function BackgroundConfig(props: { scrollRef: HTMLDivElement }) {
value={
project.background.source.type === "wallpaper"
? (wallpapers()?.find((w) =>
- (
- project.background.source as { path?: string }
- ).path?.includes(w.id),
- )?.url ?? undefined)
+ (
+ project.background.source as { path?: string }
+ ).path?.includes(w.id),
+ )?.url ?? undefined)
: undefined
}
onChange={(photoUrl) => {
@@ -3281,7 +3285,8 @@ function ZoomSegmentPreview(props: {
createEffect(() => {
// TODO: make this not hardcoded
const path = convertFileSrc(
- `${editorInstance.path}/content/segments/segment-${clipSegment()?.recordingSegment ?? 0
+ `${editorInstance.path}/content/segments/segment-${
+ clipSegment()?.recordingSegment ?? 0
}/display.mp4`,
);
video.src = path;
@@ -3484,7 +3489,8 @@ function ZoomSegmentConfig(props: {
createEffect(() => {
const path = convertFileSrc(
// TODO: this shouldn't be so hardcoded
- `${editorInstance.path
+ `${
+ editorInstance.path
}/content/segments/segment-${segmentIndex()}/display.mp4`,
);
video.src = path;
@@ -3614,7 +3620,7 @@ function ZoomSegmentConfig(props: {
x: Math.max(
Math.min(
(moveEvent.clientX - bounds.left) /
- bounds.width,
+ bounds.width,
1,
),
0,
@@ -3622,7 +3628,7 @@ function ZoomSegmentConfig(props: {
y: Math.max(
Math.min(
(moveEvent.clientY - bounds.top) /
- bounds.height,
+ bounds.height,
1,
),
0,
diff --git a/apps/desktop/src/routes/in-progress-recording.tsx b/apps/desktop/src/routes/in-progress-recording.tsx
index 1ac98309c..296287763 100644
--- a/apps/desktop/src/routes/in-progress-recording.tsx
+++ b/apps/desktop/src/routes/in-progress-recording.tsx
@@ -75,10 +75,10 @@ function InProgressRecordingInner() {
window.COUNTDOWN === 0
? { variant: "initializing" }
: {
- variant: "countdown",
- from: window.COUNTDOWN,
- current: window.COUNTDOWN,
- },
+ variant: "countdown",
+ from: window.COUNTDOWN,
+ current: window.COUNTDOWN,
+ },
);
const [start, setStart] = createSignal(Date.now());
const [time, setTime] = createSignal(Date.now());
@@ -163,9 +163,9 @@ function InProgressRecordingInner() {
const [pauseResumes, setPauseResumes] = createStore<
| []
| [
- ...Array<{ pause: number; resume?: number }>,
- { pause: number; resume?: number },
- ]
+ ...Array<{ pause: number; resume?: number }>,
+ { pause: number; resume?: number },
+ ]
>([]);
createEffect(() => {
@@ -777,8 +777,9 @@ function InProgressRecordingInner() {
<div
class="absolute inset-0 bg-blue-9 transition-transform duration-100"
style={{
- transform: `translateX(-${(1 - audioLevel()) * 100
- }%)`,
+ transform: `translateX(-${
+ (1 - audioLevel()) * 100
+ }%)`,
}}
/>
</div>
@@ -829,7 +830,7 @@ function InProgressRecordingInner() {
class={cx(
"text-red-10 hover:bg-red-3/40",
issuePanelVisible() &&
- "bg-red-3/40 ring-1 ring-red-8",
+ "bg-red-3/40 ring-1 ring-red-8",
)}
onClick={() => toggleIssuePanel()}
title={issueMessages().join(", ")}
diff --git a/apps/desktop/src/routes/screenshot-editor/Editor.tsx b/apps/desktop/src/routes/screenshot-editor/Editor.tsx
index d5c4b36b4..dcf15b801 100644
--- a/apps/desktop/src/routes/screenshot-editor/Editor.tsx
+++ b/apps/desktop/src/routes/screenshot-editor/Editor.tsx
@@ -120,9 +120,7 @@ export function Editor() {
setLayersPanelOpen(!layersPanelOpen());
break;
case "h":
- setActivePopover(
- activePopover() === "shadow" ? null : "shadow",
- );
+ setActivePopover(activePopover() === "shadow" ? null : "shadow");
break;
case "e":
setActivePopover(activePopover() === "border" ? null : "border");
@@ -223,17 +221,17 @@ function Dialogs() {
const existingCrop = cropDialog().currentCrop;
const initialBounds = existingCrop
? {
- x: existingCrop.position.x,
- y: existingCrop.position.y,
- width: existingCrop.size.x,
- height: existingCrop.size.y,
- }
+ x: existingCrop.position.x,
+ y: existingCrop.position.y,
+ width: existingCrop.size.x,
+ height: existingCrop.size.y,
+ }
: {
- x: 0,
- y: 0,
- width: originalSize.x,
- height: originalSize.y,
- };
+ x: 0,
+ y: 0,
+ width: originalSize.x,
+ height: originalSize.y,
+ };
const previewSize = () => {
const srcW = originalSize.x;
diff --git a/apps/desktop/src/routes/screenshot-editor/Preview.tsx b/apps/desktop/src/routes/screenshot-editor/Preview.tsx
index 4527786d8..f856a3eb8 100644
--- a/apps/desktop/src/routes/screenshot-editor/Preview.tsx
+++ b/apps/desktop/src/routes/screenshot-editor/Preview.tsx
@@ -228,13 +228,13 @@ export function Preview(props: { zoom: number; setZoom: (z: number) => void }) {
(pointerX -
(sizeData.width - sizeData.width * props.zoom) / 2 -
currentPan.x) /
- currentScale;
+ currentScale;
const contentY =
boundsData.y +
(pointerY -
(sizeData.height - sizeData.height * props.zoom) / 2 -
currentPan.y) /
- currentScale;
+ currentScale;
setPan({
x:
diff --git a/apps/desktop/src/routes/screenshot-editor/context.tsx b/apps/desktop/src/routes/screenshot-editor/context.tsx
index bc3934957..f3dc0e13b 100644
--- a/apps/desktop/src/routes/screenshot-editor/context.tsx
+++ b/apps/desktop/src/routes/screenshot-editor/context.tsx
@@ -88,10 +88,10 @@ export type CurrentDialog =
| { type: "renamePreset"; presetIndex: number }
| { type: "deletePreset"; presetIndex: number }
| {
- type: "crop";
- originalSize: XY<number>;
- currentCrop: { position: XY<number>; size: XY<number> } | null;
- };
+ type: "crop";
+ originalSize: XY<number>;
+ currentCrop: { position: XY<number>; size: XY<number> } | null;
+ };
export type DialogState = { open: false } | ({ open: boolean } & CurrentDialog);
@@ -348,7 +348,7 @@ function createScreenshotEditorContext() {
existing.bitmap.close();
}
setLatestFrame({ width, height, bitmap, revision });
- } catch { }
+ } catch {}
};
return instance;
diff --git a/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx
index 4362da7f2..bcfc85538 100644
--- a/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx
+++ b/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx
@@ -321,10 +321,10 @@ export function BackgroundSettingsPopover() {
value={
project.background.source.type === "wallpaper"
? (wallpapers()?.find((w) =>
- (
- project.background.source as { path?: string }
- ).path?.includes(w.id),
- )?.url ?? undefined)
+ (
+ project.background.source as { path?: string }
+ ).path?.includes(w.id),
+ )?.url ?? undefined)
: undefined
}
onChange={(photoUrl) => {