import type { SmoothMarkdownStreamOptions } from 'markstream-core'; import type { BaseNode, HtmlPolicy, MarkdownIt, ParsedNode, ParseOptions } from 'stream-markdown-parser'; import type { CustomComponentMap } from '../../customComponents'; import type { CodeBlockMonacoOptions, CodeBlockMonacoTheme } from '../../types/monaco'; import { getHtmlTagFromContent, hasCompleteHtmlTagContent, normalizeCustomHtmlTags, normalizeCustomHtmlTagName as normalizeTagName, stripCustomHtmlWrapper } from 'stream-markdown-parser'; export { getHtmlTagFromContent, hasCompleteHtmlTagContent, normalizeCustomHtmlTags, normalizeTagName, stripCustomHtmlWrapper, }; export type SvelteRenderableNode = (ParsedNode | BaseNode) & Record; export interface CodeBlockPreviewPayload { node: SvelteRenderableNode; artifactType: 'text/html' | 'image/svg+xml'; artifactTitle: string; id: string; } export type NodeRendererCodeBlockProps = Partial<{ stream: boolean; darkTheme: CodeBlockMonacoTheme; lightTheme: CodeBlockMonacoTheme; themes: CodeBlockMonacoTheme[]; monacoOptions: CodeBlockMonacoOptions; minWidth: string | number; maxWidth: string | number; isShowPreview: boolean; enableFontSizeControl: boolean; showHeader: boolean; showCopyButton: boolean; showExpandButton: boolean; showPreviewButton: boolean; showCollapseButton: boolean; showFontSizeButtons: boolean; htmlPreviewAllowScripts: boolean; htmlPreviewSandbox: string; }> & Record; export type NodeRendererMermaidProps = Partial<{ maxHeight: string | null; estimatedPreviewHeightPx: number; workerTimeoutMs: number; parseTimeoutMs: number; renderTimeoutMs: number; fullRenderTimeoutMs: number; renderDebounceMs: number; showHeader: boolean; showModeToggle: boolean; showCopyButton: boolean; showExportButton: boolean; showFullscreenButton: boolean; showCollapseButton: boolean; showZoomControls: boolean; isStrict: boolean; enableMermaidInteractions: boolean; }> & Record; export type NodeRendererD2Props = Partial<{ maxHeight: string | null; themeId: number | null; darkThemeId: number | null; showHeader: boolean; showModeToggle: boolean; showCopyButton: boolean; showExportButton: boolean; showCollapseButton: boolean; }> & Record; export type NodeRendererInfographicProps = Partial<{ maxHeight: string | null; estimatedPreviewHeightPx: number; showHeader: boolean; showModeToggle: boolean; showCopyButton: boolean; showCollapseButton: boolean; showExportButton: boolean; showFullscreenButton: boolean; showZoomControls: boolean; }> & Record; export interface NodeRendererEvents { onCopy?: (code: string) => void; onHandleArtifactClick?: (payload: CodeBlockPreviewPayload) => void; } export interface NodeRendererProps { content?: string; nodes?: readonly BaseNode[] | null; final?: boolean; parseOptions?: ParseOptions; customMarkdownIt?: (md: MarkdownIt) => MarkdownIt; debugPerformance?: boolean; customHtmlTags?: readonly string[]; htmlPolicy?: HtmlPolicy; viewportPriority?: boolean; codeBlockStream?: boolean; codeBlockDarkTheme?: CodeBlockMonacoTheme; codeBlockLightTheme?: CodeBlockMonacoTheme; codeBlockMonacoOptions?: CodeBlockMonacoOptions; renderCodeBlocksAsPre?: boolean; codeBlockMinWidth?: string | number; codeBlockMaxWidth?: string | number; codeBlockProps?: NodeRendererCodeBlockProps; mermaidProps?: NodeRendererMermaidProps; d2Props?: NodeRendererD2Props; infographicProps?: NodeRendererInfographicProps; customComponents?: CustomComponentMap; showTooltips?: boolean; themes?: CodeBlockMonacoTheme[]; isDark?: boolean; customId?: string; indexKey?: number | string; typewriter?: boolean; fade?: boolean; batchRendering?: boolean; initialRenderBatchSize?: number; renderBatchSize?: number; renderBatchDelay?: number; renderBatchBudgetMs?: number; renderBatchIdleTimeoutMs?: number; deferNodesUntilVisible?: boolean; maxLiveNodes?: number; liveNodeBuffer?: number; allowHtml?: boolean; smoothStreaming?: boolean | 'auto'; smoothStreamingOptions?: SmoothMarkdownStreamOptions; } export interface SvelteRenderContext { customId?: string; isDark?: boolean; indexKey?: string; final?: boolean; typewriter?: boolean; fade?: boolean; textStreamState?: Map; streamRenderVersion?: number; showTooltips?: boolean; codeBlockStream?: boolean; renderCodeBlocksAsPre?: boolean; allowHtml?: boolean; htmlPolicy?: HtmlPolicy; customHtmlTags?: readonly string[]; parseOptions?: ParseOptions; customMarkdownIt?: (md: MarkdownIt) => MarkdownIt; codeBlockProps?: NodeRendererCodeBlockProps; mermaidProps?: NodeRendererMermaidProps; d2Props?: NodeRendererD2Props; infographicProps?: NodeRendererInfographicProps; customComponents?: CustomComponentMap; codeBlockThemes?: { themes?: CodeBlockMonacoTheme[]; darkTheme?: CodeBlockMonacoTheme; lightTheme?: CodeBlockMonacoTheme; monacoOptions?: CodeBlockMonacoOptions; minWidth?: string | number; maxWidth?: string | number; }; events: NodeRendererEvents; } export declare const BLOCK_LEVEL_TYPES: Set; export declare function buildRenderContext(props: NodeRendererProps, events?: NodeRendererEvents, textStreamState?: Map, streamRenderVersion?: number): SvelteRenderContext; export declare function resolveParsedNodes(props: NodeRendererProps): SvelteRenderableNode[]; export declare function getNodeList(value: unknown): SvelteRenderableNode[]; export declare function isWhitespaceTextNode(node: SvelteRenderableNode | null | undefined): boolean; export declare function getMeaningfulLinkChildren(node: SvelteRenderableNode | null | undefined): SvelteRenderableNode[]; export declare function isImageOnlyLinkNode(node: SvelteRenderableNode | null | undefined): boolean; export declare function isMediaOnlyParagraphNodes(children: readonly SvelteRenderableNode[]): boolean; export declare function normalizeMediaOnlyParagraphNodes(children: readonly SvelteRenderableNode[]): SvelteRenderableNode[]; export declare function getString(value: unknown): string; export declare function isSafeAttrName(value: string): boolean; export declare function escapeHtml(value: unknown): string; export declare function escapeAttr(value: unknown): string; export declare function sanitizeClassToken(value: string): string; export declare function clampHeadingLevel(value: unknown): number; export declare function capitalize(value: string): string; export declare function normalizeCodeLanguage(raw: unknown): string; export declare function resolveCodeBlockLanguage(node: SvelteRenderableNode): string; export declare function encodeDataPayload(value: string): any; export declare function normalizeTokenAttrs(attrs?: Array<[string, string | null]> | null): Record; export declare function splitParagraphChildren(children: readonly SvelteRenderableNode[]): ({ kind: "inline"; nodes: SvelteRenderableNode[]; } | { kind: "block"; node: SvelteRenderableNode; })[];