Files
apes-sidebar/src/client/mermaid-lazy.tsx
T
lhh010 2eb9f66ce8 feat(changes): render mermaid fences in the reading mode via the shared lazy chunk
Documents containing mermaid fences now route through the editor preview chunk-resident renderer (splitMermaidBlocks detection + LazyMermaidMarkdown), so diagrams draw with zoom/pan instead of code blocks, while plain documents keep the byte-for-byte single MarkdownText pass. The lazy stub moves to a light mermaid-lazy.tsx module (re-exported from MarkdownHtml.tsx) so the core client bundle imports it without statically pulling DOMPurify/HTML analysis along. Typecheck, 4 affected suites (22 tests), and the full build pass.
2026-09-02 09:14:59 +08:00

17 lines
800 B
TypeScript

/**
* The chunk-resident markdown renderer (mermaid lazy chunk): a light stub
* module so core-bundle consumers (the changes tab's reading mode) can mount
* the mermaid-aware renderer without statically pulling MarkdownHtml's
* DOMPurify/HTML-analysis machinery into the core bundle. The chunk itself
* (src/client/chunks/mermaid) loads on first render via /sidebar/bundle.
*/
import type { ComponentType } from 'react'
import { lazyChunkComponent } from './lazy-chunk.tsx'
import type { MermaidMarkdownProps } from './mermaid-blocks.ts'
/** Shared with the legacy no-HTML preview path in TextEditor (re-exported). */
export const LazyMermaidMarkdown = lazyChunkComponent<MermaidMarkdownProps>(
'mermaid',
(mod) => mod.MermaidMarkdown as ComponentType<MermaidMarkdownProps> | undefined,
)