@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.
Files changed (291) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/LICENSE +21 -0
  3. package/README.md +579 -3
  4. package/README.zh-CN.md +547 -0
  5. package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +18 -0
  6. package/dist/chunks/MarkdownBlockquote-DVXziX2t.js.map +1 -0
  7. package/dist/chunks/MarkdownBreak-BwCi2Itt.js +18 -0
  8. package/dist/chunks/MarkdownBreak-BwCi2Itt.js.map +1 -0
  9. package/dist/chunks/MarkdownCode-B1k9tmW5.js +65 -0
  10. package/dist/chunks/MarkdownCode-B1k9tmW5.js.map +1 -0
  11. package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +51 -0
  12. package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js.map +1 -0
  13. package/dist/chunks/MarkdownContent-BAK6dqo7.js +15 -0
  14. package/dist/chunks/MarkdownContent-BAK6dqo7.js.map +1 -0
  15. package/dist/chunks/MarkdownCustomTag-BBdn3-WO.js +42 -0
  16. package/dist/chunks/MarkdownCustomTag-BBdn3-WO.js.map +1 -0
  17. package/dist/chunks/MarkdownEmphasis-CppivOEu.js +18 -0
  18. package/dist/chunks/MarkdownEmphasis-CppivOEu.js.map +1 -0
  19. package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +16 -0
  20. package/dist/chunks/MarkdownEmpty-Av5k6bqa.js.map +1 -0
  21. package/dist/chunks/MarkdownError-C0sPs5W0.js +19 -0
  22. package/dist/chunks/MarkdownError-C0sPs5W0.js.map +1 -0
  23. package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +24 -0
  24. package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js.map +1 -0
  25. package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +23 -0
  26. package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js.map +1 -0
  27. package/dist/chunks/MarkdownHeading-DaNcP0_6.js +31 -0
  28. package/dist/chunks/MarkdownHeading-DaNcP0_6.js.map +1 -0
  29. package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +18 -0
  30. package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js.map +1 -0
  31. package/dist/chunks/MarkdownHtml-66lYkvwM.js +15 -0
  32. package/dist/chunks/MarkdownHtml-66lYkvwM.js.map +1 -0
  33. package/dist/chunks/MarkdownImage-BRy76svs.js +53 -0
  34. package/dist/chunks/MarkdownImage-BRy76svs.js.map +1 -0
  35. package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +18 -0
  36. package/dist/chunks/MarkdownInlineCode-MXZYFwex.js.map +1 -0
  37. package/dist/chunks/MarkdownLink-Dbx3NwgV.js +47 -0
  38. package/dist/chunks/MarkdownLink-Dbx3NwgV.js.map +1 -0
  39. package/dist/chunks/MarkdownList-BJ-_C71k.js +22 -0
  40. package/dist/chunks/MarkdownList-BJ-_C71k.js.map +1 -0
  41. package/dist/chunks/MarkdownListItem-Z1EHIY26.js +18 -0
  42. package/dist/chunks/MarkdownListItem-Z1EHIY26.js.map +1 -0
  43. package/dist/chunks/MarkdownLoading-D-RYtXxf.js +17 -0
  44. package/dist/chunks/MarkdownLoading-D-RYtXxf.js.map +1 -0
  45. package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +18 -0
  46. package/dist/chunks/MarkdownParagraph-BxLSmSaG.js.map +1 -0
  47. package/dist/chunks/MarkdownRenderer-DLRRfsdI.js +416 -0
  48. package/dist/chunks/MarkdownRenderer-DLRRfsdI.js.map +1 -0
  49. package/dist/chunks/MarkdownRoot-DEE6iVfh.js +25 -0
  50. package/dist/chunks/MarkdownRoot-DEE6iVfh.js.map +1 -0
  51. package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +18 -0
  52. package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js.map +1 -0
  53. package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +18 -0
  54. package/dist/chunks/MarkdownStrong-uU5MzAoJ.js.map +1 -0
  55. package/dist/chunks/MarkdownTable-DmBTg_CR.js +18 -0
  56. package/dist/chunks/MarkdownTable-DmBTg_CR.js.map +1 -0
  57. package/dist/chunks/MarkdownTableCell-eiCJe847.js +33 -0
  58. package/dist/chunks/MarkdownTableCell-eiCJe847.js.map +1 -0
  59. package/dist/chunks/MarkdownTableRow-DuJaPntg.js +18 -0
  60. package/dist/chunks/MarkdownTableRow-DuJaPntg.js.map +1 -0
  61. package/dist/chunks/MarkdownTableSection-PFHz-R33.js +26 -0
  62. package/dist/chunks/MarkdownTableSection-PFHz-R33.js.map +1 -0
  63. package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +40 -0
  64. package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js.map +1 -0
  65. package/dist/chunks/MarkdownToc-BdOHF-Yo.js +51 -0
  66. package/dist/chunks/MarkdownToc-BdOHF-Yo.js.map +1 -0
  67. package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +27 -0
  68. package/dist/chunks/MarkdownTocItem-DT9mR3vL.js.map +1 -0
  69. package/dist/chunks/MermaidLiveEditor-W-qf3G-5.js +416 -0
  70. package/dist/chunks/MermaidLiveEditor-W-qf3G-5.js.map +1 -0
  71. package/dist/chunks/VueSyntaxHighlighter-DyLsYMwy.js +262 -0
  72. package/dist/chunks/VueSyntaxHighlighter-DyLsYMwy.js.map +1 -0
  73. package/dist/chunks/adapters-CMwX_NEI.js +28 -0
  74. package/dist/chunks/adapters-CMwX_NEI.js.map +1 -0
  75. package/dist/chunks/asyncToGenerator-ChigusFD.js +26 -0
  76. package/dist/chunks/blank-line-Cb-JBP_5.js +90 -0
  77. package/dist/chunks/blank-line-Cb-JBP_5.js.map +1 -0
  78. package/dist/chunks/codemirror-DyphMAEg.js +84 -0
  79. package/dist/chunks/codemirror-DyphMAEg.js.map +1 -0
  80. package/dist/chunks/config-aRYo2R8_.js +12 -0
  81. package/dist/chunks/config-aRYo2R8_.js.map +1 -0
  82. package/dist/chunks/context-8NfW6fxI.js +32 -0
  83. package/dist/chunks/context-8NfW6fxI.js.map +1 -0
  84. package/dist/chunks/default-DWVS-I_8.js +23 -0
  85. package/dist/chunks/default-DWVS-I_8.js.map +1 -0
  86. package/dist/chunks/diagnostics-CtHoJyiX.js +25 -0
  87. package/dist/chunks/diagnostics-CtHoJyiX.js.map +1 -0
  88. package/dist/chunks/export-DZQ3cUry.js +1575 -0
  89. package/dist/chunks/export-DZQ3cUry.js.map +1 -0
  90. package/dist/chunks/hast-nodes-C0bX3M5Z.js +35 -0
  91. package/dist/chunks/hast-nodes-C0bX3M5Z.js.map +1 -0
  92. package/dist/chunks/highlightjs-BEh-YwEG.js +6041 -0
  93. package/dist/chunks/highlightjs-BEh-YwEG.js.map +1 -0
  94. package/dist/chunks/identity-jZEhX2d5.js +6244 -0
  95. package/dist/chunks/identity-jZEhX2d5.js.map +1 -0
  96. package/dist/chunks/labels-BtHiUTQI.js +49 -0
  97. package/dist/chunks/labels-BtHiUTQI.js.map +1 -0
  98. package/dist/chunks/lib-BQiWGWpu.js +5087 -0
  99. package/dist/chunks/lib-BQiWGWpu.js.map +1 -0
  100. package/dist/chunks/lib-LwqA_W3J.js +127 -0
  101. package/dist/chunks/lib-LwqA_W3J.js.map +1 -0
  102. package/dist/chunks/longest-streak-DZE_EqsU.js +10 -0
  103. package/dist/chunks/longest-streak-DZE_EqsU.js.map +1 -0
  104. package/dist/chunks/micromark-factory-space-Db040TnW.js +139 -0
  105. package/dist/chunks/micromark-factory-space-Db040TnW.js.map +1 -0
  106. package/dist/chunks/normalize-CRYv3Wqt.js +220 -0
  107. package/dist/chunks/normalize-CRYv3Wqt.js.map +1 -0
  108. package/dist/chunks/objectSpread2-CtBNx0TF.js +57 -0
  109. package/dist/chunks/plugin-DqkFHyny.js +28 -0
  110. package/dist/chunks/plugin-DqkFHyny.js.map +1 -0
  111. package/dist/chunks/preset-BjaOuJUL.js +46 -0
  112. package/dist/chunks/preset-BjaOuJUL.js.map +1 -0
  113. package/dist/chunks/registry-DLjr93-V.js +6144 -0
  114. package/dist/chunks/registry-DLjr93-V.js.map +1 -0
  115. package/dist/chunks/render-Cs8iKrgz.js +1724 -0
  116. package/dist/chunks/render-Cs8iKrgz.js.map +1 -0
  117. package/dist/chunks/runtime-DJMnzjah.js +546 -0
  118. package/dist/chunks/runtime-DJMnzjah.js.map +1 -0
  119. package/dist/chunks/security-y4EwUyAs.js +214 -0
  120. package/dist/chunks/security-y4EwUyAs.js.map +1 -0
  121. package/dist/chunks/shared-DNAvZ-UY.js +76 -0
  122. package/dist/chunks/shared-DNAvZ-UY.js.map +1 -0
  123. package/dist/chunks/space-separated-tokens-CmBjEPdR.js +1099 -0
  124. package/dist/chunks/space-separated-tokens-CmBjEPdR.js.map +1 -0
  125. package/dist/chunks/url-D2BoivaE.js +26 -0
  126. package/dist/chunks/url-D2BoivaE.js.map +1 -0
  127. package/dist/chunks/useActiveHeading-BaGVMJnB.js +316 -0
  128. package/dist/chunks/useActiveHeading-BaGVMJnB.js.map +1 -0
  129. package/dist/components/CodeBlock.d.ts +73 -0
  130. package/dist/components/CodeBlock.js +1 -0
  131. package/dist/components/Icon.d.ts +6 -0
  132. package/dist/components/MarkdownBlockquote.d.ts +18 -0
  133. package/dist/components/MarkdownBlockquote.js +1 -0
  134. package/dist/components/MarkdownBreak.d.ts +8 -0
  135. package/dist/components/MarkdownBreak.js +1 -0
  136. package/dist/components/MarkdownChildren.d.ts +17 -0
  137. package/dist/components/MarkdownCode.d.ts +29 -0
  138. package/dist/components/MarkdownCode.js +1 -0
  139. package/dist/components/MarkdownConfigProvider.d.ts +33 -0
  140. package/dist/components/MarkdownConfigProvider.js +1 -0
  141. package/dist/components/MarkdownContent.d.ts +16 -0
  142. package/dist/components/MarkdownContent.js +1 -0
  143. package/dist/components/MarkdownCustomTag.d.ts +20 -0
  144. package/dist/components/MarkdownCustomTag.js +1 -0
  145. package/dist/components/MarkdownEmphasis.d.ts +18 -0
  146. package/dist/components/MarkdownEmphasis.js +1 -0
  147. package/dist/components/MarkdownEmpty.d.ts +8 -0
  148. package/dist/components/MarkdownEmpty.js +1 -0
  149. package/dist/components/MarkdownError.d.ts +11 -0
  150. package/dist/components/MarkdownError.js +1 -0
  151. package/dist/components/MarkdownFootnoteReference.d.ts +19 -0
  152. package/dist/components/MarkdownFootnoteReference.js +1 -0
  153. package/dist/components/MarkdownFootnotes.d.ts +17 -0
  154. package/dist/components/MarkdownFootnotes.js +1 -0
  155. package/dist/components/MarkdownHeading.d.ts +18 -0
  156. package/dist/components/MarkdownHeading.js +1 -0
  157. package/dist/components/MarkdownHorizontalRule.d.ts +8 -0
  158. package/dist/components/MarkdownHorizontalRule.js +1 -0
  159. package/dist/components/MarkdownHtml.d.ts +8 -0
  160. package/dist/components/MarkdownHtml.js +1 -0
  161. package/dist/components/MarkdownImage.d.ts +15 -0
  162. package/dist/components/MarkdownImage.js +1 -0
  163. package/dist/components/MarkdownInlineCode.d.ts +18 -0
  164. package/dist/components/MarkdownInlineCode.js +1 -0
  165. package/dist/components/MarkdownLink.d.ts +22 -0
  166. package/dist/components/MarkdownLink.js +1 -0
  167. package/dist/components/MarkdownList.d.ts +18 -0
  168. package/dist/components/MarkdownList.js +1 -0
  169. package/dist/components/MarkdownListItem.d.ts +18 -0
  170. package/dist/components/MarkdownListItem.js +1 -0
  171. package/dist/components/MarkdownLoading.d.ts +8 -0
  172. package/dist/components/MarkdownLoading.js +1 -0
  173. package/dist/components/MarkdownMath.d.ts +12 -0
  174. package/dist/components/MarkdownMath.js +1 -0
  175. package/dist/components/MarkdownMermaid.d.ts +78 -0
  176. package/dist/components/MarkdownMermaid.js +1 -0
  177. package/dist/components/MarkdownParagraph.d.ts +18 -0
  178. package/dist/components/MarkdownParagraph.js +1 -0
  179. package/dist/components/MarkdownRenderer.d.ts +170 -0
  180. package/dist/components/MarkdownRenderer.js +1 -0
  181. package/dist/components/MarkdownRoot.d.ts +24 -0
  182. package/dist/components/MarkdownRoot.js +1 -0
  183. package/dist/components/MarkdownStrikethrough.d.ts +18 -0
  184. package/dist/components/MarkdownStrikethrough.js +1 -0
  185. package/dist/components/MarkdownStrong.d.ts +18 -0
  186. package/dist/components/MarkdownStrong.js +1 -0
  187. package/dist/components/MarkdownTable.d.ts +18 -0
  188. package/dist/components/MarkdownTable.js +1 -0
  189. package/dist/components/MarkdownTableCell.d.ts +20 -0
  190. package/dist/components/MarkdownTableCell.js +1 -0
  191. package/dist/components/MarkdownTableRow.d.ts +18 -0
  192. package/dist/components/MarkdownTableRow.js +1 -0
  193. package/dist/components/MarkdownTableSection.d.ts +18 -0
  194. package/dist/components/MarkdownTableSection.js +1 -0
  195. package/dist/components/MarkdownTaskItem.d.ts +20 -0
  196. package/dist/components/MarkdownTaskItem.js +1 -0
  197. package/dist/components/MarkdownToc.d.ts +36 -0
  198. package/dist/components/MarkdownToc.js +1 -0
  199. package/dist/components/MarkdownTocItem.d.ts +14 -0
  200. package/dist/components/MarkdownTocItem.js +1 -0
  201. package/dist/components/MermaidBlock.d.ts +50 -0
  202. package/dist/components/MermaidBlock.js +1 -0
  203. package/dist/components/MermaidLiveEditor.d.ts +44 -0
  204. package/dist/components/MermaidLiveEditor.js +1 -0
  205. package/dist/components/VueSyntaxHighlighter.d.ts +39 -0
  206. package/dist/components/VueSyntaxHighlighter.js +1 -0
  207. package/dist/components/codeRegion.d.ts +14 -0
  208. package/dist/components/config.d.ts +7 -0
  209. package/dist/components/context.d.ts +45 -0
  210. package/dist/components/index.d.ts +42 -0
  211. package/dist/components/index.js +38 -0
  212. package/dist/components/render.d.ts +9 -0
  213. package/dist/components/scroll-lock.d.ts +7 -0
  214. package/dist/components/types.d.ts +29 -0
  215. package/dist/composables/useActiveHeading.d.ts +12 -0
  216. package/dist/composables/useCodeHighlighter.d.ts +30 -0
  217. package/dist/composables/useLineWindow.d.ts +38 -0
  218. package/dist/composables/useMarkdownDocument.d.ts +23 -0
  219. package/dist/core/adapters.d.ts +7 -0
  220. package/dist/core/config.d.ts +5 -0
  221. package/dist/core/diagnostics.d.ts +9 -0
  222. package/dist/core/finalize.d.ts +18 -0
  223. package/dist/core/hast-nodes.d.ts +6 -0
  224. package/dist/core/highlight-lines.d.ts +8 -0
  225. package/dist/core/identity.d.ts +4 -0
  226. package/dist/core/labels.d.ts +4 -0
  227. package/dist/core/manifest.d.ts +38 -0
  228. package/dist/core/memo.d.ts +5 -0
  229. package/dist/core/model-hast.d.ts +8 -0
  230. package/dist/core/model.d.ts +10 -0
  231. package/dist/core/normalize.d.ts +27 -0
  232. package/dist/core/parts.d.ts +135 -0
  233. package/dist/core/preset.d.ts +10 -0
  234. package/dist/core/run.d.ts +16 -0
  235. package/dist/core/search.d.ts +5 -0
  236. package/dist/core/security.d.ts +21 -0
  237. package/dist/core/slugger.d.ts +6 -0
  238. package/dist/core/types.d.ts +390 -0
  239. package/dist/core/url.d.ts +10 -0
  240. package/dist/editor/codemirror.d.ts +14 -0
  241. package/dist/editor/index.d.ts +2 -0
  242. package/dist/editor/index.js +1 -0
  243. package/dist/export/index.d.ts +6 -0
  244. package/dist/headless.d.ts +21 -0
  245. package/dist/headless.js +12 -0
  246. package/dist/highlight/highlightjs.d.ts +7 -0
  247. package/dist/highlight/index.d.ts +3 -0
  248. package/dist/highlight/index.js +3 -0
  249. package/dist/highlight/shared.d.ts +16 -0
  250. package/dist/highlight/shiki.d.ts +7 -0
  251. package/dist/highlight/shiki.js +76 -0
  252. package/dist/highlight/shiki.js.map +1 -0
  253. package/dist/html/index.d.ts +17 -0
  254. package/dist/html/index.js +13 -0
  255. package/dist/html/index.js.map +1 -0
  256. package/dist/index.d.ts +24 -0
  257. package/dist/index.js +55 -0
  258. package/dist/index.js.map +1 -0
  259. package/dist/math/index.d.ts +4 -0
  260. package/dist/math/index.js +583 -0
  261. package/dist/math/index.js.map +1 -0
  262. package/dist/math/katex.d.ts +4 -0
  263. package/dist/math/plugin.d.ts +20 -0
  264. package/dist/mermaid/index.d.ts +5 -0
  265. package/dist/mermaid/index.js +3 -0
  266. package/dist/mermaid/plugin.d.ts +14 -0
  267. package/dist/mermaid/runtime.d.ts +12 -0
  268. package/dist/mermaid/sanitize.d.ts +12 -0
  269. package/dist/node-components.d.ts +1 -0
  270. package/dist/node-components.js +39 -0
  271. package/dist/pipeline/custom.d.ts +8 -0
  272. package/dist/pipeline/identity.d.ts +12 -0
  273. package/dist/pipeline/index.d.ts +5 -0
  274. package/dist/pipeline/official.d.ts +6 -0
  275. package/dist/pipeline.d.ts +1 -0
  276. package/dist/pipeline.js +1 -0
  277. package/dist/plugins/builtin.d.ts +15 -0
  278. package/dist/plugins/define.d.ts +7 -0
  279. package/dist/plugins/registry.d.ts +16 -0
  280. package/dist/plugins/source.d.ts +7 -0
  281. package/dist/plugins.d.ts +3 -0
  282. package/dist/plugins.js +1 -0
  283. package/dist/presets.d.ts +3 -0
  284. package/dist/presets.js +1 -0
  285. package/dist/style.css +2 -0
  286. package/dist/styles/components.css +712 -0
  287. package/dist/styles/index.d.ts +1 -0
  288. package/dist/styles/math-full.css +3 -0
  289. package/dist/styles/math.css +18 -0
  290. package/dist/styles/tokens.css +96 -0
  291. package/package.json +211 -6
