docus 3.0.0-beta.2 → 3.0.0-beta.5
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.
- package/package.json +12 -19
- package/{app → theme/app}/router.options.ts +0 -0
- package/{assets → theme/assets}/css/fonts.css +0 -0
- package/theme/assets/css/main.css +104 -0
- package/{components → theme/components}/app/Container.vue +0 -0
- package/{components → theme/components}/app/Footer.vue +4 -4
- package/theme/components/app/MobileNav.vue +83 -0
- package/theme/components/app/Navbar.vue +37 -0
- package/{components → theme/components}/app/NavbarLogo.vue +4 -4
- package/{components → theme/components}/app/Page.vue +0 -0
- package/{components → theme/components}/app/PoweredByDocus.vue +0 -0
- package/{components → theme/components}/content/Alert.vue +0 -0
- package/{components → theme/components}/content/BlockHero.vue +0 -0
- package/{components → theme/components}/content/ButtonLink.vue +1 -1
- package/{components → theme/components}/content/Card.vue +0 -0
- package/{components → theme/components}/content/CardGrid.vue +0 -0
- package/{components → theme/components}/content/CodeBlock.vue +0 -0
- package/{components → theme/components}/content/CodeGroup.vue +6 -6
- package/{components → theme/components}/content/CopyButton.vue +0 -0
- package/{components → theme/components}/content/List.vue +0 -0
- package/{components → theme/components}/content/NeedContribution.vue +0 -0
- package/{components → theme/components}/content/ReadMore.vue +0 -0
- package/{components → theme/components}/content/Sandbox.vue +2 -2
- package/{components → theme/components}/content/TabsHeader.vue +2 -2
- package/{components → theme/components}/content/Terminal.vue +0 -0
- package/{components → theme/components}/content/VideoPlayer.vue +0 -0
- package/theme/components/dev/Debug.vue +63 -0
- package/{components → theme/components}/docs/DocsAside.vue +2 -2
- package/{components → theme/components}/docs/DocsAsideTree.vue +8 -6
- package/{components → theme/components}/docs/DocsHero.vue +0 -0
- package/{components → theme/components}/docs/DocsPage.vue +0 -1
- package/theme/components/docs/DocsPageContent.vue +32 -0
- package/{components → theme/components}/docs/DocsToc.vue +15 -12
- package/{components → theme/components}/globals/Icon.vue +0 -0
- package/{components → theme/components}/globals/Logo.vue +0 -0
- package/{components → theme/components}/globals/NuxtImg.vue +0 -0
- package/{components → theme/components}/globals/SocialIcons.vue +2 -2
- package/{components → theme/components}/globals/ThemeSelect.vue +1 -1
- package/{components → theme/components}/icons/IconAlgolia.vue +0 -0
- package/{components → theme/components}/icons/IconArrowLeft.vue +0 -0
- package/{components → theme/components}/icons/IconArrowRight.vue +0 -0
- package/{components → theme/components}/icons/IconBadgeCheck.vue +0 -0
- package/{components → theme/components}/icons/IconCheck.vue +0 -0
- package/{components → theme/components}/icons/IconCheckCircle.vue +0 -0
- package/{components → theme/components}/icons/IconChevronRight.vue +0 -0
- package/{components → theme/components}/icons/IconClipboardCheck.vue +0 -0
- package/{components → theme/components}/icons/IconClipboardCopy.vue +0 -0
- package/{components → theme/components}/icons/IconCodeSandbox.vue +0 -0
- package/{components → theme/components}/icons/IconCopy.vue +0 -0
- package/{components → theme/components}/icons/IconDots.vue +0 -0
- package/{components → theme/components}/icons/IconEdit.vue +0 -0
- package/{components → theme/components}/icons/IconExclamationCircle.vue +0 -0
- package/{components → theme/components}/icons/IconExclamationTriangle.vue +0 -0
- package/{components → theme/components}/icons/IconExternalLink.vue +0 -0
- package/{components → theme/components}/icons/IconGit.vue +0 -0
- package/{components → theme/components}/icons/IconGitHub.vue +0 -0
- package/{components → theme/components}/icons/IconHeart.vue +0 -0
- package/{components → theme/components}/icons/IconInformationCircle.vue +0 -0
- package/{components → theme/components}/icons/IconLighthouse.vue +0 -0
- package/{components → theme/components}/icons/IconLine.vue +0 -0
- package/{components → theme/components}/icons/IconMarkdown.vue +0 -0
- package/{components → theme/components}/icons/IconMenu.vue +0 -0
- package/{components → theme/components}/icons/IconMenuAlt.vue +0 -0
- package/{components → theme/components}/icons/IconMinus.vue +0 -0
- package/{components → theme/components}/icons/IconMoon.vue +0 -0
- package/{components → theme/components}/icons/IconNuxt.vue +0 -0
- package/{components → theme/components}/icons/IconNuxtContent.vue +0 -0
- package/{components → theme/components}/icons/IconNuxtLabs.vue +0 -0
- package/{components → theme/components}/icons/IconPlus.vue +0 -0
- package/{components → theme/components}/icons/IconPuzzle.vue +0 -0
- package/{components → theme/components}/icons/IconSSG.vue +0 -0
- package/{components → theme/components}/icons/IconSearch.vue +0 -0
- package/{components → theme/components}/icons/IconSun.vue +0 -0
- package/theme/components/icons/IconTailwind.vue +3 -0
- package/{components → theme/components}/icons/IconTocBack.vue +0 -0
- package/{components → theme/components}/icons/IconTocCurrent.vue +0 -0
- package/{components → theme/components}/icons/IconTocNext.vue +0 -0
- package/{components → theme/components}/icons/IconTranslate.vue +0 -0
- package/{components → theme/components}/icons/IconTwitter.vue +0 -0
- package/{components → theme/components}/icons/IconVite.vue +0 -0
- package/{components → theme/components}/icons/IconVue.vue +0 -0
- package/{components → theme/components}/icons/IconVueTelescope.vue +0 -0
- package/{components → theme/components}/icons/IconWindi.vue +0 -0
- package/{components → theme/components}/icons/IconX.vue +0 -0
- package/{components → theme/components}/icons/IconXCircle.vue +0 -0
- package/{components → theme/components}/icons/IconZap.vue +0 -0
- package/{components → theme/components}/prose/ProseA.vue +3 -3
- package/{components → theme/components}/prose/ProseBlockquote.vue +1 -1
- package/{components → theme/components}/prose/ProseCode.vue +3 -4
- package/{components → theme/components}/prose/ProseCodeInline.vue +2 -2
- package/{components → theme/components}/prose/ProseEm.vue +0 -0
- package/{components → theme/components}/prose/ProseH1.vue +0 -0
- package/{components → theme/components}/prose/ProseH2.vue +0 -0
- package/{components → theme/components}/prose/ProseH3.vue +0 -0
- package/{components → theme/components}/prose/ProseH4.vue +0 -0
- package/{components → theme/components}/prose/ProseHr.vue +1 -1
- package/{components → theme/components}/prose/ProseImg.vue +0 -0
- package/{components → theme/components}/prose/ProseLi.vue +2 -2
- package/{components → theme/components}/prose/ProseOl.vue +0 -0
- package/{components → theme/components}/prose/ProseP.vue +0 -0
- package/{components → theme/components}/prose/ProseStrong.vue +0 -0
- package/{components → theme/components}/prose/ProseTable.vue +0 -0
- package/{components → theme/components}/prose/ProseTbody.vue +0 -0
- package/{components → theme/components}/prose/ProseTd.vue +0 -0
- package/{components → theme/components}/prose/ProseTh.vue +1 -1
- package/{components → theme/components}/prose/ProseThead.vue +1 -1
- package/{components → theme/components}/prose/ProseTr.vue +1 -1
- package/{components → theme/components}/prose/ProseUl.vue +0 -0
- package/theme/composables/useDocus.ts +42 -0
- package/theme/composables/useMenu.ts +7 -0
- package/{composables → theme/composables}/useScrollToHeading.ts +0 -0
- package/{composables → theme/composables}/useScrollspy.ts +0 -0
- package/theme/composables/useUserAgent.ts +5 -0
- package/{composables/useTheme.ts → theme/composables/utils.ts} +0 -8
- package/{layouts → theme/layouts}/default.vue +6 -8
- package/{layouts → theme/layouts}/page.vue +7 -1
- package/theme/middleware/components.ts +25 -0
- package/theme/middleware/navigation.global.ts +12 -0
- package/theme/middleware/page.ts +8 -0
- package/theme/middleware/theme.global.ts +12 -0
- package/{nuxt.config.ts → theme/nuxt.config.ts} +84 -64
- package/theme/pages/[...slug].vue +62 -0
- package/theme/plugins/menu.ts +65 -0
- package/theme/plugins/user-agent.ts +25 -0
- package/theme/utils/components.ts +25 -0
- package/theme/utils/navigation.ts +49 -0
- package/theme/utils/plugin.ts +21 -0
- package/theme/utils/queries.ts +68 -0
- package/theme/utils/state.ts +32 -0
- package/theme/utils/theme.ts +64 -0
- package/assets/css/main.css +0 -11
- package/assets/css/tailwind.css +0 -282
- package/components/app/Navbar.vue +0 -26
- package/components/docs/DocsPageContent.vue +0 -31
- package/composables/useContent.ts +0 -156
- package/composables/useMenu.ts +0 -22
- package/pages/[...slug].vue +0 -26
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/site.webmanifest +0 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
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 } =
|
|
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('.
|
|
17
|
-
...document.querySelectorAll('.
|
|
18
|
-
...document.querySelectorAll('.
|
|
18
|
+
...document.querySelectorAll('.content h1'),
|
|
19
|
+
...document.querySelectorAll('.content h2'),
|
|
20
|
+
...document.querySelectorAll('.content h3'),
|
|
19
21
|
])
|
|
20
|
-
},
|
|
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-
|
|
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
|
|
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-
|
|
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) ? '
|
|
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-
|
|
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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
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 =
|
|
15
|
+
const { theme } = useDocus()
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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
|
|
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-
|
|
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
|
|
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
|
|
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-
|
|
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-
|
|
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-
|
|
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]
|
|
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);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -12,14 +12,14 @@ li {
|
|
|
12
12
|
|
|
13
13
|
ul > li {
|
|
14
14
|
&::before {
|
|
15
|
-
@apply absolute left-0 top-[0.5em]
|
|
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
|
|
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
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useDocusState } from '../utils/state'
|
|
2
|
+
|
|
3
|
+
export const useDocus = () => {
|
|
4
|
+
const { theme, navigation, page, surround } = useDocusState()
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Table of contents from parsed page.
|
|
8
|
+
*/
|
|
9
|
+
const toc = computed(() => page?.value?.body?.toc || [])
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Content type from parsed page.
|
|
13
|
+
*/
|
|
14
|
+
const type = computed(() => page.value?.meta?.type)
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Layout type from parsed page.
|
|
18
|
+
*/
|
|
19
|
+
const layout = computed(() => page.value?.meta?.layout)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Next page from `surround`.
|
|
23
|
+
*/
|
|
24
|
+
const next = computed(() => surround.value?.[1] || null)
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Previous page from `surround`.
|
|
28
|
+
*/
|
|
29
|
+
const prev = computed(() => surround.value?.[0] || null)
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
theme,
|
|
33
|
+
navigation,
|
|
34
|
+
surround,
|
|
35
|
+
page,
|
|
36
|
+
toc,
|
|
37
|
+
type,
|
|
38
|
+
layout,
|
|
39
|
+
next,
|
|
40
|
+
prev,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -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,17 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const { page, fetchNavigation } = useContent()
|
|
5
|
-
|
|
6
|
-
await fetchNavigation()
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { theme } = useDocus()
|
|
7
3
|
</script>
|
|
8
4
|
|
|
9
5
|
<template>
|
|
10
6
|
<div class="w-full flex min-h-screen flex-col">
|
|
11
|
-
<
|
|
7
|
+
<Debug v-if="theme?.debug" :config="theme?.debug" />
|
|
12
8
|
|
|
13
9
|
<div class="min-h-[calc(100vh-12rem)] sm:min-h-[calc(100vh-8rem)] flex flex-col">
|
|
10
|
+
<Navbar />
|
|
11
|
+
|
|
14
12
|
<DocsPage>
|
|
15
13
|
<template #aside>
|
|
16
|
-
<DocsAside
|
|
14
|
+
<DocsAside />
|
|
17
15
|
</template>
|
|
18
16
|
|
|
19
17
|
<DocsPageContent>
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { theme } = useDocus()
|
|
3
|
+
</script>
|
|
4
|
+
|
|
1
5
|
<template>
|
|
2
6
|
<div class="w-full flex min-h-screen flex-col">
|
|
7
|
+
<Debug v-if="theme?.debug" :config="theme?.debug" />
|
|
8
|
+
|
|
3
9
|
<Navbar />
|
|
4
10
|
|
|
5
|
-
<div class="min-h-[calc(100vh-12rem)] sm:min-h-[calc(100vh-8rem)] flex flex-col
|
|
11
|
+
<div class="min-h-[calc(100vh-12rem)] sm:min-h-[calc(100vh-8rem)] flex flex-col">
|
|
6
12
|
<NuxtPage />
|
|
7
13
|
</div>
|
|
8
14
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { flattenComponents } from '../utils/components'
|
|
2
|
+
import { useDocusState } from '../utils/state'
|
|
3
|
+
import * as Components from '#components'
|
|
4
|
+
|
|
5
|
+
export default defineNuxtRouteMiddleware(
|
|
6
|
+
async() => {
|
|
7
|
+
const { page } = useDocusState()
|
|
8
|
+
const nuxtApp = useNuxtApp()
|
|
9
|
+
|
|
10
|
+
if (page.value) {
|
|
11
|
+
// Components used in page (prose + Vue components)
|
|
12
|
+
const components: string[] = flattenComponents(page.value.body.children)
|
|
13
|
+
|
|
14
|
+
// Preload components before rendering
|
|
15
|
+
for (const name of components) {
|
|
16
|
+
if (!nuxtApp.vueApp.component(name)) {
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.log({ name, component: (Components as any)[name] })
|
|
19
|
+
|
|
20
|
+
nuxtApp.vueApp.component(name, (Components as any)[name])
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
)
|
|
@@ -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,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
|
+
)
|