markstream-octane 0.0.56-beta.1

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 (106) hide show
  1. package/README.md +276 -0
  2. package/dist/client/chunks/languageIconExtended-BZR3DrgI.js +2 -0
  3. package/dist/client/index.js +2 -0
  4. package/dist/client/workers/katexRenderer.worker.js +59 -0
  5. package/dist/client/workers/mermaidParser.worker.js +63 -0
  6. package/dist/index.css +2 -0
  7. package/dist/index.d.ts +845 -0
  8. package/dist/index.px.css +2 -0
  9. package/dist/index.tailwind.css +2009 -0
  10. package/dist/server/index.js +2 -0
  11. package/dist/server.d.ts +661 -0
  12. package/dist/tailwind.cjs +4 -0
  13. package/dist/tailwind.d.ts +2 -0
  14. package/dist/tailwind.js +2 -0
  15. package/dist/types/components/AdmonitionNode/AdmonitionNode.d.ts +12 -0
  16. package/dist/types/components/BlockquoteNode/BlockquoteNode.d.ts +8 -0
  17. package/dist/types/components/CheckboxNode/CheckboxNode.d.ts +7 -0
  18. package/dist/types/components/CodeBlockNode/CodeBlockNode.d.ts +14 -0
  19. package/dist/types/components/CodeBlockNode/HtmlPreviewFrame.d.ts +12 -0
  20. package/dist/types/components/CodeBlockNode/PreCodeNode.d.ts +3 -0
  21. package/dist/types/components/CodeBlockNode/monaco.d.ts +2 -0
  22. package/dist/types/components/CodeBlockNode/monacoThemeRegistry.d.ts +8 -0
  23. package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +5 -0
  24. package/dist/types/components/D2BlockNode/D2BlockNode.d.ts +3 -0
  25. package/dist/types/components/D2BlockNode/d2.d.ts +18 -0
  26. package/dist/types/components/D2BlockNode/index.d.ts +3 -0
  27. package/dist/types/components/DefinitionListNode/DefinitionListNode.d.ts +8 -0
  28. package/dist/types/components/EmojiNode/EmojiNode.d.ts +8 -0
  29. package/dist/types/components/EmphasisNode/EmphasisNode.d.ts +6 -0
  30. package/dist/types/components/FootnoteAnchorNode/FootnoteAnchorNode.d.ts +7 -0
  31. package/dist/types/components/FootnoteNode/FootnoteNode.d.ts +9 -0
  32. package/dist/types/components/FootnoteReferenceNode/FootnoteReferenceNode.d.ts +7 -0
  33. package/dist/types/components/HardBreakNode/HardBreakNode.d.ts +6 -0
  34. package/dist/types/components/HeadingNode/HeadingNode.d.ts +10 -0
  35. package/dist/types/components/HighlightNode/HighlightNode.d.ts +6 -0
  36. package/dist/types/components/HtmlBlockNode/HtmlBlockNode.d.ts +19 -0
  37. package/dist/types/components/HtmlInlineNode/HtmlInlineNode.d.ts +16 -0
  38. package/dist/types/components/ImageNode/ImageNode.d.ts +9 -0
  39. package/dist/types/components/InfographicBlockNode/InfographicBlockNode.d.ts +16 -0
  40. package/dist/types/components/InfographicBlockNode/height.d.ts +6 -0
  41. package/dist/types/components/InfographicBlockNode/index.d.ts +3 -0
  42. package/dist/types/components/InfographicBlockNode/infographic.d.ts +2 -0
  43. package/dist/types/components/InlineCodeNode/InlineCodeNode.d.ts +7 -0
  44. package/dist/types/components/InsertNode/InsertNode.d.ts +6 -0
  45. package/dist/types/components/LinkNode/LinkNode.d.ts +22 -0
  46. package/dist/types/components/ListItemNode/ListItemNode.d.ts +13 -0
  47. package/dist/types/components/ListNode/ListNode.d.ts +10 -0
  48. package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.d.ts +34 -0
  49. package/dist/types/components/Math/MathBlockNode.d.ts +3 -0
  50. package/dist/types/components/Math/MathInlineNode.d.ts +3 -0
  51. package/dist/types/components/Math/katex.d.ts +2 -0
  52. package/dist/types/components/MathBlockNode/MathBlockNode.d.ts +3 -0
  53. package/dist/types/components/MathInlineNode/MathInlineNode.d.ts +3 -0
  54. package/dist/types/components/MermaidBlockNode/MermaidBlockNode.d.ts +16 -0
  55. package/dist/types/components/MermaidBlockNode/height.d.ts +7 -0
  56. package/dist/types/components/MermaidBlockNode/index.d.ts +3 -0
  57. package/dist/types/components/MermaidBlockNode/mermaid.d.ts +23 -0
  58. package/dist/types/components/NodeRenderer/FallbackComponent.d.ts +6 -0
  59. package/dist/types/components/NodeRenderer/preloadMonaco.d.ts +2 -0
  60. package/dist/types/components/NodeRenderer.d.ts +5 -0
  61. package/dist/types/components/ParagraphNode/ParagraphNode.d.ts +9 -0
  62. package/dist/types/components/PreCodeNode/PreCodeNode.d.ts +3 -0
  63. package/dist/types/components/ReferenceNode/ReferenceNode.d.ts +15 -0
  64. package/dist/types/components/StrikethroughNode/StrikethroughNode.d.ts +6 -0
  65. package/dist/types/components/StrongNode/StrongNode.d.ts +6 -0
  66. package/dist/types/components/SubscriptNode/SubscriptNode.d.ts +6 -0
  67. package/dist/types/components/SuperscriptNode/SuperscriptNode.d.ts +6 -0
  68. package/dist/types/components/TableNode/TableNode.d.ts +10 -0
  69. package/dist/types/components/TextNode/TextNode.d.ts +8 -0
  70. package/dist/types/components/ThematicBreakNode/ThematicBreakNode.d.ts +3 -0
  71. package/dist/types/components/Tooltip/Tooltip.d.ts +16 -0
  72. package/dist/types/components/VmrContainerNode/VmrContainerNode.d.ts +10 -0
  73. package/dist/types/context/smoothStreaming.d.ts +2 -0
  74. package/dist/types/context/streamState.d.ts +25 -0
  75. package/dist/types/context/viewportPriority.d.ts +18 -0
  76. package/dist/types/customComponents.d.ts +38 -0
  77. package/dist/types/hooks/useSmoothMarkdownStream.d.ts +21 -0
  78. package/dist/types/i18n/useSafeI18n.d.ts +11 -0
  79. package/dist/types/index.d.ts +71 -0
  80. package/dist/types/renderers/codeBlockExtraProps.d.ts +5 -0
  81. package/dist/types/renderers/renderChildren.d.ts +7 -0
  82. package/dist/types/renderers/renderNode.d.ts +5 -0
  83. package/dist/types/server-renderer/html.d.ts +2 -0
  84. package/dist/types/server-renderer/index.d.ts +176 -0
  85. package/dist/types/server-renderer/katex.d.ts +2 -0
  86. package/dist/types/server.d.ts +56 -0
  87. package/dist/types/tailwind-entry.d.ts +3 -0
  88. package/dist/types/tooltip/singletonTooltip.d.ts +8 -0
  89. package/dist/types/types/component-props.d.ts +234 -0
  90. package/dist/types/types/node-component.d.ts +15 -0
  91. package/dist/types/types/octane.d.ts +12 -0
  92. package/dist/types/types.d.ts +127 -0
  93. package/dist/types/utils/customHtmlTag.d.ts +18 -0
  94. package/dist/types/utils/devEnv.d.ts +2 -0
  95. package/dist/types/utils/htmlToOctane.d.ts +23 -0
  96. package/dist/types/utils/languageIcon.d.ts +9 -0
  97. package/dist/types/utils/languageIconExtended.d.ts +2 -0
  98. package/dist/types/utils/normalizeKaTeXRenderInput.d.ts +2 -0
  99. package/dist/types/utils/performanceMonitor.d.ts +79 -0
  100. package/dist/types/utils/safeRaf.d.ts +3 -0
  101. package/dist/types/utils/streamingTextState.d.ts +3 -0
  102. package/dist/types/workers/katexRenderer.worker.d.ts +2 -0
  103. package/dist/types/workers/katexWorkerClient.d.ts +32 -0
  104. package/dist/types/workers/mermaidParser.worker.d.ts +2 -0
  105. package/dist/types/workers/mermaidWorkerClient.d.ts +15 -0
  106. package/package.json +149 -0