@@ -0,0 +1,262 @@
1
+ import { n as e } from "./labels-BtHiUTQI.js";
2
+ import { n as t, t as n } from "./diagnostics-CtHoJyiX.js";
3
+ import { t as r } from "./asyncToGenerator-ChigusFD.js";
4
+ import { r as i } from "./config-aRYo2R8_.js";
5
+ import { n as a, r as o } from "./context-8NfW6fxI.js";
6
+ import { o as s, s as c, t as l } from "./render-Cs8iKrgz.js";
7
+ import { computed as u, createElementBlock as d, createElementVNode as f, createVNode as p, defineComponent as m, h, normalizeStyle as g, openBlock as _, unref as v, useSlots as y } from "vue";
8
+ // src/components/VueSyntaxHighlighter.vue?vue&type=script&setup=true&lang.ts
9
+ var b = [
10
+ "data-vmd-theme",
11
+ "data-language",
12
+ "data-highlighter",
13
+ "data-virtual"
14
+ ], x = {
15
+ "data-vmd-part": "highlighter-body",
16
+ class: "vmd-highlighter-body"
17
+ }, S = /* @__PURE__ */ m({
18
+ __name: "VueSyntaxHighlighter",
19
+ props: {
20
+ source: {},
21
+ language: { default: "" },
22
+ theme: { default: void 0 },
23
+ highlighter: { default: void 0 },
24
+ lineNumbers: {
25
+ type: Boolean,
26
+ default: !1
27
+ },
28
+ highlightLines: { default: () => [] },
29
+ maxLines: { default: 0 },
30
+ virtual: {
31
+ type: Boolean,
32
+ default: !1
33
+ },
34
+ virtualThreshold: { default: 200 },
35
+ lineHeight: { default: 20 },
36
+ delay: { default: 0 }
37
+ },
38
+ emits: ["copy", "error"],
39
+ setup(S, { expose: C, emit: w }) {
40
+ let T = S, E = w, D = o(), O = i(), k = y();
41
+ function A(e) {
42
+ var t;
43
+ (t = D.onRenderError) == null || t.call(D, e), E("error", e);
44
+ }
45
+ let { result: j, active: M, resolvedTheme: N, getHighlighted: P } = c({
46
+ source: () => T.source,
47
+ language: () => T.language,
48
+ highlighter: () => {
49
+ var e, t;
50
+ return (e = (t = T.highlighter) == null ? D.highlighter : t) == null ? O.value.highlighter : e;
51
+ },
52
+ theme: () => T.theme,
53
+ contextTheme: () => {
54
+ var e;
55
+ return (e = D.theme) == null ? O.value.theme : e;
56
+ },
57
+ delay: () => T.delay,
58
+ onDiagnostic: A
59
+ }), { expanded: F, truncatable: I, totalLines: L, virtualActive: R, startLine: z, endLine: B, visibleLines: V, lineHeight: H, scrollRef: U, onScroll: W, toggle: G, isHighlightedLine: K } = s({
60
+ nodes: () => j.value.nodes,
61
+ source: () => T.source,
62
+ maxLines: () => T.maxLines,
63
+ virtual: () => T.virtual,
64
+ virtualThreshold: () => T.virtualThreshold,
65
+ lineHeight: () => T.lineHeight,
66
+ highlightLines: () => T.highlightLines
67
+ }), q = u(() => j.value.mode === "block");
68
+ function J() {
69
+ return Y.apply(this, arguments);
70
+ }
71
+ function Y() {
72
+ return Y = r(function* () {
73
+ try {
74
+ if (typeof navigator < "u" && navigator.clipboard) yield navigator.clipboard.writeText(T.source);
75
+ else if (typeof document < "u") {
76
+ let e = document.createElement("textarea");
77
+ e.value = T.source, document.body.appendChild(e), e.select();
78
+ let t = document.execCommand("copy");
79
+ if (e.remove(), t === !1) throw Error("The copy command was rejected.");
80
+ } else throw Error("Clipboard access is not available.");
81
+ E("copy", T.source);
82
+ } catch (e) {
83
+ A(n("copy-error", `The source could not be copied to the clipboard: ${t(e)}`, {
84
+ severity: "warning",
85
+ phase: "render"
86
+ }));
87
+ }
88
+ }), Y.apply(this, arguments);
89
+ }
90
+ C({
91
+ copy: J,
92
+ getHighlighted: P,
93
+ highlighted: j
94
+ });
95
+ let X = u(() => ({
96
+ source: T.source,
97
+ language: T.language,
98
+ highlighted: j.value,
99
+ nodes: j.value.nodes,
100
+ lines: V.value,
101
+ actions: { copy: J }
102
+ })), Z = u(() => ({
103
+ source: T.source,
104
+ language: T.language,
105
+ label: e(D.labels.empty),
106
+ actions: { copy: J }
107
+ })), Q = m({ setup() {
108
+ return () => {
109
+ var e;
110
+ let t = k.actions;
111
+ if (t) {
112
+ let e = t(X.value);
113
+ if (!a(e)) return h("span", {
114
+ "data-vmd-part": "highlighter-actions",
115
+ class: "vmd-highlighter-actions"
116
+ }, e);
117
+ }
118
+ let n = (e = D.slots) == null ? void 0 : e.actions;
119
+ if (n) {
120
+ let e = n(X.value);
121
+ if (!a(e)) return h("span", {
122
+ "data-vmd-part": "highlighter-actions",
123
+ class: "vmd-highlighter-actions"
124
+ }, e);
125
+ }
126
+ return null;
127
+ };
128
+ } }), $ = m({ setup() {
129
+ return () => {
130
+ var e, t;
131
+ let n = k.header;
132
+ if (n) {
133
+ let e = n(X.value);
134
+ if (!a(e)) return h("div", {
135
+ "data-vmd-part": "highlighter-header",
136
+ class: "vmd-highlighter-header"
137
+ }, e);
138
+ }
139
+ let r = (e = D.slots) == null ? void 0 : e.header;
140
+ if (r) {
141
+ let e = r(X.value);
142
+ if (!a(e)) return h("div", {
143
+ "data-vmd-part": "highlighter-header",
144
+ class: "vmd-highlighter-header"
145
+ }, e);
146
+ }
147
+ return !k.actions && !((t = D.slots) != null && t.actions) ? null : h("div", {
148
+ "data-vmd-part": "highlighter-header",
149
+ class: "vmd-highlighter-header"
150
+ }, [h("span", { class: "vmd-highlighter-label" }, T.language || "text"), h(Q)]);
151
+ };
152
+ } }), ee = m({ setup() {
153
+ return () => {
154
+ var e;
155
+ let t = k.footer;
156
+ if (t) {
157
+ let e = t(X.value);
158
+ if (!a(e)) return h("div", {
159
+ "data-vmd-part": "highlighter-footer",
160
+ class: "vmd-highlighter-footer"
161
+ }, e);
162
+ }
163
+ let n = (e = D.slots) == null ? void 0 : e.footer;
164
+ if (n) {
165
+ let e = n(X.value);
166
+ if (!a(e)) return h("div", {
167
+ "data-vmd-part": "highlighter-footer",
168
+ class: "vmd-highlighter-footer"
169
+ }, e);
170
+ }
171
+ return null;
172
+ };
173
+ } }), te = m({ setup() {
174
+ return () => D.renderHostSlot("highlighter", {
175
+ source: T.source,
176
+ language: T.language,
177
+ nodes: j.value.nodes,
178
+ lines: V.value,
179
+ highlighted: j.value,
180
+ actions: { copy: J }
181
+ }, () => {
182
+ let t = k.highlighter;
183
+ if (t) {
184
+ let e = t({
185
+ source: T.source,
186
+ language: T.language,
187
+ nodes: j.value.nodes,
188
+ lines: V.value,
189
+ highlighted: j.value,
190
+ actions: { copy: J }
191
+ });
192
+ if (!a(e)) return e;
193
+ }
194
+ if (T.source === "") return D.renderHostSlot("empty", Z.value, () => {
195
+ let t = k.empty;
196
+ if (t) {
197
+ let e = t(Z.value);
198
+ if (!a(e)) return e;
199
+ }
200
+ return h("div", {
201
+ "data-vmd-part": "highlighter-empty",
202
+ class: "vmd-highlighter-empty"
203
+ }, e(D.labels.empty));
204
+ });
205
+ if (q.value) return l(j.value.nodes, D);
206
+ let n = [];
207
+ R.value && z.value > 0 && n.push(h("div", {
208
+ "aria-hidden": "true",
209
+ style: { height: `${z.value * H.value}px` }
210
+ }));
211
+ for (let e of V.value) {
212
+ let t = K(e.index);
213
+ n.push(h("div", {
214
+ class: "vmd-highlighter-line",
215
+ "data-vmd-part": "highlighter-line",
216
+ "data-line": String(e.index + 1),
217
+ "data-highlighted": t ? "true" : void 0
218
+ }, [T.lineNumbers ? h("span", {
219
+ class: "vmd-highlighter-gutter",
220
+ "data-vmd-part": "highlighter-gutter",
221
+ "aria-hidden": "true"
222
+ }, String(e.index + 1)) : null, h("code", { class: "vmd-highlighter-code" }, l(e.nodes, D))]));
223
+ }
224
+ return R.value && B.value < L.value && n.push(h("div", {
225
+ "aria-hidden": "true",
226
+ style: { height: `${(L.value - B.value) * H.value}px` }
227
+ })), I.value && n.push(h("button", {
228
+ type: "button",
229
+ class: "vmd-highlighter-toggle",
230
+ "data-vmd-part": "highlighter-toggle",
231
+ "aria-expanded": F.value ? "true" : "false",
232
+ onClick: G
233
+ }, F.value ? e(D.labels.showLess) : e(D.labels.showAll))), n;
234
+ });
235
+ } });
236
+ return (e, t) => {
237
+ var n;
238
+ return _(), d("div", {
239
+ ref_key: "scrollRef",
240
+ ref: U,
241
+ "data-vmd-part": "highlighter",
242
+ class: "vmd-highlighter",
243
+ "data-vmd-theme": v(N),
244
+ "data-language": S.language || "text",
245
+ "data-highlighter": (n = v(M)) == null ? void 0 : n.id,
246
+ "data-virtual": v(R) ? "true" : void 0,
247
+ style: g(v(R) ? {
248
+ maxHeight: `${v(H) * 20}px`,
249
+ overflow: "auto"
250
+ } : void 0),
251
+ onScroll: t[0] || (t[0] = (...e) => v(W) && v(W)(...e))
252
+ }, [
253
+ p(v($)),
254
+ f("div", x, [p(v(te))]),
255
+ p(v(ee))
256
+ ], 44, b);
257
+ };
258
+ }
259
+ });
260
+ export { S as t };
261
+
262
+ //# sourceMappingURL=VueSyntaxHighlighter-DyLsYMwy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VueSyntaxHighlighter-DyLsYMwy.js","names":["_openBlock","_createElementBlock","_unref","_normalizeStyle","_createVNode","_createElementVNode","_sfc_main","resolveLabel","errorMessage","createDiagnostic","_asyncToGenerator","useMarkdownConfig","isEmptySlotContent","useRenderContext","useLineWindow","useCodeHighlighter","renderNodes","_hoisted_1","_hoisted_2","VueSyntaxHighlighter_default","defineComponent","__expose","__emit","props","__props","emit","context","config","ownSlots","useSlots","reportDiagnostic","_context$onRenderErro","diagnostic","_ref","_props$highlighter","_context$theme","result","blockMode","computed","copy","_copy","area","succeeded","error","slotContext","visibleLines","emptyContext","ActionsRegion","_context$slots","own","output","host","HeaderRegion","_context$slots2","_context$slots3","FooterRegion","_context$slots4","Body","slot","empty","children","virtualActive","startLine","lineHeight","line","highlighted","isHighlightedLine","endLine","totalLines","truncatable","expanded","toggle","_unref2","openBlock","createElementBlock","scrollRef","unref","resolvedTheme","active","normalizeStyle","_cache","args","onScroll","createVNode","createElementVNode"],"sources":["../../src/components/VueSyntaxHighlighter.vue","../../src/components/VueSyntaxHighlighter.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, defineComponent, h, useSlots, type VNodeChild } from 'vue'\nimport type {\n HighlightLine,\n MarkdownDiagnostic,\n MarkdownHighlighter,\n MarkdownTheme,\n} from '../core/types'\nimport { createDiagnostic, errorMessage } from '../core/diagnostics'\nimport { resolveLabel } from '../core/labels'\nimport { useCodeHighlighter } from '../composables/useCodeHighlighter'\nimport { useLineWindow } from '../composables/useLineWindow'\nimport { renderNodes } from './render'\nimport { isEmptySlotContent, useRenderContext } from './context'\nimport { useMarkdownConfig } from './config'\n\nconst props = withDefaults(\n defineProps<{\n source: string\n language?: string\n theme?: MarkdownTheme\n highlighter?: MarkdownHighlighter\n lineNumbers?: boolean\n highlightLines?: HighlightLine[]\n maxLines?: number\n virtual?: boolean\n virtualThreshold?: number\n lineHeight?: number\n delay?: number\n }>(),\n {\n language: '',\n theme: undefined,\n highlighter: undefined,\n lineNumbers: false,\n highlightLines: () => [],\n maxLines: 0,\n virtual: false,\n virtualThreshold: 200,\n lineHeight: 20,\n delay: 0,\n },\n)\n\nconst emit = defineEmits<{\n copy: [source: string]\n error: [diagnostic: MarkdownDiagnostic]\n}>()\nconst context = useRenderContext()\nconst config = useMarkdownConfig()\nconst ownSlots = useSlots()\n\nfunction reportDiagnostic(diagnostic: MarkdownDiagnostic): void {\n context.onRenderError?.(diagnostic)\n emit('error', diagnostic)\n}\n\nconst { result, active, resolvedTheme, getHighlighted } = useCodeHighlighter({\n source: () => props.source,\n language: () => props.language,\n highlighter: () =>\n props.highlighter ?? context.highlighter ?? config.value.highlighter,\n theme: () => props.theme,\n contextTheme: () => context.theme ?? config.value.theme,\n delay: () => props.delay,\n onDiagnostic: reportDiagnostic,\n})\n\nconst {\n expanded,\n truncatable,\n totalLines,\n virtualActive,\n startLine,\n endLine,\n visibleLines,\n lineHeight,\n scrollRef,\n onScroll,\n toggle,\n isHighlightedLine,\n} = useLineWindow({\n nodes: () => result.value.nodes,\n source: () => props.source,\n maxLines: () => props.maxLines,\n virtual: () => props.virtual,\n virtualThreshold: () => props.virtualThreshold,\n lineHeight: () => props.lineHeight,\n highlightLines: () => props.highlightLines,\n})\n\nconst blockMode = computed(() => result.value.mode === 'block')\n\nasync function copy(): Promise<void> {\n try {\n if (typeof navigator !== 'undefined' && navigator.clipboard) {\n await navigator.clipboard.writeText(props.source)\n } else if (typeof document !== 'undefined') {\n const area = document.createElement('textarea')\n area.value = props.source\n document.body.appendChild(area)\n area.select()\n const succeeded = document.execCommand('copy')\n area.remove()\n if (succeeded === false) throw new Error('The copy command was rejected.')\n } else {\n throw new Error('Clipboard access is not available.')\n }\n emit('copy', props.source)\n } catch (error) {\n reportDiagnostic(\n createDiagnostic(\n 'copy-error',\n `The source could not be copied to the clipboard: ${errorMessage(error)}`,\n { severity: 'warning', phase: 'render' },\n ),\n )\n }\n}\n\ndefineExpose({ copy, getHighlighted, highlighted: result })\n\nconst slotContext = computed(() => ({\n source: props.source,\n language: props.language,\n highlighted: result.value,\n nodes: result.value.nodes,\n lines: visibleLines.value,\n actions: { copy },\n}))\n\nconst emptyContext = computed(() => ({\n source: props.source,\n language: props.language,\n label: resolveLabel(context.labels.empty),\n actions: { copy },\n}))\n\nconst ActionsRegion = defineComponent({\n setup() {\n return () => {\n const own = ownSlots.actions\n if (own) {\n const output = own(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'span',\n {\n 'data-vmd-part': 'highlighter-actions',\n class: 'vmd-highlighter-actions',\n },\n output,\n )\n }\n }\n const host = context.slots?.actions\n if (host) {\n const output = host(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'span',\n {\n 'data-vmd-part': 'highlighter-actions',\n class: 'vmd-highlighter-actions',\n },\n output,\n )\n }\n }\n return null\n }\n },\n})\n\nconst HeaderRegion = defineComponent({\n setup() {\n return () => {\n const own = ownSlots.header\n if (own) {\n const output = own(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-header',\n class: 'vmd-highlighter-header',\n },\n output,\n )\n }\n }\n const host = context.slots?.header\n if (host) {\n const output = host(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-header',\n class: 'vmd-highlighter-header',\n },\n output,\n )\n }\n }\n if (!ownSlots.actions && !context.slots?.actions) return null\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-header',\n class: 'vmd-highlighter-header',\n },\n [\n h(\n 'span',\n { class: 'vmd-highlighter-label' },\n props.language || 'text',\n ),\n h(ActionsRegion),\n ],\n )\n }\n },\n})\n\nconst FooterRegion = defineComponent({\n setup() {\n return () => {\n const own = ownSlots.footer\n if (own) {\n const output = own(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-footer',\n class: 'vmd-highlighter-footer',\n },\n output,\n )\n }\n }\n const host = context.slots?.footer\n if (host) {\n const output = host(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-footer',\n class: 'vmd-highlighter-footer',\n },\n output,\n )\n }\n }\n return null\n }\n },\n})\n\nconst Body = defineComponent({\n setup() {\n return () =>\n context.renderHostSlot(\n 'highlighter',\n {\n source: props.source,\n language: props.language,\n nodes: result.value.nodes,\n lines: visibleLines.value,\n highlighted: result.value,\n actions: { copy },\n },\n () => {\n const slot = ownSlots.highlighter\n if (slot) {\n const output = slot({\n source: props.source,\n language: props.language,\n nodes: result.value.nodes,\n lines: visibleLines.value,\n highlighted: result.value,\n actions: { copy },\n })\n if (!isEmptySlotContent(output)) return output\n }\n if (props.source === '') {\n return context.renderHostSlot('empty', emptyContext.value, () => {\n const empty = ownSlots.empty\n if (empty) {\n const output = empty(emptyContext.value)\n if (!isEmptySlotContent(output)) return output\n }\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-empty',\n class: 'vmd-highlighter-empty',\n },\n resolveLabel(context.labels.empty),\n )\n })\n }\n if (blockMode.value) {\n return renderNodes(result.value.nodes, context)\n }\n const children: VNodeChild[] = []\n if (virtualActive.value && startLine.value > 0) {\n children.push(\n h('div', {\n 'aria-hidden': 'true',\n style: { height: `${startLine.value * lineHeight.value}px` },\n }),\n )\n }\n for (const line of visibleLines.value) {\n const highlighted = isHighlightedLine(line.index)\n children.push(\n h(\n 'div',\n {\n class: 'vmd-highlighter-line',\n 'data-vmd-part': 'highlighter-line',\n 'data-line': String(line.index + 1),\n 'data-highlighted': highlighted ? 'true' : undefined,\n },\n [\n props.lineNumbers\n ? h(\n 'span',\n {\n class: 'vmd-highlighter-gutter',\n 'data-vmd-part': 'highlighter-gutter',\n 'aria-hidden': 'true',\n },\n String(line.index + 1),\n )\n : null,\n h(\n 'code',\n { class: 'vmd-highlighter-code' },\n renderNodes(line.nodes, context),\n ),\n ],\n ),\n )\n }\n if (virtualActive.value && endLine.value < totalLines.value) {\n children.push(\n h('div', {\n 'aria-hidden': 'true',\n style: {\n height: `${(totalLines.value - endLine.value) * lineHeight.value}px`,\n },\n }),\n )\n }\n if (truncatable.value) {\n children.push(\n h(\n 'button',\n {\n type: 'button',\n class: 'vmd-highlighter-toggle',\n 'data-vmd-part': 'highlighter-toggle',\n 'aria-expanded': expanded.value ? 'true' : 'false',\n onClick: toggle,\n },\n expanded.value\n ? resolveLabel(context.labels.showLess)\n : resolveLabel(context.labels.showAll),\n ),\n )\n }\n return children\n },\n )\n },\n})\n</script>\n\n<template>\n <div\n ref=\"scrollRef\"\n data-vmd-part=\"highlighter\"\n class=\"vmd-highlighter\"\n :data-vmd-theme=\"resolvedTheme\"\n :data-language=\"language || 'text'\"\n :data-highlighter=\"active?.id\"\n :data-virtual=\"virtualActive ? 'true' : undefined\"\n :style=\"\n virtualActive\n ? { maxHeight: `${lineHeight * 20}px`, overflow: 'auto' }\n : undefined\n \"\n @scroll=\"onScroll\"\n >\n <HeaderRegion />\n <div data-vmd-part=\"highlighter-body\" class=\"vmd-highlighter-body\">\n <Body />\n </div>\n <FooterRegion />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, defineComponent, h, useSlots, type VNodeChild } from 'vue'\nimport type {\n HighlightLine,\n MarkdownDiagnostic,\n MarkdownHighlighter,\n MarkdownTheme,\n} from '../core/types'\nimport { createDiagnostic, errorMessage } from '../core/diagnostics'\nimport { resolveLabel } from '../core/labels'\nimport { useCodeHighlighter } from '../composables/useCodeHighlighter'\nimport { useLineWindow } from '../composables/useLineWindow'\nimport { renderNodes } from './render'\nimport { isEmptySlotContent, useRenderContext } from './context'\nimport { useMarkdownConfig } from './config'\n\nconst props = withDefaults(\n defineProps<{\n source: string\n language?: string\n theme?: MarkdownTheme\n highlighter?: MarkdownHighlighter\n lineNumbers?: boolean\n highlightLines?: HighlightLine[]\n maxLines?: number\n virtual?: boolean\n virtualThreshold?: number\n lineHeight?: number\n delay?: number\n }>(),\n {\n language: '',\n theme: undefined,\n highlighter: undefined,\n lineNumbers: false,\n highlightLines: () => [],\n maxLines: 0,\n virtual: false,\n virtualThreshold: 200,\n lineHeight: 20,\n delay: 0,\n },\n)\n\nconst emit = defineEmits<{\n copy: [source: string]\n error: [diagnostic: MarkdownDiagnostic]\n}>()\nconst context = useRenderContext()\nconst config = useMarkdownConfig()\nconst ownSlots = useSlots()\n\nfunction reportDiagnostic(diagnostic: MarkdownDiagnostic): void {\n context.onRenderError?.(diagnostic)\n emit('error', diagnostic)\n}\n\nconst { result, active, resolvedTheme, getHighlighted } = useCodeHighlighter({\n source: () => props.source,\n language: () => props.language,\n highlighter: () =>\n props.highlighter ?? context.highlighter ?? config.value.highlighter,\n theme: () => props.theme,\n contextTheme: () => context.theme ?? config.value.theme,\n delay: () => props.delay,\n onDiagnostic: reportDiagnostic,\n})\n\nconst {\n expanded,\n truncatable,\n totalLines,\n virtualActive,\n startLine,\n endLine,\n visibleLines,\n lineHeight,\n scrollRef,\n onScroll,\n toggle,\n isHighlightedLine,\n} = useLineWindow({\n nodes: () => result.value.nodes,\n source: () => props.source,\n maxLines: () => props.maxLines,\n virtual: () => props.virtual,\n virtualThreshold: () => props.virtualThreshold,\n lineHeight: () => props.lineHeight,\n highlightLines: () => props.highlightLines,\n})\n\nconst blockMode = computed(() => result.value.mode === 'block')\n\nasync function copy(): Promise<void> {\n try {\n if (typeof navigator !== 'undefined' && navigator.clipboard) {\n await navigator.clipboard.writeText(props.source)\n } else if (typeof document !== 'undefined') {\n const area = document.createElement('textarea')\n area.value = props.source\n document.body.appendChild(area)\n area.select()\n const succeeded = document.execCommand('copy')\n area.remove()\n if (succeeded === false) throw new Error('The copy command was rejected.')\n } else {\n throw new Error('Clipboard access is not available.')\n }\n emit('copy', props.source)\n } catch (error) {\n reportDiagnostic(\n createDiagnostic(\n 'copy-error',\n `The source could not be copied to the clipboard: ${errorMessage(error)}`,\n { severity: 'warning', phase: 'render' },\n ),\n )\n }\n}\n\ndefineExpose({ copy, getHighlighted, highlighted: result })\n\nconst slotContext = computed(() => ({\n source: props.source,\n language: props.language,\n highlighted: result.value,\n nodes: result.value.nodes,\n lines: visibleLines.value,\n actions: { copy },\n}))\n\nconst emptyContext = computed(() => ({\n source: props.source,\n language: props.language,\n label: resolveLabel(context.labels.empty),\n actions: { copy },\n}))\n\nconst ActionsRegion = defineComponent({\n setup() {\n return () => {\n const own = ownSlots.actions\n if (own) {\n const output = own(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'span',\n {\n 'data-vmd-part': 'highlighter-actions',\n class: 'vmd-highlighter-actions',\n },\n output,\n )\n }\n }\n const host = context.slots?.actions\n if (host) {\n const output = host(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'span',\n {\n 'data-vmd-part': 'highlighter-actions',\n class: 'vmd-highlighter-actions',\n },\n output,\n )\n }\n }\n return null\n }\n },\n})\n\nconst HeaderRegion = defineComponent({\n setup() {\n return () => {\n const own = ownSlots.header\n if (own) {\n const output = own(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-header',\n class: 'vmd-highlighter-header',\n },\n output,\n )\n }\n }\n const host = context.slots?.header\n if (host) {\n const output = host(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-header',\n class: 'vmd-highlighter-header',\n },\n output,\n )\n }\n }\n if (!ownSlots.actions && !context.slots?.actions) return null\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-header',\n class: 'vmd-highlighter-header',\n },\n [\n h(\n 'span',\n { class: 'vmd-highlighter-label' },\n props.language || 'text',\n ),\n h(ActionsRegion),\n ],\n )\n }\n },\n})\n\nconst FooterRegion = defineComponent({\n setup() {\n return () => {\n const own = ownSlots.footer\n if (own) {\n const output = own(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-footer',\n class: 'vmd-highlighter-footer',\n },\n output,\n )\n }\n }\n const host = context.slots?.footer\n if (host) {\n const output = host(slotContext.value)\n if (!isEmptySlotContent(output)) {\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-footer',\n class: 'vmd-highlighter-footer',\n },\n output,\n )\n }\n }\n return null\n }\n },\n})\n\nconst Body = defineComponent({\n setup() {\n return () =>\n context.renderHostSlot(\n 'highlighter',\n {\n source: props.source,\n language: props.language,\n nodes: result.value.nodes,\n lines: visibleLines.value,\n highlighted: result.value,\n actions: { copy },\n },\n () => {\n const slot = ownSlots.highlighter\n if (slot) {\n const output = slot({\n source: props.source,\n language: props.language,\n nodes: result.value.nodes,\n lines: visibleLines.value,\n highlighted: result.value,\n actions: { copy },\n })\n if (!isEmptySlotContent(output)) return output\n }\n if (props.source === '') {\n return context.renderHostSlot('empty', emptyContext.value, () => {\n const empty = ownSlots.empty\n if (empty) {\n const output = empty(emptyContext.value)\n if (!isEmptySlotContent(output)) return output\n }\n return h(\n 'div',\n {\n 'data-vmd-part': 'highlighter-empty',\n class: 'vmd-highlighter-empty',\n },\n resolveLabel(context.labels.empty),\n )\n })\n }\n if (blockMode.value) {\n return renderNodes(result.value.nodes, context)\n }\n const children: VNodeChild[] = []\n if (virtualActive.value && startLine.value > 0) {\n children.push(\n h('div', {\n 'aria-hidden': 'true',\n style: { height: `${startLine.value * lineHeight.value}px` },\n }),\n )\n }\n for (const line of visibleLines.value) {\n const highlighted = isHighlightedLine(line.index)\n children.push(\n h(\n 'div',\n {\n class: 'vmd-highlighter-line',\n 'data-vmd-part': 'highlighter-line',\n 'data-line': String(line.index + 1),\n 'data-highlighted': highlighted ? 'true' : undefined,\n },\n [\n props.lineNumbers\n ? h(\n 'span',\n {\n class: 'vmd-highlighter-gutter',\n 'data-vmd-part': 'highlighter-gutter',\n 'aria-hidden': 'true',\n },\n String(line.index + 1),\n )\n : null,\n h(\n 'code',\n { class: 'vmd-highlighter-code' },\n renderNodes(line.nodes, context),\n ),\n ],\n ),\n )\n }\n if (virtualActive.value && endLine.value < totalLines.value) {\n children.push(\n h('div', {\n 'aria-hidden': 'true',\n style: {\n height: `${(totalLines.value - endLine.value) * lineHeight.value}px`,\n },\n }),\n )\n }\n if (truncatable.value) {\n children.push(\n h(\n 'button',\n {\n type: 'button',\n class: 'vmd-highlighter-toggle',\n 'data-vmd-part': 'highlighter-toggle',\n 'aria-expanded': expanded.value ? 'true' : 'false',\n onClick: toggle,\n },\n expanded.value\n ? resolveLabel(context.labels.showLess)\n : resolveLabel(context.labels.showAll),\n ),\n )\n }\n return children\n },\n )\n },\n})\n</script>\n\n<template>\n <div\n ref=\"scrollRef\"\n data-vmd-part=\"highlighter\"\n class=\"vmd-highlighter\"\n :data-vmd-theme=\"resolvedTheme\"\n :data-language=\"language || 'text'\"\n :data-highlighter=\"active?.id\"\n :data-virtual=\"virtualActive ? 'true' : undefined\"\n :style=\"\n virtualActive\n ? { maxHeight: `${lineHeight * 20}px`, overflow: 'auto' }\n : undefined\n \"\n @scroll=\"onScroll\"\n >\n <HeaderRegion />\n <div data-vmd-part=\"highlighter-body\" class=\"vmd-highlighter-body\">\n <Body />\n </div>\n <FooterRegion />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,IAAMuB,IAAQC,GA4BRC,IAAOH,GAIPI,IAAUb,EAAiB,GAC3Bc,IAAShB,EAAkB,GAC3BiB,IAAWC,EAAS;EAE1B,SAASC,EAAiB,GAAsC;;GAE9D,CADA,IAAAJ,EAAQ,kBAAA,QAAAK,EAAA,KAAAL,GAAgBM,CAAU,GAClCP,EAAK,SAASO,CAAU;EAC1B;EAEA,IAAM,EAAE,WAAQ,WAAQ,kBAAe,sBAAmBjB,EAAmB;GAC3E,cAAcQ,EAAM;GACpB,gBAAgBA,EAAM;GACtB,mBACE;;IAAM,QAAA,KAAA,IAAAA,EAAA,gBAAA,OAAeG,EAAQ,cAAvBQ,MAAuB,OAAeP,EAAO,MAAM,cAA5BM;GAA4B;GAC3D,aAAaV,EAAM;GACnB,oBAAoB;;IAAQ,QAAA,IAAAG,EAAA,UAAA,OAASC,EAAO,MAAM,QAAtBQ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AA5D,EAAA,GAAAC,EAoBM,OAAA;IAnBA,SAAA;IAAJ,KAAI0E;IACJ,iBAAc;IACd,OAAM;IACL,kBAAgBzE,EAAA2E,CAAA;IAChB,iBAAerD,EAAA,YAAQ;IACvB,qBAAA,IAAkBtB,EAAA4E,CAAA,MAAA,OAAA,KAAA,IAAAN,EAAQ;IAC1B,gBAActE,EAAA2D,CAAA,IAAa,SAAY,KAAA;IACvC,OAAK1D,EAASD,EAAA2D,CAAA,IAAwC;KAAA,WAAA,GAAA3D,EAAA6D,CAAA,IAAU,GAAA;KAAA,UAAA;IAAA,IAAwC,KAAA,C;IAKxG,UAAMiB,EAAA,OAAA,EAAA,MAAE,GAAAC,MAAA/E,EAAAgF,CAAA,KAAAhF,EAAAgF,CAAA,CAAA,CAAA,GAAAD,CAAA;;IAET7E,EAAgBF,EAAAkD,CAAA,CAAA;IAChB/C,EAEM,OAFNa,GAEM,CADJd,EAAQF,EAAAuD,EAAA,CAAA,C;IAEVrD,EAAgBF,EAAAqD,EAAA,CAAA"}
@@ -0,0 +1,28 @@
1
+ // src/core/adapters.ts
2
+ function e(e) {
3
+ if (!e || typeof e != "object") return !1;
4
+ let t = e;
5
+ return typeof t.id == "string" && typeof t.highlight == "function";
6
+ }
7
+ function t(e) {
8
+ if (!e || typeof e != "object") return !1;
9
+ let t = e;
10
+ return typeof t.id == "string" && typeof t.render == "function";
11
+ }
12
+ function n(e) {
13
+ if (!e || typeof e != "object") return !1;
14
+ let t = e;
15
+ return typeof t.id == "string" && typeof t.render == "function";
16
+ }
17
+ function r(e) {
18
+ return !e || typeof e != "object" ? !1 : typeof e.format == "function";
19
+ }
20
+ function i(e) {
21
+ return !e || typeof e != "object" ? !1 : typeof e.slug == "function";
22
+ }
23
+ function a(e) {
24
+ return typeof e == "function";
25
+ }
26
+ export { i as a, n as i, e as n, a as o, t as r, r as t };
27
+
28
+ //# sourceMappingURL=adapters-CMwX_NEI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters-CMwX_NEI.js","names":["isValidHighlighter","value","adapter","isValidMathEngine","isValidMermaidRenderer","isValidDiagnosticFormatter","isValidSlugger","isValidUrlTransform"],"sources":["../../src/core/adapters.ts"],"sourcesContent":["import type {\r\n DiagnosticFormatter,\r\n MarkdownHighlighter,\r\n MarkdownSlugger,\r\n MarkdownUrlTransform,\r\n MathEngine,\r\n MermaidRenderer,\r\n} from './types'\r\n\r\nexport function isValidHighlighter(value: unknown): value is MarkdownHighlighter {\r\n if (!value || typeof value !== 'object') return false\r\n const adapter = value as MarkdownHighlighter\r\n return typeof adapter.id === 'string' && typeof adapter.highlight === 'function'\r\n}\r\n\r\nexport function isValidMathEngine(value: unknown): value is MathEngine {\r\n if (!value || typeof value !== 'object') return false\r\n const adapter = value as MathEngine\r\n return typeof adapter.id === 'string' && typeof adapter.render === 'function'\r\n}\r\n\r\nexport function isValidMermaidRenderer(value: unknown): value is MermaidRenderer {\r\n if (!value || typeof value !== 'object') return false\r\n const adapter = value as MermaidRenderer\r\n return typeof adapter.id === 'string' && typeof adapter.render === 'function'\r\n}\r\n\r\nexport function isValidDiagnosticFormatter(\r\n value: unknown,\r\n): value is DiagnosticFormatter {\r\n if (!value || typeof value !== 'object') return false\r\n return typeof (value as DiagnosticFormatter).format === 'function'\r\n}\r\n\r\nexport function isValidSlugger(value: unknown): value is MarkdownSlugger {\r\n if (!value || typeof value !== 'object') return false\r\n return typeof (value as MarkdownSlugger).slug === 'function'\r\n}\r\n\r\nexport function isValidUrlTransform(\r\n value: unknown,\r\n): value is MarkdownUrlTransform {\r\n return typeof value === 'function'\r\n}\r\n"],"mappings":";AASA,SAAgBA,EAAmB,GAA8C;CAC/E,IAAI,CAACC,KAAS,OAAOA,KAAU,UAAU,OAAO;CAChD,IAAMC,IAAUD;CAChB,OAAO,OAAOC,EAAQ,MAAO,YAAY,OAAOA,EAAQ,aAAc;AACxE;AAEA,SAAgBC,EAAkB,GAAqC;CACrE,IAAI,CAACF,KAAS,OAAOA,KAAU,UAAU,OAAO;CAChD,IAAMC,IAAUD;CAChB,OAAO,OAAOC,EAAQ,MAAO,YAAY,OAAOA,EAAQ,UAAW;AACrE;AAEA,SAAgBE,EAAuB,GAA0C;CAC/E,IAAI,CAACH,KAAS,OAAOA,KAAU,UAAU,OAAO;CAChD,IAAMC,IAAUD;CAChB,OAAO,OAAOC,EAAQ,MAAO,YAAY,OAAOA,EAAQ,UAAW;AACrE;AAEA,SAAgBG,EACd,GAC8B;CAE9B,OADI,CAACJ,KAAS,OAAOA,KAAU,WAAiB,KACzC,OAAQA,EAA8B,UAAW;AAC1D;AAEA,SAAgBK,EAAe,GAA0C;CAEvE,OADI,CAACL,KAAS,OAAOA,KAAU,WAAiB,KACzC,OAAQA,EAA0B,QAAS;AACpD;AAEA,SAAgBM,EACd,GAC+B;CAC/B,OAAO,OAAON,KAAU;AAC1B"}
@@ -0,0 +1,26 @@
1
+ // \0@oxc-project+runtime@0.155.0/helpers/esm/asyncToGenerator.js
2
+ function e(e, t, n, r, i, a, o) {
3
+ try {
4
+ var s = e[a](o), c = s.value;
5
+ } catch (e) {
6
+ n(e);
7
+ return;
8
+ }
9
+ s.done ? t(c) : Promise.resolve(c).then(r, i);
10
+ }
11
+ function t(t) {
12
+ return function() {
13
+ var n = this, r = arguments;
14
+ return new Promise(function(i, a) {
15
+ var o = t.apply(n, r);
16
+ function s(t) {
17
+ e(o, i, a, s, c, "next", t);
18
+ }
19
+ function c(t) {
20
+ e(o, i, a, s, c, "throw", t);
21
+ }
22
+ s(void 0);
23
+ });
24
+ };
25
+ }
26
+ export { t };
@@ -0,0 +1,90 @@
1
+ import { _ as e, g as t, h as n, m as r, t as i, v as a } from "./micromark-factory-space-Db040TnW.js";
2
+ // node_modules/micromark-util-normalize-identifier/index.js
3
+ function o(e) {
4
+ return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
5
+ }
6
+ // node_modules/mdast-util-to-string/lib/index.js
7
+ var s = {};
8
+ function c(e, t) {
9
+ let n = t || s;
10
+ return l(e, typeof n.includeImageAlt != "boolean" || n.includeImageAlt, typeof n.includeHtml != "boolean" || n.includeHtml);
11
+ }
12
+ function l(e, t, n) {
13
+ if (d(e)) {
14
+ if ("value" in e) return e.type === "html" && !n ? "" : e.value;
15
+ if (t && "alt" in e && e.alt) return e.alt;
16
+ if ("children" in e) return u(e.children, t, n);
17
+ }
18
+ return Array.isArray(e) ? u(e, t, n) : "";
19
+ }
20
+ function u(e, t, n) {
21
+ let r = [], i = -1;
22
+ for (; ++i < e.length;) r[i] = l(e[i], t, n);
23
+ return r.join("");
24
+ }
25
+ function d(e) {
26
+ return !!(e && typeof e == "object");
27
+ }
28
+ // node_modules/micromark-util-classify-character/index.js
29
+ function f(t) {
30
+ if (t === null || n(t) || a(t)) return 1;
31
+ if (e(t)) return 2;
32
+ }
33
+ // node_modules/micromark-util-chunked/index.js
34
+ function p(e, t, n, r) {
35
+ let i = e.length, a = 0, o;
36
+ if (t = t < 0 ? -t > i ? 0 : i + t : t > i ? i : t, n = n > 0 ? n : 0, r.length < 1e4) o = Array.from(r), o.unshift(t, n), e.splice(...o);
37
+ else for (n && e.splice(t, n); a < r.length;) o = r.slice(a, a + 1e4), o.unshift(t, 0), e.splice(...o), a += 1e4, t += 1e4;
38
+ }
39
+ function m(e, t) {
40
+ return e.length > 0 ? (p(e, e.length, 0, t), e) : t;
41
+ }
42
+ // node_modules/micromark-util-combine-extensions/index.js
43
+ var h = {}.hasOwnProperty;
44
+ function g(e) {
45
+ let t = {}, n = -1;
46
+ for (; ++n < e.length;) _(t, e[n]);
47
+ return t;
48
+ }
49
+ function _(e, t) {
50
+ let n;
51
+ for (n in t) {
52
+ let r = (h.call(e, n) ? e[n] : void 0) || (e[n] = {}), i = t[n], a;
53
+ if (i) for (a in i) {
54
+ h.call(r, a) || (r[a] = []);
55
+ let e = i[a];
56
+ v(r[a], Array.isArray(e) ? e : e ? [e] : []);
57
+ }
58
+ }
59
+ }
60
+ function v(e, t) {
61
+ let n = -1, r = [];
62
+ for (; ++n < t.length;) (t[n].add === "after" ? e : r).push(t[n]);
63
+ p(e, 0, 0, r);
64
+ }
65
+ // node_modules/micromark-util-resolve-all/index.js
66
+ function y(e, t, n) {
67
+ let r = [], i = -1;
68
+ for (; ++i < e.length;) {
69
+ let a = e[i].resolveAll;
70
+ a && !r.includes(a) && (t = a(t, n), r.push(a));
71
+ }
72
+ return t;
73
+ }
74
+ // node_modules/micromark-core-commonmark/lib/blank-line.js
75
+ var b = {
76
+ partial: !0,
77
+ tokenize: x
78
+ };
79
+ function x(e, n, a) {
80
+ return o;
81
+ function o(n) {
82
+ return t(n) ? i(e, s, "linePrefix")(n) : s(n);
83
+ }
84
+ function s(e) {
85
+ return e === null || r(e) ? n(e) : a(e);
86
+ }
87
+ }
88
+ export { p as a, o as c, m as i, y as n, f as o, g as r, c as s, b as t };
89
+
90
+ //# sourceMappingURL=blank-line-Cb-JBP_5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blank-line-Cb-JBP_5.js","names":["unicodePunctuation","markdownSpace","markdownLineEndingOrSpace","markdownLineEnding","factorySpace","unicodeWhitespace","normalizeIdentifier","value","emptyOptions","toString","settings","options","one","node","includeHtml","includeImageAlt","all","result","index","values","classifyCharacter","code","splice","end","list","chunkStart","parameters","start","remove","items","push","hasOwnProperty","combineExtensions","extensions","syntaxExtension","hook","extension","left","right","constructs","before","existing","resolveAll","called","resolve","events","context","blankLine","tokenizeBlankLine","effects","after","ok","nok"],"sources":["../../node_modules/micromark-util-normalize-identifier/index.js","../../node_modules/mdast-util-to-string/lib/index.js","../../node_modules/micromark-util-classify-character/index.js","../../node_modules/micromark-util-chunked/index.js","../../node_modules/micromark-util-combine-extensions/index.js","../../node_modules/micromark-util-resolve-all/index.js","../../node_modules/micromark-core-commonmark/lib/blank-line.js"],"sourcesContent":["/**\n * Normalize an identifier (as found in references, definitions).\n *\n * Collapses markdown whitespace, trim, and then lower- and uppercase.\n *\n * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their\n * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different\n * uppercase character (U+0398 (`Θ`)).\n * So, to get a canonical form, we perform both lower- and uppercase.\n *\n * Using uppercase last makes sure keys will never interact with default\n * prototypal values (such as `constructor`): nothing in the prototype of\n * `Object` is uppercase.\n *\n * @param {string} value\n * Identifier to normalize.\n * @returns {string}\n * Normalized identifier.\n */\nexport function normalizeIdentifier(value) {\n return value\n // Collapse markdown whitespace.\n .replace(/[\\t\\n\\r ]+/g, \" \")\n // Trim.\n .replace(/^ | $/g, '')\n // Some characters are considered “uppercase”, but if their lowercase\n // counterpart is uppercased will result in a different uppercase\n // character.\n // Hence, to get that form, we perform both lower- and uppercase.\n // Upper case makes sure keys will not interact with default prototypal\n // methods: no method is uppercase.\n .toLowerCase().toUpperCase();\n}","/**\n * @typedef {import('mdast').Nodes} Nodes\n *\n * @typedef Options\n * Configuration (optional).\n * @property {boolean | null | undefined} [includeImageAlt=true]\n * Whether to use `alt` for `image`s (default: `true`).\n * @property {boolean | null | undefined} [includeHtml=true]\n * Whether to use `value` of HTML (default: `true`).\n */\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Get the text content of a node or list of nodes.\n *\n * Prefers the node’s plain-text fields, otherwise serializes its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} [value]\n * Thing to serialize, typically `Node`.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Serialized `value`.\n */\nexport function toString(value, options) {\n const settings = options || emptyOptions\n const includeImageAlt =\n typeof settings.includeImageAlt === 'boolean'\n ? settings.includeImageAlt\n : true\n const includeHtml =\n typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true\n\n return one(value, includeImageAlt, includeHtml)\n}\n\n/**\n * One node or several nodes.\n *\n * @param {unknown} value\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized node.\n */\nfunction one(value, includeImageAlt, includeHtml) {\n if (node(value)) {\n if ('value' in value) {\n return value.type === 'html' && !includeHtml ? '' : value.value\n }\n\n if (includeImageAlt && 'alt' in value && value.alt) {\n return value.alt\n }\n\n if ('children' in value) {\n return all(value.children, includeImageAlt, includeHtml)\n }\n }\n\n if (Array.isArray(value)) {\n return all(value, includeImageAlt, includeHtml)\n }\n\n return ''\n}\n\n/**\n * Serialize a list of nodes.\n *\n * @param {Array<unknown>} values\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized nodes.\n */\nfunction all(values, includeImageAlt, includeHtml) {\n /** @type {Array<string>} */\n const result = []\n let index = -1\n\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt, includeHtml)\n }\n\n return result.join('')\n}\n\n/**\n * Check if `value` looks like a node.\n *\n * @param {unknown} value\n * Thing.\n * @returns {value is Nodes}\n * Whether `value` is a node.\n */\nfunction node(value) {\n return Boolean(value && typeof value === 'object')\n}\n","/**\n * @import {Code} from 'micromark-util-types'\n */\n\nimport { markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character';\n/**\n * Classify whether a code represents whitespace, punctuation, or something\n * else.\n *\n * Used for attention (emphasis, strong), whose sequences can open or close\n * based on the class of surrounding characters.\n *\n * > 👉 **Note**: eof (`null`) is seen as whitespace.\n *\n * @param {Code} code\n * Code.\n * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}\n * Group.\n */\nexport function classifyCharacter(code) {\n if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n return 1;\n }\n if (unicodePunctuation(code)) {\n return 2;\n }\n}","/**\n * Like `Array#splice`, but smarter for giant arrays.\n *\n * `Array#splice` takes all items to be inserted as individual argument which\n * causes a stack overflow in V8 when trying to insert 100k items for instance.\n *\n * Otherwise, this does not return the removed items, and takes `items` as an\n * array instead of rest parameters.\n *\n * @template {unknown} T\n * Item type.\n * @param {Array<T>} list\n * List to operate on.\n * @param {number} start\n * Index to remove/insert at (can be negative).\n * @param {number} remove\n * Number of items to remove.\n * @param {Array<T>} items\n * Items to inject into `list`.\n * @returns {undefined}\n * Nothing.\n */\nexport function splice(list, start, remove, items) {\n const end = list.length;\n let chunkStart = 0;\n /** @type {Array<unknown>} */\n let parameters;\n\n // Make start between zero and `end` (included).\n if (start < 0) {\n start = -start > end ? 0 : end + start;\n } else {\n start = start > end ? end : start;\n }\n remove = remove > 0 ? remove : 0;\n\n // No need to chunk the items if there’s only a couple (10k) items.\n if (items.length < 10000) {\n parameters = Array.from(items);\n parameters.unshift(start, remove);\n // @ts-expect-error Hush, it’s fine.\n list.splice(...parameters);\n } else {\n // Delete `remove` items starting from `start`\n if (remove) list.splice(start, remove);\n\n // Insert the items in chunks to not cause stack overflows.\n while (chunkStart < items.length) {\n parameters = items.slice(chunkStart, chunkStart + 10000);\n parameters.unshift(start, 0);\n // @ts-expect-error Hush, it’s fine.\n list.splice(...parameters);\n chunkStart += 10000;\n start += 10000;\n }\n }\n}\n\n/**\n * Append `items` (an array) at the end of `list` (another array).\n * When `list` was empty, returns `items` instead.\n *\n * This prevents a potentially expensive operation when `list` is empty,\n * and adds items in batches to prevent V8 from hanging.\n *\n * @template {unknown} T\n * Item type.\n * @param {Array<T>} list\n * List to operate on.\n * @param {Array<T>} items\n * Items to add to `list`.\n * @returns {Array<T>}\n * Either `list` or `items`.\n */\nexport function push(list, items) {\n if (list.length > 0) {\n splice(list, list.length, 0, items);\n return list;\n }\n return items;\n}","/**\n * @import {\n * Extension,\n * Handles,\n * HtmlExtension,\n * NormalizedExtension\n * } from 'micromark-util-types'\n */\n\nimport {splice} from 'micromark-util-chunked'\n\nconst hasOwnProperty = {}.hasOwnProperty\n\n/**\n * Combine multiple syntax extensions into one.\n *\n * @param {ReadonlyArray<Extension>} extensions\n * List of syntax extensions.\n * @returns {NormalizedExtension}\n * A single combined extension.\n */\nexport function combineExtensions(extensions) {\n /** @type {NormalizedExtension} */\n const all = {}\n let index = -1\n\n while (++index < extensions.length) {\n syntaxExtension(all, extensions[index])\n }\n\n return all\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {NormalizedExtension} all\n * Extension to merge into.\n * @param {Extension} extension\n * Extension to merge.\n * @returns {undefined}\n * Nothing.\n */\nfunction syntaxExtension(all, extension) {\n /** @type {keyof Extension} */\n let hook\n\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n /** @type {Record<string, unknown>} */\n const left = maybe || (all[hook] = {})\n /** @type {Record<string, unknown> | undefined} */\n const right = extension[hook]\n /** @type {string} */\n let code\n\n if (right) {\n for (code in right) {\n if (!hasOwnProperty.call(left, code)) left[code] = []\n const value = right[code]\n constructs(\n // @ts-expect-error Looks like a list.\n left[code],\n Array.isArray(value) ? value : value ? [value] : []\n )\n }\n }\n }\n}\n\n/**\n * Merge `list` into `existing` (both lists of constructs).\n * Mutates `existing`.\n *\n * @param {Array<unknown>} existing\n * List of constructs to merge into.\n * @param {Array<unknown>} list\n * List of constructs to merge.\n * @returns {undefined}\n * Nothing.\n */\nfunction constructs(existing, list) {\n let index = -1\n /** @type {Array<unknown>} */\n const before = []\n\n while (++index < list.length) {\n // @ts-expect-error Looks like an object.\n ;(list[index].add === 'after' ? existing : before).push(list[index])\n }\n\n splice(existing, 0, 0, before)\n}\n\n/**\n * Combine multiple HTML extensions into one.\n *\n * @param {ReadonlyArray<HtmlExtension>} htmlExtensions\n * List of HTML extensions.\n * @returns {HtmlExtension}\n * Single combined HTML extension.\n */\nexport function combineHtmlExtensions(htmlExtensions) {\n /** @type {HtmlExtension} */\n const handlers = {}\n let index = -1\n\n while (++index < htmlExtensions.length) {\n htmlExtension(handlers, htmlExtensions[index])\n }\n\n return handlers\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {HtmlExtension} all\n * Extension to merge into.\n * @param {HtmlExtension} extension\n * Extension to merge.\n * @returns {undefined}\n * Nothing.\n */\nfunction htmlExtension(all, extension) {\n /** @type {keyof HtmlExtension} */\n let hook\n\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n const left = maybe || (all[hook] = {})\n const right = extension[hook]\n /** @type {keyof Handles} */\n let type\n\n if (right) {\n for (type in right) {\n // @ts-expect-error assume document vs regular handler are managed correctly.\n left[type] = right[type]\n }\n }\n }\n}\n","/**\n * @import {Event, Resolver, TokenizeContext} from 'micromark-util-types'\n */\n\n/**\n * Call all `resolveAll`s.\n *\n * @param {ReadonlyArray<{resolveAll?: Resolver | undefined}>} constructs\n * List of constructs, optionally with `resolveAll`s.\n * @param {Array<Event>} events\n * List of events.\n * @param {TokenizeContext} context\n * Context used by `tokenize`.\n * @returns {Array<Event>}\n * Changed events.\n */\nexport function resolveAll(constructs, events, context) {\n /** @type {Array<Resolver>} */\n const called = []\n let index = -1\n\n while (++index < constructs.length) {\n const resolve = constructs[index].resolveAll\n\n if (resolve && !called.includes(resolve)) {\n events = resolve(events, context)\n called.push(resolve)\n }\n }\n\n return events\n}\n","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const blankLine = {\n partial: true,\n tokenize: tokenizeBlankLine\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLine(effects, ok, nok) {\n return start;\n\n /**\n * Start of blank line.\n *\n * > 👉 **Note**: `␠` represents a space character.\n *\n * ```markdown\n * > | ␠␠␊\n * ^\n * > | ␊\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n return markdownSpace(code) ? factorySpace(effects, after, \"linePrefix\")(code) : after(code);\n }\n\n /**\n * At eof/eol, after optional whitespace.\n *\n * > 👉 **Note**: `␠` represents a space character.\n *\n * ```markdown\n * > | ␠␠␊\n * ^\n * > | ␊\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n return code === null || markdownLineEnding(code) ? ok(code) : nok(code);\n }\n}"],"ignoreList":[0,1,2,3,4,5,6],"mappings":";;AAmBA,SAAgBM,EAAoB,GAAO;CACzC,OAAOC,EAEN,QAAQ,eAAe,GAAG,CAAC,CAE3B,QAAQ,UAAU,EAAE,CAAC,CAOrB,YAAY,CAAC,CAAC,YAAY;AAC7B;;ACpBA,IAAMC,IAAe,CAAC;AAetB,SAAgBC,EAAS,GAAO,GAAS;CACvC,IAAMC,IAAWC,KAAWH;CAQ5B,OAAOI,EAAIL,GANT,OAAOG,EAAS,mBAAoB,aAChCA,EAAS,iBAGb,OAAOA,EAAS,eAAgB,aAAYA,EAAS,WAET;AAChD;AAcA,SAASE,EAAI,GAAO,GAAiB,GAAa;CAChD,IAAIC,EAAKN,CAAK,GAAG;EACf,IAAI,WAAWA,GACb,OAAOA,EAAM,SAAS,UAAU,CAACO,IAAc,KAAKP,EAAM;EAG5D,IAAIQ,KAAmB,SAASR,KAASA,EAAM,KAC7C,OAAOA,EAAM;EAGf,IAAI,cAAcA,GAChB,OAAOS,EAAIT,EAAM,UAAUQ,GAAiBD,CAAW;CAE3D;CAMA,OAJI,MAAM,QAAQP,CAAK,IACdS,EAAIT,GAAOQ,GAAiBD,CAAW,IAGzC;AACT;AAcA,SAASE,EAAI,GAAQ,GAAiB,GAAa;CAEjD,IAAMC,IAAS,CAAC,GACZC,IAAQ;CAEZ,OAAO,EAAEA,IAAQC,EAAO,SACtB,EAAOD,KAASN,EAAIO,EAAOD,IAAQH,GAAiBD,CAAW;CAGjE,OAAOG,EAAO,KAAK,EAAE;AACvB;AAUA,SAASJ,EAAK,GAAO;CACnB,OAAO,GAAQN,KAAS,OAAOA,KAAU;AAC3C;;ACxFA,SAAgBa,EAAkB,GAAM;CACtC,IAAIC,MAAS,QAAQnB,EAA0BmB,CAAI,KAAKhB,EAAk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=> ({}),
6
+ token(e) {
7
+ return e.sol() && e.eatSpace(), e.match(/^\s*(graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|journey|gantt|pie|mindmap|timeline|gitGraph|quadrantChart|requirementDiagram|C4Context)\b/) ? "keyword" : e.match(/%%[^\n]*/) ? (e.skipToEnd(), "comment") : e.match(/"[^"]*"/) ? "string" : e.match(/-->|---|==>|-.->|--x|--o|<\|--|\|\|--|\.\.>/) ? "operator" : e.match(/[{}[\]()]/) ? "bracket" : (e.next(), null);
8
+ }
9
+ };
10
+ }
11
+ function n(e, t) {
12
+ return r.apply(this, arguments);
13
+ }
14
+ function r() {
15
+ return r = e(function* (e, n) {
16
+ let [r, i, a, o] = yield Promise.all([
17
+ import("@codemirror/view"),
18
+ import("@codemirror/state"),
19
+ import("@codemirror/language"),
20
+ import("@codemirror/commands")
21
+ ]), { EditorView: s, keymap: c, placeholder: l } = r, { EditorState: u } = i, { StreamLanguage: d } = a, { defaultKeymap: f, history: p, historyKeymap: m } = o, h = s.theme({
22
+ "&": {
23
+ height: "100%",
24
+ backgroundColor: "var(--vmd-code-bg, #f6f8fa)",
25
+ color: "var(--vmd-code-text, #1f2328)",
26
+ fontSize: "var(--vmd-font-size-sm, 0.875rem)"
27
+ },
28
+ ".cm-content": {
29
+ fontFamily: "var(--vmd-font-mono, monospace)",
30
+ padding: "0.75rem"
31
+ },
32
+ ".cm-gutters": {
33
+ backgroundColor: "var(--vmd-code-toolbar-bg, #eef1f4)",
34
+ color: "var(--vmd-color-muted, #59636e)",
35
+ border: "none"
36
+ },
37
+ "&.cm-focused": { outline: "none" }
38
+ }), g = new s({
39
+ parent: e,
40
+ state: u.create({
41
+ doc: n.value,
42
+ extensions: [
43
+ p(),
44
+ c.of([...f, ...m]),
45
+ d.define(t()),
46
+ l("Write Mermaid source…"),
47
+ s.lineWrapping,
48
+ h,
49
+ s.updateListener.of((e) => {
50
+ e.docChanged && n.onChange(e.state.doc.toString());
51
+ })
52
+ ]
53
+ })
54
+ });
55
+ return {
56
+ destroy() {
57
+ g.destroy();
58
+ },
59
+ focus() {
60
+ g.focus();
61
+ },
62
+ setValue(e) {
63
+ e !== g.state.doc.toString() && g.dispatch({ changes: {
64
+ from: 0,
65
+ to: g.state.doc.length,
66
+ insert: e
67
+ } });
68
+ },
69
+ focusLine(e) {
70
+ let t = g.state.doc.line(Math.max(1, Math.min(e, g.state.doc.lines)));
71
+ g.dispatch({
72
+ selection: {
73
+ anchor: t.from,
74
+ head: t.to
75
+ },
76
+ scrollIntoView: !0
77
+ }), g.focus();
78
+ }
79
+ };
80
+ }), r.apply(this, arguments);
81
+ }
82
+ export { n as t };
83
+
84
+ //# sourceMappingURL=codemirror-DyphMAEg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codemirror-DyphMAEg.js","names":["_asyncToGenerator","mermaidMode","stream","createMermaidEditor","_createMermaidEditor","viewModule","stateModule","languageModule","commandsModule","theme","EditorView","view","EditorState","options","history","keymap","defaultKeymap","historyKeymap","StreamLanguage","placeholder","update","value","docLine","line"],"sources":["../../src/editor/codemirror.ts"],"sourcesContent":["import type { EditorView } from '@codemirror/view'\r\n\r\nexport interface MermaidEditorHandle {\r\n destroy(): void\r\n focus(): void\r\n setValue(value: string): void\r\n focusLine(line: number): void\r\n}\r\n\r\nexport interface CreateEditorOptions {\r\n value: string\r\n theme?: 'light' | 'dark' | 'auto' | 'custom'\r\n onChange(value: string): void\r\n}\r\n\r\n/**\r\n * Minimal Mermaid tokenizer. CodeMirror has no official Mermaid language\r\n * package, so a StreamLanguage keeps the editor lazy and dependency-free.\r\n */\r\nfunction mermaidMode() {\r\n return {\r\n startState: () => ({}),\r\n token(stream: {\r\n sol(): boolean\r\n eatSpace(): boolean\r\n match(pattern: RegExp): boolean\r\n next(): string | undefined\r\n skipToEnd(): void\r\n }) {\r\n if (stream.sol()) stream.eatSpace()\r\n if (stream.match(/^\\s*(graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|journey|gantt|pie|mindmap|timeline|gitGraph|quadrantChart|requirementDiagram|C4Context)\\b/)) {\r\n return 'keyword'\r\n }\r\n if (stream.match(/%%[^\\n]*/)) {\r\n stream.skipToEnd()\r\n return 'comment'\r\n }\r\n if (stream.match(/\"[^\"]*\"/)) return 'string'\r\n if (stream.match(/-->|---|==>|-.->|--x|--o|<\\|--|\\|\\|--|\\.\\.>/)) {\r\n return 'operator'\r\n }\r\n if (stream.match(/[{}[\\]()]/)) return 'bracket'\r\n stream.next()\r\n return null\r\n },\r\n }\r\n}\r\n\r\nexport async function createMermaidEditor(\r\n parent: HTMLElement,\r\n options: CreateEditorOptions,\r\n): Promise<MermaidEditorHandle> {\r\n const [viewModule, stateModule, languageModule, commandsModule] =\r\n await Promise.all([\r\n import('@codemirror/view'),\r\n import('@codemirror/state'),\r\n import('@codemirror/language'),\r\n import('@codemirror/commands'),\r\n ])\r\n\r\n const { EditorView, keymap, placeholder } = viewModule\r\n const { EditorState } = stateModule\r\n const { StreamLanguage } = languageModule\r\n const { defaultKeymap, history, historyKeymap } = commandsModule\r\n\r\n const theme = EditorView.theme({\r\n '&': {\r\n height: '100%',\r\n backgroundColor: 'var(--vmd-code-bg, #f6f8fa)',\r\n color: 'var(--vmd-code-text, #1f2328)',\r\n fontSize: 'var(--vmd-font-size-sm, 0.875rem)',\r\n },\r\n '.cm-content': {\r\n fontFamily: 'var(--vmd-font-mono, monospace)',\r\n padding: '0.75rem',\r\n },\r\n '.cm-gutters': {\r\n backgroundColor: 'var(--vmd-code-toolbar-bg, #eef1f4)',\r\n color: 'var(--vmd-color-muted, #59636e)',\r\n border: 'none',\r\n },\r\n '&.cm-focused': { outline: 'none' },\r\n })\r\n\r\n const view = new EditorView({\r\n parent,\r\n state: EditorState.create({\r\n doc: options.value,\r\n extensions: [\r\n history(),\r\n keymap.of([...defaultKeymap, ...historyKeymap]),\r\n StreamLanguage.define(mermaidMode() as never),\r\n placeholder('Write Mermaid source…'),\r\n EditorView.lineWrapping,\r\n theme,\r\n EditorView.updateListener.of((update) => {\r\n if (update.docChanged) options.onChange(update.state.doc.toString())\r\n }),\r\n ],\r\n }),\r\n })\r\n\r\n return {\r\n destroy() {\r\n view.destroy()\r\n },\r\n focus() {\r\n view.focus()\r\n },\r\n setValue(value: string) {\r\n if (value !== view.state.doc.toString()) {\r\n view.dispatch({\r\n changes: { from: 0, to: view.state.doc.length, insert: value },\r\n })\r\n }\r\n },\r\n focusLine(line: number) {\r\n const docLine = view.state.doc.line(Math.max(1, Math.min(line, view.state.doc.lines)))\r\n view.dispatch({\r\n selection: { anchor: docLine.from, head: docLine.to },\r\n scrollIntoView: true,\r\n })\r\n view.focus()\r\n },\r\n }\r\n}\r\n\r\nexport type { EditorView }\r\n"],"mappings":";;AAmBA,SAASC,IAAc;CACrB,OAAO;EACL,mBAAmB,CAAC;EACpB,MAAM,GAMH;GAeD,OAdIC,EAAO,IAAI,KAAGA,EAAO,SAAS,GAC9BA,EAAO,MAAM,oKAAoK,IAC5K,YAELA,EAAO,MAAM,UAAU,KACzBA,EAAO,UAAU,GACV,aAELA,EAAO,MAAM,SAAS,IAAU,WAChCA,EAAO,MAAM,6CAA6C,IACrD,aAELA,EAAO,MAAM,WAAW,IAAU,aACtCA,EAAO,KAAK,GACL;EACT;CACF;AACF;AAEA,SAAsBC,EACpB,GACA,GAAA;;;;C,OADA,IAAAH,EAAA,WAAA,GACA,GAC8B;EAC9B,IAAM,CAACK,GAAYC,GAAaC,GAAgBC,KAC9C,MAAM,QAAQ,IAAI;GAChB,OAAO;GACP,OAAO;GACP,OAAO;GACP,OAAO;EACT,CAAC,GAEG,EAAE,eAAY,WAAQ,mBAAgBH,GACtC,EAAE,mBAAgBC,GAClB,EAAE,sBAAmBC,GACrB,EAAE,kBAAe,YAAS,qBAAkBC,GAE5CC,IAAQC,EAAW,MAAM;GAC7B,KAAK;IACH,QAAQ;IACR,iBAAiB;IACjB,OAAO;IACP,UAAU;GACZ;GACA,eAAe;IACb,YAAY;IACZ,SAAS;GACX;GACA,eAAe;IACb,iBAAiB;IACjB,OAAO;IACP,QAAQ;GACV;GACA,gBAAgB,EAAE,SAAS,OAAO;EACpC,CAAC,GAEKC,IAAO,IAAID,EAAW;GAC1B;GACA,OAAOE,EAAY,OAAO;IACxB,KAAKC,EAAQ;IACb,YAAY;KACVC,EAAQ;KACRC,EAAO,GAAG,CAAC,GAAGC,GAAe,GAAGC,CAAa,CAAC;KAC9CC,EAAe,OAAOjB,EAAY,CAAU;KAC5CkB,EAAY,uBAAuB;KACnCT,EAAW;KACXD;KACAC,EAAW,eAAe,IAAI,MAAW;MACvC,AAAIU,EAAO,cAAYP,EAAQ,SAASO,EAAO,MAAM,IAAI,SAAS,CAAC;KACrE,CAAC;IACH;GACF,CAAC;EACH,CAAC;EAED,OAAO;GACL,UAAU;IACR,EAAK,QAAQ;GACf;GACA,QAAQ;IACN,EAAK,MAAM;GACb;GACA,SAAS,GAAe;IACtB,AAAIC,MAAUV,EAAK,MAAM,IAAI,SAAS,KACpCA,EAAK,SAAS,EACZ,SAAS;KAAE,MAAM;KAAG,IAAIA,EAAK,MAAM,IAAI;KAAQ,QAAQU;IAAM,EAC/D,CAAC;GAEL;GACA,UAAU,GAAc;IACtB,IAAMC,IAAUX,EAAK,MAAM,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,IAAIY,GAAMZ,EAAK,MAAM,IAAI,KAAK,CAAC,CAAC;IAKrF,AAJAA,EAAK,SAAS;KACZ,WAAW;MAAE,QAAQW,EAAQ;MAAM,MAAMA,EAAQ;KAAG;KACpD,gBAAgB;IAClB,CAAC,GACDX,EAAK,MAAM;GACb;EACF;CACF,CAAA,G"}
@@ -0,0 +1,12 @@
1
+ import { computed as e, inject as t, provide as n } from "vue";
2
+ // src/components/config.ts
3
+ var r = Symbol("@coderminer/vue-markdown:config");
4
+ function i() {
5
+ return t(r, e(() => ({})));
6
+ }
7
+ function a(e) {
8
+ n(r, e);
9
+ }
10
+ export { a as n, i as r, r as t };
11
+
12
+ //# sourceMappingURL=config-aRYo2R8_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-aRYo2R8_.js","names":["MARKDOWN_CONFIG","useMarkdownConfig","inject","computed","provideMarkdownConfig","config"],"sources":["../../src/components/config.ts"],"sourcesContent":["import {\r\n computed,\r\n inject,\r\n provide,\r\n type ComputedRef,\r\n type InjectionKey,\r\n} from 'vue'\r\nimport type { MarkdownConfig } from '../core/types'\r\n\r\nexport const MARKDOWN_CONFIG: InjectionKey<ComputedRef<MarkdownConfig>> = Symbol(\r\n '@coderminer/vue-markdown:config',\r\n)\r\n\r\n/** Read the nearest provider configuration, or an empty configuration. */\r\nexport function useMarkdownConfig(): ComputedRef<MarkdownConfig> {\r\n return inject(MARKDOWN_CONFIG, computed(() => ({})))\r\n}\r\n\r\n/** Provide a configuration to descendant renderers and providers. */\r\nexport function provideMarkdownConfig(\r\n config: ComputedRef<MarkdownConfig>,\r\n): void {\r\n provide(MARKDOWN_CONFIG, config)\r\n}\r\n"],"mappings":";;AASA,IAAaA,IAA6D,OACxE,iCACF;AAGA,SAAgBC,IAAiD;CAC/D,OAAOC,EAAOF,GAAiBG,SAAgB,CAAC,EAAE,CAAC;AACrD;AAGA,SAAgBC,EACd,GACM;CACN,EAAQJ,GAAiBK,CAAM;AACjC"}