markstream-solid 0.0.0-stage → 2.0.23

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 (102) hide show
  1. package/README.md +120 -2
  2. package/dist/client/extended-BTbixd9o.js +38 -0
  3. package/dist/client/index.js +5640 -0
  4. package/dist/client/katexWorkerClient-ZLzkPVv_.js +260 -0
  5. package/dist/client/languageIcon-CDTPjsAQ.js +280 -0
  6. package/dist/client/mermaidWorkerClient-BAvGYsCO.js +243 -0
  7. package/dist/client/utils/index.js +31 -0
  8. package/dist/client/utils/katex-threshold.js +32 -0
  9. package/dist/client/utils/performance-monitor.js +73 -0
  10. package/dist/client/utils/safeRaf.js +27 -0
  11. package/dist/client/workers/katexCdnWorker.js +177 -0
  12. package/dist/client/workers/katexRenderer.worker.js +45 -0
  13. package/dist/client/workers/katexWorkerClient.js +16 -0
  14. package/dist/client/workers/mermaidCdnWorker.js +226 -0
  15. package/dist/client/workers/mermaidParser.worker.js +73 -0
  16. package/dist/client/workers/mermaidWorkerClient.js +13 -0
  17. package/dist/components/BuiltinNodes.d.ts +42 -0
  18. package/dist/components/CodeBlockNode.d.ts +10 -0
  19. package/dist/components/DiagramBlockNode.d.ts +27 -0
  20. package/dist/components/HtmlPreviewFrame.d.ts +10 -0
  21. package/dist/components/MarkstreamProvider.d.ts +5 -0
  22. package/dist/components/MarkstreamVirtualTimeline.d.ts +35 -0
  23. package/dist/components/MathNode.d.ts +6 -0
  24. package/dist/components/NodeRenderer.d.ts +27 -0
  25. package/dist/components/NodeSlot.d.ts +11 -0
  26. package/dist/components/PreCodeBlock.d.ts +3 -0
  27. package/dist/components/PreCodeNode.d.ts +9 -0
  28. package/dist/components/RenderNode.d.ts +11 -0
  29. package/dist/components/StreamingTextNode.d.ts +2 -0
  30. package/dist/components/ToolbarButton.d.ts +14 -0
  31. package/dist/components/ToolbarIcon.d.ts +18 -0
  32. package/dist/components/Tooltip.d.ts +13 -0
  33. package/dist/components/lifecycle.d.ts +6 -0
  34. package/dist/components/mathHeightCache.d.ts +5 -0
  35. package/dist/components/rendererModeDefaults.d.ts +4 -0
  36. package/dist/components/shared/diagram-height.d.ts +16 -0
  37. package/dist/components/shared/node-helpers.d.ts +78 -0
  38. package/dist/components/shared/node-outlet-helpers.d.ts +10 -0
  39. package/dist/components/shared/render-window.d.ts +18 -0
  40. package/dist/components/shared/reuseParsedNodes.d.ts +3 -0
  41. package/dist/components/viewport.d.ts +5 -0
  42. package/dist/components/virtualLayoutKey.d.ts +13 -0
  43. package/dist/configuration.d.ts +9 -0
  44. package/dist/customComponents.d.ts +36 -0
  45. package/dist/enhanceRenderedHtml.d.ts +25 -0
  46. package/dist/hydrateCustomTagContent.d.ts +2 -0
  47. package/dist/i18n/useSafeI18n.d.ts +4 -0
  48. package/dist/icon-themes/index.d.ts +2 -0
  49. package/dist/icon-themes/material/core.d.ts +2 -0
  50. package/dist/icon-themes/material/extended.d.ts +2 -0
  51. package/dist/icon-themes/material/index.d.ts +2 -0
  52. package/dist/icon-themes/registry.d.ts +9 -0
  53. package/dist/icon-themes/types.d.ts +11 -0
  54. package/dist/index.css +3279 -0
  55. package/dist/index.d.ts +48 -0
  56. package/dist/index.px.css +3279 -0
  57. package/dist/index.tailwind.css +3279 -0
  58. package/dist/optional/d2.d.ts +17 -0
  59. package/dist/optional/infographic.d.ts +31 -0
  60. package/dist/optional/katex.d.ts +9 -0
  61. package/dist/optional/mermaid.d.ts +27 -0
  62. package/dist/optional/streamDiffs.d.ts +29 -0
  63. package/dist/renderMarkdownHtml.d.ts +30 -0
  64. package/dist/sanitizeHtmlContent.d.ts +2 -0
  65. package/dist/server/extended-CKyCqQt3.js +69 -0
  66. package/dist/server/index.js +6264 -0
  67. package/dist/server/languageIcon-TXkIEBPf.js +353 -0
  68. package/dist/server/utils/index.js +31 -0
  69. package/dist/server/utils/katex-threshold.js +41 -0
  70. package/dist/server/utils/performance-monitor.js +120 -0
  71. package/dist/server/utils/safeRaf.js +28 -0
  72. package/dist/server/workers/katexCdnWorker.js +190 -0
  73. package/dist/server/workers/katexWorkerClient.js +373 -0
  74. package/dist/server/workers/mermaidCdnWorker.js +238 -0
  75. package/dist/server/workers/mermaidWorkerClient.js +333 -0
  76. package/dist/streamDiffsWorker.d.ts +72 -0
  77. package/dist/tailwind.d.ts +2 -0
  78. package/dist/tailwind.js +3 -0
  79. package/dist/tooltip/singletonTooltip.d.ts +7 -0
  80. package/dist/types/component-props.d.ts +253 -0
  81. package/dist/types/node-renderer-props.d.ts +333 -0
  82. package/dist/useSmoothMarkdownStream.d.ts +22 -0
  83. package/dist/utils/clipboard.d.ts +1 -0
  84. package/dist/utils/d2RenderSalt.d.ts +1 -0
  85. package/dist/utils/footnoteTarget.d.ts +1 -0
  86. package/dist/utils/index.d.ts +8 -0
  87. package/dist/utils/katex-threshold.d.ts +20 -0
  88. package/dist/utils/languageIcon.d.ts +8 -0
  89. package/dist/utils/mermaidRenderId.d.ts +1 -0
  90. package/dist/utils/normalizeKaTeXRenderInput.d.ts +1 -0
  91. package/dist/utils/performance-monitor.d.ts +121 -0
  92. package/dist/utils/resolveLanguageIcon.d.ts +2 -0
  93. package/dist/utils/safeRaf.d.ts +2 -0
  94. package/dist/utils/virtualItemMeasurement.d.ts +5 -0
  95. package/dist/virtual-adapter.d.ts +165 -0
  96. package/dist/workers/katexCdnWorker.d.ts +20 -0
  97. package/dist/workers/katexRenderer.worker.d.ts +1 -0
  98. package/dist/workers/katexWorkerClient.d.ts +35 -0
  99. package/dist/workers/mermaidCdnWorker.d.ts +15 -0
  100. package/dist/workers/mermaidParser.worker.d.ts +1 -0
  101. package/dist/workers/mermaidWorkerClient.d.ts +15 -0
  102. package/package.json +149 -3
