markstream-react 0.0.47 → 0.0.49
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/Tooltip-DOyIMYde.js +204 -0
- package/dist/{index-DOjYeelM.js → index-DI8pPos8.js} +20 -20
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/markstream-react.css +1 -1
- package/dist/next.d.ts +67 -34
- package/dist/next.js +1 -1
- package/dist/server.d.ts +56 -28
- package/dist/server.js +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/CodeBlockNode/HtmlPreviewFrame.d.ts +2 -0
- package/dist/types/components/D2BlockNode/d2.d.ts +13 -2
- package/dist/types/components/DefinitionListNode/DefinitionListNode.d.ts +2 -1
- package/dist/types/components/HtmlBlockNode/HtmlBlockNode.d.ts +4 -3
- package/dist/types/components/ListNode/ListNode.d.ts +2 -1
- package/dist/types/components/MermaidBlockNode/mermaid.d.ts +22 -1
- package/dist/types/components/TableNode/TableNode.d.ts +3 -2
- package/dist/types/context/smoothStreaming.d.ts +1 -0
- package/dist/types/context/streamState.d.ts +24 -0
- package/dist/types/customComponents.d.ts +4 -4
- package/dist/types/hooks/useSmoothMarkdownStream.d.ts +20 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/next.d.ts +7 -13
- package/dist/types/server-renderer/index.d.ts +5 -5
- package/dist/types/types/component-props.d.ts +12 -4
- package/dist/types/types/node-component.d.ts +2 -0
- package/dist/types/types.d.ts +21 -4
- package/dist/types/utils/customHtmlTag.d.ts +1 -1
- package/dist/types/utils/htmlToReact.d.ts +6 -5
- package/dist/types/utils/streamingTextState.d.ts +2 -23
- package/package.json +6 -4
- package/dist/Tooltip-DQ6sUeEf.js +0 -205
package/dist/server.d.ts
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
|
-
import { CodeBlockNode as CodeBlockNode$1, BaseNode, ParseOptions, MarkdownIt, HtmlPolicy, ParsedNode } from 'stream-markdown-parser';
|
|
1
|
+
import { CodeBlockNode as CodeBlockNode$1, BaseNode, ParseOptions, MarkdownIt, HtmlPolicy, ParsedNode, ListItemNode as ListItemNode$1, TableRowNode, DefinitionItemNode } from 'stream-markdown-parser';
|
|
2
2
|
import React, { ComponentType } from 'react';
|
|
3
|
+
import { SmoothMarkdownStreamOptions } from 'markstream-core';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
|
|
5
6
|
interface HtmlPreviewFrameProps {
|
|
6
7
|
code: string;
|
|
7
8
|
isDark?: boolean;
|
|
9
|
+
htmlPreviewAllowScripts?: boolean;
|
|
10
|
+
htmlPreviewSandbox?: string;
|
|
8
11
|
onClose?: () => void;
|
|
9
12
|
title?: string;
|
|
10
13
|
}
|
|
11
14
|
|
|
15
|
+
type CustomComponentDisplayMode = 'inline' | 'block';
|
|
16
|
+
type MarkstreamCustomComponent<P = never> = ComponentType<P> & {
|
|
17
|
+
markstreamDisplay?: CustomComponentDisplayMode;
|
|
18
|
+
};
|
|
19
|
+
type CustomComponentMap = Record<string, MarkstreamCustomComponent>;
|
|
20
|
+
declare function setCustomComponents(id: string, mapping: CustomComponentMap): void;
|
|
21
|
+
declare function setCustomComponents(mapping: CustomComponentMap): void;
|
|
22
|
+
declare function getCustomNodeComponents(customId?: string): CustomComponentMap;
|
|
23
|
+
declare function removeCustomComponents(id: string): void;
|
|
24
|
+
declare function clearGlobalCustomComponents(): void;
|
|
25
|
+
declare function getCustomComponentDisplay(component: ComponentType<never> | null | undefined): CustomComponentDisplayMode | undefined;
|
|
26
|
+
declare function withMarkstreamComponentDisplay<T extends ComponentType<never>>(component: T, display: CustomComponentDisplayMode): T & {
|
|
27
|
+
markstreamDisplay: CustomComponentDisplayMode;
|
|
28
|
+
};
|
|
29
|
+
|
|
12
30
|
interface CodeBlockMonacoThemeObject {
|
|
13
31
|
name: string;
|
|
14
32
|
base?: string;
|
|
@@ -18,7 +36,7 @@ interface CodeBlockMonacoThemeObject {
|
|
|
18
36
|
[key: string]: unknown;
|
|
19
37
|
}
|
|
20
38
|
type CodeBlockMonacoTheme = string | CodeBlockMonacoThemeObject;
|
|
21
|
-
type CodeBlockMonacoLanguage = string | ((...args:
|
|
39
|
+
type CodeBlockMonacoLanguage = string | ((...args: unknown[]) => unknown);
|
|
22
40
|
interface CodeBlockDiffHideUnchangedRegionsOptions {
|
|
23
41
|
enabled?: boolean;
|
|
24
42
|
contextLineCount?: number;
|
|
@@ -71,8 +89,8 @@ interface CodeBlockMonacoOptions {
|
|
|
71
89
|
diffHunkActionsOnHover?: boolean;
|
|
72
90
|
diffHunkHoverHideDelayMs?: number;
|
|
73
91
|
onDiffHunkAction?: (context: CodeBlockDiffHunkActionContext) => void | boolean | Promise<void | boolean>;
|
|
74
|
-
scrollbar?: Record<string,
|
|
75
|
-
[key: string]:
|
|
92
|
+
scrollbar?: Record<string, unknown>;
|
|
93
|
+
[key: string]: unknown;
|
|
76
94
|
}
|
|
77
95
|
interface CodeBlockNodeProps {
|
|
78
96
|
node: CodeBlockNode$1;
|
|
@@ -94,6 +112,8 @@ interface CodeBlockNodeProps {
|
|
|
94
112
|
showCollapseButton?: boolean;
|
|
95
113
|
showFontSizeButtons?: boolean;
|
|
96
114
|
showTooltips?: boolean;
|
|
115
|
+
htmlPreviewAllowScripts?: boolean;
|
|
116
|
+
htmlPreviewSandbox?: string;
|
|
97
117
|
customId?: string;
|
|
98
118
|
}
|
|
99
119
|
interface ImageNodeProps {
|
|
@@ -164,7 +184,13 @@ interface MermaidBlockNodeProps {
|
|
|
164
184
|
showTooltips?: boolean;
|
|
165
185
|
onRenderError?: (error: unknown, code: string, container: HTMLElement) => boolean | void;
|
|
166
186
|
}
|
|
167
|
-
interface
|
|
187
|
+
interface CodeBlockPreviewPayload {
|
|
188
|
+
node: CodeBlockNode$1;
|
|
189
|
+
artifactType: 'text/html' | 'image/svg+xml';
|
|
190
|
+
artifactTitle: string;
|
|
191
|
+
id: string;
|
|
192
|
+
}
|
|
193
|
+
interface MermaidBlockEvent<TPayload = unknown> {
|
|
168
194
|
payload?: TPayload;
|
|
169
195
|
defaultPrevented: boolean;
|
|
170
196
|
preventDefault: () => void;
|
|
@@ -254,7 +280,20 @@ interface NodeRendererProps {
|
|
|
254
280
|
isDark?: boolean;
|
|
255
281
|
customId?: string;
|
|
256
282
|
indexKey?: number | string;
|
|
283
|
+
/** Show a blinking typewriter cursor while streamed content grows. Default: false */
|
|
257
284
|
typewriter?: boolean;
|
|
285
|
+
/** Enable/disable non-code-node enter and streamed-text fade animations. Default: true */
|
|
286
|
+
fade?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Enable built-in smooth pacing for streaming `content` updates.
|
|
289
|
+
* - `true`: force-enable smooth streaming (content mode only)
|
|
290
|
+
* - `false`: force-disable smooth streaming
|
|
291
|
+
* - `'auto'` (default): enable only when typewriter/incremental mode is active
|
|
292
|
+
* Applies when rendering from `content` (not `nodes`).
|
|
293
|
+
*/
|
|
294
|
+
smoothStreaming?: boolean | 'auto';
|
|
295
|
+
/** Options forwarded to the built-in smooth streaming controller. Read once when the renderer is created. */
|
|
296
|
+
smoothStreamingOptions?: SmoothMarkdownStreamOptions;
|
|
258
297
|
batchRendering?: boolean;
|
|
259
298
|
initialRenderBatchSize?: number;
|
|
260
299
|
renderBatchSize?: number;
|
|
@@ -265,7 +304,7 @@ interface NodeRendererProps {
|
|
|
265
304
|
maxLiveNodes?: number;
|
|
266
305
|
liveNodeBuffer?: number;
|
|
267
306
|
onCopy?: (code: string) => void;
|
|
268
|
-
onHandleArtifactClick?: (payload:
|
|
307
|
+
onHandleArtifactClick?: (payload: CodeBlockPreviewPayload) => void;
|
|
269
308
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
270
309
|
onMouseOver?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
271
310
|
onMouseOut?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
@@ -275,9 +314,11 @@ interface RenderContext {
|
|
|
275
314
|
isDark?: boolean;
|
|
276
315
|
indexKey?: string;
|
|
277
316
|
typewriter?: boolean;
|
|
317
|
+
/** Enable/disable fade animations. Default: true */
|
|
318
|
+
fade?: boolean;
|
|
278
319
|
textStreamState?: Map<string, string>;
|
|
279
320
|
streamRenderVersion?: number;
|
|
280
|
-
customComponents?:
|
|
321
|
+
customComponents?: CustomComponentMap;
|
|
281
322
|
customHtmlTags?: readonly string[];
|
|
282
323
|
htmlPolicy?: HtmlPolicy;
|
|
283
324
|
codeBlockProps?: NodeRendererCodeBlockProps;
|
|
@@ -297,7 +338,7 @@ interface RenderContext {
|
|
|
297
338
|
};
|
|
298
339
|
events: {
|
|
299
340
|
onCopy?: (code: string) => void;
|
|
300
|
-
onHandleArtifactClick?: (payload:
|
|
341
|
+
onHandleArtifactClick?: (payload: CodeBlockPreviewPayload) => void;
|
|
301
342
|
};
|
|
302
343
|
}
|
|
303
344
|
type RenderNodeFn = (node: ParsedNode, key: React.Key, ctx: RenderContext) => React.ReactNode;
|
|
@@ -310,6 +351,8 @@ interface NodeComponentProps<TNode = unknown> {
|
|
|
310
351
|
customId?: string;
|
|
311
352
|
isDark?: boolean;
|
|
312
353
|
typewriter?: boolean;
|
|
354
|
+
/** Enable/disable fade animations. Default: true */
|
|
355
|
+
fade?: boolean;
|
|
313
356
|
children?: React.ReactNode;
|
|
314
357
|
}
|
|
315
358
|
|
|
@@ -381,21 +424,6 @@ interface TooltipProps {
|
|
|
381
424
|
isDark?: boolean | null;
|
|
382
425
|
}
|
|
383
426
|
|
|
384
|
-
type CustomComponentDisplayMode = 'inline' | 'block';
|
|
385
|
-
type MarkstreamCustomComponent<P = any> = ComponentType<P> & {
|
|
386
|
-
markstreamDisplay?: CustomComponentDisplayMode;
|
|
387
|
-
};
|
|
388
|
-
type CustomComponentMap = Record<string, MarkstreamCustomComponent<any>>;
|
|
389
|
-
declare function setCustomComponents(id: string, mapping: CustomComponentMap): void;
|
|
390
|
-
declare function setCustomComponents(mapping: CustomComponentMap): void;
|
|
391
|
-
declare function getCustomNodeComponents(customId?: string): CustomComponentMap;
|
|
392
|
-
declare function removeCustomComponents(id: string): void;
|
|
393
|
-
declare function clearGlobalCustomComponents(): void;
|
|
394
|
-
declare function getCustomComponentDisplay(component: ComponentType<any> | null | undefined): CustomComponentDisplayMode | undefined;
|
|
395
|
-
declare function withMarkstreamComponentDisplay<T extends ComponentType<any>>(component: T, display: CustomComponentDisplayMode): T & {
|
|
396
|
-
markstreamDisplay: CustomComponentDisplayMode;
|
|
397
|
-
};
|
|
398
|
-
|
|
399
427
|
declare function TextNode(props: NodeComponentProps<{
|
|
400
428
|
type: 'text';
|
|
401
429
|
content: string;
|
|
@@ -425,17 +453,17 @@ declare function ListNode(props: NodeComponentProps<{
|
|
|
425
453
|
type: 'list';
|
|
426
454
|
ordered?: boolean;
|
|
427
455
|
start?: number;
|
|
428
|
-
items?:
|
|
456
|
+
items?: ListItemNode$1[];
|
|
429
457
|
}>): react_jsx_runtime.JSX.Element;
|
|
430
458
|
declare function TableNode(props: NodeComponentProps<{
|
|
431
459
|
type: 'table';
|
|
432
|
-
header?:
|
|
433
|
-
rows?:
|
|
460
|
+
header?: TableRowNode;
|
|
461
|
+
rows?: TableRowNode[];
|
|
434
462
|
loading?: boolean;
|
|
435
463
|
}>): react_jsx_runtime.JSX.Element;
|
|
436
464
|
declare function DefinitionListNode(props: NodeComponentProps<{
|
|
437
465
|
type: 'definition_list';
|
|
438
|
-
items?:
|
|
466
|
+
items?: DefinitionItemNode[];
|
|
439
467
|
}>): react_jsx_runtime.JSX.Element;
|
|
440
468
|
declare function FootnoteNode(props: NodeComponentProps<{
|
|
441
469
|
type: 'footnote';
|
|
@@ -556,4 +584,4 @@ declare function FallbackComponent(props: NodeComponentProps<{
|
|
|
556
584
|
declare function renderNode(node: ParsedNode, key: React.Key, ctx: RenderContext): react_jsx_runtime.JSX.Element;
|
|
557
585
|
declare function NodeRenderer(props: NodeRendererProps): react_jsx_runtime.JSX.Element;
|
|
558
586
|
|
|
559
|
-
export { AdmonitionNode, BlockquoteNode, CheckboxNode, CodeBlockDiffAppearance, CodeBlockDiffHideUnchangedRegions, CodeBlockDiffHideUnchangedRegionsOptions, CodeBlockDiffHunkActionContext, CodeBlockDiffHunkActionKind, CodeBlockDiffHunkSide, CodeBlockDiffLineStyle, CodeBlockDiffUnchangedRegionStyle, CodeBlockMonacoLanguage, CodeBlockMonacoOptions, CodeBlockMonacoTheme, CodeBlockMonacoThemeObject, CodeBlockNode, CodeBlockNodeProps, CustomComponentDisplayMode, D2BlockNode, D2BlockNodeProps, DefinitionListNode, EmojiNode, EmphasisNode, FallbackComponent, FootnoteAnchorNode, FootnoteNode, FootnoteReferenceNode, HardBreakNode, HeadingNode, HighlightNode, HtmlBlockNode, HtmlInlineNode, HtmlPreviewFrame, HtmlPreviewFrameProps, ImageNode, ImageNodeProps, InfographicBlockNode, InfographicBlockNodeProps, InlineCodeNode, InsertNode, LinkNode, LinkNodeProps, LinkNodeStyleProps, ListItemNode, ListItemNodeProps, ListNode, MarkdownCodeBlockNode, MarkdownCodeBlockNodeProps, MarkstreamCustomComponent, MathBlockNode, MathBlockNodeProps, MathInlineNode, MathInlineNodeProps, MermaidBlockEvent, MermaidBlockNode, MermaidBlockNodeProps, NodeComponentProps, NodeRenderer, NodeRendererCodeBlockProps, NodeRendererProps, ParagraphNode, PreCodeNode, PreCodeNodeProps, CodeBlockNode as ReactCodeBlockNode, ReferenceNode, StrikethroughNode, StrongNode, SubscriptNode, SuperscriptNode, TableNode, TextNode, ThematicBreakNode, Tooltip, TooltipPlacement, TooltipProps, VmrContainerNode, clearGlobalCustomComponents, NodeRenderer as default, getCustomComponentDisplay, getCustomNodeComponents, removeCustomComponents, renderNode, setCustomComponents, withMarkstreamComponentDisplay };
|
|
587
|
+
export { AdmonitionNode, BlockquoteNode, CheckboxNode, CodeBlockDiffAppearance, CodeBlockDiffHideUnchangedRegions, CodeBlockDiffHideUnchangedRegionsOptions, CodeBlockDiffHunkActionContext, CodeBlockDiffHunkActionKind, CodeBlockDiffHunkSide, CodeBlockDiffLineStyle, CodeBlockDiffUnchangedRegionStyle, CodeBlockMonacoLanguage, CodeBlockMonacoOptions, CodeBlockMonacoTheme, CodeBlockMonacoThemeObject, CodeBlockNode, CodeBlockNodeProps, CodeBlockPreviewPayload, CustomComponentDisplayMode, D2BlockNode, D2BlockNodeProps, DefinitionListNode, EmojiNode, EmphasisNode, FallbackComponent, FootnoteAnchorNode, FootnoteNode, FootnoteReferenceNode, HardBreakNode, HeadingNode, HighlightNode, HtmlBlockNode, HtmlInlineNode, HtmlPreviewFrame, HtmlPreviewFrameProps, ImageNode, ImageNodeProps, InfographicBlockNode, InfographicBlockNodeProps, InlineCodeNode, InsertNode, LinkNode, LinkNodeProps, LinkNodeStyleProps, ListItemNode, ListItemNodeProps, ListNode, MarkdownCodeBlockNode, MarkdownCodeBlockNodeProps, MarkstreamCustomComponent, MathBlockNode, MathBlockNodeProps, MathInlineNode, MathInlineNodeProps, MermaidBlockEvent, MermaidBlockNode, MermaidBlockNodeProps, NodeComponentProps, NodeRenderer, NodeRendererCodeBlockProps, NodeRendererProps, ParagraphNode, PreCodeNode, PreCodeNodeProps, CodeBlockNode as ReactCodeBlockNode, ReferenceNode, StrikethroughNode, StrongNode, SubscriptNode, SuperscriptNode, TableNode, TextNode, ThematicBreakNode, Tooltip, TooltipPlacement, TooltipProps, VmrContainerNode, clearGlobalCustomComponents, NodeRenderer as default, getCustomComponentDisplay, getCustomNodeComponents, removeCustomComponents, renderNode, setCustomComponents, withMarkstreamComponentDisplay };
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o,g as e,a,r as s,s as d,w as t}from"./customHtmlTag-BRT4eqd8.js";import{A as N,B as n,C as r,a as i,D as m,b as l,E as c,c as p,F as C,d as k,e as h,f as g,H as u,g as B,h as f,i as H,j as I,k as b,I as F,l as M,m as T,n as w,L as x,o as D,p as L,M as R,q as S,r as j,s as P,N as v,P as y,t as A,a as E,R as q,S as G,u as V,v as z,w as J,T as K,x as O,y as Q,z as U,V as W,N as X,G as Y}from"./index-
|
|
1
|
+
import{c as o,g as e,a,r as s,s as d,w as t}from"./customHtmlTag-BRT4eqd8.js";import{A as N,B as n,C as r,a as i,D as m,b as l,E as c,c as p,F as C,d as k,e as h,f as g,H as u,g as B,h as f,i as H,j as I,k as b,I as F,l as M,m as T,n as w,L as x,o as D,p as L,M as R,q as S,r as j,s as P,N as v,P as y,t as A,a as E,R as q,S as G,u as V,v as z,w as J,T as K,x as O,y as Q,z as U,V as W,N as X,G as Y}from"./index-DI8pPos8.js";export{N as AdmonitionNode,n as BlockquoteNode,r as CheckboxNode,i as CodeBlockNode,m as D2BlockNode,l as DefinitionListNode,c as EmojiNode,p as EmphasisNode,C as FallbackComponent,k as FootnoteAnchorNode,h as FootnoteNode,g as FootnoteReferenceNode,u as HardBreakNode,B as HeadingNode,f as HighlightNode,H as HtmlBlockNode,I as HtmlInlineNode,b as HtmlPreviewFrame,F as ImageNode,M as InfographicBlockNode,T as InlineCodeNode,w as InsertNode,x as LinkNode,D as ListItemNode,L as ListNode,R as MarkdownCodeBlockNode,S as MathBlockNode,j as MathInlineNode,P as MermaidBlockNode,v as NodeRenderer,y as ParagraphNode,A as PreCodeNode,E as ReactCodeBlockNode,q as ReferenceNode,G as StrikethroughNode,V as StrongNode,z as SubscriptNode,J as SuperscriptNode,K as TableNode,O as TextNode,Q as ThematicBreakNode,U as Tooltip,W as VmrContainerNode,o as clearGlobalCustomComponents,X as default,e as getCustomComponentDisplay,a as getCustomNodeComponents,s as removeCustomComponents,Y as renderNode,d as setCustomComponents,t as withMarkstreamComponentDisplay};
|
package/dist/tailwind.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const safeList = `use client react string cannot delete global call clearGlobalCustomComponents
|
|
1
|
+
export const safeList = `use client react string cannot delete global call clearGlobalCustomComponents stream-markdown-parser auto code_block next.type typeof window.requestIdleCallback [data-node-index] node-spacer dark virtualized data-custom-id node-slot data-node-index data-node-type fade-node typewriter-node node-placeholder typewriterCursorRef typewriter-cursor admonition math_block html_block image object [data-node-type="code_block"] [data-node-type="admonition"] [data-node-type="table"] [data-node-type="math_block"] [data-node-type="html_block"] [data-node-type="image"] performance [markstream-react][perf] mermaid theme name markdown-renderer boolean safe note is-dark data-index-key headerId admonition-header admonition-icon admonition-title admonition-toggle aria-expanded aria-controls collapsed admonition-content aria-labelledby blockquote-node checkbox-node checkbox checkbox-input emoji-node clsx heading-node font-semibold dependency is not install it to enable footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2 flex-1 smooth footnote-reference handleScroll footnote-link cursor-pointer emphasis-node dl definition-list indexKey mb-4 dt definition-term ctx renderNode ?? definition dd definition-desc ml-4 footnote-anchor hover:underline ↩︎ hard-break mark highlight-node html-block-node escape html-block html-block-node__placeholder html-block-node__placeholder-bar w-4/5 w-2/3 setHostEl shouldRender useDynamic reactNodes href xlink:href markstream-d2-root-svg number window.requestAnimationFrame instance.render instance missing render returned empty top d2-block my-4 rounded-lg border overflow-hidden shadow-sm border-gray-700/30 bg-gray-900 text-gray-100 border-gray-200 bg-white text-gray-900 d2-block-header justify-between items-center px-4 py-2.5 border-b border-gray-400/5 gap-x-2 font-medium font-mono gap-x-1 rounded-md p-0.5 bg-gray-700 bg-gray-100 mode-btn px-2 py-1 text-xs rounded !showSource is-active showSource d2-action-btn p-2 transition-colors hover:bg-[var(--vscode-editor-selectionBackground)] copying w-3 h-3 none currentColor round aria-pressed m9 bodyRef d2-block-body bodyStyle !hasPreview d2-source py-4 d2-code d2-error mt-2 d2-render d2-svg pb-3 line-info diffUnchangedRegionStyle line-info-basic metadata legacy off never background night moon black dracula mocha frappe macchiato palenight ocean poimandres monokai laserwave tokyo slack-dark rose-pine github-dark material-theme one-dark catppuccin-mocha catppuccin-frappe catppuccin-macchiato light latte dawn lotus plaintext diff visible view.getModifiedEditor explicit on same helpers.cleanupEditor canonicalLanguage single window.cancelAnimationFrame clientX navigator.clipboard navigator.clipboard.writeText code-block-container is-rendering is-diff is-plain-text code-block-header space-x-2 icon-slot h-4 w-4 flex-shrink-0 truncate code-action-btn copied m14 evenodd code-block-body--collapsed code-block-body--expanded code-editor-layer code-height-placeholder hidden aria-hidden code-editor-fallback-surface code-fallback-plain m-0 aria-busy aria-label no code-loading-placeholder loading-skeleton skeleton-line short sr-only polite status is-loaded lazy eager async image-node__placeholder image-node__spinner image-node__placeholder-text image… placeholder image-node__error failed load react-dom library text-red-500 p-4">Failed instanceof error.message error keydown transform ease center fullscreen touches text-gray-400 hover:bg-gray-700 hover:text-gray-200 text-gray-600 hover:bg-gray-200 hover:text-gray-700 source hasPreview preview pending bg-gray-800 bg-gray-50 px-2.5 bg-gray-600 text-gray-200 text-gray-700 text-gray-500 m16 isCollapsed opacity-50 cursor-not-allowed m7 whitespace-pre-wrap text-gray-300 baseCode relative absolute top-2 right-2 z-10 gap-2 backdrop-blur infographic-preview min-h-[360px] transition-all duration-100 block inset-0 cursor-grab isDragging containerRef w-full text-center justify-center min-h-full fixed z-50 bg-black/70 p-4 closeModal dialog h-full max-w-full max-h-full shadow-lg top-6 right-6 !isDragging cursor-grabbing markstream-core inline-code inline text-[85%] px-1 py-0.5 bg-[hsl(var(--secondary))] whitespace-normal break-words text-node-stream-delta text-node-stream-delta--a text-node-stream-delta--b ease-in-out infinite node.title link-loading inline-flex items-baseline gap-1.5 link-text-wrapper leading-[normal] link-text text link-loading-indicator link-node noopener noreferrer list-node my-5 pl-[calc(13/8*1em)] list-decimal list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)] list insert-node subscript-node superscript-node vitesse-dark vitesse-light shiki shiki-fallback stream-markdown code-block-content rendererTargetRef code-block-render list-item pl-1.5 my-2 valueAttr children hr-node thematic-break text-node text-node-center strong-node in out zoom afterbegin viewBox loose strict gantt open-modal [data-mermaid-wrapper] mermaid-action-btn toggle-mode common.zoomIn common.zoomOut common.resetZoom transition-[height] duration-150 ease-out data-mermaid-wrapper mermaid-loading mermaid-spinner diagram… mermaid-block-header space-x-1 common.preview common.source common.export mermaid-error hasRenderedOnce mermaid-block modeContainerRef mermaid-modal-overlay mermaid-modal-panel mermaid-modal-header mermaid-modal-title mermaid-modal-close mermaid-modal-body modalContentRef mermaid-modal-content available default abort timed window.matchMedia ms-tooltip z-[9999] inline-block text-base py-2 px-3 shadow-md whitespace-nowrap pointer-events-none tooltip-element text-white border-gray-700 tooltip right text-right text-left pointermove pointerup pointercancel table-node-wrapper my-8 table-node table-node--loading colgroup border-[var(--table-border,#cbd5e1)] p-[calc(4/7*1em)] table-node__resize-handle table-node__loading table-node__spinner unknown-node italic node strikethrough-node paragraph-node paragraph reference-node bg-[hsl(var(--muted))] px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))] event.key infographic d2 language d2lang node.type html_inline text_special node.content heading list_item definition_list footnote footnote_reference footnote_anchor hardbreak inline_code emphasis strikethrough highlight insert subscript superscript checkbox_input emoji thematic_break math_inline reference vmr_container label_open label_close containerClass vmr-container javascript typescript python ruby shell plain cpp markdown document stream-monaco [mermaidWorkerClient] messageerror cleared worker inject via busy canParse findPrefix [markstream-react] htmlPreviewSandbox contains both allow-scripts and this only fully trusted content served an isolated en utf-8 viewport content="width=device-width initial-scale=1 html-preview-frame__backdrop--dark html-preview-frame--dark html-preview-frame__header html-preview-frame__title html-preview-frame__dot html-preview-frame__label html-preview-frame__close--dark html-preview-frame__iframe no-referrer about:blank thinking htmlFor class className data-ssr-fallback normalizedLanguage data-language renderNodeProp classAttr node.cite value void rowIdx bodyRows.length isOpen thematic-break-node cssVars image-node__img code-block-node code-block markdown-code-block-node markdown-code-block mermaid-block-node d2-block-node infographic-block-node math-block overflow-x-auto min-h-[40px] $$ math-inline-wrapper math-inline data-reference-id customComponents server-renderer node-content self_closing tag_open tag_close parse dynamic template html-inline-node html-inline-node--loading role aria-describedby mathRef math-inline--hidden math-inline__loading math-inline__spinner rendering math-rendering globalThis.requestAnimationFrame globalThis.cancelAnimationFrame sequencediagram classdiagram kind statediagram erdiagram flowchart graph module did expected normalizedType [katexWorkerClient] init cache-hit timeout waiting slot existingEnv.getWorkerUrl process katex °C`
|
|
2
2
|
module.exports = safeList;
|
|
3
3
|
export default safeList;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface D2Instance {
|
|
2
|
+
D2?: D2Constructor;
|
|
3
|
+
compile?: (source: string, options?: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
4
|
+
render?: (input: unknown, options?: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface D2Constructor {
|
|
7
|
+
new (): D2Instance;
|
|
8
|
+
D2?: D2Constructor;
|
|
9
|
+
compile?: D2Instance['compile'];
|
|
10
|
+
}
|
|
11
|
+
export type D2Module = D2Constructor | D2Instance;
|
|
12
|
+
export type D2Loader = () => Promise<unknown> | unknown;
|
|
2
13
|
export declare function setD2Loader(loader: D2Loader | null): void;
|
|
3
14
|
export declare function enableD2(loader?: D2Loader): void;
|
|
4
15
|
export declare function disableD2(): void;
|
|
5
16
|
export declare function isD2Enabled(): boolean;
|
|
6
|
-
export declare function getD2(): Promise<
|
|
17
|
+
export declare function getD2(): Promise<D2Module | null>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { DefinitionItemNode } from 'stream-markdown-parser';
|
|
1
2
|
import { NodeComponentProps } from '../../types/node-component';
|
|
2
3
|
export declare function DefinitionListNode(props: NodeComponentProps<{
|
|
3
4
|
type: 'definition_list';
|
|
4
|
-
items?:
|
|
5
|
+
items?: DefinitionItemNode[];
|
|
5
6
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export default DefinitionListNode;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { HtmlPolicy } from 'stream-markdown-parser';
|
|
1
|
+
import { HtmlPolicy, ParsedNode } from 'stream-markdown-parser';
|
|
2
|
+
import { CustomComponentMap } from '../../customComponents';
|
|
2
3
|
import { NodeComponentProps } from '../../types/node-component';
|
|
3
4
|
import { default as React } from 'react';
|
|
4
5
|
export declare function HtmlBlockNode(props: NodeComponentProps<{
|
|
@@ -7,10 +8,10 @@ export declare function HtmlBlockNode(props: NodeComponentProps<{
|
|
|
7
8
|
raw?: string;
|
|
8
9
|
tag?: string;
|
|
9
10
|
attrs?: [string, string | null][] | null;
|
|
10
|
-
children?:
|
|
11
|
+
children?: ParsedNode[];
|
|
11
12
|
loading?: boolean;
|
|
12
13
|
}> & {
|
|
13
|
-
customComponents?:
|
|
14
|
+
customComponents?: CustomComponentMap;
|
|
14
15
|
htmlPolicy?: HtmlPolicy;
|
|
15
16
|
placeholder?: React.ReactNode;
|
|
16
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { ListItemNode as ParsedListItemNode } from 'stream-markdown-parser';
|
|
1
2
|
import { NodeComponentProps } from '../../types/node-component';
|
|
2
3
|
export declare function ListNode(props: NodeComponentProps<{
|
|
3
4
|
type: 'list';
|
|
4
5
|
ordered?: boolean;
|
|
5
6
|
start?: number;
|
|
6
|
-
items?:
|
|
7
|
+
items?: ParsedListItemNode[];
|
|
7
8
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export default ListNode;
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface MermaidModule {
|
|
2
|
+
render: (id: string, source: string) => Promise<MermaidRenderResult> | MermaidRenderResult;
|
|
3
|
+
parse?: (source: string) => Promise<unknown> | unknown;
|
|
4
|
+
initialize?: (config?: Record<string, unknown>) => unknown;
|
|
5
|
+
mermaidAPI?: {
|
|
6
|
+
render?: MermaidModule['render'];
|
|
7
|
+
parse?: MermaidModule['parse'];
|
|
8
|
+
initialize?: MermaidModule['initialize'];
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export type MermaidRenderResult = string | {
|
|
12
|
+
svg?: string;
|
|
13
|
+
bindFunctions?: (element: Element) => unknown;
|
|
14
|
+
};
|
|
15
|
+
interface MermaidInitConfig extends Record<string, unknown> {
|
|
16
|
+
securityLevel?: unknown;
|
|
17
|
+
flowchart?: {
|
|
18
|
+
htmlLabels?: unknown;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare function getMermaid(initConfig?: MermaidInitConfig): Promise<MermaidModule | null>;
|
|
22
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { TableRowNode } from 'stream-markdown-parser';
|
|
1
2
|
import { NodeComponentProps } from '../../types/node-component';
|
|
2
3
|
export declare function TableNode(props: NodeComponentProps<{
|
|
3
4
|
type: 'table';
|
|
4
|
-
header?:
|
|
5
|
-
rows?:
|
|
5
|
+
header?: TableRowNode;
|
|
6
|
+
rows?: TableRowNode[];
|
|
6
7
|
loading?: boolean;
|
|
7
8
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export default TableNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SmoothStreamingContext: import('react').Context<boolean>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Holds mutable streaming state that updates on every streaming chunk
|
|
3
|
+
* without triggering React re-renders. TextNode and InlineCodeNode read
|
|
4
|
+
* from this ref inside effects / callbacks rather than from renderCtx props,
|
|
5
|
+
* so that the renderCtx object can stay referentially stable during streaming.
|
|
6
|
+
*/
|
|
7
|
+
export interface StreamStateRef {
|
|
8
|
+
/** Map from node key to last-settled text content (shared across renders). */
|
|
9
|
+
textStreamState: Map<string, string>;
|
|
10
|
+
/** Returns the current stream render version counter. */
|
|
11
|
+
getStreamRenderVersion: () => number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* React Context that carries a stable StreamStateRef.
|
|
15
|
+
* The context value itself never changes (same ref object for the lifetime
|
|
16
|
+
* of the NodeRenderer), so subscribing components do NOT re-render when
|
|
17
|
+
* the stream version increments. Consumers read the latest value inside
|
|
18
|
+
* effects or callbacks via `ref.getStreamRenderVersion()`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const StreamStateRefContext: import('react').Context<StreamStateRef>;
|
|
21
|
+
/**
|
|
22
|
+
* Hook that returns the nearest StreamStateRef, or null if none is provided.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useStreamStateRef(): StreamStateRef | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
export type CustomComponentDisplayMode = 'inline' | 'block';
|
|
3
|
-
export type MarkstreamCustomComponent<P =
|
|
3
|
+
export type MarkstreamCustomComponent<P = never> = ComponentType<P> & {
|
|
4
4
|
markstreamDisplay?: CustomComponentDisplayMode;
|
|
5
5
|
};
|
|
6
|
-
export type CustomComponentMap = Record<string, MarkstreamCustomComponent
|
|
6
|
+
export type CustomComponentMap = Record<string, MarkstreamCustomComponent>;
|
|
7
7
|
export declare function subscribeCustomComponents(listener: () => void): () => void;
|
|
8
8
|
export declare function getCustomComponentsRevision(): number;
|
|
9
9
|
export declare function setCustomComponents(id: string, mapping: CustomComponentMap): void;
|
|
@@ -11,7 +11,7 @@ export declare function setCustomComponents(mapping: CustomComponentMap): void;
|
|
|
11
11
|
export declare function getCustomNodeComponents(customId?: string): CustomComponentMap;
|
|
12
12
|
export declare function removeCustomComponents(id: string): void;
|
|
13
13
|
export declare function clearGlobalCustomComponents(): void;
|
|
14
|
-
export declare function getCustomComponentDisplay(component: ComponentType<
|
|
15
|
-
export declare function withMarkstreamComponentDisplay<T extends ComponentType<
|
|
14
|
+
export declare function getCustomComponentDisplay(component: ComponentType<never> | null | undefined): CustomComponentDisplayMode | undefined;
|
|
15
|
+
export declare function withMarkstreamComponentDisplay<T extends ComponentType<never>>(component: T, display: CustomComponentDisplayMode): T & {
|
|
16
16
|
markstreamDisplay: CustomComponentDisplayMode;
|
|
17
17
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SmoothMarkdownStreamOptions, SmoothMarkdownStreamSnapshot } from 'markstream-core';
|
|
2
|
+
export type { SmoothMarkdownStreamOptions, SmoothMarkdownStreamSnapshot };
|
|
3
|
+
export declare function useSmoothMarkdownStream(options?: SmoothMarkdownStreamOptions): {
|
|
4
|
+
enqueue: (chunk: string) => void;
|
|
5
|
+
finish: (options?: {
|
|
6
|
+
flush?: boolean;
|
|
7
|
+
}) => void;
|
|
8
|
+
flush: () => void;
|
|
9
|
+
reset: (initialMarkdown?: string) => void;
|
|
10
|
+
pause: () => void;
|
|
11
|
+
resume: () => void;
|
|
12
|
+
getSnapshot: () => SmoothMarkdownStreamSnapshot;
|
|
13
|
+
source: string;
|
|
14
|
+
visible: string;
|
|
15
|
+
done: boolean;
|
|
16
|
+
paused: boolean;
|
|
17
|
+
pendingChars: number;
|
|
18
|
+
caughtUp: boolean;
|
|
19
|
+
final: boolean;
|
|
20
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -53,10 +53,12 @@ export type { TooltipPlacement, TooltipProps } from './components/Tooltip/Toolti
|
|
|
53
53
|
export { VmrContainerNode } from './components/VmrContainerNode/VmrContainerNode';
|
|
54
54
|
export { clearGlobalCustomComponents, getCustomComponentDisplay, getCustomNodeComponents, removeCustomComponents, setCustomComponents, withMarkstreamComponentDisplay, } from './customComponents';
|
|
55
55
|
export type { CustomComponentDisplayMode, MarkstreamCustomComponent, } from './customComponents';
|
|
56
|
+
export { useSmoothMarkdownStream } from './hooks/useSmoothMarkdownStream';
|
|
57
|
+
export type { SmoothMarkdownStreamOptions, SmoothMarkdownStreamSnapshot, } from './hooks/useSmoothMarkdownStream';
|
|
56
58
|
export * from './i18n/useSafeI18n';
|
|
57
59
|
export * from './renderers/renderNode';
|
|
58
60
|
export type { NodeRendererCodeBlockProps, NodeRendererProps } from './types';
|
|
59
|
-
export type { CodeBlockDiffAppearance, CodeBlockDiffHideUnchangedRegions, CodeBlockDiffHideUnchangedRegionsOptions, CodeBlockDiffHunkActionContext, CodeBlockDiffHunkActionKind, CodeBlockDiffHunkSide, CodeBlockDiffLineStyle, CodeBlockDiffUnchangedRegionStyle, CodeBlockMonacoLanguage, CodeBlockMonacoOptions, CodeBlockMonacoTheme, CodeBlockMonacoThemeObject, CodeBlockNodeProps, D2BlockNodeProps, ImageNodeProps, InfographicBlockNodeProps, LinkNodeProps, MathBlockNodeProps, MathInlineNodeProps, MermaidBlockEvent, MermaidBlockNodeProps, PreCodeNodeProps, } from './types/component-props';
|
|
61
|
+
export type { CodeBlockDiffAppearance, CodeBlockDiffHideUnchangedRegions, CodeBlockDiffHideUnchangedRegionsOptions, CodeBlockDiffHunkActionContext, CodeBlockDiffHunkActionKind, CodeBlockDiffHunkSide, CodeBlockDiffLineStyle, CodeBlockDiffUnchangedRegionStyle, CodeBlockMonacoLanguage, CodeBlockMonacoOptions, CodeBlockMonacoTheme, CodeBlockMonacoThemeObject, CodeBlockNodeProps, CodeBlockPreviewPayload, D2BlockNodeProps, ImageNodeProps, InfographicBlockNodeProps, LinkNodeProps, MathBlockNodeProps, MathInlineNodeProps, MermaidBlockEvent, MermaidBlockNodeProps, PreCodeNodeProps, } from './types/component-props';
|
|
60
62
|
export type { NodeComponentProps } from './types/node-component';
|
|
61
63
|
export * from './utils/languageIcon';
|
|
62
64
|
export * from './workers/katexWorkerClient';
|
package/dist/types/next.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare const D2BlockNode: {
|
|
|
45
45
|
export declare const DefinitionListNode: {
|
|
46
46
|
(props: import('./types/node-component').NodeComponentProps<{
|
|
47
47
|
type: "definition_list";
|
|
48
|
-
items?:
|
|
48
|
+
items?: import('stream-markdown-parser').DefinitionItemNode[];
|
|
49
49
|
}>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
50
50
|
displayName: string;
|
|
51
51
|
};
|
|
@@ -109,17 +109,11 @@ export declare const HighlightNode: {
|
|
|
109
109
|
export declare const HtmlBlockNode: {
|
|
110
110
|
(props: import('./types/node-component').NodeComponentProps<{
|
|
111
111
|
type: "html_block";
|
|
112
|
-
content
|
|
113
|
-
raw?: string;
|
|
112
|
+
content?: string;
|
|
114
113
|
tag?: string;
|
|
115
114
|
attrs?: [string, string | null][] | null;
|
|
116
|
-
children?:
|
|
117
|
-
|
|
118
|
-
}> & {
|
|
119
|
-
customComponents?: Record<string, React.ComponentType<any>>;
|
|
120
|
-
htmlPolicy?: import('stream-markdown-parser').HtmlPolicy;
|
|
121
|
-
placeholder?: React.ReactNode;
|
|
122
|
-
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
115
|
+
children?: import('stream-markdown-parser').ParsedNode[];
|
|
116
|
+
}>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
123
117
|
displayName: string;
|
|
124
118
|
};
|
|
125
119
|
export declare const HtmlInlineNode: {
|
|
@@ -175,7 +169,7 @@ export declare const ListNode: {
|
|
|
175
169
|
type: "list";
|
|
176
170
|
ordered?: boolean;
|
|
177
171
|
start?: number;
|
|
178
|
-
items?:
|
|
172
|
+
items?: import('stream-markdown-parser').ListItemNode[];
|
|
179
173
|
}>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
180
174
|
displayName: string;
|
|
181
175
|
};
|
|
@@ -253,8 +247,8 @@ export declare const SuperscriptNode: {
|
|
|
253
247
|
export declare const TableNode: {
|
|
254
248
|
(props: import('./types/node-component').NodeComponentProps<{
|
|
255
249
|
type: "table";
|
|
256
|
-
header?:
|
|
257
|
-
rows?:
|
|
250
|
+
header?: import('stream-markdown-parser').TableRowNode;
|
|
251
|
+
rows?: import('stream-markdown-parser').TableRowNode[];
|
|
258
252
|
loading?: boolean;
|
|
259
253
|
}>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
260
254
|
displayName: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParsedNode } from 'stream-markdown-parser';
|
|
1
|
+
import { DefinitionItemNode as DefinitionItemNodeType, ListItemNode as ListItemNodeType, ParsedNode, TableRowNode as TableRowNodeType } from 'stream-markdown-parser';
|
|
2
2
|
import { HtmlPreviewFrameProps } from '../components/CodeBlockNode/HtmlPreviewFrame';
|
|
3
3
|
import { MarkdownCodeBlockNodeProps } from '../components/MarkdownCodeBlockNode/MarkdownCodeBlockNode';
|
|
4
4
|
import { TooltipProps } from '../components/Tooltip/Tooltip';
|
|
@@ -35,17 +35,17 @@ export declare function ListNode(props: NodeComponentProps<{
|
|
|
35
35
|
type: 'list';
|
|
36
36
|
ordered?: boolean;
|
|
37
37
|
start?: number;
|
|
38
|
-
items?:
|
|
38
|
+
items?: ListItemNodeType[];
|
|
39
39
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
40
40
|
export declare function TableNode(props: NodeComponentProps<{
|
|
41
41
|
type: 'table';
|
|
42
|
-
header?:
|
|
43
|
-
rows?:
|
|
42
|
+
header?: TableRowNodeType;
|
|
43
|
+
rows?: TableRowNodeType[];
|
|
44
44
|
loading?: boolean;
|
|
45
45
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
export declare function DefinitionListNode(props: NodeComponentProps<{
|
|
47
47
|
type: 'definition_list';
|
|
48
|
-
items?:
|
|
48
|
+
items?: DefinitionItemNodeType[];
|
|
49
49
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
50
50
|
export declare function FootnoteNode(props: NodeComponentProps<{
|
|
51
51
|
type: 'footnote';
|
|
@@ -8,7 +8,7 @@ export interface CodeBlockMonacoThemeObject {
|
|
|
8
8
|
[key: string]: unknown;
|
|
9
9
|
}
|
|
10
10
|
export type CodeBlockMonacoTheme = string | CodeBlockMonacoThemeObject;
|
|
11
|
-
export type CodeBlockMonacoLanguage = string | ((...args:
|
|
11
|
+
export type CodeBlockMonacoLanguage = string | ((...args: unknown[]) => unknown);
|
|
12
12
|
export interface CodeBlockDiffHideUnchangedRegionsOptions {
|
|
13
13
|
enabled?: boolean;
|
|
14
14
|
contextLineCount?: number;
|
|
@@ -61,8 +61,8 @@ export interface CodeBlockMonacoOptions {
|
|
|
61
61
|
diffHunkActionsOnHover?: boolean;
|
|
62
62
|
diffHunkHoverHideDelayMs?: number;
|
|
63
63
|
onDiffHunkAction?: (context: CodeBlockDiffHunkActionContext) => void | boolean | Promise<void | boolean>;
|
|
64
|
-
scrollbar?: Record<string,
|
|
65
|
-
[key: string]:
|
|
64
|
+
scrollbar?: Record<string, unknown>;
|
|
65
|
+
[key: string]: unknown;
|
|
66
66
|
}
|
|
67
67
|
export interface CodeBlockNodeProps {
|
|
68
68
|
node: CodeBlockNode;
|
|
@@ -84,6 +84,8 @@ export interface CodeBlockNodeProps {
|
|
|
84
84
|
showCollapseButton?: boolean;
|
|
85
85
|
showFontSizeButtons?: boolean;
|
|
86
86
|
showTooltips?: boolean;
|
|
87
|
+
htmlPreviewAllowScripts?: boolean;
|
|
88
|
+
htmlPreviewSandbox?: string;
|
|
87
89
|
customId?: string;
|
|
88
90
|
}
|
|
89
91
|
export interface ImageNodeProps {
|
|
@@ -154,7 +156,13 @@ export interface MermaidBlockNodeProps {
|
|
|
154
156
|
showTooltips?: boolean;
|
|
155
157
|
onRenderError?: (error: unknown, code: string, container: HTMLElement) => boolean | void;
|
|
156
158
|
}
|
|
157
|
-
export interface
|
|
159
|
+
export interface CodeBlockPreviewPayload {
|
|
160
|
+
node: CodeBlockNode;
|
|
161
|
+
artifactType: 'text/html' | 'image/svg+xml';
|
|
162
|
+
artifactTitle: string;
|
|
163
|
+
id: string;
|
|
164
|
+
}
|
|
165
|
+
export interface MermaidBlockEvent<TPayload = unknown> {
|
|
158
166
|
payload?: TPayload;
|
|
159
167
|
defaultPrevented: boolean;
|
|
160
168
|
preventDefault: () => void;
|