@@ -0,0 +1,234 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { CodeBlockNode } from 'stream-markdown-parser';
3
+ import type { OctaneStyle } from './octane';
4
+ export interface CodeBlockMonacoThemeObject {
5
+ name: string;
6
+ base?: string;
7
+ inherit?: boolean;
8
+ colors?: Record<string, string>;
9
+ rules?: Array<Record<string, unknown>>;
10
+ [key: string]: unknown;
11
+ }
12
+ export type CodeBlockMonacoTheme = string | CodeBlockMonacoThemeObject;
13
+ export type CodeBlockMonacoLanguage = string | ((...args: unknown[]) => unknown);
14
+ export interface CommonCodeBlockProps {
15
+ showHeader?: boolean;
16
+ showCopyButton?: boolean;
17
+ showExpandButton?: boolean;
18
+ }
19
+ export interface ShikiCodeBlockProps extends CommonCodeBlockProps {
20
+ themes?: readonly string[];
21
+ /**
22
+ * Shiki language preload request forwarded to stream-markdown's registerHighlight().
23
+ * This is not a rendering allow-list; already available Shiki languages may still highlight.
24
+ */
25
+ langs?: readonly string[];
26
+ }
27
+ export interface CodeBlockDiffHideUnchangedRegionsOptions {
28
+ enabled?: boolean;
29
+ contextLineCount?: number;
30
+ minimumLineCount?: number;
31
+ revealLineCount?: number;
32
+ }
33
+ export type CodeBlockDiffHideUnchangedRegions = boolean | CodeBlockDiffHideUnchangedRegionsOptions;
34
+ export type CodeBlockDiffLineStyle = 'background' | 'bar';
35
+ export type CodeBlockDiffAppearance = 'auto' | 'light' | 'dark';
36
+ export type CodeBlockDiffUnchangedRegionStyle = 'line-info' | 'line-info-basic' | 'metadata' | 'simple';
37
+ export type CodeBlockDiffHunkActionKind = 'revert' | 'stage';
38
+ export type CodeBlockDiffHunkSide = 'upper' | 'lower';
39
+ export interface CodeBlockDiffHunkActionContext {
40
+ action: CodeBlockDiffHunkActionKind;
41
+ side: CodeBlockDiffHunkSide;
42
+ lineChange: unknown;
43
+ originalModel: unknown;
44
+ modifiedModel: unknown;
45
+ }
46
+ export interface CodeBlockMonacoOptions {
47
+ MAX_HEIGHT?: number | string;
48
+ fontSize?: number;
49
+ lineHeight?: number;
50
+ fontFamily?: string;
51
+ tabSize?: number;
52
+ readOnly?: boolean;
53
+ wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded' | string;
54
+ wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent' | string;
55
+ theme?: string;
56
+ themes?: CodeBlockMonacoTheme[];
57
+ languages?: CodeBlockMonacoLanguage[];
58
+ renderSideBySide?: boolean;
59
+ useInlineViewWhenSpaceIsLimited?: boolean;
60
+ enableSplitViewResizing?: boolean;
61
+ ignoreTrimWhitespace?: boolean;
62
+ maxComputationTime?: number;
63
+ diffAlgorithm?: string;
64
+ renderIndicators?: boolean;
65
+ originalEditable?: boolean;
66
+ revealDebounceMs?: number;
67
+ revealStrategy?: 'bottom' | 'centerIfOutside' | 'center';
68
+ revealBatchOnIdleMs?: number;
69
+ updateThrottleMs?: number;
70
+ diffUpdateThrottleMs?: number;
71
+ diffAutoScroll?: boolean;
72
+ diffHideUnchangedRegions?: CodeBlockDiffHideUnchangedRegions;
73
+ diffLineStyle?: CodeBlockDiffLineStyle;
74
+ diffAppearance?: CodeBlockDiffAppearance;
75
+ diffUnchangedRegionStyle?: CodeBlockDiffUnchangedRegionStyle;
76
+ diffHunkActionsOnHover?: boolean;
77
+ diffHunkHoverHideDelayMs?: number;
78
+ onDiffHunkAction?: (context: CodeBlockDiffHunkActionContext) => void | boolean | Promise<void | boolean>;
79
+ scrollbar?: Record<string, unknown>;
80
+ [key: string]: unknown;
81
+ }
82
+ export interface CodeBlockNodeProps extends CommonCodeBlockProps {
83
+ node: CodeBlockNode;
84
+ isDark?: boolean;
85
+ loading?: boolean;
86
+ stream?: boolean;
87
+ darkTheme?: CodeBlockMonacoTheme;
88
+ lightTheme?: CodeBlockMonacoTheme;
89
+ isShowPreview?: boolean;
90
+ monacoOptions?: CodeBlockMonacoOptions;
91
+ enableFontSizeControl?: boolean;
92
+ minWidth?: string | number;
93
+ maxWidth?: string | number;
94
+ themes?: CodeBlockMonacoTheme[];
95
+ showPreviewButton?: boolean;
96
+ showCollapseButton?: boolean;
97
+ showFontSizeButtons?: boolean;
98
+ showTooltips?: boolean;
99
+ htmlPreviewAllowScripts?: boolean;
100
+ htmlPreviewSandbox?: string;
101
+ customId?: string;
102
+ }
103
+ export interface ImageNodeProps {
104
+ node: {
105
+ type: 'image';
106
+ src: string;
107
+ alt: string;
108
+ title: string | null;
109
+ raw: string;
110
+ loading?: boolean;
111
+ };
112
+ fallbackSrc?: string;
113
+ lazy?: boolean;
114
+ usePlaceholder?: boolean;
115
+ }
116
+ export interface LinkNodeProps {
117
+ node: {
118
+ type: 'link';
119
+ href: string;
120
+ title: string | null;
121
+ text: string;
122
+ attrs?: [string, string][];
123
+ children: {
124
+ type: string;
125
+ raw: string;
126
+ }[];
127
+ raw: string;
128
+ loading?: boolean;
129
+ };
130
+ indexKey: number | string;
131
+ customId?: string;
132
+ showTooltip?: boolean;
133
+ color?: string;
134
+ underlineHeight?: number;
135
+ underlineBottom?: number | string;
136
+ animationDuration?: number;
137
+ animationOpacity?: number;
138
+ animationTiming?: string;
139
+ animationIteration?: string | number;
140
+ }
141
+ export interface PreCodeNodeProps {
142
+ node: CodeBlockNode;
143
+ className?: string;
144
+ style?: OctaneStyle;
145
+ showLineNumbers?: boolean;
146
+ diffInline?: boolean;
147
+ }
148
+ export interface MermaidBlockNodeProps {
149
+ node: CodeBlockNode;
150
+ maxHeight?: string | null;
151
+ estimatedPreviewHeightPx?: number;
152
+ loading?: boolean;
153
+ isDark?: boolean;
154
+ workerTimeoutMs?: number;
155
+ parseTimeoutMs?: number;
156
+ renderTimeoutMs?: number;
157
+ fullRenderTimeoutMs?: number;
158
+ renderDebounceMs?: number;
159
+ contentStableDelayMs?: number;
160
+ previewPollDelayMs?: number;
161
+ previewPollMaxDelayMs?: number;
162
+ previewPollMaxAttempts?: number;
163
+ showHeader?: boolean;
164
+ showModeToggle?: boolean;
165
+ showCopyButton?: boolean;
166
+ showExportButton?: boolean;
167
+ showFullscreenButton?: boolean;
168
+ showCollapseButton?: boolean;
169
+ showZoomControls?: boolean;
170
+ enableWheelZoom?: boolean;
171
+ isStrict?: boolean;
172
+ enableMermaidInteractions?: boolean;
173
+ showTooltips?: boolean;
174
+ onRenderError?: (error: unknown, code: string, container: HTMLElement) => boolean | void;
175
+ }
176
+ export interface CodeBlockPreviewPayload {
177
+ node: CodeBlockNode;
178
+ artifactType: 'text/html' | 'image/svg+xml';
179
+ artifactTitle: string;
180
+ id: string;
181
+ }
182
+ export interface MermaidBlockEvent<TPayload = unknown> {
183
+ payload?: TPayload;
184
+ defaultPrevented: boolean;
185
+ preventDefault: () => void;
186
+ svgElement?: SVGElement | null;
187
+ svgString?: string | null;
188
+ }
189
+ export interface D2BlockNodeProps {
190
+ node: CodeBlockNode;
191
+ maxHeight?: string | null;
192
+ loading?: boolean;
193
+ isDark?: boolean;
194
+ progressiveRender?: boolean;
195
+ progressiveIntervalMs?: number;
196
+ themeId?: number | null;
197
+ darkThemeId?: number | null;
198
+ showHeader?: boolean;
199
+ showModeToggle?: boolean;
200
+ showCopyButton?: boolean;
201
+ showExportButton?: boolean;
202
+ showCollapseButton?: boolean;
203
+ }
204
+ export interface MathBlockNodeProps {
205
+ node: {
206
+ type: 'math_block';
207
+ content: string;
208
+ raw: string;
209
+ loading?: boolean;
210
+ };
211
+ }
212
+ export interface MathInlineNodeProps {
213
+ node: {
214
+ type: 'math_inline';
215
+ content: string;
216
+ raw: string;
217
+ loading?: boolean;
218
+ markup?: string;
219
+ };
220
+ }
221
+ export interface InfographicBlockNodeProps {
222
+ node: CodeBlockNode;
223
+ maxHeight?: string | null;
224
+ estimatedPreviewHeightPx?: number;
225
+ loading?: boolean;
226
+ isDark?: boolean;
227
+ showHeader?: boolean;
228
+ showModeToggle?: boolean;
229
+ showCopyButton?: boolean;
230
+ showCollapseButton?: boolean;
231
+ showExportButton?: boolean;
232
+ showFullscreenButton?: boolean;
233
+ showZoomControls?: boolean;
234
+ }
@@ -0,0 +1,15 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type * as Octane from 'octane';
3
+ import type { RenderContext, RenderNodeFn } from '../types';
4
+ export interface NodeComponentProps<TNode = unknown> {
5
+ node: TNode;
6
+ ctx?: RenderContext;
7
+ renderNode?: RenderNodeFn;
8
+ indexKey?: string | number | bigint;
9
+ customId?: string;
10
+ isDark?: boolean;
11
+ typewriter?: boolean;
12
+ /** Enable/disable fade animations. Default: true */
13
+ fade?: boolean;
14
+ children?: Octane.OctaneNode;
15
+ }
@@ -0,0 +1,12 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { OctaneNode } from 'octane';
3
+ import type { Octane } from 'octane/jsx-runtime';
4
+ export type OctanePropsWithChildren<P> = P & {
5
+ children?: OctaneNode;
6
+ };
7
+ export interface OctaneRefObject<T> {
8
+ current: T;
9
+ }
10
+ export type OctaneStyle = Exclude<Octane.JSX.IntrinsicElements['div']['style'], string | undefined>;
11
+ export type OctaneHeadingAttributes = Octane.JSX.IntrinsicElements['h1'];
12
+ export type OctaneSpanAttributes = Octane.JSX.IntrinsicElements['span'];
@@ -0,0 +1,127 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type * as Octane from 'octane';
3
+ import type { ComponentBody } from 'octane';
4
+ import type { BaseNode, HtmlPolicy, MarkdownIt, ParsedNode, ParseOptions } from 'stream-markdown-parser';
5
+ import type { CustomComponentMap, HtmlComponentDefinitions, HtmlComponentMap, StreamingComponentDefinitions, StreamingComponentMap } from './customComponents';
6
+ import type { SmoothMarkdownStreamOptions } from './hooks/useSmoothMarkdownStream';
7
+ import type { CodeBlockMonacoOptions, CodeBlockMonacoTheme, CodeBlockNodeProps, CodeBlockPreviewPayload, D2BlockNodeProps, InfographicBlockNodeProps, MermaidBlockNodeProps, ShikiCodeBlockProps } from './types/component-props';
8
+ type NodeRendererCodeBlockThemes = CodeBlockNodeProps['themes'] | ShikiCodeBlockProps['themes'];
9
+ export type NodeRendererCodeBlockProps = Partial<Omit<CodeBlockNodeProps, 'node' | 'themes'>> & Partial<Omit<ShikiCodeBlockProps, 'themes'>> & {
10
+ themes?: NodeRendererCodeBlockThemes;
11
+ } & Record<string, unknown>;
12
+ export interface NodeRendererProps<TStreamingComponents extends Record<string, ComponentBody<any>> = StreamingComponentMap, THtmlComponents extends Record<string, any> = HtmlComponentMap> {
13
+ content?: string;
14
+ nodes?: readonly BaseNode[] | null;
15
+ /**
16
+ * Whether the input stream is complete (end-of-stream). When true, the parser
17
+ * can stop emitting streaming "loading" nodes for unfinished constructs.
18
+ */
19
+ final?: boolean;
20
+ parseOptions?: ParseOptions;
21
+ customMarkdownIt?: (md: MarkdownIt) => MarkdownIt;
22
+ streamingComponents?: TStreamingComponents & StreamingComponentDefinitions<TStreamingComponents>;
23
+ htmlComponents?: THtmlComponents & HtmlComponentDefinitions<THtmlComponents>;
24
+ /** Log parse/render timing stats (dev only). */
25
+ debugPerformance?: boolean;
26
+ /**
27
+ * Custom HTML-like tags that should be emitted as custom nodes (e.g. ['thinking']).
28
+ * Forwarded to `getMarkdown()` and merged into parseOptions.
29
+ */
30
+ customHtmlTags?: readonly string[];
31
+ htmlPolicy?: HtmlPolicy;
32
+ viewportPriority?: boolean;
33
+ codeBlockStream?: boolean;
34
+ codeBlockDarkTheme?: CodeBlockMonacoTheme;
35
+ codeBlockLightTheme?: CodeBlockMonacoTheme;
36
+ codeBlockMonacoOptions?: CodeBlockMonacoOptions;
37
+ renderCodeBlocksAsPre?: boolean;
38
+ codeBlockMinWidth?: string | number;
39
+ codeBlockMaxWidth?: string | number;
40
+ codeBlockProps?: NodeRendererCodeBlockProps;
41
+ mermaidProps?: Partial<Omit<MermaidBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
42
+ d2Props?: Partial<Omit<D2BlockNodeProps, 'node' | 'loading' | 'isDark'>>;
43
+ infographicProps?: Partial<Omit<InfographicBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
44
+ showTooltips?: boolean;
45
+ /**
46
+ * Theme names or theme objects preloaded for Monaco-backed code blocks.
47
+ * When Shiki code blocks are used, only string theme names are forwarded to
48
+ * MarkdownCodeBlockNode / stream-markdown; theme objects are ignored.
49
+ */
50
+ themes?: CodeBlockMonacoTheme[];
51
+ /**
52
+ * Shiki language preload list forwarded to MarkdownCodeBlockNode.
53
+ *
54
+ * The default Octane code block renderer is Monaco-backed. This prop is used
55
+ * when a custom `code_block` or language renderer uses MarkdownCodeBlockNode.
56
+ */
57
+ langs?: readonly string[];
58
+ isDark?: boolean;
59
+ customId?: string;
60
+ indexKey?: number | string;
61
+ /** Show a blinking typewriter cursor while streamed content grows. Default: false */
62
+ typewriter?: boolean;
63
+ /** Enable/disable non-code-node enter and streamed-text fade animations. Default: true */
64
+ fade?: boolean;
65
+ /**
66
+ * Enable built-in smooth pacing for streaming `content` updates.
67
+ * - `true`: force-enable smooth streaming (content mode only)
68
+ * - `false`: force-disable smooth streaming
69
+ * - `'auto'` (default): enable only when typewriter/incremental mode is active
70
+ * Applies when rendering from `content` (not `nodes`).
71
+ */
72
+ smoothStreaming?: boolean | 'auto';
73
+ /** Options forwarded to the built-in smooth streaming controller. Read once when the renderer is created. */
74
+ smoothStreamingOptions?: SmoothMarkdownStreamOptions;
75
+ batchRendering?: boolean;
76
+ initialRenderBatchSize?: number;
77
+ renderBatchSize?: number;
78
+ renderBatchDelay?: number;
79
+ renderBatchBudgetMs?: number;
80
+ renderBatchIdleTimeoutMs?: number;
81
+ deferNodesUntilVisible?: boolean;
82
+ maxLiveNodes?: number;
83
+ liveNodeBuffer?: number;
84
+ onCopy?: (code: string) => void;
85
+ onHandleArtifactClick?: (payload: CodeBlockPreviewPayload) => void;
86
+ onClick?: (event: MouseEvent) => void;
87
+ onMouseOver?: (event: MouseEvent) => void;
88
+ onMouseOut?: (event: MouseEvent) => void;
89
+ }
90
+ export interface RenderContext {
91
+ customId?: string;
92
+ isDark?: boolean;
93
+ final?: boolean;
94
+ indexKey?: string;
95
+ typewriter?: boolean;
96
+ /** Enable/disable fade animations. Default: true */
97
+ fade?: boolean;
98
+ textStreamState?: Map<string, string>;
99
+ streamRenderVersion?: number;
100
+ customComponents?: CustomComponentMap;
101
+ streamingComponents?: StreamingComponentMap;
102
+ htmlComponents?: HtmlComponentMap;
103
+ customHtmlTags?: readonly string[];
104
+ htmlPolicy?: HtmlPolicy;
105
+ codeBlockProps?: NodeRendererCodeBlockProps;
106
+ mermaidProps?: Partial<Omit<MermaidBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
107
+ d2Props?: Partial<Omit<D2BlockNodeProps, 'node' | 'loading' | 'isDark'>>;
108
+ infographicProps?: Partial<Omit<InfographicBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
109
+ showTooltips?: boolean;
110
+ codeBlockStream?: boolean;
111
+ renderCodeBlocksAsPre?: boolean;
112
+ codeBlockThemes?: {
113
+ themes?: CodeBlockMonacoTheme[];
114
+ darkTheme?: CodeBlockMonacoTheme;
115
+ lightTheme?: CodeBlockMonacoTheme;
116
+ monacoOptions?: CodeBlockMonacoOptions;
117
+ minWidth?: string | number;
118
+ maxWidth?: string | number;
119
+ langs?: readonly string[];
120
+ };
121
+ events: {
122
+ onCopy?: (code: string) => void;
123
+ onHandleArtifactClick?: (payload: CodeBlockPreviewPayload) => void;
124
+ };
125
+ }
126
+ export type RenderNodeFn = (node: ParsedNode, key: string | number | bigint, ctx: RenderContext) => Octane.OctaneNode;
127
+ export {};
@@ -0,0 +1,18 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { ComponentBody } from 'octane';
3
+ import type { ParsedNode } from 'stream-markdown-parser';
4
+ import type { CustomComponentDisplayMode } from '../customComponents';
5
+ export interface ResolvedCustomHtmlTag {
6
+ tag: string;
7
+ isWhitelisted: boolean;
8
+ component: ComponentBody<any> | null;
9
+ display: CustomComponentDisplayMode | undefined;
10
+ }
11
+ export declare function resolveCustomHtmlTag(node: Pick<ParsedNode, 'type'> & {
12
+ tag?: string | null;
13
+ content?: unknown;
14
+ }, customComponents: Record<string, ComponentBody<any>>, customHtmlTags?: readonly string[]): ResolvedCustomHtmlTag | null;
15
+ export declare function isParagraphBreakingCustomHtmlNode(node: Pick<ParsedNode, 'type'> & {
16
+ tag?: string | null;
17
+ content?: unknown;
18
+ }, customComponents: Record<string, ComponentBody<any>>, customHtmlTags?: readonly string[]): boolean;
@@ -0,0 +1,2 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export declare function isDevEnvironment(): boolean;
@@ -0,0 +1,23 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { ComponentBody, OctaneNode } from 'octane';
3
+ import type { HtmlPolicy, ParsedNode } from 'stream-markdown-parser';
4
+ import type { RenderContext, RenderNodeFn } from '../types';
5
+ import { sanitizeHtmlAttrs as sanitizeHtmlAttrsBase, tokenizeHtml as tokenizeHtmlBase } from 'stream-markdown-parser';
6
+ export type { HtmlToken } from 'stream-markdown-parser';
7
+ type HtmlOctaneComponentMap = Record<string, ComponentBody<any>>;
8
+ type HtmlOctanePropComponentMap = Record<string, ComponentBody<any>>;
9
+ type HtmlOctaneNodeComponentMap = Record<string, ComponentBody<any>>;
10
+ interface HtmlToOctaneOptions {
11
+ ctx?: RenderContext;
12
+ keyPrefix?: string;
13
+ nodeComponents?: HtmlOctaneNodeComponentMap;
14
+ propComponents?: HtmlOctanePropComponentMap;
15
+ renderNode?: RenderNodeFn;
16
+ sourceNode?: ParsedNode;
17
+ }
18
+ export declare function normalizeDomAttrs(attrs: Record<string, string>): Record<string, unknown>;
19
+ export declare const tokenizeHtml: typeof tokenizeHtmlBase;
20
+ export declare const sanitizeHtmlAttrs: typeof sanitizeHtmlAttrsBase;
21
+ export declare function isCustomHtmlComponent(tagName: string, customComponents: HtmlOctaneComponentMap): boolean;
22
+ export declare function hasCustomHtmlComponents(content: string, customComponents: HtmlOctaneComponentMap): boolean;
23
+ export declare function parseHtmlToOctaneNodes(content: string, customComponents: HtmlOctaneComponentMap, htmlPolicy?: HtmlPolicy, options?: HtmlToOctaneOptions): OctaneNode[] | null;
@@ -0,0 +1,9 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export type LanguageIconResolver = (lang: string) => string | undefined | null;
3
+ export declare function setLanguageIconResolver(resolver?: LanguageIconResolver | null): void;
4
+ export declare function normalizeLanguageIdentifier(lang?: string | null): string;
5
+ export declare function resolveMonacoLanguageId(lang?: string | null): string;
6
+ export declare function preloadExtendedLanguageIcons(): Promise<void>;
7
+ export declare function subscribeLanguageIconsRevision(listener: () => void): () => void;
8
+ export declare function getLanguageIcon(lang: string): string;
9
+ export declare const languageMap: Record<string, string>;
@@ -0,0 +1,2 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export declare const EXTENDED_LANGUAGE_ICON_MAP: Record<string, string>;
@@ -0,0 +1,2 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export declare function normalizeKaTeXRenderInput(content: string): string;
@@ -0,0 +1,79 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ /**
3
+ * Lightweight performance monitoring helper for KaTeX rendering.
4
+ * Only used during development to understand Worker/cache benefits.
5
+ */
6
+ interface RenderMetrics {
7
+ type: 'worker' | 'direct' | 'cache-hit';
8
+ duration: number;
9
+ formulaLength: number;
10
+ timestamp: number;
11
+ success: boolean;
12
+ error?: string;
13
+ }
14
+ declare class PerformanceMonitor {
15
+ private metrics;
16
+ private enabled;
17
+ private maxMetrics;
18
+ enable(): void;
19
+ disable(): void;
20
+ recordRender(metrics: RenderMetrics): void;
21
+ private averages;
22
+ getStats(): {
23
+ totalRenders: number;
24
+ cacheHits: number;
25
+ cacheHitRate: string;
26
+ workerCalls: number;
27
+ directCalls: number;
28
+ averageWorkerTime: string;
29
+ averageDirectTime: string;
30
+ averageCacheHitTime: string;
31
+ workerSavings: string;
32
+ recommendation: string;
33
+ };
34
+ printReport(): {
35
+ totalRenders: number;
36
+ cacheHits: number;
37
+ cacheHitRate: string;
38
+ workerCalls: number;
39
+ directCalls: number;
40
+ averageWorkerTime: string;
41
+ averageDirectTime: string;
42
+ averageCacheHitTime: string;
43
+ workerSavings: string;
44
+ recommendation: string;
45
+ };
46
+ reset(): void;
47
+ exportMetrics(): {
48
+ metrics: RenderMetrics[];
49
+ stats: {
50
+ totalRenders: number;
51
+ cacheHits: number;
52
+ cacheHitRate: string;
53
+ workerCalls: number;
54
+ directCalls: number;
55
+ averageWorkerTime: string;
56
+ averageDirectTime: string;
57
+ averageCacheHitTime: string;
58
+ workerSavings: string;
59
+ recommendation: string;
60
+ };
61
+ timestamp: number;
62
+ };
63
+ }
64
+ export declare const perfMonitor: PerformanceMonitor;
65
+ export declare function enablePerfMonitoring(): void;
66
+ export declare function disablePerfMonitoring(): void;
67
+ export declare function getPerfReport(): {
68
+ totalRenders: number;
69
+ cacheHits: number;
70
+ cacheHitRate: string;
71
+ workerCalls: number;
72
+ directCalls: number;
73
+ averageWorkerTime: string;
74
+ averageDirectTime: string;
75
+ averageCacheHitTime: string;
76
+ workerSavings: string;
77
+ recommendation: string;
78
+ };
79
+ export {};
@@ -0,0 +1,3 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export declare function safeRaf(cb: FrameRequestCallback): any;
3
+ export declare function safeCancelRaf(id: number | null | undefined): void;
@@ -0,0 +1,3 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export { resolveStreamingTextState, resolveStreamingTextUpdate } from 'markstream-core';
3
+ export type { ResolveStreamingTextStateOptions, ResolveStreamingTextUpdateOptions, StreamingRenderState, StreamingTextStateResult } from 'markstream-core';
@@ -0,0 +1,2 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import 'katex/contrib/mhchem';
@@ -0,0 +1,32 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export declare function setKaTeXWorker(w: Worker): void;
3
+ export declare function clearKaTeXWorker(): void;
4
+ export declare function setKaTeXWorkerDebug(enabled: boolean): void;
5
+ export declare const WORKER_BUSY_CODE = "WORKER_BUSY";
6
+ export declare function renderKaTeXInWorker(content: string, displayMode?: boolean, timeout?: number, signal?: AbortSignal): Promise<string>;
7
+ export declare function setKaTeXCache(content: string, displayMode: boolean, html: string): void;
8
+ export declare function clearKaTeXCache(): void;
9
+ export declare function setKaTeXConcurrencyLimit(limit: number): void;
10
+ export declare function waitForKaTeXWorkerSlot(timeout?: number, signal?: AbortSignal): Promise<void>;
11
+ export interface BackpressureOptions {
12
+ timeout?: number;
13
+ waitTimeout?: number;
14
+ backoffMs?: number;
15
+ maxRetries?: number;
16
+ signal?: AbortSignal;
17
+ }
18
+ declare const defaultBackpressure: {
19
+ timeout: number;
20
+ waitTimeout: number;
21
+ backoffMs: number;
22
+ maxRetries: number;
23
+ };
24
+ export declare function setKaTeXBackpressureDefaults(opts: Partial<typeof defaultBackpressure>): void;
25
+ export declare function getKaTeXBackpressureDefaults(): {
26
+ timeout: number;
27
+ waitTimeout: number;
28
+ backoffMs: number;
29
+ maxRetries: number;
30
+ };
31
+ export declare function renderKaTeXWithBackpressure(content: string, displayMode?: boolean, opts?: BackpressureOptions): Promise<string>;
32
+ export {};
@@ -0,0 +1,2 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export {};
@@ -0,0 +1,15 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ type Theme = 'light' | 'dark';
3
+ export declare function setMermaidWorkerClientDebug(enabled: boolean): void;
4
+ export declare function setMermaidWorkerMaxConcurrency(n: number): void;
5
+ export declare function getMermaidWorkerLoad(): {
6
+ inFlight: number;
7
+ max: number;
8
+ };
9
+ export declare const MERMAID_WORKER_BUSY_CODE = "WORKER_BUSY";
10
+ export declare function setMermaidWorker(w: Worker): void;
11
+ export declare function clearMermaidWorker(): void;
12
+ export declare function canParseOffthread(code: string, theme: Theme, timeout?: number): Promise<boolean>;
13
+ export declare function findPrefixOffthread(code: string, theme: Theme, timeout?: number): Promise<string | null>;
14
+ export declare function terminateWorker(): void;
15
+ export {};