@coderminer/vue-markdown 0.0.0-stage → 1.0.1

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.
Files changed (232) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/LICENSE +21 -0
  3. package/README.md +584 -3
  4. package/README.zh-CN.md +550 -0
  5. package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +16 -0
  6. package/dist/chunks/MarkdownBreak-BwCi2Itt.js +16 -0
  7. package/dist/chunks/MarkdownCode-B1k9tmW5.js +63 -0
  8. package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +49 -0
  9. package/dist/chunks/MarkdownContent-BAK6dqo7.js +13 -0
  10. package/dist/chunks/MarkdownCustomTag-lZJHsD6f.js +46 -0
  11. package/dist/chunks/MarkdownEmphasis-CppivOEu.js +16 -0
  12. package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +14 -0
  13. package/dist/chunks/MarkdownError-C0sPs5W0.js +17 -0
  14. package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +22 -0
  15. package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +21 -0
  16. package/dist/chunks/MarkdownHeading-DaNcP0_6.js +29 -0
  17. package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +16 -0
  18. package/dist/chunks/MarkdownHtml-66lYkvwM.js +13 -0
  19. package/dist/chunks/MarkdownImage-BRy76svs.js +51 -0
  20. package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +16 -0
  21. package/dist/chunks/MarkdownLink-Dbx3NwgV.js +45 -0
  22. package/dist/chunks/MarkdownList-BJ-_C71k.js +20 -0
  23. package/dist/chunks/MarkdownListItem-Z1EHIY26.js +16 -0
  24. package/dist/chunks/MarkdownLoading-D-RYtXxf.js +15 -0
  25. package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +16 -0
  26. package/dist/chunks/MarkdownRenderer-OlkdsvI3.js +482 -0
  27. package/dist/chunks/MarkdownRoot-DEE6iVfh.js +23 -0
  28. package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +16 -0
  29. package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +16 -0
  30. package/dist/chunks/MarkdownTable-DmBTg_CR.js +16 -0
  31. package/dist/chunks/MarkdownTableCell-eiCJe847.js +31 -0
  32. package/dist/chunks/MarkdownTableRow-DuJaPntg.js +16 -0
  33. package/dist/chunks/MarkdownTableSection-PFHz-R33.js +24 -0
  34. package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +38 -0
  35. package/dist/chunks/MarkdownToc-DHWWoH6t.js +49 -0
  36. package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +25 -0
  37. package/dist/chunks/MermaidLiveEditor-1TKkI5bp.js +414 -0
  38. package/dist/chunks/VueSyntaxHighlighter-BWpCO-cX.js +260 -0
  39. package/dist/chunks/adapters-CMwX_NEI.js +26 -0
  40. package/dist/chunks/asyncToGenerator-ChigusFD.js +26 -0
  41. package/dist/chunks/blank-line-CKKsFeKR.js +88 -0
  42. package/dist/chunks/codemirror-DyphMAEg.js +82 -0
  43. package/dist/chunks/config-aRYo2R8_.js +10 -0
  44. package/dist/chunks/context-8NfW6fxI.js +30 -0
  45. package/dist/chunks/convert-hast-C4Rg2ZuF.js +6 -0
  46. package/dist/chunks/default-ZQ5aHh-N.js +3 -0
  47. package/dist/chunks/diagnostics-CtHoJyiX.js +23 -0
  48. package/dist/chunks/export-BrgMLgUp.js +1574 -0
  49. package/dist/chunks/hast-to-nodes-DuZsi4XT.js +29 -0
  50. package/dist/chunks/hast-util-from-html-D3e_iQ89.js +5088 -0
  51. package/dist/chunks/highlightjs-BxJFpKS1.js +196 -0
  52. package/dist/chunks/identity-Bi27FKyx.js +6243 -0
  53. package/dist/chunks/labels-BtHiUTQI.js +47 -0
  54. package/dist/chunks/lib-CCnkLL6S.js +252 -0
  55. package/dist/chunks/longest-streak-DZE_EqsU.js +8 -0
  56. package/dist/chunks/micromark-factory-space-CpXAnYUY.js +137 -0
  57. package/dist/chunks/normalize-VKfQXZiK.js +226 -0
  58. package/dist/chunks/objectSpread2-CtBNx0TF.js +57 -0
  59. package/dist/chunks/plugin-YWo5uqTh.js +27 -0
  60. package/dist/chunks/preset-BjaOuJUL.js +44 -0
  61. package/dist/chunks/registry-B7BfEkuy.js +6150 -0
  62. package/dist/chunks/render-DAqK0w5J.js +1754 -0
  63. package/dist/chunks/rolldown-runtime-QGRDbDUS.js +19 -0
  64. package/dist/chunks/runtime-D95F41zG.js +574 -0
  65. package/dist/chunks/security-y4EwUyAs.js +212 -0
  66. package/dist/chunks/shared-NjFDPmkb.js +67 -0
  67. package/dist/chunks/space-separated-tokens-1ebNqf35.js +1097 -0
  68. package/dist/chunks/url-D2BoivaE.js +24 -0
  69. package/dist/chunks/useActiveHeading-CnyGTG1u.js +359 -0
  70. package/dist/components/CodeBlock.d.ts +73 -0
  71. package/dist/components/CodeBlock.js +1 -0
  72. package/dist/components/Icon.d.ts +6 -0
  73. package/dist/components/MarkdownBlockquote.d.ts +18 -0
  74. package/dist/components/MarkdownBlockquote.js +1 -0
  75. package/dist/components/MarkdownBreak.d.ts +8 -0
  76. package/dist/components/MarkdownBreak.js +1 -0
  77. package/dist/components/MarkdownChildren.d.ts +17 -0
  78. package/dist/components/MarkdownCode.d.ts +29 -0
  79. package/dist/components/MarkdownCode.js +1 -0
  80. package/dist/components/MarkdownConfigProvider.d.ts +33 -0
  81. package/dist/components/MarkdownConfigProvider.js +1 -0
  82. package/dist/components/MarkdownContent.d.ts +16 -0
  83. package/dist/components/MarkdownContent.js +1 -0
  84. package/dist/components/MarkdownCustomTag.d.ts +20 -0
  85. package/dist/components/MarkdownCustomTag.js +1 -0
  86. package/dist/components/MarkdownEmphasis.d.ts +18 -0
  87. package/dist/components/MarkdownEmphasis.js +1 -0
  88. package/dist/components/MarkdownEmpty.d.ts +8 -0
  89. package/dist/components/MarkdownEmpty.js +1 -0
  90. package/dist/components/MarkdownError.d.ts +11 -0
  91. package/dist/components/MarkdownError.js +1 -0
  92. package/dist/components/MarkdownFootnoteReference.d.ts +19 -0
  93. package/dist/components/MarkdownFootnoteReference.js +1 -0
  94. package/dist/components/MarkdownFootnotes.d.ts +17 -0
  95. package/dist/components/MarkdownFootnotes.js +1 -0
  96. package/dist/components/MarkdownHeading.d.ts +18 -0
  97. package/dist/components/MarkdownHeading.js +1 -0
  98. package/dist/components/MarkdownHorizontalRule.d.ts +8 -0
  99. package/dist/components/MarkdownHorizontalRule.js +1 -0
  100. package/dist/components/MarkdownHtml.d.ts +8 -0
  101. package/dist/components/MarkdownHtml.js +1 -0
  102. package/dist/components/MarkdownImage.d.ts +15 -0
  103. package/dist/components/MarkdownImage.js +1 -0
  104. package/dist/components/MarkdownInlineCode.d.ts +18 -0
  105. package/dist/components/MarkdownInlineCode.js +1 -0
  106. package/dist/components/MarkdownLink.d.ts +22 -0
  107. package/dist/components/MarkdownLink.js +1 -0
  108. package/dist/components/MarkdownList.d.ts +18 -0
  109. package/dist/components/MarkdownList.js +1 -0
  110. package/dist/components/MarkdownListItem.d.ts +18 -0
  111. package/dist/components/MarkdownListItem.js +1 -0
  112. package/dist/components/MarkdownLoading.d.ts +8 -0
  113. package/dist/components/MarkdownLoading.js +1 -0
  114. package/dist/components/MarkdownMath.d.ts +12 -0
  115. package/dist/components/MarkdownMath.js +1 -0
  116. package/dist/components/MarkdownMermaid.d.ts +78 -0
  117. package/dist/components/MarkdownMermaid.js +1 -0
  118. package/dist/components/MarkdownParagraph.d.ts +18 -0
  119. package/dist/components/MarkdownParagraph.js +1 -0
  120. package/dist/components/MarkdownRenderer.d.ts +167 -0
  121. package/dist/components/MarkdownRenderer.js +1 -0
  122. package/dist/components/MarkdownRoot.d.ts +24 -0
  123. package/dist/components/MarkdownRoot.js +1 -0
  124. package/dist/components/MarkdownStrikethrough.d.ts +18 -0
  125. package/dist/components/MarkdownStrikethrough.js +1 -0
  126. package/dist/components/MarkdownStrong.d.ts +18 -0
  127. package/dist/components/MarkdownStrong.js +1 -0
  128. package/dist/components/MarkdownTable.d.ts +18 -0
  129. package/dist/components/MarkdownTable.js +1 -0
  130. package/dist/components/MarkdownTableCell.d.ts +20 -0
  131. package/dist/components/MarkdownTableCell.js +1 -0
  132. package/dist/components/MarkdownTableRow.d.ts +18 -0
  133. package/dist/components/MarkdownTableRow.js +1 -0
  134. package/dist/components/MarkdownTableSection.d.ts +18 -0
  135. package/dist/components/MarkdownTableSection.js +1 -0
  136. package/dist/components/MarkdownTaskItem.d.ts +20 -0
  137. package/dist/components/MarkdownTaskItem.js +1 -0
  138. package/dist/components/MarkdownToc.d.ts +36 -0
  139. package/dist/components/MarkdownToc.js +1 -0
  140. package/dist/components/MarkdownTocItem.d.ts +14 -0
  141. package/dist/components/MarkdownTocItem.js +1 -0
  142. package/dist/components/MermaidBlock.d.ts +50 -0
  143. package/dist/components/MermaidBlock.js +1 -0
  144. package/dist/components/MermaidLiveEditor.d.ts +44 -0
  145. package/dist/components/MermaidLiveEditor.js +1 -0
  146. package/dist/components/VueSyntaxHighlighter.d.ts +39 -0
  147. package/dist/components/VueSyntaxHighlighter.js +1 -0
  148. package/dist/components/codeRegion.d.ts +14 -0
  149. package/dist/components/config.d.ts +7 -0
  150. package/dist/components/context.d.ts +45 -0
  151. package/dist/components/index.d.ts +42 -0
  152. package/dist/components/index.js +38 -0
  153. package/dist/components/render.d.ts +9 -0
  154. package/dist/components/scroll-lock.d.ts +7 -0
  155. package/dist/components/types.d.ts +61 -0
  156. package/dist/composables/useActiveHeading.d.ts +12 -0
  157. package/dist/composables/useCodeHighlighter.d.ts +30 -0
  158. package/dist/composables/useLineWindow.d.ts +38 -0
  159. package/dist/composables/useMarkdownDocument.d.ts +25 -0
  160. package/dist/core/adapters.d.ts +7 -0
  161. package/dist/core/config.d.ts +5 -0
  162. package/dist/core/diagnostics.d.ts +9 -0
  163. package/dist/core/finalize.d.ts +18 -0
  164. package/dist/core/hast-nodes.d.ts +3 -0
  165. package/dist/core/hast-to-nodes.d.ts +9 -0
  166. package/dist/core/highlight-lines.d.ts +8 -0
  167. package/dist/core/identity.d.ts +4 -0
  168. package/dist/core/labels.d.ts +4 -0
  169. package/dist/core/manifest.d.ts +38 -0
  170. package/dist/core/memo.d.ts +5 -0
  171. package/dist/core/model-hast.d.ts +8 -0
  172. package/dist/core/model.d.ts +10 -0
  173. package/dist/core/normalize.d.ts +37 -0
  174. package/dist/core/parts.d.ts +136 -0
  175. package/dist/core/preset.d.ts +10 -0
  176. package/dist/core/run.d.ts +16 -0
  177. package/dist/core/search.d.ts +5 -0
  178. package/dist/core/security.d.ts +21 -0
  179. package/dist/core/slugger.d.ts +13 -0
  180. package/dist/core/types.d.ts +392 -0
  181. package/dist/core/url.d.ts +10 -0
  182. package/dist/editor/codemirror.d.ts +14 -0
  183. package/dist/editor/index.d.ts +2 -0
  184. package/dist/editor/index.js +1 -0
  185. package/dist/export/index.d.ts +6 -0
  186. package/dist/headless.d.ts +21 -0
  187. package/dist/headless.js +12 -0
  188. package/dist/highlight/convert-hast.d.ts +8 -0
  189. package/dist/highlight/highlightjs.d.ts +7 -0
  190. package/dist/highlight/index.d.ts +4 -0
  191. package/dist/highlight/index.js +4 -0
  192. package/dist/highlight/shared.d.ts +11 -0
  193. package/dist/highlight/shiki.d.ts +7 -0
  194. package/dist/highlight/shiki.js +75 -0
  195. package/dist/html/index.d.ts +17 -0
  196. package/dist/html/index.js +11 -0
  197. package/dist/index.d.ts +24 -0
  198. package/dist/index.js +53 -0
  199. package/dist/math/index.d.ts +4 -0
  200. package/dist/math/index.js +585 -0
  201. package/dist/math/katex.d.ts +4 -0
  202. package/dist/math/plugin.d.ts +20 -0
  203. package/dist/mermaid/index.d.ts +6 -0
  204. package/dist/mermaid/index.js +8 -0
  205. package/dist/mermaid/plugin.d.ts +17 -0
  206. package/dist/mermaid/runtime.d.ts +14 -0
  207. package/dist/mermaid/sanitize-svg-lazy.d.ts +10 -0
  208. package/dist/mermaid/sanitize-svg.d.ts +3 -0
  209. package/dist/mermaid/sanitize.d.ts +16 -0
  210. package/dist/node-components.d.ts +1 -0
  211. package/dist/node-components.js +39 -0
  212. package/dist/pipeline/custom.d.ts +8 -0
  213. package/dist/pipeline/identity.d.ts +12 -0
  214. package/dist/pipeline/index.d.ts +5 -0
  215. package/dist/pipeline/official.d.ts +6 -0
  216. package/dist/pipeline.d.ts +1 -0
  217. package/dist/pipeline.js +1 -0
  218. package/dist/plugins/builtin.d.ts +15 -0
  219. package/dist/plugins/define.d.ts +7 -0
  220. package/dist/plugins/registry.d.ts +16 -0
  221. package/dist/plugins/source.d.ts +7 -0
  222. package/dist/plugins.d.ts +3 -0
  223. package/dist/plugins.js +1 -0
  224. package/dist/presets.d.ts +3 -0
  225. package/dist/presets.js +1 -0
  226. package/dist/style.css +2 -0
  227. package/dist/styles/components.css +737 -0
  228. package/dist/styles/index.d.ts +1 -0
  229. package/dist/styles/math-full.css +3 -0
  230. package/dist/styles/math.css +18 -0
  231. package/dist/styles/tokens.css +96 -0
  232. package/package.json +214 -6
