markstream-react 0.0.31 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +11 -0
  2. package/dist/Tooltip-CjIRU2iQ.js +209 -0
  3. package/dist/index-BQw8Blc5.js +87 -0
  4. package/dist/index.css +1 -1
  5. package/dist/index.d.ts +65 -622
  6. package/dist/index.js +1 -211
  7. package/dist/index.px.css +1 -1
  8. package/dist/index.tailwind.css +1 -1
  9. package/dist/languageIcon-BiAQ6aSb.js +3 -0
  10. package/dist/markstream-react.css +1 -0
  11. package/dist/next.d.ts +737 -0
  12. package/dist/next.js +2 -0
  13. package/dist/server.d.ts +543 -0
  14. package/dist/server.js +1 -0
  15. package/dist/tailwind.ts +1 -1
  16. package/dist/types/components/AdmonitionNode/AdmonitionNode.d.ts +11 -0
  17. package/dist/types/components/BlockquoteNode/BlockquoteNode.d.ts +7 -0
  18. package/dist/types/components/CheckboxNode/CheckboxNode.d.ts +6 -0
  19. package/dist/types/components/CodeBlockNode/CodeBlockNode.d.ts +13 -0
  20. package/dist/types/components/CodeBlockNode/HtmlPreviewFrame.d.ts +9 -0
  21. package/dist/types/components/CodeBlockNode/PreCodeNode.d.ts +2 -0
  22. package/dist/types/components/CodeBlockNode/monaco.d.ts +1 -0
  23. package/dist/types/components/CodeBlockNode/monacoThemeRegistry.d.ts +7 -0
  24. package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +4 -0
  25. package/dist/types/components/D2BlockNode/D2BlockNode.d.ts +2 -0
  26. package/dist/types/components/D2BlockNode/d2.d.ts +6 -0
  27. package/dist/types/components/D2BlockNode/index.d.ts +2 -0
  28. package/dist/types/components/DefinitionListNode/DefinitionListNode.d.ts +6 -0
  29. package/dist/types/components/EmojiNode/EmojiNode.d.ts +7 -0
  30. package/dist/types/components/EmphasisNode/EmphasisNode.d.ts +5 -0
  31. package/dist/types/components/FootnoteAnchorNode/FootnoteAnchorNode.d.ts +6 -0
  32. package/dist/types/components/FootnoteNode/FootnoteNode.d.ts +8 -0
  33. package/dist/types/components/FootnoteReferenceNode/FootnoteReferenceNode.d.ts +6 -0
  34. package/dist/types/components/HardBreakNode/HardBreakNode.d.ts +5 -0
  35. package/dist/types/components/HeadingNode/HeadingNode.d.ts +9 -0
  36. package/dist/types/components/HighlightNode/HighlightNode.d.ts +5 -0
  37. package/dist/types/components/HtmlBlockNode/HtmlBlockNode.d.ts +12 -0
  38. package/dist/types/components/HtmlInlineNode/HtmlInlineNode.d.ts +8 -0
  39. package/dist/types/components/ImageNode/ImageNode.d.ts +9 -0
  40. package/dist/types/components/InfographicBlockNode/InfographicBlockNode.d.ts +15 -0
  41. package/dist/types/components/InfographicBlockNode/index.d.ts +2 -0
  42. package/dist/types/components/InfographicBlockNode/infographic.d.ts +1 -0
  43. package/dist/types/components/InlineCodeNode/InlineCodeNode.d.ts +6 -0
  44. package/dist/types/components/InsertNode/InsertNode.d.ts +5 -0
  45. package/dist/types/components/LinkNode/LinkNode.d.ts +21 -0
  46. package/dist/types/components/ListItemNode/ListItemNode.d.ts +12 -0
  47. package/dist/types/components/ListNode/ListNode.d.ts +8 -0
  48. package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.d.ts +36 -0
  49. package/dist/types/components/Math/MathBlockNode.d.ts +2 -0
  50. package/dist/types/components/Math/MathInlineNode.d.ts +2 -0
  51. package/dist/types/components/Math/katex.d.ts +1 -0
  52. package/dist/types/components/MathBlockNode/MathBlockNode.d.ts +2 -0
  53. package/dist/types/components/MathInlineNode/MathInlineNode.d.ts +2 -0
  54. package/dist/types/components/MermaidBlockNode/MermaidBlockNode.d.ts +15 -0
  55. package/dist/types/components/MermaidBlockNode/index.d.ts +2 -0
  56. package/dist/types/components/MermaidBlockNode/mermaid.d.ts +1 -0
  57. package/dist/types/components/NodeRenderer/FallbackComponent.d.ts +5 -0
  58. package/dist/types/components/NodeRenderer/preloadMonaco.d.ts +1 -0
  59. package/dist/types/components/NodeRenderer.d.ts +4 -0
  60. package/dist/types/components/ParagraphNode/ParagraphNode.d.ts +7 -0
  61. package/dist/types/components/PreCodeNode/PreCodeNode.d.ts +2 -0
  62. package/dist/types/components/ReferenceNode/ReferenceNode.d.ts +15 -0
  63. package/dist/types/components/StrikethroughNode/StrikethroughNode.d.ts +5 -0
  64. package/dist/types/components/StrongNode/StrongNode.d.ts +5 -0
  65. package/dist/types/components/SubscriptNode/SubscriptNode.d.ts +5 -0
  66. package/dist/types/components/SuperscriptNode/SuperscriptNode.d.ts +5 -0
  67. package/dist/types/components/TableNode/TableNode.d.ts +8 -0
  68. package/dist/types/components/TextNode/TextNode.d.ts +7 -0
  69. package/dist/types/components/ThematicBreakNode/ThematicBreakNode.d.ts +2 -0
  70. package/dist/types/components/Tooltip/Tooltip.d.ts +15 -0
  71. package/dist/types/components/VmrContainerNode/VmrContainerNode.d.ts +9 -0
  72. package/dist/types/context/viewportPriority.d.ts +17 -0
  73. package/dist/types/customComponents.d.ts +9 -0
  74. package/dist/types/i18n/useSafeI18n.d.ts +10 -0
  75. package/dist/types/index.d.ts +65 -0
  76. package/dist/types/next.d.ts +297 -0
  77. package/dist/types/renderers/renderChildren.d.ts +7 -0
  78. package/dist/types/renderers/renderNode.d.ts +4 -0
  79. package/dist/types/server-renderer/html.d.ts +2 -0
  80. package/dist/types/server-renderer/index.d.ts +166 -0
  81. package/dist/types/server-renderer/katex.d.ts +1 -0
  82. package/dist/types/server.d.ts +54 -0
  83. package/dist/types/tailwind-entry.d.ts +1 -0
  84. package/dist/types/tooltip/singletonTooltip.d.ts +7 -0
  85. package/dist/types/types/component-props.d.ts +208 -0
  86. package/dist/types/types/node-component.d.ts +12 -0
  87. package/dist/types/types.d.ts +82 -0
  88. package/dist/types/utils/languageIcon.d.ts +8 -0
  89. package/dist/types/utils/languageIconExtended.d.ts +1 -0
  90. package/dist/types/utils/performanceMonitor.d.ts +78 -0
  91. package/dist/types/utils/safeRaf.d.ts +2 -0
  92. package/dist/types/utils/streamingTextState.d.ts +23 -0
  93. package/dist/types/workers/katexRenderer.worker.d.ts +0 -0
  94. package/dist/types/workers/katexWorkerClient.d.ts +31 -0
  95. package/dist/types/workers/mermaidParser.worker.d.ts +1 -0
  96. package/dist/types/workers/mermaidWorkerClient.d.ts +14 -0
  97. package/package.json +11 -3