@@ -0,0 +1,226 @@
1
+ import { applyMermaidThemeDirective as s } from "markstream-core";
2
+ function o(e) {
3
+ return JSON.stringify(e);
4
+ }
5
+ function l(e) {
6
+ const i = e.mode ?? "module", a = o(e.mermaidUrl), t = o({
7
+ startOnLoad: !1,
8
+ securityLevel: "strict",
9
+ flowchart: { htmlLabels: !1 },
10
+ ...e.initializeOptions || {}
11
+ }), r = `
12
+ let DEBUG = false
13
+ let mermaid = null
14
+ let mermaidLoadError = null
15
+
16
+ const applyMermaidThemeDirective = ${s.toString()}
17
+
18
+ function normalizeMermaidModule(mod) {
19
+ if (!mod)
20
+ return mod
21
+ const candidate = mod && mod.default ? mod.default : mod
22
+ if (candidate && (typeof candidate.render === 'function' || typeof candidate.parse === 'function' || typeof candidate.initialize === 'function'))
23
+ return candidate
24
+ if (candidate && candidate.mermaidAPI && (typeof candidate.mermaidAPI.render === 'function' || typeof candidate.mermaidAPI.parse === 'function')) {
25
+ const api = candidate.mermaidAPI
26
+ return {
27
+ ...candidate,
28
+ render: api.render ? api.render.bind(api) : undefined,
29
+ parse: api.parse ? api.parse.bind(api) : undefined,
30
+ initialize: (opts) => {
31
+ if (typeof candidate.initialize === 'function')
32
+ return candidate.initialize(opts)
33
+ return api.initialize ? api.initialize(opts) : undefined
34
+ },
35
+ }
36
+ }
37
+ if (mod && mod.mermaid && typeof mod.mermaid.parse === 'function')
38
+ return mod.mermaid
39
+ return candidate
40
+ }
41
+
42
+ function applyThemeTo(code, theme) {
43
+ const themeValue = theme === 'dark' ? 'dark' : 'default'
44
+ const themeConfig = \`%%{init: {"theme": "\${themeValue}"}}%%\\n\`
45
+ return applyMermaidThemeDirective(code || '', themeConfig)
46
+ }
47
+
48
+ function findHeaderIndex(lines) {
49
+ const headerRe = /^(?:graph|flowchart|flowchart\\s+tb|flowchart\\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\\b/
50
+ let inFrontmatter = lines[0]?.trimEnd() === '---'
51
+ for (let i = 0; i < lines.length; i++) {
52
+ const line = (lines[i] || '').trim()
53
+ if (inFrontmatter) {
54
+ if (i > 0 && lines[i].trimEnd() === '---')
55
+ inFrontmatter = false
56
+ continue
57
+ }
58
+ if (!line || line.startsWith('%%'))
59
+ continue
60
+ if (headerRe.test(line))
61
+ return i
62
+ }
63
+ return -1
64
+ }
65
+
66
+ async function canParse(code, theme) {
67
+ const themed = applyThemeTo(code, theme)
68
+ if (mermaid && typeof mermaid.parse === 'function') {
69
+ await mermaid.parse(themed)
70
+ return true
71
+ }
72
+ throw new Error('mermaid.parse not available in worker')
73
+ }
74
+
75
+ async function findLastRenderablePrefix(baseCode, theme) {
76
+ const lines = String(baseCode || '').split(/\\r\\n?|\\n/)
77
+ const headerIndex = findHeaderIndex(lines)
78
+ if (headerIndex === -1)
79
+ return null
80
+ const head = lines.slice(0, headerIndex + 1)
81
+ await canParse(head.join('\\n'), theme)
82
+
83
+ let low = headerIndex + 1
84
+ let high = lines.length
85
+ let lastGood = headerIndex + 1
86
+ let tries = 0
87
+ const MAX_TRIES = 12
88
+
89
+ while (low <= high && tries < MAX_TRIES) {
90
+ const mid = Math.floor((low + high) / 2)
91
+ const candidate = [...head, ...lines.slice(headerIndex + 1, mid)].join('\\n')
92
+ tries += 1
93
+ try {
94
+ await canParse(candidate, theme)
95
+ lastGood = mid
96
+ low = mid + 1
97
+ }
98
+ catch {
99
+ high = mid - 1
100
+ }
101
+ }
102
+
103
+ return [...head, ...lines.slice(headerIndex + 1, lastGood)].join('\\n')
104
+ }
105
+
106
+ function initMermaidOnce() {
107
+ if (!mermaid)
108
+ return
109
+ try {
110
+ if (typeof mermaid.initialize === 'function')
111
+ mermaid.initialize(${t})
112
+ }
113
+ catch (e) {
114
+ if (DEBUG)
115
+ console.warn('[markstream-solid:mermaid-cdn-worker] initialize failed', e)
116
+ }
117
+ }
118
+
119
+ globalThis.addEventListener('message', async (ev) => {
120
+ const msg = ev.data || {}
121
+ if (msg.type === 'init') {
122
+ DEBUG = !!msg.debug
123
+ return
124
+ }
125
+
126
+ const id = msg.id
127
+ const action = msg.action
128
+ const payload = msg.payload || {}
129
+
130
+ if (!mermaid) {
131
+ const error = mermaidLoadError ? String(mermaidLoadError?.message || mermaidLoadError) : 'Mermaid is not available in worker'
132
+ globalThis.postMessage({ id, ok: false, error })
133
+ return
134
+ }
135
+
136
+ try {
137
+ if (action === 'canParse') {
138
+ const ok = await canParse(payload.code, payload.theme)
139
+ globalThis.postMessage({ id, ok: true, result: ok })
140
+ return
141
+ }
142
+ if (action === 'findPrefix') {
143
+ const result = await findLastRenderablePrefix(payload.code, payload.theme)
144
+ globalThis.postMessage({ id, ok: true, result })
145
+ return
146
+ }
147
+ globalThis.postMessage({ id, ok: false, error: 'Unknown action' })
148
+ }
149
+ catch (e) {
150
+ globalThis.postMessage({ id, ok: false, error: String(e?.message || e) })
151
+ }
152
+ })
153
+ `.trimStart();
154
+ return i === "module" ? `
155
+ ${r}
156
+
157
+ let loadPromise = null
158
+ async function loadMermaid() {
159
+ if (mermaid || mermaidLoadError)
160
+ return
161
+ if (!loadPromise) {
162
+ loadPromise = (async () => {
163
+ try {
164
+ const mod = await import(${a})
165
+ mermaid = normalizeMermaidModule(mod) || null
166
+ initMermaidOnce()
167
+ }
168
+ catch (e) {
169
+ mermaidLoadError = e
170
+ }
171
+ })()
172
+ }
173
+ await loadPromise
174
+ }
175
+
176
+ await loadMermaid()
177
+ `.trimStart() : `
178
+ ${r}
179
+
180
+ function loadMermaidClassic() {
181
+ if (mermaid || mermaidLoadError)
182
+ return
183
+ try {
184
+ importScripts(${a})
185
+ mermaid = normalizeMermaidModule(globalThis.mermaid) || null
186
+ initMermaidOnce()
187
+ }
188
+ catch (e) {
189
+ mermaidLoadError = e
190
+ }
191
+ }
192
+
193
+ loadMermaidClassic()
194
+ `.trimStart();
195
+ }
196
+ function u(e) {
197
+ const i = l(e);
198
+ if (typeof Worker > "u" || typeof URL > "u" || typeof Blob > "u")
199
+ return {
200
+ worker: null,
201
+ dispose: () => {
202
+ },
203
+ source: i
204
+ };
205
+ const a = new Blob([i], { type: "text/javascript" }), t = URL.createObjectURL(a);
206
+ let r = !1;
207
+ const d = () => {
208
+ if (!r) {
209
+ r = !0;
210
+ try {
211
+ URL.revokeObjectURL(t);
212
+ } catch {
213
+ }
214
+ }
215
+ }, m = (e.mode ?? "module") === "module" ? { ...e.workerOptions ?? {}, type: "module" } : e.workerOptions, n = new Worker(t, m);
216
+ if (e.debug)
217
+ try {
218
+ n.postMessage({ type: "init", debug: !0 });
219
+ } catch {
220
+ }
221
+ return { worker: n, dispose: d, source: i };
222
+ }
223
+ export {
224
+ l as buildMermaidCDNWorkerSource,
225
+ u as createMermaidWorkerFromCDN
226
+ };
@@ -0,0 +1,73 @@
1
+ import { applyMermaidThemeDirective as u } from "markstream-core";
2
+ import f from "mermaid";
3
+ f.initialize({ startOnLoad: !1, securityLevel: "strict", flowchart: { htmlLabels: !1 } });
4
+ function p(r, t) {
5
+ return u(r, `%%{init: {"theme": "${t === "dark" ? "dark" : "default"}"}}%%
6
+ `);
7
+ }
8
+ function g(r) {
9
+ const t = /^(?:graph|flowchart|flowchart\s+tb|flowchart\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\b/;
10
+ let a = r[0]?.trimEnd() === "---";
11
+ for (let e = 0; e < r.length; e += 1) {
12
+ const n = r[e].trim();
13
+ if (a) {
14
+ e > 0 && r[e].trimEnd() === "---" && (a = !1);
15
+ continue;
16
+ }
17
+ if (!(!n || n.startsWith("%%")) && t.test(n))
18
+ return e;
19
+ }
20
+ return -1;
21
+ }
22
+ async function c(r, t) {
23
+ const a = p(r, t), e = f;
24
+ if (typeof e.parse == "function")
25
+ return await e.parse(a), !0;
26
+ throw new Error("mermaid.parse not available in worker");
27
+ }
28
+ async function y(r, t) {
29
+ const a = r.split(/\r\n?|\n/), e = g(a);
30
+ if (e === -1)
31
+ return null;
32
+ const n = a.slice(0, e + 1);
33
+ await c(n.join(`
34
+ `), t);
35
+ let o = e + 1, s = a.length, l = e + 1, d = 0;
36
+ const m = 12;
37
+ for (; o <= s && d < m; ) {
38
+ const i = Math.floor((o + s) / 2), h = [...n, ...a.slice(e + 1, i)].join(`
39
+ `);
40
+ d += 1;
41
+ try {
42
+ await c(h, t), l = i, o = i + 1;
43
+ } catch {
44
+ s = i - 1;
45
+ }
46
+ }
47
+ return [...n, ...a.slice(e + 1, l)].join(`
48
+ `);
49
+ }
50
+ self.onmessage = async (r) => {
51
+ const t = r.data, a = (e) => self.postMessage(e);
52
+ try {
53
+ if (t.action === "canParse") {
54
+ a({
55
+ id: t.id,
56
+ ok: !0,
57
+ result: await c(t.payload.code, t.payload.theme)
58
+ });
59
+ return;
60
+ }
61
+ if (t.action === "findPrefix") {
62
+ a({
63
+ id: t.id,
64
+ ok: !0,
65
+ result: await y(t.payload.code, t.payload.theme)
66
+ });
67
+ return;
68
+ }
69
+ a({ id: t.id, ok: !1, error: "Unknown action" });
70
+ } catch (e) {
71
+ a({ id: t.id, ok: !1, error: e?.message ?? String(e) });
72
+ }
73
+ };
@@ -0,0 +1,13 @@
1
+ import { M as a, a as s, c as t, b as M, f as o, h as d, j as i, k as f, l as k, t as m } from "../mermaidWorkerClient-BAvGYsCO.js";
2
+ export {
3
+ a as MERMAID_DISABLED_CODE,
4
+ s as MERMAID_WORKER_BUSY_CODE,
5
+ t as canParseOffthread,
6
+ M as clearMermaidWorker,
7
+ o as findPrefixOffthread,
8
+ d as getMermaidWorkerLoad,
9
+ i as setMermaidWorker,
10
+ f as setMermaidWorkerClientDebug,
11
+ k as setMermaidWorkerMaxConcurrency,
12
+ m as terminateWorker
13
+ };
@@ -0,0 +1,42 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { NodeComponentProps } from '../customComponents';
3
+ import type { ImageNodeProps, LinkNodeProps, MathBlockNodeProps, MathInlineNodeProps, ReferenceNodeProps } from '../types/component-props';
4
+ export declare function ParagraphNode(props: NodeComponentProps): JSX.Element;
5
+ export declare function HeadingNode(props: NodeComponentProps): JSX.Element;
6
+ export declare function StrongNode(props: NodeComponentProps): JSX.Element;
7
+ export declare function EmphasisNode(props: NodeComponentProps): JSX.Element;
8
+ export declare function StrikethroughNode(props: NodeComponentProps): JSX.Element;
9
+ export declare function HighlightNode(props: NodeComponentProps): JSX.Element;
10
+ export declare function InsertNode(props: NodeComponentProps): JSX.Element;
11
+ export declare function SubscriptNode(props: NodeComponentProps): JSX.Element;
12
+ export declare function SuperscriptNode(props: NodeComponentProps): JSX.Element;
13
+ export declare function BlockquoteNode(props: NodeComponentProps): JSX.Element;
14
+ export declare function ListNode(props: NodeComponentProps): JSX.Element;
15
+ export declare function ListItemNode(props: NodeComponentProps): JSX.Element;
16
+ export declare function HardBreakNode(): JSX.Element;
17
+ export declare function ThematicBreakNode(): JSX.Element;
18
+ export declare function InlineCodeNode(props: NodeComponentProps): JSX.Element;
19
+ export declare function CheckboxNode(props: NodeComponentProps): JSX.Element;
20
+ export declare function EmojiNode(props: NodeComponentProps): JSX.Element;
21
+ export declare function ReferenceNode(props: ReferenceNodeProps & Omit<NodeComponentProps, 'node'>): JSX.Element;
22
+ export declare function HtmlInlineNode(props: NodeComponentProps): JSX.Element;
23
+ export declare function HtmlBlockNode(props: NodeComponentProps): JSX.Element;
24
+ export declare function MathInlineNode(props: MathInlineNodeProps & Omit<NodeComponentProps, 'node'>): JSX.Element;
25
+ export declare function MathBlockNode(props: MathBlockNodeProps & Omit<NodeComponentProps, 'node'>): JSX.Element;
26
+ export declare function FallbackComponent(props: NodeComponentProps): JSX.Element;
27
+ export declare function VmrContainerNode(props: NodeComponentProps): JSX.Element;
28
+ export declare function DefinitionListNode(props: NodeComponentProps): JSX.Element;
29
+ export declare function AdmonitionNode(props: NodeComponentProps): JSX.Element;
30
+ export declare function FootnoteNode(props: NodeComponentProps): JSX.Element;
31
+ export declare function FootnoteReferenceNode(props: NodeComponentProps): JSX.Element;
32
+ export declare function FootnoteAnchorNode(props: NodeComponentProps): JSX.Element;
33
+ export declare function LinkNode(props: LinkNodeProps & Omit<NodeComponentProps, 'node' | 'indexKey'>): JSX.Element;
34
+ export declare function ImageNode(props: ImageNodeProps & Omit<NodeComponentProps, 'node'> & {
35
+ onLoad?: (src: string) => void;
36
+ onError?: (src: string) => void;
37
+ onClick?: (payload: [
38
+ Event,
39
+ string
40
+ ]) => void;
41
+ }): JSX.Element;
42
+ export declare function TableNode(props: NodeComponentProps): JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { NodeComponentProps } from '../customComponents';
3
+ import type { CodeBlockNodeProps, CodeBlockPreviewPayload } from '../types/component-props';
4
+ export type SolidCodeBlockNodeProps = CodeBlockNodeProps & Omit<NodeComponentProps, 'node'> & {
5
+ headerLeft?: JSX.Element | (() => JSX.Element);
6
+ headerRight?: JSX.Element | (() => JSX.Element);
7
+ onCopy?: (code: string) => void;
8
+ onPreviewCode?: (payload: CodeBlockPreviewPayload) => void;
9
+ };
10
+ export declare function CodeBlockNode(input: SolidCodeBlockNodeProps): JSX.Element;
@@ -0,0 +1,27 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { NodeComponentProps } from '../customComponents';
3
+ import type { D2BlockNodeProps, InfographicBlockNodeProps, MermaidBlockEvent, MermaidBlockNodeProps } from '../types/component-props';
4
+ interface DiagramEvents {
5
+ onCopy?: (event: MermaidBlockEvent<{
6
+ type: 'copy';
7
+ text: string;
8
+ }>) => void;
9
+ onExport?: (event: MermaidBlockEvent<{
10
+ type: 'export';
11
+ }>) => void;
12
+ onOpenModal?: (event: MermaidBlockEvent<{
13
+ type: 'open-modal';
14
+ }>) => void;
15
+ onToggleMode?: (mode: 'source' | 'preview', event: MermaidBlockEvent<{
16
+ type: 'toggle-mode';
17
+ target: 'source' | 'preview';
18
+ }>) => void;
19
+ }
20
+ type DiagramProps = MermaidBlockNodeProps & D2BlockNodeProps & InfographicBlockNodeProps & Omit<NodeComponentProps, 'node'> & DiagramEvents & {
21
+ kind: 'mermaid' | 'd2' | 'infographic';
22
+ };
23
+ export declare function DiagramBlockNode(input: DiagramProps): JSX.Element;
24
+ export declare function MermaidBlockNode(props: MermaidBlockNodeProps & Omit<NodeComponentProps, 'node'> & DiagramEvents): JSX.Element;
25
+ export declare function D2BlockNode(props: D2BlockNodeProps & Omit<NodeComponentProps, 'node'> & DiagramEvents): JSX.Element;
26
+ export declare function InfographicBlockNode(props: InfographicBlockNodeProps & Omit<NodeComponentProps, 'node'> & DiagramEvents): JSX.Element;
27
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { JSX } from 'solid-js';
2
+ export interface HtmlPreviewFrameProps {
3
+ code: string;
4
+ isDark?: boolean;
5
+ htmlPreviewAllowScripts?: boolean;
6
+ htmlPreviewSandbox?: string;
7
+ onClose?: () => void;
8
+ title?: string;
9
+ }
10
+ export declare function HtmlPreviewFrame(props: HtmlPreviewFrameProps): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { MarkstreamSolidOptions } from '../configuration';
3
+ export declare function MarkstreamProvider(props: MarkstreamSolidOptions & {
4
+ children?: JSX.Element;
5
+ }): JSX.Element;
@@ -0,0 +1,35 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { MarkstreamVirtualMetrics, MarkstreamVirtualState } from '../types/node-renderer-props';
3
+ import type { MarkstreamThreadVirtualState, MarkstreamTimelineItem, MarkstreamVirtualTimelineProps } from '../virtual-adapter';
4
+ export interface MarkstreamVirtualTimelineHandle {
5
+ captureThreadState: () => MarkstreamThreadVirtualState;
6
+ restoreThreadState: (state: MarkstreamThreadVirtualState) => void;
7
+ scrollToBottom: () => void;
8
+ scrollToIndex: (index: number, align?: 'start' | 'center' | 'end') => void;
9
+ scrollToOffset: (offset: number) => void;
10
+ getItemSize: (key: string) => number | undefined;
11
+ getTotalHeight: () => number;
12
+ getVisibleRange: () => {
13
+ start: number;
14
+ end: number;
15
+ };
16
+ }
17
+ export declare function MarkstreamVirtualTimeline<T = MarkstreamTimelineItem>(props: MarkstreamVirtualTimelineProps<T> & {
18
+ class?: string;
19
+ style?: JSX.CSSProperties;
20
+ ref?: (handle: MarkstreamVirtualTimelineHandle) => void;
21
+ renderItem?: (item: T, index: number) => JSX.Element;
22
+ onHeightChange?: (payload: {
23
+ itemKey: string;
24
+ metrics: MarkstreamVirtualMetrics;
25
+ }) => void;
26
+ onVirtualStateChange?: (payload: {
27
+ itemKey: string;
28
+ state: MarkstreamVirtualState;
29
+ }) => void;
30
+ onThreadStateChange?: (state: MarkstreamThreadVirtualState) => void;
31
+ onRangeChange?: (range: {
32
+ start: number;
33
+ end: number;
34
+ }) => void;
35
+ }): JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { NodeComponentProps } from '../customComponents';
3
+ export declare function MathNode(props: NodeComponentProps & {
4
+ block: boolean;
5
+ cacheScope?: string | number;
6
+ }): JSX.Element;
@@ -0,0 +1,27 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { CodeBlockPreviewPayload } from '../types/component-props';
3
+ import type { MarkstreamRendererHandle, MarkstreamVirtualAnchor, MarkstreamVirtualMetrics, MarkstreamVirtualState } from '../types/node-renderer-props';
4
+ import type { NodeRendererProps } from './shared/node-helpers';
5
+ export interface MarkdownRenderProps extends NodeRendererProps {
6
+ 'data-theme'?: string;
7
+ 'class'?: string;
8
+ 'className'?: string;
9
+ 'style'?: JSX.CSSProperties;
10
+ 'onCopy'?: (code: string) => void;
11
+ 'onCopyCode'?: (payload: {
12
+ type: 'copy';
13
+ text: string;
14
+ }) => void;
15
+ 'onHandleArtifactClick'?: (payload: CodeBlockPreviewPayload) => void;
16
+ 'ref'?: (handle: MarkstreamRendererHandle) => void;
17
+ 'onHeightChange'?: (metrics: MarkstreamVirtualMetrics) => void;
18
+ 'onVirtualStateChange'?: (state: MarkstreamVirtualState) => void;
19
+ 'onAnchorChange'?: (anchor: MarkstreamVirtualAnchor) => void;
20
+ 'onRenderSettled'?: (metrics: MarkstreamVirtualMetrics) => void;
21
+ 'onRenderFinal'?: (metrics: MarkstreamVirtualMetrics) => void;
22
+ 'onClick'?: JSX.EventHandlerUnion<HTMLDivElement, MouseEvent>;
23
+ 'onMouseover'?: JSX.EventHandlerUnion<HTMLDivElement, MouseEvent>;
24
+ 'onMouseout'?: JSX.EventHandlerUnion<HTMLDivElement, MouseEvent>;
25
+ }
26
+ export declare function NodeRenderer(input: MarkdownRenderProps): JSX.Element;
27
+ export default NodeRenderer;
@@ -0,0 +1,11 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { SolidRenderableNode, SolidRenderContext } from './shared/node-helpers';
3
+ export declare function NodeSlot(props: {
4
+ node: SolidRenderableNode;
5
+ index: number;
6
+ indexKey: string;
7
+ context: SolidRenderContext;
8
+ defer: boolean;
9
+ margin: string;
10
+ estimatedHeight: number;
11
+ }): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { SolidCodeBlockNodeProps } from './CodeBlockNode';
3
+ export declare function PreCodeBlock(input: SolidCodeBlockNodeProps): JSX.Element;
@@ -0,0 +1,9 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { NodeComponentProps } from '../customComponents';
3
+ import type { CodeBlockOptions, PreCodeNodeProps } from '../types/component-props';
4
+ export declare function PreCodeNode(props: PreCodeNodeProps & Omit<NodeComponentProps, 'node'> & {
5
+ codeBlockOptions?: CodeBlockOptions;
6
+ themeName?: string;
7
+ class?: string;
8
+ style?: JSX.CSSProperties;
9
+ }): JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { NodeComponentProps } from '../customComponents';
3
+ import type { SolidRenderableNode } from './shared/node-helpers';
4
+ export declare function RenderChildren(props: NodeComponentProps & {
5
+ nodes?: readonly SolidRenderableNode[];
6
+ }): JSX.Element;
7
+ export declare function TextNode(props: NodeComponentProps): JSX.Element;
8
+ export declare function RichNode(props: NodeComponentProps): JSX.Element;
9
+ export declare function RenderNode(props: NodeComponentProps): JSX.Element;
10
+ export { CodeBlockNode } from './CodeBlockNode';
11
+ export { PreCodeNode } from './PreCodeNode';
@@ -0,0 +1,2 @@
1
+ import type { NodeComponentProps } from '../customComponents';
2
+ export declare function StreamingTextNode(props: NodeComponentProps): import("solid-js").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { JSX } from 'solid-js';
2
+ export declare function ToolbarButton(props: {
3
+ class?: string;
4
+ label: string;
5
+ children?: JSX.Element;
6
+ onClick?: JSX.EventHandler<HTMLButtonElement, MouseEvent>;
7
+ disabled?: boolean;
8
+ pressed?: boolean;
9
+ expanded?: boolean;
10
+ menu?: boolean;
11
+ hasPopup?: boolean;
12
+ showTooltips?: boolean;
13
+ isDark?: boolean;
14
+ }): JSX.Element;
@@ -0,0 +1,18 @@
1
+ declare const paths: {
2
+ copy: string;
3
+ check: string;
4
+ source: string;
5
+ preview: string;
6
+ collapse: string;
7
+ expand: string;
8
+ export: string;
9
+ open: string;
10
+ close: string;
11
+ zoomIn: string;
12
+ zoomOut: string;
13
+ reset: string;
14
+ };
15
+ export declare function ToolbarIcon(props: {
16
+ name: keyof typeof paths;
17
+ }): import("solid-js").JSX.Element;
18
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { JSX } from 'solid-js';
2
+ export interface TooltipProps {
3
+ visible: boolean;
4
+ anchorEl: HTMLElement | null;
5
+ content: string;
6
+ placement?: 'top' | 'bottom' | 'left' | 'right';
7
+ offset?: number;
8
+ originX?: number | null;
9
+ originY?: number | null;
10
+ id?: string | null;
11
+ isDark?: boolean | null;
12
+ }
13
+ export declare function Tooltip(props: TooltipProps): JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Accessor } from 'solid-js';
2
+ import type { NodeComponentProps } from '../customComponents';
3
+ import type { MarkstreamNodeLifecycle } from '../types/node-renderer-props';
4
+ export declare const NodeLifecycleContext: import("solid-js").Context<MarkstreamNodeLifecycle | undefined>;
5
+ export declare function useNodeLifecycle(props: Pick<NodeComponentProps, 'indexKey'>, pending: Accessor<boolean>, element: Accessor<HTMLElement | undefined>): void;
6
+ export declare function useMarkstreamNodeLifecycle(): MarkstreamNodeLifecycle | null;
@@ -0,0 +1,5 @@
1
+ import type { Accessor } from 'solid-js';
2
+ export declare const MathHeightCacheContext: import("solid-js").Context<{
3
+ scope: Accessor<string>;
4
+ cache: Map<string, number>;
5
+ } | undefined>;
@@ -0,0 +1,4 @@
1
+ import type { NodeRendererMode, NodeRendererProps } from './shared/node-helpers';
2
+ export type RendererModeDefaults = Pick<NodeRendererProps, 'showTooltips' | 'fade' | 'batchRendering' | 'initialRenderBatchSize' | 'renderBatchSize' | 'renderBatchDelay' | 'renderBatchBudgetMs' | 'renderBatchIdleTimeoutMs' | 'deferNodesUntilVisible' | 'maxLiveNodes' | 'liveNodeBuffer' | 'nodeVirtual'>;
3
+ export declare const RENDERER_MODE_DEFAULTS: Record<NodeRendererMode, RendererModeDefaults>;
4
+ export declare function normalizeRendererMode(value: unknown): NodeRendererMode;
@@ -0,0 +1,16 @@
1
+ export declare const MERMAID_PREVIEW_MIN_HEIGHT = 360;
2
+ export declare const MERMAID_PREVIEW_MAX_HEIGHT = 500;
3
+ export declare const INFOGRAPHIC_PREVIEW_MIN_HEIGHT = 360;
4
+ export declare const INFOGRAPHIC_PREVIEW_MAX_HEIGHT = 500;
5
+ export declare function parsePositiveNumber(value: unknown): number | null;
6
+ export declare function getMermaidDiagramKind(code: string): string;
7
+ export declare function estimateMermaidPreviewHeight(code: string): number;
8
+ export declare function estimateInfographicPreviewHeight(code: string): number;
9
+ export declare function clampPreviewHeight(height: number, minHeight?: number, maxHeight?: number | null): number;
10
+ /**
11
+ * Resolve the diagram preview minimum height from the CSS token
12
+ * (`--ms-size-diagram-min-height`), falling back to the provided default.
13
+ * SSR-safe: without a mounted container (Svelte SSR) the token is unreadable,
14
+ * so the fallback applies instead.
15
+ */
16
+ export declare function resolveDiagramMinPreviewHeight(container: HTMLElement | null | undefined, fallback: number): number;