docus 3.0.0-beta.3 → 3.0.0-beta.6

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 (144) hide show
  1. package/package.json +12 -19
  2. package/{app → theme/app}/router.options.ts +0 -0
  3. package/{assets → theme/assets}/css/fonts.css +0 -0
  4. package/theme/assets/css/main.css +104 -0
  5. package/{components → theme/components}/app/Container.vue +0 -0
  6. package/{components → theme/components}/app/Footer.vue +4 -4
  7. package/theme/components/app/MobileNav.vue +85 -0
  8. package/theme/components/app/Navbar.vue +37 -0
  9. package/{components → theme/components}/app/NavbarLogo.vue +4 -4
  10. package/{components → theme/components}/app/Page.vue +0 -0
  11. package/{components → theme/components}/app/PoweredByDocus.vue +0 -0
  12. package/{components → theme/components}/content/Alert.vue +0 -0
  13. package/{components → theme/components}/content/BlockHero.vue +0 -0
  14. package/{components → theme/components}/content/ButtonLink.vue +1 -1
  15. package/{components → theme/components}/content/Card.vue +0 -0
  16. package/{components → theme/components}/content/CardGrid.vue +0 -0
  17. package/{components → theme/components}/content/CodeBlock.vue +0 -0
  18. package/{components → theme/components}/content/CodeGroup.vue +6 -6
  19. package/{components → theme/components}/content/CopyButton.vue +0 -0
  20. package/{components → theme/components}/content/List.vue +0 -0
  21. package/{components → theme/components}/content/NeedContribution.vue +0 -0
  22. package/{components → theme/components}/content/ReadMore.vue +0 -0
  23. package/{components → theme/components}/content/Sandbox.vue +2 -2
  24. package/{components → theme/components}/content/TabsHeader.vue +2 -2
  25. package/{components → theme/components}/content/Terminal.vue +0 -0
  26. package/{components → theme/components}/content/VideoPlayer.vue +0 -0
  27. package/theme/components/dev/Debug.vue +66 -0
  28. package/{components → theme/components}/docs/DocsAside.vue +2 -2
  29. package/{components → theme/components}/docs/DocsAsideTree.vue +8 -6
  30. package/{components → theme/components}/docs/DocsHero.vue +0 -0
  31. package/{components → theme/components}/docs/DocsPage.vue +0 -1
  32. package/theme/components/docs/DocsPageContent.vue +32 -0
  33. package/{components → theme/components}/docs/DocsToc.vue +15 -12
  34. package/{components → theme/components}/globals/Icon.vue +1 -1
  35. package/{components → theme/components}/globals/Logo.vue +0 -0
  36. package/{components → theme/components}/globals/NuxtImg.vue +0 -0
  37. package/{components → theme/components}/globals/SocialIcons.vue +2 -2
  38. package/{components → theme/components}/globals/ThemeSelect.vue +0 -0
  39. package/{components → theme/components}/icons/IconAlgolia.vue +0 -0
  40. package/{components → theme/components}/icons/IconArrowLeft.vue +0 -0
  41. package/{components → theme/components}/icons/IconArrowRight.vue +0 -0
  42. package/{components → theme/components}/icons/IconBadgeCheck.vue +0 -0
  43. package/{components → theme/components}/icons/IconCheck.vue +0 -0
  44. package/{components → theme/components}/icons/IconCheckCircle.vue +0 -0
  45. package/{components → theme/components}/icons/IconChevronRight.vue +0 -0
  46. package/{components → theme/components}/icons/IconClipboardCheck.vue +0 -0
  47. package/{components → theme/components}/icons/IconClipboardCopy.vue +0 -0
  48. package/{components → theme/components}/icons/IconCodeSandbox.vue +0 -0
  49. package/{components → theme/components}/icons/IconCopy.vue +0 -0
  50. package/{components → theme/components}/icons/IconDots.vue +0 -0
  51. package/{components → theme/components}/icons/IconEdit.vue +0 -0
  52. package/{components → theme/components}/icons/IconExclamationCircle.vue +0 -0
  53. package/{components → theme/components}/icons/IconExclamationTriangle.vue +0 -0
  54. package/{components → theme/components}/icons/IconExternalLink.vue +0 -0
  55. package/{components → theme/components}/icons/IconGit.vue +0 -0
  56. package/{components → theme/components}/icons/IconGitHub.vue +0 -0
  57. package/{components → theme/components}/icons/IconHeart.vue +0 -0
  58. package/{components → theme/components}/icons/IconInformationCircle.vue +0 -0
  59. package/{components → theme/components}/icons/IconLighthouse.vue +0 -0
  60. package/{components → theme/components}/icons/IconLine.vue +0 -0
  61. package/{components → theme/components}/icons/IconMarkdown.vue +0 -0
  62. package/{components → theme/components}/icons/IconMenu.vue +0 -0
  63. package/{components → theme/components}/icons/IconMenuAlt.vue +0 -0
  64. package/{components → theme/components}/icons/IconMinus.vue +0 -0
  65. package/{components → theme/components}/icons/IconMoon.vue +0 -0
  66. package/{components → theme/components}/icons/IconNuxt.vue +0 -0
  67. package/{components → theme/components}/icons/IconNuxtContent.vue +0 -0
  68. package/{components → theme/components}/icons/IconNuxtLabs.vue +0 -0
  69. package/{components → theme/components}/icons/IconPlus.vue +0 -0
  70. package/{components → theme/components}/icons/IconPuzzle.vue +0 -0
  71. package/{components → theme/components}/icons/IconSSG.vue +0 -0
  72. package/{components → theme/components}/icons/IconSearch.vue +0 -0
  73. package/{components → theme/components}/icons/IconSun.vue +0 -0
  74. package/theme/components/icons/IconTailwind.vue +3 -0
  75. package/{components → theme/components}/icons/IconTocBack.vue +0 -0
  76. package/{components → theme/components}/icons/IconTocCurrent.vue +0 -0
  77. package/{components → theme/components}/icons/IconTocNext.vue +0 -0
  78. package/{components → theme/components}/icons/IconTranslate.vue +0 -0
  79. package/{components → theme/components}/icons/IconTwitter.vue +0 -0
  80. package/{components → theme/components}/icons/IconVite.vue +0 -0
  81. package/{components → theme/components}/icons/IconVue.vue +0 -0
  82. package/{components → theme/components}/icons/IconVueTelescope.vue +0 -0
  83. package/{components → theme/components}/icons/IconWindi.vue +0 -0
  84. package/{components → theme/components}/icons/IconX.vue +0 -0
  85. package/{components → theme/components}/icons/IconXCircle.vue +0 -0
  86. package/{components → theme/components}/icons/IconZap.vue +0 -0
  87. package/{components → theme/components}/prose/ProseA.vue +3 -3
  88. package/{components → theme/components}/prose/ProseBlockquote.vue +1 -1
  89. package/{components → theme/components}/prose/ProseCode.vue +3 -4
  90. package/{components → theme/components}/prose/ProseCodeInline.vue +2 -2
  91. package/{components → theme/components}/prose/ProseEm.vue +0 -0
  92. package/{components → theme/components}/prose/ProseH1.vue +0 -0
  93. package/{components → theme/components}/prose/ProseH2.vue +0 -0
  94. package/{components → theme/components}/prose/ProseH3.vue +0 -0
  95. package/{components → theme/components}/prose/ProseH4.vue +0 -0
  96. package/{components → theme/components}/prose/ProseHr.vue +1 -1
  97. package/{components → theme/components}/prose/ProseImg.vue +0 -0
  98. package/{components → theme/components}/prose/ProseLi.vue +2 -2
  99. package/{components → theme/components}/prose/ProseOl.vue +0 -0
  100. package/{components → theme/components}/prose/ProseP.vue +0 -0
  101. package/{components → theme/components}/prose/ProseStrong.vue +0 -0
  102. package/{components → theme/components}/prose/ProseTable.vue +0 -0
  103. package/{components → theme/components}/prose/ProseTbody.vue +0 -0
  104. package/{components → theme/components}/prose/ProseTd.vue +0 -0
  105. package/{components → theme/components}/prose/ProseTh.vue +1 -1
  106. package/{components → theme/components}/prose/ProseThead.vue +1 -1
  107. package/{components → theme/components}/prose/ProseTr.vue +1 -1
  108. package/{components → theme/components}/prose/ProseUl.vue +0 -0
  109. package/theme/composables/useDocus.ts +43 -0
  110. package/theme/composables/useMenu.ts +7 -0
  111. package/{composables → theme/composables}/useScrollToHeading.ts +0 -0
  112. package/{composables → theme/composables}/useScrollspy.ts +0 -0
  113. package/theme/composables/useUserAgent.ts +7 -0
  114. package/{composables/useTheme.ts → theme/composables/utils.ts} +0 -8
  115. package/{layouts → theme/layouts}/default.vue +7 -7
  116. package/{layouts → theme/layouts}/page.vue +9 -1
  117. package/theme/middleware/components.ts +26 -0
  118. package/theme/middleware/navigation.global.ts +12 -0
  119. package/theme/middleware/page.ts +8 -0
  120. package/theme/middleware/theme.global.ts +12 -0
  121. package/{nuxt.config.ts → theme/nuxt.config.ts} +84 -64
  122. package/theme/pages/[...slug].vue +64 -0
  123. package/theme/plugins/menu.ts +67 -0
  124. package/theme/plugins/user-agent.ts +27 -0
  125. package/theme/utils/components.ts +25 -0
  126. package/theme/utils/navigation.ts +49 -0
  127. package/theme/utils/plugin.ts +21 -0
  128. package/theme/utils/queries.ts +68 -0
  129. package/theme/utils/state.ts +32 -0
  130. package/theme/utils/theme.ts +66 -0
  131. package/assets/css/main.css +0 -11
  132. package/assets/css/tailwind.css +0 -282
  133. package/components/app/Navbar.vue +0 -26
  134. package/components/docs/DocsPageContent.vue +0 -31
  135. package/composables/useContent.ts +0 -156
  136. package/composables/useMenu.ts +0 -22
  137. package/pages/[...slug].vue +0 -26
  138. package/public/android-chrome-192x192.png +0 -0
  139. package/public/android-chrome-512x512.png +0 -0
  140. package/public/apple-touch-icon.png +0 -0
  141. package/public/favicon-16x16.png +0 -0
  142. package/public/favicon-32x32.png +0 -0
  143. package/public/favicon.ico +0 -0
  144. package/public/site.webmanifest +0 -1
