/** * Content Types System * * This module provides a content abstraction layer that transforms * structured content documents (blog posts, documentation, news articles) * into ArticleMetadata for rendering with val-article component. */ /** * Author information for content documents */ export interface ContentAuthor { /** Author's display name */ name: string; /** URL to author's avatar image */ avatar?: string; /** Author's role or title */ role?: string; /** Link to author's profile */ profileUrl?: string; } /** * Common metadata for all content documents */ export interface ContentMeta { /** Unique identifier */ id?: string; /** URL-friendly slug */ slug?: string; /** Creation date */ createdAt?: Date | string; /** Last update date */ updatedAt?: Date | string; /** Publication date */ publishedAt?: Date | string; /** Content author */ author?: ContentAuthor; /** Tags for categorization */ tags?: string[]; /** Primary category */ category?: string; /** Content locale (e.g., 'es', 'en') */ locale?: string; } /** * Heading block - renders as title or subtitle */ export interface HeadingBlock { type: 'heading'; /** Heading level: 1 = title, 2-3 = subtitle */ level: 1 | 2 | 3; /** Heading text */ text: string; } /** * Paragraph block - renders as text */ export interface ParagraphBlock { type: 'paragraph'; /** Paragraph text content */ text: string; /** Apply emphasis styling */ emphasis?: boolean; } /** * Quote block - renders as blockquote */ export interface QuoteBlock { type: 'quote'; /** Quote text */ text: string; /** Quote author name */ author?: string; /** Quote source */ source?: string; } /** * Code block - renders as syntax-highlighted code */ export interface CodeBlock { type: 'code'; /** Code content */ code: string; /** Programming language for syntax highlighting */ language?: string; /** Code block title/filename */ title?: string; } /** * List block - renders as ordered, unordered, or checklist */ export interface ListBlock { type: 'list'; /** List items (simple strings) */ items: string[]; /** Render as numbered list */ ordered?: boolean; /** Render as checklist with checkmarks */ checklist?: boolean; } /** * Image block - renders as image with optional caption */ export interface ImageBlock { type: 'image'; /** Image source URL */ src: string; /** Alt text for accessibility */ alt: string; /** Image caption */ caption?: string; /** Image alignment */ alignment?: 'left' | 'center' | 'right'; } /** * Callout block - renders as highlighted note/warning */ export interface CalloutBlock { type: 'callout'; /** Callout text content */ text: string; /** Callout variant determines styling */ variant: 'info' | 'warning' | 'success' | 'error'; /** Optional title/prefix */ title?: string; } /** * Divider block - renders as separator line */ export interface DividerBlock { type: 'divider'; /** Divider style */ style?: 'line' | 'dots' | 'space'; } /** * Button block - renders as call-to-action button */ export interface ButtonBlock { type: 'button'; /** Button text */ text: string; /** Link URL (for navigation) */ href?: string; /** Action identifier (for event handling) */ action?: string; /** Button color */ color?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger'; /** Button alignment */ alignment?: 'left' | 'center' | 'right'; } /** * Command block - renders as terminal/CLI command */ export interface CommandBlock { type: 'command'; /** Command to display */ command: string; /** Show copy button */ copyable?: boolean; } /** * Union type of all content blocks */ export type ContentBlock = HeadingBlock | ParagraphBlock | QuoteBlock | CodeBlock | ListBlock | ImageBlock | CalloutBlock | DividerBlock | ButtonBlock | CommandBlock; /** * Configuration options for content rendering */ export interface ContentConfig { /** Article theme */ theme?: 'light' | 'dark' | 'auto'; /** Maximum width of the content container */ maxWidth?: string; /** Show metadata (author, date, etc.) */ showMeta?: boolean; /** Show table of contents */ showTableOfContents?: boolean; /** Center the content container */ centered?: boolean; } /** * Base interface for all content documents. * Generic type T represents the document type discriminator. * * @example * ```typescript * interface BlogPost extends ContentDocument<'blog'> { * title: string; * excerpt: string; * } * ``` */ export interface ContentDocument { /** Document type discriminator */ type: T; /** Document metadata */ meta: ContentMeta; /** Array of content blocks */ content: ContentBlock[]; /** Rendering configuration */ config?: ContentConfig; } /** * Type guard to check if a block is a heading */ export declare function isHeadingBlock(block: ContentBlock): block is HeadingBlock; /** * Type guard to check if a block is a paragraph */ export declare function isParagraphBlock(block: ContentBlock): block is ParagraphBlock; /** * Type guard to check if a block is a code block */ export declare function isCodeBlock(block: ContentBlock): block is CodeBlock; /** * Type guard to check if a block is a list */ export declare function isListBlock(block: ContentBlock): block is ListBlock; /** * Type guard to check if a block is a callout */ export declare function isCalloutBlock(block: ContentBlock): block is CalloutBlock;