markstream-svelte 0.0.6 → 0.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -26,7 +26,6 @@ export { default as InsertNode } from './components/InsertNode.svelte';
26
26
  export { default as LinkNode } from './components/LinkNode.svelte';
27
27
  export { default as ListItemNode } from './components/ListItemNode.svelte';
28
28
  export { default as ListNode } from './components/ListNode.svelte';
29
- export { default as MarkdownCodeBlockNode } from './components/MarkdownCodeBlockNode.svelte';
30
29
  export { default as MathBlockNode } from './components/MathBlockNode.svelte';
31
30
  export { default as MathInlineNode } from './components/MathInlineNode.svelte';
32
31
  export { default as MermaidBlockNode } from './components/MermaidBlockNode.svelte';
@@ -64,14 +63,14 @@ export type { KatexLoader } from './optional/katex';
64
63
  export { disableKatex, enableKatex, getKatex, isKatexEnabled, setKatexLoader, } from './optional/katex';
65
64
  export type { MermaidLoader } from './optional/mermaid';
66
65
  export { disableMermaid, enableMermaid, getMermaid, isMermaidEnabled, setMermaidLoader, } from './optional/mermaid';
67
- export { isCodeBlockRuntimeReady, preloadCodeBlockRuntime, resetCodeBlockRuntimeReadyForTest, } from './optional/monaco';
66
+ export { isCodeBlockRuntimeReady, preloadCodeBlockRuntime, resetCodeBlockRuntimeReadyForTest, } from './optional/streamDiffs';
68
67
  export { parseNestedMarkdownToNodes, } from './parseNestedMarkdownToNodes';
69
68
  export type { NestedMarkdownNodesInput, NestedMarkdownNodesOptions, } from './parseNestedMarkdownToNodes';
70
69
  export { renderMarkdownNodesToHtml, renderMarkdownNodeToHtml, renderMarkdownToHtml, renderNestedMarkdownToHtml, } from './renderMarkdownHtml';
71
70
  export type { MarkstreamSvelteRenderOptions, NestedMarkdownHtmlInput, NestedMarkdownHtmlOptions, RenderableMarkdownNode, } from './renderMarkdownHtml';
72
71
  export { sanitizeHtmlContent } from './sanitizeHtmlContent';
73
- export type { CodeBlockDiffAppearance, CodeBlockDiffHideUnchangedRegions, CodeBlockDiffHideUnchangedRegionsOptions, CodeBlockDiffHunkActionContext, CodeBlockDiffHunkActionKind, CodeBlockDiffHunkSide, CodeBlockDiffLineStyle, CodeBlockDiffUnchangedRegionStyle, CodeBlockMonacoLanguage, CodeBlockMonacoOptions, CodeBlockMonacoTheme, CodeBlockMonacoThemeObject, } from './types/monaco';
74
- export { getLanguageIcon, languageMap, normalizeLanguageIdentifier, resolveMonacoLanguageId, setLanguageIconResolver, } from './utils/languageIcon';
72
+ export type { CodeBlockDiffHideUnchangedRegions, CodeBlockDiffHideUnchangedRegionsOptions, CodeBlockOptions, CodeBlockTheme, CodeBlockThemePair, CodeBlockThemeProp, CodeBlockThemes, } from './types/codeBlock';
73
+ export { getLanguageIcon, languageMap, normalizeLanguageIdentifier, resolveLanguageId, setLanguageIconResolver, } from './utils/languageIcon';
75
74
  export type { LanguageIconResolver } from './utils/languageIcon';
76
75
  export * from './workers/katexCdnWorker';
77
76
  export * from './workers/katexWorkerClient';
package/dist/index.js CHANGED
@@ -26,7 +26,6 @@ export { default as InsertNode } from './components/InsertNode.svelte';
26
26
  export { default as LinkNode } from './components/LinkNode.svelte';
27
27
  export { default as ListItemNode } from './components/ListItemNode.svelte';
28
28
  export { default as ListNode } from './components/ListNode.svelte';
29
- export { default as MarkdownCodeBlockNode } from './components/MarkdownCodeBlockNode.svelte';
30
29
  export { default as MathBlockNode } from './components/MathBlockNode.svelte';
31
30
  export { default as MathInlineNode } from './components/MathInlineNode.svelte';
32
31
  export { default as MermaidBlockNode } from './components/MermaidBlockNode.svelte';
@@ -56,11 +55,11 @@ export { setDefaultI18nMap, useSafeI18n } from './i18n/useSafeI18n';
56
55
  export { disableD2, enableD2, isD2Enabled, setD2Loader, } from './optional/d2';
