markstream-react 0.0.56-beta.2 → 0.0.56-beta.4

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/tailwind.js CHANGED
@@ -1,2 +1,2 @@
1
- export const safeList = `use client react stream-markdown-parser string cannot delete global call clearGlobalCustomComponents checkbox-node checkbox checkbox-input 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 auto object typeof next code_block next.type 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 [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 emphasis-node hard-break clsx heading-node font-semibold dependency is not install it to enable smooth footnote-reference handleScroll footnote-link cursor-pointer footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2 flex-1 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 footnote-anchor hover:underline ↩︎ dl definition-list indexKey mb-4 dt definition-term ctx renderNode ?? definition dd definition-desc ml-4 mark highlight-node emoji-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 insert-node inline-code inline text-[85%] px-1 py-0.5 bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full text-node-stream-delta text-node-stream-delta--a text-node-stream-delta--b 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 list-item pl-1.5 my-2 valueAttr children style.visibility hidden line-info 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 important max-height visible height onDidUpdateDiff onDidContentSizeChange onDidLayoutChange window.MutationObserver childList record.type attributes class explicit fontSize lineHeight paddingBottom paddingTop tabSize on same helpers.cleanupEditor canonicalLanguage single window.cancelAnimationFrame clientX navigator.clipboard navigator.clipboard.writeText code-fallback-plain m-0 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 aria-hidden code-editor-fallback-surface code-loading-placeholder loading-skeleton skeleton-line short sr-only polite status react-dom library failed 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 markstream-react fixed z-50 bg-black/70 p-4 closeModal dialog h-full max-h-full shadow-lg top-6 right-6 !isDragging cursor-grabbing markstream-core vitesse-dark vitesse-light shiki shiki-fallback [MarkdownCodeBlockNode] dispose stream-markdown stream-markdown.createShikiStreamRenderer available stale ready requires with ignoring and using default language register configured retrying without code-block-content rendererTargetRef code-block-render 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 aria-label noopener noreferrer unknown-node italic node paragraph-node paragraph child.type html_inline loose strict viewBox 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 abort timed out strong-node superscript-node strikethrough-node subscript-node reference-node bg-[hsl(var(--muted))] px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))] event.key text-node text-node-center primary fallback is-loaded lazy eager async image-node__placeholder image-node__spinner image-node__placeholder-text image… placeholder image-node__error load containerClass vmr-container right text-right text-left pointermove pointerup pointercancel table-node-wrapper my-8 table-node table-node--loading aria-busy colgroup border-[var(--table-border,#cbd5e1)] p-[calc(4/7*1em)] table-node__resize-handle table-node__loading table-node__spinner 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 [mermaidWorkerClient] messageerror cleared worker inject via busy canParse findPrefix javascript typescript go python ruby shell powershell d2 plain cpp csharp objectivec objectivecpp yaml markdown rust kotlin hr-node thematic-break list_item definition_list footnote footnote_reference footnote_anchor thematic_break thinking vmr_container htmlFor className label_open label_close in zoom [markstream-react] htmlPreviewSandbox contains both allow-scripts 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 node.type infographic d2lang langs text_special node.content heading hardbreak inline_code emphasis strikethrough highlight insert subscript superscript checkbox_input emoji math_inline reference stream-monaco data-ssr-fallback normalizedLanguage data-language no 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 html-inline server-renderer node-content role aria-describedby document child key ref ms-html self_closing tag_open token.type tag_close parse dynamic template html-inline-node html-inline-node--loading mathRef math-inline--hidden math-inline__loading math-inline__spinner hunk !options.preserveBlankKind context removed added markstream-pre__diff-pane--inline original markstream-pre__diff-pane--original modified markstream-pre__diff-pane--modified markstream-pre--line-numbers markstream-pre--diff-preview markstream-pre--diff-inline showLineNumbers markstream-pre__diff-code line.empty markstream-pre__diff-line--empty markstream-pre__diff-rail markstream-pre__diff-number markstream-pre__diff-content markstream-pre__diff-content-inner rendering math-rendering normalizedType globalThis.requestAnimationFrame globalThis.cancelAnimationFrame sequencediagram classdiagram kind statediagram erdiagram flowchart graph npm development process module did expected existingEnv.getWorkerUrl [katexWorkerClient] init cache-hit timeout waiting slot prototype constructor katex °C`;
1
+ export const safeList = `use client react stream-markdown-parser string cannot delete global call clearGlobalCustomComponents markstream-core plaintext ?? data-ssr-fallback aria-busy normalizedLanguage block data-language no safe html-block-node html_block node.type html_inline boolean none mermaid infographic d2 language d2lang langs whitespace-pre-wrap text-node-center text image auto paragraph-node renderNodeProp ctx paragraph escape child.type heading-node font-semibold classAttr object blockquote-node node.cite children list-item pl-1.5 my-2 value void 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 right text-right center text-center text-left table-node-wrapper data-index-key text-sm table-node--loading border-[var(--table-border,#cbd5e1)] border-b p-[calc(4/7*1em)] rowIdx bodyRows.length table-node__loading status polite table-node__spinner sr-only dl definition-list indexKey mb-4 dt definition-term definition dd definition-desc ml-4 footnote-node flex leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2 flex-1 footnote-reference href footnote-link cursor-pointer footnote-anchor hover:underline ↩︎ note is-dark headerId admonition-header admonition-icon admonition-title admonition-toggle aria-expanded aria-controls isOpen admonition-content aria-labelledby checkbox-node checkbox checkbox-input emoji-node strong-node emphasis-node emphasis strikethrough-node strikethrough mark highlight-node highlight insert-node insert subscript-node subscript superscript-node superscript thematic-break-node inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full number ease-in-out typeof infinite node.title link-loading inline-flex items-baseline gap-1.5 cssVars link-text-wrapper relative leading-[normal] link-text link-loading-indicator link-node aria-label noopener noreferrer image-node__img is-loaded eager lazy async 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] node.content $$ math-inline-wrapper math-inline reference-node bg-[hsl(var(--muted))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))] data-reference-id html-block customComponents html-inline vmr-container unknown-node text-gray-500 italic node code_block text_special heading list_item definition_list footnote footnote_reference footnote_anchor admonition hardbreak inline_code checkbox_input emoji thematic_break math_inline math_block reference vmr_container label_open label_close server-renderer markdown-renderer dark data-custom-id node-slot data-node-index data-node-type node-content collapsed next next.type window.requestIdleCallback [data-node-index] node-spacer virtualized fade-node typewriter-node node-placeholder typewriterCursorRef typewriter-cursor [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] theme name window.requestAnimationFrame [data-stream-diffs-state] style.visibility hidden line-info 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 transparent marker diff important max-height visible height onDidUpdateDiff onDidContentSizeChange onDidLayoutChange window.MutationObserver childList record.type attributes class explicit node.code fontSize lineHeight paddingBottom paddingTop tabSize on same nextOptions.unsafeCSS helpers.cleanupEditor canonicalLanguage single window.cancelAnimationFrame clientX top navigator.clipboard navigator.clipboard.writeText code-block-container my-4 rounded-lg border overflow-hidden shadow-sm border-gray-700/30 border-gray-200 is-rendering is-diff is-plain-text code-block-header code-header-main icon-slot h-4 w-4 flex-shrink-0 code-header-copy min-w-0 code-header-title truncate code-header-caption code-header-actions code-action-btn transition-colors aria-pressed action-icon currentColor round m9 copied m14 evenodd code-block-body--collapsed code-block-body--expanded code-fallback-plain m-0 code-editor-layer code-height-placeholder editorReady aria-hidden code-editor-fallback-surface code-loading-placeholder loading-skeleton skeleton-line short html-block-node__placeholder html-block-node__placeholder-bar w-4/5 w-2/3 setHostEl shouldRender useDynamic reactNodes hard-break smooth handleScroll clsx renderNode dependency is not install it to enable xlink:href markstream-d2-root-svg instance.render instance missing render returned empty d2-block bg-gray-900 text-gray-100 bg-white text-gray-900 d2-block-header justify-between items-center px-4 py-2.5 border-gray-400/5 gap-x-2 font-medium gap-x-1 p-0.5 bg-gray-700 bg-gray-100 mode-btn px-2 py-1 !showSource is-active showSource d2-action-btn p-2 hover:bg-[var(--vscode-editor-selectionBackground)] copying w-3 h-3 bodyRef d2-block-body bodyStyle !hasPreview d2-source py-4 d2-code d2-error mt-2 d2-render d2-svg pb-3 text-node-stream-delta text-node-stream-delta--a text-node-stream-delta--b valueAttr primary fallback failed image-node__placeholder image-node__spinner image-node__placeholder-text image… placeholder image-node__error load react-dom library text-red-500 p-4">Failed instanceof error.message error keydown transform ease 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 m16 isCollapsed opacity-50 cursor-not-allowed m7 text-gray-300 baseCode absolute top-2 right-2 z-10 gap-2 backdrop-blur infographic-preview min-h-[360px] transition-all duration-100 inset-0 cursor-grab isDragging containerRef w-full justify-center min-h-full markstream-react fixed z-50 bg-black/70 p-4 closeModal dialog h-full max-h-full shadow-lg top-6 right-6 !isDragging cursor-grabbing event.key containerClass in out zoom hr-node thematic-break vitesse-dark vitesse-light shiki shiki-fallback [MarkdownCodeBlockNode] dispose stream-markdown stream-markdown.createShikiStreamRenderer available stale ready requires with ignoring and using default register configured retrying without code-block-content rendererTargetRef code-block-render javascript typescript go python ruby shell powershell plain cpp csharp objectivec objectivecpp yaml markdown rust kotlin java cs php sql pointermove pointerup pointercancel my-8 table-node colgroup table-node__resize-handle loose strict viewBox 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-2 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 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 [mermaidWorkerClient] messageerror cleared worker inject via busy canParse findPrefix text-node tag_open token.type self_closing child key ref className ms-html tag_close parse dynamic template html-inline-node html-inline-node--loading normalizedType thinking htmlFor stream-diffs stream-monaco [katexWorkerClient] init cache-hit timeout waiting slot [markstream-react] htmlPreviewSandbox contains both allow-scripts 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 hunk !options.preserveBlankKind context removed added markstream-pre__diff-pane--inline original markstream-pre__diff-pane--original modified markstream-pre__diff-pane--modified ui-monospace monospace fontFamily markstream-pre--line-numbers markstream-pre--diff-preview markstream-pre--diff-inline showLineNumbers markstream-pre__diff-code line.empty markstream-pre__diff-line--empty markstream-pre__diff-rail markstream-pre__diff-number markstream-pre__diff-content markstream-pre__diff-content-inner markstream-pre__line-numbers markstream-pre__line-numbers-text markstream-pre__code sequencediagram classdiagram kind statediagram erdiagram flowchart graph npm development process katex document mathRef rendering math-rendering math-inline--hidden math-inline__loading math-inline__spinner role aria-describedby prototype constructor module globalThis.requestAnimationFrame globalThis.cancelAnimationFrame existingEnv.getWorkerUrl °C did expected`;
2
2
  export default safeList;
