//#region src/types.d.ts /** * Unlayer JSON type definitions. * Based on the design JSON shape produced by `editor.saveDesign()` in * react-email-editor / Unlayer's hosted editor. */ interface UnlayerTemplate { counters?: Record; body: UnlayerBody; schemaVersion?: number; } interface UnlayerBody { id?: string; rows: UnlayerRow[]; headers?: UnlayerRow[]; footers?: UnlayerRow[]; values: UnlayerBodyValues; } interface UnlayerBackgroundImage { url?: string; fullWidth?: boolean; repeat?: string; size?: string; position?: string; } interface UnlayerFontFamily { label?: string; value?: string; } /** * Document-level link styling: colours are strings, flags are booleans. * The hover pair has no Templatical field. */ interface UnlayerLinkStyle { body?: boolean; inherit?: boolean; linkColor?: string; linkHoverColor?: string; linkUnderline?: boolean; linkHoverUnderline?: boolean; } interface UnlayerBodyValues { backgroundColor?: string; backgroundImage?: UnlayerBackgroundImage; contentWidth?: string; contentAlignment?: string; fontFamily?: UnlayerFontFamily; textColor?: string; linkStyle?: UnlayerLinkStyle; preheaderText?: string; [key: string]: unknown; } interface UnlayerRow { id?: string; cells: number[]; columns: UnlayerColumn[]; values: UnlayerRowValues; } interface UnlayerRowValues { backgroundColor?: string; backgroundImage?: UnlayerBackgroundImage; padding?: string; columnsBackgroundColor?: string; hideMobile?: boolean; hideDesktop?: boolean; noStackMobile?: boolean; _meta?: Record; [key: string]: unknown; } interface UnlayerColumn { id?: string; contents: UnlayerContent[]; values: UnlayerColumnValues; } interface UnlayerColumnValues { backgroundColor?: string; padding?: string; border?: Record; _meta?: Record; [key: string]: unknown; } interface UnlayerContent { type: string; values: UnlayerContentValues; } interface UnlayerLinkAction { name?: string; values?: { href?: string; target?: string; }; } interface UnlayerImageSrc { url?: string; width?: number; height?: number; } interface UnlayerButtonColors { color?: string; backgroundColor?: string; hoverColor?: string; hoverBackgroundColor?: string; } interface UnlayerBorder { borderTopWidth?: string; borderTopStyle?: string; borderTopColor?: string; } interface UnlayerMenuItem { key?: string; text: string; link?: UnlayerLinkAction; } interface UnlayerMenu { items: UnlayerMenuItem[]; } interface UnlayerSocialIcon { name?: string; url?: string; type?: string; } interface UnlayerSocialIcons { iconType?: string; editor?: { data?: { showTitle?: boolean; }; }; icons?: UnlayerSocialIcon[]; } interface UnlayerContentValues { containerPadding?: string; textAlign?: string; fontFamily?: UnlayerFontFamily; fontSize?: string; fontWeight?: string | number; color?: string; hideMobile?: boolean; hideDesktop?: boolean; text?: string; headingType?: string; src?: UnlayerImageSrc; altText?: string; action?: UnlayerLinkAction; borderRadius?: string; buttonColors?: UnlayerButtonColors; padding?: string; size?: { autoWidth?: boolean; width?: string; }; href?: UnlayerLinkAction; border?: UnlayerBorder; width?: string; html?: string; menu?: UnlayerMenu; layout?: "horizontal" | "vertical"; separator?: string; icons?: UnlayerSocialIcons; videoUrl?: string; thumbnailUrl?: string; [key: string]: unknown; } /** * Conversion status for each content node in the import report. */ type ConversionStatus = "converted" | "approximated" | "html-fallback" | "skipped"; /** * A single entry in the import report. */ interface ImportReportEntry { unlayerContentType: string; templaticalBlockType: string | null; status: ConversionStatus; note?: string; } /** * The full import report returned alongside the converted template. */ interface ImportReport { entries: ImportReportEntry[]; warnings: string[]; summary: { total: number; converted: number; approximated: number; htmlFallback: number; skipped: number; }; } /** * The result of an Unlayer import operation. */ interface ImportResult { content: import("@templatical/types").TemplateContent; report: ImportReport; } //#endregion //#region src/converter.d.ts /** * Converts an Unlayer design JSON to Templatical TemplateContent. * * @param template - The parsed Unlayer JSON object (the result of `editor.saveDesign(...)`) * @returns An ImportResult with the converted content and a detailed report * * @example * ```ts * import { convertUnlayerTemplate } from '@templatical/import-unlayer'; * * const unlayerJson = JSON.parse(fileContent); * const { content, report } = convertUnlayerTemplate(unlayerJson); * * const editor = init({ container: '#editor', content }); * * console.log(report.summary); * console.log(report.warnings); * ``` */ export declare function convertUnlayerTemplate(template: UnlayerTemplate): ImportResult; //#endregion export type { ConversionStatus, ImportReport, ImportReportEntry, ImportResult, UnlayerBody, UnlayerColumn, UnlayerContent, UnlayerContentValues, UnlayerRow, UnlayerTemplate }; //# sourceMappingURL=index.d.ts.map