docus 2.1.0 → 3.0.0-beta.3

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 (274) hide show
  1. package/README.md +6 -4
  2. package/app/router.options.ts +18 -0
  3. package/assets/css/fonts.css +84 -0
  4. package/assets/css/main.css +11 -0
  5. package/assets/css/tailwind.css +282 -0
  6. package/components/app/Container.vue +25 -0
  7. package/components/app/Footer.vue +40 -0
  8. package/components/app/Navbar.vue +26 -0
  9. package/components/app/NavbarLogo.vue +33 -0
  10. package/components/app/Page.vue +7 -0
  11. package/components/app/PoweredByDocus.vue +11 -0
  12. package/components/content/Alert.vue +124 -0
  13. package/components/content/BlockHero.vue +54 -0
  14. package/components/content/ButtonLink.vue +45 -0
  15. package/components/content/Card.vue +46 -0
  16. package/components/content/CardGrid.vue +23 -0
  17. package/components/content/CodeBlock.vue +47 -0
  18. package/components/content/CodeGroup.vue +135 -0
  19. package/components/content/CopyButton.vue +49 -0
  20. package/{dist/runtime/app/components/prose/ProseOl.vue → components/content/List.vue} +2 -2
  21. package/components/content/NeedContribution.vue +23 -0
  22. package/components/content/ReadMore.vue +25 -0
  23. package/components/content/Sandbox.vue +102 -0
  24. package/components/content/TabsHeader.vue +44 -0
  25. package/components/content/Terminal.vue +64 -0
  26. package/components/content/VideoPlayer.vue +115 -0
  27. package/components/docs/DocsAside.vue +21 -0
  28. package/components/docs/DocsAsideTree.vue +102 -0
  29. package/components/docs/DocsHero.vue +39 -0
  30. package/components/docs/DocsPage.vue +22 -0
  31. package/components/docs/DocsPageContent.vue +31 -0
  32. package/components/docs/DocsToc.vue +74 -0
  33. package/components/globals/Icon.vue +24 -0
  34. package/{dist/runtime/app/components/prose/ProseHr.vue → components/globals/Logo.vue} +1 -1
  35. package/components/globals/NuxtImg.vue +45 -0
  36. package/components/globals/SocialIcons.vue +45 -0
  37. package/components/globals/ThemeSelect.vue +35 -0
  38. package/components/icons/IconAlgolia.vue +8 -0
  39. package/components/icons/IconArrowLeft.vue +10 -0
  40. package/components/icons/IconArrowRight.vue +10 -0
  41. package/components/icons/IconBadgeCheck.vue +14 -0
  42. package/components/icons/IconCheck.vue +10 -0
  43. package/components/icons/IconCheckCircle.vue +10 -0
  44. package/components/icons/IconChevronRight.vue +12 -0
  45. package/components/icons/IconClipboardCheck.vue +14 -0
  46. package/components/icons/IconClipboardCopy.vue +14 -0
  47. package/components/icons/IconCodeSandbox.vue +8 -0
  48. package/components/icons/IconCopy.vue +17 -0
  49. package/components/icons/IconDots.vue +10 -0
  50. package/components/icons/IconEdit.vue +18 -0
  51. package/components/icons/IconExclamationCircle.vue +12 -0
  52. package/components/icons/IconExclamationTriangle.vue +10 -0
  53. package/components/icons/IconExternalLink.vue +12 -0
  54. package/components/icons/IconGit.vue +7 -0
  55. package/components/icons/IconGitHub.vue +10 -0
  56. package/components/icons/IconHeart.vue +9 -0
  57. package/components/icons/IconInformationCircle.vue +10 -0
  58. package/components/icons/IconLighthouse.vue +83 -0
  59. package/components/icons/IconLine.vue +10 -0
  60. package/components/icons/IconMarkdown.vue +13 -0
  61. package/components/icons/IconMenu.vue +12 -0
  62. package/components/icons/IconMenuAlt.vue +10 -0
  63. package/components/icons/IconMinus.vue +10 -0
  64. package/components/icons/IconMoon.vue +10 -0
  65. package/components/icons/IconNuxt.vue +14 -0
  66. package/components/icons/IconNuxtContent.vue +20 -0
  67. package/components/icons/IconNuxtLabs.vue +21 -0
  68. package/components/icons/IconPlus.vue +10 -0
  69. package/components/icons/IconPuzzle.vue +8 -0
  70. package/components/icons/IconSSG.vue +7 -0
  71. package/components/icons/IconSearch.vue +12 -0
  72. package/components/icons/IconSun.vue +10 -0
  73. package/components/icons/IconTocBack.vue +21 -0
  74. package/components/icons/IconTocCurrent.vue +21 -0
  75. package/components/icons/IconTocNext.vue +8 -0
  76. package/components/icons/IconTranslate.vue +14 -0
  77. package/components/icons/IconTwitter.vue +8 -0
  78. package/components/icons/IconVite.vue +30 -0
  79. package/components/icons/IconVue.vue +6 -0
  80. package/components/icons/IconVueTelescope.vue +11 -0
  81. package/components/icons/IconWindi.vue +17 -0
  82. package/components/icons/IconX.vue +12 -0
  83. package/components/icons/IconXCircle.vue +10 -0
  84. package/components/icons/IconZap.vue +8 -0
  85. package/components/prose/ProseA.vue +66 -0
  86. package/components/prose/ProseBlockquote.vue +21 -0
  87. package/components/prose/ProseCode.vue +68 -0
  88. package/components/prose/ProseCodeInline.vue +38 -0
  89. package/components/prose/ProseEm.vue +11 -0
  90. package/components/prose/ProseH1.vue +22 -0
  91. package/components/prose/ProseH2.vue +22 -0
  92. package/components/prose/ProseH3.vue +24 -0
  93. package/components/prose/ProseH4.vue +24 -0
  94. package/components/prose/ProseHr.vue +13 -0
  95. package/components/prose/ProseImg.vue +30 -0
  96. package/components/prose/ProseLi.vue +31 -0
  97. package/components/prose/ProseOl.vue +16 -0
  98. package/components/prose/ProseP.vue +14 -0
  99. package/components/prose/ProseStrong.vue +14 -0
  100. package/components/prose/ProseTable.vue +13 -0
  101. package/{dist/runtime/app/components → components}/prose/ProseTbody.vue +0 -0
  102. package/components/prose/ProseTd.vue +11 -0
  103. package/components/prose/ProseTh.vue +11 -0
  104. package/components/prose/ProseThead.vue +11 -0
  105. package/components/prose/ProseTr.vue +11 -0
  106. package/components/prose/ProseUl.vue +15 -0
  107. package/composables/useContent.ts +156 -0
  108. package/composables/useMenu.ts +22 -0
  109. package/composables/useScrollToHeading.ts +35 -0
  110. package/composables/useScrollspy.ts +46 -0
  111. package/composables/useTheme.ts +12 -0
  112. package/layouts/default.vue +29 -0
  113. package/layouts/page.vue +11 -0
  114. package/nuxt.config.ts +151 -0
  115. package/package.json +46 -83
  116. package/pages/[...slug].vue +26 -0
  117. package/public/android-chrome-192x192.png +0 -0
  118. package/public/android-chrome-512x512.png +0 -0
  119. package/public/apple-touch-icon.png +0 -0
  120. package/public/favicon-16x16.png +0 -0
  121. package/public/favicon-32x32.png +0 -0
  122. package/public/favicon.ico +0 -0
  123. package/public/site.webmanifest +1 -0
  124. package/LICENSE +0 -21
  125. package/dist/index.cjs +0 -549
  126. package/dist/index.d.ts +0 -25
  127. package/dist/index.mjs +0 -523
  128. package/dist/runtime/app/components/DocusContent.vue +0 -215
  129. package/dist/runtime/app/components/DocusContent.vue.d.ts +0 -25
  130. package/dist/runtime/app/components/Error.vue +0 -19
  131. package/dist/runtime/app/components/Error.vue.d.ts +0 -9
  132. package/dist/runtime/app/components/Markdown.vue +0 -56
  133. package/dist/runtime/app/components/Markdown.vue.d.ts +0 -25
  134. package/dist/runtime/app/components/Page.vue +0 -29
  135. package/dist/runtime/app/components/Page.vue.d.ts +0 -2
  136. package/dist/runtime/app/components/Props.vue +0 -130
  137. package/dist/runtime/app/components/Props.vue.d.ts +0 -80
  138. package/dist/runtime/app/components/prose/ProseA.vue +0 -41
  139. package/dist/runtime/app/components/prose/ProseA.vue.d.ts +0 -23
  140. package/dist/runtime/app/components/prose/ProseBlockquote.vue +0 -5
  141. package/dist/runtime/app/components/prose/ProseCode.vue +0 -5
  142. package/dist/runtime/app/components/prose/ProseCodeInline.vue +0 -5
  143. package/dist/runtime/app/components/prose/ProseEm.vue +0 -5
  144. package/dist/runtime/app/components/prose/ProseH1.vue +0 -3
  145. package/dist/runtime/app/components/prose/ProseH2.vue +0 -3
  146. package/dist/runtime/app/components/prose/ProseH3.vue +0 -3
  147. package/dist/runtime/app/components/prose/ProseH4.vue +0 -3
  148. package/dist/runtime/app/components/prose/ProseH5.vue +0 -3
  149. package/dist/runtime/app/components/prose/ProseH6.vue +0 -3
  150. package/dist/runtime/app/components/prose/ProseImg.vue +0 -32
  151. package/dist/runtime/app/components/prose/ProseImg.vue.d.ts +0 -21
  152. package/dist/runtime/app/components/prose/ProseLi.vue +0 -3
  153. package/dist/runtime/app/components/prose/ProseParagraph.vue +0 -3
  154. package/dist/runtime/app/components/prose/ProseStrong.vue +0 -5
  155. package/dist/runtime/app/components/prose/ProseTable.vue +0 -5
  156. package/dist/runtime/app/components/prose/ProseTd.vue +0 -5
  157. package/dist/runtime/app/components/prose/ProseTh.vue +0 -5
  158. package/dist/runtime/app/components/prose/ProseThead.vue +0 -5
  159. package/dist/runtime/app/components/prose/ProseTr.vue +0 -5
  160. package/dist/runtime/app/components/prose/ProseUl.vue +0 -5
  161. package/dist/runtime/app/composables/helpers.d.ts +0 -4
  162. package/dist/runtime/app/composables/helpers.js +0 -66
  163. package/dist/runtime/app/composables/helpers.mjs +0 -40
  164. package/dist/runtime/app/composables/index.d.ts +0 -90
  165. package/dist/runtime/app/composables/index.js +0 -108
  166. package/dist/runtime/app/composables/index.mjs +0 -63
  167. package/dist/runtime/app/composables/navigation.d.ts +0 -37
  168. package/dist/runtime/app/composables/navigation.js +0 -227
  169. package/dist/runtime/app/composables/navigation.mjs +0 -148
  170. package/dist/runtime/app/composables/store.d.ts +0 -7
  171. package/dist/runtime/app/composables/store.js +0 -52
  172. package/dist/runtime/app/composables/store.mjs +0 -35
  173. package/dist/runtime/app/composables/style.d.ts +0 -11
  174. package/dist/runtime/app/composables/style.js +0 -117
  175. package/dist/runtime/app/composables/style.mjs +0 -71
  176. package/dist/runtime/app/composables/theme-colors.d.ts +0 -30
  177. package/dist/runtime/app/composables/theme-colors.js +0 -80
  178. package/dist/runtime/app/composables/theme-colors.mjs +0 -48
  179. package/dist/runtime/app/composables/websocket.d.ts +0 -3
  180. package/dist/runtime/app/composables/websocket.js +0 -79
  181. package/dist/runtime/app/composables/websocket.mjs +0 -63
  182. package/dist/runtime/app/layouts/default.vue +0 -5
  183. package/dist/runtime/app/layouts/error.vue +0 -33
  184. package/dist/runtime/app/layouts/error.vue.d.ts +0 -21
  185. package/dist/runtime/app/pages/_.vue +0 -222
  186. package/dist/runtime/app/pages/_.vue.d.ts +0 -2
  187. package/dist/runtime/context.d.ts +0 -1
  188. package/dist/runtime/context.js +0 -17
  189. package/dist/runtime/context.mjs +0 -5
  190. package/dist/runtime/database/Query.d.ts +0 -18
  191. package/dist/runtime/database/Query.js +0 -68
  192. package/dist/runtime/database/Query.mjs +0 -49
  193. package/dist/runtime/database/index.d.ts +0 -4
  194. package/dist/runtime/database/index.js +0 -45
  195. package/dist/runtime/database/index.mjs +0 -25
  196. package/dist/runtime/database/providers/local/Query.d.ts +0 -14
  197. package/dist/runtime/database/providers/local/Query.js +0 -85
  198. package/dist/runtime/database/providers/local/Query.mjs +0 -60
  199. package/dist/runtime/database/providers/local/index.d.ts +0 -3
  200. package/dist/runtime/database/providers/local/index.js +0 -63
  201. package/dist/runtime/database/providers/local/index.mjs +0 -39
  202. package/dist/runtime/database/providers/local/operations.d.ts +0 -2
  203. package/dist/runtime/database/providers/local/operations.js +0 -83
  204. package/dist/runtime/database/providers/local/operations.mjs +0 -53
  205. package/dist/runtime/database/providers/local/utils.d.ts +0 -8
  206. package/dist/runtime/database/providers/local/utils.js +0 -28
  207. package/dist/runtime/database/providers/local/utils.mjs +0 -17
  208. package/dist/runtime/index.d.ts +0 -3
  209. package/dist/runtime/index.js +0 -44
  210. package/dist/runtime/index.mjs +0 -3
  211. package/dist/runtime/navigation.d.ts +0 -4
  212. package/dist/runtime/navigation.js +0 -176
  213. package/dist/runtime/navigation.mjs +0 -137
  214. package/dist/runtime/server/api/get.d.ts +0 -10
  215. package/dist/runtime/server/api/get.js +0 -24
  216. package/dist/runtime/server/api/get.mjs +0 -13
  217. package/dist/runtime/server/api/list.d.ts +0 -9
  218. package/dist/runtime/server/api/list.js +0 -34
  219. package/dist/runtime/server/api/list.mjs +0 -18
  220. package/dist/runtime/server/api/navigation.d.ts +0 -7
  221. package/dist/runtime/server/api/navigation.js +0 -20
  222. package/dist/runtime/server/api/navigation.mjs +0 -10
  223. package/dist/runtime/server/api/preview.d.ts +0 -3
  224. package/dist/runtime/server/api/preview.js +0 -54
  225. package/dist/runtime/server/api/preview.mjs +0 -31
  226. package/dist/runtime/server/api/reload.d.ts +0 -6
  227. package/dist/runtime/server/api/reload.js +0 -27
  228. package/dist/runtime/server/api/reload.mjs +0 -11
  229. package/dist/runtime/server/api/search.d.ts +0 -6
  230. package/dist/runtime/server/api/search.js +0 -27
  231. package/dist/runtime/server/api/search.mjs +0 -13
  232. package/dist/runtime/server/content.d.ts +0 -46
  233. package/dist/runtime/server/content.js +0 -175
  234. package/dist/runtime/server/content.mjs +0 -114
  235. package/dist/runtime/server/socket.d.ts +0 -9
  236. package/dist/runtime/server/socket.js +0 -33
  237. package/dist/runtime/server/socket.mjs +0 -20
  238. package/dist/runtime/server/utils/cache.d.ts +0 -19
  239. package/dist/runtime/server/utils/cache.js +0 -110
  240. package/dist/runtime/server/utils/cache.mjs +0 -75
  241. package/dist/runtime/server/utils/index.d.ts +0 -4
  242. package/dist/runtime/server/utils/index.js +0 -18
  243. package/dist/runtime/server/utils/index.mjs +0 -8
  244. package/dist/runtime/transformers/index.d.ts +0 -1
  245. package/dist/runtime/transformers/index.js +0 -26
  246. package/dist/runtime/transformers/index.mjs +0 -11
  247. package/dist/runtime/transformers/json.d.ts +0 -3
  248. package/dist/runtime/transformers/json.js +0 -15
  249. package/dist/runtime/transformers/json.mjs +0 -5
  250. package/dist/runtime/transformers/markdown/index.d.ts +0 -8
  251. package/dist/runtime/transformers/markdown/index.js +0 -25
  252. package/dist/runtime/transformers/markdown/index.mjs +0 -16
  253. package/dist/runtime/transformers/utils/index.d.ts +0 -1
  254. package/dist/runtime/transformers/utils/index.js +0 -18
  255. package/dist/runtime/transformers/utils/index.mjs +0 -1
  256. package/dist/runtime/transformers/utils/path.d.ts +0 -26
  257. package/dist/runtime/transformers/utils/path.js +0 -88
  258. package/dist/runtime/transformers/utils/path.mjs +0 -56
  259. package/dist/runtime/utils/index.d.ts +0 -1
  260. package/dist/runtime/utils/index.js +0 -18
  261. package/dist/runtime/utils/index.mjs +0 -1
  262. package/dist/runtime/utils/log.d.ts +0 -1
  263. package/dist/runtime/utils/log.js +0 -14
  264. package/dist/runtime/utils/log.mjs +0 -2
  265. package/dist/runtime/utils/object.d.ts +0 -9
  266. package/dist/runtime/utils/object.js +0 -22
  267. package/dist/runtime/utils/object.mjs +0 -4
  268. package/dist/templates/content.mjs +0 -50
  269. package/dist/templates/docus.mjs +0 -13
  270. package/dist/templates/hot.mjs +0 -16
  271. package/dist/templates/i18n.mjs +0 -23
  272. package/dist/templates/options.mjs +0 -46
  273. package/shims.d.ts +0 -24
  274. package/types.d.ts +0 -397
