@happydesigns/ui 0.17.5 → 0.18.0
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/layouts/article.vue +2 -5
- package/app/layouts/content.vue +2 -5
- package/nuxt.config.ts +1 -5
- package/package.json +1 -1
- package/schemas/collections.ts +1 -1
- package/schemas/traits.ts +1 -1
- package/app/layouts/page.vue +0 -59
package/app/layouts/article.vue
CHANGED
|
@@ -23,9 +23,7 @@ const hasSeparator = has('separator')
|
|
|
23
23
|
const hasSurround = has('surround')
|
|
24
24
|
const hasToc = has('toc')
|
|
25
25
|
const tocEnabled = computed(() => !page.value || !('toc' in page.value) || page.value.toc !== false)
|
|
26
|
-
const
|
|
27
|
-
&& tocEnabled.value
|
|
28
|
-
&& Boolean(page.value?.body?.toc?.links?.length))
|
|
26
|
+
const showTocSidebar = computed(() => hasToc.value && tocEnabled.value)
|
|
29
27
|
|
|
30
28
|
if (!page.value) {
|
|
31
29
|
throw createError({
|
|
@@ -123,9 +121,8 @@ const backLink = computed(() => {
|
|
|
123
121
|
/>
|
|
124
122
|
</UPageBody>
|
|
125
123
|
|
|
126
|
-
<template #right>
|
|
124
|
+
<template v-if="showTocSidebar" #right>
|
|
127
125
|
<HToc
|
|
128
|
-
v-if="renderToc"
|
|
129
126
|
:links="page?.body?.toc?.links"
|
|
130
127
|
:title="page?.body?.toc?.title"
|
|
131
128
|
/>
|
package/app/layouts/content.vue
CHANGED
|
@@ -43,9 +43,7 @@ if (!page.value) {
|
|
|
43
43
|
usePageSeo(page)
|
|
44
44
|
|
|
45
45
|
const tocEnabled = computed(() => !page.value || !('toc' in page.value) || page.value.toc !== false)
|
|
46
|
-
const
|
|
47
|
-
&& tocEnabled.value
|
|
48
|
-
&& Boolean(page.value?.body?.toc?.links?.length))
|
|
46
|
+
const showTocSidebar = computed(() => hasToc.value && tocEnabled.value)
|
|
49
47
|
const header = computed(() => resolvePageHeader(page.value))
|
|
50
48
|
</script>
|
|
51
49
|
|
|
@@ -61,9 +59,8 @@ const header = computed(() => resolvePageHeader(page.value))
|
|
|
61
59
|
<slot />
|
|
62
60
|
</UPageBody>
|
|
63
61
|
|
|
64
|
-
<template #right>
|
|
62
|
+
<template v-if="showTocSidebar" #right>
|
|
65
63
|
<UContentToc
|
|
66
|
-
v-if="renderToc"
|
|
67
64
|
:links="page.body?.toc?.links"
|
|
68
65
|
:title="page.body?.toc?.title || appConfig.app.toc?.title"
|
|
69
66
|
/>
|
package/nuxt.config.ts
CHANGED
|
@@ -49,12 +49,8 @@ export default defineNuxtConfig({
|
|
|
49
49
|
extends: ['dates', 'location', 'category', 'links', 'published', 'header', 'toc', 'surround', 'copyButton', 'separator', 'backButton'],
|
|
50
50
|
config: {},
|
|
51
51
|
},
|
|
52
|
-
page: {
|
|
53
|
-
extends: ['layout', 'header'],
|
|
54
|
-
config: {},
|
|
55
|
-
},
|
|
56
52
|
content: {
|
|
57
|
-
extends: ['
|
|
53
|
+
extends: ['layout', 'header', 'toc'],
|
|
58
54
|
config: {},
|
|
59
55
|
},
|
|
60
56
|
},
|
package/package.json
CHANGED
package/schemas/collections.ts
CHANGED
package/schemas/traits.ts
CHANGED
package/app/layouts/page.vue
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts" generic="C extends keyof PageCollections = 'page'">
|
|
2
|
-
import type { Collections, PageCollections } from '@nuxt/content'
|
|
3
|
-
|
|
4
|
-
const {
|
|
5
|
-
path,
|
|
6
|
-
collection = 'page' as C,
|
|
7
|
-
} = defineProps<{
|
|
8
|
-
path?: string
|
|
9
|
-
collection?: C
|
|
10
|
-
}>()
|
|
11
|
-
|
|
12
|
-
const route = useRoute()
|
|
13
|
-
|
|
14
|
-
const { data: page } = await usePageContent<C, Collections['page']>({
|
|
15
|
-
path: () => path,
|
|
16
|
-
collection: () => collection,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const variant = computed(() => {
|
|
20
|
-
if (typeof route.meta.variant === 'string' && route.meta.variant) {
|
|
21
|
-
return route.meta.variant
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (typeof route.meta.layout === 'string' && route.meta.layout) {
|
|
25
|
-
return route.meta.layout
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return collection
|
|
29
|
-
})
|
|
30
|
-
const { has } = useVariant(variant)
|
|
31
|
-
const hasHeader = has('header')
|
|
32
|
-
|
|
33
|
-
if (!page.value) {
|
|
34
|
-
throw createError({
|
|
35
|
-
statusCode: 404,
|
|
36
|
-
statusMessage: `${collection} ${path || route.path} not found`,
|
|
37
|
-
fatal: true,
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
usePageSeo(page)
|
|
42
|
-
|
|
43
|
-
const header = computed(() => resolvePageHeader(page.value))
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<template>
|
|
47
|
-
<UContainer v-if="page">
|
|
48
|
-
<UPage>
|
|
49
|
-
<UPageHeader
|
|
50
|
-
v-if="hasHeader && header"
|
|
51
|
-
v-bind="header"
|
|
52
|
-
/>
|
|
53
|
-
|
|
54
|
-
<UPageBody>
|
|
55
|
-
<slot />
|
|
56
|
-
</UPageBody>
|
|
57
|
-
</UPage>
|
|
58
|
-
</UContainer>
|
|
59
|
-
</template>
|