undocs 0.2.14 → 0.2.15
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/app/components/AppHeader.vue +20 -24
- package/app/components/global/ReadMore.vue +1 -1
- package/app/layouts/docs.vue +6 -3
- package/app/pages/[...slug].vue +6 -2
- package/app/pages/index.vue +1 -1
- package/app/utils/nav.ts +36 -0
- package/app/utils/title.ts +9 -0
- package/package.json +1 -1
- package/app/components/NavigationTree.vue +0 -22
- package/app/utils/label.ts +0 -9
|
@@ -7,23 +7,15 @@ const appConfig = useAppConfig()
|
|
|
7
7
|
|
|
8
8
|
const { metaSymbol } = useShortcuts()
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
label: toLabel(nav._path.substring(1)),
|
|
22
|
-
to: nav._path,
|
|
23
|
-
active: route.path.startsWith(nav._path),
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
.filter(Boolean)
|
|
10
|
+
const docsNav = useDocsNav()
|
|
11
|
+
|
|
12
|
+
const headerLinks = computed(() => {
|
|
13
|
+
return docsNav.links.map((link) => {
|
|
14
|
+
return {
|
|
15
|
+
...link,
|
|
16
|
+
children: link.children?.filter((child) => !child.children || child.children.some((c) => c.to === child.to)),
|
|
17
|
+
}
|
|
18
|
+
})
|
|
27
19
|
})
|
|
28
20
|
</script>
|
|
29
21
|
|
|
@@ -36,26 +28,30 @@ const navLinks = computed(() => {
|
|
|
36
28
|
{{ appConfig.site.name }}
|
|
37
29
|
</span>
|
|
38
30
|
</NuxtLink>
|
|
39
|
-
</template>
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
<div class="ml-8 lg:flex hidden">
|
|
33
|
+
<UContentSearchButton label="Search..." />
|
|
34
|
+
</div>
|
|
43
35
|
</template>
|
|
44
36
|
|
|
37
|
+
<!-- <template #center>
|
|
38
|
+
<UContentSearchButton label="Search..." class="lg:flex hidden" />
|
|
39
|
+
</template> -->
|
|
40
|
+
|
|
45
41
|
<template #right>
|
|
46
|
-
<UHeaderLinks :links="
|
|
42
|
+
<UHeaderLinks :links="headerLinks" class="hidden md:flex mr-4" v-if="docsNav.links.length > 1" />
|
|
47
43
|
|
|
48
44
|
<UTooltip class="lg:hidden" text="Search" :shortcuts="[metaSymbol, 'K']">
|
|
49
45
|
<UContentSearchButton :label="null" />
|
|
50
46
|
</UTooltip>
|
|
51
47
|
|
|
52
|
-
|
|
48
|
+
<ColorPicker />
|
|
53
49
|
|
|
54
|
-
<SocialButtons
|
|
50
|
+
<SocialButtons />
|
|
55
51
|
</template>
|
|
56
52
|
|
|
57
53
|
<template #panel>
|
|
58
|
-
<
|
|
54
|
+
<UNavigationTree :links="docsNav.links" default-open :multiple="false" />
|
|
59
55
|
</template>
|
|
60
56
|
</UHeader>
|
|
61
57
|
</template>
|
package/app/layouts/docs.vue
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
<script setup lang="ts"
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const docsNav = useDocsNav()
|
|
3
|
+
</script>
|
|
2
4
|
|
|
3
5
|
<template>
|
|
4
6
|
<UContainer>
|
|
5
7
|
<UPage>
|
|
6
8
|
<template #left>
|
|
7
|
-
<UAside>
|
|
8
|
-
<
|
|
9
|
+
<UAside :links="docsNav.links">
|
|
10
|
+
<UDivider type="dashed" class="mb-6" v-if="docsNav.activeLinks?.length" />
|
|
11
|
+
<UNavigationTree :links="docsNav.activeLinks" />
|
|
9
12
|
</UAside>
|
|
10
13
|
</template>
|
|
11
14
|
<slot />
|
package/app/pages/[...slug].vue
CHANGED
|
@@ -68,9 +68,11 @@ onMounted(() => {
|
|
|
68
68
|
<UPageHeader :title="page.title" :description="page.description" :links="page.links" :headline="headline">
|
|
69
69
|
</UPageHeader>
|
|
70
70
|
|
|
71
|
-
<div
|
|
71
|
+
<div
|
|
72
|
+
v-if="tocLinks.length > 1"
|
|
73
|
+
class="float-right mt-4 top-[calc(var(--header-height)_+_0.5rem)] z-10 flex justify-end sticky"
|
|
74
|
+
>
|
|
72
75
|
<UDropdown
|
|
73
|
-
v-if="tocLinks.length > 2"
|
|
74
76
|
:items="[[{ label: 'Return to top', click: scrollToTop }], tocLinks]"
|
|
75
77
|
:popper="{ placement: 'bottom-end' }"
|
|
76
78
|
:mode="isMobile ? 'click' : 'hover'"
|
|
@@ -86,6 +88,8 @@ onMounted(() => {
|
|
|
86
88
|
</div>
|
|
87
89
|
|
|
88
90
|
<UPageBody prose>
|
|
91
|
+
<br v-if="tocLinks.length > 1" />
|
|
92
|
+
|
|
89
93
|
<ContentRenderer v-if="page.body" :value="page" />
|
|
90
94
|
|
|
91
95
|
<div class="space-y-6">
|
package/app/pages/index.vue
CHANGED
package/app/utils/nav.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { NavItem } from '@nuxt/content/dist/runtime/types'
|
|
2
|
+
|
|
3
|
+
export function useDocsNav() {
|
|
4
|
+
const navigation = inject<Ref<NavItem[]>>('navigation')
|
|
5
|
+
|
|
6
|
+
const route = useRoute()
|
|
7
|
+
|
|
8
|
+
const isActive = (path: string) => route.path.startsWith(path)
|
|
9
|
+
|
|
10
|
+
const links = computed(() => {
|
|
11
|
+
return mapContentNavigation(navigation.value).map((item) => {
|
|
12
|
+
if (item.children?.length === 1) {
|
|
13
|
+
return {
|
|
14
|
+
...item,
|
|
15
|
+
...item.children[0],
|
|
16
|
+
children: undefined,
|
|
17
|
+
active: isActive(item.to as string),
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
...item,
|
|
22
|
+
label: titleCase(item.to),
|
|
23
|
+
active: isActive(item.to as string),
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const activeLinks = computed(() => {
|
|
29
|
+
return links.value.find((l) => route.path.startsWith(l.to as string))?.children || []
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
return reactive({
|
|
33
|
+
links,
|
|
34
|
+
activeLinks,
|
|
35
|
+
})
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { NavItem } from '@nuxt/content/dist/runtime/types'
|
|
3
|
-
|
|
4
|
-
const navigation = inject<Ref<NavItem[]>>('navigation')
|
|
5
|
-
|
|
6
|
-
const navigationLinks = computed(() => {
|
|
7
|
-
return mapContentNavigation(navigation.value).map((item) => {
|
|
8
|
-
if (item.children?.length === 1) {
|
|
9
|
-
return {
|
|
10
|
-
...item,
|
|
11
|
-
...item.children[0],
|
|
12
|
-
children: undefined,
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return item
|
|
16
|
-
})
|
|
17
|
-
})
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<UNavigationTree :links="navigationLinks" default-open :multiple="false" />
|
|
22
|
-
</template>
|