Skip to content

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

feat: update wallpaper category counts, enhance audio and background types, and introduce editor state management

CristianOlivera13115154f9053
diff --git a/lib/wallpaper.catalog.ts b/lib/wallpaper.catalog.ts
index 89a745d..67fbc3f 100644
--- a/lib/wallpaper.catalog.ts
+++ b/lib/wallpaper.catalog.ts
@@ -34,28 +34,28 @@ const CATEGORY_CONFIGS: CategoryConfig[] = [
label: 'Escritorio',
icon: 'heroicons:computer-desktop-solid',
primary: true,
- count: 4,
+ count: 66,
},
{
id: 'gradient',
label: 'Gradientes',
icon: 'solar:mirror-left-bold',
primary: true,
- count: 0,
+ count: 90,
},
{
id: 'pattern',
label: 'Patrones',
icon: 'solar:palette-round-bold',
primary: false,
- count: 0,
+ count: 49,
},
{
id: 'minimal',
label: 'Minimal',
icon: 'solar:sun-2-bold',
primary: false,
- count: 0,
+ count: 65,
},
];
diff --git a/types/audio.types.ts b/types/audio.types.ts
index 6b6f294..4630bda 100644
--- a/types/audio.types.ts
+++ b/types/audio.types.ts
@@ -1,7 +1,3 @@
-/**
- * Audio Track in Timeline
- * Represents an audio file placed in the timeline with position and volume
- */
export interface AudioTrack {
id: string;
audioId: string; // Reference to uploaded audio file
@@ -10,6 +6,7 @@ export interface AudioTrack {
duration: number; // Duration of the audio clip (seconds)
volume: number; // 0 to 1
loop: boolean; // Whether to loop if audio is shorter than video
+ trimStart?: number; // ← ¿existe este campo?
}
/**
@@ -25,28 +22,18 @@ export interface UploadedAudio {
mimeType: string; // e.g., "audio/mp3", "audio/wav"
}
-/**
- * Audio Configuration
- * Global audio settings per video
- */
export interface AudioConfig {
- muteOriginalAudio: boolean; // Whether to mute the original video audio
- tracks: AudioTrack[]; // Audio tracks in the timeline
- masterVolume: number; // Master volume for all audio tracks (0 to 1)
+ muteOriginalAudio: boolean;
+ tracks: AudioTrack[];
+ masterVolume: number;
}
-/**
- * Default audio configuration
- */
export const DEFAULT_AUDIO_CONFIG: AudioConfig = {
muteOriginalAudio: false,
tracks: [],
masterVolume: 1,
};
-/**
- * Supported audio formats
- */
export const SUPPORTED_AUDIO_FORMATS = [
'audio/mpeg', // MP3
'audio/mp3',
@@ -67,12 +54,6 @@ export const SUPPORTED_AUDIO_EXTENSIONS = [
'.m4a',
] as const;
-/**
- * Maximum audio file size (50MB)
- */
export const MAX_AUDIO_FILE_SIZE = 50 * 1024 * 1024;
-/**
- * Maximum number of audio tracks
- */
export const MAX_AUDIO_TRACKS = 5;
diff --git a/types/background.types.ts b/types/background.types.ts
index 1088f33..b3e7e44 100644
--- a/types/background.types.ts
+++ b/types/background.types.ts
@@ -1,7 +1,3 @@
-/**
- * Tipos para configuración de fondos (colores y gradientes)
- */
-
export type GradientType = "linear" | "radial" | "conic";
export type GradientDirection =
| "to-t" | "to-tr" | "to-r" | "to-br"
@@ -29,9 +25,6 @@ export interface SolidColor {
export type BackgroundColorConfig = { type: "gradient"; config: GradientConfig }
| { type: "solid"; config: SolidColor }
-/**
- * Colores sólidos predefinidos (48 colores únicos)
- */
export const PRESET_SOLID_COLORS = [
"#8D8D8D", "#ef4444", "#f59e0b", "#10b981",
"#3b82f6", "#8b5cf6", "#ec4899", "#ffffff",
@@ -46,6 +39,7 @@ export const PRESET_SOLID_COLORS = [
"#fcd34d", "#c026d3", "#0891b2", "#dc2626",
"#059669", "#7c3aed", "#ea580c", "#db2777",
];
+
const SHARED_PALETTES: ColorStop[][] = [
[{ color: "#FFFBFD", position: 0 }, { color: "#FFE5F5", position: 33 }, { color: "#F769EA", position: 66 }, { color: "#4A1C9B", position: 100 }],
[{ color: "#1D0127", position: 0 }, { color: "#6602C6", position: 33 }, { color: "#AD24E2", position: 66 }, { color: "#FDFBFF", position: 100 }],
@@ -70,12 +64,43 @@ const SHARED_PALETTES: ColorStop[][] = [
[{ color: "#8f8f8f", position: 0 }, { color: "#444444", position: 50 }, { color: "#111111", position: 100 }],
[{ color: "#f093fb", position: 0 }, { color: "#d66efd", position: 50 }, { color: "#f5576c", position: 100 }],
[{ color: "#43e97b", position: 0 }, { color: "#3af2b0", position: 50 }, { color: "#38f9d7", position: 100 }],
- [{ color: "#fa709a", position: 0 }, { color: "#fb9067", position: 40 }, { color: "#fec440", position: 80 }, { color: "#fee140", position: 100 }]
+ [{ color: "#fa709a", position: 0 }, { color: "#fb9067", position: 40 }, { color: "#fec440", position: 80 }, { color: "#fee140", position: 100 }],
+ [{ color: "#ff7e5f", position: 0 }, { color: "#feb47b", position: 100 }],
+ [{ color: "#FF4E50", position: 0 }, { color: "#F9D423", position: 100 }],
+ [{ color: "#f12711", position: 0 }, { color: "#f5af19", position: 100 }],
+ [{ color: "#ff9966", position: 0 }, { color: "#ff5e62", position: 100 }],
+
+ [{ color: "#2b5876", position: 0 }, { color: "#4e4376", position: 100 }],
+ [{ color: "#1CB5E0", position: 0 }, { color: "#000851", position: 100 }],
+ [{ color: "#36D1DC", position: 0 }, { color: "#5B86E5", position: 100 }],
+ [{ color: "#134E5E", position: 0 }, { color: "#71B280", position: 100 }],
+
+ [{ color: "#00b09b", position: 0 }, { color: "#96c93d", position: 100 }],
+ [{ color: "#11998e", position: 0 }, { color: "#38ef7d", position: 100 }],
+ [{ color: "#348F50", position: 0 }, { color: "#56B4D3", position: 100 }],
+ [{ color: "#DCE35B", position: 0 }, { color: "#45B649", position: 100 }],
+
+ [{ color: "#0f0c29", position: 0 }, { color: "#302b63", position: 50 }, { color: "#24243e", position: 100 }],
+ [{ color: "#232526", position: 0 }, { color: "#414345", position: 100 }],
+ [{ color: "#141E30", position: 0 }, { color: "#243B55", position: 100 }],
+ [{ color: "#4B79A1", position: 0 }, { color: "#283E51", position: 100 }],
+
+ [{ color: "#ffafbd", position: 0 }, { color: "#ffc3a0", position: 100 }],
+ [{ color: "#e0c3fc", position: 0 }, { color: "#8ec5fc", position: 100 }],
+ [{ color: "#a1c4fd", position: 0 }, { color: "#c2e9fb", position: 100 }],
+ [{ color: "#fdcbf1", position: 0 }, { color: "#fdcbf1", position: 1 }, { color: "#e6dee9", position: 100 }],
+
+ [{ color: "#ff00cc", position: 0 }, { color: "#333399", position: 100 }],
+ [{ color: "#ff9a9e", position: 0 }, { color: "#fecfef", position: 99 }, { color: "#fecfef", position: 100 }],
+ [{ color: "#F00000", position: 0 }, { color: "#DC281E", position: 50 }, { color: "#000000", position: 100 }],
+ [{ color: "#00F2FE", position: 0 }, { color: "#4FACFE", position: 100 }],
+
+ [{ color: "#ff0844", position: 0 }, { color: "#ffb199", position: 100 }],
+ [{ color: "#c31432", position: 0 }, { color: "#240b36", position: 100 }],
+ [{ color: "#f857a6", position: 0 }, { color: "#ff5858", position: 100 }],
+ [{ color: "#654ea3", position: 0 }, { color: "#eaafc8", position: 100 }]
];
-/**
- * 2. Mapeo para Linear y Radial (Simples)
- */
export const PRESET_LINEAR_GRADIENTS: GradientConfig[] = SHARED_PALETTES.map(stops => ({
type: "linear", direction: "to-br", stops
}));
@@ -96,7 +121,21 @@ const CONIC_METADATA = [
{ angle: 0, originX: 25, originY: 75 }, { angle: 0, originX: 75, originY: 75 },
{ angle: 0, originX: 50, originY: 35 }, { angle: 0, originX: 50, originY: 65 },
{ angle: 0, originX: 35, originY: 50 }, { angle: 0, originX: 65, originY: 50 },
- { angle: 0, originX: 50, originY: 50 }, { angle: 0, originX: 50, originY: 50 }
+ { angle: 0, originX: 50, originY: 50 }, { angle: 0, originX: 50, originY: 50 },
+ { angle: 90, originX: 50, originY: 100 }, { angle: 135, originX: 0, originY: 0 },
+ { angle: 45, originX: 100, originY: 100 }, { angle: 180, originX: 50, originY: 50 },
+ { angle: 180, originX: 50, originY: 0 }, { angle: 225, originX: 100, originY: 0 },
+ { angle: 0, originX: 0, originY: 50 }, { angle: 90, originX: 50, originY: 50 },
+ { angle: 120, originX: 20, originY: 80 }, { angle: 60, originX: 80, originY: 20 },
+ { angle: 0, originX: 50, originY: 50 }, { angle: 300, originX: 10, originY: 10 },
+ { angle: 270, originX: 50, originY: 50 }, { angle: 180, originX: 0, originY: 100 },
+ { angle: 0, originX: 100, originY: 0 }, { angle: 45, originX: 50, originY: 50 },
+ { angle: 90, originX: 50, originY: 50 }, { angle: 135, originX: 25, originY: 75 },
+ { angle: 315, originX: 75, originY: 25 }, { angle: 0, originX: 50, originY: 50 },
+ { angle: 180, originX: 50, originY: 110 }, { angle: 45, originX: -10, originY: -10 },
+ { angle: 90, originX: 100, originY: 50 }, { angle: 270, originX: 0, originY: 50 },
+ { angle: 45, originX: 50, originY: 50 }, { angle: 135, originX: 50, originY: 50 },
+ { angle: 225, originX: 50, originY: 50 }, { angle: 315, originX: 50, originY: 50 }
];
export const PRESET_CONIC_GRADIENTS: GradientConfig[] = CONIC_METADATA.map((meta, i) => ({
diff --git a/types/canvas-elements.types.ts b/types/canvas-elements.types.ts
index 659d44b..1ac0984 100644
--- a/types/canvas-elements.types.ts
+++ b/types/canvas-elements.types.ts
@@ -3,32 +3,32 @@ export type CanvasElementType = "svg" | "image" | "text";
export interface CanvasElementBase {
id: string;
type: CanvasElementType;
- x: number; // Position in percentage (0-100)
- y: number; // Position in percentage (0-100)
- width: number; // Size in percentage
- height: number; // Size in percentage
- rotation: number; // Rotation in degrees
- opacity: number; // 0-100
- zIndex: number; // Stacking order
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ rotation: number;
+ opacity: number;
+ zIndex: number;
}
export interface SvgElement extends CanvasElementBase {
type: "svg";
category: string; // e.g., "shapes", "arrows", "decorative"
- svgId: string; // ID that maps to inline SVG component
- color?: string; // Fill color (optional)
+ svgId: string;
+ color?: string;
}
export interface ImageElement extends CanvasElementBase {
type: "image";
- category: string; // e.g., "stickers", "superposiciones", "desenfoques"
- imagePath: string; // Path to image file in public folder
+ category: string;
+ imagePath: string;
}
export interface TextElement extends CanvasElementBase {
type: "text";
content: string;
- fontSize: number; // Base size (will be scaled)
+ fontSize: number;
fontFamily: string;
fontWeight: "normal" | "medium" | "bold";
color: string;
diff --git a/types/control-panel.types.ts b/types/control-panel.types.ts
index 696710f..d56e62d 100644
--- a/types/control-panel.types.ts
+++ b/types/control-panel.types.ts
@@ -26,7 +26,6 @@ export interface ControlPanelProps {
onImageSelect: (url: string) => void;
onImageRemove: (url: string) => void;
onBackgroundColorChange: (config: BackgroundColorConfig) => void;
- // Zoom props
zoomFragments?: ZoomFragment[];
selectedZoomFragment?: ZoomFragment | null;
onSelectZoomFragment?: (fragmentId: string | null) => void;
@@ -38,19 +37,16 @@ export interface ControlPanelProps {
currentTime?: number;
getThumbnailForTime?: (time: number) => VideoThumbnail | null;
videoDimensions?: { width: number; height: number } | null;
- // Mockup props
mockupId?: string;
mockupConfig?: MockupConfig;
onMockupChange?: (mockupId: string) => void;
onMockupConfigChange?: (config: Partial<MockupConfig>) => void;
- // Canvas elements props
onAddCanvasElement?: (element: CanvasElement) => void;
selectedCanvasElement?: CanvasElement | null;
onUpdateCanvasElement?: (id: string, updates: Partial<CanvasElement>) => void;
onDeleteCanvasElement?: (id: string) => void;
onBringToFront?: (id: string) => void;
onSendToBack?: (id: string) => void;
- // Audio props
uploadedAudios?: UploadedAudio[];
audioTracks?: AudioTrack[];
muteOriginalAudio?: boolean;
diff --git a/types/editor-state.types.ts b/types/editor-state.types.ts
new file mode 100644
index 0000000..43e3f37
--- /dev/null
+++ b/types/editor-state.types.ts
@@ -0,0 +1,63 @@
+import type { BackgroundTab, AspectRatio, BackgroundColorConfig, CropArea, ZoomFragment, AudioTrack } from "@/types";
+import type { TrimRange } from "@/types/timeline.types";
+import type { MockupConfig } from "@/types/mockup.types";
+import type { CanvasElement } from "@/types/canvas-elements.types";
+
+export interface EditorState {
+ backgroundTab: BackgroundTab;
+ selectedWallpaper: number;
+ backgroundBlur: number;
+ padding: number;
+ roundedCorners: number;
+ shadows: number;
+ selectedImageUrl: string;
+ backgroundColorConfig: BackgroundColorConfig | null;
+
+ aspectRatio: AspectRatio;
+ customDimensions: { width: number; height: number } | null;
+ cropArea: CropArea | undefined;
+ trimRange: TrimRange;
+
+ zoomFragments: ZoomFragment[];
+
+ mockupId: string;
+ mockupConfig: MockupConfig;
+
+ canvasElements: CanvasElement[];
+
+ audioTracks: AudioTrack[];
+ muteOriginalAudio: boolean;
+ masterVolume: number;
+}
+
+export function createInitialEditorState(overrides?: Partial<EditorState>): EditorState {
+ return {
+ backgroundTab: "wallpaper",
+ selectedWallpaper: 0,
+ backgroundBlur: 0,
+ padding: 10,
+ roundedCorners: 10,
+ shadows: 10,
+ selectedImageUrl: "",
+ backgroundColorConfig: null,
+ aspectRatio: "auto",
+ customDimensions: null,
+ cropArea: undefined,
+ trimRange: { start: 0, end: 0 },
+ zoomFragments: [],
+ mockupId: "none",
+ mockupConfig: {
+ darkMode: false,
+ frameColor: "#000000",
+ url: "",
+ headerScale: 100,
+ headerOpacity: 100,
+ cornerRadius: 10,
+ },
+ canvasElements: [],
+ audioTracks: [],
+ muteOriginalAudio: false,
+ masterVolume: 1,
+ ...overrides,
+ };
+}
diff --git a/types/video.types.ts b/types/video.types.ts
index 06aa835..2f70fe7 100644
--- a/types/video.types.ts
+++ b/types/video.types.ts
@@ -15,6 +15,7 @@ export interface ExportSettings {
audioTracks?: Array<{
audioUrl: string;
startTime: number;
+ trimStart: number;
duration: number;
volume: number;
loop: boolean;