Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

feat: remove CursorMenu component and related cursor props from ControlPanel, update styles in ElementsMenu and Mockup menus, and enhance media mask styles

CristianOlivera162499b11e544
diff --git a/app/components/ui/editor/ControlPanel.tsx b/app/components/ui/editor/ControlPanel.tsx
index e4a6908..82e9586 100644
--- a/app/components/ui/editor/ControlPanel.tsx
+++ b/app/components/ui/editor/ControlPanel.tsx
@@ -25,8 +25,6 @@ import {
import { ElementsMenu } from "./ElementsMenu";
import { TooltipAction } from "@/components/ui/tooltip-action";
-import CursorMenu from "./CursorMenu";
-import { DEFAULT_CURSOR_CONFIG } from "@/types/cursor.types";
import { CameraMenu } from "./CameraMenu";
const ImageRecentBackgroundGrid = lazy(() => import("../ImageRecentBackgroundGrid").then(mod => ({ default: mod.ImageRecentBackgroundGrid })));
@@ -106,11 +104,7 @@ export function ControlPanel({
onUpdateAudioTrack,
onDeleteAudioTrack,
videoDuration = 0,
- // Cursor props
- cursorConfig = DEFAULT_CURSOR_CONFIG,
- cursorData,
isRecordedVideo = false,
- onCursorConfigChange,
// Videos library props
onAddVideoToTrack,
onRemoveVideoFromTrack,
@@ -385,17 +379,6 @@ export function ControlPanel({
</>
)}
- {activeTool === "cursor" && (
- <Suspense>
- <CursorMenu
- cursorConfig={cursorConfig}
- onCursorConfigChange={onCursorConfigChange || (() => { })}
- cursorData={cursorData}
- isRecordedVideo={isRecordedVideo}
- />
- </Suspense>
- )}
-
{activeTool === "camera" && (
<CameraMenu
cameraUrl={cameraUrl}
diff --git a/app/components/ui/editor/CursorMenu.tsx b/app/components/ui/editor/CursorMenu.tsx
deleted file mode 100644
index be43fae..0000000
--- a/app/components/ui/editor/CursorMenu.tsx
+++ /dev/null
@@ -1,284 +0,0 @@
-"use client";
-
-import { Icon } from "@iconify/react";
-import { SliderControl } from "../../../../components/ui/SliderControl";
-import { TooltipAction } from "@/components/ui/tooltip-action";
-import type { CursorConfig, CursorStyle, ClickEffect, CursorRecordingData } from "@/types/cursor.types";
-import { DEFAULT_CURSOR_CONFIG } from "@/types/cursor.types";
-import { MacDefaultCursor, WinDefaultCursor, DotDefaultCursor } from "@/components/cursor-svg";
-
-const PRESET_COLORS = ["#FFFFFF", "#000000", "#3B82F6", "#EF4444", "#10B981"];
-
-const CURSOR_STYLES: { id: CursorStyle; name: string; icon: string }[] = [
- { id: "none", name: "Ninguno", icon: "radix-icons:value-none" },
- { id: "mac", name: "macOS", icon: "ph:cursor-fill" },
- { id: "windows", name: "Windows", icon: "ph:cursor" },
- { id: "dot", name: "Minimalista", icon: "ph:circle-fill" },
-];
-
-const CLICK_EFFECTS: { id: ClickEffect; name: string }[] = [
- { id: "none", name: "Ninguno" },
- { id: "ripple", name: "Onda" },
- { id: "ring", name: "Aro" },
-];
-
-interface CursorMenuProps {
- cursorConfig: CursorConfig;
- onCursorConfigChange: (config: Partial<CursorConfig>) => void;
- cursorData?: CursorRecordingData;
- isRecordedVideo?: boolean;
-}
-
-export default function CursorMenu({
- cursorConfig = DEFAULT_CURSOR_CONFIG,
- onCursorConfigChange,
- cursorData,
- isRecordedVideo = false,
-}: CursorMenuProps) {
- const hasCursorData = cursorData?.hasCursorData || false;
-
- // Get the cursor preview element based on current style
- const getCursorPreviewElement = () => {
- const size = 40;
- const color = cursorConfig.color;
-
- switch (cursorConfig.style) {
- case "mac":
- return <MacDefaultCursor color={color === "#FFFFFF" ? "#000000" : color} size={size} />;
- case "windows":
- return <WinDefaultCursor color={color === "#FFFFFF" ? "#000000" : color} size={size} />;
- case "dot":
- return <DotDefaultCursor color={color} size={size} />;
- default:
- return null;
- }
- };
-
- return (
- <div className="p-4 flex flex-col gap-6">
-
- {/* Cabecera */}
- <div className="flex items-center gap-2 text-white font-medium">
- <Icon icon="ph:mouse-left-click-bold" width="20" className="text-white" />
- <span>Cursor</span>
- </div>
-
- {/* Warning if video has no cursor data */}
- {!isRecordedVideo && (
- <div className="p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/20 text-yellow-400/90 text-xs">
- <div className="flex items-start gap-2">
- <Icon icon="ph:warning" width="16" className="shrink-0 mt-0.5" />
- <p>
- Esta función solo está disponible para videos grabados con el navegador.
- Los videos subidos no incluyen datos del cursor.
- </p>
- </div>
- </div>
- )}
-
- {/* Info about cursor data availability */}
- {isRecordedVideo && !hasCursorData && (
- <div className="p-3 rounded-lg bg-blue-500/10 border border-blue-500/20 text-blue-400/90 text-xs">
- <div className="flex items-start gap-2">
- <Icon icon="ph:info" width="16" className="shrink-0 mt-0.5" />
- <p>
- Tu navegador no soporta la captura de posición del cursor.
- El cursor personalizado se mostrará en una posición estimada basada en las interacciones detectadas.
- </p>
- </div>
- </div>
- )}
-
- <div className="flex flex-col gap-6 animate-in fade-in duration-150">
-
- {/* Cursor Preview */}
- {cursorConfig.style !== "none" && (
- <div className="flex justify-center p-6 bg-linear-to-br from-white/5 to-white/2 rounded-xl border border-white/10">
- <div className="relative">
- {getCursorPreviewElement()}
- {cursorConfig.clickEffect !== "none" && (
- <div
- className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full animate-ping opacity-30"
- style={{
- width: 32,
- height: 32,
- backgroundColor: cursorConfig.clickEffectColor,
- }}
- />
- )}
- </div>
- </div>
- )}
-
- {/* Sección: Estilo del Cursor */}
- <div className="space-y-3">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">
- Estilo
- </div>
- <div className="grid grid-cols-4 gap-2">
- {CURSOR_STYLES.map((style) => (
- <TooltipAction label={style.name} key={style.id}>
- <button
- onClick={() => onCursorConfigChange({ style: style.id })}
- className={`py-3 bg-white/3 hover:bg-white/8 border squircle-element flex flex-col items-center justify-center gap-2 transition-all active:scale-95 group ${
- cursorConfig.style === style.id
- ? "border-blue-500/50 bg-blue-500/10 text-blue-400"
- : "border-white/[0.07] hover:border-white/20 text-white/60"
- }`}
- >
- <Icon
- icon={style.icon}
- width="20"
- className={cursorConfig.style === style.id ? "text-blue-400" : "group-hover:text-white transition-colors"}
- />
- <span className="text-[8px] font-medium">{style.name}</span>
- </button>
- </TooltipAction>
- ))}
- </div>
- </div>
-
- {/* Rest of options only show when cursor style is not "none" */}
- {cursorConfig.style !== "none" && (
- <>
- {/* Sección: Color */}
- <div className="space-y-3">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">
- Color Principal
- </div>
- <div className="flex gap-2">
- <div className="grid grid-cols-5 gap-2 flex-1">
- {PRESET_COLORS.map((color) => (
- <TooltipAction label={color} key={color}>
- <button
- onClick={() => onCursorConfigChange({ color })}
- className={`aspect-square squircle-element cursor-pointer transition-all border border-white/20 ${
- cursorConfig.color === color
- ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50"
- : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"
- }`}
- style={{ backgroundColor: color }}
- />
- </TooltipAction>
- ))}
- </div>
- <label className="relative cursor-pointer">
- <input
- type="color"
- value={cursorConfig.color}
- onChange={(e) => onCursorConfigChange({ color: e.target.value })}
- className="absolute inset-0 opacity-0 cursor-pointer"
- />
- <div
- className="w-10 h-10 aspect-square squircle-element border border-dashed border-white/30 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"
- style={{ backgroundColor: cursorConfig.color }}
- >
- <Icon icon="mdi:eyedropper" width="18" className="text-white mix-blend-difference" />
- </div>
- </label>
- </div>
- </div>
-
- {/* Tamaño del cursor */}
- <div className="space-y-4">
- <SliderControl
- icon="mdi:resize"
- label="Tamaño"
- value={cursorConfig.size}
- onChange={(size) => onCursorConfigChange({ size })}
- min={16}
- max={80}
- />
- </div>
-
- {/* Suavizado del movimiento */}
- <div className="space-y-4">
- <SliderControl
- icon="ph:wave-sine"
- label="Suavizado"
- value={cursorConfig.smoothing}
- onChange={(smoothing) => onCursorConfigChange({ smoothing })}
- min={0}
- max={100}
- />
- </div>
-
- {/* Separador */}
- <div className="h-px w-full bg-white/5" />
-
- {/* Sección: Efectos de Clic */}
- <div className="space-y-3">
- <div className="flex items-center justify-between">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">
- Efecto al hacer clic
- </div>
- </div>
-
- <div className="grid grid-cols-3 bg-[#09090B] squircle-element p-1 text-xs font-medium border border-white/5">
- {CLICK_EFFECTS.map((effect) => (
- <button
- key={effect.id}
- className={`flex justify-center items-center py-1.5 rounded transition ${
- cursorConfig.clickEffect === effect.id
- ? "bg-white/10 text-white"
- : "text-white/60 hover:text-white/80"
- }`}
- onClick={() => onCursorConfigChange({ clickEffect: effect.id })}
- >
- {effect.name}
- </button>
- ))}
- </div>
-
- {/* Click effect color */}
- {cursorConfig.clickEffect !== "none" && (
- <div className="flex items-center gap-3 pt-2">
- <span className="text-[11px] text-white/40">Color del efecto</span>
- <div className="flex gap-1.5 flex-1">
- {["#3B82F6", "#EF4444", "#10B981", "#F59E0B", "#8B5CF6"].map((color) => (
- <button
- key={color}
- onClick={() => onCursorConfigChange({ clickEffectColor: color })}
- className={`w-6 h-6 rounded-full transition-all ${
- cursorConfig.clickEffectColor === color
- ? "ring-2 ring-white/60 scale-110"
- : "hover:scale-105"
- }`}
- style={{ backgroundColor: color }}
- />
- ))}
- </div>
- </div>
- )}
- </div>
-
- {/* Separador */}
- <div className="h-px w-full bg-white/5" />
-
- {/* Toggle visibilidad */}
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Icon icon="ph:eye" width="16" className="text-white/40" />
- <span className="text-xs text-white/70">Mostrar cursor</span>
- </div>
- <button
- onClick={() => onCursorConfigChange({ visible: !cursorConfig.visible })}
- className={`w-10 h-5 rounded-full transition-all relative ${
- cursorConfig.visible
- ? "bg-blue-500"
- : "bg-white/20"
- }`}
- >
- <div
- className={`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-all ${
- cursorConfig.visible ? "left-5" : "left-0.5"
- }`}
- />
- </button>
- </div>
- </>
- )}
- </div>
- </div>
- );
-}
\ No newline at end of file
diff --git a/app/components/ui/editor/ElementsMenu.tsx b/app/components/ui/editor/ElementsMenu.tsx
index 72e18c3..7e09db1 100644
--- a/app/components/ui/editor/ElementsMenu.tsx
+++ b/app/components/ui/editor/ElementsMenu.tsx
@@ -276,7 +276,7 @@ export function ElementsMenu({
<div className="flex flex-col gap-5 animate-in fade-in duration-150" role="tabpanel" id="elements-panel">
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("sections.shapes")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("sections.shapes")}</div>
<div className="grid grid-cols-6 gap-2">
{PINNED_SVG_ITEMS.map((item) => (
<TooltipAction label={item.name} key={item.id}>
@@ -338,7 +338,7 @@ export function ElementsMenu({
</div>
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("sections.images")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("sections.images")}</div>
<div className="grid grid-cols-6 gap-1.5">
{PINNED_IMAGE_ITEMS.map((item) => (
<button key={item.id} onClick={() => handleAddImage(item)} className="aspect-square bg-white/3 hover:bg-white/8 border border-white/[0.07] hover:border-white/20 squircle-element flex items-center justify-center transition-all active:scale-90 overflow-hidden group">
@@ -397,7 +397,7 @@ export function ElementsMenu({
<>
{selectedElement.type === "svg" && (
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("properties.color")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("properties.color")}</div>
<div className="flex gap-2">
<div className="grid grid-cols-5 gap-2 flex-1">
{PRESET_COLORS.map((color) => (
@@ -427,12 +427,12 @@ export function ElementsMenu({
{mode === "text" && (
<div className="flex flex-col gap-5 animate-in fade-in duration-150">
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("text.content")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("text.content")}</div>
<input type="text" value={textContent} onChange={(e) => setTextContent(e.target.value)} className="w-full bg-white/4 hover:bg-white/[0.07] transition border border-white/8 squircle-element px-3 py-2 text-sm text-white placeholder:text-white/30 outline-none focus:border-white/20" placeholder={t("text.placeholder")} />
</div>
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("text.presets")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("text.presets")}</div>
<div className="grid grid-cols-2 gap-2">
{TEXT_PRESETS.map((p) => (
<button key={p.label} onClick={() => { setTextFontSize(p.fontSize); setTextFontWeight(p.weight); }} className="bg-white/3 hover:bg-white/[0.07] border border-white/[0.07] squircle-element px-3 py-2.5 text-left transition-all active:scale-[.98]">
@@ -445,7 +445,7 @@ export function ElementsMenu({
<div className="flex flex-row justify-between gap-2 space-y-2">
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("text.size")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("text.size")}</div>
<div className="flex items-center gap-2">
<input type="number" value={textFontSize || ""} onChange={(e) => { const val = e.target.value; if (val === "") { setTextFontSize(0); return; } const num = parseInt(val, 10); if (!isNaN(num)) setTextFontSize(Math.min(200, num)); }} onBlur={() => setTextFontSize((prev) => Math.max(8, Math.min(200, prev || 32)))} className="flex-1 bg-white/4 hover:bg-white/[0.07] transition border border-white/8 squircle-element px-3 py-2 text-sm text-white outline-none focus:border-white/20" min={8} max={200} />
<span className="text-xs text-white/60 w-6">px</span>
@@ -453,7 +453,7 @@ export function ElementsMenu({
</div>
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("text.font")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("text.font")}</div>
<Select value={textFontFamily} onValueChange={setTextFontFamily}>
<SelectTrigger className="w-full bg-white/4 hover:bg-white/[0.07] transition border-white/8 squircle-element text-white/80" style={{ fontFamily: textFontFamily }}>
<SelectValue />
@@ -468,7 +468,7 @@ export function ElementsMenu({
</div>
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("properties.color")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("properties.color")}</div>
<div className="flex gap-2">
<div className="grid grid-cols-5 gap-2 flex-1">
{PRESET_COLORS.map((color) => (
@@ -487,7 +487,7 @@ export function ElementsMenu({
</div>
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("text.weight")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("text.weight")}</div>
<div className="grid grid-cols-3 gap-2">
{FONT_WEIGHTS.map((w) => (
<button key={w.key} onClick={() => setTextFontWeight(w.key)} className={`px-3 py-2 rounded-lg text-xs transition-all squircle-element ${textFontWeight === w.key ? "bg-white/10 text-white border border-white/15" : "bg-white/3 text-white/35 hover:text-white/70 border border-white/6"}`}>
@@ -521,7 +521,7 @@ export function ElementsMenu({
{mode === "uploads" && (
<div className="flex flex-col gap-5 animate-in fade-in duration-150">
<div className="space-y-2">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">{t("uploads.title")}</div>
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">{t("uploads.title")}</div>
<label className={`group flex flex-col items-center justify-center w-full bg-[#09090B] border border-dashed border-white/10 hover:border-white/30 hover:bg-white/3 squircle-element p-8 text-center cursor-pointer transition-all ${isUploading ? "opacity-50 pointer-events-none" : ""}`} onDragOver={handleDragOver} onDrop={handleDrop}>
{isUploading ? (
<div className="flex flex-col items-center justify-center w-full">
@@ -549,7 +549,7 @@ export function ElementsMenu({
<div className="space-y-2">
<div className="flex justify-between items-center">
- <div className="text-[11px] uppercase tracking-widest text-white/40 font-semibold">
+ <div className="text-[11px] uppercase tracking-widest text-white/70 font-semibold">
{t("uploads.gallery", { count: uploadedImages.length })}
</div>
{uploadedImages.length > 0 && (
diff --git a/app/components/ui/editor/Mockup2dMenu.tsx b/app/components/ui/editor/Mockup2dMenu.tsx
index 1b5fc48..49ad592 100644
--- a/app/components/ui/editor/Mockup2dMenu.tsx
+++ b/app/components/ui/editor/Mockup2dMenu.tsx
@@ -128,7 +128,7 @@ export function Mockup2dMenu({
{features.hasFrameColor && (
<div className="space-y-2.5">
- <p className="text-[11px] uppercase tracking-widest text-white/40 font-bold">
+ <p className="text-[11px] uppercase tracking-widest text-white/70 font-bold">
{t("frameColor.label")}
</p>
<div className="grid grid-cols-6 gap-2">
@@ -159,7 +159,7 @@ export function Mockup2dMenu({
{features.hasUrl && (
<div className="space-y-2">
- <p className="text-[11px] uppercase tracking-widest text-white/40 font-bold">
+ <p className="text-[11px] uppercase tracking-widest text-white/70 font-bold">
{t("url.label")}
</p>
<div className="flex items-center gap-2 px-3 py-2 rounded-lg bg-[#09090B] border border-white/[0.07] focus-within:border-blue-500/40 transition-colors">
diff --git a/app/components/ui/editor/MockupMenu.tsx b/app/components/ui/editor/MockupMenu.tsx
index 3eb25ef..9f38bf1 100644
--- a/app/components/ui/editor/MockupMenu.tsx
+++ b/app/components/ui/editor/MockupMenu.tsx
@@ -300,7 +300,7 @@ export function MockupMenu({
</div>
<div className="flex flex-col gap-3">
- <p className="text-[11px] uppercase tracking-widest text-white/40 font-bold">
+ <p className="text-[11px] uppercase tracking-widest text-white/70 font-bold">
{t("frames2D")}
</p>
@@ -425,7 +425,7 @@ export function MockupMenu({
<div className="space-y-2">
<div className="grid grid-cols-3 gap-2">
- {["none", "macos", "macos-glass", "brave", "macos-dark-ide", "glass-curve"].map((id) => {
+ {["none", "outline", "macos", "macos-glass", "brave", "macos-dark-ide"].map((id) => {
const mockup = MOCKUPS.find((m) => m.id === id);
if (!mockup) return null;
@@ -468,7 +468,7 @@ export function MockupMenu({
<div className="h-px bg-white/6" />
<div className="flex flex-col gap-3">
<div className="flex items-center justify-between">
- <p className="text-[11px] uppercase tracking-widest text-white/40 font-bold">
+ <p className="text-[11px] uppercase tracking-widest text-white/70 font-bold">
{t("devices3D")}
</p>
<div className="flex items-center gap-2">
diff --git a/lib/media-mask.utils.ts b/lib/media-mask.utils.ts
index 136a08f..c2c522d 100644
--- a/lib/media-mask.utils.ts
+++ b/lib/media-mask.utils.ts
@@ -48,8 +48,10 @@ export function GetMediaMaskStyles(
return {
WebkitMaskImage: masks.join(', '),
+ WebkitMaskRepeat: 'no-repeat',
WebkitMaskComposite: 'source-in',
maskImage: masks.join(', '),
+ maskRepeat: 'no-repeat',
maskComposite: 'intersect',
};
}
diff --git a/lib/mockup-canvas/macos-container-glass.ts b/lib/mockup-canvas/macos-container-glass.ts
index e1576de..426a00c 100644
--- a/lib/mockup-canvas/macos-container-glass.ts
+++ b/lib/mockup-canvas/macos-container-glass.ts
@@ -43,7 +43,7 @@ export function drawMacosContainerGlassMockup(context: MockupCanvasContext): Moc
ctx.restore();
const headerScale = (config.headerScale || 100) / 100;
- const dotSize = 8 * headerScale;
+ const dotSize = 10 * headerScale;
const dotGap = 8 * headerScale;
const headerPaddingX = 4 * headerScale;
const headerPaddingB = 8 * headerScale;
diff --git a/types/control-panel.types.ts b/types/control-panel.types.ts
index 7d1bcfe..36e6ad7 100644
--- a/types/control-panel.types.ts
+++ b/types/control-panel.types.ts
@@ -4,7 +4,6 @@ import { ZoomFragment } from "./zoom.types";
import { MockupConfig, MenuPage } from "./mockup.types";
import type { CanvasElement } from "./canvas-elements.types";
import type { UploadedAudio, AudioTrack } from "./audio.types";
-import type { CursorConfig, CursorRecordingData } from "./cursor.types";
import type { CameraConfig } from "./camera.types";
import type { ImageProjectPreview } from "./image-project.types";
@@ -66,10 +65,7 @@ export interface ControlPanelProps {
onMasterVolumeChange?: (volume: number) => void;
videoDuration?: number;
// Cursor props
- cursorConfig?: CursorConfig;
- cursorData?: CursorRecordingData;
isRecordedVideo?: boolean;
- onCursorConfigChange?: (config: Partial<CursorConfig>) => void;
// Videos library props
onAddVideoToTrack?: (videoId: string, blob: Blob, duration: number) => void;
onRemoveVideoFromTrack?: (videoId: string) => void;
diff --git a/types/cursor.types.ts b/types/cursor.types.ts
deleted file mode 100644
index f2e13f3..0000000
--- a/types/cursor.types.ts
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * Cursor Types - Defines the structure for custom cursor overlays on recorded videos
- *
- * This system captures mouse position during screen recording and allows
- * replacing the native cursor with customizable cursor styles in the editor/export.
- */
-
-/** Cursor state based on CSS cursor property detected during recording */
-export type CursorState =
- | "default" // Normal arrow cursor
- | "pointer" // Hand/pointer (hover on buttons/links)
- | "text" // I-beam for text selection
- | "grab" // Open hand for dragging
- | "grabbing" // Closed hand while dragging
- | "wait" // Loading spinner
- | "progress" // Loading with arrow
- | "not-allowed" // Disabled/forbidden
- | "crosshair" // Precision selection
- | "move" // Move/drag indicator
- | "resize"; // Resize handles (simplified, covers all resize variants)
-
-/** A single keyframe of cursor position and state */
-export interface CursorKeyframe {
- /** Time in seconds from video start */
- time: number;
- /** X position as percentage of video width (0-100) */
- x: number;
- /** Y position as percentage of video height (0-100) */
- y: number;
- /** Current cursor state/style */
- state: CursorState;
- /** Whether the mouse button is currently pressed */
- clicking: boolean;
-}
-
-/** Cursor style/theme options */
-export type CursorStyle = "none" | "mac" | "windows" | "dot";
-
-/** Click effect animation options */
-export type ClickEffect = "none" | "ripple" | "ring";
-
-/** Cursor configuration for the editor */
-export interface CursorConfig {
- /** Which cursor style to display */
- style: CursorStyle;
- /** Main cursor color (for customizable cursors) */
- color: string;
- /** Cursor size multiplier (1 = default, 2 = double size, etc.) */
- size: number;
- /** Position smoothing factor (0 = no smoothing, 100 = max smoothing) */
- smoothing: number;
- /** Effect when clicking */
- clickEffect: ClickEffect;
- /** Click effect color */
- clickEffectColor: string;
- /** Whether to show cursor (master toggle) */
- visible: boolean;
-}
-
-/** Default cursor configuration */
-export const DEFAULT_CURSOR_CONFIG: CursorConfig = {
- style: "mac",
- color: "#FFFFFF",
- size: 32,
- smoothing: 50,
- clickEffect: "ripple",
- clickEffectColor: "#3B82F6",
- visible: true,
-};
-
-/** Recorded cursor data stored with video */
-export interface CursorRecordingData {
- /** Array of cursor keyframes captured during recording */
- keyframes: CursorKeyframe[];
- /** Original video dimensions used during recording */
- videoDimensions: {
- width: number;
- height: number;
- };
- /** Recording frame rate (for interpolation reference) */
- frameRate: number;
- /** Whether this recording has cursor data (false if captured without CaptureController support) */
- hasCursorData: boolean;
-}
-
-/** Empty cursor recording data */
-export const EMPTY_CURSOR_DATA: CursorRecordingData = {
- keyframes: [],
- videoDimensions: { width: 1920, height: 1080 },
- frameRate: 60,
- hasCursorData: false,
-};
-
-/**
- * Helper function to interpolate cursor position between keyframes
- * for smooth cursor movement at any playback time
- */
-export function interpolateCursorPosition(
- keyframes: CursorKeyframe[],
- time: number,
- smoothing: number = 50
-): CursorKeyframe | null {
- if (keyframes.length === 0) return null;
-
- // Find the two keyframes surrounding the current time
- let prevFrame: CursorKeyframe | null = null;
- let nextFrame: CursorKeyframe | null = null;
-
- for (let i = 0; i < keyframes.length; i++) {
- if (keyframes[i].time <= time) {
- prevFrame = keyframes[i];
- }
- if (keyframes[i].time >= time && !nextFrame) {
- nextFrame = keyframes[i];
- break;
- }
- }
-
- // If no previous frame, return first frame
- if (!prevFrame) return keyframes[0];
-
- // If no next frame, return last frame
- if (!nextFrame) return keyframes[keyframes.length - 1];
-
- // If same frame, return it
- if (prevFrame === nextFrame) return prevFrame;
-
- // Calculate interpolation factor
- const duration = nextFrame.time - prevFrame.time;
- const progress = (time - prevFrame.time) / duration;
-
- // Apply smoothing using easeInOutCubic
- const smoothingFactor = smoothing / 100;
- const easedProgress = easeInOutCubic(progress) * smoothingFactor + progress * (1 - smoothingFactor);
-
- // Interpolate position
- return {
- time,
- x: lerp(prevFrame.x, nextFrame.x, easedProgress),
- y: lerp(prevFrame.y, nextFrame.y, easedProgress),
- state: progress < 0.5 ? prevFrame.state : nextFrame.state,
- clicking: prevFrame.clicking || nextFrame.clicking,
- };
-}
-
-/** Linear interpolation */
-function lerp(a: number, b: number, t: number): number {
- return a + (b - a) * t;
-}
-
-/** Easing function for smooth cursor movement */
-function easeInOutCubic(t: number): number {
- return t < 0.5
- ? 4 * t * t * t
- : 1 - Math.pow(-2 * t + 2, 3) / 2;
-}
-
-/** Check if browser supports CaptureController API for cursor capture */
-export function supportsCursorCapture(): boolean {
- if (typeof window === 'undefined') return false;
- return 'CaptureController' in window;
-}
diff --git a/types/editor.types.ts b/types/editor.types.ts
index a4bc5b5..558e72d 100644
--- a/types/editor.types.ts
+++ b/types/editor.types.ts
@@ -1,6 +1,5 @@
import type { ZoomFragment } from "./zoom.types";
import type { CanvasElement } from "./canvas-elements.types";
-import type { CursorConfig, CursorRecordingData } from "./cursor.types";
export type Tool = "screenshot" | "elements" | "audio" | "zoom" | "mockup" | "cursor" | "video" | "camera" | "history" | "motion";
@@ -111,8 +110,6 @@ export interface VideoCanvasProps {
onElementUpdate?: (id: string, updates: Partial<CanvasElement>) => void;
onElementSelect?: (id: string | null) => void;
onElementDelete?: (id: string | string[]) => void;
- cursorConfig?: CursorConfig;
- cursorData?: CursorRecordingData;
cameraUrl?: string | null;
cameraConfig?: import("./camera.types").CameraConfig | null;
onCameraConfigChange?: (partial: Partial<import("./camera.types").CameraConfig>) => void;
diff --git a/types/mockup.types.ts b/types/mockup.types.ts
index b377c54..ffacdca 100644
--- a/types/mockup.types.ts
+++ b/types/mockup.types.ts
@@ -47,6 +47,7 @@ export interface MockupRenderProps {
children: React.ReactNode;
config: MockupConfig;
className?: string;
+ maskStyles?: React.CSSProperties;
}
// Default configuration