@@ -1,3 +1,3 @@
1
1
  import { PreCodeNodeProps } from '../../types/component-props';
2
2
  import { default as React } from 'react';
3
- export declare function PreCodeNode({ node, className, diffInline, showLineNumbers, style }: PreCodeNodeProps): React.JSX.Element;
3
+ export declare function PreCodeNode({ node, className, diffInline, showLineNumbers, style, monacoOptions }: PreCodeNodeProps): React.JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { CodeBlockMonacoOptions } from '../../types/component-props';
2
+ export declare const defaultCodeFontFamily = "\"SF Mono\", Monaco, Consolas, \"Ubuntu Mono\", \"Liberation Mono\", \"Courier New\", monospace";
3
+ export declare const defaultCodeFontSize = 12;
4
+ export declare const defaultCodeLineHeight = 18;
5
+ export declare function readPositiveCodeMetric(value: unknown): number | undefined;
6
+ export declare function resolveCodePadding(options?: CodeBlockMonacoOptions | null, defaultPadding?: number): {
7
+ top: number;
8
+ bottom: number;
9
+ };
10
+ export declare function resolveCodeTypography(options?: CodeBlockMonacoOptions | null, preferredFontSize?: number): {
11
+ fontFamily: string;
12
+ fontSize: number;
13
+ lineHeight: number;
14
+ };
@@ -1,3 +1,20 @@
1
1
  import { SmoothMarkdownStreamOptions, SmoothMarkdownStreamSnapshot } from 'markstream-core';
