@incremark/vue 0.1.2 → 0.2.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/dist/index.css +5 -356
- package/dist/index.css.map +1 -1
- package/dist/index.js +1181 -489
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/src/ThemeProvider.vue +41 -0
- package/src/components/Incremark.vue +53 -23
- package/src/components/IncremarkBlockquote.vue +0 -22
- package/src/components/IncremarkCode.vue +3 -161
- package/src/components/IncremarkDefault.vue +0 -27
- package/src/components/IncremarkFootnotes.vue +78 -0
- package/src/components/IncremarkHeading.vue +1 -17
- package/src/components/IncremarkHtmlElement.vue +138 -0
- package/src/components/IncremarkInline.vue +95 -56
- package/src/components/IncremarkList.vue +0 -37
- package/src/components/IncremarkMath.vue +0 -45
- package/src/components/IncremarkParagraph.vue +0 -7
- package/src/components/IncremarkRenderer.vue +15 -3
- package/src/components/IncremarkTable.vue +0 -32
- package/src/components/IncremarkThematicBreak.vue +0 -8
- package/src/components/index.ts +2 -0
- package/src/composables/useDefinationsContext.ts +16 -0
- package/src/composables/useIncremark.ts +47 -187
- package/src/composables/useProvideDefinations.ts +61 -0
- package/src/composables/useTypewriter.ts +205 -0
- package/src/index.ts +15 -0
- package/src/utils/cursor.ts +46 -0
package/dist/index.js
CHANGED
|
@@ -1,25 +1,101 @@
|
|
|
1
1
|
// src/composables/useIncremark.ts
|
|
2
|
-
import { ref, shallowRef, computed
|
|
2
|
+
import { ref as ref3, shallowRef as shallowRef2, computed as computed2, markRaw } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
createIncremarkParser
|
|
5
|
+
} from "@incremark/core";
|
|
6
|
+
|
|
7
|
+
// src/composables/useProvideDefinations.ts
|
|
8
|
+
import { ref, provide } from "vue";
|
|
9
|
+
var definationsInjectionKey = /* @__PURE__ */ Symbol("provideDefinations");
|
|
10
|
+
function useProvideDefinations() {
|
|
11
|
+
const definations = ref({});
|
|
12
|
+
const footnoteDefinitions = ref({});
|
|
13
|
+
const footnoteReferenceOrder = ref([]);
|
|
14
|
+
provide(definationsInjectionKey, {
|
|
15
|
+
definations,
|
|
16
|
+
footnoteDefinitions,
|
|
17
|
+
footnoteReferenceOrder
|
|
18
|
+
});
|
|
19
|
+
function setDefinations(definitions) {
|
|
20
|
+
definations.value = definitions;
|
|
21
|
+
}
|
|
22
|
+
function setFootnoteDefinitions(definitions) {
|
|
23
|
+
footnoteDefinitions.value = definitions;
|
|
24
|
+
}
|
|
25
|
+
function setFootnoteReferenceOrder(order) {
|
|
26
|
+
footnoteReferenceOrder.value = order;
|
|
27
|
+
}
|
|
28
|
+
function clearDefinations() {
|
|
29
|
+
definations.value = {};
|
|
30
|
+
}
|
|
31
|
+
function clearFootnoteDefinitions() {
|
|
32
|
+
footnoteDefinitions.value = {};
|
|
33
|
+
}
|
|
34
|
+
function clearFootnoteReferenceOrder() {
|
|
35
|
+
footnoteReferenceOrder.value = [];
|
|
36
|
+
}
|
|
37
|
+
function clearAllDefinations() {
|
|
38
|
+
clearDefinations();
|
|
39
|
+
clearFootnoteDefinitions();
|
|
40
|
+
clearFootnoteReferenceOrder();
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
setDefinations,
|
|
44
|
+
setFootnoteDefinitions,
|
|
45
|
+
setFootnoteReferenceOrder,
|
|
46
|
+
clearDefinations,
|
|
47
|
+
clearFootnoteDefinitions,
|
|
48
|
+
clearFootnoteReferenceOrder,
|
|
49
|
+
clearAllDefinations
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/composables/useTypewriter.ts
|
|
54
|
+
import { ref as ref2, shallowRef, computed, watch, onUnmounted } from "vue";
|
|
3
55
|
import {
|
|
4
|
-
createIncremarkParser,
|
|
5
56
|
createBlockTransformer,
|
|
6
57
|
defaultPlugins
|
|
7
58
|
} from "@incremark/core";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
59
|
+
|
|
60
|
+
// src/utils/cursor.ts
|
|
61
|
+
function addCursorToNode(node, cursor) {
|
|
62
|
+
const cloned = JSON.parse(JSON.stringify(node));
|
|
63
|
+
function addToLast(n) {
|
|
64
|
+
if (n.children && n.children.length > 0) {
|
|
65
|
+
for (let i = n.children.length - 1; i >= 0; i--) {
|
|
66
|
+
if (addToLast(n.children[i])) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
n.children.push({ type: "text", value: cursor });
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (n.type === "text" && typeof n.value === "string") {
|
|
74
|
+
n.value += cursor;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
if (typeof n.value === "string") {
|
|
78
|
+
n.value += cursor;
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
addToLast(cloned);
|
|
84
|
+
return cloned;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/composables/useTypewriter.ts
|
|
88
|
+
function useTypewriter(options) {
|
|
89
|
+
const { typewriter: typewriterConfig, completedBlocks, pendingBlocks } = options;
|
|
90
|
+
const typewriterEnabled = ref2(typewriterConfig?.enabled ?? !!typewriterConfig);
|
|
15
91
|
const displayBlocksRef = shallowRef([]);
|
|
16
|
-
const isTypewriterProcessing =
|
|
17
|
-
const isTypewriterPaused =
|
|
18
|
-
const typewriterEffect =
|
|
19
|
-
const typewriterCursor =
|
|
92
|
+
const isTypewriterProcessing = ref2(false);
|
|
93
|
+
const isTypewriterPaused = ref2(false);
|
|
94
|
+
const typewriterEffect = ref2(typewriterConfig?.effect ?? "none");
|
|
95
|
+
const typewriterCursor = ref2(typewriterConfig?.cursor ?? "|");
|
|
20
96
|
let transformer = null;
|
|
21
|
-
if (
|
|
22
|
-
const twOptions =
|
|
97
|
+
if (typewriterConfig) {
|
|
98
|
+
const twOptions = typewriterConfig;
|
|
23
99
|
transformer = createBlockTransformer({
|
|
24
100
|
charsPerTick: twOptions.charsPerTick ?? [1, 3],
|
|
25
101
|
tickInterval: twOptions.tickInterval ?? 30,
|
|
@@ -33,13 +109,6 @@ function useIncremark(options = {}) {
|
|
|
33
109
|
}
|
|
34
110
|
});
|
|
35
111
|
}
|
|
36
|
-
const ast = computed(() => ({
|
|
37
|
-
type: "root",
|
|
38
|
-
children: [
|
|
39
|
-
...completedBlocks.value.map((b) => b.node),
|
|
40
|
-
...pendingBlocks.value.map((b) => b.node)
|
|
41
|
-
]
|
|
42
|
-
}));
|
|
43
112
|
const sourceBlocks = computed(() => {
|
|
44
113
|
return completedBlocks.value.map((block) => ({
|
|
45
114
|
id: block.id,
|
|
@@ -63,31 +132,6 @@ function useIncremark(options = {}) {
|
|
|
63
132
|
{ immediate: true, deep: true }
|
|
64
133
|
);
|
|
65
134
|
}
|
|
66
|
-
function addCursorToNode(node, cursor) {
|
|
67
|
-
const cloned = JSON.parse(JSON.stringify(node));
|
|
68
|
-
function addToLast(n) {
|
|
69
|
-
if (n.children && n.children.length > 0) {
|
|
70
|
-
for (let i = n.children.length - 1; i >= 0; i--) {
|
|
71
|
-
if (addToLast(n.children[i])) {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
n.children.push({ type: "text", value: cursor });
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
if (n.type === "text" && typeof n.value === "string") {
|
|
79
|
-
n.value += cursor;
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
if (typeof n.value === "string") {
|
|
83
|
-
n.value += cursor;
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
addToLast(cloned);
|
|
89
|
-
return cloned;
|
|
90
|
-
}
|
|
91
135
|
const rawBlocks = computed(() => {
|
|
92
136
|
const result = [];
|
|
93
137
|
for (const block of completedBlocks.value) {
|
|
@@ -124,6 +168,82 @@ function useIncremark(options = {}) {
|
|
|
124
168
|
};
|
|
125
169
|
});
|
|
126
170
|
});
|
|
171
|
+
const typewriterControls = {
|
|
172
|
+
enabled: computed(() => typewriterEnabled.value),
|
|
173
|
+
setEnabled: (value) => {
|
|
174
|
+
typewriterEnabled.value = value;
|
|
175
|
+
},
|
|
176
|
+
isProcessing: computed(() => isTypewriterProcessing.value),
|
|
177
|
+
isPaused: computed(() => isTypewriterPaused.value),
|
|
178
|
+
effect: computed(() => typewriterEffect.value),
|
|
179
|
+
skip: () => transformer?.skip(),
|
|
180
|
+
pause: () => {
|
|
181
|
+
transformer?.pause();
|
|
182
|
+
isTypewriterPaused.value = true;
|
|
183
|
+
},
|
|
184
|
+
resume: () => {
|
|
185
|
+
transformer?.resume();
|
|
186
|
+
isTypewriterPaused.value = false;
|
|
187
|
+
},
|
|
188
|
+
setOptions: (opts) => {
|
|
189
|
+
if (opts.enabled !== void 0) {
|
|
190
|
+
typewriterEnabled.value = opts.enabled;
|
|
191
|
+
}
|
|
192
|
+
if (opts.charsPerTick !== void 0 || opts.tickInterval !== void 0 || opts.effect !== void 0 || opts.pauseOnHidden !== void 0) {
|
|
193
|
+
transformer?.setOptions({
|
|
194
|
+
charsPerTick: opts.charsPerTick,
|
|
195
|
+
tickInterval: opts.tickInterval,
|
|
196
|
+
effect: opts.effect,
|
|
197
|
+
pauseOnHidden: opts.pauseOnHidden
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
if (opts.effect !== void 0) {
|
|
201
|
+
typewriterEffect.value = opts.effect;
|
|
202
|
+
}
|
|
203
|
+
if (opts.cursor !== void 0) {
|
|
204
|
+
typewriterCursor.value = opts.cursor;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
onUnmounted(() => {
|
|
209
|
+
transformer?.destroy();
|
|
210
|
+
});
|
|
211
|
+
return {
|
|
212
|
+
blocks,
|
|
213
|
+
typewriter: typewriterControls,
|
|
214
|
+
transformer
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// src/composables/useIncremark.ts
|
|
219
|
+
function useIncremark(options = {}) {
|
|
220
|
+
const { setDefinations, setFootnoteDefinitions, setFootnoteReferenceOrder } = useProvideDefinations();
|
|
221
|
+
const parser = createIncremarkParser({
|
|
222
|
+
...options,
|
|
223
|
+
onChange: (state) => {
|
|
224
|
+
setDefinations(state.definitions);
|
|
225
|
+
setFootnoteDefinitions(state.footnoteDefinitions);
|
|
226
|
+
options.onChange?.(state);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
const completedBlocks = shallowRef2([]);
|
|
230
|
+
const pendingBlocks = shallowRef2([]);
|
|
231
|
+
const isLoading = ref3(false);
|
|
232
|
+
const markdown = ref3("");
|
|
233
|
+
const isFinalized = ref3(false);
|
|
234
|
+
const footnoteReferenceOrder = ref3([]);
|
|
235
|
+
const { blocks, typewriter, transformer } = useTypewriter({
|
|
236
|
+
typewriter: options.typewriter,
|
|
237
|
+
completedBlocks,
|
|
238
|
+
pendingBlocks
|
|
239
|
+
});
|
|
240
|
+
const ast = computed2(() => ({
|
|
241
|
+
type: "root",
|
|
242
|
+
children: [
|
|
243
|
+
...completedBlocks.value.map((b) => b.node),
|
|
244
|
+
...pendingBlocks.value.map((b) => b.node)
|
|
245
|
+
]
|
|
246
|
+
}));
|
|
127
247
|
function append(chunk) {
|
|
128
248
|
isLoading.value = true;
|
|
129
249
|
const update = parser.append(chunk);
|
|
@@ -135,6 +255,8 @@ function useIncremark(options = {}) {
|
|
|
135
255
|
];
|
|
136
256
|
}
|
|
137
257
|
pendingBlocks.value = update.pending.map((b) => markRaw(b));
|
|
258
|
+
footnoteReferenceOrder.value = update.footnoteReferenceOrder;
|
|
259
|
+
setFootnoteReferenceOrder(update.footnoteReferenceOrder);
|
|
138
260
|
return update;
|
|
139
261
|
}
|
|
140
262
|
function finalize() {
|
|
@@ -148,6 +270,9 @@ function useIncremark(options = {}) {
|
|
|
148
270
|
}
|
|
149
271
|
pendingBlocks.value = [];
|
|
150
272
|
isLoading.value = false;
|
|
273
|
+
isFinalized.value = true;
|
|
274
|
+
footnoteReferenceOrder.value = update.footnoteReferenceOrder;
|
|
275
|
+
setFootnoteReferenceOrder(update.footnoteReferenceOrder);
|
|
151
276
|
return update;
|
|
152
277
|
}
|
|
153
278
|
function abort() {
|
|
@@ -159,53 +284,21 @@ function useIncremark(options = {}) {
|
|
|
159
284
|
pendingBlocks.value = [];
|
|
160
285
|
markdown.value = "";
|
|
161
286
|
isLoading.value = false;
|
|
287
|
+
isFinalized.value = false;
|
|
288
|
+
footnoteReferenceOrder.value = [];
|
|
162
289
|
transformer?.reset();
|
|
163
290
|
}
|
|
164
|
-
function
|
|
291
|
+
function render17(content) {
|
|
165
292
|
const update = parser.render(content);
|
|
166
293
|
markdown.value = parser.getBuffer();
|
|
167
294
|
completedBlocks.value = parser.getCompletedBlocks().map((b) => markRaw(b));
|
|
168
295
|
pendingBlocks.value = [];
|
|
169
296
|
isLoading.value = false;
|
|
297
|
+
isFinalized.value = true;
|
|
298
|
+
footnoteReferenceOrder.value = update.footnoteReferenceOrder;
|
|
299
|
+
setFootnoteReferenceOrder(update.footnoteReferenceOrder);
|
|
170
300
|
return update;
|
|
171
301
|
}
|
|
172
|
-
const typewriter = {
|
|
173
|
-
enabled: typewriterEnabled,
|
|
174
|
-
isProcessing: computed(() => isTypewriterProcessing.value),
|
|
175
|
-
isPaused: computed(() => isTypewriterPaused.value),
|
|
176
|
-
effect: computed(() => typewriterEffect.value),
|
|
177
|
-
skip: () => transformer?.skip(),
|
|
178
|
-
pause: () => {
|
|
179
|
-
transformer?.pause();
|
|
180
|
-
isTypewriterPaused.value = true;
|
|
181
|
-
},
|
|
182
|
-
resume: () => {
|
|
183
|
-
transformer?.resume();
|
|
184
|
-
isTypewriterPaused.value = false;
|
|
185
|
-
},
|
|
186
|
-
setOptions: (opts) => {
|
|
187
|
-
if (opts.enabled !== void 0) {
|
|
188
|
-
typewriterEnabled.value = opts.enabled;
|
|
189
|
-
}
|
|
190
|
-
if (opts.charsPerTick !== void 0 || opts.tickInterval !== void 0 || opts.effect !== void 0 || opts.pauseOnHidden !== void 0) {
|
|
191
|
-
transformer?.setOptions({
|
|
192
|
-
charsPerTick: opts.charsPerTick,
|
|
193
|
-
tickInterval: opts.tickInterval,
|
|
194
|
-
effect: opts.effect,
|
|
195
|
-
pauseOnHidden: opts.pauseOnHidden
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
if (opts.effect !== void 0) {
|
|
199
|
-
typewriterEffect.value = opts.effect;
|
|
200
|
-
}
|
|
201
|
-
if (opts.cursor !== void 0) {
|
|
202
|
-
typewriterCursor.value = opts.cursor;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
onUnmounted(() => {
|
|
207
|
-
transformer?.destroy();
|
|
208
|
-
});
|
|
209
302
|
return {
|
|
210
303
|
/** 已收集的完整 Markdown 字符串 */
|
|
211
304
|
markdown,
|
|
@@ -219,6 +312,10 @@ function useIncremark(options = {}) {
|
|
|
219
312
|
blocks,
|
|
220
313
|
/** 是否正在加载 */
|
|
221
314
|
isLoading,
|
|
315
|
+
/** 是否已完成(finalize) */
|
|
316
|
+
isFinalized,
|
|
317
|
+
/** 脚注引用的出现顺序 */
|
|
318
|
+
footnoteReferenceOrder,
|
|
222
319
|
/** 追加内容 */
|
|
223
320
|
append,
|
|
224
321
|
/** 完成解析 */
|
|
@@ -228,7 +325,7 @@ function useIncremark(options = {}) {
|
|
|
228
325
|
/** 重置解析器和打字机 */
|
|
229
326
|
reset,
|
|
230
327
|
/** 一次性渲染(reset + append + finalize) */
|
|
231
|
-
render:
|
|
328
|
+
render: render17,
|
|
232
329
|
/** 解析器实例 */
|
|
233
330
|
parser,
|
|
234
331
|
/** 打字机控制 */
|
|
@@ -237,22 +334,22 @@ function useIncremark(options = {}) {
|
|
|
237
334
|
}
|
|
238
335
|
|
|
239
336
|
// src/composables/useStreamRenderer.ts
|
|
240
|
-
import { computed as
|
|
337
|
+
import { computed as computed3 } from "vue";
|
|
241
338
|
function useStreamRenderer(options) {
|
|
242
339
|
const { completedBlocks, pendingBlocks } = options;
|
|
243
|
-
const stableCompletedBlocks =
|
|
340
|
+
const stableCompletedBlocks = computed3(
|
|
244
341
|
() => completedBlocks.value.map((block) => ({
|
|
245
342
|
...block,
|
|
246
343
|
stableId: block.id
|
|
247
344
|
}))
|
|
248
345
|
);
|
|
249
|
-
const stablePendingBlocks =
|
|
346
|
+
const stablePendingBlocks = computed3(
|
|
250
347
|
() => pendingBlocks.value.map((block, index) => ({
|
|
251
348
|
...block,
|
|
252
349
|
stableId: `pending-${index}`
|
|
253
350
|
}))
|
|
254
351
|
);
|
|
255
|
-
const allStableBlocks =
|
|
352
|
+
const allStableBlocks = computed3(() => [...stableCompletedBlocks.value, ...stablePendingBlocks.value]);
|
|
256
353
|
return {
|
|
257
354
|
stableCompletedBlocks,
|
|
258
355
|
stablePendingBlocks,
|
|
@@ -290,15 +387,15 @@ function useDevTools(incremark, options = {}) {
|
|
|
290
387
|
}
|
|
291
388
|
|
|
292
389
|
// src/composables/useBlockTransformer.ts
|
|
293
|
-
import { ref as
|
|
390
|
+
import { ref as ref5, watch as watch2, computed as computed4, onUnmounted as onUnmounted3 } from "vue";
|
|
294
391
|
import {
|
|
295
392
|
createBlockTransformer as createBlockTransformer2
|
|
296
393
|
} from "@incremark/core";
|
|
297
394
|
function useBlockTransformer(sourceBlocks, options = {}) {
|
|
298
|
-
const displayBlocksRef =
|
|
299
|
-
const isProcessingRef =
|
|
300
|
-
const isPausedRef =
|
|
301
|
-
const effectRef =
|
|
395
|
+
const displayBlocksRef = ref5([]);
|
|
396
|
+
const isProcessingRef = ref5(false);
|
|
397
|
+
const isPausedRef = ref5(false);
|
|
398
|
+
const effectRef = ref5(options.effect ?? "none");
|
|
302
399
|
const transformer = createBlockTransformer2({
|
|
303
400
|
...options,
|
|
304
401
|
onChange: (blocks) => {
|
|
@@ -325,10 +422,10 @@ function useBlockTransformer(sourceBlocks, options = {}) {
|
|
|
325
422
|
transformer.destroy();
|
|
326
423
|
});
|
|
327
424
|
return {
|
|
328
|
-
displayBlocks:
|
|
329
|
-
isProcessing:
|
|
330
|
-
isPaused:
|
|
331
|
-
effect:
|
|
425
|
+
displayBlocks: computed4(() => displayBlocksRef.value),
|
|
426
|
+
isProcessing: computed4(() => isProcessingRef.value),
|
|
427
|
+
isPaused: computed4(() => isPausedRef.value),
|
|
428
|
+
effect: computed4(() => effectRef.value),
|
|
332
429
|
skip: () => transformer.skip(),
|
|
333
430
|
reset: () => transformer.reset(),
|
|
334
431
|
pause: () => {
|
|
@@ -349,20 +446,35 @@ function useBlockTransformer(sourceBlocks, options = {}) {
|
|
|
349
446
|
};
|
|
350
447
|
}
|
|
351
448
|
|
|
449
|
+
// src/composables/useDefinationsContext.ts
|
|
450
|
+
import { inject } from "vue";
|
|
451
|
+
function useDefinationsContext() {
|
|
452
|
+
const definationContext = inject(definationsInjectionKey);
|
|
453
|
+
if (!definationContext) {
|
|
454
|
+
throw new Error("definationContext not found");
|
|
455
|
+
}
|
|
456
|
+
return definationContext;
|
|
457
|
+
}
|
|
458
|
+
|
|
352
459
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=script
|
|
353
|
-
import { defineComponent as
|
|
354
|
-
import { computed as
|
|
460
|
+
import { defineComponent as _defineComponent14 } from "vue";
|
|
461
|
+
import { computed as computed10 } from "vue";
|
|
355
462
|
|
|
356
463
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkHeading.vue?type=script
|
|
357
|
-
import { defineComponent as
|
|
358
|
-
import { computed as
|
|
464
|
+
import { defineComponent as _defineComponent4 } from "vue";
|
|
465
|
+
import { computed as computed6 } from "vue";
|
|
359
466
|
|
|
360
467
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkInline.vue?type=script
|
|
361
|
-
import { defineComponent as
|
|
468
|
+
import { defineComponent as _defineComponent3 } from "vue";
|
|
469
|
+
import {
|
|
470
|
+
hasChunks,
|
|
471
|
+
getStableText,
|
|
472
|
+
isHtmlNode
|
|
473
|
+
} from "@incremark/shared";
|
|
362
474
|
|
|
363
475
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkMath.vue?type=script
|
|
364
476
|
import { defineComponent as _defineComponent } from "vue";
|
|
365
|
-
import { computed as
|
|
477
|
+
import { computed as computed5, ref as ref6, watch as watch3, shallowRef as shallowRef3, onUnmounted as onUnmounted4 } from "vue";
|
|
366
478
|
var IncremarkMath_default = /* @__PURE__ */ _defineComponent({
|
|
367
479
|
__name: "IncremarkMath",
|
|
368
480
|
props: {
|
|
@@ -372,13 +484,13 @@ var IncremarkMath_default = /* @__PURE__ */ _defineComponent({
|
|
|
372
484
|
setup(__props, { expose: __expose }) {
|
|
373
485
|
__expose();
|
|
374
486
|
const props = __props;
|
|
375
|
-
const renderedHtml =
|
|
376
|
-
const renderError =
|
|
377
|
-
const isLoading =
|
|
378
|
-
const katexRef =
|
|
487
|
+
const renderedHtml = ref6("");
|
|
488
|
+
const renderError = ref6("");
|
|
489
|
+
const isLoading = ref6(false);
|
|
490
|
+
const katexRef = shallowRef3(null);
|
|
379
491
|
let renderTimer = null;
|
|
380
|
-
const isInline =
|
|
381
|
-
const formula =
|
|
492
|
+
const isInline = computed5(() => props.node.type === "inlineMath");
|
|
493
|
+
const formula = computed5(() => props.node.value);
|
|
382
494
|
function scheduleRender() {
|
|
383
495
|
if (!formula.value) {
|
|
384
496
|
renderedHtml.value = "";
|
|
@@ -510,83 +622,304 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
510
622
|
// src/components/IncremarkMath.vue
|
|
511
623
|
IncremarkMath_default.render = render;
|
|
512
624
|
IncremarkMath_default.__file = "src/components/IncremarkMath.vue";
|
|
513
|
-
IncremarkMath_default.__scopeId = "data-v-6146c361";
|
|
514
625
|
var IncremarkMath_default2 = IncremarkMath_default;
|
|
515
626
|
|
|
627
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkHtmlElement.vue?type=script
|
|
628
|
+
import { defineComponent as _defineComponent2 } from "vue";
|
|
629
|
+
var IncremarkHtmlElement_default = /* @__PURE__ */ _defineComponent2({
|
|
630
|
+
__name: "IncremarkHtmlElement",
|
|
631
|
+
props: {
|
|
632
|
+
node: { type: Object, required: true }
|
|
633
|
+
},
|
|
634
|
+
setup(__props, { expose: __expose }) {
|
|
635
|
+
__expose();
|
|
636
|
+
function isInlineElement(tagName) {
|
|
637
|
+
const inlineElements = [
|
|
638
|
+
"a",
|
|
639
|
+
"abbr",
|
|
640
|
+
"acronym",
|
|
641
|
+
"b",
|
|
642
|
+
"bdo",
|
|
643
|
+
"big",
|
|
644
|
+
"br",
|
|
645
|
+
"button",
|
|
646
|
+
"cite",
|
|
647
|
+
"code",
|
|
648
|
+
"dfn",
|
|
649
|
+
"em",
|
|
650
|
+
"i",
|
|
651
|
+
"img",
|
|
652
|
+
"input",
|
|
653
|
+
"kbd",
|
|
654
|
+
"label",
|
|
655
|
+
"map",
|
|
656
|
+
"object",
|
|
657
|
+
"output",
|
|
658
|
+
"q",
|
|
659
|
+
"samp",
|
|
660
|
+
"script",
|
|
661
|
+
"select",
|
|
662
|
+
"small",
|
|
663
|
+
"span",
|
|
664
|
+
"strong",
|
|
665
|
+
"sub",
|
|
666
|
+
"sup",
|
|
667
|
+
"textarea",
|
|
668
|
+
"time",
|
|
669
|
+
"tt",
|
|
670
|
+
"var"
|
|
671
|
+
];
|
|
672
|
+
return inlineElements.includes(tagName.toLowerCase());
|
|
673
|
+
}
|
|
674
|
+
function isVoidElement(tagName) {
|
|
675
|
+
const voidElements = [
|
|
676
|
+
"area",
|
|
677
|
+
"base",
|
|
678
|
+
"br",
|
|
679
|
+
"col",
|
|
680
|
+
"embed",
|
|
681
|
+
"hr",
|
|
682
|
+
"img",
|
|
683
|
+
"input",
|
|
684
|
+
"link",
|
|
685
|
+
"meta",
|
|
686
|
+
"param",
|
|
687
|
+
"source",
|
|
688
|
+
"track",
|
|
689
|
+
"wbr"
|
|
690
|
+
];
|
|
691
|
+
return voidElements.includes(tagName.toLowerCase());
|
|
692
|
+
}
|
|
693
|
+
function hasOnlyInlineChildren(children) {
|
|
694
|
+
if (!children || children.length === 0) return true;
|
|
695
|
+
return children.every((child) => {
|
|
696
|
+
const type = child.type;
|
|
697
|
+
const inlineTypes = ["text", "strong", "emphasis", "inlineCode", "link", "image", "break", "html", "htmlElement"];
|
|
698
|
+
if (inlineTypes.includes(type)) {
|
|
699
|
+
if (type === "htmlElement") {
|
|
700
|
+
return isInlineElement(child.tagName);
|
|
701
|
+
}
|
|
702
|
+
return true;
|
|
703
|
+
}
|
|
704
|
+
return false;
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
function getAttrs(attrs) {
|
|
708
|
+
const result = {};
|
|
709
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
710
|
+
if (key.startsWith("on")) continue;
|
|
711
|
+
result[key] = value;
|
|
712
|
+
}
|
|
713
|
+
return result;
|
|
714
|
+
}
|
|
715
|
+
const __returned__ = { isInlineElement, isVoidElement, hasOnlyInlineChildren, getAttrs, IncremarkInline: IncremarkInline_default };
|
|
716
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
717
|
+
return __returned__;
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkHtmlElement.vue?type=template
|
|
722
|
+
import { createCommentVNode as _createCommentVNode2, openBlock as _openBlock2, createBlock as _createBlock, renderList as _renderList, Fragment as _Fragment2, createElementBlock as _createElementBlock2, resolveComponent as _resolveComponent, toDisplayString as _toDisplayString2, createTextVNode as _createTextVNode, createVNode as _createVNode, createElementVNode as _createElementVNode2, resolveDynamicComponent as _resolveDynamicComponent, mergeProps as _mergeProps, withCtx as _withCtx } from "vue";
|
|
723
|
+
var _hoisted_12 = { class: "incremark-unknown-child" };
|
|
724
|
+
function render2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
725
|
+
const _component_IncremarkHtmlElement = _resolveComponent("IncremarkHtmlElement", true);
|
|
726
|
+
return _openBlock2(), _createBlock(_resolveDynamicComponent($props.node.tagName), _mergeProps($setup.getAttrs($props.node.attrs), {
|
|
727
|
+
class: ["incremark-html-element", `incremark-${$props.node.tagName}`]
|
|
728
|
+
}), {
|
|
729
|
+
default: _withCtx(() => [
|
|
730
|
+
_createCommentVNode2(" \u81EA\u95ED\u5408\u5143\u7D20\u6CA1\u6709\u5B50\u8282\u70B9 "),
|
|
731
|
+
!$setup.isVoidElement($props.node.tagName) ? (_openBlock2(), _createElementBlock2(
|
|
732
|
+
_Fragment2,
|
|
733
|
+
{ key: 0 },
|
|
734
|
+
[
|
|
735
|
+
_createCommentVNode2(" \u5982\u679C\u5B50\u8282\u70B9\u90FD\u662F\u884C\u5185\u5185\u5BB9\uFF0C\u4F7F\u7528 IncremarkInline "),
|
|
736
|
+
$setup.hasOnlyInlineChildren($props.node.children) ? (_openBlock2(), _createBlock($setup["IncremarkInline"], {
|
|
737
|
+
key: 0,
|
|
738
|
+
nodes: $props.node.children
|
|
739
|
+
}, null, 8, ["nodes"])) : (_openBlock2(), _createElementBlock2(
|
|
740
|
+
_Fragment2,
|
|
741
|
+
{ key: 1 },
|
|
742
|
+
[
|
|
743
|
+
_createCommentVNode2(" \u5426\u5219\u9012\u5F52\u6E32\u67D3\u6BCF\u4E2A\u5B50\u8282\u70B9 "),
|
|
744
|
+
(_openBlock2(true), _createElementBlock2(
|
|
745
|
+
_Fragment2,
|
|
746
|
+
null,
|
|
747
|
+
_renderList($props.node.children, (child, idx) => {
|
|
748
|
+
return _openBlock2(), _createElementBlock2(
|
|
749
|
+
_Fragment2,
|
|
750
|
+
{ key: idx },
|
|
751
|
+
[
|
|
752
|
+
_createCommentVNode2(" \u5982\u679C\u5B50\u8282\u70B9\u662F htmlElement\uFF0C\u9012\u5F52 "),
|
|
753
|
+
child.type === "htmlElement" ? (_openBlock2(), _createBlock(_component_IncremarkHtmlElement, {
|
|
754
|
+
key: 0,
|
|
755
|
+
node: child
|
|
756
|
+
}, null, 8, ["node"])) : child.type === "text" ? (_openBlock2(), _createElementBlock2(
|
|
757
|
+
_Fragment2,
|
|
758
|
+
{ key: 1 },
|
|
759
|
+
[
|
|
760
|
+
_createCommentVNode2(" \u5982\u679C\u662F\u6587\u672C\u8282\u70B9 "),
|
|
761
|
+
_createTextVNode(
|
|
762
|
+
_toDisplayString2(child.value),
|
|
763
|
+
1
|
|
764
|
+
/* TEXT */
|
|
765
|
+
)
|
|
766
|
+
],
|
|
767
|
+
64
|
|
768
|
+
/* STABLE_FRAGMENT */
|
|
769
|
+
)) : ["strong", "emphasis", "inlineCode", "link", "image", "break"].includes(child.type) ? (_openBlock2(), _createElementBlock2(
|
|
770
|
+
_Fragment2,
|
|
771
|
+
{ key: 2 },
|
|
772
|
+
[
|
|
773
|
+
_createCommentVNode2(" \u5176\u4ED6\u7C7B\u578B\u5C1D\u8BD5\u7528 IncremarkInline "),
|
|
774
|
+
_createVNode($setup["IncremarkInline"], {
|
|
775
|
+
nodes: [child]
|
|
776
|
+
}, null, 8, ["nodes"])
|
|
777
|
+
],
|
|
778
|
+
2112
|
|
779
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
780
|
+
)) : child.type === "paragraph" ? (_openBlock2(), _createElementBlock2(
|
|
781
|
+
_Fragment2,
|
|
782
|
+
{ key: 3 },
|
|
783
|
+
[
|
|
784
|
+
_createCommentVNode2(" \u6BB5\u843D\u7B49\u5757\u7EA7\u5143\u7D20 "),
|
|
785
|
+
_createElementVNode2("p", null, [
|
|
786
|
+
_createVNode($setup["IncremarkInline"], {
|
|
787
|
+
nodes: child.children
|
|
788
|
+
}, null, 8, ["nodes"])
|
|
789
|
+
])
|
|
790
|
+
],
|
|
791
|
+
64
|
|
792
|
+
/* STABLE_FRAGMENT */
|
|
793
|
+
)) : (_openBlock2(), _createElementBlock2(
|
|
794
|
+
_Fragment2,
|
|
795
|
+
{ key: 4 },
|
|
796
|
+
[
|
|
797
|
+
_createCommentVNode2(" \u5176\u4ED6\u672A\u77E5\u7C7B\u578B\uFF0C\u663E\u793A\u539F\u59CB "),
|
|
798
|
+
_createElementVNode2(
|
|
799
|
+
"div",
|
|
800
|
+
_hoisted_12,
|
|
801
|
+
_toDisplayString2(child.type),
|
|
802
|
+
1
|
|
803
|
+
/* TEXT */
|
|
804
|
+
)
|
|
805
|
+
],
|
|
806
|
+
64
|
|
807
|
+
/* STABLE_FRAGMENT */
|
|
808
|
+
))
|
|
809
|
+
],
|
|
810
|
+
64
|
|
811
|
+
/* STABLE_FRAGMENT */
|
|
812
|
+
);
|
|
813
|
+
}),
|
|
814
|
+
128
|
|
815
|
+
/* KEYED_FRAGMENT */
|
|
816
|
+
))
|
|
817
|
+
],
|
|
818
|
+
64
|
|
819
|
+
/* STABLE_FRAGMENT */
|
|
820
|
+
))
|
|
821
|
+
],
|
|
822
|
+
64
|
|
823
|
+
/* STABLE_FRAGMENT */
|
|
824
|
+
)) : _createCommentVNode2("v-if", true)
|
|
825
|
+
]),
|
|
826
|
+
_: 1
|
|
827
|
+
/* STABLE */
|
|
828
|
+
}, 16, ["class"]);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// src/components/IncremarkHtmlElement.vue
|
|
832
|
+
IncremarkHtmlElement_default.render = render2;
|
|
833
|
+
IncremarkHtmlElement_default.__file = "src/components/IncremarkHtmlElement.vue";
|
|
834
|
+
IncremarkHtmlElement_default.__scopeId = "data-v-b3af0c5a";
|
|
835
|
+
var IncremarkHtmlElement_default2 = IncremarkHtmlElement_default;
|
|
836
|
+
|
|
516
837
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkInline.vue?type=script
|
|
517
|
-
var
|
|
838
|
+
var IncremarkInline_default2 = /* @__PURE__ */ _defineComponent3({
|
|
518
839
|
__name: "IncremarkInline",
|
|
519
840
|
props: {
|
|
520
841
|
nodes: { type: Array, required: true }
|
|
521
842
|
},
|
|
522
843
|
setup(__props, { expose: __expose }) {
|
|
523
844
|
__expose();
|
|
524
|
-
function
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
return node.
|
|
845
|
+
function isHtmlElementNode(node) {
|
|
846
|
+
return node.type === "htmlElement";
|
|
847
|
+
}
|
|
848
|
+
function isImageReference(node) {
|
|
849
|
+
return node.type === "imageReference";
|
|
529
850
|
}
|
|
530
|
-
function
|
|
531
|
-
return node.type === "
|
|
851
|
+
function isLinkReference(node) {
|
|
852
|
+
return node.type === "linkReference";
|
|
532
853
|
}
|
|
854
|
+
const props = __props;
|
|
855
|
+
const {
|
|
856
|
+
definations,
|
|
857
|
+
footnoteDefinitions
|
|
858
|
+
} = useDefinationsContext();
|
|
533
859
|
function getChunks(node) {
|
|
534
860
|
if (hasChunks(node)) {
|
|
535
861
|
return node.chunks;
|
|
536
862
|
}
|
|
537
863
|
return void 0;
|
|
538
864
|
}
|
|
539
|
-
function isHtmlNode(node) {
|
|
540
|
-
return node.type === "html";
|
|
541
|
-
}
|
|
542
865
|
function isInlineMath(node) {
|
|
543
866
|
return node.type === "inlineMath";
|
|
544
867
|
}
|
|
545
|
-
const __returned__ = {
|
|
868
|
+
const __returned__ = { isHtmlElementNode, isImageReference, isLinkReference, props, definations, footnoteDefinitions, getChunks, isInlineMath, get getStableText() {
|
|
869
|
+
return getStableText;
|
|
870
|
+
}, get isHtmlNode() {
|
|
871
|
+
return isHtmlNode;
|
|
872
|
+
}, IncremarkMath: IncremarkMath_default2, IncremarkHtmlElement: IncremarkHtmlElement_default2 };
|
|
546
873
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
547
874
|
return __returned__;
|
|
548
875
|
}
|
|
549
876
|
});
|
|
550
877
|
|
|
551
878
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkInline.vue?type=template
|
|
552
|
-
import { renderList as
|
|
553
|
-
var
|
|
554
|
-
var _hoisted_22 =
|
|
555
|
-
var _hoisted_32 = ["
|
|
556
|
-
var _hoisted_42 = ["
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
879
|
+
import { renderList as _renderList2, Fragment as _Fragment3, openBlock as _openBlock3, createElementBlock as _createElementBlock3, createCommentVNode as _createCommentVNode3, toDisplayString as _toDisplayString3, createTextVNode as _createTextVNode2, createVNode as _createVNode2, createElementVNode as _createElementVNode3, resolveComponent as _resolveComponent2 } from "vue";
|
|
880
|
+
var _hoisted_13 = ["innerHTML"];
|
|
881
|
+
var _hoisted_22 = { class: "incremark-inline-code" };
|
|
882
|
+
var _hoisted_32 = ["href"];
|
|
883
|
+
var _hoisted_42 = ["src", "alt", "title"];
|
|
884
|
+
var _hoisted_52 = ["src", "alt", "title"];
|
|
885
|
+
var _hoisted_62 = { class: "incremark-image-ref-missing" };
|
|
886
|
+
var _hoisted_7 = ["href", "title"];
|
|
887
|
+
var _hoisted_8 = { class: "incremark-link-ref-missing" };
|
|
888
|
+
var _hoisted_9 = { class: "incremark-footnote-ref" };
|
|
889
|
+
var _hoisted_10 = ["href", "id"];
|
|
890
|
+
function render3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
891
|
+
const _component_IncremarkInline = _resolveComponent2("IncremarkInline", true);
|
|
892
|
+
return _openBlock3(true), _createElementBlock3(
|
|
893
|
+
_Fragment3,
|
|
561
894
|
null,
|
|
562
|
-
|
|
563
|
-
return
|
|
564
|
-
|
|
895
|
+
_renderList2($props.nodes, (node, idx) => {
|
|
896
|
+
return _openBlock3(), _createElementBlock3(
|
|
897
|
+
_Fragment3,
|
|
565
898
|
{ key: idx },
|
|
566
899
|
[
|
|
567
|
-
|
|
568
|
-
node.type === "text" ? (
|
|
569
|
-
|
|
900
|
+
_createCommentVNode3(" \u6587\u672C\uFF08\u652F\u6301 chunks \u6E10\u5165\u52A8\u753B\uFF09 "),
|
|
901
|
+
node.type === "text" ? (_openBlock3(), _createElementBlock3(
|
|
902
|
+
_Fragment3,
|
|
570
903
|
{ key: 0 },
|
|
571
904
|
[
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
" " +
|
|
905
|
+
_createCommentVNode3(" \u7A33\u5B9A\u6587\u672C\uFF08\u5DF2\u7ECF\u663E\u793A\u8FC7\u7684\u90E8\u5206\uFF0C\u65E0\u52A8\u753B\uFF09 "),
|
|
906
|
+
_createTextVNode2(
|
|
907
|
+
" " + _toDisplayString3($setup.getStableText(node)) + " ",
|
|
575
908
|
1
|
|
576
909
|
/* TEXT */
|
|
577
910
|
),
|
|
578
|
-
|
|
579
|
-
(
|
|
580
|
-
|
|
911
|
+
_createCommentVNode3(" \u65B0\u589E\u7684 chunk \u90E8\u5206\uFF08\u5E26\u6E10\u5165\u52A8\u753B\uFF09 "),
|
|
912
|
+
(_openBlock3(true), _createElementBlock3(
|
|
913
|
+
_Fragment3,
|
|
581
914
|
null,
|
|
582
|
-
|
|
583
|
-
return
|
|
915
|
+
_renderList2($setup.getChunks(node), (chunk) => {
|
|
916
|
+
return _openBlock3(), _createElementBlock3(
|
|
584
917
|
"span",
|
|
585
918
|
{
|
|
586
919
|
key: chunk.createdAt,
|
|
587
920
|
class: "incremark-fade-in"
|
|
588
921
|
},
|
|
589
|
-
|
|
922
|
+
_toDisplayString3(chunk.text),
|
|
590
923
|
1
|
|
591
924
|
/* TEXT */
|
|
592
925
|
);
|
|
@@ -597,94 +930,200 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
597
930
|
],
|
|
598
931
|
64
|
|
599
932
|
/* STABLE_FRAGMENT */
|
|
600
|
-
)) : $setup.isInlineMath(node) ? (
|
|
601
|
-
|
|
933
|
+
)) : $setup.isInlineMath(node) ? (_openBlock3(), _createElementBlock3(
|
|
934
|
+
_Fragment3,
|
|
602
935
|
{ key: 1 },
|
|
603
936
|
[
|
|
604
|
-
|
|
605
|
-
|
|
937
|
+
_createCommentVNode3(" \u884C\u5185\u516C\u5F0F "),
|
|
938
|
+
_createVNode2($setup["IncremarkMath"], {
|
|
606
939
|
node
|
|
607
940
|
}, null, 8, ["node"])
|
|
608
941
|
],
|
|
609
942
|
2112
|
|
610
943
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
611
|
-
)) : node
|
|
612
|
-
|
|
944
|
+
)) : $setup.isHtmlElementNode(node) ? (_openBlock3(), _createElementBlock3(
|
|
945
|
+
_Fragment3,
|
|
613
946
|
{ key: 2 },
|
|
614
947
|
[
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
948
|
+
_createCommentVNode3(" htmlElement \u8282\u70B9\uFF08\u7ED3\u6784\u5316\u7684 HTML \u5143\u7D20\uFF09 "),
|
|
949
|
+
_createVNode2($setup["IncremarkHtmlElement"], {
|
|
950
|
+
node
|
|
951
|
+
}, null, 8, ["node"])
|
|
952
|
+
],
|
|
953
|
+
2112
|
|
954
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
955
|
+
)) : $setup.isHtmlNode(node) ? (_openBlock3(), _createElementBlock3(
|
|
956
|
+
_Fragment3,
|
|
957
|
+
{ key: 3 },
|
|
958
|
+
[
|
|
959
|
+
_createCommentVNode3(" HTML \u8282\u70B9\uFF08\u539F\u59CB HTML\uFF0C\u5982\u672A\u542F\u7528 htmlTree \u9009\u9879\uFF09 "),
|
|
960
|
+
_createElementVNode3("span", {
|
|
961
|
+
style: { "display": "contents" },
|
|
962
|
+
innerHTML: node.value
|
|
963
|
+
}, null, 8, _hoisted_13)
|
|
964
|
+
],
|
|
965
|
+
2112
|
|
966
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
967
|
+
)) : node.type === "strong" ? (_openBlock3(), _createElementBlock3(
|
|
968
|
+
_Fragment3,
|
|
969
|
+
{ key: 4 },
|
|
970
|
+
[
|
|
971
|
+
_createCommentVNode3(" \u52A0\u7C97 "),
|
|
972
|
+
_createElementVNode3("strong", null, [
|
|
973
|
+
_createVNode2(_component_IncremarkInline, {
|
|
618
974
|
nodes: node.children
|
|
619
975
|
}, null, 8, ["nodes"])
|
|
620
976
|
])
|
|
621
977
|
],
|
|
622
978
|
2112
|
|
623
979
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
624
|
-
)) : node.type === "emphasis" ? (
|
|
625
|
-
|
|
626
|
-
{ key:
|
|
980
|
+
)) : node.type === "emphasis" ? (_openBlock3(), _createElementBlock3(
|
|
981
|
+
_Fragment3,
|
|
982
|
+
{ key: 5 },
|
|
627
983
|
[
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
984
|
+
_createCommentVNode3(" \u659C\u4F53 "),
|
|
985
|
+
_createElementVNode3("em", null, [
|
|
986
|
+
_createVNode2(_component_IncremarkInline, {
|
|
631
987
|
nodes: node.children
|
|
632
988
|
}, null, 8, ["nodes"])
|
|
633
989
|
])
|
|
634
990
|
],
|
|
635
991
|
2112
|
|
636
992
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
637
|
-
)) : node.type === "inlineCode" ? (
|
|
638
|
-
|
|
639
|
-
{ key:
|
|
993
|
+
)) : node.type === "inlineCode" ? (_openBlock3(), _createElementBlock3(
|
|
994
|
+
_Fragment3,
|
|
995
|
+
{ key: 6 },
|
|
640
996
|
[
|
|
641
|
-
|
|
642
|
-
|
|
997
|
+
_createCommentVNode3(" \u884C\u5185\u4EE3\u7801 "),
|
|
998
|
+
_createElementVNode3(
|
|
643
999
|
"code",
|
|
644
|
-
|
|
645
|
-
|
|
1000
|
+
_hoisted_22,
|
|
1001
|
+
_toDisplayString3(node.value),
|
|
646
1002
|
1
|
|
647
1003
|
/* TEXT */
|
|
648
1004
|
)
|
|
649
1005
|
],
|
|
650
1006
|
2112
|
|
651
1007
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
652
|
-
)) : node.type === "link" ? (
|
|
653
|
-
|
|
654
|
-
{ key:
|
|
1008
|
+
)) : node.type === "link" ? (_openBlock3(), _createElementBlock3(
|
|
1009
|
+
_Fragment3,
|
|
1010
|
+
{ key: 7 },
|
|
655
1011
|
[
|
|
656
|
-
|
|
657
|
-
|
|
1012
|
+
_createCommentVNode3(" \u94FE\u63A5 "),
|
|
1013
|
+
_createElementVNode3("a", {
|
|
1014
|
+
class: "incremark-link",
|
|
658
1015
|
href: node.url,
|
|
659
1016
|
target: "_blank",
|
|
660
|
-
rel: "noopener"
|
|
1017
|
+
rel: "noopener noreferrer"
|
|
661
1018
|
}, [
|
|
662
|
-
|
|
1019
|
+
_createVNode2(_component_IncremarkInline, {
|
|
663
1020
|
nodes: node.children
|
|
664
1021
|
}, null, 8, ["nodes"])
|
|
665
|
-
], 8,
|
|
1022
|
+
], 8, _hoisted_32)
|
|
1023
|
+
],
|
|
1024
|
+
2112
|
|
1025
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1026
|
+
)) : node.type === "image" ? (_openBlock3(), _createElementBlock3(
|
|
1027
|
+
_Fragment3,
|
|
1028
|
+
{ key: 8 },
|
|
1029
|
+
[
|
|
1030
|
+
_createCommentVNode3(" \u56FE\u7247 "),
|
|
1031
|
+
_createElementVNode3("img", {
|
|
1032
|
+
class: "incremark-image",
|
|
1033
|
+
src: node.url,
|
|
1034
|
+
alt: node.alt || "",
|
|
1035
|
+
title: node.title || void 0,
|
|
1036
|
+
loading: "lazy"
|
|
1037
|
+
}, null, 8, _hoisted_42)
|
|
1038
|
+
],
|
|
1039
|
+
2112
|
|
1040
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1041
|
+
)) : $setup.isImageReference(node) ? (_openBlock3(), _createElementBlock3(
|
|
1042
|
+
_Fragment3,
|
|
1043
|
+
{ key: 9 },
|
|
1044
|
+
[
|
|
1045
|
+
_createCommentVNode3(" \u5F15\u7528\u5F0F\u56FE\u7247\uFF08imageReference\uFF09 "),
|
|
1046
|
+
$setup.definations[node.identifier] ? (_openBlock3(), _createElementBlock3("img", {
|
|
1047
|
+
key: 0,
|
|
1048
|
+
class: "incremark-image incremark-reference-image",
|
|
1049
|
+
src: $setup.definations[node.identifier].url,
|
|
1050
|
+
alt: node.alt || "",
|
|
1051
|
+
title: $setup.definations[node.identifier].title || void 0,
|
|
1052
|
+
loading: "lazy"
|
|
1053
|
+
}, null, 8, _hoisted_52)) : (_openBlock3(), _createElementBlock3(
|
|
1054
|
+
_Fragment3,
|
|
1055
|
+
{ key: 1 },
|
|
1056
|
+
[
|
|
1057
|
+
_createCommentVNode3(" \u5982\u679C\u6CA1\u6709\u627E\u5230\u5B9A\u4E49\uFF0C\u6E32\u67D3\u4E3A\u539F\u59CB\u6587\u672C\uFF08\u964D\u7EA7\u5904\u7406\uFF09 "),
|
|
1058
|
+
_createElementVNode3(
|
|
1059
|
+
"span",
|
|
1060
|
+
_hoisted_62,
|
|
1061
|
+
" ![" + _toDisplayString3(node.alt) + "][" + _toDisplayString3(node.identifier || node.label) + "] ",
|
|
1062
|
+
1
|
|
1063
|
+
/* TEXT */
|
|
1064
|
+
)
|
|
1065
|
+
],
|
|
1066
|
+
2112
|
|
1067
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1068
|
+
))
|
|
1069
|
+
],
|
|
1070
|
+
64
|
|
1071
|
+
/* STABLE_FRAGMENT */
|
|
1072
|
+
)) : $setup.isLinkReference(node) ? (_openBlock3(), _createElementBlock3(
|
|
1073
|
+
_Fragment3,
|
|
1074
|
+
{ key: 10 },
|
|
1075
|
+
[
|
|
1076
|
+
_createCommentVNode3(" \u5F15\u7528\u5F0F\u94FE\u63A5\uFF08linkReference\uFF09 "),
|
|
1077
|
+
$setup.definations[node.identifier] ? (_openBlock3(), _createElementBlock3("a", {
|
|
1078
|
+
key: 0,
|
|
1079
|
+
class: "incremark-link incremark-reference-link",
|
|
1080
|
+
href: $setup.definations[node.identifier].url,
|
|
1081
|
+
title: $setup.definations[node.identifier].title || void 0,
|
|
1082
|
+
target: "_blank",
|
|
1083
|
+
rel: "noopener noreferrer"
|
|
1084
|
+
}, [
|
|
1085
|
+
_createVNode2(_component_IncremarkInline, {
|
|
1086
|
+
nodes: node.children
|
|
1087
|
+
}, null, 8, ["nodes"])
|
|
1088
|
+
], 8, _hoisted_7)) : (_openBlock3(), _createElementBlock3(
|
|
1089
|
+
_Fragment3,
|
|
1090
|
+
{ key: 1 },
|
|
1091
|
+
[
|
|
1092
|
+
_createCommentVNode3(" \u5982\u679C\u6CA1\u6709\u627E\u5230\u5B9A\u4E49\uFF0C\u6E32\u67D3\u4E3A\u539F\u59CB\u6587\u672C\uFF08\u964D\u7EA7\u5904\u7406\uFF09 "),
|
|
1093
|
+
_createElementVNode3(
|
|
1094
|
+
"span",
|
|
1095
|
+
_hoisted_8,
|
|
1096
|
+
" [" + _toDisplayString3(node.children.map((c) => c.value).join("")) + "][" + _toDisplayString3(node.identifier || node.label) + "] ",
|
|
1097
|
+
1
|
|
1098
|
+
/* TEXT */
|
|
1099
|
+
)
|
|
1100
|
+
],
|
|
1101
|
+
2112
|
|
1102
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1103
|
+
))
|
|
666
1104
|
],
|
|
667
|
-
|
|
668
|
-
/* STABLE_FRAGMENT
|
|
669
|
-
)) : node.type === "
|
|
670
|
-
|
|
671
|
-
{ key:
|
|
1105
|
+
64
|
|
1106
|
+
/* STABLE_FRAGMENT */
|
|
1107
|
+
)) : node.type === "footnoteReference" ? (_openBlock3(), _createElementBlock3(
|
|
1108
|
+
_Fragment3,
|
|
1109
|
+
{ key: 11 },
|
|
672
1110
|
[
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
1111
|
+
_createCommentVNode3(" \u811A\u6CE8\u5F15\u7528\uFF08footnoteReference\uFF09 "),
|
|
1112
|
+
_createElementVNode3("sup", _hoisted_9, [
|
|
1113
|
+
_createElementVNode3("a", {
|
|
1114
|
+
href: `#fn-${node.identifier}`,
|
|
1115
|
+
id: `fnref-${node.identifier}`
|
|
1116
|
+
}, " [" + _toDisplayString3(node.identifier) + "] ", 9, _hoisted_10)
|
|
1117
|
+
])
|
|
679
1118
|
],
|
|
680
1119
|
2112
|
|
681
1120
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
682
|
-
)) : node.type === "break" ? (
|
|
683
|
-
|
|
684
|
-
{ key:
|
|
1121
|
+
)) : node.type === "break" ? (_openBlock3(), _createElementBlock3(
|
|
1122
|
+
_Fragment3,
|
|
1123
|
+
{ key: 12 },
|
|
685
1124
|
[
|
|
686
|
-
|
|
687
|
-
_cache[0] || (_cache[0] =
|
|
1125
|
+
_createCommentVNode3(" \u6362\u884C "),
|
|
1126
|
+
_cache[0] || (_cache[0] = _createElementVNode3(
|
|
688
1127
|
"br",
|
|
689
1128
|
null,
|
|
690
1129
|
null,
|
|
@@ -694,31 +1133,20 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
694
1133
|
],
|
|
695
1134
|
2112
|
|
696
1135
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
697
|
-
)) : node.type === "delete" ? (
|
|
698
|
-
|
|
699
|
-
{ key:
|
|
1136
|
+
)) : node.type === "delete" ? (_openBlock3(), _createElementBlock3(
|
|
1137
|
+
_Fragment3,
|
|
1138
|
+
{ key: 13 },
|
|
700
1139
|
[
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
1140
|
+
_createCommentVNode3(" \u5220\u9664\u7EBF "),
|
|
1141
|
+
_createElementVNode3("del", null, [
|
|
1142
|
+
_createVNode2(_component_IncremarkInline, {
|
|
704
1143
|
nodes: node.children
|
|
705
1144
|
}, null, 8, ["nodes"])
|
|
706
1145
|
])
|
|
707
1146
|
],
|
|
708
1147
|
2112
|
|
709
1148
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
710
|
-
)) :
|
|
711
|
-
_Fragment2,
|
|
712
|
-
{ key: 9 },
|
|
713
|
-
[
|
|
714
|
-
_createCommentVNode2(" \u539F\u59CB HTML "),
|
|
715
|
-
_createElementVNode2("span", {
|
|
716
|
-
innerHTML: node.value
|
|
717
|
-
}, null, 8, _hoisted_42)
|
|
718
|
-
],
|
|
719
|
-
2112
|
|
720
|
-
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
721
|
-
)) : _createCommentVNode2("v-if", true)
|
|
1149
|
+
)) : _createCommentVNode3("v-if", true)
|
|
722
1150
|
],
|
|
723
1151
|
64
|
|
724
1152
|
/* STABLE_FRAGMENT */
|
|
@@ -730,12 +1158,12 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
730
1158
|
}
|
|
731
1159
|
|
|
732
1160
|
// src/components/IncremarkInline.vue
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
var
|
|
1161
|
+
IncremarkInline_default2.render = render3;
|
|
1162
|
+
IncremarkInline_default2.__file = "src/components/IncremarkInline.vue";
|
|
1163
|
+
var IncremarkInline_default = IncremarkInline_default2;
|
|
736
1164
|
|
|
737
1165
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkHeading.vue?type=script
|
|
738
|
-
var IncremarkHeading_default = /* @__PURE__ */
|
|
1166
|
+
var IncremarkHeading_default = /* @__PURE__ */ _defineComponent4({
|
|
739
1167
|
__name: "IncremarkHeading",
|
|
740
1168
|
props: {
|
|
741
1169
|
node: { type: null, required: true }
|
|
@@ -743,69 +1171,69 @@ var IncremarkHeading_default = /* @__PURE__ */ _defineComponent3({
|
|
|
743
1171
|
setup(__props, { expose: __expose }) {
|
|
744
1172
|
__expose();
|
|
745
1173
|
const props = __props;
|
|
746
|
-
const tag =
|
|
747
|
-
const __returned__ = { props, tag, IncremarkInline:
|
|
1174
|
+
const tag = computed6(() => `h${props.node.depth}`);
|
|
1175
|
+
const __returned__ = { props, tag, IncremarkInline: IncremarkInline_default };
|
|
748
1176
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
749
1177
|
return __returned__;
|
|
750
1178
|
}
|
|
751
1179
|
});
|
|
752
1180
|
|
|
753
1181
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkHeading.vue?type=template
|
|
754
|
-
import { createVNode as
|
|
755
|
-
function
|
|
756
|
-
return
|
|
757
|
-
|
|
758
|
-
|
|
1182
|
+
import { createVNode as _createVNode3, resolveDynamicComponent as _resolveDynamicComponent2, normalizeClass as _normalizeClass, withCtx as _withCtx2, openBlock as _openBlock4, createBlock as _createBlock2 } from "vue";
|
|
1183
|
+
function render4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1184
|
+
return _openBlock4(), _createBlock2(_resolveDynamicComponent2($setup.tag), {
|
|
1185
|
+
class: _normalizeClass(`incremark-heading h${$props.node.depth}`)
|
|
1186
|
+
}, {
|
|
1187
|
+
default: _withCtx2(() => [
|
|
1188
|
+
_createVNode3($setup["IncremarkInline"], {
|
|
759
1189
|
nodes: $props.node.children
|
|
760
1190
|
}, null, 8, ["nodes"])
|
|
761
1191
|
]),
|
|
762
1192
|
_: 1
|
|
763
1193
|
/* STABLE */
|
|
764
|
-
});
|
|
1194
|
+
}, 8, ["class"]);
|
|
765
1195
|
}
|
|
766
1196
|
|
|
767
1197
|
// src/components/IncremarkHeading.vue
|
|
768
|
-
IncremarkHeading_default.render =
|
|
1198
|
+
IncremarkHeading_default.render = render4;
|
|
769
1199
|
IncremarkHeading_default.__file = "src/components/IncremarkHeading.vue";
|
|
770
|
-
IncremarkHeading_default.__scopeId = "data-v-56c8779f";
|
|
771
1200
|
var IncremarkHeading_default2 = IncremarkHeading_default;
|
|
772
1201
|
|
|
773
1202
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkParagraph.vue?type=script
|
|
774
|
-
import { defineComponent as
|
|
775
|
-
var IncremarkParagraph_default = /* @__PURE__ */
|
|
1203
|
+
import { defineComponent as _defineComponent5 } from "vue";
|
|
1204
|
+
var IncremarkParagraph_default = /* @__PURE__ */ _defineComponent5({
|
|
776
1205
|
__name: "IncremarkParagraph",
|
|
777
1206
|
props: {
|
|
778
1207
|
node: { type: null, required: true }
|
|
779
1208
|
},
|
|
780
1209
|
setup(__props, { expose: __expose }) {
|
|
781
1210
|
__expose();
|
|
782
|
-
const __returned__ = { IncremarkInline:
|
|
1211
|
+
const __returned__ = { IncremarkInline: IncremarkInline_default };
|
|
783
1212
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
784
1213
|
return __returned__;
|
|
785
1214
|
}
|
|
786
1215
|
});
|
|
787
1216
|
|
|
788
1217
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkParagraph.vue?type=template
|
|
789
|
-
import { createVNode as
|
|
790
|
-
var
|
|
791
|
-
function
|
|
792
|
-
return
|
|
793
|
-
|
|
1218
|
+
import { createVNode as _createVNode4, openBlock as _openBlock5, createElementBlock as _createElementBlock4 } from "vue";
|
|
1219
|
+
var _hoisted_14 = { class: "incremark-paragraph" };
|
|
1220
|
+
function render5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1221
|
+
return _openBlock5(), _createElementBlock4("p", _hoisted_14, [
|
|
1222
|
+
_createVNode4($setup["IncremarkInline"], {
|
|
794
1223
|
nodes: $props.node.children
|
|
795
1224
|
}, null, 8, ["nodes"])
|
|
796
1225
|
]);
|
|
797
1226
|
}
|
|
798
1227
|
|
|
799
1228
|
// src/components/IncremarkParagraph.vue
|
|
800
|
-
IncremarkParagraph_default.render =
|
|
1229
|
+
IncremarkParagraph_default.render = render5;
|
|
801
1230
|
IncremarkParagraph_default.__file = "src/components/IncremarkParagraph.vue";
|
|
802
|
-
IncremarkParagraph_default.__scopeId = "data-v-6fa83031";
|
|
803
1231
|
var IncremarkParagraph_default2 = IncremarkParagraph_default;
|
|
804
1232
|
|
|
805
1233
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=script
|
|
806
|
-
import { defineComponent as
|
|
807
|
-
import { computed as
|
|
808
|
-
var IncremarkCode_default = /* @__PURE__ */
|
|
1234
|
+
import { defineComponent as _defineComponent6 } from "vue";
|
|
1235
|
+
import { computed as computed7, ref as ref7, watch as watch4, shallowRef as shallowRef4, onUnmounted as onUnmounted5 } from "vue";
|
|
1236
|
+
var IncremarkCode_default = /* @__PURE__ */ _defineComponent6({
|
|
809
1237
|
__name: "IncremarkCode",
|
|
810
1238
|
props: {
|
|
811
1239
|
node: { type: null, required: true },
|
|
@@ -816,23 +1244,23 @@ var IncremarkCode_default = /* @__PURE__ */ _defineComponent5({
|
|
|
816
1244
|
setup(__props, { expose: __expose }) {
|
|
817
1245
|
__expose();
|
|
818
1246
|
const props = __props;
|
|
819
|
-
const copied =
|
|
820
|
-
const highlightedHtml =
|
|
821
|
-
const isHighlighting =
|
|
822
|
-
const highlightError =
|
|
823
|
-
const mermaidSvg =
|
|
824
|
-
const mermaidError =
|
|
825
|
-
const mermaidLoading =
|
|
826
|
-
const mermaidRef =
|
|
1247
|
+
const copied = ref7(false);
|
|
1248
|
+
const highlightedHtml = ref7("");
|
|
1249
|
+
const isHighlighting = ref7(false);
|
|
1250
|
+
const highlightError = ref7(false);
|
|
1251
|
+
const mermaidSvg = ref7("");
|
|
1252
|
+
const mermaidError = ref7("");
|
|
1253
|
+
const mermaidLoading = ref7(false);
|
|
1254
|
+
const mermaidRef = shallowRef4(null);
|
|
827
1255
|
let mermaidTimer = null;
|
|
828
|
-
const mermaidViewMode =
|
|
1256
|
+
const mermaidViewMode = ref7("preview");
|
|
829
1257
|
function toggleMermaidView() {
|
|
830
1258
|
mermaidViewMode.value = mermaidViewMode.value === "preview" ? "source" : "preview";
|
|
831
1259
|
}
|
|
832
|
-
const language =
|
|
833
|
-
const code =
|
|
834
|
-
const isMermaid =
|
|
835
|
-
const highlighterRef =
|
|
1260
|
+
const language = computed7(() => props.node.lang || "text");
|
|
1261
|
+
const code = computed7(() => props.node.value);
|
|
1262
|
+
const isMermaid = computed7(() => language.value === "mermaid");
|
|
1263
|
+
const highlighterRef = shallowRef4(null);
|
|
836
1264
|
const loadedLanguages = /* @__PURE__ */ new Set();
|
|
837
1265
|
const loadedThemes = /* @__PURE__ */ new Set();
|
|
838
1266
|
function scheduleRenderMermaid() {
|
|
@@ -944,114 +1372,114 @@ var IncremarkCode_default = /* @__PURE__ */ _defineComponent5({
|
|
|
944
1372
|
});
|
|
945
1373
|
|
|
946
1374
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkCode.vue?type=template
|
|
947
|
-
import { createCommentVNode as
|
|
948
|
-
var
|
|
1375
|
+
import { createCommentVNode as _createCommentVNode4, createElementVNode as _createElementVNode4, toDisplayString as _toDisplayString4, openBlock as _openBlock6, createElementBlock as _createElementBlock5, Fragment as _Fragment4 } from "vue";
|
|
1376
|
+
var _hoisted_15 = {
|
|
949
1377
|
key: 0,
|
|
950
1378
|
class: "incremark-mermaid"
|
|
951
1379
|
};
|
|
952
1380
|
var _hoisted_23 = { class: "mermaid-header" };
|
|
953
1381
|
var _hoisted_33 = { class: "mermaid-actions" };
|
|
954
1382
|
var _hoisted_43 = ["disabled"];
|
|
955
|
-
var
|
|
956
|
-
var
|
|
1383
|
+
var _hoisted_53 = { class: "mermaid-content" };
|
|
1384
|
+
var _hoisted_63 = {
|
|
957
1385
|
key: 0,
|
|
958
1386
|
class: "mermaid-loading"
|
|
959
1387
|
};
|
|
960
|
-
var
|
|
961
|
-
var
|
|
962
|
-
var
|
|
963
|
-
var
|
|
1388
|
+
var _hoisted_72 = { class: "mermaid-source-code" };
|
|
1389
|
+
var _hoisted_82 = { class: "mermaid-source-code" };
|
|
1390
|
+
var _hoisted_92 = ["innerHTML"];
|
|
1391
|
+
var _hoisted_102 = { class: "mermaid-source-code" };
|
|
964
1392
|
var _hoisted_11 = { class: "incremark-code" };
|
|
965
1393
|
var _hoisted_122 = { class: "code-header" };
|
|
966
1394
|
var _hoisted_132 = { class: "language" };
|
|
967
1395
|
var _hoisted_142 = { class: "code-content" };
|
|
968
|
-
var
|
|
1396
|
+
var _hoisted_152 = {
|
|
969
1397
|
key: 0,
|
|
970
1398
|
class: "code-loading"
|
|
971
1399
|
};
|
|
972
1400
|
var _hoisted_16 = ["innerHTML"];
|
|
973
1401
|
var _hoisted_17 = { class: "code-fallback" };
|
|
974
|
-
function
|
|
975
|
-
return
|
|
976
|
-
|
|
1402
|
+
function render6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1403
|
+
return _openBlock6(), _createElementBlock5(
|
|
1404
|
+
_Fragment4,
|
|
977
1405
|
null,
|
|
978
1406
|
[
|
|
979
|
-
|
|
980
|
-
$setup.isMermaid ? (
|
|
981
|
-
|
|
982
|
-
_cache[0] || (_cache[0] =
|
|
1407
|
+
_createCommentVNode4(" Mermaid \u56FE\u8868 "),
|
|
1408
|
+
$setup.isMermaid ? (_openBlock6(), _createElementBlock5("div", _hoisted_15, [
|
|
1409
|
+
_createElementVNode4("div", _hoisted_23, [
|
|
1410
|
+
_cache[0] || (_cache[0] = _createElementVNode4(
|
|
983
1411
|
"span",
|
|
984
1412
|
{ class: "language" },
|
|
985
1413
|
"MERMAID",
|
|
986
1414
|
-1
|
|
987
1415
|
/* CACHED */
|
|
988
1416
|
)),
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
class: "
|
|
1417
|
+
_createElementVNode4("div", _hoisted_33, [
|
|
1418
|
+
_createElementVNode4("button", {
|
|
1419
|
+
class: "code-btn",
|
|
992
1420
|
onClick: $setup.toggleMermaidView,
|
|
993
1421
|
type: "button",
|
|
994
1422
|
disabled: !$setup.mermaidSvg
|
|
995
|
-
},
|
|
996
|
-
|
|
1423
|
+
}, _toDisplayString4($setup.mermaidViewMode === "preview" ? "\u6E90\u7801" : "\u9884\u89C8"), 9, _hoisted_43),
|
|
1424
|
+
_createElementVNode4(
|
|
997
1425
|
"button",
|
|
998
1426
|
{
|
|
999
|
-
class: "
|
|
1427
|
+
class: "code-btn",
|
|
1000
1428
|
onClick: $setup.copyCode,
|
|
1001
1429
|
type: "button"
|
|
1002
1430
|
},
|
|
1003
|
-
|
|
1431
|
+
_toDisplayString4($setup.copied ? "\u2713 \u5DF2\u590D\u5236" : "\u590D\u5236"),
|
|
1004
1432
|
1
|
|
1005
1433
|
/* TEXT */
|
|
1006
1434
|
)
|
|
1007
1435
|
])
|
|
1008
1436
|
]),
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
$setup.mermaidLoading && !$setup.mermaidSvg ? (
|
|
1012
|
-
|
|
1437
|
+
_createElementVNode4("div", _hoisted_53, [
|
|
1438
|
+
_createCommentVNode4(" \u52A0\u8F7D\u4E2D "),
|
|
1439
|
+
$setup.mermaidLoading && !$setup.mermaidSvg ? (_openBlock6(), _createElementBlock5("div", _hoisted_63, [
|
|
1440
|
+
_createElementVNode4(
|
|
1013
1441
|
"pre",
|
|
1014
|
-
|
|
1015
|
-
|
|
1442
|
+
_hoisted_72,
|
|
1443
|
+
_toDisplayString4($setup.code),
|
|
1016
1444
|
1
|
|
1017
1445
|
/* TEXT */
|
|
1018
1446
|
)
|
|
1019
|
-
])) : $setup.mermaidViewMode === "source" ? (
|
|
1020
|
-
|
|
1447
|
+
])) : $setup.mermaidViewMode === "source" ? (_openBlock6(), _createElementBlock5(
|
|
1448
|
+
_Fragment4,
|
|
1021
1449
|
{ key: 1 },
|
|
1022
1450
|
[
|
|
1023
|
-
|
|
1024
|
-
|
|
1451
|
+
_createCommentVNode4(" \u6E90\u7801\u6A21\u5F0F "),
|
|
1452
|
+
_createElementVNode4(
|
|
1025
1453
|
"pre",
|
|
1026
|
-
|
|
1027
|
-
|
|
1454
|
+
_hoisted_82,
|
|
1455
|
+
_toDisplayString4($setup.code),
|
|
1028
1456
|
1
|
|
1029
1457
|
/* TEXT */
|
|
1030
1458
|
)
|
|
1031
1459
|
],
|
|
1032
1460
|
2112
|
|
1033
1461
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1034
|
-
)) : $setup.mermaidSvg ? (
|
|
1035
|
-
|
|
1462
|
+
)) : $setup.mermaidSvg ? (_openBlock6(), _createElementBlock5(
|
|
1463
|
+
_Fragment4,
|
|
1036
1464
|
{ key: 2 },
|
|
1037
1465
|
[
|
|
1038
|
-
|
|
1039
|
-
|
|
1466
|
+
_createCommentVNode4(" \u9884\u89C8\u6A21\u5F0F "),
|
|
1467
|
+
_createElementVNode4("div", {
|
|
1040
1468
|
innerHTML: $setup.mermaidSvg,
|
|
1041
1469
|
class: "mermaid-svg"
|
|
1042
|
-
}, null, 8,
|
|
1470
|
+
}, null, 8, _hoisted_92)
|
|
1043
1471
|
],
|
|
1044
1472
|
2112
|
|
1045
1473
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1046
|
-
)) : (
|
|
1047
|
-
|
|
1474
|
+
)) : (_openBlock6(), _createElementBlock5(
|
|
1475
|
+
_Fragment4,
|
|
1048
1476
|
{ key: 3 },
|
|
1049
1477
|
[
|
|
1050
|
-
|
|
1051
|
-
|
|
1478
|
+
_createCommentVNode4(" \u65E0\u6CD5\u6E32\u67D3\u65F6\u663E\u793A\u6E90\u7801 "),
|
|
1479
|
+
_createElementVNode4(
|
|
1052
1480
|
"pre",
|
|
1053
|
-
|
|
1054
|
-
|
|
1481
|
+
_hoisted_102,
|
|
1482
|
+
_toDisplayString4($setup.code),
|
|
1055
1483
|
1
|
|
1056
1484
|
/* TEXT */
|
|
1057
1485
|
)
|
|
@@ -1060,66 +1488,66 @@ function render5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1060
1488
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1061
1489
|
))
|
|
1062
1490
|
])
|
|
1063
|
-
])) : (
|
|
1064
|
-
|
|
1491
|
+
])) : (_openBlock6(), _createElementBlock5(
|
|
1492
|
+
_Fragment4,
|
|
1065
1493
|
{ key: 1 },
|
|
1066
1494
|
[
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1495
|
+
_createCommentVNode4(" \u666E\u901A\u4EE3\u7801\u5757 "),
|
|
1496
|
+
_createElementVNode4("div", _hoisted_11, [
|
|
1497
|
+
_createElementVNode4("div", _hoisted_122, [
|
|
1498
|
+
_createElementVNode4(
|
|
1071
1499
|
"span",
|
|
1072
1500
|
_hoisted_132,
|
|
1073
|
-
|
|
1501
|
+
_toDisplayString4($setup.language),
|
|
1074
1502
|
1
|
|
1075
1503
|
/* TEXT */
|
|
1076
1504
|
),
|
|
1077
|
-
|
|
1505
|
+
_createElementVNode4(
|
|
1078
1506
|
"button",
|
|
1079
1507
|
{
|
|
1080
|
-
class: "
|
|
1508
|
+
class: "code-btn",
|
|
1081
1509
|
onClick: $setup.copyCode,
|
|
1082
1510
|
type: "button"
|
|
1083
1511
|
},
|
|
1084
|
-
|
|
1512
|
+
_toDisplayString4($setup.copied ? "\u2713 \u5DF2\u590D\u5236" : "\u590D\u5236"),
|
|
1085
1513
|
1
|
|
1086
1514
|
/* TEXT */
|
|
1087
1515
|
)
|
|
1088
1516
|
]),
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
$setup.isHighlighting && !$setup.highlightedHtml ? (
|
|
1092
|
-
|
|
1093
|
-
|
|
1517
|
+
_createElementVNode4("div", _hoisted_142, [
|
|
1518
|
+
_createCommentVNode4(" \u6B63\u5728\u52A0\u8F7D\u9AD8\u4EAE "),
|
|
1519
|
+
$setup.isHighlighting && !$setup.highlightedHtml ? (_openBlock6(), _createElementBlock5("div", _hoisted_152, [
|
|
1520
|
+
_createElementVNode4("pre", null, [
|
|
1521
|
+
_createElementVNode4(
|
|
1094
1522
|
"code",
|
|
1095
1523
|
null,
|
|
1096
|
-
|
|
1524
|
+
_toDisplayString4($setup.code),
|
|
1097
1525
|
1
|
|
1098
1526
|
/* TEXT */
|
|
1099
1527
|
)
|
|
1100
1528
|
])
|
|
1101
|
-
])) : $setup.highlightedHtml ? (
|
|
1102
|
-
|
|
1529
|
+
])) : $setup.highlightedHtml ? (_openBlock6(), _createElementBlock5(
|
|
1530
|
+
_Fragment4,
|
|
1103
1531
|
{ key: 1 },
|
|
1104
1532
|
[
|
|
1105
|
-
|
|
1106
|
-
|
|
1533
|
+
_createCommentVNode4(" \u9AD8\u4EAE\u540E\u7684\u4EE3\u7801 "),
|
|
1534
|
+
_createElementVNode4("div", {
|
|
1107
1535
|
innerHTML: $setup.highlightedHtml,
|
|
1108
1536
|
class: "shiki-wrapper"
|
|
1109
1537
|
}, null, 8, _hoisted_16)
|
|
1110
1538
|
],
|
|
1111
1539
|
2112
|
|
1112
1540
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1113
|
-
)) : (
|
|
1114
|
-
|
|
1541
|
+
)) : (_openBlock6(), _createElementBlock5(
|
|
1542
|
+
_Fragment4,
|
|
1115
1543
|
{ key: 2 },
|
|
1116
1544
|
[
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1545
|
+
_createCommentVNode4(" \u56DE\u9000\uFF1A\u65E0\u9AD8\u4EAE "),
|
|
1546
|
+
_createElementVNode4("pre", _hoisted_17, [
|
|
1547
|
+
_createElementVNode4(
|
|
1120
1548
|
"code",
|
|
1121
1549
|
null,
|
|
1122
|
-
|
|
1550
|
+
_toDisplayString4($setup.code),
|
|
1123
1551
|
1
|
|
1124
1552
|
/* TEXT */
|
|
1125
1553
|
)
|
|
@@ -1141,15 +1569,14 @@ function render5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1141
1569
|
}
|
|
1142
1570
|
|
|
1143
1571
|
// src/components/IncremarkCode.vue
|
|
1144
|
-
IncremarkCode_default.render =
|
|
1572
|
+
IncremarkCode_default.render = render6;
|
|
1145
1573
|
IncremarkCode_default.__file = "src/components/IncremarkCode.vue";
|
|
1146
|
-
IncremarkCode_default.__scopeId = "data-v-c48b1022";
|
|
1147
1574
|
var IncremarkCode_default2 = IncremarkCode_default;
|
|
1148
1575
|
|
|
1149
1576
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkList.vue?type=script
|
|
1150
|
-
import { defineComponent as
|
|
1151
|
-
import { computed as
|
|
1152
|
-
var IncremarkList_default = /* @__PURE__ */
|
|
1577
|
+
import { defineComponent as _defineComponent7 } from "vue";
|
|
1578
|
+
import { computed as computed8 } from "vue";
|
|
1579
|
+
var IncremarkList_default = /* @__PURE__ */ _defineComponent7({
|
|
1153
1580
|
__name: "IncremarkList",
|
|
1154
1581
|
props: {
|
|
1155
1582
|
node: { type: null, required: true }
|
|
@@ -1157,7 +1584,7 @@ var IncremarkList_default = /* @__PURE__ */ _defineComponent6({
|
|
|
1157
1584
|
setup(__props, { expose: __expose }) {
|
|
1158
1585
|
__expose();
|
|
1159
1586
|
const props = __props;
|
|
1160
|
-
const tag =
|
|
1587
|
+
const tag = computed8(() => props.node.ordered ? "ol" : "ul");
|
|
1161
1588
|
function getItemContent(item) {
|
|
1162
1589
|
const firstChild = item.children[0];
|
|
1163
1590
|
if (firstChild?.type === "paragraph") {
|
|
@@ -1165,49 +1592,49 @@ var IncremarkList_default = /* @__PURE__ */ _defineComponent6({
|
|
|
1165
1592
|
}
|
|
1166
1593
|
return [];
|
|
1167
1594
|
}
|
|
1168
|
-
const __returned__ = { props, tag, getItemContent, IncremarkInline:
|
|
1595
|
+
const __returned__ = { props, tag, getItemContent, IncremarkInline: IncremarkInline_default };
|
|
1169
1596
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1170
1597
|
return __returned__;
|
|
1171
1598
|
}
|
|
1172
1599
|
});
|
|
1173
1600
|
|
|
1174
1601
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkList.vue?type=template
|
|
1175
|
-
import { renderList as
|
|
1602
|
+
import { renderList as _renderList3, Fragment as _Fragment5, openBlock as _openBlock7, createElementBlock as _createElementBlock6, createElementVNode as _createElementVNode5, createVNode as _createVNode5, createBlock as _createBlock3, normalizeClass as _normalizeClass2, resolveDynamicComponent as _resolveDynamicComponent3, withCtx as _withCtx3 } from "vue";
|
|
1176
1603
|
var _hoisted_18 = {
|
|
1177
1604
|
key: 0,
|
|
1178
1605
|
class: "task-label"
|
|
1179
1606
|
};
|
|
1180
1607
|
var _hoisted_24 = ["checked"];
|
|
1181
1608
|
var _hoisted_34 = { class: "task-content" };
|
|
1182
|
-
function
|
|
1183
|
-
return
|
|
1184
|
-
class:
|
|
1609
|
+
function render7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1610
|
+
return _openBlock7(), _createBlock3(_resolveDynamicComponent3($setup.tag), {
|
|
1611
|
+
class: _normalizeClass2(["incremark-list", { "task-list": $props.node.children.some((item) => item.checked !== null && item.checked !== void 0) }])
|
|
1185
1612
|
}, {
|
|
1186
|
-
default:
|
|
1187
|
-
(
|
|
1188
|
-
|
|
1613
|
+
default: _withCtx3(() => [
|
|
1614
|
+
(_openBlock7(true), _createElementBlock6(
|
|
1615
|
+
_Fragment5,
|
|
1189
1616
|
null,
|
|
1190
|
-
|
|
1191
|
-
return
|
|
1617
|
+
_renderList3($props.node.children, (item, index) => {
|
|
1618
|
+
return _openBlock7(), _createElementBlock6(
|
|
1192
1619
|
"li",
|
|
1193
1620
|
{
|
|
1194
1621
|
key: index,
|
|
1195
|
-
class:
|
|
1622
|
+
class: _normalizeClass2(["incremark-list-item", { "task-item": item.checked !== null && item.checked !== void 0 }])
|
|
1196
1623
|
},
|
|
1197
1624
|
[
|
|
1198
|
-
item.checked !== null && item.checked !== void 0 ? (
|
|
1199
|
-
|
|
1625
|
+
item.checked !== null && item.checked !== void 0 ? (_openBlock7(), _createElementBlock6("label", _hoisted_18, [
|
|
1626
|
+
_createElementVNode5("input", {
|
|
1200
1627
|
type: "checkbox",
|
|
1201
1628
|
checked: item.checked,
|
|
1202
1629
|
disabled: "",
|
|
1203
1630
|
class: "checkbox"
|
|
1204
1631
|
}, null, 8, _hoisted_24),
|
|
1205
|
-
|
|
1206
|
-
|
|
1632
|
+
_createElementVNode5("span", _hoisted_34, [
|
|
1633
|
+
_createVNode5($setup["IncremarkInline"], {
|
|
1207
1634
|
nodes: $setup.getItemContent(item)
|
|
1208
1635
|
}, null, 8, ["nodes"])
|
|
1209
1636
|
])
|
|
1210
|
-
])) : (
|
|
1637
|
+
])) : (_openBlock7(), _createBlock3($setup["IncremarkInline"], {
|
|
1211
1638
|
key: 1,
|
|
1212
1639
|
nodes: $setup.getItemContent(item)
|
|
1213
1640
|
}, null, 8, ["nodes"]))
|
|
@@ -1226,14 +1653,13 @@ function render6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1226
1653
|
}
|
|
1227
1654
|
|
|
1228
1655
|
// src/components/IncremarkList.vue
|
|
1229
|
-
IncremarkList_default.render =
|
|
1656
|
+
IncremarkList_default.render = render7;
|
|
1230
1657
|
IncremarkList_default.__file = "src/components/IncremarkList.vue";
|
|
1231
|
-
IncremarkList_default.__scopeId = "data-v-0778ccea";
|
|
1232
1658
|
var IncremarkList_default2 = IncremarkList_default;
|
|
1233
1659
|
|
|
1234
1660
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkTable.vue?type=script
|
|
1235
|
-
import { defineComponent as
|
|
1236
|
-
var IncremarkTable_default = /* @__PURE__ */
|
|
1661
|
+
import { defineComponent as _defineComponent8 } from "vue";
|
|
1662
|
+
var IncremarkTable_default = /* @__PURE__ */ _defineComponent8({
|
|
1237
1663
|
__name: "IncremarkTable",
|
|
1238
1664
|
props: {
|
|
1239
1665
|
node: { type: null, required: true }
|
|
@@ -1243,34 +1669,34 @@ var IncremarkTable_default = /* @__PURE__ */ _defineComponent7({
|
|
|
1243
1669
|
function getCellContent(cell) {
|
|
1244
1670
|
return cell.children;
|
|
1245
1671
|
}
|
|
1246
|
-
const __returned__ = { getCellContent, IncremarkInline:
|
|
1672
|
+
const __returned__ = { getCellContent, IncremarkInline: IncremarkInline_default };
|
|
1247
1673
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1248
1674
|
return __returned__;
|
|
1249
1675
|
}
|
|
1250
1676
|
});
|
|
1251
1677
|
|
|
1252
1678
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkTable.vue?type=template
|
|
1253
|
-
import { renderList as
|
|
1679
|
+
import { renderList as _renderList4, Fragment as _Fragment6, openBlock as _openBlock8, createElementBlock as _createElementBlock7, createVNode as _createVNode6, normalizeStyle as _normalizeStyle, createCommentVNode as _createCommentVNode6, createElementVNode as _createElementVNode6 } from "vue";
|
|
1254
1680
|
var _hoisted_19 = { class: "incremark-table-wrapper" };
|
|
1255
1681
|
var _hoisted_25 = { class: "incremark-table" };
|
|
1256
1682
|
var _hoisted_35 = { key: 0 };
|
|
1257
|
-
function
|
|
1258
|
-
return
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
$props.node.children[0] ? (
|
|
1262
|
-
(
|
|
1263
|
-
|
|
1683
|
+
function render8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1684
|
+
return _openBlock8(), _createElementBlock7("div", _hoisted_19, [
|
|
1685
|
+
_createElementVNode6("table", _hoisted_25, [
|
|
1686
|
+
_createElementVNode6("thead", null, [
|
|
1687
|
+
$props.node.children[0] ? (_openBlock8(), _createElementBlock7("tr", _hoisted_35, [
|
|
1688
|
+
(_openBlock8(true), _createElementBlock7(
|
|
1689
|
+
_Fragment6,
|
|
1264
1690
|
null,
|
|
1265
|
-
|
|
1266
|
-
return
|
|
1691
|
+
_renderList4($props.node.children[0].children, (cell, cellIndex) => {
|
|
1692
|
+
return _openBlock8(), _createElementBlock7(
|
|
1267
1693
|
"th",
|
|
1268
1694
|
{
|
|
1269
1695
|
key: cellIndex,
|
|
1270
1696
|
style: _normalizeStyle({ textAlign: $props.node.align?.[cellIndex] || "left" })
|
|
1271
1697
|
},
|
|
1272
1698
|
[
|
|
1273
|
-
|
|
1699
|
+
_createVNode6($setup["IncremarkInline"], {
|
|
1274
1700
|
nodes: $setup.getCellContent(cell)
|
|
1275
1701
|
}, null, 8, ["nodes"])
|
|
1276
1702
|
],
|
|
@@ -1281,26 +1707,26 @@ function render7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1281
1707
|
128
|
|
1282
1708
|
/* KEYED_FRAGMENT */
|
|
1283
1709
|
))
|
|
1284
|
-
])) :
|
|
1710
|
+
])) : _createCommentVNode6("v-if", true)
|
|
1285
1711
|
]),
|
|
1286
|
-
|
|
1287
|
-
(
|
|
1288
|
-
|
|
1712
|
+
_createElementVNode6("tbody", null, [
|
|
1713
|
+
(_openBlock8(true), _createElementBlock7(
|
|
1714
|
+
_Fragment6,
|
|
1289
1715
|
null,
|
|
1290
|
-
|
|
1291
|
-
return
|
|
1292
|
-
(
|
|
1293
|
-
|
|
1716
|
+
_renderList4($props.node.children.slice(1), (row, rowIndex) => {
|
|
1717
|
+
return _openBlock8(), _createElementBlock7("tr", { key: rowIndex }, [
|
|
1718
|
+
(_openBlock8(true), _createElementBlock7(
|
|
1719
|
+
_Fragment6,
|
|
1294
1720
|
null,
|
|
1295
|
-
|
|
1296
|
-
return
|
|
1721
|
+
_renderList4(row.children, (cell, cellIndex) => {
|
|
1722
|
+
return _openBlock8(), _createElementBlock7(
|
|
1297
1723
|
"td",
|
|
1298
1724
|
{
|
|
1299
1725
|
key: cellIndex,
|
|
1300
1726
|
style: _normalizeStyle({ textAlign: $props.node.align?.[cellIndex] || "left" })
|
|
1301
1727
|
},
|
|
1302
1728
|
[
|
|
1303
|
-
|
|
1729
|
+
_createVNode6($setup["IncremarkInline"], {
|
|
1304
1730
|
nodes: $setup.getCellContent(cell)
|
|
1305
1731
|
}, null, 8, ["nodes"])
|
|
1306
1732
|
],
|
|
@@ -1322,14 +1748,13 @@ function render7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1322
1748
|
}
|
|
1323
1749
|
|
|
1324
1750
|
// src/components/IncremarkTable.vue
|
|
1325
|
-
IncremarkTable_default.render =
|
|
1751
|
+
IncremarkTable_default.render = render8;
|
|
1326
1752
|
IncremarkTable_default.__file = "src/components/IncremarkTable.vue";
|
|
1327
|
-
IncremarkTable_default.__scopeId = "data-v-7aea7ba6";
|
|
1328
1753
|
var IncremarkTable_default2 = IncremarkTable_default;
|
|
1329
1754
|
|
|
1330
1755
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkBlockquote.vue?type=script
|
|
1331
|
-
import { defineComponent as
|
|
1332
|
-
var IncremarkBlockquote_default = /* @__PURE__ */
|
|
1756
|
+
import { defineComponent as _defineComponent9 } from "vue";
|
|
1757
|
+
var IncremarkBlockquote_default = /* @__PURE__ */ _defineComponent9({
|
|
1333
1758
|
__name: "IncremarkBlockquote",
|
|
1334
1759
|
props: {
|
|
1335
1760
|
node: { type: null, required: true }
|
|
@@ -1343,29 +1768,29 @@ var IncremarkBlockquote_default = /* @__PURE__ */ _defineComponent8({
|
|
|
1343
1768
|
});
|
|
1344
1769
|
|
|
1345
1770
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkBlockquote.vue?type=template
|
|
1346
|
-
import { renderList as
|
|
1771
|
+
import { renderList as _renderList5, Fragment as _Fragment7, openBlock as _openBlock9, createElementBlock as _createElementBlock8, createBlock as _createBlock4, toDisplayString as _toDisplayString5 } from "vue";
|
|
1347
1772
|
var _hoisted_110 = { class: "incremark-blockquote" };
|
|
1348
1773
|
var _hoisted_26 = {
|
|
1349
1774
|
key: 1,
|
|
1350
1775
|
class: "unknown-child"
|
|
1351
1776
|
};
|
|
1352
|
-
function
|
|
1353
|
-
return
|
|
1354
|
-
(
|
|
1355
|
-
|
|
1777
|
+
function render9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1778
|
+
return _openBlock9(), _createElementBlock8("blockquote", _hoisted_110, [
|
|
1779
|
+
(_openBlock9(true), _createElementBlock8(
|
|
1780
|
+
_Fragment7,
|
|
1356
1781
|
null,
|
|
1357
|
-
|
|
1358
|
-
return
|
|
1359
|
-
|
|
1782
|
+
_renderList5($props.node.children, (child, index) => {
|
|
1783
|
+
return _openBlock9(), _createElementBlock8(
|
|
1784
|
+
_Fragment7,
|
|
1360
1785
|
{ key: index },
|
|
1361
1786
|
[
|
|
1362
|
-
child.type === "paragraph" ? (
|
|
1787
|
+
child.type === "paragraph" ? (_openBlock9(), _createBlock4($setup["IncremarkParagraph"], {
|
|
1363
1788
|
key: 0,
|
|
1364
1789
|
node: child
|
|
1365
|
-
}, null, 8, ["node"])) : (
|
|
1790
|
+
}, null, 8, ["node"])) : (_openBlock9(), _createElementBlock8(
|
|
1366
1791
|
"div",
|
|
1367
1792
|
_hoisted_26,
|
|
1368
|
-
|
|
1793
|
+
_toDisplayString5(child.type),
|
|
1369
1794
|
1
|
|
1370
1795
|
/* TEXT */
|
|
1371
1796
|
))
|
|
@@ -1381,14 +1806,13 @@ function render8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1381
1806
|
}
|
|
1382
1807
|
|
|
1383
1808
|
// src/components/IncremarkBlockquote.vue
|
|
1384
|
-
IncremarkBlockquote_default.render =
|
|
1809
|
+
IncremarkBlockquote_default.render = render9;
|
|
1385
1810
|
IncremarkBlockquote_default.__file = "src/components/IncremarkBlockquote.vue";
|
|
1386
|
-
IncremarkBlockquote_default.__scopeId = "data-v-67363f13";
|
|
1387
1811
|
var IncremarkBlockquote_default2 = IncremarkBlockquote_default;
|
|
1388
1812
|
|
|
1389
1813
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkThematicBreak.vue?type=script
|
|
1390
|
-
import { defineComponent as
|
|
1391
|
-
var IncremarkThematicBreak_default = /* @__PURE__ */
|
|
1814
|
+
import { defineComponent as _defineComponent10 } from "vue";
|
|
1815
|
+
var IncremarkThematicBreak_default = /* @__PURE__ */ _defineComponent10({
|
|
1392
1816
|
__name: "IncremarkThematicBreak",
|
|
1393
1817
|
setup(__props, { expose: __expose }) {
|
|
1394
1818
|
__expose();
|
|
@@ -1399,21 +1823,20 @@ var IncremarkThematicBreak_default = /* @__PURE__ */ _defineComponent9({
|
|
|
1399
1823
|
});
|
|
1400
1824
|
|
|
1401
1825
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkThematicBreak.vue?type=template
|
|
1402
|
-
import { openBlock as
|
|
1826
|
+
import { openBlock as _openBlock10, createElementBlock as _createElementBlock9 } from "vue";
|
|
1403
1827
|
var _hoisted_111 = { class: "incremark-hr" };
|
|
1404
|
-
function
|
|
1405
|
-
return
|
|
1828
|
+
function render10(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1829
|
+
return _openBlock10(), _createElementBlock9("hr", _hoisted_111);
|
|
1406
1830
|
}
|
|
1407
1831
|
|
|
1408
1832
|
// src/components/IncremarkThematicBreak.vue
|
|
1409
|
-
IncremarkThematicBreak_default.render =
|
|
1833
|
+
IncremarkThematicBreak_default.render = render10;
|
|
1410
1834
|
IncremarkThematicBreak_default.__file = "src/components/IncremarkThematicBreak.vue";
|
|
1411
|
-
IncremarkThematicBreak_default.__scopeId = "data-v-cb316429";
|
|
1412
1835
|
var IncremarkThematicBreak_default2 = IncremarkThematicBreak_default;
|
|
1413
1836
|
|
|
1414
1837
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkDefault.vue?type=script
|
|
1415
|
-
import { defineComponent as
|
|
1416
|
-
var IncremarkDefault_default = /* @__PURE__ */
|
|
1838
|
+
import { defineComponent as _defineComponent11 } from "vue";
|
|
1839
|
+
var IncremarkDefault_default = /* @__PURE__ */ _defineComponent11({
|
|
1417
1840
|
__name: "IncremarkDefault",
|
|
1418
1841
|
props: {
|
|
1419
1842
|
node: { type: null, required: true }
|
|
@@ -1427,22 +1850,22 @@ var IncremarkDefault_default = /* @__PURE__ */ _defineComponent10({
|
|
|
1427
1850
|
});
|
|
1428
1851
|
|
|
1429
1852
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkDefault.vue?type=template
|
|
1430
|
-
import { toDisplayString as
|
|
1853
|
+
import { toDisplayString as _toDisplayString6, createElementVNode as _createElementVNode7, openBlock as _openBlock11, createElementBlock as _createElementBlock10 } from "vue";
|
|
1431
1854
|
var _hoisted_112 = { class: "incremark-default" };
|
|
1432
1855
|
var _hoisted_27 = { class: "type-badge" };
|
|
1433
|
-
function
|
|
1434
|
-
return
|
|
1435
|
-
|
|
1856
|
+
function render11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1857
|
+
return _openBlock11(), _createElementBlock10("div", _hoisted_112, [
|
|
1858
|
+
_createElementVNode7(
|
|
1436
1859
|
"span",
|
|
1437
1860
|
_hoisted_27,
|
|
1438
|
-
|
|
1861
|
+
_toDisplayString6($props.node.type),
|
|
1439
1862
|
1
|
|
1440
1863
|
/* TEXT */
|
|
1441
1864
|
),
|
|
1442
|
-
|
|
1865
|
+
_createElementVNode7(
|
|
1443
1866
|
"pre",
|
|
1444
1867
|
null,
|
|
1445
|
-
|
|
1868
|
+
_toDisplayString6(JSON.stringify($props.node, null, 2)),
|
|
1446
1869
|
1
|
|
1447
1870
|
/* TEXT */
|
|
1448
1871
|
)
|
|
@@ -1450,24 +1873,216 @@ function render10(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1450
1873
|
}
|
|
1451
1874
|
|
|
1452
1875
|
// src/components/IncremarkDefault.vue
|
|
1453
|
-
IncremarkDefault_default.render =
|
|
1876
|
+
IncremarkDefault_default.render = render11;
|
|
1454
1877
|
IncremarkDefault_default.__file = "src/components/IncremarkDefault.vue";
|
|
1455
|
-
IncremarkDefault_default.__scopeId = "data-v-5542d517";
|
|
1456
1878
|
var IncremarkDefault_default2 = IncremarkDefault_default;
|
|
1457
1879
|
|
|
1880
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkFootnotes.vue?type=script
|
|
1881
|
+
import { defineComponent as _defineComponent13 } from "vue";
|
|
1882
|
+
import { computed as computed9 } from "vue";
|
|
1883
|
+
|
|
1884
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=script
|
|
1885
|
+
import { defineComponent as _defineComponent12 } from "vue";
|
|
1886
|
+
var IncremarkRenderer_default = /* @__PURE__ */ _defineComponent12({
|
|
1887
|
+
__name: "IncremarkRenderer",
|
|
1888
|
+
props: {
|
|
1889
|
+
node: { type: null, required: true }
|
|
1890
|
+
},
|
|
1891
|
+
setup(__props, { expose: __expose }) {
|
|
1892
|
+
__expose();
|
|
1893
|
+
const props = __props;
|
|
1894
|
+
const componentMap = {
|
|
1895
|
+
heading: IncremarkHeading_default2,
|
|
1896
|
+
paragraph: IncremarkParagraph_default2,
|
|
1897
|
+
code: IncremarkCode_default2,
|
|
1898
|
+
list: IncremarkList_default2,
|
|
1899
|
+
table: IncremarkTable_default2,
|
|
1900
|
+
blockquote: IncremarkBlockquote_default2,
|
|
1901
|
+
thematicBreak: IncremarkThematicBreak_default2,
|
|
1902
|
+
math: IncremarkMath_default2,
|
|
1903
|
+
inlineMath: IncremarkMath_default2,
|
|
1904
|
+
htmlElement: IncremarkHtmlElement_default2
|
|
1905
|
+
};
|
|
1906
|
+
function getComponent(type) {
|
|
1907
|
+
return componentMap[type] || IncremarkDefault_default2;
|
|
1908
|
+
}
|
|
1909
|
+
function isHtmlNode2(node) {
|
|
1910
|
+
return node.type === "html";
|
|
1911
|
+
}
|
|
1912
|
+
const __returned__ = { props, componentMap, getComponent, isHtmlNode: isHtmlNode2 };
|
|
1913
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1914
|
+
return __returned__;
|
|
1915
|
+
}
|
|
1916
|
+
});
|
|
1917
|
+
|
|
1918
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=template
|
|
1919
|
+
import { createCommentVNode as _createCommentVNode8, toDisplayString as _toDisplayString7, createElementVNode as _createElementVNode8, openBlock as _openBlock12, createElementBlock as _createElementBlock11, resolveDynamicComponent as _resolveDynamicComponent4, createBlock as _createBlock5, Fragment as _Fragment8 } from "vue";
|
|
1920
|
+
var _hoisted_113 = {
|
|
1921
|
+
key: 0,
|
|
1922
|
+
class: "incremark-html-code"
|
|
1923
|
+
};
|
|
1924
|
+
function render12(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1925
|
+
return _openBlock12(), _createElementBlock11(
|
|
1926
|
+
_Fragment8,
|
|
1927
|
+
null,
|
|
1928
|
+
[
|
|
1929
|
+
_createCommentVNode8(" HTML \u8282\u70B9\uFF1A\u6E32\u67D3\u4E3A\u4EE3\u7801\u5757\u663E\u793A\u6E90\u4EE3\u7801 "),
|
|
1930
|
+
$setup.isHtmlNode($props.node) ? (_openBlock12(), _createElementBlock11("pre", _hoisted_113, [
|
|
1931
|
+
_createElementVNode8(
|
|
1932
|
+
"code",
|
|
1933
|
+
null,
|
|
1934
|
+
_toDisplayString7($props.node.value),
|
|
1935
|
+
1
|
|
1936
|
+
/* TEXT */
|
|
1937
|
+
)
|
|
1938
|
+
])) : (_openBlock12(), _createElementBlock11(
|
|
1939
|
+
_Fragment8,
|
|
1940
|
+
{ key: 1 },
|
|
1941
|
+
[
|
|
1942
|
+
_createCommentVNode8(" \u5176\u4ED6\u8282\u70B9\uFF1A\u4F7F\u7528\u5BF9\u5E94\u7EC4\u4EF6 "),
|
|
1943
|
+
(_openBlock12(), _createBlock5(_resolveDynamicComponent4($setup.getComponent($props.node.type)), { node: $props.node }, null, 8, ["node"]))
|
|
1944
|
+
],
|
|
1945
|
+
2112
|
|
1946
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1947
|
+
))
|
|
1948
|
+
],
|
|
1949
|
+
2112
|
|
1950
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
1951
|
+
);
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
// src/components/IncremarkRenderer.vue
|
|
1955
|
+
IncremarkRenderer_default.render = render12;
|
|
1956
|
+
IncremarkRenderer_default.__file = "src/components/IncremarkRenderer.vue";
|
|
1957
|
+
var IncremarkRenderer_default2 = IncremarkRenderer_default;
|
|
1958
|
+
|
|
1959
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkFootnotes.vue?type=script
|
|
1960
|
+
var IncremarkFootnotes_default = /* @__PURE__ */ _defineComponent13({
|
|
1961
|
+
__name: "IncremarkFootnotes",
|
|
1962
|
+
setup(__props, { expose: __expose }) {
|
|
1963
|
+
__expose();
|
|
1964
|
+
const { definations, footnoteDefinitions, footnoteReferenceOrder } = useDefinationsContext();
|
|
1965
|
+
const orderedFootnotes = computed9(() => {
|
|
1966
|
+
return footnoteReferenceOrder.value.map((identifier) => ({
|
|
1967
|
+
identifier,
|
|
1968
|
+
definition: footnoteDefinitions.value[identifier]
|
|
1969
|
+
})).filter((item) => item.definition !== void 0);
|
|
1970
|
+
});
|
|
1971
|
+
const hasFootnotes = computed9(() => orderedFootnotes.value.length > 0);
|
|
1972
|
+
const __returned__ = { definations, footnoteDefinitions, footnoteReferenceOrder, orderedFootnotes, hasFootnotes, IncremarkRenderer: IncremarkRenderer_default2 };
|
|
1973
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1974
|
+
return __returned__;
|
|
1975
|
+
}
|
|
1976
|
+
});
|
|
1977
|
+
|
|
1978
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkFootnotes.vue?type=template
|
|
1979
|
+
import { createElementVNode as _createElementVNode9, renderList as _renderList6, Fragment as _Fragment9, openBlock as _openBlock13, createElementBlock as _createElementBlock12, createCommentVNode as _createCommentVNode9, toDisplayString as _toDisplayString8, createBlock as _createBlock6 } from "vue";
|
|
1980
|
+
var _hoisted_114 = {
|
|
1981
|
+
key: 0,
|
|
1982
|
+
class: "incremark-footnotes"
|
|
1983
|
+
};
|
|
1984
|
+
var _hoisted_28 = { class: "incremark-footnotes-list" };
|
|
1985
|
+
var _hoisted_36 = ["id"];
|
|
1986
|
+
var _hoisted_44 = { class: "incremark-footnote-content" };
|
|
1987
|
+
var _hoisted_54 = { class: "incremark-footnote-number" };
|
|
1988
|
+
var _hoisted_64 = { class: "incremark-footnote-body" };
|
|
1989
|
+
var _hoisted_73 = ["href"];
|
|
1990
|
+
function render13(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1991
|
+
return $setup.hasFootnotes ? (_openBlock13(), _createElementBlock12("section", _hoisted_114, [
|
|
1992
|
+
_cache[0] || (_cache[0] = _createElementVNode9(
|
|
1993
|
+
"hr",
|
|
1994
|
+
{ class: "incremark-footnotes-divider" },
|
|
1995
|
+
null,
|
|
1996
|
+
-1
|
|
1997
|
+
/* CACHED */
|
|
1998
|
+
)),
|
|
1999
|
+
_createElementVNode9("ol", _hoisted_28, [
|
|
2000
|
+
(_openBlock13(true), _createElementBlock12(
|
|
2001
|
+
_Fragment9,
|
|
2002
|
+
null,
|
|
2003
|
+
_renderList6($setup.orderedFootnotes, (item, index) => {
|
|
2004
|
+
return _openBlock13(), _createElementBlock12("li", {
|
|
2005
|
+
key: item.identifier,
|
|
2006
|
+
id: `fn-${item.identifier}`,
|
|
2007
|
+
class: "incremark-footnote-item"
|
|
2008
|
+
}, [
|
|
2009
|
+
_createElementVNode9("div", _hoisted_44, [
|
|
2010
|
+
_createCommentVNode9(" \u811A\u6CE8\u5E8F\u53F7 "),
|
|
2011
|
+
_createElementVNode9(
|
|
2012
|
+
"span",
|
|
2013
|
+
_hoisted_54,
|
|
2014
|
+
_toDisplayString8(index + 1) + ".",
|
|
2015
|
+
1
|
|
2016
|
+
/* TEXT */
|
|
2017
|
+
),
|
|
2018
|
+
_createCommentVNode9(" \u811A\u6CE8\u5185\u5BB9 "),
|
|
2019
|
+
_createElementVNode9("div", _hoisted_64, [
|
|
2020
|
+
(_openBlock13(true), _createElementBlock12(
|
|
2021
|
+
_Fragment9,
|
|
2022
|
+
null,
|
|
2023
|
+
_renderList6(item.definition.children, (child, childIndex) => {
|
|
2024
|
+
return _openBlock13(), _createBlock6($setup["IncremarkRenderer"], {
|
|
2025
|
+
key: childIndex,
|
|
2026
|
+
node: child
|
|
2027
|
+
}, null, 8, ["node"]);
|
|
2028
|
+
}),
|
|
2029
|
+
128
|
|
2030
|
+
/* KEYED_FRAGMENT */
|
|
2031
|
+
))
|
|
2032
|
+
])
|
|
2033
|
+
]),
|
|
2034
|
+
_createCommentVNode9(" \u8FD4\u56DE\u94FE\u63A5 "),
|
|
2035
|
+
_createElementVNode9("a", {
|
|
2036
|
+
href: `#fnref-${item.identifier}`,
|
|
2037
|
+
class: "incremark-footnote-backref",
|
|
2038
|
+
"aria-label": "\u8FD4\u56DE\u5F15\u7528\u4F4D\u7F6E"
|
|
2039
|
+
}, " \u21A9 ", 8, _hoisted_73)
|
|
2040
|
+
], 8, _hoisted_36);
|
|
2041
|
+
}),
|
|
2042
|
+
128
|
|
2043
|
+
/* KEYED_FRAGMENT */
|
|
2044
|
+
))
|
|
2045
|
+
])
|
|
2046
|
+
])) : _createCommentVNode9("v-if", true);
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
// src/components/IncremarkFootnotes.vue
|
|
2050
|
+
IncremarkFootnotes_default.render = render13;
|
|
2051
|
+
IncremarkFootnotes_default.__file = "src/components/IncremarkFootnotes.vue";
|
|
2052
|
+
var IncremarkFootnotes_default2 = IncremarkFootnotes_default;
|
|
2053
|
+
|
|
1458
2054
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=script
|
|
1459
|
-
var Incremark_default = /* @__PURE__ */
|
|
2055
|
+
var Incremark_default = /* @__PURE__ */ _defineComponent14({
|
|
1460
2056
|
__name: "Incremark",
|
|
1461
2057
|
props: {
|
|
1462
|
-
blocks: { type: Array, required:
|
|
2058
|
+
blocks: { type: Array, required: false, default: () => [] },
|
|
1463
2059
|
components: { type: Object, required: false, default: () => ({}) },
|
|
1464
2060
|
pendingClass: { type: String, required: false, default: "incremark-pending" },
|
|
1465
2061
|
completedClass: { type: String, required: false, default: "incremark-completed" },
|
|
1466
|
-
showBlockStatus: { type: Boolean, required: false, default: false }
|
|
2062
|
+
showBlockStatus: { type: Boolean, required: false, default: false },
|
|
2063
|
+
incremark: { type: null, required: false }
|
|
1467
2064
|
},
|
|
1468
2065
|
setup(__props, { expose: __expose }) {
|
|
1469
2066
|
__expose();
|
|
2067
|
+
function isHtmlNode2(node) {
|
|
2068
|
+
return node.type === "html";
|
|
2069
|
+
}
|
|
1470
2070
|
const props = __props;
|
|
2071
|
+
let footnoteReferenceOrder;
|
|
2072
|
+
try {
|
|
2073
|
+
const context = useDefinationsContext();
|
|
2074
|
+
footnoteReferenceOrder = context.footnoteReferenceOrder;
|
|
2075
|
+
} catch {
|
|
2076
|
+
footnoteReferenceOrder = computed10(() => []);
|
|
2077
|
+
}
|
|
2078
|
+
const actualBlocks = computed10(() => props.incremark?.blocks.value || props.blocks || []);
|
|
2079
|
+
const actualIsFinalized = computed10(() => {
|
|
2080
|
+
if (props.incremark) {
|
|
2081
|
+
return props.incremark.isFinalized.value;
|
|
2082
|
+
}
|
|
2083
|
+
const blocks = props.blocks || [];
|
|
2084
|
+
return blocks.length > 0 && blocks.every((b) => b.status === "completed");
|
|
2085
|
+
});
|
|
1471
2086
|
const defaultComponents = {
|
|
1472
2087
|
heading: IncremarkHeading_default2,
|
|
1473
2088
|
paragraph: IncremarkParagraph_default2,
|
|
@@ -1477,37 +2092,49 @@ var Incremark_default = /* @__PURE__ */ _defineComponent11({
|
|
|
1477
2092
|
blockquote: IncremarkBlockquote_default2,
|
|
1478
2093
|
thematicBreak: IncremarkThematicBreak_default2,
|
|
1479
2094
|
math: IncremarkMath_default2,
|
|
1480
|
-
inlineMath: IncremarkMath_default2
|
|
2095
|
+
inlineMath: IncremarkMath_default2,
|
|
2096
|
+
htmlElement: IncremarkHtmlElement_default2
|
|
1481
2097
|
};
|
|
1482
|
-
const mergedComponents =
|
|
2098
|
+
const mergedComponents = computed10(() => ({
|
|
1483
2099
|
...defaultComponents,
|
|
1484
2100
|
...props.components
|
|
1485
2101
|
}));
|
|
1486
2102
|
function getComponent(type) {
|
|
1487
2103
|
return mergedComponents.value[type] || props.components?.default || IncremarkDefault_default2;
|
|
1488
2104
|
}
|
|
1489
|
-
const __returned__ = {
|
|
2105
|
+
const __returned__ = { isHtmlNode: isHtmlNode2, props, get footnoteReferenceOrder() {
|
|
2106
|
+
return footnoteReferenceOrder;
|
|
2107
|
+
}, set footnoteReferenceOrder(v) {
|
|
2108
|
+
footnoteReferenceOrder = v;
|
|
2109
|
+
}, actualBlocks, actualIsFinalized, defaultComponents, mergedComponents, getComponent, IncremarkFootnotes: IncremarkFootnotes_default2 };
|
|
1490
2110
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1491
2111
|
return __returned__;
|
|
1492
2112
|
}
|
|
1493
2113
|
});
|
|
1494
2114
|
|
|
1495
2115
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/Incremark.vue?type=template
|
|
1496
|
-
import {
|
|
1497
|
-
var
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
2116
|
+
import { createCommentVNode as _createCommentVNode10, renderList as _renderList7, Fragment as _Fragment10, openBlock as _openBlock14, createElementBlock as _createElementBlock13, toDisplayString as _toDisplayString9, createElementVNode as _createElementVNode10, resolveDynamicComponent as _resolveDynamicComponent5, createBlock as _createBlock7, normalizeClass as _normalizeClass3 } from "vue";
|
|
2117
|
+
var _hoisted_115 = { class: "incremark" };
|
|
2118
|
+
var _hoisted_29 = {
|
|
2119
|
+
key: 0,
|
|
2120
|
+
class: "incremark-html-code"
|
|
2121
|
+
};
|
|
2122
|
+
function render14(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2123
|
+
return _openBlock14(), _createElementBlock13("div", _hoisted_115, [
|
|
2124
|
+
_createCommentVNode10(" \u4E3B\u8981\u5185\u5BB9\u5757 "),
|
|
2125
|
+
(_openBlock14(true), _createElementBlock13(
|
|
2126
|
+
_Fragment10,
|
|
2127
|
+
null,
|
|
2128
|
+
_renderList7($setup.actualBlocks, (block) => {
|
|
2129
|
+
return _openBlock14(), _createElementBlock13(
|
|
2130
|
+
_Fragment10,
|
|
1504
2131
|
null,
|
|
1505
|
-
|
|
1506
|
-
|
|
2132
|
+
[
|
|
2133
|
+
block.node.type !== "definition" && block.node.type !== "footnoteDefinition" ? (_openBlock14(), _createElementBlock13(
|
|
1507
2134
|
"div",
|
|
1508
2135
|
{
|
|
1509
2136
|
key: block.stableId,
|
|
1510
|
-
class:
|
|
2137
|
+
class: _normalizeClass3([
|
|
1511
2138
|
"incremark-block",
|
|
1512
2139
|
block.status === "completed" ? $props.completedClass : $props.pendingClass,
|
|
1513
2140
|
{ "incremark-show-status": $props.showBlockStatus },
|
|
@@ -1515,74 +2142,53 @@ function render11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1515
2142
|
])
|
|
1516
2143
|
},
|
|
1517
2144
|
[
|
|
1518
|
-
(
|
|
1519
|
-
|
|
1520
|
-
|
|
2145
|
+
_createCommentVNode10(" HTML \u8282\u70B9\uFF1A\u6E32\u67D3\u4E3A\u4EE3\u7801\u5757\u663E\u793A\u6E90\u4EE3\u7801 "),
|
|
2146
|
+
$setup.isHtmlNode(block.node) ? (_openBlock14(), _createElementBlock13("pre", _hoisted_29, [
|
|
2147
|
+
_createElementVNode10(
|
|
2148
|
+
"code",
|
|
2149
|
+
null,
|
|
2150
|
+
_toDisplayString9(block.node.value),
|
|
2151
|
+
1
|
|
2152
|
+
/* TEXT */
|
|
2153
|
+
)
|
|
2154
|
+
])) : (_openBlock14(), _createElementBlock13(
|
|
2155
|
+
_Fragment10,
|
|
2156
|
+
{ key: 1 },
|
|
2157
|
+
[
|
|
2158
|
+
_createCommentVNode10(" \u5176\u4ED6\u8282\u70B9\uFF1A\u4F7F\u7528\u5BF9\u5E94\u7EC4\u4EF6 "),
|
|
2159
|
+
(_openBlock14(), _createBlock7(_resolveDynamicComponent5($setup.getComponent(block.node.type)), {
|
|
2160
|
+
node: block.node
|
|
2161
|
+
}, null, 8, ["node"]))
|
|
2162
|
+
],
|
|
2163
|
+
2112
|
|
2164
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
2165
|
+
))
|
|
1521
2166
|
],
|
|
1522
2167
|
2
|
|
1523
2168
|
/* CLASS */
|
|
1524
|
-
)
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
/*
|
|
1528
|
-
)
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
/*
|
|
1532
|
-
|
|
2169
|
+
)) : _createCommentVNode10("v-if", true)
|
|
2170
|
+
],
|
|
2171
|
+
64
|
|
2172
|
+
/* STABLE_FRAGMENT */
|
|
2173
|
+
);
|
|
2174
|
+
}),
|
|
2175
|
+
256
|
|
2176
|
+
/* UNKEYED_FRAGMENT */
|
|
2177
|
+
)),
|
|
2178
|
+
_createCommentVNode10(" \u811A\u6CE8\u5217\u8868\uFF08\u4EC5\u5728 finalize \u540E\u663E\u793A\uFF09 "),
|
|
2179
|
+
$setup.actualIsFinalized && $setup.footnoteReferenceOrder.value?.length > 0 ? (_openBlock14(), _createBlock7($setup["IncremarkFootnotes"], { key: 0 })) : _createCommentVNode10("v-if", true)
|
|
1533
2180
|
]);
|
|
1534
2181
|
}
|
|
1535
2182
|
|
|
1536
2183
|
// src/components/Incremark.vue
|
|
1537
|
-
Incremark_default.render =
|
|
2184
|
+
Incremark_default.render = render14;
|
|
1538
2185
|
Incremark_default.__file = "src/components/Incremark.vue";
|
|
1539
|
-
Incremark_default.__scopeId = "data-v-5966b843";
|
|
1540
2186
|
var Incremark_default2 = Incremark_default;
|
|
1541
2187
|
|
|
1542
|
-
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=script
|
|
1543
|
-
import { defineComponent as _defineComponent12 } from "vue";
|
|
1544
|
-
var IncremarkRenderer_default = /* @__PURE__ */ _defineComponent12({
|
|
1545
|
-
__name: "IncremarkRenderer",
|
|
1546
|
-
props: {
|
|
1547
|
-
node: { type: null, required: true }
|
|
1548
|
-
},
|
|
1549
|
-
setup(__props, { expose: __expose }) {
|
|
1550
|
-
__expose();
|
|
1551
|
-
const componentMap = {
|
|
1552
|
-
heading: IncremarkHeading_default2,
|
|
1553
|
-
paragraph: IncremarkParagraph_default2,
|
|
1554
|
-
code: IncremarkCode_default2,
|
|
1555
|
-
list: IncremarkList_default2,
|
|
1556
|
-
table: IncremarkTable_default2,
|
|
1557
|
-
blockquote: IncremarkBlockquote_default2,
|
|
1558
|
-
thematicBreak: IncremarkThematicBreak_default2,
|
|
1559
|
-
math: IncremarkMath_default2,
|
|
1560
|
-
inlineMath: IncremarkMath_default2
|
|
1561
|
-
};
|
|
1562
|
-
function getComponent(type) {
|
|
1563
|
-
return componentMap[type] || IncremarkDefault_default2;
|
|
1564
|
-
}
|
|
1565
|
-
const __returned__ = { componentMap, getComponent };
|
|
1566
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1567
|
-
return __returned__;
|
|
1568
|
-
}
|
|
1569
|
-
});
|
|
1570
|
-
|
|
1571
|
-
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/IncremarkRenderer.vue?type=template
|
|
1572
|
-
import { resolveDynamicComponent as _resolveDynamicComponent4, openBlock as _openBlock12, createBlock as _createBlock5 } from "vue";
|
|
1573
|
-
function render12(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1574
|
-
return _openBlock12(), _createBlock5(_resolveDynamicComponent4($setup.getComponent($props.node.type)), { node: $props.node }, null, 8, ["node"]);
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
// src/components/IncremarkRenderer.vue
|
|
1578
|
-
IncremarkRenderer_default.render = render12;
|
|
1579
|
-
IncremarkRenderer_default.__file = "src/components/IncremarkRenderer.vue";
|
|
1580
|
-
var IncremarkRenderer_default2 = IncremarkRenderer_default;
|
|
1581
|
-
|
|
1582
2188
|
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/AutoScrollContainer.vue?type=script
|
|
1583
|
-
import { defineComponent as
|
|
1584
|
-
import { ref as
|
|
1585
|
-
var AutoScrollContainer_default = /* @__PURE__ */
|
|
2189
|
+
import { defineComponent as _defineComponent15 } from "vue";
|
|
2190
|
+
import { ref as ref8, onMounted as onMounted2, onUnmounted as onUnmounted6, nextTick } from "vue";
|
|
2191
|
+
var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent15({
|
|
1586
2192
|
__name: "AutoScrollContainer",
|
|
1587
2193
|
props: {
|
|
1588
2194
|
enabled: { type: Boolean, required: false, default: true },
|
|
@@ -1591,8 +2197,8 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent13({
|
|
|
1591
2197
|
},
|
|
1592
2198
|
setup(__props, { expose: __expose }) {
|
|
1593
2199
|
const props = __props;
|
|
1594
|
-
const containerRef =
|
|
1595
|
-
const isUserScrolledUp =
|
|
2200
|
+
const containerRef = ref8(null);
|
|
2201
|
+
const isUserScrolledUp = ref8(false);
|
|
1596
2202
|
let lastScrollTop = 0;
|
|
1597
2203
|
let lastScrollHeight = 0;
|
|
1598
2204
|
function isNearBottom() {
|
|
@@ -1690,9 +2296,9 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent13({
|
|
|
1690
2296
|
});
|
|
1691
2297
|
|
|
1692
2298
|
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/components/AutoScrollContainer.vue?type=template
|
|
1693
|
-
import { renderSlot as _renderSlot, openBlock as
|
|
1694
|
-
function
|
|
1695
|
-
return
|
|
2299
|
+
import { renderSlot as _renderSlot, openBlock as _openBlock15, createElementBlock as _createElementBlock14 } from "vue";
|
|
2300
|
+
function render15(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2301
|
+
return _openBlock15(), _createElementBlock14(
|
|
1696
2302
|
"div",
|
|
1697
2303
|
{
|
|
1698
2304
|
ref: "containerRef",
|
|
@@ -1708,11 +2314,62 @@ function render13(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1708
2314
|
}
|
|
1709
2315
|
|
|
1710
2316
|
// src/components/AutoScrollContainer.vue
|
|
1711
|
-
AutoScrollContainer_default.render =
|
|
2317
|
+
AutoScrollContainer_default.render = render15;
|
|
1712
2318
|
AutoScrollContainer_default.__file = "src/components/AutoScrollContainer.vue";
|
|
1713
2319
|
AutoScrollContainer_default.__scopeId = "data-v-e0d180b8";
|
|
1714
2320
|
var AutoScrollContainer_default2 = AutoScrollContainer_default;
|
|
1715
2321
|
|
|
2322
|
+
// sfc-script:/Users/yishuai/develop/ai/markdown/packages/vue/src/ThemeProvider.vue?type=script
|
|
2323
|
+
import { defineComponent as _defineComponent16 } from "vue";
|
|
2324
|
+
import { ref as ref9, watch as watch6 } from "vue";
|
|
2325
|
+
import { applyTheme } from "@incremark/theme";
|
|
2326
|
+
var ThemeProvider_default = /* @__PURE__ */ _defineComponent16({
|
|
2327
|
+
__name: "ThemeProvider",
|
|
2328
|
+
props: {
|
|
2329
|
+
theme: { type: null, required: true },
|
|
2330
|
+
class: { type: String, required: false, default: "" }
|
|
2331
|
+
},
|
|
2332
|
+
setup(__props, { expose: __expose }) {
|
|
2333
|
+
__expose();
|
|
2334
|
+
const props = __props;
|
|
2335
|
+
const containerRef = ref9();
|
|
2336
|
+
watch6(
|
|
2337
|
+
() => props.theme,
|
|
2338
|
+
(theme) => {
|
|
2339
|
+
if (containerRef.value) {
|
|
2340
|
+
applyTheme(containerRef.value, theme);
|
|
2341
|
+
}
|
|
2342
|
+
},
|
|
2343
|
+
{ immediate: true }
|
|
2344
|
+
);
|
|
2345
|
+
const __returned__ = { props, containerRef };
|
|
2346
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2347
|
+
return __returned__;
|
|
2348
|
+
}
|
|
2349
|
+
});
|
|
2350
|
+
|
|
2351
|
+
// sfc-template:/Users/yishuai/develop/ai/markdown/packages/vue/src/ThemeProvider.vue?type=template
|
|
2352
|
+
import { renderSlot as _renderSlot2, normalizeClass as _normalizeClass4, openBlock as _openBlock16, createElementBlock as _createElementBlock15 } from "vue";
|
|
2353
|
+
function render16(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2354
|
+
return _openBlock16(), _createElementBlock15(
|
|
2355
|
+
"div",
|
|
2356
|
+
{
|
|
2357
|
+
ref: "containerRef",
|
|
2358
|
+
class: _normalizeClass4([$setup.props.class, "incremark-theme-provider"])
|
|
2359
|
+
},
|
|
2360
|
+
[
|
|
2361
|
+
_renderSlot2(_ctx.$slots, "default")
|
|
2362
|
+
],
|
|
2363
|
+
2
|
|
2364
|
+
/* CLASS */
|
|
2365
|
+
);
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
// src/ThemeProvider.vue
|
|
2369
|
+
ThemeProvider_default.render = render16;
|
|
2370
|
+
ThemeProvider_default.__file = "src/ThemeProvider.vue";
|
|
2371
|
+
var ThemeProvider_default2 = ThemeProvider_default;
|
|
2372
|
+
|
|
1716
2373
|
// src/index.ts
|
|
1717
2374
|
import {
|
|
1718
2375
|
BlockTransformer as BlockTransformer2,
|
|
@@ -1729,6 +2386,13 @@ import {
|
|
|
1729
2386
|
allPlugins,
|
|
1730
2387
|
createPlugin
|
|
1731
2388
|
} from "@incremark/core";
|
|
2389
|
+
import {
|
|
2390
|
+
defaultTheme,
|
|
2391
|
+
darkTheme,
|
|
2392
|
+
generateCSSVars,
|
|
2393
|
+
mergeTheme,
|
|
2394
|
+
applyTheme as applyTheme2
|
|
2395
|
+
} from "@incremark/theme";
|
|
1732
2396
|
export {
|
|
1733
2397
|
AutoScrollContainer_default2 as AutoScrollContainer,
|
|
1734
2398
|
BlockTransformer2 as BlockTransformer,
|
|
@@ -1736,29 +2400,57 @@ export {
|
|
|
1736
2400
|
IncremarkBlockquote_default2 as IncremarkBlockquote,
|
|
1737
2401
|
IncremarkCode_default2 as IncremarkCode,
|
|
1738
2402
|
IncremarkDefault_default2 as IncremarkDefault,
|
|
2403
|
+
IncremarkFootnotes_default2 as IncremarkFootnotes,
|
|
1739
2404
|
IncremarkHeading_default2 as IncremarkHeading,
|
|
1740
|
-
|
|
2405
|
+
IncremarkHtmlElement_default2 as IncremarkHtmlElement,
|
|
2406
|
+
IncremarkInline_default as IncremarkInline,
|
|
1741
2407
|
IncremarkList_default2 as IncremarkList,
|
|
1742
2408
|
IncremarkMath_default2 as IncremarkMath,
|
|
1743
2409
|
IncremarkParagraph_default2 as IncremarkParagraph,
|
|
1744
2410
|
IncremarkRenderer_default2 as IncremarkRenderer,
|
|
1745
2411
|
IncremarkTable_default2 as IncremarkTable,
|
|
1746
2412
|
IncremarkThematicBreak_default2 as IncremarkThematicBreak,
|
|
2413
|
+
ThemeProvider_default2 as ThemeProvider,
|
|
1747
2414
|
allPlugins,
|
|
2415
|
+
applyTheme2 as applyTheme,
|
|
1748
2416
|
cloneNode,
|
|
1749
2417
|
codeBlockPlugin,
|
|
1750
2418
|
countChars,
|
|
1751
2419
|
createBlockTransformer3 as createBlockTransformer,
|
|
1752
2420
|
createPlugin,
|
|
2421
|
+
darkTheme,
|
|
1753
2422
|
defaultPlugins2 as defaultPlugins,
|
|
2423
|
+
defaultTheme,
|
|
2424
|
+
generateCSSVars,
|
|
1754
2425
|
imagePlugin,
|
|
1755
2426
|
mathPlugin,
|
|
2427
|
+
mergeTheme,
|
|
1756
2428
|
mermaidPlugin,
|
|
1757
2429
|
sliceAst,
|
|
1758
2430
|
thematicBreakPlugin,
|
|
1759
2431
|
useBlockTransformer,
|
|
2432
|
+
useDefinationsContext,
|
|
1760
2433
|
useDevTools,
|
|
1761
2434
|
useIncremark,
|
|
2435
|
+
useProvideDefinations,
|
|
1762
2436
|
useStreamRenderer
|
|
1763
2437
|
};
|
|
2438
|
+
/**
|
|
2439
|
+
* @file Cursor Utils - 光标工具函数
|
|
2440
|
+
*
|
|
2441
|
+
* @description
|
|
2442
|
+
* 用于在 AST 节点末尾添加光标的工具函数。
|
|
2443
|
+
*
|
|
2444
|
+
* @author Incremark Team
|
|
2445
|
+
* @license MIT
|
|
2446
|
+
*/
|
|
2447
|
+
/**
|
|
2448
|
+
* @file useTypewriter Composable - 打字机效果管理
|
|
2449
|
+
*
|
|
2450
|
+
* @description
|
|
2451
|
+
* 管理打字机效果的状态和控制逻辑,从 useIncremark 中拆分出来以简化代码。
|
|
2452
|
+
*
|
|
2453
|
+
* @author Incremark Team
|
|
2454
|
+
* @license MIT
|
|
2455
|
+
*/
|
|
1764
2456
|
//# sourceMappingURL=index.js.map
|