Create professional demos and 3D mockups in seconds, directly in your browser
Refactor iPhone Slim and S24 Ultra mockup drawing functions for improved readability and maintainability
CristianOlivera1570792f1f941
diff --git a/app/components/ui/editor/mockups/GlassFullMockup.tsx b/app/components/ui/editor/mockups/GlassFullMockup.tsxindex 5fee70c..82a659c 100644--- a/app/components/ui/editor/mockups/GlassFullMockup.tsx+++ b/app/components/ui/editor/mockups/GlassFullMockup.tsx@@ -5,229 +5,209 @@ import type { MockupRenderProps } from "@/types/mockup.types";import { hexToRgba } from "@/lib/utils";interface GlassFullMockupProps extends MockupRenderProps {- shadows?: number;- roundedCorners?: number;+ shadows?: number;+ roundedCorners?: number;}export function GlassFullMockup({- children,- config,- className = "",- shadows = 30,- roundedCorners+ children,+ config,+ className = "",+ shadows = 30,+ roundedCorners}: GlassFullMockupProps) {- const isDark = config.darkMode;- const frameColor = isDark ? config.frameColor : "#ffffff";- const cornerRadius = roundedCorners ?? config.cornerRadius;-- const headerOpacity = config.headerOpacity ?? 10;- const headerScale = (config.headerScale || 100) / 100;-- const framePadding = 12 * headerScale;- const buttonWidth = 4 * headerScale;-- const notchTop = 8 * headerScale;- const notchWidth = 104 * headerScale;- const notchHeight = 24 * headerScale;- const notchPaddingX = 8 * headerScale;- const dotSize = 8 * headerScale;-- const statusBarHeight = 32 * headerScale;- const statusBarPaddingX = 28 * headerScale;- const timeFontSize = 10 * headerScale;-- const signalBarWidth = 2 * headerScale;- const iconsGap = 6 * headerScale;- const wifiSize = 12 * headerScale;- const batteryWidth = 18 * headerScale;- const batteryHeight = 10 * headerScale;-- const contentPaddingTop = 40 * headerScale;-- const homeIndicatorWidth = 128 * headerScale;- const homeIndicatorHeight = 4 * headerScale;- const homeIndicatorBottom = 8 * headerScale;-- const screenBg = isDark ? "#0a0a0a" : "#f9f9f9";- const frameBorderColor = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(255, 255, 255, 0.3)";- const screenBorderColor = isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)";- const notchBg = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.05)";- const statusBarText = isDark ? "rgba(255, 255, 255, 0.8)" : "rgba(0, 0, 0, 0.6)";- const statusBarTextDim = isDark ? "rgba(255, 255, 255, 0.4)" : "rgba(0, 0, 0, 0.2)";- const homeIndicatorBg = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.1)";- const buttonBg = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(255, 255, 255, 0.4)";+ const isDark = config.darkMode;+ const frameColor = isDark ? config.frameColor : "#ffffff";+ const cornerRadius = roundedCorners ?? config.cornerRadius;+ const headerOpacity = config.headerOpacity ?? 10;++ const headerScale = (config.headerScale || 100) / 100;++ const framePadding = 12 * headerScale;+ const buttonWidth = 7 * headerScale;++ const notchTop = 8 * headerScale;+ const notchWidth = 104 * headerScale;+ const notchHeight = 24 * headerScale;+ const notchPaddingX = 8 * headerScale;+ const dotSize = 8 * headerScale;++ const statusBarHeight = 32 * headerScale;+ const statusBarPaddingX = 28 * headerScale;+ const timeFontSize = 10 * headerScale;+ const signalBarWidth = 2 * headerScale;+ const iconsGap = 6 * headerScale;+ const wifiSize = 12 * headerScale;+ const batteryWidth = 18 * headerScale;+ const batteryHeight = 10 * headerScale;++ const contentPaddingTop = 40 * headerScale;++ const homeIndicatorWidth = 128 * headerScale;+ const homeIndicatorHeight = 4 * headerScale;+ const homeIndicatorBottom = 8 * headerScale;++ const screenBg = isDark ? "#0a0a0a" : "#f9f9f9";+ const frameBorderColor = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(255, 255, 255, 0.3)";+ const screenBorderColor = isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)";+ const notchBg = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.05)";+ const statusBarText = isDark ? "rgba(255, 255, 255, 0.8)" : "rgba(0, 0, 0, 0.6)";+ const statusBarTextDim = isDark ? "rgba(255, 255, 255, 0.4)" : "rgba(0, 0, 0, 0.2)";+ const homeIndicatorBg = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.1)";++ const buttonBg = isDark ? "rgba(255, 255, 255, 0.25)" : "rgba(0, 0, 0, 0.15)";+ const buttonBorderColor = isDark ? "rgba(255, 255, 255, 0.4)" : "rgba(0, 0, 0, 0.25)";+ const buttonShadow = isDark ? "inset 0px 0px 4px rgba(255,255,255,0.2), 0 1px 3px rgba(0,0,0,0.5)" : "inset 0px 0px 4px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.2)";++ return (+ <div className={`relative flex flex-col ${className}`}>+ <div+ className="relative flex flex-col backdrop-blur-2xl"+ style={{+ padding: `${framePadding}px`,+ backgroundColor: hexToRgba(frameColor, headerOpacity),+ borderRadius: `${cornerRadius * 2.8}px`,+ boxShadow: shadows > 0 ? `0 ${shadows}px ${shadows * 2}px rgba(0,0,0,1)` : 'none',+ border: `1px solid ${frameBorderColor}`,+ }}+ >+ <div+ className="absolute backdrop-blur-md rounded-l-sm z-[-1]"+ style={{+ left: `-${buttonWidth}px`,+ top: '15%',+ width: `${buttonWidth}px`,+ height: '5%',+ backgroundColor: buttonBg,+ borderLeft: `1px solid ${buttonBorderColor}`,+ borderTop: `1px solid ${buttonBorderColor}`,+ borderBottom: `1px solid ${buttonBorderColor}`,+ boxShadow: buttonShadow+ }}+ />+ <div+ className="absolute backdrop-blur-md rounded-l-sm z-[-1]"+ style={{+ left: `-${buttonWidth}px`,+ top: '25%',+ width: `${buttonWidth}px`,+ height: '12%',+ backgroundColor: buttonBg,+ borderLeft: `1px solid ${buttonBorderColor}`,+ borderTop: `1px solid ${buttonBorderColor}`,+ borderBottom: `1px solid ${buttonBorderColor}`,+ boxShadow: buttonShadow+ }}+ />+ <div+ className="absolute backdrop-blur-md rounded-r-sm z-[-1]"+ style={{+ right: `-${buttonWidth}px`,+ top: '28%',+ width: `${buttonWidth}px`,+ height: '14%',+ backgroundColor: buttonBg,+ borderRight: `1px solid ${buttonBorderColor}`,+ borderTop: `1px solid ${buttonBorderColor}`,+ borderBottom: `1px solid ${buttonBorderColor}`,+ boxShadow: buttonShadow+ }}+ />- return (<div- className={`relative flex flex-col ${className}`}+ className="relative w-full h-full overflow-hidden flex flex-col shadow-inner"+ style={{+ backgroundColor: screenBg,+ borderRadius: `${cornerRadius * 2.3}px`,+ border: `1px solid ${screenBorderColor}`,+ }}>+ <div+ className="absolute left-1/2 -translate-x-1/2 rounded-full z-30 flex items-center justify-between shadow-sm"+ style={{+ top: `${notchTop}px`,+ width: `${notchWidth}px`,+ height: `${notchHeight}px`,+ backgroundColor: notchBg,+ padding: `0 ${notchPaddingX}px`+ }}+ ><div- className="relative flex flex-col backdrop-blur-2xl"+ className="bg-neutral-500 rounded-full border border-neutral-700"+ style={{ width: `${dotSize}px`, height: `${dotSize}px` }}+ />+ <div+ className="bg-indigo-500 rounded-full opacity-80 blur-[1px]"+ style={{ width: `${dotSize}px`, height: `${dotSize}px` }}+ />+ </div>++ <div+ className="absolute top-0 w-full flex items-center justify-between z-20"+ style={{+ height: `${statusBarHeight}px`,+ padding: `0 ${statusBarPaddingX}px`,+ }}+ >+ <span+ className="font-bold tracking-tight"+ style={{ fontSize: `${timeFontSize}px`, color: statusBarText }}+ >+ 9:41+ </span>++ <div className="flex items-center" style={{ gap: `${iconsGap}px` }}>+ <div className="flex items-end" style={{ gap: '1px', height: `${batteryHeight * 0.8}px` }}>+ <div className="rounded-[0.5px]" style={{ width: `${signalBarWidth}px`, height: '40%', backgroundColor: statusBarText }} />+ <div className="rounded-[0.5px]" style={{ width: `${signalBarWidth}px`, height: '60%', backgroundColor: statusBarText }} />+ <div className="rounded-[0.5px]" style={{ width: `${signalBarWidth}px`, height: '80%', backgroundColor: statusBarText }} />+ <div className="rounded-[0.5px]" style={{ width: `${signalBarWidth}px`, height: '100%', backgroundColor: statusBarTextDim }} />+ </div>+ <Icon icon="mdi:wifi" style={{ width: `${wifiSize}px`, height: `${wifiSize}px`, color: statusBarText }} />++ <div+ className="relative rounded-[2px] flex items-center"style={{- padding: `${framePadding}px`,- backgroundColor: hexToRgba(frameColor, headerOpacity),- borderRadius: `${cornerRadius * 2.8}px`,- boxShadow: shadows > 0- ? `0 ${shadows}px ${shadows * 2}px rgba(0,0,0,1)`- : 'none',- border: `1px solid ${frameBorderColor}`,+ width: `${batteryWidth}px`,+ height: `${batteryHeight}px`,+ padding: '1px',+ border: `1px solid ${statusBarTextDim}`}}- >+ >+ <div className="h-full rounded-[0.5px]" style={{ width: '70%', backgroundColor: statusBarText }} /><div- className="absolute backdrop-blur-md rounded-l-sm"- style={{- left: `-${buttonWidth}px`,- top: '15%',- width: `${buttonWidth}px`,- height: '5%',- backgroundColor: buttonBg,- borderLeft: `1px solid ${frameBorderColor}`,- borderTop: `1px solid ${frameBorderColor}`,- borderBottom: `1px solid ${frameBorderColor}`,- }}+ className="absolute rounded-r-full"+ style={{+ right: '-2px',+ width: '1px',+ height: '40%',+ backgroundColor: statusBarTextDim+ }}/>-- <div- className="absolute backdrop-blur-md rounded-l-sm"- style={{- left: `-${buttonWidth}px`,- top: '25%',- width: `${buttonWidth}px`,- height: '12%',- backgroundColor: buttonBg,- borderLeft: `1px solid ${frameBorderColor}`,- borderTop: `1px solid ${frameBorderColor}`,- borderBottom: `1px solid ${frameBorderColor}`,- }}- />-- <div- className="absolute backdrop-blur-md rounded-r-sm"- style={{- right: `-${buttonWidth}px`,- top: '28%',- width: `${buttonWidth}px`,- height: '14%',- backgroundColor: buttonBg,- borderRight: `1px solid ${frameBorderColor}`,- borderTop: `1px solid ${frameBorderColor}`,- borderBottom: `1px solid ${frameBorderColor}`,- }}- />-- <div- className="relative w-full h-full overflow-hidden flex flex-col shadow-inner"- style={{- backgroundColor: screenBg,- borderRadius: `${cornerRadius * 2.3}px`,- border: `1px solid ${screenBorderColor}`,- }}- >- <div- className="absolute left-1/2 -translate-x-1/2 rounded-full z-30 flex items-center justify-between shadow-sm"- style={{- top: `${notchTop}px`,- width: `${notchWidth}px`,- height: `${notchHeight}px`,- backgroundColor: notchBg,- padding: `0 ${notchPaddingX}px`- }}- >- <div- className="bg-neutral-500 rounded-full border border-neutral-700"- style={{ width: `${dotSize}px`, height: `${dotSize}px` }}- />- <div- className="bg-indigo-500 rounded-full opacity-80 blur-[1px]"- style={{ width: `${dotSize}px`, height: `${dotSize}px` }}- />- </div>-- <div- className="absolute top-0 w-full flex items-center justify-between z-20"- style={{- height: `${statusBarHeight}px`,- padding: `0 ${statusBarPaddingX}px`,- }}- >- <span- className="font-bold tracking-tight"- style={{- fontSize: `${timeFontSize}px`,- color: statusBarText- }}- >- 9:41- </span>- <div- className="flex items-center"- style={{ gap: `${iconsGap}px` }}- >- <div- className="flex items-end"- style={{ gap: '1px', height: `${batteryHeight * 0.8}px` }}- >- <div className="rounded-[0.5px]" style={{ width: `${signalBarWidth}px`, height: '40%', backgroundColor: statusBarText }} />- <div className="rounded-[0.5px]" style={{ width: `${signalBarWidth}px`, height: '60%', backgroundColor: statusBarText }} />- <div className="rounded-[0.5px]" style={{ width: `${signalBarWidth}px`, height: '80%', backgroundColor: statusBarText }} />- <div className="rounded-[0.5px]" style={{ width: `${signalBarWidth}px`, height: '100%', backgroundColor: statusBarTextDim }} />- </div>- <Icon- icon="mdi:wifi"- style={{- width: `${wifiSize}px`,- height: `${wifiSize}px`,- color: statusBarText- }}- />- <div- className="relative rounded-[2px] flex items-center"- style={{- width: `${batteryWidth}px`,- height: `${batteryHeight}px`,- padding: '1px',- border: `1px solid ${statusBarTextDim}`- }}- >- <div- className="h-full rounded-[0.5px]"- style={{ width: '70%', backgroundColor: statusBarText }}- />- <div- className="absolute rounded-r-full"- style={{- right: '-2px',- width: '1px',- height: '40%',- backgroundColor: statusBarTextDim- }}- />- </div>- </div>- </div>-- <div- className="relative w-full h-full"- style={{- paddingTop: `${contentPaddingTop}px`- }}- >- <div className="relative z-10 w-full h-full">- {children}- </div>- </div>+ </div>+ </div>+ </div>- <div- className="absolute left-1/2 -translate-x-1/2 rounded-full z-20 pointer-events-none"- style={{- bottom: `${homeIndicatorBottom}px`,- width: `${homeIndicatorWidth}px`,- height: `${homeIndicatorHeight}px`,- backgroundColor: homeIndicatorBg- }}- />- </div>+ <div+ className="relative w-full h-full"+ style={{ paddingTop: `${contentPaddingTop}px` }}+ >+ <div className="relative z-10 w-full h-full">+ {children}</div>+ </div>++ <div+ className="absolute left-1/2 -translate-x-1/2 rounded-full z-20 pointer-events-none"+ style={{+ bottom: `${homeIndicatorBottom}px`,+ width: `${homeIndicatorWidth}px`,+ height: `${homeIndicatorHeight}px`,+ backgroundColor: homeIndicatorBg+ }}+ /></div>- );+ </div>+ </div>+ );}\ No newline at end of filediff --git a/app/components/ui/editor/mockups/IPhoneSlimMockup.tsx b/app/components/ui/editor/mockups/IPhoneSlimMockup.tsxindex e4275cf..49e53ae 100644--- a/app/components/ui/editor/mockups/IPhoneSlimMockup.tsx+++ b/app/components/ui/editor/mockups/IPhoneSlimMockup.tsx@@ -9,82 +9,76 @@ interface IPhoneSlimMockupProps extends MockupRenderProps {roundedCorners?: number;}-export function IPhoneSlimMockup({- children,+export function IPhoneSlimMockup({+ children,config,className = "",shadows = 30,- roundedCorners+ roundedCorners,}: IPhoneSlimMockupProps) {const isDark = config.darkMode;const frameColor = isDark ? config.frameColor : "#e5e5e5";const cornerRadius = roundedCorners ?? config.cornerRadius;const headerOpacity = config.headerOpacity ?? 100;-const headerScale = (config.headerScale || 100) / 100;-- const statusBarHeight = 28 * headerScale;++ // Dimensiones del Header optimizadas para alineación perfecta+ const statusBarHeight = 32 * headerScale;const statusBarPaddingX = 24 * headerScale;- const timeFontSize = 10 * headerScale;+ const timeFontSize = 12 * headerScale;const signalBarWidth = 3 * headerScale;- const wifiSize = 14 * headerScale;- const batteryWidth = 20 * headerScale;- const batteryHeight = 10 * headerScale;- const iconsGap = 4 * headerScale;-+ const wifiSize = 13 * headerScale;+ const batteryWidth = 22 * headerScale;+ const batteryHeight = 11 * headerScale;+ const iconsGap = 6 * headerScale;+const dynamicIslandTop = 6 * headerScale;const dynamicIslandMinHeight = 18 * headerScale;const dynamicIslandPaddingX = 8 * headerScale;const dynamicIslandGap = 4 * headerScale;- const dotSize = 6 * headerScale;-+ const dotSize = 5 * headerScale;+const homeIndicatorBottom = 6 * headerScale;const homeIndicatorHeight = 3 * headerScale;-const framePadding = 6 * headerScale;-+const screenBg = isDark ? "#0a0a0a" : "#fafafa";const statusBarText = isDark ? "#ffffff" : "#000000";const borderColor = isDark ? "#404040" : "#525252";return (- <div- className={`relative flex flex-col ${className}`}- >- <div+ <div className={`relative flex flex-col ${className}`}>+ <divclassName="relative flex flex-col"style={{padding: `${framePadding}px`,backgroundColor: hexToRgba(frameColor, headerOpacity),borderRadius: `${cornerRadius * 2.5}px`,- boxShadow: shadows > 0- ? `0 ${shadows}px ${shadows * 2}px rgba(0,0,0,1)`- : 'none',+ boxShadow: shadows > 0 ? `0 ${shadows}px ${shadows * 2}px rgba(0,0,0,1)` : "none",border: `1px solid ${borderColor}`,}}>- <div+ <divclassName="absolute -left-1.25 top-[15%] w-1 h-[6%] rounded-l-sm"- style={{+ style={{backgroundColor: hexToRgba(frameColor, headerOpacity),borderLeft: `1px solid ${borderColor}`,borderTop: `1px solid ${borderColor}`,borderBottom: `1px solid ${borderColor}`,}}/>- <div+ <divclassName="absolute -left-1.25 top-[24%] w-1 h-[12%] rounded-l-sm"- style={{+ style={{backgroundColor: hexToRgba(frameColor, headerOpacity),borderLeft: `1px solid ${borderColor}`,borderTop: `1px solid ${borderColor}`,borderBottom: `1px solid ${borderColor}`,}}/>-- <div+ <divclassName="absolute -right-1.25 top-[28%] w-1 h-[14%] rounded-r-sm"- style={{+ style={{backgroundColor: hexToRgba(frameColor, headerOpacity),borderRight: `1px solid ${borderColor}`,borderTop: `1px solid ${borderColor}`,@@ -92,143 +86,128 @@ export function IPhoneSlimMockup({}}/>- <div+ <divclassName="relative w-full h-full overflow-hidden flex flex-col border border-black"style={{- backgroundColor: '#000000',+ backgroundColor: "#000000",borderRadius: `${cornerRadius * 2.2}px`,}}>- <div- className="absolute left-1/2 -translate-x-1/2 w-[28%] bg-black rounded-full z-30 flex items-center justify-end"- style={{+ <div+ className="absolute left-1/2 -translate-x-1/2 w-[28%] bg-black rounded-full z-30 flex items-center justify-center"+ style={{top: `${dynamicIslandTop}px`,minHeight: `${dynamicIslandMinHeight}px`,- height: '4%',+ height: "4%",padding: `0 ${dynamicIslandPaddingX}px`,gap: `${dynamicIslandGap}px`,- boxShadow: '0 2px 8px rgba(0,0,0,0.3)'+ boxShadow: "0 2px 8px rgba(0,0,0,0.3)",}}>- <div+ <divclassName="bg-indigo-500/40 rounded-full blur-[1px]"style={{ width: `${dotSize}px`, height: `${dotSize}px` }}/>- <div+ <divclassName="bg-neutral-800 rounded-full border border-white/10"style={{ width: `${dotSize}px`, height: `${dotSize}px` }}/></div>- <div- className="absolute top-0 w-full flex items-center justify-between z-20"+ <div+ className="absolute -top-2 w-full flex items-center justify-between z-20"style={{height: `max(${statusBarHeight}px, 7%)`,padding: `0 ${statusBarPaddingX}px`,}}>- <span- className="font-bold tracking-tight"- style={{- fontSize: `${timeFontSize}px`,- color: statusBarText- }}+ <span+ className="font-bold tracking-tight leading-none flex items-center"+ style={{ fontSize: `${timeFontSize}px`, color: statusBarText }}>9:41</span>- <div++ <divclassName="flex items-center opacity-90"style={{ gap: `${iconsGap}px` }}>- <div+ <divclassName="flex items-end"- style={{ gap: '1px', height: `${batteryHeight}px` }}+ style={{ gap: "1.5px", height: `${batteryHeight}px` }}>- <div- className="rounded-full"- style={{- width: `${signalBarWidth}px`,- height: '40%',- backgroundColor: statusBarText- }}+ <div+ className="rounded-full"+ style={{ width: `${signalBarWidth}px`, height: "30%", backgroundColor: statusBarText }}/>- <div- className="rounded-full"- style={{- width: `${signalBarWidth}px`,- height: '60%',- backgroundColor: statusBarText- }}+ <div+ className="rounded-full"+ style={{ width: `${signalBarWidth}px`, height: "55%", backgroundColor: statusBarText }}/>- <div- className="rounded-full"- style={{- width: `${signalBarWidth}px`,- height: '80%',- backgroundColor: statusBarText- }}+ <div+ className="rounded-full"+ style={{ width: `${signalBarWidth}px`, height: "80%", backgroundColor: statusBarText }}/>- <div- className="rounded-full"- style={{- width: `${signalBarWidth}px`,- height: '100%',- backgroundColor: statusBarText- }}+ <div+ className="rounded-full"+ style={{ width: `${signalBarWidth}px`, height: "100%", backgroundColor: statusBarText }}/></div>- <Icon- icon="mdi:wifi"- style={{- width: `${wifiSize}px`,++ <Icon+ icon="mdi:wifi"+ style={{+ width: `${wifiSize}px`,height: `${wifiSize}px`,- color: statusBarText- }}+ color: statusBarText,+ display: "block",+ }}/>- <div- className="border rounded-[3px] p-px relative"- style={{++ <div+ className="border rounded-[3px] p-px flex items-center relative"+ style={{width: `${batteryWidth}px`,height: `${batteryHeight}px`,- borderColor: `${statusBarText}50`+ borderColor: `${statusBarText}50`,}}>- <div- className="h-full w-[90%] rounded-[1px]"+ <div+ className="h-full w-[85%] rounded-[1px]"style={{ backgroundColor: statusBarText }}/>+ <div+ className="absolute -right-[3px] w-[2px] h-[40%] rounded-r-[1px]"+ style={{ backgroundColor: `${statusBarText}50` }}+ /></div></div></div>- <div+ <divclassName="w-full h-full relative overflow-hidden"- style={{- paddingTop: `max(${statusBarHeight}px, 8%)`,- }}+ style={{ paddingTop: `max(${statusBarHeight}px, 8%)` }}>- <div- className="absolute inset-0"- style={{+ <div+ className="absolute inset-0"+ style={{backgroundColor: screenBg,top: `max(${statusBarHeight}px, 8%)`,}}/>- <div className="relative z-10 w-full h-full">- {children}- </div>+ <div className="relative z-10 w-full h-full">{children}</div></div>- <div+ <divclassName="absolute left-1/2 -translate-x-1/2 w-[35%] rounded-full z-20"- style={{+ style={{bottom: `${homeIndicatorBottom}px`,height: `${homeIndicatorHeight}px`,- backgroundColor: `${statusBarText}15`+ backgroundColor: `${statusBarText}15`,}}/></div></div></div>);-}+}\ No newline at end of filediff --git a/app/components/ui/editor/mockups/S24UltraMockup.tsx b/app/components/ui/editor/mockups/S24UltraMockup.tsxindex b7b354c..f36118a 100644--- a/app/components/ui/editor/mockups/S24UltraMockup.tsx+++ b/app/components/ui/editor/mockups/S24UltraMockup.tsx@@ -21,7 +21,7 @@ export function S24UltraMockup({const headerScale = (config.headerScale || 100) / 100;const framePadding = 10 * headerScale;- const buttonWidth = 4 * headerScale;+ const buttonWidth = 8 * headerScale;const buttonRadius = 2 * headerScale;const cameraTop = 12 * headerScale;@@ -69,7 +69,7 @@ export function S24UltraMockup({right: `-${buttonWidth}px`,top: '20%',width: `${buttonWidth}px`,- height: '8%',+ height: '10%',backgroundColor: buttonBgColor,borderTopRightRadius: `${buttonRadius}px`,borderBottomRightRadius: `${buttonRadius}px`,diff --git a/lib/mockup-canvas/glass-curve.ts b/lib/mockup-canvas/glass-curve.tsindex a13670f..99c12d4 100644--- a/lib/mockup-canvas/glass-curve.ts+++ b/lib/mockup-canvas/glass-curve.ts@@ -3,78 +3,77 @@ import type { MockupCanvasContext, MockupDrawResult } from "./types";import { drawRoundedRectPath, drawMockupShadow } from "./shared";export function drawGlassCurveMockup(context: MockupCanvasContext): MockupDrawResult {- const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;- const isDark = config.darkMode;-- const frameColor = isDark ? config.frameColor : "#ffffff";- const headerOpacity = config.headerOpacity ?? 10;- const headerScale = (config.headerScale || 100) / 100;+ const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;- const framePadding = 4 * headerScale;- const reflectionWidth = 16 * headerScale;- const notchTop = 16 * headerScale;- const notchWidth = 40 * headerScale;- const notchHeight = 4 * headerScale;- const contentPaddingTop = 32 * headerScale;+ const isDark = config.darkMode;+ const frameColor = isDark ? config.frameColor : "#ffffff";+ const headerOpacity = config.headerOpacity ?? 10;+ const headerScale = (config.headerScale || 100) / 100;- const screenBg = isDark ? "#0a0a0a" : "#ffffff";- const borderColor = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(255, 255, 255, 0.4)";- const reflectionColor = isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(255, 255, 255, 0.2)";- const notchBg = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.05)";+ const framePadding = 24 * headerScale;+ const reflectionWidth = 16 * headerScale;- const outerRadius = cornerRadius * 8;- drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);+ const notchTop = 28 * headerScale;+ const notchWidth = 120 * headerScale;+ const notchHeight = 12 * headerScale;+ const contentPaddingTop = 90 * headerScale;- ctx.save();- drawRoundedRectPath(ctx, x, y, width, height, outerRadius);- ctx.fillStyle = hexToRgba(frameColor, headerOpacity);- ctx.fill();- ctx.strokeStyle = borderColor;- ctx.lineWidth = 6;- ctx.stroke();+ const screenBg = isDark ? "#0a0a0a" : "#ffffff";+ const borderColor = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(255, 255, 255, 0.4)";+ const reflectionColor = isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(255, 255, 255, 0.2)";+ const notchBg = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.05)";- ctx.clip();+ const outerRadius = cornerRadius * 8;- const leftGradient = ctx.createLinearGradient(x, y, x + reflectionWidth, y);- leftGradient.addColorStop(0, reflectionColor);- leftGradient.addColorStop(1, "rgba(255, 255, 255, 0)");- ctx.fillStyle = leftGradient;- ctx.fillRect(x, y, reflectionWidth, height);+ drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);- const rightGradient = ctx.createLinearGradient(x + width, y, x + width - reflectionWidth, y);- rightGradient.addColorStop(0, reflectionColor);- rightGradient.addColorStop(1, "rgba(255, 255, 255, 0)");- ctx.fillStyle = rightGradient;- ctx.fillRect(x + width - reflectionWidth, y, reflectionWidth, height);-- ctx.restore();+ ctx.save();+ drawRoundedRectPath(ctx, x, y, width, height, outerRadius);+ ctx.fillStyle = hexToRgba(frameColor, headerOpacity);+ ctx.fill();+ ctx.strokeStyle = borderColor;+ ctx.lineWidth = 6;+ ctx.stroke();- const screenX = x + framePadding;- const screenY = y + framePadding;- const screenWidth = width - framePadding * 2;- const screenHeight = height - framePadding * 2;-- const innerRadius = Math.max(0, outerRadius - framePadding);+ ctx.clip();+ const leftGradient = ctx.createLinearGradient(x, y, x + reflectionWidth, y);+ leftGradient.addColorStop(0, reflectionColor);+ leftGradient.addColorStop(1, "rgba(255, 255, 255, 0)");+ ctx.fillStyle = leftGradient;+ ctx.fillRect(x, y, reflectionWidth, height);- ctx.save();- drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, innerRadius);- ctx.fillStyle = screenBg;- ctx.fill();- ctx.restore();+ const rightGradient = ctx.createLinearGradient(x + width, y, x + width - reflectionWidth, y);+ rightGradient.addColorStop(0, reflectionColor);+ rightGradient.addColorStop(1, "rgba(255, 255, 255, 0)");+ ctx.fillStyle = rightGradient;+ ctx.fillRect(x + width - reflectionWidth, y, reflectionWidth, height);+ ctx.restore();- const notchX = screenX + (screenWidth - notchWidth) / 2;- const notchY = screenY + notchTop;+ const screenX = x + framePadding;+ const screenY = y + framePadding;+ const screenWidth = width - framePadding * 2;+ const screenHeight = height - framePadding * 2;+ const innerRadius = Math.max(0, outerRadius - framePadding);- ctx.save();- drawRoundedRectPath(ctx, notchX, notchY, notchWidth, notchHeight, notchHeight / 2);- ctx.fillStyle = notchBg;- ctx.fill();- ctx.restore();+ ctx.save();+ drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, innerRadius);+ ctx.fillStyle = screenBg;+ ctx.fill();+ ctx.restore();- return {- contentX: screenX,- contentY: screenY + contentPaddingTop,- contentWidth: screenWidth,- contentHeight: screenHeight - contentPaddingTop,- };+ const notchX = screenX + (screenWidth - notchWidth) / 2;+ const notchY = screenY + notchTop;++ ctx.save();+ drawRoundedRectPath(ctx, notchX, notchY, notchWidth, notchHeight, notchHeight / 2);+ ctx.fillStyle = notchBg;+ ctx.fill();+ ctx.restore();++ return {+ contentX: screenX,+ contentY: screenY + contentPaddingTop,+ contentWidth: screenWidth,+ contentHeight: screenHeight - contentPaddingTop,+ };}\ No newline at end of filediff --git a/lib/mockup-canvas/glass-full.ts b/lib/mockup-canvas/glass-full.tsindex 0cb855e..4c81698 100644--- a/lib/mockup-canvas/glass-full.ts+++ b/lib/mockup-canvas/glass-full.ts@@ -1,174 +1,237 @@import { hexToRgba } from "@/lib/utils";-import {- drawWifiIcon,- drawSignalBars,- drawBattery,-} from "@/lib/canvas-icons";+import { drawWifiIcon } from "@/lib/canvas-icons";import type { MockupCanvasContext, MockupDrawResult } from "./types";import { drawRoundedRectPath, drawMockupShadow } from "./shared";export function drawGlassFullMockup(context: MockupCanvasContext): MockupDrawResult {- const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;- const isDark = config.darkMode;-- const frameColor = isDark ? config.frameColor : "#ffffff";- const headerOpacity = config.headerOpacity ?? 10;- const headerScale = (config.headerScale || 100) / 100;-- const framePadding = 12 * headerScale;- const buttonWidth = 4 * headerScale;-- const notchTop = 8 * headerScale;- const notchWidth = 104 * headerScale;- const notchHeight = 24 * headerScale;- const dotSize = 8 * headerScale;-- const statusBarHeight = 32 * headerScale;- const timeFontSize = 10 * headerScale;-- const iconStatusSize = 12 * headerScale;- const batteryWidth = 18 * headerScale;- const batteryHeight = 10 * headerScale;-- const contentPaddingTop = 40 * headerScale;-- const homeIndicatorWidth = 128 * headerScale;- const homeIndicatorHeight = 4 * headerScale;- const homeIndicatorBottom = 8 * headerScale;-- const screenBg = isDark ? "#0a0a0a" : "#f9f9f9";- const frameBorderColor = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(255, 255, 255, 0.3)";- const screenBorderColor = isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)";- const notchBg = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.05)";- const statusBarText = isDark ? "rgba(255, 255, 255, 0.8)" : "rgba(0, 0, 0, 0.6)";- const homeIndicatorBg = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.1)";- const buttonBg = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(255, 255, 255, 0.4)";-- const outerRadius = cornerRadius * 8;- drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);-- ctx.save();- const drawButton = (percentY: number, percentH: number, isLeft: boolean) => {- const btnW = buttonWidth;- const btnR = 2 * headerScale;- const overlap = 2; // Overlap the frame to avoid visible lines- const btnY = y + (height * percentY);- const btnH = height * percentH;-- ctx.beginPath();- if (isLeft) {- const btnX = x - btnW;- ctx.moveTo(btnX + btnW + overlap, btnY);- ctx.lineTo(btnX + btnR, btnY);- ctx.arcTo(btnX, btnY, btnX, btnY + btnR, btnR);- ctx.lineTo(btnX, btnY + btnH - btnR);- ctx.arcTo(btnX, btnY + btnH, btnX + btnR, btnY + btnH, btnR);- ctx.lineTo(btnX + btnW + overlap, btnY + btnH);- } else {- const btnX = x + width;- ctx.moveTo(btnX - overlap, btnY);- ctx.lineTo(btnX + btnW - btnR, btnY);- ctx.arcTo(btnX + btnW, btnY, btnX + btnW, btnY + btnR, btnR);- ctx.lineTo(btnX + btnW, btnY + btnH - btnR);- ctx.arcTo(btnX + btnW, btnY + btnH, btnX + btnW - btnR, btnY + btnH, btnR);- ctx.lineTo(btnX - overlap, btnY + btnH);- }- ctx.fillStyle = buttonBg;- ctx.fill();- ctx.strokeStyle = frameBorderColor;- ctx.lineWidth = 1;- ctx.stroke();- };-- drawButton(0.15, 0.05, true); // Mute- drawButton(0.25, 0.12, true); // Volume Up- drawButton(0.28, 0.14, false); // Power- ctx.restore();+ const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;++ const isDark = config.darkMode;+ const frameColor = isDark ? config.frameColor : "#ffffff";+ const headerOpacity = config.headerOpacity ?? 10;+ const headerScale = (config.headerScale || 100) / 100;++ const framePadding = 12 * headerScale;+ const buttonWidth = 14 * headerScale;++ const notchTop = 22 * headerScale;+ const notchWidth = 180 * headerScale;+ const notchHeight = 52 * headerScale;+ const notchPaddingX = 18 * headerScale;+ const dotSize = 16 * headerScale;++ const statusBarHeight = 85 * headerScale;+ const statusBarPaddingX = 50 * headerScale;+ const timeFontSize = 28 * headerScale;+ const signalBarWidth = 5 * headerScale;+ const iconsGap = 16 * headerScale;+ const wifiSize = 32 * headerScale;+ const batteryWidth = 46 * headerScale;+ const batteryHeight = 24 * headerScale;++ const contentPaddingTop = 115 * headerScale;++ const homeIndicatorWidth = 160 * headerScale;+ const homeIndicatorHeight = 6 * headerScale;+ const homeIndicatorBottom = 12 * headerScale;++ const screenBg = isDark ? "#0a0a0a" : "#f9f9f9";+ const frameBorderColor = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(255, 255, 255, 0.3)";+ const screenBorderColor = isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)";+ const notchBg = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.05)";+ const statusBarText = isDark ? "rgba(255, 255, 255, 0.8)" : "rgba(0, 0, 0, 0.6)";+ const statusBarTextDim = isDark ? "rgba(255, 255, 255, 0.4)" : "rgba(0, 0, 0, 0.2)";+ const homeIndicatorBg = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.1)";++ const buttonBg = isDark ? "rgba(255, 255, 255, 0.25)" : "rgba(0, 0, 0, 0.15)";+ const buttonBorderColor = isDark ? "rgba(255, 255, 255, 0.4)" : "rgba(0, 0, 0, 0.25)";+ const buttonShadowColor = isDark ? "rgba(0, 0, 0, 0.5)" : "rgba(0, 0, 0, 0.2)";++ const outerRadius = cornerRadius * 8;++ drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);++ ctx.save();+ const drawButton = (percentY: number, percentH: number, isLeft: boolean) => {+ const btnW = buttonWidth;+ const btnR = 4 * headerScale;+ const overlap = 2;++ const btnY = y + (height * percentY);+ const btnH = height * percentH;+ ctx.beginPath();+ if (isLeft) {+ const btnX = x - btnW;+ ctx.moveTo(btnX + btnW + overlap, btnY);+ ctx.lineTo(btnX + btnR, btnY);+ ctx.arcTo(btnX, btnY, btnX, btnY + btnR, btnR);+ ctx.lineTo(btnX, btnY + btnH - btnR);+ ctx.arcTo(btnX, btnY + btnH, btnX + btnR, btnY + btnH, btnR);+ ctx.lineTo(btnX + btnW + overlap, btnY + btnH);+ } else {+ const btnX = x + width;+ ctx.moveTo(btnX - overlap, btnY);+ ctx.lineTo(btnX + btnW - btnR, btnY);+ ctx.arcTo(btnX + btnW, btnY, btnX + btnW, btnY + btnR, btnR);+ ctx.lineTo(btnX + btnW, btnY + btnH - btnR);+ ctx.arcTo(btnX + btnW, btnY + btnH, btnX + btnW - btnR, btnY + btnH, btnR);+ ctx.lineTo(btnX - overlap, btnY + btnH);+ }++ ctx.fillStyle = buttonBg;ctx.save();- drawRoundedRectPath(ctx, x, y, width, height, outerRadius);- ctx.fillStyle = hexToRgba(frameColor, headerOpacity);+ ctx.shadowColor = buttonShadowColor;+ ctx.shadowBlur = 4;+ ctx.shadowOffsetY = 2;ctx.fill();- ctx.strokeStyle = frameBorderColor;- ctx.lineWidth = 1;- ctx.stroke();ctx.restore();- const screenX = x + framePadding;- const screenY = y + framePadding;- const screenWidth = width - framePadding * 2;- const screenHeight = height - framePadding * 2;- const innerRadius = Math.max(0, outerRadius - framePadding);-- ctx.save();- drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, innerRadius);- ctx.fillStyle = screenBg;- ctx.fill();- ctx.strokeStyle = screenBorderColor;+ ctx.strokeStyle = buttonBorderColor;ctx.lineWidth = 1;ctx.stroke();- ctx.restore();-- const dynamicIslandX = screenX + (screenWidth - notchWidth) / 2;- const dynamicIslandY = screenY + notchTop;-- ctx.save();- drawRoundedRectPath(ctx, dynamicIslandX, dynamicIslandY, notchWidth, notchHeight, notchHeight / 2);- ctx.fillStyle = notchBg;- ctx.fill();-- const dotCenterY = dynamicIslandY + notchHeight / 2;- ctx.beginPath();- ctx.arc(dynamicIslandX + notchHeight, dotCenterY, dotSize / 2, 0, Math.PI * 2);- ctx.fillStyle = "#737373"; // neutral-500- ctx.fill();- ctx.lineWidth = 1;- ctx.strokeStyle = "#404040"; // neutral-700- ctx.stroke();-- ctx.beginPath();- ctx.arc(dynamicIslandX + notchWidth - notchHeight, dotCenterY, dotSize / 2, 0, Math.PI * 2);- ctx.fillStyle = "#6366f1"; // indigo-500- ctx.fill();- ctx.restore();-- const timeX = screenX + 28 * headerScale;- const timeY = screenY + statusBarHeight / 2 + 2;-- ctx.save();- ctx.font = `bold ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;- ctx.fillStyle = statusBarText;- ctx.textBaseline = "middle";- ctx.fillText("9:41", timeX, timeY);- ctx.restore();-- const indicatorsY = timeY - 5 * headerScale;+ };++ drawButton(0.13, 0.09, true);+ drawButton(0.23, 0.18, true);+ drawButton(0.25, 0.20, false);+ ctx.restore();++ ctx.save();+ drawRoundedRectPath(ctx, x, y, width, height, outerRadius);+ ctx.fillStyle = hexToRgba(frameColor, headerOpacity);+ ctx.fill();+ ctx.strokeStyle = frameBorderColor;+ ctx.lineWidth = 1;+ ctx.stroke();+ ctx.restore();++ const screenX = x + framePadding;+ const screenY = y + framePadding;+ const screenWidth = width - framePadding * 2;+ const screenHeight = height - framePadding * 2;+ const innerRadius = Math.max(0, outerRadius - framePadding);++ ctx.save();+ drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, innerRadius);+ ctx.fillStyle = screenBg;+ ctx.fill();+ ctx.strokeStyle = screenBorderColor;+ ctx.lineWidth = 1;+ ctx.stroke();+ ctx.restore();++ const dynamicIslandX = screenX + (screenWidth - notchWidth) / 2;+ const dynamicIslandY = screenY + notchTop;++ ctx.save();+ ctx.shadowColor = "rgba(0,0,0,0.05)";+ ctx.shadowBlur = 2;+ ctx.shadowOffsetY = 1;+ drawRoundedRectPath(ctx, dynamicIslandX, dynamicIslandY, notchWidth, notchHeight, notchHeight / 2);+ ctx.fillStyle = notchBg;+ ctx.fill();+ ctx.restore();++ const dotCenterY = dynamicIslandY + notchHeight / 2;++ ctx.beginPath();+ ctx.arc(dynamicIslandX + notchPaddingX + dotSize / 2, dotCenterY, dotSize / 2, 0, Math.PI * 2);+ ctx.fillStyle = "#737373";+ ctx.fill();+ ctx.lineWidth = 1;+ ctx.strokeStyle = "#404040";+ ctx.stroke();++ ctx.beginPath();+ ctx.arc(dynamicIslandX + notchWidth - notchPaddingX - dotSize / 2, dotCenterY, dotSize / 2, 0, Math.PI * 2);+ ctx.fillStyle = "#6366f1";+ ctx.save();+ ctx.shadowColor = "#6366f1";+ ctx.shadowBlur = 2;+ ctx.fill();+ ctx.restore();++ const statusBarCenterY = screenY + statusBarHeight / 2;+ const rightEdgeX = screenX + screenWidth - statusBarPaddingX;++ const timeX = screenX + statusBarPaddingX;+ ctx.save();+ ctx.font = `bold ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;+ ctx.fillStyle = statusBarText;+ ctx.textBaseline = "middle";+ ctx.fillText("9:41", timeX, statusBarCenterY + 1);+ ctx.restore();++ const batteryX = rightEdgeX - batteryWidth;+ const batteryY = statusBarCenterY - batteryHeight / 2;++ ctx.save();+ drawRoundedRectPath(ctx, batteryX, batteryY, batteryWidth, batteryHeight, 4);+ ctx.strokeStyle = statusBarTextDim;+ ctx.lineWidth = 1;+ ctx.stroke();++ ctx.fillStyle = statusBarText;+ const batPadding = 3;+ const batInnerW = (batteryWidth - batPadding * 2) * 0.7;+ const batInnerH = batteryHeight - batPadding * 2;+ drawRoundedRectPath(ctx, batteryX + batPadding, batteryY + batPadding, batInnerW, batInnerH, 2);+ ctx.fill();++ ctx.fillStyle = statusBarTextDim;+ const nipW = 3;+ const nipH = batteryHeight * 0.4;+ const nipY = statusBarCenterY - nipH / 2;+ ctx.beginPath();+ if (ctx.roundRect) {+ ctx.roundRect(batteryX + batteryWidth + 0.5, nipY, nipW, nipH, [0, 2, 2, 0]);+ } else {+ ctx.fillRect(batteryX + batteryWidth + 0.5, nipY, nipW, nipH);+ }+ ctx.fill();+ ctx.restore();++ const wifiX = batteryX - iconsGap - wifiSize;+ const wifiY = statusBarCenterY - wifiSize / 2;+ drawWifiIcon(ctx, wifiX, wifiY, wifiSize, statusBarText);++ const signalGroupWidth = (signalBarWidth * 4) + 3;+ const signalX = wifiX - iconsGap - signalGroupWidth;+ const signalMaxH = batteryHeight * 0.8;+ const signalBaseY = statusBarCenterY + signalMaxH / 2;++ ctx.save();+ const barScales = [0.4, 0.6, 0.8, 1.0];+ barScales.forEach((scale, i) => {+ const bH = signalMaxH * scale;+ const bX = signalX + i * (signalBarWidth + 1);+ const bY = signalBaseY - bH;- const batteryX = screenX + screenWidth - 28 * headerScale - batteryWidth;- const batteryY = timeY - batteryHeight / 2;- drawBattery(ctx, batteryX, batteryY, batteryWidth, batteryHeight, statusBarText, 0.7);-- const wifiX = batteryX - iconStatusSize - 6 * headerScale;- const wifiY = indicatorsY;- drawWifiIcon(ctx, wifiX, wifiY, iconStatusSize, statusBarText);-- const signalX = wifiX - iconStatusSize - 6 * headerScale;- const signalY = indicatorsY;- drawSignalBars(ctx, signalX, signalY, iconStatusSize, statusBarText);-- const homeIndicatorX = screenX + (screenWidth - homeIndicatorWidth) / 2;- const homeIndicatorY = screenY + screenHeight - homeIndicatorBottom - homeIndicatorHeight;-- ctx.save();- drawRoundedRectPath(ctx, homeIndicatorX, homeIndicatorY, homeIndicatorWidth, homeIndicatorHeight, homeIndicatorHeight / 2);- ctx.fillStyle = homeIndicatorBg;+ ctx.fillStyle = i === 3 ? statusBarTextDim : statusBarText;+ ctx.beginPath();+ if (ctx.roundRect) {+ ctx.roundRect(bX, bY, signalBarWidth, bH, 0.5);+ } else {+ ctx.fillRect(bX, bY, signalBarWidth, bH);+ }ctx.fill();- ctx.restore();-- return {- contentX: screenX,- contentY: screenY + contentPaddingTop,- contentWidth: screenWidth,- contentHeight: screenHeight - contentPaddingTop,- };+ });+ ctx.restore();++ const homeIndicatorX = screenX + (screenWidth - homeIndicatorWidth) / 2;+ const homeIndicatorY = screenY + screenHeight - homeIndicatorBottom - homeIndicatorHeight;++ ctx.save();+ drawRoundedRectPath(ctx, homeIndicatorX, homeIndicatorY, homeIndicatorWidth, homeIndicatorHeight, homeIndicatorHeight / 2);+ ctx.fillStyle = homeIndicatorBg;+ ctx.fill();+ ctx.restore();++ return {+ contentX: screenX,+ contentY: screenY + contentPaddingTop,+ contentWidth: screenWidth,+ contentHeight: screenHeight - contentPaddingTop,+ };}\ No newline at end of filediff --git a/lib/mockup-canvas/hard-shell.ts b/lib/mockup-canvas/hard-shell.tsindex fb88c34..1e795d4 100644--- a/lib/mockup-canvas/hard-shell.ts+++ b/lib/mockup-canvas/hard-shell.ts@@ -2,219 +2,218 @@ import type { MockupCanvasContext, MockupDrawResult } from "./types";import { drawRoundedRectPath, drawMockupShadow } from "./shared";export function drawHardShellMockup(context: MockupCanvasContext): MockupDrawResult {- const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;- const isDark = config.darkMode;-- const frameColor = isDark ? (config.frameColor || "#27272a") : "#ffffff";- const headerScale = (config.headerScale || 100) / 100;-- const buttonWidth = 7 * headerScale;-- const outerPadding = 6 * headerScale;- const bezelPadding = 4 * headerScale;-- const cameraTop = 10 * headerScale;- const cameraSize = 14 * headerScale;- const cameraLensSize = 5 * headerScale;-- const statusBarHeight = 32 * headerScale;- const statusBarPaddingX = 16 * headerScale;- const timeFontSize = 12 * headerScale;- const networkFontSize = 10 * headerScale;-- const signalBarWidth = 3 * headerScale;- const batteryWidth = 22 * headerScale;- const batteryHeight = 11 * headerScale;-- const contentPaddingTop = 44 * headerScale;-- const homeIndicatorWidth = 112 * headerScale;- const homeIndicatorHeight = 6 * headerScale;- const homeIndicatorBottom = 8 * headerScale;-- const screenBg = isDark ? "#000000" : "#f8fafc";- const textColor = isDark ? "#ffffff" : "#000000";- const frameBorderColor = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.2)";- const buttonBgColor = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.15)";- const buttonBorderColor = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.3)";- const homeIndicatorBg = isDark ? "rgba(255, 255, 255, 0.3)" : "rgba(0, 0, 0, 0.2)";-- const outerRadius = cornerRadius * 4;-- drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);-- ctx.save();- const drawButton = (percentY: number, percentH: number, isLeft: boolean) => {- const btnW = buttonWidth;- const btnR = 2 * headerScale;- const overlap = 2;- const btnY = y + (height * percentY);- const btnH = height * percentH;-- ctx.beginPath();- if (isLeft) {- const btnX = x - btnW;- ctx.moveTo(btnX + btnW + overlap, btnY);- ctx.lineTo(btnX + btnR, btnY);- ctx.arcTo(btnX, btnY, btnX, btnY + btnR, btnR);- ctx.lineTo(btnX, btnY + btnH - btnR);- ctx.arcTo(btnX, btnY + btnH, btnX + btnR, btnY + btnH, btnR);- ctx.lineTo(btnX + btnW + overlap, btnY + btnH);- } else {- const btnX = x + width;- ctx.moveTo(btnX - overlap, btnY);- ctx.lineTo(btnX + btnW - btnR, btnY);- ctx.arcTo(btnX + btnW, btnY, btnX + btnW, btnY + btnR, btnR);- ctx.lineTo(btnX + btnW, btnY + btnH - btnR);- ctx.arcTo(btnX + btnW, btnY + btnH, btnX + btnW - btnR, btnY + btnH, btnR);- ctx.lineTo(btnX - overlap, btnY + btnH);- }- ctx.fillStyle = buttonBgColor;- ctx.fill();- ctx.strokeStyle = buttonBorderColor;- ctx.lineWidth = 1;- ctx.stroke();- };-- drawButton(0.18, 0.09, false); // Volume- drawButton(0.31, 0.05, false); // Power- ctx.restore();-- ctx.save();- drawRoundedRectPath(ctx, x, y, width, height, outerRadius);- ctx.fillStyle = frameColor;- ctx.fill();- ctx.strokeStyle = frameBorderColor;- ctx.lineWidth = 1;- ctx.stroke();- ctx.restore();+ const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;- const bezelX = x + outerPadding;- const bezelY = y + outerPadding;- const bezelWidth = width - (outerPadding * 2);- const bezelHeight = height - (outerPadding * 2);- const bezelRadius = cornerRadius * 4;+ const isDark = config.darkMode;+ const frameColor = isDark ? (config.frameColor || "#27272a") : "#ffffff";+ const headerScale = (config.headerScale || 100) / 100;- ctx.save();- drawRoundedRectPath(ctx, bezelX, bezelY, bezelWidth, bezelHeight, bezelRadius);- ctx.fillStyle = "#000000";- ctx.fill();- ctx.strokeStyle = "rgba(0,0,0,1)";- ctx.lineWidth = 2;- ctx.stroke();- ctx.restore();+ const buttonWidth = 20 * headerScale;+ const outerPadding = 8 * headerScale;+ const bezelPadding = 6 * headerScale;- const screenX = bezelX + bezelPadding;- const screenY = bezelY + bezelPadding;- const screenWidth = bezelWidth - (bezelPadding * 2);- const screenHeight = bezelHeight - (bezelPadding * 2);- const screenRadius = Math.max(0, outerRadius - bezelPadding);+ const cameraTop = 26 * headerScale;+ const cameraSize = 36 * headerScale;+ const cameraLensSize = 14 * headerScale;- ctx.save();- drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, screenRadius);- ctx.fillStyle = screenBg;- ctx.fill();- ctx.restore();+ const statusBarHeight = 105 * headerScale;+ const statusBarPaddingX = 48 * headerScale;+ const timeFontSize = 34 * headerScale;+ const networkFontSize = 26 * headerScale;+ const signalBarWidth = 7 * headerScale;+ const batteryWidth = 58 * headerScale;+ const batteryHeight = 28 * headerScale;- const camCenterX = screenX + screenWidth / 2;- const camCenterY = screenY + cameraTop + cameraSize / 2;+ const contentPaddingTop = 140 * headerScale;- ctx.save();- ctx.beginPath();- ctx.arc(camCenterX, camCenterY, cameraSize / 2, 0, Math.PI * 2);- ctx.fillStyle = "#000000";- ctx.fill();+ const homeIndicatorWidth = 160 * headerScale;+ const homeIndicatorHeight = 8 * headerScale;+ const homeIndicatorBottom = 12 * headerScale;- ctx.beginPath();- ctx.arc(camCenterX, camCenterY, cameraLensSize / 2, 0, Math.PI * 2);- ctx.fillStyle = "rgba(30, 58, 138, 0.6)"; // blue-900/60- ctx.fill();- ctx.restore();-- const timeX = screenX + statusBarPaddingX;- const timeY = screenY + statusBarHeight / 2;-- ctx.save();- ctx.font = `500 ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;- ctx.fillStyle = textColor;- ctx.textBaseline = "middle";- ctx.fillText("11:43", timeX, timeY + 1); // +1 for optical alignment- ctx.restore();-- const batPoleWidth = 2 * headerScale;- const batPoleHeight = 4 * headerScale;- const batX = screenX + screenWidth - statusBarPaddingX - batPoleWidth - batteryWidth;- const batY = timeY - batteryHeight / 2 + 1; // +1 optical alignment-- ctx.save();- ctx.strokeStyle = textColor;- ctx.lineWidth = 1 * headerScale;- ctx.beginPath();- drawRoundedRectPath(ctx, batX, batY, batteryWidth, batteryHeight, 3 * headerScale);- ctx.stroke();+ const screenBg = isDark ? "#000000" : "#f8fafc";+ const textColor = isDark ? "#ffffff" : "#000000";+ const frameBorderColor = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.2)";+ const buttonBgColor = isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.15)";+ const buttonBorderColor = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.3)";+ const homeIndicatorBg = isDark ? "rgba(255, 255, 255, 0.3)" : "rgba(0, 0, 0, 0.2)";- const batPad = 1.5 * headerScale;- const fillWidth = (batteryWidth - batPad * 2) * 0.8; // 80% full- const fillHeight = batteryHeight - batPad * 2;- ctx.fillStyle = textColor;- ctx.beginPath();- drawRoundedRectPath(ctx, batX + batPad, batY + batPad, fillWidth, fillHeight, 1 * headerScale);- ctx.fill();+ const outerRadius = cornerRadius * 4;++ drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);++ ctx.save();+ const drawButton = (percentY: number, percentH: number, isLeft: boolean) => {+ const btnW = buttonWidth;+ const btnR = 6 * headerScale;+ const overlap = 2;++ const btnY = y + (height * percentY);+ const btnH = height * percentH;ctx.beginPath();- const bumpY = batY + (batteryHeight - batPoleHeight) / 2;- ctx.moveTo(batX + batteryWidth, bumpY);- ctx.lineTo(batX + batteryWidth + batPoleWidth - 1, bumpY);- ctx.quadraticCurveTo(batX + batteryWidth + batPoleWidth, bumpY, batX + batteryWidth + batPoleWidth, bumpY + 1);- ctx.lineTo(batX + batteryWidth + batPoleWidth, bumpY + batPoleHeight - 1);- ctx.quadraticCurveTo(batX + batteryWidth + batPoleWidth, bumpY + batPoleHeight, batX + batteryWidth + batPoleWidth - 1, bumpY + batPoleHeight);- ctx.lineTo(batX + batteryWidth, bumpY + batPoleHeight);- ctx.globalAlpha = 0.9;- ctx.fill();- ctx.restore();-- const sigGap = 1 * headerScale;- const totalSigWidth = (signalBarWidth * 4) + (sigGap * 3);- const sigX = batX - 6 * headerScale - totalSigWidth;- const sigMaxHeight = 12 * headerScale;- const sigYBottom = batY + batteryHeight; // Bottom-aligned with the battery-- ctx.save();- ctx.fillStyle = textColor;- const sigPercents = [0.5, 0.65, 0.8, 1.0];- for (let i = 0; i < 4; i++) {- const h = sigMaxHeight * sigPercents[i];- const barX = sigX + i * (signalBarWidth + sigGap);- const barY = sigYBottom - h;- drawRoundedRectPath(ctx, barX, barY, signalBarWidth, h, 1 * headerScale);- ctx.fill();+ if (isLeft) {+ const btnX = x - btnW;+ ctx.moveTo(btnX + btnW + overlap, btnY);+ ctx.lineTo(btnX + btnR, btnY);+ ctx.arcTo(btnX, btnY, btnX, btnY + btnR, btnR);+ ctx.lineTo(btnX, btnY + btnH - btnR);+ ctx.arcTo(btnX, btnY + btnH, btnX + btnR, btnY + btnH, btnR);+ ctx.lineTo(btnX + btnW + overlap, btnY + btnH);+ } else {+ const btnX = x + width;+ ctx.moveTo(btnX - overlap, btnY);+ ctx.lineTo(btnX + btnW - btnR, btnY);+ ctx.arcTo(btnX + btnW, btnY, btnX + btnW, btnY + btnR, btnR);+ ctx.lineTo(btnX + btnW, btnY + btnH - btnR);+ ctx.arcTo(btnX + btnW, btnY + btnH, btnX + btnW - btnR, btnY + btnH, btnR);+ ctx.lineTo(btnX - overlap, btnY + btnH);}- ctx.restore();-- const text5G = "5G";- ctx.save();- ctx.font = `bold ${networkFontSize}px "Inter", sans-serif`;- ctx.fillStyle = textColor;- ctx.textBaseline = "middle";- const textMetrics = ctx.measureText(text5G);- const text5GX = sigX - 6 * headerScale - textMetrics.width;- ctx.fillText(text5G, text5GX, timeY + 1);- ctx.restore();-- const homeIndicatorX = screenX + (screenWidth - homeIndicatorWidth) / 2;- const homeIndicatorY = screenY + screenHeight - homeIndicatorBottom - homeIndicatorHeight;-- ctx.save();- drawRoundedRectPath(ctx, homeIndicatorX, homeIndicatorY, homeIndicatorWidth, homeIndicatorHeight, homeIndicatorHeight / 2);- ctx.fillStyle = homeIndicatorBg;++ ctx.fillStyle = buttonBgColor;+ ctx.fill();+ ctx.strokeStyle = buttonBorderColor;+ ctx.lineWidth = 2;+ ctx.stroke();+ };++ drawButton(0.15, 0.15, false);+ drawButton(0.32, 0.09, false);+ ctx.restore();++ ctx.save();+ drawRoundedRectPath(ctx, x, y, width, height, outerRadius);+ ctx.fillStyle = frameColor;+ ctx.fill();+ ctx.strokeStyle = frameBorderColor;+ ctx.lineWidth = 1;+ ctx.stroke();+ ctx.restore();++ const bezelX = x + outerPadding;+ const bezelY = y + outerPadding;+ const bezelWidth = width - (outerPadding * 2);+ const bezelHeight = height - (outerPadding * 2);+ const bezelRadius = cornerRadius * 4;++ ctx.save();+ drawRoundedRectPath(ctx, bezelX, bezelY, bezelWidth, bezelHeight, bezelRadius);+ ctx.fillStyle = "#000000";+ ctx.fill();+ ctx.strokeStyle = "rgba(0,0,0,1)";+ ctx.lineWidth = 2;+ ctx.stroke();+ ctx.restore();++ const screenX = bezelX + bezelPadding;+ const screenY = bezelY + bezelPadding;+ const screenWidth = bezelWidth - (bezelPadding * 2);+ const screenHeight = bezelHeight - (bezelPadding * 2);+ const screenRadius = Math.max(0, outerRadius - bezelPadding);++ ctx.save();+ drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, screenRadius);+ ctx.fillStyle = screenBg;+ ctx.fill();+ ctx.restore();++ const camCenterX = screenX + screenWidth / 2;+ const camCenterY = screenY + cameraTop + cameraSize / 2;++ ctx.save();+ ctx.beginPath();+ ctx.arc(camCenterX, camCenterY, cameraSize / 2, 0, Math.PI * 2);+ ctx.fillStyle = "#000000";+ ctx.fill();+ ctx.beginPath();+ ctx.arc(camCenterX, camCenterY, cameraLensSize / 2, 0, Math.PI * 2);+ ctx.fillStyle = "rgba(30, 58, 138, 0.6)";+ ctx.fill();+ ctx.restore();++ const timeX = screenX + statusBarPaddingX;+ const timeY = screenY + statusBarHeight / 2;++ ctx.save();+ ctx.font = `500 ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;+ ctx.fillStyle = textColor;+ ctx.textBaseline = "middle";+ ctx.fillText("11:43", timeX, timeY + 1);+ ctx.restore();++ const batPoleWidth = 5 * headerScale;+ const batPoleHeight = 10 * headerScale;+ const batX = screenX + screenWidth - statusBarPaddingX - batPoleWidth - batteryWidth;+ const batY = timeY - batteryHeight / 2 + 1;++ ctx.save();+ ctx.strokeStyle = textColor;+ ctx.lineWidth = 2 * headerScale;+ ctx.beginPath();+ drawRoundedRectPath(ctx, batX, batY, batteryWidth, batteryHeight, 6 * headerScale);+ ctx.stroke();++ const batPad = 4 * headerScale;+ const fillWidth = (batteryWidth - batPad * 2) * 0.8;+ const fillHeight = batteryHeight - batPad * 2;+ ctx.fillStyle = textColor;+ ctx.beginPath();+ drawRoundedRectPath(ctx, batX + batPad, batY + batPad, fillWidth, fillHeight, 2.5 * headerScale);+ ctx.fill();++ ctx.beginPath();+ const bumpY = batY + (batteryHeight - batPoleHeight) / 2;+ ctx.moveTo(batX + batteryWidth, bumpY);+ ctx.lineTo(batX + batteryWidth + batPoleWidth - 1, bumpY);+ ctx.quadraticCurveTo(batX + batteryWidth + batPoleWidth, bumpY, batX + batteryWidth + batPoleWidth, bumpY + 1);+ ctx.lineTo(batX + batteryWidth + batPoleWidth, bumpY + batPoleHeight - 1);+ ctx.quadraticCurveTo(batX + batteryWidth + batPoleWidth, bumpY + batPoleHeight, batX + batteryWidth + batPoleWidth - 1, bumpY + batPoleHeight);+ ctx.lineTo(batX + batteryWidth, bumpY + batPoleHeight);+ ctx.globalAlpha = 0.9;+ ctx.fill();+ ctx.restore();++ const sigGap = 2.5 * headerScale;+ const totalSigWidth = (signalBarWidth * 4) + (sigGap * 3);+ const sigX = batX - 16 * headerScale - totalSigWidth;+ const sigMaxHeight = 32 * headerScale;+ const sigYBottom = batY + batteryHeight;++ ctx.save();+ ctx.fillStyle = textColor;+ const sigPercents = [0.5, 0.65, 0.8, 1.0];+ for (let i = 0; i < 4; i++) {+ const h = sigMaxHeight * sigPercents[i];+ const barX = sigX + i * (signalBarWidth + sigGap);+ const barY = sigYBottom - h;+ drawRoundedRectPath(ctx, barX, barY, signalBarWidth, h, 2 * headerScale);ctx.fill();- ctx.restore();-- return {- contentX: screenX,- contentY: screenY + contentPaddingTop,- contentWidth: screenWidth,- contentHeight: screenHeight - contentPaddingTop,- };+ }+ ctx.restore();++ const text5G = "5G";+ ctx.save();+ ctx.font = `bold ${networkFontSize}px "Inter", sans-serif`;+ ctx.fillStyle = textColor;+ ctx.textBaseline = "middle";+ const textMetrics = ctx.measureText(text5G);+ const text5GX = sigX - 16 * headerScale - textMetrics.width;+ ctx.fillText(text5G, text5GX, timeY + 1);+ ctx.restore();++ const homeIndicatorX = screenX + (screenWidth - homeIndicatorWidth) / 2;+ const homeIndicatorY = screenY + screenHeight - homeIndicatorBottom - homeIndicatorHeight;++ ctx.save();+ drawRoundedRectPath(ctx, homeIndicatorX, homeIndicatorY, homeIndicatorWidth, homeIndicatorHeight, homeIndicatorHeight / 2);+ ctx.fillStyle = homeIndicatorBg;+ ctx.fill();+ ctx.restore();++ return {+ contentX: screenX,+ contentY: screenY + contentPaddingTop,+ contentWidth: screenWidth,+ contentHeight: screenHeight - contentPaddingTop,+ };}\ No newline at end of filediff --git a/lib/mockup-canvas/iphone-slim.ts b/lib/mockup-canvas/iphone-slim.tsindex bd34ad5..2781f91 100644--- a/lib/mockup-canvas/iphone-slim.ts+++ b/lib/mockup-canvas/iphone-slim.ts@@ -1,148 +1,148 @@import { hexToRgba } from "@/lib/utils";-import {- drawWifiIcon,- drawSignalBars,- drawBattery,-} from "@/lib/canvas-icons";+import { drawWifiIcon, drawSignalBars, drawBattery } from "@/lib/canvas-icons";import type { MockupCanvasContext, MockupDrawResult } from "./types";import { drawRoundedRectPath, drawMockupShadow } from "./shared";export function drawIPhoneSlimMockup(context: MockupCanvasContext): MockupDrawResult {- const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;- const isDark = config.darkMode;-- const frameColor = isDark ? config.frameColor : "#e5e5e5";- const headerOpacity = config.headerOpacity ?? 100;-- const headerScale = (config.headerScale || 100) / 100;-- const framePadding = 6 * headerScale;- const statusBarHeight = 28 * headerScale;- const dynamicIslandHeight = 18 * headerScale;- const dynamicIslandTop = 6 * headerScale;- const homeIndicatorHeight = 3 * headerScale;- const homeIndicatorBottom = 6 * headerScale;-- const borderColor = isDark ? "#404040" : "#525252";- const statusBarText = isDark ? "#ffffff" : "#000000";-- const outerRadius = cornerRadius * 8;- drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);-- ctx.save();- const drawButton = (percentY: number, percentH: number, isLeft: boolean) => {- const btnWidth = 4; // Button width (similar to w-1)- const btnRadius = 2; // Corner radius- const overlap = 2; // Pixels that overlap the frame to hide the joint- const btnY = y + (height * percentY);- const btnH = height * percentH;-- ctx.beginPath();- if (isLeft) {- const btnX = x - btnWidth;- ctx.moveTo(btnX + btnWidth + overlap, btnY);- ctx.lineTo(btnX + btnRadius, btnY);- ctx.arcTo(btnX, btnY, btnX, btnY + btnRadius, btnRadius);- ctx.lineTo(btnX, btnY + btnH - btnRadius);- ctx.arcTo(btnX, btnY + btnH, btnX + btnRadius, btnY + btnH, btnRadius);- ctx.lineTo(btnX + btnWidth + overlap, btnY + btnH);- } else {- const btnX = x + width;- ctx.moveTo(btnX - overlap, btnY);- ctx.lineTo(btnX + btnWidth - btnRadius, btnY);- ctx.arcTo(btnX + btnWidth, btnY, btnX + btnWidth, btnY + btnRadius, btnRadius);- ctx.lineTo(btnX + btnWidth, btnY + btnH - btnRadius);- ctx.arcTo(btnX + btnWidth, btnY + btnH, btnX + btnWidth - btnRadius, btnY + btnH, btnRadius);- ctx.lineTo(btnX - overlap, btnY + btnH);- }- ctx.fillStyle = hexToRgba(frameColor, headerOpacity);- ctx.fill();- ctx.strokeStyle = borderColor;- ctx.lineWidth = 1;- ctx.stroke();- };-- drawButton(0.15, 0.06, true);- drawButton(0.24, 0.12, true);- drawButton(0.28, 0.14, false);- ctx.restore();-- ctx.save();- drawRoundedRectPath(ctx, x, y, width, height, outerRadius);+ const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;++ const isDark = config.darkMode;+ const frameColor = isDark ? config.frameColor : "#e5e5e5";+ const headerOpacity = config.headerOpacity ?? 100;+ const headerScale = (config.headerScale || 100) / 100;++ const framePadding = 6 * headerScale;+ const borderColor = isDark ? "#404040" : "#525252";+ const statusBarText = isDark ? "#ffffff" : "#000000";+ const outerRadius = cornerRadius * 8;++ const statusBarHeight = 120 * headerScale;+ const dynamicIslandHeight = 44 * headerScale;+ const dynamicIslandTop = 16 * headerScale;++ const statusBarPaddingX = 60 * headerScale;++ const timeFontSize = 38 * headerScale;+ const iconStatusSize = 34 * headerScale;+ const batteryWidth = 62 * headerScale;+ const batteryHeight = 28 * headerScale;++ const buttonWidth = 20 * headerScale;+ const buttonRadius = 6 * headerScale;++ const homeIndicatorHeight = 5 * headerScale;+ const homeIndicatorBottom = 10 * headerScale;++ drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);++ ctx.save();+ const drawButton = (percentY: number, percentH: number, isLeft: boolean) => {+ const btnW = buttonWidth;+ const btnR = buttonRadius;+ const overlap = 2;+ const btnY = y + (height * percentY);+ const btnH = height * percentH;++ ctx.beginPath();+ if (isLeft) {+ const btnX = x - btnW;+ ctx.moveTo(btnX + btnW + overlap, btnY);+ ctx.lineTo(btnX + btnR, btnY);+ ctx.arcTo(btnX, btnY, btnX, btnY + btnR, btnR);+ ctx.lineTo(btnX, btnY + btnH - btnR);+ ctx.arcTo(btnX, btnY + btnH, btnX + btnR, btnY + btnH, btnR);+ ctx.lineTo(btnX + btnW + overlap, btnY + btnH);+ } else {+ const btnX = x + width;+ ctx.moveTo(btnX - overlap, btnY);+ ctx.lineTo(btnX + btnW - btnR, btnY);+ ctx.arcTo(btnX + btnW, btnY, btnX + btnW, btnY + btnR, btnR);+ ctx.lineTo(btnX + btnW, btnY + btnH - btnR);+ ctx.arcTo(btnX + btnW, btnY + btnH, btnX + btnW - btnR, btnY + btnH, btnR);+ ctx.lineTo(btnX - overlap, btnY + btnH);+ }ctx.fillStyle = hexToRgba(frameColor, headerOpacity);ctx.fill();ctx.strokeStyle = borderColor;- ctx.lineWidth = 1;+ ctx.lineWidth = 2;ctx.stroke();- ctx.restore();-- const screenX = x + framePadding;- const screenY = y + framePadding;- const screenWidth = width - framePadding * 2;- const screenHeight = height - framePadding * 2;- const innerRadius = Math.max(0, outerRadius - framePadding);-- ctx.save();- drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, innerRadius);- ctx.fillStyle = "#000000";- ctx.fill();- ctx.strokeStyle = "#000000";- ctx.lineWidth = 1;- ctx.stroke();- ctx.restore();-- const dynamicIslandWidth = screenWidth * 0.28;- const dynamicIslandX = screenX + (screenWidth - dynamicIslandWidth) / 2;- const dynamicIslandY = screenY + dynamicIslandTop;-- ctx.save();- drawRoundedRectPath(ctx, dynamicIslandX, dynamicIslandY, dynamicIslandWidth, dynamicIslandHeight, dynamicIslandHeight / 2);- ctx.fillStyle = "#000000";- ctx.fill();- ctx.restore();-- const timeFontSize = 10 * headerScale;- const timeX = screenX + 24 * headerScale;- const timeY = screenY + statusBarHeight / 2 + 2;-- ctx.save();- ctx.font = `bold ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;- ctx.fillStyle = statusBarText;- ctx.textBaseline = "middle";- ctx.fillText("9:41", timeX, timeY);- ctx.restore();-- const indicatorsY = timeY - 5 * headerScale;- const iconStatusSize = 12 * headerScale;- const batteryWidth = 20 * headerScale;- const batteryHeight = 10 * headerScale;-- const batteryX = screenX + screenWidth - 24 * headerScale - batteryWidth;- const batteryY = timeY - batteryHeight / 2;- drawBattery(ctx, batteryX, batteryY, batteryWidth, batteryHeight, statusBarText, 0.9);-- const wifiX = batteryX - iconStatusSize - 6 * headerScale;- const wifiY = indicatorsY;- drawWifiIcon(ctx, wifiX, wifiY, iconStatusSize, statusBarText);-- const signalX = wifiX - iconStatusSize - 4 * headerScale;- const signalY = indicatorsY;- drawSignalBars(ctx, signalX, signalY, iconStatusSize, statusBarText);-- const homeIndicatorWidth = screenWidth * 0.35;- const homeIndicatorX = screenX + (screenWidth - homeIndicatorWidth) / 2;- const homeIndicatorY = screenY + screenHeight - homeIndicatorBottom - homeIndicatorHeight;-- ctx.save();- drawRoundedRectPath(ctx, homeIndicatorX, homeIndicatorY, homeIndicatorWidth, homeIndicatorHeight, homeIndicatorHeight / 2);- ctx.fillStyle = `${statusBarText}15`;- ctx.fill();- ctx.restore();-- return {- contentX: screenX,- contentY: screenY + statusBarHeight,- contentWidth: screenWidth,- contentHeight: screenHeight - statusBarHeight - homeIndicatorBottom - homeIndicatorHeight,- };+ };++ drawButton(0.15, 0.06, true);+ drawButton(0.24, 0.12, true);+ drawButton(0.28, 0.14, false);+ ctx.restore();++ ctx.save();+ drawRoundedRectPath(ctx, x, y, width, height, outerRadius);+ ctx.fillStyle = hexToRgba(frameColor, headerOpacity);+ ctx.fill();+ ctx.strokeStyle = borderColor;+ ctx.lineWidth = 1;+ ctx.stroke();+ ctx.restore();++ const screenX = x + framePadding;+ const screenY = y + framePadding;+ const screenWidth = width - framePadding * 2;+ const screenHeight = height - framePadding * 2;+ const innerRadius = Math.max(0, outerRadius - framePadding);++ ctx.save();+ drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, innerRadius);+ ctx.fillStyle = "#000000";+ ctx.fill();+ ctx.strokeStyle = "#000000";+ ctx.lineWidth = 1;+ ctx.stroke();+ ctx.restore();++ const dynamicIslandWidth = screenWidth * 0.32;+ const dynamicIslandX = screenX + (screenWidth - dynamicIslandWidth) / 2;+ const dynamicIslandY = screenY + dynamicIslandTop;++ ctx.save();+ drawRoundedRectPath(ctx, dynamicIslandX, dynamicIslandY, dynamicIslandWidth, dynamicIslandHeight, dynamicIslandHeight / 2);+ ctx.fillStyle = "#000000";+ ctx.fill();+ ctx.restore();++ const timeX = screenX + statusBarPaddingX;+ const timeY = screenY + (statusBarHeight / 2) - (6 * headerScale);++ ctx.save();+ ctx.font = `bold ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;+ ctx.fillStyle = statusBarText;+ ctx.textBaseline = "middle";+ ctx.fillText("9:41", timeX, timeY);+ ctx.restore();++ const batteryX = screenX + screenWidth - statusBarPaddingX - batteryWidth;+ const batteryY = timeY - (batteryHeight / 2);+ drawBattery(ctx, batteryX, batteryY, batteryWidth, batteryHeight, statusBarText, 0.9);++ const wifiX = batteryX - iconStatusSize - 12 * headerScale;+ const wifiY = timeY - (iconStatusSize / 2);+ drawWifiIcon(ctx, wifiX, wifiY, iconStatusSize, statusBarText);++ const signalX = wifiX - iconStatusSize - 8 * headerScale;+ const signalY = timeY - (iconStatusSize / 2);+ drawSignalBars(ctx, signalX, signalY, iconStatusSize, statusBarText);++ const homeIndicatorWidth = screenWidth * 0.35;+ const homeIndicatorX = screenX + (screenWidth - homeIndicatorWidth) / 2;+ const homeIndicatorY = screenY + screenHeight - homeIndicatorBottom - homeIndicatorHeight;++ ctx.save();+ drawRoundedRectPath(ctx, homeIndicatorX, homeIndicatorY, homeIndicatorWidth, homeIndicatorHeight, homeIndicatorHeight / 2);+ ctx.fillStyle = `${statusBarText}15`;+ ctx.fill();+ ctx.restore();++ return {+ contentX: screenX,+ contentY: screenY + statusBarHeight,+ contentWidth: screenWidth,+ contentHeight: screenHeight - statusBarHeight - homeIndicatorBottom - homeIndicatorHeight,+ };}\ No newline at end of filediff --git a/lib/mockup-canvas/s24-ultra.ts b/lib/mockup-canvas/s24-ultra.tsindex 2095ca4..608d4ec 100644--- a/lib/mockup-canvas/s24-ultra.ts+++ b/lib/mockup-canvas/s24-ultra.ts@@ -2,195 +2,192 @@ import type { MockupCanvasContext, MockupDrawResult } from "./types";import { drawRoundedRectPath, drawMockupShadow } from "./shared";export function drawS24UltraMockup(context: MockupCanvasContext): MockupDrawResult {- const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;- const isDark = config.darkMode;-- const headerScale = (config.headerScale || 100) / 100;- const frameColor = isDark ? (config.frameColor || "#171717") : "#e5e5e5";-- const framePadding = 10 * headerScale;- const buttonWidth = 4 * headerScale;- const buttonRadius = 2 * headerScale;-- const cameraTop = 12 * headerScale;- const cameraSize = 14 * headerScale;- const cameraLensSize = 4 * headerScale;-- const statusBarHeight = 40 * headerScale;- const statusBarPaddingX = 20 * headerScale;- const timeFontSize = 10 * headerScale;-- const navBarHeight = 40 * headerScale;- const navIconSize = 12 * headerScale;- const navGap = 48 * headerScale;-- const screenBg = isDark ? "#000000" : "#ffffff";- const frameBorderColor = isDark ? "#404040" : "#d4d4d4";- const screenBorderColor = isDark ? "rgba(255,255,255,0.1)" : "#000000";-- const buttonBgColor = isDark ? "#737373" : "#a3a3a3";- const buttonBorderColor = isDark ? "#262626" : "#737373";-- const textAndIconColor = isDark ? "rgba(255,255,255,0.9)" : "rgba(0,0,0,0.9)";- const navIconColor = isDark ? "rgba(255, 255, 255, 0.3)" : "rgba(0, 0, 0, 0.2)";- const iconBoxBg = isDark ? "#ffffff" : "#000000";- const iconBoxText = isDark ? "#000000" : "#ffffff";-- const outerRadius = cornerRadius * 1.2;-- drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);-- ctx.save();- const drawSideButton = (percentY: number, percentH: number) => {- const btnY = y + (height * percentY);- const btnH = height * percentH;- const btnX = x + width;-- ctx.beginPath();- ctx.moveTo(btnX, btnY);- ctx.lineTo(btnX + buttonWidth - buttonRadius, btnY);- ctx.arcTo(btnX + buttonWidth, btnY, btnX + buttonWidth, btnY + buttonRadius, buttonRadius);- ctx.lineTo(btnX + buttonWidth, btnY + btnH - buttonRadius);- ctx.arcTo(btnX + buttonWidth, btnY + btnH, btnX + buttonWidth - buttonRadius, btnY + btnH, buttonRadius);- ctx.lineTo(btnX, btnY + btnH);-- ctx.fillStyle = buttonBgColor;- ctx.fill();- ctx.strokeStyle = buttonBorderColor;- ctx.lineWidth = 1;- ctx.stroke();- };-- drawSideButton(0.20, 0.08); // Volume- drawSideButton(0.32, 0.12); // Power- ctx.restore();-- ctx.save();- drawRoundedRectPath(ctx, x, y, width, height, outerRadius);- ctx.fillStyle = frameColor;- ctx.fill();- ctx.strokeStyle = frameBorderColor;- ctx.lineWidth = 1;- ctx.stroke();- ctx.restore();+ const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;- const screenX = x + framePadding;- const screenY = y + framePadding;- const screenWidth = width - (framePadding * 2);- const screenHeight = height - (framePadding * 2);- const screenRadius = Math.max(0, outerRadius - framePadding);+ const isDark = config.darkMode;+ const headerScale = (config.headerScale || 100) / 100;- ctx.save();- drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, screenRadius);- ctx.fillStyle = screenBg;- ctx.fill();- ctx.strokeStyle = screenBorderColor;- ctx.lineWidth = 1;- ctx.stroke();- ctx.restore();+ const frameColor = isDark ? (config.frameColor || "#171717") : "#e5e5e5";+ const framePadding = 10 * headerScale;- const camCenterX = screenX + screenWidth / 2;- const camCenterY = screenY + cameraTop + cameraSize / 2;+ const buttonWidth = 18 * headerScale;+ const buttonRadius = 4 * headerScale;- ctx.save();- ctx.beginPath();- ctx.arc(camCenterX, camCenterY, cameraSize / 2, 0, Math.PI * 2);- ctx.fillStyle = "#000000";- ctx.fill();+ const cameraTop = 22 * headerScale;+ const cameraSize = 34 * headerScale;+ const cameraLensSize = 10 * headerScale;- ctx.beginPath();- ctx.arc(camCenterX, camCenterY, cameraLensSize / 2, 0, Math.PI * 2);- ctx.fillStyle = "rgba(99, 102, 241, 0.3)"; // blue-indigo lens reflection- ctx.fill();- ctx.restore();-- const statusYCenter = screenY + statusBarHeight / 2;-- ctx.save();- ctx.font = `500 ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;- ctx.fillStyle = textAndIconColor;- ctx.textBaseline = "middle";- ctx.fillText("12:30", screenX + statusBarPaddingX, statusYCenter + 1); // +1 optical correction- ctx.restore();-- let currentRightX = screenX + screenWidth - statusBarPaddingX;- const gap = 6 * headerScale;-- const batW = 20 * headerScale;- const batH = 10 * headerScale;- currentRightX -= batW;-- ctx.save();- ctx.strokeStyle = isDark ? "rgba(255,255,255,0.4)" : "rgba(0,0,0,0.4)";- ctx.lineWidth = 1 * headerScale;- drawRoundedRectPath(ctx, currentRightX, statusYCenter - batH / 2, batW, batH, 2 * headerScale);- ctx.stroke();-- ctx.fillStyle = iconBoxBg;- const pad = 1 * headerScale;- drawRoundedRectPath(ctx, currentRightX + pad, statusYCenter - batH / 2 + pad, batW - pad * 2, batH - pad * 2, 1 * headerScale);- ctx.fill();- ctx.restore();+ const statusBarHeight = 110 * headerScale;+ const statusBarPaddingX = 56 * headerScale;+ const timeFontSize = 32 * headerScale;- const box5GSize = 14 * headerScale;- currentRightX -= (box5GSize + gap);+ const batW = 54 * headerScale;+ const batH = 26 * headerScale;+ const box5GSize = 36 * headerScale;+ const text5GSize = 18 * headerScale;+ const wifiSize = 30 * headerScale;+ const gap = 16 * headerScale;- ctx.save();- ctx.fillStyle = iconBoxBg;- drawRoundedRectPath(ctx, currentRightX, statusYCenter - box5GSize / 2, box5GSize, box5GSize, 2 * headerScale);- ctx.fill();-- ctx.font = `bold ${7 * headerScale}px "Inter", sans-serif`;- ctx.fillStyle = iconBoxText;- ctx.textAlign = "center";- ctx.textBaseline = "middle";- ctx.fillText("5G", currentRightX + box5GSize / 2, statusYCenter + 0.5);- ctx.restore();-- const wifiSize = 12 * headerScale;- currentRightX -= (wifiSize + gap);-- ctx.save();- ctx.translate(currentRightX, statusYCenter - wifiSize / 2);- const wifiScale = wifiSize / 24; // Original Tailwind SVG is 24x24- ctx.scale(wifiScale, wifiScale);- const wifiPath = new Path2D("M12 21l-12-12c5.5-5.5 14.5-5.5 20 0l-8 12z");- ctx.fillStyle = textAndIconColor;- ctx.globalAlpha = 0.8;- ctx.fill(wifiPath);- ctx.restore();-- const navYCenter = screenY + screenHeight - navBarHeight / 2;- const navCenterX = screenX + screenWidth / 2;-- ctx.save();- ctx.strokeStyle = navIconColor;- ctx.lineWidth = 2 * headerScale;- ctx.lineCap = "round";- ctx.lineJoin = "round";-- const leftIconX = navCenterX - navGap;- ctx.strokeRect(leftIconX - navIconSize / 2, navYCenter - navIconSize / 2, navIconSize, navIconSize);-- ctx.beginPath();- ctx.arc(navCenterX, navYCenter, navIconSize / 2, 0, Math.PI * 2);- ctx.stroke();+ const navBarHeight = 85 * headerScale;+ const navIconSize = 28 * headerScale;+ const navGap = 85 * headerScale;++ const screenBg = isDark ? "#000000" : "#ffffff";+ const frameBorderColor = isDark ? "#404040" : "#d4d4d4";+ const screenBorderColor = isDark ? "rgba(255,255,255,0.1)" : "#000000";+ const buttonBgColor = isDark ? "#737373" : "#a3a3a3";+ const buttonBorderColor = isDark ? "#262626" : "#737373";+ const textAndIconColor = isDark ? "rgba(255,255,255,0.9)" : "rgba(0,0,0,0.9)";+ const navIconColor = isDark ? "rgba(255, 255, 255, 0.3)" : "rgba(0, 0, 0, 0.2)";+ const iconBoxBg = isDark ? "#ffffff" : "#000000";+ const iconBoxText = isDark ? "#000000" : "#ffffff";++ const outerRadius = cornerRadius * 1.2;++ drawMockupShadow(ctx, x, y, width, height, outerRadius, shadowBlur);++ ctx.save();+ const drawSideButton = (percentY: number, percentH: number) => {+ const btnY = y + (height * percentY);+ const btnH = height * percentH;+ const overlap = 2;+ const btnX = x + width - overlap;- const rightIconX = navCenterX + navGap + (4 * headerScale); // Visual offset- ctx.translate(rightIconX, navYCenter);- ctx.rotate(45 * Math.PI / 180); // Rotate to form the arrowctx.beginPath();- const halfIcon = navIconSize / 2;- ctx.moveTo(-halfIcon, -halfIcon); // Top- ctx.lineTo(-halfIcon, halfIcon); // Bottom-left corner- ctx.lineTo(halfIcon, halfIcon); // Right+ ctx.moveTo(btnX, btnY);+ ctx.lineTo(btnX + buttonWidth - buttonRadius, btnY);+ ctx.arcTo(btnX + buttonWidth, btnY, btnX + buttonWidth, btnY + buttonRadius, buttonRadius);+ ctx.lineTo(btnX + buttonWidth, btnY + btnH - buttonRadius);+ ctx.arcTo(btnX + buttonWidth, btnY + btnH, btnX + buttonWidth - buttonRadius, btnY + btnH, buttonRadius);+ ctx.lineTo(btnX, btnY + btnH);+ ctx.fillStyle = buttonBgColor;+ ctx.fill();+ ctx.strokeStyle = buttonBorderColor;+ ctx.lineWidth = 1.5;ctx.stroke();- ctx.restore();-- return {- contentX: screenX,- contentY: screenY + statusBarHeight,- contentWidth: screenWidth,- contentHeight: screenHeight - statusBarHeight - navBarHeight,- };+ };++ drawSideButton(0.20, 0.08);+ drawSideButton(0.32, 0.12);+ ctx.restore();++ ctx.save();+ drawRoundedRectPath(ctx, x, y, width, height, outerRadius);+ ctx.fillStyle = frameColor;+ ctx.fill();+ ctx.strokeStyle = frameBorderColor;+ ctx.lineWidth = 1;+ ctx.stroke();+ ctx.restore();++ const screenX = x + framePadding;+ const screenY = y + framePadding;+ const screenWidth = width - (framePadding * 2);+ const screenHeight = height - (framePadding * 2);+ const screenRadius = Math.max(0, outerRadius - framePadding);++ ctx.save();+ drawRoundedRectPath(ctx, screenX, screenY, screenWidth, screenHeight, screenRadius);+ ctx.fillStyle = screenBg;+ ctx.fill();+ ctx.strokeStyle = screenBorderColor;+ ctx.lineWidth = 1;+ ctx.stroke();+ ctx.restore();++ const camCenterX = screenX + screenWidth / 2;+ const camCenterY = screenY + cameraTop + cameraSize / 2;++ ctx.save();+ ctx.beginPath();+ ctx.arc(camCenterX, camCenterY, cameraSize / 2, 0, Math.PI * 2);+ ctx.fillStyle = "#000000";+ ctx.fill();++ ctx.beginPath();+ ctx.arc(camCenterX, camCenterY, cameraLensSize / 2, 0, Math.PI * 2);+ ctx.fillStyle = "rgba(99, 102, 241, 0.3)";+ ctx.fill();+ ctx.restore();++ const statusYCenter = screenY + (statusBarHeight / 2);++ ctx.save();+ ctx.font = `500 ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;+ ctx.fillStyle = textAndIconColor;+ ctx.textBaseline = "middle";+ ctx.fillText("12:30", screenX + statusBarPaddingX, statusYCenter + (2 * headerScale));+ ctx.restore();++ let currentRightX = screenX + screenWidth - statusBarPaddingX;++ currentRightX -= batW;+ ctx.save();+ ctx.strokeStyle = isDark ? "rgba(255,255,255,0.4)" : "rgba(0,0,0,0.4)";+ ctx.lineWidth = 2 * headerScale;+ drawRoundedRectPath(ctx, currentRightX, statusYCenter - batH / 2, batW, batH, 4 * headerScale);+ ctx.stroke();++ ctx.fillStyle = iconBoxBg;+ const pad = 2 * headerScale;+ drawRoundedRectPath(ctx, currentRightX + pad, statusYCenter - batH / 2 + pad, batW - pad * 2, batH - pad * 2, 2 * headerScale);+ ctx.fill();+ ctx.restore();++ currentRightX -= (box5GSize + gap);+ ctx.save();+ ctx.fillStyle = iconBoxBg;+ drawRoundedRectPath(ctx, currentRightX, statusYCenter - box5GSize / 2, box5GSize, box5GSize, 4 * headerScale);+ ctx.fill();+ ctx.font = `bold ${text5GSize}px "Inter", sans-serif`;+ ctx.fillStyle = iconBoxText;+ ctx.textAlign = "center";+ ctx.textBaseline = "middle";+ ctx.fillText("5G", currentRightX + box5GSize / 2, statusYCenter + (1 * headerScale));+ ctx.restore();++ currentRightX -= (wifiSize + gap);+ ctx.save();+ ctx.translate(currentRightX, statusYCenter - wifiSize / 2);+ const wifiScale = wifiSize / 24;+ ctx.scale(wifiScale, wifiScale);+ const wifiPath = new Path2D("M12 21l-12-12c5.5-5.5 14.5-5.5 20 0l-8 12z");+ ctx.fillStyle = textAndIconColor;+ ctx.globalAlpha = 0.8;+ ctx.fill(wifiPath);+ ctx.restore();++ const navYCenter = screenY + screenHeight - navBarHeight / 2;+ const navCenterX = screenX + screenWidth / 2;++ ctx.save();+ ctx.strokeStyle = navIconColor;+ ctx.lineWidth = 3 * headerScale;+ ctx.lineCap = "round";+ ctx.lineJoin = "round";++ const leftIconX = navCenterX - navGap;+ ctx.strokeRect(leftIconX - navIconSize / 2, navYCenter - navIconSize / 2, navIconSize, navIconSize);++ ctx.beginPath();+ ctx.arc(navCenterX, navYCenter, navIconSize / 2, 0, Math.PI * 2);+ ctx.stroke();++ const rightIconX = navCenterX + navGap + (6 * headerScale);+ ctx.translate(rightIconX, navYCenter);+ ctx.rotate(45 * Math.PI / 180);+ ctx.beginPath();+ const halfIcon = navIconSize / 2;+ ctx.moveTo(-halfIcon, -halfIcon);+ ctx.lineTo(-halfIcon, halfIcon);+ ctx.lineTo(halfIcon, halfIcon);+ ctx.stroke();+ ctx.restore();++ return {+ contentX: screenX,+ contentY: screenY + statusBarHeight,+ contentWidth: screenWidth,+ contentHeight: screenHeight - statusBarHeight - navBarHeight,+ };}\ No newline at end of file