@md-plugins/quasar-app-extension-q-press 0.1.0-beta.2 → 0.1.0-beta.21

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 (253) hide show
  1. package/README.md +20 -15
  2. package/dist/index.js +41 -7
  3. package/dist/install.js +7 -5
  4. package/dist/q-press-globals.d.ts +49 -0
  5. package/dist/templates/init/src/_q-press/api/components/MarkdownCode.json +2 -2
  6. package/dist/templates/init/src/_q-press/api/components/MarkdownCodepen.json +6 -9
  7. package/dist/templates/init/src/_q-press/api/components/MarkdownExample.json +27 -2
  8. package/dist/templates/init/src/_q-press/components/MarkdownApi.vue +129 -84
  9. package/dist/templates/init/src/_q-press/components/MarkdownCardLink.vue +1 -1
  10. package/dist/templates/init/src/_q-press/components/MarkdownCardTitle.vue +1 -1
  11. package/dist/templates/init/src/_q-press/components/MarkdownCode.vue +71 -3
  12. package/dist/templates/init/src/_q-press/components/MarkdownCodepen.vue +316 -59
  13. package/dist/templates/init/src/_q-press/components/MarkdownCopyButton.vue +1 -1
  14. package/dist/templates/init/src/_q-press/components/MarkdownExample.vue +54 -19
  15. package/dist/templates/init/src/_q-press/components/MarkdownLink.vue +5 -5
  16. package/dist/templates/init/src/_q-press/components/MarkdownMermaid.vue +123 -0
  17. package/dist/templates/init/src/_q-press/components/MarkdownTree.vue +2 -2
  18. package/dist/templates/init/src/_q-press/components/markdown-utils.ts +27 -3
  19. package/dist/templates/init/src/_q-press/css/app.scss +38 -26
  20. package/dist/templates/init/src/_q-press/css/code-theme.scss +634 -0
  21. package/dist/templates/init/src/_q-press/css/themes/default.scss +1 -1
  22. package/dist/templates/init/src/_q-press/css/themes/evergreen.scss +69 -0
  23. package/dist/templates/init/src/_q-press/css/themes/mystic.scss +1 -1
  24. package/dist/templates/init/src/_q-press/css/themes/newspaper.scss +1 -1
  25. package/dist/templates/init/src/_q-press/css/themes/sunrise.scss +1 -1
  26. package/dist/templates/init/src/_q-press/css/themes/tawny.scss +1 -1
  27. package/dist/templates/init/src/_q-press/layouts/MarkdownDrawerSidebar.vue +1 -1
  28. package/dist/templates/init/src/_q-press/layouts/MarkdownDrawerToc.vue +1 -1
  29. package/dist/templates/init/src/_q-press/layouts/MarkdownHeader.vue +1 -1
  30. package/dist/templates/init/src/_q-press/layouts/MarkdownLayout.vue +2 -2
  31. package/dist/templates/init/src/_q-press/layouts/MarkdownPage.vue +4 -3
  32. package/dist/templates/init/src/_q-press/layouts/MarkdownSearch.vue +1 -1
  33. package/dist/templates/init/src/_q-press/stores/markdown.ts +1 -2
  34. package/dist/templates/init/src/components/LandingPage/LandingPage.vue +15 -1
  35. package/dist/templates/init/src/components/QPressThemeGallery.vue +336 -0
  36. package/dist/templates/init/src/components/page-parts/releases/GitHubReleases.vue +121 -0
  37. package/dist/templates/init/src/components/page-parts/releases/PackageReleases.vue +191 -0
  38. package/dist/templates/init/src/components/page-parts/releases/md-table-parser.ts +52 -0
  39. package/dist/templates/init/src/components/page-parts/releases/sanitize.ts +132 -0
  40. package/dist/templates/init/src/markdown/__elements.md +8 -8
  41. package/dist/templates/init/src/markdown/__elements2.md +4 -4
  42. package/dist/templates/init/src/markdown/faq/best-practices.md +27 -0
  43. package/dist/templates/init/src/markdown/faq/general.md +27 -0
  44. package/dist/templates/init/src/markdown/faq/troubleshooting.md +27 -0
  45. package/dist/templates/init/src/markdown/getting-started/introduction.md +7 -5
  46. package/dist/templates/init/src/markdown/md-plugins/blockquote/overview.md +3 -1
  47. package/dist/templates/init/src/markdown/md-plugins/codeblocks/advanced.md +19 -15
  48. package/dist/templates/init/src/markdown/md-plugins/codeblocks/overview.md +45 -8
  49. package/dist/templates/init/src/markdown/md-plugins/containers/overview.md +3 -1
  50. package/dist/templates/init/src/markdown/md-plugins/frontmatter/overview.md +3 -1
  51. package/dist/templates/init/src/markdown/md-plugins/headers/overview.md +3 -1
  52. package/dist/templates/init/src/markdown/md-plugins/image/overview.md +3 -1
  53. package/dist/templates/init/src/markdown/md-plugins/imports/overview.md +3 -1
  54. package/dist/templates/init/src/markdown/md-plugins/inline-code/overview.md +3 -1
  55. package/dist/templates/init/src/markdown/md-plugins/link/advanced.md +2 -2
  56. package/dist/templates/init/src/markdown/md-plugins/link/overview.md +6 -4
  57. package/dist/templates/init/src/markdown/md-plugins/mermaid/advanced.md +69 -0
  58. package/dist/templates/init/src/markdown/md-plugins/mermaid/overview.md +73 -0
  59. package/dist/templates/init/src/markdown/md-plugins/shared/overview.md +28 -13
  60. package/dist/templates/init/src/markdown/md-plugins/table/overview.md +3 -1
  61. package/dist/templates/init/src/markdown/md-plugins/title/overview.md +3 -1
  62. package/dist/templates/init/src/markdown/other/contact.md +37 -0
  63. package/dist/templates/init/src/markdown/other/contributing/bugs-and-feature-requests.md +33 -0
  64. package/dist/templates/init/src/markdown/other/contributing/call-to-action.md +25 -0
  65. package/dist/templates/init/src/markdown/other/contributing/documentation.md +31 -0
  66. package/dist/templates/init/src/markdown/other/contributing/overview.md +41 -0
  67. package/dist/templates/init/src/markdown/other/contributing/packages.md +28 -0
  68. package/dist/templates/init/src/markdown/other/contributing/sponsor.md +23 -0
  69. package/dist/templates/init/src/markdown/other/faq.md +179 -0
  70. package/dist/templates/init/src/markdown/other/releases.md +11 -0
  71. package/dist/templates/init/src/markdown/other/upgrade-guide.md +165 -0
  72. package/dist/templates/init/src/markdown/quasar-app-extensions/qpress/advanced.md +11 -3
  73. package/dist/templates/init/src/markdown/quasar-app-extensions/qpress/components.md +25 -29
  74. package/dist/templates/init/src/markdown/quasar-app-extensions/qpress/overview.md +20 -20
  75. package/dist/templates/init/src/markdown/quasar-app-extensions/qpress/site-config.md +17 -3
  76. package/dist/templates/init/src/markdown/quasar-app-extensions/qpress/themes.md +101 -9
  77. package/dist/templates/init/src/markdown/quasar-app-extensions/vite-md-plugin-app-ext/advanced.md +158 -0
  78. package/dist/templates/init/src/markdown/quasar-app-extensions/vite-md-plugin-app-ext/overview.md +1 -1
  79. package/dist/templates/init/src/markdown/vite-plugins/vite-examples-plugin/advanced.md +8 -3
  80. package/dist/templates/init/src/markdown/vite-plugins/vite-examples-plugin/overview.md +19 -5
  81. package/dist/templates/init/src/markdown/vite-plugins/vite-md-plugin/advanced.md +84 -54
  82. package/dist/templates/init/src/markdown/vite-plugins/vite-md-plugin/overview.md +19 -3
  83. package/dist/templates/init/src/siteConfig/index.ts +52 -23
  84. package/dist/templates/update/src/_q-press/api/components/MarkdownCode.json +2 -2
  85. package/dist/templates/update/src/_q-press/api/components/MarkdownCodepen.json +6 -9
  86. package/dist/templates/update/src/_q-press/api/components/MarkdownExample.json +27 -2
  87. package/dist/templates/update/src/_q-press/components/MarkdownApi.vue +129 -84
  88. package/dist/templates/update/src/_q-press/components/MarkdownCardLink.vue +1 -1
  89. package/dist/templates/update/src/_q-press/components/MarkdownCardTitle.vue +1 -1
  90. package/dist/templates/update/src/_q-press/components/MarkdownCode.vue +71 -3
  91. package/dist/templates/update/src/_q-press/components/MarkdownCodepen.vue +316 -59
  92. package/dist/templates/update/src/_q-press/components/MarkdownCopyButton.vue +1 -1
  93. package/dist/templates/update/src/_q-press/components/MarkdownExample.vue +54 -19
  94. package/dist/templates/update/src/_q-press/components/MarkdownLink.vue +5 -5
  95. package/dist/templates/update/src/_q-press/components/MarkdownMermaid.vue +123 -0
  96. package/dist/templates/update/src/_q-press/components/MarkdownTree.vue +2 -2
  97. package/dist/templates/update/src/_q-press/components/markdown-utils.ts +27 -3
  98. package/dist/templates/update/src/_q-press/css/app.scss +38 -26
  99. package/dist/templates/update/src/_q-press/css/code-theme.scss +634 -0
  100. package/dist/templates/update/src/_q-press/css/themes/default.scss +1 -1
  101. package/dist/templates/update/src/_q-press/css/themes/evergreen.scss +69 -0
  102. package/dist/templates/update/src/_q-press/css/themes/mystic.scss +1 -1
  103. package/dist/templates/update/src/_q-press/css/themes/newspaper.scss +1 -1
  104. package/dist/templates/update/src/_q-press/css/themes/sunrise.scss +1 -1
  105. package/dist/templates/update/src/_q-press/css/themes/tawny.scss +1 -1
  106. package/dist/templates/update/src/_q-press/layouts/MarkdownDrawerSidebar.vue +1 -1
  107. package/dist/templates/update/src/_q-press/layouts/MarkdownDrawerToc.vue +1 -1
  108. package/dist/templates/update/src/_q-press/layouts/MarkdownHeader.vue +1 -1
  109. package/dist/templates/update/src/_q-press/layouts/MarkdownLayout.vue +2 -2
  110. package/dist/templates/update/src/_q-press/layouts/MarkdownPage.vue +4 -3
  111. package/dist/templates/update/src/_q-press/layouts/MarkdownSearch.vue +1 -1
  112. package/dist/templates/update/src/_q-press/stores/markdown.ts +1 -2
  113. package/package.json +22 -21
  114. package/src/index.ts +80 -11
  115. package/src/install.ts +10 -9
  116. package/src/q-press-globals.d.ts +49 -0
  117. package/src/templates/init/src/_q-press/api/components/MarkdownCode.json +2 -2
  118. package/src/templates/init/src/_q-press/api/components/MarkdownCodepen.json +6 -9
  119. package/src/templates/init/src/_q-press/api/components/MarkdownExample.json +27 -2
  120. package/src/templates/init/src/_q-press/components/MarkdownApi.vue +129 -84
  121. package/src/templates/init/src/_q-press/components/MarkdownCardLink.vue +1 -1
  122. package/src/templates/init/src/_q-press/components/MarkdownCardTitle.vue +1 -1
  123. package/src/templates/init/src/_q-press/components/MarkdownCode.vue +71 -3
  124. package/src/templates/init/src/_q-press/components/MarkdownCodepen.vue +316 -59
  125. package/src/templates/init/src/_q-press/components/MarkdownCopyButton.vue +1 -1
  126. package/src/templates/init/src/_q-press/components/MarkdownExample.vue +54 -19
  127. package/src/templates/init/src/_q-press/components/MarkdownLink.vue +5 -5
  128. package/src/templates/init/src/_q-press/components/MarkdownMermaid.vue +123 -0
  129. package/src/templates/init/src/_q-press/components/MarkdownTree.vue +2 -2
  130. package/src/templates/init/src/_q-press/components/markdown-utils.ts +27 -3
  131. package/src/templates/init/src/_q-press/css/app.scss +38 -26
  132. package/src/templates/init/src/_q-press/css/code-theme.scss +634 -0
  133. package/src/templates/init/src/_q-press/css/themes/default.scss +1 -1
  134. package/src/templates/init/src/_q-press/css/themes/evergreen.scss +69 -0
  135. package/src/templates/init/src/_q-press/css/themes/mystic.scss +1 -1
  136. package/src/templates/init/src/_q-press/css/themes/newspaper.scss +1 -1
  137. package/src/templates/init/src/_q-press/css/themes/sunrise.scss +1 -1
  138. package/src/templates/init/src/_q-press/css/themes/tawny.scss +1 -1
  139. package/src/templates/init/src/_q-press/layouts/MarkdownDrawerSidebar.vue +1 -1
  140. package/src/templates/init/src/_q-press/layouts/MarkdownDrawerToc.vue +1 -1
  141. package/src/templates/init/src/_q-press/layouts/MarkdownHeader.vue +1 -1
  142. package/src/templates/init/src/_q-press/layouts/MarkdownLayout.vue +2 -2
  143. package/src/templates/init/src/_q-press/layouts/MarkdownPage.vue +4 -3
  144. package/src/templates/init/src/_q-press/layouts/MarkdownSearch.vue +1 -1
  145. package/src/templates/init/src/_q-press/stores/markdown.ts +1 -2
  146. package/src/templates/init/src/components/LandingPage/LandingPage.vue +15 -1
  147. package/src/templates/init/src/components/QPressThemeGallery.vue +336 -0
  148. package/src/templates/init/src/components/page-parts/releases/GitHubReleases.vue +121 -0
  149. package/src/templates/init/src/components/page-parts/releases/PackageReleases.vue +191 -0
  150. package/src/templates/init/src/components/page-parts/releases/md-table-parser.ts +52 -0
  151. package/src/templates/init/src/components/page-parts/releases/sanitize.ts +132 -0
  152. package/src/templates/init/src/markdown/__elements.md +8 -8
  153. package/src/templates/init/src/markdown/__elements2.md +4 -4
  154. package/src/templates/init/src/markdown/faq/best-practices.md +27 -0
  155. package/src/templates/init/src/markdown/faq/general.md +27 -0
  156. package/src/templates/init/src/markdown/faq/troubleshooting.md +27 -0
  157. package/src/templates/init/src/markdown/getting-started/introduction.md +7 -5
  158. package/src/templates/init/src/markdown/md-plugins/blockquote/overview.md +3 -1
  159. package/src/templates/init/src/markdown/md-plugins/codeblocks/advanced.md +19 -15
  160. package/src/templates/init/src/markdown/md-plugins/codeblocks/overview.md +45 -8
  161. package/src/templates/init/src/markdown/md-plugins/containers/overview.md +3 -1
  162. package/src/templates/init/src/markdown/md-plugins/frontmatter/overview.md +3 -1
  163. package/src/templates/init/src/markdown/md-plugins/headers/overview.md +3 -1
  164. package/src/templates/init/src/markdown/md-plugins/image/overview.md +3 -1
  165. package/src/templates/init/src/markdown/md-plugins/imports/overview.md +3 -1
  166. package/src/templates/init/src/markdown/md-plugins/inline-code/overview.md +3 -1
  167. package/src/templates/init/src/markdown/md-plugins/link/advanced.md +2 -2
  168. package/src/templates/init/src/markdown/md-plugins/link/overview.md +6 -4
  169. package/src/templates/init/src/markdown/md-plugins/mermaid/advanced.md +69 -0
  170. package/src/templates/init/src/markdown/md-plugins/mermaid/overview.md +73 -0
  171. package/src/templates/init/src/markdown/md-plugins/shared/overview.md +28 -13
  172. package/src/templates/init/src/markdown/md-plugins/table/overview.md +3 -1
  173. package/src/templates/init/src/markdown/md-plugins/title/overview.md +3 -1
  174. package/src/templates/init/src/markdown/other/contact.md +37 -0
  175. package/src/templates/init/src/markdown/other/contributing/bugs-and-feature-requests.md +33 -0
  176. package/src/templates/init/src/markdown/other/contributing/call-to-action.md +25 -0
  177. package/src/templates/init/src/markdown/other/contributing/documentation.md +31 -0
  178. package/src/templates/init/src/markdown/other/contributing/overview.md +41 -0
  179. package/src/templates/init/src/markdown/other/contributing/packages.md +28 -0
  180. package/src/templates/init/src/markdown/other/contributing/sponsor.md +23 -0
  181. package/src/templates/init/src/markdown/other/faq.md +179 -0
  182. package/src/templates/init/src/markdown/other/releases.md +11 -0
  183. package/src/templates/init/src/markdown/other/upgrade-guide.md +165 -0
  184. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/advanced.md +11 -3
  185. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/components.md +25 -29
  186. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/overview.md +20 -20
  187. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/site-config.md +17 -3
  188. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/themes.md +101 -9
  189. package/src/templates/init/src/markdown/quasar-app-extensions/vite-md-plugin-app-ext/advanced.md +158 -0
  190. package/src/templates/init/src/markdown/quasar-app-extensions/vite-md-plugin-app-ext/overview.md +1 -1
  191. package/src/templates/init/src/markdown/vite-plugins/vite-examples-plugin/advanced.md +8 -3
  192. package/src/templates/init/src/markdown/vite-plugins/vite-examples-plugin/overview.md +19 -5
  193. package/src/templates/init/src/markdown/vite-plugins/vite-md-plugin/advanced.md +84 -54
  194. package/src/templates/init/src/markdown/vite-plugins/vite-md-plugin/overview.md +19 -3
  195. package/src/templates/init/src/siteConfig/index.ts +52 -23
  196. package/src/templates/update/src/_q-press/api/components/MarkdownCode.json +2 -2
  197. package/src/templates/update/src/_q-press/api/components/MarkdownCodepen.json +6 -9
  198. package/src/templates/update/src/_q-press/api/components/MarkdownExample.json +27 -2
  199. package/src/templates/update/src/_q-press/components/MarkdownApi.vue +129 -84
  200. package/src/templates/update/src/_q-press/components/MarkdownCardLink.vue +1 -1
  201. package/src/templates/update/src/_q-press/components/MarkdownCardTitle.vue +1 -1
  202. package/src/templates/update/src/_q-press/components/MarkdownCode.vue +71 -3
  203. package/src/templates/update/src/_q-press/components/MarkdownCodepen.vue +316 -59
  204. package/src/templates/update/src/_q-press/components/MarkdownCopyButton.vue +1 -1
  205. package/src/templates/update/src/_q-press/components/MarkdownExample.vue +54 -19
  206. package/src/templates/update/src/_q-press/components/MarkdownLink.vue +5 -5
  207. package/src/templates/update/src/_q-press/components/MarkdownMermaid.vue +123 -0
  208. package/src/templates/update/src/_q-press/components/MarkdownTree.vue +2 -2
  209. package/src/templates/update/src/_q-press/components/markdown-utils.ts +27 -3
  210. package/src/templates/update/src/_q-press/css/app.scss +38 -26
  211. package/src/templates/update/src/_q-press/css/code-theme.scss +634 -0
  212. package/src/templates/update/src/_q-press/css/themes/default.scss +1 -1
  213. package/src/templates/update/src/_q-press/css/themes/evergreen.scss +69 -0
  214. package/src/templates/update/src/_q-press/css/themes/mystic.scss +1 -1
  215. package/src/templates/update/src/_q-press/css/themes/newspaper.scss +1 -1
  216. package/src/templates/update/src/_q-press/css/themes/sunrise.scss +1 -1
  217. package/src/templates/update/src/_q-press/css/themes/tawny.scss +1 -1
  218. package/src/templates/update/src/_q-press/layouts/MarkdownDrawerSidebar.vue +1 -1
  219. package/src/templates/update/src/_q-press/layouts/MarkdownDrawerToc.vue +1 -1
  220. package/src/templates/update/src/_q-press/layouts/MarkdownHeader.vue +1 -1
  221. package/src/templates/update/src/_q-press/layouts/MarkdownLayout.vue +2 -2
  222. package/src/templates/update/src/_q-press/layouts/MarkdownPage.vue +4 -3
  223. package/src/templates/update/src/_q-press/layouts/MarkdownSearch.vue +1 -1
  224. package/src/templates/update/src/_q-press/stores/markdown.ts +1 -2
  225. package/tsconfig.json +1 -1
  226. package/dist/templates/init/src/_q-press/api/components/MarkdownCodePrism.json +0 -29
  227. package/dist/templates/init/src/_q-press/components/MarkdownCodePrism.ts +0 -36
  228. package/dist/templates/init/src/_q-press/css/prism-theme.scss +0 -298
  229. package/dist/templates/init/src/markdown/guides/contributing.md +0 -101
  230. package/dist/templates/init/src/markdown/guides/faq.md +0 -115
  231. package/dist/templates/init/src/markdown/guides/release-notes.md +0 -0
  232. package/dist/templates/init/src/markdown/guides/style-guide.md +0 -0
  233. package/dist/templates/init/src/markdown/guides/upgrade-guide.md +0 -92
  234. package/dist/templates/init/src/markdown/other/release-notes.md +0 -8
  235. package/dist/templates/init/src/q-press.globals.d.ts +0 -36
  236. package/dist/templates/update/src/_q-press/api/components/MarkdownCodePrism.json +0 -29
  237. package/dist/templates/update/src/_q-press/components/MarkdownCodePrism.ts +0 -36
  238. package/dist/templates/update/src/_q-press/css/prism-theme.scss +0 -298
  239. package/dist/templates/update/src/q-press.globals.d.ts +0 -36
  240. package/src/templates/init/src/_q-press/api/components/MarkdownCodePrism.json +0 -29
  241. package/src/templates/init/src/_q-press/components/MarkdownCodePrism.ts +0 -36
  242. package/src/templates/init/src/_q-press/css/prism-theme.scss +0 -298
  243. package/src/templates/init/src/markdown/guides/contributing.md +0 -101
  244. package/src/templates/init/src/markdown/guides/faq.md +0 -115
  245. package/src/templates/init/src/markdown/guides/release-notes.md +0 -0
  246. package/src/templates/init/src/markdown/guides/style-guide.md +0 -0
  247. package/src/templates/init/src/markdown/guides/upgrade-guide.md +0 -92
  248. package/src/templates/init/src/markdown/other/release-notes.md +0 -8
  249. package/src/templates/init/src/q-press.globals.d.ts +0 -36
  250. package/src/templates/update/src/_q-press/api/components/MarkdownCodePrism.json +0 -29
  251. package/src/templates/update/src/_q-press/components/MarkdownCodePrism.ts +0 -36
  252. package/src/templates/update/src/_q-press/css/prism-theme.scss +0 -298
  253. package/src/templates/update/src/q-press.globals.d.ts +0 -36
