markstream-react 0.0.14 → 0.0.16
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.
- package/dist/index.css +1 -1
- package/dist/index.d.ts +585 -0
- package/dist/index.js +23 -23
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/package.json +8 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { BaseNode, ParseOptions, MarkdownIt, ParsedNode } from 'stream-markdown-parser';
|
|
3
|
+
import React, { ComponentType } from 'react';
|
|
4
|
+
|
|
5
|
+
interface NodeRendererProps {
|
|
6
|
+
content?: string;
|
|
7
|
+
nodes?: BaseNode[];
|
|
8
|
+
/**
|
|
9
|
+
* Whether the input stream is complete (end-of-stream). When true, the parser
|
|
10
|
+
* can stop emitting streaming "loading" nodes for unfinished constructs.
|
|
11
|
+
*/
|
|
12
|
+
final?: boolean;
|
|
13
|
+
parseOptions?: ParseOptions;
|
|
14
|
+
customMarkdownIt?: (md: MarkdownIt) => MarkdownIt;
|
|
15
|
+
/** Log parse/render timing stats (dev only). */
|
|
16
|
+
debugPerformance?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Custom HTML-like tags that should be emitted as custom nodes (e.g. ['thinking']).
|
|
19
|
+
* Forwarded to `getMarkdown()` and merged into parseOptions.
|
|
20
|
+
*/
|
|
21
|
+
customHtmlTags?: readonly string[];
|
|
22
|
+
viewportPriority?: boolean;
|
|
23
|
+
codeBlockStream?: boolean;
|
|
24
|
+
codeBlockDarkTheme?: any;
|
|
25
|
+
codeBlockLightTheme?: any;
|
|
26
|
+
codeBlockMonacoOptions?: Record<string, any>;
|
|
27
|
+
renderCodeBlocksAsPre?: boolean;
|
|
28
|
+
codeBlockMinWidth?: string | number;
|
|
29
|
+
codeBlockMaxWidth?: string | number;
|
|
30
|
+
codeBlockProps?: Record<string, any>;
|
|
31
|
+
themes?: string[];
|
|
32
|
+
isDark?: boolean;
|
|
33
|
+
customId?: string;
|
|
34
|
+
indexKey?: number | string;
|
|
35
|
+
typewriter?: boolean;
|
|
36
|
+
batchRendering?: boolean;
|
|
37
|
+
initialRenderBatchSize?: number;
|
|
38
|
+
renderBatchSize?: number;
|
|
39
|
+
renderBatchDelay?: number;
|
|
40
|
+
renderBatchBudgetMs?: number;
|
|
41
|
+
renderBatchIdleTimeoutMs?: number;
|
|
42
|
+
deferNodesUntilVisible?: boolean;
|
|
43
|
+
maxLiveNodes?: number;
|
|
44
|
+
liveNodeBuffer?: number;
|
|
45
|
+
onCopy?: (code: string) => void;
|
|
46
|
+
onHandleArtifactClick?: (payload: any) => void;
|
|
47
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
48
|
+
onMouseOver?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
49
|
+
onMouseOut?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
50
|
+
}
|
|
51
|
+
interface RenderContext {
|
|
52
|
+
customId?: string;
|
|
53
|
+
isDark?: boolean;
|
|
54
|
+
indexKey?: string;
|
|
55
|
+
typewriter?: boolean;
|
|
56
|
+
codeBlockProps?: Record<string, any>;
|
|
57
|
+
codeBlockStream?: boolean;
|
|
58
|
+
renderCodeBlocksAsPre?: boolean;
|
|
59
|
+
codeBlockThemes?: {
|
|
60
|
+
themes?: string[];
|
|
61
|
+
darkTheme?: any;
|
|
62
|
+
lightTheme?: any;
|
|
63
|
+
monacoOptions?: Record<string, any>;
|
|
64
|
+
minWidth?: string | number;
|
|
65
|
+
maxWidth?: string | number;
|
|
66
|
+
};
|
|
67
|
+
events: {
|
|
68
|
+
onCopy?: (code: string) => void;
|
|
69
|
+
onHandleArtifactClick?: (payload: any) => void;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
type RenderNodeFn = (node: ParsedNode, key: React.Key, ctx: RenderContext) => React.ReactNode;
|
|
73
|
+
|
|
74
|
+
interface NodeComponentProps<TNode = unknown> {
|
|
75
|
+
node: TNode;
|
|
76
|
+
ctx?: RenderContext;
|
|
77
|
+
renderNode?: RenderNodeFn;
|
|
78
|
+
indexKey?: React.Key;
|
|
79
|
+
customId?: string;
|
|
80
|
+
isDark?: boolean;
|
|
81
|
+
typewriter?: boolean;
|
|
82
|
+
children?: React.ReactNode;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
declare function AdmonitionNode(props: NodeComponentProps<{
|
|
86
|
+
type: 'admonition';
|
|
87
|
+
kind?: string;
|
|
88
|
+
title?: string;
|
|
89
|
+
children?: ParsedNode[];
|
|
90
|
+
collapsible?: boolean;
|
|
91
|
+
open?: boolean;
|
|
92
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
93
|
+
|
|
94
|
+
declare function BlockquoteNode(props: NodeComponentProps<{
|
|
95
|
+
type: 'blockquote';
|
|
96
|
+
children?: ParsedNode[];
|
|
97
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
98
|
+
|
|
99
|
+
declare function CheckboxNode(props: NodeComponentProps<{
|
|
100
|
+
type: 'checkbox' | 'checkbox_input';
|
|
101
|
+
checked?: boolean;
|
|
102
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
103
|
+
|
|
104
|
+
interface CodeBlockNodeProps {
|
|
105
|
+
node: {
|
|
106
|
+
type: 'code_block';
|
|
107
|
+
language: string;
|
|
108
|
+
code: string;
|
|
109
|
+
raw: string;
|
|
110
|
+
diff?: boolean;
|
|
111
|
+
originalCode?: string;
|
|
112
|
+
updatedCode?: string;
|
|
113
|
+
};
|
|
114
|
+
isDark?: boolean;
|
|
115
|
+
loading?: boolean;
|
|
116
|
+
stream?: boolean;
|
|
117
|
+
darkTheme?: any;
|
|
118
|
+
lightTheme?: any;
|
|
119
|
+
isShowPreview?: boolean;
|
|
120
|
+
monacoOptions?: {
|
|
121
|
+
[k: string]: any;
|
|
122
|
+
};
|
|
123
|
+
enableFontSizeControl?: boolean;
|
|
124
|
+
minWidth?: string | number;
|
|
125
|
+
maxWidth?: string | number;
|
|
126
|
+
themes?: any[];
|
|
127
|
+
showHeader?: boolean;
|
|
128
|
+
showCopyButton?: boolean;
|
|
129
|
+
showExpandButton?: boolean;
|
|
130
|
+
showPreviewButton?: boolean;
|
|
131
|
+
showFontSizeButtons?: boolean;
|
|
132
|
+
customId?: string;
|
|
133
|
+
}
|
|
134
|
+
interface ImageNodeProps {
|
|
135
|
+
node: {
|
|
136
|
+
type: 'image';
|
|
137
|
+
src: string;
|
|
138
|
+
alt: string;
|
|
139
|
+
title: string | null;
|
|
140
|
+
raw: string;
|
|
141
|
+
loading?: boolean;
|
|
142
|
+
};
|
|
143
|
+
fallbackSrc?: string;
|
|
144
|
+
showCaption?: boolean;
|
|
145
|
+
lazy?: boolean;
|
|
146
|
+
svgMinHeight?: string;
|
|
147
|
+
usePlaceholder?: boolean;
|
|
148
|
+
}
|
|
149
|
+
interface LinkNodeProps {
|
|
150
|
+
node: {
|
|
151
|
+
type: 'link';
|
|
152
|
+
href: string;
|
|
153
|
+
title: string | null;
|
|
154
|
+
text: string;
|
|
155
|
+
children: {
|
|
156
|
+
type: string;
|
|
157
|
+
raw: string;
|
|
158
|
+
}[];
|
|
159
|
+
raw: string;
|
|
160
|
+
loading?: boolean;
|
|
161
|
+
};
|
|
162
|
+
indexKey: number | string;
|
|
163
|
+
customId?: string;
|
|
164
|
+
showTooltip?: boolean;
|
|
165
|
+
color?: string;
|
|
166
|
+
underlineHeight?: number;
|
|
167
|
+
underlineBottom?: number | string;
|
|
168
|
+
animationDuration?: number;
|
|
169
|
+
animationOpacity?: number;
|
|
170
|
+
animationTiming?: string;
|
|
171
|
+
animationIteration?: string | number;
|
|
172
|
+
}
|
|
173
|
+
interface PreCodeNodeProps {
|
|
174
|
+
node: any;
|
|
175
|
+
}
|
|
176
|
+
interface MermaidBlockNodeProps {
|
|
177
|
+
node: any;
|
|
178
|
+
maxHeight?: string | null;
|
|
179
|
+
loading?: boolean;
|
|
180
|
+
isDark?: boolean;
|
|
181
|
+
workerTimeoutMs?: number;
|
|
182
|
+
parseTimeoutMs?: number;
|
|
183
|
+
renderTimeoutMs?: number;
|
|
184
|
+
fullRenderTimeoutMs?: number;
|
|
185
|
+
showHeader?: boolean;
|
|
186
|
+
showModeToggle?: boolean;
|
|
187
|
+
showCopyButton?: boolean;
|
|
188
|
+
showExportButton?: boolean;
|
|
189
|
+
showFullscreenButton?: boolean;
|
|
190
|
+
showCollapseButton?: boolean;
|
|
191
|
+
showZoomControls?: boolean;
|
|
192
|
+
enableWheelZoom?: boolean;
|
|
193
|
+
isStrict?: boolean;
|
|
194
|
+
}
|
|
195
|
+
interface MermaidBlockEvent<TPayload = any> {
|
|
196
|
+
payload?: TPayload;
|
|
197
|
+
defaultPrevented: boolean;
|
|
198
|
+
preventDefault: () => void;
|
|
199
|
+
svgElement?: SVGElement | null;
|
|
200
|
+
svgString?: string | null;
|
|
201
|
+
}
|
|
202
|
+
interface MathBlockNodeProps {
|
|
203
|
+
node: {
|
|
204
|
+
type: 'math_block';
|
|
205
|
+
content: string;
|
|
206
|
+
raw: string;
|
|
207
|
+
loading?: boolean;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
interface MathInlineNodeProps {
|
|
211
|
+
node: {
|
|
212
|
+
type: 'math_inline';
|
|
213
|
+
content: string;
|
|
214
|
+
raw: string;
|
|
215
|
+
loading?: boolean;
|
|
216
|
+
markup?: string;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
interface InfographicBlockNodeProps {
|
|
220
|
+
node: any;
|
|
221
|
+
maxHeight?: string | null;
|
|
222
|
+
loading?: boolean;
|
|
223
|
+
isDark?: boolean;
|
|
224
|
+
showHeader?: boolean;
|
|
225
|
+
showModeToggle?: boolean;
|
|
226
|
+
showCopyButton?: boolean;
|
|
227
|
+
showExportButton?: boolean;
|
|
228
|
+
showFullscreenButton?: boolean;
|
|
229
|
+
showCollapseButton?: boolean;
|
|
230
|
+
showZoomControls?: boolean;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
interface CodeBlockPreviewPayload {
|
|
234
|
+
node: CodeBlockNodeProps['node'];
|
|
235
|
+
artifactType: 'text/html' | 'image/svg+xml';
|
|
236
|
+
artifactTitle: string;
|
|
237
|
+
id: string;
|
|
238
|
+
}
|
|
239
|
+
interface CodeBlockNodeReactEvents {
|
|
240
|
+
onCopy?: (code: string) => void;
|
|
241
|
+
onPreviewCode?: (payload: CodeBlockPreviewPayload) => void;
|
|
242
|
+
}
|
|
243
|
+
declare function CodeBlockNode(rawProps: CodeBlockNodeProps & CodeBlockNodeReactEvents): react_jsx_runtime.JSX.Element;
|
|
244
|
+
|
|
245
|
+
interface HtmlPreviewFrameProps {
|
|
246
|
+
code: string;
|
|
247
|
+
isDark?: boolean;
|
|
248
|
+
onClose?: () => void;
|
|
249
|
+
title?: string;
|
|
250
|
+
}
|
|
251
|
+
declare function HtmlPreviewFrame(props: HtmlPreviewFrameProps): React.ReactPortal;
|
|
252
|
+
|
|
253
|
+
declare function DefinitionListNode(props: NodeComponentProps<{
|
|
254
|
+
type: 'definition_list';
|
|
255
|
+
items?: any[];
|
|
256
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
257
|
+
|
|
258
|
+
declare function EmojiNode(props: NodeComponentProps<{
|
|
259
|
+
type: 'emoji';
|
|
260
|
+
name: string;
|
|
261
|
+
markup?: string;
|
|
262
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
263
|
+
|
|
264
|
+
declare function EmphasisNode(props: NodeComponentProps<{
|
|
265
|
+
type: 'emphasis';
|
|
266
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
267
|
+
|
|
268
|
+
declare function FootnoteAnchorNode(props: NodeComponentProps<{
|
|
269
|
+
type: 'footnote_anchor';
|
|
270
|
+
id: string;
|
|
271
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
272
|
+
|
|
273
|
+
declare function FootnoteNode(props: NodeComponentProps<{
|
|
274
|
+
type: 'footnote';
|
|
275
|
+
id: string;
|
|
276
|
+
children?: ParsedNode[];
|
|
277
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
278
|
+
|
|
279
|
+
declare function FootnoteReferenceNode(props: NodeComponentProps<{
|
|
280
|
+
type: 'footnote_reference';
|
|
281
|
+
id: string;
|
|
282
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
283
|
+
|
|
284
|
+
declare function HardBreakNode(_props: NodeComponentProps<{
|
|
285
|
+
type: 'hardbreak';
|
|
286
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
287
|
+
|
|
288
|
+
declare function HeadingNode(props: NodeComponentProps<{
|
|
289
|
+
type: 'heading';
|
|
290
|
+
level?: number;
|
|
291
|
+
children?: ParsedNode[];
|
|
292
|
+
attrs?: Record<string, string | boolean>;
|
|
293
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
294
|
+
|
|
295
|
+
declare function HighlightNode(props: NodeComponentProps<{
|
|
296
|
+
type: 'highlight';
|
|
297
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
298
|
+
|
|
299
|
+
declare function HtmlBlockNode(props: NodeComponentProps<{
|
|
300
|
+
type: 'html_block';
|
|
301
|
+
content: string;
|
|
302
|
+
attrs?: [string, string | null][] | null;
|
|
303
|
+
loading?: boolean;
|
|
304
|
+
}> & {
|
|
305
|
+
customComponents?: Record<string, React.ComponentType<any>>;
|
|
306
|
+
placeholder?: React.ReactNode;
|
|
307
|
+
}): react_jsx_runtime.JSX.Element;
|
|
308
|
+
|
|
309
|
+
declare function HtmlInlineNode(props: NodeComponentProps<{
|
|
310
|
+
type: 'html_inline';
|
|
311
|
+
content: string;
|
|
312
|
+
loading?: boolean;
|
|
313
|
+
autoClosed?: boolean;
|
|
314
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
315
|
+
|
|
316
|
+
interface ImageNodeReactEvents {
|
|
317
|
+
onLoad?: (src: string) => void;
|
|
318
|
+
onError?: (src: string) => void;
|
|
319
|
+
onClick?: (payload: [event: React.MouseEvent<HTMLImageElement>, src: string]) => void;
|
|
320
|
+
}
|
|
321
|
+
declare function ImageNode(rawProps: ImageNodeProps & ImageNodeReactEvents): react_jsx_runtime.JSX.Element;
|
|
322
|
+
|
|
323
|
+
interface InfographicBlockNodeReactEvents {
|
|
324
|
+
onCopy?: (code: string) => void;
|
|
325
|
+
onExport?: (event: MermaidBlockEvent<{
|
|
326
|
+
type: 'export';
|
|
327
|
+
}>) => void;
|
|
328
|
+
onOpenModal?: (event: MermaidBlockEvent<{
|
|
329
|
+
type: 'open-modal';
|
|
330
|
+
}>) => void;
|
|
331
|
+
onToggleMode?: (target: 'preview' | 'source', event: MermaidBlockEvent<{
|
|
332
|
+
type: 'toggle-mode';
|
|
333
|
+
target: 'preview' | 'source';
|
|
334
|
+
}>) => void;
|
|
335
|
+
}
|
|
336
|
+
declare function InfographicBlockNode(rawProps: InfographicBlockNodeProps & InfographicBlockNodeReactEvents): react_jsx_runtime.JSX.Element;
|
|
337
|
+
|
|
338
|
+
declare function InlineCodeNode(props: NodeComponentProps<{
|
|
339
|
+
type: 'inline_code';
|
|
340
|
+
code: string;
|
|
341
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
342
|
+
|
|
343
|
+
declare function InsertNode(props: NodeComponentProps<{
|
|
344
|
+
type: 'insert';
|
|
345
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
346
|
+
|
|
347
|
+
interface LinkNodeStyleProps {
|
|
348
|
+
showTooltip?: boolean;
|
|
349
|
+
color?: string;
|
|
350
|
+
underlineHeight?: number;
|
|
351
|
+
underlineBottom?: number | string;
|
|
352
|
+
animationDuration?: number;
|
|
353
|
+
animationOpacity?: number;
|
|
354
|
+
animationTiming?: string;
|
|
355
|
+
animationIteration?: string | number;
|
|
356
|
+
}
|
|
357
|
+
declare function LinkNode(props: NodeComponentProps<{
|
|
358
|
+
type: 'link';
|
|
359
|
+
href: string;
|
|
360
|
+
title: string | null;
|
|
361
|
+
text: string;
|
|
362
|
+
children?: ParsedNode[];
|
|
363
|
+
loading?: boolean;
|
|
364
|
+
}> & LinkNodeStyleProps): react_jsx_runtime.JSX.Element;
|
|
365
|
+
|
|
366
|
+
interface ListItemNodeData {
|
|
367
|
+
type: 'list_item';
|
|
368
|
+
children?: ParsedNode[];
|
|
369
|
+
raw?: string;
|
|
370
|
+
}
|
|
371
|
+
interface ListItemNodeProps extends NodeComponentProps<ListItemNodeData> {
|
|
372
|
+
value?: number;
|
|
373
|
+
}
|
|
374
|
+
declare function ListItemNode(props: ListItemNodeProps): react_jsx_runtime.JSX.Element;
|
|
375
|
+
|
|
376
|
+
declare function ListNode(props: NodeComponentProps<{
|
|
377
|
+
type: 'list';
|
|
378
|
+
ordered?: boolean;
|
|
379
|
+
start?: number;
|
|
380
|
+
items?: any[];
|
|
381
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
382
|
+
|
|
383
|
+
interface MarkdownCodeBlockNodeProps {
|
|
384
|
+
node: {
|
|
385
|
+
type: 'code_block';
|
|
386
|
+
language: string;
|
|
387
|
+
code: string;
|
|
388
|
+
raw: string;
|
|
389
|
+
diff?: boolean;
|
|
390
|
+
originalCode?: string;
|
|
391
|
+
updatedCode?: string;
|
|
392
|
+
};
|
|
393
|
+
loading?: boolean;
|
|
394
|
+
stream?: boolean;
|
|
395
|
+
darkTheme?: string;
|
|
396
|
+
lightTheme?: string;
|
|
397
|
+
isDark?: boolean;
|
|
398
|
+
isShowPreview?: boolean;
|
|
399
|
+
enableFontSizeControl?: boolean;
|
|
400
|
+
minWidth?: string | number;
|
|
401
|
+
maxWidth?: string | number;
|
|
402
|
+
themes?: string[];
|
|
403
|
+
showHeader?: boolean;
|
|
404
|
+
showCopyButton?: boolean;
|
|
405
|
+
showExpandButton?: boolean;
|
|
406
|
+
showPreviewButton?: boolean;
|
|
407
|
+
showFontSizeButtons?: boolean;
|
|
408
|
+
onCopy?: (code: string) => void;
|
|
409
|
+
onPreviewCode?: (payload: {
|
|
410
|
+
type: string;
|
|
411
|
+
content: string;
|
|
412
|
+
title: string;
|
|
413
|
+
}) => void;
|
|
414
|
+
}
|
|
415
|
+
declare function MarkdownCodeBlockNode(rawProps: MarkdownCodeBlockNodeProps): react_jsx_runtime.JSX.Element;
|
|
416
|
+
|
|
417
|
+
declare function MathBlockNode({ node }: MathBlockNodeProps): react_jsx_runtime.JSX.Element;
|
|
418
|
+
|
|
419
|
+
declare function MathInlineNode({ node }: MathInlineNodeProps): react_jsx_runtime.JSX.Element;
|
|
420
|
+
|
|
421
|
+
interface MermaidBlockNodeReactEvents {
|
|
422
|
+
onCopy?: (code: string) => void;
|
|
423
|
+
onExport?: (event: MermaidBlockEvent<{
|
|
424
|
+
type: 'export';
|
|
425
|
+
}>) => void;
|
|
426
|
+
onOpenModal?: (event: MermaidBlockEvent<{
|
|
427
|
+
type: 'open-modal';
|
|
428
|
+
}>) => void;
|
|
429
|
+
onToggleMode?: (target: 'preview' | 'source', event: MermaidBlockEvent<{
|
|
430
|
+
type: 'toggle-mode';
|
|
431
|
+
target: 'preview' | 'source';
|
|
432
|
+
}>) => void;
|
|
433
|
+
}
|
|
434
|
+
declare function MermaidBlockNode(rawProps: MermaidBlockNodeProps & MermaidBlockNodeReactEvents): react_jsx_runtime.JSX.Element;
|
|
435
|
+
|
|
436
|
+
declare const NodeRenderer: React.FC<NodeRendererProps>;
|
|
437
|
+
|
|
438
|
+
declare function FallbackComponent(props: NodeComponentProps<{
|
|
439
|
+
type: string;
|
|
440
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
441
|
+
|
|
442
|
+
declare function ParagraphNode(props: NodeComponentProps<{
|
|
443
|
+
type: 'paragraph';
|
|
444
|
+
children?: ParsedNode[];
|
|
445
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
446
|
+
|
|
447
|
+
declare function PreCodeNode({ node }: PreCodeNodeProps): react_jsx_runtime.JSX.Element;
|
|
448
|
+
|
|
449
|
+
interface ReferenceNodeHandlers {
|
|
450
|
+
onClick?: (event: React.MouseEvent, id: string, messageId?: string, threadId?: string) => void;
|
|
451
|
+
onMouseEnter?: (event: React.MouseEvent, id: string, messageId?: string, threadId?: string) => void;
|
|
452
|
+
onMouseLeave?: (event: React.MouseEvent, id: string, messageId?: string, threadId?: string) => void;
|
|
453
|
+
}
|
|
454
|
+
declare function ReferenceNode(props: NodeComponentProps<{
|
|
455
|
+
type: 'reference';
|
|
456
|
+
id: string;
|
|
457
|
+
}> & {
|
|
458
|
+
messageId?: string;
|
|
459
|
+
threadId?: string;
|
|
460
|
+
} & ReferenceNodeHandlers): react_jsx_runtime.JSX.Element;
|
|
461
|
+
|
|
462
|
+
declare function StrikethroughNode(props: NodeComponentProps<{
|
|
463
|
+
type: 'strikethrough';
|
|
464
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
465
|
+
|
|
466
|
+
declare function StrongNode(props: NodeComponentProps<{
|
|
467
|
+
type: 'strong';
|
|
468
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
469
|
+
|
|
470
|
+
declare function SubscriptNode(props: NodeComponentProps<{
|
|
471
|
+
type: 'subscript';
|
|
472
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
473
|
+
|
|
474
|
+
declare function SuperscriptNode(props: NodeComponentProps<{
|
|
475
|
+
type: 'superscript';
|
|
476
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
477
|
+
|
|
478
|
+
declare function TableNode(props: NodeComponentProps<{
|
|
479
|
+
type: 'table';
|
|
480
|
+
header?: any;
|
|
481
|
+
rows?: any[];
|
|
482
|
+
loading?: boolean;
|
|
483
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
484
|
+
|
|
485
|
+
declare function TextNode(props: NodeComponentProps<{
|
|
486
|
+
type: 'text';
|
|
487
|
+
content: string;
|
|
488
|
+
center?: boolean;
|
|
489
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
490
|
+
|
|
491
|
+
declare function ThematicBreakNode(): react_jsx_runtime.JSX.Element;
|
|
492
|
+
|
|
493
|
+
type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
494
|
+
interface TooltipProps {
|
|
495
|
+
visible: boolean;
|
|
496
|
+
anchorEl: HTMLElement | null;
|
|
497
|
+
content: string;
|
|
498
|
+
placement?: TooltipPlacement;
|
|
499
|
+
offset?: number;
|
|
500
|
+
originX?: number | null;
|
|
501
|
+
originY?: number | null;
|
|
502
|
+
id?: string | null;
|
|
503
|
+
isDark?: boolean | null;
|
|
504
|
+
}
|
|
505
|
+
declare function Tooltip(props: TooltipProps): React.ReactPortal;
|
|
506
|
+
|
|
507
|
+
declare function VmrContainerNode(props: NodeComponentProps<{
|
|
508
|
+
type: 'vmr_container';
|
|
509
|
+
name: string;
|
|
510
|
+
attrs?: Record<string, string> | [string, string | null][] | null;
|
|
511
|
+
children?: ParsedNode[];
|
|
512
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
513
|
+
|
|
514
|
+
type CustomComponentMap = Record<string, ComponentType<any>>;
|
|
515
|
+
declare function setCustomComponents(id: string, mapping: CustomComponentMap): void;
|
|
516
|
+
declare function setCustomComponents(mapping: CustomComponentMap): void;
|
|
517
|
+
declare function getCustomNodeComponents(customId?: string): CustomComponentMap;
|
|
518
|
+
declare function removeCustomComponents(id: string): void;
|
|
519
|
+
declare function clearGlobalCustomComponents(): void;
|
|
520
|
+
|
|
521
|
+
declare const defaultMap: Record<string, string>;
|
|
522
|
+
/**
|
|
523
|
+
* Replace the entire default translation map.
|
|
524
|
+
* Consumers can call this to provide their own fallback translations (e.g. Chinese).
|
|
525
|
+
*/
|
|
526
|
+
declare function setDefaultI18nMap(map: Record<keyof typeof defaultMap, string>): void;
|
|
527
|
+
declare function useSafeI18n(): {
|
|
528
|
+
t: (key: string) => string;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
declare function renderNode(node: ParsedNode, key: React.Key, ctx: RenderContext): react_jsx_runtime.JSX.Element;
|
|
532
|
+
|
|
533
|
+
type LanguageIconResolver = (lang: string) => string | undefined | null;
|
|
534
|
+
declare function setLanguageIconResolver(resolver?: LanguageIconResolver | null): void;
|
|
535
|
+
declare function normalizeLanguageIdentifier(lang?: string | null): string;
|
|
536
|
+
declare function resolveMonacoLanguageId(lang?: string | null): string;
|
|
537
|
+
declare function getLanguageIcon(lang: string): string;
|
|
538
|
+
declare const languageMap: Record<string, string>;
|
|
539
|
+
|
|
540
|
+
declare function setKaTeXWorker(w: Worker): void;
|
|
541
|
+
declare function clearKaTeXWorker(): void;
|
|
542
|
+
declare function setKaTeXWorkerDebug(enabled: boolean): void;
|
|
543
|
+
declare const WORKER_BUSY_CODE = "WORKER_BUSY";
|
|
544
|
+
declare function renderKaTeXInWorker(content: string, displayMode?: boolean, timeout?: number, signal?: AbortSignal): Promise<string>;
|
|
545
|
+
declare function setKaTeXCache(content: string, displayMode: boolean, html: string): void;
|
|
546
|
+
declare function clearKaTeXCache(): void;
|
|
547
|
+
declare function setKaTeXConcurrencyLimit(limit: number): void;
|
|
548
|
+
declare function waitForKaTeXWorkerSlot(timeout?: number, signal?: AbortSignal): Promise<void>;
|
|
549
|
+
interface BackpressureOptions {
|
|
550
|
+
timeout?: number;
|
|
551
|
+
waitTimeout?: number;
|
|
552
|
+
backoffMs?: number;
|
|
553
|
+
maxRetries?: number;
|
|
554
|
+
signal?: AbortSignal;
|
|
555
|
+
}
|
|
556
|
+
declare const defaultBackpressure: {
|
|
557
|
+
timeout: number;
|
|
558
|
+
waitTimeout: number;
|
|
559
|
+
backoffMs: number;
|
|
560
|
+
maxRetries: number;
|
|
561
|
+
};
|
|
562
|
+
declare function setKaTeXBackpressureDefaults(opts: Partial<typeof defaultBackpressure>): void;
|
|
563
|
+
declare function getKaTeXBackpressureDefaults(): {
|
|
564
|
+
timeout: number;
|
|
565
|
+
waitTimeout: number;
|
|
566
|
+
backoffMs: number;
|
|
567
|
+
maxRetries: number;
|
|
568
|
+
};
|
|
569
|
+
declare function renderKaTeXWithBackpressure(content: string, displayMode?: boolean, opts?: BackpressureOptions): Promise<string>;
|
|
570
|
+
|
|
571
|
+
type Theme = 'light' | 'dark';
|
|
572
|
+
declare function setMermaidWorkerClientDebug(enabled: boolean): void;
|
|
573
|
+
declare function setMermaidWorkerMaxConcurrency(n: number): void;
|
|
574
|
+
declare function getMermaidWorkerLoad(): {
|
|
575
|
+
inFlight: number;
|
|
576
|
+
max: number;
|
|
577
|
+
};
|
|
578
|
+
declare const MERMAID_WORKER_BUSY_CODE = "WORKER_BUSY";
|
|
579
|
+
declare function setMermaidWorker(w: Worker): void;
|
|
580
|
+
declare function clearMermaidWorker(): void;
|
|
581
|
+
declare function canParseOffthread(code: string, theme: Theme, timeout?: number): Promise<boolean>;
|
|
582
|
+
declare function findPrefixOffthread(code: string, theme: Theme, timeout?: number): Promise<string>;
|
|
583
|
+
declare function terminateWorker(): void;
|
|
584
|
+
|
|
585
|
+
export { AdmonitionNode, BackpressureOptions, BlockquoteNode, CheckboxNode, CodeBlockNode, CodeBlockNodeProps, DefinitionListNode, EmojiNode, EmphasisNode, FallbackComponent, FootnoteAnchorNode, FootnoteNode, FootnoteReferenceNode, HardBreakNode, HeadingNode, HighlightNode, HtmlBlockNode, HtmlInlineNode, HtmlPreviewFrame, ImageNode, ImageNodeProps, InfographicBlockNode, InfographicBlockNodeProps, InlineCodeNode, InsertNode, LanguageIconResolver, LinkNode, LinkNodeProps, ListItemNode, ListNode, MERMAID_WORKER_BUSY_CODE, MarkdownCodeBlockNode, MathBlockNode, MathBlockNodeProps, MathInlineNode, MathInlineNodeProps, MermaidBlockEvent, MermaidBlockNode, MermaidBlockNodeProps, NodeComponentProps, NodeRenderer, NodeRendererProps, ParagraphNode, PreCodeNode, PreCodeNodeProps, CodeBlockNode as ReactCodeBlockNode, ReferenceNode, StrikethroughNode, StrongNode, SubscriptNode, SuperscriptNode, TableNode, TextNode, ThematicBreakNode, Tooltip, VmrContainerNode, WORKER_BUSY_CODE, canParseOffthread, clearGlobalCustomComponents, clearKaTeXCache, clearKaTeXWorker, clearMermaidWorker, findPrefixOffthread, getCustomNodeComponents, getKaTeXBackpressureDefaults, getLanguageIcon, getMermaidWorkerLoad, languageMap, normalizeLanguageIdentifier, removeCustomComponents, renderKaTeXInWorker, renderKaTeXWithBackpressure, renderNode, resolveMonacoLanguageId, setCustomComponents, setDefaultI18nMap, setKaTeXBackpressureDefaults, setKaTeXCache, setKaTeXConcurrencyLimit, setKaTeXWorker, setKaTeXWorkerDebug, setLanguageIconResolver, setMermaidWorker, setMermaidWorkerClientDebug, setMermaidWorkerMaxConcurrency, terminateWorker, useSafeI18n, waitForKaTeXWorkerSlot };
|