@happydesigns/ui 0.18.0 → 0.19.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/README.md +96 -70
- package/app/app.config.ts +139 -135
- package/app/components/Snippet.vue +7 -2
- package/app/components/article/ArticleGrid.vue +2 -2
- package/app/components/article/ArticleHeaderBody.vue +26 -26
- package/app/components/article/ArticleHeadlineMeta.vue +37 -37
- package/app/components/article/ArticleList.vue +2 -2
- package/app/components/article/ArticlePage.vue +2 -2
- package/app/components/traits/Authors.vue +2 -1
- package/app/components/traits/Links.vue +17 -21
- package/app/components/traits/Surround.vue +13 -7
- package/app/composables/useArticleList.ts +44 -33
- package/app/composables/usePageContent.ts +22 -19
- package/app/layouts/article.vue +132 -132
- package/app/layouts/content.vue +70 -70
- package/app/types/config.ts +96 -91
- package/app/types/content.ts +14 -0
- package/app/utils/resolveUsers.ts +56 -55
- package/package.json +2 -3
- package/schemas/collections.ts +11 -46
- package/schemas/index.ts +1 -0
- package/server/utils/contentSearch.ts +68 -67
- package/content.config.ts +0 -6
package/app/layouts/content.vue
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
<script setup lang="ts" generic="C extends
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
const {
|
|
5
|
-
path,
|
|
6
|
-
collection = 'page' as C,
|
|
7
|
-
} = defineProps<{
|
|
8
|
-
path?: string
|
|
9
|
-
collection?: C
|
|
10
|
-
}>()
|
|
11
|
-
|
|
12
|
-
const appConfig = useAppConfig()
|
|
13
|
-
const route = useRoute()
|
|
14
|
-
|
|
15
|
-
const { data: page } = await usePageContent<C
|
|
16
|
-
path: () => path,
|
|
17
|
-
collection: () => collection,
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const variant = computed(() => {
|
|
21
|
-
if (typeof route.meta.variant === 'string' && route.meta.variant) {
|
|
22
|
-
return route.meta.variant
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (typeof route.meta.layout === 'string' && route.meta.layout) {
|
|
26
|
-
return route.meta.layout
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return collection
|
|
30
|
-
})
|
|
31
|
-
const { has } = useVariant(variant)
|
|
32
|
-
const hasHeader = has('header')
|
|
33
|
-
const hasToc = has('toc')
|
|
34
|
-
|
|
35
|
-
if (!page.value) {
|
|
36
|
-
throw createError({
|
|
37
|
-
statusCode: 404,
|
|
38
|
-
statusMessage: `${collection} ${path || route.path} not found`,
|
|
39
|
-
fatal: true,
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
usePageSeo(page)
|
|
44
|
-
|
|
45
|
-
const tocEnabled = computed(() => !page.value || !('toc' in page.value) || page.value.toc !== false)
|
|
46
|
-
const showTocSidebar = computed(() => hasToc.value && tocEnabled.value)
|
|
47
|
-
const header = computed(() => resolvePageHeader(page.value))
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<template>
|
|
51
|
-
<UContainer v-if="page">
|
|
52
|
-
<UPage>
|
|
53
|
-
<UPageHeader
|
|
54
|
-
v-if="hasHeader && header"
|
|
55
|
-
v-bind="header"
|
|
56
|
-
/>
|
|
57
|
-
|
|
58
|
-
<UPageBody>
|
|
59
|
-
<slot />
|
|
60
|
-
</UPageBody>
|
|
61
|
-
|
|
62
|
-
<template v-if="showTocSidebar" #right>
|
|
63
|
-
<UContentToc
|
|
64
|
-
:links="page.body?.toc?.links"
|
|
65
|
-
:title="page.body?.toc?.title || appConfig.app.toc?.title"
|
|
66
|
-
/>
|
|
67
|
-
</template>
|
|
68
|
-
</UPage>
|
|
69
|
-
</UContainer>
|
|
70
|
-
</template>
|
|
1
|
+
<script setup lang="ts" generic="C extends PageCollectionName = 'page'">
|
|
2
|
+
import type { PageCollectionName } from '../types/content'
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
path,
|
|
6
|
+
collection = 'page' as C,
|
|
7
|
+
} = defineProps<{
|
|
8
|
+
path?: string
|
|
9
|
+
collection?: C
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const appConfig = useAppConfig()
|
|
13
|
+
const route = useRoute()
|
|
14
|
+
|
|
15
|
+
const { data: page } = await usePageContent<C>({
|
|
16
|
+
path: () => path,
|
|
17
|
+
collection: () => collection,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const variant = computed(() => {
|
|
21
|
+
if (typeof route.meta.variant === 'string' && route.meta.variant) {
|
|
22
|
+
return route.meta.variant
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (typeof route.meta.layout === 'string' && route.meta.layout) {
|
|
26
|
+
return route.meta.layout
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return collection
|
|
30
|
+
})
|
|
31
|
+
const { has } = useVariant(variant)
|
|
32
|
+
const hasHeader = has('header')
|
|
33
|
+
const hasToc = has('toc')
|
|
34
|
+
|
|
35
|
+
if (!page.value) {
|
|
36
|
+
throw createError({
|
|
37
|
+
statusCode: 404,
|
|
38
|
+
statusMessage: `${collection} ${path || route.path} not found`,
|
|
39
|
+
fatal: true,
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
usePageSeo(page)
|
|
44
|
+
|
|
45
|
+
const tocEnabled = computed(() => !page.value || !('toc' in page.value) || page.value.toc !== false)
|
|
46
|
+
const showTocSidebar = computed(() => hasToc.value && tocEnabled.value)
|
|
47
|
+
const header = computed(() => resolvePageHeader(page.value))
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<UContainer v-if="page">
|
|
52
|
+
<UPage>
|
|
53
|
+
<UPageHeader
|
|
54
|
+
v-if="hasHeader && header"
|
|
55
|
+
v-bind="header"
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
<UPageBody>
|
|
59
|
+
<slot />
|
|
60
|
+
</UPageBody>
|
|
61
|
+
|
|
62
|
+
<template v-if="showTocSidebar" #right>
|
|
63
|
+
<UContentToc
|
|
64
|
+
:links="page.body?.toc?.links"
|
|
65
|
+
:title="page.body?.toc?.title || appConfig.app.toc?.title"
|
|
66
|
+
/>
|
|
67
|
+
</template>
|
|
68
|
+
</UPage>
|
|
69
|
+
</UContainer>
|
|
70
|
+
</template>
|
package/app/types/config.ts
CHANGED
|
@@ -1,91 +1,96 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ButtonProps, CommandPaletteGroup, ContentSearchLink, FooterColumn, NavigationMenuItem } from '@nuxt/ui'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
1
|
+
import type { SQLOperator } from '@nuxt/content'
|
|
2
|
+
import type { ButtonProps, CommandPaletteGroup, ContentSearchLink, FooterColumn, NavigationMenuItem } from '@nuxt/ui'
|
|
3
|
+
import type { CollectionName, PageCollectionName } from './content'
|
|
4
|
+
|
|
5
|
+
export type { CollectionName, ContentLink, PageCollectionName } from './content'
|
|
6
|
+
|
|
7
|
+
export type ActionButton = ButtonProps & {
|
|
8
|
+
/** Built-in type for a dynamic GitHub link (URL resolved from app.meta.github) */
|
|
9
|
+
action?: 'github-edit' | 'report-github-issue'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface QueryConfig {
|
|
13
|
+
fields?: string[]
|
|
14
|
+
where?: { field: string, operator: SQLOperator, value?: unknown }[]
|
|
15
|
+
order?: { field: string, direction: 'ASC' | 'DESC' } | false
|
|
16
|
+
}
|
|
17
|
+
export interface SearchCollectionConfig {
|
|
18
|
+
/** Page collection included in both generated search indexes. */
|
|
19
|
+
name: PageCollectionName
|
|
20
|
+
/** Filters applied before navigation and search sections are generated. */
|
|
21
|
+
where?: QueryConfig['where']
|
|
22
|
+
/** Optional stable ordering for generated entries. */
|
|
23
|
+
order?: QueryConfig['order']
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SearchConfig {
|
|
27
|
+
title?: string
|
|
28
|
+
description?: string
|
|
29
|
+
placeholder?: string
|
|
30
|
+
resultLimit?: number
|
|
31
|
+
links?: ContentSearchLink[]
|
|
32
|
+
groups?: CommandPaletteGroup[]
|
|
33
|
+
/** Shared-cache policy for dynamic search endpoints. Set to false to disable caching. */
|
|
34
|
+
cache?: false | {
|
|
35
|
+
/** CDN/proxy cache lifetime in seconds. Browser responses always revalidate. */
|
|
36
|
+
sharedMaxAge?: number
|
|
37
|
+
/** Time in seconds a shared cache may serve stale data while refreshing. */
|
|
38
|
+
staleWhileRevalidate?: number
|
|
39
|
+
}
|
|
40
|
+
error?: {
|
|
41
|
+
title?: string
|
|
42
|
+
description?: string
|
|
43
|
+
retryLabel?: string
|
|
44
|
+
}
|
|
45
|
+
/** Opt-in page collections exposed by the generated public search indexes. */
|
|
46
|
+
collections?: SearchCollectionConfig[]
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Consumer-owned app config fields can be added through declaration merging.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* declare module '@happydesigns/ui/types' {
|
|
53
|
+
* interface HAppConfigExtensions {
|
|
54
|
+
* contact?: { email?: string }
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
*/
|
|
58
|
+
export interface HAppConfigExtensions {}
|
|
59
|
+
|
|
60
|
+
export interface HAppConfigInput extends HAppConfigExtensions {
|
|
61
|
+
meta?: {
|
|
62
|
+
copyright?: {
|
|
63
|
+
copyrightYear?: number
|
|
64
|
+
copyrightHolder?: string
|
|
65
|
+
copyrightHomepage?: string
|
|
66
|
+
}
|
|
67
|
+
socials?: ButtonProps[]
|
|
68
|
+
github?: {
|
|
69
|
+
repo?: string
|
|
70
|
+
branch?: string
|
|
71
|
+
dir?: string
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
links?: {
|
|
75
|
+
header?: NavigationMenuItem[]
|
|
76
|
+
footer?: FooterColumn[]
|
|
77
|
+
}
|
|
78
|
+
search?: SearchConfig
|
|
79
|
+
content?: { userCollection?: CollectionName }
|
|
80
|
+
toc?: { title?: string }
|
|
81
|
+
icons?: Record<string, string>
|
|
82
|
+
date?: {
|
|
83
|
+
locale?: string
|
|
84
|
+
options?: Intl.DateTimeFormatOptions
|
|
85
|
+
datetimeOptions?: Intl.DateTimeFormatOptions
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export interface HAppConfig extends HAppConfigInput {
|
|
89
|
+
meta: NonNullable<HAppConfigInput['meta']>
|
|
90
|
+
links: NonNullable<HAppConfigInput['links']>
|
|
91
|
+
search: SearchConfig
|
|
92
|
+
content: NonNullable<HAppConfigInput['content']>
|
|
93
|
+
toc: NonNullable<HAppConfigInput['toc']>
|
|
94
|
+
icons: Record<string, string>
|
|
95
|
+
date: NonNullable<HAppConfigInput['date']>
|
|
96
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Collections, PageCollections } from '@nuxt/content'
|
|
2
|
+
import type { ButtonProps } from '@nuxt/ui'
|
|
3
|
+
|
|
4
|
+
/** Preserves autocomplete for generated names while allowing runtime-defined collections. */
|
|
5
|
+
type ExtensibleName<T extends string> = T | (string & Record<never, never>)
|
|
6
|
+
|
|
7
|
+
/** Any generated collection name, with an escape hatch for runtime configuration. */
|
|
8
|
+
export type CollectionName = ExtensibleName<Extract<keyof Collections, string>>
|
|
9
|
+
|
|
10
|
+
/** Any generated page collection name, with an escape hatch for runtime configuration. */
|
|
11
|
+
export type PageCollectionName = ExtensibleName<Extract<keyof PageCollections, string>>
|
|
12
|
+
|
|
13
|
+
/** Serializable link data passed directly to Nuxt UI's Button component. */
|
|
14
|
+
export type ContentLink = ButtonProps
|
|
@@ -1,59 +1,60 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import type { CollectionItemBase, CollectionQueryBuilder, Collections } from '@nuxt/content'
|
|
2
|
+
import type { UserProps } from '@nuxt/ui'
|
|
3
|
+
import type { CollectionName } from '../types/content'
|
|
4
|
+
|
|
5
|
+
interface UserRecord extends CollectionItemBase {
|
|
6
|
+
username: string
|
|
7
|
+
name?: UserProps['name']
|
|
8
|
+
description?: UserProps['description']
|
|
9
|
+
to?: UserProps['to']
|
|
10
|
+
avatar?: UserProps['avatar']
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type ResolvedUser = Omit<UserRecord, 'username'> & Partial<UserProps>
|
|
14
|
+
|
|
15
|
+
/** Removes the internal lookup key before passing a profile to Nuxt UI. */
|
|
16
|
+
export function toUserProps<T extends { username: string }>(
|
|
17
|
+
user: T,
|
|
18
|
+
extraProps: Partial<UserProps> = {},
|
|
19
|
+
): Omit<T, 'username'> & Partial<UserProps> {
|
|
20
|
+
const { username: _lookupKey, ...profile } = user
|
|
21
|
+
|
|
22
|
+
return { ...profile, ...extraProps }
|
|
9
23
|
}
|
|
10
24
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const { username: _lookupKey, ...profile } = user
|
|
21
|
-
|
|
22
|
-
return { ...profile, ...extraProps }
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Fetches user details once and keeps the lookup key available for callers
|
|
27
|
-
* that need to associate a profile with several content entries.
|
|
28
|
-
*/
|
|
29
|
-
export async function resolveUserMap(users: string[], extraProps: Partial<UserProps> = {}) {
|
|
30
|
-
const uniqueUsers = [...new Set(users)]
|
|
31
|
-
|
|
32
|
-
if (uniqueUsers.length === 0)
|
|
25
|
+
/** Fetches user details from the consumer-configured collection. */
|
|
26
|
+
export async function resolveUserMap(
|
|
27
|
+
users: string[],
|
|
28
|
+
extraProps: Partial<UserProps> = {},
|
|
29
|
+
collection: CollectionName = 'user',
|
|
30
|
+
) {
|
|
31
|
+
const uniqueUsers = [...new Set(users)]
|
|
32
|
+
|
|
33
|
+
if (uniqueUsers.length === 0)
|
|
33
34
|
return new Map<string, ResolvedUser>()
|
|
34
35
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const userList = Array.isArray(users) ? users : [users]
|
|
53
|
-
const resolved = await resolveUserMap(userList, extraProps)
|
|
54
|
-
|
|
55
|
-
return userList.flatMap((username) => {
|
|
56
|
-
const user = resolved.get(username)
|
|
57
|
-
return user ? [user] : []
|
|
58
|
-
})
|
|
59
|
-
}
|
|
36
|
+
const query = queryCollection(collection as keyof Collections) as unknown as CollectionQueryBuilder<UserRecord>
|
|
37
|
+
const resolved = await query
|
|
38
|
+
.where('username', 'IN', uniqueUsers)
|
|
39
|
+
.select('username', 'name', 'description', 'to', 'avatar')
|
|
40
|
+
.all()
|
|
41
|
+
|
|
42
|
+
return new Map(resolved.map(user => [user.username, toUserProps(user, extraProps)]))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Fetches user details in the requested username order. Unknown users are omitted.
|
|
47
|
+
*/
|
|
48
|
+
export default async function resolveUsers(
|
|
49
|
+
users: string | string[],
|
|
50
|
+
extraProps: Partial<UserProps> = {},
|
|
51
|
+
collection: CollectionName = 'user',
|
|
52
|
+
) {
|
|
53
|
+
const userList = Array.isArray(users) ? users : [users]
|
|
54
|
+
const resolved = await resolveUserMap(userList, extraProps, collection)
|
|
55
|
+
|
|
56
|
+
return userList.flatMap((username) => {
|
|
57
|
+
const user = resolved.get(username)
|
|
58
|
+
return user ? [user] : []
|
|
59
|
+
})
|
|
60
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happydesigns/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
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.",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"main": "./nuxt.config.ts",
|
|
33
33
|
"files": [
|
|
34
34
|
"app",
|
|
35
|
-
"content.config.ts",
|
|
36
35
|
"nuxt.config.ts",
|
|
37
36
|
"schemas",
|
|
38
37
|
"server",
|
|
@@ -93,4 +92,4 @@
|
|
|
93
92
|
"resolutions": {
|
|
94
93
|
"@happydesigns/ui": "workspace:*"
|
|
95
94
|
}
|
|
96
|
-
}
|
|
95
|
+
}
|
package/schemas/collections.ts
CHANGED
|
@@ -1,50 +1,15 @@
|
|
|
1
1
|
import { mergeVariantSchemas } from '@happydesigns/nuxt-variants/schemas'
|
|
2
|
-
import { defineCollection } from '@nuxt/content'
|
|
3
|
-
import { articleCollectionIndexes, userCollectionIndexes } from './indexes'
|
|
4
2
|
import { variantSchemas } from './traits'
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
source: {
|
|
18
|
-
include: 'articles/**/*.{md,yaml}',
|
|
19
|
-
prefix: '/articles',
|
|
20
|
-
},
|
|
21
|
-
schema: mergeVariantSchemas(['article'], variantSchemas),
|
|
22
|
-
indexes: articleCollectionIndexes,
|
|
23
|
-
}),
|
|
24
|
-
|
|
25
|
-
event: defineCollection({
|
|
26
|
-
type: 'page',
|
|
27
|
-
source: {
|
|
28
|
-
include: 'events/**/*.{md,yaml}',
|
|
29
|
-
prefix: '/events',
|
|
30
|
-
},
|
|
31
|
-
schema: mergeVariantSchemas(['event'], variantSchemas),
|
|
32
|
-
indexes: articleCollectionIndexes,
|
|
33
|
-
}),
|
|
34
|
-
|
|
35
|
-
page: defineCollection({
|
|
36
|
-
type: 'page',
|
|
37
|
-
source: {
|
|
38
|
-
include: 'pages/**/*.{md,yaml}',
|
|
39
|
-
prefix: '/',
|
|
40
|
-
},
|
|
41
|
-
schema: mergeVariantSchemas(['content'], variantSchemas),
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
user: defineCollection({
|
|
45
|
-
type: 'data',
|
|
46
|
-
source: 'users/**/*.{md,yaml}',
|
|
47
|
-
schema: mergeVariantSchemas(['user'], variantSchemas),
|
|
48
|
-
indexes: userCollectionIndexes,
|
|
49
|
-
}),
|
|
4
|
+
/**
|
|
5
|
+
* Source-agnostic schemas for consumer-owned Nuxt Content collections.
|
|
6
|
+
*
|
|
7
|
+
* Collection names, sources, prefixes and any project-specific schema fields
|
|
8
|
+
* intentionally remain in the consuming application's `content.config.ts`.
|
|
9
|
+
*/
|
|
10
|
+
export const collectionSchemas = {
|
|
11
|
+
content: mergeVariantSchemas(['content'], variantSchemas),
|
|
12
|
+
article: mergeVariantSchemas(['article'], variantSchemas),
|
|
13
|
+
event: mergeVariantSchemas(['event'], variantSchemas),
|
|
14
|
+
user: mergeVariantSchemas(['user'], variantSchemas),
|
|
50
15
|
}
|
package/schemas/index.ts
CHANGED