@coderminer/vue-markdown 0.0.0-stage → 1.0.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/CHANGELOG.md +110 -0
- package/LICENSE +21 -0
- package/README.md +579 -3
- package/README.zh-CN.md +547 -0
- package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +18 -0
- package/dist/chunks/MarkdownBlockquote-DVXziX2t.js.map +1 -0
- package/dist/chunks/MarkdownBreak-BwCi2Itt.js +18 -0
- package/dist/chunks/MarkdownBreak-BwCi2Itt.js.map +1 -0
- package/dist/chunks/MarkdownCode-B1k9tmW5.js +65 -0
- package/dist/chunks/MarkdownCode-B1k9tmW5.js.map +1 -0
- package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +51 -0
- package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js.map +1 -0
- package/dist/chunks/MarkdownContent-BAK6dqo7.js +15 -0
- package/dist/chunks/MarkdownContent-BAK6dqo7.js.map +1 -0
- package/dist/chunks/MarkdownCustomTag-BBdn3-WO.js +42 -0
- package/dist/chunks/MarkdownCustomTag-BBdn3-WO.js.map +1 -0
- package/dist/chunks/MarkdownEmphasis-CppivOEu.js +18 -0
- package/dist/chunks/MarkdownEmphasis-CppivOEu.js.map +1 -0
- package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +16 -0
- package/dist/chunks/MarkdownEmpty-Av5k6bqa.js.map +1 -0
- package/dist/chunks/MarkdownError-C0sPs5W0.js +19 -0
- package/dist/chunks/MarkdownError-C0sPs5W0.js.map +1 -0
- package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +24 -0
- package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js.map +1 -0
- package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +23 -0
- package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js.map +1 -0
- package/dist/chunks/MarkdownHeading-DaNcP0_6.js +31 -0
- package/dist/chunks/MarkdownHeading-DaNcP0_6.js.map +1 -0
- package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +18 -0
- package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js.map +1 -0
- package/dist/chunks/MarkdownHtml-66lYkvwM.js +15 -0
- package/dist/chunks/MarkdownHtml-66lYkvwM.js.map +1 -0
- package/dist/chunks/MarkdownImage-BRy76svs.js +53 -0
- package/dist/chunks/MarkdownImage-BRy76svs.js.map +1 -0
- package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +18 -0
- package/dist/chunks/MarkdownInlineCode-MXZYFwex.js.map +1 -0
- package/dist/chunks/MarkdownLink-Dbx3NwgV.js +47 -0
- package/dist/chunks/MarkdownLink-Dbx3NwgV.js.map +1 -0
- package/dist/chunks/MarkdownList-BJ-_C71k.js +22 -0
- package/dist/chunks/MarkdownList-BJ-_C71k.js.map +1 -0
- package/dist/chunks/MarkdownListItem-Z1EHIY26.js +18 -0
- package/dist/chunks/MarkdownListItem-Z1EHIY26.js.map +1 -0
- package/dist/chunks/MarkdownLoading-D-RYtXxf.js +17 -0
- package/dist/chunks/MarkdownLoading-D-RYtXxf.js.map +1 -0
- package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +18 -0
- package/dist/chunks/MarkdownParagraph-BxLSmSaG.js.map +1 -0
- package/dist/chunks/MarkdownRenderer-DLRRfsdI.js +416 -0
- package/dist/chunks/MarkdownRenderer-DLRRfsdI.js.map +1 -0
- package/dist/chunks/MarkdownRoot-DEE6iVfh.js +25 -0
- package/dist/chunks/MarkdownRoot-DEE6iVfh.js.map +1 -0
- package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +18 -0
- package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js.map +1 -0
- package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +18 -0
- package/dist/chunks/MarkdownStrong-uU5MzAoJ.js.map +1 -0
- package/dist/chunks/MarkdownTable-DmBTg_CR.js +18 -0
- package/dist/chunks/MarkdownTable-DmBTg_CR.js.map +1 -0
- package/dist/chunks/MarkdownTableCell-eiCJe847.js +33 -0
- package/dist/chunks/MarkdownTableCell-eiCJe847.js.map +1 -0
- package/dist/chunks/MarkdownTableRow-DuJaPntg.js +18 -0
- package/dist/chunks/MarkdownTableRow-DuJaPntg.js.map +1 -0
- package/dist/chunks/MarkdownTableSection-PFHz-R33.js +26 -0
- package/dist/chunks/MarkdownTableSection-PFHz-R33.js.map +1 -0
- package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +40 -0
- package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js.map +1 -0
- package/dist/chunks/MarkdownToc-BdOHF-Yo.js +51 -0
- package/dist/chunks/MarkdownToc-BdOHF-Yo.js.map +1 -0
- package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +27 -0
- package/dist/chunks/MarkdownTocItem-DT9mR3vL.js.map +1 -0
- package/dist/chunks/MermaidLiveEditor-W-qf3G-5.js +416 -0
- package/dist/chunks/MermaidLiveEditor-W-qf3G-5.js.map +1 -0
- package/dist/chunks/VueSyntaxHighlighter-DyLsYMwy.js +262 -0
- package/dist/chunks/VueSyntaxHighlighter-DyLsYMwy.js.map +1 -0
- package/dist/chunks/adapters-CMwX_NEI.js +28 -0
- package/dist/chunks/adapters-CMwX_NEI.js.map +1 -0
- package/dist/chunks/asyncToGenerator-ChigusFD.js +26 -0
- package/dist/chunks/blank-line-Cb-JBP_5.js +90 -0
- package/dist/chunks/blank-line-Cb-JBP_5.js.map +1 -0
- package/dist/chunks/codemirror-DyphMAEg.js +84 -0
- package/dist/chunks/codemirror-DyphMAEg.js.map +1 -0
- package/dist/chunks/config-aRYo2R8_.js +12 -0
- package/dist/chunks/config-aRYo2R8_.js.map +1 -0
- package/dist/chunks/context-8NfW6fxI.js +32 -0
- package/dist/chunks/context-8NfW6fxI.js.map +1 -0
- package/dist/chunks/default-DWVS-I_8.js +23 -0
- package/dist/chunks/default-DWVS-I_8.js.map +1 -0
- package/dist/chunks/diagnostics-CtHoJyiX.js +25 -0
- package/dist/chunks/diagnostics-CtHoJyiX.js.map +1 -0
- package/dist/chunks/export-DZQ3cUry.js +1575 -0
- package/dist/chunks/export-DZQ3cUry.js.map +1 -0
- package/dist/chunks/hast-nodes-C0bX3M5Z.js +35 -0
- package/dist/chunks/hast-nodes-C0bX3M5Z.js.map +1 -0
- package/dist/chunks/highlightjs-BEh-YwEG.js +6041 -0
- package/dist/chunks/highlightjs-BEh-YwEG.js.map +1 -0
- package/dist/chunks/identity-jZEhX2d5.js +6244 -0
- package/dist/chunks/identity-jZEhX2d5.js.map +1 -0
- package/dist/chunks/labels-BtHiUTQI.js +49 -0
- package/dist/chunks/labels-BtHiUTQI.js.map +1 -0
- package/dist/chunks/lib-BQiWGWpu.js +5087 -0
- package/dist/chunks/lib-BQiWGWpu.js.map +1 -0
- package/dist/chunks/lib-LwqA_W3J.js +127 -0
- package/dist/chunks/lib-LwqA_W3J.js.map +1 -0
- package/dist/chunks/longest-streak-DZE_EqsU.js +10 -0
- package/dist/chunks/longest-streak-DZE_EqsU.js.map +1 -0
- package/dist/chunks/micromark-factory-space-Db040TnW.js +139 -0
- package/dist/chunks/micromark-factory-space-Db040TnW.js.map +1 -0
- package/dist/chunks/normalize-CRYv3Wqt.js +220 -0
- package/dist/chunks/normalize-CRYv3Wqt.js.map +1 -0
- package/dist/chunks/objectSpread2-CtBNx0TF.js +57 -0
- package/dist/chunks/plugin-DqkFHyny.js +28 -0
- package/dist/chunks/plugin-DqkFHyny.js.map +1 -0
- package/dist/chunks/preset-BjaOuJUL.js +46 -0
- package/dist/chunks/preset-BjaOuJUL.js.map +1 -0
- package/dist/chunks/registry-DLjr93-V.js +6144 -0
- package/dist/chunks/registry-DLjr93-V.js.map +1 -0
- package/dist/chunks/render-Cs8iKrgz.js +1724 -0
- package/dist/chunks/render-Cs8iKrgz.js.map +1 -0
- package/dist/chunks/runtime-DJMnzjah.js +546 -0
- package/dist/chunks/runtime-DJMnzjah.js.map +1 -0
- package/dist/chunks/security-y4EwUyAs.js +214 -0
- package/dist/chunks/security-y4EwUyAs.js.map +1 -0
- package/dist/chunks/shared-DNAvZ-UY.js +76 -0
- package/dist/chunks/shared-DNAvZ-UY.js.map +1 -0
- package/dist/chunks/space-separated-tokens-CmBjEPdR.js +1099 -0
- package/dist/chunks/space-separated-tokens-CmBjEPdR.js.map +1 -0
- package/dist/chunks/url-D2BoivaE.js +26 -0
- package/dist/chunks/url-D2BoivaE.js.map +1 -0
- package/dist/chunks/useActiveHeading-BaGVMJnB.js +316 -0
- package/dist/chunks/useActiveHeading-BaGVMJnB.js.map +1 -0
- package/dist/components/CodeBlock.d.ts +73 -0
- package/dist/components/CodeBlock.js +1 -0
- package/dist/components/Icon.d.ts +6 -0
- package/dist/components/MarkdownBlockquote.d.ts +18 -0
- package/dist/components/MarkdownBlockquote.js +1 -0
- package/dist/components/MarkdownBreak.d.ts +8 -0
- package/dist/components/MarkdownBreak.js +1 -0
- package/dist/components/MarkdownChildren.d.ts +17 -0
- package/dist/components/MarkdownCode.d.ts +29 -0
- package/dist/components/MarkdownCode.js +1 -0
- package/dist/components/MarkdownConfigProvider.d.ts +33 -0
- package/dist/components/MarkdownConfigProvider.js +1 -0
- package/dist/components/MarkdownContent.d.ts +16 -0
- package/dist/components/MarkdownContent.js +1 -0
- package/dist/components/MarkdownCustomTag.d.ts +20 -0
- package/dist/components/MarkdownCustomTag.js +1 -0
- package/dist/components/MarkdownEmphasis.d.ts +18 -0
- package/dist/components/MarkdownEmphasis.js +1 -0
- package/dist/components/MarkdownEmpty.d.ts +8 -0
- package/dist/components/MarkdownEmpty.js +1 -0
- package/dist/components/MarkdownError.d.ts +11 -0
- package/dist/components/MarkdownError.js +1 -0
- package/dist/components/MarkdownFootnoteReference.d.ts +19 -0
- package/dist/components/MarkdownFootnoteReference.js +1 -0
- package/dist/components/MarkdownFootnotes.d.ts +17 -0
- package/dist/components/MarkdownFootnotes.js +1 -0
- package/dist/components/MarkdownHeading.d.ts +18 -0
- package/dist/components/MarkdownHeading.js +1 -0
- package/dist/components/MarkdownHorizontalRule.d.ts +8 -0
- package/dist/components/MarkdownHorizontalRule.js +1 -0
- package/dist/components/MarkdownHtml.d.ts +8 -0
- package/dist/components/MarkdownHtml.js +1 -0
- package/dist/components/MarkdownImage.d.ts +15 -0
- package/dist/components/MarkdownImage.js +1 -0
- package/dist/components/MarkdownInlineCode.d.ts +18 -0
- package/dist/components/MarkdownInlineCode.js +1 -0
- package/dist/components/MarkdownLink.d.ts +22 -0
- package/dist/components/MarkdownLink.js +1 -0
- package/dist/components/MarkdownList.d.ts +18 -0
- package/dist/components/MarkdownList.js +1 -0
- package/dist/components/MarkdownListItem.d.ts +18 -0
- package/dist/components/MarkdownListItem.js +1 -0
- package/dist/components/MarkdownLoading.d.ts +8 -0
- package/dist/components/MarkdownLoading.js +1 -0
- package/dist/components/MarkdownMath.d.ts +12 -0
- package/dist/components/MarkdownMath.js +1 -0
- package/dist/components/MarkdownMermaid.d.ts +78 -0
- package/dist/components/MarkdownMermaid.js +1 -0
- package/dist/components/MarkdownParagraph.d.ts +18 -0
- package/dist/components/MarkdownParagraph.js +1 -0
- package/dist/components/MarkdownRenderer.d.ts +170 -0
- package/dist/components/MarkdownRenderer.js +1 -0
- package/dist/components/MarkdownRoot.d.ts +24 -0
- package/dist/components/MarkdownRoot.js +1 -0
- package/dist/components/MarkdownStrikethrough.d.ts +18 -0
- package/dist/components/MarkdownStrikethrough.js +1 -0
- package/dist/components/MarkdownStrong.d.ts +18 -0
- package/dist/components/MarkdownStrong.js +1 -0
- package/dist/components/MarkdownTable.d.ts +18 -0
- package/dist/components/MarkdownTable.js +1 -0
- package/dist/components/MarkdownTableCell.d.ts +20 -0
- package/dist/components/MarkdownTableCell.js +1 -0
- package/dist/components/MarkdownTableRow.d.ts +18 -0
- package/dist/components/MarkdownTableRow.js +1 -0
- package/dist/components/MarkdownTableSection.d.ts +18 -0
- package/dist/components/MarkdownTableSection.js +1 -0
- package/dist/components/MarkdownTaskItem.d.ts +20 -0
- package/dist/components/MarkdownTaskItem.js +1 -0
- package/dist/components/MarkdownToc.d.ts +36 -0
- package/dist/components/MarkdownToc.js +1 -0
- package/dist/components/MarkdownTocItem.d.ts +14 -0
- package/dist/components/MarkdownTocItem.js +1 -0
- package/dist/components/MermaidBlock.d.ts +50 -0
- package/dist/components/MermaidBlock.js +1 -0
- package/dist/components/MermaidLiveEditor.d.ts +44 -0
- package/dist/components/MermaidLiveEditor.js +1 -0
- package/dist/components/VueSyntaxHighlighter.d.ts +39 -0
- package/dist/components/VueSyntaxHighlighter.js +1 -0
- package/dist/components/codeRegion.d.ts +14 -0
- package/dist/components/config.d.ts +7 -0
- package/dist/components/context.d.ts +45 -0
- package/dist/components/index.d.ts +42 -0
- package/dist/components/index.js +38 -0
- package/dist/components/render.d.ts +9 -0
- package/dist/components/scroll-lock.d.ts +7 -0
- package/dist/components/types.d.ts +29 -0
- package/dist/composables/useActiveHeading.d.ts +12 -0
- package/dist/composables/useCodeHighlighter.d.ts +30 -0
- package/dist/composables/useLineWindow.d.ts +38 -0
- package/dist/composables/useMarkdownDocument.d.ts +23 -0
- package/dist/core/adapters.d.ts +7 -0
- package/dist/core/config.d.ts +5 -0
- package/dist/core/diagnostics.d.ts +9 -0
- package/dist/core/finalize.d.ts +18 -0
- package/dist/core/hast-nodes.d.ts +6 -0
- package/dist/core/highlight-lines.d.ts +8 -0
- package/dist/core/identity.d.ts +4 -0
- package/dist/core/labels.d.ts +4 -0
- package/dist/core/manifest.d.ts +38 -0
- package/dist/core/memo.d.ts +5 -0
- package/dist/core/model-hast.d.ts +8 -0
- package/dist/core/model.d.ts +10 -0
- package/dist/core/normalize.d.ts +27 -0
- package/dist/core/parts.d.ts +135 -0
- package/dist/core/preset.d.ts +10 -0
- package/dist/core/run.d.ts +16 -0
- package/dist/core/search.d.ts +5 -0
- package/dist/core/security.d.ts +21 -0
- package/dist/core/slugger.d.ts +6 -0
- package/dist/core/types.d.ts +390 -0
- package/dist/core/url.d.ts +10 -0
- package/dist/editor/codemirror.d.ts +14 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/index.js +1 -0
- package/dist/export/index.d.ts +6 -0
- package/dist/headless.d.ts +21 -0
- package/dist/headless.js +12 -0
- package/dist/highlight/highlightjs.d.ts +7 -0
- package/dist/highlight/index.d.ts +3 -0
- package/dist/highlight/index.js +3 -0
- package/dist/highlight/shared.d.ts +16 -0
- package/dist/highlight/shiki.d.ts +7 -0
- package/dist/highlight/shiki.js +76 -0
- package/dist/highlight/shiki.js.map +1 -0
- package/dist/html/index.d.ts +17 -0
- package/dist/html/index.js +13 -0
- package/dist/html/index.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/math/index.d.ts +4 -0
- package/dist/math/index.js +583 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/katex.d.ts +4 -0
- package/dist/math/plugin.d.ts +20 -0
- package/dist/mermaid/index.d.ts +5 -0
- package/dist/mermaid/index.js +3 -0
- package/dist/mermaid/plugin.d.ts +14 -0
- package/dist/mermaid/runtime.d.ts +12 -0
- package/dist/mermaid/sanitize.d.ts +12 -0
- package/dist/node-components.d.ts +1 -0
- package/dist/node-components.js +39 -0
- package/dist/pipeline/custom.d.ts +8 -0
- package/dist/pipeline/identity.d.ts +12 -0
- package/dist/pipeline/index.d.ts +5 -0
- package/dist/pipeline/official.d.ts +6 -0
- package/dist/pipeline.d.ts +1 -0
- package/dist/pipeline.js +1 -0
- package/dist/plugins/builtin.d.ts +15 -0
- package/dist/plugins/define.d.ts +7 -0
- package/dist/plugins/registry.d.ts +16 -0
- package/dist/plugins/source.d.ts +7 -0
- package/dist/plugins.d.ts +3 -0
- package/dist/plugins.js +1 -0
- package/dist/presets.d.ts +3 -0
- package/dist/presets.js +1 -0
- package/dist/style.css +2 -0
- package/dist/styles/components.css +712 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/math-full.css +3 -0
- package/dist/styles/math.css +18 -0
- package/dist/styles/tokens.css +96 -0
- package/package.json +211 -6
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import { n as e } from "./labels-BtHiUTQI.js";
|
|
2
|
+
import { t } from "./diagnostics-CtHoJyiX.js";
|
|
3
|
+
import { t as n } from "./asyncToGenerator-ChigusFD.js";
|
|
4
|
+
import { n as r, r as i } from "./context-8NfW6fxI.js";
|
|
5
|
+
import { r as a } from "./render-Cs8iKrgz.js";
|
|
6
|
+
import { t as o } from "./codemirror-DyphMAEg.js";
|
|
7
|
+
import { computed as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, h as f, nextTick as p, normalizeStyle as ee, onMounted as te, onUnmounted as ne, openBlock as re, ref as m, shallowRef as ie, unref as h, useSlots as ae, watch as g } from "vue";
|
|
8
|
+
// src/components/scroll-lock.ts
|
|
9
|
+
var _ = 0, v;
|
|
10
|
+
function oe() {
|
|
11
|
+
typeof document < "u" && (_ === 0 && (v = document.body.style.overflow, document.body.style.overflow = "hidden"), _ += 1);
|
|
12
|
+
}
|
|
13
|
+
function se() {
|
|
14
|
+
if (typeof document < "u" && _ !== 0 && (--_, _ === 0)) {
|
|
15
|
+
var e;
|
|
16
|
+
document.body.style.overflow = (e = v) == null ? "" : e, v = void 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// src/components/MermaidLiveEditor.vue?vue&type=script&setup=true&lang.ts
|
|
20
|
+
var ce = [
|
|
21
|
+
"data-vmd-theme",
|
|
22
|
+
"data-fullscreen",
|
|
23
|
+
"data-compact",
|
|
24
|
+
"aria-label"
|
|
25
|
+
], le = ["data-vmd-part"], ue = {
|
|
26
|
+
"data-vmd-part": "editor-toolbar",
|
|
27
|
+
class: "vmd-editor-toolbar"
|
|
28
|
+
}, de = { class: "vmd-editor-body" }, fe = [
|
|
29
|
+
"aria-label",
|
|
30
|
+
"aria-valuenow",
|
|
31
|
+
"aria-valuemin",
|
|
32
|
+
"aria-valuemax"
|
|
33
|
+
], pe = ["aria-label"], me = ["data-compact", "aria-label"], he = /* @__PURE__ */ d({
|
|
34
|
+
__name: "MermaidLiveEditor",
|
|
35
|
+
props: {
|
|
36
|
+
modelValue: { default: "" },
|
|
37
|
+
debounce: { default: 300 },
|
|
38
|
+
theme: { default: void 0 },
|
|
39
|
+
renderer: { default: void 0 },
|
|
40
|
+
diagnosticsFormatter: { default: void 0 },
|
|
41
|
+
compact: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
},
|
|
45
|
+
rawDetails: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
autoFocus: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: !1
|
|
52
|
+
},
|
|
53
|
+
initialRatio: { default: .5 },
|
|
54
|
+
minRatio: { default: .2 }
|
|
55
|
+
},
|
|
56
|
+
emits: [
|
|
57
|
+
"update:modelValue",
|
|
58
|
+
"preview",
|
|
59
|
+
"error"
|
|
60
|
+
],
|
|
61
|
+
setup(_, { expose: v, emit: he }) {
|
|
62
|
+
let y = _, b = he;
|
|
63
|
+
function x(e) {
|
|
64
|
+
return typeof e == "string" ? e : "";
|
|
65
|
+
}
|
|
66
|
+
let S = x(y.modelValue), C = i(), w = ae(), T = s(() => {
|
|
67
|
+
var e, t;
|
|
68
|
+
return (e = (t = y.theme) == null ? C.theme : t) == null ? "light" : e;
|
|
69
|
+
}), E = m(S), D = m(S), O = m(y.initialRatio), k = m(S.trim() ? "pending" : "idle"), A = ie([]), j = m(!1), M = m(), N = m(), P, F, I = ie(null), L = m(), R = s(() => D.value.trim() === ""), ge = s(() => {
|
|
70
|
+
var e;
|
|
71
|
+
return !!(w.fullscreen || (e = C.slots) != null && e.fullscreen);
|
|
72
|
+
});
|
|
73
|
+
function z(e, t, n) {
|
|
74
|
+
return C.renderHostSlot(e, t, () => {
|
|
75
|
+
let i = w[e];
|
|
76
|
+
if (!i) return n();
|
|
77
|
+
let a = i(t);
|
|
78
|
+
return r(a) ? n() : a;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
let B = !1, V = !1, H = !0;
|
|
82
|
+
function _e() {
|
|
83
|
+
B || (B = !0, oe());
|
|
84
|
+
}
|
|
85
|
+
function U() {
|
|
86
|
+
B && (B = !1, se());
|
|
87
|
+
}
|
|
88
|
+
function W(e) {
|
|
89
|
+
if (H) {
|
|
90
|
+
if (e && _e(), j.value = e, e) {
|
|
91
|
+
var t, n;
|
|
92
|
+
(t = M.value) == null || (n = t.focus) == null || n.call(t), typeof document < "u" && document.addEventListener("keydown", q);
|
|
93
|
+
} else typeof document < "u" && document.removeEventListener("keydown", q), U();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function G() {
|
|
97
|
+
return K.apply(this, arguments);
|
|
98
|
+
}
|
|
99
|
+
function K() {
|
|
100
|
+
return K = n(function* () {
|
|
101
|
+
let e = M.value;
|
|
102
|
+
if (typeof document < "u") {
|
|
103
|
+
if (j.value) {
|
|
104
|
+
try {
|
|
105
|
+
e && document.fullscreenElement === e && (yield document.exitFullscreen());
|
|
106
|
+
} catch (e) {}
|
|
107
|
+
if (!H) return;
|
|
108
|
+
V = !1, W(!1);
|
|
109
|
+
} else {
|
|
110
|
+
V = !1;
|
|
111
|
+
try {
|
|
112
|
+
var t;
|
|
113
|
+
if (yield e == null || (t = e.requestFullscreen) == null ? void 0 : t.call(e), !H) return;
|
|
114
|
+
V = !!e && document.fullscreenElement === e;
|
|
115
|
+
} catch (e) {}
|
|
116
|
+
if (!H) return;
|
|
117
|
+
W(!0);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}), K.apply(this, arguments);
|
|
121
|
+
}
|
|
122
|
+
function q(e) {
|
|
123
|
+
var t, n;
|
|
124
|
+
if (!j.value) return;
|
|
125
|
+
if (e.key === "Escape") {
|
|
126
|
+
W(!1);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (e.key !== "Tab") return;
|
|
130
|
+
let r = Array.from((t = (n = M.value) == null ? void 0 : n.querySelectorAll("button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])")) == null ? [] : t).filter((e) => !e.closest("[aria-hidden=\"true\"]"));
|
|
131
|
+
if (r.length === 0) {
|
|
132
|
+
var i;
|
|
133
|
+
e.preventDefault(), (i = M.value) == null || i.focus();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
let a = r[0], o = r[r.length - 1];
|
|
137
|
+
a && o && (e.shiftKey ? (document.activeElement === a || document.activeElement === M.value) && (e.preventDefault(), o.focus()) : document.activeElement === o && (e.preventDefault(), a.focus()));
|
|
138
|
+
}
|
|
139
|
+
function ve() {
|
|
140
|
+
if (!H) return;
|
|
141
|
+
let e = M.value;
|
|
142
|
+
e && document.fullscreenElement === e ? V = !0 : V && (V = !1, W(!1));
|
|
143
|
+
}
|
|
144
|
+
function ye(n) {
|
|
145
|
+
var r;
|
|
146
|
+
let i = (r = y.diagnosticsFormatter) == null ? C.diagnosticsFormatter : r;
|
|
147
|
+
if (i) try {
|
|
148
|
+
return i.format(n, E.value);
|
|
149
|
+
} catch (e) {}
|
|
150
|
+
let a = /line\s+(\d+)/i.exec(n), o = a != null && a[1] ? Number(a[1]) : void 0;
|
|
151
|
+
return t("mermaid-error", o ? e(C.labels.editorSyntaxError, { line: o }) : e(C.labels.editorParseError), {
|
|
152
|
+
phase: "render",
|
|
153
|
+
details: n,
|
|
154
|
+
source: o ? {
|
|
155
|
+
start: {
|
|
156
|
+
line: o,
|
|
157
|
+
column: 1
|
|
158
|
+
},
|
|
159
|
+
end: {
|
|
160
|
+
line: o,
|
|
161
|
+
column: 1
|
|
162
|
+
}
|
|
163
|
+
} : void 0
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function be(e) {
|
|
167
|
+
var t;
|
|
168
|
+
k.value = "error";
|
|
169
|
+
let n = ye(e);
|
|
170
|
+
L.value = e, A.value = [n], b("error", n), y.autoFocus && (t = n.source) != null && (t = t.start) != null && t.line && p(() => {
|
|
171
|
+
var e;
|
|
172
|
+
return X((e = n.source) == null ? void 0 : e.start.line);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function xe(e) {
|
|
176
|
+
I.value = e, L.value = void 0, k.value = "ready", A.value = [];
|
|
177
|
+
}
|
|
178
|
+
function J(e) {
|
|
179
|
+
let t = x(e);
|
|
180
|
+
E.value = t, b("update:modelValue", t);
|
|
181
|
+
}
|
|
182
|
+
function Y(e) {
|
|
183
|
+
F && clearTimeout(F), F = setTimeout(() => {
|
|
184
|
+
D.value = e, b("preview", e);
|
|
185
|
+
}, Math.max(0, y.debounce));
|
|
186
|
+
}
|
|
187
|
+
g(() => y.modelValue, (e) => {
|
|
188
|
+
let t = x(e);
|
|
189
|
+
t !== E.value && (E.value = t, P == null || P.setValue(t), Y(t));
|
|
190
|
+
}), g(E, (e) => {
|
|
191
|
+
Y(e);
|
|
192
|
+
}), g(D, (e) => {
|
|
193
|
+
e.trim() ? (k.value = "pending", L.value = void 0, A.value = []) : (I.value = null, L.value = void 0, A.value = [], k.value = "idle");
|
|
194
|
+
});
|
|
195
|
+
function X(e) {
|
|
196
|
+
e && (P == null || P.focusLine(e));
|
|
197
|
+
}
|
|
198
|
+
function Se(e) {
|
|
199
|
+
e.key === "ArrowLeft" ? (O.value = Math.max(y.minRatio, O.value - .05), e.preventDefault()) : e.key === "ArrowRight" ? (O.value = Math.min(1 - y.minRatio, O.value + .05), e.preventDefault()) : e.key === "Home" && (O.value = y.initialRatio, e.preventDefault());
|
|
200
|
+
}
|
|
201
|
+
let Z;
|
|
202
|
+
function Ce(e) {
|
|
203
|
+
var t;
|
|
204
|
+
if (typeof document > "u") return;
|
|
205
|
+
let n = (t = M.value) == null ? void 0 : t.getBoundingClientRect();
|
|
206
|
+
if (!n) return;
|
|
207
|
+
let r = (e) => {
|
|
208
|
+
let t = (e.clientX - n.left) / n.width;
|
|
209
|
+
O.value = Math.min(1 - y.minRatio, Math.max(y.minRatio, t));
|
|
210
|
+
}, i = () => {
|
|
211
|
+
document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), Z = void 0;
|
|
212
|
+
};
|
|
213
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), Z = i, e.preventDefault();
|
|
214
|
+
}
|
|
215
|
+
te(n(function* () {
|
|
216
|
+
if (typeof document < "u" && document.addEventListener("fullscreenchange", ve), yield p(), N.value) try {
|
|
217
|
+
P = yield o(N.value, {
|
|
218
|
+
value: E.value,
|
|
219
|
+
theme: T.value,
|
|
220
|
+
onChange: J
|
|
221
|
+
});
|
|
222
|
+
} catch (e) {
|
|
223
|
+
P = void 0;
|
|
224
|
+
}
|
|
225
|
+
})), ne(() => {
|
|
226
|
+
H = !1, F && clearTimeout(F), Z == null || Z(), P == null || P.destroy(), typeof document < "u" && (document.removeEventListener("keydown", q), document.removeEventListener("fullscreenchange", ve)), U();
|
|
227
|
+
});
|
|
228
|
+
function we() {
|
|
229
|
+
P == null || P.focus();
|
|
230
|
+
}
|
|
231
|
+
function Q() {
|
|
232
|
+
F && clearTimeout(F), D.value = E.value, b("preview", E.value);
|
|
233
|
+
}
|
|
234
|
+
v({
|
|
235
|
+
focus: we,
|
|
236
|
+
refreshPreview: Q,
|
|
237
|
+
toggleFullscreen: G,
|
|
238
|
+
getDiagnostics: () => A.value
|
|
239
|
+
});
|
|
240
|
+
let $ = d({ setup() {
|
|
241
|
+
return () => {
|
|
242
|
+
let t = e(j.value ? C.labels.exitFullscreen : C.labels.fullscreen);
|
|
243
|
+
return z("fullscreen", {
|
|
244
|
+
fullscreen: j.value,
|
|
245
|
+
label: t,
|
|
246
|
+
toggle: G
|
|
247
|
+
}, () => f("button", {
|
|
248
|
+
type: "button",
|
|
249
|
+
"aria-pressed": j.value ? "true" : "false",
|
|
250
|
+
onClick: G
|
|
251
|
+
}, t));
|
|
252
|
+
};
|
|
253
|
+
} }), Te = d({ setup() {
|
|
254
|
+
function t() {
|
|
255
|
+
return [
|
|
256
|
+
f("span", { class: "vmd-editor-title" }, e(C.labels.editor)),
|
|
257
|
+
f($),
|
|
258
|
+
f("button", {
|
|
259
|
+
type: "button",
|
|
260
|
+
onClick: () => {
|
|
261
|
+
O.value = y.initialRatio;
|
|
262
|
+
}
|
|
263
|
+
}, e(C.labels.editorReset))
|
|
264
|
+
];
|
|
265
|
+
}
|
|
266
|
+
return () => {
|
|
267
|
+
var e, n;
|
|
268
|
+
let i = {
|
|
269
|
+
ratio: O.value,
|
|
270
|
+
fullscreen: j.value,
|
|
271
|
+
compact: y.compact,
|
|
272
|
+
actions: {
|
|
273
|
+
toggleFullscreen: G,
|
|
274
|
+
resetRatio: () => {
|
|
275
|
+
O.value = y.initialRatio;
|
|
276
|
+
},
|
|
277
|
+
setRatio: (e) => {
|
|
278
|
+
O.value = Math.min(1 - y.minRatio, Math.max(y.minRatio, e));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}, a = (e = (n = C.slots) == null ? void 0 : n.toolbar) == null ? w.toolbar : e;
|
|
282
|
+
if (!a) return t();
|
|
283
|
+
let o = a(i);
|
|
284
|
+
return r(o) ? t() : ge.value ? [o, f($)] : o;
|
|
285
|
+
};
|
|
286
|
+
} }), Ee = d({ setup() {
|
|
287
|
+
return () => z("editor", {
|
|
288
|
+
value: E.value,
|
|
289
|
+
update: J,
|
|
290
|
+
diagnostics: A.value,
|
|
291
|
+
status: k.value,
|
|
292
|
+
actions: {
|
|
293
|
+
focus: () => P == null ? void 0 : P.focus(),
|
|
294
|
+
reset: () => {
|
|
295
|
+
J(""), P == null || P.setValue("");
|
|
296
|
+
},
|
|
297
|
+
fullscreen: G
|
|
298
|
+
}
|
|
299
|
+
}, () => f("div", {
|
|
300
|
+
ref: N,
|
|
301
|
+
class: "vmd-editor-host",
|
|
302
|
+
"data-vmd-part": "editor-pane"
|
|
303
|
+
}));
|
|
304
|
+
} }), De = d({ setup() {
|
|
305
|
+
function t() {
|
|
306
|
+
return z("empty", {
|
|
307
|
+
source: D.value,
|
|
308
|
+
actions: {
|
|
309
|
+
focus: () => P == null ? void 0 : P.focus(),
|
|
310
|
+
refresh: Q
|
|
311
|
+
}
|
|
312
|
+
}, () => f("p", {
|
|
313
|
+
class: "vmd-editor-empty",
|
|
314
|
+
"data-vmd-part": "editor-empty"
|
|
315
|
+
}, e(C.labels.editorEmpty)));
|
|
316
|
+
}
|
|
317
|
+
return () => {
|
|
318
|
+
var e, n, i, o;
|
|
319
|
+
let s = {
|
|
320
|
+
source: D.value,
|
|
321
|
+
status: k.value,
|
|
322
|
+
error: L.value,
|
|
323
|
+
nodes: (e = (n = I.value) == null ? void 0 : n.nodes) == null ? [] : e,
|
|
324
|
+
actions: {
|
|
325
|
+
refresh: Q,
|
|
326
|
+
fullscreen: G,
|
|
327
|
+
focus: () => P == null ? void 0 : P.focus()
|
|
328
|
+
}
|
|
329
|
+
}, c = (i = (o = C.slots) == null ? void 0 : o.preview) == null ? w.preview : i, l = c ? c(s) : void 0, u = c ? !r(l) : !1;
|
|
330
|
+
return [R.value ? null : f(a, {
|
|
331
|
+
source: D.value,
|
|
332
|
+
renderer: y.renderer,
|
|
333
|
+
theme: T.value,
|
|
334
|
+
showErrors: !0,
|
|
335
|
+
compact: y.compact,
|
|
336
|
+
style: u ? { display: "none" } : void 0,
|
|
337
|
+
"aria-hidden": u ? "true" : void 0,
|
|
338
|
+
onError: be,
|
|
339
|
+
onRendered: xe
|
|
340
|
+
}), u ? l : R.value ? t() : null];
|
|
341
|
+
};
|
|
342
|
+
} }), Oe = d({ setup() {
|
|
343
|
+
return () => z("editor-diagnostics", {
|
|
344
|
+
diagnostics: A.value,
|
|
345
|
+
focusLine: X
|
|
346
|
+
}, () => A.value.length === 0 ? null : f("ul", {
|
|
347
|
+
class: "vmd-editor-diagnostic-list",
|
|
348
|
+
role: "status"
|
|
349
|
+
}, A.value.map((t) => {
|
|
350
|
+
var n;
|
|
351
|
+
let r = (n = t.source) == null || (n = n.start) == null ? void 0 : n.line;
|
|
352
|
+
return f("li", { key: t.message }, [
|
|
353
|
+
f("span", t.message),
|
|
354
|
+
y.rawDetails && t.details ? f("pre", { class: "vmd-editor-diagnostic-details" }, t.details) : null,
|
|
355
|
+
r ? f("button", {
|
|
356
|
+
type: "button",
|
|
357
|
+
onClick: () => X(r)
|
|
358
|
+
}, e(C.labels.editorLine, { line: r })) : null
|
|
359
|
+
]);
|
|
360
|
+
})));
|
|
361
|
+
} });
|
|
362
|
+
return (t, n) => (re(), c("div", {
|
|
363
|
+
ref_key: "root",
|
|
364
|
+
ref: M,
|
|
365
|
+
"data-vmd-part": "editor",
|
|
366
|
+
class: "vmd-editor",
|
|
367
|
+
"data-vmd-theme": T.value,
|
|
368
|
+
"data-fullscreen": j.value ? "true" : void 0,
|
|
369
|
+
"data-compact": _.compact ? "true" : void 0,
|
|
370
|
+
"aria-label": h(e)(h(C).labels.editor),
|
|
371
|
+
role: "group",
|
|
372
|
+
tabindex: "-1"
|
|
373
|
+
}, [l("div", {
|
|
374
|
+
class: "vmd-editor-surface",
|
|
375
|
+
"data-vmd-part": j.value ? "editor-fullscreen" : void 0
|
|
376
|
+
}, [
|
|
377
|
+
l("div", ue, [u(h(Te))]),
|
|
378
|
+
l("div", de, [
|
|
379
|
+
l("div", {
|
|
380
|
+
"data-vmd-part": "editor-pane",
|
|
381
|
+
class: "vmd-editor-pane",
|
|
382
|
+
style: ee({ flexBasis: `${O.value * 100}%` })
|
|
383
|
+
}, [u(h(Ee))], 4),
|
|
384
|
+
l("div", {
|
|
385
|
+
"data-vmd-part": "editor-divider",
|
|
386
|
+
class: "vmd-editor-divider",
|
|
387
|
+
role: "separator",
|
|
388
|
+
"aria-orientation": "vertical",
|
|
389
|
+
tabindex: "0",
|
|
390
|
+
"aria-label": h(e)(h(C).labels.editorSplitter),
|
|
391
|
+
"aria-valuenow": Math.round(O.value * 100),
|
|
392
|
+
"aria-valuemin": Math.round(_.minRatio * 100),
|
|
393
|
+
"aria-valuemax": Math.round((1 - _.minRatio) * 100),
|
|
394
|
+
onMousedown: Ce,
|
|
395
|
+
onKeydown: Se
|
|
396
|
+
}, null, 40, fe),
|
|
397
|
+
l("div", {
|
|
398
|
+
"data-vmd-part": "editor-preview",
|
|
399
|
+
class: "vmd-editor-preview",
|
|
400
|
+
role: "region",
|
|
401
|
+
"aria-label": h(e)(h(C).labels.preview)
|
|
402
|
+
}, [u(h(De))], 8, pe)
|
|
403
|
+
]),
|
|
404
|
+
l("div", {
|
|
405
|
+
"data-vmd-part": "editor-diagnostics",
|
|
406
|
+
class: "vmd-editor-diagnostics",
|
|
407
|
+
"data-compact": _.compact ? "true" : void 0,
|
|
408
|
+
role: "group",
|
|
409
|
+
"aria-label": h(e)(h(C).labels.editorDiagnostics)
|
|
410
|
+
}, [u(h(Oe))], 8, me)
|
|
411
|
+
], 8, le)], 8, ce));
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
export { he as t };
|
|
415
|
+
|
|
416
|
+
//# sourceMappingURL=MermaidLiveEditor-W-qf3G-5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MermaidLiveEditor-W-qf3G-5.js","names":["MermaidBlock","_openBlock","_createElementBlock","_unref","_createElementVNode","_createVNode","_normalizeStyle","_sfc_main","resolveLabel","_asyncToGenerator","isEmptySlotContent","useRenderContext","MermaidBlock_default","createMermaidEditor","lockCount","previousOverflow","lockPageScroll","unlockPageScroll","_previousOverflow","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","MermaidLiveEditor_default","defineComponent","__expose","__emit","props","__props","emit","asSource","value","initialValue","context","ownSlots","useSlots","resolvedTheme","computed","_ref","_props$theme","ref","previewSource","ratio","status","diagnostics","shallowRef","fullscreen","root","editorHost","handle","previewTimer","previewResult","previewError","isEmptyPreview","hasFullscreenSlot","_context$slots","renderSlot","name","slotProps","slot","fallback","output","scrollLocked","nativeFullscreen","active","lockScroll","unlockScroll","setFullscreen","next","_root$value","_root$value$focus","onKeydown","toggleFullscreen","_toggleFullscreen","element","_unused2","_element$requestFulls","_unused","_root$value$querySele","_root$value2","event","focusables","_root$value3","first","last","onFullscreenChange","diagnosticFromError","_props$diagnosticsFor","formatter","message","_unused3","match","line","createDiagnostic","onError","_diagnostic$source","diagnostic","nextTick","_diagnostic$source2","focusLine","onRendered","result","updateValue","source","schedulePreview","watch","onDividerKeydown","dragCleanup","startDrag","_root$value4","rect","move","moveEvent","up","onMounted","error","onUnmounted","focus","refreshPreview","FullscreenSlot","label","h","ToolbarSlot","defaultToolbar","_context$slots$toolba","_context$slots2","EditorSlot","PreviewSlot","emptyPreview","_previewResult$value$","_previewResult$value","_context$slots$previe","_context$slots3","hasSlotOutput","DiagnosticsContent","_diagnostic$source3","openBlock","createElementBlock","unref","createElementVNode","createVNode","normalizeStyle"],"sources":["../../src/components/scroll-lock.ts","../../src/components/MermaidLiveEditor.vue","../../src/components/MermaidLiveEditor.vue"],"sourcesContent":["let lockCount = 0\nlet previousOverflow: string | undefined\n\n/**\n * Lock page scrolling for every fullscreen surface on the page. The original\n * overflow is restored only when the last surface releases the lock.\n */\nexport function lockPageScroll(): void {\n if (typeof document === 'undefined') return\n if (lockCount === 0) {\n previousOverflow = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n }\n lockCount += 1\n}\n\n/** Release one page-scroll lock. Safe to call when the caller owns no lock. */\nexport function unlockPageScroll(): void {\n if (typeof document === 'undefined' || lockCount === 0) return\n lockCount -= 1\n if (lockCount === 0) {\n document.body.style.overflow = previousOverflow ?? ''\n previousOverflow = undefined\n }\n}\n","<script setup lang=\"ts\">\r\nimport {\r\n computed,\r\n defineComponent,\r\n h,\r\n nextTick,\r\n onMounted,\r\n onUnmounted,\r\n ref,\r\n shallowRef,\r\n useSlots,\r\n watch,\r\n type VNodeChild,\r\n} from 'vue'\r\nimport type {\r\n DiagnosticFormatter,\r\n MarkdownDiagnostic,\r\n MarkdownTheme,\r\n MermaidRenderResult,\r\n MermaidRenderer,\r\n} from '../core/types'\r\nimport { createDiagnostic } from '../core/diagnostics'\r\nimport { resolveLabel } from '../core/labels'\r\nimport { isEmptySlotContent, useRenderContext } from './context'\r\nimport { lockPageScroll, unlockPageScroll } from './scroll-lock'\r\nimport MermaidBlock from './MermaidBlock.vue'\r\nimport { createMermaidEditor, type MermaidEditorHandle } from '../editor/codemirror'\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n modelValue?: string\r\n debounce?: number\r\n theme?: 'light' | 'dark' | 'auto' | 'custom'\r\n renderer?: MermaidRenderer\r\n diagnosticsFormatter?: DiagnosticFormatter\r\n compact?: boolean\r\n rawDetails?: boolean\r\n autoFocus?: boolean\r\n initialRatio?: number\r\n minRatio?: number\r\n }>(),\r\n {\r\n modelValue: '',\r\n debounce: 300,\r\n theme: undefined,\r\n renderer: undefined,\r\n diagnosticsFormatter: undefined,\r\n compact: false,\r\n rawDetails: false,\r\n autoFocus: false,\r\n initialRatio: 0.5,\r\n minRatio: 0.2,\r\n },\r\n)\r\n\r\nconst emit = defineEmits<{\r\n 'update:modelValue': [value: string]\r\n preview: [value: string]\r\n error: [diagnostic: MarkdownDiagnostic]\r\n}>()\r\n\r\nfunction asSource(value: unknown): string {\r\n return typeof value === 'string' ? value : ''\r\n}\r\n\r\nconst initialValue = asSource(props.modelValue)\r\n\r\nconst context = useRenderContext()\r\nconst ownSlots = useSlots()\r\nconst resolvedTheme = computed<MarkdownTheme>(\r\n () => props.theme ?? context.theme ?? 'light',\r\n)\r\nconst value = ref(initialValue)\r\nconst previewSource = ref(initialValue)\r\nconst ratio = ref(props.initialRatio)\r\nconst status = ref<'idle' | 'pending' | 'ready' | 'error'>(\r\n initialValue.trim() ? 'pending' : 'idle',\r\n)\r\nconst diagnostics = shallowRef<MarkdownDiagnostic[]>([])\r\nconst fullscreen = ref(false)\r\nconst root = ref<HTMLElement>()\r\nconst editorHost = ref<HTMLElement>()\r\nlet handle: MermaidEditorHandle | undefined\r\nlet previewTimer: ReturnType<typeof setTimeout> | undefined\r\n\r\nconst previewResult = shallowRef<MermaidRenderResult | null>(null)\r\nconst previewError = ref<string | undefined>()\r\nconst isEmptyPreview = computed(() => previewSource.value.trim() === '')\r\nconst hasFullscreenSlot = computed(() =>\r\n Boolean(ownSlots.fullscreen || context.slots?.fullscreen),\r\n)\r\n\r\nfunction renderSlot(\r\n name: string,\r\n slotProps: Record<string, unknown>,\r\n fallback: () => VNodeChild,\r\n): VNodeChild {\r\n return context.renderHostSlot(name, slotProps, () => {\r\n const slot = ownSlots[name]\r\n if (!slot) return fallback()\r\n const output = slot(slotProps)\r\n return isEmptySlotContent(output) ? fallback() : output\r\n })\r\n}\r\n\r\nlet scrollLocked = false\r\nlet nativeFullscreen = false\r\nlet active = true\r\n\r\nfunction lockScroll(): void {\r\n if (scrollLocked) return\r\n scrollLocked = true\r\n lockPageScroll()\r\n}\r\n\r\nfunction unlockScroll(): void {\r\n if (!scrollLocked) return\r\n scrollLocked = false\r\n unlockPageScroll()\r\n}\r\n\r\nfunction setFullscreen(next: boolean): void {\r\n if (!active) return\r\n if (next) lockScroll()\r\n fullscreen.value = next\r\n if (next) {\r\n root.value?.focus?.()\r\n if (typeof document !== 'undefined') {\r\n document.addEventListener('keydown', onKeydown)\r\n }\r\n } else {\r\n if (typeof document !== 'undefined') {\r\n document.removeEventListener('keydown', onKeydown)\r\n }\r\n unlockScroll()\r\n }\r\n}\r\n\r\nasync function toggleFullscreen(): Promise<void> {\r\n const element = root.value\r\n if (typeof document === 'undefined') return\r\n if (!fullscreen.value) {\r\n nativeFullscreen = false\r\n try {\r\n await element?.requestFullscreen?.()\r\n if (!active) return\r\n nativeFullscreen = Boolean(element) && document.fullscreenElement === element\r\n } catch {\r\n // CSS fallback.\r\n }\r\n if (!active) return\r\n setFullscreen(true)\r\n } else {\r\n try {\r\n if (element && document.fullscreenElement === element) {\r\n await document.exitFullscreen()\r\n }\r\n } catch {\r\n // Ignore.\r\n }\r\n if (!active) return\r\n nativeFullscreen = false\r\n setFullscreen(false)\r\n }\r\n}\r\n\r\nfunction onKeydown(event: KeyboardEvent): void {\r\n if (!fullscreen.value) return\r\n if (event.key === 'Escape') {\r\n setFullscreen(false)\r\n return\r\n }\r\n if (event.key !== 'Tab') return\r\n\r\n const focusables = Array.from(\r\n root.value?.querySelectorAll<HTMLElement>(\r\n 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])',\r\n ) ?? [],\r\n ).filter((element) => !element.closest('[aria-hidden=\"true\"]'))\r\n if (focusables.length === 0) {\r\n event.preventDefault()\r\n root.value?.focus()\r\n return\r\n }\r\n const first = focusables[0]\r\n const last = focusables[focusables.length - 1]\r\n if (!first || !last) return\r\n if (event.shiftKey) {\r\n if (document.activeElement === first || document.activeElement === root.value) {\r\n event.preventDefault()\r\n last.focus()\r\n }\r\n } else if (document.activeElement === last) {\r\n event.preventDefault()\r\n first.focus()\r\n }\r\n}\r\n\r\nfunction onFullscreenChange(): void {\r\n if (!active) return\r\n const element = root.value\r\n if (element && document.fullscreenElement === element) {\r\n nativeFullscreen = true\r\n return\r\n }\r\n if (!nativeFullscreen) return\r\n nativeFullscreen = false\r\n setFullscreen(false)\r\n}\r\n\r\nfunction diagnosticFromError(message: string): MarkdownDiagnostic {\r\n const formatter = props.diagnosticsFormatter ?? context.diagnosticsFormatter\r\n if (formatter) {\r\n try {\r\n return formatter.format(message, value.value)\r\n } catch {\r\n // Fall through to the default formatter.\r\n }\r\n }\r\n const match = /line\\s+(\\d+)/i.exec(message)\r\n const line = match?.[1] ? Number(match[1]) : undefined\r\n return createDiagnostic(\r\n 'mermaid-error',\r\n line\r\n ? resolveLabel(context.labels.editorSyntaxError, { line })\r\n : resolveLabel(context.labels.editorParseError),\r\n {\r\n phase: 'render',\r\n details: message,\r\n source: line\r\n ? {\r\n start: { line, column: 1 },\r\n end: { line, column: 1 },\r\n }\r\n : undefined,\r\n },\r\n )\r\n}\r\n\r\nfunction onError(message: string): void {\r\n status.value = 'error'\r\n const diagnostic = diagnosticFromError(message)\r\n previewError.value = message\r\n diagnostics.value = [diagnostic]\r\n emit('error', diagnostic)\r\n if (props.autoFocus && diagnostic.source?.start?.line) {\r\n void nextTick(() => focusLine(diagnostic.source?.start.line))\r\n }\r\n}\r\n\r\nfunction onRendered(result: MermaidRenderResult): void {\r\n previewResult.value = result\r\n previewError.value = undefined\r\n status.value = 'ready'\r\n diagnostics.value = []\r\n}\r\n\r\nfunction updateValue(next: string): void {\r\n const source = asSource(next)\r\n value.value = source\r\n emit('update:modelValue', source)\r\n}\r\n\r\nfunction schedulePreview(next: string): void {\r\n if (previewTimer) clearTimeout(previewTimer)\r\n previewTimer = setTimeout(() => {\r\n previewSource.value = next\r\n emit('preview', next)\r\n }, Math.max(0, props.debounce))\r\n}\r\n\r\nwatch(\r\n () => props.modelValue,\r\n (next) => {\r\n const source = asSource(next)\r\n if (source === value.value) return\r\n value.value = source\r\n handle?.setValue(source)\r\n schedulePreview(source)\r\n },\r\n)\r\n\r\nwatch(value, (next) => {\r\n schedulePreview(next)\r\n})\r\n\r\nwatch(previewSource, (next) => {\r\n if (next.trim()) {\r\n status.value = 'pending'\r\n previewError.value = undefined\r\n diagnostics.value = []\r\n return\r\n }\r\n previewResult.value = null\r\n previewError.value = undefined\r\n diagnostics.value = []\r\n status.value = 'idle'\r\n})\r\n\r\nfunction focusLine(line?: number): void {\r\n if (line) handle?.focusLine(line)\r\n}\r\n\r\nfunction onDividerKeydown(event: KeyboardEvent): void {\r\n if (event.key === 'ArrowLeft') {\r\n ratio.value = Math.max(props.minRatio, ratio.value - 0.05)\r\n event.preventDefault()\r\n } else if (event.key === 'ArrowRight') {\r\n ratio.value = Math.min(1 - props.minRatio, ratio.value + 0.05)\r\n event.preventDefault()\r\n } else if (event.key === 'Home') {\r\n ratio.value = props.initialRatio\r\n event.preventDefault()\r\n }\r\n}\r\n\r\nlet dragCleanup: (() => void) | undefined\r\nfunction startDrag(event: MouseEvent): void {\r\n if (typeof document === 'undefined') return\r\n const rect = root.value?.getBoundingClientRect()\r\n if (!rect) return\r\n const move = (moveEvent: MouseEvent): void => {\r\n const next = (moveEvent.clientX - rect.left) / rect.width\r\n ratio.value = Math.min(1 - props.minRatio, Math.max(props.minRatio, next))\r\n }\r\n const up = (): void => {\r\n document.removeEventListener('mousemove', move)\r\n document.removeEventListener('mouseup', up)\r\n dragCleanup = undefined\r\n }\r\n document.addEventListener('mousemove', move)\r\n document.addEventListener('mouseup', up)\r\n dragCleanup = up\r\n event.preventDefault()\r\n}\r\n\r\nonMounted(async () => {\r\n if (typeof document !== 'undefined') {\r\n document.addEventListener('fullscreenchange', onFullscreenChange)\r\n }\r\n await nextTick()\r\n if (!editorHost.value) return\r\n try {\r\n handle = await createMermaidEditor(editorHost.value, {\r\n value: value.value,\r\n theme: resolvedTheme.value,\r\n onChange: updateValue,\r\n })\r\n } catch (error) {\r\n if (import.meta.env.DEV) console.error('Mermaid editor failed', error)\r\n handle = undefined\r\n }\r\n})\r\n\r\nonUnmounted(() => {\r\n active = false\r\n if (previewTimer) clearTimeout(previewTimer)\r\n dragCleanup?.()\r\n handle?.destroy()\r\n if (typeof document !== 'undefined') {\r\n document.removeEventListener('keydown', onKeydown)\r\n document.removeEventListener('fullscreenchange', onFullscreenChange)\r\n }\r\n unlockScroll()\r\n})\r\n\r\nfunction focus(): void {\r\n handle?.focus()\r\n}\r\n\r\n/** Apply the current editor value to the preview without waiting for debounce. */\r\nfunction refreshPreview(): void {\r\n if (previewTimer) clearTimeout(previewTimer)\r\n previewSource.value = value.value\r\n emit('preview', value.value)\r\n}\r\n\r\ndefineExpose({\r\n focus,\r\n refreshPreview,\r\n toggleFullscreen,\r\n getDiagnostics: (): MarkdownDiagnostic[] => diagnostics.value,\r\n})\r\n\r\nconst FullscreenSlot = defineComponent({\r\n setup() {\r\n return () => {\r\n const label = resolveLabel(\r\n fullscreen.value\r\n ? context.labels.exitFullscreen\r\n : context.labels.fullscreen,\r\n )\r\n return renderSlot(\r\n 'fullscreen',\r\n {\r\n fullscreen: fullscreen.value,\r\n label,\r\n toggle: toggleFullscreen,\r\n },\r\n () =>\r\n h(\r\n 'button',\r\n {\r\n type: 'button',\r\n 'aria-pressed': fullscreen.value ? 'true' : 'false',\r\n onClick: toggleFullscreen,\r\n },\r\n label,\r\n ),\r\n )\r\n }\r\n },\r\n})\r\n\r\nconst ToolbarSlot = defineComponent({\r\n setup() {\r\n function defaultToolbar(): VNodeChild[] {\r\n return [\r\n h(\r\n 'span',\r\n { class: 'vmd-editor-title' },\r\n resolveLabel(context.labels.editor),\r\n ),\r\n h(FullscreenSlot),\r\n h(\r\n 'button',\r\n {\r\n type: 'button',\r\n onClick: () => {\r\n ratio.value = props.initialRatio\r\n },\r\n },\r\n resolveLabel(context.labels.editorReset),\r\n ),\r\n ]\r\n }\r\n\r\n return () => {\r\n const slotProps = {\r\n ratio: ratio.value,\r\n fullscreen: fullscreen.value,\r\n compact: props.compact,\r\n actions: {\r\n toggleFullscreen,\r\n resetRatio: () => {\r\n ratio.value = props.initialRatio\r\n },\r\n setRatio: (next: number) => {\r\n ratio.value = Math.min(\r\n 1 - props.minRatio,\r\n Math.max(props.minRatio, next),\r\n )\r\n },\r\n },\r\n }\r\n const slot = context.slots?.toolbar ?? ownSlots.toolbar\r\n if (!slot) return defaultToolbar()\r\n const output = slot(slotProps)\r\n if (isEmptySlotContent(output)) return defaultToolbar()\r\n return hasFullscreenSlot.value ? [output, h(FullscreenSlot)] : output\r\n }\r\n },\r\n})\r\n\r\nconst EditorSlot = defineComponent({\r\n setup() {\r\n return () =>\r\n renderSlot(\r\n 'editor',\r\n {\r\n value: value.value,\r\n update: updateValue,\r\n diagnostics: diagnostics.value,\r\n status: status.value,\r\n actions: {\r\n focus: () => handle?.focus(),\r\n reset: () => {\r\n updateValue('')\r\n handle?.setValue('')\r\n },\r\n fullscreen: toggleFullscreen,\r\n },\r\n },\r\n () =>\r\n h('div', {\r\n ref: editorHost,\r\n class: 'vmd-editor-host',\r\n 'data-vmd-part': 'editor-pane',\r\n }),\r\n )\r\n },\r\n})\r\n\r\nconst PreviewSlot = defineComponent({\r\n setup() {\r\n function emptyPreview(): VNodeChild {\r\n return renderSlot(\r\n 'empty',\r\n {\r\n source: previewSource.value,\r\n actions: {\r\n focus: () => handle?.focus(),\r\n refresh: refreshPreview,\r\n },\r\n },\r\n () =>\r\n h(\r\n 'p',\r\n {\r\n class: 'vmd-editor-empty',\r\n 'data-vmd-part': 'editor-empty',\r\n },\r\n resolveLabel(context.labels.editorEmpty),\r\n ),\r\n )\r\n }\r\n\r\n return () => {\r\n const slotProps = {\r\n source: previewSource.value,\r\n status: status.value,\r\n error: previewError.value,\r\n nodes: previewResult.value?.nodes ?? [],\r\n actions: {\r\n refresh: refreshPreview,\r\n fullscreen: toggleFullscreen,\r\n focus: () => handle?.focus(),\r\n },\r\n }\r\n const slot = context.slots?.preview ?? ownSlots.preview\r\n const output = slot ? slot(slotProps) : undefined\r\n const hasSlotOutput = slot ? !isEmptySlotContent(output) : false\r\n const renderer = isEmptyPreview.value\r\n ? null\r\n : h(MermaidBlock, {\r\n source: previewSource.value,\r\n renderer: props.renderer,\r\n theme: resolvedTheme.value,\r\n showErrors: true,\r\n compact: props.compact,\r\n style: hasSlotOutput ? { display: 'none' } : undefined,\r\n 'aria-hidden': hasSlotOutput ? 'true' : undefined,\r\n onError,\r\n onRendered,\r\n })\r\n const content = hasSlotOutput\r\n ? output\r\n : isEmptyPreview.value\r\n ? emptyPreview()\r\n : null\r\n return [renderer, content]\r\n }\r\n },\r\n})\r\n\r\nconst DiagnosticsContent = defineComponent({\r\n setup() {\r\n return () =>\r\n renderSlot(\r\n 'editor-diagnostics',\r\n {\r\n diagnostics: diagnostics.value,\r\n focusLine,\r\n },\r\n () => {\r\n if (diagnostics.value.length === 0) return null\r\n return h(\r\n 'ul',\r\n { class: 'vmd-editor-diagnostic-list', role: 'status' },\r\n diagnostics.value.map((diagnostic) => {\r\n const line = diagnostic.source?.start?.line\r\n return h('li', { key: diagnostic.message }, [\r\n h('span', diagnostic.message),\r\n props.rawDetails && diagnostic.details\r\n ? h(\r\n 'pre',\r\n { class: 'vmd-editor-diagnostic-details' },\r\n diagnostic.details,\r\n )\r\n : null,\r\n line\r\n ? h(\r\n 'button',\r\n {\r\n type: 'button',\r\n onClick: () => focusLine(line),\r\n },\r\n resolveLabel(context.labels.editorLine, { line }),\r\n )\r\n : null,\r\n ])\r\n }),\r\n )\r\n },\r\n )\r\n },\r\n})\r\n\r\n</script>\r\n\r\n<template>\r\n <div\r\n ref=\"root\"\r\n data-vmd-part=\"editor\"\r\n class=\"vmd-editor\"\r\n :data-vmd-theme=\"resolvedTheme\"\r\n :data-fullscreen=\"fullscreen ? 'true' : undefined\"\r\n :data-compact=\"compact ? 'true' : undefined\"\r\n :aria-label=\"resolveLabel(context.labels.editor)\"\r\n role=\"group\"\r\n tabindex=\"-1\"\r\n >\r\n <div\r\n class=\"vmd-editor-surface\"\r\n :data-vmd-part=\"fullscreen ? 'editor-fullscreen' : undefined\"\r\n >\r\n <div data-vmd-part=\"editor-toolbar\" class=\"vmd-editor-toolbar\">\r\n <ToolbarSlot />\r\n </div>\r\n\r\n <div class=\"vmd-editor-body\">\r\n <div\r\n data-vmd-part=\"editor-pane\"\r\n class=\"vmd-editor-pane\"\r\n :style=\"{ flexBasis: `${ratio * 100}%` }\"\r\n >\r\n <EditorSlot />\r\n </div>\r\n <div\r\n data-vmd-part=\"editor-divider\"\r\n class=\"vmd-editor-divider\"\r\n role=\"separator\"\r\n aria-orientation=\"vertical\"\r\n tabindex=\"0\"\r\n :aria-label=\"resolveLabel(context.labels.editorSplitter)\"\r\n :aria-valuenow=\"Math.round(ratio * 100)\"\r\n :aria-valuemin=\"Math.round(minRatio * 100)\"\r\n :aria-valuemax=\"Math.round((1 - minRatio) * 100)\"\r\n @mousedown=\"startDrag\"\r\n @keydown=\"onDividerKeydown\"\r\n />\r\n <div\r\n data-vmd-part=\"editor-preview\"\r\n class=\"vmd-editor-preview\"\r\n role=\"region\"\r\n :aria-label=\"resolveLabel(context.labels.preview)\"\r\n >\r\n <PreviewSlot />\r\n </div>\r\n </div>\r\n\r\n <div\r\n data-vmd-part=\"editor-diagnostics\"\r\n class=\"vmd-editor-diagnostics\"\r\n :data-compact=\"compact ? 'true' : undefined\"\r\n role=\"group\"\r\n :aria-label=\"resolveLabel(context.labels.editorDiagnostics)\"\r\n >\r\n <DiagnosticsContent />\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n","<script setup lang=\"ts\">\r\nimport {\r\n computed,\r\n defineComponent,\r\n h,\r\n nextTick,\r\n onMounted,\r\n onUnmounted,\r\n ref,\r\n shallowRef,\r\n useSlots,\r\n watch,\r\n type VNodeChild,\r\n} from 'vue'\r\nimport type {\r\n DiagnosticFormatter,\r\n MarkdownDiagnostic,\r\n MarkdownTheme,\r\n MermaidRenderResult,\r\n MermaidRenderer,\r\n} from '../core/types'\r\nimport { createDiagnostic } from '../core/diagnostics'\r\nimport { resolveLabel } from '../core/labels'\r\nimport { isEmptySlotContent, useRenderContext } from './context'\r\nimport { lockPageScroll, unlockPageScroll } from './scroll-lock'\r\nimport MermaidBlock from './MermaidBlock.vue'\r\nimport { createMermaidEditor, type MermaidEditorHandle } from '../editor/codemirror'\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n modelValue?: string\r\n debounce?: number\r\n theme?: 'light' | 'dark' | 'auto' | 'custom'\r\n renderer?: MermaidRenderer\r\n diagnosticsFormatter?: DiagnosticFormatter\r\n compact?: boolean\r\n rawDetails?: boolean\r\n autoFocus?: boolean\r\n initialRatio?: number\r\n minRatio?: number\r\n }>(),\r\n {\r\n modelValue: '',\r\n debounce: 300,\r\n theme: undefined,\r\n renderer: undefined,\r\n diagnosticsFormatter: undefined,\r\n compact: false,\r\n rawDetails: false,\r\n autoFocus: false,\r\n initialRatio: 0.5,\r\n minRatio: 0.2,\r\n },\r\n)\r\n\r\nconst emit = defineEmits<{\r\n 'update:modelValue': [value: string]\r\n preview: [value: string]\r\n error: [diagnostic: MarkdownDiagnostic]\r\n}>()\r\n\r\nfunction asSource(value: unknown): string {\r\n return typeof value === 'string' ? value : ''\r\n}\r\n\r\nconst initialValue = asSource(props.modelValue)\r\n\r\nconst context = useRenderContext()\r\nconst ownSlots = useSlots()\r\nconst resolvedTheme = computed<MarkdownTheme>(\r\n () => props.theme ?? context.theme ?? 'light',\r\n)\r\nconst value = ref(initialValue)\r\nconst previewSource = ref(initialValue)\r\nconst ratio = ref(props.initialRatio)\r\nconst status = ref<'idle' | 'pending' | 'ready' | 'error'>(\r\n initialValue.trim() ? 'pending' : 'idle',\r\n)\r\nconst diagnostics = shallowRef<MarkdownDiagnostic[]>([])\r\nconst fullscreen = ref(false)\r\nconst root = ref<HTMLElement>()\r\nconst editorHost = ref<HTMLElement>()\r\nlet handle: MermaidEditorHandle | undefined\r\nlet previewTimer: ReturnType<typeof setTimeout> | undefined\r\n\r\nconst previewResult = shallowRef<MermaidRenderResult | null>(null)\r\nconst previewError = ref<string | undefined>()\r\nconst isEmptyPreview = computed(() => previewSource.value.trim() === '')\r\nconst hasFullscreenSlot = computed(() =>\r\n Boolean(ownSlots.fullscreen || context.slots?.fullscreen),\r\n)\r\n\r\nfunction renderSlot(\r\n name: string,\r\n slotProps: Record<string, unknown>,\r\n fallback: () => VNodeChild,\r\n): VNodeChild {\r\n return context.renderHostSlot(name, slotProps, () => {\r\n const slot = ownSlots[name]\r\n if (!slot) return fallback()\r\n const output = slot(slotProps)\r\n return isEmptySlotContent(output) ? fallback() : output\r\n })\r\n}\r\n\r\nlet scrollLocked = false\r\nlet nativeFullscreen = false\r\nlet active = true\r\n\r\nfunction lockScroll(): void {\r\n if (scrollLocked) return\r\n scrollLocked = true\r\n lockPageScroll()\r\n}\r\n\r\nfunction unlockScroll(): void {\r\n if (!scrollLocked) return\r\n scrollLocked = false\r\n unlockPageScroll()\r\n}\r\n\r\nfunction setFullscreen(next: boolean): void {\r\n if (!active) return\r\n if (next) lockScroll()\r\n fullscreen.value = next\r\n if (next) {\r\n root.value?.focus?.()\r\n if (typeof document !== 'undefined') {\r\n document.addEventListener('keydown', onKeydown)\r\n }\r\n } else {\r\n if (typeof document !== 'undefined') {\r\n document.removeEventListener('keydown', onKeydown)\r\n }\r\n unlockScroll()\r\n }\r\n}\r\n\r\nasync function toggleFullscreen(): Promise<void> {\r\n const element = root.value\r\n if (typeof document === 'undefined') return\r\n if (!fullscreen.value) {\r\n nativeFullscreen = false\r\n try {\r\n await element?.requestFullscreen?.()\r\n if (!active) return\r\n nativeFullscreen = Boolean(element) && document.fullscreenElement === element\r\n } catch {\r\n // CSS fallback.\r\n }\r\n if (!active) return\r\n setFullscreen(true)\r\n } else {\r\n try {\r\n if (element && document.fullscreenElement === element) {\r\n await document.exitFullscreen()\r\n }\r\n } catch {\r\n // Ignore.\r\n }\r\n if (!active) return\r\n nativeFullscreen = false\r\n setFullscreen(false)\r\n }\r\n}\r\n\r\nfunction onKeydown(event: KeyboardEvent): void {\r\n if (!fullscreen.value) return\r\n if (event.key === 'Escape') {\r\n setFullscreen(false)\r\n return\r\n }\r\n if (event.key !== 'Tab') return\r\n\r\n const focusables = Array.from(\r\n root.value?.querySelectorAll<HTMLElement>(\r\n 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])',\r\n ) ?? [],\r\n ).filter((element) => !element.closest('[aria-hidden=\"true\"]'))\r\n if (focusables.length === 0) {\r\n event.preventDefault()\r\n root.value?.focus()\r\n return\r\n }\r\n const first = focusables[0]\r\n const last = focusables[focusables.length - 1]\r\n if (!first || !last) return\r\n if (event.shiftKey) {\r\n if (document.activeElement === first || document.activeElement === root.value) {\r\n event.preventDefault()\r\n last.focus()\r\n }\r\n } else if (document.activeElement === last) {\r\n event.preventDefault()\r\n first.focus()\r\n }\r\n}\r\n\r\nfunction onFullscreenChange(): void {\r\n if (!active) return\r\n const element = root.value\r\n if (element && document.fullscreenElement === element) {\r\n nativeFullscreen = true\r\n return\r\n }\r\n if (!nativeFullscreen) return\r\n nativeFullscreen = false\r\n setFullscreen(false)\r\n}\r\n\r\nfunction diagnosticFromError(message: string): MarkdownDiagnostic {\r\n const formatter = props.diagnosticsFormatter ?? context.diagnosticsFormatter\r\n if (formatter) {\r\n try {\r\n return formatter.format(message, value.value)\r\n } catch {\r\n // Fall through to the default formatter.\r\n }\r\n }\r\n const match = /line\\s+(\\d+)/i.exec(message)\r\n const line = match?.[1] ? Number(match[1]) : undefined\r\n return createDiagnostic(\r\n 'mermaid-error',\r\n line\r\n ? resolveLabel(context.labels.editorSyntaxError, { line })\r\n : resolveLabel(context.labels.editorParseError),\r\n {\r\n phase: 'render',\r\n details: message,\r\n source: line\r\n ? {\r\n start: { line, column: 1 },\r\n end: { line, column: 1 },\r\n }\r\n : undefined,\r\n },\r\n )\r\n}\r\n\r\nfunction onError(message: string): void {\r\n status.value = 'error'\r\n const diagnostic = diagnosticFromError(message)\r\n previewError.value = message\r\n diagnostics.value = [diagnostic]\r\n emit('error', diagnostic)\r\n if (props.autoFocus && diagnostic.source?.start?.line) {\r\n void nextTick(() => focusLine(diagnostic.source?.start.line))\r\n }\r\n}\r\n\r\nfunction onRendered(result: MermaidRenderResult): void {\r\n previewResult.value = result\r\n previewError.value = undefined\r\n status.value = 'ready'\r\n diagnostics.value = []\r\n}\r\n\r\nfunction updateValue(next: string): void {\r\n const source = asSource(next)\r\n value.value = source\r\n emit('update:modelValue', source)\r\n}\r\n\r\nfunction schedulePreview(next: string): void {\r\n if (previewTimer) clearTimeout(previewTimer)\r\n previewTimer = setTimeout(() => {\r\n previewSource.value = next\r\n emit('preview', next)\r\n }, Math.max(0, props.debounce))\r\n}\r\n\r\nwatch(\r\n () => props.modelValue,\r\n (next) => {\r\n const source = asSource(next)\r\n if (source === value.value) return\r\n value.value = source\r\n handle?.setValue(source)\r\n schedulePreview(source)\r\n },\r\n)\r\n\r\nwatch(value, (next) => {\r\n schedulePreview(next)\r\n})\r\n\r\nwatch(previewSource, (next) => {\r\n if (next.trim()) {\r\n status.value = 'pending'\r\n previewError.value = undefined\r\n diagnostics.value = []\r\n return\r\n }\r\n previewResult.value = null\r\n previewError.value = undefined\r\n diagnostics.value = []\r\n status.value = 'idle'\r\n})\r\n\r\nfunction focusLine(line?: number): void {\r\n if (line) handle?.focusLine(line)\r\n}\r\n\r\nfunction onDividerKeydown(event: KeyboardEvent): void {\r\n if (event.key === 'ArrowLeft') {\r\n ratio.value = Math.max(props.minRatio, ratio.value - 0.05)\r\n event.preventDefault()\r\n } else if (event.key === 'ArrowRight') {\r\n ratio.value = Math.min(1 - props.minRatio, ratio.value + 0.05)\r\n event.preventDefault()\r\n } else if (event.key === 'Home') {\r\n ratio.value = props.initialRatio\r\n event.preventDefault()\r\n }\r\n}\r\n\r\nlet dragCleanup: (() => void) | undefined\r\nfunction startDrag(event: MouseEvent): void {\r\n if (typeof document === 'undefined') return\r\n const rect = root.value?.getBoundingClientRect()\r\n if (!rect) return\r\n const move = (moveEvent: MouseEvent): void => {\r\n const next = (moveEvent.clientX - rect.left) / rect.width\r\n ratio.value = Math.min(1 - props.minRatio, Math.max(props.minRatio, next))\r\n }\r\n const up = (): void => {\r\n document.removeEventListener('mousemove', move)\r\n document.removeEventListener('mouseup', up)\r\n dragCleanup = undefined\r\n }\r\n document.addEventListener('mousemove', move)\r\n document.addEventListener('mouseup', up)\r\n dragCleanup = up\r\n event.preventDefault()\r\n}\r\n\r\nonMounted(async () => {\r\n if (typeof document !== 'undefined') {\r\n document.addEventListener('fullscreenchange', onFullscreenChange)\r\n }\r\n await nextTick()\r\n if (!editorHost.value) return\r\n try {\r\n handle = await createMermaidEditor(editorHost.value, {\r\n value: value.value,\r\n theme: resolvedTheme.value,\r\n onChange: updateValue,\r\n })\r\n } catch (error) {\r\n if (import.meta.env.DEV) console.error('Mermaid editor failed', error)\r\n handle = undefined\r\n }\r\n})\r\n\r\nonUnmounted(() => {\r\n active = false\r\n if (previewTimer) clearTimeout(previewTimer)\r\n dragCleanup?.()\r\n handle?.destroy()\r\n if (typeof document !== 'undefined') {\r\n document.removeEventListener('keydown', onKeydown)\r\n document.removeEventListener('fullscreenchange', onFullscreenChange)\r\n }\r\n unlockScroll()\r\n})\r\n\r\nfunction focus(): void {\r\n handle?.focus()\r\n}\r\n\r\n/** Apply the current editor value to the preview without waiting for debounce. */\r\nfunction refreshPreview(): void {\r\n if (previewTimer) clearTimeout(previewTimer)\r\n previewSource.value = value.value\r\n emit('preview', value.value)\r\n}\r\n\r\ndefineExpose({\r\n focus,\r\n refreshPreview,\r\n toggleFullscreen,\r\n getDiagnostics: (): MarkdownDiagnostic[] => diagnostics.value,\r\n})\r\n\r\nconst FullscreenSlot = defineComponent({\r\n setup() {\r\n return () => {\r\n const label = resolveLabel(\r\n fullscreen.value\r\n ? context.labels.exitFullscreen\r\n : context.labels.fullscreen,\r\n )\r\n return renderSlot(\r\n 'fullscreen',\r\n {\r\n fullscreen: fullscreen.value,\r\n label,\r\n toggle: toggleFullscreen,\r\n },\r\n () =>\r\n h(\r\n 'button',\r\n {\r\n type: 'button',\r\n 'aria-pressed': fullscreen.value ? 'true' : 'false',\r\n onClick: toggleFullscreen,\r\n },\r\n label,\r\n ),\r\n )\r\n }\r\n },\r\n})\r\n\r\nconst ToolbarSlot = defineComponent({\r\n setup() {\r\n function defaultToolbar(): VNodeChild[] {\r\n return [\r\n h(\r\n 'span',\r\n { class: 'vmd-editor-title' },\r\n resolveLabel(context.labels.editor),\r\n ),\r\n h(FullscreenSlot),\r\n h(\r\n 'button',\r\n {\r\n type: 'button',\r\n onClick: () => {\r\n ratio.value = props.initialRatio\r\n },\r\n },\r\n resolveLabel(context.labels.editorReset),\r\n ),\r\n ]\r\n }\r\n\r\n return () => {\r\n const slotProps = {\r\n ratio: ratio.value,\r\n fullscreen: fullscreen.value,\r\n compact: props.compact,\r\n actions: {\r\n toggleFullscreen,\r\n resetRatio: () => {\r\n ratio.value = props.initialRatio\r\n },\r\n setRatio: (next: number) => {\r\n ratio.value = Math.min(\r\n 1 - props.minRatio,\r\n Math.max(props.minRatio, next),\r\n )\r\n },\r\n },\r\n }\r\n const slot = context.slots?.toolbar ?? ownSlots.toolbar\r\n if (!slot) return defaultToolbar()\r\n const output = slot(slotProps)\r\n if (isEmptySlotContent(output)) return defaultToolbar()\r\n return hasFullscreenSlot.value ? [output, h(FullscreenSlot)] : output\r\n }\r\n },\r\n})\r\n\r\nconst EditorSlot = defineComponent({\r\n setup() {\r\n return () =>\r\n renderSlot(\r\n 'editor',\r\n {\r\n value: value.value,\r\n update: updateValue,\r\n diagnostics: diagnostics.value,\r\n status: status.value,\r\n actions: {\r\n focus: () => handle?.focus(),\r\n reset: () => {\r\n updateValue('')\r\n handle?.setValue('')\r\n },\r\n fullscreen: toggleFullscreen,\r\n },\r\n },\r\n () =>\r\n h('div', {\r\n ref: editorHost,\r\n class: 'vmd-editor-host',\r\n 'data-vmd-part': 'editor-pane',\r\n }),\r\n )\r\n },\r\n})\r\n\r\nconst PreviewSlot = defineComponent({\r\n setup() {\r\n function emptyPreview(): VNodeChild {\r\n return renderSlot(\r\n 'empty',\r\n {\r\n source: previewSource.value,\r\n actions: {\r\n focus: () => handle?.focus(),\r\n refresh: refreshPreview,\r\n },\r\n },\r\n () =>\r\n h(\r\n 'p',\r\n {\r\n class: 'vmd-editor-empty',\r\n 'data-vmd-part': 'editor-empty',\r\n },\r\n resolveLabel(context.labels.editorEmpty),\r\n ),\r\n )\r\n }\r\n\r\n return () => {\r\n const slotProps = {\r\n source: previewSource.value,\r\n status: status.value,\r\n error: previewError.value,\r\n nodes: previewResult.value?.nodes ?? [],\r\n actions: {\r\n refresh: refreshPreview,\r\n fullscreen: toggleFullscreen,\r\n focus: () => handle?.focus(),\r\n },\r\n }\r\n const slot = context.slots?.preview ?? ownSlots.preview\r\n const output = slot ? slot(slotProps) : undefined\r\n const hasSlotOutput = slot ? !isEmptySlotContent(output) : false\r\n const renderer = isEmptyPreview.value\r\n ? null\r\n : h(MermaidBlock, {\r\n source: previewSource.value,\r\n renderer: props.renderer,\r\n theme: resolvedTheme.value,\r\n showErrors: true,\r\n compact: props.compact,\r\n style: hasSlotOutput ? { display: 'none' } : undefined,\r\n 'aria-hidden': hasSlotOutput ? 'true' : undefined,\r\n onError,\r\n onRendered,\r\n })\r\n const content = hasSlotOutput\r\n ? output\r\n : isEmptyPreview.value\r\n ? emptyPreview()\r\n : null\r\n return [renderer, content]\r\n }\r\n },\r\n})\r\n\r\nconst DiagnosticsContent = defineComponent({\r\n setup() {\r\n return () =>\r\n renderSlot(\r\n 'editor-diagnostics',\r\n {\r\n diagnostics: diagnostics.value,\r\n focusLine,\r\n },\r\n () => {\r\n if (diagnostics.value.length === 0) return null\r\n return h(\r\n 'ul',\r\n { class: 'vmd-editor-diagnostic-list', role: 'status' },\r\n diagnostics.value.map((diagnostic) => {\r\n const line = diagnostic.source?.start?.line\r\n return h('li', { key: diagnostic.message }, [\r\n h('span', diagnostic.message),\r\n props.rawDetails && diagnostic.details\r\n ? h(\r\n 'pre',\r\n { class: 'vmd-editor-diagnostic-details' },\r\n diagnostic.details,\r\n )\r\n : null,\r\n line\r\n ? h(\r\n 'button',\r\n {\r\n type: 'button',\r\n onClick: () => focusLine(line),\r\n },\r\n resolveLabel(context.labels.editorLine, { line }),\r\n )\r\n : null,\r\n ])\r\n }),\r\n )\r\n },\r\n )\r\n },\r\n})\r\n\r\n</script>\r\n\r\n<template>\r\n <div\r\n ref=\"root\"\r\n data-vmd-part=\"editor\"\r\n class=\"vmd-editor\"\r\n :data-vmd-theme=\"resolvedTheme\"\r\n :data-fullscreen=\"fullscreen ? 'true' : undefined\"\r\n :data-compact=\"compact ? 'true' : undefined\"\r\n :aria-label=\"resolveLabel(context.labels.editor)\"\r\n role=\"group\"\r\n tabindex=\"-1\"\r\n >\r\n <div\r\n class=\"vmd-editor-surface\"\r\n :data-vmd-part=\"fullscreen ? 'editor-fullscreen' : undefined\"\r\n >\r\n <div data-vmd-part=\"editor-toolbar\" class=\"vmd-editor-toolbar\">\r\n <ToolbarSlot />\r\n </div>\r\n\r\n <div class=\"vmd-editor-body\">\r\n <div\r\n data-vmd-part=\"editor-pane\"\r\n class=\"vmd-editor-pane\"\r\n :style=\"{ flexBasis: `${ratio * 100}%` }\"\r\n >\r\n <EditorSlot />\r\n </div>\r\n <div\r\n data-vmd-part=\"editor-divider\"\r\n class=\"vmd-editor-divider\"\r\n role=\"separator\"\r\n aria-orientation=\"vertical\"\r\n tabindex=\"0\"\r\n :aria-label=\"resolveLabel(context.labels.editorSplitter)\"\r\n :aria-valuenow=\"Math.round(ratio * 100)\"\r\n :aria-valuemin=\"Math.round(minRatio * 100)\"\r\n :aria-valuemax=\"Math.round((1 - minRatio) * 100)\"\r\n @mousedown=\"startDrag\"\r\n @keydown=\"onDividerKeydown\"\r\n />\r\n <div\r\n data-vmd-part=\"editor-preview\"\r\n class=\"vmd-editor-preview\"\r\n role=\"region\"\r\n :aria-label=\"resolveLabel(context.labels.preview)\"\r\n >\r\n <PreviewSlot />\r\n </div>\r\n </div>\r\n\r\n <div\r\n data-vmd-part=\"editor-diagnostics\"\r\n class=\"vmd-editor-diagnostics\"\r\n :data-compact=\"compact ? 'true' : undefined\"\r\n role=\"group\"\r\n :aria-label=\"resolveLabel(context.labels.editorDiagnostics)\"\r\n >\r\n <DiagnosticsContent />\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n"],"mappings":";;;;;;;;AAAA,IAAIc,IAAY,GACZC;AAMJ,SAAgBC,KAAuB;CACrC,AAAI,OAAO,WAAa,QACpBF,MAAc,MAChB,IAAmB,SAAS,KAAK,MAAM,UACvC,SAAS,KAAK,MAAM,WAAW,WAEjC,KAAa;AACf;AAGA,SAAgBG,KAAyB;CACvC,IAAI,OAAO,WAAa,OAAeH,MAAc,MACrD,KACIA,MAAc,IAAG;;EAEnB,AADA,SAAS,KAAK,MAAM,YAAA,IAAWC,MAAA,OAAoB,KA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