/** * Blog document model: parse/serialize + optional component registry. */ import type { Component } from 'svelte'; export type BlogBlockType = 'heading' | 'paragraph' | 'image' | 'code' | 'callout' | 'quote' | 'list' | 'divider' | 'markdown' | 'video' | 'embed' | 'gallery' | 'table' | 'cta' | 'spacer' | 'html' | 'component'; export type BlogHeadingLevel = 1 | 2 | 3 | 4; export type BlogAlign = 'left' | 'center' | 'right'; export type BlogWidth = 'full' | 'wide' | 'content' | 'narrow'; export type BlogCalloutTone = 'info' | 'success' | 'warning' | 'danger' | 'neutral'; export interface BlogHeadingData { level: BlogHeadingLevel; text: string; align?: BlogAlign; anchor?: string; } export interface BlogParagraphData { text: string; align?: BlogAlign; lead?: boolean; muted?: boolean; } export interface BlogImageData { src: string; alt?: string; caption?: string; href?: string; align?: BlogAlign; width?: BlogWidth; rounded?: boolean; shadow?: boolean; } export interface BlogCodeData { code: string; language?: string; filename?: string; showLineNumbers?: boolean; highlightLines?: string; } export interface BlogCalloutData { tone?: BlogCalloutTone; title?: string; text: string; collapsible?: boolean; } export interface BlogQuoteData { text: string; cite?: string; role?: string; align?: BlogAlign; } export interface BlogListData { ordered?: boolean; items: string[]; tight?: boolean; start?: number; } export interface BlogMarkdownData { source: string; } export interface BlogDividerData { style?: 'solid' | 'dashed' | 'dotted'; label?: string; spacing?: 'sm' | 'md' | 'lg'; } export interface BlogVideoData { src: string; poster?: string; caption?: string; controls?: boolean; autoplay?: boolean; loop?: boolean; muted?: boolean; align?: BlogAlign; width?: BlogWidth; } export interface BlogEmbedData { url: string; title?: string; aspectRatio?: '16:9' | '4:3' | '1:1' | '9:16'; height?: number; caption?: string; } export interface BlogGalleryImage { src: string; alt?: string; caption?: string; } export interface BlogGalleryData { images: BlogGalleryImage[]; columns?: 2 | 3 | 4; gap?: 'sm' | 'md' | 'lg'; rounded?: boolean; } export interface BlogTableData { headers: string[]; rows: string[][]; striped?: boolean; compact?: boolean; caption?: string; } export interface BlogCtaData { label: string; href?: string; variant?: 'primary' | 'secondary' | 'ghost' | 'outline'; align?: BlogAlign; subtitle?: string; openInNewTab?: boolean; } export interface BlogSpacerData { size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; } export interface BlogHtmlData { html: string; } export interface BlogComponentPropField { key: string; label: string; type: 'string' | 'number' | 'boolean' | 'select' | 'textarea' | 'color'; options?: { value: string; label: string; }[]; placeholder?: string; description?: string; } export interface BlogComponentData { componentId: string; props?: Record; } export type BlogBlockData = BlogHeadingData | BlogParagraphData | BlogImageData | BlogCodeData | BlogCalloutData | BlogQuoteData | BlogListData | BlogMarkdownData | BlogDividerData | BlogVideoData | BlogEmbedData | BlogGalleryData | BlogTableData | BlogCtaData | BlogSpacerData | BlogHtmlData | BlogComponentData | Record; export interface BlogBlock { id: string; type: BlogBlockType; data: BlogBlockData; } export interface BlogDocument { version: 1; title?: string; description?: string; coverImage?: string; author?: string; tags?: string[]; publishedAt?: string; blocks: BlogBlock[]; } export interface BlogComponentRegistration { label: string; component: Component; defaultProps?: Record; description?: string; /** Optional schema so BlogEditor can show typed prop fields. */ propFields?: BlogComponentPropField[]; } export declare function emptyBlogDocument(title?: string): BlogDocument; export declare function defaultDataForType(type: BlogBlockType): BlogBlockData; export declare function createBlock(type: BlogBlockType, data?: Partial): BlogBlock; export declare function createComponentBlock(componentId: string, props?: Record): BlogBlock; export declare function serializeBlogDocument(doc: BlogDocument): string; export declare function parseBlogDocument(raw: string | BlogDocument): BlogDocument; export declare function registerBlogComponent(id: string, registration: BlogComponentRegistration): void; export declare function unregisterBlogComponent(id: string): void; export declare function getBlogComponent(id: string): BlogComponentRegistration | undefined; export declare function listBlogComponents(): { id: string; registration: BlogComponentRegistration; }[]; export declare function clearBlogComponentRegistry(): void; export declare function blogWidthClass(width?: BlogWidth): string; export declare function blogAlignClass(align?: BlogAlign): string; export declare function blogAspectPadding(ratio?: BlogEmbedData['aspectRatio']): string; export declare const NATIVE_BLOCK_TYPES: { type: Exclude; label: string; group: string; }[];