UNPKG

@prodbirdy/mockup-generator

Version:

Serverless-optimized TypeScript SDK for generating high-quality product mockups from PSD templates

117 lines (99 loc) 2.46 kB
export const LAYER_TYPES = { GROUP: "group", SMART_OBJECT: "smartObject", TEXT: "text", SHAPE: "shape", ADJUSTMENT: "adjustment", PIXEL: "pixel", } as const; export type LayerType = (typeof LAYER_TYPES)[keyof typeof LAYER_TYPES]; export const LAYER_ICONS: Record<LayerType, string> = { [LAYER_TYPES.GROUP]: "📁", [LAYER_TYPES.SMART_OBJECT]: "🔗", [LAYER_TYPES.TEXT]: "📝", [LAYER_TYPES.SHAPE]: "✏️", [LAYER_TYPES.ADJUSTMENT]: "🎨", [LAYER_TYPES.PIXEL]: "🖼️", }; export const FILL_MODES = { FIT: "fit", FILL: "fill", STRETCH: "stretch", } as const; export type FillMode = (typeof FILL_MODES)[keyof typeof FILL_MODES]; export interface PrintArea { x: number; y: number; width: number; height: number; } export interface SmartObjectConfig { name: string; imagePath: string; fillMode?: FillMode; printArea?: PrintArea; useGuideConstraints?: boolean; customDimensions?: { width: number; height: number; }; } export type ExportFormat = "png" | "jpg" | "jpeg"; export interface ExportConfig { format: ExportFormat; quality?: number; // 0-100 for JPEG width?: number; height?: number; maintainAspectRatio?: boolean; } export interface MockupConfig { inputPath: string; outputPath: string; smartObjects: SmartObjectConfig[]; exports?: ExportConfig[]; verbose?: boolean; debug?: boolean; } export interface SmartObjectInfo { name: string | undefined; width: number; height: number; layer: any; path: string[]; } export interface GuideConstraints { left?: number; top?: number; right?: number; bottom?: number; } export interface Guide { location: number; direction: "horizontal" | "vertical"; } // R2 Configuration export interface R2Config { endpoint: string; accessKeyId: string; secretAccessKey: string; bucket: string; region?: string; } // Photopea Export Configuration export type PhotopeaExportFormat = "png" | "jpg" | "jpeg" | "webp" | "pdf"; export interface PhotopeaExportConfig { formats: PhotopeaExportFormat[]; quality?: number; // 0-100 for lossy formats uploadToR2?: boolean; r2Prefix?: string; // Optional prefix for R2 uploads } export interface PhotopeaConfig { r2?: R2Config; exports: PhotopeaExportConfig; headless?: boolean; timeout?: number; } // Extended Mockup Config with Photopea support export interface MockupConfigWithPhotopea extends MockupConfig { photopea?: PhotopeaConfig; }