@incremark/vue 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +206 -56
- package/dist/components/ConfigProvider.vue.d.ts +19 -0
- package/dist/components/Incremark.vue.d.ts +4 -12
- package/dist/components/IncremarkCode.vue.d.ts +7 -4
- package/dist/components/IncremarkCodeDefault.vue.d.ts +16 -0
- package/dist/components/IncremarkCodeMermaid.vue.d.ts +10 -0
- package/dist/components/IncremarkContent.vue.d.ts +3 -0
- package/dist/components/SvgIcon.vue.d.ts +13 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/useIncremark.d.ts +3 -3
- package/dist/composables/useLocale.d.ts +21 -0
- package/dist/composables/useShiki.d.ts +66 -0
- package/dist/composables/useStreamRenderer.d.ts +7 -11
- package/dist/composables/useTypewriter.d.ts +3 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1014 -553
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +25 -0
- package/package.json +13 -7
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/composables/useIncremark.ts
|
|
2
|
-
import { ref as ref3, shallowRef as shallowRef2, computed as computed2, markRaw } from "vue";
|
|
2
|
+
import { ref as ref3, shallowRef as shallowRef2, computed as computed2, markRaw, watch as watch2, toValue as toValue2 } from "vue";
|
|
3
3
|
import {
|
|
4
4
|
createIncremarkParser
|
|
5
5
|
} from "@incremark/core";
|
|
@@ -51,7 +51,7 @@ function useProvideDefinations() {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// src/composables/useTypewriter.ts
|
|
54
|
-
import { ref as ref2, shallowRef, computed, watch, onUnmounted } from "vue";
|
|
54
|
+
import { ref as ref2, shallowRef, computed, watch, toValue, onUnmounted } from "vue";
|
|
55
55
|
import {
|
|
56
56
|
createBlockTransformer,
|
|
57
57
|
defaultPlugins
|
|
@@ -86,23 +86,23 @@ function addCursorToNode(node, cursor) {
|
|
|
86
86
|
|
|
87
87
|
// src/composables/useTypewriter.ts
|
|
88
88
|
function useTypewriter(options) {
|
|
89
|
-
const { typewriter:
|
|
90
|
-
const
|
|
89
|
+
const { typewriter: typewriterInput, completedBlocks, pendingBlocks } = options;
|
|
90
|
+
const initialConfig = toValue(typewriterInput);
|
|
91
|
+
const typewriterEnabled = ref2(initialConfig?.enabled ?? !!initialConfig);
|
|
91
92
|
const displayBlocksRef = shallowRef([]);
|
|
92
93
|
const isTypewriterProcessing = ref2(false);
|
|
93
94
|
const isTypewriterPaused = ref2(false);
|
|
94
|
-
const typewriterEffect = ref2(
|
|
95
|
-
const typewriterCursor = ref2(
|
|
95
|
+
const typewriterEffect = ref2(initialConfig?.effect ?? "none");
|
|
96
|
+
const typewriterCursor = ref2(initialConfig?.cursor ?? "|");
|
|
96
97
|
const isAnimationComplete = ref2(true);
|
|
97
98
|
let transformer = null;
|
|
98
|
-
if (
|
|
99
|
-
const twOptions = typewriterConfig;
|
|
99
|
+
if (initialConfig) {
|
|
100
100
|
transformer = createBlockTransformer({
|
|
101
|
-
charsPerTick:
|
|
102
|
-
tickInterval:
|
|
103
|
-
effect:
|
|
104
|
-
pauseOnHidden:
|
|
105
|
-
plugins:
|
|
101
|
+
charsPerTick: initialConfig.charsPerTick ?? [1, 3],
|
|
102
|
+
tickInterval: initialConfig.tickInterval ?? 30,
|
|
103
|
+
effect: initialConfig.effect ?? "none",
|
|
104
|
+
pauseOnHidden: initialConfig.pauseOnHidden ?? true,
|
|
105
|
+
plugins: initialConfig.plugins ?? defaultPlugins,
|
|
106
106
|
onChange: (blocks2) => {
|
|
107
107
|
displayBlocksRef.value = blocks2;
|
|
108
108
|
isTypewriterProcessing.value = transformer?.isProcessing() ?? false;
|
|
@@ -116,6 +116,28 @@ function useTypewriter(options) {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
+
watch(
|
|
120
|
+
() => toValue(typewriterInput),
|
|
121
|
+
(newConfig) => {
|
|
122
|
+
if (!newConfig) return;
|
|
123
|
+
if (newConfig.enabled !== void 0) {
|
|
124
|
+
typewriterEnabled.value = newConfig.enabled;
|
|
125
|
+
}
|
|
126
|
+
if (newConfig.effect !== void 0) {
|
|
127
|
+
typewriterEffect.value = newConfig.effect;
|
|
128
|
+
}
|
|
129
|
+
if (newConfig.cursor !== void 0) {
|
|
130
|
+
typewriterCursor.value = newConfig.cursor;
|
|
131
|
+
}
|
|
132
|
+
transformer?.setOptions({
|
|
133
|
+
charsPerTick: newConfig.charsPerTick,
|
|
134
|
+
tickInterval: newConfig.tickInterval,
|
|
135
|
+
effect: newConfig.effect,
|
|
136
|
+
pauseOnHidden: newConfig.pauseOnHidden
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
{ deep: true }
|
|
140
|
+
);
|
|
119
141
|
const sourceBlocks = computed(() => {
|
|
120
142
|
return completedBlocks.value.map((block) => ({
|
|
121
143
|
id: block.id,
|
|
@@ -140,17 +162,7 @@ function useTypewriter(options) {
|
|
|
140
162
|
);
|
|
141
163
|
}
|
|
142
164
|
const rawBlocks = computed(() => {
|
|
143
|
-
|
|
144
|
-
for (const block of completedBlocks.value) {
|
|
145
|
-
result.push({ ...block, stableId: block.id });
|
|
146
|
-
}
|
|
147
|
-
for (let i = 0; i < pendingBlocks.value.length; i++) {
|
|
148
|
-
result.push({
|
|
149
|
-
...pendingBlocks.value[i],
|
|
150
|
-
stableId: `pending-${i}`
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
return result;
|
|
165
|
+
return [...completedBlocks.value, ...pendingBlocks.value];
|
|
154
166
|
});
|
|
155
167
|
const blocks = computed(() => {
|
|
156
168
|
if (!typewriterEnabled.value || !transformer) {
|
|
@@ -165,7 +177,6 @@ function useTypewriter(options) {
|
|
|
165
177
|
}
|
|
166
178
|
return {
|
|
167
179
|
id: db.id,
|
|
168
|
-
stableId: db.id,
|
|
169
180
|
status: db.isDisplayComplete ? "completed" : "pending",
|
|
170
181
|
isLastPending,
|
|
171
182
|
node,
|
|
@@ -224,16 +235,19 @@ function useTypewriter(options) {
|
|
|
224
235
|
}
|
|
225
236
|
|
|
226
237
|
// src/composables/useIncremark.ts
|
|
227
|
-
function useIncremark(
|
|
238
|
+
function useIncremark(optionsInput = {}) {
|
|
228
239
|
const { setDefinations, setFootnoteDefinitions, setFootnoteReferenceOrder } = useProvideDefinations();
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
240
|
+
function createParser(options) {
|
|
241
|
+
return createIncremarkParser({
|
|
242
|
+
...options,
|
|
243
|
+
onChange: (state) => {
|
|
244
|
+
setDefinations(state.definitions);
|
|
245
|
+
setFootnoteDefinitions(state.footnoteDefinitions);
|
|
246
|
+
options.onChange?.(state);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
let parser = createParser(toValue2(optionsInput));
|
|
237
251
|
const completedBlocks = shallowRef2([]);
|
|
238
252
|
const pendingBlocks = shallowRef2([]);
|
|
239
253
|
const isLoading = ref3(false);
|
|
@@ -241,12 +255,12 @@ function useIncremark(options = {}) {
|
|
|
241
255
|
const isFinalized = ref3(false);
|
|
242
256
|
const footnoteReferenceOrder = ref3([]);
|
|
243
257
|
const { blocks, typewriter, transformer, isAnimationComplete } = useTypewriter({
|
|
244
|
-
typewriter:
|
|
258
|
+
typewriter: () => toValue2(optionsInput).typewriter,
|
|
245
259
|
completedBlocks,
|
|
246
260
|
pendingBlocks
|
|
247
261
|
});
|
|
248
262
|
const isDisplayComplete = computed2(() => {
|
|
249
|
-
if (!
|
|
263
|
+
if (!toValue2(optionsInput).typewriter || !typewriter.enabled.value) {
|
|
250
264
|
return isFinalized.value;
|
|
251
265
|
}
|
|
252
266
|
return isFinalized.value && isAnimationComplete.value;
|
|
@@ -299,7 +313,18 @@ function useIncremark(options = {}) {
|
|
|
299
313
|
footnoteReferenceOrder.value = [];
|
|
300
314
|
transformer?.reset();
|
|
301
315
|
}
|
|
302
|
-
|
|
316
|
+
watch2(
|
|
317
|
+
() => {
|
|
318
|
+
const { typewriter: _, ...parserOptions } = toValue2(optionsInput);
|
|
319
|
+
return JSON.stringify(parserOptions);
|
|
320
|
+
},
|
|
321
|
+
() => {
|
|
322
|
+
const { typewriter: _, ...parserOptions } = toValue2(optionsInput);
|
|
323
|
+
parser = createParser(parserOptions);
|
|
324
|
+
reset();
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
function render23(content) {
|
|
303
328
|
const update = parser.render(content);
|
|
304
329
|
markdown.value = parser.getBuffer();
|
|
305
330
|
completedBlocks.value = parser.getCompletedBlocks().map((b) => markRaw(b));
|
|
@@ -343,7 +368,7 @@ function useIncremark(options = {}) {
|
|
|
343
368
|
/** 重置解析器和打字机 */
|
|
344
369
|
reset,
|
|
345
370
|
/** 一次性渲染(reset + append + finalize) */
|
|
346
|
-
render:
|
|
371
|
+
render: render23,
|
|
347
372
|
/** 解析器实例 */
|
|
348
373
|
parser,
|
|
349
374
|
/** 打字机控制 */
|
|
@@ -355,23 +380,13 @@ function useIncremark(options = {}) {
|
|
|
355
380
|
import { computed as computed3 } from "vue";
|
|
356
381
|
function useStreamRenderer(options) {
|
|
357
382
|
const { completedBlocks, pendingBlocks } = options;
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
stableId: block.id
|
|
362
|
-
}))
|
|
363
|
-
);
|
|
364
|
-
const stablePendingBlocks = computed3(
|
|
365
|
-
() => pendingBlocks.value.map((block, index) => ({
|
|
366
|
-
...block,
|
|
367
|
-
stableId: `pending-${index}`
|
|
368
|
-
}))
|
|
369
|
-
);
|
|
370
|
-
const allStableBlocks = computed3(() => [...stableCompletedBlocks.value, ...stablePendingBlocks.value]);
|
|
383
|
+
const completedBlocksComputed = computed3(() => completedBlocks.value);
|
|
384
|
+
const pendingBlocksComputed = computed3(() => pendingBlocks.value);
|
|
385
|
+
const allBlocks = computed3(() => [...completedBlocksComputed.value, ...pendingBlocksComputed.value]);
|
|
371
386
|
return {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
387
|
+
completedBlocks: completedBlocksComputed,
|
|
388
|
+
pendingBlocks: pendingBlocksComputed,
|
|
389
|
+
allBlocks
|
|
375
390
|
};
|
|
376
391
|
}
|
|
377
392
|
|
|
@@ -382,8 +397,8 @@ function useDevTools(incremark, options = {}) {
|
|
|
382
397
|
const devtools = createDevTools(options);
|
|
383
398
|
incremark.parser.setOnChange((state) => {
|
|
384
399
|
const blocks = [
|
|
385
|
-
...state.completedBlocks
|
|
386
|
-
...state.pendingBlocks
|
|
400
|
+
...state.completedBlocks,
|
|
401
|
+
...state.pendingBlocks
|
|
387
402
|
];
|
|
388
403
|
devtools.update({
|
|
389
404
|
blocks,
|
|
@@ -405,15 +420,15 @@ function useDevTools(incremark, options = {}) {
|
|
|
405
420
|
}
|
|
406
421
|
|
|
407
422
|
// src/composables/useBlockTransformer.ts
|
|
408
|
-
import { ref as
|
|
423
|
+
import { ref as ref4, watch as watch3, computed as computed4, onUnmounted as onUnmounted3 } from "vue";
|
|
409
424
|
import {
|
|
410
425
|
createBlockTransformer as createBlockTransformer2
|
|
411
426
|
} from "@incremark/core";
|
|
412
427
|
function useBlockTransformer(sourceBlocks, options = {}) {
|
|
413
|
-
const displayBlocksRef =
|
|
414
|
-
const isProcessingRef =
|
|
415
|
-
const isPausedRef =
|
|
416
|
-
const effectRef =
|
|
428
|
+
const displayBlocksRef = ref4([]);
|
|
429
|
+
const isProcessingRef = ref4(false);
|
|
430
|
+
const isPausedRef = ref4(false);
|
|
431
|
+
const effectRef = ref4(options.effect ?? "none");
|
|
417
432
|
const transformer = createBlockTransformer2({
|
|
418
433
|
...options,
|
|
419
434
|
onChange: (blocks) => {
|
|
@@ -422,7 +437,7 @@ function useBlockTransformer(sourceBlocks, options = {}) {
|
|
|
422
437
|
isPausedRef.value = transformer.isPausedState();
|
|
423
438
|
}
|
|
424
439
|
});
|
|
425
|
-
|
|
440
|
+
watch3(
|
|
426
441
|
sourceBlocks,
|
|
427
442
|
(blocks) => {
|
|
428
443
|
transformer.push(blocks);
|
|
@@ -464,10 +479,38 @@ function useBlockTransformer(sourceBlocks, options = {}) {
|
|
|
464
479
|
};
|
|
465
480
|
}
|
|
466
481
|
|
|
482
|
+
// src/composables/useLocale.ts
|
|
483
|
+
import { inject, computed as computed5 } from "vue";
|
|
484
|
+
var LOCALE_KEY = /* @__PURE__ */ Symbol("incremark-locale");
|
|
485
|
+
function useLocale() {
|
|
486
|
+
const locale = inject(LOCALE_KEY);
|
|
487
|
+
if (!locale) {
|
|
488
|
+
const defaultLocale = enShared;
|
|
489
|
+
const t2 = computed5(() => (key) => {
|
|
490
|
+
const keys = key.split(".");
|
|
491
|
+
let value = defaultLocale;
|
|
492
|
+
for (const k of keys) {
|
|
493
|
+
value = value?.[k];
|
|
494
|
+
}
|
|
495
|
+
return value || key;
|
|
496
|
+
});
|
|
497
|
+
return { t: t2 };
|
|
498
|
+
}
|
|
499
|
+
const t = computed5(() => (key) => {
|
|
500
|
+
const keys = key.split(".");
|
|
501
|
+
let value = locale.value;
|
|
502
|
+
for (const k of keys) {
|
|
503
|
+
value = value?.[k];
|
|
504
|
+
}
|
|
505
|
+
return value || key;
|
|
506
|
+
});
|
|
507
|
+
return { t };
|
|
508
|
+
}
|
|
509
|
+
|
|
467
510
|
// src/composables/useDefinationsContext.ts
|
|
468
|
-
import { inject } from "vue";
|
|
511
|
+
import { inject as inject2 } from "vue";
|
|
469
512
|
function useDefinationsContext() {
|
|
470
|
-
const definationContext =
|
|
513
|
+
const definationContext = inject2(definationsInjectionKey);
|
|
471
514
|
if (!definationContext) {
|
|
472
515
|
throw new Error("definationContext not found");
|
|
473
516
|
}
|
|
@@ -475,16 +518,16 @@ function useDefinationsContext() {
|
|
|
475
518
|
}
|
|
476
519
|
|
|
477
520
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=script
|
|
478
|
-
import { defineComponent as
|
|
479
|
-
import { computed as
|
|
521
|
+
import { defineComponent as _defineComponent18 } from "vue";
|
|
522
|
+
import { computed as computed14 } from "vue";
|
|
480
523
|
|
|
481
524
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=script
|
|
482
|
-
import { defineComponent as
|
|
483
|
-
import { computed as
|
|
525
|
+
import { defineComponent as _defineComponent16 } from "vue";
|
|
526
|
+
import { computed as computed12 } from "vue";
|
|
484
527
|
|
|
485
528
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkHeading.vue?type=script
|
|
486
529
|
import { defineComponent as _defineComponent4 } from "vue";
|
|
487
|
-
import { computed as
|
|
530
|
+
import { computed as computed7 } from "vue";
|
|
488
531
|
|
|
489
532
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkInline.vue?type=script
|
|
490
533
|
import { defineComponent as _defineComponent3 } from "vue";
|
|
@@ -496,7 +539,7 @@ import {
|
|
|
496
539
|
|
|
497
540
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkMath.vue?type=script
|
|
498
541
|
import { defineComponent as _defineComponent } from "vue";
|
|
499
|
-
import { computed as
|
|
542
|
+
import { computed as computed6, ref as ref5, watch as watch4, shallowRef as shallowRef3, onUnmounted as onUnmounted4 } from "vue";
|
|
500
543
|
var IncremarkMath_default = /* @__PURE__ */ _defineComponent({
|
|
501
544
|
__name: "IncremarkMath",
|
|
502
545
|
props: {
|
|
@@ -506,13 +549,13 @@ var IncremarkMath_default = /* @__PURE__ */ _defineComponent({
|
|
|
506
549
|
setup(__props, { expose: __expose }) {
|
|
507
550
|
__expose();
|
|
508
551
|
const props = __props;
|
|
509
|
-
const renderedHtml =
|
|
510
|
-
const renderError =
|
|
511
|
-
const isLoading =
|
|
552
|
+
const renderedHtml = ref5("");
|
|
553
|
+
const renderError = ref5("");
|
|
554
|
+
const isLoading = ref5(false);
|
|
512
555
|
const katexRef = shallowRef3(null);
|
|
513
556
|
let renderTimer = null;
|
|
514
|
-
const isInline =
|
|
515
|
-
const formula =
|
|
557
|
+
const isInline = computed6(() => props.node.type === "inlineMath");
|
|
558
|
+
const formula = computed6(() => props.node.value);
|
|
516
559
|
function scheduleRender() {
|
|
517
560
|
if (!formula.value) {
|
|
518
561
|
renderedHtml.value = "";
|
|
@@ -552,7 +595,7 @@ var IncremarkMath_default = /* @__PURE__ */ _defineComponent({
|
|
|
552
595
|
clearTimeout(renderTimer);
|
|
553
596
|
}
|
|
554
597
|
});
|
|
555
|
-
|
|
598
|
+
watch4(formula, scheduleRender, { immediate: true });
|
|
556
599
|
const __returned__ = { props, renderedHtml, renderError, isLoading, katexRef, get renderTimer() {
|
|
557
600
|
return renderTimer;
|
|
558
601
|
}, set renderTimer(v) {
|
|
@@ -979,7 +1022,7 @@ function render3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
979
1022
|
[
|
|
980
1023
|
_createCommentVNode3(" HTML \u8282\u70B9\uFF08\u539F\u59CB HTML\uFF0C\u5982\u672A\u542F\u7528 htmlTree \u9009\u9879\uFF09 "),
|
|
981
1024
|
_createElementVNode3("span", {
|
|
982
|
-
|
|
1025
|
+
class: "incremark-inline-html",
|
|
983
1026
|
innerHTML: node.value
|
|
984
1027
|
}, null, 8, _hoisted_13)
|
|
985
1028
|
],
|
|
@@ -1192,7 +1235,7 @@ var IncremarkHeading_default = /* @__PURE__ */ _defineComponent4({
|
|
|
1192
1235
|
setup(__props, { expose: __expose }) {
|
|
1193
1236
|
__expose();
|
|
1194
1237
|
const props = __props;
|
|
1195
|
-
const tag =
|
|
1238
|
+
const tag = computed7(() => `h${props.node.depth}`);
|
|
1196
1239
|
const __returned__ = { props, tag, IncremarkInline: IncremarkInline_default };
|
|
1197
1240
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1198
1241
|
return __returned__;
|
|
@@ -1252,57 +1295,70 @@ IncremarkParagraph_default.__file = "src/components/IncremarkParagraph.vue";
|
|
|
1252
1295
|
var IncremarkParagraph_default2 = IncremarkParagraph_default;
|
|
1253
1296
|
|
|
1254
1297
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=script
|
|
1298
|
+
import { defineComponent as _defineComponent9 } from "vue";
|
|
1299
|
+
import { computed as computed10 } from "vue";
|
|
1300
|
+
|
|
1301
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeMermaid.vue?type=script
|
|
1302
|
+
import { defineComponent as _defineComponent7 } from "vue";
|
|
1303
|
+
import { computed as computed8, ref as ref6, onUnmounted as onUnmounted5, shallowRef as shallowRef4, watch as watch5 } from "vue";
|
|
1304
|
+
import { GravityMermaid, LucideCode, LucideEye, LucideCopy, LucideCopyCheck } from "@incremark/icons";
|
|
1305
|
+
import { isClipboardAvailable } from "@incremark/shared";
|
|
1306
|
+
|
|
1307
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/SvgIcon.vue?type=script
|
|
1255
1308
|
import { defineComponent as _defineComponent6 } from "vue";
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1309
|
+
var SvgIcon_default = /* @__PURE__ */ _defineComponent6({
|
|
1310
|
+
__name: "SvgIcon",
|
|
1311
|
+
props: {
|
|
1312
|
+
svg: { type: String, required: true },
|
|
1313
|
+
sizeClass: { type: String, required: false }
|
|
1314
|
+
},
|
|
1315
|
+
setup(__props, { expose: __expose }) {
|
|
1316
|
+
__expose();
|
|
1317
|
+
const __returned__ = {};
|
|
1318
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1319
|
+
return __returned__;
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
|
|
1323
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/SvgIcon.vue?type=template
|
|
1324
|
+
import { normalizeClass as _normalizeClass2, openBlock as _openBlock6, createElementBlock as _createElementBlock5 } from "vue";
|
|
1325
|
+
var _hoisted_15 = ["innerHTML"];
|
|
1326
|
+
function render6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1327
|
+
return _openBlock6(), _createElementBlock5("span", {
|
|
1328
|
+
class: _normalizeClass2(["incremark-icon", $props.sizeClass]),
|
|
1329
|
+
innerHTML: $props.svg,
|
|
1330
|
+
"aria-hidden": "true"
|
|
1331
|
+
}, null, 10, _hoisted_15);
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
// src/components/SvgIcon.vue
|
|
1335
|
+
SvgIcon_default.render = render6;
|
|
1336
|
+
SvgIcon_default.__file = "src/components/SvgIcon.vue";
|
|
1337
|
+
var SvgIcon_default2 = SvgIcon_default;
|
|
1338
|
+
|
|
1339
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeMermaid.vue?type=script
|
|
1340
|
+
var IncremarkCodeMermaid_default = /* @__PURE__ */ _defineComponent7({
|
|
1341
|
+
__name: "IncremarkCodeMermaid",
|
|
1259
1342
|
props: {
|
|
1260
1343
|
node: { type: null, required: true },
|
|
1261
|
-
|
|
1262
|
-
fallbackTheme: { type: String, required: false, default: "github-dark" },
|
|
1263
|
-
disableHighlight: { type: Boolean, required: false, default: false },
|
|
1264
|
-
mermaidDelay: { type: Number, required: false, default: 500 },
|
|
1265
|
-
customCodeBlocks: { type: Object, required: false, default: () => ({}) },
|
|
1266
|
-
codeBlockConfigs: { type: Object, required: false, default: () => ({}) },
|
|
1267
|
-
blockStatus: { type: String, required: false, default: "completed" }
|
|
1344
|
+
mermaidDelay: { type: Number, required: false, default: 500 }
|
|
1268
1345
|
},
|
|
1269
1346
|
setup(__props, { expose: __expose }) {
|
|
1270
1347
|
__expose();
|
|
1271
1348
|
const props = __props;
|
|
1272
|
-
const
|
|
1273
|
-
const
|
|
1274
|
-
const
|
|
1275
|
-
const
|
|
1276
|
-
const mermaidSvg = ref7("");
|
|
1277
|
-
const mermaidError = ref7("");
|
|
1278
|
-
const mermaidLoading = ref7(false);
|
|
1349
|
+
const { t } = useLocale();
|
|
1350
|
+
const mermaidSvg = ref6("");
|
|
1351
|
+
const mermaidError = ref6("");
|
|
1352
|
+
const mermaidLoading = ref6(false);
|
|
1279
1353
|
const mermaidRef = shallowRef4(null);
|
|
1280
1354
|
let mermaidTimer = null;
|
|
1281
|
-
const mermaidViewMode =
|
|
1355
|
+
const mermaidViewMode = ref6("preview");
|
|
1282
1356
|
function toggleMermaidView() {
|
|
1283
1357
|
mermaidViewMode.value = mermaidViewMode.value === "preview" ? "source" : "preview";
|
|
1284
1358
|
}
|
|
1285
|
-
const
|
|
1286
|
-
const code = computed7(() => props.node.value);
|
|
1287
|
-
const isMermaid = computed7(() => language.value === "mermaid");
|
|
1288
|
-
const CustomCodeBlock = computed7(() => {
|
|
1289
|
-
const component = props.customCodeBlocks?.[language.value];
|
|
1290
|
-
if (!component) return null;
|
|
1291
|
-
const config = props.codeBlockConfigs?.[language.value];
|
|
1292
|
-
if (config?.takeOver) {
|
|
1293
|
-
return component;
|
|
1294
|
-
}
|
|
1295
|
-
if (props.blockStatus !== "completed") {
|
|
1296
|
-
return null;
|
|
1297
|
-
}
|
|
1298
|
-
return component;
|
|
1299
|
-
});
|
|
1300
|
-
const useCustomComponent = computed7(() => !!CustomCodeBlock.value);
|
|
1301
|
-
const highlighterRef = shallowRef4(null);
|
|
1302
|
-
const loadedLanguages = /* @__PURE__ */ new Set();
|
|
1303
|
-
const loadedThemes = /* @__PURE__ */ new Set();
|
|
1359
|
+
const code = computed8(() => props.node.value);
|
|
1304
1360
|
function scheduleRenderMermaid() {
|
|
1305
|
-
if (!
|
|
1361
|
+
if (!code.value) return;
|
|
1306
1362
|
if (mermaidTimer) {
|
|
1307
1363
|
clearTimeout(mermaidTimer);
|
|
1308
1364
|
}
|
|
@@ -1321,7 +1377,8 @@ var IncremarkCode_default = /* @__PURE__ */ _defineComponent6({
|
|
|
1321
1377
|
mermaidRef.value.initialize({
|
|
1322
1378
|
startOnLoad: false,
|
|
1323
1379
|
theme: "dark",
|
|
1324
|
-
securityLevel: "loose"
|
|
1380
|
+
securityLevel: "loose",
|
|
1381
|
+
suppressErrorRendering: true
|
|
1325
1382
|
});
|
|
1326
1383
|
}
|
|
1327
1384
|
const mermaid = mermaidRef.value;
|
|
@@ -1335,279 +1392,539 @@ var IncremarkCode_default = /* @__PURE__ */ _defineComponent6({
|
|
|
1335
1392
|
mermaidLoading.value = false;
|
|
1336
1393
|
}
|
|
1337
1394
|
}
|
|
1395
|
+
watch5(code, scheduleRenderMermaid, { immediate: true });
|
|
1338
1396
|
onUnmounted5(() => {
|
|
1339
1397
|
if (mermaidTimer) {
|
|
1340
1398
|
clearTimeout(mermaidTimer);
|
|
1341
1399
|
}
|
|
1400
|
+
if (copyTimeoutId) {
|
|
1401
|
+
clearTimeout(copyTimeoutId);
|
|
1402
|
+
}
|
|
1342
1403
|
});
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1404
|
+
const copied = ref6(false);
|
|
1405
|
+
let copyTimeoutId = null;
|
|
1406
|
+
async function copyCode() {
|
|
1407
|
+
if (!isClipboardAvailable()) return;
|
|
1408
|
+
try {
|
|
1409
|
+
await navigator.clipboard.writeText(code.value);
|
|
1410
|
+
copied.value = true;
|
|
1411
|
+
if (copyTimeoutId) {
|
|
1412
|
+
clearTimeout(copyTimeoutId);
|
|
1413
|
+
}
|
|
1414
|
+
copyTimeoutId = setTimeout(() => {
|
|
1415
|
+
copied.value = false;
|
|
1416
|
+
}, 2e3);
|
|
1417
|
+
} catch {
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
const __returned__ = { props, t, mermaidSvg, mermaidError, mermaidLoading, mermaidRef, get mermaidTimer() {
|
|
1421
|
+
return mermaidTimer;
|
|
1422
|
+
}, set mermaidTimer(v) {
|
|
1423
|
+
mermaidTimer = v;
|
|
1424
|
+
}, mermaidViewMode, toggleMermaidView, code, scheduleRenderMermaid, doRenderMermaid, copied, get copyTimeoutId() {
|
|
1425
|
+
return copyTimeoutId;
|
|
1426
|
+
}, set copyTimeoutId(v) {
|
|
1427
|
+
copyTimeoutId = v;
|
|
1428
|
+
}, copyCode, get GravityMermaid() {
|
|
1429
|
+
return GravityMermaid;
|
|
1430
|
+
}, get LucideCode() {
|
|
1431
|
+
return LucideCode;
|
|
1432
|
+
}, get LucideEye() {
|
|
1433
|
+
return LucideEye;
|
|
1434
|
+
}, get LucideCopy() {
|
|
1435
|
+
return LucideCopy;
|
|
1436
|
+
}, get LucideCopyCheck() {
|
|
1437
|
+
return LucideCopyCheck;
|
|
1438
|
+
}, SvgIcon: SvgIcon_default2 };
|
|
1439
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1440
|
+
return __returned__;
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
|
|
1444
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeMermaid.vue?type=template
|
|
1445
|
+
import { createVNode as _createVNode5, createTextVNode as _createTextVNode3, createElementVNode as _createElementVNode4, createCommentVNode as _createCommentVNode4, toDisplayString as _toDisplayString4, openBlock as _openBlock7, createElementBlock as _createElementBlock6, Fragment as _Fragment4 } from "vue";
|
|
1446
|
+
var _hoisted_16 = { class: "incremark-mermaid" };
|
|
1447
|
+
var _hoisted_23 = { class: "mermaid-header" };
|
|
1448
|
+
var _hoisted_33 = { class: "language" };
|
|
1449
|
+
var _hoisted_43 = { class: "mermaid-actions" };
|
|
1450
|
+
var _hoisted_53 = ["disabled", "aria-label", "title"];
|
|
1451
|
+
var _hoisted_63 = ["aria-label", "title"];
|
|
1452
|
+
var _hoisted_72 = { class: "mermaid-content" };
|
|
1453
|
+
var _hoisted_82 = {
|
|
1454
|
+
key: 0,
|
|
1455
|
+
class: "mermaid-loading"
|
|
1456
|
+
};
|
|
1457
|
+
var _hoisted_92 = { class: "mermaid-source-code" };
|
|
1458
|
+
var _hoisted_102 = { class: "mermaid-source-code" };
|
|
1459
|
+
var _hoisted_11 = ["innerHTML"];
|
|
1460
|
+
var _hoisted_122 = { class: "mermaid-source-code" };
|
|
1461
|
+
function render7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1462
|
+
return _openBlock7(), _createElementBlock6("div", _hoisted_16, [
|
|
1463
|
+
_createElementVNode4("div", _hoisted_23, [
|
|
1464
|
+
_createElementVNode4("span", _hoisted_33, [
|
|
1465
|
+
_createVNode5($setup["SvgIcon"], {
|
|
1466
|
+
svg: $setup.GravityMermaid,
|
|
1467
|
+
class: "language-icon"
|
|
1468
|
+
}, null, 8, ["svg"]),
|
|
1469
|
+
_cache[0] || (_cache[0] = _createTextVNode3(
|
|
1470
|
+
" MERMAID ",
|
|
1471
|
+
-1
|
|
1472
|
+
/* CACHED */
|
|
1473
|
+
))
|
|
1474
|
+
]),
|
|
1475
|
+
_createElementVNode4("div", _hoisted_43, [
|
|
1476
|
+
_createElementVNode4("button", {
|
|
1477
|
+
class: "code-btn",
|
|
1478
|
+
onClick: $setup.toggleMermaidView,
|
|
1479
|
+
type: "button",
|
|
1480
|
+
disabled: !$setup.mermaidSvg,
|
|
1481
|
+
"aria-label": $setup.mermaidViewMode === "preview" ? $setup.t("mermaid.viewSource") : $setup.t("mermaid.preview"),
|
|
1482
|
+
title: $setup.mermaidViewMode === "preview" ? "View Source" : "Preview"
|
|
1483
|
+
}, [
|
|
1484
|
+
_createVNode5($setup["SvgIcon"], {
|
|
1485
|
+
svg: $setup.mermaidViewMode === "preview" ? $setup.LucideCode : $setup.LucideEye
|
|
1486
|
+
}, null, 8, ["svg"])
|
|
1487
|
+
], 8, _hoisted_53),
|
|
1488
|
+
_createElementVNode4("button", {
|
|
1489
|
+
class: "code-btn",
|
|
1490
|
+
onClick: $setup.copyCode,
|
|
1491
|
+
type: "button",
|
|
1492
|
+
"aria-label": $setup.copied ? $setup.t("mermaid.copied") : $setup.t("mermaid.copy"),
|
|
1493
|
+
title: $setup.copied ? "Copied!" : "Copy"
|
|
1494
|
+
}, [
|
|
1495
|
+
_createVNode5($setup["SvgIcon"], {
|
|
1496
|
+
svg: $setup.copied ? $setup.LucideCopyCheck : $setup.LucideCopy
|
|
1497
|
+
}, null, 8, ["svg"])
|
|
1498
|
+
], 8, _hoisted_63)
|
|
1499
|
+
])
|
|
1500
|
+
]),
|
|
1501
|
+
_createElementVNode4("div", _hoisted_72, [
|
|
1502
|
+
_createCommentVNode4(" \u52A0\u8F7D\u4E2D "),
|
|
1503
|
+
$setup.mermaidLoading && !$setup.mermaidSvg ? (_openBlock7(), _createElementBlock6("div", _hoisted_82, [
|
|
1504
|
+
_createElementVNode4(
|
|
1505
|
+
"pre",
|
|
1506
|
+
_hoisted_92,
|
|
1507
|
+
_toDisplayString4($setup.code),
|
|
1508
|
+
1
|
|
1509
|
+
/* TEXT */
|
|
1510
|
+
)
|
|
1511
|
+
])) : $setup.mermaidViewMode === "source" ? (_openBlock7(), _createElementBlock6(
|
|
1512
|
+
_Fragment4,
|
|
1513
|
+
{ key: 1 },
|
|
1514
|
+
[
|
|
1515
|
+
_createCommentVNode4(" \u6E90\u7801\u6A21\u5F0F "),
|
|
1516
|
+
_createElementVNode4(
|
|
1517
|
+
"pre",
|
|
1518
|
+
_hoisted_102,
|
|
1519
|
+
_toDisplayString4($setup.code),
|
|
1520
|
+
1
|
|
1521
|
+
/* TEXT */
|
|
1522
|
+
)
|
|
1523
|
+
],
|
|
1524
|
+
2112
|
|
1525
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1526
|
+
)) : $setup.mermaidSvg ? (_openBlock7(), _createElementBlock6(
|
|
1527
|
+
_Fragment4,
|
|
1528
|
+
{ key: 2 },
|
|
1529
|
+
[
|
|
1530
|
+
_createCommentVNode4(" \u9884\u89C8\u6A21\u5F0F "),
|
|
1531
|
+
_createElementVNode4("div", {
|
|
1532
|
+
innerHTML: $setup.mermaidSvg,
|
|
1533
|
+
class: "mermaid-svg"
|
|
1534
|
+
}, null, 8, _hoisted_11)
|
|
1535
|
+
],
|
|
1536
|
+
2112
|
|
1537
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1538
|
+
)) : (_openBlock7(), _createElementBlock6(
|
|
1539
|
+
_Fragment4,
|
|
1540
|
+
{ key: 3 },
|
|
1541
|
+
[
|
|
1542
|
+
_createCommentVNode4(" \u65E0\u6CD5\u6E32\u67D3\u65F6\u663E\u793A\u6E90\u7801 "),
|
|
1543
|
+
_createElementVNode4(
|
|
1544
|
+
"pre",
|
|
1545
|
+
_hoisted_122,
|
|
1546
|
+
_toDisplayString4($setup.code),
|
|
1547
|
+
1
|
|
1548
|
+
/* TEXT */
|
|
1549
|
+
)
|
|
1550
|
+
],
|
|
1551
|
+
2112
|
|
1552
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1553
|
+
))
|
|
1554
|
+
])
|
|
1555
|
+
]);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
// src/components/IncremarkCodeMermaid.vue
|
|
1559
|
+
IncremarkCodeMermaid_default.render = render7;
|
|
1560
|
+
IncremarkCodeMermaid_default.__file = "src/components/IncremarkCodeMermaid.vue";
|
|
1561
|
+
var IncremarkCodeMermaid_default2 = IncremarkCodeMermaid_default;
|
|
1562
|
+
|
|
1563
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeDefault.vue?type=script
|
|
1564
|
+
import { defineComponent as _defineComponent8 } from "vue";
|
|
1565
|
+
import { computed as computed9, onUnmounted as onUnmounted6, ref as ref7, watch as watch6 } from "vue";
|
|
1566
|
+
import { LucideCopy as LucideCopy2, LucideCopyCheck as LucideCopyCheck2 } from "@incremark/icons";
|
|
1567
|
+
import { isClipboardAvailable as isClipboardAvailable2 } from "@incremark/shared";
|
|
1568
|
+
|
|
1569
|
+
// src/composables/useShiki.ts
|
|
1570
|
+
import { shallowRef as shallowRef5 } from "vue";
|
|
1571
|
+
var ShikiManager = class _ShikiManager {
|
|
1572
|
+
static instance = null;
|
|
1573
|
+
/** 存储 highlighter 实例,key 为主题名称 */
|
|
1574
|
+
highlighters = /* @__PURE__ */ new Map();
|
|
1575
|
+
constructor() {
|
|
1576
|
+
}
|
|
1577
|
+
static getInstance() {
|
|
1578
|
+
if (!_ShikiManager.instance) {
|
|
1579
|
+
_ShikiManager.instance = new _ShikiManager();
|
|
1580
|
+
}
|
|
1581
|
+
return _ShikiManager.instance;
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* 获取或创建 highlighter
|
|
1585
|
+
* @param theme 主题名称
|
|
1586
|
+
* @returns highlighter 实例
|
|
1587
|
+
*/
|
|
1588
|
+
async getHighlighter(theme) {
|
|
1589
|
+
if (this.highlighters.has(theme)) {
|
|
1590
|
+
return this.highlighters.get(theme);
|
|
1591
|
+
}
|
|
1592
|
+
const { createHighlighter } = await import("shiki");
|
|
1593
|
+
const highlighter = await createHighlighter({
|
|
1594
|
+
themes: [theme],
|
|
1595
|
+
langs: []
|
|
1596
|
+
});
|
|
1597
|
+
const info = {
|
|
1598
|
+
highlighter,
|
|
1599
|
+
loadedLanguages: /* @__PURE__ */ new Set(),
|
|
1600
|
+
loadedThemes: /* @__PURE__ */ new Set([theme])
|
|
1601
|
+
};
|
|
1602
|
+
this.highlighters.set(theme, info);
|
|
1603
|
+
return info;
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* 加载语言(按需)
|
|
1607
|
+
* @param theme 主题名称
|
|
1608
|
+
* @param lang 语言名称
|
|
1609
|
+
*/
|
|
1610
|
+
async loadLanguage(theme, lang) {
|
|
1611
|
+
const info = this.highlighters.get(theme);
|
|
1612
|
+
if (!info || info.loadedLanguages.has(lang)) return;
|
|
1613
|
+
try {
|
|
1614
|
+
await info.highlighter.loadLanguage(lang);
|
|
1615
|
+
info.loadedLanguages.add(lang);
|
|
1616
|
+
} catch {
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* 加载主题(按需)
|
|
1621
|
+
* @param theme 主题名称
|
|
1622
|
+
*/
|
|
1623
|
+
async loadTheme(theme) {
|
|
1624
|
+
const info = this.highlighters.get(theme);
|
|
1625
|
+
if (!info || info.loadedThemes.has(theme)) return;
|
|
1626
|
+
try {
|
|
1627
|
+
await info.highlighter.loadTheme(theme);
|
|
1628
|
+
info.loadedThemes.add(theme);
|
|
1629
|
+
} catch {
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* 高亮代码
|
|
1634
|
+
* @param theme 主题名称
|
|
1635
|
+
* @param code 代码内容
|
|
1636
|
+
* @param lang 语言名称
|
|
1637
|
+
* @param fallbackTheme 回退主题
|
|
1638
|
+
* @returns 高亮后的 HTML
|
|
1639
|
+
*/
|
|
1640
|
+
async codeToHtml(theme, code, lang, fallbackTheme) {
|
|
1641
|
+
const info = this.highlighters.get(theme);
|
|
1642
|
+
if (!info) throw new Error("Highlighter not found");
|
|
1643
|
+
const actualLang = info.loadedLanguages.has(lang) ? lang : "text";
|
|
1644
|
+
const actualTheme = info.loadedThemes.has(theme) ? theme : fallbackTheme;
|
|
1645
|
+
return info.highlighter.codeToHtml(code, {
|
|
1646
|
+
lang: actualLang,
|
|
1647
|
+
theme: actualTheme
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* 清理所有 highlighter(应用退出或需要重置时调用)
|
|
1652
|
+
*/
|
|
1653
|
+
disposeAll() {
|
|
1654
|
+
for (const [, info] of this.highlighters) {
|
|
1655
|
+
if (info.highlighter?.dispose) {
|
|
1656
|
+
info.highlighter.dispose();
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
this.highlighters.clear();
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1662
|
+
var shikiManagerInstance = null;
|
|
1663
|
+
function getShikiManager() {
|
|
1664
|
+
if (!shikiManagerInstance) {
|
|
1665
|
+
shikiManagerInstance = ShikiManager.getInstance();
|
|
1666
|
+
}
|
|
1667
|
+
return shikiManagerInstance;
|
|
1668
|
+
}
|
|
1669
|
+
function useShiki(theme) {
|
|
1670
|
+
const highlighterInfo = shallowRef5(null);
|
|
1671
|
+
const isHighlighting = shallowRef5(false);
|
|
1672
|
+
async function getHighlighter() {
|
|
1673
|
+
if (!highlighterInfo.value) {
|
|
1674
|
+
highlighterInfo.value = await getShikiManager().getHighlighter(theme);
|
|
1675
|
+
}
|
|
1676
|
+
return highlighterInfo.value;
|
|
1677
|
+
}
|
|
1678
|
+
async function highlight(code, lang, fallbackTheme) {
|
|
1679
|
+
isHighlighting.value = true;
|
|
1680
|
+
try {
|
|
1681
|
+
const info = await getHighlighter();
|
|
1682
|
+
const manager = getShikiManager();
|
|
1683
|
+
if (!info.loadedLanguages.has(lang) && lang !== "text") {
|
|
1684
|
+
await manager.loadLanguage(theme, lang);
|
|
1685
|
+
}
|
|
1686
|
+
if (!info.loadedThemes.has(theme)) {
|
|
1687
|
+
await manager.loadTheme(theme);
|
|
1347
1688
|
}
|
|
1689
|
+
return await manager.codeToHtml(theme, code, lang, fallbackTheme);
|
|
1690
|
+
} catch (e) {
|
|
1691
|
+
throw e;
|
|
1692
|
+
} finally {
|
|
1693
|
+
isHighlighting.value = false;
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
return {
|
|
1697
|
+
highlighterInfo,
|
|
1698
|
+
isHighlighting,
|
|
1699
|
+
highlight
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeDefault.vue?type=script
|
|
1704
|
+
var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent8({
|
|
1705
|
+
__name: "IncremarkCodeDefault",
|
|
1706
|
+
props: {
|
|
1707
|
+
node: { type: null, required: true },
|
|
1708
|
+
theme: { type: String, required: false, default: "github-dark" },
|
|
1709
|
+
fallbackTheme: { type: String, required: false, default: "github-dark" },
|
|
1710
|
+
disableHighlight: { type: Boolean, required: false, default: false }
|
|
1711
|
+
},
|
|
1712
|
+
setup(__props, { expose: __expose }) {
|
|
1713
|
+
__expose();
|
|
1714
|
+
const props = __props;
|
|
1715
|
+
const copied = ref7(false);
|
|
1716
|
+
const highlightedHtml = ref7("");
|
|
1717
|
+
const language = computed9(() => props.node.lang || "text");
|
|
1718
|
+
const code = computed9(() => props.node.value);
|
|
1719
|
+
const { t } = useLocale();
|
|
1720
|
+
const { isHighlighting, highlight } = useShiki(props.theme);
|
|
1721
|
+
async function doHighlight() {
|
|
1348
1722
|
if (!code.value || props.disableHighlight) {
|
|
1349
1723
|
highlightedHtml.value = "";
|
|
1350
1724
|
return;
|
|
1351
1725
|
}
|
|
1352
|
-
isHighlighting.value = true;
|
|
1353
|
-
highlightError.value = false;
|
|
1354
1726
|
try {
|
|
1355
|
-
|
|
1356
|
-
const { createHighlighter } = await import("shiki");
|
|
1357
|
-
highlighterRef.value = await createHighlighter({
|
|
1358
|
-
themes: [props.theme],
|
|
1359
|
-
langs: []
|
|
1360
|
-
});
|
|
1361
|
-
loadedThemes.add(props.theme);
|
|
1362
|
-
}
|
|
1363
|
-
const highlighter = highlighterRef.value;
|
|
1364
|
-
const lang = language.value;
|
|
1365
|
-
if (!loadedLanguages.has(lang) && lang !== "text") {
|
|
1366
|
-
try {
|
|
1367
|
-
await highlighter.loadLanguage(lang);
|
|
1368
|
-
loadedLanguages.add(lang);
|
|
1369
|
-
} catch {
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
if (!loadedThemes.has(props.theme)) {
|
|
1373
|
-
try {
|
|
1374
|
-
await highlighter.loadTheme(props.theme);
|
|
1375
|
-
loadedThemes.add(props.theme);
|
|
1376
|
-
} catch {
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
const html = highlighter.codeToHtml(code.value, {
|
|
1380
|
-
lang: loadedLanguages.has(lang) ? lang : "text",
|
|
1381
|
-
theme: loadedThemes.has(props.theme) ? props.theme : props.fallbackTheme
|
|
1382
|
-
});
|
|
1727
|
+
const html = await highlight(code.value, language.value, props.fallbackTheme);
|
|
1383
1728
|
highlightedHtml.value = html;
|
|
1384
1729
|
} catch (e) {
|
|
1385
|
-
highlightError.value = true;
|
|
1386
1730
|
highlightedHtml.value = "";
|
|
1387
|
-
} finally {
|
|
1388
|
-
isHighlighting.value = false;
|
|
1389
1731
|
}
|
|
1390
1732
|
}
|
|
1391
|
-
|
|
1733
|
+
watch6([code, () => props.theme], doHighlight, { immediate: true });
|
|
1734
|
+
let copyTimeoutId = null;
|
|
1392
1735
|
async function copyCode() {
|
|
1736
|
+
if (!isClipboardAvailable2()) return;
|
|
1393
1737
|
try {
|
|
1394
1738
|
await navigator.clipboard.writeText(code.value);
|
|
1395
1739
|
copied.value = true;
|
|
1396
|
-
|
|
1740
|
+
if (copyTimeoutId) {
|
|
1741
|
+
clearTimeout(copyTimeoutId);
|
|
1742
|
+
}
|
|
1743
|
+
copyTimeoutId = setTimeout(() => {
|
|
1397
1744
|
copied.value = false;
|
|
1398
1745
|
}, 2e3);
|
|
1399
1746
|
} catch {
|
|
1400
1747
|
}
|
|
1401
1748
|
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
}
|
|
1749
|
+
onUnmounted6(() => {
|
|
1750
|
+
if (copyTimeoutId) {
|
|
1751
|
+
clearTimeout(copyTimeoutId);
|
|
1752
|
+
}
|
|
1753
|
+
});
|
|
1754
|
+
const __returned__ = { props, copied, highlightedHtml, language, code, t, isHighlighting, highlight, doHighlight, get copyTimeoutId() {
|
|
1755
|
+
return copyTimeoutId;
|
|
1756
|
+
}, set copyTimeoutId(v) {
|
|
1757
|
+
copyTimeoutId = v;
|
|
1758
|
+
}, copyCode, get LucideCopy() {
|
|
1759
|
+
return LucideCopy2;
|
|
1760
|
+
}, get LucideCopyCheck() {
|
|
1761
|
+
return LucideCopyCheck2;
|
|
1762
|
+
}, SvgIcon: SvgIcon_default2 };
|
|
1407
1763
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1408
1764
|
return __returned__;
|
|
1409
1765
|
}
|
|
1410
1766
|
});
|
|
1411
1767
|
|
|
1412
|
-
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/
|
|
1413
|
-
import {
|
|
1414
|
-
var
|
|
1415
|
-
var
|
|
1416
|
-
var
|
|
1417
|
-
var
|
|
1418
|
-
var
|
|
1419
|
-
var
|
|
1420
|
-
key: 0,
|
|
1421
|
-
class: "mermaid-loading"
|
|
1422
|
-
};
|
|
1423
|
-
var _hoisted_72 = { class: "mermaid-source-code" };
|
|
1424
|
-
var _hoisted_82 = { class: "mermaid-source-code" };
|
|
1425
|
-
var _hoisted_92 = ["innerHTML"];
|
|
1426
|
-
var _hoisted_102 = { class: "mermaid-source-code" };
|
|
1427
|
-
var _hoisted_11 = { class: "incremark-code" };
|
|
1428
|
-
var _hoisted_122 = { class: "code-header" };
|
|
1429
|
-
var _hoisted_132 = { class: "language" };
|
|
1430
|
-
var _hoisted_142 = { class: "code-content" };
|
|
1431
|
-
var _hoisted_152 = {
|
|
1768
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCodeDefault.vue?type=template
|
|
1769
|
+
import { toDisplayString as _toDisplayString5, createElementVNode as _createElementVNode5, createVNode as _createVNode6, createCommentVNode as _createCommentVNode5, openBlock as _openBlock8, createElementBlock as _createElementBlock7, Fragment as _Fragment5 } from "vue";
|
|
1770
|
+
var _hoisted_17 = { class: "incremark-code" };
|
|
1771
|
+
var _hoisted_24 = { class: "code-header" };
|
|
1772
|
+
var _hoisted_34 = { class: "language" };
|
|
1773
|
+
var _hoisted_44 = ["aria-label", "title"];
|
|
1774
|
+
var _hoisted_54 = { class: "code-content" };
|
|
1775
|
+
var _hoisted_64 = {
|
|
1432
1776
|
key: 0,
|
|
1433
1777
|
class: "code-loading"
|
|
1434
1778
|
};
|
|
1435
|
-
var
|
|
1436
|
-
var
|
|
1437
|
-
function
|
|
1438
|
-
return
|
|
1439
|
-
|
|
1779
|
+
var _hoisted_73 = ["innerHTML"];
|
|
1780
|
+
var _hoisted_83 = { class: "code-fallback" };
|
|
1781
|
+
function render8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1782
|
+
return _openBlock8(), _createElementBlock7("div", _hoisted_17, [
|
|
1783
|
+
_createElementVNode5("div", _hoisted_24, [
|
|
1784
|
+
_createElementVNode5(
|
|
1785
|
+
"span",
|
|
1786
|
+
_hoisted_34,
|
|
1787
|
+
_toDisplayString5($setup.language),
|
|
1788
|
+
1
|
|
1789
|
+
/* TEXT */
|
|
1790
|
+
),
|
|
1791
|
+
_createElementVNode5("button", {
|
|
1792
|
+
class: "code-btn",
|
|
1793
|
+
onClick: $setup.copyCode,
|
|
1794
|
+
type: "button",
|
|
1795
|
+
"aria-label": $setup.copied ? $setup.t("code.copied") : $setup.t("code.copy"),
|
|
1796
|
+
title: $setup.copied ? "Copied!" : "Copy"
|
|
1797
|
+
}, [
|
|
1798
|
+
_createVNode6($setup["SvgIcon"], {
|
|
1799
|
+
svg: $setup.copied ? $setup.LucideCopyCheck : $setup.LucideCopy
|
|
1800
|
+
}, null, 8, ["svg"])
|
|
1801
|
+
], 8, _hoisted_44)
|
|
1802
|
+
]),
|
|
1803
|
+
_createElementVNode5("div", _hoisted_54, [
|
|
1804
|
+
_createCommentVNode5(" \u6B63\u5728\u52A0\u8F7D\u9AD8\u4EAE "),
|
|
1805
|
+
$setup.isHighlighting && !$setup.highlightedHtml ? (_openBlock8(), _createElementBlock7("div", _hoisted_64, [
|
|
1806
|
+
_createElementVNode5("pre", null, [
|
|
1807
|
+
_createElementVNode5(
|
|
1808
|
+
"code",
|
|
1809
|
+
null,
|
|
1810
|
+
_toDisplayString5($setup.code),
|
|
1811
|
+
1
|
|
1812
|
+
/* TEXT */
|
|
1813
|
+
)
|
|
1814
|
+
])
|
|
1815
|
+
])) : $setup.highlightedHtml ? (_openBlock8(), _createElementBlock7(
|
|
1816
|
+
_Fragment5,
|
|
1817
|
+
{ key: 1 },
|
|
1818
|
+
[
|
|
1819
|
+
_createCommentVNode5(" \u9AD8\u4EAE\u540E\u7684\u4EE3\u7801 "),
|
|
1820
|
+
_createElementVNode5("div", {
|
|
1821
|
+
innerHTML: $setup.highlightedHtml,
|
|
1822
|
+
class: "shiki-wrapper"
|
|
1823
|
+
}, null, 8, _hoisted_73)
|
|
1824
|
+
],
|
|
1825
|
+
2112
|
|
1826
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1827
|
+
)) : (_openBlock8(), _createElementBlock7(
|
|
1828
|
+
_Fragment5,
|
|
1829
|
+
{ key: 2 },
|
|
1830
|
+
[
|
|
1831
|
+
_createCommentVNode5(" \u56DE\u9000\uFF1A\u65E0\u9AD8\u4EAE "),
|
|
1832
|
+
_createElementVNode5("pre", _hoisted_83, [
|
|
1833
|
+
_createElementVNode5(
|
|
1834
|
+
"code",
|
|
1835
|
+
null,
|
|
1836
|
+
_toDisplayString5($setup.code),
|
|
1837
|
+
1
|
|
1838
|
+
/* TEXT */
|
|
1839
|
+
)
|
|
1840
|
+
])
|
|
1841
|
+
],
|
|
1842
|
+
2112
|
|
1843
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1844
|
+
))
|
|
1845
|
+
])
|
|
1846
|
+
]);
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
// src/components/IncremarkCodeDefault.vue
|
|
1850
|
+
IncremarkCodeDefault_default.render = render8;
|
|
1851
|
+
IncremarkCodeDefault_default.__file = "src/components/IncremarkCodeDefault.vue";
|
|
1852
|
+
var IncremarkCodeDefault_default2 = IncremarkCodeDefault_default;
|
|
1853
|
+
|
|
1854
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=script
|
|
1855
|
+
var IncremarkCode_default = /* @__PURE__ */ _defineComponent9({
|
|
1856
|
+
__name: "IncremarkCode",
|
|
1857
|
+
props: {
|
|
1858
|
+
node: { type: null, required: true },
|
|
1859
|
+
theme: { type: String, required: false, default: "github-dark" },
|
|
1860
|
+
fallbackTheme: { type: String, required: false, default: "github-dark" },
|
|
1861
|
+
disableHighlight: { type: Boolean, required: false, default: false },
|
|
1862
|
+
mermaidDelay: { type: Number, required: false, default: 500 },
|
|
1863
|
+
customCodeBlocks: { type: Object, required: false, default: () => ({}) },
|
|
1864
|
+
codeBlockConfigs: { type: Object, required: false, default: () => ({}) },
|
|
1865
|
+
blockStatus: { type: String, required: false, default: "completed" },
|
|
1866
|
+
defaultCodeComponent: { type: null, required: false, default: () => IncremarkCodeDefault_default2 }
|
|
1867
|
+
},
|
|
1868
|
+
setup(__props, { expose: __expose }) {
|
|
1869
|
+
__expose();
|
|
1870
|
+
const props = __props;
|
|
1871
|
+
const language = computed10(() => props.node.lang || "text");
|
|
1872
|
+
const CustomCodeBlock = computed10(() => {
|
|
1873
|
+
const component = props.customCodeBlocks?.[language.value];
|
|
1874
|
+
if (!component) return null;
|
|
1875
|
+
const config = props.codeBlockConfigs?.[language.value];
|
|
1876
|
+
if (config?.takeOver) {
|
|
1877
|
+
return component;
|
|
1878
|
+
}
|
|
1879
|
+
if (props.blockStatus !== "completed") {
|
|
1880
|
+
return null;
|
|
1881
|
+
}
|
|
1882
|
+
return component;
|
|
1883
|
+
});
|
|
1884
|
+
const isMermaid = computed10(() => language.value === "mermaid");
|
|
1885
|
+
const __returned__ = { props, language, CustomCodeBlock, isMermaid, IncremarkCodeMermaid: IncremarkCodeMermaid_default2 };
|
|
1886
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1887
|
+
return __returned__;
|
|
1888
|
+
}
|
|
1889
|
+
});
|
|
1890
|
+
|
|
1891
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=template
|
|
1892
|
+
import { createCommentVNode as _createCommentVNode6, resolveDynamicComponent as _resolveDynamicComponent3, openBlock as _openBlock9, createBlock as _createBlock3, createVNode as _createVNode7, Fragment as _Fragment6, createElementBlock as _createElementBlock8 } from "vue";
|
|
1893
|
+
function render9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1894
|
+
return _openBlock9(), _createElementBlock8(
|
|
1895
|
+
_Fragment6,
|
|
1440
1896
|
null,
|
|
1441
1897
|
[
|
|
1442
|
-
|
|
1443
|
-
$setup.CustomCodeBlock ? (
|
|
1898
|
+
_createCommentVNode6(" \u81EA\u5B9A\u4E49\u4EE3\u7801\u5757\u7EC4\u4EF6 "),
|
|
1899
|
+
$setup.CustomCodeBlock ? (_openBlock9(), _createBlock3(_resolveDynamicComponent3($setup.CustomCodeBlock), {
|
|
1444
1900
|
key: 0,
|
|
1445
|
-
"code-str": $
|
|
1901
|
+
"code-str": $props.node.value,
|
|
1446
1902
|
lang: $setup.language,
|
|
1447
1903
|
completed: $props.blockStatus === "completed",
|
|
1448
1904
|
takeOver: $props.codeBlockConfigs?.[$setup.language]?.takeOver
|
|
1449
|
-
}, null, 8, ["code-str", "lang", "completed", "takeOver"])) : $setup.isMermaid ? (
|
|
1450
|
-
|
|
1905
|
+
}, null, 8, ["code-str", "lang", "completed", "takeOver"])) : $setup.isMermaid ? (_openBlock9(), _createElementBlock8(
|
|
1906
|
+
_Fragment6,
|
|
1451
1907
|
{ key: 1 },
|
|
1452
1908
|
[
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
{ class: "language" },
|
|
1459
|
-
"MERMAID",
|
|
1460
|
-
-1
|
|
1461
|
-
/* CACHED */
|
|
1462
|
-
)),
|
|
1463
|
-
_createElementVNode4("div", _hoisted_33, [
|
|
1464
|
-
_createElementVNode4("button", {
|
|
1465
|
-
class: "code-btn",
|
|
1466
|
-
onClick: $setup.toggleMermaidView,
|
|
1467
|
-
type: "button",
|
|
1468
|
-
disabled: !$setup.mermaidSvg
|
|
1469
|
-
}, _toDisplayString4($setup.mermaidViewMode === "preview" ? "\u6E90\u7801" : "\u9884\u89C8"), 9, _hoisted_43),
|
|
1470
|
-
_createElementVNode4(
|
|
1471
|
-
"button",
|
|
1472
|
-
{
|
|
1473
|
-
class: "code-btn",
|
|
1474
|
-
onClick: $setup.copyCode,
|
|
1475
|
-
type: "button"
|
|
1476
|
-
},
|
|
1477
|
-
_toDisplayString4($setup.copied ? "\u2713 \u5DF2\u590D\u5236" : "\u590D\u5236"),
|
|
1478
|
-
1
|
|
1479
|
-
/* TEXT */
|
|
1480
|
-
)
|
|
1481
|
-
])
|
|
1482
|
-
]),
|
|
1483
|
-
_createElementVNode4("div", _hoisted_53, [
|
|
1484
|
-
_createCommentVNode4(" \u52A0\u8F7D\u4E2D "),
|
|
1485
|
-
$setup.mermaidLoading && !$setup.mermaidSvg ? (_openBlock6(), _createElementBlock5("div", _hoisted_63, [
|
|
1486
|
-
_createElementVNode4(
|
|
1487
|
-
"pre",
|
|
1488
|
-
_hoisted_72,
|
|
1489
|
-
_toDisplayString4($setup.code),
|
|
1490
|
-
1
|
|
1491
|
-
/* TEXT */
|
|
1492
|
-
)
|
|
1493
|
-
])) : $setup.mermaidViewMode === "source" ? (_openBlock6(), _createElementBlock5(
|
|
1494
|
-
_Fragment4,
|
|
1495
|
-
{ key: 1 },
|
|
1496
|
-
[
|
|
1497
|
-
_createCommentVNode4(" \u6E90\u7801\u6A21\u5F0F "),
|
|
1498
|
-
_createElementVNode4(
|
|
1499
|
-
"pre",
|
|
1500
|
-
_hoisted_82,
|
|
1501
|
-
_toDisplayString4($setup.code),
|
|
1502
|
-
1
|
|
1503
|
-
/* TEXT */
|
|
1504
|
-
)
|
|
1505
|
-
],
|
|
1506
|
-
2112
|
|
1507
|
-
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1508
|
-
)) : $setup.mermaidSvg ? (_openBlock6(), _createElementBlock5(
|
|
1509
|
-
_Fragment4,
|
|
1510
|
-
{ key: 2 },
|
|
1511
|
-
[
|
|
1512
|
-
_createCommentVNode4(" \u9884\u89C8\u6A21\u5F0F "),
|
|
1513
|
-
_createElementVNode4("div", {
|
|
1514
|
-
innerHTML: $setup.mermaidSvg,
|
|
1515
|
-
class: "mermaid-svg"
|
|
1516
|
-
}, null, 8, _hoisted_92)
|
|
1517
|
-
],
|
|
1518
|
-
2112
|
|
1519
|
-
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1520
|
-
)) : (_openBlock6(), _createElementBlock5(
|
|
1521
|
-
_Fragment4,
|
|
1522
|
-
{ key: 3 },
|
|
1523
|
-
[
|
|
1524
|
-
_createCommentVNode4(" \u65E0\u6CD5\u6E32\u67D3\u65F6\u663E\u793A\u6E90\u7801 "),
|
|
1525
|
-
_createElementVNode4(
|
|
1526
|
-
"pre",
|
|
1527
|
-
_hoisted_102,
|
|
1528
|
-
_toDisplayString4($setup.code),
|
|
1529
|
-
1
|
|
1530
|
-
/* TEXT */
|
|
1531
|
-
)
|
|
1532
|
-
],
|
|
1533
|
-
2112
|
|
1534
|
-
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1535
|
-
))
|
|
1536
|
-
])
|
|
1537
|
-
])
|
|
1909
|
+
_createCommentVNode6(" Mermaid \u56FE\u8868 "),
|
|
1910
|
+
_createVNode7($setup["IncremarkCodeMermaid"], {
|
|
1911
|
+
node: $props.node,
|
|
1912
|
+
"mermaid-delay": $props.mermaidDelay
|
|
1913
|
+
}, null, 8, ["node", "mermaid-delay"])
|
|
1538
1914
|
],
|
|
1539
1915
|
2112
|
|
1540
1916
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1541
|
-
)) : (
|
|
1542
|
-
|
|
1917
|
+
)) : (_openBlock9(), _createElementBlock8(
|
|
1918
|
+
_Fragment6,
|
|
1543
1919
|
{ key: 2 },
|
|
1544
1920
|
[
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
1
|
|
1553
|
-
/* TEXT */
|
|
1554
|
-
),
|
|
1555
|
-
_createElementVNode4(
|
|
1556
|
-
"button",
|
|
1557
|
-
{
|
|
1558
|
-
class: "code-btn",
|
|
1559
|
-
onClick: $setup.copyCode,
|
|
1560
|
-
type: "button"
|
|
1561
|
-
},
|
|
1562
|
-
_toDisplayString4($setup.copied ? "\u2713 \u5DF2\u590D\u5236" : "\u590D\u5236"),
|
|
1563
|
-
1
|
|
1564
|
-
/* TEXT */
|
|
1565
|
-
)
|
|
1566
|
-
]),
|
|
1567
|
-
_createElementVNode4("div", _hoisted_142, [
|
|
1568
|
-
_createCommentVNode4(" \u6B63\u5728\u52A0\u8F7D\u9AD8\u4EAE "),
|
|
1569
|
-
$setup.isHighlighting && !$setup.highlightedHtml ? (_openBlock6(), _createElementBlock5("div", _hoisted_152, [
|
|
1570
|
-
_createElementVNode4("pre", null, [
|
|
1571
|
-
_createElementVNode4(
|
|
1572
|
-
"code",
|
|
1573
|
-
null,
|
|
1574
|
-
_toDisplayString4($setup.code),
|
|
1575
|
-
1
|
|
1576
|
-
/* TEXT */
|
|
1577
|
-
)
|
|
1578
|
-
])
|
|
1579
|
-
])) : $setup.highlightedHtml ? (_openBlock6(), _createElementBlock5(
|
|
1580
|
-
_Fragment4,
|
|
1581
|
-
{ key: 1 },
|
|
1582
|
-
[
|
|
1583
|
-
_createCommentVNode4(" \u9AD8\u4EAE\u540E\u7684\u4EE3\u7801 "),
|
|
1584
|
-
_createElementVNode4("div", {
|
|
1585
|
-
innerHTML: $setup.highlightedHtml,
|
|
1586
|
-
class: "shiki-wrapper"
|
|
1587
|
-
}, null, 8, _hoisted_16)
|
|
1588
|
-
],
|
|
1589
|
-
2112
|
|
1590
|
-
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1591
|
-
)) : (_openBlock6(), _createElementBlock5(
|
|
1592
|
-
_Fragment4,
|
|
1593
|
-
{ key: 2 },
|
|
1594
|
-
[
|
|
1595
|
-
_createCommentVNode4(" \u56DE\u9000\uFF1A\u65E0\u9AD8\u4EAE "),
|
|
1596
|
-
_createElementVNode4("pre", _hoisted_17, [
|
|
1597
|
-
_createElementVNode4(
|
|
1598
|
-
"code",
|
|
1599
|
-
null,
|
|
1600
|
-
_toDisplayString4($setup.code),
|
|
1601
|
-
1
|
|
1602
|
-
/* TEXT */
|
|
1603
|
-
)
|
|
1604
|
-
])
|
|
1605
|
-
],
|
|
1606
|
-
2112
|
|
1607
|
-
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1608
|
-
))
|
|
1609
|
-
])
|
|
1610
|
-
])
|
|
1921
|
+
_createCommentVNode6(" \u9ED8\u8BA4\u4EE3\u7801\u5757\u6E32\u67D3\uFF08\u652F\u6301\u7528\u6237\u81EA\u5B9A\u4E49\uFF09 "),
|
|
1922
|
+
(_openBlock9(), _createBlock3(_resolveDynamicComponent3($props.defaultCodeComponent), {
|
|
1923
|
+
node: $props.node,
|
|
1924
|
+
theme: $props.theme,
|
|
1925
|
+
"fallback-theme": $props.fallbackTheme,
|
|
1926
|
+
"disable-highlight": $props.disableHighlight
|
|
1927
|
+
}, null, 8, ["node", "theme", "fallback-theme", "disable-highlight"]))
|
|
1611
1928
|
],
|
|
1612
1929
|
2112
|
|
1613
1930
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
@@ -1619,14 +1936,14 @@ function render6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1619
1936
|
}
|
|
1620
1937
|
|
|
1621
1938
|
// src/components/IncremarkCode.vue
|
|
1622
|
-
IncremarkCode_default.render =
|
|
1939
|
+
IncremarkCode_default.render = render9;
|
|
1623
1940
|
IncremarkCode_default.__file = "src/components/IncremarkCode.vue";
|
|
1624
1941
|
var IncremarkCode_default2 = IncremarkCode_default;
|
|
1625
1942
|
|
|
1626
1943
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkList.vue?type=script
|
|
1627
|
-
import { defineComponent as
|
|
1628
|
-
import { computed as
|
|
1629
|
-
var IncremarkList_default = /* @__PURE__ */
|
|
1944
|
+
import { defineComponent as _defineComponent10 } from "vue";
|
|
1945
|
+
import { computed as computed11 } from "vue";
|
|
1946
|
+
var IncremarkList_default = /* @__PURE__ */ _defineComponent10({
|
|
1630
1947
|
...{
|
|
1631
1948
|
name: "IncremarkList"
|
|
1632
1949
|
},
|
|
@@ -1637,7 +1954,7 @@ var IncremarkList_default = /* @__PURE__ */ _defineComponent7({
|
|
|
1637
1954
|
setup(__props, { expose: __expose }) {
|
|
1638
1955
|
__expose();
|
|
1639
1956
|
const props = __props;
|
|
1640
|
-
const tag =
|
|
1957
|
+
const tag = computed11(() => props.node.ordered ? "ol" : "ul");
|
|
1641
1958
|
function getItemInlineContent(item) {
|
|
1642
1959
|
const firstChild = item.children[0];
|
|
1643
1960
|
if (firstChild?.type === "paragraph") {
|
|
@@ -1663,61 +1980,62 @@ var IncremarkList_default = /* @__PURE__ */ _defineComponent7({
|
|
|
1663
1980
|
});
|
|
1664
1981
|
|
|
1665
1982
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkList.vue?type=template
|
|
1666
|
-
import { renderList as _renderList3, Fragment as
|
|
1983
|
+
import { renderList as _renderList3, Fragment as _Fragment7, openBlock as _openBlock10, createElementBlock as _createElementBlock9, createElementVNode as _createElementVNode6, createVNode as _createVNode8, createCommentVNode as _createCommentVNode7, createBlock as _createBlock4, normalizeClass as _normalizeClass3, resolveDynamicComponent as _resolveDynamicComponent4, withCtx as _withCtx3 } from "vue";
|
|
1667
1984
|
var _hoisted_18 = {
|
|
1668
1985
|
key: 0,
|
|
1669
1986
|
class: "task-label"
|
|
1670
1987
|
};
|
|
1671
|
-
var
|
|
1672
|
-
var
|
|
1673
|
-
function
|
|
1674
|
-
return
|
|
1675
|
-
class:
|
|
1988
|
+
var _hoisted_25 = ["checked"];
|
|
1989
|
+
var _hoisted_35 = { class: "task-content" };
|
|
1990
|
+
function render10(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1991
|
+
return _openBlock10(), _createBlock4(_resolveDynamicComponent4($setup.tag), {
|
|
1992
|
+
class: _normalizeClass3(["incremark-list", { "task-list": $props.node.children.some((item) => item.checked !== null && item.checked !== void 0) }]),
|
|
1993
|
+
start: $props.node.start || void 0
|
|
1676
1994
|
}, {
|
|
1677
1995
|
default: _withCtx3(() => [
|
|
1678
|
-
(
|
|
1679
|
-
|
|
1996
|
+
(_openBlock10(true), _createElementBlock9(
|
|
1997
|
+
_Fragment7,
|
|
1680
1998
|
null,
|
|
1681
1999
|
_renderList3($props.node.children, (item, index) => {
|
|
1682
|
-
return
|
|
2000
|
+
return _openBlock10(), _createElementBlock9(
|
|
1683
2001
|
"li",
|
|
1684
2002
|
{
|
|
1685
2003
|
key: index,
|
|
1686
|
-
class:
|
|
2004
|
+
class: _normalizeClass3(["incremark-list-item", { "task-item": item.checked !== null && item.checked !== void 0 }])
|
|
1687
2005
|
},
|
|
1688
2006
|
[
|
|
1689
|
-
item.checked !== null && item.checked !== void 0 ? (
|
|
1690
|
-
|
|
2007
|
+
item.checked !== null && item.checked !== void 0 ? (_openBlock10(), _createElementBlock9("label", _hoisted_18, [
|
|
2008
|
+
_createElementVNode6("input", {
|
|
1691
2009
|
type: "checkbox",
|
|
1692
2010
|
checked: item.checked,
|
|
1693
2011
|
disabled: "",
|
|
1694
2012
|
class: "checkbox"
|
|
1695
|
-
}, null, 8,
|
|
1696
|
-
|
|
1697
|
-
|
|
2013
|
+
}, null, 8, _hoisted_25),
|
|
2014
|
+
_createElementVNode6("span", _hoisted_35, [
|
|
2015
|
+
_createVNode8($setup["IncremarkInline"], {
|
|
1698
2016
|
nodes: $setup.getItemInlineContent(item)
|
|
1699
2017
|
}, null, 8, ["nodes"])
|
|
1700
2018
|
])
|
|
1701
|
-
])) : (
|
|
1702
|
-
|
|
2019
|
+
])) : (_openBlock10(), _createElementBlock9(
|
|
2020
|
+
_Fragment7,
|
|
1703
2021
|
{ key: 1 },
|
|
1704
2022
|
[
|
|
1705
|
-
|
|
2023
|
+
_createVNode8($setup["IncremarkInline"], {
|
|
1706
2024
|
nodes: $setup.getItemInlineContent(item)
|
|
1707
2025
|
}, null, 8, ["nodes"]),
|
|
1708
|
-
|
|
1709
|
-
$setup.hasBlockChildren(item) ? (
|
|
1710
|
-
|
|
2026
|
+
_createCommentVNode7(" \u9012\u5F52\u6E32\u67D3\u6240\u6709\u5757\u7EA7\u5185\u5BB9\uFF08\u5D4C\u5957\u5217\u8868\u3001heading\u3001blockquote\u3001code\u3001table \u7B49\uFF09 "),
|
|
2027
|
+
$setup.hasBlockChildren(item) ? (_openBlock10(true), _createElementBlock9(
|
|
2028
|
+
_Fragment7,
|
|
1711
2029
|
{ key: 0 },
|
|
1712
2030
|
_renderList3($setup.getItemBlockChildren(item), (child, childIndex) => {
|
|
1713
|
-
return
|
|
2031
|
+
return _openBlock10(), _createBlock4($setup["IncremarkRenderer"], {
|
|
1714
2032
|
key: childIndex,
|
|
1715
2033
|
node: child
|
|
1716
2034
|
}, null, 8, ["node"]);
|
|
1717
2035
|
}),
|
|
1718
2036
|
128
|
|
1719
2037
|
/* KEYED_FRAGMENT */
|
|
1720
|
-
)) :
|
|
2038
|
+
)) : _createCommentVNode7("v-if", true)
|
|
1721
2039
|
],
|
|
1722
2040
|
64
|
|
1723
2041
|
/* STABLE_FRAGMENT */
|
|
@@ -1733,17 +2051,17 @@ function render7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1733
2051
|
]),
|
|
1734
2052
|
_: 1
|
|
1735
2053
|
/* STABLE */
|
|
1736
|
-
}, 8, ["class"]);
|
|
2054
|
+
}, 8, ["class", "start"]);
|
|
1737
2055
|
}
|
|
1738
2056
|
|
|
1739
2057
|
// src/components/IncremarkList.vue
|
|
1740
|
-
IncremarkList_default.render =
|
|
2058
|
+
IncremarkList_default.render = render10;
|
|
1741
2059
|
IncremarkList_default.__file = "src/components/IncremarkList.vue";
|
|
1742
2060
|
var IncremarkList_default2 = IncremarkList_default;
|
|
1743
2061
|
|
|
1744
2062
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkTable.vue?type=script
|
|
1745
|
-
import { defineComponent as
|
|
1746
|
-
var IncremarkTable_default = /* @__PURE__ */
|
|
2063
|
+
import { defineComponent as _defineComponent11 } from "vue";
|
|
2064
|
+
var IncremarkTable_default = /* @__PURE__ */ _defineComponent11({
|
|
1747
2065
|
__name: "IncremarkTable",
|
|
1748
2066
|
props: {
|
|
1749
2067
|
node: { type: null, required: true }
|
|
@@ -1760,62 +2078,62 @@ var IncremarkTable_default = /* @__PURE__ */ _defineComponent8({
|
|
|
1760
2078
|
});
|
|
1761
2079
|
|
|
1762
2080
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkTable.vue?type=template
|
|
1763
|
-
import { renderList as _renderList4, Fragment as
|
|
2081
|
+
import { renderList as _renderList4, Fragment as _Fragment8, openBlock as _openBlock11, createElementBlock as _createElementBlock10, createVNode as _createVNode9, normalizeClass as _normalizeClass4, createCommentVNode as _createCommentVNode8, createElementVNode as _createElementVNode7 } from "vue";
|
|
1764
2082
|
var _hoisted_19 = { class: "incremark-table-wrapper" };
|
|
1765
|
-
var
|
|
1766
|
-
var
|
|
1767
|
-
function
|
|
1768
|
-
return
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
$props.node.children[0] ? (
|
|
1772
|
-
(
|
|
1773
|
-
|
|
2083
|
+
var _hoisted_26 = { class: "incremark-table" };
|
|
2084
|
+
var _hoisted_36 = { key: 0 };
|
|
2085
|
+
function render11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2086
|
+
return _openBlock11(), _createElementBlock10("div", _hoisted_19, [
|
|
2087
|
+
_createElementVNode7("table", _hoisted_26, [
|
|
2088
|
+
_createElementVNode7("thead", null, [
|
|
2089
|
+
$props.node.children[0] ? (_openBlock11(), _createElementBlock10("tr", _hoisted_36, [
|
|
2090
|
+
(_openBlock11(true), _createElementBlock10(
|
|
2091
|
+
_Fragment8,
|
|
1774
2092
|
null,
|
|
1775
2093
|
_renderList4($props.node.children[0].children, (cell, cellIndex) => {
|
|
1776
|
-
return
|
|
2094
|
+
return _openBlock11(), _createElementBlock10(
|
|
1777
2095
|
"th",
|
|
1778
2096
|
{
|
|
1779
2097
|
key: cellIndex,
|
|
1780
|
-
|
|
2098
|
+
class: _normalizeClass4(`incremark-table-align-${$props.node.align?.[cellIndex] || "left"}`)
|
|
1781
2099
|
},
|
|
1782
2100
|
[
|
|
1783
|
-
|
|
2101
|
+
_createVNode9($setup["IncremarkInline"], {
|
|
1784
2102
|
nodes: $setup.getCellContent(cell)
|
|
1785
2103
|
}, null, 8, ["nodes"])
|
|
1786
2104
|
],
|
|
1787
|
-
|
|
1788
|
-
/*
|
|
2105
|
+
2
|
|
2106
|
+
/* CLASS */
|
|
1789
2107
|
);
|
|
1790
2108
|
}),
|
|
1791
2109
|
128
|
|
1792
2110
|
/* KEYED_FRAGMENT */
|
|
1793
2111
|
))
|
|
1794
|
-
])) :
|
|
2112
|
+
])) : _createCommentVNode8("v-if", true)
|
|
1795
2113
|
]),
|
|
1796
|
-
|
|
1797
|
-
(
|
|
1798
|
-
|
|
2114
|
+
_createElementVNode7("tbody", null, [
|
|
2115
|
+
(_openBlock11(true), _createElementBlock10(
|
|
2116
|
+
_Fragment8,
|
|
1799
2117
|
null,
|
|
1800
2118
|
_renderList4($props.node.children.slice(1), (row, rowIndex) => {
|
|
1801
|
-
return
|
|
1802
|
-
(
|
|
1803
|
-
|
|
2119
|
+
return _openBlock11(), _createElementBlock10("tr", { key: rowIndex }, [
|
|
2120
|
+
(_openBlock11(true), _createElementBlock10(
|
|
2121
|
+
_Fragment8,
|
|
1804
2122
|
null,
|
|
1805
2123
|
_renderList4(row.children, (cell, cellIndex) => {
|
|
1806
|
-
return
|
|
2124
|
+
return _openBlock11(), _createElementBlock10(
|
|
1807
2125
|
"td",
|
|
1808
2126
|
{
|
|
1809
2127
|
key: cellIndex,
|
|
1810
|
-
|
|
2128
|
+
class: _normalizeClass4(`incremark-table-align-${$props.node.align?.[cellIndex] || "left"}`)
|
|
1811
2129
|
},
|
|
1812
2130
|
[
|
|
1813
|
-
|
|
2131
|
+
_createVNode9($setup["IncremarkInline"], {
|
|
1814
2132
|
nodes: $setup.getCellContent(cell)
|
|
1815
2133
|
}, null, 8, ["nodes"])
|
|
1816
2134
|
],
|
|
1817
|
-
|
|
1818
|
-
/*
|
|
2135
|
+
2
|
|
2136
|
+
/* CLASS */
|
|
1819
2137
|
);
|
|
1820
2138
|
}),
|
|
1821
2139
|
128
|
|
@@ -1832,13 +2150,13 @@ function render8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1832
2150
|
}
|
|
1833
2151
|
|
|
1834
2152
|
// src/components/IncremarkTable.vue
|
|
1835
|
-
IncremarkTable_default.render =
|
|
2153
|
+
IncremarkTable_default.render = render11;
|
|
1836
2154
|
IncremarkTable_default.__file = "src/components/IncremarkTable.vue";
|
|
1837
2155
|
var IncremarkTable_default2 = IncremarkTable_default;
|
|
1838
2156
|
|
|
1839
2157
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkBlockquote.vue?type=script
|
|
1840
|
-
import { defineComponent as
|
|
1841
|
-
var IncremarkBlockquote_default = /* @__PURE__ */
|
|
2158
|
+
import { defineComponent as _defineComponent12 } from "vue";
|
|
2159
|
+
var IncremarkBlockquote_default = /* @__PURE__ */ _defineComponent12({
|
|
1842
2160
|
__name: "IncremarkBlockquote",
|
|
1843
2161
|
props: {
|
|
1844
2162
|
node: { type: null, required: true }
|
|
@@ -1852,15 +2170,15 @@ var IncremarkBlockquote_default = /* @__PURE__ */ _defineComponent9({
|
|
|
1852
2170
|
});
|
|
1853
2171
|
|
|
1854
2172
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkBlockquote.vue?type=template
|
|
1855
|
-
import { renderList as _renderList5, Fragment as
|
|
2173
|
+
import { renderList as _renderList5, Fragment as _Fragment9, openBlock as _openBlock12, createElementBlock as _createElementBlock11, createBlock as _createBlock5 } from "vue";
|
|
1856
2174
|
var _hoisted_110 = { class: "incremark-blockquote" };
|
|
1857
|
-
function
|
|
1858
|
-
return
|
|
1859
|
-
(
|
|
1860
|
-
|
|
2175
|
+
function render12(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2176
|
+
return _openBlock12(), _createElementBlock11("blockquote", _hoisted_110, [
|
|
2177
|
+
(_openBlock12(true), _createElementBlock11(
|
|
2178
|
+
_Fragment9,
|
|
1861
2179
|
null,
|
|
1862
2180
|
_renderList5($props.node.children, (child, index) => {
|
|
1863
|
-
return
|
|
2181
|
+
return _openBlock12(), _createBlock5($setup["IncremarkRenderer"], {
|
|
1864
2182
|
key: index,
|
|
1865
2183
|
node: child
|
|
1866
2184
|
}, null, 8, ["node"]);
|
|
@@ -1872,13 +2190,13 @@ function render9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1872
2190
|
}
|
|
1873
2191
|
|
|
1874
2192
|
// src/components/IncremarkBlockquote.vue
|
|
1875
|
-
IncremarkBlockquote_default.render =
|
|
2193
|
+
IncremarkBlockquote_default.render = render12;
|
|
1876
2194
|
IncremarkBlockquote_default.__file = "src/components/IncremarkBlockquote.vue";
|
|
1877
2195
|
var IncremarkBlockquote_default2 = IncremarkBlockquote_default;
|
|
1878
2196
|
|
|
1879
2197
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkThematicBreak.vue?type=script
|
|
1880
|
-
import { defineComponent as
|
|
1881
|
-
var IncremarkThematicBreak_default = /* @__PURE__ */
|
|
2198
|
+
import { defineComponent as _defineComponent13 } from "vue";
|
|
2199
|
+
var IncremarkThematicBreak_default = /* @__PURE__ */ _defineComponent13({
|
|
1882
2200
|
__name: "IncremarkThematicBreak",
|
|
1883
2201
|
setup(__props, { expose: __expose }) {
|
|
1884
2202
|
__expose();
|
|
@@ -1889,20 +2207,20 @@ var IncremarkThematicBreak_default = /* @__PURE__ */ _defineComponent10({
|
|
|
1889
2207
|
});
|
|
1890
2208
|
|
|
1891
2209
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkThematicBreak.vue?type=template
|
|
1892
|
-
import { openBlock as
|
|
2210
|
+
import { openBlock as _openBlock13, createElementBlock as _createElementBlock12 } from "vue";
|
|
1893
2211
|
var _hoisted_111 = { class: "incremark-hr" };
|
|
1894
|
-
function
|
|
1895
|
-
return
|
|
2212
|
+
function render13(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2213
|
+
return _openBlock13(), _createElementBlock12("hr", _hoisted_111);
|
|
1896
2214
|
}
|
|
1897
2215
|
|
|
1898
2216
|
// src/components/IncremarkThematicBreak.vue
|
|
1899
|
-
IncremarkThematicBreak_default.render =
|
|
2217
|
+
IncremarkThematicBreak_default.render = render13;
|
|
1900
2218
|
IncremarkThematicBreak_default.__file = "src/components/IncremarkThematicBreak.vue";
|
|
1901
2219
|
var IncremarkThematicBreak_default2 = IncremarkThematicBreak_default;
|
|
1902
2220
|
|
|
1903
2221
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContainer.vue?type=script
|
|
1904
|
-
import { defineComponent as
|
|
1905
|
-
var IncremarkContainer_default = /* @__PURE__ */
|
|
2222
|
+
import { defineComponent as _defineComponent14 } from "vue";
|
|
2223
|
+
var IncremarkContainer_default = /* @__PURE__ */ _defineComponent14({
|
|
1906
2224
|
__name: "IncremarkContainer",
|
|
1907
2225
|
props: {
|
|
1908
2226
|
node: { type: Object, required: true },
|
|
@@ -1934,56 +2252,56 @@ var IncremarkContainer_default = /* @__PURE__ */ _defineComponent11({
|
|
|
1934
2252
|
});
|
|
1935
2253
|
|
|
1936
2254
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContainer.vue?type=template
|
|
1937
|
-
import { createCommentVNode as
|
|
2255
|
+
import { createCommentVNode as _createCommentVNode9, renderList as _renderList6, Fragment as _Fragment10, openBlock as _openBlock14, createElementBlock as _createElementBlock13, createBlock as _createBlock6, resolveDynamicComponent as _resolveDynamicComponent5, withCtx as _withCtx4, normalizeClass as _normalizeClass5, createElementVNode as _createElementVNode8 } from "vue";
|
|
1938
2256
|
var _hoisted_112 = {
|
|
1939
2257
|
key: 0,
|
|
1940
2258
|
class: "incremark-container-content"
|
|
1941
2259
|
};
|
|
1942
|
-
function
|
|
1943
|
-
return
|
|
1944
|
-
|
|
2260
|
+
function render14(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2261
|
+
return _openBlock14(), _createElementBlock13(
|
|
2262
|
+
_Fragment10,
|
|
1945
2263
|
null,
|
|
1946
2264
|
[
|
|
1947
|
-
|
|
1948
|
-
$setup.hasCustomContainer ? (
|
|
2265
|
+
_createCommentVNode9(" \u5982\u679C\u6709\u81EA\u5B9A\u4E49\u5BB9\u5668\u7EC4\u4EF6\uFF0C\u4F7F\u7528\u81EA\u5B9A\u4E49\u7EC4\u4EF6 "),
|
|
2266
|
+
$setup.hasCustomContainer ? (_openBlock14(), _createBlock6(_resolveDynamicComponent5($setup.CustomContainer), {
|
|
1949
2267
|
key: 0,
|
|
1950
2268
|
name: $setup.containerName,
|
|
1951
2269
|
options: $setup.options
|
|
1952
2270
|
}, {
|
|
1953
2271
|
default: _withCtx4(() => [
|
|
1954
|
-
|
|
1955
|
-
$props.node.children && $props.node.children.length > 0 ? (
|
|
1956
|
-
|
|
2272
|
+
_createCommentVNode9(" \u5C06\u5BB9\u5668\u5185\u5BB9\u4F5C\u4E3A\u9ED8\u8BA4 slot \u4F20\u9012 "),
|
|
2273
|
+
$props.node.children && $props.node.children.length > 0 ? (_openBlock14(true), _createElementBlock13(
|
|
2274
|
+
_Fragment10,
|
|
1957
2275
|
{ key: 0 },
|
|
1958
2276
|
_renderList6($props.node.children, (child, index) => {
|
|
1959
|
-
return
|
|
2277
|
+
return _openBlock14(), _createBlock6($setup["IncremarkRenderer"], {
|
|
1960
2278
|
key: index,
|
|
1961
2279
|
node: child
|
|
1962
2280
|
}, null, 8, ["node"]);
|
|
1963
2281
|
}),
|
|
1964
2282
|
128
|
|
1965
2283
|
/* KEYED_FRAGMENT */
|
|
1966
|
-
)) :
|
|
2284
|
+
)) : _createCommentVNode9("v-if", true)
|
|
1967
2285
|
]),
|
|
1968
2286
|
_: 1
|
|
1969
2287
|
/* STABLE */
|
|
1970
|
-
}, 8, ["name", "options"])) : (
|
|
1971
|
-
|
|
2288
|
+
}, 8, ["name", "options"])) : (_openBlock14(), _createElementBlock13(
|
|
2289
|
+
_Fragment10,
|
|
1972
2290
|
{ key: 1 },
|
|
1973
2291
|
[
|
|
1974
|
-
|
|
1975
|
-
|
|
2292
|
+
_createCommentVNode9(" \u5982\u679C\u6CA1\u6709\u81EA\u5B9A\u4E49\u5BB9\u5668\u7EC4\u4EF6\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u6E32\u67D3 "),
|
|
2293
|
+
_createElementVNode8(
|
|
1976
2294
|
"div",
|
|
1977
2295
|
{
|
|
1978
|
-
class:
|
|
2296
|
+
class: _normalizeClass5(["incremark-container", `incremark-container-${$setup.containerName}`])
|
|
1979
2297
|
},
|
|
1980
2298
|
[
|
|
1981
|
-
$props.node.children && $props.node.children.length > 0 ? (
|
|
1982
|
-
(
|
|
1983
|
-
|
|
2299
|
+
$props.node.children && $props.node.children.length > 0 ? (_openBlock14(), _createElementBlock13("div", _hoisted_112, [
|
|
2300
|
+
(_openBlock14(true), _createElementBlock13(
|
|
2301
|
+
_Fragment10,
|
|
1984
2302
|
null,
|
|
1985
2303
|
_renderList6($props.node.children, (child, index) => {
|
|
1986
|
-
return
|
|
2304
|
+
return _openBlock14(), _createBlock6($setup["IncremarkRenderer"], {
|
|
1987
2305
|
key: index,
|
|
1988
2306
|
node: child
|
|
1989
2307
|
}, null, 8, ["node"]);
|
|
@@ -1991,7 +2309,7 @@ function render11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1991
2309
|
128
|
|
1992
2310
|
/* KEYED_FRAGMENT */
|
|
1993
2311
|
))
|
|
1994
|
-
])) :
|
|
2312
|
+
])) : _createCommentVNode9("v-if", true)
|
|
1995
2313
|
],
|
|
1996
2314
|
2
|
|
1997
2315
|
/* CLASS */
|
|
@@ -2007,13 +2325,13 @@ function render11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2007
2325
|
}
|
|
2008
2326
|
|
|
2009
2327
|
// src/components/IncremarkContainer.vue
|
|
2010
|
-
IncremarkContainer_default.render =
|
|
2328
|
+
IncremarkContainer_default.render = render14;
|
|
2011
2329
|
IncremarkContainer_default.__file = "src/components/IncremarkContainer.vue";
|
|
2012
2330
|
var IncremarkContainer_default2 = IncremarkContainer_default;
|
|
2013
2331
|
|
|
2014
2332
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkDefault.vue?type=script
|
|
2015
|
-
import { defineComponent as
|
|
2016
|
-
var IncremarkDefault_default = /* @__PURE__ */
|
|
2333
|
+
import { defineComponent as _defineComponent15 } from "vue";
|
|
2334
|
+
var IncremarkDefault_default = /* @__PURE__ */ _defineComponent15({
|
|
2017
2335
|
__name: "IncremarkDefault",
|
|
2018
2336
|
props: {
|
|
2019
2337
|
node: { type: null, required: true }
|
|
@@ -2027,22 +2345,22 @@ var IncremarkDefault_default = /* @__PURE__ */ _defineComponent12({
|
|
|
2027
2345
|
});
|
|
2028
2346
|
|
|
2029
2347
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkDefault.vue?type=template
|
|
2030
|
-
import { toDisplayString as
|
|
2348
|
+
import { toDisplayString as _toDisplayString6, createElementVNode as _createElementVNode9, openBlock as _openBlock15, createElementBlock as _createElementBlock14 } from "vue";
|
|
2031
2349
|
var _hoisted_113 = { class: "incremark-default" };
|
|
2032
|
-
var
|
|
2033
|
-
function
|
|
2034
|
-
return
|
|
2035
|
-
|
|
2350
|
+
var _hoisted_27 = { class: "type-badge" };
|
|
2351
|
+
function render15(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2352
|
+
return _openBlock15(), _createElementBlock14("div", _hoisted_113, [
|
|
2353
|
+
_createElementVNode9(
|
|
2036
2354
|
"span",
|
|
2037
|
-
|
|
2038
|
-
|
|
2355
|
+
_hoisted_27,
|
|
2356
|
+
_toDisplayString6($props.node.type),
|
|
2039
2357
|
1
|
|
2040
2358
|
/* TEXT */
|
|
2041
2359
|
),
|
|
2042
|
-
|
|
2360
|
+
_createElementVNode9(
|
|
2043
2361
|
"pre",
|
|
2044
2362
|
null,
|
|
2045
|
-
|
|
2363
|
+
_toDisplayString6(JSON.stringify($props.node, null, 2)),
|
|
2046
2364
|
1
|
|
2047
2365
|
/* TEXT */
|
|
2048
2366
|
)
|
|
@@ -2050,12 +2368,12 @@ function render12(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2050
2368
|
}
|
|
2051
2369
|
|
|
2052
2370
|
// src/components/IncremarkDefault.vue
|
|
2053
|
-
IncremarkDefault_default.render =
|
|
2371
|
+
IncremarkDefault_default.render = render15;
|
|
2054
2372
|
IncremarkDefault_default.__file = "src/components/IncremarkDefault.vue";
|
|
2055
2373
|
var IncremarkDefault_default2 = IncremarkDefault_default;
|
|
2056
2374
|
|
|
2057
2375
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=script
|
|
2058
|
-
var IncremarkRenderer_default2 = /* @__PURE__ */
|
|
2376
|
+
var IncremarkRenderer_default2 = /* @__PURE__ */ _defineComponent16({
|
|
2059
2377
|
__name: "IncremarkRenderer",
|
|
2060
2378
|
props: {
|
|
2061
2379
|
node: { type: null, required: true },
|
|
@@ -2083,7 +2401,7 @@ var IncremarkRenderer_default2 = /* @__PURE__ */ _defineComponent13({
|
|
|
2083
2401
|
leafDirective: IncremarkContainer_default2,
|
|
2084
2402
|
textDirective: IncremarkContainer_default2
|
|
2085
2403
|
};
|
|
2086
|
-
const componentMap =
|
|
2404
|
+
const componentMap = computed12(() => ({
|
|
2087
2405
|
...defaultComponentMap,
|
|
2088
2406
|
...props.components
|
|
2089
2407
|
}));
|
|
@@ -2103,57 +2421,58 @@ var IncremarkRenderer_default2 = /* @__PURE__ */ _defineComponent13({
|
|
|
2103
2421
|
});
|
|
2104
2422
|
|
|
2105
2423
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=template
|
|
2106
|
-
import { createCommentVNode as
|
|
2424
|
+
import { createCommentVNode as _createCommentVNode10, toDisplayString as _toDisplayString7, createElementVNode as _createElementVNode10, openBlock as _openBlock16, createElementBlock as _createElementBlock15, createVNode as _createVNode10, Fragment as _Fragment11, resolveDynamicComponent as _resolveDynamicComponent6, createBlock as _createBlock7 } from "vue";
|
|
2107
2425
|
var _hoisted_114 = {
|
|
2108
2426
|
key: 0,
|
|
2109
2427
|
class: "incremark-html-code"
|
|
2110
2428
|
};
|
|
2111
|
-
function
|
|
2112
|
-
return
|
|
2113
|
-
|
|
2429
|
+
function render16(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2430
|
+
return _openBlock16(), _createElementBlock15(
|
|
2431
|
+
_Fragment11,
|
|
2114
2432
|
null,
|
|
2115
2433
|
[
|
|
2116
|
-
|
|
2117
|
-
$setup.isHtmlNode($props.node) ? (
|
|
2118
|
-
|
|
2434
|
+
_createCommentVNode10(" HTML \u8282\u70B9\uFF1A\u6E32\u67D3\u4E3A\u4EE3\u7801\u5757\u663E\u793A\u6E90\u4EE3\u7801 "),
|
|
2435
|
+
$setup.isHtmlNode($props.node) ? (_openBlock16(), _createElementBlock15("pre", _hoisted_114, [
|
|
2436
|
+
_createElementVNode10(
|
|
2119
2437
|
"code",
|
|
2120
2438
|
null,
|
|
2121
|
-
|
|
2439
|
+
_toDisplayString7($props.node.value),
|
|
2122
2440
|
1
|
|
2123
2441
|
/* TEXT */
|
|
2124
2442
|
)
|
|
2125
|
-
])) : $setup.isContainerNode($props.node) ? (
|
|
2126
|
-
|
|
2443
|
+
])) : $setup.isContainerNode($props.node) ? (_openBlock16(), _createElementBlock15(
|
|
2444
|
+
_Fragment11,
|
|
2127
2445
|
{ key: 1 },
|
|
2128
2446
|
[
|
|
2129
|
-
|
|
2130
|
-
|
|
2447
|
+
_createCommentVNode10(" \u5BB9\u5668\u8282\u70B9\uFF1A\u4F7F\u7528\u5BB9\u5668\u7EC4\u4EF6\uFF0C\u4F20\u9012 customContainers "),
|
|
2448
|
+
_createVNode10($setup["IncremarkContainer"], {
|
|
2131
2449
|
node: $props.node,
|
|
2132
2450
|
"custom-containers": $props.customContainers
|
|
2133
2451
|
}, null, 8, ["node", "custom-containers"])
|
|
2134
2452
|
],
|
|
2135
2453
|
2112
|
|
2136
2454
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
2137
|
-
)) : $props.node.type === "code" ? (
|
|
2138
|
-
|
|
2455
|
+
)) : $props.node.type === "code" ? (_openBlock16(), _createElementBlock15(
|
|
2456
|
+
_Fragment11,
|
|
2139
2457
|
{ key: 2 },
|
|
2140
2458
|
[
|
|
2141
|
-
|
|
2142
|
-
|
|
2459
|
+
_createCommentVNode10(" \u4EE3\u7801\u8282\u70B9\uFF1A\u7279\u6B8A\u5904\u7406\uFF0C\u4F20\u9012 customCodeBlocks\u3001codeBlockConfigs \u548C blockStatus "),
|
|
2460
|
+
_createVNode10($setup["IncremarkCode"], {
|
|
2143
2461
|
node: $props.node,
|
|
2144
2462
|
"custom-code-blocks": $props.customCodeBlocks,
|
|
2145
2463
|
"code-block-configs": $props.codeBlockConfigs,
|
|
2146
|
-
"block-status": $props.blockStatus
|
|
2147
|
-
|
|
2464
|
+
"block-status": $props.blockStatus,
|
|
2465
|
+
"default-code-component": $props.components?.["code"]
|
|
2466
|
+
}, null, 8, ["node", "custom-code-blocks", "code-block-configs", "block-status", "default-code-component"])
|
|
2148
2467
|
],
|
|
2149
2468
|
2112
|
|
2150
2469
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
2151
|
-
)) : (
|
|
2152
|
-
|
|
2470
|
+
)) : (_openBlock16(), _createElementBlock15(
|
|
2471
|
+
_Fragment11,
|
|
2153
2472
|
{ key: 3 },
|
|
2154
2473
|
[
|
|
2155
|
-
|
|
2156
|
-
(
|
|
2474
|
+
_createCommentVNode10(" \u5176\u4ED6\u8282\u70B9\uFF1A\u4F7F\u7528\u5BF9\u5E94\u7EC4\u4EF6 "),
|
|
2475
|
+
(_openBlock16(), _createBlock7(_resolveDynamicComponent6($setup.getComponent($props.node.type)), {
|
|
2157
2476
|
node: $props.node
|
|
2158
2477
|
}, null, 8, ["node"]))
|
|
2159
2478
|
],
|
|
@@ -2167,25 +2486,25 @@ function render13(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2167
2486
|
}
|
|
2168
2487
|
|
|
2169
2488
|
// src/components/IncremarkRenderer.vue
|
|
2170
|
-
IncremarkRenderer_default2.render =
|
|
2489
|
+
IncremarkRenderer_default2.render = render16;
|
|
2171
2490
|
IncremarkRenderer_default2.__file = "src/components/IncremarkRenderer.vue";
|
|
2172
2491
|
var IncremarkRenderer_default = IncremarkRenderer_default2;
|
|
2173
2492
|
|
|
2174
2493
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkFootnotes.vue?type=script
|
|
2175
|
-
import { defineComponent as
|
|
2176
|
-
import { computed as
|
|
2177
|
-
var IncremarkFootnotes_default = /* @__PURE__ */
|
|
2494
|
+
import { defineComponent as _defineComponent17 } from "vue";
|
|
2495
|
+
import { computed as computed13 } from "vue";
|
|
2496
|
+
var IncremarkFootnotes_default = /* @__PURE__ */ _defineComponent17({
|
|
2178
2497
|
__name: "IncremarkFootnotes",
|
|
2179
2498
|
setup(__props, { expose: __expose }) {
|
|
2180
2499
|
__expose();
|
|
2181
2500
|
const { footnoteDefinitions, footnoteReferenceOrder } = useDefinationsContext();
|
|
2182
|
-
const orderedFootnotes =
|
|
2501
|
+
const orderedFootnotes = computed13(() => {
|
|
2183
2502
|
return footnoteReferenceOrder.value.map((identifier) => ({
|
|
2184
2503
|
identifier,
|
|
2185
2504
|
definition: footnoteDefinitions.value[identifier]
|
|
2186
2505
|
})).filter((item) => item.definition !== void 0);
|
|
2187
2506
|
});
|
|
2188
|
-
const hasFootnotes =
|
|
2507
|
+
const hasFootnotes = computed13(() => orderedFootnotes.value.length > 0);
|
|
2189
2508
|
const __returned__ = { footnoteDefinitions, footnoteReferenceOrder, orderedFootnotes, hasFootnotes, IncremarkRenderer: IncremarkRenderer_default };
|
|
2190
2509
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2191
2510
|
return __returned__;
|
|
@@ -2193,52 +2512,52 @@ var IncremarkFootnotes_default = /* @__PURE__ */ _defineComponent14({
|
|
|
2193
2512
|
});
|
|
2194
2513
|
|
|
2195
2514
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkFootnotes.vue?type=template
|
|
2196
|
-
import { createElementVNode as
|
|
2515
|
+
import { createElementVNode as _createElementVNode11, renderList as _renderList7, Fragment as _Fragment12, openBlock as _openBlock17, createElementBlock as _createElementBlock16, createCommentVNode as _createCommentVNode11, toDisplayString as _toDisplayString8, createBlock as _createBlock8 } from "vue";
|
|
2197
2516
|
var _hoisted_115 = {
|
|
2198
2517
|
key: 0,
|
|
2199
2518
|
class: "incremark-footnotes"
|
|
2200
2519
|
};
|
|
2201
|
-
var
|
|
2202
|
-
var
|
|
2203
|
-
var
|
|
2204
|
-
var
|
|
2205
|
-
var
|
|
2206
|
-
var
|
|
2207
|
-
function
|
|
2208
|
-
return $setup.hasFootnotes ? (
|
|
2209
|
-
_cache[0] || (_cache[0] =
|
|
2520
|
+
var _hoisted_28 = { class: "incremark-footnotes-list" };
|
|
2521
|
+
var _hoisted_37 = ["id"];
|
|
2522
|
+
var _hoisted_45 = { class: "incremark-footnote-content" };
|
|
2523
|
+
var _hoisted_55 = { class: "incremark-footnote-number" };
|
|
2524
|
+
var _hoisted_65 = { class: "incremark-footnote-body" };
|
|
2525
|
+
var _hoisted_74 = ["href"];
|
|
2526
|
+
function render17(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2527
|
+
return $setup.hasFootnotes ? (_openBlock17(), _createElementBlock16("section", _hoisted_115, [
|
|
2528
|
+
_cache[0] || (_cache[0] = _createElementVNode11(
|
|
2210
2529
|
"hr",
|
|
2211
2530
|
{ class: "incremark-footnotes-divider" },
|
|
2212
2531
|
null,
|
|
2213
2532
|
-1
|
|
2214
2533
|
/* CACHED */
|
|
2215
2534
|
)),
|
|
2216
|
-
|
|
2217
|
-
(
|
|
2218
|
-
|
|
2535
|
+
_createElementVNode11("ol", _hoisted_28, [
|
|
2536
|
+
(_openBlock17(true), _createElementBlock16(
|
|
2537
|
+
_Fragment12,
|
|
2219
2538
|
null,
|
|
2220
2539
|
_renderList7($setup.orderedFootnotes, (item, index) => {
|
|
2221
|
-
return
|
|
2540
|
+
return _openBlock17(), _createElementBlock16("li", {
|
|
2222
2541
|
key: item.identifier,
|
|
2223
2542
|
id: `fn-${item.identifier}`,
|
|
2224
2543
|
class: "incremark-footnote-item"
|
|
2225
2544
|
}, [
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2545
|
+
_createElementVNode11("div", _hoisted_45, [
|
|
2546
|
+
_createCommentVNode11(" \u811A\u6CE8\u5E8F\u53F7 "),
|
|
2547
|
+
_createElementVNode11(
|
|
2229
2548
|
"span",
|
|
2230
|
-
|
|
2231
|
-
|
|
2549
|
+
_hoisted_55,
|
|
2550
|
+
_toDisplayString8(index + 1) + ".",
|
|
2232
2551
|
1
|
|
2233
2552
|
/* TEXT */
|
|
2234
2553
|
),
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
(
|
|
2238
|
-
|
|
2554
|
+
_createCommentVNode11(" \u811A\u6CE8\u5185\u5BB9 "),
|
|
2555
|
+
_createElementVNode11("div", _hoisted_65, [
|
|
2556
|
+
(_openBlock17(true), _createElementBlock16(
|
|
2557
|
+
_Fragment12,
|
|
2239
2558
|
null,
|
|
2240
2559
|
_renderList7(item.definition.children, (child, childIndex) => {
|
|
2241
|
-
return
|
|
2560
|
+
return _openBlock17(), _createBlock8($setup["IncremarkRenderer"], {
|
|
2242
2561
|
key: childIndex,
|
|
2243
2562
|
node: child
|
|
2244
2563
|
}, null, 8, ["node"]);
|
|
@@ -2248,28 +2567,28 @@ function render14(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2248
2567
|
))
|
|
2249
2568
|
])
|
|
2250
2569
|
]),
|
|
2251
|
-
|
|
2252
|
-
|
|
2570
|
+
_createCommentVNode11(" \u8FD4\u56DE\u94FE\u63A5 "),
|
|
2571
|
+
_createElementVNode11("a", {
|
|
2253
2572
|
href: `#fnref-${item.identifier}`,
|
|
2254
2573
|
class: "incremark-footnote-backref",
|
|
2255
2574
|
"aria-label": "\u8FD4\u56DE\u5F15\u7528\u4F4D\u7F6E"
|
|
2256
|
-
}, " \u21A9 ", 8,
|
|
2257
|
-
], 8,
|
|
2575
|
+
}, " \u21A9 ", 8, _hoisted_74)
|
|
2576
|
+
], 8, _hoisted_37);
|
|
2258
2577
|
}),
|
|
2259
2578
|
128
|
|
2260
2579
|
/* KEYED_FRAGMENT */
|
|
2261
2580
|
))
|
|
2262
2581
|
])
|
|
2263
|
-
])) :
|
|
2582
|
+
])) : _createCommentVNode11("v-if", true);
|
|
2264
2583
|
}
|
|
2265
2584
|
|
|
2266
2585
|
// src/components/IncremarkFootnotes.vue
|
|
2267
|
-
IncremarkFootnotes_default.render =
|
|
2586
|
+
IncremarkFootnotes_default.render = render17;
|
|
2268
2587
|
IncremarkFootnotes_default.__file = "src/components/IncremarkFootnotes.vue";
|
|
2269
2588
|
var IncremarkFootnotes_default2 = IncremarkFootnotes_default;
|
|
2270
2589
|
|
|
2271
2590
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=script
|
|
2272
|
-
var Incremark_default = /* @__PURE__ */
|
|
2591
|
+
var Incremark_default = /* @__PURE__ */ _defineComponent18({
|
|
2273
2592
|
__name: "Incremark",
|
|
2274
2593
|
props: {
|
|
2275
2594
|
blocks: { type: Array, required: false, default: () => [] },
|
|
@@ -2289,8 +2608,8 @@ var Incremark_default = /* @__PURE__ */ _defineComponent15({
|
|
|
2289
2608
|
const {
|
|
2290
2609
|
footnoteReferenceOrder
|
|
2291
2610
|
} = useDefinationsContext();
|
|
2292
|
-
const actualBlocks =
|
|
2293
|
-
const actualIsDisplayComplete =
|
|
2611
|
+
const actualBlocks = computed14(() => props.incremark?.blocks.value || props.blocks || []);
|
|
2612
|
+
const actualIsDisplayComplete = computed14(() => {
|
|
2294
2613
|
if (props.incremark) {
|
|
2295
2614
|
return props.incremark.isDisplayComplete.value;
|
|
2296
2615
|
}
|
|
@@ -2303,24 +2622,24 @@ var Incremark_default = /* @__PURE__ */ _defineComponent15({
|
|
|
2303
2622
|
});
|
|
2304
2623
|
|
|
2305
2624
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=template
|
|
2306
|
-
import { createCommentVNode as
|
|
2625
|
+
import { createCommentVNode as _createCommentVNode12, renderList as _renderList8, Fragment as _Fragment13, openBlock as _openBlock18, createElementBlock as _createElementBlock17, createVNode as _createVNode11, normalizeClass as _normalizeClass6, createBlock as _createBlock9 } from "vue";
|
|
2307
2626
|
var _hoisted_116 = { class: "incremark" };
|
|
2308
|
-
function
|
|
2309
|
-
return
|
|
2310
|
-
|
|
2311
|
-
(
|
|
2312
|
-
|
|
2627
|
+
function render18(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2628
|
+
return _openBlock18(), _createElementBlock17("div", _hoisted_116, [
|
|
2629
|
+
_createCommentVNode12(" \u4E3B\u8981\u5185\u5BB9\u5757 "),
|
|
2630
|
+
(_openBlock18(true), _createElementBlock17(
|
|
2631
|
+
_Fragment13,
|
|
2313
2632
|
null,
|
|
2314
2633
|
_renderList8($setup.actualBlocks, (block) => {
|
|
2315
|
-
return
|
|
2316
|
-
|
|
2634
|
+
return _openBlock18(), _createElementBlock17(
|
|
2635
|
+
_Fragment13,
|
|
2317
2636
|
null,
|
|
2318
2637
|
[
|
|
2319
|
-
block.node.type !== "definition" && block.node.type !== "footnoteDefinition" ? (
|
|
2638
|
+
block.node.type !== "definition" && block.node.type !== "footnoteDefinition" ? (_openBlock18(), _createElementBlock17(
|
|
2320
2639
|
"div",
|
|
2321
2640
|
{
|
|
2322
|
-
key: block.
|
|
2323
|
-
class:
|
|
2641
|
+
key: block.id,
|
|
2642
|
+
class: _normalizeClass6([
|
|
2324
2643
|
"incremark-block",
|
|
2325
2644
|
block.status === "completed" ? $props.completedClass : $props.pendingClass,
|
|
2326
2645
|
{ "incremark-show-status": $props.showBlockStatus },
|
|
@@ -2328,8 +2647,8 @@ function render15(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2328
2647
|
])
|
|
2329
2648
|
},
|
|
2330
2649
|
[
|
|
2331
|
-
|
|
2332
|
-
|
|
2650
|
+
_createCommentVNode12(" \u4F7F\u7528 IncremarkRenderer \u7EDF\u4E00\u5904\u7406\u6240\u6709\u8282\u70B9\u7C7B\u578B "),
|
|
2651
|
+
_createVNode11($setup["IncremarkRenderer"], {
|
|
2333
2652
|
node: block.node,
|
|
2334
2653
|
"block-status": block.status,
|
|
2335
2654
|
"custom-containers": $props.customContainers,
|
|
@@ -2340,7 +2659,7 @@ function render15(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2340
2659
|
],
|
|
2341
2660
|
2
|
|
2342
2661
|
/* CLASS */
|
|
2343
|
-
)) :
|
|
2662
|
+
)) : _createCommentVNode12("v-if", true)
|
|
2344
2663
|
],
|
|
2345
2664
|
64
|
|
2346
2665
|
/* STABLE_FRAGMENT */
|
|
@@ -2349,20 +2668,115 @@ function render15(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2349
2668
|
256
|
|
2350
2669
|
/* UNKEYED_FRAGMENT */
|
|
2351
2670
|
)),
|
|
2352
|
-
|
|
2353
|
-
$setup.actualIsDisplayComplete && $setup.footnoteReferenceOrder.length > 0 ? (
|
|
2671
|
+
_createCommentVNode12(" \u811A\u6CE8\u5217\u8868\uFF08\u4EC5\u5728\u5185\u5BB9\u5B8C\u5168\u663E\u793A\u540E\u663E\u793A\uFF09 "),
|
|
2672
|
+
$setup.actualIsDisplayComplete && $setup.footnoteReferenceOrder.length > 0 ? (_openBlock18(), _createBlock9($setup["IncremarkFootnotes"], { key: 0 })) : _createCommentVNode12("v-if", true)
|
|
2354
2673
|
]);
|
|
2355
2674
|
}
|
|
2356
2675
|
|
|
2357
2676
|
// src/components/Incremark.vue
|
|
2358
|
-
Incremark_default.render =
|
|
2677
|
+
Incremark_default.render = render18;
|
|
2359
2678
|
Incremark_default.__file = "src/components/Incremark.vue";
|
|
2360
2679
|
var Incremark_default2 = Incremark_default;
|
|
2361
2680
|
|
|
2681
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContent.vue?type=script
|
|
2682
|
+
import { defineComponent as _defineComponent19 } from "vue";
|
|
2683
|
+
import { computed as computed15, watch as watch7 } from "vue";
|
|
2684
|
+
var IncremarkContent_default = /* @__PURE__ */ _defineComponent19({
|
|
2685
|
+
__name: "IncremarkContent",
|
|
2686
|
+
props: {
|
|
2687
|
+
stream: { type: Function, required: false },
|
|
2688
|
+
content: { type: String, required: false },
|
|
2689
|
+
components: { type: Object, required: false },
|
|
2690
|
+
customContainers: { type: Object, required: false },
|
|
2691
|
+
customCodeBlocks: { type: Object, required: false },
|
|
2692
|
+
codeBlockConfigs: { type: Object, required: false },
|
|
2693
|
+
isFinished: { type: Boolean, required: false },
|
|
2694
|
+
incremarkOptions: { type: Object, required: false },
|
|
2695
|
+
pendingClass: { type: String, required: false },
|
|
2696
|
+
showBlockStatus: { type: Boolean, required: false }
|
|
2697
|
+
},
|
|
2698
|
+
setup(__props, { expose: __expose }) {
|
|
2699
|
+
__expose();
|
|
2700
|
+
const props = __props;
|
|
2701
|
+
const incremarkOptions = computed15(() => ({
|
|
2702
|
+
gfm: true,
|
|
2703
|
+
htmlTree: true,
|
|
2704
|
+
containers: true,
|
|
2705
|
+
math: true,
|
|
2706
|
+
...props.incremarkOptions
|
|
2707
|
+
}));
|
|
2708
|
+
const { blocks, append, finalize, render: render23, reset, isDisplayComplete, markdown } = useIncremark(incremarkOptions);
|
|
2709
|
+
const isStreamMode = computed15(() => typeof props.stream === "function");
|
|
2710
|
+
async function handleStreamInput() {
|
|
2711
|
+
if (!props.stream) return;
|
|
2712
|
+
try {
|
|
2713
|
+
const stream = props.stream();
|
|
2714
|
+
for await (const chunk of stream) {
|
|
2715
|
+
append(chunk);
|
|
2716
|
+
}
|
|
2717
|
+
finalize();
|
|
2718
|
+
} catch (error) {
|
|
2719
|
+
console.error("Stream error: ", error);
|
|
2720
|
+
finalize();
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
function handleContentInput(newContent, oldContent) {
|
|
2724
|
+
if (!newContent) {
|
|
2725
|
+
if (oldContent) {
|
|
2726
|
+
reset();
|
|
2727
|
+
}
|
|
2728
|
+
return;
|
|
2729
|
+
}
|
|
2730
|
+
if (newContent?.startsWith(oldContent ?? "")) {
|
|
2731
|
+
const delta = newContent.slice((oldContent || "").length);
|
|
2732
|
+
append(delta);
|
|
2733
|
+
} else {
|
|
2734
|
+
render23(newContent);
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
2737
|
+
watch7(() => props.content, async (newContent, oldContent) => {
|
|
2738
|
+
if (isStreamMode.value) {
|
|
2739
|
+
await handleStreamInput();
|
|
2740
|
+
return;
|
|
2741
|
+
} else {
|
|
2742
|
+
handleContentInput(newContent, oldContent);
|
|
2743
|
+
}
|
|
2744
|
+
}, { immediate: true });
|
|
2745
|
+
watch7(() => props.isFinished, (newIsFinished) => {
|
|
2746
|
+
if (newIsFinished && props.content === markdown.value) {
|
|
2747
|
+
finalize();
|
|
2748
|
+
}
|
|
2749
|
+
}, { immediate: true });
|
|
2750
|
+
const __returned__ = { props, incremarkOptions, blocks, append, finalize, render: render23, reset, isDisplayComplete, markdown, isStreamMode, handleStreamInput, handleContentInput, Incremark: Incremark_default2 };
|
|
2751
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2752
|
+
return __returned__;
|
|
2753
|
+
}
|
|
2754
|
+
});
|
|
2755
|
+
|
|
2756
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkContent.vue?type=template
|
|
2757
|
+
import { openBlock as _openBlock19, createBlock as _createBlock10 } from "vue";
|
|
2758
|
+
function render19(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2759
|
+
return _openBlock19(), _createBlock10($setup["Incremark"], {
|
|
2760
|
+
blocks: $setup.blocks,
|
|
2761
|
+
"pending-class": $props.pendingClass,
|
|
2762
|
+
"is-display-complete": $setup.isDisplayComplete,
|
|
2763
|
+
"show-block-status": $props.showBlockStatus,
|
|
2764
|
+
components: $props.components,
|
|
2765
|
+
"custom-containers": $props.customContainers,
|
|
2766
|
+
"custom-code-blocks": $props.customCodeBlocks,
|
|
2767
|
+
"code-block-configs": $props.codeBlockConfigs
|
|
2768
|
+
}, null, 8, ["blocks", "pending-class", "is-display-complete", "show-block-status", "components", "custom-containers", "custom-code-blocks", "code-block-configs"]);
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
// src/components/IncremarkContent.vue
|
|
2772
|
+
IncremarkContent_default.render = render19;
|
|
2773
|
+
IncremarkContent_default.__file = "src/components/IncremarkContent.vue";
|
|
2774
|
+
var IncremarkContent_default2 = IncremarkContent_default;
|
|
2775
|
+
|
|
2362
2776
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/AutoScrollContainer.vue?type=script
|
|
2363
|
-
import { defineComponent as
|
|
2364
|
-
import { ref as ref8, onMounted as onMounted2, onUnmounted as
|
|
2365
|
-
var AutoScrollContainer_default = /* @__PURE__ */
|
|
2777
|
+
import { defineComponent as _defineComponent20 } from "vue";
|
|
2778
|
+
import { ref as ref8, onMounted as onMounted2, onUnmounted as onUnmounted7, nextTick } from "vue";
|
|
2779
|
+
var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent20({
|
|
2366
2780
|
__name: "AutoScrollContainer",
|
|
2367
2781
|
props: {
|
|
2368
2782
|
enabled: { type: Boolean, required: false, default: true },
|
|
@@ -2440,7 +2854,7 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent16({
|
|
|
2440
2854
|
characterData: true
|
|
2441
2855
|
});
|
|
2442
2856
|
});
|
|
2443
|
-
|
|
2857
|
+
onUnmounted7(() => {
|
|
2444
2858
|
observer?.disconnect();
|
|
2445
2859
|
});
|
|
2446
2860
|
__expose({
|
|
@@ -2470,9 +2884,9 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent16({
|
|
|
2470
2884
|
});
|
|
2471
2885
|
|
|
2472
2886
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/AutoScrollContainer.vue?type=template
|
|
2473
|
-
import { renderSlot as _renderSlot, openBlock as
|
|
2474
|
-
function
|
|
2475
|
-
return
|
|
2887
|
+
import { renderSlot as _renderSlot, openBlock as _openBlock20, createElementBlock as _createElementBlock18 } from "vue";
|
|
2888
|
+
function render20(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2889
|
+
return _openBlock20(), _createElementBlock18(
|
|
2476
2890
|
"div",
|
|
2477
2891
|
{
|
|
2478
2892
|
ref: "containerRef",
|
|
@@ -2488,15 +2902,16 @@ function render16(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2488
2902
|
}
|
|
2489
2903
|
|
|
2490
2904
|
// src/components/AutoScrollContainer.vue
|
|
2491
|
-
AutoScrollContainer_default.render =
|
|
2905
|
+
AutoScrollContainer_default.render = render20;
|
|
2492
2906
|
AutoScrollContainer_default.__file = "src/components/AutoScrollContainer.vue";
|
|
2493
2907
|
var AutoScrollContainer_default2 = AutoScrollContainer_default;
|
|
2494
2908
|
|
|
2495
2909
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/ThemeProvider.vue?type=script
|
|
2496
|
-
import { defineComponent as
|
|
2497
|
-
import { ref as ref9, watch as
|
|
2910
|
+
import { defineComponent as _defineComponent21 } from "vue";
|
|
2911
|
+
import { ref as ref9, watch as watch9 } from "vue";
|
|
2498
2912
|
import { applyTheme } from "@incremark/theme";
|
|
2499
|
-
|
|
2913
|
+
import { isServer } from "@incremark/shared";
|
|
2914
|
+
var ThemeProvider_default = /* @__PURE__ */ _defineComponent21({
|
|
2500
2915
|
__name: "ThemeProvider",
|
|
2501
2916
|
props: {
|
|
2502
2917
|
theme: { type: null, required: true },
|
|
@@ -2506,9 +2921,10 @@ var ThemeProvider_default = /* @__PURE__ */ _defineComponent17({
|
|
|
2506
2921
|
__expose();
|
|
2507
2922
|
const props = __props;
|
|
2508
2923
|
const containerRef = ref9();
|
|
2509
|
-
|
|
2924
|
+
watch9(
|
|
2510
2925
|
() => props.theme,
|
|
2511
2926
|
(theme) => {
|
|
2927
|
+
if (isServer()) return;
|
|
2512
2928
|
if (containerRef.value) {
|
|
2513
2929
|
applyTheme(containerRef.value, theme);
|
|
2514
2930
|
}
|
|
@@ -2522,13 +2938,13 @@ var ThemeProvider_default = /* @__PURE__ */ _defineComponent17({
|
|
|
2522
2938
|
});
|
|
2523
2939
|
|
|
2524
2940
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/ThemeProvider.vue?type=template
|
|
2525
|
-
import { renderSlot as _renderSlot2, normalizeClass as
|
|
2526
|
-
function
|
|
2527
|
-
return
|
|
2941
|
+
import { renderSlot as _renderSlot2, normalizeClass as _normalizeClass7, openBlock as _openBlock21, createElementBlock as _createElementBlock19 } from "vue";
|
|
2942
|
+
function render21(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2943
|
+
return _openBlock21(), _createElementBlock19(
|
|
2528
2944
|
"div",
|
|
2529
2945
|
{
|
|
2530
2946
|
ref: "containerRef",
|
|
2531
|
-
class:
|
|
2947
|
+
class: _normalizeClass7([$setup.props.class, "incremark-theme-provider"])
|
|
2532
2948
|
},
|
|
2533
2949
|
[
|
|
2534
2950
|
_renderSlot2(_ctx.$slots, "default")
|
|
@@ -2539,10 +2955,49 @@ function render17(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2539
2955
|
}
|
|
2540
2956
|
|
|
2541
2957
|
// src/ThemeProvider.vue
|
|
2542
|
-
ThemeProvider_default.render =
|
|
2958
|
+
ThemeProvider_default.render = render21;
|
|
2543
2959
|
ThemeProvider_default.__file = "src/ThemeProvider.vue";
|
|
2544
2960
|
var ThemeProvider_default2 = ThemeProvider_default;
|
|
2545
2961
|
|
|
2962
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/ConfigProvider.vue?type=script
|
|
2963
|
+
import { defineComponent as _defineComponent22 } from "vue";
|
|
2964
|
+
import { provide as provide2, ref as ref10, watch as watch10 } from "vue";
|
|
2965
|
+
var ConfigProvider_default = /* @__PURE__ */ _defineComponent22({
|
|
2966
|
+
__name: "ConfigProvider",
|
|
2967
|
+
props: {
|
|
2968
|
+
locale: { type: null, required: false, default: () => enShared }
|
|
2969
|
+
},
|
|
2970
|
+
setup(__props, { expose: __expose }) {
|
|
2971
|
+
__expose();
|
|
2972
|
+
const props = __props;
|
|
2973
|
+
const localeRef = ref10(props.locale);
|
|
2974
|
+
provide2(LOCALE_KEY, localeRef);
|
|
2975
|
+
watch10(
|
|
2976
|
+
() => props.locale,
|
|
2977
|
+
(newLocale) => {
|
|
2978
|
+
if (newLocale) {
|
|
2979
|
+
localeRef.value = newLocale;
|
|
2980
|
+
}
|
|
2981
|
+
},
|
|
2982
|
+
{ deep: true }
|
|
2983
|
+
);
|
|
2984
|
+
const __returned__ = { props, localeRef };
|
|
2985
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2986
|
+
return __returned__;
|
|
2987
|
+
}
|
|
2988
|
+
});
|
|
2989
|
+
|
|
2990
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/ConfigProvider.vue?type=template
|
|
2991
|
+
import { renderSlot as _renderSlot3 } from "vue";
|
|
2992
|
+
function render22(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2993
|
+
return _renderSlot3(_ctx.$slots, "default");
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
// src/components/ConfigProvider.vue
|
|
2997
|
+
ConfigProvider_default.render = render22;
|
|
2998
|
+
ConfigProvider_default.__file = "src/components/ConfigProvider.vue";
|
|
2999
|
+
var ConfigProvider_default2 = ConfigProvider_default;
|
|
3000
|
+
|
|
2546
3001
|
// src/index.ts
|
|
2547
3002
|
import {
|
|
2548
3003
|
BlockTransformer as BlockTransformer2,
|
|
@@ -2566,12 +3021,15 @@ import {
|
|
|
2566
3021
|
mergeTheme,
|
|
2567
3022
|
applyTheme as applyTheme2
|
|
2568
3023
|
} from "@incremark/theme";
|
|
3024
|
+
import { en as enShared, zhCN as zhCNShared } from "@incremark/shared";
|
|
2569
3025
|
export {
|
|
2570
3026
|
AutoScrollContainer_default2 as AutoScrollContainer,
|
|
2571
3027
|
BlockTransformer2 as BlockTransformer,
|
|
3028
|
+
ConfigProvider_default2 as ConfigProvider,
|
|
2572
3029
|
Incremark_default2 as Incremark,
|
|
2573
3030
|
IncremarkBlockquote_default2 as IncremarkBlockquote,
|
|
2574
3031
|
IncremarkCode_default2 as IncremarkCode,
|
|
3032
|
+
IncremarkContent_default2 as IncremarkContent,
|
|
2575
3033
|
IncremarkDefault_default2 as IncremarkDefault,
|
|
2576
3034
|
IncremarkFootnotes_default2 as IncremarkFootnotes,
|
|
2577
3035
|
IncremarkHeading_default2 as IncremarkHeading,
|
|
@@ -2594,6 +3052,7 @@ export {
|
|
|
2594
3052
|
darkTheme,
|
|
2595
3053
|
defaultPlugins2 as defaultPlugins,
|
|
2596
3054
|
defaultTheme,
|
|
3055
|
+
enShared as en,
|
|
2597
3056
|
generateCSSVars,
|
|
2598
3057
|
imagePlugin,
|
|
2599
3058
|
mathPlugin,
|
|
@@ -2605,8 +3064,10 @@ export {
|
|
|
2605
3064
|
useDefinationsContext,
|
|
2606
3065
|
useDevTools,
|
|
2607
3066
|
useIncremark,
|
|
3067
|
+
useLocale,
|
|
2608
3068
|
useProvideDefinations,
|
|
2609
|
-
useStreamRenderer
|
|
3069
|
+
useStreamRenderer,
|
|
3070
|
+
zhCNShared as zhCN
|
|
2610
3071
|
};
|
|
2611
3072
|
/**
|
|
2612
3073
|
* @file Cursor Utils - 光标工具函数
|