@@ -1,11 +1,13 @@
1
1
  <script setup lang="ts">
2
- import { useContent, useRoute, useScrollToHeading, useScrollspy, watch } from '#imports'
2
+ import { useDocus, useRoute, useScrollToHeading, useScrollspy, watch } from '#imports'
3
+
4
+ const emit = defineEmits(['move'])
3
5
 
4
6
  const route = useRoute()
5
7
 
6
8
  const { activeHeadings, updateHeadings } = useScrollspy()
7
9
 
8
- const { toc, prev, next } = useContent()
10
+ const { toc, prev, next } = useDocus()
9
11
 
10
12
  watch(
11
13
  () => route.path,
@@ -13,11 +15,11 @@ watch(
13
15
  if (process.client) {
14
16
  setTimeout(() => {
15
17
  updateHeadings([
16
- ...document.querySelectorAll('.prose h1'),
17
- ...document.querySelectorAll('.prose h2'),
18
- ...document.querySelectorAll('.prose h3'),
18
+ ...document.querySelectorAll('.content h1'),
19
+ ...document.querySelectorAll('.content h2'),
20
+ ...document.querySelectorAll('.content h3'),
19
21
  ])
20
- }, 1000)
22
+ }, 100)
21
23
  }
22
24
  }, {
23
25
  immediate: true,
@@ -25,30 +27,31 @@ watch(
25
27
 
26
28
  function scrollToHeading(id: string, scrollMarginCssVar: string) {
27
29
  useScrollToHeading(id, scrollMarginCssVar)
30
+ emit('move', id)
28
31
  }
29
32
  </script>
30
33
 
31
34
  <template>
32
35
  <div class="space-y-2">
33
36
  <NuxtLink v-if="prev" :to="prev.slug" class="flex lg:flex-row-reverse items-center text-primary font-semibold group gap-x-3">
34
- <div class="flex-shrink-0 p-1 rounded-md text-secondary-group-hover transition-base">
37
+ <div class="flex-shrink-0 p-1 rounded-lg text-secondary-group-hover transition-base">
35
38
  <Icon name="heroicons-solid:chevron-double-left" class="w-6 h-6" />
36
39
  </div>
37
40
 
38
41
  <span>Previous page</span>
39
42
  </NuxtLink>
40
43
 
41
- <template v-if="toc.length">
44
+ <template v-if="toc?.links?.length">
42
45
  <div class="flex lg:flex-row-reverse items-center font-semibold gap-x-3">
43
- <div class="flex-shrink-0 p-1 rounded-md">
46
+ <div class="flex-shrink-0 p-1 rounded-lg">
44
47
  <Icon name="heroicons-outline:view-grid" class="w-6 h-6" />
45
48
  </div>
46
49
 
47
50
  <span>On this page</span>
48
51
  </div>
49
52
 
50
- <ul class="pl-3 lg:pr-3 mr-1">
51
- <li v-for="link in toc" :key="link.text" class="group border-l-2 lg:border-r-2 lg:border-l-0 min-w-0 lg:text-right" :class="activeHeadings.includes(link.id) ? 'u-border-gray-900' : 'u-border-gray-300'">
53
+ <ul class="pl-3 lg:pr-3 mr-1 border-gray-500">
54
+ <li v-for="link in toc.links" :key="link.text" class="group border-l-2 lg:border-r-2 lg:border-l-0 min-w-0 lg:text-right" :class="activeHeadings.includes(link.id) ? 'border-primary-600' : 'border-primary-600'">
52
55
  <a
53
56
  :href="`#${link.id}`"
54
57
  class="text-secondary text-secondary-group-hover py-1 pl-3 lg:pr-3 block truncate"
@@ -64,7 +67,7 @@ function scrollToHeading(id: string, scrollMarginCssVar: string) {
64
67
  </template>
65
68
 
66
69
  <NuxtLink v-if="next" :to="next.slug" class="flex lg:flex-row-reverse items-center text-primary font-semibold group gap-x-3">
67
- <div class="flex-shrink-0 p-1 rounded-md text-secondary-group-hover transition-base">
70
+ <div class="flex-shrink-0 p-1 rounded-lg text-secondary-group-hover transition-base">
68
71
  <Icon name="heroicons-solid:chevron-double-right" class="w-6 h-6" />
69
72
  </div>
70
73
 
@@ -14,7 +14,7 @@ const icon = ref(null)
14
14
 
15
15
  icon.value = await loadIcon(props.name)
16
16
 
17
- watch(() => props.name, async() => {
17
+ watch(() => props.name, async () => {
18
18
  icon.value = await loadIcon(props.name)
19
19
  })
20
20
  </script>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useTheme } from '#imports'
2
+ import { useDocus } from '#imports'
3
3
 
4
4
  defineProps({
5
5
  size: {
@@ -12,7 +12,7 @@ defineProps({
12
12
  },
13
13
  })
14
14
 
15
- const theme = useTheme()
15
+ const { theme } = useDocus()
16
16
  </script>
17
17
 
18
18
  <template>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <svg fill="#06B6D4" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.001,4.8c-3.2,0-5.2,1.6-6,4.8c1.2-1.6,2.6-2.2,4.2-1.8c0.913,0.228,1.565,0.89,2.288,1.624 C13.666,10.618,15.027,12,18.001,12c3.2,0,5.2-1.6,6-4.8c-1.2,1.6-2.6,2.2-4.2,1.8c-0.913-0.228-1.565-0.89-2.288-1.624 C16.337,6.182,14.976,4.8,12.001,4.8z M6.001,12c-3.2,0-5.2,1.6-6,4.8c1.2-1.6,2.6-2.2,4.2-1.8c0.913,0.228,1.565,0.89,2.288,1.624 c1.177,1.194,2.538,2.576,5.512,2.576c3.2,0,5.2-1.6,6-4.8c-1.2,1.6-2.6,2.2-4.2,1.8c-0.913-0.228-1.565-0.89-2.288-1.624 C10.337,13.382,8.976,12,6.001,12z" /></svg>
3
+ </template>
File without changes
@@ -26,7 +26,7 @@ defineProps({
26
26
 
27
27
  <style lang="postcss" scoped>
28
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;
29
+ @apply font-medium no-underline text-primary-500 border-b border-transparent hover:border-primary-500 transition-colors;
30
30
  }
31
31
 
32
32
  h1 a,
@@ -35,7 +35,7 @@ h3 a,
35
35
  h4 a {
36
36
  @apply relative;
37
37
  &::after {
38
- @apply absolute pl-2 w-5 h-5 opacity-0;
38
+ @apply absolute pl-2 w-6 h-6 opacity-0;
39
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
40
  }
41
41
  &:hover {
@@ -51,7 +51,7 @@ h4 a {
51
51
  height: calc(100% + 4px);
52
52
  }
53
53
  &:hover:before {
54
- @apply d-prose-a-headline-border;
54
+ @apply border-b border-dashed border-gray-900 dark:border-gray-100;
55
55
  }
56
56
  }
57
57
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  <style lang="postcss" scoped>
8
8
  blockquote {
9
- @apply text-base mt-[1.5em] mb-[1.5em] font-medium pl-4 d-prose-blockquote-text d-prose-blockquote-border;
9
+ @apply text-base mt-[1.5em] mb-[1.5em] font-medium pl-4 text-secondary border-l-2 border-gray-200 dark:border-gray-700;
10
10
 
11
11
  quotes: '201C' '201D' '2018' '2019';
12
12
  }
@@ -23,8 +23,8 @@ defineProps({
23
23
  </script>
24
24
 
25
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">
26
+ <div class="prose-code text-gray-50 w-full group">
27
+ <span v-if="filename" class="filename transition-base top-2 right-2 opacity-100 absolute right-0 z-0 m-1 py-1.5 px-2 text-gray-400 bg-gray-900 rounded-lg font-mono text-xs leading-none tracking-tight">
28
28
  {{ filename }}
29
29
  </span>
30
30
 
@@ -40,8 +40,7 @@ div {
40
40
  }
41
41
 
42
42
  :deep(pre) {
43
- @apply flex flex-1 p-4 my-0 overflow-x-auto leading-normal;
44
- background-color: #282c34;
43
+ @apply flex flex-1 p-4 my-0 overflow-x-auto leading-relaxed text-sm code-background;
45
44
  }
46
45
 
47
46
  :deep(code) {
@@ -6,7 +6,7 @@
6
6
 
7
7
  <style lang="postcss" scoped>
8
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;
9
+ @apply font-normal text-sm py-[3px] px-[6px] rounded-lg bg-gray-100 text-gray-800 dark:text-gray-100 dark:bg-gray-800;
10
10
  }
11
11
 
12
12
  a code {
@@ -29,7 +29,7 @@ h4 a {
29
29
  }
30
30
 
31
31
  & code:before {
32
- @apply absolute top-[-2px] left-[-2px] -z-[1] d-prose-code-inline-bg rounded-md pointer-events-none;
32
+ @apply absolute top-[-2px] left-[-2px] -z-[1] rounded-lg pointer-events-none;
33
33
  content: '';
34
34
  width: calc(100% + 4px);
35
35
  height: calc(100% + 4px);
@@ -4,7 +4,7 @@
4
4
 
5
5
  <style lang="postcss" scoped>
6
6
  hr {
7
- @apply d-prose-hr-border my-8;
7
+ @apply border-t border-gray-100 dark:border-gray-800 my-8;
8
8
  }
9
9
 
10
10
  hr + * {
@@ -12,14 +12,14 @@ li {
12
12
 
13
13
  ul > li {
14
14
  &::before {
15
- @apply absolute left-0 top-[0.5em] d-prose-ul-li-bullet rounded-full w-1.5 h-1.5;
15
+ @apply absolute left-0 top-[0.5em] surface-secondary rounded-full w-1.5 h-1.5;
16
16
  content: '';
17
17
  }
18
18
  }
19
19
 
20
20
  ol > li {
21
21
  &::before {
22
- @apply absolute left-0 top-0 d-secondary-text;
22
+ @apply absolute left-0 top-0 text-secondary;
23
23
  content: counter(list-item, decimal) '.';
24
24
  content: counter(list-item, var(--list-counter-style, decimal)) '.';
25
25
  }
@@ -6,6 +6,6 @@
6
6
 
7
7
  <style lang="postcss" scoped>
8
8
  thead th {
9
- @apply font-semibold d-secondary-text p-2 pt-0 align-bottom first:pl-0 last:pr-0;
9
+ @apply font-semibold text-secondary p-2 pt-0 align-bottom first:pl-0 last:pr-0;
10
10
  }
11
11
  </style>
@@ -6,6 +6,6 @@
6
6
 
7
7
  <style lang="postcss" scoped>
8
8
  thead {
9
- @apply d-prose-thead-border;
9
+ @apply border-b border-gray-200 dark:border-gray-700;
10
10
  }
11
11
  </style>
@@ -6,6 +6,6 @@
6
6
 
7
7
  <style lang="postcss" scoped>
8
8
  tbody tr {
9
- @apply d-prose-tr-border;
9
+ @apply border-b border-gray-100 dark:border-gray-800;
10
10
  }
11
11
  </style>
@@ -0,0 +1,43 @@
1
+ import { useDocusState } from '../utils/state'
2
+ import { computed } from '#imports'
3
+
4
+ export const useDocus = () => {
5
+ const { theme, navigation, page, surround } = useDocusState()
6
+
7
+ /**
8
+ * Table of contents from parsed page.
9
+ */
10
+ const toc = computed(() => page?.value?.body?.toc || [])
11
+
12
+ /**
13
+ * Content type from parsed page.
14
+ */
15
+ const type = computed(() => page.value?.meta?.type)
16
+
17
+ /**
18
+ * Layout type from parsed page.
19
+ */
20
+ const layout = computed(() => page.value?.meta?.layout)
21
+
22
+ /**
23
+ * Next page from `surround`.
24
+ */
25
+ const next = computed(() => surround.value?.[1] || null)
26
+
27
+ /**
28
+ * Previous page from `surround`.
29
+ */
30
+ const prev = computed(() => surround.value?.[0] || null)
31
+
32
+ return {
33
+ theme,
34
+ navigation,
35
+ surround,
36
+ page,
37
+ toc,
38
+ type,
39
+ layout,
40
+ next,
41
+ prev,
42
+ }
43
+ }
@@ -0,0 +1,7 @@
1
+ import { useNuxtApp } from '#imports'
2
+
3
+ export const useMenu = () => {
4
+ const { $menu } = useNuxtApp()
5
+
6
+ return $menu
7
+ }
@@ -0,0 +1,7 @@
1
+ import { useNuxtApp } from '#imports'
2
+
3
+ export const useUserAgent = () => {
4
+ const { $userAgent } = useNuxtApp()
5
+
6
+ return $userAgent
7
+ }
@@ -1,11 +1,3 @@
1
- import { useRuntimeConfig } from '#imports'
2
-
3
- export const useTheme = () => {
4
- const { theme } = useRuntimeConfig()
5
-
6
- return theme
7
- }
8
-
9
1
  export const classNames = (...args: any[]) => {
10
2
  const classes = args.filter(Boolean).join(' ')
11
3
  return classes.length ? classes : undefined
@@ -1,19 +1,19 @@
1
- <script setup>
2
- import { useContent } from '#imports'
1
+ <script setup lang="ts">
2
+ import { useDocus } from '#imports'
3
3
 
4
- const { page, fetchNavigation } = useContent()
5
-
6
- await fetchNavigation()
4
+ const { theme } = useDocus()
7
5
  </script>
8
6
 
9
7
  <template>
10
8
  <div class="w-full flex min-h-screen flex-col">
11
- <Navbar />
9
+ <Debug v-if="theme?.debug" :config="theme?.debug" />
12
10
 
13
11
  <div class="min-h-[calc(100vh-12rem)] sm:min-h-[calc(100vh-8rem)] flex flex-col">
12
+ <Navbar />
13
+
14
14
  <DocsPage>
15
15
  <template #aside>
16
- <DocsAside v-if="page?.value?.aside || typeof page?.value?.aside === 'undefined'" />
16
+ <DocsAside />
17
17
  </template>
18
18
 
19
19
  <DocsPageContent>
@@ -1,8 +1,16 @@
1
+ <script setup lang="ts">
2
+ import { useDocus } from '#imports'
3
+
4
+ const { theme } = useDocus()
5
+ </script>
6
+
1
7
  <template>
2
8
  <div class="w-full flex min-h-screen flex-col">
9
+ <Debug v-if="theme?.debug" :config="theme?.debug" />
10
+
3
11
  <Navbar />
4
12
 
5
- <div class="min-h-[calc(100vh-12rem)] sm:min-h-[calc(100vh-8rem)] flex flex-col ">
13
+ <div class="min-h-[calc(100vh-12rem)] sm:min-h-[calc(100vh-8rem)] flex flex-col">
6
14
  <NuxtPage />
7
15
  </div>
8
16
 
@@ -0,0 +1,26 @@
1
+ import { flattenComponents } from '../utils/components'
2
+ import { useDocusState } from '../utils/state'
3
+ import * as Components from '#components'
4
+ import { useNuxtApp } from '#imports'
5
+
6
+ export default defineNuxtRouteMiddleware(
7
+ async () => {
8
+ const { page } = useDocusState()
9
+ const nuxtApp = useNuxtApp()
10
+
11
+ if (page.value) {
12
+ // Components used in page (prose + Vue components)
13
+ const components: string[] = flattenComponents(page.value.body.children)
14
+
15
+ // Preload components before rendering
16
+ for (const name of components) {
17
+ if (!nuxtApp.vueApp.component(name)) {
18
+ // eslint-disable-next-line no-console
19
+ console.log({ name, component: (Components as any)[name] })
20
+
21
+ nuxtApp.vueApp.component(name, (Components as any)[name])
22
+ }
23
+ }
24
+ }
25
+ },
26
+ )
@@ -0,0 +1,12 @@
1
+ import { useDocusState } from '../utils/state'
2
+ import { queryNavigation } from '../utils/queries'
3
+ import { defineNuxtRouteMiddleware } from '#imports'
4
+
5
+ export default defineNuxtRouteMiddleware(
6
+ async () => {
7
+ const { navigation } = useDocusState()
8
+
9
+ if (!navigation.value)
10
+ await queryNavigation()
11
+ },
12
+ )
@@ -0,0 +1,8 @@
1
+ import { queryPage } from '../utils/queries'
2
+ import { defineNuxtRouteMiddleware } from '#imports'
3
+
4
+ export default defineNuxtRouteMiddleware(
5
+ async (to) => {
6
+ await queryPage(to)
7
+ },
8
+ )
@@ -0,0 +1,12 @@
1
+ import { useDocusState } from '../utils/state'
2
+ import { queryTheme } from '../utils/queries'
3
+ import { defineNuxtRouteMiddleware } from '#imports'
4
+
5
+ export default defineNuxtRouteMiddleware(
6
+ async () => {
7
+ const { theme } = useDocusState()
8
+
9
+ if (!theme.value)
10
+ await queryTheme()
11
+ },
12
+ )