package/dist/next.d.ts ADDED
@@ -0,0 +1,737 @@
1
+ import React, { ComponentType } from 'react';
2
+ import * as stream_markdown_parser from 'stream-markdown-parser';
3
+ import { CodeBlockNode as CodeBlockNode$1, BaseNode, ParseOptions, MarkdownIt, ParsedNode } from 'stream-markdown-parser';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+
6
+ type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
7
+ interface TooltipProps {
8
+ visible: boolean;
9
+ anchorEl: HTMLElement | null;
10
+ content: string;
11
+ placement?: TooltipPlacement;
12
+ offset?: number;
13
+ originX?: number | null;
14
+ originY?: number | null;
15
+ id?: string | null;
16
+ isDark?: boolean | null;
17
+ }
18
+
19
+ interface CodeBlockMonacoThemeObject {
20
+ name: string;
21
+ base?: string;
22
+ inherit?: boolean;
23
+ colors?: Record<string, string>;
24
+ rules?: Array<Record<string, unknown>>;
25
+ [key: string]: unknown;
26
+ }
27
+ type CodeBlockMonacoTheme = string | CodeBlockMonacoThemeObject;
28
+ type CodeBlockMonacoLanguage = string | ((...args: any[]) => unknown);
29
+ interface CodeBlockDiffHideUnchangedRegionsOptions {
30
+ enabled?: boolean;
31
+ contextLineCount?: number;
32
+ minimumLineCount?: number;
33
+ revealLineCount?: number;
34
+ }
35
+ type CodeBlockDiffHideUnchangedRegions = boolean | CodeBlockDiffHideUnchangedRegionsOptions;
36
+ type CodeBlockDiffLineStyle = 'background' | 'bar';
37
+ type CodeBlockDiffAppearance = 'auto' | 'light' | 'dark';
38
+ type CodeBlockDiffUnchangedRegionStyle = 'line-info' | 'line-info-basic' | 'metadata' | 'simple';
39
+ type CodeBlockDiffHunkActionKind = 'revert' | 'stage';
40
+ type CodeBlockDiffHunkSide = 'upper' | 'lower';
41
+ interface CodeBlockDiffHunkActionContext {
42
+ action: CodeBlockDiffHunkActionKind;
43
+ side: CodeBlockDiffHunkSide;
44
+ lineChange: unknown;
45
+ originalModel: unknown;
46
+ modifiedModel: unknown;
47
+ }
48
+ interface CodeBlockMonacoOptions {
49
+ MAX_HEIGHT?: number | string;
50
+ fontSize?: number;
51
+ lineHeight?: number;
52
+ fontFamily?: string;
53
+ tabSize?: number;
54
+ readOnly?: boolean;
55
+ wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded' | string;
56
+ wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent' | string;
57
+ theme?: string;
58
+ themes?: CodeBlockMonacoTheme[];
59
+ languages?: CodeBlockMonacoLanguage[];
60
+ renderSideBySide?: boolean;
61
+ enableSplitViewResizing?: boolean;
62
+ ignoreTrimWhitespace?: boolean;
63
+ maxComputationTime?: number;
64
+ diffAlgorithm?: string;
65
+ renderIndicators?: boolean;
66
+ originalEditable?: boolean;
67
+ revealDebounceMs?: number;
68
+ revealStrategy?: 'bottom' | 'centerIfOutside' | 'center';
69
+ revealBatchOnIdleMs?: number;
70
+ updateThrottleMs?: number;
71
+ diffUpdateThrottleMs?: number;
72
+ diffAutoScroll?: boolean;
73
+ diffHideUnchangedRegions?: CodeBlockDiffHideUnchangedRegions;
74
+ diffLineStyle?: CodeBlockDiffLineStyle;
75
+ diffAppearance?: CodeBlockDiffAppearance;
76
+ diffUnchangedRegionStyle?: CodeBlockDiffUnchangedRegionStyle;
77
+ diffHunkActionsOnHover?: boolean;
78
+ diffHunkHoverHideDelayMs?: number;
79
+ onDiffHunkAction?: (context: CodeBlockDiffHunkActionContext) => void | boolean | Promise<void | boolean>;
80
+ scrollbar?: Record<string, any>;
81
+ [key: string]: any;
82
+ }
83
+ interface CodeBlockNodeProps {
84
+ node: CodeBlockNode$1;
85
+ isDark?: boolean;
86
+ loading?: boolean;
87
+ stream?: boolean;
88
+ darkTheme?: CodeBlockMonacoTheme;
89
+ lightTheme?: CodeBlockMonacoTheme;
90
+ isShowPreview?: boolean;
91
+ monacoOptions?: CodeBlockMonacoOptions;
92
+ enableFontSizeControl?: boolean;
93
+ minWidth?: string | number;
94
+ maxWidth?: string | number;
95
+ themes?: CodeBlockMonacoTheme[];
96
+ showHeader?: boolean;
97
+ showCopyButton?: boolean;
98
+ showExpandButton?: boolean;
99
+ showPreviewButton?: boolean;
100
+ showCollapseButton?: boolean;
101
+ showFontSizeButtons?: boolean;
102
+ showTooltips?: boolean;
103
+ customId?: string;
104
+ }
105
+ interface ImageNodeProps {
106
+ node: {
107
+ type: 'image';
108
+ src: string;
109
+ alt: string;
110
+ title: string | null;
111
+ raw: string;
112
+ loading?: boolean;
113
+ };
114
+ fallbackSrc?: string;
115
+ showCaption?: boolean;
116
+ lazy?: boolean;
117
+ svgMinHeight?: string;
118
+ usePlaceholder?: boolean;
119
+ }
120
+ interface LinkNodeProps {
121
+ node: {
122
+ type: 'link';
123
+ href: string;
124
+ title: string | null;
125
+ text: string;
126
+ attrs?: [string, string][];
127
+ children: {
128
+ type: string;
129
+ raw: string;
130
+ }[];
131
+ raw: string;
132
+ loading?: boolean;
133
+ };
134
+ indexKey: number | string;
135
+ customId?: string;
136
+ showTooltip?: boolean;
137
+ color?: string;
138
+ underlineHeight?: number;
139
+ underlineBottom?: number | string;
140
+ animationDuration?: number;
141
+ animationOpacity?: number;
142
+ animationTiming?: string;
143
+ animationIteration?: string | number;
144
+ }
145
+ interface PreCodeNodeProps {
146
+ node: CodeBlockNode$1;
147
+ }
148
+ interface MermaidBlockNodeProps {
149
+ node: CodeBlockNode$1;
150
+ maxHeight?: string | null;
151
+ loading?: boolean;
152
+ isDark?: boolean;
153
+ workerTimeoutMs?: number;
154
+ parseTimeoutMs?: number;
155
+ renderTimeoutMs?: number;
156
+ fullRenderTimeoutMs?: number;
157
+ renderDebounceMs?: number;
158
+ contentStableDelayMs?: number;
159
+ previewPollDelayMs?: number;
160
+ previewPollMaxDelayMs?: number;
161
+ previewPollMaxAttempts?: number;
162
+ showHeader?: boolean;
163
+ showModeToggle?: boolean;
164
+ showCopyButton?: boolean;
165
+ showExportButton?: boolean;
166
+ showFullscreenButton?: boolean;
167
+ showCollapseButton?: boolean;
168
+ showZoomControls?: boolean;
169
+ enableWheelZoom?: boolean;
170
+ isStrict?: boolean;
171
+ showTooltips?: boolean;
172
+ onRenderError?: (error: unknown, code: string, container: HTMLElement) => boolean | void;
173
+ }
174
+ interface MermaidBlockEvent<TPayload = any> {
175
+ payload?: TPayload;
176
+ defaultPrevented: boolean;
177
+ preventDefault: () => void;
178
+ svgElement?: SVGElement | null;
179
+ svgString?: string | null;
180
+ }
181
+ interface D2BlockNodeProps {
182
+ node: CodeBlockNode$1;
183
+ maxHeight?: string | null;
184
+ loading?: boolean;
185
+ isDark?: boolean;
186
+ progressiveRender?: boolean;
187
+ progressiveIntervalMs?: number;
188
+ themeId?: number | null;
189
+ darkThemeId?: number | null;
190
+ showHeader?: boolean;
191
+ showModeToggle?: boolean;
192
+ showCopyButton?: boolean;
193
+ showExportButton?: boolean;
194
+ showCollapseButton?: boolean;
195
+ }
196
+ interface MathBlockNodeProps {
197
+ node: {
198
+ type: 'math_block';
199
+ content: string;
200
+ raw: string;
201
+ loading?: boolean;
202
+ };
203
+ }
204
+ interface MathInlineNodeProps {
205
+ node: {
206
+ type: 'math_inline';
207
+ content: string;
208
+ raw: string;
209
+ loading?: boolean;
210
+ markup?: string;
211
+ };
212
+ }
213
+ interface InfographicBlockNodeProps {
214
+ node: CodeBlockNode$1;
215
+ maxHeight?: string | null;
216
+ loading?: boolean;
217
+ isDark?: boolean;
218
+ showHeader?: boolean;
219
+ showModeToggle?: boolean;
220
+ showCopyButton?: boolean;
221
+ showCollapseButton?: boolean;
222
+ showExportButton?: boolean;
223
+ showFullscreenButton?: boolean;
224
+ showZoomControls?: boolean;
225
+ }
226
+
227
+ interface NodeRendererProps {
228
+ content?: string;
229
+ nodes?: readonly BaseNode[] | null;
230
+ /**
231
+ * Whether the input stream is complete (end-of-stream). When true, the parser
232
+ * can stop emitting streaming "loading" nodes for unfinished constructs.
233
+ */
234
+ final?: boolean;
235
+ parseOptions?: ParseOptions;
236
+ customMarkdownIt?: (md: MarkdownIt) => MarkdownIt;
237
+ /** Log parse/render timing stats (dev only). */
238
+ debugPerformance?: boolean;
239
+ /**
240
+ * Custom HTML-like tags that should be emitted as custom nodes (e.g. ['thinking']).
241
+ * Forwarded to `getMarkdown()` and merged into parseOptions.
242
+ */
243
+ customHtmlTags?: readonly string[];
244
+ viewportPriority?: boolean;
245
+ codeBlockStream?: boolean;
246
+ codeBlockDarkTheme?: CodeBlockMonacoTheme;
247
+ codeBlockLightTheme?: CodeBlockMonacoTheme;
248
+ codeBlockMonacoOptions?: CodeBlockMonacoOptions;
249
+ renderCodeBlocksAsPre?: boolean;
250
+ codeBlockMinWidth?: string | number;
251
+ codeBlockMaxWidth?: string | number;
252
+ codeBlockProps?: Record<string, any>;
253
+ mermaidProps?: Partial<Omit<MermaidBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
254
+ d2Props?: Partial<Omit<D2BlockNodeProps, 'node' | 'loading' | 'isDark'>>;
255
+ infographicProps?: Partial<Omit<InfographicBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
256
+ showTooltips?: boolean;
257
+ themes?: CodeBlockMonacoTheme[];
258
+ isDark?: boolean;
259
+ customId?: string;
260
+ indexKey?: number | string;
261
+ typewriter?: boolean;
262
+ batchRendering?: boolean;
263
+ initialRenderBatchSize?: number;
264
+ renderBatchSize?: number;
265
+ renderBatchDelay?: number;
266
+ renderBatchBudgetMs?: number;
267
+ renderBatchIdleTimeoutMs?: number;
268
+ deferNodesUntilVisible?: boolean;
269
+ maxLiveNodes?: number;
270
+ liveNodeBuffer?: number;
271
+ onCopy?: (code: string) => void;
272
+ onHandleArtifactClick?: (payload: any) => void;
273
+ onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
274
+ onMouseOver?: (event: React.MouseEvent<HTMLElement>) => void;
275
+ onMouseOut?: (event: React.MouseEvent<HTMLElement>) => void;
276
+ }
277
+ interface RenderContext {
278
+ customId?: string;
279
+ isDark?: boolean;
280
+ indexKey?: string;
281
+ typewriter?: boolean;
282
+ textStreamState?: Map<string, string>;
283
+ streamRenderVersion?: number;
284
+ customComponents?: Record<string, React.ComponentType<any>>;
285
+ codeBlockProps?: Record<string, any>;
286
+ mermaidProps?: Partial<Omit<MermaidBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
287
+ d2Props?: Partial<Omit<D2BlockNodeProps, 'node' | 'loading' | 'isDark'>>;
288
+ infographicProps?: Partial<Omit<InfographicBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
289
+ showTooltips?: boolean;
290
+ codeBlockStream?: boolean;
291
+ renderCodeBlocksAsPre?: boolean;
292
+ codeBlockThemes?: {
293
+ themes?: CodeBlockMonacoTheme[];
294
+ darkTheme?: CodeBlockMonacoTheme;
295
+ lightTheme?: CodeBlockMonacoTheme;
296
+ monacoOptions?: CodeBlockMonacoOptions;
297
+ minWidth?: string | number;
298
+ maxWidth?: string | number;
299
+ };
300
+ events: {
301
+ onCopy?: (code: string) => void;
302
+ onHandleArtifactClick?: (payload: any) => void;
303
+ };
304
+ }
305
+ type RenderNodeFn = (node: ParsedNode, key: React.Key, ctx: RenderContext) => React.ReactNode;
306
+
307
+ interface MarkdownCodeBlockNodeProps {
308
+ node: {
309
+ type: 'code_block';
310
+ language: string;
311
+ code: string;
312
+ raw: string;
313
+ diff?: boolean;
314
+ originalCode?: string;
315
+ updatedCode?: string;
316
+ };
317
+ loading?: boolean;
318
+ stream?: boolean;
319
+ darkTheme?: string;
320
+ lightTheme?: string;
321
+ isDark?: boolean;
322
+ isShowPreview?: boolean;
323
+ enableFontSizeControl?: boolean;
324
+ minWidth?: string | number;
325
+ maxWidth?: string | number;
326
+ themes?: string[];
327
+ showHeader?: boolean;
328
+ showCopyButton?: boolean;
329
+ showExpandButton?: boolean;
330
+ showPreviewButton?: boolean;
331
+ showCollapseButton?: boolean;
332
+ showFontSizeButtons?: boolean;
333
+ showTooltips?: boolean;
334
+ onCopy?: (code: string) => void;
335
+ onPreviewCode?: (payload: {
336
+ type: string;
337
+ content: string;
338
+ title: string;
339
+ }) => void;
340
+ }
341
+
342
+ interface NodeComponentProps<TNode = unknown> {
343
+ node: TNode;
344
+ ctx?: RenderContext;
345
+ renderNode?: RenderNodeFn;
346
+ indexKey?: React.Key;
347
+ customId?: string;
348
+ isDark?: boolean;
349
+ typewriter?: boolean;
350
+ children?: React.ReactNode;
351
+ }
352
+
353
+ interface LinkNodeStyleProps {
354
+ showTooltip?: boolean;
355
+ color?: string;
356
+ underlineHeight?: number;
357
+ underlineBottom?: number | string;
358
+ animationDuration?: number;
359
+ animationOpacity?: number;
360
+ animationTiming?: string;
361
+ animationIteration?: string | number;
362
+ }
363
+
364
+ interface HtmlPreviewFrameProps {
365
+ code: string;
366
+ isDark?: boolean;
367
+ onClose?: () => void;
368
+ title?: string;
369
+ }
370
+
371
+ type D2Loader = () => Promise<any> | any;
372
+ declare function setD2Loader(loader: D2Loader | null): void;
373
+ declare function enableD2(loader?: D2Loader): void;
374
+ declare function disableD2(): void;
375
+ declare function isD2Enabled(): boolean;
376
+ declare function getD2(): Promise<any>;
377
+
378
+ type CustomComponentMap = Record<string, ComponentType<any>>;
379
+ declare function setCustomComponents(id: string, mapping: CustomComponentMap): void;
380
+ declare function setCustomComponents(mapping: CustomComponentMap): void;
381
+ declare function getCustomNodeComponents(customId?: string): CustomComponentMap;
382
+ declare function removeCustomComponents(id: string): void;
383
+ declare function clearGlobalCustomComponents(): void;
384
+
385
+ interface ListItemNodeData {
386
+ type: 'list_item';
387
+ children?: ParsedNode[];
388
+ raw?: string;
389
+ }
390
+ interface ListItemNodeProps extends NodeComponentProps<ListItemNodeData> {
391
+ value?: number;
392
+ }
393
+
394
+ declare const defaultMap: Record<string, string>;
395
+ /**
396
+ * Replace the entire default translation map.
397
+ * Consumers can call this to provide their own fallback translations (e.g. Chinese).
398
+ */
399
+ declare function setDefaultI18nMap(map: Record<keyof typeof defaultMap, string>): void;
400
+ declare function useSafeI18n(): {
401
+ t: (key: string) => string;
402
+ };
403
+
404
+ declare function renderNode(node: ParsedNode, key: React.Key, ctx: RenderContext): react_jsx_runtime.JSX.Element;
405
+
406
+ type LanguageIconResolver = (lang: string) => string | undefined | null;
407
+ declare function setLanguageIconResolver(resolver?: LanguageIconResolver | null): void;
408
+ declare function normalizeLanguageIdentifier(lang?: string | null): string;
409
+ declare function resolveMonacoLanguageId(lang?: string | null): string;
410
+ declare function preloadExtendedLanguageIcons(): Promise<void>;
411
+ declare function subscribeLanguageIconsRevision(listener: () => void): () => void;
412
+ declare function getLanguageIcon(lang: string): string;
413
+ declare const languageMap: Record<string, string>;
414
+
415
+ declare function setKaTeXWorker(w: Worker): void;
416
+ declare function clearKaTeXWorker(): void;
417
+ declare function setKaTeXWorkerDebug(enabled: boolean): void;
418
+ declare const WORKER_BUSY_CODE = "WORKER_BUSY";
419
+ declare function renderKaTeXInWorker(content: string, displayMode?: boolean, timeout?: number, signal?: AbortSignal): Promise<string>;
420
+ declare function setKaTeXCache(content: string, displayMode: boolean, html: string): void;
421
+ declare function clearKaTeXCache(): void;
422
+ declare function setKaTeXConcurrencyLimit(limit: number): void;
423
+ declare function waitForKaTeXWorkerSlot(timeout?: number, signal?: AbortSignal): Promise<void>;
424
+ interface BackpressureOptions {
425
+ timeout?: number;
426
+ waitTimeout?: number;
427
+ backoffMs?: number;
428
+ maxRetries?: number;
429
+ signal?: AbortSignal;
430
+ }
431
+ declare const defaultBackpressure: {
432
+ timeout: number;
433
+ waitTimeout: number;
434
+ backoffMs: number;
435
+ maxRetries: number;
436
+ };
437
+ declare function setKaTeXBackpressureDefaults(opts: Partial<typeof defaultBackpressure>): void;
438
+ declare function getKaTeXBackpressureDefaults(): {
439
+ timeout: number;
440
+ waitTimeout: number;
441
+ backoffMs: number;
442
+ maxRetries: number;
443
+ };
444
+ declare function renderKaTeXWithBackpressure(content: string, displayMode?: boolean, opts?: BackpressureOptions): Promise<string>;
445
+
446
+ type Theme = 'light' | 'dark';
447
+ declare function setMermaidWorkerClientDebug(enabled: boolean): void;
448
+ declare function setMermaidWorkerMaxConcurrency(n: number): void;
449
+ declare function getMermaidWorkerLoad(): {
450
+ inFlight: number;
451
+ max: number;
452
+ };
453
+ declare const MERMAID_WORKER_BUSY_CODE = "WORKER_BUSY";
454
+ declare function setMermaidWorker(w: Worker): void;
455
+ declare function clearMermaidWorker(): void;
456
+ declare function canParseOffthread(code: string, theme: Theme, timeout?: number): Promise<boolean>;
457
+ declare function findPrefixOffthread(code: string, theme: Theme, timeout?: number): Promise<string>;
458
+ declare function terminateWorker(): void;
459
+
460
+ declare const AdmonitionNode: {
461
+ (props: NodeComponentProps<{
462
+ type: "admonition";
463
+ kind?: string;
464
+ title?: string;
465
+ children?: stream_markdown_parser.ParsedNode[];
466
+ collapsible?: boolean;
467
+ open?: boolean;
468
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
469
+ displayName: string;
470
+ };
471
+ declare const BlockquoteNode: {
472
+ (props: NodeComponentProps<{
473
+ type: "blockquote";
474
+ children?: stream_markdown_parser.ParsedNode[];
475
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
476
+ displayName: string;
477
+ };
478
+ declare const CheckboxNode: {
479
+ (props: NodeComponentProps<{
480
+ type: "checkbox" | "checkbox_input";
481
+ checked?: boolean;
482
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
483
+ displayName: string;
484
+ };
485
+ declare const CodeBlockNode: {
486
+ (props: CodeBlockNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
487
+ displayName: string;
488
+ };
489
+ declare const ReactCodeBlockNode: {
490
+ (props: CodeBlockNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
491
+ displayName: string;
492
+ };
493
+ declare const HtmlPreviewFrame: {
494
+ (props: HtmlPreviewFrameProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
495
+ displayName: string;
496
+ };
497
+ declare const D2BlockNode: {
498
+ (props: D2BlockNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
499
+ displayName: string;
500
+ };
501
+ declare const DefinitionListNode: {
502
+ (props: NodeComponentProps<{
503
+ type: "definition_list";
504
+ items?: any[];
505
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
506
+ displayName: string;
507
+ };
508
+ declare const EmojiNode: {
509
+ (props: NodeComponentProps<{
510
+ type: "emoji";
511
+ name: string;
512
+ markup?: string;
513
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
514
+ displayName: string;
515
+ };
516
+ declare const EmphasisNode: {
517
+ (props: NodeComponentProps<{
518
+ type: "emphasis";
519
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
520
+ displayName: string;
521
+ };
522
+ declare const FootnoteAnchorNode: {
523
+ (props: NodeComponentProps<{
524
+ type: "footnote_anchor";
525
+ id: string;
526
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
527
+ displayName: string;
528
+ };
529
+ declare const FootnoteNode: {
530
+ (props: NodeComponentProps<{
531
+ type: "footnote";
532
+ id: string;
533
+ children?: stream_markdown_parser.ParsedNode[];
534
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
535
+ displayName: string;
536
+ };
537
+ declare const FootnoteReferenceNode: {
538
+ (props: NodeComponentProps<{
539
+ type: "footnote_reference";
540
+ id: string;
541
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
542
+ displayName: string;
543
+ };
544
+ declare const HardBreakNode: {
545
+ (props: NodeComponentProps<{
546
+ type: "hardbreak";
547
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
548
+ displayName: string;
549
+ };
550
+ declare const HeadingNode: {
551
+ (props: NodeComponentProps<{
552
+ type: "heading";
553
+ level?: number;
554
+ children?: stream_markdown_parser.ParsedNode[];
555
+ attrs?: Record<string, string | boolean>;
556
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
557
+ displayName: string;
558
+ };
559
+ declare const HighlightNode: {
560
+ (props: NodeComponentProps<{
561
+ type: "highlight";
562
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
563
+ displayName: string;
564
+ };
565
+ declare const HtmlBlockNode: {
566
+ (props: NodeComponentProps<{
567
+ type: "html_block";
568
+ content?: string;
569
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
570
+ displayName: string;
571
+ };
572
+ declare const HtmlInlineNode: {
573
+ (props: NodeComponentProps<{
574
+ type: "html_inline";
575
+ content?: string;
576
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
577
+ displayName: string;
578
+ };
579
+ declare const ImageNode: {
580
+ (props: ImageNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
581
+ displayName: string;
582
+ };
583
+ declare const InfographicBlockNode: {
584
+ (props: InfographicBlockNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
585
+ displayName: string;
586
+ };
587
+ declare const InlineCodeNode: {
588
+ (props: NodeComponentProps<{
589
+ type: "inline_code";
590
+ code: string;
591
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
592
+ displayName: string;
593
+ };
594
+ declare const InsertNode: {
595
+ (props: NodeComponentProps<{
596
+ type: "insert";
597
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
598
+ displayName: string;
599
+ };
600
+ declare const LinkNode: {
601
+ (props: NodeComponentProps<{
602
+ type: "link";
603
+ href: string;
604
+ title: string | null;
605
+ text: string;
606
+ children?: stream_markdown_parser.ParsedNode[];
607
+ loading?: boolean;
608
+ }> & LinkNodeStyleProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
609
+ displayName: string;
610
+ };
611
+ declare const ListItemNode: {
612
+ (props: NodeComponentProps<{
613
+ type: "list_item";
614
+ children?: stream_markdown_parser.ParsedNode[];
615
+ }> & {
616
+ value?: number;
617
+ }): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
618
+ displayName: string;
619
+ };
620
+ declare const ListNode: {
621
+ (props: NodeComponentProps<{
622
+ type: "list";
623
+ ordered?: boolean;
624
+ start?: number;
625
+ items?: any[];
626
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
627
+ displayName: string;
628
+ };
629
+ declare const MarkdownCodeBlockNode: {
630
+ (props: MarkdownCodeBlockNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
631
+ displayName: string;
632
+ };
633
+ declare const MathBlockNode: {
634
+ (props: MathBlockNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
635
+ displayName: string;
636
+ };
637
+ declare const MathInlineNode: {
638
+ (props: MathInlineNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
639
+ displayName: string;
640
+ };
641
+ declare const MermaidBlockNode: {
642
+ (props: MermaidBlockNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
643
+ displayName: string;
644
+ };
645
+ declare const NodeRenderer: {
646
+ (props: NodeRendererProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
647
+ displayName: string;
648
+ };
649
+ declare const FallbackComponent: {
650
+ (props: NodeComponentProps<{
651
+ type: string;
652
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
653
+ displayName: string;
654
+ };
655
+ declare const ParagraphNode: {
656
+ (props: NodeComponentProps<{
657
+ type: "paragraph";
658
+ children?: stream_markdown_parser.ParsedNode[];
659
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
660
+ displayName: string;
661
+ };
662
+ declare const PreCodeNode: {
663
+ (props: PreCodeNodeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
664
+ displayName: string;
665
+ };
666
+ declare const ReferenceNode: {
667
+ (props: NodeComponentProps<{
668
+ type: "reference";
669
+ id: string;
670
+ }> & {
671
+ messageId?: string;
672
+ threadId?: string;
673
+ }): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
674
+ displayName: string;
675
+ };
676
+ declare const StrikethroughNode: {
677
+ (props: NodeComponentProps<{
678
+ type: "strikethrough";
679
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
680
+ displayName: string;
681
+ };
682
+ declare const StrongNode: {
683
+ (props: NodeComponentProps<{
684
+ type: "strong";
685
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
686
+ displayName: string;
687
+ };
688
+ declare const SubscriptNode: {
689
+ (props: NodeComponentProps<{
690
+ type: "subscript";
691
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
692
+ displayName: string;
693
+ };
694
+ declare const SuperscriptNode: {
695
+ (props: NodeComponentProps<{
696
+ type: "superscript";
697
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
698
+ displayName: string;
699
+ };
700
+ declare const TableNode: {
701
+ (props: NodeComponentProps<{
702
+ type: "table";
703
+ header?: any;
704
+ rows?: any[];
705
+ loading?: boolean;
706
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
707
+ displayName: string;
708
+ };
709
+ declare const TextNode: {
710
+ (props: NodeComponentProps<{
711
+ type: "text";
712
+ content: string;
713
+ center?: boolean;
714
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
715
+ displayName: string;
716
+ };
717
+ declare const ThematicBreakNode: {
718
+ (props: NodeComponentProps<{
719
+ type: "thematic_break";
720
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
721
+ displayName: string;
722
+ };
723
+ declare const Tooltip: {
724
+ (props: TooltipProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
725
+ displayName: string;
726
+ };
727
+ declare const VmrContainerNode: {
728
+ (props: NodeComponentProps<{
729
+ type: "vmr_container";
730
+ name: string;
731
+ attrs?: Record<string, string> | [string, string | null][] | null;
732
+ children?: stream_markdown_parser.ParsedNode[];
733
+ }>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
734
+ displayName: string;
735
+ };
736
+
737
+ export { AdmonitionNode, BackpressureOptions, BlockquoteNode, CheckboxNode, CodeBlockDiffAppearance, CodeBlockDiffHideUnchangedRegions, CodeBlockDiffHideUnchangedRegionsOptions, CodeBlockDiffHunkActionContext, CodeBlockDiffHunkActionKind, CodeBlockDiffHunkSide, CodeBlockDiffLineStyle, CodeBlockDiffUnchangedRegionStyle, CodeBlockMonacoLanguage, CodeBlockMonacoOptions, CodeBlockMonacoTheme, CodeBlockMonacoThemeObject, CodeBlockNode, CodeBlockNodeProps, D2BlockNode, D2BlockNodeProps, D2Loader, DefinitionListNode, EmojiNode, EmphasisNode, FallbackComponent, FootnoteAnchorNode, FootnoteNode, FootnoteReferenceNode, HardBreakNode, HeadingNode, HighlightNode, HtmlBlockNode, HtmlInlineNode, HtmlPreviewFrame, HtmlPreviewFrameProps, ImageNode, ImageNodeProps, InfographicBlockNode, InfographicBlockNodeProps, InlineCodeNode, InsertNode, LanguageIconResolver, LinkNode, LinkNodeProps, LinkNodeStyleProps, ListItemNode, ListItemNodeProps, ListNode, MERMAID_WORKER_BUSY_CODE, MarkdownCodeBlockNode, MarkdownCodeBlockNodeProps, MathBlockNode, MathBlockNodeProps, MathInlineNode, MathInlineNodeProps, MermaidBlockEvent, MermaidBlockNode, MermaidBlockNodeProps, NodeComponentProps, NodeRenderer, NodeRendererProps, ParagraphNode, PreCodeNode, PreCodeNodeProps, ReactCodeBlockNode, ReferenceNode, StrikethroughNode, StrongNode, SubscriptNode, SuperscriptNode, TableNode, TextNode, ThematicBreakNode, Tooltip, TooltipPlacement, TooltipProps, VmrContainerNode, WORKER_BUSY_CODE, canParseOffthread, clearGlobalCustomComponents, clearKaTeXCache, clearKaTeXWorker, clearMermaidWorker, NodeRenderer as default, disableD2, enableD2, findPrefixOffthread, getCustomNodeComponents, getD2, getKaTeXBackpressureDefaults, getLanguageIcon, getMermaidWorkerLoad, isD2Enabled, languageMap, normalizeLanguageIdentifier, preloadExtendedLanguageIcons, removeCustomComponents, renderKaTeXInWorker, renderKaTeXWithBackpressure, renderNode, resolveMonacoLanguageId, setCustomComponents, setD2Loader, setDefaultI18nMap, setKaTeXBackpressureDefaults, setKaTeXCache, setKaTeXConcurrencyLimit, setKaTeXWorker, setKaTeXWorkerDebug, setLanguageIconResolver, setMermaidWorker, setMermaidWorkerClientDebug, setMermaidWorkerMaxConcurrency, subscribeLanguageIconsRevision, terminateWorker, useSafeI18n, waitForKaTeXWorkerSlot };