57
56
  export { disableKatex, enableKatex, getKatex, isKatexEnabled, setKatexLoader, } from './optional/katex';
58
57
  export { disableMermaid, enableMermaid, getMermaid, isMermaidEnabled, setMermaidLoader, } from './optional/mermaid';
59
- export { isCodeBlockRuntimeReady, preloadCodeBlockRuntime, resetCodeBlockRuntimeReadyForTest, } from './optional/monaco';
58
+ export { isCodeBlockRuntimeReady, preloadCodeBlockRuntime, resetCodeBlockRuntimeReadyForTest, } from './optional/streamDiffs';
60
59
  export { parseNestedMarkdownToNodes, } from './parseNestedMarkdownToNodes';
61
60
  export { renderMarkdownNodesToHtml, renderMarkdownNodeToHtml, renderMarkdownToHtml, renderNestedMarkdownToHtml, } from './renderMarkdownHtml';
62
61
  export { sanitizeHtmlContent } from './sanitizeHtmlContent';
63
- export { getLanguageIcon, languageMap, normalizeLanguageIdentifier, resolveMonacoLanguageId, setLanguageIconResolver, } from './utils/languageIcon';
62
+ export { getLanguageIcon, languageMap, normalizeLanguageIdentifier, resolveLanguageId, setLanguageIconResolver, } from './utils/languageIcon';
64
63
  export * from './workers/katexCdnWorker';
65
64
  export * from './workers/katexWorkerClient';
66
65
  export * from './workers/mermaidCdnWorker';
package/dist/index.px.css CHANGED
@@ -1299,8 +1299,8 @@ body > div[id^="dmermaid-"] {
1299
1299
  background: #0b1220;
1300
1300
  }
1301
1301
 