@@ -0,0 +1,49 @@
1
+ import { r as e } from "./normalize-VKfQXZiK.js";
2
+ import { t } from "./MarkdownTocItem-DT9mR3vL.js";
3
+ import { Fragment as n, computed as r, createBlock as i, createElementBlock as a, createElementVNode as o, defineComponent as s, openBlock as c, renderList as l, renderSlot as u, resolveDynamicComponent as d } from "vue";
4
+ // src/components/MarkdownToc.vue?vue&type=script&setup=true&lang.ts
5
+ var f = ["aria-label"], p = {
6
+ "data-vmd-part": "toc-nav",
7
+ class: "vmd-toc-nav"
8
+ }, m = /* @__PURE__ */ s({
9
+ __name: "MarkdownToc",
10
+ props: {
11
+ items: {},
12
+ activeId: { default: void 0 },
13
+ label: { default: "Table of contents" },
14
+ tocItem: {
15
+ type: [
16
+ String,
17
+ Object,
18
+ Function
19
+ ],
20
+ default: void 0
21
+ },
22
+ tocDepth: { default: 0 }
23
+ },
24
+ emits: ["navigate"],
25
+ setup(s, { emit: m }) {
26
+ let h = s, g = r(() => e(h.items, h.tocDepth)), _ = m;
27
+ function v(e) {
28
+ _("navigate", e);
29
+ }
30
+ let y = r(() => {
31
+ var e;
32
+ return (e = h.tocItem) == null ? t : e;
33
+ });
34
+ return (e, t) => (c(), a("nav", {
35
+ "data-vmd-part": "toc",
36
+ class: "vmd-toc",
37
+ "aria-label": s.label
38
+ }, [o("ol", p, [(c(!0), a(n, null, l(g.value, (t) => u(e.$slots, "toc-item", {
39
+ item: t,
40
+ active: t.id === s.activeId,
41
+ navigate: v
42
+ }, () => [(c(), i(d(y.value), {
43
+ item: t,
44
+ active: t.id === s.activeId,
45
+ onNavigate: v
46
+ }, null, 40, ["item", "active"]))], void 0, t.id)), 128))])], 8, f));
47
+ }
48
+ });
49
+ export { m as t };
@@ -0,0 +1,25 @@
1
+ import { computed as e, createElementBlock as t, createElementVNode as n, defineComponent as r, normalizeStyle as i, openBlock as a, toDisplayString as o, withModifiers as s } from "vue";
2
+ // src/components/MarkdownTocItem.vue?vue&type=script&setup=true&lang.ts
3
+ var c = { class: "vmd-toc-entry" }, l = ["href", "aria-current"], u = /* @__PURE__ */ r({
4
+ __name: "MarkdownTocItem",
5
+ props: {
6
+ item: {},
7
+ active: {
8
+ type: Boolean,
9
+ default: !1
10
+ }
11
+ },
12
+ emits: ["navigate"],
13
+ setup(r) {
14
+ let u = r, d = e(() => ({ "--vmd-toc-depth": String(u.item.level) }));
15
+ return (e, u) => (a(), t("li", c, [n("a", {
16
+ "data-vmd-part": "toc-item",
17
+ class: "vmd-toc-item",
18
+ href: `#${r.item.id}`,
19
+ "aria-current": r.active ? "true" : void 0,
20
+ style: i(d.value),
21
+ onClick: u[0] || (u[0] = s((t) => e.$emit("navigate", r.item.id), ["prevent"]))
22
+ }, o(r.item.text), 13, l)]));
23
+ }
24
+ });
25
+ export { u as t };
@@ -0,0 +1,414 @@
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-DAqK0w5J.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 };