vue-stream-markdown 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/{blockquote-CVFraiyL.js → blockquote-DTo6zg12.js} +6 -2
- package/dist/{break-CzrM3nW0.js → break-DoDPjOA0.js} +4 -0
- package/dist/button-1EHxh8s2.js +6 -0
- package/dist/{button-CWSGNZmd.js → button-B7H9jKmU.js} +2 -2
- package/dist/{code-DwwmPoup.js → code-DC7KVCvB.js} +14 -10
- package/dist/{code-block-XfHjZodV.js → code-block-DPC1FZT3.js} +26 -13
- package/dist/code-block-DYrPMONb.js +10 -0
- package/dist/{composables-BMXMKLLj.js → composables-BvaSMf02.js} +17 -2
- package/dist/{delete-BRwEUU72.js → delete-xkkM7TML.js} +6 -2
- package/dist/dropdown-Cv_yW4GS.js +6 -0
- package/dist/{emphasis-DblyP-Vp.js → emphasis-BmM30dZi.js} +6 -2
- package/dist/error-component-1U-JNS6o.js +5 -0
- package/dist/{error-component-CckClFee.js → error-component-DFBWdaYB.js} +2 -2
- package/dist/{footnote-definition-BvZNKSLa.js → footnote-definition-6cTbdg-J.js} +9 -5
- package/dist/{footnote-reference-DvAxMjRZ.js → footnote-reference-CxJUg8wT.js} +5 -1
- package/dist/{heading-g87txbB0.js → heading-DQ4lofbm.js} +6 -2
- package/dist/{html-BG83dEZJ.js → html-Be_6ezK6.js} +4 -0
- package/dist/{html-D7bGx0Cz.js → html-DfTs9nEm.js} +4 -0
- package/dist/{icon-CpKYt1dR.js → icon-BJa4ovUe.js} +1 -1
- package/dist/icon-CvIgAOPh.js +4 -0
- package/dist/{image-Dwe5A7RP.js → image-DXu2WF2r.js} +13 -10
- package/dist/image-Dm5xIWs7.js +9 -0
- package/dist/{image-CR28eDok.js → image-e0E51Nc3.js} +21 -12
- package/dist/index.css +130 -144
- package/dist/index.d.ts +211 -148
- package/dist/index.js +452 -247
- package/dist/{inline-code-E5uGvmnx.js → inline-code-B5lfHACE.js} +4 -0
- package/dist/{inline-math-BHDNxQ5R.js → inline-math-BuO_dWPX.js} +7 -3
- package/dist/{link-BiA46FMM.js → link-DyD59DzG.js} +8 -4
- package/dist/{list-D7QyoGUy.js → list-De0KPajx.js} +6 -2
- package/dist/{list-item-Cv8l3Ufd.js → list-item-CuUgvXRC.js} +6 -2
- package/dist/{math-BzuYH4PG.js → math-DnFOOLdz.js} +7 -3
- package/dist/{mermaid-BoiSJ4fF.js → mermaid-ZCQPlRUa.js} +22 -8
- package/dist/modal-B5jFKJL4.js +4 -0
- package/dist/{modal-DHGxvCt5.js → modal-Bhe0iSs6.js} +8 -5
- package/dist/{node-list-D6zJX92N.js → node-list-CWy--Gin.js} +7 -78
- package/dist/node-list-Doh9Z-4p.js +4 -0
- package/dist/{paragraph-YTqe84Bm.js → paragraph-D3H1qprZ.js} +6 -2
- package/dist/previewers-DB2HHDGb.js +10 -0
- package/dist/{segmented-DDQZGL7l.js → segmented-B-kjIOkd.js} +1 -1
- package/dist/segmented-fbmq_xK1.js +7 -0
- package/dist/{shiki-DDfRFzy0.js → shiki-DAu2_FTG.js} +7 -3
- package/dist/{strong-nPwCJEKq.js → strong-BlCQoXCR.js} +6 -2
- package/dist/{table-Dtpd-MnT.js → table-Co_MpK6m.js} +17 -8
- package/dist/{text-CfRWiRE0.js → text-DbHMEN3P.js} +4 -0
- package/dist/{thematic-break-DgOD2KmY.js → thematic-break-CdlhHAEZ.js} +4 -0
- package/dist/theme.css +2 -2
- package/dist/tooltip-70WIAMmC.js +4 -0
- package/dist/{tooltip-C4RiUZwy.js → tooltip-CWv9skVu.js} +3 -2
- package/dist/{vanilla-NR7MOE5P.js → vanilla-D30b-_ch.js} +1 -1
- package/dist/vanilla-DV7fYrnj.js +4 -0
- package/dist/{yaml-DP0yfJyS.js → yaml-DL5ozHZ_.js} +4 -0
- package/dist/{zoom-container-CqZQ4X6w.js → zoom-container-DbeN8U39.js} +33 -9
- package/dist/zoom-container-Dc8N-wuo.js +7 -0
- package/package.json +4 -5
- package/dist/button-BFS-gHGF.js +0 -6
- package/dist/code-block-CTM9VEwA.js +0 -10
- package/dist/dropdown-BQ3uynLf.js +0 -6
- package/dist/error-component-B_Vacrqa.js +0 -5
- package/dist/icon-BX3KKloR.js +0 -4
- package/dist/image-BtkXhzG1.js +0 -9
- package/dist/modal-CFOdkYNj.js +0 -4
- package/dist/node-list-BYDvt6bq.js +0 -4
- package/dist/previewers-Cpx1Wqu8.js +0 -10
- package/dist/segmented-CaVb5_Rp.js +0 -7
- package/dist/tooltip-BIvCaFUj.js +0 -4
- package/dist/vanilla-DfHiHWnr.js +0 -4
- package/dist/zoom-container-DtkZ07v1.js +0 -7
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ This project also uses and benefits from:
|
|
|
72
72
|
- [Shiki](https://shiki.style/) - Beautiful syntax highlighting
|
|
73
73
|
- [Mermaid](https://mermaid.js.org/) - Diagramming and charting tool
|
|
74
74
|
- [KaTeX](https://katex.org/) - Fast math typesetting library for the web
|
|
75
|
-
- [Remend](https://github.com/vercel/streamdown/tree/main/packages/remend) -
|
|
75
|
+
- [Remend](https://github.com/vercel/streamdown/tree/main/packages/remend) - This project implements similar functionality inspired by remend for intelligently parsing and completing incomplete Markdown blocks.
|
|
76
76
|
|
|
77
77
|
### Code Sources
|
|
78
78
|
- [markstream-vue](https://github.com/Simon-He95/markstream-vue) - The original inspiration for learning AST-based custom markdown rendering, and the source of the animation implementation used in this project
|
|
@@ -96,6 +96,10 @@ If you encounter any problems, please:
|
|
|
96
96
|
|
|
97
97
|
Please provide the shareable link, markdown content, and AST syntax tree when creating an issue. This will help me reproduce and diagnose the problem more effectively.
|
|
98
98
|
|
|
99
|
+
## Contributors
|
|
100
|
+
|
|
101
|
+
[](https://github.com/jinghaihan/vue-stream-markdown/graphs/contributors)
|
|
102
|
+
|
|
99
103
|
## License
|
|
100
104
|
|
|
101
105
|
[MIT](./LICENSE) License © [jinghaihan](https://github.com/jinghaihan)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./composables-
|
|
2
|
-
import { t as node_list_default } from "./node-list-
|
|
1
|
+
import "./composables-BvaSMf02.js";
|
|
2
|
+
import { t as node_list_default } from "./node-list-CWy--Gin.js";
|
|
3
3
|
import { createElementBlock, createVNode, defineComponent, mergeProps, openBlock } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/components/renderers/blockquote.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -55,6 +55,10 @@ var blockquote_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
55
55
|
type: Object,
|
|
56
56
|
required: false
|
|
57
57
|
},
|
|
58
|
+
uiOptions: {
|
|
59
|
+
type: Object,
|
|
60
|
+
required: false
|
|
61
|
+
},
|
|
58
62
|
isDark: {
|
|
59
63
|
type: Boolean,
|
|
60
64
|
required: false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as tooltip_default } from "./tooltip-
|
|
2
|
-
import { t as icon_default } from "./icon-
|
|
1
|
+
import { t as tooltip_default } from "./tooltip-CWv9skVu.js";
|
|
2
|
+
import { t as icon_default } from "./icon-BJa4ovUe.js";
|
|
3
3
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, normalizeClass, normalizeStyle, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
|
|
4
4
|
import { createReusableTemplate } from "@vueuse/core";
|
|
5
5
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./previewers-
|
|
2
|
-
import { r as useShiki } from "./composables-
|
|
3
|
-
import "./tooltip-
|
|
4
|
-
import "./button-
|
|
5
|
-
import "./icon-
|
|
6
|
-
import "./modal-
|
|
7
|
-
import { t as code_block_default } from "./code-block-
|
|
8
|
-
import "./segmented-
|
|
1
|
+
import "./previewers-DB2HHDGb.js";
|
|
2
|
+
import { r as useShiki } from "./composables-BvaSMf02.js";
|
|
3
|
+
import "./tooltip-CWv9skVu.js";
|
|
4
|
+
import "./button-B7H9jKmU.js";
|
|
5
|
+
import "./icon-BJa4ovUe.js";
|
|
6
|
+
import "./modal-Bhe0iSs6.js";
|
|
7
|
+
import { t as code_block_default } from "./code-block-DPC1FZT3.js";
|
|
8
|
+
import "./segmented-B-kjIOkd.js";
|
|
9
9
|
import { computed, createBlock, createCommentVNode, defineAsyncComponent, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, resolveDynamicComponent, withCtx } from "vue";
|
|
10
10
|
|
|
11
11
|
//#region src/components/renderers/code/index.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -60,6 +60,10 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
60
60
|
type: Object,
|
|
61
61
|
required: false
|
|
62
62
|
},
|
|
63
|
+
uiOptions: {
|
|
64
|
+
type: Object,
|
|
65
|
+
required: false
|
|
66
|
+
},
|
|
63
67
|
isDark: {
|
|
64
68
|
type: Boolean,
|
|
65
69
|
required: false
|
|
@@ -75,8 +79,8 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
75
79
|
const languageClass = computed(() => `language-${props.node.lang}`);
|
|
76
80
|
const { installed: hasShiki } = useShiki();
|
|
77
81
|
const components = {
|
|
78
|
-
vanilla: defineAsyncComponent(() => import("./vanilla-
|
|
79
|
-
shiki: defineAsyncComponent(() => import("./shiki-
|
|
82
|
+
vanilla: defineAsyncComponent(() => import("./vanilla-DV7fYrnj.js")),
|
|
83
|
+
shiki: defineAsyncComponent(() => import("./shiki-DAu2_FTG.js"))
|
|
80
84
|
};
|
|
81
85
|
const component = computed(() => {
|
|
82
86
|
if (hasShiki.value) return components.shiki;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as CODE_PREVIEWERS } from "./previewers-
|
|
2
|
-
import { G as useControls, K as useContext, V as save, b as useI18n, d as LANGUAGE_ALIAS, f as LANGUAGE_EXTENSIONS, m as useMermaid, p as LANGUAGE_ICONS, q as useCodeOptions } from "./composables-
|
|
3
|
-
import { t as button_default } from "./button-
|
|
4
|
-
import { t as modal_default } from "./modal-
|
|
5
|
-
import { t as segmented_default } from "./segmented-
|
|
6
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineAsyncComponent, defineComponent,
|
|
1
|
+
import { t as CODE_PREVIEWERS } from "./previewers-DB2HHDGb.js";
|
|
2
|
+
import { G as useControls, K as useContext, V as save, b as useI18n, d as LANGUAGE_ALIAS, f as LANGUAGE_EXTENSIONS, m as useMermaid, p as LANGUAGE_ICONS, q as useCodeOptions } from "./composables-BvaSMf02.js";
|
|
3
|
+
import { t as button_default } from "./button-B7H9jKmU.js";
|
|
4
|
+
import { t as modal_default } from "./modal-Bhe0iSs6.js";
|
|
5
|
+
import { t as segmented_default } from "./segmented-B-kjIOkd.js";
|
|
6
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineAsyncComponent, defineComponent, mergeProps, normalizeClass, normalizeStyle, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toRefs, unref, useModel, vShow, watch, withCtx, withDirectives } from "vue";
|
|
7
7
|
import { createReusableTemplate, useClipboard } from "@vueuse/core";
|
|
8
8
|
|
|
9
9
|
//#region src/components/code-block/actions.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -179,6 +179,10 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
179
179
|
type: Object,
|
|
180
180
|
required: false
|
|
181
181
|
},
|
|
182
|
+
uiOptions: {
|
|
183
|
+
type: Object,
|
|
184
|
+
required: false
|
|
185
|
+
},
|
|
182
186
|
isDark: {
|
|
183
187
|
type: Boolean,
|
|
184
188
|
required: false
|
|
@@ -186,13 +190,13 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
186
190
|
},
|
|
187
191
|
setup(__props) {
|
|
188
192
|
const props = __props;
|
|
189
|
-
const CodeNode = defineAsyncComponent(() => import("./code-
|
|
193
|
+
const CodeNode = defineAsyncComponent(() => import("./code-DC7KVCvB.js"));
|
|
190
194
|
const { controls, previewers, codeOptions } = toRefs(props);
|
|
191
195
|
const [DefineTemplate, ReuseTemplate] = createReusableTemplate();
|
|
192
196
|
const { t } = useI18n();
|
|
193
|
-
const { isControlEnabled, resolveControls } = useControls({ controls });
|
|
197
|
+
const { isControlEnabled, getControlValue, resolveControls } = useControls({ controls });
|
|
194
198
|
const { installed: hasMermaid } = useMermaid();
|
|
195
|
-
const { onCopied } = useContext();
|
|
199
|
+
const { beforeDownload, onCopied } = useContext();
|
|
196
200
|
const { copy, copied } = useClipboard({ legacy: true });
|
|
197
201
|
const { saveMermaid } = useMermaid();
|
|
198
202
|
const collapsed = ref(false);
|
|
@@ -265,6 +269,7 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
265
269
|
if (data && typeof data !== "boolean") return data;
|
|
266
270
|
return previewer;
|
|
267
271
|
});
|
|
272
|
+
const inlineInteractive = computed(() => getControlValue("mermaid.inlineInteractive") ?? true);
|
|
268
273
|
function normalizeHeight(height) {
|
|
269
274
|
return typeof height === "number" ? `${height}px` : height;
|
|
270
275
|
}
|
|
@@ -322,14 +327,22 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
322
327
|
icon: "download",
|
|
323
328
|
options: downloadOptions.value.length > 0 ? downloadOptions.value : void 0,
|
|
324
329
|
visible: () => showDownload.value && !!LANGUAGE_EXTENSIONS[language.value],
|
|
325
|
-
onClick: (_event, item) => {
|
|
330
|
+
onClick: async (_event, item) => {
|
|
326
331
|
if (props.node.loading) return;
|
|
327
332
|
if (!item || item.value === "code") {
|
|
328
333
|
const extension = LANGUAGE_EXTENSIONS[language.value];
|
|
329
|
-
|
|
334
|
+
if (await beforeDownload({
|
|
335
|
+
type: "code",
|
|
336
|
+
content: props.node.value
|
|
337
|
+
})) save(`file.${extension}`, props.node.value, "text/plain");
|
|
330
338
|
return;
|
|
331
339
|
}
|
|
332
|
-
if ((item === null || item === void 0 ? void 0 : item.value) === "svg" || (item === null || item === void 0 ? void 0 : item.value) === "png")
|
|
340
|
+
if ((item === null || item === void 0 ? void 0 : item.value) === "svg" || (item === null || item === void 0 ? void 0 : item.value) === "png") {
|
|
341
|
+
if (await beforeDownload({
|
|
342
|
+
type: "mermaid",
|
|
343
|
+
content: props.node.value
|
|
344
|
+
})) saveMermaid(item === null || item === void 0 ? void 0 : item.value, props.node.value);
|
|
345
|
+
}
|
|
333
346
|
}
|
|
334
347
|
},
|
|
335
348
|
{
|
|
@@ -394,7 +407,7 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
394
407
|
withDirectives(createElementVNode("main", {
|
|
395
408
|
"data-stream-markdown": "code-block-content",
|
|
396
409
|
style: normalizeStyle({ maxHeight: maxHeight.value })
|
|
397
|
-
}, [previewable.value ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(PreviewComponent.value),
|
|
410
|
+
}, [previewable.value ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(PreviewComponent.value), mergeProps({ key: 0 }, props, { interactive: inlineInteractive.value }), null, 16, ["interactive"])), [[vShow, mode.value === "preview"]]) : createCommentVNode("v-if", true), withDirectives(createElementVNode("main", null, [renderSlot(_ctx.$slots, "default")], 512), [[vShow, mode.value === "source"]])], 4), [[vShow, !collapsed.value]]),
|
|
398
411
|
createVNode(modal_default, {
|
|
399
412
|
open: fullscreen.value,
|
|
400
413
|
"onUpdate:open": _cache[10] || (_cache[10] = ($event) => fullscreen.value = $event),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./previewers-DB2HHDGb.js";
|
|
2
|
+
import "./composables-BvaSMf02.js";
|
|
3
|
+
import "./tooltip-CWv9skVu.js";
|
|
4
|
+
import "./button-B7H9jKmU.js";
|
|
5
|
+
import "./icon-BJa4ovUe.js";
|
|
6
|
+
import "./modal-Bhe0iSs6.js";
|
|
7
|
+
import { t as code_block_default } from "./code-block-DPC1FZT3.js";
|
|
8
|
+
import "./segmented-B-kjIOkd.js";
|
|
9
|
+
|
|
10
|
+
export { code_block_default as default };
|
|
@@ -38,6 +38,8 @@ function useContext() {
|
|
|
38
38
|
const context = injectContext();
|
|
39
39
|
const mode = computed(() => unref(context.mode) ?? "streaming");
|
|
40
40
|
const icons = computed(() => unref(context.icons) ?? {});
|
|
41
|
+
const uiOptions = computed(() => unref(context.uiOptions) ?? {});
|
|
42
|
+
const hideTooltip = computed(() => uiOptions.value.hideTooltip ?? false);
|
|
41
43
|
const isDark = computed(() => unref(context.isDark) ?? false);
|
|
42
44
|
const enableAnimate = computed(() => unref(context.enableAnimate));
|
|
43
45
|
const parsedNodes = computed(() => unref(context.parsedNodes) ?? []);
|
|
@@ -55,6 +57,7 @@ function useContext() {
|
|
|
55
57
|
provideContext,
|
|
56
58
|
injectContext,
|
|
57
59
|
mode,
|
|
60
|
+
hideTooltip,
|
|
58
61
|
icons,
|
|
59
62
|
isDark,
|
|
60
63
|
enableAnimate,
|
|
@@ -62,6 +65,12 @@ function useContext() {
|
|
|
62
65
|
get getContainer() {
|
|
63
66
|
return context.getContainer || (() => void 0);
|
|
64
67
|
},
|
|
68
|
+
get getOverlayContainer() {
|
|
69
|
+
return context.getOverlayContainer || (() => null);
|
|
70
|
+
},
|
|
71
|
+
get beforeDownload() {
|
|
72
|
+
return context.beforeDownload || (() => true);
|
|
73
|
+
},
|
|
65
74
|
get onCopied() {
|
|
66
75
|
return context.onCopied || (() => {});
|
|
67
76
|
}
|
|
@@ -479,6 +488,7 @@ function tableDataToMarkdown(data) {
|
|
|
479
488
|
//#endregion
|
|
480
489
|
//#region src/composables/use-floating.ts
|
|
481
490
|
function useFloating(options) {
|
|
491
|
+
const hideTooltip = computed(() => unref(options.hideTooltip) ?? false);
|
|
482
492
|
const trigger = computed(() => unref(options.trigger) ?? "hover");
|
|
483
493
|
const placement = computed(() => unref(options.placement) ?? "top");
|
|
484
494
|
const delay = computed(() => unref(options.delay) ?? [100, 100]);
|
|
@@ -555,6 +565,7 @@ function useFloating(options) {
|
|
|
555
565
|
updatePosition();
|
|
556
566
|
}
|
|
557
567
|
function onMouseEnter() {
|
|
568
|
+
if (hideTooltip.value) return;
|
|
558
569
|
if (trigger.value === "hover") show();
|
|
559
570
|
}
|
|
560
571
|
function onMouseLeave() {
|
|
@@ -1939,7 +1950,11 @@ function useTailwindV3Theme(options) {
|
|
|
1939
1950
|
id: "stream-markdown-tailwind-v3-theme",
|
|
1940
1951
|
immediate: false
|
|
1941
1952
|
});
|
|
1942
|
-
const styleScope = computed(() =>
|
|
1953
|
+
const styleScope = computed(() => {
|
|
1954
|
+
const scope = unref(options.styleScope);
|
|
1955
|
+
if (!scope) return [".stream-markdown", ".stream-markdown-overlay"];
|
|
1956
|
+
return Array.isArray(scope) ? scope : [scope];
|
|
1957
|
+
});
|
|
1943
1958
|
const element = computed(() => {
|
|
1944
1959
|
return toValue(options.element) || (isClient() ? document.body : void 0);
|
|
1945
1960
|
});
|
|
@@ -1953,7 +1968,7 @@ function useTailwindV3Theme(options) {
|
|
|
1953
1968
|
if (value && !reg.test(value)) cssVariables.push(` ${name}: hsl(${value});`);
|
|
1954
1969
|
}
|
|
1955
1970
|
if (cssVariables.length > 0) {
|
|
1956
|
-
css.value =
|
|
1971
|
+
css.value = styleScope.value.map((scope) => `${scope} {\n${cssVariables.join("\n")}\n}`).join("\n");
|
|
1957
1972
|
load();
|
|
1958
1973
|
} else {
|
|
1959
1974
|
css.value = "";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./composables-
|
|
2
|
-
import { t as node_list_default } from "./node-list-
|
|
1
|
+
import "./composables-BvaSMf02.js";
|
|
2
|
+
import { t as node_list_default } from "./node-list-CWy--Gin.js";
|
|
3
3
|
import { createElementBlock, createVNode, defineComponent, mergeProps, openBlock } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/components/renderers/delete.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -55,6 +55,10 @@ var delete_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
55
55
|
type: Object,
|
|
56
56
|
required: false
|
|
57
57
|
},
|
|
58
|
+
uiOptions: {
|
|
59
|
+
type: Object,
|
|
60
|
+
required: false
|
|
61
|
+
},
|
|
58
62
|
isDark: {
|
|
59
63
|
type: Boolean,
|
|
60
64
|
required: false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./composables-
|
|
2
|
-
import { t as node_list_default } from "./node-list-
|
|
1
|
+
import "./composables-BvaSMf02.js";
|
|
2
|
+
import { t as node_list_default } from "./node-list-CWy--Gin.js";
|
|
3
3
|
import { createElementBlock, createVNode, defineComponent, mergeProps, openBlock } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/components/renderers/emphasis.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -55,6 +55,10 @@ var emphasis_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
55
55
|
type: Object,
|
|
56
56
|
required: false
|
|
57
57
|
},
|
|
58
|
+
uiOptions: {
|
|
59
|
+
type: Object,
|
|
60
|
+
required: false
|
|
61
|
+
},
|
|
58
62
|
isDark: {
|
|
59
63
|
type: Boolean,
|
|
60
64
|
required: false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as useContext, b as useI18n } from "./composables-
|
|
2
|
-
import { t as icon_default } from "./icon-
|
|
1
|
+
import { K as useContext, b as useI18n } from "./composables-BvaSMf02.js";
|
|
2
|
+
import { t as icon_default } from "./icon-BJa4ovUe.js";
|
|
3
3
|
import { computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, defineComponent, openBlock, renderSlot, resolveDynamicComponent, toDisplayString } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/components/error-component.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { K as useContext, b as useI18n } from "./composables-
|
|
2
|
-
import { t as node_list_default } from "./node-list-
|
|
3
|
-
import "./tooltip-
|
|
4
|
-
import { t as button_default } from "./button-
|
|
5
|
-
import "./icon-
|
|
1
|
+
import { K as useContext, b as useI18n } from "./composables-BvaSMf02.js";
|
|
2
|
+
import { t as node_list_default } from "./node-list-CWy--Gin.js";
|
|
3
|
+
import "./tooltip-CWv9skVu.js";
|
|
4
|
+
import { t as button_default } from "./button-B7H9jKmU.js";
|
|
5
|
+
import "./icon-BJa4ovUe.js";
|
|
6
6
|
import { computed, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, openBlock, toDisplayString, unref } from "vue";
|
|
7
7
|
|
|
8
8
|
//#region src/components/renderers/footnote-definition.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -59,6 +59,10 @@ var footnote_definition_vue_vue_type_script_setup_true_lang_default = /* @__PURE
|
|
|
59
59
|
type: Object,
|
|
60
60
|
required: false
|
|
61
61
|
},
|
|
62
|
+
uiOptions: {
|
|
63
|
+
type: Object,
|
|
64
|
+
required: false
|
|
65
|
+
},
|
|
62
66
|
isDark: {
|
|
63
67
|
type: Boolean,
|
|
64
68
|
required: false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as useContext } from "./composables-
|
|
1
|
+
import { K as useContext } from "./composables-BvaSMf02.js";
|
|
2
2
|
import { computed, createElementBlock, createElementVNode, defineComponent, openBlock, toDisplayString } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/renderers/footnote-reference.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -54,6 +54,10 @@ var footnote_reference_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
|
|
|
54
54
|
type: Object,
|
|
55
55
|
required: false
|
|
56
56
|
},
|
|
57
|
+
uiOptions: {
|
|
58
|
+
type: Object,
|
|
59
|
+
required: false
|
|
60
|
+
},
|
|
57
61
|
isDark: {
|
|
58
62
|
type: Boolean,
|
|
59
63
|
required: false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./composables-
|
|
2
|
-
import { t as node_list_default } from "./node-list-
|
|
1
|
+
import "./composables-BvaSMf02.js";
|
|
2
|
+
import { t as node_list_default } from "./node-list-CWy--Gin.js";
|
|
3
3
|
import { computed, createBlock, createVNode, defineComponent, mergeProps, openBlock, resolveDynamicComponent, withCtx } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/components/renderers/heading.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -54,6 +54,10 @@ var heading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
54
54
|
type: Object,
|
|
55
55
|
required: false
|
|
56
56
|
},
|
|
57
|
+
uiOptions: {
|
|
58
|
+
type: Object,
|
|
59
|
+
required: false
|
|
60
|
+
},
|
|
57
61
|
isDark: {
|
|
58
62
|
type: Boolean,
|
|
59
63
|
required: false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as useContext } from "./composables-
|
|
1
|
+
import { K as useContext } from "./composables-BvaSMf02.js";
|
|
2
2
|
import { computed, createElementBlock, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, unref } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/icon.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { G as useControls,
|
|
1
|
+
import { G as useControls, K as useContext, b as useI18n, h as useMediumZoom } from "./composables-BvaSMf02.js";
|
|
2
2
|
import { n as treeFlatFilter } from "./dist-CYkm26BF.js";
|
|
3
|
-
import { t as button_default } from "./button-
|
|
4
|
-
import { t as modal_default } from "./modal-
|
|
5
|
-
import { t as zoom_container_default } from "./zoom-container-
|
|
3
|
+
import { t as button_default } from "./button-B7H9jKmU.js";
|
|
4
|
+
import { t as modal_default } from "./modal-Bhe0iSs6.js";
|
|
5
|
+
import { t as zoom_container_default } from "./zoom-container-DbeN8U39.js";
|
|
6
6
|
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeStyle, openBlock, ref, renderList, toRefs, unref, watch, withCtx } from "vue";
|
|
7
7
|
import { useCycleList } from "@vueuse/core";
|
|
8
8
|
|
|
@@ -54,6 +54,10 @@ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
54
54
|
nodeProps: {
|
|
55
55
|
type: Object,
|
|
56
56
|
required: true
|
|
57
|
+
},
|
|
58
|
+
handleDownload: {
|
|
59
|
+
type: Function,
|
|
60
|
+
required: false
|
|
57
61
|
}
|
|
58
62
|
},
|
|
59
63
|
emits: ["load", "error"],
|
|
@@ -72,7 +76,7 @@ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
72
76
|
initialValue: props.src,
|
|
73
77
|
fallbackIndex: 0
|
|
74
78
|
});
|
|
75
|
-
const enableDownload = computed(() => isControlEnabled("image.download"));
|
|
79
|
+
const enableDownload = computed(() => isControlEnabled("image.download") && !!props.handleDownload);
|
|
76
80
|
const enableCarousel = computed(() => isControlEnabled("image.carousel"));
|
|
77
81
|
const enableFlip = computed(() => isControlEnabled("image.flip"));
|
|
78
82
|
const enableRotate = computed(() => isControlEnabled("image.rotate"));
|
|
@@ -105,7 +109,10 @@ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
105
109
|
key: "download",
|
|
106
110
|
icon: "download",
|
|
107
111
|
name: t("button.download"),
|
|
108
|
-
onClick:
|
|
112
|
+
onClick: () => {
|
|
113
|
+
var _props$handleDownload;
|
|
114
|
+
return (_props$handleDownload = props.handleDownload) === null || _props$handleDownload === void 0 ? void 0 : _props$handleDownload.call(props, imageSrc.value);
|
|
115
|
+
},
|
|
109
116
|
visible: () => !!imageSrc.value && enableDownload.value
|
|
110
117
|
},
|
|
111
118
|
{
|
|
@@ -170,10 +177,6 @@ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
170
177
|
if (isAnimating.value) return;
|
|
171
178
|
zoomOut();
|
|
172
179
|
}
|
|
173
|
-
function download() {
|
|
174
|
-
if (!imageSrc.value) return;
|
|
175
|
-
saveImage(imageSrc.value, props.alt);
|
|
176
|
-
}
|
|
177
180
|
function flipHorizontal() {
|
|
178
181
|
scaleX.value *= -1;
|
|
179
182
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./composables-BvaSMf02.js";
|
|
2
|
+
import "./tooltip-CWv9skVu.js";
|
|
3
|
+
import "./button-B7H9jKmU.js";
|
|
4
|
+
import "./icon-BJa4ovUe.js";
|
|
5
|
+
import "./modal-Bhe0iSs6.js";
|
|
6
|
+
import "./zoom-container-DbeN8U39.js";
|
|
7
|
+
import { t as image_default } from "./image-DXu2WF2r.js";
|
|
8
|
+
|
|
9
|
+
export { image_default as default };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { G as useControls, H as saveImage, b as useI18n, i as useSanitizers } from "./composables-
|
|
2
|
-
import "./tooltip-
|
|
3
|
-
import { t as button_default } from "./button-
|
|
4
|
-
import "./icon-
|
|
5
|
-
import "./modal-
|
|
6
|
-
import { t as error_component_default } from "./error-component-
|
|
7
|
-
import "./zoom-container-
|
|
8
|
-
import { t as image_default$1 } from "./image-
|
|
1
|
+
import { G as useControls, H as saveImage, K as useContext, b as useI18n, i as useSanitizers } from "./composables-BvaSMf02.js";
|
|
2
|
+
import "./tooltip-CWv9skVu.js";
|
|
3
|
+
import { t as button_default } from "./button-B7H9jKmU.js";
|
|
4
|
+
import "./icon-BJa4ovUe.js";
|
|
5
|
+
import "./modal-Bhe0iSs6.js";
|
|
6
|
+
import { t as error_component_default } from "./error-component-DFBWdaYB.js";
|
|
7
|
+
import "./zoom-container-DbeN8U39.js";
|
|
8
|
+
import { t as image_default$1 } from "./image-DXu2WF2r.js";
|
|
9
9
|
import { t as spin_default } from "./spin-DzERwGWy.js";
|
|
10
10
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, normalizeStyle, openBlock, ref, resolveDynamicComponent, toDisplayString, toRefs, unref, withCtx } from "vue";
|
|
11
11
|
|
|
@@ -66,6 +66,10 @@ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
66
66
|
type: Object,
|
|
67
67
|
required: false
|
|
68
68
|
},
|
|
69
|
+
uiOptions: {
|
|
70
|
+
type: Object,
|
|
71
|
+
required: false
|
|
72
|
+
},
|
|
69
73
|
isDark: {
|
|
70
74
|
type: Boolean,
|
|
71
75
|
required: false
|
|
@@ -75,6 +79,7 @@ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
75
79
|
const props = __props;
|
|
76
80
|
const { t } = useI18n();
|
|
77
81
|
const { controls, hardenOptions } = toRefs(props);
|
|
82
|
+
const { beforeDownload } = useContext();
|
|
78
83
|
const { isControlEnabled } = useControls({ controls });
|
|
79
84
|
const maskRef = ref();
|
|
80
85
|
const loadError = ref(false);
|
|
@@ -114,9 +119,12 @@ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
114
119
|
}
|
|
115
120
|
loadError.value = true;
|
|
116
121
|
}
|
|
117
|
-
async function handleDownload() {
|
|
118
|
-
if (!
|
|
119
|
-
|
|
122
|
+
async function handleDownload(url = imageSrc.value) {
|
|
123
|
+
if (!url) return;
|
|
124
|
+
if (await beforeDownload({
|
|
125
|
+
type: "image",
|
|
126
|
+
url
|
|
127
|
+
})) saveImage(url, alt.value);
|
|
120
128
|
}
|
|
121
129
|
function handleMouseEnter() {
|
|
122
130
|
if (maskRef.value) maskRef.value.style.opacity = 1;
|
|
@@ -145,7 +153,7 @@ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
145
153
|
"icon-width": 16,
|
|
146
154
|
"icon-height": 16,
|
|
147
155
|
"button-style": { backgroundColor: "color-mix(in oklab, var(--background) 90%, transparent)" },
|
|
148
|
-
onClick: handleDownload
|
|
156
|
+
onClick: _cache[0] || (_cache[0] = () => handleDownload(imageSrc.value))
|
|
149
157
|
}, null, 8, ["name"])) : createCommentVNode("v-if", true)], 512)) : createCommentVNode("v-if", true),
|
|
150
158
|
(isLoading.value || !imageLoaded.value) && !unref(isHardenUrl) ? (openBlock(), createBlock(spin_default, { key: 1 })) : createCommentVNode("v-if", true),
|
|
151
159
|
!isLoading.value && !unref(isHardenUrl) && typeof unref(transformedUrl) === "string" ? (openBlock(), createBlock(image_default$1, {
|
|
@@ -157,6 +165,7 @@ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
157
165
|
controls: unref(controls),
|
|
158
166
|
"transform-harden-url": unref(transformHardenUrl),
|
|
159
167
|
"node-props": props,
|
|
168
|
+
"handle-download": handleDownload,
|
|
160
169
|
onLoad: handleLoaded,
|
|
161
170
|
onError: handleError
|
|
162
171
|
}, null, 8, [
|