1302
- .markstream-svelte .markstream-svelte-enhanced-block__body--code .monaco-editor,
1303
- .markstream-svelte .markstream-svelte-enhanced-block__body--code .monaco-diff-editor {
1302
+ .markstream-svelte .markstream-svelte-enhanced-block__body--code .stream-diffs-shell,
1303
+ .markstream-svelte .markstream-svelte-enhanced-block__body--code diffs-container {
1304
1304
  min-height: inherit;
1305
1305
  }
1306
1306
 
@@ -1536,19 +1536,9 @@ body > div[id^="dmermaid-"] {
1536
1536
  box-shadow: 0 22px 44px -30px rgba(2, 6, 23, 0.95);
1537
1537
  }
1538
1538
 
1539
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor,
1540
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .monaco-editor-background,
1541
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .margin,
1542
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .lines-content {
1539
+ .markstream-svelte .code-block-container.is-plain-text .stream-diffs-shell,
1540
+ .markstream-svelte .code-block-container.is-plain-text diffs-container {
1543
1541
  background: var(--vscode-editor-background, var(--markstream-code-fallback-bg)) !important;
1544
- }
1545
-
1546
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor,
1547
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .margin,
1548
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .view-lines,
1549
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .view-line,
1550
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .view-line span,
1551
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .line-numbers {
1552
1542
  color: var(--vscode-editor-foreground, var(--markstream-code-fallback-fg)) !important;
1553
1543
  }
1554
1544
 
@@ -1619,7 +1609,6 @@ body > div[id^="dmermaid-"] {
1619
1609
  .markstream-svelte .code-block-body {
1620
1610
  position: relative;
1621
1611
  display: grid;
1622
- min-height: 96px;
1623
1612
  min-width: 0;
1624
1613
  overflow: hidden;
1625
1614
  background: var(--markstream-code-fallback-bg, var(--code-bg));
@@ -1686,10 +1675,6 @@ body > div[id^="dmermaid-"] {
1686
1675
  background: transparent;
1687
1676
  }
1688
1677
 
1689
- .markstream-svelte .code-editor-container {
1690
- min-height: 96px;
1691
- }
1692
-
1693
1678
  .markstream-svelte .code-editor-container.is-hidden {
1694
1679
  opacity: 0;
1695
1680
  pointer-events: none;
@@ -1858,6 +1843,12 @@ body > div[id^="dmermaid-"] {
1858
1843
  --vscode-editor-foreground: var(--markstream-diff-editor-fg);
1859
1844
  --vscode-diffEditor-unchangedRegionForeground: var(--markstream-diff-unchanged-fg);
1860
1845
  --vscode-diffEditor-unchangedRegionBackground: var(--markstream-diff-unchanged-bg);
1846
+ --vscode-diffEditor-insertedTextBackground: var(--markstream-diff-added-inline);
1847
+ --vscode-diffEditor-removedTextBackground: var(--markstream-diff-removed-inline);
1848
+ --vscode-diffEditor-insertedLineBackground: var(--markstream-diff-added-line);
1849
+ --vscode-diffEditor-removedLineBackground: var(--markstream-diff-removed-line);
1850
+ --vscode-diffEditor-insertedTextBorder: var(--markstream-diff-added-inline-border);
1851
+ --vscode-diffEditor-removedTextBorder: var(--markstream-diff-removed-inline-border);
1861
1852
  --vscode-focusBorder: var(--markstream-diff-focus);
1862
1853
  --vscode-widget-shadow: var(--markstream-diff-widget-shadow);
1863
1854
  }
@@ -1867,56 +1858,6 @@ body > div[id^="dmermaid-"] {
1867
1858
  background: var(--markstream-diff-editor-bg);
1868
1859
  }
1869
1860
 
1870
- .markstream-svelte .code-block-container .stream-monaco-diff-root {
1871
- --stream-monaco-gutter-gap: var(--markstream-diff-gutter-gap) !important;
1872
- --stream-monaco-line-number: var(--markstream-diff-line-number) !important;
1873
- --stream-monaco-line-number-active: var(--markstream-diff-line-number-active) !important;
1874
- --stream-monaco-added-fg: var(--markstream-diff-added-fg) !important;
1875
- --stream-monaco-removed-fg: var(--markstream-diff-removed-fg) !important;
1876
- --stream-monaco-added-line: var(--markstream-diff-added-line) !important;
1877
- --stream-monaco-removed-line: var(--markstream-diff-removed-line) !important;
1878
- --stream-monaco-added-inline: var(--markstream-diff-added-inline) !important;
1879
- --stream-monaco-removed-inline: var(--markstream-diff-removed-inline) !important;
1880
- --stream-monaco-added-inline-border: var(--markstream-diff-added-inline-border) !important;
1881
- --stream-monaco-removed-inline-border: var(--markstream-diff-removed-inline-border) !important;
1882
- --stream-monaco-added-line-fill: var(--markstream-diff-added-line-fill) !important;
1883
- --stream-monaco-removed-line-fill: var(--markstream-diff-removed-line-fill) !important;
1884
- --stream-monaco-unchanged-bg: var(--markstream-diff-unchanged-bg) !important;
1885
- --stream-monaco-unchanged-fg: var(--markstream-diff-unchanged-fg) !important;
1886
- }
1887
-
1888
- .markstream-svelte .code-block-container .stream-monaco-diff-root .monaco-diff-editor .diffOverview,
1889
- .markstream-svelte .code-block-container .stream-monaco-diff-root .decorationsOverviewRuler {
1890
- display: none !important;
1891
- }
1892
-
1893
- .markstream-svelte .code-block-container .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center:not(.stream-monaco-unchanged-bridge-source),
1894
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge {
1895
- --stream-monaco-unchanged-bg: var(--markstream-diff-unchanged-bg) !important;
1896
- --stream-monaco-unchanged-fg: var(--markstream-diff-unchanged-fg) !important;
1897
- background: var(--stream-monaco-unchanged-bg) !important;
1898
- color: var(--stream-monaco-unchanged-fg) !important;
1899
- }
1900
-
1901
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary,
1902
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary:hover,
1903
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary:focus-visible {
1904
- background: var(--stream-monaco-unchanged-bg) !important;
1905
- color: var(--markstream-diff-unchanged-fg) !important;
1906
- }
1907
-
1908
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-rail,
1909
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal,
1910
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal:hover,
1911
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal:focus-visible {
1912
- background: var(--stream-monaco-unchanged-bg) !important;
1913
- color: var(--markstream-diff-unchanged-fg) !important;
1914
- }
1915
-
1916
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-rail {
1917
- border-right-color: var(--markstream-diff-unchanged-divider) !important;
1918
- }
1919
-
1920
1861
  .html-preview-frame__backdrop {
1921
1862
  position: fixed;
1922
1863
  inset: 0;
@@ -1299,8 +1299,8 @@ body > div[id^="dmermaid-"] {
1299
1299
  background: #0b1220;
1300
1300
  }
1301
1301
 
1302
- .markstream-svelte .markstream-svelte-enhanced-block__body--code .monaco-editor,
1303
- .markstream-svelte .markstream-svelte-enhanced-block__body--code .monaco-diff-editor {
1302
+ .markstream-svelte .markstream-svelte-enhanced-block__body--code .stream-diffs-shell,
1303
+ .markstream-svelte .markstream-svelte-enhanced-block__body--code diffs-container {
1304
1304
  min-height: inherit;
1305
1305
  }
1306
1306
 
@@ -1536,19 +1536,9 @@ body > div[id^="dmermaid-"] {
1536
1536
  box-shadow: 0 22px 44px -30px rgba(2, 6, 23, 0.95);
1537
1537
  }
1538
1538
 
1539
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor,
1540
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .monaco-editor-background,
1541
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .margin,
1542
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .lines-content {
1539
+ .markstream-svelte .code-block-container.is-plain-text .stream-diffs-shell,
1540
+ .markstream-svelte .code-block-container.is-plain-text diffs-container {
1543
1541
  background: var(--vscode-editor-background, var(--markstream-code-fallback-bg)) !important;
1544
- }
1545
-
1546
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor,
1547
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .margin,
1548
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .view-lines,
1549
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .view-line,
1550
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .view-line span,
1551
- .markstream-svelte .code-block-container.is-plain-text .monaco-editor .line-numbers {
1552
1542
  color: var(--vscode-editor-foreground, var(--markstream-code-fallback-fg)) !important;
1553
1543
  }
1554
1544
 
@@ -1619,7 +1609,6 @@ body > div[id^="dmermaid-"] {
1619
1609
  .markstream-svelte .code-block-body {
1620
1610
  position: relative;
1621
1611
  display: grid;
1622
- min-height: 96px;
1623
1612
  min-width: 0;
1624
1613
  overflow: hidden;
1625
1614
  background: var(--markstream-code-fallback-bg, var(--code-bg));
@@ -1686,10 +1675,6 @@ body > div[id^="dmermaid-"] {
1686
1675
  background: transparent;
1687
1676
  }
1688
1677
 
1689
- .markstream-svelte .code-editor-container {
1690
- min-height: 96px;
1691
- }
1692
-
1693
1678
  .markstream-svelte .code-editor-container.is-hidden {
1694
1679
  opacity: 0;
1695
1680
  pointer-events: none;
@@ -1858,6 +1843,12 @@ body > div[id^="dmermaid-"] {
1858
1843
  --vscode-editor-foreground: var(--markstream-diff-editor-fg);
1859
1844
  --vscode-diffEditor-unchangedRegionForeground: var(--markstream-diff-unchanged-fg);
1860
1845
  --vscode-diffEditor-unchangedRegionBackground: var(--markstream-diff-unchanged-bg);
1846
+ --vscode-diffEditor-insertedTextBackground: var(--markstream-diff-added-inline);
1847
+ --vscode-diffEditor-removedTextBackground: var(--markstream-diff-removed-inline);
1848
+ --vscode-diffEditor-insertedLineBackground: var(--markstream-diff-added-line);
1849
+ --vscode-diffEditor-removedLineBackground: var(--markstream-diff-removed-line);
1850
+ --vscode-diffEditor-insertedTextBorder: var(--markstream-diff-added-inline-border);
1851
+ --vscode-diffEditor-removedTextBorder: var(--markstream-diff-removed-inline-border);
1861
1852
  --vscode-focusBorder: var(--markstream-diff-focus);
1862
1853
  --vscode-widget-shadow: var(--markstream-diff-widget-shadow);
1863
1854
  }
@@ -1867,56 +1858,6 @@ body > div[id^="dmermaid-"] {
1867
1858
  background: var(--markstream-diff-editor-bg);
1868
1859
  }
1869
1860
 
1870
- .markstream-svelte .code-block-container .stream-monaco-diff-root {
1871
- --stream-monaco-gutter-gap: var(--markstream-diff-gutter-gap) !important;
1872
- --stream-monaco-line-number: var(--markstream-diff-line-number) !important;
1873
- --stream-monaco-line-number-active: var(--markstream-diff-line-number-active) !important;
1874
- --stream-monaco-added-fg: var(--markstream-diff-added-fg) !important;
1875
- --stream-monaco-removed-fg: var(--markstream-diff-removed-fg) !important;
1876
- --stream-monaco-added-line: var(--markstream-diff-added-line) !important;
1877
- --stream-monaco-removed-line: var(--markstream-diff-removed-line) !important;
1878
- --stream-monaco-added-inline: var(--markstream-diff-added-inline) !important;
1879
- --stream-monaco-removed-inline: var(--markstream-diff-removed-inline) !important;
1880
- --stream-monaco-added-inline-border: var(--markstream-diff-added-inline-border) !important;
1881
- --stream-monaco-removed-inline-border: var(--markstream-diff-removed-inline-border) !important;
1882
- --stream-monaco-added-line-fill: var(--markstream-diff-added-line-fill) !important;
1883
- --stream-monaco-removed-line-fill: var(--markstream-diff-removed-line-fill) !important;
1884
- --stream-monaco-unchanged-bg: var(--markstream-diff-unchanged-bg) !important;
1885
- --stream-monaco-unchanged-fg: var(--markstream-diff-unchanged-fg) !important;
1886
- }
1887
-
1888
- .markstream-svelte .code-block-container .stream-monaco-diff-root .monaco-diff-editor .diffOverview,
1889
- .markstream-svelte .code-block-container .stream-monaco-diff-root .decorationsOverviewRuler {
1890
- display: none !important;
1891
- }
1892
-
1893
- .markstream-svelte .code-block-container .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center:not(.stream-monaco-unchanged-bridge-source),
1894
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge {
1895
- --stream-monaco-unchanged-bg: var(--markstream-diff-unchanged-bg) !important;
1896
- --stream-monaco-unchanged-fg: var(--markstream-diff-unchanged-fg) !important;
1897
- background: var(--stream-monaco-unchanged-bg) !important;
1898
- color: var(--stream-monaco-unchanged-fg) !important;
1899
- }
1900
-
1901
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary,
1902
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary:hover,
1903
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary:focus-visible {
1904
- background: var(--stream-monaco-unchanged-bg) !important;
1905
- color: var(--markstream-diff-unchanged-fg) !important;
1906
- }
1907
-
1908
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-rail,
1909
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal,
1910
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal:hover,
1911
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal:focus-visible {
1912
- background: var(--stream-monaco-unchanged-bg) !important;
1913
- color: var(--markstream-diff-unchanged-fg) !important;
1914
- }
1915
-
1916
- .markstream-svelte .code-block-container .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-rail {
1917
- border-right-color: var(--markstream-diff-unchanged-divider) !important;
1918
- }
1919
-
1920
1861
  .html-preview-frame__backdrop {
1921
1862
  position: fixed;
1922
1863
  inset: 0;
@@ -1,4 +1,4 @@
1
- export interface MonacoRuntimeHelpers {
1
+ export interface StreamDiffsRuntimeHelpers {
2
2
  createEditor?: (container: HTMLElement, code: string, language: string) => Promise<unknown> | unknown;
3
3
  createDiffEditor?: (container: HTMLElement, original: string, modified: string, language: string) => Promise<unknown> | unknown;
4
4
  updateCode?: (code: string, language?: string) => Promise<unknown> | unknown;
@@ -10,12 +10,11 @@ export interface MonacoRuntimeHelpers {
10
10
  getDiffEditorView?: () => unknown;
11
11
  refreshDiffPresentation?: () => unknown;
12
12
  }
13
- export interface MonacoRuntimeModule {
14
- useMonaco: (options?: Record<string, unknown>) => MonacoRuntimeHelpers;
15
- preloadMonacoWorkers?: () => Promise<unknown> | unknown;
16
- getOrCreateHighlighter?: (...args: unknown[]) => Promise<unknown> | unknown;
13
+ export interface StreamDiffsRuntimeModule {
14
+ createCodeBlockRuntime: (options?: Record<string, unknown>) => StreamDiffsRuntimeHelpers;
15
+ preloadStreamDiffs?: () => Promise<unknown> | unknown;
17
16
  }
18
17
  export declare function isCodeBlockRuntimeReady(): boolean;
19
18
  export declare function resetCodeBlockRuntimeReadyForTest(): void;
20
19
  export declare function preloadCodeBlockRuntime(): Promise<boolean>;
21
- export declare function getUseMonaco(): Promise<MonacoRuntimeModule | null>;
20
+ export declare function getStreamDiffsRuntime(): Promise<StreamDiffsRuntimeModule | null>;
@@ -0,0 +1,66 @@
1
+ let streamDiffsModule = null;
2
+ let importAttempted = false;
3
+ let pendingImport = null;
4
+ let runtimePreloaded = false;
5
+ let codeBlockRuntimeReady = false;
6
+ function normalizeStreamDiffsModule(value) {
7
+ var _a, _b;
8
+ const moduleValue = value;
9
+ const source = typeof (moduleValue === null || moduleValue === void 0 ? void 0 : moduleValue.createCodeBlockRuntime) === 'function' || typeof (moduleValue === null || moduleValue === void 0 ? void 0 : moduleValue.useMonaco) === 'function'
10
+ ? moduleValue
11
+ : value === null || value === void 0 ? void 0 : value.default;
12
+ const factory = (_a = source === null || source === void 0 ? void 0 : source.createCodeBlockRuntime) !== null && _a !== void 0 ? _a : source === null || source === void 0 ? void 0 : source.useMonaco;
13
+ if (typeof factory !== 'function')
14
+ return null;
15
+ return {
16
+ createCodeBlockRuntime: options => factory.call(source, options),
17
+ preloadStreamDiffs: (_b = source === null || source === void 0 ? void 0 : source.preloadStreamDiffs) === null || _b === void 0 ? void 0 : _b.bind(source),
18
+ };
19
+ }
20
+ export function isCodeBlockRuntimeReady() {
21
+ return codeBlockRuntimeReady;
22
+ }
23
+ export function resetCodeBlockRuntimeReadyForTest() {
24
+ codeBlockRuntimeReady = false;
25
+ }
26
+ export async function preloadCodeBlockRuntime() {
27
+ const runtime = await getStreamDiffsRuntime();
28
+ return !!runtime;
29
+ }
30
+ async function preloadRuntime(mod) {
31
+ if (runtimePreloaded)
32
+ return;
33
+ runtimePreloaded = true;
34
+ if (typeof (mod === null || mod === void 0 ? void 0 : mod.preloadStreamDiffs) === 'function')
35
+ await mod.preloadStreamDiffs();
36
+ }
37
+ export async function getStreamDiffsRuntime() {
38
+ if (streamDiffsModule)
39
+ return streamDiffsModule;
40
+ if (pendingImport)
41
+ return await pendingImport;
42
+ if (importAttempted)
43
+ return null;
44
+ pendingImport = (async () => {
45
+ // `stream-diffs` is the only supported enhanced code-block runtime in 2.0.
46
+ try {
47
+ const candidate = normalizeStreamDiffsModule(await import('stream-diffs/markstream'));
48
+ if (!candidate)
49
+ return null;
50
+ streamDiffsModule = candidate;
51
+ await preloadRuntime(streamDiffsModule);
52
+ codeBlockRuntimeReady = true;
53
+ return streamDiffsModule;
54
+ }
55
+ catch {
56
+ importAttempted = true;
57
+ return null;
58
+ }
59
+ })();
60
+ try {
61
+ return await pendingImport;
62
+ }
63
+ finally {
64
+ pendingImport = null;
65
+ }
66
+ }
@@ -0,0 +1,66 @@
1
+ export interface CodeBlockThemePair {
2
+ dark: string;
3
+ light: string;
4
+ }
5
+ export type CodeBlockTheme = string;
6
+ export type CodeBlockThemeProp = CodeBlockTheme | CodeBlockThemePair;
7
+ export type CodeBlockThemes = readonly [dark: CodeBlockTheme, light: CodeBlockTheme];
8
+ export interface CodeBlockDiffHideUnchangedRegionsOptions {
9
+ enabled?: boolean;
10
+ contextLineCount?: number;
11
+ minimumLineCount?: number;
12
+ revealLineCount?: number;
13
+ }
14
+ export type CodeBlockDiffHideUnchangedRegions = boolean | CodeBlockDiffHideUnchangedRegionsOptions;
15
+ export interface CodeBlockOptions {
16
+ fontSize?: number;
17
+ lineHeight?: number;
18
+ fontFamily?: string;
19
+ maxHeight?: number;
20
+ padding?: number;
21
+ tabSize?: number;
22
+ disableLineNumbers?: boolean;
23
+ overflow?: 'scroll' | 'wrap';
24
+ disableVirtualizationBuffers?: boolean;
25
+ preferredHighlighter?: 'shiki-js' | 'shiki-wasm';
26
+ useCSSClasses?: boolean;
27
+ useTokenTransformer?: boolean;
28
+ tokenizeMaxLineLength?: number;
29
+ tokenizeMaxLength?: number;
30
+ unsafeCSS?: string;
31
+ diffStyle?: 'unified' | 'split';
32
+ diffIndicators?: 'classic' | 'bars' | 'none';
33
+ disableBackground?: boolean;
34
+ hunkSeparators?: 'simple' | 'metadata' | 'line-info' | 'line-info-basic';
35
+ expandUnchanged?: boolean;
36
+ collapsedContextThreshold?: number;
37
+ lineDiffType?: 'word-alt' | 'word' | 'char' | 'none';
38
+ maxLineDiffLength?: number;
39
+ expansionLineCount?: number;
40
+ parseDiffOptions?: Record<string, unknown>;
41
+ lineHoverHighlight?: 'disabled' | 'both' | 'number' | 'line';
42
+ enableTokenInteractionsOnWhitespace?: boolean;
43
+ enableGutterUtility?: boolean;
44
+ enableLineSelection?: boolean;
45
+ controlledSelection?: boolean;
46
+ onGutterUtilityClick?: (...args: any[]) => unknown;
47
+ onLineClick?: (...args: any[]) => unknown;
48
+ onLineNumberClick?: (...args: any[]) => unknown;
49
+ onLineEnter?: (...args: any[]) => unknown;
50
+ onLineLeave?: (...args: any[]) => unknown;
51
+ onTokenClick?: (...args: any[]) => unknown;
52
+ onTokenEnter?: (...args: any[]) => unknown;
53
+ onTokenLeave?: (...args: any[]) => unknown;
54
+ onLineSelected?: (...args: any[]) => unknown;
55
+ onLineSelectionStart?: (...args: any[]) => unknown;
56
+ onLineSelectionChange?: (...args: any[]) => unknown;
57
+ onLineSelectionEnd?: (...args: any[]) => unknown;
58
+ getLineIndex?: (...args: any[]) => unknown;
59
+ renderAnnotation?: (...args: any[]) => unknown;
60
+ renderGutterUtility?: (...args: any[]) => unknown;
61
+ onPostRender?: (...args: any[]) => unknown;
62
+ mergeConflict?: boolean;
63
+ lineAnnotations?: unknown[];
64
+ onController?: (controller: any) => void;
65
+ workerManager?: unknown;
66
+ }
@@ -1,6 +1,6 @@
1
1
  export type LanguageIconResolver = (lang: string) => string | undefined | null;
2
2
  export declare function normalizeLanguageIdentifier(lang?: string | null): string;
3
- export declare function resolveMonacoLanguageId(lang?: string | null): string;
3
+ export declare function resolveLanguageId(lang?: string | null): string;
4
4
  export declare function isLikelyIncompleteLanguageIdentifier(lang?: string | null): boolean;
5
5
  export declare function setLanguageIconResolver(resolver?: LanguageIconResolver | null): void;
6
6
  export declare function getLanguageIcon(lang: string): string;
@@ -147,16 +147,18 @@ export function normalizeLanguageIdentifier(lang) {
147
147
  const token = extractLanguageToken(lang);
148
148
  return (_a = LANGUAGE_ALIAS_MAP[token]) !== null && _a !== void 0 ? _a : token;
149
149
  }
150
- export function resolveMonacoLanguageId(lang) {
150
+ export function resolveLanguageId(lang) {
151
151
  const canonical = normalizeLanguageIdentifier(lang);
152
152
  if (!canonical)
153
153
  return 'plaintext';
154
154
  if (canonical === 'plain')
155
155
  return 'plaintext';
156
- if (canonical === 'jsx')
157
- return 'javascript';
158
- if (canonical === 'tsx')
159
- return 'typescript';
156
+ if (canonical === 'shell')
157
+ return 'zsh';
158
+ if (canonical === 'objectivec')
159
+ return 'objective-c';
160
+ if (canonical === 'objectivecpp')
161
+ return 'objective-cpp';
160
162
  return canonical;
161
163
  }
162
164
  export function isLikelyIncompleteLanguageIdentifier(lang) {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "markstream-svelte",
3
3
  "type": "module",
4
- "version": "0.0.6",
5
- "description": "Svelte 5 and SvelteKit streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown, Mermaid, KaTeX, Monaco-powered code blocks, and custom Svelte components.",
4
+ "version": "0.1.0-beta.3",
5
+ "description": "Svelte 5 and SvelteKit streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown, Mermaid, KaTeX, stream-diffs powered code blocks, and custom Svelte components.",
6
6
  "author": "Simon He",
7
7
  "license": "MIT",
8
8
  "homepage": "https://markstream.simonhe.me/frameworks/svelte",
@@ -41,10 +41,10 @@
41
41
  "streaming-mermaid",
42
42
  "katex",
43
43
  "streaming-katex",
44
+ "stream-diffs",
44
45
  "streaming-code-blocks",
45
46
  "d2",
46
47
  "infographic",
47
- "monaco-editor",
48
48
  "large-documents",
49
49
  "custom-components",
50
50
  "beta",
@@ -73,13 +73,22 @@
73
73
  "files": [
74
74
  "dist"
75
75
  ],
76
+ "scripts": {
77
+ "build": "pnpm --dir ../markdown-parser build && pnpm --dir ../markstream-core build && svelte-package -i src -o dist --tsconfig tsconfig.build.json && postcss src/index.css -o dist/index.css && cp dist/index.css dist/index.tailwind.css && node ../../scripts/generate-px-css.mjs",
78
+ "dev": "vite dev",
79
+ "preview": "vite preview",
80
+ "typecheck": "svelte-check --tsconfig ./tsconfig.json",
81
+ "prepublishOnly": "pnpm run build && pnpm run check:workspace-deps-published",
82
+ "check:core-published": "node ../../scripts/check-core-published.mjs --package-json package.json --core-package-json ../markstream-core/package.json",
83
+ "check:workspace-deps-published": "node ../../scripts/check-workspace-deps-published.mjs --package-json package.json",
84
+ "release": "pnpm run check:workspace-deps-published && bumpp --all --commit --no-tag --no-push --execute 'pnpm --workspace-root run docs:llms:generate' && DIST_TAG=\"$(node ../../scripts/dist-tag.mjs)\" && pnpm publish --access public --tag \"${DIST_TAG}\" && node ../../scripts/tag-package.mjs --package-json package.json --push"
85
+ },
76
86
  "peerDependencies": {
77
87
  "@antv/infographic": "^0.2.3",
78
88
  "@terrastruct/d2": ">=0.1.33",
79
89
  "katex": ">=0.16.22",
80
90
  "mermaid": ">=11",
81
91
  "stream-diffs": ">=0.0.2",
82
- "stream-monaco": ">=0.0.48",
83
92
  "svelte": ">=5 <6"
84
93
  },
85
94
  "peerDependenciesMeta": {
@@ -97,15 +106,12 @@
97
106
  },
98
107
  "stream-diffs": {
99
108
  "optional": true
100
- },
101
- "stream-monaco": {
102
- "optional": true
103
109
  }
104
110
  },
105
111
  "dependencies": {
106
112
  "@floating-ui/dom": "^1.8.0",
107
- "stream-markdown-parser": "1.2.3",
108
- "markstream-core": "1.0.3"
113
+ "markstream-core": "1.1.0-beta.2",
114
+ "stream-markdown-parser": "1.2.6-beta.1"
109
115
  },
110
116
  "devDependencies": {
111
117
  "@sveltejs/package": "^2.5.8",
@@ -118,14 +124,5 @@
118
124
  "tailwindcss": "^3.4.19",
119
125
  "typescript": "^5.9.3",
120
126
  "vite": "^7.3.6"
121
- },
122
- "scripts": {
123
- "build": "pnpm --dir ../markdown-parser build && pnpm --dir ../markstream-core build && svelte-package -i src -o dist --tsconfig tsconfig.build.json && postcss src/index.css -o dist/index.css && cp dist/index.css dist/index.tailwind.css && node ../../scripts/generate-px-css.mjs",
124
- "dev": "vite dev",
125
- "preview": "vite preview",
126
- "typecheck": "svelte-check --tsconfig ./tsconfig.json",
127
- "check:core-published": "node ../../scripts/check-core-published.mjs --package-json package.json --core-package-json ../markstream-core/package.json",
128
- "check:workspace-deps-published": "node ../../scripts/check-workspace-deps-published.mjs --package-json package.json",
129
- "release": "pnpm run check:workspace-deps-published && bumpp --all --commit --no-tag --no-push --execute 'pnpm --workspace-root run docs:llms:generate' && pnpm publish --access public $(node ../../scripts/dist-tag.mjs) && node ../../scripts/tag-package.mjs --package-json package.json --push"
130
127
  }
131
- }
128
+ }
@@ -1,15 +0,0 @@
1
- <script lang="ts">
2
- import type { SvelteRenderableNode, SvelteRenderContext } from './shared/node-helpers'
3
- import CodeBlockNode from './CodeBlockNode.svelte'
4
-
5
- type Props = {
6
- node: SvelteRenderableNode
7
- context?: SvelteRenderContext
8
- };
9
- let {
10
- node,
11
- context = undefined
12
- }: Props = $props()
13
- </script>
14
-
15
- <CodeBlockNode {node} {context} />
@@ -1,8 +0,0 @@
1
- import type { SvelteRenderableNode, SvelteRenderContext } from './shared/node-helpers';
2
- type Props = {
3
- node: SvelteRenderableNode;
4
- context?: SvelteRenderContext;
5
- };
6
- declare const MarkdownCodeBlockNode: import("svelte").Component<Props, {}, "">;
7
- type MarkdownCodeBlockNode = ReturnType<typeof MarkdownCodeBlockNode>;
8
- export default MarkdownCodeBlockNode;