Skip to content

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

feat(mockups): add onConfigChange prop to mockup components for URL updates

CristianOlivera1de7793507270
diff --git a/app/[locale]/(editor)/editor/page.tsx b/app/[locale]/(editor)/editor/page.tsx
index 144b80e..4ddc6b4 100644
--- a/app/[locale]/(editor)/editor/page.tsx
+++ b/app/[locale]/(editor)/editor/page.tsx
@@ -3196,6 +3196,7 @@ export default function Editor() {
otherSelectionActive={otherSelectionActive}
mockupMotionFragments={mockupMotionFragments}
videoDuration={videoDuration}
+ onMockupConfigChange={handleMockupConfigChange}
/>
{/* Video mode: Show player controls and timeline */}
diff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsx
index 46439e1..1f212a5 100644
--- a/app/components/ui/editor/VideoCanvas.tsx
+++ b/app/components/ui/editor/VideoCanvas.tsx
@@ -101,6 +101,7 @@ function VideoCanvasInner({
mockupMotionFragments = [],
videoDuration = 0,
onSelectedElementIdsChange,
+ onMockupConfigChange
}: VideoCanvasProps & {
ref?: React.Ref<VideoCanvasHandle>;
onSelectedElementIdsChange?: (ids: string[]) => void;
@@ -2021,12 +2022,12 @@ function VideoCanvasInner({
}}
onMouseDown={(e) => {
if (!hasMedia || !onVideoTransformChange) return;
- if ((e.target as HTMLElement).closest('[data-rotation-handle]')) return;
+ const targetEl = e.target as HTMLElement;
+ if (targetEl.closest('[data-rotation-handle]')) return;
+ if (targetEl.closest('input, textarea, [contenteditable="true"]')) return; // 👈 NUEVO
e.preventDefault();
wasDragRef.current = false;
-
const isGroupMember = isVideoSelected && canvasSelectedIds.length > 0;
-
if (e.shiftKey) {
setIsVideoSelected((prev) => !prev);
} else if (isGroupMember) {
@@ -2036,17 +2037,16 @@ function VideoCanvasInner({
if (onElementSelect) onElementSelect(null);
setCanvasSelectedIds([]);
}
-
setVideoHoverCorner(getNearestCorner(e, videoTransform.rotation));
setIsDraggingVideo(true);
dragStartPos.current = {
- x: e.clientX, y: e.clientY,
+ x: e.clientX,
+ y: e.clientY,
initialRotation: videoTransform.rotation,
initialTranslateX: videoTransform.translateX,
initialTranslateY: videoTransform.translateY,
};
clickStartPosRef.current = { x: e.clientX, y: e.clientY };
-
if (canvasSelectedIds.length > 0) {
setIsDraggingElement(true);
elementDragStart.current = { x: e.clientX, y: e.clientY, initialX: 0, initialY: 0, initialRotation: 0 };
@@ -2058,10 +2058,11 @@ function VideoCanvasInner({
}
}}
onClick={(e) => {
- if ((e.target as HTMLElement).closest('[data-rotation-handle]')) return;
+ const targetEl = e.target as HTMLElement;
+ if (targetEl.closest('[data-rotation-handle]')) return;
+ if (targetEl.closest('input, textarea, [contenteditable="true"]')) return; // 👈 NUEVO
if (!onMockupClick) return;
if (mockupId === "none" || mockupId === undefined) return;
- // Only fire if pointer stayed within CLICK_THRESHOLD (i.e. a click, not a drag)
const start = clickStartPosRef.current;
clickStartPosRef.current = null;
if (!start) return;
@@ -2112,6 +2113,7 @@ function VideoCanvasInner({
isHovered={isVideoHovered}
onDeviceHoverChange={(hovered) => setIsVideoHovered(hovered && hasMedia)}
onDeviceRectChange={setPhotoDeviceRect}
+ onConfigChange={onMockupConfigChange}
>
{mockupChildren}
</MockupWrapper>
diff --git a/app/components/ui/editor/mockups/BraveGlassMockup.tsx b/app/components/ui/editor/mockups/BraveGlassMockup.tsx
index 8fe820c..544636a 100644
--- a/app/components/ui/editor/mockups/BraveGlassMockup.tsx
+++ b/app/components/ui/editor/mockups/BraveGlassMockup.tsx
@@ -15,6 +15,7 @@ export function BraveGlassMockup({
shadows = 20,
roundedCorners,
maskStyles,
+ onConfigChange
}: BraveGlassMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
@@ -147,12 +148,20 @@ export function BraveGlassMockup({
d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
/>
</svg>
- <span
- className="flex-1 text-center font-medium truncate"
- style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px` }}
- >
- {url}
- </span>
+ <input
+ type="text"
+ value={url}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ className="flex-1 text-center font-medium truncate bg-transparent border-none outline-none"
+ style={{
+ fontSize: `${fontSize}px`,
+ padding: `0 ${urlBarPadding}px`,
+ color: "inherit"
+ }}
+ />
<svg
style={{ width: `${iconSize * 0.75}px`, height: `${iconSize * 0.75}px`, flexShrink: 0, color: "rgba(234,179,8,0.8)" }}
fill="currentColor"
diff --git a/app/components/ui/editor/mockups/BraveMockup.tsx b/app/components/ui/editor/mockups/BraveMockup.tsx
index 03f8f99..dd7c3b3 100644
--- a/app/components/ui/editor/mockups/BraveMockup.tsx
+++ b/app/components/ui/editor/mockups/BraveMockup.tsx
@@ -1,6 +1,6 @@
"use client";
-import type { MockupRenderProps } from "@/types/mockup.types";
+import { DEFAULT_MOCKUP_CONFIG, type MockupRenderProps } from "@/types/mockup.types";
import { hexToRgba } from "@/lib/utils";
import { deriveSearchBg } from "@/lib/color.utils";
@@ -15,7 +15,8 @@ export function BraveMockup({
className = "",
shadows = 20,
roundedCorners,
- maskStyles
+ maskStyles,
+ onConfigChange
}: BraveMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
@@ -102,12 +103,17 @@ export function BraveMockup({
<svg style={{ width: `${iconSize * 0.65}px`, height: `${iconSize * 0.65}px`, opacity: 0.6, flexShrink: 0 }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
</svg>
- <span
- className="flex-1 text-center font-medium truncate"
- style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px` }}
- >
- {url}
- </span>
+ <input
+ type="text"
+ value={url}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder={DEFAULT_MOCKUP_CONFIG.url}
+ className="flex-1 text-center font-medium truncate bg-transparent border-none outline-none"
+ style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px`, color: textColor }}
+ />
<svg style={{ width: `${iconSize * 0.75}px`, height: `${iconSize * 0.75}px`, flexShrink: 0, color: "rgba(234,179,8,0.8)" }} fill="currentColor" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z" />
</svg>
diff --git a/app/components/ui/editor/mockups/BrowserTabGlassMockup.tsx b/app/components/ui/editor/mockups/BrowserTabGlassMockup.tsx
index e731518..220b155 100644
--- a/app/components/ui/editor/mockups/BrowserTabGlassMockup.tsx
+++ b/app/components/ui/editor/mockups/BrowserTabGlassMockup.tsx
@@ -12,7 +12,8 @@ export function BrowserTabGlassMockup({
config,
className = "",
shadows = 20,
- roundedCorners
+ roundedCorners,
+ onConfigChange
}: BrowserTabGlassMockupProps) {
const isDark = config.darkMode;
const url = config.url;
@@ -22,25 +23,25 @@ export function BrowserTabGlassMockup({
const bgColor = isDark ? "#1e1e1e" : "#f9f9f9";
- const tabBg = isDark ? "rgba(255,255,255,0.12)" : "rgba(255,255,255,0.8)";
- const tabBorderColor = isDark ? "rgba(255,255,255,0.2)" : "rgba(255,255,255,0.9)";
- const tabTitleColor = isDark ? "#d1d5db" : "#374151";
- const tabCloseColor = isDark ? "rgba(209,213,219,0.6)" : "rgba(75,85,99,0.8)";
- const tabCloseBg = isDark ? "rgba(255,255,255,0.1)" : "rgba(156,163,175,0.2)";
+ const tabBg = isDark ? "rgba(255,255,255,0.12)" : "rgba(255,255,255,0.8)";
+ const tabBorderColor = isDark ? "rgba(255,255,255,0.2)" : "rgba(255,255,255,0.9)";
+ const tabTitleColor = isDark ? "#d1d5db" : "#374151";
+ const tabCloseColor = isDark ? "rgba(209,213,219,0.6)" : "rgba(75,85,99,0.8)";
+ const tabCloseBg = isDark ? "rgba(255,255,255,0.1)" : "rgba(156,163,175,0.2)";
- const tabBarH = 24 * headerScale;
- const dotSize = 10 * headerScale;
- const dotGap = 6 * headerScale;
- const dotPaddingX = 4 * headerScale;
- const tabH = 28 * headerScale;
- const tabW = 184 * headerScale;
- const tabPaddingX = 12 * headerScale;
- const tabIconSize = 12 * headerScale;
- const tabFontSize = 10 * headerScale;
- const addBtnSize = 24 * headerScale;
- const winIconGap = 24 * headerScale;
- const winIconMB = 10 * headerScale;
- const winIconMR = 4 * headerScale;
+ const tabBarH = 24 * headerScale;
+ const dotSize = 10 * headerScale;
+ const dotGap = 6 * headerScale;
+ const dotPaddingX = 4 * headerScale;
+ const tabH = 28 * headerScale;
+ const tabW = 184 * headerScale;
+ const tabPaddingX = 12 * headerScale;
+ const tabIconSize = 12 * headerScale;
+ const tabFontSize = 10 * headerScale;
+ const addBtnSize = 24 * headerScale;
+ const winIconGap = 24 * headerScale;
+ const winIconMB = 10 * headerScale;
+ const winIconMR = 4 * headerScale;
return (
<div
@@ -50,17 +51,17 @@ export function BrowserTabGlassMockup({
boxShadow: shadows > 0
? `0 ${shadows * 0.3}px ${shadows}px rgba(0,0,0,1)`
: "none",
- borderTop: "1px solid rgba(255,255,255,0.6)",
+ borderTop: "1px solid rgba(255,255,255,0.6)",
borderLeft: "1px solid rgba(255,255,255,0.6)",
}}
>
<div
className="flex items-end justify-between select-none shrink-0 relative z-10"
style={{
- height: `${tabBarH}px`,
- paddingLeft: `${16 * headerScale}px`,
- paddingRight: `${4 * headerScale}px`,
- borderTopLeftRadius: `${cornerRadius}px`,
+ height: `${tabBarH}px`,
+ paddingLeft: `${16 * headerScale}px`,
+ paddingRight: `${4 * headerScale}px`,
+ borderTopLeftRadius: `${cornerRadius}px`,
borderTopRightRadius: `${cornerRadius}px`,
}}
>
@@ -74,7 +75,7 @@ export function BrowserTabGlassMockup({
key={i}
className="rounded-full"
style={{
- width: `${dotSize}px`,
+ width: `${dotSize}px`,
height: `${dotSize}px`,
backgroundColor: "rgba(255,255,255,0.2)",
border: "1px solid rgba(255,255,255,0.3)",
@@ -86,13 +87,13 @@ export function BrowserTabGlassMockup({
<div
className="flex items-center justify-between"
style={{
- width: `${tabW}px`,
- height: `${tabH}px`,
- padding: `0 ${tabPaddingX}px`,
+ width: `${tabW}px`,
+ height: `${tabH}px`,
+ padding: `0 ${tabPaddingX}px`,
backgroundColor: tabBg,
- backdropFilter: "blur(12px)",
- borderTop: `1px solid ${tabBorderColor}`,
- borderLeft: `1px solid ${tabBorderColor}`,
+ backdropFilter: "blur(12px)",
+ borderTop: `1px solid ${tabBorderColor}`,
+ borderLeft: `1px solid ${tabBorderColor}`,
borderRight: `1px solid ${tabBorderColor}`,
borderRadius: `${8 * headerScale}px ${8 * headerScale}px 0 0`,
boxShadow: "-5px 0 15px rgba(0,0,0,0.05)",
@@ -101,7 +102,7 @@ export function BrowserTabGlassMockup({
<div className="flex items-center overflow-hidden" style={{ gap: `${8 * headerScale}px` }}>
<div
style={{
- width: `${tabIconSize}px`,
+ width: `${tabIconSize}px`,
height: `${tabIconSize}px`,
borderRadius: "50%",
backgroundColor: "#60a5fa",
@@ -109,17 +110,22 @@ export function BrowserTabGlassMockup({
flexShrink: 0,
}}
/>
- <span
- className="font-medium truncate"
+ <input
+ type="text"
+ value={url || ""}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder="Nueva pestaña"
+ className="font-medium truncate bg-transparent border-none outline-none w-full placeholder:text-inherit/50"
style={{ fontSize: `${tabFontSize}px`, letterSpacing: "-0.02em", color: tabTitleColor }}
- >
- {url ?? "Nueva pestaña"}
- </span>
+ />
</div>
<div
className="flex items-center justify-center relative flex-shrink-0"
style={{
- width: `${8 * headerScale}px`,
+ width: `${8 * headerScale}px`,
height: `${8 * headerScale}px`,
borderRadius: "50%",
backgroundColor: tabCloseBg,
@@ -134,7 +140,7 @@ export function BrowserTabGlassMockup({
<div
className="flex items-center justify-center rounded-full"
style={{
- width: `${addBtnSize}px`,
+ width: `${addBtnSize}px`,
height: `${addBtnSize}px`,
marginBottom: `${4 * headerScale}px`,
backgroundColor: "rgba(255,255,255,0.2)",
@@ -164,7 +170,7 @@ export function BrowserTabGlassMockup({
className="flex-1 relative overflow-hidden"
style={{
backgroundColor: bgColor,
- borderBottomLeftRadius: `${Math.max(0, cornerRadius - 3)}px`,
+ borderBottomLeftRadius: `${Math.max(0, cornerRadius - 3)}px`,
borderBottomRightRadius: `${Math.max(0, cornerRadius - 3)}px`,
}}
>
diff --git a/app/components/ui/editor/mockups/ChromeGlassMockup.tsx b/app/components/ui/editor/mockups/ChromeGlassMockup.tsx
index 12bcbac..0d59b42 100644
--- a/app/components/ui/editor/mockups/ChromeGlassMockup.tsx
+++ b/app/components/ui/editor/mockups/ChromeGlassMockup.tsx
@@ -15,6 +15,7 @@ export function ChromeGlassMockup({
shadows = 20,
roundedCorners,
maskStyles,
+ onConfigChange
}: ChromeGlassMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
@@ -110,9 +111,17 @@ export function ChromeGlassMockup({
<svg style={{ width: `${tabIconSz}px`, height: `${tabIconSz}px`, flexShrink: 0, color: "#2563eb" }} fill="currentColor" viewBox="0 0 24 24">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z" />
</svg>
- <span className="truncate flex-1" style={{ fontSize: `${tabFontSz}px`, color: textColor }}>
- {url?.replace(/^https?:\/\//, "") ?? "New tab"}
- </span>
+ <input
+ type="text"
+ value={url || ""}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder="New tab"
+ className="truncate flex-1 bg-transparent border-none outline-none w-full placeholder:text-inherit/50 cursor-text"
+ style={{ fontSize: `${tabFontSz}px`, color: textColor }}
+ />
<svg style={{ width: `${tabCloseS}px`, height: `${tabCloseS}px`, flexShrink: 0, color: iconColor, opacity: 0.7 }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path d="M6 18L18 6M6 6l12 12" strokeWidth="2.5" strokeLinecap="round" />
</svg>
@@ -188,9 +197,16 @@ export function ChromeGlassMockup({
<svg style={{ width: `${iconSz * 0.75}px`, height: `${iconSz * 0.75}px`, flexShrink: 0, opacity: 0.6 }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" strokeWidth="2" />
</svg>
- <span className="truncate flex-1" style={{ fontSize: `${urlFontSz}px` }}>
- {url?.replace(/^https?:\/\//, "")}
- </span>
+ <input
+ type="text"
+ value={url || ""}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ className="truncate flex-1 bg-transparent border-none outline-none w-full cursor-text"
+ style={{ fontSize: `${urlFontSz}px`, color: "inherit" }}
+ />
</div>
</div>
<div className="flex items-center shrink-0" style={{ gap: `${rightGap}px`, color: iconColor }}>
diff --git a/app/components/ui/editor/mockups/ChromeMockup.tsx b/app/components/ui/editor/mockups/ChromeMockup.tsx
index 87d3f21..60b0ef7 100644
--- a/app/components/ui/editor/mockups/ChromeMockup.tsx
+++ b/app/components/ui/editor/mockups/ChromeMockup.tsx
@@ -15,6 +15,7 @@ export function ChromeMockup({
shadows = 20,
roundedCorners,
maskStyles,
+ onConfigChange
}: ChromeMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
@@ -32,26 +33,26 @@ export function ChromeMockup({
const textColor = isDark ? "#9ca3af" : "#374151";
const iconColor = isDark ? "rgba(255,255,255,0.5)" : "rgba(55,65,81,0.7)";
- const tabBarH = 32 * headerScale;
- const tabH = 28 * headerScale;
- const tabW = 180 * headerScale;
- const tabPadX = 12 * headerScale;
- const tabFontSz = 10.5 * headerScale;
- const tabIconSz = 12 * headerScale;
- const tabML = 8 * headerScale;
- const tabRadius = 4 * headerScale;
- const plusSize = 14 * headerScale;
- const plusML = 4 * headerScale;
- const winBtnW = 42 * headerScale;
- const addrH = 32 * headerScale;
- const addrPadX = 8 * headerScale;
+ const tabBarH = 32 * headerScale;
+ const tabH = 28 * headerScale;
+ const tabW = 180 * headerScale;
+ const tabPadX = 12 * headerScale;
+ const tabFontSz = 10.5 * headerScale;
+ const tabIconSz = 12 * headerScale;
+ const tabML = 8 * headerScale;
+ const tabRadius = 4 * headerScale;
+ const plusSize = 14 * headerScale;
+ const plusML = 4 * headerScale;
+ const winBtnW = 42 * headerScale;
+ const addrH = 32 * headerScale;
+ const addrPadX = 8 * headerScale;
const navBtnSize = 14 * headerScale;
- const navGap = 2 * headerScale;
- const urlH = 26 * headerScale;
- const urlFontSz = 11 * headerScale;
- const urlPadX = 12 * headerScale;
- const rightGap = 2 * headerScale;
- const iconSz = 14 * headerScale;
+ const navGap = 2 * headerScale;
+ const urlH = 26 * headerScale;
+ const urlFontSz = 11 * headerScale;
+ const urlPadX = 12 * headerScale;
+ const rightGap = 2 * headerScale;
+ const iconSz = 14 * headerScale;
return (
<div className={`relative w-full h-full ${className}`}>
@@ -101,9 +102,17 @@ export function ChromeMockup({
<svg style={{ width: `${tabIconSz}px`, height: `${tabIconSz}px`, flexShrink: 0, color: "#2563eb" }} fill="currentColor" viewBox="0 0 24 24">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z" />
</svg>
- <span className="truncate flex-1" style={{ fontSize: `${tabFontSz}px`, color: textColor }}>
- {url?.replace(/^https?:\/\//, "") ?? "New tab"}
- </span>
+ <input
+ type="text"
+ value={url || ""}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder="New tab"
+ className="truncate flex-1 bg-transparent border-none outline-none w-full placeholder:text-inherit/50 cursor-text"
+ style={{ fontSize: `${tabFontSz}px`, color: textColor }}
+ />
<svg style={{ width: `${tabIconSz}px`, height: `${tabIconSz}px`, flexShrink: 0, color: iconColor }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path d="M6 18L18 6M6 6l12 12" strokeWidth="2.5" strokeLinecap="round" />
</svg>
@@ -179,9 +188,16 @@ export function ChromeMockup({
<svg style={{ width: `${iconSz * 0.75}px`, height: `${iconSz * 0.75}px`, flexShrink: 0, opacity: 0.6 }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" strokeWidth="2" />
</svg>
- <span className="truncate flex-1" style={{ fontSize: `${urlFontSz}px` }}>
- {url?.replace(/^https?:\/\//, "")}
- </span>
+ <input
+ type="text"
+ value={url || ""}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ className="truncate flex-1 bg-transparent border-none outline-none w-full cursor-text"
+ style={{ fontSize: `${urlFontSz}px`, color: "inherit" }}
+ />
</div>
</div>
<div className="flex items-center shrink-0" style={{ gap: `${rightGap}px`, color: iconColor }}>
diff --git a/app/components/ui/editor/mockups/MacosDarkIdeMockup.tsx b/app/components/ui/editor/mockups/MacosDarkIdeMockup.tsx
index ff6fd4f..cb3342f 100644
--- a/app/components/ui/editor/mockups/MacosDarkIdeMockup.tsx
+++ b/app/components/ui/editor/mockups/MacosDarkIdeMockup.tsx
@@ -14,32 +14,33 @@ export function MacosDarkIdeMockup({
className = "",
shadows = 20,
roundedCorners,
- maskStyles,
+ maskStyles,
+ onConfigChange
}: MacosDarkIdeMockupProps) {
- const isDark = config.darkMode;
- const frameColor = config.frameColor;
- const url = config.url;
- const cornerRadius = roundedCorners ?? config.cornerRadius;
+ const isDark = config.darkMode;
+ const frameColor = config.frameColor;
+ const url = config.url;
+ const cornerRadius = roundedCorners ?? config.cornerRadius;
const headerOpacity = config.headerOpacity ?? 100;
- const headerScale = (config.headerScale || 100) / 100;
+ const headerScale = (config.headerScale || 100) / 100;
- const headerHeight = 35 * headerScale;
- const menuFontSize = 12 * headerScale;
- const menuPaddingX = 8 * headerScale;
- const menuPaddingY = 4 * headerScale;
- const menuGap = 4 * headerScale;
+ const headerHeight = 35 * headerScale;
+ const menuFontSize = 12 * headerScale;
+ const menuPaddingX = 8 * headerScale;
+ const menuPaddingY = 4 * headerScale;
+ const menuGap = 4 * headerScale;
const headerPaddingX = 12 * headerScale;
- const searchHeight = 22 * headerScale;
+ const searchHeight = 22 * headerScale;
const searchIconSize = 10 * headerScale;
const searchFontSize = 11 * headerScale;
- const searchPaddingX = 8 * headerScale;
- const searchGap = 6 * headerScale;
+ const searchPaddingX = 8 * headerScale;
+ const searchGap = 6 * headerScale;
- const bgColor = isDark ? "#1e1e1e" : "#f3f3f3";
- const borderColor = isDark ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.1)";
- const textColor = isDark ? "#cccccc" : "#333333";
+ const bgColor = isDark ? "#1e1e1e" : "#f3f3f3";
+ const borderColor = isDark ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.1)";
+ const textColor = isDark ? "#cccccc" : "#333333";
const searchBorder = isDark ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.15)";
const searchBgBase = deriveSearchBg(frameColor);
@@ -67,14 +68,14 @@ export function MacosDarkIdeMockup({
<div
className="flex items-center justify-between select-none shrink-0"
style={{
- height: `${headerHeight}px`,
- paddingLeft: `${headerPaddingX}px`,
- paddingRight: `${headerPaddingX}px`,
- backgroundColor: hexToRgba(frameColor, headerOpacity),
- borderBottom: `1px solid ${borderColor}`,
- borderTopLeftRadius: `${cornerRadius}px`,
+ height: `${headerHeight}px`,
+ paddingLeft: `${headerPaddingX}px`,
+ paddingRight: `${headerPaddingX}px`,
+ backgroundColor: hexToRgba(frameColor, headerOpacity),
+ borderBottom: `1px solid ${borderColor}`,
+ borderTopLeftRadius: `${cornerRadius}px`,
borderTopRightRadius: `${cornerRadius}px`,
- color: textColor,
+ color: textColor,
}}
>
<div className="flex items-center" style={{ gap: `${menuGap * 2}px` }}>
@@ -103,25 +104,33 @@ export function MacosDarkIdeMockup({
<div
className="flex items-center justify-center w-full rounded-md cursor-text"
style={{
- height: `${searchHeight}px`,
- gap: `${searchGap}px`,
- padding: `0 ${searchPaddingX}px`,
+ height: `${searchHeight}px`,
+ gap: `${searchGap}px`,
+ padding: `0 ${searchPaddingX}px`,
backgroundColor: hexToRgba(searchBgBase, headerOpacity),
- border: `1px solid ${searchBorder}`,
+ border: `1px solid ${searchBorder}`,
}}
>
<svg style={{ width: `${searchIconSize}px`, height: `${searchIconSize}px`, opacity: 0.5, flexShrink: 0 }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2.5" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2.5" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
- <span className="truncate" style={{ fontSize: `${searchFontSize}px`, color: textColor }}>
- {url || "openvid"}
- </span>
+ <input
+ type="text"
+ value={url || ""}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder="openvid"
+ className="truncate flex-1 bg-transparent border-none outline-none w-full text-center placeholder:text-inherit/50 cursor-text"
+ style={{ fontSize: `${searchFontSize}px`, color: textColor }}
+ />
</div>
</div>
<div className="flex items-center justify-end" style={{ width: `${80 * headerScale}px`, color: isDark ? "rgba(163,163,163,0.8)" : "rgba(100,100,100,0.8)" }}>
<svg style={{ width: `${14 * headerScale}px`, height: `${14 * headerScale}px` }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path d="M4 6h16M4 12h16M4 18h16" strokeWidth="1.5" strokeLinecap="round"/>
+ <path d="M4 6h16M4 12h16M4 18h16" strokeWidth="1.5" strokeLinecap="round" />
</svg>
</div>
</div>
diff --git a/app/components/ui/editor/mockups/MacosGhostGlassMockup.tsx b/app/components/ui/editor/mockups/MacosGhostGlassMockup.tsx
index 312a359..7c78db6 100644
--- a/app/components/ui/editor/mockups/MacosGhostGlassMockup.tsx
+++ b/app/components/ui/editor/mockups/MacosGhostGlassMockup.tsx
@@ -1,6 +1,6 @@
"use client";
import { Icon } from "@iconify/react";
-import type { MockupRenderProps } from "@/types/mockup.types";
+import { DEFAULT_MOCKUP_CONFIG, type MockupRenderProps } from "@/types/mockup.types";
import { hexToRgba } from "@/lib/utils";
import { deriveSearchBg } from "@/lib/color.utils";
@@ -16,6 +16,7 @@ export function MacosGhostGlassMockup({
shadows = 20,
roundedCorners,
maskStyles,
+ onConfigChange
}: MacosGhostGlassMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
@@ -113,9 +114,17 @@ export function MacosGhostGlassMockup({
}}
>
<Icon icon="mdi:lock" className="opacity-60" style={{ width: `${buttonSize}px`, height: `${buttonSize}px`, flexShrink: 0 }} />
- <span className="flex-1 text-center font-medium truncate" style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px` }}>
- {url}
- </span>
+ <input
+ type="text"
+ value={url}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder={DEFAULT_MOCKUP_CONFIG.url}
+ className="flex-1 text-center font-medium truncate bg-transparent border-none outline-none"
+ style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px`, color: textColor }}
+ />
<Icon icon="mdi:refresh" className="opacity-60" style={{ width: `${buttonSize}px`, height: `${buttonSize}px`, flexShrink: 0 }} />
</div>
</div>
diff --git a/app/components/ui/editor/mockups/MacosGhostIdeMockup.tsx b/app/components/ui/editor/mockups/MacosGhostIdeMockup.tsx
index 5ce1f77..453d5af 100644
--- a/app/components/ui/editor/mockups/MacosGhostIdeMockup.tsx
+++ b/app/components/ui/editor/mockups/MacosGhostIdeMockup.tsx
@@ -14,7 +14,8 @@ export function MacosGhostIdeMockup({
className = "",
shadows = 20,
roundedCorners,
- maskStyles,
+ maskStyles,
+ onConfigChange
}: MacosGhostIdeMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
@@ -114,9 +115,17 @@ export function MacosGhostIdeMockup({
<svg style={{ width: `${searchIconSize}px`, height: `${searchIconSize}px`, opacity: 0.5, flexShrink: 0 }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2.5" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
- <span className="truncate" style={{ fontSize: `${searchFontSize}px`, color: textColor }}>
- {url || "openvid"}
- </span>
+ <input
+ type="text"
+ value={url || ""}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder="openvid"
+ className="truncate flex-1 bg-transparent border-none outline-none w-full text-center placeholder:text-inherit/50 cursor-text"
+ style={{ fontSize: `${searchFontSize}px`, color: textColor }}
+ />
</div>
</div>
diff --git a/app/components/ui/editor/mockups/MacosGhostMockup.tsx b/app/components/ui/editor/mockups/MacosGhostMockup.tsx
index 18b1ac4..3edda3d 100644
--- a/app/components/ui/editor/mockups/MacosGhostMockup.tsx
+++ b/app/components/ui/editor/mockups/MacosGhostMockup.tsx
@@ -1,6 +1,6 @@
"use client";
import { Icon } from "@iconify/react";
-import type { MockupRenderProps } from "@/types/mockup.types";
+import { DEFAULT_MOCKUP_CONFIG, type MockupRenderProps } from "@/types/mockup.types";
import { hexToRgba } from "@/lib/utils";
import { deriveSearchBg } from "@/lib/color.utils";
@@ -16,6 +16,7 @@ export function MacosGhostMockup({
shadows = 20,
roundedCorners,
maskStyles,
+ onConfigChange
}: MacosGhostMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
@@ -112,12 +113,17 @@ export function MacosGhostMockup({
className="opacity-60"
style={{ width: `${buttonSize}px`, height: `${buttonSize}px`, flexShrink: 0 }}
/>
- <span
- className="flex-1 text-center font-medium truncate"
- style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px` }}
- >
- {url}
- </span>
+ <input
+ type="text"
+ value={url}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder={DEFAULT_MOCKUP_CONFIG.url}
+ className="flex-1 text-center font-medium truncate bg-transparent border-none outline-none"
+ style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px`, color: textColor }}
+ />
<Icon
icon="mdi:refresh"
className="opacity-60"
diff --git a/app/components/ui/editor/mockups/MacosGlassMockup.tsx b/app/components/ui/editor/mockups/MacosGlassMockup.tsx
index 78f22e2..9d38f3e 100644
--- a/app/components/ui/editor/mockups/MacosGlassMockup.tsx
+++ b/app/components/ui/editor/mockups/MacosGlassMockup.tsx
@@ -1,6 +1,6 @@
"use client";
import { Icon } from "@iconify/react";
-import type { MockupRenderProps } from "@/types/mockup.types";
+import { DEFAULT_MOCKUP_CONFIG, type MockupRenderProps } from "@/types/mockup.types";
import { hexToRgba } from "@/lib/utils";
import { deriveSearchBg } from "@/lib/color.utils";
@@ -16,6 +16,7 @@ export function MacosGlassMockup({
shadows = 20,
roundedCorners,
maskStyles,
+ onConfigChange
}: MacosMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
@@ -53,8 +54,7 @@ export function MacosGlassMockup({
return (
<div className={`relative w-full h-full flex flex-col ${className}`}>
-
- {/* Capa de Sombra interna (evita oscurecer el borde glass exterior) */}
+
<div
className="absolute pointer-events-none"
style={{
@@ -64,7 +64,6 @@ export function MacosGlassMockup({
}}
/>
- {/* Capa principal */}
<div
className="relative w-full h-full overflow-hidden"
style={{
@@ -116,9 +115,17 @@ export function MacosGlassMockup({
}}
>
<Icon icon="mdi:lock" className="opacity-60" style={{ width: `${buttonSize}px`, height: `${buttonSize}px`, flexShrink: 0 }} />
- <span className="flex-1 text-center font-medium truncate" style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px` }}>
- {url}
- </span>
+ <input
+ type="text"
+ value={url}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder={DEFAULT_MOCKUP_CONFIG.url}
+ className="flex-1 text-center font-medium truncate bg-transparent border-none outline-none"
+ style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px`, color: textColor }}
+ />
<Icon icon="mdi:refresh" className="opacity-60" style={{ width: `${buttonSize}px`, height: `${buttonSize}px`, flexShrink: 0 }} />
</div>
</div>
diff --git a/app/components/ui/editor/mockups/MacosMockup.tsx b/app/components/ui/editor/mockups/MacosMockup.tsx
index a6a38cd..89fee67 100644
--- a/app/components/ui/editor/mockups/MacosMockup.tsx
+++ b/app/components/ui/editor/mockups/MacosMockup.tsx
@@ -1,7 +1,7 @@
"use client";
import { Icon } from "@iconify/react";
-import type { MockupRenderProps } from "@/types/mockup.types";
+import { DEFAULT_MOCKUP_CONFIG, type MockupRenderProps } from "@/types/mockup.types";
import { hexToRgba } from "@/lib/utils";
import { deriveSearchBg } from "@/lib/color.utils";
@@ -10,7 +10,7 @@ interface MacosMockupProps extends MockupRenderProps {
roundedCorners?: number;
}
-export function MacosMockup({ children, config, className = "", shadows = 20, roundedCorners, maskStyles }: MacosMockupProps) {
+export function MacosMockup({ children, config, className = "", shadows = 20, roundedCorners, maskStyles, onConfigChange }: MacosMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
const url = config.url;
@@ -88,15 +88,17 @@ export function MacosMockup({ children, config, className = "", shadows = 20, ro
}}
>
<Icon icon="mdi:lock" className="opacity-60 shrink-0" style={{ width: `${buttonSize}px`, height: `${buttonSize}px` }} />
- <span
- className="flex-1 text-center font-medium truncate min-w-0 mt-0.5"
- style={{
- fontSize: `${fontSize}px`,
- padding: `0 ${urlBarPadding}px`,
- }}
- >
- {url}
- </span>
+ <input
+ type="text"
+ value={url}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder={DEFAULT_MOCKUP_CONFIG.url}
+ className="flex-1 text-center font-medium truncate min-w-0 mt-0.5 bg-transparent border-none outline-none"
+ style={{ fontSize: `${fontSize}px`, padding: `0 ${urlBarPadding}px`, color: textColor }}
+ />
<Icon icon="mdi:refresh" className="opacity-60 shrink-0" style={{ width: `${buttonSize}px`, height: `${buttonSize}px` }} />
</div>
</div>
diff --git a/app/components/ui/editor/mockups/MockupWrapper.tsx b/app/components/ui/editor/mockups/MockupWrapper.tsx
index 4fd4a9c..0b09a4c 100644
--- a/app/components/ui/editor/mockups/MockupWrapper.tsx
+++ b/app/components/ui/editor/mockups/MockupWrapper.tsx
@@ -37,9 +37,10 @@ interface MockupWrapperProps {
isHovered?: boolean;
onDeviceHoverChange?: (hovered: boolean) => void;
onDeviceRectChange?: (rect: { x: number; y: number; width: number; height: number } | null) => void;
+ onConfigChange?: (config: Partial<MockupConfig>) => void;
}
-function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, shadows = 20, className = "", maskStyles, isSelected = false, isHovered = false, onDeviceHoverChange, onDeviceRectChange }: MockupWrapperProps) {
+function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, shadows = 20, className = "", maskStyles, isSelected = false, isHovered = false, onDeviceHoverChange, onDeviceRectChange, onConfigChange }: MockupWrapperProps) {
switch (mockupId) {
case "none":
return (
@@ -61,6 +62,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</MacosMockup>
@@ -74,6 +76,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</MacosGlassMockup>
@@ -113,6 +116,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</MacosGhostMockup>
@@ -125,6 +129,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</MacosGhostGlassMockup>
@@ -150,6 +155,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</BraveMockup>
@@ -162,6 +168,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</BraveGlassMockup>
@@ -174,6 +181,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</BrowserTabGlassMockup>
@@ -186,6 +194,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</ChromeMockup>
@@ -199,6 +208,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</ChromeGlassMockup>
@@ -277,6 +287,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</VSCodeMockup>
@@ -289,6 +300,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</MacosDarkIdeMockup>
@@ -301,6 +313,7 @@ function MockupWrapperInner({ mockupId, config, children, roundedCorners = 12, s
shadows={shadows}
className={className}
maskStyles={maskStyles}
+ onConfigChange={onConfigChange}
>
{children}
</MacosGhostIdeMockup>
diff --git a/app/components/ui/editor/mockups/VSCodeMockup.tsx b/app/components/ui/editor/mockups/VSCodeMockup.tsx
index da6f211..782ae6a 100644
--- a/app/components/ui/editor/mockups/VSCodeMockup.tsx
+++ b/app/components/ui/editor/mockups/VSCodeMockup.tsx
@@ -15,7 +15,8 @@ export function VSCodeMockup({
className = "",
shadows = 20,
roundedCorners,
- maskStyles,
+ maskStyles,
+ onConfigChange,
}: VSCodeMockupProps) {
const isDark = config.darkMode;
const frameColor = config.frameColor;
@@ -113,9 +114,17 @@ export function VSCodeMockup({
}}
>
<Icon icon="mdi:magnify" className="opacity-50" style={{ width: `${searchIconSize}px`, height: `${searchIconSize}px` }} />
- <span className="truncate" style={{ fontSize: `${searchFontSize}px`, color: textColor }}>
- {url || "openvid"}
- </span>
+ <input
+ type="text"
+ value={url || ""}
+ onChange={(e) => onConfigChange?.({ url: e.target.value })}
+ onMouseDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
+ placeholder="openvid"
+ className="truncate flex-1 bg-transparent border-none outline-none w-full text-center placeholder:text-inherit/50 cursor-text"
+ style={{ fontSize: `${searchFontSize}px`, color: textColor }}
+ />
</div>
</div>
diff --git a/types/editor.types.ts b/types/editor.types.ts
index b7814aa..cc9a783 100644
--- a/types/editor.types.ts
+++ b/types/editor.types.ts
@@ -1,136 +1,120 @@
+"use client";
import type { ZoomFragment } from "./zoom.types";
import type { CanvasElement } from "./canvas-elements.types";
+import type { ImageMaskConfig } from "@/types/photo.types";
+import type { MockupConfig } from "./mockup.types";
+import type { CameraConfig } from "./camera.types";
import { MockupMotionFragment } from "@/lib/mockup-motion";
export type Tool = "screenshot" | "elements" | "audio" | "zoom" | "mockup" | "cursor" | "video" | "camera" | "history" | "motion";
-
export type BackgroundTab = "wallpaper" | "image" | "color";
-
export type AspectRatio = "auto" | "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "custom";
-export interface CropArea {
- x: number;
- y: number;
- width: number;
- height: number;
-}
-
-export interface VideoTransform {
- rotation: number;
- translateX: number;
- translateY: number;
-}
+export interface CropArea { x: number; y: number; width: number; height: number; }
+export interface VideoTransform { rotation: number; translateX: number; translateY: number; }
export const ASPECT_RATIO_DIMENSIONS: Record<AspectRatio, { width: number; height: number } | null> = {
- "auto": null,
- "16:9": { width: 1920, height: 1080 },
- "9:16": { width: 1080, height: 1920 },
- "1:1": { width: 1080, height: 1080 },
- "4:3": { width: 1440, height: 1080 },
- "3:4": { width: 1080, height: 1440 },
- "custom": null,
+ "auto": null,
+ "16:9": { width: 1920, height: 1080 },
+ "9:16": { width: 1080, height: 1920 },
+ "1:1": { width: 1080, height: 1080 },
+ "4:3": { width: 1440, height: 1080 },
+ "3:4": { width: 1080, height: 1440 },
+ "custom": null,
};
export interface EditorState {
- activeTool: Tool;
- backgroundTab: BackgroundTab;
- selectedWallpaper: number;
- backgroundBlur: number;
- padding: number;
- roundedCorners: number;
- shadows: number;
+ activeTool: Tool;
+ backgroundTab: BackgroundTab;
+ selectedWallpaper: number;
+ backgroundBlur: number;
+ padding: number;
+ roundedCorners: number;
+ shadows: number;
}
export interface VideoCanvasHandle {
- getExportCanvas: () => HTMLCanvasElement | null;
- drawFrame: (highQuality?: boolean, explicitTimelineTime?: number, frameOverride?: VideoFrame) => Promise<void>;
-
- getPreviewContainer: () => HTMLDivElement | null;
- clearAllSelection: () => { multiIds: string[]; videoSelected: boolean };
- restoreSelectionState: (state: { multiIds: string[]; videoSelected: boolean }) => void;
-
-}
-
-export interface VideoThumbnail {
- time: number;
- dataUrl: string;
- quality?: "low" | "high";
+ getExportCanvas: () => HTMLCanvasElement | null;
+ drawFrame: (highQuality?: boolean, explicitTimelineTime?: number, frameOverride?: VideoFrame) => Promise<void>;
+ getPreviewContainer: () => HTMLDivElement | null;
+ clearAllSelection: () => { multiIds: string[]; videoSelected: boolean };
+ restoreSelectionState: (state: { multiIds: string[]; videoSelected: boolean }) => void;
}
+export interface VideoThumbnail { time: number; dataUrl: string; quality?: "low" | "high"; }
export type MediaType = "video" | "image";
export interface VideoCanvasProps {
- activeTool?: string;
- mediaType?: MediaType;
- imageUrl?: string | null;
- imageRef?: React.RefObject<HTMLImageElement | null>;
- imageTransform?: {
- id: string;
- label: string;
- rotateX: number;
- rotateY: number;
- rotateZ: number;
- translateY: number;
- scale: number;
- perspective?: number;
- };
- apply3DToBackground?: boolean;
- imageMaskConfig?: import("@/types/photo.types").ImageMaskConfig;
- videoMaskConfig?: import("@/types/photo.types").ImageMaskConfig;
- onVideoMaskConfigChange?: (config: import("@/types/photo.types").ImageMaskConfig) => void;
- videoRef: React.RefObject<HTMLVideoElement | null>;
- videoUrl: string | null;
- padding: number;
- roundedCorners: number;
- shadows: number;
- aspectRatio?: AspectRatio;
- customAspectRatio?: { width: number; height: number } | null;
- cropArea?: CropArea;
- backgroundTab?: BackgroundTab;
- selectedWallpaper?: number;
- backgroundBlur?: number;
- selectedImageUrl?: string;
- unsplashOverrideUrl?: string;
- backgroundColorCss?: string;
- onTimeUpdate: () => void;
- onLoadedMetadata: () => void;
- onEnded: () => void;
- isScrubbing?: boolean;
- scrubTime?: number;
- getThumbnailForTime?: (time: number) => VideoThumbnail | null;
- zoomFragments?: ZoomFragment[];
- currentTime?: number;
- mockupId?: string;
- mockupConfig?: import("./mockup.types").MockupConfig;
- onVideoUpload?: (file: File) => void;
- onImageUpload?: (file: File) => void;
- onImageDrop?: (files: FileList | File[]) => void;
- onVideoDrop?: (files: FileList) => void;
- isUploading?: boolean;
- videoTransform?: VideoTransform;
- onVideoTransformChange?: (transform: VideoTransform) => void;
- canvasElements?: CanvasElement[];
- selectedElementId?: string | null;
- onElementUpdate?: (id: string, updates: Partial<CanvasElement>) => void;
- onElementSelect?: (id: string | null) => void;
- onElementDelete?: (id: string | string[]) => void;
- cameraUrl?: string | null;
- cameraConfig?: import("./camera.types").CameraConfig | null;
- onCameraConfigChange?: (partial: Partial<import("./camera.types").CameraConfig>) => void;
- onCameraClick?: () => void;
- layersPanelToolbar?: React.ReactNode;
- textToolActive?: boolean;
- onTextToolDeactivate?: () => void;
- onAddElement?: (element: CanvasElement) => void;
- isPlaying?: boolean;
- onMockupClick?: (kind: "2d" | "3d") => void;
- isRestoringProjectRef?: React.MutableRefObject<boolean>;
- activeMediaAspect?: number | null;
- activeClipUrl?: string | null;
- onPaddingChange?: (value: number) => void;
- imageZoomScale?: number;
- onImageZoomScaleChange?: (scale: number) => void;
- otherSelectionActive?: boolean;
- mockupMotionFragments?: MockupMotionFragment[];
- videoDuration?: number;
-}
\ No newline at end of file
+ activeTool?: string;
+ mediaType?: MediaType;
+ imageUrl?: string | null;
+ imageRef?: React.RefObject<HTMLImageElement | null>;
+ imageTransform?: { id: string; label: string; rotateX: number; rotateY: number; rotateZ: number; translateY: number; scale: number; perspective?: number; };
+ apply3DToBackground?: boolean;
+
+
+ imageMaskConfig?: ImageMaskConfig;
+ videoMaskConfig?: ImageMaskConfig;
+ onVideoMaskConfigChange?: (config: ImageMaskConfig) => void;
+
+ videoRef: React.RefObject<HTMLVideoElement | null>;
+ videoUrl: string | null;
+ padding: number;
+ roundedCorners: number;
+ shadows: number;
+ aspectRatio?: AspectRatio;
+ customAspectRatio?: { width: number; height: number } | null;
+ cropArea?: CropArea;
+ backgroundTab?: BackgroundTab;
+ selectedWallpaper?: number;
+ backgroundBlur?: number;
+ selectedImageUrl?: string;
+ unsplashOverrideUrl?: string;
+ backgroundColorCss?: string;
+ onTimeUpdate: () => void;
+ onLoadedMetadata: () => void;
+ onEnded: () => void;
+ isScrubbing?: boolean;
+ scrubTime?: number;
+ getThumbnailForTime?: (time: number) => VideoThumbnail | null;
+ zoomFragments?: ZoomFragment[];
+ currentTime?: number;
+ mockupId?: string;
+
+ mockupConfig?: MockupConfig;
+
+ onVideoUpload?: (file: File) => void;
+ onImageUpload?: (file: File) => void;
+ onImageDrop?: (files: FileList | File[]) => void;
+ onVideoDrop?: (files: FileList) => void;
+ isUploading?: boolean;
+ videoTransform?: VideoTransform;
+ onVideoTransformChange?: (transform: VideoTransform) => void;
+ canvasElements?: CanvasElement[];
+ selectedElementId?: string | null;
+ onElementUpdate?: (id: string, updates: Partial<CanvasElement>) => void;
+ onElementSelect?: (id: string | null) => void;
+ onElementDelete?: (id: string | string[]) => void;
+ cameraUrl?: string | null;
+
+ cameraConfig?: CameraConfig | null;
+ onCameraConfigChange?: (partial: Partial<CameraConfig>) => void;
+
+ onCameraClick?: () => void;
+ layersPanelToolbar?: React.ReactNode;
+ textToolActive?: boolean;
+ onTextToolDeactivate?: () => void;
+ onAddElement?: (element: CanvasElement) => void;
+ isPlaying?: boolean;
+ onMockupClick?: (kind: "2d" | "3d") => void;
+ isRestoringProjectRef?: React.MutableRefObject<boolean>;
+ activeMediaAspect?: number | null;
+ activeClipUrl?: string | null;
+ onPaddingChange?: (value: number) => void;
+ imageZoomScale?: number;
+ onImageZoomScaleChange?: (scale: number) => void;
+ otherSelectionActive?: boolean;
+ mockupMotionFragments?: MockupMotionFragment[];
+ videoDuration?: number;
+ onMockupConfigChange?: (config: Partial<MockupConfig>) => void;
+}
diff --git a/types/mockup.types.ts b/types/mockup.types.ts
index 62a8cfe..ba520fd 100644
--- a/types/mockup.types.ts
+++ b/types/mockup.types.ts
@@ -48,6 +48,7 @@ export interface MockupRenderProps {
config: MockupConfig;
className?: string;
maskStyles?: React.CSSProperties;
+ onConfigChange?: (config: Partial<MockupConfig>) => void;
}
// Default configuration