@incremark/vue 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CachedCodeRenderer.vue.d.ts +16 -0
- package/dist/components/IncremarkCode.vue.d.ts +1 -1
- package/dist/components/IncremarkCodeDefault.vue.d.ts +3 -0
- package/dist/composables/useIncremark.d.ts +2 -42
- package/dist/composables/useShiki.d.ts +2 -0
- package/dist/composables/useTypewriter.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1048 -287
- package/dist/index.js.map +1 -1
- package/package.json +14 -10
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
|
-
|
|
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
|
-
|
|
151
|
-
(
|
|
152
|
-
|
|
153
|
-
|
|
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
|
|
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.
|
|
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 =
|
|
294
|
+
const ast = ref3({
|
|
269
295
|
type: "root",
|
|
270
|
-
children: [
|
|
271
|
-
|
|
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
|
}
|
|
@@ -332,7 +360,14 @@ function useIncremark(optionsInput = {}) {
|
|
|
332
360
|
transformer?.reset();
|
|
333
361
|
}
|
|
334
362
|
);
|
|
335
|
-
|
|
363
|
+
watch2(
|
|
364
|
+
displayedFootnoteReferenceOrder,
|
|
365
|
+
(newOrder) => {
|
|
366
|
+
setFootnoteReferenceOrder(newOrder);
|
|
367
|
+
},
|
|
368
|
+
{ immediate: true }
|
|
369
|
+
);
|
|
370
|
+
function render24(content) {
|
|
336
371
|
const update = parser.render(content);
|
|
337
372
|
markdown.value = parser.getBuffer();
|
|
338
373
|
completedBlocks.value = parser.getCompletedBlocks().map((b) => markRaw(b));
|
|
@@ -343,7 +378,7 @@ function useIncremark(optionsInput = {}) {
|
|
|
343
378
|
setFootnoteReferenceOrder(update.footnoteReferenceOrder);
|
|
344
379
|
return update;
|
|
345
380
|
}
|
|
346
|
-
|
|
381
|
+
const result = {
|
|
347
382
|
/** 已收集的完整 Markdown 字符串 */
|
|
348
383
|
markdown,
|
|
349
384
|
/** 已完成的块列表 */
|
|
@@ -376,12 +411,13 @@ function useIncremark(optionsInput = {}) {
|
|
|
376
411
|
/** 重置解析器和打字机 */
|
|
377
412
|
reset,
|
|
378
413
|
/** 一次性渲染(reset + append + finalize) */
|
|
379
|
-
render:
|
|
414
|
+
render: render24,
|
|
380
415
|
/** 解析器实例 */
|
|
381
416
|
parser,
|
|
382
417
|
/** 打字机控制 */
|
|
383
418
|
typewriter
|
|
384
419
|
};
|
|
420
|
+
return result;
|
|
385
421
|
}
|
|
386
422
|
|
|
387
423
|
// src/composables/useStreamRenderer.ts
|
|
@@ -488,22 +524,11 @@ function useBlockTransformer(sourceBlocks, options = {}) {
|
|
|
488
524
|
}
|
|
489
525
|
|
|
490
526
|
// src/composables/useLocale.ts
|
|
491
|
-
import { inject, computed as computed5 } from "vue";
|
|
527
|
+
import { inject, computed as computed5, ref as ref5 } from "vue";
|
|
528
|
+
import { zhCN } from "@incremark/shared";
|
|
492
529
|
var LOCALE_KEY = /* @__PURE__ */ Symbol("incremark-locale");
|
|
493
530
|
function useLocale() {
|
|
494
|
-
const locale = inject(LOCALE_KEY);
|
|
495
|
-
if (!locale) {
|
|
496
|
-
const defaultLocale = enShared;
|
|
497
|
-
const t2 = computed5(() => (key) => {
|
|
498
|
-
const keys = key.split(".");
|
|
499
|
-
let value = defaultLocale;
|
|
500
|
-
for (const k of keys) {
|
|
501
|
-
value = value?.[k];
|
|
502
|
-
}
|
|
503
|
-
return value || key;
|
|
504
|
-
});
|
|
505
|
-
return { t: t2 };
|
|
506
|
-
}
|
|
531
|
+
const locale = inject(LOCALE_KEY, ref5(zhCN));
|
|
507
532
|
const t = computed5(() => (key) => {
|
|
508
533
|
const keys = key.split(".");
|
|
509
534
|
let value = locale.value;
|
|
@@ -526,11 +551,11 @@ function useDefinationsContext() {
|
|
|
526
551
|
}
|
|
527
552
|
|
|
528
553
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=script
|
|
529
|
-
import { defineComponent as
|
|
554
|
+
import { defineComponent as _defineComponent19 } from "vue";
|
|
530
555
|
import { computed as computed14 } from "vue";
|
|
531
556
|
|
|
532
557
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=script
|
|
533
|
-
import { defineComponent as
|
|
558
|
+
import { defineComponent as _defineComponent17 } from "vue";
|
|
534
559
|
import { computed as computed12 } from "vue";
|
|
535
560
|
|
|
536
561
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkHeading.vue?type=script
|
|
@@ -547,19 +572,19 @@ import {
|
|
|
547
572
|
|
|
548
573
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkMath.vue?type=script
|
|
549
574
|
import { defineComponent as _defineComponent } from "vue";
|
|
550
|
-
import { computed as computed6, ref as
|
|
575
|
+
import { computed as computed6, ref as ref6, watch as watch4, shallowRef as shallowRef3, onUnmounted as onUnmounted4 } from "vue";
|
|
551
576
|
var IncremarkMath_default = /* @__PURE__ */ _defineComponent({
|
|
552
577
|
__name: "IncremarkMath",
|
|
553
578
|
props: {
|
|
554
579
|
node: { type: Object, required: true },
|
|
555
|
-
renderDelay: { type: Number, required: false, default:
|
|
580
|
+
renderDelay: { type: Number, required: false, default: 0 }
|
|
556
581
|
},
|
|
557
582
|
setup(__props, { expose: __expose }) {
|
|
558
583
|
__expose();
|
|
559
584
|
const props = __props;
|
|
560
|
-
const renderedHtml =
|
|
561
|
-
const renderError =
|
|
562
|
-
const isLoading =
|
|
585
|
+
const renderedHtml = ref6("");
|
|
586
|
+
const renderError = ref6("");
|
|
587
|
+
const isLoading = ref6(false);
|
|
563
588
|
const katexRef = shallowRef3(null);
|
|
564
589
|
let renderTimer = null;
|
|
565
590
|
const isInline = computed6(() => props.node.type === "inlineMath");
|
|
@@ -1303,12 +1328,12 @@ IncremarkParagraph_default.__file = "src/components/IncremarkParagraph.vue";
|
|
|
1303
1328
|
var IncremarkParagraph_default2 = IncremarkParagraph_default;
|
|
1304
1329
|
|
|
1305
1330
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=script
|
|
1306
|
-
import { defineComponent as
|
|
1331
|
+
import { defineComponent as _defineComponent10 } from "vue";
|
|
1307
1332
|
import { computed as computed10 } from "vue";
|
|
1308
1333
|
|
|
1309
1334
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeMermaid.vue?type=script
|
|
1310
1335
|
import { defineComponent as _defineComponent7 } from "vue";
|
|
1311
|
-
import { computed as computed8, ref as
|
|
1336
|
+
import { computed as computed8, ref as ref7, onUnmounted as onUnmounted5, shallowRef as shallowRef4, watch as watch5 } from "vue";
|
|
1312
1337
|
import { GravityMermaid, LucideCode, LucideEye, LucideCopy, LucideCopyCheck } from "@incremark/icons";
|
|
1313
1338
|
import { isClipboardAvailable } from "@incremark/shared";
|
|
1314
1339
|
|
|
@@ -1355,12 +1380,12 @@ var IncremarkCodeMermaid_default = /* @__PURE__ */ _defineComponent7({
|
|
|
1355
1380
|
__expose();
|
|
1356
1381
|
const props = __props;
|
|
1357
1382
|
const { t } = useLocale();
|
|
1358
|
-
const mermaidSvg =
|
|
1359
|
-
const mermaidError =
|
|
1360
|
-
const mermaidLoading =
|
|
1383
|
+
const mermaidSvg = ref7("");
|
|
1384
|
+
const mermaidError = ref7("");
|
|
1385
|
+
const mermaidLoading = ref7(false);
|
|
1361
1386
|
const mermaidRef = shallowRef4(null);
|
|
1362
1387
|
let mermaidTimer = null;
|
|
1363
|
-
const mermaidViewMode =
|
|
1388
|
+
const mermaidViewMode = ref7("preview");
|
|
1364
1389
|
function toggleMermaidView() {
|
|
1365
1390
|
mermaidViewMode.value = mermaidViewMode.value === "preview" ? "source" : "preview";
|
|
1366
1391
|
}
|
|
@@ -1409,7 +1434,7 @@ var IncremarkCodeMermaid_default = /* @__PURE__ */ _defineComponent7({
|
|
|
1409
1434
|
clearTimeout(copyTimeoutId);
|
|
1410
1435
|
}
|
|
1411
1436
|
});
|
|
1412
|
-
const copied =
|
|
1437
|
+
const copied = ref7(false);
|
|
1413
1438
|
let copyTimeoutId = null;
|
|
1414
1439
|
async function copyCode() {
|
|
1415
1440
|
if (!isClipboardAvailable()) return;
|
|
@@ -1569,8 +1594,8 @@ IncremarkCodeMermaid_default.__file = "src/components/IncremarkCodeMermaid.vue";
|
|
|
1569
1594
|
var IncremarkCodeMermaid_default2 = IncremarkCodeMermaid_default;
|
|
1570
1595
|
|
|
1571
1596
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeDefault.vue?type=script
|
|
1572
|
-
import { defineComponent as
|
|
1573
|
-
import { computed as computed9,
|
|
1597
|
+
import { defineComponent as _defineComponent9 } from "vue";
|
|
1598
|
+
import { computed as computed9, ref as ref9, watch as watch7 } from "vue";
|
|
1574
1599
|
import { LucideCopy as LucideCopy2, LucideCopyCheck as LucideCopyCheck2 } from "@incremark/icons";
|
|
1575
1600
|
import { isClipboardAvailable as isClipboardAvailable2 } from "@incremark/shared";
|
|
1576
1601
|
|
|
@@ -1677,9 +1702,22 @@ function getShikiManager() {
|
|
|
1677
1702
|
function useShiki(theme) {
|
|
1678
1703
|
const highlighterInfo = shallowRef5(null);
|
|
1679
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
|
+
}
|
|
1680
1717
|
async function getHighlighter() {
|
|
1681
1718
|
if (!highlighterInfo.value) {
|
|
1682
1719
|
highlighterInfo.value = await getShikiManager().getHighlighter(theme);
|
|
1720
|
+
isReady.value = true;
|
|
1683
1721
|
}
|
|
1684
1722
|
return highlighterInfo.value;
|
|
1685
1723
|
}
|
|
@@ -1704,41 +1742,787 @@ function useShiki(theme) {
|
|
|
1704
1742
|
return {
|
|
1705
1743
|
highlighterInfo,
|
|
1706
1744
|
isHighlighting,
|
|
1745
|
+
isReady,
|
|
1746
|
+
initHighlighter,
|
|
1707
1747
|
highlight
|
|
1708
1748
|
};
|
|
1709
1749
|
}
|
|
1710
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 isBrowser = typeof window !== "undefined";
|
|
2376
|
+
const hasStreamError = ref8(false);
|
|
2377
|
+
const tokens = reactive([]);
|
|
2378
|
+
const index = ref8(0);
|
|
2379
|
+
let controller = null;
|
|
2380
|
+
let textStream = null;
|
|
2381
|
+
let tokenStream = null;
|
|
2382
|
+
if (isBrowser) {
|
|
2383
|
+
textStream = new ReadableStream({
|
|
2384
|
+
start(_controller) {
|
|
2385
|
+
controller = _controller;
|
|
2386
|
+
}
|
|
2387
|
+
});
|
|
2388
|
+
try {
|
|
2389
|
+
tokenStream = textStream.pipeThrough(
|
|
2390
|
+
new CodeToTokenTransformStream({
|
|
2391
|
+
highlighter: props.highlighter,
|
|
2392
|
+
lang: props.lang,
|
|
2393
|
+
theme: props.theme,
|
|
2394
|
+
allowRecalls: true
|
|
2395
|
+
})
|
|
2396
|
+
);
|
|
2397
|
+
} catch (error) {
|
|
2398
|
+
console.error("Failed to create token stream:", error);
|
|
2399
|
+
hasStreamError.value = true;
|
|
2400
|
+
emit("stream-error");
|
|
2401
|
+
}
|
|
2402
|
+
if (tokenStream) {
|
|
2403
|
+
tokenStream.pipeTo(new WritableStream({
|
|
2404
|
+
write(token) {
|
|
2405
|
+
if ("recall" in token)
|
|
2406
|
+
tokens.splice(tokens.length - token.recall, token.recall);
|
|
2407
|
+
else
|
|
2408
|
+
tokens.push(token);
|
|
2409
|
+
},
|
|
2410
|
+
close: () => {
|
|
2411
|
+
emit("stream-end");
|
|
2412
|
+
}
|
|
2413
|
+
})).catch((error) => {
|
|
2414
|
+
console.error("Stream error:", error);
|
|
2415
|
+
hasStreamError.value = true;
|
|
2416
|
+
emit("stream-error");
|
|
2417
|
+
});
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
watch6(() => props.code, (newCode) => {
|
|
2421
|
+
if (!isBrowser || !controller) return;
|
|
2422
|
+
if (newCode.length > index.value && !hasStreamError.value) {
|
|
2423
|
+
const incremental = newCode.slice(index.value);
|
|
2424
|
+
controller.enqueue(incremental);
|
|
2425
|
+
index.value = newCode.length;
|
|
2426
|
+
}
|
|
2427
|
+
}, { immediate: true });
|
|
2428
|
+
const render24 = () => {
|
|
2429
|
+
if (hasStreamError.value || !isBrowser || tokens.length === 0) {
|
|
2430
|
+
return h("pre", { class: "shiki incremark-code-stream" }, h("code", {}, props.code));
|
|
2431
|
+
}
|
|
2432
|
+
return h(
|
|
2433
|
+
"pre",
|
|
2434
|
+
{ class: "shiki incremark-code-stream" },
|
|
2435
|
+
h(
|
|
2436
|
+
"code",
|
|
2437
|
+
{},
|
|
2438
|
+
renderList(tokens, (token) => h("span", { key: objectId(token), style: token.htmlStyle || getTokenStyleObject(token) }, token.content))
|
|
2439
|
+
)
|
|
2440
|
+
);
|
|
2441
|
+
};
|
|
2442
|
+
onUnmounted6(() => {
|
|
2443
|
+
hasStreamError.value = false;
|
|
2444
|
+
tokens.length = 0;
|
|
2445
|
+
index.value = 0;
|
|
2446
|
+
});
|
|
2447
|
+
const __returned__ = { props, emit, isBrowser, hasStreamError, tokens, index, get controller() {
|
|
2448
|
+
return controller;
|
|
2449
|
+
}, set controller(v) {
|
|
2450
|
+
controller = v;
|
|
2451
|
+
}, get textStream() {
|
|
2452
|
+
return textStream;
|
|
2453
|
+
}, set textStream(v) {
|
|
2454
|
+
textStream = v;
|
|
2455
|
+
}, get tokenStream() {
|
|
2456
|
+
return tokenStream;
|
|
2457
|
+
}, set tokenStream(v) {
|
|
2458
|
+
tokenStream = v;
|
|
2459
|
+
}, render: render24 };
|
|
2460
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2461
|
+
return __returned__;
|
|
2462
|
+
}
|
|
2463
|
+
});
|
|
2464
|
+
|
|
2465
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/CachedCodeRenderer.vue?type=template
|
|
2466
|
+
import { resolveDynamicComponent as _resolveDynamicComponent3, openBlock as _openBlock8, createBlock as _createBlock3 } from "vue";
|
|
2467
|
+
function render8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2468
|
+
return _openBlock8(), _createBlock3(_resolveDynamicComponent3($setup.render));
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
// src/components/CachedCodeRenderer.vue
|
|
2472
|
+
CachedCodeRenderer_default.render = render8;
|
|
2473
|
+
CachedCodeRenderer_default.__file = "src/components/CachedCodeRenderer.vue";
|
|
2474
|
+
var CachedCodeRenderer_default2 = CachedCodeRenderer_default;
|
|
2475
|
+
|
|
1711
2476
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeDefault.vue?type=script
|
|
1712
|
-
var IncremarkCodeDefault_default = /* @__PURE__ */
|
|
2477
|
+
var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent9({
|
|
1713
2478
|
__name: "IncremarkCodeDefault",
|
|
1714
2479
|
props: {
|
|
1715
2480
|
node: { type: null, required: true },
|
|
1716
2481
|
theme: { type: String, required: false, default: "github-dark" },
|
|
1717
2482
|
fallbackTheme: { type: String, required: false, default: "github-dark" },
|
|
1718
|
-
disableHighlight: { type: Boolean, required: false, default: false }
|
|
2483
|
+
disableHighlight: { type: Boolean, required: false, default: false },
|
|
2484
|
+
blockStatus: { type: String, required: false, default: "pending" }
|
|
1719
2485
|
},
|
|
1720
2486
|
setup(__props, { expose: __expose }) {
|
|
1721
2487
|
__expose();
|
|
1722
2488
|
const props = __props;
|
|
1723
|
-
const copied =
|
|
1724
|
-
const highlightedHtml = ref7("");
|
|
2489
|
+
const copied = ref9(false);
|
|
1725
2490
|
const language = computed9(() => props.node.lang || "text");
|
|
1726
2491
|
const code = computed9(() => props.node.value);
|
|
1727
2492
|
const { t } = useLocale();
|
|
1728
|
-
const {
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
2493
|
+
const { highlighterInfo, initHighlighter } = useShiki(props.theme);
|
|
2494
|
+
const isLanguageLoaded = ref9(false);
|
|
2495
|
+
const shouldEnableHighlight = computed9(() => {
|
|
2496
|
+
return !props.disableHighlight && code.value && code.value.length > 0;
|
|
2497
|
+
});
|
|
2498
|
+
watch7([highlighterInfo, language, shouldEnableHighlight], async ([info, lang, shouldHighlight]) => {
|
|
2499
|
+
if (!shouldHighlight) {
|
|
1732
2500
|
return;
|
|
1733
2501
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
2502
|
+
if (!info) {
|
|
2503
|
+
await initHighlighter();
|
|
2504
|
+
} else if (lang && lang !== "text") {
|
|
2505
|
+
if (!info.loadedLanguages.has(lang)) {
|
|
2506
|
+
try {
|
|
2507
|
+
isLanguageLoaded.value = false;
|
|
2508
|
+
const supportedLangs = info.highlighter.getLoadedLanguages();
|
|
2509
|
+
const bundledLangs = await import("shiki").then((m) => Object.keys(m.bundledLanguages || {}));
|
|
2510
|
+
const isSupported = supportedLangs.includes(lang) || bundledLangs.includes(lang);
|
|
2511
|
+
if (isSupported) {
|
|
2512
|
+
await info.highlighter.loadLanguage(lang);
|
|
2513
|
+
info.loadedLanguages.add(lang);
|
|
2514
|
+
}
|
|
2515
|
+
isLanguageLoaded.value = true;
|
|
2516
|
+
} catch {
|
|
2517
|
+
isLanguageLoaded.value = true;
|
|
2518
|
+
}
|
|
2519
|
+
} else {
|
|
2520
|
+
isLanguageLoaded.value = true;
|
|
2521
|
+
}
|
|
2522
|
+
} else {
|
|
2523
|
+
isLanguageLoaded.value = true;
|
|
1739
2524
|
}
|
|
1740
|
-
}
|
|
1741
|
-
watch6([code, () => props.theme], doHighlight, { immediate: true });
|
|
2525
|
+
}, { immediate: true, deep: true });
|
|
1742
2526
|
let copyTimeoutId = null;
|
|
1743
2527
|
async function copyCode() {
|
|
1744
2528
|
if (!isClipboardAvailable2()) return;
|
|
@@ -1754,12 +2538,7 @@ var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent8({
|
|
|
1754
2538
|
} catch {
|
|
1755
2539
|
}
|
|
1756
2540
|
}
|
|
1757
|
-
|
|
1758
|
-
if (copyTimeoutId) {
|
|
1759
|
-
clearTimeout(copyTimeoutId);
|
|
1760
|
-
}
|
|
1761
|
-
});
|
|
1762
|
-
const __returned__ = { props, copied, highlightedHtml, language, code, t, isHighlighting, highlight, doHighlight, get copyTimeoutId() {
|
|
2541
|
+
const __returned__ = { props, copied, language, code, t, highlighterInfo, initHighlighter, isLanguageLoaded, shouldEnableHighlight, get copyTimeoutId() {
|
|
1763
2542
|
return copyTimeoutId;
|
|
1764
2543
|
}, set copyTimeoutId(v) {
|
|
1765
2544
|
copyTimeoutId = v;
|
|
@@ -1767,27 +2546,23 @@ var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent8({
|
|
|
1767
2546
|
return LucideCopy2;
|
|
1768
2547
|
}, get LucideCopyCheck() {
|
|
1769
2548
|
return LucideCopyCheck2;
|
|
1770
|
-
}, SvgIcon: SvgIcon_default2 };
|
|
2549
|
+
}, SvgIcon: SvgIcon_default2, CachedCodeRenderer: CachedCodeRenderer_default2 };
|
|
1771
2550
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1772
2551
|
return __returned__;
|
|
1773
2552
|
}
|
|
1774
2553
|
});
|
|
1775
2554
|
|
|
1776
2555
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeDefault.vue?type=template
|
|
1777
|
-
import { toDisplayString as _toDisplayString5, createElementVNode as _createElementVNode5, createVNode as _createVNode6, createCommentVNode as _createCommentVNode5, openBlock as
|
|
2556
|
+
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";
|
|
1778
2557
|
var _hoisted_17 = { class: "incremark-code" };
|
|
1779
2558
|
var _hoisted_24 = { class: "code-header" };
|
|
1780
2559
|
var _hoisted_34 = { class: "language" };
|
|
1781
2560
|
var _hoisted_44 = ["aria-label", "title"];
|
|
1782
2561
|
var _hoisted_54 = { class: "code-content" };
|
|
1783
|
-
var _hoisted_64 = {
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
var _hoisted_73 = ["innerHTML"];
|
|
1788
|
-
var _hoisted_83 = { class: "code-fallback" };
|
|
1789
|
-
function render8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1790
|
-
return _openBlock8(), _createElementBlock7("div", _hoisted_17, [
|
|
2562
|
+
var _hoisted_64 = { class: "shiki-wrapper" };
|
|
2563
|
+
var _hoisted_73 = { class: "code-fallback" };
|
|
2564
|
+
function render9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2565
|
+
return _openBlock9(), _createElementBlock7("div", _hoisted_17, [
|
|
1791
2566
|
_createElementVNode5("div", _hoisted_24, [
|
|
1792
2567
|
_createElementVNode5(
|
|
1793
2568
|
"span",
|
|
@@ -1809,58 +2584,44 @@ function render8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1809
2584
|
], 8, _hoisted_44)
|
|
1810
2585
|
]),
|
|
1811
2586
|
_createElementVNode5("div", _hoisted_54, [
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
_createCommentVNode5(" \u56DE\u9000\uFF1A\u65E0\u9AD8\u4EAE "),
|
|
1840
|
-
_createElementVNode5("pre", _hoisted_83, [
|
|
1841
|
-
_createElementVNode5(
|
|
1842
|
-
"code",
|
|
1843
|
-
null,
|
|
1844
|
-
_toDisplayString5($setup.code),
|
|
1845
|
-
1
|
|
1846
|
-
/* TEXT */
|
|
1847
|
-
)
|
|
1848
|
-
])
|
|
1849
|
-
],
|
|
1850
|
-
2112
|
|
1851
|
-
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1852
|
-
))
|
|
2587
|
+
_createElementVNode5("div", _hoisted_64, [
|
|
2588
|
+
_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 "),
|
|
2589
|
+
$setup.shouldEnableHighlight && $setup.highlighterInfo && $setup.isLanguageLoaded ? (_openBlock9(), _createBlock4($setup["CachedCodeRenderer"], {
|
|
2590
|
+
key: 0,
|
|
2591
|
+
code: $setup.code,
|
|
2592
|
+
lang: $setup.language,
|
|
2593
|
+
theme: $props.theme,
|
|
2594
|
+
highlighter: $setup.highlighterInfo.highlighter
|
|
2595
|
+
}, null, 8, ["code", "lang", "theme", "highlighter"])) : (_openBlock9(), _createElementBlock7(
|
|
2596
|
+
_Fragment5,
|
|
2597
|
+
{ key: 1 },
|
|
2598
|
+
[
|
|
2599
|
+
_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 "),
|
|
2600
|
+
_createElementVNode5("pre", _hoisted_73, [
|
|
2601
|
+
_createElementVNode5(
|
|
2602
|
+
"code",
|
|
2603
|
+
null,
|
|
2604
|
+
_toDisplayString5($setup.code),
|
|
2605
|
+
1
|
|
2606
|
+
/* TEXT */
|
|
2607
|
+
)
|
|
2608
|
+
])
|
|
2609
|
+
],
|
|
2610
|
+
2112
|
|
2611
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
2612
|
+
))
|
|
2613
|
+
])
|
|
1853
2614
|
])
|
|
1854
2615
|
]);
|
|
1855
2616
|
}
|
|
1856
2617
|
|
|
1857
2618
|
// src/components/IncremarkCodeDefault.vue
|
|
1858
|
-
IncremarkCodeDefault_default.render =
|
|
2619
|
+
IncremarkCodeDefault_default.render = render9;
|
|
1859
2620
|
IncremarkCodeDefault_default.__file = "src/components/IncremarkCodeDefault.vue";
|
|
1860
2621
|
var IncremarkCodeDefault_default2 = IncremarkCodeDefault_default;
|
|
1861
2622
|
|
|
1862
2623
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=script
|
|
1863
|
-
var IncremarkCode_default = /* @__PURE__ */
|
|
2624
|
+
var IncremarkCode_default = /* @__PURE__ */ _defineComponent10({
|
|
1864
2625
|
__name: "IncremarkCode",
|
|
1865
2626
|
props: {
|
|
1866
2627
|
node: { type: null, required: true },
|
|
@@ -1897,20 +2658,20 @@ var IncremarkCode_default = /* @__PURE__ */ _defineComponent9({
|
|
|
1897
2658
|
});
|
|
1898
2659
|
|
|
1899
2660
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=template
|
|
1900
|
-
import { createCommentVNode as _createCommentVNode6, resolveDynamicComponent as
|
|
1901
|
-
function
|
|
1902
|
-
return
|
|
2661
|
+
import { createCommentVNode as _createCommentVNode6, resolveDynamicComponent as _resolveDynamicComponent4, openBlock as _openBlock10, createBlock as _createBlock5, createVNode as _createVNode7, Fragment as _Fragment6, createElementBlock as _createElementBlock8 } from "vue";
|
|
2662
|
+
function render10(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2663
|
+
return _openBlock10(), _createElementBlock8(
|
|
1903
2664
|
_Fragment6,
|
|
1904
2665
|
null,
|
|
1905
2666
|
[
|
|
1906
2667
|
_createCommentVNode6(" \u81EA\u5B9A\u4E49\u4EE3\u7801\u5757\u7EC4\u4EF6 "),
|
|
1907
|
-
$setup.CustomCodeBlock ? (
|
|
2668
|
+
$setup.CustomCodeBlock ? (_openBlock10(), _createBlock5(_resolveDynamicComponent4($setup.CustomCodeBlock), {
|
|
1908
2669
|
key: 0,
|
|
1909
2670
|
"code-str": $props.node.value,
|
|
1910
2671
|
lang: $setup.language,
|
|
1911
2672
|
completed: $props.blockStatus === "completed",
|
|
1912
2673
|
takeOver: $props.codeBlockConfigs?.[$setup.language]?.takeOver
|
|
1913
|
-
}, null, 8, ["code-str", "lang", "completed", "takeOver"])) : $setup.isMermaid ? (
|
|
2674
|
+
}, null, 8, ["code-str", "lang", "completed", "takeOver"])) : $setup.isMermaid ? (_openBlock10(), _createElementBlock8(
|
|
1914
2675
|
_Fragment6,
|
|
1915
2676
|
{ key: 1 },
|
|
1916
2677
|
[
|
|
@@ -1922,17 +2683,18 @@ function render9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1922
2683
|
],
|
|
1923
2684
|
2112
|
|
1924
2685
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1925
|
-
)) : (
|
|
2686
|
+
)) : (_openBlock10(), _createElementBlock8(
|
|
1926
2687
|
_Fragment6,
|
|
1927
2688
|
{ key: 2 },
|
|
1928
2689
|
[
|
|
1929
|
-
_createCommentVNode6(" \u9ED8\u8BA4\u4EE3\u7801\u5757\u6E32\u67D3\uFF08\u652F\u6301\u7528\u6237\u81EA\u5B9A\u4E49\uFF09
|
|
1930
|
-
(
|
|
2690
|
+
_createCommentVNode6(" \u9ED8\u8BA4\u4EE3\u7801\u5757\u6E32\u67D3\uFF08\u652F\u6301\u7528\u6237\u81EA\u5B9A\u4E49\uFF0C\u4F7F\u7528 stream \u9AD8\u4EAE\uFF09"),
|
|
2691
|
+
(_openBlock10(), _createBlock5(_resolveDynamicComponent4($props.defaultCodeComponent), {
|
|
1931
2692
|
node: $props.node,
|
|
1932
2693
|
theme: $props.theme,
|
|
1933
2694
|
"fallback-theme": $props.fallbackTheme,
|
|
1934
|
-
"disable-highlight": $props.disableHighlight
|
|
1935
|
-
|
|
2695
|
+
"disable-highlight": $props.disableHighlight,
|
|
2696
|
+
"block-status": $props.blockStatus
|
|
2697
|
+
}, null, 8, ["node", "theme", "fallback-theme", "disable-highlight", "block-status"]))
|
|
1936
2698
|
],
|
|
1937
2699
|
2112
|
|
1938
2700
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
@@ -1944,14 +2706,14 @@ function render9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1944
2706
|
}
|
|
1945
2707
|
|
|
1946
2708
|
// src/components/IncremarkCode.vue
|
|
1947
|
-
IncremarkCode_default.render =
|
|
2709
|
+
IncremarkCode_default.render = render10;
|
|
1948
2710
|
IncremarkCode_default.__file = "src/components/IncremarkCode.vue";
|
|
1949
2711
|
var IncremarkCode_default2 = IncremarkCode_default;
|
|
1950
2712
|
|
|
1951
2713
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkList.vue?type=script
|
|
1952
|
-
import { defineComponent as
|
|
2714
|
+
import { defineComponent as _defineComponent11 } from "vue";
|
|
1953
2715
|
import { computed as computed11 } from "vue";
|
|
1954
|
-
var IncremarkList_default = /* @__PURE__ */
|
|
2716
|
+
var IncremarkList_default = /* @__PURE__ */ _defineComponent11({
|
|
1955
2717
|
...{
|
|
1956
2718
|
name: "IncremarkList"
|
|
1957
2719
|
},
|
|
@@ -1988,31 +2750,31 @@ var IncremarkList_default = /* @__PURE__ */ _defineComponent10({
|
|
|
1988
2750
|
});
|
|
1989
2751
|
|
|
1990
2752
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkList.vue?type=template
|
|
1991
|
-
import { renderList as _renderList3, Fragment as _Fragment7, openBlock as
|
|
2753
|
+
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";
|
|
1992
2754
|
var _hoisted_18 = {
|
|
1993
2755
|
key: 0,
|
|
1994
2756
|
class: "task-label"
|
|
1995
2757
|
};
|
|
1996
2758
|
var _hoisted_25 = ["checked"];
|
|
1997
2759
|
var _hoisted_35 = { class: "task-content" };
|
|
1998
|
-
function
|
|
1999
|
-
return
|
|
2760
|
+
function render11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2761
|
+
return _openBlock11(), _createBlock6(_resolveDynamicComponent5($setup.tag), {
|
|
2000
2762
|
class: _normalizeClass3(["incremark-list", { "task-list": $props.node.children.some((item) => item.checked !== null && item.checked !== void 0) }]),
|
|
2001
2763
|
start: $props.node.start || void 0
|
|
2002
2764
|
}, {
|
|
2003
2765
|
default: _withCtx3(() => [
|
|
2004
|
-
(
|
|
2766
|
+
(_openBlock11(true), _createElementBlock9(
|
|
2005
2767
|
_Fragment7,
|
|
2006
2768
|
null,
|
|
2007
2769
|
_renderList3($props.node.children, (item, index) => {
|
|
2008
|
-
return
|
|
2770
|
+
return _openBlock11(), _createElementBlock9(
|
|
2009
2771
|
"li",
|
|
2010
2772
|
{
|
|
2011
2773
|
key: index,
|
|
2012
2774
|
class: _normalizeClass3(["incremark-list-item", { "task-item": item.checked !== null && item.checked !== void 0 }])
|
|
2013
2775
|
},
|
|
2014
2776
|
[
|
|
2015
|
-
item.checked !== null && item.checked !== void 0 ? (
|
|
2777
|
+
item.checked !== null && item.checked !== void 0 ? (_openBlock11(), _createElementBlock9("label", _hoisted_18, [
|
|
2016
2778
|
_createElementVNode6("input", {
|
|
2017
2779
|
type: "checkbox",
|
|
2018
2780
|
checked: item.checked,
|
|
@@ -2024,7 +2786,7 @@ function render10(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2024
2786
|
nodes: $setup.getItemInlineContent(item)
|
|
2025
2787
|
}, null, 8, ["nodes"])
|
|
2026
2788
|
])
|
|
2027
|
-
])) : (
|
|
2789
|
+
])) : (_openBlock11(), _createElementBlock9(
|
|
2028
2790
|
_Fragment7,
|
|
2029
2791
|
{ key: 1 },
|
|
2030
2792
|
[
|
|
@@ -2032,11 +2794,11 @@ function render10(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2032
2794
|
nodes: $setup.getItemInlineContent(item)
|
|
2033
2795
|
}, null, 8, ["nodes"]),
|
|
2034
2796
|
_createCommentVNode7(" \u9012\u5F52\u6E32\u67D3\u6240\u6709\u5757\u7EA7\u5185\u5BB9\uFF08\u5D4C\u5957\u5217\u8868\u3001heading\u3001blockquote\u3001code\u3001table \u7B49\uFF09 "),
|
|
2035
|
-
$setup.hasBlockChildren(item) ? (
|
|
2797
|
+
$setup.hasBlockChildren(item) ? (_openBlock11(true), _createElementBlock9(
|
|
2036
2798
|
_Fragment7,
|
|
2037
2799
|
{ key: 0 },
|
|
2038
2800
|
_renderList3($setup.getItemBlockChildren(item), (child, childIndex) => {
|
|
2039
|
-
return
|
|
2801
|
+
return _openBlock11(), _createBlock6($setup["IncremarkRenderer"], {
|
|
2040
2802
|
key: childIndex,
|
|
2041
2803
|
node: child
|
|
2042
2804
|
}, null, 8, ["node"]);
|
|
@@ -2063,13 +2825,13 @@ function render10(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2063
2825
|
}
|
|
2064
2826
|
|
|
2065
2827
|
// src/components/IncremarkList.vue
|
|
2066
|
-
IncremarkList_default.render =
|
|
2828
|
+
IncremarkList_default.render = render11;
|
|
2067
2829
|
IncremarkList_default.__file = "src/components/IncremarkList.vue";
|
|
2068
2830
|
var IncremarkList_default2 = IncremarkList_default;
|
|
2069
2831
|
|
|
2070
2832
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkTable.vue?type=script
|
|
2071
|
-
import { defineComponent as
|
|
2072
|
-
var IncremarkTable_default = /* @__PURE__ */
|
|
2833
|
+
import { defineComponent as _defineComponent12 } from "vue";
|
|
2834
|
+
var IncremarkTable_default = /* @__PURE__ */ _defineComponent12({
|
|
2073
2835
|
__name: "IncremarkTable",
|
|
2074
2836
|
props: {
|
|
2075
2837
|
node: { type: null, required: true }
|
|
@@ -2086,20 +2848,20 @@ var IncremarkTable_default = /* @__PURE__ */ _defineComponent11({
|
|
|
2086
2848
|
});
|
|
2087
2849
|
|
|
2088
2850
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkTable.vue?type=template
|
|
2089
|
-
import { renderList as _renderList4, Fragment as _Fragment8, openBlock as
|
|
2851
|
+
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";
|
|
2090
2852
|
var _hoisted_19 = { class: "incremark-table-wrapper" };
|
|
2091
2853
|
var _hoisted_26 = { class: "incremark-table" };
|
|
2092
2854
|
var _hoisted_36 = { key: 0 };
|
|
2093
|
-
function
|
|
2094
|
-
return
|
|
2855
|
+
function render12(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2856
|
+
return _openBlock12(), _createElementBlock10("div", _hoisted_19, [
|
|
2095
2857
|
_createElementVNode7("table", _hoisted_26, [
|
|
2096
2858
|
_createElementVNode7("thead", null, [
|
|
2097
|
-
$props.node.children[0] ? (
|
|
2098
|
-
(
|
|
2859
|
+
$props.node.children[0] ? (_openBlock12(), _createElementBlock10("tr", _hoisted_36, [
|
|
2860
|
+
(_openBlock12(true), _createElementBlock10(
|
|
2099
2861
|
_Fragment8,
|
|
2100
2862
|
null,
|
|
2101
2863
|
_renderList4($props.node.children[0].children, (cell, cellIndex) => {
|
|
2102
|
-
return
|
|
2864
|
+
return _openBlock12(), _createElementBlock10(
|
|
2103
2865
|
"th",
|
|
2104
2866
|
{
|
|
2105
2867
|
key: cellIndex,
|
|
@@ -2120,16 +2882,16 @@ function render11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2120
2882
|
])) : _createCommentVNode8("v-if", true)
|
|
2121
2883
|
]),
|
|
2122
2884
|
_createElementVNode7("tbody", null, [
|
|
2123
|
-
(
|
|
2885
|
+
(_openBlock12(true), _createElementBlock10(
|
|
2124
2886
|
_Fragment8,
|
|
2125
2887
|
null,
|
|
2126
2888
|
_renderList4($props.node.children.slice(1), (row, rowIndex) => {
|
|
2127
|
-
return
|
|
2128
|
-
(
|
|
2889
|
+
return _openBlock12(), _createElementBlock10("tr", { key: rowIndex }, [
|
|
2890
|
+
(_openBlock12(true), _createElementBlock10(
|
|
2129
2891
|
_Fragment8,
|
|
2130
2892
|
null,
|
|
2131
2893
|
_renderList4(row.children, (cell, cellIndex) => {
|
|
2132
|
-
return
|
|
2894
|
+
return _openBlock12(), _createElementBlock10(
|
|
2133
2895
|
"td",
|
|
2134
2896
|
{
|
|
2135
2897
|
key: cellIndex,
|
|
@@ -2158,13 +2920,13 @@ function render11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2158
2920
|
}
|
|
2159
2921
|
|
|
2160
2922
|
// src/components/IncremarkTable.vue
|
|
2161
|
-
IncremarkTable_default.render =
|
|
2923
|
+
IncremarkTable_default.render = render12;
|
|
2162
2924
|
IncremarkTable_default.__file = "src/components/IncremarkTable.vue";
|
|
2163
2925
|
var IncremarkTable_default2 = IncremarkTable_default;
|
|
2164
2926
|
|
|
2165
2927
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkBlockquote.vue?type=script
|
|
2166
|
-
import { defineComponent as
|
|
2167
|
-
var IncremarkBlockquote_default = /* @__PURE__ */
|
|
2928
|
+
import { defineComponent as _defineComponent13 } from "vue";
|
|
2929
|
+
var IncremarkBlockquote_default = /* @__PURE__ */ _defineComponent13({
|
|
2168
2930
|
__name: "IncremarkBlockquote",
|
|
2169
2931
|
props: {
|
|
2170
2932
|
node: { type: null, required: true }
|
|
@@ -2178,15 +2940,15 @@ var IncremarkBlockquote_default = /* @__PURE__ */ _defineComponent12({
|
|
|
2178
2940
|
});
|
|
2179
2941
|
|
|
2180
2942
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkBlockquote.vue?type=template
|
|
2181
|
-
import { renderList as _renderList5, Fragment as _Fragment9, openBlock as
|
|
2943
|
+
import { renderList as _renderList5, Fragment as _Fragment9, openBlock as _openBlock13, createElementBlock as _createElementBlock11, createBlock as _createBlock7 } from "vue";
|
|
2182
2944
|
var _hoisted_110 = { class: "incremark-blockquote" };
|
|
2183
|
-
function
|
|
2184
|
-
return
|
|
2185
|
-
(
|
|
2945
|
+
function render13(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2946
|
+
return _openBlock13(), _createElementBlock11("blockquote", _hoisted_110, [
|
|
2947
|
+
(_openBlock13(true), _createElementBlock11(
|
|
2186
2948
|
_Fragment9,
|
|
2187
2949
|
null,
|
|
2188
2950
|
_renderList5($props.node.children, (child, index) => {
|
|
2189
|
-
return
|
|
2951
|
+
return _openBlock13(), _createBlock7($setup["IncremarkRenderer"], {
|
|
2190
2952
|
key: index,
|
|
2191
2953
|
node: child
|
|
2192
2954
|
}, null, 8, ["node"]);
|
|
@@ -2198,13 +2960,13 @@ function render12(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2198
2960
|
}
|
|
2199
2961
|
|
|
2200
2962
|
// src/components/IncremarkBlockquote.vue
|
|
2201
|
-
IncremarkBlockquote_default.render =
|
|
2963
|
+
IncremarkBlockquote_default.render = render13;
|
|
2202
2964
|
IncremarkBlockquote_default.__file = "src/components/IncremarkBlockquote.vue";
|
|
2203
2965
|
var IncremarkBlockquote_default2 = IncremarkBlockquote_default;
|
|
2204
2966
|
|
|
2205
2967
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkThematicBreak.vue?type=script
|
|
2206
|
-
import { defineComponent as
|
|
2207
|
-
var IncremarkThematicBreak_default = /* @__PURE__ */
|
|
2968
|
+
import { defineComponent as _defineComponent14 } from "vue";
|
|
2969
|
+
var IncremarkThematicBreak_default = /* @__PURE__ */ _defineComponent14({
|
|
2208
2970
|
__name: "IncremarkThematicBreak",
|
|
2209
2971
|
setup(__props, { expose: __expose }) {
|
|
2210
2972
|
__expose();
|
|
@@ -2215,20 +2977,20 @@ var IncremarkThematicBreak_default = /* @__PURE__ */ _defineComponent13({
|
|
|
2215
2977
|
});
|
|
2216
2978
|
|
|
2217
2979
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkThematicBreak.vue?type=template
|
|
2218
|
-
import { openBlock as
|
|
2980
|
+
import { openBlock as _openBlock14, createElementBlock as _createElementBlock12 } from "vue";
|
|
2219
2981
|
var _hoisted_111 = { class: "incremark-hr" };
|
|
2220
|
-
function
|
|
2221
|
-
return
|
|
2982
|
+
function render14(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2983
|
+
return _openBlock14(), _createElementBlock12("hr", _hoisted_111);
|
|
2222
2984
|
}
|
|
2223
2985
|
|
|
2224
2986
|
// src/components/IncremarkThematicBreak.vue
|
|
2225
|
-
IncremarkThematicBreak_default.render =
|
|
2987
|
+
IncremarkThematicBreak_default.render = render14;
|
|
2226
2988
|
IncremarkThematicBreak_default.__file = "src/components/IncremarkThematicBreak.vue";
|
|
2227
2989
|
var IncremarkThematicBreak_default2 = IncremarkThematicBreak_default;
|
|
2228
2990
|
|
|
2229
2991
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContainer.vue?type=script
|
|
2230
|
-
import { defineComponent as
|
|
2231
|
-
var IncremarkContainer_default = /* @__PURE__ */
|
|
2992
|
+
import { defineComponent as _defineComponent15 } from "vue";
|
|
2993
|
+
var IncremarkContainer_default = /* @__PURE__ */ _defineComponent15({
|
|
2232
2994
|
__name: "IncremarkContainer",
|
|
2233
2995
|
props: {
|
|
2234
2996
|
node: { type: Object, required: true },
|
|
@@ -2260,29 +3022,29 @@ var IncremarkContainer_default = /* @__PURE__ */ _defineComponent14({
|
|
|
2260
3022
|
});
|
|
2261
3023
|
|
|
2262
3024
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContainer.vue?type=template
|
|
2263
|
-
import { createCommentVNode as _createCommentVNode9, renderList as _renderList6, Fragment as _Fragment10, openBlock as
|
|
3025
|
+
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";
|
|
2264
3026
|
var _hoisted_112 = {
|
|
2265
3027
|
key: 0,
|
|
2266
3028
|
class: "incremark-container-content"
|
|
2267
3029
|
};
|
|
2268
|
-
function
|
|
2269
|
-
return
|
|
3030
|
+
function render15(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3031
|
+
return _openBlock15(), _createElementBlock13(
|
|
2270
3032
|
_Fragment10,
|
|
2271
3033
|
null,
|
|
2272
3034
|
[
|
|
2273
3035
|
_createCommentVNode9(" \u5982\u679C\u6709\u81EA\u5B9A\u4E49\u5BB9\u5668\u7EC4\u4EF6\uFF0C\u4F7F\u7528\u81EA\u5B9A\u4E49\u7EC4\u4EF6 "),
|
|
2274
|
-
$setup.hasCustomContainer ? (
|
|
3036
|
+
$setup.hasCustomContainer ? (_openBlock15(), _createBlock8(_resolveDynamicComponent6($setup.CustomContainer), {
|
|
2275
3037
|
key: 0,
|
|
2276
3038
|
name: $setup.containerName,
|
|
2277
3039
|
options: $setup.options
|
|
2278
3040
|
}, {
|
|
2279
3041
|
default: _withCtx4(() => [
|
|
2280
3042
|
_createCommentVNode9(" \u5C06\u5BB9\u5668\u5185\u5BB9\u4F5C\u4E3A\u9ED8\u8BA4 slot \u4F20\u9012 "),
|
|
2281
|
-
$props.node.children && $props.node.children.length > 0 ? (
|
|
3043
|
+
$props.node.children && $props.node.children.length > 0 ? (_openBlock15(true), _createElementBlock13(
|
|
2282
3044
|
_Fragment10,
|
|
2283
3045
|
{ key: 0 },
|
|
2284
3046
|
_renderList6($props.node.children, (child, index) => {
|
|
2285
|
-
return
|
|
3047
|
+
return _openBlock15(), _createBlock8($setup["IncremarkRenderer"], {
|
|
2286
3048
|
key: index,
|
|
2287
3049
|
node: child
|
|
2288
3050
|
}, null, 8, ["node"]);
|
|
@@ -2293,7 +3055,7 @@ function render14(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2293
3055
|
]),
|
|
2294
3056
|
_: 1
|
|
2295
3057
|
/* STABLE */
|
|
2296
|
-
}, 8, ["name", "options"])) : (
|
|
3058
|
+
}, 8, ["name", "options"])) : (_openBlock15(), _createElementBlock13(
|
|
2297
3059
|
_Fragment10,
|
|
2298
3060
|
{ key: 1 },
|
|
2299
3061
|
[
|
|
@@ -2304,12 +3066,12 @@ function render14(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2304
3066
|
class: _normalizeClass5(["incremark-container", `incremark-container-${$setup.containerName}`])
|
|
2305
3067
|
},
|
|
2306
3068
|
[
|
|
2307
|
-
$props.node.children && $props.node.children.length > 0 ? (
|
|
2308
|
-
(
|
|
3069
|
+
$props.node.children && $props.node.children.length > 0 ? (_openBlock15(), _createElementBlock13("div", _hoisted_112, [
|
|
3070
|
+
(_openBlock15(true), _createElementBlock13(
|
|
2309
3071
|
_Fragment10,
|
|
2310
3072
|
null,
|
|
2311
3073
|
_renderList6($props.node.children, (child, index) => {
|
|
2312
|
-
return
|
|
3074
|
+
return _openBlock15(), _createBlock8($setup["IncremarkRenderer"], {
|
|
2313
3075
|
key: index,
|
|
2314
3076
|
node: child
|
|
2315
3077
|
}, null, 8, ["node"]);
|
|
@@ -2333,13 +3095,13 @@ function render14(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2333
3095
|
}
|
|
2334
3096
|
|
|
2335
3097
|
// src/components/IncremarkContainer.vue
|
|
2336
|
-
IncremarkContainer_default.render =
|
|
3098
|
+
IncremarkContainer_default.render = render15;
|
|
2337
3099
|
IncremarkContainer_default.__file = "src/components/IncremarkContainer.vue";
|
|
2338
3100
|
var IncremarkContainer_default2 = IncremarkContainer_default;
|
|
2339
3101
|
|
|
2340
3102
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkDefault.vue?type=script
|
|
2341
|
-
import { defineComponent as
|
|
2342
|
-
var IncremarkDefault_default = /* @__PURE__ */
|
|
3103
|
+
import { defineComponent as _defineComponent16 } from "vue";
|
|
3104
|
+
var IncremarkDefault_default = /* @__PURE__ */ _defineComponent16({
|
|
2343
3105
|
__name: "IncremarkDefault",
|
|
2344
3106
|
props: {
|
|
2345
3107
|
node: { type: null, required: true }
|
|
@@ -2353,11 +3115,11 @@ var IncremarkDefault_default = /* @__PURE__ */ _defineComponent15({
|
|
|
2353
3115
|
});
|
|
2354
3116
|
|
|
2355
3117
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkDefault.vue?type=template
|
|
2356
|
-
import { toDisplayString as _toDisplayString6, createElementVNode as _createElementVNode9, openBlock as
|
|
3118
|
+
import { toDisplayString as _toDisplayString6, createElementVNode as _createElementVNode9, openBlock as _openBlock16, createElementBlock as _createElementBlock14 } from "vue";
|
|
2357
3119
|
var _hoisted_113 = { class: "incremark-default" };
|
|
2358
3120
|
var _hoisted_27 = { class: "type-badge" };
|
|
2359
|
-
function
|
|
2360
|
-
return
|
|
3121
|
+
function render16(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3122
|
+
return _openBlock16(), _createElementBlock14("div", _hoisted_113, [
|
|
2361
3123
|
_createElementVNode9(
|
|
2362
3124
|
"span",
|
|
2363
3125
|
_hoisted_27,
|
|
@@ -2376,12 +3138,12 @@ function render15(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2376
3138
|
}
|
|
2377
3139
|
|
|
2378
3140
|
// src/components/IncremarkDefault.vue
|
|
2379
|
-
IncremarkDefault_default.render =
|
|
3141
|
+
IncremarkDefault_default.render = render16;
|
|
2380
3142
|
IncremarkDefault_default.__file = "src/components/IncremarkDefault.vue";
|
|
2381
3143
|
var IncremarkDefault_default2 = IncremarkDefault_default;
|
|
2382
3144
|
|
|
2383
3145
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=script
|
|
2384
|
-
var IncremarkRenderer_default2 = /* @__PURE__ */
|
|
3146
|
+
var IncremarkRenderer_default2 = /* @__PURE__ */ _defineComponent17({
|
|
2385
3147
|
__name: "IncremarkRenderer",
|
|
2386
3148
|
props: {
|
|
2387
3149
|
node: { type: null, required: true },
|
|
@@ -2429,18 +3191,18 @@ var IncremarkRenderer_default2 = /* @__PURE__ */ _defineComponent16({
|
|
|
2429
3191
|
});
|
|
2430
3192
|
|
|
2431
3193
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=template
|
|
2432
|
-
import { createCommentVNode as _createCommentVNode10, toDisplayString as _toDisplayString7, createElementVNode as _createElementVNode10, openBlock as
|
|
3194
|
+
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";
|
|
2433
3195
|
var _hoisted_114 = {
|
|
2434
3196
|
key: 0,
|
|
2435
3197
|
class: "incremark-html-code"
|
|
2436
3198
|
};
|
|
2437
|
-
function
|
|
2438
|
-
return
|
|
3199
|
+
function render17(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3200
|
+
return _openBlock17(), _createElementBlock15(
|
|
2439
3201
|
_Fragment11,
|
|
2440
3202
|
null,
|
|
2441
3203
|
[
|
|
2442
3204
|
_createCommentVNode10(" HTML \u8282\u70B9\uFF1A\u6E32\u67D3\u4E3A\u4EE3\u7801\u5757\u663E\u793A\u6E90\u4EE3\u7801 "),
|
|
2443
|
-
$setup.isHtmlNode($props.node) ? (
|
|
3205
|
+
$setup.isHtmlNode($props.node) ? (_openBlock17(), _createElementBlock15("pre", _hoisted_114, [
|
|
2444
3206
|
_createElementVNode10(
|
|
2445
3207
|
"code",
|
|
2446
3208
|
null,
|
|
@@ -2448,7 +3210,7 @@ function render16(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2448
3210
|
1
|
|
2449
3211
|
/* TEXT */
|
|
2450
3212
|
)
|
|
2451
|
-
])) : $setup.isContainerNode($props.node) ? (
|
|
3213
|
+
])) : $setup.isContainerNode($props.node) ? (_openBlock17(), _createElementBlock15(
|
|
2452
3214
|
_Fragment11,
|
|
2453
3215
|
{ key: 1 },
|
|
2454
3216
|
[
|
|
@@ -2460,7 +3222,7 @@ function render16(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2460
3222
|
],
|
|
2461
3223
|
2112
|
|
2462
3224
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
2463
|
-
)) : $props.node.type === "code" ? (
|
|
3225
|
+
)) : $props.node.type === "code" ? (_openBlock17(), _createElementBlock15(
|
|
2464
3226
|
_Fragment11,
|
|
2465
3227
|
{ key: 2 },
|
|
2466
3228
|
[
|
|
@@ -2475,12 +3237,12 @@ function render16(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2475
3237
|
],
|
|
2476
3238
|
2112
|
|
2477
3239
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
2478
|
-
)) : (
|
|
3240
|
+
)) : (_openBlock17(), _createElementBlock15(
|
|
2479
3241
|
_Fragment11,
|
|
2480
3242
|
{ key: 3 },
|
|
2481
3243
|
[
|
|
2482
3244
|
_createCommentVNode10(" \u5176\u4ED6\u8282\u70B9\uFF1A\u4F7F\u7528\u5BF9\u5E94\u7EC4\u4EF6 "),
|
|
2483
|
-
(
|
|
3245
|
+
(_openBlock17(), _createBlock9(_resolveDynamicComponent7($setup.getComponent($props.node.type)), {
|
|
2484
3246
|
node: $props.node
|
|
2485
3247
|
}, null, 8, ["node"]))
|
|
2486
3248
|
],
|
|
@@ -2494,14 +3256,14 @@ function render16(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2494
3256
|
}
|
|
2495
3257
|
|
|
2496
3258
|
// src/components/IncremarkRenderer.vue
|
|
2497
|
-
IncremarkRenderer_default2.render =
|
|
3259
|
+
IncremarkRenderer_default2.render = render17;
|
|
2498
3260
|
IncremarkRenderer_default2.__file = "src/components/IncremarkRenderer.vue";
|
|
2499
3261
|
var IncremarkRenderer_default = IncremarkRenderer_default2;
|
|
2500
3262
|
|
|
2501
3263
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkFootnotes.vue?type=script
|
|
2502
|
-
import { defineComponent as
|
|
3264
|
+
import { defineComponent as _defineComponent18 } from "vue";
|
|
2503
3265
|
import { computed as computed13 } from "vue";
|
|
2504
|
-
var IncremarkFootnotes_default = /* @__PURE__ */
|
|
3266
|
+
var IncremarkFootnotes_default = /* @__PURE__ */ _defineComponent18({
|
|
2505
3267
|
__name: "IncremarkFootnotes",
|
|
2506
3268
|
setup(__props, { expose: __expose }) {
|
|
2507
3269
|
__expose();
|
|
@@ -2520,7 +3282,7 @@ var IncremarkFootnotes_default = /* @__PURE__ */ _defineComponent17({
|
|
|
2520
3282
|
});
|
|
2521
3283
|
|
|
2522
3284
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkFootnotes.vue?type=template
|
|
2523
|
-
import { createElementVNode as _createElementVNode11, renderList as _renderList7, Fragment as _Fragment12, openBlock as
|
|
3285
|
+
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";
|
|
2524
3286
|
var _hoisted_115 = {
|
|
2525
3287
|
key: 0,
|
|
2526
3288
|
class: "incremark-footnotes"
|
|
@@ -2531,8 +3293,8 @@ var _hoisted_45 = { class: "incremark-footnote-content" };
|
|
|
2531
3293
|
var _hoisted_55 = { class: "incremark-footnote-number" };
|
|
2532
3294
|
var _hoisted_65 = { class: "incremark-footnote-body" };
|
|
2533
3295
|
var _hoisted_74 = ["href"];
|
|
2534
|
-
function
|
|
2535
|
-
return $setup.hasFootnotes ? (
|
|
3296
|
+
function render18(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3297
|
+
return $setup.hasFootnotes ? (_openBlock18(), _createElementBlock16("section", _hoisted_115, [
|
|
2536
3298
|
_cache[0] || (_cache[0] = _createElementVNode11(
|
|
2537
3299
|
"hr",
|
|
2538
3300
|
{ class: "incremark-footnotes-divider" },
|
|
@@ -2541,11 +3303,11 @@ function render17(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2541
3303
|
/* CACHED */
|
|
2542
3304
|
)),
|
|
2543
3305
|
_createElementVNode11("ol", _hoisted_28, [
|
|
2544
|
-
(
|
|
3306
|
+
(_openBlock18(true), _createElementBlock16(
|
|
2545
3307
|
_Fragment12,
|
|
2546
3308
|
null,
|
|
2547
3309
|
_renderList7($setup.orderedFootnotes, (item, index) => {
|
|
2548
|
-
return
|
|
3310
|
+
return _openBlock18(), _createElementBlock16("li", {
|
|
2549
3311
|
key: item.identifier,
|
|
2550
3312
|
id: `fn-${item.identifier}`,
|
|
2551
3313
|
class: "incremark-footnote-item"
|
|
@@ -2561,11 +3323,11 @@ function render17(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2561
3323
|
),
|
|
2562
3324
|
_createCommentVNode11(" \u811A\u6CE8\u5185\u5BB9 "),
|
|
2563
3325
|
_createElementVNode11("div", _hoisted_65, [
|
|
2564
|
-
(
|
|
3326
|
+
(_openBlock18(true), _createElementBlock16(
|
|
2565
3327
|
_Fragment12,
|
|
2566
3328
|
null,
|
|
2567
3329
|
_renderList7(item.definition.children, (child, childIndex) => {
|
|
2568
|
-
return
|
|
3330
|
+
return _openBlock18(), _createBlock10($setup["IncremarkRenderer"], {
|
|
2569
3331
|
key: childIndex,
|
|
2570
3332
|
node: child
|
|
2571
3333
|
}, null, 8, ["node"]);
|
|
@@ -2591,12 +3353,12 @@ function render17(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2591
3353
|
}
|
|
2592
3354
|
|
|
2593
3355
|
// src/components/IncremarkFootnotes.vue
|
|
2594
|
-
IncremarkFootnotes_default.render =
|
|
3356
|
+
IncremarkFootnotes_default.render = render18;
|
|
2595
3357
|
IncremarkFootnotes_default.__file = "src/components/IncremarkFootnotes.vue";
|
|
2596
3358
|
var IncremarkFootnotes_default2 = IncremarkFootnotes_default;
|
|
2597
3359
|
|
|
2598
3360
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=script
|
|
2599
|
-
var Incremark_default = /* @__PURE__ */
|
|
3361
|
+
var Incremark_default = /* @__PURE__ */ _defineComponent19({
|
|
2600
3362
|
__name: "Incremark",
|
|
2601
3363
|
props: {
|
|
2602
3364
|
blocks: { type: Array, required: false, default: () => [] },
|
|
@@ -2630,20 +3392,20 @@ var Incremark_default = /* @__PURE__ */ _defineComponent18({
|
|
|
2630
3392
|
});
|
|
2631
3393
|
|
|
2632
3394
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=template
|
|
2633
|
-
import { createCommentVNode as _createCommentVNode12, renderList as _renderList8, Fragment as _Fragment13, openBlock as
|
|
3395
|
+
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";
|
|
2634
3396
|
var _hoisted_116 = { class: "incremark" };
|
|
2635
|
-
function
|
|
2636
|
-
return
|
|
3397
|
+
function render19(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3398
|
+
return _openBlock19(), _createElementBlock17("div", _hoisted_116, [
|
|
2637
3399
|
_createCommentVNode12(" \u4E3B\u8981\u5185\u5BB9\u5757 "),
|
|
2638
|
-
(
|
|
3400
|
+
(_openBlock19(true), _createElementBlock17(
|
|
2639
3401
|
_Fragment13,
|
|
2640
3402
|
null,
|
|
2641
3403
|
_renderList8($setup.actualBlocks, (block) => {
|
|
2642
|
-
return
|
|
3404
|
+
return _openBlock19(), _createElementBlock17(
|
|
2643
3405
|
_Fragment13,
|
|
2644
3406
|
null,
|
|
2645
3407
|
[
|
|
2646
|
-
block.node.type !== "definition" && block.node.type !== "footnoteDefinition" ? (
|
|
3408
|
+
block.node.type !== "definition" && block.node.type !== "footnoteDefinition" ? (_openBlock19(), _createElementBlock17(
|
|
2647
3409
|
"div",
|
|
2648
3410
|
{
|
|
2649
3411
|
key: block.id,
|
|
@@ -2655,7 +3417,6 @@ function render18(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2655
3417
|
])
|
|
2656
3418
|
},
|
|
2657
3419
|
[
|
|
2658
|
-
_createCommentVNode12(" \u4F7F\u7528 IncremarkRenderer \u7EDF\u4E00\u5904\u7406\u6240\u6709\u8282\u70B9\u7C7B\u578B "),
|
|
2659
3420
|
_createVNode11($setup["IncremarkRenderer"], {
|
|
2660
3421
|
node: block.node,
|
|
2661
3422
|
"block-status": block.status,
|
|
@@ -2677,19 +3438,19 @@ function render18(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2677
3438
|
/* UNKEYED_FRAGMENT */
|
|
2678
3439
|
)),
|
|
2679
3440
|
_createCommentVNode12(" \u811A\u6CE8\u5217\u8868\uFF08\u4EC5\u5728\u5185\u5BB9\u5B8C\u5168\u663E\u793A\u540E\u663E\u793A\uFF09 "),
|
|
2680
|
-
$setup.actualIsDisplayComplete && $setup.footnoteReferenceOrder.length > 0 ? (
|
|
3441
|
+
$setup.actualIsDisplayComplete && $setup.footnoteReferenceOrder.length > 0 ? (_openBlock19(), _createBlock11($setup["IncremarkFootnotes"], { key: 0 })) : _createCommentVNode12("v-if", true)
|
|
2681
3442
|
]);
|
|
2682
3443
|
}
|
|
2683
3444
|
|
|
2684
3445
|
// src/components/Incremark.vue
|
|
2685
|
-
Incremark_default.render =
|
|
3446
|
+
Incremark_default.render = render19;
|
|
2686
3447
|
Incremark_default.__file = "src/components/Incremark.vue";
|
|
2687
3448
|
var Incremark_default2 = Incremark_default;
|
|
2688
3449
|
|
|
2689
3450
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContent.vue?type=script
|
|
2690
|
-
import { defineComponent as
|
|
2691
|
-
import { computed as computed15, watch as
|
|
2692
|
-
var IncremarkContent_default = /* @__PURE__ */
|
|
3451
|
+
import { defineComponent as _defineComponent20 } from "vue";
|
|
3452
|
+
import { computed as computed15, watch as watch8 } from "vue";
|
|
3453
|
+
var IncremarkContent_default = /* @__PURE__ */ _defineComponent20({
|
|
2693
3454
|
__name: "IncremarkContent",
|
|
2694
3455
|
props: {
|
|
2695
3456
|
stream: { type: Function, required: false },
|
|
@@ -2713,7 +3474,7 @@ var IncremarkContent_default = /* @__PURE__ */ _defineComponent19({
|
|
|
2713
3474
|
math: true,
|
|
2714
3475
|
...props.incremarkOptions
|
|
2715
3476
|
}));
|
|
2716
|
-
const { blocks, append, finalize, render:
|
|
3477
|
+
const { blocks, append, finalize, render: render24, reset, isDisplayComplete, markdown } = useIncremark(incremarkOptions);
|
|
2717
3478
|
const isStreamMode = computed15(() => typeof props.stream === "function");
|
|
2718
3479
|
async function handleStreamInput() {
|
|
2719
3480
|
if (!props.stream) return;
|
|
@@ -2739,32 +3500,31 @@ var IncremarkContent_default = /* @__PURE__ */ _defineComponent19({
|
|
|
2739
3500
|
const delta = newContent.slice((oldContent || "").length);
|
|
2740
3501
|
append(delta);
|
|
2741
3502
|
} else {
|
|
2742
|
-
|
|
3503
|
+
render24(newContent);
|
|
2743
3504
|
}
|
|
2744
3505
|
}
|
|
2745
|
-
|
|
3506
|
+
watch8(() => props.content, async (newContent, oldContent) => {
|
|
2746
3507
|
if (isStreamMode.value) {
|
|
2747
3508
|
await handleStreamInput();
|
|
2748
|
-
return;
|
|
2749
3509
|
} else {
|
|
2750
3510
|
handleContentInput(newContent, oldContent);
|
|
2751
3511
|
}
|
|
2752
3512
|
}, { immediate: true });
|
|
2753
|
-
|
|
3513
|
+
watch8(() => props.isFinished, (newIsFinished) => {
|
|
2754
3514
|
if (newIsFinished && props.content === markdown.value) {
|
|
2755
3515
|
finalize();
|
|
2756
3516
|
}
|
|
2757
3517
|
}, { immediate: true });
|
|
2758
|
-
const __returned__ = { props, incremarkOptions, blocks, append, finalize, render:
|
|
3518
|
+
const __returned__ = { props, incremarkOptions, blocks, append, finalize, render: render24, reset, isDisplayComplete, markdown, isStreamMode, handleStreamInput, handleContentInput, Incremark: Incremark_default2 };
|
|
2759
3519
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2760
3520
|
return __returned__;
|
|
2761
3521
|
}
|
|
2762
3522
|
});
|
|
2763
3523
|
|
|
2764
3524
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContent.vue?type=template
|
|
2765
|
-
import { openBlock as
|
|
2766
|
-
function
|
|
2767
|
-
return
|
|
3525
|
+
import { openBlock as _openBlock20, createBlock as _createBlock12 } from "vue";
|
|
3526
|
+
function render20(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3527
|
+
return _openBlock20(), _createBlock12($setup["Incremark"], {
|
|
2768
3528
|
blocks: $setup.blocks,
|
|
2769
3529
|
"pending-class": $props.pendingClass,
|
|
2770
3530
|
"is-display-complete": $setup.isDisplayComplete,
|
|
@@ -2777,14 +3537,14 @@ function render19(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2777
3537
|
}
|
|
2778
3538
|
|
|
2779
3539
|
// src/components/IncremarkContent.vue
|
|
2780
|
-
IncremarkContent_default.render =
|
|
3540
|
+
IncremarkContent_default.render = render20;
|
|
2781
3541
|
IncremarkContent_default.__file = "src/components/IncremarkContent.vue";
|
|
2782
3542
|
var IncremarkContent_default2 = IncremarkContent_default;
|
|
2783
3543
|
|
|
2784
3544
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/AutoScrollContainer.vue?type=script
|
|
2785
|
-
import { defineComponent as
|
|
2786
|
-
import { ref as
|
|
2787
|
-
var AutoScrollContainer_default = /* @__PURE__ */
|
|
3545
|
+
import { defineComponent as _defineComponent21 } from "vue";
|
|
3546
|
+
import { ref as ref10, onMounted as onMounted5, onUnmounted as onUnmounted7, nextTick } from "vue";
|
|
3547
|
+
var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent21({
|
|
2788
3548
|
__name: "AutoScrollContainer",
|
|
2789
3549
|
props: {
|
|
2790
3550
|
enabled: { type: Boolean, required: false, default: true },
|
|
@@ -2793,8 +3553,8 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent20({
|
|
|
2793
3553
|
},
|
|
2794
3554
|
setup(__props, { expose: __expose }) {
|
|
2795
3555
|
const props = __props;
|
|
2796
|
-
const containerRef =
|
|
2797
|
-
const isUserScrolledUp =
|
|
3556
|
+
const containerRef = ref10(null);
|
|
3557
|
+
const isUserScrolledUp = ref10(false);
|
|
2798
3558
|
let lastScrollTop = 0;
|
|
2799
3559
|
let lastScrollHeight = 0;
|
|
2800
3560
|
function isNearBottom() {
|
|
@@ -2840,7 +3600,7 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent20({
|
|
|
2840
3600
|
lastScrollHeight = scrollHeight;
|
|
2841
3601
|
}
|
|
2842
3602
|
let observer = null;
|
|
2843
|
-
|
|
3603
|
+
onMounted5(() => {
|
|
2844
3604
|
if (!containerRef.value) return;
|
|
2845
3605
|
lastScrollTop = containerRef.value.scrollTop;
|
|
2846
3606
|
lastScrollHeight = containerRef.value.scrollHeight;
|
|
@@ -2892,9 +3652,9 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent20({
|
|
|
2892
3652
|
});
|
|
2893
3653
|
|
|
2894
3654
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/AutoScrollContainer.vue?type=template
|
|
2895
|
-
import { renderSlot as _renderSlot, openBlock as
|
|
2896
|
-
function
|
|
2897
|
-
return
|
|
3655
|
+
import { renderSlot as _renderSlot, openBlock as _openBlock21, createElementBlock as _createElementBlock18 } from "vue";
|
|
3656
|
+
function render21(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3657
|
+
return _openBlock21(), _createElementBlock18(
|
|
2898
3658
|
"div",
|
|
2899
3659
|
{
|
|
2900
3660
|
ref: "containerRef",
|
|
@@ -2910,16 +3670,16 @@ function render20(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2910
3670
|
}
|
|
2911
3671
|
|
|
2912
3672
|
// src/components/AutoScrollContainer.vue
|
|
2913
|
-
AutoScrollContainer_default.render =
|
|
3673
|
+
AutoScrollContainer_default.render = render21;
|
|
2914
3674
|
AutoScrollContainer_default.__file = "src/components/AutoScrollContainer.vue";
|
|
2915
3675
|
var AutoScrollContainer_default2 = AutoScrollContainer_default;
|
|
2916
3676
|
|
|
2917
3677
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/ThemeProvider.vue?type=script
|
|
2918
|
-
import { defineComponent as
|
|
2919
|
-
import { ref as
|
|
3678
|
+
import { defineComponent as _defineComponent22 } from "vue";
|
|
3679
|
+
import { ref as ref11, watch as watch10 } from "vue";
|
|
2920
3680
|
import { applyTheme } from "@incremark/theme";
|
|
2921
3681
|
import { isServer } from "@incremark/shared";
|
|
2922
|
-
var ThemeProvider_default = /* @__PURE__ */
|
|
3682
|
+
var ThemeProvider_default = /* @__PURE__ */ _defineComponent22({
|
|
2923
3683
|
__name: "ThemeProvider",
|
|
2924
3684
|
props: {
|
|
2925
3685
|
theme: { type: null, required: true },
|
|
@@ -2928,8 +3688,8 @@ var ThemeProvider_default = /* @__PURE__ */ _defineComponent21({
|
|
|
2928
3688
|
setup(__props, { expose: __expose }) {
|
|
2929
3689
|
__expose();
|
|
2930
3690
|
const props = __props;
|
|
2931
|
-
const containerRef =
|
|
2932
|
-
|
|
3691
|
+
const containerRef = ref11();
|
|
3692
|
+
watch10(
|
|
2933
3693
|
() => props.theme,
|
|
2934
3694
|
(theme) => {
|
|
2935
3695
|
if (isServer()) return;
|
|
@@ -2946,9 +3706,9 @@ var ThemeProvider_default = /* @__PURE__ */ _defineComponent21({
|
|
|
2946
3706
|
});
|
|
2947
3707
|
|
|
2948
3708
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/ThemeProvider.vue?type=template
|
|
2949
|
-
import { renderSlot as _renderSlot2, normalizeClass as _normalizeClass7, openBlock as
|
|
2950
|
-
function
|
|
2951
|
-
return
|
|
3709
|
+
import { renderSlot as _renderSlot2, normalizeClass as _normalizeClass7, openBlock as _openBlock22, createElementBlock as _createElementBlock19 } from "vue";
|
|
3710
|
+
function render22(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3711
|
+
return _openBlock22(), _createElementBlock19(
|
|
2952
3712
|
"div",
|
|
2953
3713
|
{
|
|
2954
3714
|
ref: "containerRef",
|
|
@@ -2963,24 +3723,25 @@ function render21(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2963
3723
|
}
|
|
2964
3724
|
|
|
2965
3725
|
// src/ThemeProvider.vue
|
|
2966
|
-
ThemeProvider_default.render =
|
|
3726
|
+
ThemeProvider_default.render = render22;
|
|
2967
3727
|
ThemeProvider_default.__file = "src/ThemeProvider.vue";
|
|
2968
3728
|
var ThemeProvider_default2 = ThemeProvider_default;
|
|
2969
3729
|
|
|
2970
3730
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/ConfigProvider.vue?type=script
|
|
2971
|
-
import { defineComponent as
|
|
2972
|
-
import { provide as provide2, ref as
|
|
2973
|
-
|
|
3731
|
+
import { defineComponent as _defineComponent23 } from "vue";
|
|
3732
|
+
import { provide as provide2, ref as ref12, watch as watch11 } from "vue";
|
|
3733
|
+
import { zhCN as zhCN2 } from "@incremark/shared";
|
|
3734
|
+
var ConfigProvider_default = /* @__PURE__ */ _defineComponent23({
|
|
2974
3735
|
__name: "ConfigProvider",
|
|
2975
3736
|
props: {
|
|
2976
|
-
locale: { type: null, required: false, default: () =>
|
|
3737
|
+
locale: { type: null, required: false, default: () => zhCN2 }
|
|
2977
3738
|
},
|
|
2978
3739
|
setup(__props, { expose: __expose }) {
|
|
2979
3740
|
__expose();
|
|
2980
3741
|
const props = __props;
|
|
2981
|
-
const localeRef =
|
|
3742
|
+
const localeRef = ref12(props.locale || zhCN2);
|
|
2982
3743
|
provide2(LOCALE_KEY, localeRef);
|
|
2983
|
-
|
|
3744
|
+
watch11(
|
|
2984
3745
|
() => props.locale,
|
|
2985
3746
|
(newLocale) => {
|
|
2986
3747
|
if (newLocale) {
|
|
@@ -2997,12 +3758,12 @@ var ConfigProvider_default = /* @__PURE__ */ _defineComponent22({
|
|
|
2997
3758
|
|
|
2998
3759
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/ConfigProvider.vue?type=template
|
|
2999
3760
|
import { renderSlot as _renderSlot3 } from "vue";
|
|
3000
|
-
function
|
|
3761
|
+
function render23(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3001
3762
|
return _renderSlot3(_ctx.$slots, "default");
|
|
3002
3763
|
}
|
|
3003
3764
|
|
|
3004
3765
|
// src/components/ConfigProvider.vue
|
|
3005
|
-
ConfigProvider_default.render =
|
|
3766
|
+
ConfigProvider_default.render = render23;
|
|
3006
3767
|
ConfigProvider_default.__file = "src/components/ConfigProvider.vue";
|
|
3007
3768
|
var ConfigProvider_default2 = ConfigProvider_default;
|
|
3008
3769
|
|
|
@@ -3016,7 +3777,7 @@ import {
|
|
|
3016
3777
|
codeBlockPlugin,
|
|
3017
3778
|
mermaidPlugin,
|
|
3018
3779
|
imagePlugin,
|
|
3019
|
-
mathPlugin,
|
|
3780
|
+
mathPlugin as mathPlugin2,
|
|
3020
3781
|
thematicBreakPlugin,
|
|
3021
3782
|
defaultPlugins as defaultPlugins2,
|
|
3022
3783
|
allPlugins,
|
|
@@ -3063,7 +3824,7 @@ export {
|
|
|
3063
3824
|
enShared as en,
|
|
3064
3825
|
generateCSSVars,
|
|
3065
3826
|
imagePlugin,
|
|
3066
|
-
mathPlugin,
|
|
3827
|
+
mathPlugin2 as mathPlugin,
|
|
3067
3828
|
mergeTheme,
|
|
3068
3829
|
mermaidPlugin,
|
|
3069
3830
|
sliceAst,
|