Create professional demos and 3D mockups in seconds, directly in your browser
feat(cursor): add cursor tracking and customization features
CristianOlivera1453c2c5502d7
diff --git a/app/(editor)/editor/page.tsx b/app/(editor)/editor/page.tsxindex 6a6eebe..db41782 100644--- a/app/(editor)/editor/page.tsx+++ b/app/(editor)/editor/page.tsx@@ -13,6 +13,8 @@ import type { ExportQuality, Tool, BackgroundTab, VideoCanvasHandle, BackgroundCimport type { TrimRange } from "@/types/timeline.types";import type { MockupConfig } from "@/types/mockup.types";import type { EditorState } from "@/types/editor-state.types";+import type { CursorConfig, CursorRecordingData } from "@/types/cursor.types";+import { DEFAULT_CURSOR_CONFIG, EMPTY_CURSOR_DATA } from "@/types/cursor.types";import { createInitialEditorState } from "@/types/editor-state.types";import { DEFAULT_MOCKUP_CONFIG, getMockupDefaultConfig } from "@/types/mockup.types";import type { CanvasElement } from "@/types/canvas-elements.types";@@ -198,6 +200,11 @@ export default function Editor() {const [masterVolume, setMasterVolume] = useState<number>(1);const [selectedAudioTrackId, setSelectedAudioTrackId] = useState<string | null>(null);+ // Cursor state+ const [cursorConfig, setCursorConfig] = useState<CursorConfig>(DEFAULT_CURSOR_CONFIG);+ const [cursorData, setCursorData] = useState<CursorRecordingData>(EMPTY_CURSOR_DATA);+ const [isRecordedVideo, setIsRecordedVideo] = useState<boolean>(false);+// Audio trim modal stateconst [autoTrimModalOpen, setAutoTrimModalOpen] = useState(false);const [pendingAudioUpload, setPendingAudioUpload] = useState<{@@ -281,7 +288,6 @@ export default function Editor() {}}, [audioTracks]);- // Cleanup audio elements on unmountuseEffect(() => {const elementsRef = audioElementsRef.current;return () => {@@ -293,12 +299,6 @@ export default function Editor() {};}, []);- // ====================- // Undo/Redo Sync - Bidirectional state synchronization- // ====================-- // Sync individual states → editorState (for history tracking)- // Debounced to avoid creating history entries on every keystrokeconst updateEditorStateDebounced = useRef<NodeJS.Timeout | null>(null);useEffect(() => {if (updateEditorStateDebounced.current) {@@ -608,6 +608,11 @@ export default function Editor() {setMasterVolume(volume);}, []);+ // Cursor config change handler+ const handleCursorConfigChange = useCallback((config: Partial<CursorConfig>) => {+ setCursorConfig(prev => ({ ...prev, ...config }));+ }, []);+const handleSelectAudioTrack = useCallback((trackId: string | null) => {setSelectedAudioTrackId(trackId);// Clear zoom fragment selection when selecting audio track@@ -756,6 +761,20 @@ export default function Editor() {});}+ // Load cursor data if available (only for recorded videos)+ if ('isRecordedVideo' in videoToLoad && videoToLoad.isRecordedVideo) {+ setIsRecordedVideo(true);+ if ('cursorData' in videoToLoad && videoToLoad.cursorData) {+ setCursorData(videoToLoad.cursorData);+ } else {+ setCursorData(EMPTY_CURSOR_DATA);+ }+ } else {+ // Uploaded video - no cursor data+ setIsRecordedVideo(false);+ setCursorData(EMPTY_CURSOR_DATA);+ }+// Clear undo/redo history when loading a new video// Use longer timeout to ensure all state updates complete firstsetTimeout(() => {@@ -1314,6 +1333,11 @@ export default function Editor() {onMasterVolumeChange={handleMasterVolumeChange}videoDuration={videoDuration}videoHasAudioTrack={videoHasAudioTrack}+ // Cursor props+ cursorConfig={cursorConfig}+ cursorData={cursorData}+ isRecordedVideo={isRecordedVideo}+ onCursorConfigChange={handleCursorConfigChange}/></Suspense></motion.div>@@ -1395,6 +1419,9 @@ export default function Editor() {selectedElementId={selectedElementId}onElementUpdate={updateCanvasElement}onElementSelect={selectCanvasElement}+ // Cursor overlay props+ cursorConfig={cursorConfig}+ cursorData={cursorData}onEnded={() => {setIsPlaying(false);justEndedRef.current = true;@@ -1521,6 +1548,11 @@ export default function Editor() {onMasterVolumeChange={handleMasterVolumeChange}videoDuration={videoDuration}videoHasAudioTrack={videoHasAudioTrack}+ // Cursor props+ cursorConfig={cursorConfig}+ cursorData={cursorData}+ isRecordedVideo={isRecordedVideo}+ onCursorConfigChange={handleCursorConfigChange}/><Suspense fallback={null}>diff --git a/app/(home)/donate/DonateClient.tsx b/app/(home)/donate/DonateClient.tsxnew file mode 100644index 0000000..5c52fdd--- /dev/null+++ b/app/(home)/donate/DonateClient.tsx@@ -0,0 +1,202 @@+"use client";++import { Icon } from "@iconify/react";+import Link from "next/link";+import { useState } from "react";+import { type DONATION_METHODS } from "./page";++type Method = typeof DONATION_METHODS[number];++export default function DonateClient({+ methods,+ defaultMethod+}: {+ methods: Method[];+ defaultMethod: string;+}) {+ // Inicializamos el estado con el método que nos indica el servidor+ const [selected, setSelected] = useState<string | null>(defaultMethod);+ const [copied, setCopied] = useState<string | null>(null);+ const [qrModalSrc, setQrModalSrc] = useState<string | null>(null);++ const handleCopy = (text: string, key: string) => {+ const cleanText = text.replace(/\s/g, '');+ navigator.clipboard.writeText(cleanText);+ setCopied(key);+ setTimeout(() => setCopied(null), 2000);+ };++ return (+ <div className="min-h-screen bg-black text-white overflow-hidden pt-24 pb-16 relative">+ <div className="max-w-2xl mx-auto px-4">++ <Link+ href="/"+ className="inline-flex items-center gap-2 text-sm text-white/40 hover:text-white mb-12 transition-colors group font-medium"+ >+ <Icon icon="lucide:arrow-left" width="16" className="group-hover:-translate-x-1 transition-transform" />+ Volver al inicio+ </Link>++ <div className="mb-10">+ <h1 className="text-2xl font-semibold text-white mb-2 tracking-tight">+ Apoya el desarrollo+ </h1>+ <p className="text-white/50 text-sm leading-relaxed max-w-lg">+ openvid es una herramienta de código abierto. Tu contribución nos permite mantener los servidores activos y continuar el desarrollo de nuevas características.+ </p>+ </div>++ <div className="flex flex-col bg-[#0A0A0A] border border-white/10 rounded-xl overflow-hidden shadow-2xl">+ <div className="px-5 py-3 border-b border-white/10 bg-white/5 flex items-center justify-between">+ <span className="text-[10px] font-semibold uppercase tracking-[0.15em] text-white/50">+ Métodos+ </span>+ <Icon icon="lucide:shield-check" width="14" className="text-white/30" />+ </div>++ <div className="flex flex-col">+ {methods.map((method) => (+ <div key={method.id} className="border-b border-white/5 last:border-0">+ <button+ onClick={() => setSelected(selected === method.id ? null : method.id)}+ className="w-full flex items-center justify-between p-5 text-left transition-colors hover:bg-white/5 group"+ >+ <div className="flex items-center gap-4">+ <div className="w-9 h-9 rounded bg-[#1C1C1F] border border-white/10 flex items-center justify-center shrink-0 overflow-hidden group-hover:border-white/20 transition-colors">+ {method.image ? (+ <img src={method.image} alt={method.name} className="w-full h-full object-cover opacity-80 group-hover:opacity-100 transition-opacity" />+ ) : (+ <Icon icon={method.icon!} width="18" style={{ color: method.color }} className="opacity-80 group-hover:opacity-100 transition-opacity" />+ )}+ </div>+ <div>+ <div className="flex items-center gap-2 mb-0.5">+ <span className="text-sm font-medium text-white/90 group-hover:text-white transition-colors">{method.name}</span>+ <span className="text-[9px] uppercase tracking-wider text-white/40 border border-white/10 px-1.5 py-0.5 rounded font-medium">+ {method.tagline}+ </span>+ </div>+ <p className="text-[11px] text-white/40">{method.detail}</p>+ </div>+ </div>+ <Icon+ icon="lucide:chevron-down"+ width="16"+ className={`text-white/30 shrink-0 transition-transform duration-300 ${selected === method.id ? "rotate-180 text-white/70" : ""}`}+ />+ </button>++ {selected === method.id && (+ <div className="bg-[#131315] border-t border-white/5 px-5 py-6 animate-in fade-in slide-in-from-top-2 duration-200">++ {method.id === "yape" && (+ <div className="space-y-4 max-w-md">+ <div className="flex flex-col items-center p-5 bg-black border border-white/10 rounded-lg">+ <button+ onClick={() => setQrModalSrc(method.qrImage!)}+ className="relative w-32 h-32 bg-white rounded flex items-center justify-center overflow-hidden cursor-pointer group hover:ring-2 hover:ring-white/20 transition-all"+ >+ <img src={method.qrImage} alt="Código QR Yape" className="w-full h-full object-contain transition-transform group-hover:scale-105" />+ <div className="absolute inset-0 bg-black/0 group-hover:bg-black/10 transition-colors flex items-center justify-center">+ <Icon icon="lucide:zoom-in" width="24" className="text-black opacity-0 group-hover:opacity-60 transition-opacity" />+ </div>+ </button>+ </div>++ <CopyRow label="Número celular" value={method.phone!} copyKey="yape-phone" copied={copied} onCopy={handleCopy} />+ </div>+ )}++ {method.id === "visa" && (+ <div className="space-y-3 max-w-md">+ <CopyRow label="Cuenta BCP (Soles)" value={method.account!} copyKey="visa-account" copied={copied} onCopy={handleCopy} />+ <CopyRow label="Código de Cuenta Interbancario (CCI)" value={method.cci!} copyKey="visa-cci" copied={copied} onCopy={handleCopy} />+ </div>+ )}++ {method.id === "paypal" && (+ <div className="space-y-4 max-w-md">+ <CopyRow label="Correo electrónico de PayPal" value={method.email!} copyKey="paypal-email" copied={copied} onCopy={handleCopy} />+ <div className="flex items-center gap-3">+ <div className="h-px bg-white/10 flex-1"></div>+ <span className="text-[10px] uppercase tracking-widest text-white/30 font-medium">o alternativamente</span>+ <div className="h-px bg-white/10 flex-1"></div>+ </div>+ <a+ href={method.link}+ target="_blank"+ rel="noopener noreferrer"+ className="flex items-center justify-center gap-2 w-full px-4 py-2.5 rounded-lg border border-white/10 bg-white/5 hover:bg-white/10 text-sm font-medium text-white transition-colors"+ >+ <Icon icon="lucide:external-link" width="16" className="text-white/50" />+ Abrir enlace de pago directo+ </a>+ </div>+ )}++ </div>+ )}+ </div>+ ))}+ </div>+ </div>+ </div>++ {qrModalSrc && (+ <div+ className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm animate-in fade-in duration-200"+ onClick={() => setQrModalSrc(null)}+ >+ <div+ className="relative w-full max-w-sm bg-[#131315] border border-white/10 rounded-2xl p-6 shadow-2xl flex flex-col items-center animate-in zoom-in-95 duration-200"+ onClick={(e) => e.stopPropagation()}+ >+ <div className="w-full flex justify-between items-center mb-6">+ <span className="text-sm font-semibold text-white/90 tracking-wide">Escanear código QR</span>+ <button+ onClick={() => setQrModalSrc(null)}+ className="text-white/40 hover:text-white bg-white/5 hover:bg-white/10 rounded-full p-1.5 transition-colors"+ >+ <Icon icon="lucide:x" width="18" />+ </button>+ </div>++ <div className="w-full aspect-square bg-white rounded-xl overflow-hidden flex items-center justify-center p-2">+ <img src={qrModalSrc} alt="QR Ampliado" className="w-full h-full object-contain" />+ </div>++ <button+ onClick={() => setQrModalSrc(null)}+ className="mt-6 w-full py-2.5 rounded-lg border border-white/10 bg-white/5 hover:bg-white/10 text-sm font-medium text-white transition-colors"+ >+ Cerrar+ </button>+ </div>+ </div>+ )}+ </div>+ );+}++function CopyRow({ label, value, copyKey, copied, onCopy }: { label: string, value: string, copyKey: string, copied: string | null, onCopy: (val: string, key: string) => void }) {+ return (+ <div className="flex items-center justify-between bg-black border border-white/10 rounded-lg p-3 group">+ <div>+ <p className="text-[10px] uppercase tracking-wider text-white/40 mb-1 font-medium">{label}</p>+ <p className="font-mono text-sm text-white/90 tracking-wide">{value}</p>+ </div>+ <button+ onClick={() => onCopy(value, copyKey)}+ className={`flex items-center gap-1.5 px-3 py-1.5 rounded border transition-all text-xs font-medium ${+ copied === copyKey+ ? "border-green-500/30 bg-green-500/10 text-green-400"+ : "border-white/10 bg-white/5 text-white/60 hover:text-white hover:bg-white/10"+ }`}+ >+ <Icon icon={copied === copyKey ? "lucide:check" : "lucide:copy"} width="14" />+ {copied === copyKey ? "Copiado" : "Copiar"}+ </button>+ </div>+ );+}\ No newline at end of filediff --git a/app/(home)/donate/page.tsx b/app/(home)/donate/page.tsxnew file mode 100644index 0000000..10f3fca--- /dev/null+++ b/app/(home)/donate/page.tsx@@ -0,0 +1,52 @@+import { headers } from "next/headers";+import DonateClient from "./DonateClient";++export const DONATION_METHODS = [+ {+ id: "yape",+ name: "Yape",+ tagline: "Transferencia local",+ icon: "simple-icons:yape",+ image: "/images/pages/yape.avif",+ color: "#6C3EB8",+ detail: "Escanea el QR o usa el número de teléfono",+ phone: "+51 954 306 632",+ qrImage: "/images/pages/qr.avif",+ },+ {+ id: "visa",+ name: "Transferencia Bancaria",+ tagline: "Red nacional",+ icon: "mdi:bank-outline",+ image: "/images/pages/visa.avif",+ color: "#F5A623",+ detail: "Depósito directo a cuenta BCP (Soles)",+ account: "200-12083829-0-69",+ cci: "002-20011208382906945",+ },+ {+ id: "paypal",+ name: "PayPal",+ tagline: "Transferencia internacional",+ icon: "logos:paypal",+ color: "#009CDE",+ detail: "Envío mediante correo electrónico o enlace directo",+ email: "[email protected]",+ link: "https://www.paypal.com/ncp/payment/AZ3LS98LJ9SM2",+ },+];++export default async function DonatePage() {+ const headersList = await headers();+ const country = headersList.get("x-user-country") || "UNKNOWN";++ const isPeru = country === "PE" || country === "UNKNOWN";++ const availableMethods = isPeru+ ? DONATION_METHODS+ : DONATION_METHODS.filter(m => m.id !== "yape");++ const defaultMethod = isPeru ? "yape" : "paypal";++ return <DonateClient methods={availableMethods} defaultMethod={defaultMethod} />;+}\ No newline at end of filediff --git a/app/(home)/page.tsx b/app/(home)/page.tsxindex 80abbe6..618ac57 100644--- a/app/(home)/page.tsx+++ b/app/(home)/page.tsx@@ -1,3 +1,4 @@+import DonationCard from "../components/ui/DonationCard";import EditorPreview from "../components/ui/EditorPreview";import Hero from "../components/ui/Hero";import InteractiveRecordingSteps from "../components/ui/RecordingSteps";@@ -18,6 +19,12 @@ export default function Home() {<InteractiveRecordingSteps /></div></section>++ <section className="py-16 w-full mb-20">+ <div className="max-w-xl mx-auto px-6">+ <DonationCard />+ </div>+ </section></div>);}\ No newline at end of filediff --git a/app/(legal)/privacy/page.tsx b/app/(legal)/privacy/page.tsxindex 27b0fd7..e28f45a 100644--- a/app/(legal)/privacy/page.tsx+++ b/app/(legal)/privacy/page.tsx@@ -7,7 +7,6 @@ export default function PrivacyPage() {return (<div className="min-h-screen bg-[#09090B] py-16 px-4 sm:px-6 lg:px-8"><div className="max-w-3xl mx-auto">- {/* Header */}<div className="mb-12"><Linkhref="/"@@ -25,7 +24,6 @@ export default function PrivacyPage() {</p></div>- {/* Content */}<div className="space-y-10 text-white/70 leading-relaxed"><section><h2 className="text-xl font-medium text-white mb-4">1. Introducción</h2>@@ -167,7 +165,6 @@ export default function PrivacyPage() {</section></div>- {/* Footer Info */}<div className="mt-16 pt-8 border-t border-white/10"><p className="text-sm text-white/50">Al usar openvid, también aceptas nuestros{" "}diff --git a/app/(legal)/terms/page.tsx b/app/(legal)/terms/page.tsxindex 3a19c69..175c144 100644--- a/app/(legal)/terms/page.tsx+++ b/app/(legal)/terms/page.tsx@@ -7,7 +7,6 @@ export default function TermsPage() {return (<div className="min-h-screen bg-[#09090B] py-16 px-4 sm:px-6 lg:px-8"><div className="max-w-3xl mx-auto">- {/* Header */}<div className="mb-12"><Linkhref="/"@@ -25,7 +24,6 @@ export default function TermsPage() {</p></div>- {/* Content */}<div className="space-y-10 text-white/70 leading-relaxed"><section><h2 className="text-xl font-medium text-white mb-4">1. Aceptación de los Términos</h2>@@ -121,7 +119,6 @@ export default function TermsPage() {</section></div>- {/* Footer Info */}<div className="mt-16 pt-8 border-t border-white/10"><p className="text-sm text-white/50">Al usar openvid, también aceptas nuestra{" "}diff --git a/app/components/common/Footer.tsx b/app/components/common/Footer.tsxindex cdb8362..2d030fa 100644--- a/app/components/common/Footer.tsx+++ b/app/components/common/Footer.tsx@@ -26,6 +26,7 @@ export default function Footer() {<li><a href="#docs" className="hover:text-white transition-colors">Documentación</a></li><li><Link href="/editor" className="hover:text-white transition-colors">Ir al editor</Link></li>{/* <li><a href="#" className="hover:text-white transition-colors">Pricing</a></li> */}+ <li><a href="/donate" target="_blank" className="hover:text-white transition-colors">Donar</a></li></ul></div><div>diff --git a/app/components/common/Header.tsx b/app/components/common/Header.tsxindex dab1f1b..dc39423 100644--- a/app/components/common/Header.tsx+++ b/app/components/common/Header.tsx@@ -69,6 +69,7 @@ export default function Header() {Ir al editor</Link>)}+ <Link href="/donate" target="_blank" className="hover:text-white transition-colors">Donar</Link></div><div className="flex items-center gap-2">diff --git a/app/components/ui/DonationCard.tsx b/app/components/ui/DonationCard.tsxnew file mode 100644index 0000000..dffb134--- /dev/null+++ b/app/components/ui/DonationCard.tsx@@ -0,0 +1,40 @@+"use client";+import React from 'react';+import { Icon } from "@iconify/react";++export default function DonationCard() {+ return (+ <a+ href="/donate"+ target="_blank"+ rel="noopener noreferrer"+ className="relative group flex items-center justify-between w-full overflow-hidden rounded-3xl border border-white/10 bg-[#0E0E12] p-8 transition-all hover:border-white/20 hover:bg-white/4 active:scale-[0.99]"+ >+ <div className="absolute -right-20 -top-20 h-64 w-64 rounded-full bg-blue-500/15 blur-[80px] pointer-events-none transition-opacity group-hover:opacity-100 opacity-50" />++ <div className="relative z-10 flex items-center gap-6">+ <div className="flex h-14 w-14 items-center justify-center rounded-2xl bg-white/5 text-white border border-white/10 group-hover:bg-white/10 transition-colors shrink-0">+ <Icon icon="carbon:cafe" width="28" height="28" />+ </div>++ <div className="flex flex-col">+ <h4 className="text-xl font-medium text-white tracking-tight">+ Cómprame un café+ </h4>+ <p className="text-sm text-neutral-500 group-hover:text-neutral-400 transition-colors">+ Apoya al proyecto openvid+ </p>+ </div>+ </div>++ <div className="relative z-10 flex items-center gap-4 text-neutral-600 group-hover:text-white transition-all">+ <Icon+ icon="carbon:arrow-right"+ width="24"+ height="24"+ className="transform group-hover:translate-x-1 transition-transform"+ />+ </div>+ </a>+ );+}diff --git a/app/components/ui/EditorPreview.tsx b/app/components/ui/EditorPreview.tsxindex efe2b8f..db51279 100644--- a/app/components/ui/EditorPreview.tsx+++ b/app/components/ui/EditorPreview.tsx@@ -1,7 +1,6 @@'use client';import { useEffect, useRef } from 'react';import Atropos from 'atropos';-import 'atropos/css';export default function EditorPreview() {const atroposRef = useRef<HTMLDivElement>(null);@@ -22,7 +21,7 @@ export default function EditorPreview() {}, []);return (- <div className="relative max-w-6xl mx-auto mt-10 sm:mt-0 hero-perspective-container">+ <div className="relative max-w-6xl mx-auto mt-30 sm:mt-0 hero-perspective-container"><div className="hero-3d-wrapper relative w-full">diff --git a/app/components/ui/SidebarTool.tsx b/app/components/ui/SidebarTool.tsxindex af56ace..2718e75 100644--- a/app/components/ui/SidebarTool.tsx+++ b/app/components/ui/SidebarTool.tsx@@ -8,27 +8,42 @@ interface SidebarToolProps {label?: string;isActive?: boolean;onClick?: () => void;+ badge?: string;+ disabled?: boolean;}-export function SidebarTool({ icon, label, isActive, onClick }: SidebarToolProps) {+export function SidebarTool({ icon, label, isActive, onClick, badge, disabled }: SidebarToolProps) {return (<button- onClick={onClick}- className={`relative flex flex-col items-center gap-1.5 transition-all duration-200 group w-full ${isActive ? "text-white" : "text-white/60 hover:text-white"- }`}+ onClick={disabled ? undefined : onClick}+ disabled={disabled}+ className={`relative flex flex-col items-center gap-1.5 transition-all duration-200 group w-full+ ${disabled ? "opacity-40 cursor-not-allowed" : "cursor-pointer"}+ ${isActive ? "text-white" : "text-white/60 hover:text-white"}`+ }>- {isActive && (+ {badge && (+ <div className="absolute -top-1 -right-0.5 z-10 px-1.5 py-0.5 bg-linear-to-r from-gray-500 to-gray-500 rounded-full border border-white/20 shadow-lg pointer-events-none">+ <span className="text-[8px] font-bold text-white tracking-widest uppercase block drop-shadow-sm leading-none">+ {badge}+ </span>+ </div>+ )}++ {isActive && !disabled && (<div className="absolute inset-x-0 top-0 h-px bg-linear-to-r from-transparent via-white/20 to-transparent mx-2" />)}<span- className="flex items-center justify-center p-3 squircle-element transition-all duration-200 group relative"- style={isActive ? {+ className={`flex items-center justify-center p-3 squircle-element transition-all duration-200 group relative+ ${!disabled && isActive ? "" : "group-hover:bg-white/5"}+ `}+ style={isActive && !disabled ? {background: 'radial-gradient(circle at 50% 0%, #555555 0%, #454545 64%)',boxShadow: 'inset 0 1.01rem 0.2rem -1rem #fff, 0 0 0 1px #fff4, 0 4px 4px 0 #0004, 0 0 0 1px #333',} : {}}>- <div className={`transition-transform duration-300 ${isActive ? "scale-110" : "group-hover:scale-105"}`}>+ <div className={`transition-transform duration-300 ${isActive && !disabled ? "scale-110" : !disabled ? "group-hover:scale-105" : ""}`}>{typeof icon === "string" ? (<Icon icon={icon} width="20" />) : (@@ -38,13 +53,13 @@ export function SidebarTool({ icon, label, isActive, onClick }: SidebarToolProps)}</div>- {isActive && (+ {isActive && !disabled && (<div className="absolute left-1 w-8 h-2 top-1/5 -translate-y-1/2 size-3 bg-white rounded-full blur-[5px] rotate-45 opacity-50" />)}</span>{label && (- <label className="text-xs font-medium cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis max-w-full">+ <label className={`text-xs font-medium whitespace-nowrap overflow-hidden text-ellipsis max-w-full ${disabled ? "cursor-not-allowed" : "cursor-pointer"}`}>{label}</label>)}diff --git a/app/components/ui/editor/ControlPanel.tsx b/app/components/ui/editor/ControlPanel.tsxindex ab525cd..bd93d80 100644--- a/app/components/ui/editor/ControlPanel.tsx+++ b/app/components/ui/editor/ControlPanel.tsx@@ -11,6 +11,8 @@ import { lazy, Suspense } from "react";import { ElementsMenuSkeleton, ZoomGlobalConfigSkeleton, MockupMenuSkeleton, WallpaperSkeleton, BackgroundColorSkeleton, ImageBackgroundSkeleton, ZoomFragmentEditorSkeleton, AudioMenuSkeleton } from "../Skeleton";import { ElementsMenu } from "./ElementsMenu";import { TooltipAction } from "@/components/ui/tooltip-action";+import CursorMenu from "./CursorMenu";+import { DEFAULT_CURSOR_CONFIG } from "@/types/cursor.types";// Lazy load heavy components - only load when neededconst ImageRecentBackgroundGrid = lazy(() => import("../ImageRecentBackgroundGrid").then(mod => ({ default: mod.ImageRecentBackgroundGrid })));@@ -86,6 +88,11 @@ export function ControlPanel({onMasterVolumeChange,videoDuration = 0,videoHasAudioTrack = true,+ // Cursor props+ cursorConfig = DEFAULT_CURSOR_CONFIG,+ cursorData,+ isRecordedVideo = false,+ onCursorConfigChange,}: ExtendedControlPanelProps) {return (<div className="relative w-full sm:w-[320px] h-screen bg-[#141417] border-r border-white/10 flex flex-col shrink-0">@@ -229,6 +236,17 @@ export function ControlPanel({</>)}+ {activeTool === "cursor" && (+ <Suspense >+ <CursorMenu+ cursorConfig={cursorConfig}+ onCursorConfigChange={onCursorConfigChange || (() => {})}+ cursorData={cursorData}+ isRecordedVideo={isRecordedVideo}+ />+ </Suspense>+ )}+{activeTool === "elements" && (<Suspense fallback={<ElementsMenuSkeleton />}><ElementsMenudiff --git a/app/components/ui/editor/CursorMenu.tsx b/app/components/ui/editor/CursorMenu.tsxnew file mode 100644index 0000000..3fd8672--- /dev/null+++ b/app/components/ui/editor/CursorMenu.tsx@@ -0,0 +1,284 @@+"use client";++import { Icon } from "@iconify/react";+import { SliderControl } from "../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-[10px] 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/50"+ }`}+ >+ <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-[10px] 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-[10px] 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/50 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-[10px] 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/60">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 filediff --git a/app/components/ui/editor/MobileControlPanel.tsx b/app/components/ui/editor/MobileControlPanel.tsxindex 2a221d0..8cf81e0 100644--- a/app/components/ui/editor/MobileControlPanel.tsx+++ b/app/components/ui/editor/MobileControlPanel.tsx@@ -3,7 +3,6 @@import { Suspense } from "react";import { Icon } from "@iconify/react";import * as Dialog from "@radix-ui/react-dialog";-import type { Tool } from "@/types";import type { ControlPanelProps } from "@/types/control-panel.types";import { LoadingSpinner } from "@/app/components/ui/LoadingSpinner";@@ -12,7 +11,6 @@ interface MobileControlPanelProps extends ControlPanelProps {onClose: () => void;}-// Dynamic importsimport dynamic from "next/dynamic";const ControlPanel = dynamic(@@ -46,6 +44,7 @@ export function MobileControlPanel({controlPanelProps.activeTool === "elements" ? "mdi:shape-outline" :controlPanelProps.activeTool === "audio" ? "mdi:volume-high" :controlPanelProps.activeTool === "zoom" ? "iconamoon:zoom-in-bold" :+ controlPanelProps.activeTool === "cursor" ? "ph:cursor-fill" :"hugeicons:ai-browser"}width="20"@@ -55,6 +54,7 @@ export function MobileControlPanel({{controlPanelProps.activeTool === "audio" && "Audio"}{controlPanelProps.activeTool === "zoom" && "Zoom"}{controlPanelProps.activeTool === "mockup" && "Mockup"}+ {controlPanelProps.activeTool === "cursor" && "Cursor"}</Dialog.Title><Dialog.Close asChild><buttondiff --git a/app/components/ui/editor/ToolsSidebar.tsx b/app/components/ui/editor/ToolsSidebar.tsxindex 7aa1582..fedce3c 100644--- a/app/components/ui/editor/ToolsSidebar.tsx+++ b/app/components/ui/editor/ToolsSidebar.tsx@@ -9,13 +9,15 @@ import { TooltipAction } from "@/components/ui/tooltip-action";interface ExtendedToolsSidebarProps extends ToolsSidebarProps {onVideoUpload?: (file: File) => void;isUploading?: boolean;+ isCursorEnabled?: boolean;}export function ToolsSidebar({activeTool,onToolChange,onVideoUpload,- isUploading = false+ isUploading = false,+ isCursorEnabled = false}: ExtendedToolsSidebarProps) {const fileInputRef = useRef<HTMLInputElement>(null);const [isDragging, setIsDragging] = useState(false);@@ -35,19 +37,19 @@ export function ToolsSidebar({const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {e.preventDefault();e.stopPropagation();- if (!isDragging) setIsDragging(true); // Activamos el estado visual+ if (!isDragging) setIsDragging(true);};const handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {e.preventDefault();e.stopPropagation();- setIsDragging(false); // Desactivamos el estado visual al salir+ setIsDragging(false);};const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {e.preventDefault();e.stopPropagation();- setIsDragging(false); // Desactivamos el estado visual al soltar+ setIsDragging(false);if (isUploading) return;@@ -70,13 +72,32 @@ export function ToolsSidebar({background: 'radial-gradient(circle at 50% 30%, #2a2a2a 0%, #131313 64%)',}}>- <div className="flex flex-col gap-4 w-full overflow-y-auto p-2">+ <div className="flex flex-col gap-4 w-full overflow-y-auto px-2 custom-scrollbar mask-y-from-85% mask-y-to-99%">++ <div className="shrink-0 h-4" aria-hidden="true" />+<SidebarToolicon="solar:gallery-wide-linear"label="Fondo"isActive={activeTool === "screenshot"}onClick={() => onToolChange("screenshot")}/>+ <SidebarTool+ icon="hugeicons:ai-browser"+ label="Mockup"+ isActive={activeTool === "mockup"}+ onClick={() => onToolChange("mockup")}+ />++ <SidebarTool+ icon="solar:cursor-bold-duotone"+ label="Cursor"+ isActive={activeTool === "cursor"}+ onClick={() => onToolChange("cursor")}+ badge={!isCursorEnabled ? "Pronto" : undefined}+ disabled={!isCursorEnabled}+ />+<SidebarToollabel="Elementos"isActive={activeTool === "elements"}@@ -113,14 +134,9 @@ export function ToolsSidebar({onClick={() => onToolChange("zoom")}/>- <SidebarTool- icon="hugeicons:ai-browser"- label="Mockup"- isActive={activeTool === "mockup"}- onClick={() => onToolChange("mockup")}- />-+ <div className="shrink-0 h-4" aria-hidden="true" /></div>+<divclassName="w-full p-2 relative flex flex-col items-center shrink-0 group"onDragOver={handleDragOver}@@ -170,4 +186,4 @@ export function ToolsSidebar({</aside></div>);-}+}\ No newline at end of filediff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsxindex 9c79c7a..e731f18 100644--- a/app/components/ui/editor/VideoCanvas.tsx+++ b/app/components/ui/editor/VideoCanvas.tsx@@ -1,9 +1,11 @@"use client";-import { useRef, useEffect, useImperativeHandle, forwardRef, useMemo, useState } from "react";+import { useRef, useEffect, useImperativeHandle, forwardRef, useMemo, useState, useCallback } from "react";import type { VideoCanvasHandle, VideoCanvasProps, VideoThumbnail } from "@/types";import type { ImageElement, SvgElement, CanvasElement } from "@/types/canvas-elements.types";import { ASPECT_RATIO_DIMENSIONS } from "@/types";+import { interpolateCursorPosition, DEFAULT_CURSOR_CONFIG, EMPTY_CURSOR_DATA } from "@/types/cursor.types";+import type { CursorKeyframe } from "@/types/cursor.types";import { getWallpaperUrl } from "@/lib/wallpaper.utils";import { drawRoundedRect, drawRoundedRectBottomOnly, calculateScaledPadding, applyCanvasBackground, getAspectRatioStyle, getMaxWidth } from "@/lib/canvas.utils";import { drawMockupToCanvas } from "@/lib/mockup-canvas.utils";@@ -14,9 +16,71 @@ import { MockupWrapper } from "./mockups/MockupWrapper";import { DEFAULT_MOCKUP_CONFIG } from "@/types/mockup.types";import { calculateSmoothZoom } from "@/lib/canvas.utils";import { SVG_COMPONENTS, getSvgDataUrl } from "@/components/canvas-svg";+import { getCursorSvgDataUrl } from "@/components/cursor-svg";import { VIDEO_Z_INDEX, BOTTOM_ONLY_RADIUS_MOCKUPS, SELF_SHADOWING_MOCKUPS } from "@/lib/constants";export type { VideoCanvasHandle, VideoCanvasProps };+type Corner = "top-left" | "top-right" | "bottom-right" | "bottom-left";++function getNearestCorner(e: React.MouseEvent<HTMLElement>, rotationDeg = 0): Corner {+ const rect = e.currentTarget.getBoundingClientRect();+ const cx = rect.left + rect.width / 2;+ const cy = rect.top + rect.height / 2;++ const dx = e.clientX - cx;+ const dy = e.clientY - cy;++ const rad = (-rotationDeg * Math.PI) / 180;+ const localX = dx * Math.cos(rad) - dy * Math.sin(rad);+ const localY = dx * Math.sin(rad) + dy * Math.cos(rad);++ const isRight = localX > 0;+ const isBottom = localY > 0;+ if (!isRight && !isBottom) return "top-left";+ if (isRight && !isBottom) return "top-right";+ if (isRight && isBottom) return "bottom-right";+ return "bottom-left";+}++function getCornerStyle(corner: Corner, offset = -10): React.CSSProperties {+ const base: React.CSSProperties = { position: "absolute", zIndex: 20 };+ switch (corner) {+ case "top-left":+ return { ...base, top: offset, left: offset, cursor: "nw-resize" };+ case "top-right":+ return { ...base, top: offset, right: offset, cursor: "ne-resize" };+ case "bottom-right":+ return { ...base, bottom: offset, right: offset, cursor: "se-resize" };+ case "bottom-left":+ return { ...base, bottom: offset, left: offset, cursor: "sw-resize" };+ }+}++const CORNER_ICON_ROTATION: Record<Corner, number> = {+ "top-right": 0, // posición natural del SVG+ "bottom-right": 90, // gira 90° a la derecha+ "bottom-left": 180, // gira 180°+ "top-left": 270, // gira 270°+};++function RotationHandleIcon({ corner, color = "#3b82f6" }: { corner: Corner; color?: string }) {+ const rot = CORNER_ICON_ROTATION[corner];+ const maskId = `rotation-mask-${corner}`;++ return (+ <div style={{ display: "flex", transform: `rotate(${rot}deg)` }}>+ <svg width="18" height="18" viewBox="0 0 685 670" fill="none" xmlns="http://www.w3.org/2000/svg">+ <mask id={maskId} maskUnits="userSpaceOnUse" x="-17.9957" y="-16.9657" width="719.848" height="701.972" fill="black">+ <rect fill="white" x="-17.9957" y="-16.9657" width="719.848" height="701.972" />+ <path d="M188.7 17.3203C192.371 20.6905 195.297 24.7568 196.896 29.5153C196.804 31.4331 196.628 33.3462 196.407 35.253L196.086 38.3485C194.185 45.1048 187.596 49.2812 182.3 53.4645L179.893 55.3804C170.681 62.6755 161.291 69.7335 151.888 76.7785L146.587 80.7623C142.336 83.9569 138.083 87.1485 133.827 90.3371C136.643 91.7362 138.62 92.1593 141.702 92.6303C221.494 105.429 298.804 139.014 361.051 190.907L363.116 192.61C386.479 211.924 407.834 233.265 427.193 256.593C428.51 258.175 429.841 259.745 431.187 261.303C436.124 267.044 440.735 273.001 445.304 279.039L447.144 281.465C451.048 286.661 454.678 291.975 458.182 297.446C458.972 298.651 459.763 299.855 460.555 301.057C467.035 310.998 472.939 321.209 478.629 331.621L479.952 334.032C490.563 353.458 499.248 373.561 507.205 394.202L508.112 396.528C532.411 459.154 538.3 527.308 533.707 593.826L536.359 591.825C538.266 590.388 540.177 588.958 542.093 587.536C547.16 583.76 552.068 579.908 556.803 575.724C559.317 573.573 561.966 571.63 564.625 569.663C566.651 568.108 568.562 566.469 570.478 564.781C574.33 561.404 578.359 558.322 582.475 555.275C584.3 553.907 586.097 552.504 587.867 551.066C592.182 548.09 595.457 547.11 600.709 547.252C606.012 548.246 610.34 550.778 613.423 555.254C616.471 560.89 617.202 565.69 615.538 571.991C611.911 579.023 605.957 583.371 599.841 588.182C597.764 589.824 595.695 591.477 593.635 593.139C590.552 595.621 587.465 598.099 584.374 600.573C579.939 604.125 575.509 607.686 571.084 611.255L568.966 612.962L564.737 616.371C562.596 618.097 560.454 619.822 558.311 621.548C554.757 624.408 551.204 627.27 547.653 630.134L543.385 633.572C541.279 635.269 539.173 636.967 537.067 638.666L535.056 640.287C531.434 643.215 527.882 646.227 524.401 649.321C520.128 652.924 517.027 654.734 511.276 654.638C504.105 654.004 499.663 652.411 494.944 646.952C492.961 644.459 491.036 641.92 489.17 639.337C487.454 637.019 485.664 634.855 483.756 632.696C480.714 629.246 477.973 625.634 475.234 621.942C473.027 619.061 470.646 616.357 468.252 613.632C466.614 611.711 465.096 609.742 463.596 607.712C461.593 605.011 459.475 602.398 457.248 599.879C454.628 596.895 452.205 593.821 449.837 590.634C447.52 587.515 445.157 584.511 442.585 581.601C439.023 577.562 435.848 573.275 432.645 568.951C430.766 566.503 428.804 564.231 426.725 561.954C422.256 556.843 419.912 551.54 420.356 544.631C421.353 539.257 423.925 535.418 428.315 532.199C432.962 529.558 437.478 528.95 442.76 529.556C451.493 532.113 456.527 540.68 461.659 547.618C463.214 549.643 464.853 551.555 466.541 553.47C469.161 556.454 471.584 559.528 473.952 562.715C476.269 565.834 478.632 568.838 481.205 571.75C484.822 575.845 488.047 580.2 491.28 584.603C493.001 586.821 494.783 588.71 496.789 590.662C504.124 496.484 482.562 403.63 431.234 323.957L429.63 321.468C428.235 319.326 426.829 317.19 425.414 315.061L423.957 312.797C419.497 305.991 414.657 299.488 409.77 292.985L407.699 290.221C403.597 284.783 399.284 279.507 394.769 274.406C393.892 273.397 393.014 272.387 392.138 271.377C328.722 199.526 238.424 143.586 142.368 130.844L138.269 130.285C134.982 129.837 131.694 129.395 128.405 128.958L130.038 131.102C135.126 137.781 140.205 144.466 145.275 151.158C147.881 154.598 150.492 158.034 153.109 161.467C155.636 164.781 158.155 168.101 160.667 171.426C161.626 172.691 162.588 173.954 163.553 175.215C164.905 176.987 166.251 178.763 167.591 180.545L169.913 183.602C173.799 189.622 174.325 194.307 173.148 201.193C171.749 206.255 169.054 209.036 164.818 212.141C159.201 214.73 155.104 214.729 149.217 213.352C142.679 210.418 138.628 203.943 134.466 198.389L132.361 195.61C130.075 192.585 127.794 189.557 125.517 186.526L120.747 180.204C117.419 175.792 114.094 171.377 110.773 166.96C106.938 161.861 103.096 156.766 99.2489 151.675C95.5407 146.767 91.837 141.855 88.1379 136.939C86.5663 134.852 84.993 132.767 83.418 130.682C81.2195 127.77 79.0256 124.855 76.8362 121.935L74.8605 119.328C70.2774 113.197 67.1715 108.398 67.725 100.558C68.83 93.5503 72.4821 90.3096 77.777 85.9979L79.4553 84.631C85.6232 79.6401 91.9415 74.85 98.2822 70.0813L102.047 67.2411C104.649 65.2779 107.253 63.3169 109.858 61.3581C113.178 58.8594 116.495 56.358 119.809 53.8538C122.389 51.9069 124.971 49.9612 127.553 48.0168L131.222 45.2499C137.374 40.6033 143.537 36.1004 150.092 32.0322C151.512 30.9025 152.898 29.7291 154.246 28.5137C164.229 19.7 175.218 10.6187 188.7 17.3203Z" />+ </mask>+ <path d="M188.7 17.3203C192.371 20.6905 195.297 24.7568 196.896 29.5153C196.804 31.4331 196.628 33.3462 196.407 35.253L196.086 38.3485C194.185 45.1048 187.596 49.2812 182.3 53.4645L179.893 55.3804C170.681 62.6755 161.291 69.7335 151.888 76.7785L146.587 80.7623C142.336 83.9569 138.083 87.1485 133.827 90.3371C136.643 91.7362 138.62 92.1593 141.702 92.6303C221.494 105.429 298.804 139.014 361.051 190.907L363.116 192.61C386.479 211.924 407.834 233.265 427.193 256.593C428.51 258.175 429.841 259.745 431.187 261.303C436.124 267.044 440.735 273.001 445.304 279.039L447.144 281.465C451.048 286.661 454.678 291.975 458.182 297.446C458.972 298.651 459.763 299.855 460.555 301.057C467.035 310.998 472.939 321.209 478.629 331.621L479.952 334.032C490.563 353.458 499.248 373.561 507.205 394.202L508.112 396.528C532.411 459.154 538.3 527.308 533.707 593.826L536.359 591.825C538.266 590.388 540.177 588.958 542.093 587.536C547.16 583.76 552.068 579.908 556.803 575.724C559.317 573.573 561.966 571.63 564.625 569.663C566.651 568.108 568.562 566.469 570.478 564.781C574.33 561.404 578.359 558.322 582.475 555.275C584.3 553.907 586.097 552.504 587.867 551.066C592.182 548.09 595.457 547.11 600.709 547.252C606.012 548.246 610.34 550.778 613.423 555.254C616.471 560.89 617.202 565.69 615.538 571.991C611.911 579.023 605.957 583.371 599.841 588.182C597.764 589.824 595.695 591.477 593.635 593.139C590.552 595.621 587.465 598.099 584.374 600.573C579.939 604.125 575.509 607.686 571.084 611.255L568.966 612.962L564.737 616.371C562.596 618.097 560.454 619.822 558.311 621.548C554.757 624.408 551.204 627.27 547.653 630.134L543.385 633.572C541.279 635.269 539.173 636.967 537.067 638.666L535.056 640.287C531.434 643.215 527.882 646.227 524.401 649.321C520.128 652.924 517.027 654.734 511.276 654.638C504.105 654.004 499.663 652.411 494.944 646.952C492.961 644.459 491.036 641.92 489.17 639.337C487.454 637.019 485.664 634.855 483.756 632.696C480.714 629.246 477.973 625.634 475.234 621.942C473.027 619.061 470.646 616.357 468.252 613.632C466.614 611.711 465.096 609.742 463.596 607.712C461.593 605.011 459.475 602.398 457.248 599.879C454.628 596.895 452.205 593.821 449.837 590.634C447.52 587.515 445.157 584.511 442.585 581.601C439.023 577.562 435.848 573.275 432.645 568.951C430.766 566.503 428.804 564.231 426.725 561.954C422.256 556.843 419.912 551.54 420.356 544.631C421.353 539.257 423.925 535.418 428.315 532.199C432.962 529.558 437.478 528.95 442.76 529.556C451.493 532.113 456.527 540.68 461.659 547.618C463.214 549.643 464.853 551.555 466.541 553.47C469.161 556.454 471.584 559.528 473.952 562.715C476.269 565.834 478.632 568.838 481.205 571.75C484.822 575.845 488.047 580.2 491.28 584.603C493.001 586.821 494.783 588.71 496.789 590.662C504.124 496.484 482.562 403.63 431.234 323.957L429.63 321.468C428.235 319.326 426.829 317.19 425.414 315.061L423.957 312.797C419.497 305.991 414.657 299.488 409.77 292.985L407.699 290.221C403.597 284.783 399.284 279.507 394.769 274.406C393.892 273.397 393.014 272.387 392.138 271.377C328.722 199.526 238.424 143.586 142.368 130.844L138.269 130.285C134.982 129.837 131.694 129.395 128.405 128.958L130.038 131.102C135.126 137.781 140.205 144.466 145.275 151.158C147.881 154.598 150.492 158.034 153.109 161.467C155.636 164.781 158.155 168.101 160.667 171.426C161.626 172.691 162.588 173.954 163.553 175.215C164.905 176.987 166.251 178.763 167.591 180.545L169.913 183.602C173.799 189.622 174.325 194.307 173.148 201.193C171.749 206.255 169.054 209.036 164.818 212.141C159.201 214.73 155.104 214.729 149.217 213.352C142.679 210.418 138.628 203.943 134.466 198.389L132.361 195.61C130.075 192.585 127.794 189.557 125.517 186.526L120.747 180.204C117.419 175.792 114.094 171.377 110.773 166.96C106.938 161.861 103.096 156.766 99.2489 151.675C95.5407 146.767 91.837 141.855 88.1379 136.939C86.5663 134.852 84.993 132.767 83.418 130.682C81.2195 127.77 79.0256 124.855 76.8362 121.935L74.8605 119.328C70.2774 113.197 67.1715 108.398 67.725 100.558C68.83 93.5503 72.4821 90.3096 77.777 85.9979L79.4553 84.631C85.6232 79.6401 91.9415 74.85 98.2822 70.0813L102.047 67.2411C104.649 65.2779 107.253 63.3169 109.858 61.3581C113.178 58.8594 116.495 56.358 119.809 53.8538C122.389 51.9069 124.971 49.9612 127.553 48.0168L131.222 45.2499C137.374 40.6033 143.537 36.1004 150.092 32.0322C151.512 30.9025 152.898 29.7291 154.246 28.5137C164.229 19.7 175.218 10.6187 188.7 17.3203Z" fill="#FEFEFE" />+ <path d="M188.7 17.3203C192.371 20.6905 195.297 24.7568 196.896 29.5153C196.804 31.4331 196.628 33.3462 196.407 35.253L196.086 38.3485C194.185 45.1048 187.596 49.2812 182.3 53.4645L179.893 55.3804C170.681 62.6755 161.291 69.7335 151.888 76.7785L146.587 80.7623C142.336 83.9569 138.083 87.1485 133.827 90.3371C136.643 91.7362 138.62 92.1593 141.702 92.6303C221.494 105.429 298.804 139.014 361.051 190.907L363.116 192.61C386.479 211.924 407.834 233.265 427.193 256.593C428.51 258.175 429.841 259.745 431.187 261.303C436.124 267.044 440.735 273.001 445.304 279.039L447.144 281.465C451.048 286.661 454.678 291.975 458.182 297.446C458.972 298.651 459.763 299.855 460.555 301.057C467.035 310.998 472.939 321.209 478.629 331.621L479.952 334.032C490.563 353.458 499.248 373.561 507.205 394.202L508.112 396.528C532.411 459.154 538.3 527.308 533.707 593.826L536.359 591.825C538.266 590.388 540.177 588.958 542.093 587.536C547.16 583.76 552.068 579.908 556.803 575.724C559.317 573.573 561.966 571.63 564.625 569.663C566.651 568.108 568.562 566.469 570.478 564.781C574.33 561.404 578.359 558.322 582.475 555.275C584.3 553.907 586.097 552.504 587.867 551.066C592.182 548.09 595.457 547.11 600.709 547.252C606.012 548.246 610.34 550.778 613.423 555.254C616.471 560.89 617.202 565.69 615.538 571.991C611.911 579.023 605.957 583.371 599.841 588.182C597.764 589.824 595.695 591.477 593.635 593.139C590.552 595.621 587.465 598.099 584.374 600.573C579.939 604.125 575.509 607.686 571.084 611.255L568.966 612.962L564.737 616.371C562.596 618.097 560.454 619.822 558.311 621.548C554.757 624.408 551.204 627.27 547.653 630.134L543.385 633.572C541.279 635.269 539.173 636.967 537.067 638.666L535.056 640.287C531.434 643.215 527.882 646.227 524.401 649.321C520.128 652.924 517.027 654.734 511.276 654.638C504.105 654.004 499.663 652.411 494.944 646.952C492.961 644.459 491.036 641.92 489.17 639.337C487.454 637.019 485.664 634.855 483.756 632.696C480.714 629.246 477.973 625.634 475.234 621.942C473.027 619.061 470.646 616.357 468.252 613.632C466.614 611.711 465.096 609.742 463.596 607.712C461.593 605.011 459.475 602.398 457.248 599.879C454.628 596.895 452.205 593.821 449.837 590.634C447.52 587.515 445.157 584.511 442.585 581.601C439.023 577.562 435.848 573.275 432.645 568.951C430.766 566.503 428.804 564.231 426.725 561.954C422.256 556.843 419.912 551.54 420.356 544.631C421.353 539.257 423.925 535.418 428.315 532.199C432.962 529.558 437.478 528.95 442.76 529.556C451.493 532.113 456.527 540.68 461.659 547.618C463.214 549.643 464.853 551.555 466.541 553.47C469.161 556.454 471.584 559.528 473.952 562.715C476.269 565.834 478.632 568.838 481.205 571.75C484.822 575.845 488.047 580.2 491.28 584.603C493.001 586.821 494.783 588.71 496.789 590.662C504.124 496.484 482.562 403.63 431.234 323.957L429.63 321.468C428.235 319.326 426.829 317.19 425.414 315.061L423.957 312.797C419.497 305.991 414.657 299.488 409.77 292.985L407.699 290.221C403.597 284.783 399.284 279.507 394.769 274.406C393.892 273.397 393.014 272.387 392.138 271.377C328.722 199.526 238.424 143.586 142.368 130.844L138.269 130.285C134.982 129.837 131.694 129.395 128.405 128.958L130.038 131.102C135.126 137.781 140.205 144.466 145.275 151.158C147.881 154.598 150.492 158.034 153.109 161.467C155.636 164.781 158.155 168.101 160.667 171.426C161.626 172.691 162.588 173.954 163.553 175.215C164.905 176.987 166.251 178.763 167.591 180.545L169.913 183.602C173.799 189.622 174.325 194.307 173.148 201.193C171.749 206.255 169.054 209.036 164.818 212.141C159.201 214.73 155.104 214.729 149.217 213.352C142.679 210.418 138.628 203.943 134.466 198.389L132.361 195.61C130.075 192.585 127.794 189.557 125.517 186.526L120.747 180.204C117.419 175.792 114.094 171.377 110.773 166.96C106.938 161.861 103.096 156.766 99.2489 151.675C95.5407 146.767 91.837 141.855 88.1379 136.939C86.5663 134.852 84.993 132.767 83.418 130.682C81.2195 127.77 79.0256 124.855 76.8362 121.935L74.8605 119.328C70.2774 113.197 67.1715 108.398 67.725 100.558C68.83 93.5503 72.4821 90.3096 77.777 85.9979L79.4553 84.631C85.6232 79.6401 91.9415 74.85 98.2822 70.0813L102.047 67.2411C104.649 65.2779 107.253 63.3169 109.858 61.3581C113.178 58.8594 116.495 56.358 119.809 53.8538C122.389 51.9069 124.971 49.9612 127.553 48.0168L131.222 45.2499C137.374 40.6033 143.537 36.1004 150.092 32.0322C151.512 30.9025 152.898 29.7291 154.246 28.5137C164.229 19.7 175.218 10.6187 188.7 17.3203Z" stroke="black" strokeWidth="25" mask={`url(#${maskId})`} />+ </svg>+ </div>+ );+}+export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(function VideoCanvas({videoRef,videoUrl,@@ -50,6 +114,9 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functselectedElementId = null,onElementUpdate,onElementSelect,+ // Cursor props+ cursorConfig = DEFAULT_CURSOR_CONFIG,+ cursorData = EMPTY_CURSOR_DATA,}, ref) {const wallpaperUrl = getWallpaperUrl(selectedWallpaper);@@ -87,6 +154,34 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functreturn { scale, translateX, translateY, transitionMs };}, [activeZoomFragment, zoomFragments, currentTime]);+ // Calculate current cursor position from cursor data+ const cursorPosition = useMemo<CursorKeyframe | null>(() => {+ if (!cursorConfig.visible || cursorConfig.style === "none" || !cursorData.hasCursorData) {+ return null;+ }+ return interpolateCursorPosition(cursorData.keyframes, currentTime, cursorConfig.smoothing);+ }, [cursorConfig.visible, cursorConfig.style, cursorConfig.smoothing, cursorData.hasCursorData, cursorData.keyframes, currentTime]);++ // Get cursor SVG data URL for rendering+ const cursorSvgDataUrl = useMemo(() => {+ if (!cursorPosition || cursorConfig.style === "none") return null;+ return getCursorSvgDataUrl(cursorConfig.style, cursorPosition.state, cursorConfig.color, cursorConfig.size);+ }, [cursorPosition, cursorConfig.style, cursorConfig.color, cursorConfig.size]);++ // Preload cursor image for canvas rendering+ const cursorImageRef = useRef<HTMLImageElement | null>(null);+ useEffect(() => {+ if (cursorSvgDataUrl) {+ const img = new Image();+ img.src = cursorSvgDataUrl;+ img.onload = () => {+ cursorImageRef.current = img;+ };+ } else {+ cursorImageRef.current = null;+ }+ }, [cursorSvgDataUrl]);+// Determinar qué background mostrar basado en el tab activoconst shouldShowUnsplashOverride = backgroundTab === "wallpaper" && unsplashOverrideUrl !== "";const shouldShowWallpaper = backgroundTab === "wallpaper" && selectedWallpaper >= 0 && !shouldShowUnsplashOverride;@@ -113,6 +208,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functconst [isVideoHovered, setIsVideoHovered] = useState(false);const [isDraggingVideo, setIsDraggingVideo] = useState(false);const [isDraggingRotation, setIsDraggingRotation] = useState(false);+ const [videoHoverCorner, setVideoHoverCorner] = useState<Corner>("top-right");const dragStartPos = useRef({ x: 0, y: 0, initialRotation: 0, initialTranslateX: 0, initialTranslateY: 0 });const lastAngleRef = useRef<number | null>(null);const videoContainerRef = useRef<HTMLDivElement>(null);@@ -189,15 +285,15 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functif (!cache.has(imageElement.imagePath)) {const img = new Image();img.crossOrigin = "anonymous"; // Prevenir problemas de CORS al exportar-+img.onload = () => {cache.set(imageElement.imagePath, img);};-+img.onerror = () => {console.error(`Failed to load canvas element image: ${imageElement.imagePath}`);};-+img.src = imageElement.imagePath;}}@@ -213,36 +309,24 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functif (isDraggingRotation) {const container = videoContainerRef.current;if (!container) return;-const rect = container.getBoundingClientRect();const centerX = rect.left + rect.width / 2;const centerY = rect.top + rect.height / 2;-const rawAngle = Math.atan2(e.clientY - centerY, e.clientX - centerX) * (180 / Math.PI) + 90;-- if (lastAngleRef.current === null) {- lastAngleRef.current = rawAngle;- }+ if (lastAngleRef.current === null) lastAngleRef.current = rawAngle;let delta = rawAngle - lastAngleRef.current;if (delta > 180) delta -= 360;if (delta < -180) delta += 360;lastAngleRef.current = rawAngle;-- onVideoTransformChange({- ...videoTransform,- rotation: videoTransform.rotation + delta,- });+ onVideoTransformChange({ ...videoTransform, rotation: videoTransform.rotation + delta });} else if (isDraggingVideo) {const deltaX = e.clientX - dragStartPos.current.x;const deltaY = e.clientY - dragStartPos.current.y;-const container = videoContainerRef.current;if (!container) return;-const rect = container.getBoundingClientRect();const percentX = (deltaX / rect.width) * 100;const percentY = (deltaY / rect.height) * 100;-onVideoTransformChange({...videoTransform,translateX: dragStartPos.current.initialTranslateX + percentX,@@ -259,7 +343,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functwindow.addEventListener("mousemove", handleMouseMove);window.addEventListener("mouseup", handleMouseUp);-return () => {window.removeEventListener("mousemove", handleMouseMove);window.removeEventListener("mouseup", handleMouseUp);@@ -272,43 +355,32 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functconst handleMouseMove = (e: MouseEvent) => {if (!selectedElementId || !onElementUpdate) return;-const selectedElement = canvasElements.find(el => el.id === selectedElementId);if (!selectedElement) return;if (isDraggingElementRotation) {const container = canvasContainerRef.current;if (!container) return;-const rect = container.getBoundingClientRect();const centerX = rect.left + rect.width * (selectedElement.x / 100);const centerY = rect.top + rect.height * (selectedElement.y / 100);-const currentAngle = Math.atan2(e.clientY - centerY, e.clientX - centerX) * (180 / Math.PI);const startAngle = Math.atan2(elementDragStart.current.y - centerY,elementDragStart.current.x - centerX) * (180 / Math.PI);-- // Normalize angle delta to -180 to +180 rangelet deltaAngle = currentAngle - startAngle;if (deltaAngle > 180) deltaAngle -= 360;if (deltaAngle < -180) deltaAngle += 360;-- const newRotation = elementDragStart.current.initialRotation + deltaAngle;-- onElementUpdate(selectedElementId, { rotation: newRotation });+ onElementUpdate(selectedElementId, { rotation: elementDragStart.current.initialRotation + deltaAngle });} else if (isDraggingElement) {const container = canvasContainerRef.current;if (!container) return;-const rect = container.getBoundingClientRect();const deltaX = e.clientX - elementDragStart.current.x;const deltaY = e.clientY - elementDragStart.current.y;-const percentX = (deltaX / rect.width) * 100;const percentY = (deltaY / rect.height) * 100;-onElementUpdate(selectedElementId, {x: Math.max(0, Math.min(100, elementDragStart.current.initialX + percentX)),y: Math.max(0, Math.min(100, elementDragStart.current.initialY + percentY)),@@ -323,7 +395,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functwindow.addEventListener("mousemove", handleMouseMove);window.addEventListener("mouseup", handleMouseUp);-return () => {window.removeEventListener("mousemove", handleMouseMove);window.removeEventListener("mouseup", handleMouseUp);@@ -396,7 +467,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functconst elemX = (element.x / 100) * canvasWidth;const elemY = (element.y / 100) * canvasHeight;-+// Calculate element dimensions using reference size to maintain consistent scalingconst elemWidth = (element.width / 100) * referenceSize;const elemHeight = (element.height / 100) * referenceSize;@@ -405,7 +476,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functconst imgAspectRatio = img.naturalWidth / img.naturalHeight;let finalWidth = elemWidth;let finalHeight = elemHeight;-+// Apply object-contain logic: scale to fit within element bounds while maintaining aspect ratioconst elementAspectRatio = elemWidth / elemHeight;if (imgAspectRatio > elementAspectRatio) {@@ -660,6 +731,81 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct// 8. Render elements ABOVE video (zIndex >= VIDEO_Z_INDEX)await renderCanvasElements(ctx, canvasElements, canvasWidth, canvasHeight, false);+ // 9. Render cursor overlay if enabled and data available+ if (cursorConfig.visible && cursorConfig.style !== "none" && cursorData.hasCursorData) {+ const frameTime = video.currentTime;+ const cursorPos = interpolateCursorPosition(cursorData.keyframes, frameTime, cursorConfig.smoothing);++ if (cursorPos) {+ // Get cursor image from cache+ const cursorDataUrl = getCursorSvgDataUrl(cursorConfig.style, cursorPos.state, cursorConfig.color, cursorConfig.size);+ if (cursorDataUrl) {+ const cursorImg = new Image();+ cursorImg.src = cursorDataUrl;++ // Wait for cursor image to load+ await new Promise<void>((resolve) => {+ if (cursorImg.complete) {+ resolve();+ } else {+ cursorImg.onload = () => resolve();+ cursorImg.onerror = () => resolve();+ }+ });++ // Calculate cursor position relative to the video area+ // The cursor positions stored are percentages of the video dimensions+ const cursorX = videoX + (cursorPos.x / 100) * videoWidth;+ const cursorY = videoY + (cursorPos.y / 100) * videoHeight;++ // Scale cursor size based on canvas dimensions+ const cursorScale = canvasWidth / 1920; // Reference 1920px+ const scaledCursorSize = cursorConfig.size * cursorScale;++ ctx.save();+ ctx.globalAlpha = 1;++ // Draw click effect if clicking+ if (cursorPos.clicking && cursorConfig.clickEffect !== "none") {+ ctx.save();+ const effectSize = scaledCursorSize * 2;++ if (cursorConfig.clickEffect === "ripple") {+ // Ripple effect - expanding circles+ ctx.beginPath();+ ctx.arc(cursorX, cursorY, effectSize, 0, Math.PI * 2);+ ctx.strokeStyle = cursorConfig.clickEffectColor;+ ctx.lineWidth = 3 * cursorScale;+ ctx.globalAlpha = 0.5;+ ctx.stroke();+ } else if (cursorConfig.clickEffect === "ring") {+ // Ring effect - solid ring+ ctx.beginPath();+ ctx.arc(cursorX, cursorY, effectSize * 0.8, 0, Math.PI * 2);+ ctx.strokeStyle = cursorConfig.clickEffectColor;+ ctx.lineWidth = 4 * cursorScale;+ ctx.globalAlpha = 0.7;+ ctx.stroke();+ }++ ctx.restore();+ }++ // Draw cursor image+ // Cursor hotspot is typically at top-left for arrow cursors+ ctx.drawImage(+ cursorImg,+ cursorX,+ cursorY,+ scaledCursorSize,+ scaledCursorSize+ );++ ctx.restore();+ }+ }+ }+ctx.restore();};@@ -783,13 +929,13 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functinitialTranslateY: videoTransform.translateY,};}}+ onMouseMove={(e) => { if (videoUrl) setVideoHoverCorner(getNearestCorner(e, videoTransform.rotation)); }}><div className="relative">{/* Rotation handle */}{isVideoHovered && videoUrl && onVideoTransformChange && (<div- data-rotation-handle- className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default active:cursor-default"+ data-rotation-handle style={getCornerStyle(videoHoverCorner, -14)}onMouseDown={(e) => {e.preventDefault();e.stopPropagation();@@ -804,15 +950,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct};}}>- <div className="p-0.5 border border-white hover:border-white/80 rounded shadow-sm bg-[#111]">- <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" className="text-gray-200">- <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />- </svg>- </div>- <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">- <div className="w-px h-1 bg-white" />- <div className="w-1 h-1 rounded-full bg-white" />- </div>+ <RotationHandleIcon corner={videoHoverCorner} color="#e5e7eb" /></div>)}{isVideoHovered && videoUrl && !isDraggingVideo && !isDraggingRotation && (@@ -828,7 +966,8 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functshadows={shadows}>{videoUrl ? (- <div className="relative flex items-center justify-center overflow-hidden max-w-full max-h-full rounded-[inherit]"> {/* Video element */}+ <div className="relative flex items-center justify-center overflow-hidden max-w-full max-h-full rounded-[inherit]"+ > {/* Video element */}<videoref={videoRef}src={videoUrl}@@ -884,6 +1023,50 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functelementDragStart={elementDragStart}layerZIndex={3}/>++ {/* Capa 4: Cursor overlay for preview */}+ {cursorPosition && cursorSvgDataUrl && cursorConfig.visible && cursorConfig.style !== "none" && (+ <div+ className="absolute inset-0 pointer-events-none"+ style={{+ zIndex: 4,+ padding: `${padding * 0.5}%`,+ }}+ >+ <div className="relative w-full h-full">+ {/* Click effect */}+ {cursorPosition.clicking && cursorConfig.clickEffect !== "none" && (+ <div+ className="absolute rounded-full animate-ping"+ style={{+ left: `${cursorPosition.x}%`,+ top: `${cursorPosition.y}%`,+ width: cursorConfig.size * 2,+ height: cursorConfig.size * 2,+ transform: 'translate(-50%, -50%)',+ backgroundColor: cursorConfig.clickEffectColor,+ opacity: cursorConfig.clickEffect === "ripple" ? 0.3 : 0.5,+ }}+ />+ )}+ {/* Cursor image */}+ <img+ src={cursorSvgDataUrl}+ alt="cursor"+ className="absolute pointer-events-none"+ style={{+ left: `${cursorPosition.x}%`,+ top: `${cursorPosition.y}%`,+ width: cursorConfig.size,+ height: cursorConfig.size,+ // Cursor hotspot at top-left for arrow cursors+ transform: 'translate(0, 0)',+ transition: cursorConfig.smoothing > 50 ? `all ${cursorConfig.smoothing}ms ease-out` : 'none',+ }}+ />+ </div>+ </div>+ )}</div></div></div>@@ -920,116 +1103,152 @@ function CanvasElementsLayer({elementDragStart: React.MutableRefObject<{ x: number; y: number; initialX: number; initialY: number; initialRotation: number }>;layerZIndex: number;}) {- // Filter elements based on whether they should be behind or above video+ const layerRef = useRef<HTMLDivElement>(null);+ const [refSize, setRefSize] = useState(0);++ // Per-element corner tracking: elementId → Corner+ const [elementCorners, setElementCorners] = useState<Record<string, Corner>>({});++ useEffect(() => {+ const el = layerRef.current;+ if (!el) return;+ const measure = () => {+ const { width, height } = el.getBoundingClientRect();+ setRefSize(Math.min(width, height));+ };+ measure();+ const ro = new ResizeObserver(measure);+ ro.observe(el);+ return () => ro.disconnect();+ }, []);++ const toPx = (pct: number) => refSize > 0 ? (pct / 100) * refSize : 0;++ const setRefs = useCallback((node: HTMLDivElement | null) => {+ (layerRef as React.MutableRefObject<HTMLDivElement | null>).current = node;+ if (canvasContainerRef) {+ const externalRef = canvasContainerRef as React.MutableRefObject<HTMLDivElement | null>;+ externalRef.current = node;+ }+ }, [canvasContainerRef]);+const filteredElements = canvasElements.filter(element =>behindVideo ? element.zIndex < VIDEO_Z_INDEX : element.zIndex >= VIDEO_Z_INDEX);- // If no elements to render, return empty div (but still set ref if provided)if (filteredElements.length === 0) {- return <div ref={canvasContainerRef} className="absolute inset-0 pointer-events-none" style={{ zIndex: layerZIndex }} />;+ return (+ <div+ ref={setRefs}+ className="absolute inset-0 pointer-events-none"+ style={{ zIndex: layerZIndex }}+ />+ );}return (<div- ref={canvasContainerRef}+ ref={setRefs}className="absolute inset-0"onClick={(e) => {- // Deselect element if clicking on background (not on an element)- if (e.target === e.currentTarget && onElementSelect) {- onElementSelect(null);- }+ if (e.target === e.currentTarget && onElementSelect) onElementSelect(null);}}style={{ zIndex: layerZIndex, pointerEvents: 'none' }}>- {/* Sort elements by zIndex for proper layering */}{[...filteredElements].sort((a, b) => a.zIndex - b.zIndex).map((element) => {const isSelected = selectedElementId === element.id;const isHovered = hoveredElementId === element.id;+ const activeCorner: Corner = elementCorners[element.id] ?? "top-right";++ const wPx = toPx(element.width);+ const hPx = toPx(element.height);++ const commonStyle: React.CSSProperties = {+ position: "absolute",+ left: `${element.x}%`,+ top: `${element.y}%`,+ width: wPx > 0 ? `${wPx}px` : `${element.width}%`,+ height: hPx > 0 ? `${hPx}px` : `${element.height}%`,+ transform: `translate(-50%, -50%) rotate(${element.rotation}deg)`,+ zIndex: element.zIndex,+ transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',+ };++ // ── Shared mouse handlers ──────────────────────────────────+ const handleMouseEnter = () => setHoveredElementId(element.id);+ const handleMouseLeave = () => setHoveredElementId(null);+ const handleMouseMove = (e: React.MouseEvent<HTMLElement>) => {+ // ✅ Pasar element.rotation para corregir el cálculo+ const corner = getNearestCorner(e, element.rotation);+ setElementCorners(prev => ({ ...prev, [element.id]: corner }));+ };+ const handleMouseDown = (e: React.MouseEvent<HTMLElement>) => {+ if (!onElementSelect) return;+ if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;+ e.preventDefault();+ e.stopPropagation();+ onElementSelect(element.id);+ setIsDraggingElement(true);+ elementDragStart.current = {+ x: e.clientX,+ y: e.clientY,+ initialX: element.x,+ initialY: element.y,+ initialRotation: element.rotation,+ };+ };++ // ── Rotation handle (shared across element types) ──────────+ const rotationHandle = isSelected && onElementUpdate ? (+ <div+ data-element-rotation+ style={getCornerStyle(activeCorner, -14)}+ onMouseDown={(e) => {+ e.preventDefault();+ e.stopPropagation();+ setIsDraggingElementRotation(true);+ elementDragStart.current = {+ x: e.clientX,+ y: e.clientY,+ initialX: element.x,+ initialY: element.y,+ initialRotation: element.rotation,+ };+ }}+ >+ <RotationHandleIcon corner={activeCorner} />+ </div>+ ) : null;+ // ── Selection / hover border ───────────────────────────────+ const selectionBorder = (isSelected || isHovered) ? (+ <div+ className={`absolute inset-0 border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}+ style={{ borderRadius: '2px' }}+ />+ ) : null;++ // ── Render by type ─────────────────────────────────────────if (element.type === "svg") {+ const SvgComponent = SVG_COMPONENTS[(element as SvgElement).svgId];return (<divkey={element.id}data-canvas-element- className="absolute pointer-events-auto cursor-move"- style={{- left: `${element.x}%`,- top: `${element.y}%`,- width: `${element.width}%`,- height: `${element.height}%`,- transform: `translate(-50%, -50%) rotate(${element.rotation}deg)`,- zIndex: element.zIndex,- transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',- }}- onMouseEnter={() => setHoveredElementId(element.id)}- onMouseLeave={() => setHoveredElementId(null)}- onMouseDown={(e) => {- if (!onElementSelect) return;- // Only start dragging if not clicking on rotation handle- if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;-- e.preventDefault();- e.stopPropagation();- onElementSelect(element.id);- setIsDraggingElement(true);- elementDragStart.current = {- x: e.clientX,- y: e.clientY,- initialX: element.x,- initialY: element.y,- initialRotation: element.rotation,- };- }}+ className="pointer-events-auto cursor-move"+ style={commonStyle}+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}+ onMouseMove={handleMouseMove}+ onMouseDown={handleMouseDown}>- {/* SVG element - render inline with color */}- {(() => {- const SvgComponent = SVG_COMPONENTS[element.svgId];- if (!SvgComponent) return null;- return (- <div className="w-full h-full" style={{ opacity: element.opacity }}>- <SvgComponent color={element.color} className="w-full h-full" />- </div>- );- })()}-- {/* Selection border and rotation handle */}- {(isSelected || isHovered) && (- <>- <div- className={`absolute -inset-px border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}- style={{ borderRadius: '2px' }}- />- {isSelected && onElementUpdate && (- <div- data-element-rotation- className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default"- onMouseDown={(e) => {- e.preventDefault();- e.stopPropagation();- setIsDraggingElementRotation(true);- elementDragStart.current = {- x: e.clientX,- y: e.clientY,- initialX: element.x,- initialY: element.y,- initialRotation: element.rotation,- };- }}- >- <div className="p-0.5 border border-blue-500 hover:border-blue-400 rounded shadow-sm bg-[#111]">- <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" className="text-blue-500">- <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />- </svg>- </div>- <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">- <div className="w-px h-1 bg-blue-500" />- <div className="w-1 h-1 rounded-full bg-blue-500" />- </div>- </div>- )}- </>+ {SvgComponent && (+ <div className="w-full h-full" style={{ opacity: element.opacity }}>+ <SvgComponent color={(element as SvgElement).color} className="w-full h-full" />+ </div>)}+ {selectionBorder}+ {rotationHandle}</div>);}@@ -1039,79 +1258,22 @@ function CanvasElementsLayer({<divkey={element.id}data-canvas-element- className="absolute pointer-events-auto cursor-move"- style={{- left: `${element.x}%`,- top: `${element.y}%`,- width: `${element.width}%`,- height: `${element.height}%`,- transform: `translate(-50%, -50%) rotate(${element.rotation}deg)`,- zIndex: element.zIndex,- transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',- }}- onMouseEnter={() => setHoveredElementId(element.id)}- onMouseLeave={() => setHoveredElementId(null)}- onMouseDown={(e) => {- if (!onElementSelect) return;- if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;-- e.preventDefault();- e.stopPropagation();- onElementSelect(element.id);- setIsDraggingElement(true);- elementDragStart.current = {- x: e.clientX,- y: e.clientY,- initialX: element.x,- initialY: element.y,- initialRotation: element.rotation,- };- }}+ className="pointer-events-auto cursor-move"+ style={commonStyle}+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}+ onMouseMove={handleMouseMove}+ onMouseDown={handleMouseDown}><img- src={element.imagePath}+ src={(element as ImageElement).imagePath}alt="Image element"crossOrigin="anonymous"className="w-full h-full object-contain rounded"style={{ pointerEvents: 'none', opacity: element.opacity }}/>-- {(isSelected || isHovered) && (- <>- <div- className={`absolute -inset-px border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}- style={{ borderRadius: '2px' }}- />- {isSelected && onElementUpdate && (- <div- data-element-rotation- className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default"- onMouseDown={(e) => {- e.preventDefault();- e.stopPropagation();- setIsDraggingElementRotation(true);- elementDragStart.current = {- x: e.clientX,- y: e.clientY,- initialX: element.x,- initialY: element.y,- initialRotation: element.rotation,- };- }}- >- <div className="p-0.5 border border-blue-500 hover:border-blue-400 rounded shadow-sm bg-[#111]">- <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" className="text-blue-500">- <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />- </svg>- </div>- <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">- <div className="w-px h-1 bg-blue-500" />- <div className="w-1 h-1 rounded-full bg-blue-500" />- </div>- </div>- )}- </>- )}+ {selectionBorder}+ {rotationHandle}</div>);}@@ -1129,24 +1291,10 @@ function CanvasElementsLayer({zIndex: element.zIndex,transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',}}- onMouseEnter={() => setHoveredElementId(element.id)}- onMouseLeave={() => setHoveredElementId(null)}- onMouseDown={(e) => {- if (!onElementSelect) return;- if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;-- e.preventDefault();- e.stopPropagation();- onElementSelect(element.id);- setIsDraggingElement(true);- elementDragStart.current = {- x: e.clientX,- y: e.clientY,- initialX: element.x,- initialY: element.y,- initialRotation: element.rotation,- };- }}+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}+ onMouseMove={handleMouseMove}+ onMouseDown={handleMouseDown}><divclassName="whitespace-nowrap"@@ -1162,43 +1310,13 @@ function CanvasElementsLayer({>{element.content}</div>-{(isSelected || isHovered) && (- <>- <div- className={`absolute -inset-x-2 -inset-y-1 border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}- style={{ borderRadius: '2px' }}- />- {isSelected && onElementUpdate && (- <div- data-element-rotation- className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default"- onMouseDown={(e) => {- e.preventDefault();- e.stopPropagation();- setIsDraggingElementRotation(true);- elementDragStart.current = {- x: e.clientX,- y: e.clientY,- initialX: element.x,- initialY: element.y,- initialRotation: element.rotation,- };- }}- >- <div className="p-0.5 border border-blue-500 hover:border-blue-400 rounded shadow-sm bg-[#111]">- <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" className="text-blue-500">- <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />- </svg>- </div>- <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">- <div className="w-px h-1 bg-blue-500" />- <div className="w-1 h-1 rounded-full bg-blue-500" />- </div>- </div>- )}- </>+ <div+ className={`absolute -inset-x-2 -inset-y-1 border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}+ style={{ borderRadius: '2px' }}+ />)}+ {rotationHandle}</div>);}diff --git a/app/globals.css b/app/globals.cssindex 7085ee7..d5e4176 100644--- a/app/globals.css+++ b/app/globals.css@@ -1,6 +1,7 @@@import "tailwindcss";@import "tw-animate-css";@import "shadcn/tailwind.css";+@import 'atropos/scss';@custom-variant dark (&:is(.dark *));@@ -282,4 +283,5 @@ button {.atropos-highlight {border-radius: 1rem;-}\ No newline at end of file+}+diff --git a/components/cursor-svg/index.tsx b/components/cursor-svg/index.tsxnew file mode 100644index 0000000..6798e7a--- /dev/null+++ b/components/cursor-svg/index.tsx@@ -0,0 +1,752 @@+/**+ * Cursor SVG Components - Custom cursor overlays for video recordings+ *+ * Provides SVG cursors in three styles: macOS, Windows, and Dot+ * Each style supports multiple cursor states (default, pointer, text, etc.)+ */++import type { CursorState, CursorStyle } from "@/types/cursor.types";++interface CursorSvgProps {+ color?: string;+ size?: number;+ className?: string;+}++// ============================================================================+// macOS Cursors+// ============================================================================++/** macOS default arrow cursor */+export const MacDefaultCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 01.35-.15h6.87c.48 0 .73-.58.39-.92L5.84 2.86a.5.5 0 00-.34-.15c-.28 0-.5.22-.5.5z"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1.5"+ />+ </svg>+);++/** macOS pointer (hand) cursor */+export const MacPointerCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M9.5 5v9.795a.75.75 0 01-1.28.53l-2.72-2.72a1 1 0 00-1.41 0l-.1.1a1 1 0 000 1.41l4.54 4.54a2 2 0 001.41.59h6.1a2 2 0 002-2V13.5a1 1 0 00-1-1h-.5v-1a1 1 0 00-1-1h-.5V10a1 1 0 00-1-1h-.5V5.5a1 1 0 00-1-1h-1a1 1 0 00-1 1v-.5z"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1.2"+ />+ </svg>+);++/** macOS text (I-beam) cursor */+export const MacTextCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M12 4V20M8 4H16M8 20H16"+ stroke="#FFFFFF"+ strokeWidth="3"+ strokeLinecap="round"+ />+ <path+ d="M12 4V20M8 4H16M8 20H16"+ stroke={color}+ strokeWidth="1.5"+ strokeLinecap="round"+ />+ </svg>+);++/** macOS crosshair cursor */+export const MacCrosshairCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <circle cx="12" cy="12" r="8" stroke="#FFFFFF" strokeWidth="3" fill="none" />+ <circle cx="12" cy="12" r="8" stroke={color} strokeWidth="1.5" fill="none" />+ <path d="M12 2V8M12 16V22M2 12H8M16 12H22" stroke="#FFFFFF" strokeWidth="3" strokeLinecap="round" />+ <path d="M12 2V8M12 16V22M2 12H8M16 12H22" stroke={color} strokeWidth="1.5" strokeLinecap="round" />+ </svg>+);++/** macOS grab (open hand) cursor */+export const MacGrabCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M8 12V7a1 1 0 112 0v4m0 0V6a1 1 0 112 0v5m0 0V6.5a1 1 0 112 0V11m0 0V8a1 1 0 112 0v6a5 5 0 01-5 5h-2a5 5 0 01-5-5v-2a1 1 0 011-1h1"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1.2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+);++/** macOS grabbing (closed hand) cursor */+export const MacGrabbingCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M18 11V14a5 5 0 01-5 5h-2a5 5 0 01-5-5v-3a1 1 0 011-1h1a1 1 0 011 1v0m9 0a1 1 0 00-1-1h0a1 1 0 00-1 1v0m2-1v-1a1 1 0 00-1-1h0a1 1 0 00-1 1v1m0 0a1 1 0 00-1-1h0a1 1 0 00-1 1v1m0-1V9a1 1 0 00-1-1h0a1 1 0 00-1 1v1"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1.2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+);++/** macOS wait (spinner) cursor */+export const MacWaitCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <circle cx="12" cy="12" r="9" stroke="#FFFFFF" strokeWidth="3" fill="none" />+ <circle cx="12" cy="12" r="9" stroke={color} strokeWidth="1.5" fill="none" strokeDasharray="40 60" />+ <circle cx="12" cy="12" r="4" fill={color} />+ </svg>+);++/** macOS not-allowed cursor */+export const MacNotAllowedCursor = ({ color: _color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <circle cx="12" cy="12" r="9" stroke="#FFFFFF" strokeWidth="3" fill="none" />+ <circle cx="12" cy="12" r="9" stroke="#EF4444" strokeWidth="1.5" fill="none" />+ <path d="M5.5 18.5L18.5 5.5" stroke="#FFFFFF" strokeWidth="3" strokeLinecap="round" />+ <path d="M5.5 18.5L18.5 5.5" stroke="#EF4444" strokeWidth="1.5" strokeLinecap="round" />+ </svg>+);++/** macOS move cursor */+export const MacMoveCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M12 3L8 7h3v4H7V8l-4 4 4 4v-3h4v4H8l4 4 4-4h-3v-4h4v3l4-4-4-4v3h-4V7h3l-4-4z"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1"+ />+ </svg>+);++/** macOS resize cursor */+export const MacResizeCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M4 9L4 4L9 4M15 4L20 4L20 9M20 15L20 20L15 20M9 20L4 20L4 15"+ stroke="#FFFFFF"+ strokeWidth="3"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M4 9L4 4L9 4M15 4L20 4L20 9M20 15L20 20L15 20M9 20L4 20L4 15"+ stroke={color}+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+);++// ============================================================================+// Windows Cursors+// ============================================================================++/** Windows default arrow cursor */+export const WinDefaultCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M4 4L4 20L9 15L12 21L14 20L11 14L17 14L4 4Z"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1.5"+ strokeLinejoin="round"+ />+ </svg>+);++/** Windows pointer (hand) cursor */+export const WinPointerCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M11 4v7h-1a2 2 0 00-2 2v1a6 6 0 006 6h1a5 5 0 005-5v-4a2 2 0 00-2-2h-1V7a2 2 0 00-2-2h0a2 2 0 00-2 2v2a2 2 0 00-4 0V4a2 2 0 00-2-2h0a2 2 0 00-2 2v7"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1.2"+ />+ </svg>+);++/** Windows text (I-beam) cursor */+export const WinTextCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M12 3V21M9 3H15M9 21H15"+ stroke="#FFFFFF"+ strokeWidth="3.5"+ strokeLinecap="round"+ />+ <path+ d="M12 3V21M9 3H15M9 21H15"+ stroke={color}+ strokeWidth="2"+ strokeLinecap="round"+ />+ </svg>+);++/** Windows crosshair cursor */+export const WinCrosshairCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path d="M12 2V22M2 12H22" stroke="#FFFFFF" strokeWidth="3" strokeLinecap="round" />+ <path d="M12 2V22M2 12H22" stroke={color} strokeWidth="1.5" strokeLinecap="round" />+ <rect x="10" y="10" width="4" height="4" fill="#FFFFFF" stroke={color} strokeWidth="1" />+ </svg>+);++/** Windows grab cursor */+export const WinGrabCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M7 11v-1a2 2 0 114 0m0 0v-1a2 2 0 114 0v1m0 0a2 2 0 114 0v5a7 7 0 01-7 7h-1a7 7 0 01-7-7v-2a2 2 0 114 0"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1.2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+);++/** Windows grabbing cursor */+export const WinGrabbingCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M7 15v-3a2 2 0 012-2h0a2 2 0 012 2m0 0a2 2 0 012-2h0a2 2 0 012 2m0 0a2 2 0 012-2h0a2 2 0 012 2v3a7 7 0 01-7 7h-1a7 7 0 01-7-7v-3a2 2 0 114 0"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1.2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+);++/** Windows wait cursor */+export const WinWaitCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <circle cx="12" cy="12" r="10" fill="#FFFFFF" stroke={color} strokeWidth="1.5" />+ <path d="M12 6v6l4 2" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />+ </svg>+);++/** Windows not-allowed cursor */+export const WinNotAllowedCursor = ({ color: _color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <circle cx="12" cy="12" r="10" fill="#FFFFFF" stroke="#EF4444" strokeWidth="2" />+ <path d="M7 7L17 17" stroke="#EF4444" strokeWidth="2" strokeLinecap="round" />+ </svg>+);++/** Windows move cursor */+export const WinMoveCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M12 2L9 5h2v5H6V8l-3 4 3 4v-2h5v5H9l3 3 3-3h-2v-5h5v2l3-4-3-4v2h-5V5h2l-3-3z"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1"+ strokeLinejoin="round"+ />+ </svg>+);++/** Windows resize cursor */+export const WinResizeCursor = ({ color = "#000000", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ style={{ filter: 'drop-shadow(1px 1px 1px rgba(0,0,0,0.3))' }}+ >+ <path+ d="M4 4L10 4L4 10L4 4ZM20 20L14 20L20 14L20 20Z"+ fill="#FFFFFF"+ stroke={color}+ strokeWidth="1.5"+ />+ <path d="M4 4L20 20" stroke="#FFFFFF" strokeWidth="3" />+ <path d="M4 4L20 20" stroke={color} strokeWidth="1.5" />+ </svg>+);++// ============================================================================+// Dot Cursors (Minimalist)+// ============================================================================++/** Dot default cursor */+export const DotDefaultCursor = ({ color = "#FFFFFF", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <circle+ cx="12"+ cy="12"+ r="6"+ fill={color}+ stroke="rgba(0,0,0,0.5)"+ strokeWidth="2"+ />+ </svg>+);++/** Dot pointer cursor - slightly larger */+export const DotPointerCursor = ({ color = "#FFFFFF", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <circle+ cx="12"+ cy="12"+ r="8"+ fill={color}+ stroke="rgba(0,0,0,0.5)"+ strokeWidth="2"+ />+ </svg>+);++/** Dot text cursor - vertical line */+export const DotTextCursor = ({ color = "#FFFFFF", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <rect+ x="10"+ y="4"+ width="4"+ height="16"+ rx="2"+ fill={color}+ stroke="rgba(0,0,0,0.5)"+ strokeWidth="1"+ />+ </svg>+);++/** Dot crosshair cursor */+export const DotCrosshairCursor = ({ color = "#FFFFFF", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <circle+ cx="12"+ cy="12"+ r="3"+ fill={color}+ stroke="rgba(0,0,0,0.5)"+ strokeWidth="1"+ />+ <circle+ cx="12"+ cy="12"+ r="8"+ fill="none"+ stroke={color}+ strokeWidth="2"+ />+ </svg>+);++/** Dot grab cursor */+export const DotGrabCursor = ({ color = "#FFFFFF", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <circle cx="8" cy="12" r="3" fill={color} stroke="rgba(0,0,0,0.5)" strokeWidth="1" />+ <circle cx="16" cy="12" r="3" fill={color} stroke="rgba(0,0,0,0.5)" strokeWidth="1" />+ </svg>+);++/** Dot grabbing cursor */+export const DotGrabbingCursor = ({ color = "#FFFFFF", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <ellipse+ cx="12"+ cy="12"+ rx="8"+ ry="4"+ fill={color}+ stroke="rgba(0,0,0,0.5)"+ strokeWidth="2"+ />+ </svg>+);++/** Dot wait cursor */+export const DotWaitCursor = ({ color = "#FFFFFF", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <circle+ cx="12"+ cy="12"+ r="6"+ fill="none"+ stroke={color}+ strokeWidth="3"+ strokeDasharray="20 10"+ />+ </svg>+);++/** Dot not-allowed cursor */+export const DotNotAllowedCursor = ({ color = "#EF4444", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <circle+ cx="12"+ cy="12"+ r="8"+ fill="none"+ stroke={color}+ strokeWidth="3"+ />+ <path d="M6 18L18 6" stroke={color} strokeWidth="3" strokeLinecap="round" />+ </svg>+);++/** Dot move cursor */+export const DotMoveCursor = ({ color = "#FFFFFF", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <circle cx="12" cy="12" r="4" fill={color} stroke="rgba(0,0,0,0.5)" strokeWidth="1" />+ <circle cx="12" cy="4" r="2" fill={color} stroke="rgba(0,0,0,0.5)" strokeWidth="1" />+ <circle cx="12" cy="20" r="2" fill={color} stroke="rgba(0,0,0,0.5)" strokeWidth="1" />+ <circle cx="4" cy="12" r="2" fill={color} stroke="rgba(0,0,0,0.5)" strokeWidth="1" />+ <circle cx="20" cy="12" r="2" fill={color} stroke="rgba(0,0,0,0.5)" strokeWidth="1" />+ </svg>+);++/** Dot resize cursor */+export const DotResizeCursor = ({ color = "#FFFFFF", size = 24, className }: CursorSvgProps) => (+ <svg+ className={className}+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ >+ <circle cx="6" cy="6" r="4" fill={color} stroke="rgba(0,0,0,0.5)" strokeWidth="1" />+ <circle cx="18" cy="18" r="4" fill={color} stroke="rgba(0,0,0,0.5)" strokeWidth="1" />+ <path d="M8 8L16 16" stroke={color} strokeWidth="2" strokeLinecap="round" />+ </svg>+);++// ============================================================================+// Cursor Component Maps+// ============================================================================++type CursorComponentMap = {+ [state in CursorState]: React.FC<CursorSvgProps>;+};++export const MAC_CURSORS: CursorComponentMap = {+ default: MacDefaultCursor,+ pointer: MacPointerCursor,+ text: MacTextCursor,+ crosshair: MacCrosshairCursor,+ grab: MacGrabCursor,+ grabbing: MacGrabbingCursor,+ wait: MacWaitCursor,+ progress: MacWaitCursor,+ "not-allowed": MacNotAllowedCursor,+ move: MacMoveCursor,+ resize: MacResizeCursor,+};++export const WIN_CURSORS: CursorComponentMap = {+ default: WinDefaultCursor,+ pointer: WinPointerCursor,+ text: WinTextCursor,+ crosshair: WinCrosshairCursor,+ grab: WinGrabCursor,+ grabbing: WinGrabbingCursor,+ wait: WinWaitCursor,+ progress: WinWaitCursor,+ "not-allowed": WinNotAllowedCursor,+ move: WinMoveCursor,+ resize: WinResizeCursor,+};++export const DOT_CURSORS: CursorComponentMap = {+ default: DotDefaultCursor,+ pointer: DotPointerCursor,+ text: DotTextCursor,+ crosshair: DotCrosshairCursor,+ grab: DotGrabCursor,+ grabbing: DotGrabbingCursor,+ wait: DotWaitCursor,+ progress: DotWaitCursor,+ "not-allowed": DotNotAllowedCursor,+ move: DotMoveCursor,+ resize: DotResizeCursor,+};++/**+ * Get the appropriate cursor component for a given style and state+ */+export function getCursorComponent(+ style: CursorStyle,+ state: CursorState+): React.FC<CursorSvgProps> | null {+ switch (style) {+ case "mac":+ return MAC_CURSORS[state];+ case "windows":+ return WIN_CURSORS[state];+ case "dot":+ return DOT_CURSORS[state];+ case "none":+ default:+ return null;+ }+}++/**+ * Generate SVG data URL for canvas rendering+ */+export function getCursorSvgDataUrl(+ style: CursorStyle,+ state: CursorState,+ color: string,+ size: number+): string | null {+ if (style === "none") return null;++ const svgStrings: Record<CursorStyle, Record<CursorState, string>> = {+ none: {} as Record<CursorState, string>,+ mac: {+ default: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 01.35-.15h6.87c.48 0 .73-.58.39-.92L5.84 2.86a.5.5 0 00-.34-.15c-.28 0-.5.22-.5.5z" fill="#FFFFFF" stroke="${color}" stroke-width="1.5"/></svg>`,+ pointer: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M9.5 5v9.795a.75.75 0 01-1.28.53l-2.72-2.72a1 1 0 00-1.41 0l-.1.1a1 1 0 000 1.41l4.54 4.54a2 2 0 001.41.59h6.1a2 2 0 002-2V13.5a1 1 0 00-1-1h-.5v-1a1 1 0 00-1-1h-.5V10a1 1 0 00-1-1h-.5V5.5a1 1 0 00-1-1h-1a1 1 0 00-1 1v-.5z" fill="#FFFFFF" stroke="${color}" stroke-width="1.2"/></svg>`,+ text: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M12 4V20M8 4H16M8 20H16" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round"/><path d="M12 4V20M8 4H16M8 20H16" stroke="${color}" stroke-width="1.5" stroke-linecap="round"/></svg>`,+ crosshair: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="8" stroke="#FFFFFF" stroke-width="3" fill="none"/><circle cx="12" cy="12" r="8" stroke="${color}" stroke-width="1.5" fill="none"/><path d="M12 2V8M12 16V22M2 12H8M16 12H22" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round"/><path d="M12 2V8M12 16V22M2 12H8M16 12H22" stroke="${color}" stroke-width="1.5" stroke-linecap="round"/></svg>`,+ grab: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M8 12V7a1 1 0 112 0v4m0 0V6a1 1 0 112 0v5m0 0V6.5a1 1 0 112 0V11m0 0V8a1 1 0 112 0v6a5 5 0 01-5 5h-2a5 5 0 01-5-5v-2a1 1 0 011-1h1" fill="#FFFFFF" stroke="${color}" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,+ grabbing: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M18 11V14a5 5 0 01-5 5h-2a5 5 0 01-5-5v-3a1 1 0 011-1h1a1 1 0 011 1v0m9 0a1 1 0 00-1-1h0a1 1 0 00-1 1v0m2-1v-1a1 1 0 00-1-1h0a1 1 0 00-1 1v1m0 0a1 1 0 00-1-1h0a1 1 0 00-1 1v1m0-1V9a1 1 0 00-1-1h0a1 1 0 00-1 1v1" fill="#FFFFFF" stroke="${color}" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,+ wait: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="9" stroke="#FFFFFF" stroke-width="3" fill="none"/><circle cx="12" cy="12" r="9" stroke="${color}" stroke-width="1.5" fill="none" stroke-dasharray="40 60"/><circle cx="12" cy="12" r="4" fill="${color}"/></svg>`,+ progress: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="9" stroke="#FFFFFF" stroke-width="3" fill="none"/><circle cx="12" cy="12" r="9" stroke="${color}" stroke-width="1.5" fill="none" stroke-dasharray="40 60"/><circle cx="12" cy="12" r="4" fill="${color}"/></svg>`,+ "not-allowed": `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="9" stroke="#FFFFFF" stroke-width="3" fill="none"/><circle cx="12" cy="12" r="9" stroke="#EF4444" stroke-width="1.5" fill="none"/><path d="M5.5 18.5L18.5 5.5" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round"/><path d="M5.5 18.5L18.5 5.5" stroke="#EF4444" stroke-width="1.5" stroke-linecap="round"/></svg>`,+ move: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M12 3L8 7h3v4H7V8l-4 4 4 4v-3h4v4H8l4 4 4-4h-3v-4h4v3l4-4-4-4v3h-4V7h3l-4-4z" fill="#FFFFFF" stroke="${color}" stroke-width="1"/></svg>`,+ resize: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M4 9L4 4L9 4M15 4L20 4L20 9M20 15L20 20L15 20M9 20L4 20L4 15" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 9L4 4L9 4M15 4L20 4L20 9M20 15L20 20L15 20M9 20L4 20L4 15" stroke="${color}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,+ },+ windows: {+ default: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M4 4L4 20L9 15L12 21L14 20L11 14L17 14L4 4Z" fill="#FFFFFF" stroke="${color}" stroke-width="1.5" stroke-linejoin="round"/></svg>`,+ pointer: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M11 4v7h-1a2 2 0 00-2 2v1a6 6 0 006 6h1a5 5 0 005-5v-4a2 2 0 00-2-2h-1V7a2 2 0 00-2-2h0a2 2 0 00-2 2v2a2 2 0 00-4 0V4a2 2 0 00-2-2h0a2 2 0 00-2 2v7" fill="#FFFFFF" stroke="${color}" stroke-width="1.2"/></svg>`,+ text: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M12 3V21M9 3H15M9 21H15" stroke="#FFFFFF" stroke-width="3.5" stroke-linecap="round"/><path d="M12 3V21M9 3H15M9 21H15" stroke="${color}" stroke-width="2" stroke-linecap="round"/></svg>`,+ crosshair: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M12 2V22M2 12H22" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round"/><path d="M12 2V22M2 12H22" stroke="${color}" stroke-width="1.5" stroke-linecap="round"/><rect x="10" y="10" width="4" height="4" fill="#FFFFFF" stroke="${color}" stroke-width="1"/></svg>`,+ grab: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M7 11v-1a2 2 0 114 0m0 0v-1a2 2 0 114 0v1m0 0a2 2 0 114 0v5a7 7 0 01-7 7h-1a7 7 0 01-7-7v-2a2 2 0 114 0" fill="#FFFFFF" stroke="${color}" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,+ grabbing: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M7 15v-3a2 2 0 012-2h0a2 2 0 012 2m0 0a2 2 0 012-2h0a2 2 0 012 2m0 0a2 2 0 012-2h0a2 2 0 012 2v3a7 7 0 01-7 7h-1a7 7 0 01-7-7v-3a2 2 0 114 0" fill="#FFFFFF" stroke="${color}" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,+ wait: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#FFFFFF" stroke="${color}" stroke-width="1.5"/><path d="M12 6v6l4 2" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,+ progress: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#FFFFFF" stroke="${color}" stroke-width="1.5"/><path d="M12 6v6l4 2" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,+ "not-allowed": `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" fill="#FFFFFF" stroke="#EF4444" stroke-width="2"/><path d="M7 7L17 17" stroke="#EF4444" stroke-width="2" stroke-linecap="round"/></svg>`,+ move: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M12 2L9 5h2v5H6V8l-3 4 3 4v-2h5v5H9l3 3 3-3h-2v-5h5v2l3-4-3-4v2h-5V5h2l-3-3z" fill="#FFFFFF" stroke="${color}" stroke-width="1" stroke-linejoin="round"/></svg>`,+ resize: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><path d="M4 4L10 4L4 10L4 4ZM20 20L14 20L20 14L20 20Z" fill="#FFFFFF" stroke="${color}" stroke-width="1.5"/><path d="M4 4L20 20" stroke="#FFFFFF" stroke-width="3"/><path d="M4 4L20 20" stroke="${color}" stroke-width="1.5"/></svg>`,+ },+ dot: {+ default: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="6" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="2"/></svg>`,+ pointer: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="8" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="2"/></svg>`,+ text: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><rect x="10" y="4" width="4" height="16" rx="2" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/></svg>`,+ crosshair: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="3" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/><circle cx="12" cy="12" r="8" fill="none" stroke="${color}" stroke-width="2"/></svg>`,+ grab: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="8" cy="12" r="3" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/><circle cx="16" cy="12" r="3" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/></svg>`,+ grabbing: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><ellipse cx="12" cy="12" rx="8" ry="4" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="2"/></svg>`,+ wait: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="6" fill="none" stroke="${color}" stroke-width="3" stroke-dasharray="20 10"/></svg>`,+ progress: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="6" fill="none" stroke="${color}" stroke-width="3" stroke-dasharray="20 10"/></svg>`,+ "not-allowed": `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="8" fill="none" stroke="#EF4444" stroke-width="3"/><path d="M6 18L18 6" stroke="#EF4444" stroke-width="3" stroke-linecap="round"/></svg>`,+ move: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="4" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/><circle cx="12" cy="4" r="2" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/><circle cx="12" cy="20" r="2" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/><circle cx="4" cy="12" r="2" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/><circle cx="20" cy="12" r="2" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/></svg>`,+ resize: `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"><circle cx="6" cy="6" r="4" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/><circle cx="18" cy="18" r="4" fill="${color}" stroke="rgba(0,0,0,0.5)" stroke-width="1"/><path d="M8 8L16 16" stroke="${color}" stroke-width="2" stroke-linecap="round"/></svg>`,+ },+ };++ const styleSvgs = svgStrings[style];+ if (!styleSvgs) return null;++ const svg = styleSvgs[state];+ if (!svg) return null;++ return `data:image/svg+xml,${encodeURIComponent(svg)}`;+}diff --git a/hooks/useDebounce.ts b/hooks/useDebounce.tsindex 5747624..b594ed9 100644--- a/hooks/useDebounce.ts+++ b/hooks/useDebounce.ts@@ -1,9 +1,5 @@import { useEffect, useState } from 'react';-/**- * Hook para debouncing de valores - útil para evitar renders excesivos- * en sliders y otros controles que cambian rápidamente- */export function useDebounce<T>(value: T, delay: number = 300): T {const [debouncedValue, setDebouncedValue] = useState<T>(value);diff --git a/hooks/useScreenRecording.ts b/hooks/useScreenRecording.tsindex b2cddda..47ae926 100644--- a/hooks/useScreenRecording.ts+++ b/hooks/useScreenRecording.ts@@ -3,10 +3,40 @@import { useState, useCallback, useRef, useEffect } from "react";import { useRouter } from "next/navigation";import type { RecordingState, RecordingResult, VideoData } from "@/types";+import type { CursorKeyframe, CursorRecordingData, CursorState } from "@/types/cursor.types";+import { EMPTY_CURSOR_DATA, supportsCursorCapture } from "@/types/cursor.types";import { clearAllThumbnailCache } from "@/lib/thumbnail-cache";export type { RecordingState, RecordingResult, VideoData };+// Extend global types for CaptureController (2026 API)+declare global {+ interface CaptureController extends EventTarget {+ oncapturedmousechange: ((event: CapturedMouseEvent) => void) | null;+ setFocusBehavior(behavior: "focus-captured-surface" | "no-focus-change"): void;+ }++ interface CapturedMouseEvent extends Event {+ surfaceX: number;+ surfaceY: number;+ }++ var CaptureController: {+ prototype: CaptureController;+ new(): CaptureController;+ } | undefined;+}++// Extended options for getDisplayMedia with CaptureController support+interface ExtendedDisplayMediaOptions {+ controller?: CaptureController;+ video?: boolean | MediaTrackConstraints & {+ cursor?: "always" | "motion" | "never";+ displaySurface?: "browser" | "window" | "monitor";+ };+ audio?: boolean | MediaTrackConstraints;+}+function generateVideoId(): string {return `vid_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;}@@ -47,7 +77,11 @@ async function getDB(): Promise<IDBDatabase> {});}-async function saveVideoToIndexedDB(blob: Blob, duration: number): Promise<string> {+async function saveVideoToIndexedDB(+ blob: Blob,+ duration: number,+ cursorData?: CursorRecordingData+): Promise<string> {try {await clearAllThumbnailCache();} catch (e) {@@ -67,6 +101,8 @@ async function saveVideoToIndexedDB(blob: Blob, duration: number): Promise<strinduration,videoId,timestamp: Date.now(),+ cursorData: cursorData || EMPTY_CURSOR_DATA,+ isRecordedVideo: true, // Flag to identify browser-recorded videos};const putRequest = store.put(videoData, "currentVideo");@@ -83,7 +119,15 @@ async function saveVideoToIndexedDB(blob: Blob, duration: number): Promise<strin});}-export async function loadVideoFromIndexedDB(): Promise<{ blob: Blob; duration: number; url: string; videoId: string; timestamp: number } | null> {+export async function loadVideoFromIndexedDB(): Promise<{+ blob: Blob;+ duration: number;+ url: string;+ videoId: string;+ timestamp: number;+ cursorData?: CursorRecordingData;+ isRecordedVideo?: boolean;+} | null> {try {const db = await getDB();const storeName = "videos";@@ -106,7 +150,15 @@ export async function loadVideoFromIndexedDB(): Promise<{ blob: Blob; duration:const url = URL.createObjectURL(data.blob);const videoId = data.videoId || `vid_${data.timestamp || Date.now()}`;const timestamp = data.timestamp || Date.now();- resolve({ blob: data.blob, duration: data.duration, url, videoId, timestamp });+ resolve({+ blob: data.blob,+ duration: data.duration,+ url,+ videoId,+ timestamp,+ cursorData: data.cursorData || EMPTY_CURSOR_DATA,+ isRecordedVideo: data.isRecordedVideo || false,+ });} else {resolve(null);}@@ -174,6 +226,13 @@ export function useScreenRecording() {const stateRef = useRef<RecordingState>("idle");const recordingTimerRef = useRef<NodeJS.Timeout | null>(null);+ // Cursor capture refs+ const cursorKeyframesRef = useRef<CursorKeyframe[]>([]);+ const captureControllerRef = useRef<CaptureController | null>(null);+ const videoDimensionsRef = useRef<{ width: number; height: number }>({ width: 1920, height: 1080 });+ const isClickingRef = useRef<boolean>(false);+ const lastCursorStateRef = useRef<CursorState>("default");+useEffect(() => {stateRef.current = state;}, [state]);@@ -238,8 +297,17 @@ export function useScreenRecording() {const startRecording = useCallback((stream: MediaStream) => {try {chunksRef.current = [];+ cursorKeyframesRef.current = []; // Reset cursor keyframesstartTimeRef.current = Date.now();+ // Get video dimensions from the stream+ const videoTrack = stream.getVideoTracks()[0];+ const settings = videoTrack.getSettings();+ videoDimensionsRef.current = {+ width: settings.width || 1920,+ height: settings.height || 1080,+ };+const codecOptions = [{ mimeType: "video/webm;codecs=vp9,opus" },{ mimeType: "video/webm;codecs=vp8,opus" },@@ -254,7 +322,6 @@ export function useScreenRecording() {try {if (MediaRecorder.isTypeSupported(options.mimeType)) {mediaRecorder = new MediaRecorder(stream, options);- console.log(`Using codec: ${options.mimeType}`);break;}} catch (e) {@@ -294,11 +361,25 @@ export function useScreenRecording() {streamRef.current = null;}+ // Clean up capture controller+ if (captureControllerRef.current) {+ captureControllerRef.current.oncapturedmousechange = null;+ captureControllerRef.current = null;+ }+const blob = new Blob(chunksRef.current, { type: "video/webm" });const duration = (Date.now() - startTimeRef.current) / 1000;+ // Build cursor recording data+ const cursorData: CursorRecordingData = {+ keyframes: cursorKeyframesRef.current,+ videoDimensions: videoDimensionsRef.current,+ frameRate: 60,+ hasCursorData: cursorKeyframesRef.current.length > 0,+ };+try {- await saveVideoToIndexedDB(blob, duration);+ await saveVideoToIndexedDB(blob, duration, cursorData);router.push("/editor");} catch (error) {console.error("Error al guardar video:", error);@@ -328,18 +409,89 @@ export function useScreenRecording() {try {setError(null);- const stream = await navigator.mediaDevices.getDisplayMedia({+ // Check if CaptureController is supported (2026 API for cursor tracking)+ const hasCaptureController = supportsCursorCapture();+ let controller: CaptureController | null = null;++ if (hasCaptureController && typeof CaptureController !== "undefined") {+ try {+ controller = new CaptureController();+ captureControllerRef.current = controller;++ // Listen for cursor position changes+ controller.oncapturedmousechange = (event: CapturedMouseEvent) => {+ console.log(`[RAW EVENT] X: ${event.surfaceX}, Y: ${event.surfaceY} | Estado actual: ${stateRef.current}`);+ if (stateRef.current !== "recording") return;+ console.log(`Cursor detectado en X: ${event.surfaceX}, Y: ${event.surfaceY}`);++ const time = (Date.now() - startTimeRef.current) / 1000;+ const { width, height } = videoDimensionsRef.current;++ // Convert pixel coordinates to percentages+ const x = (event.surfaceX / width) * 100;+ const y = (event.surfaceY / height) * 100;++ // Only add keyframe if position changed significantly (optimization)+ const lastKeyframe = cursorKeyframesRef.current[cursorKeyframesRef.current.length - 1];+ if (!lastKeyframe ||+ Math.abs(lastKeyframe.x - x) > 0.1 ||+ Math.abs(lastKeyframe.y - y) > 0.1 ||+ lastKeyframe.clicking !== isClickingRef.current) {++ cursorKeyframesRef.current.push({+ time,+ x,+ y,+ state: lastCursorStateRef.current,+ clicking: isClickingRef.current,+ });+ }+ };++ console.log("CaptureController initialized for cursor tracking");+ } catch (e) {+ console.warn("Failed to initialize CaptureController:", e);+ controller = null;+ captureControllerRef.current = null;+ }+ }++ // Build display media options+ const displayMediaOptions: ExtendedDisplayMediaOptions = {video: {displaySurface: "browser",+ // Hide native cursor when CaptureController is available+ // so we can draw our custom cursor instead+ ...(controller ? { cursor: "never" as const } : {}),},audio: {echoCancellation: true,noiseSuppression: true,},- });+ // Attach controller if available+ ...(controller ? { controller } : {}),+ };++ const stream = await navigator.mediaDevices.getDisplayMedia(displayMediaOptions as DisplayMediaStreamOptions);streamRef.current = stream;+ // Set up click tracking for the captured surface+ if (controller) {+ // Track mouse clicks globally during recording+ const handleMouseDown = () => { isClickingRef.current = true; };+ const handleMouseUp = () => { isClickingRef.current = false; };++ document.addEventListener("mousedown", handleMouseDown);+ document.addEventListener("mouseup", handleMouseUp);++ // Clean up click listeners when stream ends+ stream.getVideoTracks()[0].addEventListener("ended", () => {+ document.removeEventListener("mousedown", handleMouseDown);+ document.removeEventListener("mouseup", handleMouseUp);+ });+ }+stream.getVideoTracks()[0].onended = () => {if (stateRef.current === "recording") {stopRecording();@@ -379,7 +531,13 @@ export function useScreenRecording() {if (mediaRecorderRef.current && mediaRecorderRef.current.state !== "inactive") {mediaRecorderRef.current.stop();}+ // Clean up capture controller+ if (captureControllerRef.current) {+ captureControllerRef.current.oncapturedmousechange = null;+ captureControllerRef.current = null;+ }chunksRef.current = [];+ cursorKeyframesRef.current = [];setState("idle");restoreOriginals();}, [restoreOriginals]);diff --git a/proxy.ts b/proxy.tsindex 16d8f0a..845be13 100644--- a/proxy.ts+++ b/proxy.ts@@ -2,7 +2,16 @@ import { updateSession } from "@/utils/supabase/middleware";import { type NextRequest } from "next/server";export async function proxy(request: NextRequest) {- return await updateSession(request);+ const response = await updateSession(request);++ const country =+ request.headers.get('x-vercel-ip-country') ||+ request.headers.get('cf-ipcountry') ||+ 'UNKNOWN';++ response.headers.set('x-user-country', country);++ return response;}export const config = {diff --git a/public/images/pages/qr.avif b/public/images/pages/qr.avifnew file mode 100644index 0000000..30746b3Binary files /dev/null and b/public/images/pages/qr.avif differdiff --git a/public/images/pages/visa.avif b/public/images/pages/visa.avifnew file mode 100644index 0000000..f478cb1Binary files /dev/null and b/public/images/pages/visa.avif differdiff --git a/public/images/pages/yape.avif b/public/images/pages/yape.avifnew file mode 100644index 0000000..bb883a4Binary files /dev/null and b/public/images/pages/yape.avif differdiff --git a/types/control-panel.types.ts b/types/control-panel.types.tsindex d56e62d..88384f9 100644--- a/types/control-panel.types.ts+++ b/types/control-panel.types.ts@@ -4,6 +4,7 @@ import { ZoomFragment } from "./zoom.types";import { MockupConfig } from "./mockup.types";import type { CanvasElement } from "./canvas-elements.types";import type { UploadedAudio, AudioTrack } from "./audio.types";+import type { CursorConfig, CursorRecordingData } from "./cursor.types";export interface ControlPanelProps {activeTool: Tool;@@ -60,4 +61,9 @@ export interface ControlPanelProps {onMasterVolumeChange?: (volume: number) => void;videoDuration?: number;videoHasAudioTrack?: boolean;+ // Cursor props+ cursorConfig?: CursorConfig;+ cursorData?: CursorRecordingData;+ isRecordedVideo?: boolean;+ onCursorConfigChange?: (config: Partial<CursorConfig>) => void;}diff --git a/types/cursor.types.ts b/types/cursor.types.tsnew file mode 100644index 0000000..f2e13f3--- /dev/null+++ b/types/cursor.types.ts@@ -0,0 +1,162 @@+/**+ * 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.tsindex 8650687..ee9c70e 100644--- a/types/editor.types.ts+++ b/types/editor.types.ts@@ -1,7 +1,8 @@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";+export type Tool = "screenshot" | "elements" | "audio" | "zoom" | "mockup" | "cursor";export type BackgroundTab = "wallpaper" | "image" | "color";@@ -91,4 +92,7 @@ export interface VideoCanvasProps {selectedElementId?: string | null;onElementUpdate?: (id: string, updates: Partial<CanvasElement>) => void;onElementSelect?: (id: string | null) => void;+ // Cursor overlay props+ cursorConfig?: CursorConfig;+ cursorData?: CursorRecordingData;}diff --git a/types/index.ts b/types/index.tsindex b9eebf0..24f0e33 100644--- a/types/index.ts+++ b/types/index.ts@@ -4,4 +4,5 @@ export * from './recording.types';export * from './background.types';export * from './zoom.types';export * from './mockup.types';-export * from './audio.types';\ No newline at end of file+export * from './audio.types';+export * from './cursor.types';\ No newline at end of filediff --git a/types/tool-sidebar.types.ts b/types/tool-sidebar.types.tsindex a30a9cd..d54b3b8 100644--- a/types/tool-sidebar.types.ts+++ b/types/tool-sidebar.types.ts@@ -1,4 +1,4 @@-type Tool = "screenshot" | "elements" | "audio" | "zoom" | "mockup";+type Tool = "screenshot" | "elements" | "audio" | "zoom" | "mockup" | "cursor";export interface ToolsSidebarProps {activeTool: Tool;