docus 2.1.0 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +23 -0
  7. package/components/app/Footer.vue +38 -0
  8. package/components/app/Navbar.vue +26 -0
  9. package/components/app/NavbarLogo.vue +31 -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 +44 -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 +134 -0
  19. package/components/content/CopyButton.vue +48 -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 +24 -0
  23. package/components/content/Sandbox.vue +100 -0
  24. package/components/content/TabsHeader.vue +44 -0
  25. package/components/content/Terminal.vue +70 -0
  26. package/components/content/VideoPlayer.vue +113 -0
  27. package/components/docs/DocsAside.vue +19 -0
  28. package/components/docs/DocsAsideTree.vue +101 -0
  29. package/components/docs/DocsHero.vue +39 -0
  30. package/components/docs/DocsPage.vue +22 -0
  31. package/components/docs/DocsPageContent.vue +29 -0
  32. package/components/docs/DocsToc.vue +72 -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 +43 -0
  36. package/components/globals/SocialIcons.vue +43 -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 +32 -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 +155 -0
  108. package/composables/useMenu.ts +20 -0
  109. package/composables/useScrollToHeading.ts +35 -0
  110. package/composables/useScrollspy.ts +45 -0
  111. package/composables/useTheme.ts +10 -0
  112. package/layouts/default.vue +27 -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 +24 -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,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,32 @@
1
+ <script>
2
+ export default {
3
+ props: {
4
+ src: {
5
+ type: String,
6
+ default: '',
7
+ },
8
+ alt: {
9
+ type: String,
10
+ default: '',
11
+ },
12
+ width: {
13
+ type: [String, Number],
14
+ default: undefined,
15
+ },
16
+ height: {
17
+ type: [String, Number],
18
+ default: undefined,
19
+ },
20
+ },
21
+ }
22
+ </script>
23
+
24
+ <template>
25
+ <NuxtImg :src="src" :alt="alt" :width="width" :height="height" />
26
+ </template>
27
+
28
+ <style lang="postcss" scoped>
29
+ :deep(img) {
30
+ @apply my-[1em];
31
+ }
32
+ </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,155 @@
1
+ import { withoutTrailingSlash } from 'ufo'
2
+ import type { NavItem, ParsedContent } from '@nuxt/content/dist/runtime/types'
3
+
4
+ let closeHook
5
+
6
+ export const useContent = () => {
7
+ const route = useRoute()
8
+
9
+ const path = computed(() => withoutTrailingSlash(route.path))
10
+
11
+ /**
12
+ * Navigation tree from root of app.
13
+ */
14
+ const navigation = useState<NavItem[]>('navigation', () => null)
15
+
16
+ /**
17
+ * Current page complete data.
18
+ */
19
+ const page = useState<ParsedContent>(`content-page-${path.value}`, () => null)
20
+
21
+ /**
22
+ * Previous and next page data.
23
+ * Format: [prev, next]
24
+ */
25
+ const surround = useState<ParsedContent[]>(`content-surround-${path.value}`, () => null)
26
+
27
+ /**
28
+ * Table of contents from parsed page.
29
+ */
30
+ const toc = computed(() => page?.value?.body?.toc?.links || [])
31
+
32
+ /**
33
+ * Content type from parsed page.
34
+ */
35
+ const type = computed(() => page.value?.meta?.type)
36
+
37
+ /**
38
+ * Next page from `surround`.
39
+ */
40
+ const next = computed(() => surround.value?.[1] || null)
41
+
42
+ /**
43
+ * Previous page from `surround`.
44
+ */
45
+ const prev = computed(() => surround.value?.[0] || null)
46
+
47
+ /**
48
+ * Page list fetching helper.
49
+ */
50
+ const fetchDir = async(path: string) => await queryContent(path).find()
51
+
52
+ /**
53
+ * Find first child link from a navigation node.
54
+ */
55
+ const findBottomLink = (link: NavItem) => {
56
+ let slug = link.slug
57
+
58
+ if (link.children && link.children.length)
59
+ slug = findBottomLink(link.children[0])
60
+
61
+ return slug
62
+ }
63
+
64
+ /**
65
+ * Find current navigation node from a path.
66
+ */
67
+ const navFromPath = (path: string, tree: NavItem[] = navigation.value) => {
68
+ for (const file of tree) {
69
+ if (file.children) {
70
+ const result = navFromPath(path, file.children)
71
+ if (result)
72
+ return result
73
+ }
74
+
75
+ if (file.slug === path)
76
+ return file
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Navigation fetching helper.
82
+ */
83
+ const fetchNavigation = async(force = false) => {
84
+ if (navigation.value !== null && !force)
85
+ return
86
+
87
+ navigation.value = await fetchContentNavigation()
88
+ }
89
+
90
+ /**
91
+ * Local page fetching helper.
92
+ */
93
+ const fetchPage = async(force = false) => {
94
+ if (page.value !== null && !force)
95
+ return
96
+
97
+ const splitted = path.value.split('/')
98
+ const directory = splitted.slice(0, splitted.length - 1).join('/')
99
+
100
+ // Get navigation node from current path
101
+ const file = navFromPath(path.value, navigation.value)
102
+
103
+ if (file && !file.children) {
104
+ // Path queried has a page (and is not a directory)
105
+ await Promise.all([
106
+ queryContent().where({ id: file.id }).findOne() as Promise<ParsedContent>,
107
+ queryContent(directory).findSurround(path.value) as Promise<ParsedContent[]>,
108
+ ]).then(([_page, _surround]) => {
109
+ page.value = _page
110
+ surround.value = _surround
111
+ })
112
+ }
113
+ else if (file) {
114
+ navigateTo(findBottomLink(file))
115
+ }
116
+ }
117
+
118
+ // Re-fetch page on change (development only)
119
+ if (process.dev) {
120
+ onMounted(
121
+ () => {
122
+ // Cleanup previous hook before registering new one.
123
+ if (closeHook)
124
+ closeHook()
125
+
126
+ const { hook } = useNuxtApp()
127
+
128
+ closeHook = hook('app:data:refresh', async() => {
129
+ await fetchNavigation(true)
130
+ await fetchPage(true)
131
+ })
132
+ },
133
+ )
134
+ onBeforeUnmount(() => closeHook && closeHook())
135
+ }
136
+
137
+ return {
138
+ // useState references
139
+ navigation,
140
+ page,
141
+ surround,
142
+ // Fetching helpers
143
+ fetchDir,
144
+ fetchPage,
145
+ fetchNavigation,
146
+ // Computed values
147
+ next,
148
+ prev,
149
+ type,
150
+ toc,
151
+ // Methods
152
+ navFromPath,
153
+ findBottomLink,
154
+ }
155
+ }