@@ -0,0 +1,123 @@
1
+ <template>
2
+ <div class="markdown-mermaid q-my-md">
3
+ <div
4
+ v-if="errorMessage"
5
+ class="markdown-mermaid__error"
6
+ role="alert"
7
+ >
8
+ {{ errorMessage }}
9
+ </div>
10
+ <div
11
+ v-else-if="isRendering"
12
+ class="markdown-mermaid__loading"
13
+ >
14
+ Rendering diagram...
15
+ </div>
16
+ <div
17
+ ref="containerRef"
18
+ class="markdown-mermaid__diagram"
19
+ ></div>
20
+ </div>
21
+ </template>
22
+
23
+ <script setup lang="ts">
24
+ import { uid, useQuasar } from 'quasar'
25
+ import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
26
+
27
+ const props = defineProps<{
28
+ code: string
29
+ }>()
30
+
31
+ const $q = useQuasar()
32
+ const containerRef = ref<HTMLElement | null>(null)
33
+ const errorMessage = ref('')
34
+ const isRendering = ref(false)
35
+
36
+ let disposed = false
37
+ let renderRequest = 0
38
+
39
+ async function renderDiagram(): Promise<void> {
40
+ if (import.meta.env.QUASAR_CLIENT !== true || containerRef.value === null) {
41
+ return
42
+ }
43
+
44
+ const requestId = ++renderRequest
45
+
46
+ errorMessage.value = ''
47
+ isRendering.value = true
48
+
49
+ await nextTick()
50
+
51
+ try {
52
+ const { default: mermaid } = await import('mermaid')
53
+
54
+ mermaid.initialize({
55
+ securityLevel: 'strict',
56
+ startOnLoad: false,
57
+ theme: $q.dark.isActive === true ? 'dark' : 'default',
58
+ })
59
+
60
+ const { svg, bindFunctions } = await mermaid.render(`markdown-mermaid-${uid()}`, props.code)
61
+
62
+ if (disposed === true || requestId !== renderRequest || containerRef.value === null) {
63
+ return
64
+ }
65
+
66
+ containerRef.value.innerHTML = svg
67
+ bindFunctions?.(containerRef.value)
68
+ } catch (error) {
69
+ if (disposed === false && requestId === renderRequest) {
70
+ errorMessage.value = error instanceof Error ? error.message : 'Unable to render diagram.'
71
+ }
72
+ } finally {
73
+ if (disposed === false && requestId === renderRequest) {
74
+ isRendering.value = false
75
+ }
76
+ }
77
+ }
78
+
79
+ onMounted(() => {
80
+ void renderDiagram()
81
+ })
82
+
83
+ watch(
84
+ () => [props.code, $q.dark.isActive] as const,
85
+ () => {
86
+ void renderDiagram()
87
+ },
88
+ )
89
+
90
+ onBeforeUnmount(() => {
91
+ disposed = true
92
+ })
93
+ </script>
94
+
95
+ <style lang="scss">
96
+ .markdown-mermaid {
97
+ border: 1px solid var(--q-separator-color);
98
+ border-radius: 8px;
99
+ overflow-x: auto;
100
+ padding: 1rem;
101
+
102
+ &__diagram {
103
+ min-width: 100%;
104
+ text-align: center;
105
+
106
+ svg {
107
+ max-width: 100%;
108
+ height: auto;
109
+ }
110
+ }
111
+
112
+ &__error {
113
+ color: var(--q-negative);
114
+ font-family: monospace;
115
+ white-space: pre-wrap;
116
+ }
117
+
118
+ &__loading {
119
+ color: var(--q-secondary);
120
+ font-style: italic;
121
+ }
122
+ }
123
+ </style>
@@ -34,8 +34,8 @@
34
34
  </q-tree>
