markstream-svelte 0.0.6 → 0.1.0-beta.2
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/README.md +14 -17
- package/dist/components/CodeBlockNode.svelte +235 -266
- package/dist/components/CodeBlockNode.svelte.d.ts +6 -5
- package/dist/components/NodeOutlet.svelte +13 -2
- package/dist/components/NodeRenderer.svelte +16 -5
- package/dist/components/PreCodeNode.svelte +1 -1
- package/dist/components/shared/node-helpers.d.ts +14 -13
- package/dist/components/shared/node-helpers.js +1 -1
- package/dist/enhanceRenderedHtml.d.ts +5 -2
- package/dist/enhanceRenderedHtml.js +134 -40
- package/dist/index.css +10 -69
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -3
- package/dist/index.px.css +10 -69
- package/dist/index.tailwind.css +10 -69
- package/dist/optional/{monaco.d.ts → streamDiffs.d.ts} +5 -6
- package/dist/optional/streamDiffs.js +66 -0
- package/dist/types/codeBlock.d.ts +66 -0
- package/dist/utils/languageIcon.d.ts +1 -1
- package/dist/utils/languageIcon.js +7 -5
- package/package.json +6 -10
- package/dist/components/MarkdownCodeBlockNode.svelte +0 -15
- package/dist/components/MarkdownCodeBlockNode.svelte.d.ts +0 -8
- package/dist/optional/monaco.js +0 -84
- package/dist/types/monaco.d.ts +0 -65
- /package/dist/types/{monaco.js → codeBlock.js} +0 -0
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/
|
|
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 {
|
|
74
|
-
export { getLanguageIcon, languageMap, normalizeLanguageIdentifier,
|
|
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/
|
|
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,
|
|
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 .
|
|
1303
|
-
.markstream-svelte .markstream-svelte-enhanced-block__body--code
|
|
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 .
|
|
1540
|
-
.markstream-svelte .code-block-container.is-plain-text
|
|
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;
|
package/dist/index.tailwind.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 .
|
|
1303
|
-
.markstream-svelte .markstream-svelte-enhanced-block__body--code
|
|
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 .
|
|
1540
|
-
.markstream-svelte .code-block-container.is-plain-text
|
|
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
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
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
|
|
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
|
|
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 === '
|
|
157
|
-
return '
|
|
158
|
-
if (canonical === '
|
|
159
|
-
return '
|
|
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.
|
|
5
|
-
"description": "Svelte 5 and SvelteKit streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown, Mermaid, KaTeX,
|
|
4
|
+
"version": "0.1.0-beta.2",
|
|
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",
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
"katex": ">=0.16.22",
|
|
80
80
|
"mermaid": ">=11",
|
|
81
81
|
"stream-diffs": ">=0.0.2",
|
|
82
|
-
"stream-monaco": ">=0.0.48",
|
|
83
82
|
"svelte": ">=5 <6"
|
|
84
83
|
},
|
|
85
84
|
"peerDependenciesMeta": {
|
|
@@ -97,15 +96,12 @@
|
|
|
97
96
|
},
|
|
98
97
|
"stream-diffs": {
|
|
99
98
|
"optional": true
|
|
100
|
-
},
|
|
101
|
-
"stream-monaco": {
|
|
102
|
-
"optional": true
|
|
103
99
|
}
|
|
104
100
|
},
|
|
105
101
|
"dependencies": {
|
|
106
102
|
"@floating-ui/dom": "^1.8.0",
|
|
107
|
-
"
|
|
108
|
-
"
|
|
103
|
+
"markstream-core": "1.1.0-beta.1",
|
|
104
|
+
"stream-markdown-parser": "1.2.5-beta.1"
|
|
109
105
|
},
|
|
110
106
|
"devDependencies": {
|
|
111
107
|
"@sveltejs/package": "^2.5.8",
|
|
@@ -126,6 +122,6 @@
|
|
|
126
122
|
"typecheck": "svelte-check --tsconfig ./tsconfig.json",
|
|
127
123
|
"check:core-published": "node ../../scripts/check-core-published.mjs --package-json package.json --core-package-json ../markstream-core/package.json",
|
|
128
124
|
"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' &&
|
|
125
|
+
"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"
|
|
130
126
|
}
|
|
131
127
|
}
|
|
@@ -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;
|
package/dist/optional/monaco.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
let monacoModule = null;
|
|
2
|
-
let importAttempted = false;
|
|
3
|
-
let pendingImport = null;
|
|
4
|
-
let workersPreloaded = false;
|
|
5
|
-
let codeBlockRuntimeReady = false;
|
|
6
|
-
export function isCodeBlockRuntimeReady() {
|
|
7
|
-
return codeBlockRuntimeReady;
|
|
8
|
-
}
|
|
9
|
-
export function resetCodeBlockRuntimeReadyForTest() {
|
|
10
|
-
codeBlockRuntimeReady = false;
|
|
11
|
-
}
|
|
12
|
-
export async function preloadCodeBlockRuntime() {
|
|
13
|
-
const runtime = await getUseMonaco();
|
|
14
|
-
return !!runtime;
|
|
15
|
-
}
|
|
16
|
-
async function preloadWorkers(mod) {
|
|
17
|
-
if (workersPreloaded)
|
|
18
|
-
return;
|
|
19
|
-
workersPreloaded = true;
|
|
20
|
-
const existingEnv = globalThis === null || globalThis === void 0 ? void 0 : globalThis.MonacoEnvironment;
|
|
21
|
-
if (existingEnv && (typeof existingEnv.getWorker === 'function' || typeof existingEnv.getWorkerUrl === 'function'))
|
|
22
|
-
return;
|
|
23
|
-
if (typeof (mod === null || mod === void 0 ? void 0 : mod.preloadMonacoWorkers) === 'function')
|
|
24
|
-
await mod.preloadMonacoWorkers();
|
|
25
|
-
}
|
|
26
|
-
async function warmupShikiTokenizer(mod) {
|
|
27
|
-
const getOrCreateHighlighter = mod === null || mod === void 0 ? void 0 : mod.getOrCreateHighlighter;
|
|
28
|
-
if (typeof getOrCreateHighlighter !== 'function')
|
|
29
|
-
return true;
|
|
30
|
-
try {
|
|
31
|
-
const highlighter = await getOrCreateHighlighter(['vitesse-dark', 'vitesse-light'], ['plaintext', 'text', 'javascript']);
|
|
32
|
-
if (highlighter && typeof highlighter.codeToTokens === 'function') {
|
|
33
|
-
highlighter.codeToTokens('const a = 1', { lang: 'javascript', theme: 'vitesse-dark' });
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.warn('[markstream-svelte] Failed to warm up stream-monaco tokenizer.', error);
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export async function getUseMonaco() {
|
|
43
|
-
if (monacoModule)
|
|
44
|
-
return monacoModule;
|
|
45
|
-
if (pendingImport)
|
|
46
|
-
return await pendingImport;
|
|
47
|
-
if (importAttempted)
|
|
48
|
-
return null;
|
|
49
|
-
pendingImport = (async () => {
|
|
50
|
-
var _a;
|
|
51
|
-
// Prefer `stream-diffs`: smaller runtime without the heavy
|
|
52
|
-
// `monaco-editor` dependency. `stream-monaco` remains supported as a
|
|
53
|
-
// fallback for consumers who install it.
|
|
54
|
-
const candidates = [
|
|
55
|
-
async () => (await import('stream-diffs')),
|
|
56
|
-
async () => (await import('stream-monaco')),
|
|
57
|
-
];
|
|
58
|
-
for (const load of candidates) {
|
|
59
|
-
try {
|
|
60
|
-
const candidate = await load();
|
|
61
|
-
const resolved = (_a = candidate === null || candidate === void 0 ? void 0 : candidate.default) !== null && _a !== void 0 ? _a : candidate;
|
|
62
|
-
if (typeof (resolved === null || resolved === void 0 ? void 0 : resolved.useMonaco) !== 'function')
|
|
63
|
-
continue;
|
|
64
|
-
monacoModule = resolved;
|
|
65
|
-
await preloadWorkers(monacoModule);
|
|
66
|
-
codeBlockRuntimeReady = true;
|
|
67
|
-
if (typeof (monacoModule === null || monacoModule === void 0 ? void 0 : monacoModule.getOrCreateHighlighter) === 'function')
|
|
68
|
-
void warmupShikiTokenizer(monacoModule);
|
|
69
|
-
return monacoModule;
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
// Try the next candidate runtime.
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
importAttempted = true;
|
|
76
|
-
return null;
|
|
77
|
-
})();
|
|
78
|
-
try {
|
|
79
|
-
return await pendingImport;
|
|
80
|
-
}
|
|
81
|
-
finally {
|
|
82
|
-
pendingImport = null;
|
|
83
|
-
}
|
|
84
|
-
}
|