@@ -0,0 +1,10 @@
1
+ <template>
2
+ <svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path
4
+ d="M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704ZM9.85358 5.14644C10.0488 5.3417 10.0488 5.65829 9.85358 5.85355L8.20713 7.49999L9.85358 9.14644C10.0488 9.3417 10.0488 9.65829 9.85358 9.85355C9.65832 10.0488 9.34173 10.0488 9.14647 9.85355L7.50002 8.2071L5.85358 9.85355C5.65832 10.0488 5.34173 10.0488 5.14647 9.85355C4.95121 9.65829 4.95121 9.3417 5.14647 9.14644L6.79292 7.49999L5.14647 5.85355C4.95121 5.65829 4.95121 5.3417 5.14647 5.14644C5.34173 4.95118 5.65832 4.95118 5.85358 5.14644L7.50002 6.79289L9.14647 5.14644C9.34173 4.95118 9.65832 4.95118 9.85358 5.14644Z"
5
+ fill="currentColor"
6
+ fill-rule="evenodd"
7
+ clip-rule="evenodd"
8
+ />
9
+ </svg>
10
+ </template>
@@ -0,0 +1,8 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 48 48" width="64" height="64">
3
+ <polygon
4
+ fill="#ffae0b"
5
+ points="16.828,5.828 29.966,5.828 25.172,19.414 33.966,19.414 18.621,43.138 21.034,26.379 12.828,26.379"
6
+ />
7
+ </svg>
8
+ </template>
@@ -0,0 +1,66 @@
1
+ <script setup lang="ts">
2
+ defineProps({
3
+ href: {
4
+ type: String,
5
+ default: '',
6
+ },
7
+ blank: {
8
+ type: Boolean,
9
+ default: false,
10
+ },
11
+ /**
12
+ * `true` if `href` points to a static file
13
+ */
14
+ static: {
15
+ type: Boolean,
16
+ default: false,
17
+ },
18
+ })
19
+ </script>
20
+
21
+ <template>
22
+ <NuxtLink :to="href" :blank="blank" :static="static">
23
+ <slot />
24
+ </NuxtLink>
25
+ </template>
26
+
27
+ <style lang="postcss" scoped>
28
+ :not(h1, h2, h3, h4) > a {
29
+ @apply font-medium no-underline d-prose-a-text d-prose-a-border hover:d-prose-a-border-hover;
30
+ }
31
+
32
+ h1 a,
33
+ h2 a,
34
+ h3 a,
35
+ h4 a {
36
+ @apply relative;
37
+ &::after {
38
+ @apply absolute pl-2 w-5 h-5 opacity-0;
39
+ content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="%23111827"%3E%3Cpath stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" /%3E%3C/svg%3E');
40
+ }
41
+ &:hover {
42
+ &::after {
43
+ @apply opacity-100;
44
+ }
45
+ }
46
+
47
+ /* Hover underline */
48
+ &:before {
49
+ @apply absolute top-0 left-0 w-full;
50
+ content: '';
51
+ height: calc(100% + 4px);
52
+ }
53
+ &:hover:before {
54
+ @apply d-prose-a-headline-border;
55
+ }
56
+ }
57
+
58
+ .dark h1 a,
59
+ .dark h2 a,
60
+ .dark h3 a,
61
+ .dark h4 a {
62
+ &::after {
63
+ content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="white"%3E%3Cpath stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" /%3E%3C/svg%3E');
64
+ }
65
+ }
66
+ </style>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <blockquote>
3
+ <slot />
4
+ </blockquote>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ blockquote {
9
+ @apply text-base mt-[1.5em] mb-[1.5em] font-medium pl-4 d-prose-blockquote-text d-prose-blockquote-border;
10
+
11
+ quotes: '201C' '201D' '2018' '2019';
12
+ }
13
+
14
+ blockquote p:first-of-type::before {
15
+ content: '';
16
+ }
17
+
18
+ blockquote p:last-of-type::after {
19
+ content: '';
20
+ }
21
+ </style>
@@ -0,0 +1,68 @@
1
+ <script setup lang="ts">
2
+ import type { PropType } from 'vue'
3
+ import type { Lang } from 'shiki-es'
4
+
5
+ defineProps({
6
+ code: {
7
+ type: String,
8
+ default: '',
9
+ },
10
+ language: {
11
+ type: String as PropType<Lang>,
12
+ default: null,
13
+ },
14
+ filename: {
15
+ type: String,
16
+ default: null,
17
+ },
18
+ highlights: {
19
+ type: Array as () => number[],
20
+ default: () => [],
21
+ },
22
+ })
23
+ </script>
24
+
25
+ <template>
26
+ <div class="prose-code w-full group">
27
+ <span v-if="filename" class="filename transition-base top-1 right-1 opacity-100 absolute right-0 z-0 m-1 py-1.5 px-2 text-gray-400 bg-gray-900 rounded-md font-mono text-xs leading-none tracking-tight">
28
+ {{ filename }}
29
+ </span>
30
+
31
+ <slot />
32
+
33
+ <CopyButton class="copy-button opacity-0 transition-base" />
34
+ </div>
35
+ </template>
36
+
37
+ <style lang="postcss" scoped>
38
+ div {
39
+ @apply relative rounded-lg overflow-hidden my-4;
40
+ }
41
+
42
+ :deep(pre) {
43
+ @apply flex flex-1 p-4 my-0 overflow-x-auto leading-normal;
44
+ background-color: #282c34;
45
+ }
46
+
47
+ :deep(code) {
48
+ @apply flex flex-col;
49
+ }
50
+
51
+ :deep(.line) {
52
+ @apply inline-table min-h-[1rem];
53
+ }
54
+
55
+ :deep(.line.highlight) {
56
+ background-color: #3f3f46;
57
+ }
58
+
59
+ .group:hover {
60
+ .filename {
61
+ @apply opacity-0;
62
+ }
63
+
64
+ .copy-button {
65
+ @apply opacity-100;
66
+ }
67
+ }
68
+ </style>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <code>
3
+ <slot />
4
+ </code>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ code {
9
+ @apply font-normal text-sm py-[3px] px-[6px] rounded-md bg-gray-100 text-gray-800 dark:text-gray-100 dark:bg-gray-800;
10
+ }
11
+
12
+ a code {
13
+ &:hover {
14
+ @apply border-primary-500;
15
+ }
16
+ }
17
+
18
+ tbody code {
19
+ @apply text-[12px];
20
+ }
21
+
22
+ h1 a,
23
+ h2 a,
24
+ h3 a,
25
+ h4 a {
26
+ code {
27
+ @apply relative;
28
+ font-size: inherit;
29
+ }
30
+
31
+ & code:before {
32
+ @apply absolute top-[-2px] left-[-2px] -z-[1] d-prose-code-inline-bg rounded-md pointer-events-none;
33
+ content: '';
34
+ width: calc(100% + 4px);
35
+ height: calc(100% + 4px);
36
+ }
37
+ }
38
+ </style>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <em>
3
+ <slot />
4
+ </em>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ em {
9
+ @apply italic text-current;
10
+ }
11
+ </style>
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ defineProps<{ id: string }>()
3
+ </script>
4
+
5
+ <template>
6
+ <h1 :id="id">
7
+ <NuxtLink :href="`#${id}`">
8
+ <slot />
9
+ </NuxtLink>
10
+ </h1>
11
+ </template>>
12
+
13
+ <style lang="postcss" scoped>
14
+ h1 {
15
+ font-size: 2rem;
16
+ @apply tracking-tight leading-snug font-semibold mt-[1em] mb-[0.5em];
17
+ }
18
+
19
+ h1 + * {
20
+ @apply mt-0;
21
+ }
22
+ </style>
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ defineProps<{ id: string }>()
3
+ </script>
4
+
5
+ <template>
6
+ <h2 :id="id">
7
+ <NuxtLink :href="`#${id}`">
8
+ <slot />
9
+ </NuxtLink>
10
+ </h2>
11
+ </template>
12
+
13
+ <style lang="postcss" scoped>
14
+ h2 {
15
+ font-size: 1.5rem;
16
+ @apply tracking-tight leading-snug font-semibold mt-[1.25em] mb-[0.5em];
17
+ }
18
+
19
+ h2 + * {
20
+ @apply mt-0;
21
+ }
22
+ </style>
@@ -0,0 +1,24 @@
1
+ <script setup lang="ts">
2
+ defineProps<{ id: string }>()
3
+ </script>
4
+
5
+ <template>
6
+ <h3 :id="id">
7
+ <NuxtLink :href="`#${id}`">
8
+ <slot />
9
+ </NuxtLink>
10
+ </h3>
11
+ </template>
12
+
13
+ <style lang="postcss" scoped>
14
+ h3 {
15
+ /* TODO */
16
+ /* extend.fontSize do not work in Windi */
17
+ font-size: 1.25rem;
18
+ @apply tracking-tight leading-snug font-semibold mt-[1.25em] mb-[0.5em];
19
+ }
20
+
21
+ h3 + * {
22
+ @apply mt-0;
23
+ }
24
+ </style>
@@ -0,0 +1,24 @@
1
+ <script setup lang="ts">
2
+ defineProps<{ id: string }>()
3
+ </script>
4
+
5
+ <template>
6
+ <h4 :id="id">
7
+ <NuxtLink :href="`#${id}`">
8
+ <slot />
9
+ </NuxtLink>
10
+ </h4>
11
+ </template>
12
+
13
+ <style lang="postcss" scoped>
14
+ h4 {
15
+ /* TODO */
16
+ /* extend.fontSize do not work in Windi */
17
+ font-size: 1.125rem;
18
+ @apply tracking-tight leading-snug font-semibold mt-[1.25em] mb-[0.5em];
19
+ }
20
+
21
+ h4 + * {
22
+ @apply mt-0;
23
+ }
24
+ </style>
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <hr>
3
+ </template>
4
+
5
+ <style lang="postcss" scoped>
6
+ hr {
7
+ @apply d-prose-hr-border my-8;
8
+ }
9
+
10
+ hr + * {
11
+ @apply mt-0;
12
+ }
13
+ </style>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ defineProps({
3
+ src: {
4
+ type: String,
5
+ default: '',
6
+ },
7
+ alt: {
8
+ type: String,
9
+ default: '',
10
+ },
11
+ width: {
12
+ type: [String, Number],
13
+ default: undefined,
14
+ },
15
+ height: {
16
+ type: [String, Number],
17
+ default: undefined,
18
+ },
19
+ })
20
+ </script>
21
+
22
+ <template>
23
+ <NuxtImg :src="src" :alt="alt" :width="width" :height="height" />
24
+ </template>
25
+
26
+ <style lang="postcss" scoped>
27
+ :deep(img) {
28
+ @apply my-[1em];
29
+ }
30
+ </style>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <li><slot /></li>
3
+ </template>
4
+
5
+ <style lang="postcss" scoped>
6
+ li {
7
+ @apply relative my-[0.25em] pl-4;
8
+ p {
9
+ @apply my-[0.75em];
10
+ }
11
+ }
12
+
13
+ ul > li {
14
+ &::before {
15
+ @apply absolute left-0 top-[0.5em] d-prose-ul-li-bullet rounded-full w-1.5 h-1.5;
16
+ content: '';
17
+ }
18
+ }
19
+
20
+ ol > li {
21
+ &::before {
22
+ @apply absolute left-0 top-0 d-secondary-text;
23
+ content: counter(list-item, decimal) '.';
24
+ content: counter(list-item, var(--list-counter-style, decimal)) '.';
25
+ }
26
+ }
27
+
28
+ :deep(.nuxt-content-highlight) {
29
+ @apply m-0;
30
+ }
31
+ </style>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <ol>
3
+ <slot />
4
+ </ol>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ ol {
9
+ @apply mx-0 p-0 my-[1.25em] list-none;
10
+
11
+ :deep(ul),
12
+ :deep(ol) {
13
+ @apply !my-[0.5em];
14
+ }
15
+ }
16
+ </style>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <p><slot /></p>
3
+ </template>
4
+
5
+ <style lang="postcss" scoped>
6
+ p {
7
+ @apply leading-relaxed my-4;
8
+
9
+ :deep(br) {
10
+ @apply block mt-4;
11
+ content: '';
12
+ }
13
+ }
14
+ </style>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <strong>
3
+ <slot />
4
+ </strong>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ strong {
9
+ @apply font-semibold;
10
+ }
11
+ a strong {
12
+ @apply text-current;
13
+ }
14
+ </style>
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <div class="max-w-full my-6 overflow-x-auto">
3
+ <table>
4
+ <slot />
5
+ </table>
6
+ </div>
7
+ </template>
8
+
9
+ <style lang="postcss" scoped>
10
+ table {
11
+ @apply leading-5 text-sm w-full table-auto text-left;
12
+ }
13
+ </style>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <td>
3
+ <slot />
4
+ </td>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ tbody td {
9
+ @apply align-top first:pl-0 last:pr-0 p-[0.5em];
10
+ }
11
+ </style>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <th>
3
+ <slot />
4
+ </th>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ thead th {
9
+ @apply font-semibold d-secondary-text p-2 pt-0 align-bottom first:pl-0 last:pr-0;
10
+ }
11
+ </style>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <thead>
3
+ <slot />
4
+ </thead>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ thead {
9
+ @apply d-prose-thead-border;
10
+ }
11
+ </style>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <tr>
3
+ <slot />
4
+ </tr>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ tbody tr {
9
+ @apply d-prose-tr-border;
10
+ }
11
+ </style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <ul>
3
+ <slot />
4
+ </ul>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ ul {
9
+ @apply list-none mx-0 p-0 my-[1.25em];
10
+ :deep(ul),
11
+ :deep(ol) {
12
+ @apply !my-[0.5em];
13
+ }
14
+ }
15
+ </style>
@@ -0,0 +1,156 @@
1
+ import { withoutTrailingSlash } from 'ufo'
2
+ import type { NavItem, ParsedContent } from '@nuxt/content/dist/runtime/types'
3
+ import { computed, fetchContentNavigation, onBeforeUnmount, onMounted, queryContent, useNuxtApp, useRoute, useState } from '#imports'
4
+
5
+ let closeHook
6
+
7
+ export const useContent = () => {
8
+ const route = useRoute()
9
+
10
+ const path = computed(() => withoutTrailingSlash(route.path))
11
+
12
+ /**
13
+ * Navigation tree from root of app.
14
+ */
15
+ const navigation = useState<NavItem[]>('navigation', () => null)
16
+
17
+ /**
18
+ * Current page complete data.
19
+ */
20
+ const page = useState<ParsedContent>(`content-page-${path.value}`, () => null)
21
+
22
+ /**
23
+ * Previous and next page data.
24
+ * Format: [prev, next]
25
+ */
26
+ const surround = useState<ParsedContent[]>(`content-surround-${path.value}`, () => null)
27
+
28
+ /**
29
+ * Table of contents from parsed page.
30
+ */
31
+ const toc = computed(() => page?.value?.body?.toc?.links || [])
32
+
33
+ /**
34
+ * Content type from parsed page.
35
+ */
36
+ const type = computed(() => page.value?.meta?.type)
37
+
38
+ /**
39
+ * Next page from `surround`.
40
+ */
41
+ const next = computed(() => surround.value?.[1] || null)
42
+
43
+ /**
44
+ * Previous page from `surround`.
45
+ */
46
+ const prev = computed(() => surround.value?.[0] || null)
47
+
48
+ /**
49
+ * Page list fetching helper.
50
+ */
51
+ const fetchDir = async(path: string) => await queryContent(path).find()
52
+
53
+ /**
54
+ * Find first child link from a navigation node.
55
+ */
56
+ const findBottomLink = (link: NavItem) => {
57
+ let slug = link.slug
58
+
59
+ if (link.children && link.children.length)
60
+ slug = findBottomLink(link.children[0])
61
+
62
+ return slug
63
+ }
64
+
65
+ /**
66
+ * Find current navigation node from a path.
67
+ */
68
+ const navFromPath = (path: string, tree: NavItem[] = navigation.value) => {
69
+ for (const file of tree) {
70
+ if (file.children) {
71
+ const result = navFromPath(path, file.children)
72
+ if (result)
73
+ return result
74
+ }
75
+
76
+ if (file.slug === path)
77
+ return file
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Navigation fetching helper.
83
+ */
84
+ const fetchNavigation = async(force = false) => {
85
+ if (navigation.value !== null && !force)
86
+ return
87
+
88
+ navigation.value = await fetchContentNavigation()
89
+ }
90
+
91
+ /**
92
+ * Local page fetching helper.
93
+ */
94
+ const fetchPage = async(force = false) => {
95
+ if (page.value !== null && !force)
96
+ return
97
+
98
+ const splitted = path.value.split('/')
99
+ const directory = splitted.slice(0, splitted.length - 1).join('/')
100
+
101
+ // Get navigation node from current path
102
+ const file = navFromPath(path.value, navigation.value)
103
+
104
+ if (file && !file.children) {
105
+ // Path queried has a page (and is not a directory)
106
+ await Promise.all([
107
+ queryContent().where({ id: file.id }).findOne() as Promise<ParsedContent>,
108
+ queryContent(directory).findSurround(path.value) as Promise<ParsedContent[]>,
109
+ ]).then(([_page, _surround]) => {
110
+ page.value = _page
111
+ surround.value = _surround
112
+ })
113
+ }
114
+ else if (file) {
115
+ navigateTo(findBottomLink(file))
116
+ }
117
+ }
118
+
119
+ // Re-fetch page on change (development only)
120
+ if (process.dev) {
121
+ onMounted(
122
+ () => {
123
+ // Cleanup previous hook before registering new one.
124
+ if (closeHook)
125
+ closeHook()
126
+
127
+ const { hook } = useNuxtApp()
128
+
129
+ closeHook = hook('app:data:refresh', async() => {
130
+ await fetchNavigation(true)
131
+ await fetchPage(true)
132
+ })
133
+ },
134
+ )
135
+ onBeforeUnmount(() => closeHook && closeHook())
136
+ }
137
+
138
+ return {
139
+ // useState references
140
+ navigation,
141
+ page,
142
+ surround,
143
+ // Fetching helpers
144
+ fetchDir,
145
+ fetchPage,
146
+ fetchNavigation,
147
+ // Computed values
148
+ next,
149
+ prev,
150
+ type,
151
+ toc,
152
+ // Methods
153
+ navFromPath,
154
+ findBottomLink,
155
+ }
156
+ }