35
35
  </template>
36
36
 
37
- <script setup>
38
- import { mdiLaunch, mdiInformationOutline } from '@quasar/extras/mdi-v6'
37
+ <script setup lang="ts">
38
+ import { mdiLaunch, mdiInformationOutline } from '@quasar/extras/mdi-v7'
39
39
 
40
40
  const props = defineProps({
41
41
  def: {
@@ -1,5 +1,31 @@
1
1
  import { Notify } from 'quasar'
2
- import { slugify } from '@md-plugins/shared'
2
+
3
+ const andRE = /&/g
4
+ const rCombining = /[\u0300-\u036F]/g
5
+ // oxlint-disable-next-line no-control-regex
6
+ const rControl = /[\u0000-\u001f]/g
7
+ const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'“”‘’<>,.?/]+/g
8
+
9
+ /**
10
+ * Default slugification function used by qPress client helpers.
11
+ */
12
+ export const slugify = (str: string): string =>
13
+ str
14
+ .trim()
15
+ .replace(/([a-z])([A-Z])/g, '$1-$2')
16
+ .replace(/[\s_]+/g, '-')
17
+ .toLowerCase()
18
+ .normalize('NFKD')
19
+ .replace(rCombining, '')
20
+ .replace(andRE, '-and-')
21
+ .replace(rControl, '-')
22
+ .replace(rSpecial, '-')
23
+ .replace(/[^a-z0-9-]+/g, '')
24
+ .replace(/([a-z])(\d)/g, '$1-$2')
25
+ .replace(/(\d)([a-z])/g, '$1-$2')
26
+ .replace(/-{2,}/g, '-')
27
+ .replace(/(^-|-$)/g, '')
28
+ .replace(/^(\d)/, '_$1')
3
29
 
4
30
  /**
5
31
  * Fallback function to copy text to clipboard when the Clipboard API is not available.
@@ -101,5 +127,3 @@ export function copyHeading(id: string): void {
101
127
  timeout: 2000,
102
128
  })
103
129
  }
104
-
105
- export { slugify }
@@ -1,7 +1,9 @@
1
1
  @use 'sass:math';
2
+ @use 'sass:color';
3
+ @use './fonts.scss';
2
4
 
3
- @import './fonts.scss';
4
- @import './prism-theme.scss';
5
+ // Keep this import so Shiki code blocks share the selected qPress theme variables.
6
+ @import './code-theme.scss';
5
7
 
6
8
  .material-icons {
7
9
  font-family: 'Material Icons';
@@ -82,9 +84,10 @@ ul {
82
84
  line-height: $font-size;
83
85
  border-radius: $generic-border-radius;
84
86
  font-family: inherit;
85
- color: scale-color($brand-primary, $lightness: -35%);
87
+ color: $brand-light-text;
88
+ background-color: rgba($brand-primary, 0.08);
86
89
  vertical-align: baseline;
87
- border: 1px solid currentColor;
90
+ border: 1px solid rgba($brand-primary, 0.5);
88
91
  }
89
92
 
90
93
  .markdown-note {
@@ -107,10 +110,13 @@ ul {
107
110
  // .markdown-note__title,
108
111
  .markdown-link,
109
112
  .markdown-token {
110
- color: scale-color($brand-primary, $lightness: -35%);
113
+ color: $brand-light-text;
114
+ }
115
+ .markdown-link {
116
+ border-bottom-color: rgba($brand-primary, 0.78);
111
117
  }
112
118
  .markdown-token {
113
- border-color: scale-color($brand-primary, $lightness: -35%);
119
+ border-color: rgba($brand-primary, 0.5);
114
120
  }
115
121
  & strong {
116
122
  font-weight: 700;
@@ -119,16 +125,16 @@ ul {
119
125
  }
120
126
 
121
127
  &--tip {
122
- color: scale-color($positive, $lightness: -40%) !important;
123
- background-color: scale-color($positive, $lightness: 85%);
128
+ color: color.scale($positive, $lightness: -40%) !important;
129
+ background-color: color.scale($positive, $lightness: 85%);
124
130
  border-color: $positive;
125
131
  .markdown-note__title,
126
132
  .markdown-link,
127
133
  .markdown-token {
128
- color: scale-color($positive, $lightness: -40%);
134
+ color: color.scale($positive, $lightness: -40%);
129
135
  }
130
136
  .markdown-token {
131
- border-color: scale-color($positive, $lightness: -40%);
137
+ border-color: color.scale($positive, $lightness: -40%);
132
138
  }
133
139
  & strong {
134
140
  font-weight: 700;
@@ -137,16 +143,16 @@ ul {
137
143
  }
138
144
 
139
145
  &--warning {
140
- color: scale-color($warning, $lightness: -40%);
141
- background-color: scale-color($warning, $lightness: 85%);
142
- border-color: scale-color($warning, $lightness: -30%);
146
+ color: color.scale($warning, $lightness: -40%);
147
+ background-color: color.scale($warning, $lightness: 85%);
148
+ border-color: color.scale($warning, $lightness: -30%);
143
149
  .markdown-note__title,
144
150
  .markdown-link,
145
151
  .markdown-token {
146
- color: scale-color($warning, $lightness: -40%);
152
+ color: color.scale($warning, $lightness: -40%);
147
153
  }
148
154
  .markdown-token {
149
- border-color: scale-color($warning, $lightness: -40%);
155
+ border-color: color.scale($warning, $lightness: -40%);
150
156
  }
151
157
  & strong {
152
158
  font-weight: 700;
@@ -155,8 +161,8 @@ ul {
155
161
  }
156
162
 
157
163
  &--danger {
158
- color: scale-color($negative, $lightness: -40%);
159
- background-color: scale-color($negative, $lightness: 90%);
164
+ color: color.scale($negative, $lightness: -40%);
165
+ background-color: color.scale($negative, $lightness: 90%);
160
166
  border-color: $negative;
161
167
  .markdown-note__title,
162
168
  .markdown-link,
@@ -511,7 +517,7 @@ body.q-scroll--lock .q-page > .q-scroll--anchor {
511
517
  .markdown-heading .q-badge,
512
518
  .header-badge {
513
519
  color: $brand-primary;
514
- background: scale-color($light-bg, $lightness: 15%);
520
+ background: color.scale($light-bg, $lightness: 15%);
515
521
  vertical-align: super;
516
522
  letter-spacing: $letter-spacing-brand;
517
523
  padding: 4px 8px;
@@ -552,6 +558,12 @@ $letter-spacing-list: 40, 100, 225, 263, 300, 375, 450;
552
558
  }
553
559
 
554
560
  body.body--dark {
561
+ .markdown-token {
562
+ color: $brand-dark-text;
563
+ background-color: rgba($brand-primary, 0.18);
564
+ border-color: rgba($brand-primary, 0.72);
565
+ }
566
+
555
567
  .markdown-technical {
556
568
  color: $brand-dark-text;
557
569
  background: $brand-dark-bg;
@@ -591,9 +603,9 @@ body.body--dark {
591
603
 
592
604
  .markdown-note {
593
605
  &:not(.markdown-note--tip, .markdown-note--warning, .markdown-note--danger) {
594
- color: scale-color($dark-pill, $lightness: 80%);
606
+ color: color.scale($dark-pill, $lightness: 80%);
595
607
  background-color: $dark-pill;
596
- border-color: scale-color($dark-pill, $lightness: 50%);
608
+ border-color: color.scale($dark-pill, $lightness: 50%);
597
609
  .markdown-token {
598
610
  border-color: #ddd;
599
611
  color: #ddd;
@@ -605,7 +617,7 @@ body.body--dark {
605
617
 
606
618
  &--tip {
607
619
  border-color: $positive;
608
- background-color: scale-color($positive, $lightness: -85%);
620
+ background-color: color.scale($positive, $lightness: -85%);
609
621
  .markdown-note__title,
610
622
  .markdown-link,
611
623
  .markdown-token {
@@ -618,7 +630,7 @@ body.body--dark {
618
630
 
619
631
  &--warning {
620
632
  border-color: $warning;
621
- background-color: scale-color($warning, $lightness: -85%);
633
+ background-color: color.scale($warning, $lightness: -85%);
622
634
  .markdown-note__title,
623
635
  .markdown-link,
624
636
  .markdown-token {
@@ -631,7 +643,7 @@ body.body--dark {
631
643
 
632
644
  &--danger {
633
645
  border-color: $negative;
634
- background-color: scale-color($negative, $lightness: -80%);
646
+ background-color: color.scale($negative, $lightness: -80%);
635
647
  }
636
648
  }
637
649
 
@@ -656,7 +668,7 @@ body.body--dark {
656
668
  padding: 4px 8px 4px 28px;
657
669
  position: relative;
658
670
  border-radius: 3px 5px 5px 0;
659
- background: scale-color($brand-light, $lightness: -15%);
671
+ background: color.scale($brand-light, $lightness: -15%);
660
672
  color: $brand-secondary;
661
673
  font-size: ($font-size + 2px);
662
674
  letter-spacing: $letter-spacing-brand;
@@ -670,7 +682,7 @@ body.body--dark {
670
682
  height: 0;
671
683
  border: 0 solid transparent;
672
684
  border-width: 9px 0 0 11px;
673
- border-top-color: scale-color($brand-light, $lightness: -25%);
685
+ border-top-color: color.scale($brand-light, $lightness: -25%);
674
686
  }
675
687
  }
676
688
 
@@ -678,6 +690,6 @@ body.body--dark .markdown-card-title {
678
690
  background: $brand-secondary;
679
691
  color: $dark-text;
680
692
  &:after {
681
- border-top-color: scale-color($brand-secondary, $lightness: -30%);
693
+ border-top-color: color.scale($brand-secondary, $lightness: -30%);
682
694
  }
683
695
  }