2
2
  export type { SmoothMarkdownStreamOptions, SmoothMarkdownStreamSnapshot };
3
- export declare function useSmoothMarkdownStream(options?: SmoothMarkdownStreamOptions): any;
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
+ };
@@ -127,7 +127,7 @@ export declare function LinkNode(props: NodeComponentProps<LinkNodeProps['node']
127
127
  animationIteration?: string | number;
128
128
  }): React.JSX.Element;
129
129
  export declare function ImageNode(rawProps: ImageNodeProps): React.JSX.Element;
130
- export declare function PreCodeNode({ node }: PreCodeNodeProps): React.JSX.Element;
130
+ export declare function PreCodeNode(props: PreCodeNodeProps): React.JSX.Element;
131
131
  export declare function CodeBlockNode(props: CodeBlockNodeProps): React.JSX.Element;
132
132
  export declare function MarkdownCodeBlockNode(props: MarkdownCodeBlockNodeProps): React.JSX.Element;
133
133
  export declare function MermaidBlockNode(props: MermaidBlockNodeProps): React.JSX.Element;
@@ -94,6 +94,7 @@ export interface CodeBlockNodeProps extends CommonCodeBlockProps {
94
94
  showPreviewButton?: boolean;
95
95
  showCollapseButton?: boolean;
96
96
  showFontSizeButtons?: boolean;
97
+ showLineNumbers?: boolean;
97
98
  showTooltips?: boolean;
98
99
  htmlPreviewAllowScripts?: boolean;
99
100
  htmlPreviewSandbox?: string;
@@ -143,6 +144,7 @@ export interface PreCodeNodeProps {
143
144
  style?: CSSProperties;
144
145
  showLineNumbers?: boolean;
145
146
  diffInline?: boolean;
147
+ monacoOptions?: CodeBlockMonacoOptions;
146
148
  }
147
149
  export interface MermaidBlockNodeProps {
148
150
  node: CodeBlockNode;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "markstream-react",
3
3
  "type": "module",
4
- "version": "0.0.56-beta.2",
4
+ "version": "0.0.56-beta.4",
5
5
  "description": "React/Next.js streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown, long documents, Mermaid, KaTeX, Shiki, Monaco, and custom React components.",
6
6
  "author": "Simon He",
7
7
  "license": "MIT",
@@ -88,6 +88,7 @@
88
88
  "mermaid": ">=11",
89
89
  "react": ">=18",
90
90
  "react-dom": ">=18",
91
+ "stream-diffs": ">=0.0.2",
91
92
  "stream-markdown": ">=0.0.16",
92
93
  "stream-monaco": ">=0.0.48"
93
94
  },
@@ -104,6 +105,9 @@
104
105
  "mermaid": {
105
106
  "optional": true
106
107
  },
108
+ "stream-diffs": {
109
+ "optional": true
110
+ },
107
111
  "stream-markdown": {
108
112
  "optional": true
109
113
  },
@@ -114,7 +118,7 @@
114
118
  "dependencies": {
115
119
  "@floating-ui/dom": "^1.8.0",
116
120
  "clsx": "^2.1.1",
117
- "stream-markdown-parser": "1.2.0",
121
+ "stream-markdown-parser": "1.2.3",
118
122
  "markstream-core": "1.0.3"
119
123
  },
120
124
  "devDependencies": {