@incremark/vue 0.3.0 → 0.3.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/dist/index.js CHANGED
@@ -54,13 +54,21 @@ function useProvideDefinations() {
54
54
  import { ref as ref2, shallowRef, computed, watch, toValue, onUnmounted } from "vue";
55
55
  import {
56
56
  createBlockTransformer,
57
- defaultPlugins
57
+ defaultPlugins,
58
+ mathPlugin,
59
+ collectFootnoteReferences
58
60
  } from "@incremark/core";
59
61
 
60
62
  // src/utils/cursor.ts
61
63
  function addCursorToNode(node, cursor) {
64
+ if (node.type === "code") {
65
+ return node;
66
+ }
62
67
  const cloned = JSON.parse(JSON.stringify(node));
63
68
  function addToLast(n) {
69
+ if (n.type === "code") {
70
+ return false;
71
+ }
64
72
  if (n.children && n.children.length > 0) {
65
73
  for (let i = n.children.length - 1; i >= 0; i--) {
66
74
  if (addToLast(n.children[i])) {
@@ -102,14 +110,12 @@ function useTypewriter(options) {
102
110
  tickInterval: initialConfig.tickInterval ?? 30,
103
111
  effect: initialConfig.effect ?? "none",
104
112
  pauseOnHidden: initialConfig.pauseOnHidden ?? true,
105
- plugins: initialConfig.plugins ?? defaultPlugins,
113
+ // 默认插件 + 数学公式插件(数学公式应该整体显示,不参与打字机逐字符效果)
114
+ plugins: initialConfig.plugins ?? [...defaultPlugins, mathPlugin],
106
115
  onChange: (blocks2) => {
107
116
  displayBlocksRef.value = blocks2;
108
117
  isTypewriterProcessing.value = transformer?.isProcessing() ?? false;
109
118
  isTypewriterPaused.value = transformer?.isPausedState() ?? false;
110
- if (transformer?.isProcessing()) {
111
- isAnimationComplete.value = false;
112
- }
113
119
  },
114
120
  onAllComplete: () => {
115
121
  isAnimationComplete.value = true;
@@ -138,27 +144,14 @@ function useTypewriter(options) {
138
144
  },
139
145
  { deep: true }
140
146
  );
141
- const sourceBlocks = computed(() => {
142
- return completedBlocks.value.map((block) => ({
143
- id: block.id,
144
- node: block.node,
145
- status: block.status
146
- }));
147
- });
148
147
  if (transformer) {
149
148
  watch(
150
- sourceBlocks,
151
- (blocks2) => {
152
- transformer.push(blocks2);
153
- const currentDisplaying = displayBlocksRef.value.find((b) => !b.isDisplayComplete);
154
- if (currentDisplaying) {
155
- const updated = blocks2.find((b) => b.id === currentDisplaying.id);
156
- if (updated) {
157
- transformer.update(updated);
158
- }
159
- }
149
+ [completedBlocks, pendingBlocks],
150
+ () => {
151
+ const allBlocks = [...completedBlocks.value, ...pendingBlocks.value];
152
+ transformer.push(allBlocks);
160
153
  },
161
- { immediate: true, deep: true }
154
+ { immediate: true }
162
155
  );
163
156
  }
164
157
  const rawBlocks = computed(() => {
@@ -177,15 +170,47 @@ function useTypewriter(options) {
177
170
  }
178
171
  return {
179
172
  id: db.id,
180
- status: db.isDisplayComplete ? "completed" : "pending",
181
- isLastPending,
173
+ status: db.status,
182
174
  node,
175
+ // 这些字段在打字机模式下没有意义,设为默认值以满足类型要求
183
176
  startOffset: 0,
184
177
  endOffset: 0,
185
- rawText: ""
178
+ rawText: "",
179
+ isLastPending
186
180
  };
187
181
  });
188
182
  });
183
+ const displayedFootnoteReferenceOrder = computed(() => {
184
+ if (!typewriterEnabled.value || !transformer) {
185
+ const references2 = [];
186
+ const seen2 = /* @__PURE__ */ new Set();
187
+ for (const block of rawBlocks.value) {
188
+ const blockRefs = collectFootnoteReferences(block.node);
189
+ for (const ref13 of blockRefs) {
190
+ if (!seen2.has(ref13)) {
191
+ seen2.add(ref13);
192
+ references2.push(ref13);
193
+ }
194
+ }
195
+ }
196
+ return references2;
197
+ }
198
+ if (!isAnimationComplete.value) {
199
+ return [];
200
+ }
201
+ const references = [];
202
+ const seen = /* @__PURE__ */ new Set();
203
+ for (const db of displayBlocksRef.value) {
204
+ const blockRefs = collectFootnoteReferences(db.displayNode);
205
+ for (const ref13 of blockRefs) {
206
+ if (!seen.has(ref13)) {
207
+ seen.add(ref13);
208
+ references.push(ref13);
209
+ }
210
+ }
211
+ }
212
+ return references;
213
+ });
189
214
  const typewriterControls = {
190
215
  enabled: computed(() => typewriterEnabled.value),
191
216
  setEnabled: (value) => {
@@ -230,7 +255,8 @@ function useTypewriter(options) {
230
255
  blocks,
231
256
  typewriter: typewriterControls,
232
257
  transformer,
233
- isAnimationComplete
258
+ isAnimationComplete,
259
+ displayedFootnoteReferenceOrder
234
260
  };
235
261
  }
236
262
 
@@ -254,7 +280,7 @@ function useIncremark(optionsInput = {}) {
254
280
  const markdown = ref3("");
255
281
  const isFinalized = ref3(false);
256
282
  const footnoteReferenceOrder = ref3([]);
257
- const { blocks, typewriter, transformer, isAnimationComplete } = useTypewriter({
283
+ const { blocks, typewriter, transformer, isAnimationComplete, displayedFootnoteReferenceOrder } = useTypewriter({
258
284
  typewriter: () => toValue2(optionsInput).typewriter,
259
285
  completedBlocks,
260
286
  pendingBlocks
@@ -265,33 +291,35 @@ function useIncremark(optionsInput = {}) {
265
291
  }
266
292
  return isFinalized.value && isAnimationComplete.value;
267
293
  });
268
- const ast = computed2(() => ({
294
+ const ast = ref3({
269
295
  type: "root",
270
- children: [
271
- ...completedBlocks.value.map((b) => b.node),
272
- ...pendingBlocks.value.map((b) => b.node)
273
- ]
274
- }));
296
+ children: []
297
+ });
275
298
  function handleUpdate(update, isFinalize = false) {
276
299
  markdown.value = parser.getBuffer();
300
+ if (update.updated.length > 0) {
301
+ const idsToRemove = new Set(update.updated.map((b) => b.id));
302
+ completedBlocks.value = completedBlocks.value.filter((b) => !idsToRemove.has(b.id));
303
+ }
277
304
  if (update.completed.length > 0) {
278
- completedBlocks.value = [
279
- ...completedBlocks.value,
280
- ...update.completed.map((b) => markRaw(b))
281
- ];
305
+ completedBlocks.value.push(...update.completed.map((b) => markRaw(b)));
282
306
  }
283
307
  pendingBlocks.value = update.pending.map((b) => markRaw(b));
284
308
  if (isFinalize) {
309
+ if (pendingBlocks.value.length) {
310
+ completedBlocks.value.push(...pendingBlocks.value.map((b) => markRaw(b)));
311
+ pendingBlocks.value = [];
312
+ }
285
313
  isLoading.value = false;
286
314
  isFinalized.value = true;
287
315
  } else {
288
316
  isLoading.value = true;
289
317
  }
290
318
  footnoteReferenceOrder.value = update.footnoteReferenceOrder;
291
- setFootnoteReferenceOrder(update.footnoteReferenceOrder);
292
319
  }
293
320
  function append(chunk) {
294
321
  const update = parser.append(chunk);
322
+ ast.value = update.ast;
295
323
  handleUpdate(update, false);
296
324
  return update;
297
325
  }
@@ -315,16 +343,31 @@ function useIncremark(optionsInput = {}) {
315
343
  }
316
344
  watch2(
317
345
  () => {
318
- const { typewriter: _, ...parserOptions } = toValue2(optionsInput);
319
- return JSON.stringify(parserOptions);
346
+ const opts = toValue2(optionsInput);
347
+ const { typewriter: _, astBuilder, ...parserOptions } = opts;
348
+ return JSON.stringify(parserOptions) + "|" + (astBuilder?.name ?? "default");
320
349
  },
321
350
  () => {
322
- const { typewriter: _, ...parserOptions } = toValue2(optionsInput);
323
- parser = createParser(parserOptions);
324
- reset();
351
+ const opts = toValue2(optionsInput);
352
+ const { typewriter: _, ...parserOptions } = opts;
353
+ parser.updateOptions(parserOptions);
354
+ completedBlocks.value = [];
355
+ pendingBlocks.value = [];
356
+ markdown.value = "";
357
+ isLoading.value = false;
358
+ isFinalized.value = false;
359
+ footnoteReferenceOrder.value = [];
360
+ transformer?.reset();
325
361
  }
326
362
  );
327
- function render23(content) {
363
+ watch2(
364
+ displayedFootnoteReferenceOrder,
365
+ (newOrder) => {
366
+ setFootnoteReferenceOrder(newOrder);
367
+ },
368
+ { immediate: true }
369
+ );
370
+ function render24(content) {
328
371
  const update = parser.render(content);
329
372
  markdown.value = parser.getBuffer();
330
373
  completedBlocks.value = parser.getCompletedBlocks().map((b) => markRaw(b));
@@ -335,7 +378,7 @@ function useIncremark(optionsInput = {}) {
335
378
  setFootnoteReferenceOrder(update.footnoteReferenceOrder);
336
379
  return update;
337
380
  }
338
- return {
381
+ const result = {
339
382
  /** 已收集的完整 Markdown 字符串 */
340
383
  markdown,
341
384
  /** 已完成的块列表 */
@@ -368,12 +411,13 @@ function useIncremark(optionsInput = {}) {
368
411
  /** 重置解析器和打字机 */
369
412
  reset,
370
413
  /** 一次性渲染(reset + append + finalize) */
371
- render: render23,
414
+ render: render24,
372
415
  /** 解析器实例 */
373
416
  parser,
374
417
  /** 打字机控制 */
375
418
  typewriter
376
419
  };
420
+ return result;
377
421
  }
378
422
 
379
423
  // src/composables/useStreamRenderer.ts
@@ -480,22 +524,11 @@ function useBlockTransformer(sourceBlocks, options = {}) {
480
524
  }
481
525
 
482
526
  // src/composables/useLocale.ts
483
- import { inject, computed as computed5 } from "vue";
527
+ import { inject, computed as computed5, ref as ref5 } from "vue";
528
+ import { zhCN } from "@incremark/shared";
484
529
  var LOCALE_KEY = /* @__PURE__ */ Symbol("incremark-locale");
485
530
  function useLocale() {
486
- const locale = inject(LOCALE_KEY);
487
- if (!locale) {
488
- const defaultLocale = enShared;
489
- const t2 = computed5(() => (key) => {
490
- const keys = key.split(".");
491
- let value = defaultLocale;
492
- for (const k of keys) {
493
- value = value?.[k];
494
- }
495
- return value || key;
496
- });
497
- return { t: t2 };
498
- }
531
+ const locale = inject(LOCALE_KEY, ref5(zhCN));
499
532
  const t = computed5(() => (key) => {
500
533
  const keys = key.split(".");
501
534
  let value = locale.value;
@@ -518,11 +551,11 @@ function useDefinationsContext() {
518
551
  }
519
552
 
520
553
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=script
521
- import { defineComponent as _defineComponent18 } from "vue";
554
+ import { defineComponent as _defineComponent19 } from "vue";
522
555
  import { computed as computed14 } from "vue";
523
556
 
524
557
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=script
525
- import { defineComponent as _defineComponent16 } from "vue";
558
+ import { defineComponent as _defineComponent17 } from "vue";
526
559
  import { computed as computed12 } from "vue";
527
560
 
528
561
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkHeading.vue?type=script
@@ -539,7 +572,7 @@ import {
539
572
 
540
573
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkMath.vue?type=script
541
574
  import { defineComponent as _defineComponent } from "vue";
542
- import { computed as computed6, ref as ref5, watch as watch4, shallowRef as shallowRef3, onUnmounted as onUnmounted4 } from "vue";
575
+ import { computed as computed6, ref as ref6, watch as watch4, shallowRef as shallowRef3, onUnmounted as onUnmounted4 } from "vue";
543
576
  var IncremarkMath_default = /* @__PURE__ */ _defineComponent({
544
577
  __name: "IncremarkMath",
545
578
  props: {
@@ -549,9 +582,9 @@ var IncremarkMath_default = /* @__PURE__ */ _defineComponent({
549
582
  setup(__props, { expose: __expose }) {
550
583
  __expose();
551
584
  const props = __props;
552
- const renderedHtml = ref5("");
553
- const renderError = ref5("");
554
- const isLoading = ref5(false);
585
+ const renderedHtml = ref6("");
586
+ const renderError = ref6("");
587
+ const isLoading = ref6(false);
555
588
  const katexRef = shallowRef3(null);
556
589
  let renderTimer = null;
557
590
  const isInline = computed6(() => props.node.type === "inlineMath");
@@ -1295,12 +1328,12 @@ IncremarkParagraph_default.__file = "src/components/IncremarkParagraph.vue";
1295
1328
  var IncremarkParagraph_default2 = IncremarkParagraph_default;
1296
1329
 
1297
1330
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=script
1298
- import { defineComponent as _defineComponent9 } from "vue";
1331
+ import { defineComponent as _defineComponent10 } from "vue";
1299
1332
  import { computed as computed10 } from "vue";
1300
1333
 
1301
1334
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeMermaid.vue?type=script
1302
1335
  import { defineComponent as _defineComponent7 } from "vue";
1303
- import { computed as computed8, ref as ref6, onUnmounted as onUnmounted5, shallowRef as shallowRef4, watch as watch5 } from "vue";
1336
+ import { computed as computed8, ref as ref7, onUnmounted as onUnmounted5, shallowRef as shallowRef4, watch as watch5 } from "vue";
1304
1337
  import { GravityMermaid, LucideCode, LucideEye, LucideCopy, LucideCopyCheck } from "@incremark/icons";
1305
1338
  import { isClipboardAvailable } from "@incremark/shared";
1306
1339
 
@@ -1347,12 +1380,12 @@ var IncremarkCodeMermaid_default = /* @__PURE__ */ _defineComponent7({
1347
1380
  __expose();
1348
1381
  const props = __props;
1349
1382
  const { t } = useLocale();
1350
- const mermaidSvg = ref6("");
1351
- const mermaidError = ref6("");
1352
- const mermaidLoading = ref6(false);
1383
+ const mermaidSvg = ref7("");
1384
+ const mermaidError = ref7("");
1385
+ const mermaidLoading = ref7(false);
1353
1386
  const mermaidRef = shallowRef4(null);
1354
1387
  let mermaidTimer = null;
1355
- const mermaidViewMode = ref6("preview");
1388
+ const mermaidViewMode = ref7("preview");
1356
1389
  function toggleMermaidView() {
1357
1390
  mermaidViewMode.value = mermaidViewMode.value === "preview" ? "source" : "preview";
1358
1391
  }
@@ -1401,7 +1434,7 @@ var IncremarkCodeMermaid_default = /* @__PURE__ */ _defineComponent7({
1401
1434
  clearTimeout(copyTimeoutId);
1402
1435
  }
1403
1436
  });
1404
- const copied = ref6(false);
1437
+ const copied = ref7(false);
1405
1438
  let copyTimeoutId = null;
1406
1439
  async function copyCode() {
1407
1440
  if (!isClipboardAvailable()) return;
@@ -1561,8 +1594,8 @@ IncremarkCodeMermaid_default.__file = "src/components/IncremarkCodeMermaid.vue";
1561
1594
  var IncremarkCodeMermaid_default2 = IncremarkCodeMermaid_default;
1562
1595
 
1563
1596
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeDefault.vue?type=script
1564
- import { defineComponent as _defineComponent8 } from "vue";
1565
- import { computed as computed9, onUnmounted as onUnmounted6, ref as ref7, watch as watch6 } from "vue";
1597
+ import { defineComponent as _defineComponent9 } from "vue";
1598
+ import { computed as computed9, ref as ref9, watch as watch7 } from "vue";
1566
1599
  import { LucideCopy as LucideCopy2, LucideCopyCheck as LucideCopyCheck2 } from "@incremark/icons";
1567
1600
  import { isClipboardAvailable as isClipboardAvailable2 } from "@incremark/shared";
1568
1601
 
@@ -1669,9 +1702,22 @@ function getShikiManager() {
1669
1702
  function useShiki(theme) {
1670
1703
  const highlighterInfo = shallowRef5(null);
1671
1704
  const isHighlighting = shallowRef5(false);
1705
+ const isReady = shallowRef5(false);
1706
+ async function initHighlighter() {
1707
+ if (isReady.value) return;
1708
+ try {
1709
+ const info = await getShikiManager().getHighlighter(theme);
1710
+ highlighterInfo.value = info;
1711
+ isReady.value = true;
1712
+ } catch (e) {
1713
+ console.warn("Failed to initialize Shiki highlighter:", e);
1714
+ throw e;
1715
+ }
1716
+ }
1672
1717
  async function getHighlighter() {
1673
1718
  if (!highlighterInfo.value) {
1674
1719
  highlighterInfo.value = await getShikiManager().getHighlighter(theme);
1720
+ isReady.value = true;
1675
1721
  }
1676
1722
  return highlighterInfo.value;
1677
1723
  }
@@ -1696,41 +1742,785 @@ function useShiki(theme) {
1696
1742
  return {
1697
1743
  highlighterInfo,
1698
1744
  isHighlighting,
1745
+ isReady,
1746
+ initHighlighter,
1699
1747
  highlight
1700
1748
  };
1701
1749
  }
1702
1750
 
1751
+ // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/CachedCodeRenderer.vue?type=script
1752
+ import { defineComponent as _defineComponent8 } from "vue";
1753
+ import { h, ref as ref8, reactive, watch as watch6, renderList, onUnmounted as onUnmounted6 } from "vue";
1754
+ import { CodeToTokenTransformStream } from "shiki-stream";
1755
+
1756
+ // ../../node_modules/.pnpm/@shikijs+vscode-textmate@10.0.2/node_modules/@shikijs/vscode-textmate/dist/index.js
1757
+ function escapeRegExpCharacters(value) {
1758
+ return value.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, "\\$&");
1759
+ }
1760
+ var CachedFn = class {
1761
+ constructor(fn) {
1762
+ this.fn = fn;
1763
+ }
1764
+ cache = /* @__PURE__ */ new Map();
1765
+ get(key) {
1766
+ if (this.cache.has(key)) {
1767
+ return this.cache.get(key);
1768
+ }
1769
+ const value = this.fn(key);
1770
+ this.cache.set(key, value);
1771
+ return value;
1772
+ }
1773
+ };
1774
+ var ScopeStack = class _ScopeStack {
1775
+ constructor(parent, scopeName) {
1776
+ this.parent = parent;
1777
+ this.scopeName = scopeName;
1778
+ }
1779
+ static push(path, scopeNames) {
1780
+ for (const name of scopeNames) {
1781
+ path = new _ScopeStack(path, name);
1782
+ }
1783
+ return path;
1784
+ }
1785
+ static from(...segments) {
1786
+ let result = null;
1787
+ for (let i = 0; i < segments.length; i++) {
1788
+ result = new _ScopeStack(result, segments[i]);
1789
+ }
1790
+ return result;
1791
+ }
1792
+ push(scopeName) {
1793
+ return new _ScopeStack(this, scopeName);
1794
+ }
1795
+ getSegments() {
1796
+ let item = this;
1797
+ const result = [];
1798
+ while (item) {
1799
+ result.push(item.scopeName);
1800
+ item = item.parent;
1801
+ }
1802
+ result.reverse();
1803
+ return result;
1804
+ }
1805
+ toString() {
1806
+ return this.getSegments().join(" ");
1807
+ }
1808
+ extends(other) {
1809
+ if (this === other) {
1810
+ return true;
1811
+ }
1812
+ if (this.parent === null) {
1813
+ return false;
1814
+ }
1815
+ return this.parent.extends(other);
1816
+ }
1817
+ getExtensionIfDefined(base) {
1818
+ const result = [];
1819
+ let item = this;
1820
+ while (item && item !== base) {
1821
+ result.push(item.scopeName);
1822
+ item = item.parent;
1823
+ }
1824
+ return item === base ? result.reverse() : void 0;
1825
+ }
1826
+ };
1827
+ var FontStyle = /* @__PURE__ */ ((FontStyle2) => {
1828
+ FontStyle2[FontStyle2["NotSet"] = -1] = "NotSet";
1829
+ FontStyle2[FontStyle2["None"] = 0] = "None";
1830
+ FontStyle2[FontStyle2["Italic"] = 1] = "Italic";
1831
+ FontStyle2[FontStyle2["Bold"] = 2] = "Bold";
1832
+ FontStyle2[FontStyle2["Underline"] = 4] = "Underline";
1833
+ FontStyle2[FontStyle2["Strikethrough"] = 8] = "Strikethrough";
1834
+ return FontStyle2;
1835
+ })(FontStyle || {});
1836
+ var emptyParentScopes = Object.freeze([]);
1837
+ var EncodedTokenMetadata = class _EncodedTokenMetadata {
1838
+ static toBinaryStr(encodedTokenAttributes) {
1839
+ return encodedTokenAttributes.toString(2).padStart(32, "0");
1840
+ }
1841
+ static print(encodedTokenAttributes) {
1842
+ const languageId = _EncodedTokenMetadata.getLanguageId(encodedTokenAttributes);
1843
+ const tokenType = _EncodedTokenMetadata.getTokenType(encodedTokenAttributes);
1844
+ const fontStyle = _EncodedTokenMetadata.getFontStyle(encodedTokenAttributes);
1845
+ const foreground = _EncodedTokenMetadata.getForeground(encodedTokenAttributes);
1846
+ const background = _EncodedTokenMetadata.getBackground(encodedTokenAttributes);
1847
+ console.log({
1848
+ languageId,
1849
+ tokenType,
1850
+ fontStyle,
1851
+ foreground,
1852
+ background
1853
+ });
1854
+ }
1855
+ static getLanguageId(encodedTokenAttributes) {
1856
+ return (encodedTokenAttributes & 255) >>> 0;
1857
+ }
1858
+ static getTokenType(encodedTokenAttributes) {
1859
+ return (encodedTokenAttributes & 768) >>> 8;
1860
+ }
1861
+ static containsBalancedBrackets(encodedTokenAttributes) {
1862
+ return (encodedTokenAttributes & 1024) !== 0;
1863
+ }
1864
+ static getFontStyle(encodedTokenAttributes) {
1865
+ return (encodedTokenAttributes & 30720) >>> 11;
1866
+ }
1867
+ static getForeground(encodedTokenAttributes) {
1868
+ return (encodedTokenAttributes & 16744448) >>> 15;
1869
+ }
1870
+ static getBackground(encodedTokenAttributes) {
1871
+ return (encodedTokenAttributes & 4278190080) >>> 24;
1872
+ }
1873
+ /**
1874
+ * Updates the fields in `metadata`.
1875
+ * A value of `0`, `NotSet` or `null` indicates that the corresponding field should be left as is.
1876
+ */
1877
+ static set(encodedTokenAttributes, languageId, tokenType, containsBalancedBrackets, fontStyle, foreground, background) {
1878
+ let _languageId = _EncodedTokenMetadata.getLanguageId(encodedTokenAttributes);
1879
+ let _tokenType = _EncodedTokenMetadata.getTokenType(encodedTokenAttributes);
1880
+ let _containsBalancedBracketsBit = _EncodedTokenMetadata.containsBalancedBrackets(encodedTokenAttributes) ? 1 : 0;
1881
+ let _fontStyle = _EncodedTokenMetadata.getFontStyle(encodedTokenAttributes);
1882
+ let _foreground = _EncodedTokenMetadata.getForeground(encodedTokenAttributes);
1883
+ let _background = _EncodedTokenMetadata.getBackground(encodedTokenAttributes);
1884
+ if (languageId !== 0) {
1885
+ _languageId = languageId;
1886
+ }
1887
+ if (tokenType !== 8) {
1888
+ _tokenType = fromOptionalTokenType(tokenType);
1889
+ }
1890
+ if (containsBalancedBrackets !== null) {
1891
+ _containsBalancedBracketsBit = containsBalancedBrackets ? 1 : 0;
1892
+ }
1893
+ if (fontStyle !== -1) {
1894
+ _fontStyle = fontStyle;
1895
+ }
1896
+ if (foreground !== 0) {
1897
+ _foreground = foreground;
1898
+ }
1899
+ if (background !== 0) {
1900
+ _background = background;
1901
+ }
1902
+ return (_languageId << 0 | _tokenType << 8 | _containsBalancedBracketsBit << 10 | _fontStyle << 11 | _foreground << 15 | _background << 24) >>> 0;
1903
+ }
1904
+ };
1905
+ function fromOptionalTokenType(standardType) {
1906
+ return standardType;
1907
+ }
1908
+ function ruleIdFromNumber(id) {
1909
+ return id;
1910
+ }
1911
+ function ruleIdToNumber(id) {
1912
+ return id;
1913
+ }
1914
+ var BasicScopeAttributes = class {
1915
+ constructor(languageId, tokenType) {
1916
+ this.languageId = languageId;
1917
+ this.tokenType = tokenType;
1918
+ }
1919
+ };
1920
+ var BasicScopeAttributesProvider = class _BasicScopeAttributesProvider {
1921
+ _defaultAttributes;
1922
+ _embeddedLanguagesMatcher;
1923
+ constructor(initialLanguageId, embeddedLanguages) {
1924
+ this._defaultAttributes = new BasicScopeAttributes(
1925
+ initialLanguageId,
1926
+ 8
1927
+ /* NotSet */
1928
+ );
1929
+ this._embeddedLanguagesMatcher = new ScopeMatcher(Object.entries(embeddedLanguages || {}));
1930
+ }
1931
+ getDefaultAttributes() {
1932
+ return this._defaultAttributes;
1933
+ }
1934
+ getBasicScopeAttributes(scopeName) {
1935
+ if (scopeName === null) {
1936
+ return _BasicScopeAttributesProvider._NULL_SCOPE_METADATA;
1937
+ }
1938
+ return this._getBasicScopeAttributes.get(scopeName);
1939
+ }
1940
+ static _NULL_SCOPE_METADATA = new BasicScopeAttributes(0, 0);
1941
+ _getBasicScopeAttributes = new CachedFn((scopeName) => {
1942
+ const languageId = this._scopeToLanguage(scopeName);
1943
+ const standardTokenType = this._toStandardTokenType(scopeName);
1944
+ return new BasicScopeAttributes(languageId, standardTokenType);
1945
+ });
1946
+ /**
1947
+ * Given a produced TM scope, return the language that token describes or null if unknown.
1948
+ * e.g. source.html => html, source.css.embedded.html => css, punctuation.definition.tag.html => null
1949
+ */
1950
+ _scopeToLanguage(scope) {
1951
+ return this._embeddedLanguagesMatcher.match(scope) || 0;
1952
+ }
1953
+ _toStandardTokenType(scopeName) {
1954
+ const m = scopeName.match(_BasicScopeAttributesProvider.STANDARD_TOKEN_TYPE_REGEXP);
1955
+ if (!m) {
1956
+ return 8;
1957
+ }
1958
+ switch (m[1]) {
1959
+ case "comment":
1960
+ return 1;
1961
+ case "string":
1962
+ return 2;
1963
+ case "regex":
1964
+ return 3;
1965
+ case "meta.embedded":
1966
+ return 0;
1967
+ }
1968
+ throw new Error("Unexpected match for standard token type!");
1969
+ }
1970
+ static STANDARD_TOKEN_TYPE_REGEXP = /\b(comment|string|regex|meta\.embedded)\b/;
1971
+ };
1972
+ var ScopeMatcher = class {
1973
+ values;
1974
+ scopesRegExp;
1975
+ constructor(values) {
1976
+ if (values.length === 0) {
1977
+ this.values = null;
1978
+ this.scopesRegExp = null;
1979
+ } else {
1980
+ this.values = new Map(values);
1981
+ const escapedScopes = values.map(
1982
+ ([scopeName, value]) => escapeRegExpCharacters(scopeName)
1983
+ );
1984
+ escapedScopes.sort();
1985
+ escapedScopes.reverse();
1986
+ this.scopesRegExp = new RegExp(
1987
+ `^((${escapedScopes.join(")|(")}))($|\\.)`,
1988
+ ""
1989
+ );
1990
+ }
1991
+ }
1992
+ match(scope) {
1993
+ if (!this.scopesRegExp) {
1994
+ return void 0;
1995
+ }
1996
+ const m = scope.match(this.scopesRegExp);
1997
+ if (!m) {
1998
+ return void 0;
1999
+ }
2000
+ return this.values.get(m[1]);
2001
+ }
2002
+ };
2003
+ var DebugFlags = {
2004
+ InDebugMode: typeof process !== "undefined" && !!process.env["VSCODE_TEXTMATE_DEBUG"]
2005
+ };
2006
+ var AttributedScopeStack = class _AttributedScopeStack {
2007
+ /**
2008
+ * Invariant:
2009
+ * ```
2010
+ * if (parent && !scopePath.extends(parent.scopePath)) {
2011
+ * throw new Error();
2012
+ * }
2013
+ * ```
2014
+ */
2015
+ constructor(parent, scopePath, tokenAttributes) {
2016
+ this.parent = parent;
2017
+ this.scopePath = scopePath;
2018
+ this.tokenAttributes = tokenAttributes;
2019
+ }
2020
+ static fromExtension(namesScopeList, contentNameScopesList) {
2021
+ let current = namesScopeList;
2022
+ let scopeNames = namesScopeList?.scopePath ?? null;
2023
+ for (const frame of contentNameScopesList) {
2024
+ scopeNames = ScopeStack.push(scopeNames, frame.scopeNames);
2025
+ current = new _AttributedScopeStack(current, scopeNames, frame.encodedTokenAttributes);
2026
+ }
2027
+ return current;
2028
+ }
2029
+ static createRoot(scopeName, tokenAttributes) {
2030
+ return new _AttributedScopeStack(null, new ScopeStack(null, scopeName), tokenAttributes);
2031
+ }
2032
+ static createRootAndLookUpScopeName(scopeName, tokenAttributes, grammar) {
2033
+ const rawRootMetadata = grammar.getMetadataForScope(scopeName);
2034
+ const scopePath = new ScopeStack(null, scopeName);
2035
+ const rootStyle = grammar.themeProvider.themeMatch(scopePath);
2036
+ const resolvedTokenAttributes = _AttributedScopeStack.mergeAttributes(
2037
+ tokenAttributes,
2038
+ rawRootMetadata,
2039
+ rootStyle
2040
+ );
2041
+ return new _AttributedScopeStack(null, scopePath, resolvedTokenAttributes);
2042
+ }
2043
+ get scopeName() {
2044
+ return this.scopePath.scopeName;
2045
+ }
2046
+ toString() {
2047
+ return this.getScopeNames().join(" ");
2048
+ }
2049
+ equals(other) {
2050
+ return _AttributedScopeStack.equals(this, other);
2051
+ }
2052
+ static equals(a, b) {
2053
+ do {
2054
+ if (a === b) {
2055
+ return true;
2056
+ }
2057
+ if (!a && !b) {
2058
+ return true;
2059
+ }
2060
+ if (!a || !b) {
2061
+ return false;
2062
+ }
2063
+ if (a.scopeName !== b.scopeName || a.tokenAttributes !== b.tokenAttributes) {
2064
+ return false;
2065
+ }
2066
+ a = a.parent;
2067
+ b = b.parent;
2068
+ } while (true);
2069
+ }
2070
+ static mergeAttributes(existingTokenAttributes, basicScopeAttributes, styleAttributes) {
2071
+ let fontStyle = -1;
2072
+ let foreground = 0;
2073
+ let background = 0;
2074
+ if (styleAttributes !== null) {
2075
+ fontStyle = styleAttributes.fontStyle;
2076
+ foreground = styleAttributes.foregroundId;
2077
+ background = styleAttributes.backgroundId;
2078
+ }
2079
+ return EncodedTokenMetadata.set(
2080
+ existingTokenAttributes,
2081
+ basicScopeAttributes.languageId,
2082
+ basicScopeAttributes.tokenType,
2083
+ null,
2084
+ fontStyle,
2085
+ foreground,
2086
+ background
2087
+ );
2088
+ }
2089
+ pushAttributed(scopePath, grammar) {
2090
+ if (scopePath === null) {
2091
+ return this;
2092
+ }
2093
+ if (scopePath.indexOf(" ") === -1) {
2094
+ return _AttributedScopeStack._pushAttributed(this, scopePath, grammar);
2095
+ }
2096
+ const scopes = scopePath.split(/ /g);
2097
+ let result = this;
2098
+ for (const scope of scopes) {
2099
+ result = _AttributedScopeStack._pushAttributed(result, scope, grammar);
2100
+ }
2101
+ return result;
2102
+ }
2103
+ static _pushAttributed(target, scopeName, grammar) {
2104
+ const rawMetadata = grammar.getMetadataForScope(scopeName);
2105
+ const newPath = target.scopePath.push(scopeName);
2106
+ const scopeThemeMatchResult = grammar.themeProvider.themeMatch(newPath);
2107
+ const metadata = _AttributedScopeStack.mergeAttributes(
2108
+ target.tokenAttributes,
2109
+ rawMetadata,
2110
+ scopeThemeMatchResult
2111
+ );
2112
+ return new _AttributedScopeStack(target, newPath, metadata);
2113
+ }
2114
+ getScopeNames() {
2115
+ return this.scopePath.getSegments();
2116
+ }
2117
+ getExtensionIfDefined(base) {
2118
+ const result = [];
2119
+ let self = this;
2120
+ while (self && self !== base) {
2121
+ result.push({
2122
+ encodedTokenAttributes: self.tokenAttributes,
2123
+ scopeNames: self.scopePath.getExtensionIfDefined(self.parent?.scopePath ?? null)
2124
+ });
2125
+ self = self.parent;
2126
+ }
2127
+ return self === base ? result.reverse() : void 0;
2128
+ }
2129
+ };
2130
+ var StateStackImpl = class _StateStackImpl {
2131
+ /**
2132
+ * Invariant:
2133
+ * ```
2134
+ * if (contentNameScopesList !== nameScopesList && contentNameScopesList?.parent !== nameScopesList) {
2135
+ * throw new Error();
2136
+ * }
2137
+ * if (this.parent && !nameScopesList.extends(this.parent.contentNameScopesList)) {
2138
+ * throw new Error();
2139
+ * }
2140
+ * ```
2141
+ */
2142
+ constructor(parent, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {
2143
+ this.parent = parent;
2144
+ this.ruleId = ruleId;
2145
+ this.beginRuleCapturedEOL = beginRuleCapturedEOL;
2146
+ this.endRule = endRule;
2147
+ this.nameScopesList = nameScopesList;
2148
+ this.contentNameScopesList = contentNameScopesList;
2149
+ this.depth = this.parent ? this.parent.depth + 1 : 1;
2150
+ this._enterPos = enterPos;
2151
+ this._anchorPos = anchorPos;
2152
+ }
2153
+ _stackElementBrand = void 0;
2154
+ // TODO remove me
2155
+ static NULL = new _StateStackImpl(
2156
+ null,
2157
+ 0,
2158
+ 0,
2159
+ 0,
2160
+ false,
2161
+ null,
2162
+ null,
2163
+ null
2164
+ );
2165
+ /**
2166
+ * The position on the current line where this state was pushed.
2167
+ * This is relevant only while tokenizing a line, to detect endless loops.
2168
+ * Its value is meaningless across lines.
2169
+ */
2170
+ _enterPos;
2171
+ /**
2172
+ * The captured anchor position when this stack element was pushed.
2173
+ * This is relevant only while tokenizing a line, to restore the anchor position when popping.
2174
+ * Its value is meaningless across lines.
2175
+ */
2176
+ _anchorPos;
2177
+ /**
2178
+ * The depth of the stack.
2179
+ */
2180
+ depth;
2181
+ equals(other) {
2182
+ if (other === null) {
2183
+ return false;
2184
+ }
2185
+ return _StateStackImpl._equals(this, other);
2186
+ }
2187
+ static _equals(a, b) {
2188
+ if (a === b) {
2189
+ return true;
2190
+ }
2191
+ if (!this._structuralEquals(a, b)) {
2192
+ return false;
2193
+ }
2194
+ return AttributedScopeStack.equals(a.contentNameScopesList, b.contentNameScopesList);
2195
+ }
2196
+ /**
2197
+ * A structural equals check. Does not take into account `scopes`.
2198
+ */
2199
+ static _structuralEquals(a, b) {
2200
+ do {
2201
+ if (a === b) {
2202
+ return true;
2203
+ }
2204
+ if (!a && !b) {
2205
+ return true;
2206
+ }
2207
+ if (!a || !b) {
2208
+ return false;
2209
+ }
2210
+ if (a.depth !== b.depth || a.ruleId !== b.ruleId || a.endRule !== b.endRule) {
2211
+ return false;
2212
+ }
2213
+ a = a.parent;
2214
+ b = b.parent;
2215
+ } while (true);
2216
+ }
2217
+ clone() {
2218
+ return this;
2219
+ }
2220
+ static _reset(el) {
2221
+ while (el) {
2222
+ el._enterPos = -1;
2223
+ el._anchorPos = -1;
2224
+ el = el.parent;
2225
+ }
2226
+ }
2227
+ reset() {
2228
+ _StateStackImpl._reset(this);
2229
+ }
2230
+ pop() {
2231
+ return this.parent;
2232
+ }
2233
+ safePop() {
2234
+ if (this.parent) {
2235
+ return this.parent;
2236
+ }
2237
+ return this;
2238
+ }
2239
+ push(ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {
2240
+ return new _StateStackImpl(
2241
+ this,
2242
+ ruleId,
2243
+ enterPos,
2244
+ anchorPos,
2245
+ beginRuleCapturedEOL,
2246
+ endRule,
2247
+ nameScopesList,
2248
+ contentNameScopesList
2249
+ );
2250
+ }
2251
+ getEnterPos() {
2252
+ return this._enterPos;
2253
+ }
2254
+ getAnchorPos() {
2255
+ return this._anchorPos;
2256
+ }
2257
+ getRule(grammar) {
2258
+ return grammar.getRule(this.ruleId);
2259
+ }
2260
+ toString() {
2261
+ const r = [];
2262
+ this._writeString(r, 0);
2263
+ return "[" + r.join(",") + "]";
2264
+ }
2265
+ _writeString(res, outIndex) {
2266
+ if (this.parent) {
2267
+ outIndex = this.parent._writeString(res, outIndex);
2268
+ }
2269
+ res[outIndex++] = `(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`;
2270
+ return outIndex;
2271
+ }
2272
+ withContentNameScopesList(contentNameScopeStack) {
2273
+ if (this.contentNameScopesList === contentNameScopeStack) {
2274
+ return this;
2275
+ }
2276
+ return this.parent.push(
2277
+ this.ruleId,
2278
+ this._enterPos,
2279
+ this._anchorPos,
2280
+ this.beginRuleCapturedEOL,
2281
+ this.endRule,
2282
+ this.nameScopesList,
2283
+ contentNameScopeStack
2284
+ );
2285
+ }
2286
+ withEndRule(endRule) {
2287
+ if (this.endRule === endRule) {
2288
+ return this;
2289
+ }
2290
+ return new _StateStackImpl(
2291
+ this.parent,
2292
+ this.ruleId,
2293
+ this._enterPos,
2294
+ this._anchorPos,
2295
+ this.beginRuleCapturedEOL,
2296
+ endRule,
2297
+ this.nameScopesList,
2298
+ this.contentNameScopesList
2299
+ );
2300
+ }
2301
+ // Used to warn of endless loops
2302
+ hasSameRuleAs(other) {
2303
+ let el = this;
2304
+ while (el && el._enterPos === other._enterPos) {
2305
+ if (el.ruleId === other.ruleId) {
2306
+ return true;
2307
+ }
2308
+ el = el.parent;
2309
+ }
2310
+ return false;
2311
+ }
2312
+ toStateStackFrame() {
2313
+ return {
2314
+ ruleId: ruleIdToNumber(this.ruleId),
2315
+ beginRuleCapturedEOL: this.beginRuleCapturedEOL,
2316
+ endRule: this.endRule,
2317
+ nameScopesList: this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList ?? null) ?? [],
2318
+ contentNameScopesList: this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList) ?? []
2319
+ };
2320
+ }
2321
+ static pushFrame(self, frame) {
2322
+ const namesScopeList = AttributedScopeStack.fromExtension(self?.nameScopesList ?? null, frame.nameScopesList);
2323
+ return new _StateStackImpl(
2324
+ self,
2325
+ ruleIdFromNumber(frame.ruleId),
2326
+ frame.enterPos ?? -1,
2327
+ frame.anchorPos ?? -1,
2328
+ frame.beginRuleCapturedEOL,
2329
+ frame.endRule,
2330
+ namesScopeList,
2331
+ AttributedScopeStack.fromExtension(namesScopeList, frame.contentNameScopesList)
2332
+ );
2333
+ }
2334
+ };
2335
+ var INITIAL = StateStackImpl.NULL;
2336
+
2337
+ // ../../node_modules/.pnpm/@shikijs+core@3.21.0/node_modules/@shikijs/core/dist/index.mjs
2338
+ function getTokenStyleObject(token) {
2339
+ const styles = {};
2340
+ if (token.color)
2341
+ styles.color = token.color;
2342
+ if (token.bgColor)
2343
+ styles["background-color"] = token.bgColor;
2344
+ if (token.fontStyle) {
2345
+ if (token.fontStyle & FontStyle.Italic)
2346
+ styles["font-style"] = "italic";
2347
+ if (token.fontStyle & FontStyle.Bold)
2348
+ styles["font-weight"] = "bold";
2349
+ const decorations = [];
2350
+ if (token.fontStyle & FontStyle.Underline)
2351
+ decorations.push("underline");
2352
+ if (token.fontStyle & FontStyle.Strikethrough)
2353
+ decorations.push("line-through");
2354
+ if (decorations.length)
2355
+ styles["text-decoration"] = decorations.join(" ");
2356
+ }
2357
+ return styles;
2358
+ }
2359
+
2360
+ // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/CachedCodeRenderer.vue?type=script
2361
+ import { objectId } from "@antfu/utils";
2362
+ var CachedCodeRenderer_default = /* @__PURE__ */ _defineComponent8({
2363
+ __name: "CachedCodeRenderer",
2364
+ props: {
2365
+ code: { type: String, required: true },
2366
+ lang: { type: String, required: true },
2367
+ theme: { type: String, required: true },
2368
+ highlighter: { type: null, required: true }
2369
+ },
2370
+ emits: ["stream-start", "stream-end", "stream-error"],
2371
+ setup(__props, { expose: __expose, emit: __emit }) {
2372
+ __expose();
2373
+ const props = __props;
2374
+ const emit = __emit;
2375
+ const hasStreamError = ref8(false);
2376
+ const index = ref8(0);
2377
+ let controller = null;
2378
+ const textStream = new ReadableStream({
2379
+ start(_controller) {
2380
+ controller = _controller;
2381
+ }
2382
+ });
2383
+ watch6(() => props.code, (newCode) => {
2384
+ if (newCode.length > index.value && !hasStreamError.value) {
2385
+ const incremental = newCode.slice(index.value);
2386
+ controller?.enqueue(incremental);
2387
+ index.value = newCode.length;
2388
+ }
2389
+ }, { immediate: true });
2390
+ let tokenStream = null;
2391
+ try {
2392
+ tokenStream = textStream.pipeThrough(
2393
+ new CodeToTokenTransformStream({
2394
+ highlighter: props.highlighter,
2395
+ lang: props.lang,
2396
+ theme: props.theme,
2397
+ allowRecalls: true
2398
+ })
2399
+ );
2400
+ } catch (error) {
2401
+ console.error("Failed to create token stream:", error);
2402
+ hasStreamError.value = true;
2403
+ emit("stream-error");
2404
+ }
2405
+ const tokens = reactive([]);
2406
+ if (tokenStream) {
2407
+ let tokenCount = 0;
2408
+ tokenStream.pipeTo(new WritableStream({
2409
+ write(token) {
2410
+ const start = performance.now();
2411
+ if ("recall" in token)
2412
+ tokens.splice(tokens.length - token.recall, token.recall);
2413
+ else
2414
+ tokens.push(token);
2415
+ const elapsed = performance.now() - start;
2416
+ tokenCount++;
2417
+ if (elapsed > 1) {
2418
+ console.log(`[Vue CodeRenderer] Token #${tokenCount} update took ${elapsed.toFixed(2)}ms, total tokens: ${tokens.length}`);
2419
+ }
2420
+ },
2421
+ close: () => {
2422
+ console.log(`[Vue CodeRenderer] Stream completed, total tokens: ${tokenCount}`);
2423
+ emit("stream-end");
2424
+ }
2425
+ })).catch((error) => {
2426
+ console.error("Stream error:", error);
2427
+ hasStreamError.value = true;
2428
+ emit("stream-error");
2429
+ });
2430
+ }
2431
+ const render24 = () => {
2432
+ if (hasStreamError.value) {
2433
+ return h("pre", { class: "shiki incremark-code-stream" }, h("code", props.code));
2434
+ }
2435
+ return h(
2436
+ "pre",
2437
+ { class: "shiki incremark-code-stream" },
2438
+ h(
2439
+ "code",
2440
+ renderList(tokens, (token) => h("span", { key: objectId(token), style: token.htmlStyle || getTokenStyleObject(token) }, token.content))
2441
+ )
2442
+ );
2443
+ };
2444
+ onUnmounted6(() => {
2445
+ hasStreamError.value = false;
2446
+ tokens.length = 0;
2447
+ index.value = 0;
2448
+ });
2449
+ const __returned__ = { props, emit, hasStreamError, index, get controller() {
2450
+ return controller;
2451
+ }, set controller(v) {
2452
+ controller = v;
2453
+ }, textStream, get tokenStream() {
2454
+ return tokenStream;
2455
+ }, set tokenStream(v) {
2456
+ tokenStream = v;
2457
+ }, tokens, render: render24 };
2458
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
2459
+ return __returned__;
2460
+ }
2461
+ });
2462
+
2463
+ // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/CachedCodeRenderer.vue?type=template
2464
+ import { resolveDynamicComponent as _resolveDynamicComponent3, openBlock as _openBlock8, createBlock as _createBlock3 } from "vue";
2465
+ function render8(_ctx, _cache, $props, $setup, $data, $options) {
2466
+ return _openBlock8(), _createBlock3(_resolveDynamicComponent3($setup.render));
2467
+ }
2468
+
2469
+ // src/components/CachedCodeRenderer.vue
2470
+ CachedCodeRenderer_default.render = render8;
2471
+ CachedCodeRenderer_default.__file = "src/components/CachedCodeRenderer.vue";
2472
+ var CachedCodeRenderer_default2 = CachedCodeRenderer_default;
2473
+
1703
2474
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeDefault.vue?type=script
1704
- var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent8({
2475
+ var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent9({
1705
2476
  __name: "IncremarkCodeDefault",
1706
2477
  props: {
1707
2478
  node: { type: null, required: true },
1708
2479
  theme: { type: String, required: false, default: "github-dark" },
1709
2480
  fallbackTheme: { type: String, required: false, default: "github-dark" },
1710
- disableHighlight: { type: Boolean, required: false, default: false }
2481
+ disableHighlight: { type: Boolean, required: false, default: false },
2482
+ blockStatus: { type: String, required: false, default: "pending" }
1711
2483
  },
1712
2484
  setup(__props, { expose: __expose }) {
1713
2485
  __expose();
1714
2486
  const props = __props;
1715
- const copied = ref7(false);
1716
- const highlightedHtml = ref7("");
2487
+ const copied = ref9(false);
1717
2488
  const language = computed9(() => props.node.lang || "text");
1718
2489
  const code = computed9(() => props.node.value);
1719
2490
  const { t } = useLocale();
1720
- const { isHighlighting, highlight } = useShiki(props.theme);
1721
- async function doHighlight() {
1722
- if (!code.value || props.disableHighlight) {
1723
- highlightedHtml.value = "";
2491
+ const { highlighterInfo, initHighlighter } = useShiki(props.theme);
2492
+ const isLanguageLoaded = ref9(false);
2493
+ const shouldEnableHighlight = computed9(() => {
2494
+ return !props.disableHighlight && code.value && code.value.length > 0;
2495
+ });
2496
+ watch7([highlighterInfo, language, shouldEnableHighlight], async ([info, lang, shouldHighlight]) => {
2497
+ if (!shouldHighlight) {
1724
2498
  return;
1725
2499
  }
1726
- try {
1727
- const html = await highlight(code.value, language.value, props.fallbackTheme);
1728
- highlightedHtml.value = html;
1729
- } catch (e) {
1730
- highlightedHtml.value = "";
2500
+ if (!info) {
2501
+ await initHighlighter();
2502
+ } else if (lang && lang !== "text") {
2503
+ if (!info.loadedLanguages.has(lang)) {
2504
+ try {
2505
+ isLanguageLoaded.value = false;
2506
+ const supportedLangs = info.highlighter.getLoadedLanguages();
2507
+ const bundledLangs = await import("shiki").then((m) => Object.keys(m.bundledLanguages || {}));
2508
+ const isSupported = supportedLangs.includes(lang) || bundledLangs.includes(lang);
2509
+ if (isSupported) {
2510
+ await info.highlighter.loadLanguage(lang);
2511
+ info.loadedLanguages.add(lang);
2512
+ }
2513
+ isLanguageLoaded.value = true;
2514
+ } catch {
2515
+ isLanguageLoaded.value = true;
2516
+ }
2517
+ } else {
2518
+ isLanguageLoaded.value = true;
2519
+ }
2520
+ } else {
2521
+ isLanguageLoaded.value = true;
1731
2522
  }
1732
- }
1733
- watch6([code, () => props.theme], doHighlight, { immediate: true });
2523
+ }, { immediate: true, deep: true });
1734
2524
  let copyTimeoutId = null;
1735
2525
  async function copyCode() {
1736
2526
  if (!isClipboardAvailable2()) return;
@@ -1746,12 +2536,7 @@ var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent8({
1746
2536
  } catch {
1747
2537
  }
1748
2538
  }
1749
- onUnmounted6(() => {
1750
- if (copyTimeoutId) {
1751
- clearTimeout(copyTimeoutId);
1752
- }
1753
- });
1754
- const __returned__ = { props, copied, highlightedHtml, language, code, t, isHighlighting, highlight, doHighlight, get copyTimeoutId() {
2539
+ const __returned__ = { props, copied, language, code, t, highlighterInfo, initHighlighter, isLanguageLoaded, shouldEnableHighlight, get copyTimeoutId() {
1755
2540
  return copyTimeoutId;
1756
2541
  }, set copyTimeoutId(v) {
1757
2542
  copyTimeoutId = v;
@@ -1759,27 +2544,23 @@ var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent8({
1759
2544
  return LucideCopy2;
1760
2545
  }, get LucideCopyCheck() {
1761
2546
  return LucideCopyCheck2;
1762
- }, SvgIcon: SvgIcon_default2 };
2547
+ }, SvgIcon: SvgIcon_default2, CachedCodeRenderer: CachedCodeRenderer_default2 };
1763
2548
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1764
2549
  return __returned__;
1765
2550
  }
1766
2551
  });
1767
2552
 
1768
2553
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeDefault.vue?type=template
1769
- import { toDisplayString as _toDisplayString5, createElementVNode as _createElementVNode5, createVNode as _createVNode6, createCommentVNode as _createCommentVNode5, openBlock as _openBlock8, createElementBlock as _createElementBlock7, Fragment as _Fragment5 } from "vue";
2554
+ import { toDisplayString as _toDisplayString5, createElementVNode as _createElementVNode5, createVNode as _createVNode6, createCommentVNode as _createCommentVNode5, openBlock as _openBlock9, createBlock as _createBlock4, Fragment as _Fragment5, createElementBlock as _createElementBlock7 } from "vue";
1770
2555
  var _hoisted_17 = { class: "incremark-code" };
1771
2556
  var _hoisted_24 = { class: "code-header" };
1772
2557
  var _hoisted_34 = { class: "language" };
1773
2558
  var _hoisted_44 = ["aria-label", "title"];
1774
2559
  var _hoisted_54 = { class: "code-content" };
1775
- var _hoisted_64 = {
1776
- key: 0,
1777
- class: "code-loading"
1778
- };
1779
- var _hoisted_73 = ["innerHTML"];
1780
- var _hoisted_83 = { class: "code-fallback" };
1781
- function render8(_ctx, _cache, $props, $setup, $data, $options) {
1782
- return _openBlock8(), _createElementBlock7("div", _hoisted_17, [
2560
+ var _hoisted_64 = { class: "shiki-wrapper" };
2561
+ var _hoisted_73 = { class: "code-fallback" };
2562
+ function render9(_ctx, _cache, $props, $setup, $data, $options) {
2563
+ return _openBlock9(), _createElementBlock7("div", _hoisted_17, [
1783
2564
  _createElementVNode5("div", _hoisted_24, [
1784
2565
  _createElementVNode5(
1785
2566
  "span",
@@ -1801,58 +2582,44 @@ function render8(_ctx, _cache, $props, $setup, $data, $options) {
1801
2582
  ], 8, _hoisted_44)
1802
2583
  ]),
1803
2584
  _createElementVNode5("div", _hoisted_54, [
1804
- _createCommentVNode5(" \u6B63\u5728\u52A0\u8F7D\u9AD8\u4EAE "),
1805
- $setup.isHighlighting && !$setup.highlightedHtml ? (_openBlock8(), _createElementBlock7("div", _hoisted_64, [
1806
- _createElementVNode5("pre", null, [
1807
- _createElementVNode5(
1808
- "code",
1809
- null,
1810
- _toDisplayString5($setup.code),
1811
- 1
1812
- /* TEXT */
1813
- )
1814
- ])
1815
- ])) : $setup.highlightedHtml ? (_openBlock8(), _createElementBlock7(
1816
- _Fragment5,
1817
- { key: 1 },
1818
- [
1819
- _createCommentVNode5(" \u9AD8\u4EAE\u540E\u7684\u4EE3\u7801 "),
1820
- _createElementVNode5("div", {
1821
- innerHTML: $setup.highlightedHtml,
1822
- class: "shiki-wrapper"
1823
- }, null, 8, _hoisted_73)
1824
- ],
1825
- 2112
1826
- /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
1827
- )) : (_openBlock8(), _createElementBlock7(
1828
- _Fragment5,
1829
- { key: 2 },
1830
- [
1831
- _createCommentVNode5(" \u56DE\u9000\uFF1A\u65E0\u9AD8\u4EAE "),
1832
- _createElementVNode5("pre", _hoisted_83, [
1833
- _createElementVNode5(
1834
- "code",
1835
- null,
1836
- _toDisplayString5($setup.code),
1837
- 1
1838
- /* TEXT */
1839
- )
1840
- ])
1841
- ],
1842
- 2112
1843
- /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
1844
- ))
2585
+ _createElementVNode5("div", _hoisted_64, [
2586
+ _createCommentVNode5(" Stream \u9AD8\u4EAE\uFF08\u53EA\u6709\u5F53\u5B58\u5728\u4EE3\u7801\u5185\u5BB9\u4E14\u8BED\u8A00\u52A0\u8F7D\u5B8C\u6210\u540E\u624D\u6E32\u67D3\uFF09 "),
2587
+ $setup.shouldEnableHighlight && $setup.highlighterInfo && $setup.isLanguageLoaded ? (_openBlock9(), _createBlock4($setup["CachedCodeRenderer"], {
2588
+ key: 0,
2589
+ code: $setup.code,
2590
+ lang: $setup.language,
2591
+ theme: $props.theme,
2592
+ highlighter: $setup.highlighterInfo.highlighter
2593
+ }, null, 8, ["code", "lang", "theme", "highlighter"])) : (_openBlock9(), _createElementBlock7(
2594
+ _Fragment5,
2595
+ { key: 1 },
2596
+ [
2597
+ _createCommentVNode5(" \u65E0\u9AD8\u4EAE\u6A21\u5F0F\uFF08\u7981\u7528\u9AD8\u4EAE\u3001\u65E0\u4EE3\u7801\u5185\u5BB9\u3001\u6216\u8BED\u8A00\u672A\u52A0\u8F7D\u5B8C\u6210\u65F6\u663E\u793A\uFF09 "),
2598
+ _createElementVNode5("pre", _hoisted_73, [
2599
+ _createElementVNode5(
2600
+ "code",
2601
+ null,
2602
+ _toDisplayString5($setup.code),
2603
+ 1
2604
+ /* TEXT */
2605
+ )
2606
+ ])
2607
+ ],
2608
+ 2112
2609
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
2610
+ ))
2611
+ ])
1845
2612
  ])
1846
2613
  ]);
1847
2614
  }
1848
2615
 
1849
2616
  // src/components/IncremarkCodeDefault.vue
1850
- IncremarkCodeDefault_default.render = render8;
2617
+ IncremarkCodeDefault_default.render = render9;
1851
2618
  IncremarkCodeDefault_default.__file = "src/components/IncremarkCodeDefault.vue";
1852
2619
  var IncremarkCodeDefault_default2 = IncremarkCodeDefault_default;
1853
2620
 
1854
2621
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=script
1855
- var IncremarkCode_default = /* @__PURE__ */ _defineComponent9({
2622
+ var IncremarkCode_default = /* @__PURE__ */ _defineComponent10({
1856
2623
  __name: "IncremarkCode",
1857
2624
  props: {
1858
2625
  node: { type: null, required: true },
@@ -1889,20 +2656,20 @@ var IncremarkCode_default = /* @__PURE__ */ _defineComponent9({
1889
2656
  });
1890
2657
 
1891
2658
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=template
1892
- import { createCommentVNode as _createCommentVNode6, resolveDynamicComponent as _resolveDynamicComponent3, openBlock as _openBlock9, createBlock as _createBlock3, createVNode as _createVNode7, Fragment as _Fragment6, createElementBlock as _createElementBlock8 } from "vue";
1893
- function render9(_ctx, _cache, $props, $setup, $data, $options) {
1894
- return _openBlock9(), _createElementBlock8(
2659
+ import { createCommentVNode as _createCommentVNode6, resolveDynamicComponent as _resolveDynamicComponent4, openBlock as _openBlock10, createBlock as _createBlock5, createVNode as _createVNode7, Fragment as _Fragment6, createElementBlock as _createElementBlock8 } from "vue";
2660
+ function render10(_ctx, _cache, $props, $setup, $data, $options) {
2661
+ return _openBlock10(), _createElementBlock8(
1895
2662
  _Fragment6,
1896
2663
  null,
1897
2664
  [
1898
2665
  _createCommentVNode6(" \u81EA\u5B9A\u4E49\u4EE3\u7801\u5757\u7EC4\u4EF6 "),
1899
- $setup.CustomCodeBlock ? (_openBlock9(), _createBlock3(_resolveDynamicComponent3($setup.CustomCodeBlock), {
2666
+ $setup.CustomCodeBlock ? (_openBlock10(), _createBlock5(_resolveDynamicComponent4($setup.CustomCodeBlock), {
1900
2667
  key: 0,
1901
2668
  "code-str": $props.node.value,
1902
2669
  lang: $setup.language,
1903
2670
  completed: $props.blockStatus === "completed",
1904
2671
  takeOver: $props.codeBlockConfigs?.[$setup.language]?.takeOver
1905
- }, null, 8, ["code-str", "lang", "completed", "takeOver"])) : $setup.isMermaid ? (_openBlock9(), _createElementBlock8(
2672
+ }, null, 8, ["code-str", "lang", "completed", "takeOver"])) : $setup.isMermaid ? (_openBlock10(), _createElementBlock8(
1906
2673
  _Fragment6,
1907
2674
  { key: 1 },
1908
2675
  [
@@ -1914,17 +2681,18 @@ function render9(_ctx, _cache, $props, $setup, $data, $options) {
1914
2681
  ],
1915
2682
  2112
1916
2683
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
1917
- )) : (_openBlock9(), _createElementBlock8(
2684
+ )) : (_openBlock10(), _createElementBlock8(
1918
2685
  _Fragment6,
1919
2686
  { key: 2 },
1920
2687
  [
1921
- _createCommentVNode6(" \u9ED8\u8BA4\u4EE3\u7801\u5757\u6E32\u67D3\uFF08\u652F\u6301\u7528\u6237\u81EA\u5B9A\u4E49\uFF09 "),
1922
- (_openBlock9(), _createBlock3(_resolveDynamicComponent3($props.defaultCodeComponent), {
2688
+ _createCommentVNode6(" \u9ED8\u8BA4\u4EE3\u7801\u5757\u6E32\u67D3\uFF08\u652F\u6301\u7528\u6237\u81EA\u5B9A\u4E49\uFF0C\u4F7F\u7528 stream \u9AD8\u4EAE\uFF09"),
2689
+ (_openBlock10(), _createBlock5(_resolveDynamicComponent4($props.defaultCodeComponent), {
1923
2690
  node: $props.node,
1924
2691
  theme: $props.theme,
1925
2692
  "fallback-theme": $props.fallbackTheme,
1926
- "disable-highlight": $props.disableHighlight
1927
- }, null, 8, ["node", "theme", "fallback-theme", "disable-highlight"]))
2693
+ "disable-highlight": $props.disableHighlight,
2694
+ "block-status": $props.blockStatus
2695
+ }, null, 8, ["node", "theme", "fallback-theme", "disable-highlight", "block-status"]))
1928
2696
  ],
1929
2697
  2112
1930
2698
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
@@ -1936,14 +2704,14 @@ function render9(_ctx, _cache, $props, $setup, $data, $options) {
1936
2704
  }
1937
2705
 
1938
2706
  // src/components/IncremarkCode.vue
1939
- IncremarkCode_default.render = render9;
2707
+ IncremarkCode_default.render = render10;
1940
2708
  IncremarkCode_default.__file = "src/components/IncremarkCode.vue";
1941
2709
  var IncremarkCode_default2 = IncremarkCode_default;
1942
2710
 
1943
2711
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkList.vue?type=script
1944
- import { defineComponent as _defineComponent10 } from "vue";
2712
+ import { defineComponent as _defineComponent11 } from "vue";
1945
2713
  import { computed as computed11 } from "vue";
1946
- var IncremarkList_default = /* @__PURE__ */ _defineComponent10({
2714
+ var IncremarkList_default = /* @__PURE__ */ _defineComponent11({
1947
2715
  ...{
1948
2716
  name: "IncremarkList"
1949
2717
  },
@@ -1980,31 +2748,31 @@ var IncremarkList_default = /* @__PURE__ */ _defineComponent10({
1980
2748
  });
1981
2749
 
1982
2750
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkList.vue?type=template
1983
- import { renderList as _renderList3, Fragment as _Fragment7, openBlock as _openBlock10, createElementBlock as _createElementBlock9, createElementVNode as _createElementVNode6, createVNode as _createVNode8, createCommentVNode as _createCommentVNode7, createBlock as _createBlock4, normalizeClass as _normalizeClass3, resolveDynamicComponent as _resolveDynamicComponent4, withCtx as _withCtx3 } from "vue";
2751
+ import { renderList as _renderList3, Fragment as _Fragment7, openBlock as _openBlock11, createElementBlock as _createElementBlock9, createElementVNode as _createElementVNode6, createVNode as _createVNode8, createCommentVNode as _createCommentVNode7, createBlock as _createBlock6, normalizeClass as _normalizeClass3, resolveDynamicComponent as _resolveDynamicComponent5, withCtx as _withCtx3 } from "vue";
1984
2752
  var _hoisted_18 = {
1985
2753
  key: 0,
1986
2754
  class: "task-label"
1987
2755
  };
1988
2756
  var _hoisted_25 = ["checked"];
1989
2757
  var _hoisted_35 = { class: "task-content" };
1990
- function render10(_ctx, _cache, $props, $setup, $data, $options) {
1991
- return _openBlock10(), _createBlock4(_resolveDynamicComponent4($setup.tag), {
2758
+ function render11(_ctx, _cache, $props, $setup, $data, $options) {
2759
+ return _openBlock11(), _createBlock6(_resolveDynamicComponent5($setup.tag), {
1992
2760
  class: _normalizeClass3(["incremark-list", { "task-list": $props.node.children.some((item) => item.checked !== null && item.checked !== void 0) }]),
1993
2761
  start: $props.node.start || void 0
1994
2762
  }, {
1995
2763
  default: _withCtx3(() => [
1996
- (_openBlock10(true), _createElementBlock9(
2764
+ (_openBlock11(true), _createElementBlock9(
1997
2765
  _Fragment7,
1998
2766
  null,
1999
2767
  _renderList3($props.node.children, (item, index) => {
2000
- return _openBlock10(), _createElementBlock9(
2768
+ return _openBlock11(), _createElementBlock9(
2001
2769
  "li",
2002
2770
  {
2003
2771
  key: index,
2004
2772
  class: _normalizeClass3(["incremark-list-item", { "task-item": item.checked !== null && item.checked !== void 0 }])
2005
2773
  },
2006
2774
  [
2007
- item.checked !== null && item.checked !== void 0 ? (_openBlock10(), _createElementBlock9("label", _hoisted_18, [
2775
+ item.checked !== null && item.checked !== void 0 ? (_openBlock11(), _createElementBlock9("label", _hoisted_18, [
2008
2776
  _createElementVNode6("input", {
2009
2777
  type: "checkbox",
2010
2778
  checked: item.checked,
@@ -2016,7 +2784,7 @@ function render10(_ctx, _cache, $props, $setup, $data, $options) {
2016
2784
  nodes: $setup.getItemInlineContent(item)
2017
2785
  }, null, 8, ["nodes"])
2018
2786
  ])
2019
- ])) : (_openBlock10(), _createElementBlock9(
2787
+ ])) : (_openBlock11(), _createElementBlock9(
2020
2788
  _Fragment7,
2021
2789
  { key: 1 },
2022
2790
  [
@@ -2024,11 +2792,11 @@ function render10(_ctx, _cache, $props, $setup, $data, $options) {
2024
2792
  nodes: $setup.getItemInlineContent(item)
2025
2793
  }, null, 8, ["nodes"]),
2026
2794
  _createCommentVNode7(" \u9012\u5F52\u6E32\u67D3\u6240\u6709\u5757\u7EA7\u5185\u5BB9\uFF08\u5D4C\u5957\u5217\u8868\u3001heading\u3001blockquote\u3001code\u3001table \u7B49\uFF09 "),
2027
- $setup.hasBlockChildren(item) ? (_openBlock10(true), _createElementBlock9(
2795
+ $setup.hasBlockChildren(item) ? (_openBlock11(true), _createElementBlock9(
2028
2796
  _Fragment7,
2029
2797
  { key: 0 },
2030
2798
  _renderList3($setup.getItemBlockChildren(item), (child, childIndex) => {
2031
- return _openBlock10(), _createBlock4($setup["IncremarkRenderer"], {
2799
+ return _openBlock11(), _createBlock6($setup["IncremarkRenderer"], {
2032
2800
  key: childIndex,
2033
2801
  node: child
2034
2802
  }, null, 8, ["node"]);
@@ -2055,13 +2823,13 @@ function render10(_ctx, _cache, $props, $setup, $data, $options) {
2055
2823
  }
2056
2824
 
2057
2825
  // src/components/IncremarkList.vue
2058
- IncremarkList_default.render = render10;
2826
+ IncremarkList_default.render = render11;
2059
2827
  IncremarkList_default.__file = "src/components/IncremarkList.vue";
2060
2828
  var IncremarkList_default2 = IncremarkList_default;
2061
2829
 
2062
2830
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkTable.vue?type=script
2063
- import { defineComponent as _defineComponent11 } from "vue";
2064
- var IncremarkTable_default = /* @__PURE__ */ _defineComponent11({
2831
+ import { defineComponent as _defineComponent12 } from "vue";
2832
+ var IncremarkTable_default = /* @__PURE__ */ _defineComponent12({
2065
2833
  __name: "IncremarkTable",
2066
2834
  props: {
2067
2835
  node: { type: null, required: true }
@@ -2078,20 +2846,20 @@ var IncremarkTable_default = /* @__PURE__ */ _defineComponent11({
2078
2846
  });
2079
2847
 
2080
2848
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkTable.vue?type=template
2081
- import { renderList as _renderList4, Fragment as _Fragment8, openBlock as _openBlock11, createElementBlock as _createElementBlock10, createVNode as _createVNode9, normalizeClass as _normalizeClass4, createCommentVNode as _createCommentVNode8, createElementVNode as _createElementVNode7 } from "vue";
2849
+ import { renderList as _renderList4, Fragment as _Fragment8, openBlock as _openBlock12, createElementBlock as _createElementBlock10, createVNode as _createVNode9, normalizeClass as _normalizeClass4, createCommentVNode as _createCommentVNode8, createElementVNode as _createElementVNode7 } from "vue";
2082
2850
  var _hoisted_19 = { class: "incremark-table-wrapper" };
2083
2851
  var _hoisted_26 = { class: "incremark-table" };
2084
2852
  var _hoisted_36 = { key: 0 };
2085
- function render11(_ctx, _cache, $props, $setup, $data, $options) {
2086
- return _openBlock11(), _createElementBlock10("div", _hoisted_19, [
2853
+ function render12(_ctx, _cache, $props, $setup, $data, $options) {
2854
+ return _openBlock12(), _createElementBlock10("div", _hoisted_19, [
2087
2855
  _createElementVNode7("table", _hoisted_26, [
2088
2856
  _createElementVNode7("thead", null, [
2089
- $props.node.children[0] ? (_openBlock11(), _createElementBlock10("tr", _hoisted_36, [
2090
- (_openBlock11(true), _createElementBlock10(
2857
+ $props.node.children[0] ? (_openBlock12(), _createElementBlock10("tr", _hoisted_36, [
2858
+ (_openBlock12(true), _createElementBlock10(
2091
2859
  _Fragment8,
2092
2860
  null,
2093
2861
  _renderList4($props.node.children[0].children, (cell, cellIndex) => {
2094
- return _openBlock11(), _createElementBlock10(
2862
+ return _openBlock12(), _createElementBlock10(
2095
2863
  "th",
2096
2864
  {
2097
2865
  key: cellIndex,
@@ -2112,16 +2880,16 @@ function render11(_ctx, _cache, $props, $setup, $data, $options) {
2112
2880
  ])) : _createCommentVNode8("v-if", true)
2113
2881
  ]),
2114
2882
  _createElementVNode7("tbody", null, [
2115
- (_openBlock11(true), _createElementBlock10(
2883
+ (_openBlock12(true), _createElementBlock10(
2116
2884
  _Fragment8,
2117
2885
  null,
2118
2886
  _renderList4($props.node.children.slice(1), (row, rowIndex) => {
2119
- return _openBlock11(), _createElementBlock10("tr", { key: rowIndex }, [
2120
- (_openBlock11(true), _createElementBlock10(
2887
+ return _openBlock12(), _createElementBlock10("tr", { key: rowIndex }, [
2888
+ (_openBlock12(true), _createElementBlock10(
2121
2889
  _Fragment8,
2122
2890
  null,
2123
2891
  _renderList4(row.children, (cell, cellIndex) => {
2124
- return _openBlock11(), _createElementBlock10(
2892
+ return _openBlock12(), _createElementBlock10(
2125
2893
  "td",
2126
2894
  {
2127
2895
  key: cellIndex,
@@ -2150,13 +2918,13 @@ function render11(_ctx, _cache, $props, $setup, $data, $options) {
2150
2918
  }
2151
2919
 
2152
2920
  // src/components/IncremarkTable.vue
2153
- IncremarkTable_default.render = render11;
2921
+ IncremarkTable_default.render = render12;
2154
2922
  IncremarkTable_default.__file = "src/components/IncremarkTable.vue";
2155
2923
  var IncremarkTable_default2 = IncremarkTable_default;
2156
2924
 
2157
2925
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkBlockquote.vue?type=script
2158
- import { defineComponent as _defineComponent12 } from "vue";
2159
- var IncremarkBlockquote_default = /* @__PURE__ */ _defineComponent12({
2926
+ import { defineComponent as _defineComponent13 } from "vue";
2927
+ var IncremarkBlockquote_default = /* @__PURE__ */ _defineComponent13({
2160
2928
  __name: "IncremarkBlockquote",
2161
2929
  props: {
2162
2930
  node: { type: null, required: true }
@@ -2170,15 +2938,15 @@ var IncremarkBlockquote_default = /* @__PURE__ */ _defineComponent12({
2170
2938
  });
2171
2939
 
2172
2940
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkBlockquote.vue?type=template
2173
- import { renderList as _renderList5, Fragment as _Fragment9, openBlock as _openBlock12, createElementBlock as _createElementBlock11, createBlock as _createBlock5 } from "vue";
2941
+ import { renderList as _renderList5, Fragment as _Fragment9, openBlock as _openBlock13, createElementBlock as _createElementBlock11, createBlock as _createBlock7 } from "vue";
2174
2942
  var _hoisted_110 = { class: "incremark-blockquote" };
2175
- function render12(_ctx, _cache, $props, $setup, $data, $options) {
2176
- return _openBlock12(), _createElementBlock11("blockquote", _hoisted_110, [
2177
- (_openBlock12(true), _createElementBlock11(
2943
+ function render13(_ctx, _cache, $props, $setup, $data, $options) {
2944
+ return _openBlock13(), _createElementBlock11("blockquote", _hoisted_110, [
2945
+ (_openBlock13(true), _createElementBlock11(
2178
2946
  _Fragment9,
2179
2947
  null,
2180
2948
  _renderList5($props.node.children, (child, index) => {
2181
- return _openBlock12(), _createBlock5($setup["IncremarkRenderer"], {
2949
+ return _openBlock13(), _createBlock7($setup["IncremarkRenderer"], {
2182
2950
  key: index,
2183
2951
  node: child
2184
2952
  }, null, 8, ["node"]);
@@ -2190,13 +2958,13 @@ function render12(_ctx, _cache, $props, $setup, $data, $options) {
2190
2958
  }
2191
2959
 
2192
2960
  // src/components/IncremarkBlockquote.vue
2193
- IncremarkBlockquote_default.render = render12;
2961
+ IncremarkBlockquote_default.render = render13;
2194
2962
  IncremarkBlockquote_default.__file = "src/components/IncremarkBlockquote.vue";
2195
2963
  var IncremarkBlockquote_default2 = IncremarkBlockquote_default;
2196
2964
 
2197
2965
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkThematicBreak.vue?type=script
2198
- import { defineComponent as _defineComponent13 } from "vue";
2199
- var IncremarkThematicBreak_default = /* @__PURE__ */ _defineComponent13({
2966
+ import { defineComponent as _defineComponent14 } from "vue";
2967
+ var IncremarkThematicBreak_default = /* @__PURE__ */ _defineComponent14({
2200
2968
  __name: "IncremarkThematicBreak",
2201
2969
  setup(__props, { expose: __expose }) {
2202
2970
  __expose();
@@ -2207,20 +2975,20 @@ var IncremarkThematicBreak_default = /* @__PURE__ */ _defineComponent13({
2207
2975
  });
2208
2976
 
2209
2977
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkThematicBreak.vue?type=template
2210
- import { openBlock as _openBlock13, createElementBlock as _createElementBlock12 } from "vue";
2978
+ import { openBlock as _openBlock14, createElementBlock as _createElementBlock12 } from "vue";
2211
2979
  var _hoisted_111 = { class: "incremark-hr" };
2212
- function render13(_ctx, _cache, $props, $setup, $data, $options) {
2213
- return _openBlock13(), _createElementBlock12("hr", _hoisted_111);
2980
+ function render14(_ctx, _cache, $props, $setup, $data, $options) {
2981
+ return _openBlock14(), _createElementBlock12("hr", _hoisted_111);
2214
2982
  }
2215
2983
 
2216
2984
  // src/components/IncremarkThematicBreak.vue
2217
- IncremarkThematicBreak_default.render = render13;
2985
+ IncremarkThematicBreak_default.render = render14;
2218
2986
  IncremarkThematicBreak_default.__file = "src/components/IncremarkThematicBreak.vue";
2219
2987
  var IncremarkThematicBreak_default2 = IncremarkThematicBreak_default;
2220
2988
 
2221
2989
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContainer.vue?type=script
2222
- import { defineComponent as _defineComponent14 } from "vue";
2223
- var IncremarkContainer_default = /* @__PURE__ */ _defineComponent14({
2990
+ import { defineComponent as _defineComponent15 } from "vue";
2991
+ var IncremarkContainer_default = /* @__PURE__ */ _defineComponent15({
2224
2992
  __name: "IncremarkContainer",
2225
2993
  props: {
2226
2994
  node: { type: Object, required: true },
@@ -2252,29 +3020,29 @@ var IncremarkContainer_default = /* @__PURE__ */ _defineComponent14({
2252
3020
  });
2253
3021
 
2254
3022
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContainer.vue?type=template
2255
- import { createCommentVNode as _createCommentVNode9, renderList as _renderList6, Fragment as _Fragment10, openBlock as _openBlock14, createElementBlock as _createElementBlock13, createBlock as _createBlock6, resolveDynamicComponent as _resolveDynamicComponent5, withCtx as _withCtx4, normalizeClass as _normalizeClass5, createElementVNode as _createElementVNode8 } from "vue";
3023
+ import { createCommentVNode as _createCommentVNode9, renderList as _renderList6, Fragment as _Fragment10, openBlock as _openBlock15, createElementBlock as _createElementBlock13, createBlock as _createBlock8, resolveDynamicComponent as _resolveDynamicComponent6, withCtx as _withCtx4, normalizeClass as _normalizeClass5, createElementVNode as _createElementVNode8 } from "vue";
2256
3024
  var _hoisted_112 = {
2257
3025
  key: 0,
2258
3026
  class: "incremark-container-content"
2259
3027
  };
2260
- function render14(_ctx, _cache, $props, $setup, $data, $options) {
2261
- return _openBlock14(), _createElementBlock13(
3028
+ function render15(_ctx, _cache, $props, $setup, $data, $options) {
3029
+ return _openBlock15(), _createElementBlock13(
2262
3030
  _Fragment10,
2263
3031
  null,
2264
3032
  [
2265
3033
  _createCommentVNode9(" \u5982\u679C\u6709\u81EA\u5B9A\u4E49\u5BB9\u5668\u7EC4\u4EF6\uFF0C\u4F7F\u7528\u81EA\u5B9A\u4E49\u7EC4\u4EF6 "),
2266
- $setup.hasCustomContainer ? (_openBlock14(), _createBlock6(_resolveDynamicComponent5($setup.CustomContainer), {
3034
+ $setup.hasCustomContainer ? (_openBlock15(), _createBlock8(_resolveDynamicComponent6($setup.CustomContainer), {
2267
3035
  key: 0,
2268
3036
  name: $setup.containerName,
2269
3037
  options: $setup.options
2270
3038
  }, {
2271
3039
  default: _withCtx4(() => [
2272
3040
  _createCommentVNode9(" \u5C06\u5BB9\u5668\u5185\u5BB9\u4F5C\u4E3A\u9ED8\u8BA4 slot \u4F20\u9012 "),
2273
- $props.node.children && $props.node.children.length > 0 ? (_openBlock14(true), _createElementBlock13(
3041
+ $props.node.children && $props.node.children.length > 0 ? (_openBlock15(true), _createElementBlock13(
2274
3042
  _Fragment10,
2275
3043
  { key: 0 },
2276
3044
  _renderList6($props.node.children, (child, index) => {
2277
- return _openBlock14(), _createBlock6($setup["IncremarkRenderer"], {
3045
+ return _openBlock15(), _createBlock8($setup["IncremarkRenderer"], {
2278
3046
  key: index,
2279
3047
  node: child
2280
3048
  }, null, 8, ["node"]);
@@ -2285,7 +3053,7 @@ function render14(_ctx, _cache, $props, $setup, $data, $options) {
2285
3053
  ]),
2286
3054
  _: 1
2287
3055
  /* STABLE */
2288
- }, 8, ["name", "options"])) : (_openBlock14(), _createElementBlock13(
3056
+ }, 8, ["name", "options"])) : (_openBlock15(), _createElementBlock13(
2289
3057
  _Fragment10,
2290
3058
  { key: 1 },
2291
3059
  [
@@ -2296,12 +3064,12 @@ function render14(_ctx, _cache, $props, $setup, $data, $options) {
2296
3064
  class: _normalizeClass5(["incremark-container", `incremark-container-${$setup.containerName}`])
2297
3065
  },
2298
3066
  [
2299
- $props.node.children && $props.node.children.length > 0 ? (_openBlock14(), _createElementBlock13("div", _hoisted_112, [
2300
- (_openBlock14(true), _createElementBlock13(
3067
+ $props.node.children && $props.node.children.length > 0 ? (_openBlock15(), _createElementBlock13("div", _hoisted_112, [
3068
+ (_openBlock15(true), _createElementBlock13(
2301
3069
  _Fragment10,
2302
3070
  null,
2303
3071
  _renderList6($props.node.children, (child, index) => {
2304
- return _openBlock14(), _createBlock6($setup["IncremarkRenderer"], {
3072
+ return _openBlock15(), _createBlock8($setup["IncremarkRenderer"], {
2305
3073
  key: index,
2306
3074
  node: child
2307
3075
  }, null, 8, ["node"]);
@@ -2325,13 +3093,13 @@ function render14(_ctx, _cache, $props, $setup, $data, $options) {
2325
3093
  }
2326
3094
 
2327
3095
  // src/components/IncremarkContainer.vue
2328
- IncremarkContainer_default.render = render14;
3096
+ IncremarkContainer_default.render = render15;
2329
3097
  IncremarkContainer_default.__file = "src/components/IncremarkContainer.vue";
2330
3098
  var IncremarkContainer_default2 = IncremarkContainer_default;
2331
3099
 
2332
3100
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkDefault.vue?type=script
2333
- import { defineComponent as _defineComponent15 } from "vue";
2334
- var IncremarkDefault_default = /* @__PURE__ */ _defineComponent15({
3101
+ import { defineComponent as _defineComponent16 } from "vue";
3102
+ var IncremarkDefault_default = /* @__PURE__ */ _defineComponent16({
2335
3103
  __name: "IncremarkDefault",
2336
3104
  props: {
2337
3105
  node: { type: null, required: true }
@@ -2345,11 +3113,11 @@ var IncremarkDefault_default = /* @__PURE__ */ _defineComponent15({
2345
3113
  });
2346
3114
 
2347
3115
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkDefault.vue?type=template
2348
- import { toDisplayString as _toDisplayString6, createElementVNode as _createElementVNode9, openBlock as _openBlock15, createElementBlock as _createElementBlock14 } from "vue";
3116
+ import { toDisplayString as _toDisplayString6, createElementVNode as _createElementVNode9, openBlock as _openBlock16, createElementBlock as _createElementBlock14 } from "vue";
2349
3117
  var _hoisted_113 = { class: "incremark-default" };
2350
3118
  var _hoisted_27 = { class: "type-badge" };
2351
- function render15(_ctx, _cache, $props, $setup, $data, $options) {
2352
- return _openBlock15(), _createElementBlock14("div", _hoisted_113, [
3119
+ function render16(_ctx, _cache, $props, $setup, $data, $options) {
3120
+ return _openBlock16(), _createElementBlock14("div", _hoisted_113, [
2353
3121
  _createElementVNode9(
2354
3122
  "span",
2355
3123
  _hoisted_27,
@@ -2368,12 +3136,12 @@ function render15(_ctx, _cache, $props, $setup, $data, $options) {
2368
3136
  }
2369
3137
 
2370
3138
  // src/components/IncremarkDefault.vue
2371
- IncremarkDefault_default.render = render15;
3139
+ IncremarkDefault_default.render = render16;
2372
3140
  IncremarkDefault_default.__file = "src/components/IncremarkDefault.vue";
2373
3141
  var IncremarkDefault_default2 = IncremarkDefault_default;
2374
3142
 
2375
3143
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=script
2376
- var IncremarkRenderer_default2 = /* @__PURE__ */ _defineComponent16({
3144
+ var IncremarkRenderer_default2 = /* @__PURE__ */ _defineComponent17({
2377
3145
  __name: "IncremarkRenderer",
2378
3146
  props: {
2379
3147
  node: { type: null, required: true },
@@ -2421,18 +3189,18 @@ var IncremarkRenderer_default2 = /* @__PURE__ */ _defineComponent16({
2421
3189
  });
2422
3190
 
2423
3191
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=template
2424
- import { createCommentVNode as _createCommentVNode10, toDisplayString as _toDisplayString7, createElementVNode as _createElementVNode10, openBlock as _openBlock16, createElementBlock as _createElementBlock15, createVNode as _createVNode10, Fragment as _Fragment11, resolveDynamicComponent as _resolveDynamicComponent6, createBlock as _createBlock7 } from "vue";
3192
+ import { createCommentVNode as _createCommentVNode10, toDisplayString as _toDisplayString7, createElementVNode as _createElementVNode10, openBlock as _openBlock17, createElementBlock as _createElementBlock15, createVNode as _createVNode10, Fragment as _Fragment11, resolveDynamicComponent as _resolveDynamicComponent7, createBlock as _createBlock9 } from "vue";
2425
3193
  var _hoisted_114 = {
2426
3194
  key: 0,
2427
3195
  class: "incremark-html-code"
2428
3196
  };
2429
- function render16(_ctx, _cache, $props, $setup, $data, $options) {
2430
- return _openBlock16(), _createElementBlock15(
3197
+ function render17(_ctx, _cache, $props, $setup, $data, $options) {
3198
+ return _openBlock17(), _createElementBlock15(
2431
3199
  _Fragment11,
2432
3200
  null,
2433
3201
  [
2434
3202
  _createCommentVNode10(" HTML \u8282\u70B9\uFF1A\u6E32\u67D3\u4E3A\u4EE3\u7801\u5757\u663E\u793A\u6E90\u4EE3\u7801 "),
2435
- $setup.isHtmlNode($props.node) ? (_openBlock16(), _createElementBlock15("pre", _hoisted_114, [
3203
+ $setup.isHtmlNode($props.node) ? (_openBlock17(), _createElementBlock15("pre", _hoisted_114, [
2436
3204
  _createElementVNode10(
2437
3205
  "code",
2438
3206
  null,
@@ -2440,7 +3208,7 @@ function render16(_ctx, _cache, $props, $setup, $data, $options) {
2440
3208
  1
2441
3209
  /* TEXT */
2442
3210
  )
2443
- ])) : $setup.isContainerNode($props.node) ? (_openBlock16(), _createElementBlock15(
3211
+ ])) : $setup.isContainerNode($props.node) ? (_openBlock17(), _createElementBlock15(
2444
3212
  _Fragment11,
2445
3213
  { key: 1 },
2446
3214
  [
@@ -2452,7 +3220,7 @@ function render16(_ctx, _cache, $props, $setup, $data, $options) {
2452
3220
  ],
2453
3221
  2112
2454
3222
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
2455
- )) : $props.node.type === "code" ? (_openBlock16(), _createElementBlock15(
3223
+ )) : $props.node.type === "code" ? (_openBlock17(), _createElementBlock15(
2456
3224
  _Fragment11,
2457
3225
  { key: 2 },
2458
3226
  [
@@ -2467,12 +3235,12 @@ function render16(_ctx, _cache, $props, $setup, $data, $options) {
2467
3235
  ],
2468
3236
  2112
2469
3237
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
2470
- )) : (_openBlock16(), _createElementBlock15(
3238
+ )) : (_openBlock17(), _createElementBlock15(
2471
3239
  _Fragment11,
2472
3240
  { key: 3 },
2473
3241
  [
2474
3242
  _createCommentVNode10(" \u5176\u4ED6\u8282\u70B9\uFF1A\u4F7F\u7528\u5BF9\u5E94\u7EC4\u4EF6 "),
2475
- (_openBlock16(), _createBlock7(_resolveDynamicComponent6($setup.getComponent($props.node.type)), {
3243
+ (_openBlock17(), _createBlock9(_resolveDynamicComponent7($setup.getComponent($props.node.type)), {
2476
3244
  node: $props.node
2477
3245
  }, null, 8, ["node"]))
2478
3246
  ],
@@ -2486,14 +3254,14 @@ function render16(_ctx, _cache, $props, $setup, $data, $options) {
2486
3254
  }
2487
3255
 
2488
3256
  // src/components/IncremarkRenderer.vue
2489
- IncremarkRenderer_default2.render = render16;
3257
+ IncremarkRenderer_default2.render = render17;
2490
3258
  IncremarkRenderer_default2.__file = "src/components/IncremarkRenderer.vue";
2491
3259
  var IncremarkRenderer_default = IncremarkRenderer_default2;
2492
3260
 
2493
3261
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkFootnotes.vue?type=script
2494
- import { defineComponent as _defineComponent17 } from "vue";
3262
+ import { defineComponent as _defineComponent18 } from "vue";
2495
3263
  import { computed as computed13 } from "vue";
2496
- var IncremarkFootnotes_default = /* @__PURE__ */ _defineComponent17({
3264
+ var IncremarkFootnotes_default = /* @__PURE__ */ _defineComponent18({
2497
3265
  __name: "IncremarkFootnotes",
2498
3266
  setup(__props, { expose: __expose }) {
2499
3267
  __expose();
@@ -2512,7 +3280,7 @@ var IncremarkFootnotes_default = /* @__PURE__ */ _defineComponent17({
2512
3280
  });
2513
3281
 
2514
3282
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkFootnotes.vue?type=template
2515
- import { createElementVNode as _createElementVNode11, renderList as _renderList7, Fragment as _Fragment12, openBlock as _openBlock17, createElementBlock as _createElementBlock16, createCommentVNode as _createCommentVNode11, toDisplayString as _toDisplayString8, createBlock as _createBlock8 } from "vue";
3283
+ import { createElementVNode as _createElementVNode11, renderList as _renderList7, Fragment as _Fragment12, openBlock as _openBlock18, createElementBlock as _createElementBlock16, createCommentVNode as _createCommentVNode11, toDisplayString as _toDisplayString8, createBlock as _createBlock10 } from "vue";
2516
3284
  var _hoisted_115 = {
2517
3285
  key: 0,
2518
3286
  class: "incremark-footnotes"
@@ -2523,8 +3291,8 @@ var _hoisted_45 = { class: "incremark-footnote-content" };
2523
3291
  var _hoisted_55 = { class: "incremark-footnote-number" };
2524
3292
  var _hoisted_65 = { class: "incremark-footnote-body" };
2525
3293
  var _hoisted_74 = ["href"];
2526
- function render17(_ctx, _cache, $props, $setup, $data, $options) {
2527
- return $setup.hasFootnotes ? (_openBlock17(), _createElementBlock16("section", _hoisted_115, [
3294
+ function render18(_ctx, _cache, $props, $setup, $data, $options) {
3295
+ return $setup.hasFootnotes ? (_openBlock18(), _createElementBlock16("section", _hoisted_115, [
2528
3296
  _cache[0] || (_cache[0] = _createElementVNode11(
2529
3297
  "hr",
2530
3298
  { class: "incremark-footnotes-divider" },
@@ -2533,11 +3301,11 @@ function render17(_ctx, _cache, $props, $setup, $data, $options) {
2533
3301
  /* CACHED */
2534
3302
  )),
2535
3303
  _createElementVNode11("ol", _hoisted_28, [
2536
- (_openBlock17(true), _createElementBlock16(
3304
+ (_openBlock18(true), _createElementBlock16(
2537
3305
  _Fragment12,
2538
3306
  null,
2539
3307
  _renderList7($setup.orderedFootnotes, (item, index) => {
2540
- return _openBlock17(), _createElementBlock16("li", {
3308
+ return _openBlock18(), _createElementBlock16("li", {
2541
3309
  key: item.identifier,
2542
3310
  id: `fn-${item.identifier}`,
2543
3311
  class: "incremark-footnote-item"
@@ -2553,11 +3321,11 @@ function render17(_ctx, _cache, $props, $setup, $data, $options) {
2553
3321
  ),
2554
3322
  _createCommentVNode11(" \u811A\u6CE8\u5185\u5BB9 "),
2555
3323
  _createElementVNode11("div", _hoisted_65, [
2556
- (_openBlock17(true), _createElementBlock16(
3324
+ (_openBlock18(true), _createElementBlock16(
2557
3325
  _Fragment12,
2558
3326
  null,
2559
3327
  _renderList7(item.definition.children, (child, childIndex) => {
2560
- return _openBlock17(), _createBlock8($setup["IncremarkRenderer"], {
3328
+ return _openBlock18(), _createBlock10($setup["IncremarkRenderer"], {
2561
3329
  key: childIndex,
2562
3330
  node: child
2563
3331
  }, null, 8, ["node"]);
@@ -2583,12 +3351,12 @@ function render17(_ctx, _cache, $props, $setup, $data, $options) {
2583
3351
  }
2584
3352
 
2585
3353
  // src/components/IncremarkFootnotes.vue
2586
- IncremarkFootnotes_default.render = render17;
3354
+ IncremarkFootnotes_default.render = render18;
2587
3355
  IncremarkFootnotes_default.__file = "src/components/IncremarkFootnotes.vue";
2588
3356
  var IncremarkFootnotes_default2 = IncremarkFootnotes_default;
2589
3357
 
2590
3358
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=script
2591
- var Incremark_default = /* @__PURE__ */ _defineComponent18({
3359
+ var Incremark_default = /* @__PURE__ */ _defineComponent19({
2592
3360
  __name: "Incremark",
2593
3361
  props: {
2594
3362
  blocks: { type: Array, required: false, default: () => [] },
@@ -2622,20 +3390,20 @@ var Incremark_default = /* @__PURE__ */ _defineComponent18({
2622
3390
  });
2623
3391
 
2624
3392
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=template
2625
- import { createCommentVNode as _createCommentVNode12, renderList as _renderList8, Fragment as _Fragment13, openBlock as _openBlock18, createElementBlock as _createElementBlock17, createVNode as _createVNode11, normalizeClass as _normalizeClass6, createBlock as _createBlock9 } from "vue";
3393
+ import { createCommentVNode as _createCommentVNode12, renderList as _renderList8, Fragment as _Fragment13, openBlock as _openBlock19, createElementBlock as _createElementBlock17, createVNode as _createVNode11, normalizeClass as _normalizeClass6, createBlock as _createBlock11 } from "vue";
2626
3394
  var _hoisted_116 = { class: "incremark" };
2627
- function render18(_ctx, _cache, $props, $setup, $data, $options) {
2628
- return _openBlock18(), _createElementBlock17("div", _hoisted_116, [
3395
+ function render19(_ctx, _cache, $props, $setup, $data, $options) {
3396
+ return _openBlock19(), _createElementBlock17("div", _hoisted_116, [
2629
3397
  _createCommentVNode12(" \u4E3B\u8981\u5185\u5BB9\u5757 "),
2630
- (_openBlock18(true), _createElementBlock17(
3398
+ (_openBlock19(true), _createElementBlock17(
2631
3399
  _Fragment13,
2632
3400
  null,
2633
3401
  _renderList8($setup.actualBlocks, (block) => {
2634
- return _openBlock18(), _createElementBlock17(
3402
+ return _openBlock19(), _createElementBlock17(
2635
3403
  _Fragment13,
2636
3404
  null,
2637
3405
  [
2638
- block.node.type !== "definition" && block.node.type !== "footnoteDefinition" ? (_openBlock18(), _createElementBlock17(
3406
+ block.node.type !== "definition" && block.node.type !== "footnoteDefinition" ? (_openBlock19(), _createElementBlock17(
2639
3407
  "div",
2640
3408
  {
2641
3409
  key: block.id,
@@ -2647,7 +3415,6 @@ function render18(_ctx, _cache, $props, $setup, $data, $options) {
2647
3415
  ])
2648
3416
  },
2649
3417
  [
2650
- _createCommentVNode12(" \u4F7F\u7528 IncremarkRenderer \u7EDF\u4E00\u5904\u7406\u6240\u6709\u8282\u70B9\u7C7B\u578B "),
2651
3418
  _createVNode11($setup["IncremarkRenderer"], {
2652
3419
  node: block.node,
2653
3420
  "block-status": block.status,
@@ -2669,19 +3436,19 @@ function render18(_ctx, _cache, $props, $setup, $data, $options) {
2669
3436
  /* UNKEYED_FRAGMENT */
2670
3437
  )),
2671
3438
  _createCommentVNode12(" \u811A\u6CE8\u5217\u8868\uFF08\u4EC5\u5728\u5185\u5BB9\u5B8C\u5168\u663E\u793A\u540E\u663E\u793A\uFF09 "),
2672
- $setup.actualIsDisplayComplete && $setup.footnoteReferenceOrder.length > 0 ? (_openBlock18(), _createBlock9($setup["IncremarkFootnotes"], { key: 0 })) : _createCommentVNode12("v-if", true)
3439
+ $setup.actualIsDisplayComplete && $setup.footnoteReferenceOrder.length > 0 ? (_openBlock19(), _createBlock11($setup["IncremarkFootnotes"], { key: 0 })) : _createCommentVNode12("v-if", true)
2673
3440
  ]);
2674
3441
  }
2675
3442
 
2676
3443
  // src/components/Incremark.vue
2677
- Incremark_default.render = render18;
3444
+ Incremark_default.render = render19;
2678
3445
  Incremark_default.__file = "src/components/Incremark.vue";
2679
3446
  var Incremark_default2 = Incremark_default;
2680
3447
 
2681
3448
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContent.vue?type=script
2682
- import { defineComponent as _defineComponent19 } from "vue";
2683
- import { computed as computed15, watch as watch7 } from "vue";
2684
- var IncremarkContent_default = /* @__PURE__ */ _defineComponent19({
3449
+ import { defineComponent as _defineComponent20 } from "vue";
3450
+ import { computed as computed15, watch as watch8 } from "vue";
3451
+ var IncremarkContent_default = /* @__PURE__ */ _defineComponent20({
2685
3452
  __name: "IncremarkContent",
2686
3453
  props: {
2687
3454
  stream: { type: Function, required: false },
@@ -2705,7 +3472,7 @@ var IncremarkContent_default = /* @__PURE__ */ _defineComponent19({
2705
3472
  math: true,
2706
3473
  ...props.incremarkOptions
2707
3474
  }));
2708
- const { blocks, append, finalize, render: render23, reset, isDisplayComplete, markdown } = useIncremark(incremarkOptions);
3475
+ const { blocks, append, finalize, render: render24, reset, isDisplayComplete, markdown } = useIncremark(incremarkOptions);
2709
3476
  const isStreamMode = computed15(() => typeof props.stream === "function");
2710
3477
  async function handleStreamInput() {
2711
3478
  if (!props.stream) return;
@@ -2731,32 +3498,31 @@ var IncremarkContent_default = /* @__PURE__ */ _defineComponent19({
2731
3498
  const delta = newContent.slice((oldContent || "").length);
2732
3499
  append(delta);
2733
3500
  } else {
2734
- render23(newContent);
3501
+ render24(newContent);
2735
3502
  }
2736
3503
  }
2737
- watch7(() => props.content, async (newContent, oldContent) => {
3504
+ watch8(() => props.content, async (newContent, oldContent) => {
2738
3505
  if (isStreamMode.value) {
2739
3506
  await handleStreamInput();
2740
- return;
2741
3507
  } else {
2742
3508
  handleContentInput(newContent, oldContent);
2743
3509
  }
2744
3510
  }, { immediate: true });
2745
- watch7(() => props.isFinished, (newIsFinished) => {
3511
+ watch8(() => props.isFinished, (newIsFinished) => {
2746
3512
  if (newIsFinished && props.content === markdown.value) {
2747
3513
  finalize();
2748
3514
  }
2749
3515
  }, { immediate: true });
2750
- const __returned__ = { props, incremarkOptions, blocks, append, finalize, render: render23, reset, isDisplayComplete, markdown, isStreamMode, handleStreamInput, handleContentInput, Incremark: Incremark_default2 };
3516
+ const __returned__ = { props, incremarkOptions, blocks, append, finalize, render: render24, reset, isDisplayComplete, markdown, isStreamMode, handleStreamInput, handleContentInput, Incremark: Incremark_default2 };
2751
3517
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
2752
3518
  return __returned__;
2753
3519
  }
2754
3520
  });
2755
3521
 
2756
3522
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContent.vue?type=template
2757
- import { openBlock as _openBlock19, createBlock as _createBlock10 } from "vue";
2758
- function render19(_ctx, _cache, $props, $setup, $data, $options) {
2759
- return _openBlock19(), _createBlock10($setup["Incremark"], {
3523
+ import { openBlock as _openBlock20, createBlock as _createBlock12 } from "vue";
3524
+ function render20(_ctx, _cache, $props, $setup, $data, $options) {
3525
+ return _openBlock20(), _createBlock12($setup["Incremark"], {
2760
3526
  blocks: $setup.blocks,
2761
3527
  "pending-class": $props.pendingClass,
2762
3528
  "is-display-complete": $setup.isDisplayComplete,
@@ -2769,14 +3535,14 @@ function render19(_ctx, _cache, $props, $setup, $data, $options) {
2769
3535
  }
2770
3536
 
2771
3537
  // src/components/IncremarkContent.vue
2772
- IncremarkContent_default.render = render19;
3538
+ IncremarkContent_default.render = render20;
2773
3539
  IncremarkContent_default.__file = "src/components/IncremarkContent.vue";
2774
3540
  var IncremarkContent_default2 = IncremarkContent_default;
2775
3541
 
2776
3542
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/AutoScrollContainer.vue?type=script
2777
- import { defineComponent as _defineComponent20 } from "vue";
2778
- import { ref as ref8, onMounted as onMounted2, onUnmounted as onUnmounted7, nextTick } from "vue";
2779
- var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent20({
3543
+ import { defineComponent as _defineComponent21 } from "vue";
3544
+ import { ref as ref10, onMounted as onMounted5, onUnmounted as onUnmounted7, nextTick } from "vue";
3545
+ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent21({
2780
3546
  __name: "AutoScrollContainer",
2781
3547
  props: {
2782
3548
  enabled: { type: Boolean, required: false, default: true },
@@ -2785,8 +3551,8 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent20({
2785
3551
  },
2786
3552
  setup(__props, { expose: __expose }) {
2787
3553
  const props = __props;
2788
- const containerRef = ref8(null);
2789
- const isUserScrolledUp = ref8(false);
3554
+ const containerRef = ref10(null);
3555
+ const isUserScrolledUp = ref10(false);
2790
3556
  let lastScrollTop = 0;
2791
3557
  let lastScrollHeight = 0;
2792
3558
  function isNearBottom() {
@@ -2832,7 +3598,7 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent20({
2832
3598
  lastScrollHeight = scrollHeight;
2833
3599
  }
2834
3600
  let observer = null;
2835
- onMounted2(() => {
3601
+ onMounted5(() => {
2836
3602
  if (!containerRef.value) return;
2837
3603
  lastScrollTop = containerRef.value.scrollTop;
2838
3604
  lastScrollHeight = containerRef.value.scrollHeight;
@@ -2884,9 +3650,9 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent20({
2884
3650
  });
2885
3651
 
2886
3652
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/AutoScrollContainer.vue?type=template
2887
- import { renderSlot as _renderSlot, openBlock as _openBlock20, createElementBlock as _createElementBlock18 } from "vue";
2888
- function render20(_ctx, _cache, $props, $setup, $data, $options) {
2889
- return _openBlock20(), _createElementBlock18(
3653
+ import { renderSlot as _renderSlot, openBlock as _openBlock21, createElementBlock as _createElementBlock18 } from "vue";
3654
+ function render21(_ctx, _cache, $props, $setup, $data, $options) {
3655
+ return _openBlock21(), _createElementBlock18(
2890
3656
  "div",
2891
3657
  {
2892
3658
  ref: "containerRef",
@@ -2902,16 +3668,16 @@ function render20(_ctx, _cache, $props, $setup, $data, $options) {
2902
3668
  }
2903
3669
 
2904
3670
  // src/components/AutoScrollContainer.vue
2905
- AutoScrollContainer_default.render = render20;
3671
+ AutoScrollContainer_default.render = render21;
2906
3672
  AutoScrollContainer_default.__file = "src/components/AutoScrollContainer.vue";
2907
3673
  var AutoScrollContainer_default2 = AutoScrollContainer_default;
2908
3674
 
2909
3675
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/ThemeProvider.vue?type=script
2910
- import { defineComponent as _defineComponent21 } from "vue";
2911
- import { ref as ref9, watch as watch9 } from "vue";
3676
+ import { defineComponent as _defineComponent22 } from "vue";
3677
+ import { ref as ref11, watch as watch10 } from "vue";
2912
3678
  import { applyTheme } from "@incremark/theme";
2913
3679
  import { isServer } from "@incremark/shared";
2914
- var ThemeProvider_default = /* @__PURE__ */ _defineComponent21({
3680
+ var ThemeProvider_default = /* @__PURE__ */ _defineComponent22({
2915
3681
  __name: "ThemeProvider",
2916
3682
  props: {
2917
3683
  theme: { type: null, required: true },
@@ -2920,8 +3686,8 @@ var ThemeProvider_default = /* @__PURE__ */ _defineComponent21({
2920
3686
  setup(__props, { expose: __expose }) {
2921
3687
  __expose();
2922
3688
  const props = __props;
2923
- const containerRef = ref9();
2924
- watch9(
3689
+ const containerRef = ref11();
3690
+ watch10(
2925
3691
  () => props.theme,
2926
3692
  (theme) => {
2927
3693
  if (isServer()) return;
@@ -2938,9 +3704,9 @@ var ThemeProvider_default = /* @__PURE__ */ _defineComponent21({
2938
3704
  });
2939
3705
 
2940
3706
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/ThemeProvider.vue?type=template
2941
- import { renderSlot as _renderSlot2, normalizeClass as _normalizeClass7, openBlock as _openBlock21, createElementBlock as _createElementBlock19 } from "vue";
2942
- function render21(_ctx, _cache, $props, $setup, $data, $options) {
2943
- return _openBlock21(), _createElementBlock19(
3707
+ import { renderSlot as _renderSlot2, normalizeClass as _normalizeClass7, openBlock as _openBlock22, createElementBlock as _createElementBlock19 } from "vue";
3708
+ function render22(_ctx, _cache, $props, $setup, $data, $options) {
3709
+ return _openBlock22(), _createElementBlock19(
2944
3710
  "div",
2945
3711
  {
2946
3712
  ref: "containerRef",
@@ -2955,24 +3721,25 @@ function render21(_ctx, _cache, $props, $setup, $data, $options) {
2955
3721
  }
2956
3722
 
2957
3723
  // src/ThemeProvider.vue
2958
- ThemeProvider_default.render = render21;
3724
+ ThemeProvider_default.render = render22;
2959
3725
  ThemeProvider_default.__file = "src/ThemeProvider.vue";
2960
3726
  var ThemeProvider_default2 = ThemeProvider_default;
2961
3727
 
2962
3728
  // sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/ConfigProvider.vue?type=script
2963
- import { defineComponent as _defineComponent22 } from "vue";
2964
- import { provide as provide2, ref as ref10, watch as watch10 } from "vue";
2965
- var ConfigProvider_default = /* @__PURE__ */ _defineComponent22({
3729
+ import { defineComponent as _defineComponent23 } from "vue";
3730
+ import { provide as provide2, ref as ref12, watch as watch11 } from "vue";
3731
+ import { zhCN as zhCN2 } from "@incremark/shared";
3732
+ var ConfigProvider_default = /* @__PURE__ */ _defineComponent23({
2966
3733
  __name: "ConfigProvider",
2967
3734
  props: {
2968
- locale: { type: null, required: false, default: () => enShared }
3735
+ locale: { type: null, required: false, default: () => zhCN2 }
2969
3736
  },
2970
3737
  setup(__props, { expose: __expose }) {
2971
3738
  __expose();
2972
3739
  const props = __props;
2973
- const localeRef = ref10(props.locale);
3740
+ const localeRef = ref12(props.locale || zhCN2);
2974
3741
  provide2(LOCALE_KEY, localeRef);
2975
- watch10(
3742
+ watch11(
2976
3743
  () => props.locale,
2977
3744
  (newLocale) => {
2978
3745
  if (newLocale) {
@@ -2989,12 +3756,12 @@ var ConfigProvider_default = /* @__PURE__ */ _defineComponent22({
2989
3756
 
2990
3757
  // sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/ConfigProvider.vue?type=template
2991
3758
  import { renderSlot as _renderSlot3 } from "vue";
2992
- function render22(_ctx, _cache, $props, $setup, $data, $options) {
3759
+ function render23(_ctx, _cache, $props, $setup, $data, $options) {
2993
3760
  return _renderSlot3(_ctx.$slots, "default");
2994
3761
  }
2995
3762
 
2996
3763
  // src/components/ConfigProvider.vue
2997
- ConfigProvider_default.render = render22;
3764
+ ConfigProvider_default.render = render23;
2998
3765
  ConfigProvider_default.__file = "src/components/ConfigProvider.vue";
2999
3766
  var ConfigProvider_default2 = ConfigProvider_default;
3000
3767
 
@@ -3008,7 +3775,7 @@ import {
3008
3775
  codeBlockPlugin,
3009
3776
  mermaidPlugin,
3010
3777
  imagePlugin,
3011
- mathPlugin,
3778
+ mathPlugin as mathPlugin2,
3012
3779
  thematicBreakPlugin,
3013
3780
  defaultPlugins as defaultPlugins2,
3014
3781
  allPlugins,
@@ -3055,7 +3822,7 @@ export {
3055
3822
  enShared as en,
3056
3823
  generateCSSVars,
3057
3824
  imagePlugin,
3058
- mathPlugin,
3825
+ mathPlugin2 as mathPlugin,
3059
3826
  mergeTheme,
3060
3827
  mermaidPlugin,
3061
3828
  sliceAst,