@happydesigns/ui 0.17.2 → 0.17.3

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.
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts" generic="C extends 'page' = 'page'">
2
+ import type { Collections } 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 { has } = useVariant(collection)
20
+ const hasHeader = has('header')
21
+
22
+ if (!page.value) {
23
+ throw createError({
24
+ statusCode: 404,
25
+ statusMessage: `${collection} ${path || route.path} not found`,
26
+ fatal: true,
27
+ })
28
+ }
29
+
30
+ usePageSeo(page)
31
+
32
+ const header = computed(() => resolvePageHeader(page.value))
33
+ </script>
34
+
35
+ <template>
36
+ <UContainer v-if="page">
37
+ <UPage>
38
+ <UPageHeader
39
+ v-if="hasHeader && header"
40
+ v-bind="header"
41
+ />
42
+
43
+ <UPageBody>
44
+ <slot />
45
+ </UPageBody>
46
+ </UPage>
47
+ </UContainer>
48
+ </template>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@happydesigns/ui",
3
3
  "type": "module",
4
- "version": "0.17.2",
4
+ "version": "0.17.3",
5
5
  "private": false,
6
6
  "packageManager": "pnpm@11.11.0",
7
7
  "description": "A reusable Nuxt foundation for content-driven happydesigns websites and applications.",
package/schemas/traits.ts CHANGED
@@ -57,7 +57,7 @@ export const locationTrait = {
57
57
 
58
58
  export const layoutTrait = {
59
59
  schema: z.object({
60
- layout: z.enum(['default', 'content']).optional(),
60
+ layout: z.enum(['default', 'page', 'content']).optional(),
61
61
  }),
62
62
  }
63
63