Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat: Screenshot editor styling/layout + Mask annotation
Richie McIlroyb4c8a17bfdbc
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex b3ef2aa2b..d48ec03f9 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -2440,6 +2440,7 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {]).map_label(|label| match label {label if label.starts_with("editor-") => "editor",+ label if label.starts_with("screenshot-editor-") => "screenshot-editor",label if label.starts_with("window-capture-occluder-") => {"window-capture-occluder"}@@ -2814,6 +2815,7 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {tauri::RunEvent::Reopen { .. } => {let has_window = _handle.webview_windows().iter().any(|(label, _)| {label.starts_with("editor-")+ || label.starts_with("screenshot-editor-")|| label.as_str() == "settings"|| label.as_str() == "signin"});@@ -2824,6 +2826,7 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {.iter().find(|(label, _)| {label.starts_with("editor-")+ || label.starts_with("screenshot-editor-")|| label.as_str() == "settings"|| label.as_str() == "signin"})diff --git a/apps/desktop/src/components/Mode.tsx b/apps/desktop/src/components/Mode.tsxindex 7fa7e524b..7950c6fd3 100644--- a/apps/desktop/src/components/Mode.tsx+++ b/apps/desktop/src/components/Mode.tsx@@ -81,7 +81,7 @@ const Mode = () => {: "bg-gray-3 hover:bg-gray-7"}`}>- <IconCapImageFilled class="size-[19px] invert dark:invert-0" />+ <IconCapImageFilled class="size-3.5 invert dark:invert-0" /></div></Tooltip>)}@@ -124,7 +124,7 @@ const Mode = () => {: "bg-gray-3 hover:bg-gray-7"}`}>- <IconCapImageFilled class="size-[19px] invert dark:invert-0" />+ <IconCapImageFilled class="size-3.5 invert dark:invert-0" /></div></>)}diff --git a/apps/desktop/src/components/Tooltip.tsx b/apps/desktop/src/components/Tooltip.tsxindex c208e7598..606dcc3b4 100644--- a/apps/desktop/src/components/Tooltip.tsx+++ b/apps/desktop/src/components/Tooltip.tsx@@ -1,9 +1,9 @@-import { Tooltip as KTooltip } from "@kobalte/core";+import { Tooltip as KTooltip } from "@kobalte/core/tooltip";import { type as ostype } from "@tauri-apps/plugin-os";import { cx } from "cva";import type { ComponentProps, JSX } from "solid-js";-interface Props extends ComponentProps<typeof KTooltip.Root> {+interface Props extends ComponentProps<typeof KTooltip> {content?: JSX.Element;childClass?: string;kbd?: string[];@@ -23,8 +23,8 @@ const kbdSymbolModifier = (key: string, os: Os) => {export default function Tooltip(props: Props) {const os = ostype();return (- <KTooltip.Root {...props} openDelay={props.openDelay ?? 200}>- <KTooltip.Trigger class={cx(props.childClass)}>+ <KTooltip {...props} openDelay={props.openDelay ?? 200}>+ <KTooltip.Trigger class={cx(props.childClass)} as="div">{props.children}</KTooltip.Trigger><KTooltip.Portal>@@ -42,6 +42,6 @@ export default function Tooltip(props: Props) {<KTooltip.Arrow size={16} /></KTooltip.Content></KTooltip.Portal>- </KTooltip.Root>+ </KTooltip>);}diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/ChangeLogButton.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/ChangeLogButton.tsxindex 755e749c5..132b271d4 100644--- a/apps/desktop/src/routes/(window-chrome)/new-main/ChangeLogButton.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/ChangeLogButton.tsx@@ -6,6 +6,7 @@ import { createStore } from "solid-js/store";import Tooltip from "~/components/Tooltip";import { commands } from "~/utils/tauri";import { apiClient } from "~/utils/web-api";+import IconLucideBell from "~icons/lucide/bell";const ChangelogButton = () => {const [changelogState, setChangelogState] = makePersisted(diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/TargetMenuGrid.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/TargetMenuGrid.tsxindex 37dc79d35..2531ba96d 100644--- a/apps/desktop/src/routes/(window-chrome)/new-main/TargetMenuGrid.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/TargetMenuGrid.tsx@@ -155,7 +155,6 @@ export default function TargetMenuGrid(props: TargetMenuGridProps) {enterToClass="scale-100 opacity-100"exitActiveClass="transition duration-200"exitClass="scale-100"- exitToClass="scale-100"exitToClass="scale-95"><divdiff --git a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsxindex 455a723e0..eef73ecab 100644--- a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx@@ -58,10 +58,15 @@ import {type RecordingTargetMode,type ScreenCaptureTarget,} from "~/utils/tauri";+import IconCapLogoFull from "~icons/cap/logo-full";+import IconCapLogoFullDark from "~icons/cap/logo-full-dark";+import IconCapSettings from "~icons/cap/settings";import IconLucideAppWindowMac from "~icons/lucide/app-window-mac";import IconLucideArrowLeft from "~icons/lucide/arrow-left";+import IconLucideBug from "~icons/lucide/bug";import IconLucideImage from "~icons/lucide/image";import IconLucideSearch from "~icons/lucide/search";+import IconLucideSquarePlay from "~icons/lucide/square-play";import IconMaterialSymbolsScreenshotFrame2Rounded from "~icons/material-symbols/screenshot-frame-2-rounded";import IconMdiMonitor from "~icons/mdi/monitor";import { WindowChromeHeader } from "../Context";diff --git a/apps/desktop/src/routes/screenshot-editor/AnnotationConfig.tsx b/apps/desktop/src/routes/screenshot-editor/AnnotationConfig.tsxnew file mode 100644index 000000000..754914fce--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/AnnotationConfig.tsx@@ -0,0 +1,260 @@+import { Popover } from "@kobalte/core/popover";+import { createMemo, For, Show } from "solid-js";+import { Portal } from "solid-js/web";+import { BACKGROUND_COLORS, hexToRgb, RgbInput, rgbToHex } from "./ColorPicker";+import { type Annotation, useScreenshotEditorContext } from "./context";+import { Slider } from "./ui";++export function AnnotationConfig() {+ const {+ annotations,+ selectedAnnotationId,+ setAnnotations,+ projectHistory,+ setSelectedAnnotationId,+ } = useScreenshotEditorContext();++ const selected = createMemo(() =>+ annotations.find((a) => a.id === selectedAnnotationId()),+ );++ const update = <K extends keyof Annotation>(+ field: K,+ value: Annotation[K],+ ) => {+ projectHistory.push();+ setAnnotations((a) => a.id === selectedAnnotationId(), field, value);+ };++ return (+ <Show when={selected()}>+ {(ann) => {+ const type = ann().type;+ const maskType = () => ann().maskType ?? "blur";+ const maskLevel = () => ann().maskLevel ?? 16;+ return (+ <Portal>+ <div class="fixed left-1/2 -translate-x-1/2 top-20 z-[100] flex items-center gap-3 p-2 rounded-xl border border-gray-3 bg-gray-1/90 backdrop-blur-md shadow-xl animate-in fade-in slide-in-from-top-2">+ <Show when={type !== "mask"}>+ <div class="flex flex-col gap-1">+ <span class="text-[10px] text-gray-11 font-medium uppercase tracking-wider">+ {type === "text" ? "Color" : "Stroke"}+ </span>+ <ColorPickerButton+ value={ann().strokeColor}+ onChange={(c) => update("strokeColor", c)}+ />+ </div>+ </Show>++ <Show when={type !== "text" && type !== "mask"}>+ <div class="flex flex-col gap-1 w-24">+ <span class="text-[10px] text-gray-11 font-medium uppercase tracking-wider flex justify-between">+ Width <span>{ann().strokeWidth}px</span>+ </span>+ <Slider+ value={[ann().strokeWidth]}+ onChange={(v) => update("strokeWidth", v[0])}+ minValue={1}+ maxValue={20}+ step={1}+ class="w-full"+ />+ </div>+ </Show>++ <Show when={type === "rectangle" || type === "circle"}>+ <div class="flex flex-col gap-1">+ <span class="text-[10px] text-gray-11 font-medium uppercase tracking-wider">+ Fill+ </span>+ <ColorPickerButton+ value={ann().fillColor}+ onChange={(c) => update("fillColor", c)}+ allowTransparent+ />+ </div>+ </Show>++ <Show when={type !== "mask"}>+ <div class="flex flex-col gap-1 w-24">+ <span class="text-[10px] text-gray-11 font-medium uppercase tracking-wider flex justify-between">+ Opacity <span>{Math.round(ann().opacity * 100)}%</span>+ </span>+ <Slider+ value={[ann().opacity]}+ onChange={(v) => update("opacity", v[0])}+ minValue={0.1}+ maxValue={1}+ step={0.1}+ class="w-full"+ />+ </div>+ </Show>++ <Show when={type === "mask"}>+ <div class="flex flex-col gap-1">+ <span class="text-[10px] text-gray-11 font-medium uppercase tracking-wider">+ Style+ </span>+ <div class="flex gap-1">+ <button+ type="button"+ class={`px-3 h-8 rounded-lg border ${+ maskType() === "blur"+ ? "border-blue-7 bg-blue-3 text-blue-11"+ : "border-gray-4 bg-gray-2 text-gray-11"+ }`}+ onClick={() => update("maskType", "blur")}+ >+ Blur+ </button>+ <button+ type="button"+ class={`px-3 h-8 rounded-lg border ${+ maskType() === "pixelate"+ ? "border-blue-7 bg-blue-3 text-blue-11"+ : "border-gray-4 bg-gray-2 text-gray-11"+ }`}+ onClick={() => update("maskType", "pixelate")}+ >+ Pixelate+ </button>+ </div>+ </div>+ </Show>++ <Show when={type === "mask"}>+ <div class="flex flex-col gap-1 w-28">+ <span class="text-[10px] text-gray-11 font-medium uppercase tracking-wider flex justify-between">+ Intensity <span>{Math.round(maskLevel())}</span>+ </span>+ <Slider+ value={[maskLevel()]}+ onChange={(v) => update("maskLevel", v[0])}+ minValue={4}+ maxValue={50}+ step={1}+ class="w-full"+ />+ </div>+ </Show>++ {/* Font Size for Text */}+ <Show when={type === "text"}>+ <div class="flex flex-col gap-1 w-24">+ <span class="text-[10px] text-gray-11 font-medium uppercase tracking-wider flex justify-between">+ Size <span>{ann().height}px</span>+ </span>+ <Slider+ value={[ann().height]}+ onChange={(v) => update("height", v[0])}+ minValue={12}+ maxValue={100}+ step={1}+ class="w-full"+ />+ </div>+ </Show>++ <div class="w-px h-8 bg-gray-4 mx-1" />++ <button+ type="button"+ class="text-xs text-blue-11 font-medium hover:text-blue-9 px-2 h-full"+ onClick={() => setSelectedAnnotationId(null)}+ >+ Done+ </button>+ </div>+ </Portal>+ );+ }}+ </Show>+ );+}++function ColorPickerButton(props: {+ value: string;+ onChange: (value: string) => void;+ allowTransparent?: boolean;+}) {+ // Helper to handle RGB <-> Hex+ const rgbValue = createMemo(() => {+ if (props.value === "transparent")+ return [0, 0, 0] as [number, number, number];+ const rgb = hexToRgb(props.value);+ if (!rgb) return [0, 0, 0] as [number, number, number];+ return [rgb[0], rgb[1], rgb[2]] as [number, number, number];+ });++ const isTransparent = createMemo(() => props.value === "transparent");++ return (+ <Popover placement="bottom">+ <Popover.Trigger class="outline-none group">+ <div class="size-6 rounded-full border border-gray-4 p-0.5 bg-white dark:bg-gray-2 transition-transform group-hover:scale-105 group-active:scale-95 shadow-sm">+ <div+ class="w-full h-full rounded-full border border-black/5"+ style={{+ background: isTransparent()+ ? "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)"+ : props.value,+ "background-size": isTransparent() ? "4px 4px" : "auto",+ "background-color": isTransparent() ? "white" : props.value,+ }}+ />+ </div>+ </Popover.Trigger>+ <Popover.Portal>+ <Popover.Content class="z-[200] w-[240px] overflow-hidden rounded-xl border border-gray-3 bg-gray-1 shadow-xl animate-in fade-in zoom-in-95 p-3">+ <div class="flex flex-col gap-3">+ <RgbInput+ value={rgbValue()}+ onChange={(rgb) => {+ props.onChange(rgbToHex(rgb));+ }}+ />++ <div class="grid grid-cols-6 gap-2">+ <Show when={props.allowTransparent}>+ <button+ type="button"+ title="Transparent"+ onClick={() => props.onChange("transparent")}+ class="size-6 rounded-full border border-gray-3 relative overflow-hidden hover:scale-110 transition-transform"+ style={{+ background:+ "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",+ "background-size": "4px 4px",+ "background-color": "white",+ }}+ >+ <Show when={isTransparent()}>+ <div class="absolute inset-0 ring-2 ring-blue-9 rounded-full" />+ </Show>+ </button>+ </Show>+ <For each={BACKGROUND_COLORS.filter((c) => c !== "#00000000")}>+ {(color) => (+ <button+ type="button"+ class="size-6 rounded-full border border-black/10 hover:scale-110 transition-transform relative"+ style={{ "background-color": color }}+ onClick={() => props.onChange(color)}+ >+ <Show+ when={props.value.toLowerCase() === color.toLowerCase()}+ >+ <div class="absolute inset-0 ring-2 ring-white/50 rounded-full shadow-sm" />+ </Show>+ </button>+ )}+ </For>+ </div>+ </div>+ </Popover.Content>+ </Popover.Portal>+ </Popover>+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/AnnotationLayer.tsx b/apps/desktop/src/routes/screenshot-editor/AnnotationLayer.tsxnew file mode 100644index 000000000..caf799c7d--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/AnnotationLayer.tsx@@ -0,0 +1,658 @@+import { cx } from "cva";+import {+ createEffect,+ createMemo,+ createSignal,+ For,+ onCleanup,+ Show,+} from "solid-js";+import { unwrap } from "solid-js/store";+import {+ type Annotation,+ type AnnotationType,+ type ScreenshotProject,+ useScreenshotEditorContext,+} from "./context";++export function AnnotationLayer(props: {+ bounds: { x: number; y: number; width: number; height: number };+ cssWidth: number;+ cssHeight: number;+}) {+ const {+ project,+ annotations,+ setAnnotations,+ activeTool,+ setActiveTool,+ selectedAnnotationId,+ setSelectedAnnotationId,+ projectHistory,+ } = useScreenshotEditorContext();++ const [isDrawing, setIsDrawing] = createSignal(false);+ const [dragState, setDragState] = createSignal<{+ id: string;+ action: "move" | "resize";+ handle?: string;+ startX: number;+ startY: number;+ original: Annotation;+ } | null>(null);++ // History snapshots+ let dragSnapshot: {+ project: ScreenshotProject;+ annotations: Annotation[];+ } | null = null;+ let drawSnapshot: {+ project: ScreenshotProject;+ annotations: Annotation[];+ } | null = null;+ let textSnapshot: {+ project: ScreenshotProject;+ annotations: Annotation[];+ } | null = null;++ const [textEditingId, setTextEditingId] = createSignal<string | null>(null);++ // Temporary annotation being drawn+ const [tempAnnotation, setTempAnnotation] = createSignal<Annotation | null>(+ null,+ );++ // Delete key handler+ createEffect(() => {+ const handleKeyDown = (e: KeyboardEvent) => {+ if (textEditingId()) return;+ if (e.key === "Backspace" || e.key === "Delete") {+ const id = selectedAnnotationId();+ if (id) {+ projectHistory.push(); // Save current state before delete+ setAnnotations((prev) => prev.filter((a) => a.id !== id));+ setSelectedAnnotationId(null);+ }+ }+ };+ window.addEventListener("keydown", handleKeyDown);+ onCleanup(() => window.removeEventListener("keydown", handleKeyDown));+ });++ // Helper to get coordinates in SVG space+ const getSvgPoint = (+ e: MouseEvent,+ svg: SVGSVGElement,+ ): { x: number; y: number } => {+ const rect = svg.getBoundingClientRect();+ const x = e.clientX - rect.left;+ const y = e.clientY - rect.top;+ // Scale to viewBox+ return {+ x: props.bounds.x + (x / rect.width) * props.bounds.width,+ y: props.bounds.y + (y / rect.height) * props.bounds.height,+ };+ };++ const handleMouseDown = (e: MouseEvent) => {+ // If editing text, click outside commits change (handled by blur on input usually, but safety here)+ if (textEditingId()) {+ // If clicking inside the text editor, don't stop+ if ((e.target as HTMLElement).closest(".text-editor")) return;+ setTextEditingId(null);+ }++ if (activeTool() === "select") {+ if (e.target === e.currentTarget) {+ setSelectedAnnotationId(null);+ }+ return;+ }++ // Snapshot for drawing+ drawSnapshot = {+ project: structuredClone(unwrap(project)),+ annotations: structuredClone(unwrap(annotations)),+ };++ const svg = e.currentTarget as SVGSVGElement;+ const point = getSvgPoint(e, svg);++ setIsDrawing(true);+ const id = crypto.randomUUID();+ const newAnn: Annotation = {+ id,+ type: activeTool() as AnnotationType,+ x: point.x,+ y: point.y,+ width: 0,+ height: 0,+ strokeColor: "#F05656", // Red default+ strokeWidth: 4,+ fillColor: "transparent",+ opacity: 1,+ rotation: 0,+ text: activeTool() === "text" ? "Text" : null,+ maskType: activeTool() === "mask" ? "blur" : null,+ maskLevel: activeTool() === "mask" ? 16 : null,+ };++ if (activeTool() === "text") {+ newAnn.height = 40; // Default font size+ newAnn.width = 150; // Default width+ }++ setTempAnnotation(newAnn);+ };++ const handleMouseMove = (e: MouseEvent) => {+ const svg = e.currentTarget as SVGSVGElement;+ const point = getSvgPoint(e, svg);++ if (isDrawing() && tempAnnotation()) {+ const temp = tempAnnotation()!;+ // Update temp annotation dimensions+ if (temp.type === "text") return;++ let width = point.x - temp.x;+ let height = point.y - temp.y;++ // Shift key for aspect ratio constraint+ if (e.shiftKey) {+ if (+ temp.type === "rectangle" ||+ temp.type === "circle" ||+ temp.type === "mask"+ ) {+ const size = Math.max(Math.abs(width), Math.abs(height));+ width = width < 0 ? -size : size;+ height = height < 0 ? -size : size;+ } else if (temp.type === "arrow") {+ // Snap to 45 degree increments+ const angle = Math.atan2(height, width);+ const snap = Math.round(angle / (Math.PI / 4)) * (Math.PI / 4);+ const dist = Math.sqrt(width * width + height * height);+ width = Math.cos(snap) * dist;+ height = Math.sin(snap) * dist;+ }+ }++ setTempAnnotation({+ ...temp,+ width,+ height,+ });+ return;+ }++ if (dragState()) {+ const state = dragState()!;+ const dx = point.x - state.startX;+ const dy = point.y - state.startY;++ if (state.action === "move") {+ setAnnotations(+ (a) => a.id === state.id,+ (a) => ({+ ...a,+ x: state.original.x + dx,+ y: state.original.y + dy,+ }),+ );+ } else if (state.action === "resize" && state.handle) {+ const original = state.original;+ let newX = original.x;+ let newY = original.y;+ let newW = original.width;+ let newH = original.height;++ // For arrow: 'start' and 'end' handles+ if (original.type === "arrow") {+ if (state.handle === "start") {+ newX = original.x + dx;+ newY = original.y + dy;+ newW = original.width - dx;+ newH = original.height - dy;+ } else if (state.handle === "end") {+ newW = original.width + dx;+ newH = original.height + dy;+ }+ } else {+ // For shapes+ if (state.handle.includes("e")) newW = original.width + dx;+ if (state.handle.includes("s")) newH = original.height + dy;+ if (state.handle.includes("w")) {+ newX = original.x + dx;+ newW = original.width - dx;+ }+ if (state.handle.includes("n")) {+ newY = original.y + dy;+ newH = original.height - dy;+ }++ // Shift constraint during resize+ if (+ e.shiftKey &&+ (original.type === "rectangle" || original.type === "circle")+ ) {+ // This is complex for corner resizing, simplifying:+ // Just force aspect ratio based on original+ const ratio = original.width / original.height;+ if (state.handle.includes("e") || state.handle.includes("w")) {+ // Width driven, adjust height+ // This is tricky with 8 handles. Skipping proper aspect resize for now to save time/complexity+ // Or simple implementation:+ }+ }+ }++ setAnnotations((a) => a.id === state.id, {+ x: newX,+ y: newY,+ width: newW,+ height: newH,+ });+ }+ }+ };++ const handleMouseUp = () => {+ if (isDrawing() && tempAnnotation()) {+ const ann = tempAnnotation()!;+ // Normalize rect/circle negative width/height+ if (+ ann.type === "rectangle" ||+ ann.type === "circle" ||+ ann.type === "mask"+ ) {+ if (ann.width < 0) {+ ann.x += ann.width;+ ann.width = Math.abs(ann.width);+ }+ if (ann.height < 0) {+ ann.y += ann.height;+ ann.height = Math.abs(ann.height);+ }+ if (ann.width < 5 && ann.height < 5) {+ setTempAnnotation(null);+ setIsDrawing(false);+ drawSnapshot = null; // Cancel snapshot if too small+ return;+ }+ }+ // For arrow, we keep negative width/height as vector++ // Commit history+ if (drawSnapshot) projectHistory.push(drawSnapshot);+ drawSnapshot = null;++ setAnnotations((prev) => [...prev, ann]);+ setTempAnnotation(null);+ setIsDrawing(false);+ setActiveTool("select");+ setSelectedAnnotationId(ann.id);+ }++ if (dragState()) {+ // Commit history if changed+ // We can check if current annotations differ from snapshot, but that's expensive.+ // Instead, we assume if we dragged, we changed.+ // We need to know if we actually moved.+ // But we don't have "current" vs "original" easily without checking.+ // Simpler: always push if dragSnapshot exists.+ if (dragSnapshot) {+ projectHistory.push(dragSnapshot);+ }+ dragSnapshot = null;+ }++ setDragState(null);+ };++ const startDrag = (e: MouseEvent, id: string, handle?: string) => {+ e.stopPropagation();+ if (activeTool() !== "select") return;++ const svg = (e.currentTarget as Element).closest("svg")!;+ const point = getSvgPoint(e, svg);+ const annotation = annotations.find((a) => a.id === id);++ if (annotation) {+ // Snapshot for dragging+ dragSnapshot = {+ project: structuredClone(unwrap(project)),+ annotations: structuredClone(unwrap(annotations)),+ };++ setSelectedAnnotationId(id);+ setDragState({+ id,+ action: handle ? "resize" : "move",+ handle,+ startX: point.x,+ startY: point.y,+ original: { ...annotation },+ });+ }+ };++ const handleDoubleClick = (e: MouseEvent, id: string) => {+ e.stopPropagation();+ const ann = annotations.find((a) => a.id === id);+ if (ann && ann.type === "text") {+ // Snapshot for text editing+ textSnapshot = {+ project: structuredClone(unwrap(project)),+ annotations: structuredClone(unwrap(annotations)),+ };+ setTextEditingId(id);+ }+ };++ const handleSize = createMemo(() => {+ if (props.cssWidth === 0) return 0;+ return (10 / props.cssWidth) * props.bounds.width;+ });++ return (+ <svg+ viewBox={`${props.bounds.x} ${props.bounds.y} ${props.bounds.width} ${props.bounds.height}`}+ style={{+ width: `${props.cssWidth}px`,+ height: `${props.cssHeight}px`,+ position: "absolute",+ top: 0,+ left: 0,+ "pointer-events": "all",+ "z-index": 10,+ }}+ class={activeTool() !== "select" ? "cursor-crosshair" : ""}+ onMouseDown={handleMouseDown}+ onMouseMove={handleMouseMove}+ onMouseUp={handleMouseUp}+ >+ <defs>+ <marker+ id="arrowhead"+ markerWidth="10"+ markerHeight="7"+ refX="9"+ refY="3.5"+ orient="auto"+ >+ <polygon points="0 0, 10 3.5, 0 7" fill="context-stroke" />+ </marker>+ </defs>++ <For each={annotations}>+ {(ann) => (+ <g+ onMouseDown={(e) => startDrag(e, ann.id)}+ onDblClick={(e) => handleDoubleClick(e, ann.id)}+ class="group"+ style={{+ "pointer-events": "all",+ cursor: activeTool() === "select" ? "move" : "inherit",+ }}+ >+ {/* Text Editor Overlay */}+ <Show when={textEditingId() === ann.id}>+ <foreignObject+ x={ann.x}+ y={ann.y}+ width={Math.max(ann.width, 100)}+ height={Math.max(ann.height, 50)}+ class="overflow-visible"+ >+ <div+ class="text-editor bg-transparent outline-none p-0 m-0"+ contentEditable+ style={{+ "font-size": `${ann.height}px`,+ color: ann.strokeColor,+ "min-width": "10px",+ "white-space": "nowrap",+ "line-height": "1",+ }}+ ref={(el) => {+ setTimeout(() => {+ el.focus();+ // Select all text+ const range = document.createRange();+ range.selectNodeContents(el);+ const sel = window.getSelection();+ sel?.removeAllRanges();+ sel?.addRange(range);+ });+ }}+ onBlur={(e) => {+ const text = e.currentTarget.innerText;+ const originalText = annotations.find(+ (a) => a.id === ann.id,+ )?.text;++ if (!text.trim()) {+ // If deleting, use snapshot+ if (textSnapshot) projectHistory.push(textSnapshot);+ setAnnotations((prev) =>+ prev.filter((a) => a.id !== ann.id),+ );+ } else if (text !== originalText) {+ // If changed, use snapshot+ if (textSnapshot) projectHistory.push(textSnapshot);+ setAnnotations((a) => a.id === ann.id, "text", text);+ }++ textSnapshot = null;+ setTextEditingId(null);+ }}+ onKeyDown={(e) => {+ e.stopPropagation(); // Prevent deleting annotation+ if (e.key === "Enter" && !e.shiftKey) {+ e.preventDefault();+ e.currentTarget.blur();+ }+ }}+ >+ {ann.text}+ </div>+ </foreignObject>+ </Show>++ <Show when={textEditingId() !== ann.id}>+ <RenderAnnotation annotation={ann} />+ </Show>++ <Show when={selectedAnnotationId() === ann.id && !textEditingId()}>+ <SelectionHandles+ annotation={ann}+ handleSize={handleSize()}+ onResizeStart={startDrag}+ />+ </Show>+ </g>+ )}+ </For>+ <Show when={tempAnnotation()}>+ {(ann) => <RenderAnnotation annotation={ann()} />}+ </Show>+ </svg>+ );+}++function RenderAnnotation(props: { annotation: Annotation }) {+ return (+ <>+ {props.annotation.type === "rectangle" && (+ <rect+ x={Math.min(+ props.annotation.x,+ props.annotation.x + props.annotation.width,+ )}+ y={Math.min(+ props.annotation.y,+ props.annotation.y + props.annotation.height,+ )}+ width={Math.abs(props.annotation.width)}+ height={Math.abs(props.annotation.height)}+ stroke={props.annotation.strokeColor}+ stroke-width={props.annotation.strokeWidth}+ fill={props.annotation.fillColor}+ opacity={props.annotation.opacity}+ />+ )}+ {props.annotation.type === "circle" && (+ <ellipse+ cx={props.annotation.x + props.annotation.width / 2}+ cy={props.annotation.y + props.annotation.height / 2}+ rx={Math.abs(props.annotation.width / 2)}+ ry={Math.abs(props.annotation.height / 2)}+ stroke={props.annotation.strokeColor}+ stroke-width={props.annotation.strokeWidth}+ fill={props.annotation.fillColor}+ opacity={props.annotation.opacity}+ />+ )}+ {props.annotation.type === "arrow" && (+ <line+ x1={props.annotation.x}+ y1={props.annotation.y}+ x2={props.annotation.x + props.annotation.width}+ y2={props.annotation.y + props.annotation.height}+ stroke={props.annotation.strokeColor}+ stroke-width={props.annotation.strokeWidth}+ marker-end="url(#arrowhead)"+ opacity={props.annotation.opacity}+ />+ )}+ {props.annotation.type === "text" && (+ <text+ x={props.annotation.x}+ y={props.annotation.y + props.annotation.height} // SVG text y is baseline+ fill={props.annotation.strokeColor}+ font-size={props.annotation.height}+ font-family="sans-serif"+ opacity={props.annotation.opacity}+ style={{ "user-select": "none", "white-space": "pre" }}+ >+ {props.annotation.text}+ </text>+ )}+ {props.annotation.type === "mask" && (+ <rect+ x={Math.min(+ props.annotation.x,+ props.annotation.x + props.annotation.width,+ )}+ y={Math.min(+ props.annotation.y,+ props.annotation.y + props.annotation.height,+ )}+ width={Math.abs(props.annotation.width)}+ height={Math.abs(props.annotation.height)}+ stroke={props.annotation.strokeColor}+ stroke-width={props.annotation.strokeWidth}+ fill={props.annotation.fillColor}+ opacity={props.annotation.opacity}+ />+ )}+ </>+ );+}++function SelectionHandles(props: {+ annotation: Annotation;+ handleSize: number;+ onResizeStart: (e: MouseEvent, id: string, handle: string) => void;+}) {+ const half = createMemo(() => props.handleSize / 2);++ return (+ <Show+ when={props.annotation.type === "arrow"}+ fallback={+ <g>+ <For+ each={[+ { id: "nw", x: 0, y: 0 },+ { id: "n", x: 0.5, y: 0 },+ { id: "ne", x: 1, y: 0 },+ { id: "w", x: 0, y: 0.5 },+ { id: "e", x: 1, y: 0.5 },+ { id: "sw", x: 0, y: 1 },+ { id: "s", x: 0.5, y: 1 },+ { id: "se", x: 1, y: 1 },+ ]}+ >+ {(handle) => (+ <Handle+ x={+ props.annotation.x ++ handle.x * props.annotation.width -+ half()+ }+ y={+ props.annotation.y ++ handle.y * props.annotation.height -+ half()+ }+ size={props.handleSize}+ cursor={`${handle.id}-resize`}+ onMouseDown={(e) =>+ props.onResizeStart(e, props.annotation.id, handle.id)+ }+ />+ )}+ </For>+ </g>+ }+ >+ <g>+ <Handle+ x={props.annotation.x - half()}+ y={props.annotation.y - half()}+ size={props.handleSize}+ cursor="crosshair"+ onMouseDown={(e) =>+ props.onResizeStart(e, props.annotation.id, "start")+ }+ />+ <Handle+ x={props.annotation.x + props.annotation.width - half()}+ y={props.annotation.y + props.annotation.height - half()}+ size={props.handleSize}+ cursor="crosshair"+ onMouseDown={(e) =>+ props.onResizeStart(e, props.annotation.id, "end")+ }+ />+ </g>+ </Show>+ );+}++function Handle(props: {+ x: number;+ y: number;+ size: number;+ cursor: string;+ onMouseDown: (e: MouseEvent) => void;+}) {+ return (+ <rect+ x={props.x}+ y={props.y}+ width={props.size}+ height={props.size}+ fill="white"+ stroke="#00A0FF"+ stroke-width={1}+ class="cursor-pointer"+ style={{+ "pointer-events": "all",+ cursor: props.cursor,+ }}+ onMouseDown={props.onMouseDown}+ />+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/AnnotationTools.tsx b/apps/desktop/src/routes/screenshot-editor/AnnotationTools.tsxnew file mode 100644index 000000000..61b47a4c4--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/AnnotationTools.tsx@@ -0,0 +1,65 @@+import { cx } from "cva";+import { Show } from "solid-js";+import IconLucideArrowUpRight from "~icons/lucide/arrow-up-right";+import IconLucideCircle from "~icons/lucide/circle";+import IconLucideEyeOff from "~icons/lucide/eye-off";+import IconLucideMousePointer2 from "~icons/lucide/mouse-pointer-2";+import IconLucideSquare from "~icons/lucide/square";+import IconLucideType from "~icons/lucide/type";+import { AnnotationConfig } from "./AnnotationConfig";+import { type AnnotationType, useScreenshotEditorContext } from "./context";++export function AnnotationTools() {+ return (+ <>+ <div class="flex items-center gap-1">+ <ToolButton+ tool="select"+ icon={IconLucideMousePointer2}+ label="Select"+ />+ <ToolButton tool="arrow" icon={IconLucideArrowUpRight} label="Arrow" />+ <ToolButton+ tool="rectangle"+ icon={IconLucideSquare}+ label="Rectangle"+ />+ <ToolButton tool="mask" icon={IconLucideEyeOff} label="Mask" />+ <ToolButton tool="circle" icon={IconLucideCircle} label="Circle" />+ <ToolButton tool="text" icon={IconLucideType} label="Text" />+ </div>+ <AnnotationConfig />+ </>+ );+}++import type { Component } from "solid-js";++function ToolButton(props: {+ tool: AnnotationType | "select";+ icon: Component<{ class?: string }>;+ label: string;+}) {+ const { activeTool, setActiveTool, setSelectedAnnotationId } =+ useScreenshotEditorContext();+ return (+ <button+ type="button"+ onClick={() => {+ setActiveTool(props.tool);+ if (props.tool !== "select") {+ setSelectedAnnotationId(null);+ }+ }}+ class={cx(+ "flex items-center justify-center rounded-[0.5rem] transition-all size-8",+ activeTool() === props.tool+ ? "bg-blue-3 text-blue-11"+ : "bg-transparent hover:bg-gray-3 text-gray-11",+ )}+ title={props.label}+ >+ <props.icon class="size-4" />+ </button>+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/AspectRatioSelect.tsx b/apps/desktop/src/routes/screenshot-editor/AspectRatioSelect.tsxdeleted file mode 100644index e6578fb41..000000000--- a/apps/desktop/src/routes/screenshot-editor/AspectRatioSelect.tsx+++ /dev/null@@ -1,105 +0,0 @@-import { Select as KSelect } from "@kobalte/core/select";-import { createSignal, Show } from "solid-js";-import Tooltip from "~/components/Tooltip";-import type { AspectRatio } from "~/utils/tauri";-import IconCapChevronDown from "~icons/cap/chevron-down";-import IconCapCircleCheck from "~icons/cap/circle-check";-import IconCapLayout from "~icons/cap/layout";-import { ASPECT_RATIOS } from "../editor/projectConfig";-import { useScreenshotEditorContext } from "./context";-import {- EditorButton,- MenuItem,- MenuItemList,- PopperContent,- topLeftAnimateClasses,-} from "./ui";--function AspectRatioSelect() {- const { project, setProject } = useScreenshotEditorContext();- const [open, setOpen] = createSignal(false);- let triggerSelect: HTMLDivElement | undefined;-- return (- <Tooltip content="Aspect Ratio">- <KSelect<AspectRatio | "auto">- open={open()}- onOpenChange={setOpen}- ref={triggerSelect}- value={project.aspectRatio ?? "auto"}- onChange={(v) => {- if (v === null) return;- setProject("aspectRatio", v === "auto" ? null : v);- }}- defaultValue="auto"- options={- ["auto", "wide", "vertical", "square", "classic", "tall"] as const- }- multiple={false}- itemComponent={(props) => {- const item = () =>- props.item.rawValue === "auto"- ? null- : ASPECT_RATIOS[props.item.rawValue];-- return (- <MenuItem<typeof KSelect.Item> as={KSelect.Item} item={props.item}>- <KSelect.ItemLabel class="flex-1">- {props.item.rawValue === "auto"- ? "Auto"- : ASPECT_RATIOS[props.item.rawValue].name}- <Show when={item()}>- {(item) => (- <span class="text-gray-11">- {"⋅"}- {item().ratio[0]}:{item().ratio[1]}- </span>- )}- </Show>- </KSelect.ItemLabel>- <KSelect.ItemIndicator class="ml-auto">- <IconCapCircleCheck />- </KSelect.ItemIndicator>- </MenuItem>- );- }}- placement="top-start"- >- <EditorButton<typeof KSelect.Trigger>- as={KSelect.Trigger}- class="w-28"- leftIcon={<IconCapLayout />}- rightIcon={- <KSelect.Icon>- <IconCapChevronDown />- </KSelect.Icon>- }- rightIconEnd={true}- >- <KSelect.Value<AspectRatio | "auto">>- {(state) => {- const text = () => {- const option = state.selectedOption();- return option === "auto" ? "Auto" : ASPECT_RATIOS[option].name;- };- return <>{text()}</>;- }}- </KSelect.Value>- </EditorButton>- <KSelect.Portal>- <PopperContent<typeof KSelect.Content>- as={KSelect.Content}- class={topLeftAnimateClasses}- >- <MenuItemList<typeof KSelect.Listbox>- as={KSelect.Listbox}- class="w-[12.5rem]"- />- </PopperContent>- </KSelect.Portal>- </KSelect>- </Tooltip>- );-}--export default AspectRatioSelect;diff --git a/apps/desktop/src/routes/screenshot-editor/ColorPicker.tsx b/apps/desktop/src/routes/screenshot-editor/ColorPicker.tsxnew file mode 100644index 000000000..8b50c2d7e--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/ColorPicker.tsx@@ -0,0 +1,107 @@+import { createWritableMemo } from "@solid-primitives/memo";+import { TextInput } from "./TextInput";++export const BACKGROUND_COLORS = [+ "#FF0000", // Red+ "#FF4500", // Orange-Red+ "#FF8C00", // Orange+ "#FFD700", // Gold+ "#FFFF00", // Yellow+ "#ADFF2F", // Green-Yellow+ "#32CD32", // Lime Green+ "#008000", // Green+ "#00CED1", // Dark Turquoise+ "#4785FF", // Dodger Blue+ "#0000FF", // Blue+ "#4B0082", // Indigo+ "#800080", // Purple+ "#A9A9A9", // Dark Gray+ "#FFFFFF", // White+ "#000000", // Black+ "#00000000", // Transparent+];++export function RgbInput(props: {+ value: [number, number, number];+ onChange: (value: [number, number, number]) => void;+}) {+ const [text, setText] = createWritableMemo(() => rgbToHex(props.value));+ let prevHex = rgbToHex(props.value);+ let colorInput!: HTMLInputElement;++ return (+ <div class="flex flex-row items-center gap-[0.75rem] relative">+ <button+ type="button"+ class="size-[2rem] rounded-[0.5rem] border border-gray-4"+ style={{+ "background-color": rgbToHex(props.value),+ }}+ onClick={() => colorInput.click()}+ />+ <input+ ref={colorInput}+ type="color"+ class="absolute left-0 bottom-0 w-[3rem] opacity-0"+ value={rgbToHex(props.value)}+ onChange={(e) => {+ const value = hexToRgb(e.target.value);+ if (!value) return;+ const [r, g, b] = value;+ props.onChange([r, g, b]);+ }}+ />+ <TextInput+ class="w-[4.60rem] p-[0.375rem] text-gray-12 text-[13px] border rounded-[0.5rem] bg-gray-1 outline-none focus:ring-1 transition-shadows duration-200 focus:ring-gray-500 focus:ring-offset-1 focus:ring-offset-gray-200"+ value={text()}+ onFocus={() => {+ prevHex = rgbToHex(props.value);+ }}+ onInput={(e) => {+ setText(e.currentTarget.value);+ const value = hexToRgb(e.target.value);+ if (!value) return;+ const [r, g, b] = value;+ props.onChange([r, g, b]);+ }}+ onBlur={(e) => {+ const value = hexToRgb(e.target.value);+ if (value) {+ const [r, g, b] = value;+ props.onChange([r, g, b]);+ } else {+ setText(prevHex);+ const fallbackValue = hexToRgb(text());+ if (!fallbackValue) return;+ const [r, g, b] = fallbackValue;+ props.onChange([r, g, b]);+ }+ }}+ />+ </div>+ );+}++export function rgbToHex(rgb: [number, number, number]) {+ return `#${rgb+ .map((c) => c.toString(16).padStart(2, "0"))+ .join("")+ .toUpperCase()}`;+}++export function hexToRgb(hex: string): [number, number, number, number] | null {+ const match = hex.match(+ /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i,+ );+ if (!match) return null;+ const [, r, g, b, a] = match;+ const rgb = [+ Number.parseInt(r, 16),+ Number.parseInt(g, 16),+ Number.parseInt(b, 16),+ ] as const;+ if (a) {+ return [...rgb, Number.parseInt(a, 16)];+ }+ return [...rgb, 255];+}diff --git a/apps/desktop/src/routes/screenshot-editor/ConfigSidebar.tsx b/apps/desktop/src/routes/screenshot-editor/ConfigSidebar.tsxdeleted file mode 100644index f73625076..000000000--- a/apps/desktop/src/routes/screenshot-editor/ConfigSidebar.tsx+++ /dev/null@@ -1,989 +0,0 @@-import {- Collapsible,- Collapsible as KCollapsible,-} from "@kobalte/core/collapsible";-import {- RadioGroup as KRadioGroup,- RadioGroup,-} from "@kobalte/core/radio-group";-import { Select as KSelect } from "@kobalte/core/select";-import { Tabs as KTabs } from "@kobalte/core/tabs";-import { createEventListenerMap } from "@solid-primitives/event-listener";-import { createWritableMemo } from "@solid-primitives/memo";-import { convertFileSrc } from "@tauri-apps/api/core";-import { appDataDir, resolveResource } from "@tauri-apps/api/path";-import { BaseDirectory, writeFile } from "@tauri-apps/plugin-fs";-import { type as ostype } from "@tauri-apps/plugin-os";-import { cx } from "cva";-import {- batch,- createMemo,- createResource,- createSignal,- For,- onMount,- Show,- type ValidComponent,-} from "solid-js";-import { createStore } from "solid-js/store";-import { Dynamic } from "solid-js/web";-import toast from "solid-toast";-import colorBg from "~/assets/illustrations/color.webp";-import gradientBg from "~/assets/illustrations/gradient.webp";-import imageBg from "~/assets/illustrations/image.webp";-import transparentBg from "~/assets/illustrations/transparent.webp";-import { Toggle } from "~/components/Toggle";-import type { BackgroundSource } from "~/utils/tauri";-import IconCapBgBlur from "~icons/cap/bg-blur";-import IconCapChevronDown from "~icons/cap/chevron-down";-import IconCapCircleX from "~icons/cap/circle-x";-import IconCapCorners from "~icons/cap/corners";-import IconCapEnlarge from "~icons/cap/enlarge";-import IconCapImage from "~icons/cap/image";-import IconCapPadding from "~icons/cap/padding";-import IconCapSettings from "~icons/cap/settings";-import IconCapShadow from "~icons/cap/shadow";-import {- DEFAULT_GRADIENT_FROM,- DEFAULT_GRADIENT_TO,- type RGBColor,-} from "../editor/projectConfig";-import { useScreenshotEditorContext } from "./context";-import ShadowSettings from "./ShadowSettings";-import { TextInput } from "./TextInput";-import {- Field,- MenuItem,- MenuItemList,- PopperContent,- Slider,- topSlideAnimateClasses,-} from "./ui";--// Constants-const BACKGROUND_SOURCES = {- wallpaper: "Wallpaper",- image: "Image",- color: "Color",- gradient: "Gradient",-} satisfies Record<BackgroundSource["type"], string>;--const BACKGROUND_ICONS = {- wallpaper: imageBg,- image: transparentBg,- color: colorBg,- gradient: gradientBg,-} satisfies Record<BackgroundSource["type"], string>;--const BACKGROUND_SOURCES_LIST = [- "wallpaper",- "image",- "color",- "gradient",-] satisfies Array<BackgroundSource["type"]>;--const BACKGROUND_COLORS = [- "#FF0000", // Red- "#FF4500", // Orange-Red- "#FF8C00", // Orange- "#FFD700", // Gold- "#FFFF00", // Yellow- "#ADFF2F", // Green-Yellow- "#32CD32", // Lime Green- "#008000", // Green- "#00CED1", // Dark Turquoise- "#4785FF", // Dodger Blue- "#0000FF", // Blue- "#4B0082", // Indigo- "#800080", // Purple- "#A9A9A9", // Dark Gray- "#FFFFFF", // White- "#000000", // Black- "#00000000", // Transparent-];--// Copied gradients-const BACKGROUND_GRADIENTS = [- { from: [15, 52, 67], to: [52, 232, 158] },- { from: [34, 193, 195], to: [253, 187, 45] },- { from: [29, 253, 251], to: [195, 29, 253] },- { from: [69, 104, 220], to: [176, 106, 179] },- { from: [106, 130, 251], to: [252, 92, 125] },- { from: [131, 58, 180], to: [253, 29, 29] },- { from: [249, 212, 35], to: [255, 78, 80] },- { from: [255, 94, 0], to: [255, 42, 104] },- { from: [255, 0, 150], to: [0, 204, 255] },- { from: [0, 242, 96], to: [5, 117, 230] },- { from: [238, 205, 163], to: [239, 98, 159] },- { from: [44, 62, 80], to: [52, 152, 219] },- { from: [168, 239, 255], to: [238, 205, 163] },- { from: [74, 0, 224], to: [143, 0, 255] },- { from: [252, 74, 26], to: [247, 183, 51] },- { from: [0, 255, 255], to: [255, 20, 147] },- { from: [255, 127, 0], to: [255, 255, 0] },- { from: [255, 0, 255], to: [0, 255, 0] },-] satisfies Array<{ from: RGBColor; to: RGBColor }>;--const WALLPAPER_NAMES = [- "macOS/tahoe-dusk-min",- "macOS/tahoe-dawn-min",- "macOS/tahoe-day-min",- "macOS/tahoe-night-min",- "macOS/tahoe-dark",- "macOS/tahoe-light",- "macOS/sequoia-dark",- "macOS/sequoia-light",- "macOS/sonoma-clouds",- "macOS/sonoma-dark",- "macOS/sonoma-evening",- "macOS/sonoma-fromabove",- "macOS/sonoma-horizon",- "macOS/sonoma-light",- "macOS/sonoma-river",- "macOS/ventura-dark",- "macOS/ventura-semi-dark",- "macOS/ventura",- "blue/1",- "blue/2",- "blue/3",- "blue/4",- "blue/5",- "blue/6",- "purple/1",- "purple/2",- "purple/3",- "purple/4",- "purple/5",- "purple/6",- "dark/1",- "dark/2",- "dark/3",- "dark/4",- "dark/5",- "dark/6",- "orange/1",- "orange/2",- "orange/3",- "orange/4",- "orange/5",- "orange/6",- "orange/7",- "orange/8",- "orange/9",-] as const;--const BACKGROUND_THEMES = {- macOS: "macOS",- dark: "Dark",- blue: "Blue",- purple: "Purple",- orange: "Orange",-};--export type CornerRoundingType = "rounded" | "squircle";-const CORNER_STYLE_OPTIONS = [- { name: "Squircle", value: "squircle" },- { name: "Rounded", value: "rounded" },-] satisfies Array<{ name: string; value: CornerRoundingType }>;--export function ConfigSidebar() {- const [selectedTab, setSelectedTab] = createSignal("background");- let scrollRef!: HTMLDivElement;-- return (- <KTabs- value={selectedTab()}- onChange={setSelectedTab}- class="flex flex-col min-h-0 shrink-0 flex-1 max-w-[26rem] overflow-hidden rounded-xl z-10 bg-gray-1 dark:bg-gray-2 border border-gray-3"- >- <KTabs.List class="flex overflow-hidden sticky top-0 z-[60] flex-row items-center h-16 text-lg border-b border-gray-3 shrink-0 bg-gray-1 dark:bg-gray-2">- <For each={[{ id: "background", icon: IconCapImage }]}>- {(item) => (- <KTabs.Trigger- value={item.id}- class={cx(- "flex relative z-10 flex-1 justify-center items-center px-4 py-2 transition-colors group disabled:opacity-50 focus:outline-none",- "text-gray-11 ui-selected:text-gray-12",- )}- >- <div- class={cx(- "flex justify-center relative border-transparent border z-10 items-center rounded-md size-9 transition will-change-transform",- selectedTab() !== item.id &&- "group-hover:border-gray-300 group-disabled:border-none",- )}- >- <Dynamic component={item.icon} />- </div>- </KTabs.Trigger>- )}- </For>-- <KTabs.Indicator class="absolute top-0 left-0 w-full h-full transition-transform duration-200 ease-in-out pointer-events-none will-change-transform">- <div class="absolute top-1/2 left-1/2 rounded-lg transform -translate-x-1/2 -translate-y-1/2 bg-gray-3 will-change-transform size-9" />- </KTabs.Indicator>- </KTabs.List>-- <div- ref={scrollRef}- class="custom-scroll overflow-x-hidden overflow-y-scroll text-[0.875rem] flex-1 min-h-0"- >- <BackgroundConfig scrollRef={scrollRef} />- </div>- </KTabs>- );-}--function BackgroundConfig(props: { scrollRef: HTMLDivElement }) {- const { project, setProject, projectHistory } = useScreenshotEditorContext();-- // Background tabs- const [backgroundTab, setBackgroundTab] =- createSignal<keyof typeof BACKGROUND_THEMES>("macOS");-- const [wallpapers] = createResource(async () => {- // Only load visible wallpapers initially- const visibleWallpaperPaths = WALLPAPER_NAMES.map(async (id) => {- try {- const path = await resolveResource(`assets/backgrounds/${id}.jpg`);- return { id, path };- } catch (err) {- return { id, path: null };- }- });-- // Load initial batch- const initialPaths = await Promise.all(visibleWallpaperPaths);-- return initialPaths- .filter((p) => p.path !== null)- .map(({ id, path }) => ({- id,- url: convertFileSrc(path!),- rawPath: path!,- }));- });-- const filteredWallpapers = createMemo(() => {- const currentTab = backgroundTab();- return wallpapers()?.filter((wp) => wp.id.startsWith(currentTab)) || [];- });-- const [scrollX, setScrollX] = createSignal(0);- const [reachedEndOfScroll, setReachedEndOfScroll] = createSignal(false);- const [backgroundRef, setBackgroundRef] = createSignal<HTMLDivElement>();-- createEventListenerMap(- () => backgroundRef() ?? [],- {- scroll: () => {- const el = backgroundRef();- if (el) {- setScrollX(el.scrollLeft);- const reachedEnd = el.scrollWidth - el.clientWidth - el.scrollLeft;- setReachedEndOfScroll(reachedEnd === 0);- }- },- wheel: (e: WheelEvent) => {- const el = backgroundRef();- if (el) {- e.preventDefault();- el.scrollLeft +=- Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY;- }- },- },- { passive: false },- );-- let fileInput!: HTMLInputElement;- const hapticsEnabled = ostype() === "macos";-- const setProjectSource = (source: any) => {- setProject("background", "source", source);- };-- // Debounced set project for history- const debouncedSetProject = (wallpaperPath: string) => {- const resumeHistory = projectHistory.pause();- queueMicrotask(() => {- batch(() => {- setProject("background", "source", {- type: "wallpaper",- path: wallpaperPath,- } as const);- resumeHistory();- });- });- };-- const ensurePaddingForBackground = () => {- batch(() => {- const isPaddingZero = project.background.padding === 0;- const isRoundingZero = project.background.rounding === 0;-- if (isPaddingZero) {- setProject("background", "padding", 10);- }-- if (isPaddingZero && isRoundingZero) {- setProject("background", "rounding", 8);- }- });- };-- return (- <KTabs.Content value="background" class="flex flex-col gap-6 p-4">- <Field icon={<IconCapImage class="size-4" />} name="Background Image">- <KTabs- value={project.background.source.type}- onChange={(v) => {- const tab = v as BackgroundSource["type"];- let newSource: any;- switch (tab) {- case "wallpaper":- newSource = { type: "wallpaper", path: null };- break;- case "image":- newSource = { type: "image", path: null };- break;- case "color":- newSource = { type: "color", value: DEFAULT_GRADIENT_FROM };- break;- case "gradient":- newSource = {- type: "gradient",- from: DEFAULT_GRADIENT_FROM,- to: DEFAULT_GRADIENT_TO,- };- break;- }-- // Try to preserve existing if type matches- if (project.background.source.type === tab) {- newSource = project.background.source;- }-- setProjectSource(newSource);- if (tab === "wallpaper" || tab === "image" || tab === "gradient") {- ensurePaddingForBackground();- }- }}- >- <KTabs.List class="flex flex-row gap-2 items-center rounded-[0.5rem] relative">- <For each={BACKGROUND_SOURCES_LIST}>- {(item) => {- return (- <KTabs.Trigger- class="z-10 flex-1 py-2.5 px-2 text-xs text-gray-11 ui-selected:border-gray-3 ui-selected:bg-gray-3 ui-not-selected:hover:border-gray-7 rounded-[10px] transition-colors duration-200 outline-none border ui-selected:text-gray-12 peer"- value={item}- >- {BACKGROUND_SOURCES[item]}- </KTabs.Trigger>- );- }}- </For>- </KTabs.List>-- <div class="my-5 w-full border-t border-dashed border-gray-5" />-- <KTabs.Content value="wallpaper">- <KTabs class="overflow-hidden relative" value={backgroundTab()}>- <KTabs.List- ref={setBackgroundRef}- class="flex overflow-x-auto overscroll-contain relative z-10 flex-row gap-2 items-center mb-3 text-xs hide-scroll"- >- <For each={Object.entries(BACKGROUND_THEMES)}>- {([key, value]) => (- <KTabs.Trigger- onClick={() =>- setBackgroundTab(key as keyof typeof BACKGROUND_THEMES)- }- value={key}- class="flex relative z-10 flex-1 justify-center items-center px-4 py-2 bg-transparent rounded-lg border transition-colors duration-200 text-gray-11 ui-not-selected:hover:border-gray-7 ui-selected:bg-gray-3 ui-selected:border-gray-3 group ui-selected:text-gray-12 disabled:opacity-50 focus:outline-none"- >- {value}- </KTabs.Trigger>- )}- </For>- </KTabs.List>- </KTabs>-- <KRadioGroup- value={- project.background.source.type === "wallpaper"- ? (wallpapers()?.find((w) =>- (- project.background.source as { path?: string }- ).path?.includes(w.id),- )?.url ?? undefined)- : undefined- }- onChange={(photoUrl) => {- const wallpaper = wallpapers()?.find((w) => w.url === photoUrl);- if (wallpaper) {- debouncedSetProject(wallpaper.rawPath);- ensurePaddingForBackground();- }- }}- class="grid grid-cols-7 gap-2 h-auto"- >- <For each={filteredWallpapers().slice(0, 21)}>- {(photo) => (- <KRadioGroup.Item- value={photo.url!}- class="relative aspect-square group"- >- <KRadioGroup.ItemInput class="peer" />- <KRadioGroup.ItemControl class="overflow-hidden w-full h-full rounded-lg transition cursor-pointer ui-not-checked:ring-offset-1 ui-not-checked:ring-offset-gray-200 ui-not-checked:hover:ring-1 ui-not-checked:hover:ring-gray-400 ui-checked:ring-2 ui-checked:ring-gray-500 ui-checked:ring-offset-2 ui-checked:ring-offset-gray-200">- <img- src={photo.url!}- loading="eager"- class="object-cover w-full h-full"- alt="Wallpaper option"- />- </KRadioGroup.ItemControl>- </KRadioGroup.Item>- )}- </For>- </KRadioGroup>- </KTabs.Content>-- <KTabs.Content value="image">- <Show- when={- project.background.source.type === "image" &&- project.background.source.path- }- fallback={- <button- type="button"- onClick={() => fileInput.click()}- class="p-6 bg-gray-2 text-[13px] w-full rounded-[0.5rem] border border-gray-5 border-dashed flex flex-col items-center justify-center gap-[0.5rem] hover:bg-gray-3 transition-colors duration-100"- >- <IconCapImage class="text-gray-11 size-6" />- <span class="text-gray-12">- Click to select or drag and drop image- </span>- </button>- }- >- {(source) => (- <div class="overflow-hidden relative w-full h-48 rounded-md border border-gray-3 group">- <img- src={convertFileSrc(source())}- class="object-cover w-full h-full"- alt="Selected background"- />- <div class="absolute top-2 right-2">- <button- type="button"- onClick={() =>- setProjectSource({- type: "image",- path: null,- })- }- class="p-2 text-white rounded-full transition-colors bg-black/50 hover:bg-black/70"- >- <IconCapCircleX class="w-4 h-4" />- </button>- </div>- </div>- )}- </Show>- <input- type="file"- ref={fileInput}- class="hidden"- accept="image/apng, image/avif, image/jpeg, image/png, image/webp"- onChange={async (e) => {- const file = e.currentTarget.files?.[0];- if (!file) return;- const fileName = `bg-${Date.now()}-${file.name}`;- const arrayBuffer = await file.arrayBuffer();- const uint8Array = new Uint8Array(arrayBuffer);-- const fullPath = `${await appDataDir()}/${fileName}`;-- await writeFile(fileName, uint8Array, {- baseDir: BaseDirectory.AppData,- });-- setProjectSource({- type: "image",- path: fullPath,- });- ensurePaddingForBackground();- }}- />- </KTabs.Content>-- <KTabs.Content value="color">- <div class="flex flex-col flex-wrap gap-3">- <div class="flex flex-row items-center w-full h-10">- <RgbInput- value={- project.background.source.type === "color"- ? project.background.source.value- : [0, 0, 0]- }- onChange={(v) =>- setProjectSource({ type: "color", value: v })- }- />- </div>- <div class="flex flex-wrap gap-2">- <For each={BACKGROUND_COLORS}>- {(color) => (- <label class="relative">- <input- type="radio"- class="sr-only peer"- name="colorPicker"- onChange={(e) => {- if (e.target.checked) {- const rgb = hexToRgb(color);- if (rgb)- setProjectSource({- type: "color",- value: [rgb[0], rgb[1], rgb[2]],- alpha: rgb[3],- });- }- }}- />- <div- class="rounded-lg transition-all duration-200 cursor-pointer size-8 peer-checked:hover:opacity-100 peer-hover:opacity-70 peer-checked:ring-2 peer-checked:ring-gray-500 peer-checked:ring-offset-2 peer-checked:ring-offset-gray-200"- style={{ background: color }}- />- </label>- )}- </For>- </div>- </div>- </KTabs.Content>-- <KTabs.Content value="gradient">- <Show- when={- project.background.source.type === "gradient" &&- project.background.source- }- >- {(source) => {- const angle = () => source().angle ?? 90;- return (- <div class="flex flex-col gap-3">- <div class="flex gap-5 h-10">- <RgbInput- value={source().from}- onChange={(from) =>- setProjectSource({ ...source(), from })- }- />- <RgbInput- value={source().to}- onChange={(to) => setProjectSource({ ...source(), to })}- />- </div>- <div class="flex flex-wrap gap-2">- <For each={BACKGROUND_GRADIENTS}>- {(gradient) => (- <label class="relative">- <input- type="radio"- class="sr-only peer"- name="colorPicker"- onChange={(e) => {- if (e.target.checked) {- setProjectSource({- type: "gradient",- from: gradient.from,- to: gradient.to,- });- ensurePaddingForBackground();- }- }}- />- <div- class="rounded-lg transition-all duration-200 cursor-pointer size-8 peer-checked:hover:opacity-100 peer-hover:opacity-70 peer-checked:ring-2 peer-checked:ring-gray-500 peer-checked:ring-offset-2 peer-checked:ring-offset-gray-200"- style={{- background: `linear-gradient(${angle()}deg, rgb(${gradient.from.join(- ",",- )}), rgb(${gradient.to.join(",")}))`,- }}- />- </label>- )}- </For>- </div>- </div>- );- }}- </Show>- </KTabs.Content>- </KTabs>- </Field>-- <Field name="Background Blur" icon={<IconCapBgBlur />}>- <Slider- value={[project.background.blur]}- onChange={(v) => setProject("background", "blur", v[0])}- minValue={0}- maxValue={100}- step={0.1}- formatTooltip="%"- />- </Field>-- <div class="w-full border-t border-gray-300 border-dashed" />-- <Field name="Padding" icon={<IconCapPadding class="size-4" />}>- <Slider- value={[project.background.padding]}- onChange={(v) => setProject("background", "padding", v[0])}- minValue={0}- maxValue={40}- step={0.1}- formatTooltip="%"- />- </Field>-- <Field name="Rounded Corners" icon={<IconCapCorners class="size-4" />}>- <div class="flex flex-col gap-3">- <Slider- value={[project.background.rounding]}- onChange={(v) => setProject("background", "rounding", v[0])}- minValue={0}- maxValue={100}- step={0.1}- formatTooltip="%"- />- <CornerStyleSelect- label="Corner Style"- value={project.background.roundingType || "squircle"}- onChange={(v) => setProject("background", "roundingType", v)}- />- </div>- </Field>-- <Field name="Shadow" icon={<IconCapShadow class="size-4" />}>- <Slider- value={[project.background.shadow!]}- onChange={(v) => {- batch(() => {- setProject("background", "shadow", v[0]);- if (v[0] > 0 && !project.background.advancedShadow) {- setProject("background", "advancedShadow", {- size: 50,- opacity: 18,- blur: 50,- });- }- });- }}- minValue={0}- maxValue={100}- step={0.1}- formatTooltip="%"- />-- <ShadowSettings- scrollRef={props.scrollRef}- size={{- value: [project.background.advancedShadow?.size ?? 50],- onChange: (v) => {- setProject("background", "advancedShadow", {- ...(project.background.advancedShadow ?? {- size: 50,- opacity: 18,- blur: 50,- }),- size: v[0],- });- },- }}- opacity={{- value: [project.background.advancedShadow?.opacity ?? 18],- onChange: (v) => {- setProject("background", "advancedShadow", {- ...(project.background.advancedShadow ?? {- size: 50,- opacity: 18,- blur: 50,- }),- opacity: v[0],- });- },- }}- blur={{- value: [project.background.advancedShadow?.blur ?? 50],- onChange: (v) => {- setProject("background", "advancedShadow", {- ...(project.background.advancedShadow ?? {- size: 50,- opacity: 18,- blur: 50,- }),- blur: v[0],- });- },- }}- />- </Field>-- <Field- name="Border"- icon={<IconCapSettings class="size-4" />}- value={- <Toggle- checked={project.background.border?.enabled ?? false}- onChange={(enabled) => {- const prev = project.background.border ?? {- enabled: false,- width: 5.0,- color: [0, 0, 0],- opacity: 50.0,- };-- if (props.scrollRef && enabled) {- setTimeout(- () =>- props.scrollRef.scrollTo({- top: props.scrollRef.scrollHeight,- behavior: "smooth",- }),- 100,- );- }-- setProject("background", "border", {- ...prev,- enabled,- });- }}- />- }- />- <KCollapsible open={project.background.border?.enabled ?? false}>- <KCollapsible.Content class="overflow-hidden opacity-0 transition-opacity animate-collapsible-up ui-expanded:animate-collapsible-down ui-expanded:opacity-100">- <div class="flex flex-col gap-6 pb-6">- <Field name="Border Width" icon={<IconCapEnlarge class="size-4" />}>- <Slider- value={[project.background.border?.width ?? 5.0]}- onChange={(v) =>- setProject("background", "border", {- ...(project.background.border ?? {- enabled: true,- width: 5.0,- color: [0, 0, 0],- opacity: 50.0,- }),- width: v[0],- })- }- minValue={1}- maxValue={20}- step={0.1}- formatTooltip="px"- />- </Field>- <Field name="Border Color" icon={<IconCapImage class="size-4" />}>- <RgbInput- value={project.background.border?.color ?? [0, 0, 0]}- onChange={(color) =>- setProject("background", "border", {- ...(project.background.border ?? {- enabled: true,- width: 5.0,- color: [0, 0, 0],- opacity: 50.0,- }),- color,- })- }- />- </Field>- <Field- name="Border Opacity"- icon={<IconCapShadow class="size-4" />}- >- <Slider- value={[project.background.border?.opacity ?? 50.0]}- onChange={(v) =>- setProject("background", "border", {- ...(project.background.border ?? {- enabled: true,- width: 5.0,- color: [0, 0, 0],- opacity: 50.0,- }),- opacity: v[0],- })- }- minValue={0}- maxValue={100}- step={0.1}- formatTooltip="%"- />- </Field>- </div>- </KCollapsible.Content>- </KCollapsible>- </KTabs.Content>- );-}--// Utils--function CornerStyleSelect(props: {- label?: string;- value: CornerRoundingType;- onChange: (value: CornerRoundingType) => void;-}) {- return (- <div class="flex flex-col gap-1.5">- <Show when={props.label}>- {(label) => (- <span class="text-[0.65rem] uppercase tracking-wide text-gray-11">- {label()}- </span>- )}- </Show>- <KSelect<{ name: string; value: CornerRoundingType }>- options={CORNER_STYLE_OPTIONS}- optionValue="value"- optionTextValue="name"- value={CORNER_STYLE_OPTIONS.find(- (option) => option.value === props.value,- )}- onChange={(option) => option && props.onChange(option.value)}- disallowEmptySelection- itemComponent={(itemProps) => (- <MenuItem<typeof KSelect.Item>- as={KSelect.Item}- item={itemProps.item}- >- <KSelect.ItemLabel class="flex-1">- {itemProps.item.rawValue.name}- </KSelect.ItemLabel>- </MenuItem>- )}- >- <KSelect.Trigger class="flex flex-row gap-2 items-center px-2 w-full h-8 rounded-lg transition-colors bg-gray-3 disabled:text-gray-11">- <KSelect.Value<{- name: string;- value: CornerRoundingType;- }> class="flex-1 text-sm text-left truncate text-[--gray-500] font-normal">- {(state) => <span>{state.selectedOption().name}</span>}- </KSelect.Value>- <KSelect.Icon<ValidComponent>- as={(iconProps) => (- <IconCapChevronDown- {...iconProps}- class="size-4 shrink-0 transform transition-transform ui-expanded:rotate-180 text-[--gray-500]"- />- )}- />- </KSelect.Trigger>- <KSelect.Portal>- <PopperContent<typeof KSelect.Content>- as={KSelect.Content}- class={cx(topSlideAnimateClasses, "z-50")}- >- <MenuItemList<typeof KSelect.Listbox>- class="overflow-y-auto max-h-32"- as={KSelect.Listbox}- />- </PopperContent>- </KSelect.Portal>- </KSelect>- </div>- );-}--function RgbInput(props: {- value: [number, number, number];- onChange: (value: [number, number, number]) => void;-}) {- const [text, setText] = createWritableMemo(() => rgbToHex(props.value));- let prevHex = rgbToHex(props.value);- let colorInput!: HTMLInputElement;-- return (- <div class="flex flex-row items-center gap-[0.75rem] relative">- <button- type="button"- class="size-[2rem] rounded-[0.5rem]"- style={{- "background-color": rgbToHex(props.value),- }}- onClick={() => colorInput.click()}- />- <input- ref={colorInput}- type="color"- class="absolute left-0 bottom-0 w-[3rem] opacity-0"- value={rgbToHex(props.value)}- onChange={(e) => {- const value = hexToRgb(e.target.value);- if (!value) return;- const [r, g, b] = value;- props.onChange([r, g, b]);- }}- />- <TextInput- class="w-[4.60rem] p-[0.375rem] text-gray-12 text-[13px] border rounded-[0.5rem] bg-gray-1 outline-none focus:ring-1 transition-shadows duration-200 focus:ring-gray-500 focus:ring-offset-1 focus:ring-offset-gray-200"- value={text()}- onFocus={() => {- prevHex = rgbToHex(props.value);- }}- onInput={(e) => {- setText(e.currentTarget.value);- const value = hexToRgb(e.target.value);- if (!value) return;- const [r, g, b] = value;- props.onChange([r, g, b]);- }}- onBlur={(e) => {- const value = hexToRgb(e.target.value);- if (value) {- const [r, g, b] = value;- props.onChange([r, g, b]);- } else {- setText(prevHex);- const fallbackValue = hexToRgb(text());- if (!fallbackValue) return;- const [r, g, b] = fallbackValue;- props.onChange([r, g, b]);- }- }}- />- </div>- );-}--function rgbToHex(rgb: [number, number, number]) {- return `#${rgb- .map((c) => c.toString(16).padStart(2, "0"))- .join("")- .toUpperCase()}`;-}--function hexToRgb(hex: string): [number, number, number, number] | null {- const match = hex.match(- /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i,- );- if (!match) return null;- const [, r, g, b, a] = match;- const rgb = [- Number.parseInt(r, 16),- Number.parseInt(g, 16),- Number.parseInt(b, 16),- ] as const;- if (a) {- return [...rgb, Number.parseInt(a, 16)];- }- return [...rgb, 255];-}diff --git a/apps/desktop/src/routes/screenshot-editor/Editor.tsx b/apps/desktop/src/routes/screenshot-editor/Editor.tsxindex a39cbd5cd..59b303f6d 100644--- a/apps/desktop/src/routes/screenshot-editor/Editor.tsx+++ b/apps/desktop/src/routes/screenshot-editor/Editor.tsx@@ -4,7 +4,14 @@ import { makePersisted } from "@solid-primitives/storage";import { convertFileSrc } from "@tauri-apps/api/core";import { LogicalPosition } from "@tauri-apps/api/dpi";import { Menu } from "@tauri-apps/api/menu";-import { createSignal, Match, Show, Switch } from "solid-js";+import {+ createEffect,+ createSignal,+ Match,+ onCleanup,+ Show,+ Switch,+} from "solid-js";import { Transition } from "solid-transition-group";import {CROP_ZERO,@@ -18,7 +25,6 @@ import { composeEventHandlers } from "~/utils/composeEventHandlers";import IconCapCircleX from "~icons/cap/circle-x";import IconLucideMaximize from "~icons/lucide/maximize";import IconLucideRatio from "~icons/lucide/ratio";-import { ConfigSidebar } from "./ConfigSidebar";import { useScreenshotEditorContext } from "./context";import { ExportDialog } from "./ExportDialog";import { Header } from "./Header";@@ -26,17 +32,98 @@ import { Preview } from "./Preview";import { Dialog, DialogContent, EditorButton, Input, Subfield } from "./ui";export function Editor() {+ const [zoom, setZoom] = createSignal(1);+ const {+ projectHistory,+ setActiveTool,+ setProject,+ project,+ setSelectedAnnotationId,+ } = useScreenshotEditorContext();++ createEffect(() => {+ const handleKeyDown = (e: KeyboardEvent) => {+ // Ignore if typing in an input or contenteditable+ const target = e.target as HTMLElement;+ if (+ target.tagName === "INPUT" ||+ target.tagName === "TEXTAREA" ||+ target.isContentEditable+ ) {+ return;+ }++ const isMod = e.metaKey || e.ctrlKey;+ const isShift = e.shiftKey;++ // Undo / Redo+ if (isMod && e.key.toLowerCase() === "z") {+ e.preventDefault();+ if (isShift) {+ projectHistory.redo();+ } else {+ projectHistory.undo();+ }+ return;+ }+ if (isMod && e.key.toLowerCase() === "y") {+ e.preventDefault();+ projectHistory.redo();+ return;+ }++ // Tools (No modifiers)+ if (!isMod && !isShift) {+ switch (e.key.toLowerCase()) {+ case "a":+ setActiveTool("arrow");+ setSelectedAnnotationId(null);+ break;+ case "r":+ setActiveTool("rectangle");+ setSelectedAnnotationId(null);+ break;+ case "c":+ case "o": // Support 'o' for oval/circle too+ setActiveTool("circle");+ setSelectedAnnotationId(null);+ break;+ case "t":+ setActiveTool("text");+ setSelectedAnnotationId(null);+ break;+ case "v":+ case "s":+ case "escape":+ setActiveTool("select");+ setSelectedAnnotationId(null);+ break;+ case "p": {+ // Toggle Padding+ // We need to push history here too if we want undo for padding+ projectHistory.push();+ const currentPadding = project.background.padding;+ setProject("background", "padding", currentPadding === 0 ? 20 : 0);+ break;+ }+ }+ }+ };++ window.addEventListener("keydown", handleKeyDown);+ onCleanup(() => window.removeEventListener("keydown", handleKeyDown));+ });+return (<>- <Header />+ <Header zoom={zoom()} setZoom={setZoom} /><div- class="flex overflow-y-hidden flex-col flex-1 gap-2 pb-4 w-full min-h-0 leading-5 animate-in fade-in"+ class="flex overflow-y-hidden flex-col flex-1 gap-0 pb-0 w-full min-h-0 leading-5 animate-in fade-in"data-tauri-drag-region><div class="flex overflow-hidden flex-col flex-1 min-h-0">- <div class="flex overflow-y-hidden flex-row flex-1 min-h-0 gap-2 px-2 pb-0.5">- <Preview />- <ConfigSidebar />+ <div class="flex overflow-y-hidden flex-row flex-1 min-h-0">+ <Preview zoom={zoom()} setZoom={setZoom} /></div></div><Dialogs />diff --git a/apps/desktop/src/routes/screenshot-editor/ExportDialog.tsx b/apps/desktop/src/routes/screenshot-editor/ExportDialog.tsxindex bdf62dab7..65858297e 100644--- a/apps/desktop/src/routes/screenshot-editor/ExportDialog.tsx+++ b/apps/desktop/src/routes/screenshot-editor/ExportDialog.tsx@@ -1,53 +1,196 @@import { Button } from "@cap/ui-solid";import { convertFileSrc } from "@tauri-apps/api/core";import { save } from "@tauri-apps/plugin-dialog";-import { createSignal, Show } from "solid-js";+import { createSignal } from "solid-js";import toast from "solid-toast";import { commands } from "~/utils/tauri";-import IconCapCircleX from "~icons/cap/circle-x";import IconCapCopy from "~icons/cap/copy";import IconCapFile from "~icons/cap/file";-import { useScreenshotEditorContext } from "./context";+import { type Annotation, useScreenshotEditorContext } from "./context";import { Dialog, DialogContent } from "./ui";export function ExportDialog() {- const { dialog, setDialog, path, project } = useScreenshotEditorContext();+ const { dialog, setDialog, path, latestFrame, annotations } =+ useScreenshotEditorContext();const [exporting, setExporting] = createSignal(false);+ const drawAnnotations = (+ ctx: CanvasRenderingContext2D,+ annotations: Annotation[],+ ) => {+ for (const ann of annotations) {+ if (ann.type === "mask") continue;+ ctx.save();+ ctx.globalAlpha = ann.opacity;+ ctx.strokeStyle = ann.strokeColor;+ ctx.lineWidth = ann.strokeWidth;+ ctx.fillStyle = ann.fillColor;++ if (ann.type === "rectangle") {+ if (ann.fillColor !== "transparent") {+ ctx.fillRect(ann.x, ann.y, ann.width, ann.height);+ }+ ctx.strokeRect(ann.x, ann.y, ann.width, ann.height);+ } else if (ann.type === "circle") {+ ctx.beginPath();+ const cx = ann.x + ann.width / 2;+ const cy = ann.y + ann.height / 2;+ const rx = Math.abs(ann.width / 2);+ const ry = Math.abs(ann.height / 2);+ ctx.ellipse(cx, cy, rx, ry, 0, 0, 2 * Math.PI);+ if (ann.fillColor !== "transparent") {+ ctx.fill();+ }+ ctx.stroke();+ } else if (ann.type === "arrow") {+ ctx.beginPath();+ const x1 = ann.x;+ const y1 = ann.y;+ const x2 = ann.x + ann.width;+ const y2 = ann.y + ann.height;++ // Line+ ctx.moveTo(x1, y1);+ ctx.lineTo(x2, y2);+ ctx.stroke();++ // Arrowhead+ const angle = Math.atan2(y2 - y1, x2 - x1);+ const headLen = 10 + ann.strokeWidth; // scale with stroke?+ ctx.beginPath();+ ctx.moveTo(x2, y2);+ ctx.lineTo(+ x2 - headLen * Math.cos(angle - Math.PI / 6),+ y2 - headLen * Math.sin(angle - Math.PI / 6),+ );+ ctx.lineTo(+ x2 - headLen * Math.cos(angle + Math.PI / 6),+ y2 - headLen * Math.sin(angle + Math.PI / 6),+ );+ ctx.lineTo(x2, y2);+ ctx.fillStyle = ann.strokeColor;+ ctx.fill();+ } else if (ann.type === "text" && ann.text) {+ ctx.fillStyle = ann.strokeColor; // Text uses stroke color+ ctx.font = `${ann.height}px sans-serif`;+ ctx.fillText(ann.text, ann.x, ann.y + ann.height); // text baseline bottomish+ }++ ctx.restore();+ }+ };++ const applyMaskAnnotations = (+ ctx: CanvasRenderingContext2D,+ source: HTMLCanvasElement,+ annotations: Annotation[],+ ) => {+ for (const ann of annotations) {+ if (ann.type !== "mask") continue;++ const startX = Math.max(0, Math.min(ann.x, ann.x + ann.width));+ const startY = Math.max(0, Math.min(ann.y, ann.y + ann.height));+ const endX = Math.min(source.width, Math.max(ann.x, ann.x + ann.width));+ const endY = Math.min(source.height, Math.max(ann.y, ann.y + ann.height));++ const regionWidth = endX - startX;+ const regionHeight = endY - startY;+ if (regionWidth <= 0 || regionHeight <= 0) continue;++ const level = Math.max(1, ann.maskLevel ?? 16);+ const type = ann.maskType ?? "blur";++ if (type === "pixelate") {+ const blockSize = Math.max(2, Math.round(level));+ const temp = document.createElement("canvas");+ temp.width = Math.max(1, Math.floor(regionWidth / blockSize));+ temp.height = Math.max(1, Math.floor(regionHeight / blockSize));+ const tempCtx = temp.getContext("2d");+ if (!tempCtx) continue;+ tempCtx.imageSmoothingEnabled = false;+ tempCtx.drawImage(+ source,+ startX,+ startY,+ regionWidth,+ regionHeight,+ 0,+ 0,+ temp.width,+ temp.height,+ );+ const previousSmoothing = ctx.imageSmoothingEnabled;+ ctx.imageSmoothingEnabled = false;+ ctx.drawImage(+ temp,+ 0,+ 0,+ temp.width,+ temp.height,+ startX,+ startY,+ regionWidth,+ regionHeight,+ );+ ctx.imageSmoothingEnabled = previousSmoothing;+ continue;+ }++ ctx.save();+ ctx.beginPath();+ ctx.rect(startX, startY, regionWidth, regionHeight);+ ctx.clip();+ ctx.filter = `blur(${level}px)`;+ ctx.drawImage(+ source,+ startX,+ startY,+ regionWidth,+ regionHeight,+ startX,+ startY,+ regionWidth,+ regionHeight,+ );+ ctx.restore();+ }+ ctx.filter = "none";+ };+const exportImage = async (destination: "file" | "clipboard") => {setExporting(true);try {- // 1. Load the image- const img = new Image();- img.src = convertFileSrc(path);- await new Promise((resolve, reject) => {- img.onload = resolve;- img.onerror = reject;- });-- // 2. Create canvas with appropriate dimensions- // We need to account for padding, crop, etc.- // For now, let's assume simple export of the original image + background settings- // This is a simplified implementation. A robust one would replicate the CSS effects on canvas.-const canvas = document.createElement("canvas");const ctx = canvas.getContext("2d");if (!ctx) throw new Error("Could not get canvas context");- // Calculate dimensions based on project settings- // This logic needs to match Preview.tsx- const padding = project.background.padding * 2; // Scale factor?- // In Preview.tsx: padding: `${padding * 2}px`- // But here we are working with actual pixels.- // Let's assume padding is in pixels relative to the image size?- // Or we need a consistent scale.- // For simplicity, let's just use the image size + padding.-- // TODO: Implement proper rendering logic matching CSS- // For now, we'll just export the original image to demonstrate the flow- canvas.width = img.width;- canvas.height = img.height;- ctx.drawImage(img, 0, 0);+ const frame = latestFrame();+ if (frame) {+ canvas.width = frame.width;+ canvas.height = frame.data.height;+ ctx.putImageData(frame.data, 0, 0);+ } else {+ // Fallback to loading file+ const img = new Image();+ img.src = convertFileSrc(path);+ await new Promise((resolve, reject) => {+ img.onload = resolve;+ img.onerror = reject;+ });+ canvas.width = img.width;+ canvas.height = img.height;+ ctx.drawImage(img, 0, 0);+ }++ const sourceCanvas = document.createElement("canvas");+ sourceCanvas.width = canvas.width;+ sourceCanvas.height = canvas.height;+ const sourceCtx = sourceCanvas.getContext("2d");+ if (!sourceCtx) throw new Error("Could not get source canvas context");+ sourceCtx.drawImage(canvas, 0, 0);++ applyMaskAnnotations(ctx, sourceCanvas, annotations);+ drawAnnotations(ctx, annotations);// 3. Exportconst blob = await new Promise<Blob | null>((resolve) =>diff --git a/apps/desktop/src/routes/screenshot-editor/Header.tsx b/apps/desktop/src/routes/screenshot-editor/Header.tsxindex 62acc9e3c..46c75070c 100644--- a/apps/desktop/src/routes/screenshot-editor/Header.tsx+++ b/apps/desktop/src/routes/screenshot-editor/Header.tsx@@ -1,174 +1,166 @@import { Button } from "@cap/ui-solid";+import { DropdownMenu } from "@kobalte/core/dropdown-menu";import { getCurrentWindow } from "@tauri-apps/api/window";import { ask } from "@tauri-apps/plugin-dialog";import { remove } from "@tauri-apps/plugin-fs";import { revealItemInDir } from "@tauri-apps/plugin-opener";import { type as ostype } from "@tauri-apps/plugin-os";import { cx } from "cva";-import { createEffect, createSignal, Show } from "solid-js";+import { createEffect, createSignal, Suspense } from "solid-js";import Tooltip from "~/components/Tooltip";import CaptionControlsWindows11 from "~/components/titlebar/controls/CaptionControlsWindows11";import { commands } from "~/utils/tauri";+import IconCapCrop from "~icons/cap/crop";import IconCapTrash from "~icons/cap/trash";+import IconCapZoomIn from "~icons/cap/zoom-in";+import IconCapZoomOut from "~icons/cap/zoom-out";import IconLucideCopy from "~icons/lucide/copy";import IconLucideFolder from "~icons/lucide/folder";+import IconLucideMoreHorizontal from "~icons/lucide/more-horizontal";+import IconLucideSave from "~icons/lucide/save";+import { AnnotationTools } from "./AnnotationTools";import { useScreenshotEditorContext } from "./context";-import PresetsDropdown from "./PresetsDropdown";-import { EditorButton } from "./ui";+import PresetsSubMenu from "./PresetsDropdown";+import { AspectRatioSelect } from "./popovers/AspectRatioSelect";+import { BackgroundSettingsPopover } from "./popovers/BackgroundSettingsPopover";+import { BorderPopover } from "./popovers/BorderPopover";+import { PaddingPopover } from "./popovers/PaddingPopover";+import { RoundingPopover } from "./popovers/RoundingPopover";+import { ShadowPopover } from "./popovers/ShadowPopover";+import {+ DropdownItem,+ EditorButton,+ MenuItemList,+ PopperContent,+ Slider,+ topSlideAnimateClasses,+} from "./ui";export function Header() {- const { path, setDialog } = useScreenshotEditorContext();+ const { path, setDialog, project, latestFrame } =+ useScreenshotEditorContext();- // Extract filename from path- const filename = () => {- if (!path) return "Screenshot";- const parts = path.split(/[/\\]/);- return parts[parts.length - 1] || "Screenshot";+ const cropDialogHandler = () => {+ const frame = latestFrame();+ setDialog({+ open: true,+ type: "crop",+ position: {+ ...(project.background.crop?.position ?? { x: 0, y: 0 }),+ },+ size: {+ ...(project.background.crop?.size ?? {+ x: frame?.width ?? 0,+ y: frame?.data.height ?? 0,+ }),+ },+ });};return (<divdata-tauri-drag-region- class="flex relative flex-row items-center w-full h-14"+ class="flex relative flex-row items-center w-full h-14 px-4 border-b border-gray-3 bg-gray-1 dark:bg-gray-2 shrink-0 z-20 gap-4 justify-between">- <div- data-tauri-drag-region- class={cx("flex flex-row flex-1 gap-2 items-center px-4 h-full")}- >- {ostype() === "macos" && <div class="h-full w-[4rem]" />}+ <div class="flex items-center gap-4">+ {ostype() === "macos" && <div class="w-14" />}+ </div>+ <div class="flex items-center gap-2 absolute left-1/2 -translate-x-1/2">+ <AspectRatioSelect /><EditorButton- onClick={async () => {- if (await ask("Are you sure you want to delete this screenshot?")) {- await remove(path);- await getCurrentWindow().close();- }- }}- tooltipText="Delete screenshot"- leftIcon={<IconCapTrash class="w-5" />}+ tooltipText="Crop Image"+ onClick={cropDialogHandler}+ leftIcon={<IconCapCrop class="size-4" />}/>- <EditorButton- onClick={() => {- revealItemInDir(path);- }}- tooltipText="Open containing folder"- leftIcon={<IconLucideFolder class="w-5" />}- />-- <div class="flex flex-row items-center">- <NameEditor name={filename()} />- </div>+ <div class="w-px h-6 bg-gray-4 mx-1" />+ <AnnotationTools />+ <div class="w-px h-6 bg-gray-4 mx-1" />+ <BackgroundSettingsPopover />+ <PaddingPopover />+ <RoundingPopover />+ <ShadowPopover />+ <BorderPopover /></div><div- data-tauri-drag-region- class="flex flex-col justify-center px-4 border-x border-black-transparent-10"- >- <PresetsDropdown />- </div>-- <div- data-tauri-drag-regionclass={cx(- "flex-1 h-full flex flex-row items-center gap-2 pl-2 justify-end px-4",+ "flex flex-row items-center gap-2",ostype() !== "windows" && "pr-2",)}>+ <div class="w-px h-6 bg-gray-4 mx-1" />+<EditorButtononClick={() => {commands.copyScreenshotToClipboard(path);}}tooltipText="Copy to Clipboard"- leftIcon={<IconLucideCopy class="w-5" />}+ leftIcon={<IconLucideCopy class="w-4" />}/>- <Button- variant="dark"- class="flex gap-1.5 justify-center h-[40px] w-full max-w-[100px]"- onClick={() => {- setDialog({ type: "export", open: true });- }}- >- <UploadIcon class="text-gray-1 size-4" />- Export- </Button>- {ostype() === "windows" && <CaptionControlsWindows11 />}- </div>- </div>- );-}+ <EditorButton+ tooltipText="Export / Share"+ onClick={() => setDialog({ type: "export", open: true })}+ leftIcon={<IconLucideSave class="size-4" />}+ />-const UploadIcon = (props: any) => {- return (- <svg- width={20}- height={20}- viewBox="0 0 20 20"- fill="none"- xmlns="http://www.w3.org/2000/svg"- {...props}- >- <path- d="M16.6667 10.625V14.1667C16.6667 15.5474 15.5474 16.6667 14.1667 16.6667H5.83333C4.45262 16.6667 3.33333 15.5474 3.33333 14.1667V10.625"- stroke="currentColor"- stroke-width={1.66667}- stroke-linecap="round"- stroke-linejoin="round"- />- <path- d="M9.99999 3.33333V12.7083M9.99999 3.33333L13.75 7.08333M9.99999 3.33333L6.24999 7.08333"- stroke="currentColor"- stroke-width={1.66667}- stroke-linecap="round"- stroke-linejoin="round"- />- </svg>- );-};+ <DropdownMenu gutter={8} placement="bottom-end">+ <EditorButton<typeof DropdownMenu.Trigger>+ as={DropdownMenu.Trigger}+ tooltipText="More Actions"+ leftIcon={<IconLucideMoreHorizontal class="size-4" />}+ />+ <DropdownMenu.Portal>+ <Suspense>+ <PopperContent<typeof DropdownMenu.Content>+ as={DropdownMenu.Content}+ class={cx("min-w-[200px]", topSlideAnimateClasses)}+ >+ <MenuItemList<typeof DropdownMenu.Group>+ as={DropdownMenu.Group}+ class="p-1"+ >+ <DropdownItem+ onClick={() => {+ revealItemInDir(path);+ }}+ >+ <IconLucideFolder class="size-4 text-gray-11" />+ <span>Open Folder</span>+ </DropdownItem>+ <DropdownItem+ onClick={async () => {+ if (+ await ask(+ "Are you sure you want to delete this screenshot?",+ )+ ) {+ await remove(path);+ await getCurrentWindow().close();+ }+ }}+ >+ <IconCapTrash class="size-4 text-gray-11" />+ <span>Delete</span>+ </DropdownItem>+ </MenuItemList>-function NameEditor(props: { name: string }) {- let prettyNameRef: HTMLInputElement | undefined;- let prettyNameMeasureRef: HTMLSpanElement | undefined;- const [truncated, setTruncated] = createSignal(false);- const [prettyName, setPrettyName] = createSignal(props.name);+ <DropdownMenu.Separator class="h-px bg-gray-4 mx-1 my-1" />- createEffect(() => {- if (!prettyNameRef || !prettyNameMeasureRef) return;- prettyNameMeasureRef.textContent = prettyName();- const inputWidth = prettyNameRef.offsetWidth;- const textWidth = prettyNameMeasureRef.offsetWidth;- setTruncated(inputWidth < textWidth);- });+ <MenuItemList<typeof DropdownMenu.Group>+ as={DropdownMenu.Group}+ class="p-1"+ >+ <PresetsSubMenu />+ </MenuItemList>+ </PopperContent>+ </Suspense>+ </DropdownMenu.Portal>+ </DropdownMenu>- return (- <Tooltip disabled={!truncated()} content={props.name}>- <div class="flex relative flex-row items-center text-sm font-normal font-inherit tracking-inherit text-gray-12">- <input- ref={prettyNameRef}- class={cx(- "absolute inset-0 px-px m-0 opacity-0 overflow-hidden focus:opacity-100 bg-transparent border-b border-transparent focus:border-gray-7 focus:outline-none peer whitespace-pre",- truncated() && "truncate",- (prettyName().length < 1 || prettyName().length > 100) &&- "focus:border-red-500",- )}- value={prettyName()}- readOnly // Read only for now as we don't have rename logic- onInput={(e) => setPrettyName(e.currentTarget.value)}- onBlur={async () => {- setPrettyName(props.name);- }}- onKeyDown={(e) => {- if (e.key === "Enter" || e.key === "Escape") {- prettyNameRef?.blur();- }- }}- />- {/* Hidden span for measuring text width */}- <span- ref={prettyNameMeasureRef}- class="pointer-events-none max-w-[200px] px-px m-0 peer-focus:opacity-0 border-b border-transparent truncate whitespace-pre"- />+ {ostype() === "windows" && <CaptionControlsWindows11 />}</div>- </Tooltip>+ </div>);}diff --git a/apps/desktop/src/routes/screenshot-editor/PresetsDropdown.tsx b/apps/desktop/src/routes/screenshot-editor/PresetsDropdown.tsxindex 655dca537..b4cf0ae26 100644--- a/apps/desktop/src/routes/screenshot-editor/PresetsDropdown.tsx+++ b/apps/desktop/src/routes/screenshot-editor/PresetsDropdown.tsx@@ -1,32 +1,34 @@import { DropdownMenu as KDropdownMenu } from "@kobalte/core/dropdown-menu";import { cx } from "cva";import { Suspense } from "solid-js";-import IconCapChevronDown from "~icons/cap/chevron-down";import IconCapCirclePlus from "~icons/cap/circle-plus";import IconCapPresets from "~icons/cap/presets";+import IconLucideChevronRight from "~icons/lucide/chevron-right";import {DropdownItem,- EditorButton,MenuItemList,PopperContent,- topCenterAnimateClasses,+ topSlideAnimateClasses,} from "./ui";-export function PresetsDropdown() {+export function PresetsSubMenu() {return (- <KDropdownMenu gutter={8} placement="bottom">- <EditorButton<typeof KDropdownMenu.Trigger>- as={KDropdownMenu.Trigger}- leftIcon={<IconCapPresets />}- rightIcon={<IconCapChevronDown />}+ <KDropdownMenu.Sub gutter={8} placement="right-start">+ <KDropdownMenu.SubTrigger+ as={DropdownItem}+ class="justify-between cursor-default">- Presets- </EditorButton>+ <div class="flex items-center gap-2">+ <IconCapPresets />+ <span>Presets</span>+ </div>+ <IconLucideChevronRight class="size-3 text-gray-10" />+ </KDropdownMenu.SubTrigger><KDropdownMenu.Portal><Suspense>- <PopperContent<typeof KDropdownMenu.Content>- as={KDropdownMenu.Content}- class={cx("w-72 max-h-56", topCenterAnimateClasses)}+ <PopperContent<typeof KDropdownMenu.SubContent>+ as={KDropdownMenu.SubContent}+ class={cx("w-72 max-h-56", topSlideAnimateClasses)}><MenuItemList<typeof KDropdownMenu.Group>as={KDropdownMenu.Group}@@ -48,8 +50,8 @@ export function PresetsDropdown() {</PopperContent></Suspense></KDropdownMenu.Portal>- </KDropdownMenu>+ </KDropdownMenu.Sub>);}-export default PresetsDropdown;+export default PresetsSubMenu;diff --git a/apps/desktop/src/routes/screenshot-editor/Preview.tsx b/apps/desktop/src/routes/screenshot-editor/Preview.tsxindex 988548c40..a0362d96d 100644--- a/apps/desktop/src/routes/screenshot-editor/Preview.tsx+++ b/apps/desktop/src/routes/screenshot-editor/Preview.tsx@@ -6,32 +6,50 @@ import Tooltip from "~/components/Tooltip";import IconCapCrop from "~icons/cap/crop";import IconCapZoomIn from "~icons/cap/zoom-in";import IconCapZoomOut from "~icons/cap/zoom-out";+import { ASPECT_RATIOS } from "../editor/projectConfig";import { EditorButton, Slider } from "../editor/ui";-import AspectRatioSelect from "./AspectRatioSelect";import { useScreenshotEditorContext } from "./context";+import { AspectRatioSelect } from "./popovers/AspectRatioSelect";-// CSS for checkerboard grid (adaptive to light/dark mode)+// CSS for checkerboard gridconst gridStyle = {+ "background-color": "white","background-image":- "linear-gradient(45deg, rgba(128,128,128,0.12) 25%, transparent 25%), " +- "linear-gradient(-45deg, rgba(128,128,128,0.12) 25%, transparent 25%), " +- "linear-gradient(45deg, transparent 75%, rgba(128,128,128,0.12) 75%), " +- "linear-gradient(-45deg, transparent 75%, rgba(128,128,128,0.12) 75%)",- "background-size": "40px 40px",- "background-position": "0 0, 0 20px, 20px -20px, -20px 0px",- "background-color": "rgba(200,200,200,0.08)",+ "linear-gradient(45deg, #f0f0f0 25%, transparent 25%), linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%), linear-gradient(-45deg, transparent 75%, #f0f0f0 75%)",+ "background-size": "20px 20px",+ "background-position": "0 0, 0 10px, 10px -10px, -10px 0px",};-export function Preview() {- const { path, project, setDialog, latestFrame } =+import { AnnotationLayer } from "./AnnotationLayer";++export function Preview(props: { zoom: number; setZoom: (z: number) => void }) {+ const { path, project, setDialog, latestFrame, annotations, activeTool } =useScreenshotEditorContext();- const [zoom, setZoom] = createSignal(1);let canvasRef: HTMLCanvasElement | undefined;const [canvasContainerRef, setCanvasContainerRef] =createSignal<HTMLDivElement>();const containerBounds = createElementBounds(canvasContainerRef);+ const [pan, setPan] = createSignal({ x: 0, y: 0 });++ const handleWheel = (e: WheelEvent) => {+ e.preventDefault();+ if (e.ctrlKey) {+ // Zoom+ const delta = -e.deltaY;+ const zoomStep = 0.005;+ const newZoom = Math.max(0.1, Math.min(3, props.zoom + delta * zoomStep));+ props.setZoom(newZoom);+ } else {+ // Pan+ setPan((p) => ({+ x: p.x - e.deltaX,+ y: p.y - e.deltaY,+ }));+ }+ };+createEffect(() => {const frame = latestFrame();if (frame && canvasRef) {@@ -42,44 +60,38 @@ export function Preview() {}});- const cropDialogHandler = () => {- // We use the original image for cropping- // We can get dimensions from the latest frame or load the image- // For now, let's just open the dialog and let it handle loading- setDialog({- open: true,- type: "crop",- position: {- ...(project.background.crop?.position ?? { x: 0, y: 0 }),- },- size: {- ...(project.background.crop?.size ?? {- x: latestFrame()?.width ?? 0,- y: latestFrame()?.height ?? 0,- }),- },- });- };-return (- <div class="flex flex-col flex-1 rounded-xl border bg-gray-1 dark:bg-gray-2 border-gray-3">- {/* Top Toolbar */}- <div class="flex gap-3 justify-center p-3">- <AspectRatioSelect />- <EditorButton- tooltipText="Crop Image"- onClick={cropDialogHandler}- leftIcon={<IconCapCrop class="w-5 text-gray-12" />}- >- Crop- </EditorButton>- </div>-+ <div class="flex flex-col flex-1 overflow-hidden bg-gray-1 dark:bg-gray-2">{/* Preview Area */}<divref={setCanvasContainerRef}- class="flex-1 relative flex items-center justify-center bg-[--bg-subtle] overflow-hidden"+ class="flex-1 relative flex items-center justify-center overflow-hidden outline-none"+ style={gridStyle}+ onWheel={handleWheel}>+ <div class="absolute left-4 bottom-4 z-10 flex items-center gap-2 bg-gray-1 dark:bg-gray-3 rounded-lg shadow-sm p-1 border border-gray-4">+ <EditorButton+ tooltipText="Zoom Out"+ onClick={() => props.setZoom(Math.max(0.1, props.zoom - 0.1))}+ >+ <IconCapZoomOut class="size-4" />+ </EditorButton>+ <Slider+ class="w-20"+ minValue={0.1}+ maxValue={3}+ step={0.1}+ value={[props.zoom]}+ onChange={([v]) => props.setZoom(v)}+ formatTooltip={(v) => `${Math.round(v * 100)}%`}+ />+ <EditorButton+ tooltipText="Zoom In"+ onClick={() => props.setZoom(Math.min(3, props.zoom + 0.1))}+ >+ <IconCapZoomIn class="size-4" />+ </EditorButton>+ </div><Showwhen={!!latestFrame()}fallback={<div class="text-gray-11">Loading preview...</div>}@@ -99,6 +111,63 @@ export function Preview() {const frameWidth = () => frame().width;const frameHeight = () => frame().data.height;+ const bounds = createMemo(() => {+ const crop = project.background.crop;+ let minX = crop ? crop.position.x : 0;+ let minY = crop ? crop.position.y : 0;+ let maxX = crop ? crop.position.x + crop.size.x : frameWidth();+ let maxY = crop ? crop.position.y + crop.size.y : frameHeight();++ for (const ann of annotations) {+ const ax1 = ann.x;+ const ay1 = ann.y;+ const ax2 = ann.x + ann.width;+ const ay2 = ann.y + ann.height;++ const left = Math.min(ax1, ax2);+ const right = Math.max(ax1, ax2);+ const top = Math.min(ay1, ay2);+ const bottom = Math.max(ay1, ay2);++ minX = Math.min(minX, left);+ maxX = Math.max(maxX, right);+ minY = Math.min(minY, top);+ maxY = Math.max(maxY, bottom);+ }++ let x = minX;+ let y = minY;+ let width = maxX - minX;+ let height = maxY - minY;++ if (project.aspectRatio) {+ const ratioConf = ASPECT_RATIOS[project.aspectRatio];+ if (ratioConf) {+ const targetRatio = ratioConf.ratio[0] / ratioConf.ratio[1];+ const currentRatio = width / height;++ if (currentRatio > targetRatio) {+ const newHeight = width / targetRatio;+ const padY = (newHeight - height) / 2;+ y -= padY;+ height = newHeight;+ } else {+ const newWidth = height * targetRatio;+ const padX = (newWidth - width) / 2;+ x -= padX;+ width = newWidth;+ }+ }+ }++ return {+ x,+ y,+ width,+ height,+ };+ });+const availableWidth = () =>Math.max((containerBounds.width ?? 0) - padding * 2, 0);const availableHeight = () =>@@ -111,9 +180,9 @@ export function Preview() {return width / height;};- const frameAspect = () => {- const width = frameWidth();- const height = frameHeight();+ const contentAspect = () => {+ const width = bounds().width;+ const height = bounds().height;if (width === 0 || height === 0) return containerAspect();return width / height;};@@ -121,69 +190,199 @@ export function Preview() {const size = () => {let width: number;let height: number;- if (frameAspect() < containerAspect()) {+ if (contentAspect() < containerAspect()) {height = availableHeight();- width = height * frameAspect();+ width = height * contentAspect();} else {width = availableWidth();- height = width / frameAspect();+ height = width / contentAspect();}return {- width: Math.min(width, frameWidth()),- height: Math.min(height, frameHeight()),+ width: Math.min(width, bounds().width),+ height: Math.min(height, bounds().height),};};+ const fitScale = () => {+ if (bounds().width === 0) return 1;+ return size().width / bounds().width;+ };++ const cssScale = () => fitScale() * props.zoom;+ const scaledWidth = () => frameWidth() * cssScale();+ const scaledHeight = () => frameHeight() * cssScale();+ const canvasLeft = () => -bounds().x * cssScale();+ const canvasTop = () => -bounds().y * cssScale();++ let maskCanvasRef: HTMLCanvasElement | undefined;++ const renderMaskOverlays = () => {+ const frameData = latestFrame();+ if (!maskCanvasRef) return;+ const ctx = maskCanvasRef.getContext("2d");+ if (!ctx) return;+ if (!frameData) {+ maskCanvasRef.width = 0;+ maskCanvasRef.height = 0;+ return;+ }++ const masks = annotations.filter((ann) => ann.type === "mask");++ if (+ maskCanvasRef.width !== frameData.width ||+ maskCanvasRef.height !== frameData.data.height+ ) {+ maskCanvasRef.width = frameData.width;+ maskCanvasRef.height = frameData.data.height;+ }++ ctx.clearRect(0, 0, maskCanvasRef.width, maskCanvasRef.height);++ if (!masks.length || !canvasRef) return;++ const source = canvasRef;++ for (const mask of masks) {+ const startX = Math.max(+ 0,+ Math.min(mask.x, mask.x + mask.width),+ );+ const startY = Math.max(+ 0,+ Math.min(mask.y, mask.y + mask.height),+ );+ const endX = Math.min(+ frameData.width,+ Math.max(mask.x, mask.x + mask.width),+ );+ const endY = Math.min(+ frameData.data.height,+ Math.max(mask.y, mask.y + mask.height),+ );++ const regionWidth = endX - startX;+ const regionHeight = endY - startY;++ if (regionWidth <= 0 || regionHeight <= 0) continue;++ const level = Math.max(1, mask.maskLevel ?? 16);+ const type = mask.maskType ?? "blur";++ if (type === "pixelate") {+ const blockSize = Math.max(2, Math.round(level));+ const temp = document.createElement("canvas");+ temp.width = Math.max(1, Math.floor(regionWidth / blockSize));+ temp.height = Math.max(+ 1,+ Math.floor(regionHeight / blockSize),+ );+ const tempCtx = temp.getContext("2d");+ if (!tempCtx) continue;+ tempCtx.imageSmoothingEnabled = false;+ tempCtx.drawImage(+ source,+ startX,+ startY,+ regionWidth,+ regionHeight,+ 0,+ 0,+ temp.width,+ temp.height,+ );+ ctx.imageSmoothingEnabled = false;+ ctx.drawImage(+ temp,+ 0,+ 0,+ temp.width,+ temp.height,+ startX,+ startY,+ regionWidth,+ regionHeight,+ );+ ctx.imageSmoothingEnabled = true;+ continue;+ }++ ctx.save();+ ctx.beginPath();+ ctx.rect(startX, startY, regionWidth, regionHeight);+ ctx.clip();+ ctx.filter = `blur(${level}px)`;+ ctx.drawImage(+ source,+ startX,+ startY,+ regionWidth,+ regionHeight,+ startX,+ startY,+ regionWidth,+ regionHeight,+ );+ ctx.restore();+ }++ ctx.filter = "none";+ };++ createEffect(renderMaskOverlays);+return (<div class="flex overflow-hidden absolute inset-0 justify-center items-center h-full">- <canvas- ref={canvasRef}- width={frameWidth()}- height={frameHeight()}+ <divstyle={{- width: `${size().width * zoom()}px`,- height: `${size().height * zoom()}px`,- ...gridStyle,+ width: `${size().width * props.zoom}px`,+ height: `${size().height * props.zoom}px`,+ position: "relative",+ transform: `translate(${pan().x}px, ${pan().y}px)`,+ "will-change": "transform",}}- class="rounded shadow-lg transition-all duration-200 ease-out"- />+ class="shadow-lg block"+ >+ <canvas+ ref={canvasRef}+ width={frameWidth()}+ height={frameHeight()}+ style={{+ position: "absolute",+ left: `${canvasLeft()}px`,+ top: `${canvasTop()}px`,+ width: `${scaledWidth()}px`,+ height: `${scaledHeight()}px`,+ }}+ />+ <canvas+ ref={(el) => {+ maskCanvasRef = el ?? maskCanvasRef;+ renderMaskOverlays();+ }}+ width={frameWidth()}+ height={frameHeight()}+ style={{+ position: "absolute",+ left: `${canvasLeft()}px`,+ top: `${canvasTop()}px`,+ width: `${scaledWidth()}px`,+ height: `${scaledHeight()}px`,+ "pointer-events": "none",+ }}+ />+ <AnnotationLayer+ bounds={bounds()}+ cssWidth={size().width * props.zoom}+ cssHeight={size().height * props.zoom}+ />+ </div></div>);}}</Show></div>-- {/* Bottom Toolbar (Zoom) */}- <div class="flex overflow-hidden z-10 flex-row gap-3 justify-between items-center p-5 h-[72px]">- <div class="flex-1">{/* Left side spacer or info */}</div>-- <div class="flex flex-row flex-1 gap-4 justify-end items-center">- <div class="flex-1" />-- <Tooltip kbd={["meta", "-"]} content="Zoom out">- <IconCapZoomOut- onClick={() => setZoom((z) => Math.max(0.1, z - 0.1))}- class="text-gray-12 size-5 will-change-[opacity] transition-opacity hover:opacity-70 cursor-pointer"- />- </Tooltip>- <Tooltip kbd={["meta", "+"]} content="Zoom in">- <IconCapZoomIn- onClick={() => setZoom((z) => Math.min(3, z + 0.1))}- class="text-gray-12 size-5 will-change-[opacity] transition-opacity hover:opacity-70 cursor-pointer"- />- </Tooltip>- <Slider- class="w-24"- minValue={0.1}- maxValue={3}- step={0.1}- value={[zoom()]}- onChange={([v]) => setZoom(v)}- formatTooltip={(v) => `${Math.round(v * 100)}%`}- />- </div>- </div></div>);}diff --git a/apps/desktop/src/routes/screenshot-editor/context.tsx b/apps/desktop/src/routes/screenshot-editor/context.tsxindex 55f160619..a2de8e972 100644--- a/apps/desktop/src/routes/screenshot-editor/context.tsx+++ b/apps/desktop/src/routes/screenshot-editor/context.tsx@@ -1,15 +1,15 @@import { createContextProvider } from "@solid-primitives/context";import { trackStore } from "@solid-primitives/deep";import { debounce } from "@solid-primitives/scheduled";+import { convertFileSrc } from "@tauri-apps/api/core";import { createEffect, createResource, createSignal, on } from "solid-js";import { createStore, reconcile, unwrap } from "solid-js/store";import { createImageDataWS, createLazySignal } from "~/utils/socket";import {- type AspectRatio,+ type Annotation,+ type AnnotationType,type AudioConfiguration,- type BackgroundConfiguration,type Camera,- type CameraPosition,type CursorConfiguration,commands,type HotkeysConfiguration,@@ -18,6 +18,7 @@ import {} from "~/utils/tauri";export type ScreenshotProject = ProjectConfiguration;+export type { Annotation, AnnotationType };export type CurrentDialog =| { type: "createPreset" }@@ -39,7 +40,7 @@ const DEFAULT_CAMERA: Camera = {advancedShadow: null,shape: "square",roundingType: "squircle",-};+} as unknown as Camera;const DEFAULT_AUDIO: AudioConfiguration = {mute: false,@@ -92,75 +93,228 @@ const DEFAULT_PROJECT: ScreenshotProject = {timeline: null,captions: null,clips: [],-};+ annotations: [],+} as unknown as ScreenshotProject;-export const [ScreenshotEditorProvider, useScreenshotEditorContext] =- createContextProvider(() => {- const [project, setProject] =- createStore<ScreenshotProject>(DEFAULT_PROJECT);- const [dialog, setDialog] = createSignal<DialogState>({- open: false,- });-- const [latestFrame, setLatestFrame] = createLazySignal<{- width: number;- data: ImageData;- }>();-- const [editorInstance] = createResource(async () => {- // @ts-expect-error - types not updated yet- const instance = await commands.createScreenshotEditorInstance();-- if (instance.config) {- setProject(reconcile(instance.config));+function createScreenshotEditorContext() {+ const [project, setProject] = createStore<ScreenshotProject>(DEFAULT_PROJECT);+ const [annotations, setAnnotations] = createStore<Annotation[]>([]);+ const [selectedAnnotationId, setSelectedAnnotationId] = createSignal<+ string | null+ >(null);+ const [activeTool, setActiveTool] = createSignal<AnnotationType | "select">(+ "select",+ );++ const [dialog, setDialog] = createSignal<DialogState>({+ open: false,+ });++ const [latestFrame, setLatestFrame] = createLazySignal<{+ width: number;+ data: ImageData;+ }>();++ const [editorInstance] = createResource(async () => {+ const instance = await commands.createScreenshotEditorInstance();++ if (instance.config) {+ setProject(reconcile(instance.config));+ if (instance.config.annotations) {+ setAnnotations(reconcile(instance.config.annotations));}+ }- const [_ws, isConnected] = createImageDataWS(- instance.framesSocketUrl,- setLatestFrame,- );+ // Load initial frame from disk in case WS fails or is slow+ if (instance.path) {+ const img = new Image();+ img.crossOrigin = "anonymous";+ img.src = convertFileSrc(instance.path);+ img.onload = () => {+ const canvas = document.createElement("canvas");+ canvas.width = img.naturalWidth;+ canvas.height = img.naturalHeight;+ const ctx = canvas.getContext("2d");+ if (ctx) {+ ctx.drawImage(img, 0, 0);+ const data = ctx.getImageData(+ 0,+ 0,+ img.naturalWidth,+ img.naturalHeight,+ );+ setLatestFrame({ width: img.naturalWidth, data });+ }+ };+ }- return instance;- });+ const [_ws, _isConnected] = createImageDataWS(+ instance.framesSocketUrl,+ setLatestFrame,+ );- const saveConfig = debounce((config: ProjectConfiguration) => {- // @ts-expect-error - command signature update- commands.updateScreenshotConfig(config, true);- }, 1000);+ return instance;+ });- createEffect(- on([() => trackStore(project), editorInstance], async ([, instance]) => {+ const saveConfig = debounce((config: ProjectConfiguration) => {+ commands.updateScreenshotConfig(config, true);+ }, 1000);++ createEffect(+ on(+ [+ () => trackStore(project),+ () => trackStore(annotations),+ editorInstance,+ ],+ async ([, , instance]) => {if (!instance) return;- const config = unwrap(project);+ const config = {+ ...unwrap(project),+ annotations: unwrap(annotations),+ };- // @ts-expect-error - command signature updatecommands.updateScreenshotConfig(config, false);saveConfig(config);- }),- );+ },+ ),+ );++ // History Implementation+ const [history, setHistory] = createStore<{+ past: { project: ScreenshotProject; annotations: Annotation[] }[];+ future: { project: ScreenshotProject; annotations: Annotation[] }[];+ }>({+ past: [],+ future: [],+ });++ type HistorySnapshot = {+ project: ScreenshotProject;+ annotations: Annotation[];+ };- // Mock history for now or implement if needed- const projectHistory = {- pause: () => () => {},- resume: () => {},- undo: () => {},- redo: () => {},- canUndo: () => false,- canRedo: () => false,- isPaused: () => false,+ let pausedHistorySnapshot: HistorySnapshot | null = null;+ let hasPausedHistoryChanges = false;+ const [historyPauseCount, setHistoryPauseCount] = createSignal(0);++ createEffect(+ on([() => trackStore(project), () => trackStore(annotations)], () => {+ if (historyPauseCount() > 0) {+ hasPausedHistoryChanges = true;+ }+ }),+ );++ const pushHistory = (snapshot: HistorySnapshot | null = null) => {+ const state = snapshot ?? {+ project: structuredClone(unwrap(project)),+ annotations: structuredClone(unwrap(annotations)),};+ setHistory("past", (p) => [...p, state]);+ setHistory("future", []);+ };- return {- get path() {- return editorInstance()?.path ?? "";- },- project,- setProject,- projectHistory,- dialog,- setDialog,- latestFrame,- editorInstance,+ const pauseHistory = () => {+ if (historyPauseCount() === 0) {+ pausedHistorySnapshot = {+ project: structuredClone(unwrap(project)),+ annotations: structuredClone(unwrap(annotations)),+ };+ hasPausedHistoryChanges = false;+ }++ setHistoryPauseCount((count) => count + 1);++ let resumed = false;++ return () => {+ if (resumed) return;+ resumed = true;++ setHistoryPauseCount((count) => {+ const next = Math.max(0, count - 1);++ if (next === 0) {+ if (pausedHistorySnapshot && hasPausedHistoryChanges) {+ pushHistory(pausedHistorySnapshot);+ }++ pausedHistorySnapshot = null;+ hasPausedHistoryChanges = false;+ }++ return next;+ });};- }, null!);+ };++ const undo = () => {+ if (history.past.length === 0) return;+ const previous = history.past[history.past.length - 1];+ const current = {+ project: structuredClone(unwrap(project)),+ annotations: structuredClone(unwrap(annotations)),+ };++ setHistory("past", (p) => p.slice(0, -1));+ setHistory("future", (f) => [current, ...f]);++ setProject(reconcile(previous.project));+ setAnnotations(reconcile(previous.annotations));+ };++ const redo = () => {+ if (history.future.length === 0) return;+ const next = history.future[0];+ const current = {+ project: structuredClone(unwrap(project)),+ annotations: structuredClone(unwrap(annotations)),+ };++ setHistory("future", (f) => f.slice(1));+ setHistory("past", (p) => [...p, current]);++ setProject(reconcile(next.project));+ setAnnotations(reconcile(next.annotations));+ };++ const canUndo = () => history.past.length > 0;+ const canRedo = () => history.future.length > 0;++ const projectHistory = {+ push: pushHistory,+ undo,+ redo,+ canUndo,+ canRedo,+ pause: pauseHistory,+ isPaused: () => historyPauseCount() > 0,+ };++ return {+ get path() {+ return editorInstance()?.path ?? "";+ },+ project,+ setProject,+ annotations,+ setAnnotations,+ selectedAnnotationId,+ setSelectedAnnotationId,+ activeTool,+ setActiveTool,+ projectHistory,+ dialog,+ setDialog,+ latestFrame,+ editorInstance,+ };+}++export const [ScreenshotEditorProvider, useScreenshotEditorContext] =+ createContextProvider(+ createScreenshotEditorContext,+ null as unknown as ReturnType<typeof createScreenshotEditorContext>,+ );diff --git a/apps/desktop/src/routes/screenshot-editor/popovers/AnnotationPopover.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/AnnotationPopover.tsxnew file mode 100644index 000000000..07b5c9c9e--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/popovers/AnnotationPopover.tsx@@ -0,0 +1,209 @@+import { Popover } from "@kobalte/core/popover";+import { createMemo, For, Show } from "solid-js";+import { Toggle } from "~/components/Toggle";+import IconLucidePencil from "~icons/lucide/pencil";+import IconLucideTrash from "~icons/lucide/trash-2";+import { BACKGROUND_COLORS, hexToRgb, RgbInput } from "../ColorPicker";+import { type Annotation, useScreenshotEditorContext } from "../context";+import { EditorButton, Slider } from "../ui";++export function AnnotationPopover() {+ const {+ annotations,+ setAnnotations,+ selectedAnnotationId,+ setSelectedAnnotationId,+ } = useScreenshotEditorContext();++ const selectedAnnotation = createMemo(() =>+ annotations.find((a) => a.id === selectedAnnotationId()),+ );++ const updateSelected = (key: keyof Annotation, value: any) => {+ const id = selectedAnnotationId();+ if (!id) return;+ setAnnotations((a) => a.id === id, key, value);+ };++ return (+ <Popover placement="bottom-start">+ <Popover.Trigger+ as={EditorButton}+ leftIcon={<IconLucidePencil class="size-4" />}+ tooltipText="Annotation Settings"+ disabled={!selectedAnnotation()}+ />+ <Popover.Portal>+ <Popover.Content class="z-50 w-[240px] overflow-hidden rounded-xl border border-gray-3 bg-gray-1 shadow-xl animate-in fade-in zoom-in-95 p-4">+ <div class="flex flex-col gap-4">+ <Show+ when={selectedAnnotation()}+ fallback={+ <div class="text-center text-gray-11 text-xs font-medium">+ Select an annotation to edit.+ </div>+ }+ >+ {(annotation) => (+ <div class="flex flex-col gap-4 animate-in fade-in slide-in-from-top-2">+ <div class="flex flex-col gap-2">+ <span class="text-xs font-medium text-gray-11">+ Stroke Color+ </span>+ <RgbInput+ value={+ (hexToRgb(annotation().strokeColor)?.slice(0, 3) as [+ number,+ number,+ number,+ ]) || [0, 0, 0]+ }+ onChange={(rgb) =>+ updateSelected(+ "strokeColor",+ `#${rgb+ .map((c) => c.toString(16).padStart(2, "0"))+ .join("")+ .toUpperCase()}`,+ )+ }+ />+ {/* Color Presets */}+ <div class="flex flex-wrap gap-2 mt-1">+ <For each={BACKGROUND_COLORS.slice(0, 8)}>+ {(color) => (+ <button+ type="button"+ class="size-5 rounded-full border border-gray-4 hover:scale-110 transition-transform"+ style={{ background: color }}+ onClick={() => updateSelected("strokeColor", color)}+ />+ )}+ </For>+ </div>+ </div>++ {(annotation().type === "rectangle" ||+ annotation().type === "circle") && (+ <div class="flex flex-col gap-2">+ <div class="flex flex-row justify-between items-center">+ <span class="text-xs font-medium text-gray-11">+ Fill Color+ </span>+ <Toggle+ size="sm"+ checked={annotation().fillColor !== "transparent"}+ onChange={(checked) =>+ updateSelected(+ "fillColor",+ checked ? "#000000" : "transparent",+ )+ }+ />+ </div>++ {annotation().fillColor !== "transparent" && (+ <>+ <RgbInput+ value={+ (hexToRgb(+ annotation().fillColor === "transparent"+ ? "#000000"+ : annotation().fillColor,+ )?.slice(0, 3) as [number, number, number]) || [+ 0, 0, 0,+ ]+ }+ onChange={(rgb) =>+ updateSelected(+ "fillColor",+ `#${rgb+ .map((c) => c.toString(16).padStart(2, "0"))+ .join("")+ .toUpperCase()}`,+ )+ }+ />+ <div class="flex flex-wrap gap-2 mt-1">+ <For each={BACKGROUND_COLORS.slice(0, 8)}>+ {(color) => (+ <button+ type="button"+ class="size-5 rounded-full border border-gray-4 hover:scale-110 transition-transform"+ style={{ background: color }}+ onClick={() =>+ updateSelected("fillColor", color)+ }+ />+ )}+ </For>+ </div>+ </>+ )}+ </div>+ )}++ <div class="flex flex-col gap-2">+ <span class="text-xs font-medium text-gray-11">+ Stroke Width+ </span>+ <Slider+ value={[annotation().strokeWidth]}+ onChange={([v]) => updateSelected("strokeWidth", v)}+ minValue={1}+ maxValue={20}+ step={1}+ />+ </div>++ <div class="flex flex-col gap-2">+ <span class="text-xs font-medium text-gray-11">+ Opacity+ </span>+ <Slider+ value={[annotation().opacity * 100]}+ onChange={([v]) => updateSelected("opacity", v / 100)}+ minValue={0}+ maxValue={100}+ formatTooltip="%"+ />+ </div>++ {annotation().type === "text" && (+ <div class="flex flex-col gap-2">+ <span class="text-xs font-medium text-gray-11">+ Font Size+ </span>+ <Slider+ value={[annotation().height || 24]} // Text uses height as font size roughly+ onChange={([v]) => updateSelected("height", v)}+ minValue={12}+ maxValue={100}+ step={1}+ />+ </div>+ )}++ <div class="flex justify-end mt-2">+ <EditorButton+ variant="danger"+ leftIcon={<IconLucideTrash class="size-4" />}+ onClick={() => {+ setAnnotations((prev) =>+ prev.filter((a) => a.id !== selectedAnnotationId()),+ );+ setSelectedAnnotationId(null);+ }}+ >+ Delete Annotation+ </EditorButton>+ </div>+ </div>+ )}+ </Show>+ </div>+ </Popover.Content>+ </Popover.Portal>+ </Popover>+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/popovers/AspectRatioSelect.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/AspectRatioSelect.tsxnew file mode 100644index 000000000..b218c21b2--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/popovers/AspectRatioSelect.tsx@@ -0,0 +1,103 @@+import { Select as KSelect } from "@kobalte/core/select";+import { createSignal, Show } from "solid-js";+import type { AspectRatio } from "~/utils/tauri";+import IconCapChevronDown from "~icons/cap/chevron-down";+import IconCapLayout from "~icons/cap/layout";+import IconLucideCheckCircle from "~icons/lucide/check-circle-2";+import { ASPECT_RATIOS } from "../../editor/projectConfig";+import { useScreenshotEditorContext } from "../context";+import {+ EditorButton,+ MenuItem,+ MenuItemList,+ PopperContent,+ topLeftAnimateClasses,+} from "../ui";++export function AspectRatioSelect() {+ const { project, setProject } = useScreenshotEditorContext();+ const [open, setOpen] = createSignal(false);+ let triggerSelect: HTMLDivElement | undefined;++ return (+ <KSelect<AspectRatio | "auto">+ open={open()}+ onOpenChange={setOpen}+ ref={triggerSelect}+ value={project.aspectRatio ?? "auto"}+ onChange={(v) => {+ if (v === null) return;+ setProject("aspectRatio", v === "auto" ? null : v);+ }}+ defaultValue="auto"+ options={+ ["auto", "wide", "vertical", "square", "classic", "tall"] as const+ }+ multiple={false}+ itemComponent={(props) => {+ const item = () =>+ props.item.rawValue === "auto"+ ? null+ : ASPECT_RATIOS[props.item.rawValue];++ return (+ <MenuItem<typeof KSelect.Item> as={KSelect.Item} item={props.item}>+ <KSelect.ItemLabel class="flex-1">+ {props.item.rawValue === "auto"+ ? "Auto"+ : ASPECT_RATIOS[props.item.rawValue].name}+ <Show when={item()}>+ {(item) => (+ <span class="text-gray-11">+ {"⋅"}+ {item().ratio[0]}:{item().ratio[1]}+ </span>+ )}+ </Show>+ </KSelect.ItemLabel>+ <KSelect.ItemIndicator class="ml-auto">+ <IconLucideCheckCircle />+ </KSelect.ItemIndicator>+ </MenuItem>+ );+ }}+ placement="bottom-start"+ >+ <EditorButton<typeof KSelect.Trigger>+ as={KSelect.Trigger}+ class="w-20"+ tooltipText="Aspect Ratio"+ leftIcon={<IconCapLayout class="size-4" />}+ rightIcon={+ <KSelect.Icon>+ <IconCapChevronDown class="size-4" />+ </KSelect.Icon>+ }+ rightIconEnd={true}+ >+ <KSelect.Value<AspectRatio | "auto">>+ {(state) => {+ const text = () => {+ const option = state.selectedOption();+ if (option === "auto") return "Auto";+ const ratio = ASPECT_RATIOS[option].ratio;+ return `${ratio[0]}:${ratio[1]}`;+ };+ return <>{text()}</>;+ }}+ </KSelect.Value>+ </EditorButton>+ <KSelect.Portal>+ <PopperContent<typeof KSelect.Content>+ as={KSelect.Content}+ class={topLeftAnimateClasses}+ >+ <MenuItemList<typeof KSelect.Listbox>+ as={KSelect.Listbox}+ class="w-[12.5rem]"+ />+ </PopperContent>+ </KSelect.Portal>+ </KSelect>+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsxnew file mode 100644index 000000000..d999f4dee--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx@@ -0,0 +1,532 @@+import { Popover } from "@kobalte/core/popover";+import { RadioGroup as KRadioGroup } from "@kobalte/core/radio-group";+import { Tabs as KTabs } from "@kobalte/core/tabs";+import { convertFileSrc } from "@tauri-apps/api/core";+import { appDataDir, resolveResource } from "@tauri-apps/api/path";+import { BaseDirectory, writeFile } from "@tauri-apps/plugin-fs";+import {+ batch,+ createMemo,+ createResource,+ createSignal,+ For,+ Show,+} from "solid-js";+import type { BackgroundSource } from "~/utils/tauri";+import IconCapBgBlur from "~icons/cap/bg-blur";+import IconCapCircleX from "~icons/cap/circle-x";+import IconCapImage from "~icons/cap/image";+import {+ DEFAULT_GRADIENT_FROM,+ DEFAULT_GRADIENT_TO,+ type RGBColor,+} from "../../editor/projectConfig";+import { BACKGROUND_COLORS, hexToRgb, RgbInput } from "../ColorPicker";+import { useScreenshotEditorContext } from "../context";+import { EditorButton, Field, Slider } from "../ui";++// Constants+const BACKGROUND_SOURCES = {+ wallpaper: "Wallpaper",+ image: "Image",+ color: "Color",+ gradient: "Gradient",+} satisfies Record<BackgroundSource["type"], string>;++const BACKGROUND_SOURCES_LIST = [+ "wallpaper",+ "image",+ "color",+ "gradient",+] satisfies Array<BackgroundSource["type"]>;++// Copied gradients+const BACKGROUND_GRADIENTS = [+ { from: [15, 52, 67], to: [52, 232, 158] },+ { from: [34, 193, 195], to: [253, 187, 45] },+ { from: [29, 253, 251], to: [195, 29, 253] },+ { from: [69, 104, 220], to: [176, 106, 179] },+ { from: [106, 130, 251], to: [252, 92, 125] },+ { from: [131, 58, 180], to: [253, 29, 29] },+ { from: [249, 212, 35], to: [255, 78, 80] },+ { from: [255, 94, 0], to: [255, 42, 104] },+ { from: [255, 0, 150], to: [0, 204, 255] },+ { from: [0, 242, 96], to: [5, 117, 230] },+ { from: [238, 205, 163], to: [239, 98, 159] },+ { from: [44, 62, 80], to: [52, 152, 219] },+ { from: [168, 239, 255], to: [238, 205, 163] },+ { from: [74, 0, 224], to: [143, 0, 255] },+ { from: [252, 74, 26], to: [247, 183, 51] },+ { from: [0, 255, 255], to: [255, 20, 147] },+ { from: [255, 127, 0], to: [255, 255, 0] },+ { from: [255, 0, 255], to: [0, 255, 0] },+] satisfies Array<{ from: RGBColor; to: RGBColor }>;++const WALLPAPER_NAMES = [+ "macOS/tahoe-dusk-min",+ "macOS/tahoe-dawn-min",+ "macOS/tahoe-day-min",+ "macOS/tahoe-night-min",+ "macOS/tahoe-dark",+ "macOS/tahoe-light",+ "macOS/sequoia-dark",+ "macOS/sequoia-light",+ "macOS/sonoma-clouds",+ "macOS/sonoma-dark",+ "macOS/sonoma-evening",+ "macOS/sonoma-fromabove",+ "macOS/sonoma-horizon",+ "macOS/sonoma-light",+ "macOS/sonoma-river",+ "macOS/ventura-dark",+ "macOS/ventura-semi-dark",+ "macOS/ventura",+ "blue/1",+ "blue/2",+ "blue/3",+ "blue/4",+ "blue/5",+ "blue/6",+ "purple/1",+ "purple/2",+ "purple/3",+ "purple/4",+ "purple/5",+ "purple/6",+ "dark/1",+ "dark/2",+ "dark/3",+ "dark/4",+ "dark/5",+ "dark/6",+ "orange/1",+ "orange/2",+ "orange/3",+ "orange/4",+ "orange/5",+ "orange/6",+ "orange/7",+ "orange/8",+ "orange/9",+ "orange/10",+] as const;++type WallpaperName = (typeof WALLPAPER_NAMES)[number];++const BACKGROUND_THEMES = {+ macOS: "macOS",+ dark: "Dark",+ blue: "Blue",+ purple: "Purple",+ orange: "Orange",+};++export function BackgroundSettingsPopover() {+ const { project, setProject, projectHistory } = useScreenshotEditorContext();++ let scrollRef!: HTMLDivElement;++ // Background tabs+ const [backgroundTab, setBackgroundTab] =+ createSignal<keyof typeof BACKGROUND_THEMES>("macOS");++ const [wallpapers] = createResource(async () => {+ // Only load visible wallpapers initially+ const visibleWallpaperPaths = WALLPAPER_NAMES.map(async (id) => {+ try {+ const path = await resolveResource(`assets/backgrounds/${id}.jpg`);+ return { id, path };+ } catch {+ return { id, path: null };+ }+ });++ // Load initial batch+ const initialPaths = await Promise.all(visibleWallpaperPaths);++ return initialPaths+ .filter((p): p is { id: WallpaperName; path: string } => p.path !== null)+ .map(({ id, path }) => ({+ id,+ url: convertFileSrc(path),+ rawPath: path,+ }));+ });++ const filteredWallpapers = createMemo(() => {+ const currentTab = backgroundTab();+ return wallpapers()?.filter((wp) => wp.id.startsWith(currentTab)) || [];+ });++ let fileInput!: HTMLInputElement;++ const setProjectSource = (source: BackgroundSource) => {+ setProject("background", "source", source);+ };++ // Debounced set project for history+ const debouncedSetProject = (wallpaperPath: string) => {+ const resumeHistory = projectHistory.pause();+ queueMicrotask(() => {+ batch(() => {+ setProject("background", "source", {+ type: "wallpaper",+ path: wallpaperPath,+ } as const);+ resumeHistory();+ });+ });+ };++ const ensurePaddingForBackground = () => {+ batch(() => {+ const isPaddingZero = project.background.padding === 0;+ const isRoundingZero = project.background.rounding === 0;++ if (isPaddingZero) {+ setProject("background", "padding", 10);+ }++ if (isPaddingZero && isRoundingZero) {+ setProject("background", "rounding", 8);+ }+ });+ };++ return (+ <Popover placement="bottom-start">+ <Popover.Trigger+ as={EditorButton}+ leftIcon={<IconCapImage class="size-4" />}+ tooltipText="Background Settings"+ />+ <Popover.Portal>+ <Popover.Content class="z-50 w-[400px] overflow-hidden rounded-xl border border-gray-3 bg-gray-1 shadow-xl animate-in fade-in zoom-in-95">+ <div+ ref={scrollRef}+ class="max-h-[600px] overflow-y-auto p-4 flex flex-col gap-6"+ >+ <Field+ icon={<IconCapImage class="size-4" />}+ name="Background Image"+ >+ <KTabs+ value={project.background.source.type}+ onChange={(v) => {+ const tab = v as BackgroundSource["type"];+ let newSource: BackgroundSource;+ switch (tab) {+ case "wallpaper":+ newSource = { type: "wallpaper", path: null };+ break;+ case "image":+ newSource = { type: "image", path: null };+ break;+ case "color":+ newSource = {+ type: "color",+ value: DEFAULT_GRADIENT_FROM,+ };+ break;+ case "gradient":+ newSource = {+ type: "gradient",+ from: DEFAULT_GRADIENT_FROM,+ to: DEFAULT_GRADIENT_TO,+ };+ break;+ }++ // Try to preserve existing if type matches+ if (project.background.source.type === tab) {+ newSource = project.background.source;+ }++ setProjectSource(newSource);+ if (+ tab === "wallpaper" ||+ tab === "image" ||+ tab === "gradient"+ ) {+ ensurePaddingForBackground();+ }+ }}+ >+ <KTabs.List class="flex flex-row gap-2 items-center rounded-[0.5rem] relative">+ <For each={BACKGROUND_SOURCES_LIST}>+ {(item) => {+ return (+ <KTabs.Trigger+ class="z-10 flex-1 py-2.5 px-2 text-xs text-gray-11 ui-selected:border-gray-3 ui-selected:bg-gray-3 ui-not-selected:hover:border-gray-7 rounded-[10px] transition-colors duration-200 outline-none border ui-selected:text-gray-12 peer"+ value={item}+ >+ {BACKGROUND_SOURCES[item]}+ </KTabs.Trigger>+ );+ }}+ </For>+ </KTabs.List>++ <div class="my-5 w-full border-t border-dashed border-gray-5" />++ <KTabs.Content value="wallpaper">+ <KTabs+ class="overflow-hidden relative"+ value={backgroundTab()}+ >+ <KTabs.List class="flex overflow-x-auto overscroll-contain relative z-10 flex-row gap-2 items-center mb-3 text-xs hide-scroll">+ <For each={Object.entries(BACKGROUND_THEMES)}>+ {([key, value]) => (+ <KTabs.Trigger+ onClick={() =>+ setBackgroundTab(+ key as keyof typeof BACKGROUND_THEMES,+ )+ }+ value={key}+ class="flex relative z-10 flex-1 justify-center items-center px-4 py-2 bg-transparent rounded-lg border transition-colors duration-200 text-gray-11 ui-not-selected:hover:border-gray-7 ui-selected:bg-gray-3 ui-selected:border-gray-3 group ui-selected:text-gray-12 disabled:opacity-50 focus:outline-none"+ >+ {value}+ </KTabs.Trigger>+ )}+ </For>+ </KTabs.List>+ </KTabs>++ <KRadioGroup+ value={+ project.background.source.type === "wallpaper"+ ? (wallpapers()?.find((w) =>+ (+ project.background.source as { path?: string }+ ).path?.includes(w.id),+ )?.url ?? undefined)+ : undefined+ }+ onChange={(photoUrl) => {+ const wallpaper = wallpapers()?.find(+ (w) => w.url === photoUrl,+ );+ if (wallpaper) {+ debouncedSetProject(wallpaper.rawPath);+ ensurePaddingForBackground();+ }+ }}+ class="grid grid-cols-7 gap-2 h-auto"+ >+ <For each={filteredWallpapers().slice(0, 21)}>+ {(photo) => (+ <KRadioGroup.Item+ value={photo.url}+ class="relative aspect-square group"+ >+ <KRadioGroup.ItemInput class="peer" />+ <KRadioGroup.ItemControl class="overflow-hidden w-full h-full rounded-lg transition cursor-pointer ui-not-checked:ring-offset-1 ui-not-checked:ring-offset-gray-200 ui-not-checked:hover:ring-1 ui-not-checked:hover:ring-gray-400 ui-checked:ring-2 ui-checked:ring-gray-500 ui-checked:ring-offset-2 ui-checked:ring-offset-gray-200">+ <img+ src={photo.url}+ loading="eager"+ class="object-cover w-full h-full"+ alt="Wallpaper option"+ />+ </KRadioGroup.ItemControl>+ </KRadioGroup.Item>+ )}+ </For>+ </KRadioGroup>+ </KTabs.Content>++ <KTabs.Content value="image">+ <Show+ when={+ project.background.source.type === "image" &&+ project.background.source.path+ }+ fallback={+ <button+ type="button"+ onClick={() => fileInput.click()}+ class="p-6 bg-gray-2 text-[13px] w-full rounded-[0.5rem] border border-gray-5 border-dashed flex flex-col items-center justify-center gap-[0.5rem] hover:bg-gray-3 transition-colors duration-100"+ >+ <IconCapImage class="text-gray-11 size-6" />+ <span class="text-gray-12">+ Click to select or drag and drop image+ </span>+ </button>+ }+ >+ {(source) => (+ <div class="overflow-hidden relative w-full h-48 rounded-md border border-gray-3 group">+ <img+ src={convertFileSrc(source())}+ class="object-cover w-full h-full"+ alt="Selected background"+ />+ <div class="absolute top-2 right-2">+ <button+ type="button"+ onClick={() =>+ setProjectSource({+ type: "image",+ path: null,+ })+ }+ class="p-2 text-white rounded-full transition-colors bg-black/50 hover:bg-black/70"+ >+ <IconCapCircleX class="w-4 h-4" />+ </button>+ </div>+ </div>+ )}+ </Show>+ <input+ type="file"+ ref={fileInput}+ class="hidden"+ accept="image/apng, image/avif, image/jpeg, image/png, image/webp"+ onChange={async (e) => {+ const file = e.currentTarget.files?.[0];+ if (!file) return;+ const fileName = `bg-${Date.now()}-${file.name}`;+ const arrayBuffer = await file.arrayBuffer();+ const uint8Array = new Uint8Array(arrayBuffer);++ const fullPath = `${await appDataDir()}/${fileName}`;++ await writeFile(fileName, uint8Array, {+ baseDir: BaseDirectory.AppData,+ });++ setProjectSource({+ type: "image",+ path: fullPath,+ });+ ensurePaddingForBackground();+ }}+ />+ </KTabs.Content>++ <KTabs.Content value="color">+ <div class="flex flex-col flex-wrap gap-3">+ <div class="flex flex-row items-center w-full h-10">+ <RgbInput+ value={+ project.background.source.type === "color"+ ? project.background.source.value+ : [0, 0, 0]+ }+ onChange={(v) =>+ setProjectSource({ type: "color", value: v })+ }+ />+ </div>+ <div class="flex flex-wrap gap-2">+ <For each={BACKGROUND_COLORS}>+ {(color) => (+ <label class="relative">+ <input+ type="radio"+ class="sr-only peer"+ name="colorPicker"+ onChange={(e) => {+ if (e.target.checked) {+ const rgb = hexToRgb(color);+ if (rgb)+ setProjectSource({+ type: "color",+ value: [rgb[0], rgb[1], rgb[2]],+ alpha: rgb[3],+ });+ }+ }}+ />+ <div+ class="rounded-lg transition-all duration-200 cursor-pointer size-8 peer-checked:hover:opacity-100 peer-hover:opacity-70 peer-checked:ring-2 peer-checked:ring-gray-500 peer-checked:ring-offset-2 peer-checked:ring-offset-gray-200"+ style={{ background: color }}+ />+ </label>+ )}+ </For>+ </div>+ </div>+ </KTabs.Content>++ <KTabs.Content value="gradient">+ <Show+ when={+ project.background.source.type === "gradient" &&+ project.background.source+ }+ >+ {(source) => {+ const angle = () => source().angle ?? 90;+ return (+ <div class="flex flex-col gap-3">+ <div class="flex gap-5 h-10">+ <RgbInput+ value={source().from}+ onChange={(from) =>+ setProjectSource({ ...source(), from })+ }+ />+ <RgbInput+ value={source().to}+ onChange={(to) =>+ setProjectSource({ ...source(), to })+ }+ />+ </div>+ <div class="flex flex-wrap gap-2">+ <For each={BACKGROUND_GRADIENTS}>+ {(gradient) => (+ <label class="relative">+ <input+ type="radio"+ class="sr-only peer"+ name="colorPicker"+ onChange={(e) => {+ if (e.target.checked) {+ setProjectSource({+ type: "gradient",+ from: gradient.from,+ to: gradient.to,+ });+ ensurePaddingForBackground();+ }+ }}+ />+ <div+ class="rounded-lg transition-all duration-200 cursor-pointer size-8 peer-checked:hover:opacity-100 peer-hover:opacity-70 peer-checked:ring-2 peer-checked:ring-gray-500 peer-checked:ring-offset-2 peer-checked:ring-offset-gray-200"+ style={{+ background: `linear-gradient(${angle()}deg, rgb(${gradient.from.join(+ ",",+ )}), rgb(${gradient.to.join(",")}))`,+ }}+ />+ </label>+ )}+ </For>+ </div>+ </div>+ );+ }}+ </Show>+ </KTabs.Content>+ </KTabs>+ </Field>++ <Field name="Background Blur" icon={<IconCapBgBlur />}>+ <Slider+ value={[project.background.blur]}+ onChange={(v) => setProject("background", "blur", v[0])}+ minValue={0}+ maxValue={100}+ step={0.1}+ formatTooltip="%"+ />+ </Field>+ </div>+ </Popover.Content>+ </Popover.Portal>+ </Popover>+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/popovers/BorderPopover.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/BorderPopover.tsxnew file mode 100644index 000000000..5cca1fdd4--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/popovers/BorderPopover.tsx@@ -0,0 +1,111 @@+import { Collapsible } from "@kobalte/core/collapsible";+import { Popover } from "@kobalte/core/popover";+import { Toggle } from "~/components/Toggle";+import IconCapEnlarge from "~icons/cap/enlarge";+import IconCapImage from "~icons/cap/image";+import IconCapSettings from "~icons/cap/settings";+import IconCapShadow from "~icons/cap/shadow";+import { RgbInput } from "../ColorPicker";+import { useScreenshotEditorContext } from "../context";+import { EditorButton, Field, Slider } from "../ui";++export function BorderPopover() {+ const { project, setProject } = useScreenshotEditorContext();++ return (+ <Popover placement="bottom-start">+ <Popover.Trigger+ as={EditorButton}+ leftIcon={<IconCapSettings class="size-4" />}+ tooltipText="Border"+ />+ <Popover.Portal>+ <Popover.Content class="z-50 w-[280px] overflow-hidden rounded-xl border border-gray-3 bg-gray-1 shadow-xl animate-in fade-in zoom-in-95 p-4">+ <div class="flex flex-col gap-4">+ <div class="flex flex-row justify-between items-center">+ <span class="text-xs font-medium text-gray-11">Border</span>+ <Toggle+ checked={project.background.border?.enabled ?? false}+ onChange={(enabled) => {+ const prev = project.background.border ?? {+ enabled: false,+ width: 5.0,+ color: [0, 0, 0],+ opacity: 50.0,+ };+ setProject("background", "border", {+ ...prev,+ enabled,+ });+ }}+ />+ </div>++ <Collapsible open={project.background.border?.enabled ?? false}>+ <Collapsible.Content class="overflow-hidden opacity-0 transition-opacity animate-collapsible-up ui-expanded:animate-collapsible-down ui-expanded:opacity-100">+ <div class="flex flex-col gap-4">+ <Field name="Width" icon={<IconCapEnlarge class="size-4" />}>+ <Slider+ value={[project.background.border?.width ?? 5.0]}+ onChange={(v) =>+ setProject("background", "border", {+ ...(project.background.border ?? {+ enabled: true,+ width: 5.0,+ color: [0, 0, 0],+ opacity: 50.0,+ }),+ width: v[0],+ })+ }+ minValue={1}+ maxValue={20}+ step={0.1}+ formatTooltip="px"+ />+ </Field>+ <Field name="Color" icon={<IconCapImage class="size-4" />}>+ <RgbInput+ value={project.background.border?.color ?? [0, 0, 0]}+ onChange={(color) =>+ setProject("background", "border", {+ ...(project.background.border ?? {+ enabled: true,+ width: 5.0,+ color: [0, 0, 0],+ opacity: 50.0,+ }),+ color,+ })+ }+ />+ </Field>+ <Field name="Opacity" icon={<IconCapShadow class="size-4" />}>+ <Slider+ value={[project.background.border?.opacity ?? 50.0]}+ onChange={(v) =>+ setProject("background", "border", {+ ...(project.background.border ?? {+ enabled: true,+ width: 5.0,+ color: [0, 0, 0],+ opacity: 50.0,+ }),+ opacity: v[0],+ })+ }+ minValue={0}+ maxValue={100}+ step={0.1}+ formatTooltip="%"+ />+ </Field>+ </div>+ </Collapsible.Content>+ </Collapsible>+ </div>+ </Popover.Content>+ </Popover.Portal>+ </Popover>+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/popovers/PaddingPopover.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/PaddingPopover.tsxnew file mode 100644index 000000000..d4dbf4258--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/popovers/PaddingPopover.tsx@@ -0,0 +1,33 @@+import { Popover } from "@kobalte/core/popover";+import IconCapPadding from "~icons/cap/padding";+import { useScreenshotEditorContext } from "../context";+import { EditorButton, Slider } from "../ui";++export function PaddingPopover() {+ const { project, setProject } = useScreenshotEditorContext();++ return (+ <Popover placement="bottom-start">+ <Popover.Trigger+ as={EditorButton}+ leftIcon={<IconCapPadding class="size-4" />}+ tooltipText="Padding"+ />+ <Popover.Portal>+ <Popover.Content class="z-50 w-[200px] overflow-hidden rounded-xl border border-gray-3 bg-gray-1 shadow-xl animate-in fade-in zoom-in-95 p-4">+ <div class="flex flex-col gap-2">+ <span class="text-xs font-medium text-gray-11">Padding</span>+ <Slider+ value={[project.background.padding]}+ onChange={(v) => setProject("background", "padding", v[0])}+ minValue={0}+ maxValue={100}+ step={1}+ formatTooltip="px"+ />+ </div>+ </Popover.Content>+ </Popover.Portal>+ </Popover>+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/popovers/RoundingPopover.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/RoundingPopover.tsxnew file mode 100644index 000000000..c09a05e0b--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/popovers/RoundingPopover.tsx@@ -0,0 +1,123 @@+import { Popover } from "@kobalte/core/popover";+import { Select as KSelect } from "@kobalte/core/select";+import { cx } from "cva";+import { Show, type ValidComponent } from "solid-js";+import IconCapChevronDown from "~icons/cap/chevron-down";+import IconCapCorners from "~icons/cap/corners";+import { useScreenshotEditorContext } from "../context";+import {+ EditorButton,+ MenuItem,+ MenuItemList,+ PopperContent,+ Slider,+ topSlideAnimateClasses,+} from "../ui";++export type CornerRoundingType = "rounded" | "squircle";+const CORNER_STYLE_OPTIONS = [+ { name: "Squircle", value: "squircle" },+ { name: "Rounded", value: "rounded" },+] satisfies Array<{ name: string; value: CornerRoundingType }>;++export function RoundingPopover() {+ const { project, setProject } = useScreenshotEditorContext();++ return (+ <Popover placement="bottom-start">+ <Popover.Trigger+ as={EditorButton}+ leftIcon={<IconCapCorners class="size-4" />}+ tooltipText="Corner Rounding"+ />+ <Popover.Portal>+ <Popover.Content class="z-50 w-[240px] overflow-hidden rounded-xl border border-gray-3 bg-gray-1 shadow-xl animate-in fade-in zoom-in-95 p-4">+ <div class="flex flex-col gap-4">+ <div class="flex flex-col gap-2">+ <span class="text-xs font-medium text-gray-11">Rounding</span>+ <Slider+ value={[project.background.rounding]}+ onChange={(v) => setProject("background", "rounding", v[0])}+ minValue={0}+ maxValue={100}+ step={1}+ formatTooltip="px"+ />+ </div>+ <CornerStyleSelect+ label="Corner Style"+ value={project.background.roundingType || "squircle"}+ onChange={(v) => setProject("background", "roundingType", v)}+ />+ </div>+ </Popover.Content>+ </Popover.Portal>+ </Popover>+ );+}++function CornerStyleSelect(props: {+ label?: string;+ value: CornerRoundingType;+ onChange: (value: CornerRoundingType) => void;+}) {+ return (+ <div class="flex flex-col gap-1.5">+ <Show when={props.label}>+ {(label) => (+ <span class="text-[0.65rem] uppercase tracking-wide text-gray-11">+ {label()}+ </span>+ )}+ </Show>+ <KSelect<{ name: string; value: CornerRoundingType }>+ options={CORNER_STYLE_OPTIONS}+ optionValue="value"+ optionTextValue="name"+ value={CORNER_STYLE_OPTIONS.find(+ (option) => option.value === props.value,+ )}+ onChange={(option) => option && props.onChange(option.value)}+ disallowEmptySelection+ itemComponent={(itemProps) => (+ <MenuItem<typeof KSelect.Item>+ as={KSelect.Item}+ item={itemProps.item}+ >+ <KSelect.ItemLabel class="flex-1">+ {itemProps.item.rawValue.name}+ </KSelect.ItemLabel>+ </MenuItem>+ )}+ >+ <KSelect.Trigger class="flex flex-row gap-2 items-center px-2 w-full h-8 rounded-lg transition-colors bg-gray-3 disabled:text-gray-11">+ <KSelect.Value<{+ name: string;+ value: CornerRoundingType;+ }> class="flex-1 text-sm text-left truncate text-[--gray-500] font-normal">+ {(state) => <span>{state.selectedOption().name}</span>}+ </KSelect.Value>+ <KSelect.Icon<ValidComponent>+ as={(iconProps) => (+ <IconCapChevronDown+ {...iconProps}+ class="size-4 shrink-0 transform transition-transform ui-expanded:rotate-180 text-[--gray-500]"+ />+ )}+ />+ </KSelect.Trigger>+ <KSelect.Portal>+ <PopperContent<typeof KSelect.Content>+ as={KSelect.Content}+ class={cx(topSlideAnimateClasses, "z-50")}+ >+ <MenuItemList<typeof KSelect.Listbox>+ class="overflow-y-auto max-h-32"+ as={KSelect.Listbox}+ />+ </PopperContent>+ </KSelect.Portal>+ </KSelect>+ </div>+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/popovers/ShadowPopover.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/ShadowPopover.tsxnew file mode 100644index 000000000..7372e9fdb--- /dev/null+++ b/apps/desktop/src/routes/screenshot-editor/popovers/ShadowPopover.tsx@@ -0,0 +1,96 @@+import { Popover } from "@kobalte/core/popover";+import { batch } from "solid-js";+import IconCapShadow from "~icons/cap/shadow";+import { useScreenshotEditorContext } from "../context";+import { EditorButton, Slider } from "../ui";+import ShadowSettings from "./ShadowSettings";++export function ShadowPopover() {+ const { project, setProject } = useScreenshotEditorContext();+ // We need a dummy scrollRef since ShadowSettings expects it,+ // but in this simple popover we might not need auto-scroll.+ // Passing undefined might break it if it relies on it, checking ShadowSettings source would be good.+ // Assuming it's optional or we can pass a dummy one.+ let scrollRef: HTMLDivElement | undefined;++ return (+ <Popover placement="bottom-start">+ <Popover.Trigger+ as={EditorButton}+ leftIcon={<IconCapShadow class="size-4" />}+ tooltipText="Shadow"+ />+ <Popover.Portal>+ <Popover.Content class="z-50 w-[280px] overflow-hidden rounded-xl border border-gray-3 bg-gray-1 shadow-xl animate-in fade-in zoom-in-95 p-4">+ <div ref={scrollRef} class="flex flex-col gap-4">+ <div class="flex flex-col gap-2">+ <span class="text-xs font-medium text-gray-11">Shadow</span>+ <Slider+ value={[project.background.shadow ?? 0]}+ onChange={(v) => {+ batch(() => {+ setProject("background", "shadow", v[0]);+ if (v[0] > 0 && !project.background.advancedShadow) {+ setProject("background", "advancedShadow", {+ size: 50,+ opacity: 18,+ blur: 50,+ });+ }+ });+ }}+ minValue={0}+ maxValue={100}+ step={1}+ formatTooltip="%"+ />+ </div>++ <ShadowSettings+ scrollRef={scrollRef}+ size={{+ value: [project.background.advancedShadow?.size ?? 50],+ onChange: (v) => {+ setProject("background", "advancedShadow", {+ ...(project.background.advancedShadow ?? {+ size: 50,+ opacity: 18,+ blur: 50,+ }),+ size: v[0],+ });+ },+ }}+ opacity={{+ value: [project.background.advancedShadow?.opacity ?? 18],+ onChange: (v) => {+ setProject("background", "advancedShadow", {+ ...(project.background.advancedShadow ?? {+ size: 50,+ opacity: 18,+ blur: 50,+ }),+ opacity: v[0],+ });+ },+ }}+ blur={{+ value: [project.background.advancedShadow?.blur ?? 50],+ onChange: (v) => {+ setProject("background", "advancedShadow", {+ ...(project.background.advancedShadow ?? {+ size: 50,+ opacity: 18,+ blur: 50,+ }),+ blur: v[0],+ });+ },+ }}+ />+ </div>+ </Popover.Content>+ </Popover.Portal>+ </Popover>+ );+}diff --git a/apps/desktop/src/routes/screenshot-editor/ShadowSettings.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/ShadowSettings.tsxsimilarity index 98%rename from apps/desktop/src/routes/screenshot-editor/ShadowSettings.tsxrename to apps/desktop/src/routes/screenshot-editor/popovers/ShadowSettings.tsxindex b9bb7e666..e2eca87f2 100644--- a/apps/desktop/src/routes/screenshot-editor/ShadowSettings.tsx+++ b/apps/desktop/src/routes/screenshot-editor/popovers/ShadowSettings.tsx@@ -2,7 +2,7 @@ import { Collapsible as KCollapsible } from "@kobalte/core/collapsible";import { cx } from "cva";import { createSignal } from "solid-js";import IconCapChevronDown from "~icons/cap/chevron-down";-import { Field, Slider } from "./ui";+import { Field, Slider } from "../ui";interface Props {size: {diff --git a/apps/desktop/src/routes/screenshot-editor/ui.tsx b/apps/desktop/src/routes/screenshot-editor/ui.tsxindex c26ed34df..1f35bba04 100644--- a/apps/desktop/src/routes/screenshot-editor/ui.tsx+++ b/apps/desktop/src/routes/screenshot-editor/ui.tsx@@ -392,6 +392,7 @@ export function EditorButton<T extends ValidComponent = "button">(<Polymorphicas="button"{...others}+ ref={local.ref}class={cx(editorButtonStyles({ ...cvaProps, class: cvaProps.class }),local.rightIconEnd && "justify-between",@@ -405,6 +406,7 @@ export function EditorButton<T extends ValidComponent = "button">(<Polymorphicas="button"{...others}+ ref={local.ref}class={cx(editorButtonStyles({ ...cvaProps, class: cvaProps.class }),local.rightIconEnd && "justify-between",@@ -433,7 +435,7 @@ export const topSlideAnimateClasses ="ui-expanded:animate-in ui-expanded:fade-in ui-expanded:slide-in-from-top-1 ui-closed:animate-out ui-closed:fade-out ui-closed:slide-out-to-top-1 origin-top-center";export function ComingSoonTooltip(- props: ComponentProps<typeof KTooltip> & any,+ props: ComponentProps<typeof KTooltip> & { as?: ValidComponent },) {const [trigger, root] = splitProps(props, ["children", "as"]);return (diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.tsindex 2092cea14..918b3898e 100644--- a/apps/desktop/src/utils/tauri.ts+++ b/apps/desktop/src/utils/tauri.ts@@ -358,6 +358,8 @@ uploadProgressEvent: "upload-progress-event"/** user-defined types **/+export type Annotation = { id: string; type: AnnotationType; x: number; y: number; width: number; height: number; strokeColor: string; strokeWidth: number; fillColor: string; opacity: number; rotation: number; text: string | null; maskType?: MaskType | null; maskLevel?: number | null }+export type AnnotationType = "arrow" | "circle" | "rectangle" | "text" | "mask"export type AppTheme = "system" | "light" | "dark"export type AspectRatio = "wide" | "vertical" | "square" | "classic" | "tall"export type Audio = { duration: number; sample_rate: number; channels: number; start_time: number }@@ -373,7 +375,7 @@ export type AuthStore = { secret: AuthSecret; user_id: string | null; plan: Planexport type BackgroundConfiguration = { source: BackgroundSource; blur: number; padding: number; rounding: number; roundingType?: CornerStyle; inset: number; crop: Crop | null; shadow?: number; advancedShadow?: ShadowConfiguration | null; border?: BorderConfiguration | null }export type BackgroundSource = { type: "wallpaper"; path: string | null } | { type: "image"; path: string | null } | { type: "color"; value: [number, number, number]; alpha?: number } | { type: "gradient"; from: [number, number, number]; to: [number, number, number]; angle?: number }export type BorderConfiguration = { enabled: boolean; width: number; color: [number, number, number]; opacity: number }-export type Camera = { hide: boolean; mirror: boolean; position: CameraPosition; size: number; zoom_size: number | null; rounding?: number; shadow?: number; advanced_shadow?: ShadowConfiguration | null; shape?: CameraShape; rounding_type?: CornerStyle }+export type Camera = { hide: boolean; mirror: boolean; position: CameraPosition; size: number; zoomSize: number | null; rounding?: number; shadow?: number; advancedShadow?: ShadowConfiguration | null; shape?: CameraShape; roundingType?: CornerStyle }export type CameraInfo = { device_id: string; model_id: ModelIDType | null; display_name: string }export type CameraPosition = { x: CameraXPosition; y: CameraYPosition }export type CameraPreviewShape = "round" | "square" | "full"@@ -436,6 +438,7 @@ export type LogicalBounds = { position: LogicalPosition; size: LogicalSize }export type LogicalPosition = { x: number; y: number }export type LogicalSize = { width: number; height: number }export type MainWindowRecordingStartBehaviour = "close" | "minimise"+export type MaskType = "blur" | "pixelate"export type ModelIDType = stringexport type Mp4ExportSettings = { fps: number; resolution_base: XY<number>; compression: ExportCompression }export type MultipleSegment = { display: VideoMeta; camera?: VideoMeta | null; mic?: AudioMeta | null; system_audio?: AudioMeta | null; cursor?: string | null }@@ -455,7 +458,7 @@ export type PostDeletionBehaviour = "doNothing" | "reopenRecordingWindow"export type PostStudioRecordingBehaviour = "openEditor" | "showOverlay"export type Preset = { name: string; config: ProjectConfiguration }export type PresetsStore = { presets: Preset[]; default: number | null }-export type ProjectConfiguration = { aspectRatio: AspectRatio | null; background: BackgroundConfiguration; camera: Camera; audio: AudioConfiguration; cursor: CursorConfiguration; hotkeys: HotkeysConfiguration; timeline?: TimelineConfiguration | null; captions?: CaptionsData | null; clips?: ClipConfiguration[] }+export type ProjectConfiguration = { aspectRatio: AspectRatio | null; background: BackgroundConfiguration; camera: Camera; audio: AudioConfiguration; cursor: CursorConfiguration; hotkeys: HotkeysConfiguration; timeline?: TimelineConfiguration | null; captions?: CaptionsData | null; clips?: ClipConfiguration[]; annotations?: Annotation[] }export type ProjectRecordingsMeta = { segments: SegmentRecordings[] }export type RecordingAction = "Started" | "InvalidAuthentication" | "UpgradeRequired"export type RecordingDeleted = { path: string }diff --git a/bun.lock b/bun.locknew file mode 100644index 000000000..fd657dbac--- /dev/null+++ b/bun.lock@@ -0,0 +1,239 @@+{+ "lockfileVersion": 1,+ "workspaces": {+ "": {+ "name": "cap",+ "devDependencies": {+ "@biomejs/biome": "2.2.0",+ "@clack/prompts": "^0.10.0",+ "@effect/language-service": "^0.44.0",+ "dotenv-cli": "latest",+ "mysql2": "^3.15.2",+ "tsdown": "^0.15.6",+ "turbo": "^2.3.4",+ "typescript": "^5.8.3",+ },+ },+ },+ "packages": {+ "@babel/generator": ["@babel/[email protected]", "", { "dependencies": { "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ=="],++ "@babel/helper-string-parser": ["@babel/[email protected]", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="],++ "@babel/helper-validator-identifier": ["@babel/[email protected]", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="],++ "@babel/parser": ["@babel/[email protected]", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="],++ "@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="],++ "@biomejs/biome": ["@biomejs/[email protected]", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.2.0", "@biomejs/cli-darwin-x64": "2.2.0", "@biomejs/cli-linux-arm64": "2.2.0", "@biomejs/cli-linux-arm64-musl": "2.2.0", "@biomejs/cli-linux-x64": "2.2.0", "@biomejs/cli-linux-x64-musl": "2.2.0", "@biomejs/cli-win32-arm64": "2.2.0", "@biomejs/cli-win32-x64": "2.2.0" }, "bin": { "biome": "bin/biome" } }, "sha512-3On3RSYLsX+n9KnoSgfoYlckYBoU6VRM22cw1gB4Y0OuUVSYd/O/2saOJMrA4HFfA1Ff0eacOvMN1yAAvHtzIw=="],++ "@biomejs/cli-darwin-arm64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zKbwUUh+9uFmWfS8IFxmVD6XwqFcENjZvEyfOxHs1epjdH3wyyMQG80FGDsmauPwS2r5kXdEM0v/+dTIA9FXAg=="],++ "@biomejs/cli-darwin-x64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-+OmT4dsX2eTfhD5crUOPw3RPhaR+SKVspvGVmSdZ9y9O/AgL8pla6T4hOn1q+VAFBHuHhsdxDRJgFCSC7RaMOw=="],++ "@biomejs/cli-linux-arm64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-6eoRdF2yW5FnW9Lpeivh7Mayhq0KDdaDMYOJnH9aT02KuSIX5V1HmWJCQQPwIQbhDh68Zrcpl8inRlTEan0SXw=="],++ "@biomejs/cli-linux-arm64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-egKpOa+4FL9YO+SMUMLUvf543cprjevNc3CAgDNFLcjknuNMcZ0GLJYa3EGTCR2xIkIUJDVneBV3O9OcIlCEZQ=="],++ "@biomejs/cli-linux-x64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-5UmQx/OZAfJfi25zAnAGHUMuOd+LOsliIt119x2soA2gLggQYrVPA+2kMUxR6Mw5M1deUF/AWWP2qpxgH7Nyfw=="],++ "@biomejs/cli-linux-x64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-I5J85yWwUWpgJyC1CcytNSGusu2p9HjDnOPAFG4Y515hwRD0jpR9sT9/T1cKHtuCvEQ/sBvx+6zhz9l9wEJGAg=="],++ "@biomejs/cli-win32-arm64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-n9a1/f2CwIDmNMNkFs+JI0ZjFnMO0jdOyGNtihgUNFnlmd84yIYY2KMTBmMV58ZlVHjgmY5Y6E1hVTnSRieggA=="],++ "@biomejs/cli-win32-x64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-Nawu5nHjP/zPKTIryh2AavzTc/KEg4um/MxWdXW0A6P/RZOyIpa7+QSjeXwAwX/utJGaCoXRPWtF3m5U/bB3Ww=="],++ "@clack/core": ["@clack/[email protected]", "", { "dependencies": { "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-NYQfcEy8MWIxrT5Fj8nIVchfRFA26yYKJcvBS7WlUIlw2OmQOY9DhGGXMovyI5J5PpxrCPGkgUi207EBrjpBvg=="],++ "@clack/prompts": ["@clack/[email protected]", "", { "dependencies": { "@clack/core": "0.4.2", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-Q0T02vx8ZM9XSv9/Yde0jTmmBQufZhPJfYAg2XrrrxWWaZgq1rr8nU8Hv710BQ1dhoP8rtY7YUdpGej2Qza/cw=="],++ "@effect/language-service": ["@effect/[email protected]", "", { "bin": { "effect-language-service": "cli.js" } }, "sha512-BH5F8B1CFbkL2iaX8Ly5OFO7wHfWVc+FJ7xxF+XF2tVOW1gaWxxyBdvyPpZSZDbL8wp+Fii7NH5lXh+Q9W7Tqg=="],++ "@emnapi/core": ["@emnapi/[email protected]", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" } }, "sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg=="],++ "@emnapi/runtime": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA=="],++ "@emnapi/wasi-threads": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ=="],++ "@jridgewell/gen-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],++ "@jridgewell/resolve-uri": ["@jridgewell/[email protected]", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],++ "@jridgewell/sourcemap-codec": ["@jridgewell/[email protected]", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],++ "@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],++ "@napi-rs/wasm-runtime": ["@napi-rs/[email protected]", "", { "dependencies": { "@emnapi/core": "^1.5.0", "@emnapi/runtime": "^1.5.0", "@tybys/wasm-util": "^0.10.1" } }, "sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw=="],++ "@oxc-project/types": ["@oxc-project/[email protected]", "", {}, "sha512-vACy7vhpMPhjEJhULNxrdR0D943TkA/MigMpJCHmBHvMXxRStRi/dPtTlfQ3uDwWSzRpT8z+7ImjZVf8JWBocQ=="],++ "@quansync/fs": ["@quansync/[email protected]", "", { "dependencies": { "quansync": "^0.2.11" } }, "sha512-lNS9hL2aS2NZgNW7BBj+6EBl4rOf8l+tQ0eRY6JWCI8jI2kc53gSoqbjojU0OnAWhzoXiOjFyGsHcDGePB3lhA=="],++ "@rolldown/binding-android-arm64": ["@rolldown/[email protected]", "", { "os": "android", "cpu": "arm64" }, "sha512-bfgKYhFiXJALeA/riil908+2vlyWGdwa7Ju5S+JgWZYdR4jtiPOGdM6WLfso1dojCh+4ZWeiTwPeV9IKQEX+4g=="],++ "@rolldown/binding-darwin-arm64": ["@rolldown/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-xjCv4CRVsSnnIxTuyH1RDJl5OEQ1c9JYOwfDAHddjJDxCw46ZX9q80+xq7Eok7KC4bRSZudMJllkvOKv0T9SeA=="],++ "@rolldown/binding-darwin-x64": ["@rolldown/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-ddcO9TD3D/CLUa/l8GO8LHzBOaZqWg5ClMy3jICoxwCuoz47h9dtqPsIeTiB6yR501LQTeDsjA4lIFd7u3Ljfw=="],++ "@rolldown/binding-freebsd-x64": ["@rolldown/[email protected]", "", { "os": "freebsd", "cpu": "x64" }, "sha512-MBTWdrzW9w+UMYDUvnEuh0pQvLENkl2Sis15fHTfHVW7ClbGuez+RWopZudIDEGkpZXdeI4CkRXk+vdIIebrmg=="],++ "@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-4YgoCFiki1HR6oSg+GxxfzfnVCesQxLF1LEnw9uXS/MpBmuog0EOO2rYfy69rWP4tFZL9IWp6KEfGZLrZ7aUog=="],++ "@rolldown/binding-linux-arm64-gnu": ["@rolldown/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-LE1gjAwQRrbCOorJJ7LFr10s5vqYf5a00V5Ea9wXcT2+56n5YosJkcp8eQ12FxRBv2YX8dsdQJb+ZTtYJwb6XQ=="],++ "@rolldown/binding-linux-arm64-musl": ["@rolldown/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-tdy8ThO/fPp40B81v0YK3QC+KODOmzJzSUOO37DinQxzlTJ026gqUSOM8tzlVixRbQJltgVDCTYF8HNPRErQTA=="],++ "@rolldown/binding-linux-x64-gnu": ["@rolldown/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-lS082ROBWdmOyVY/0YB3JmsiClaWoxvC+dA8/rbhyB9VLkvVEaihLEOr4CYmrMse151C4+S6hCw6oa1iewox7g=="],++ "@rolldown/binding-linux-x64-musl": ["@rolldown/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-Hi73aYY0cBkr1/SvNQqH8Cd+rSV6S9RB5izCv0ySBcRnd/Wfn5plguUoGYwBnhHgFbh6cPw9m2dUVBR6BG1gxA=="],++ "@rolldown/binding-openharmony-arm64": ["@rolldown/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-fljEqbO7RHHogNDxYtTzr+GNjlfOx21RUyGmF+NrkebZ8emYYiIqzPxsaMZuRx0rgZmVmliOzEp86/CQFDKhJQ=="],++ "@rolldown/binding-wasm32-wasi": ["@rolldown/[email protected]", "", { "dependencies": { "@napi-rs/wasm-runtime": "^1.0.7" }, "cpu": "none" }, "sha512-ZJDB7lkuZE9XUnWQSYrBObZxczut+8FZ5pdanm8nNS1DAo8zsrPuvGwn+U3fwU98WaiFsNrA4XHngesCGr8tEQ=="],++ "@rolldown/binding-win32-arm64-msvc": ["@rolldown/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-zyzAjItHPUmxg6Z8SyRhLdXlJn3/D9KL5b9mObUrBHhWS/GwRH4665xCiFqeuktAhhWutqfc+rOV2LjK4VYQGQ=="],++ "@rolldown/binding-win32-ia32-msvc": ["@rolldown/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-wODcGzlfxqS6D7BR0srkJk3drPwXYLu7jPHN27ce2c4PUnVVmJnp9mJzUQGT4LpmHmmVdMZ+P6hKvyTGBzc1CA=="],++ "@rolldown/binding-win32-x64-msvc": ["@rolldown/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-wiU40G1nQo9rtfvF9jLbl79lUgjfaD/LTyUEw2Wg/gdF5OhjzpKMVugZQngO+RNdwYaNj+Fs+kWBWfp4VXPMHA=="],++ "@rolldown/pluginutils": ["@rolldown/[email protected]", "", {}, "sha512-Le9ulGCrD8ggInzWw/k2J8QcbPz7eGIOWqfJ2L+1R0Opm7n6J37s2hiDWlh6LJN0Lk9L5sUzMvRHKW7UxBZsQA=="],++ "@tybys/wasm-util": ["@tybys/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg=="],++ "ansis": ["[email protected]", "", {}, "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig=="],++ "ast-kit": ["[email protected]", "", { "dependencies": { "@babel/parser": "^7.28.5", "pathe": "^2.0.3" } }, "sha512-m1Q/RaVOnTp9JxPX+F+Zn7IcLYMzM8kZofDImfsKZd8MbR+ikdOzTeztStWqfrqIxZnYWryyI9ePm3NGjnZgGw=="],++ "aws-ssl-profiles": ["[email protected]", "", {}, "sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g=="],++ "birpc": ["[email protected]", "", {}, "sha512-Bz2a4qD/5GRhiHSwj30c/8kC8QGj12nNDwz3D4ErQ4Xhy35dsSDvF+RA/tWpjyU0pdGtSDiEk6B5fBGE1qNVhw=="],++ "cac": ["[email protected]", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="],++ "chokidar": ["[email protected]", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="],++ "cross-spawn": ["[email protected]", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],++ "debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],++ "defu": ["[email protected]", "", {}, "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="],++ "denque": ["[email protected]", "", {}, "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw=="],++ "diff": ["[email protected]", "", {}, "sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg=="],++ "dotenv": ["[email protected]", "", {}, "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w=="],++ "dotenv-cli": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.6", "dotenv": "^17.1.0", "dotenv-expand": "^12.0.0", "minimist": "^1.2.6" }, "bin": { "dotenv": "cli.js" } }, "sha512-r5pA8idbk7GFWuHEU7trSTflWcdBpQEK+Aw17UrSHjS6CReuhrrPcyC3zcQBPQvhArRHnBo/h6eLH1fkCvNlww=="],++ "dotenv-expand": ["[email protected]", "", { "dependencies": { "dotenv": "^16.4.5" } }, "sha512-uc47g4b+4k/M/SeaW1y4OApx+mtLWl92l5LMPP0GNXctZqELk+YGgOPIIC5elYmUH4OuoK3JLhuRUYegeySiFA=="],++ "dts-resolver": ["[email protected]", "", { "peerDependencies": { "oxc-resolver": ">=11.0.0" }, "optionalPeers": ["oxc-resolver"] }, "sha512-bihc7jPC90VrosXNzK0LTE2cuLP6jr0Ro8jk+kMugHReJVLIpHz/xadeq3MhuwyO4TD4OA3L1Q8pBBFRc08Tsw=="],++ "empathic": ["[email protected]", "", {}, "sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA=="],++ "fdir": ["[email protected]", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],++ "generate-function": ["[email protected]", "", { "dependencies": { "is-property": "^1.0.2" } }, "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ=="],++ "get-tsconfig": ["[email protected]", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ=="],++ "hookable": ["[email protected]", "", {}, "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ=="],++ "iconv-lite": ["[email protected]", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ=="],++ "is-property": ["[email protected]", "", {}, "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g=="],++ "isexe": ["[email protected]", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],++ "jiti": ["[email protected]", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="],++ "jsesc": ["[email protected]", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="],++ "long": ["[email protected]", "", {}, "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA=="],++ "lru-cache": ["[email protected]", "", {}, "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA=="],++ "lru.min": ["[email protected]", "", {}, "sha512-Lkk/vx6ak3rYkRR0Nhu4lFUT2VDnQSxBe8Hbl7f36358p6ow8Bnvr8lrLt98H8J1aGxfhbX4Fs5tYg2+FTwr5Q=="],++ "magic-string": ["[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],++ "minimist": ["[email protected]", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],++ "ms": ["[email protected]", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],++ "mysql2": ["[email protected]", "", { "dependencies": { "aws-ssl-profiles": "^1.1.1", "denque": "^2.1.0", "generate-function": "^2.3.1", "iconv-lite": "^0.7.0", "long": "^5.2.1", "lru.min": "^1.0.0", "named-placeholders": "^1.1.3", "seq-queue": "^0.0.5", "sqlstring": "^2.3.2" } }, "sha512-FBrGau0IXmuqg4haEZRBfHNWB5mUARw6hNwPDXXGg0XzVJ50mr/9hb267lvpVMnhZ1FON3qNd4Xfcez1rbFwSg=="],++ "named-placeholders": ["[email protected]", "", { "dependencies": { "lru-cache": "^7.14.1" } }, "sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w=="],++ "obug": ["[email protected]", "", {}, "sha512-uu/tgLPoa75CFA7UDkmqspKbefvZh1WMPwkU3bNr0PY746a/+xwXVgbw5co5C3GvJj3h5u8g/pbxXzI0gd1QFg=="],++ "path-key": ["[email protected]", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],++ "pathe": ["[email protected]", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],++ "picocolors": ["[email protected]", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],++ "picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],++ "quansync": ["[email protected]", "", {}, "sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA=="],++ "readdirp": ["[email protected]", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],++ "resolve-pkg-maps": ["[email protected]", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="],++ "rolldown": ["[email protected]", "", { "dependencies": { "@oxc-project/types": "=0.95.0", "@rolldown/pluginutils": "1.0.0-beta.45" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.0.0-beta.45", "@rolldown/binding-darwin-arm64": "1.0.0-beta.45", "@rolldown/binding-darwin-x64": "1.0.0-beta.45", "@rolldown/binding-freebsd-x64": "1.0.0-beta.45", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.45", "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.45", "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.45", "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.45", "@rolldown/binding-linux-x64-musl": "1.0.0-beta.45", "@rolldown/binding-openharmony-arm64": "1.0.0-beta.45", "@rolldown/binding-wasm32-wasi": "1.0.0-beta.45", "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.45", "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.45", "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.45" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-iMmuD72XXLf26Tqrv1cryNYLX6NNPLhZ3AmNkSf8+xda0H+yijjGJ+wVT9UdBUHOpKzq9RjKtQKRCWoEKQQBZQ=="],++ "rolldown-plugin-dts": ["[email protected]", "", { "dependencies": { "@babel/generator": "^7.28.5", "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "ast-kit": "^2.2.0", "birpc": "^2.8.0", "dts-resolver": "^2.1.3", "get-tsconfig": "^4.13.0", "magic-string": "^0.30.21", "obug": "^2.0.0" }, "peerDependencies": { "@ts-macro/tsc": "^0.3.6", "@typescript/native-preview": ">=7.0.0-dev.20250601.1", "rolldown": "^1.0.0-beta.44", "typescript": "^5.0.0", "vue-tsc": "~3.1.0" }, "optionalPeers": ["@ts-macro/tsc", "@typescript/native-preview", "typescript", "vue-tsc"] }, "sha512-76EEBlhF00yeY6M7VpMkWKI4r9WjuoMiOGey7j4D6zf3m0BR+ZrrY9hvSXdueJ3ljxSLq4DJBKFpX/X9+L7EKw=="],++ "safer-buffer": ["[email protected]", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],++ "semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="],++ "seq-queue": ["[email protected]", "", {}, "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q=="],++ "shebang-command": ["[email protected]", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],++ "shebang-regex": ["[email protected]", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],++ "sisteransi": ["[email protected]", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],++ "sqlstring": ["[email protected]", "", {}, "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg=="],++ "tinyexec": ["[email protected]", "", {}, "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg=="],++ "tinyglobby": ["[email protected]", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="],++ "tree-kill": ["[email protected]", "", { "bin": { "tree-kill": "cli.js" } }, "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="],++ "tsdown": ["[email protected]", "", { "dependencies": { "ansis": "^4.2.0", "cac": "^6.7.14", "chokidar": "^4.0.3", "debug": "^4.4.3", "diff": "^8.0.2", "empathic": "^2.0.0", "hookable": "^5.5.3", "rolldown": "1.0.0-beta.45", "rolldown-plugin-dts": "^0.17.2", "semver": "^7.7.3", "tinyexec": "^1.0.1", "tinyglobby": "^0.2.15", "tree-kill": "^1.2.2", "unconfig": "^7.3.3" }, "peerDependencies": { "@arethetypeswrong/core": "^0.18.1", "publint": "^0.3.0", "typescript": "^5.0.0", "unplugin-lightningcss": "^0.4.0", "unplugin-unused": "^0.5.0", "unrun": "^0.2.1" }, "optionalPeers": ["@arethetypeswrong/core", "publint", "typescript", "unplugin-lightningcss", "unplugin-unused", "unrun"], "bin": { "tsdown": "dist/run.mjs" } }, "sha512-c8VLlQm8/lFrOAg5VMVeN4NAbejZyVQkzd+ErjuaQgJFI/9MhR9ivr0H/CM7UlOF1+ELlF6YaI7sU/4itgGQ8w=="],++ "tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],++ "turbo": ["[email protected]", "", { "optionalDependencies": { "turbo-darwin-64": "2.6.1", "turbo-darwin-arm64": "2.6.1", "turbo-linux-64": "2.6.1", "turbo-linux-arm64": "2.6.1", "turbo-windows-64": "2.6.1", "turbo-windows-arm64": "2.6.1" }, "bin": { "turbo": "bin/turbo" } }, "sha512-qBwXXuDT3rA53kbNafGbT5r++BrhRgx3sAo0cHoDAeG9g1ItTmUMgltz3Hy7Hazy1ODqNpR+C7QwqL6DYB52yA=="],++ "turbo-darwin-64": ["[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-Dm0HwhyZF4J0uLqkhUyCVJvKM9Rw7M03v3J9A7drHDQW0qAbIGBrUijQ8g4Q9Cciw/BXRRd8Uzkc3oue+qn+ZQ=="],++ "turbo-darwin-arm64": ["[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-U0PIPTPyxdLsrC3jN7jaJUwgzX5sVUBsKLO7+6AL+OASaa1NbT1pPdiZoTkblBAALLP76FM0LlnsVQOnmjYhyw=="],++ "turbo-linux-64": ["[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-eM1uLWgzv89bxlK29qwQEr9xYWBhmO/EGiH22UGfq+uXr+QW1OvNKKMogSN65Ry8lElMH4LZh0aX2DEc7eC0Mw=="],++ "turbo-linux-arm64": ["[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-MFFh7AxAQAycXKuZDrbeutfWM5Ep0CEZ9u7zs4Hn2FvOViTCzIfEhmuJou3/a5+q5VX1zTxQrKGy+4Lf5cdpsA=="],++ "turbo-windows-64": ["[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-buq7/VAN7KOjMYi4tSZT5m+jpqyhbRU2EUTTvp6V0Ii8dAkY2tAAjQN1q5q2ByflYWKecbQNTqxmVploE0LVwQ=="],++ "turbo-windows-arm64": ["[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-7w+AD5vJp3R+FB0YOj1YJcNcOOvBior7bcHTodqp90S3x3bLgpr7tE6xOea1e8JkP7GK6ciKVUpQvV7psiwU5Q=="],++ "typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],++ "unconfig": ["[email protected]", "", { "dependencies": { "@quansync/fs": "^0.1.5", "defu": "^6.1.4", "jiti": "^2.6.1", "quansync": "^0.2.11", "unconfig-core": "7.4.1" } }, "sha512-uyQ7LElcGizrOGZyIq9KU+xkuEjcRf9IpmDTkCSYv5mEeZzrXSj6rb51C0L+WTedsmAoVxW9WKrLWhSwebIM9Q=="],++ "unconfig-core": ["[email protected]", "", { "dependencies": { "@quansync/fs": "^0.1.5", "quansync": "^0.2.11" } }, "sha512-Bp/bPZjV2Vl/fofoA2OYLSnw1Z0MOhCX7zHnVCYrazpfZvseBbGhwcNQMxsg185Mqh7VZQqK3C8hFG/Dyng+yA=="],++ "which": ["[email protected]", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],++ "dotenv-expand/dotenv": ["[email protected]", "", {}, "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow=="],+ }+}diff --git a/crates/project/src/configuration.rs b/crates/project/src/configuration.rsindex cd3bf369b..6b469ece4 100644--- a/crates/project/src/configuration.rs+++ b/crates/project/src/configuration.rs@@ -111,24 +111,24 @@ impl<T: Sub<Output = T> + Copy> Sub<T> for XY<T> {}}-impl<T: Mul<Output = T> + Copy> Mul<T> for XY<T> {+impl<T: Mul<Output = T> + Copy> Mul<XY<T>> for XY<T> {type Output = Self;- fn mul(self, other: T) -> Self {+ fn mul(self, other: Self) -> Self {Self {- x: self.x * other,- y: self.y * other,+ x: self.x * other.x,+ y: self.y * other.y,}}}-impl<T: Mul<Output = T> + Copy> Mul<XY<T>> for XY<T> {+impl<T: Mul<Output = T> + Copy> Mul<T> for XY<T> {type Output = Self;- fn mul(self, other: Self) -> Self {+ fn mul(self, other: T) -> Self {Self {- x: self.x * other.x,- y: self.y * other.y,+ x: self.x * other,+ y: self.y * other,}}}@@ -289,6 +289,7 @@ pub struct CameraPosition {}#[derive(Debug, Clone, Serialize, Deserialize, Type)]+#[serde(rename_all = "camelCase")]pub struct Camera {pub hide: bool,pub mirror: bool,@@ -668,6 +669,45 @@ pub struct ClipConfiguration {pub offsets: ClipOffsets,}+#[derive(Type, Serialize, Deserialize, Clone, Debug, PartialEq)]+#[serde(rename_all = "camelCase")]+pub enum AnnotationType {+ Arrow,+ Circle,+ Rectangle,+ Text,+ Mask,+}++#[derive(Type, Serialize, Deserialize, Clone, Debug, PartialEq)]+#[serde(rename_all = "camelCase")]+pub enum MaskType {+ Blur,+ Pixelate,+}++#[derive(Type, Serialize, Deserialize, Clone, Debug)]+#[serde(rename_all = "camelCase")]+pub struct Annotation {+ pub id: String,+ #[serde(rename = "type")]+ pub annotation_type: AnnotationType,+ pub x: f64,+ pub y: f64,+ pub width: f64,+ pub height: f64,+ pub stroke_color: String,+ pub stroke_width: f64,+ pub fill_color: String,+ pub opacity: f64,+ pub rotation: f64,+ pub text: Option<String>,+ #[serde(default)]+ pub mask_type: Option<MaskType>,+ #[serde(default)]+ pub mask_level: Option<f64>,+}+#[derive(Type, Serialize, Deserialize, Clone, Debug, Default)]#[serde(rename_all = "camelCase")]pub struct ProjectConfiguration {@@ -683,6 +723,8 @@ pub struct ProjectConfiguration {pub captions: Option<CaptionsData>,#[serde(default)]pub clips: Vec<ClipConfiguration>,+ #[serde(default)]+ pub annotations: Vec<Annotation>,}impl ProjectConfiguration {diff --git a/packages/ui-solid/src/auto-imports.d.ts b/packages/ui-solid/src/auto-imports.d.tsindex 4db5e5ed5..6bf33b06f 100644--- a/packages/ui-solid/src/auto-imports.d.ts+++ b/packages/ui-solid/src/auto-imports.d.ts@@ -85,6 +85,7 @@ declare global {const IconLucideRatio: typeof import('~icons/lucide/ratio.jsx')['default']const IconLucideRectangleHorizontal: typeof import('~icons/lucide/rectangle-horizontal.jsx')['default']const IconLucideRotateCcw: typeof import('~icons/lucide/rotate-ccw.jsx')['default']+ const IconLucideSave: typeof import('~icons/lucide/save.jsx')['default']const IconLucideSearch: typeof import('~icons/lucide/search.jsx')['default']const IconLucideSquarePlay: typeof import('~icons/lucide/square-play.jsx')['default']const IconLucideUnplug: typeof import('~icons/lucide/unplug.jsx')['default']