/** * Preview Renderer for Momentum CMS * * Generates a styled HTML page from document data and collection config. * Used by the built-in preview endpoint to render live previews in the admin iframe. */ import type { CollectionConfig, Field } from '@momentumcms/core'; /** Custom field renderer: receives the field value and returns an HTML string to embed. */ export type CustomFieldRenderer = (value: unknown, field: Field) => string; /** Options for rendering a preview HTML page. */ export interface PreviewRenderOptions { /** Document data to render */ doc: Record; /** Collection configuration */ collection: CollectionConfig; /** * Optional custom field renderers keyed by `admin.editor` value. * When a field's `admin.editor` matches a key, the custom renderer is used * instead of the default switch-case logic. */ customFieldRenderers?: Record; } /** * Render a styled HTML preview page from document data. * * The page includes: * - Styled rendering of each visible field * - Inline CSS for responsive layout * - postMessage listener for live updates from the admin form * * Security: All field values (including rich text) are HTML-escaped in both * the initial server render and the client-side postMessage handler. */ export declare function renderPreviewHTML(options: PreviewRenderOptions): string;