@happydesigns/ui 0.18.0 → 0.19.1
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/nuxt.config.ts +3 -35
- package/package.json +3 -4
- package/schemas/collections.ts +17 -49
- package/schemas/index.ts +3 -1
- package/schemas/variants.ts +41 -0
- package/server/utils/contentSearch.ts +68 -67
- package/content.config.ts +0 -6
package/README.md
CHANGED
|
@@ -1,70 +1,96 @@
|
|
|
1
|
-
# @happydesigns/ui
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@happydesigns/ui)
|
|
4
|
-
[](https://www.npmjs.com/package/@happydesigns/ui)
|
|
5
|
-
[](https://github.com/happydesigns/ui/actions/workflows/ci.yml)
|
|
6
|
-
|
|
7
|
-
Reusable Nuxt layer for happydesigns websites, docs sites, and product apps.
|
|
8
|
-
|
|
9
|
-
The package provides shared Nuxt setup, Nuxt UI conventions, content collection schemas, public `H*` components, composables, variants, and app config conventions. Projects extend the layer and keep project-specific routes, content, branding, and deployment settings in the project that owns them.
|
|
10
|
-
|
|
11
|
-
[npm](https://www.npmjs.com/package/@happydesigns/ui) · [npmx](https://npmx.dev/package/@happydesigns/ui) · [GitHub](https://github.com/happydesigns/ui)
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pnpm add @happydesigns/ui @nuxt/ui tailwindcss
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
export default defineNuxtConfig({
|
|
21
|
-
extends: ['@happydesigns/ui'],
|
|
22
|
-
css: ['~/assets/css/main.css'],
|
|
23
|
-
})
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Create the application's single Tailwind entry point:
|
|
27
|
-
|
|
28
|
-
```css
|
|
29
|
-
@import "tailwindcss";
|
|
30
|
-
@import "@nuxt/ui";
|
|
31
|
-
@import "@happydesigns/ui/styles.css";
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Do not register another stylesheet that imports Tailwind or Nuxt UI. Keeping one compilation context ensures that Nuxt UI's generated responsive and color-mode variants share the application's theme and source graph.
|
|
35
|
-
|
|
36
|
-
Run Nuxt preparation after changing dependencies or layer configuration:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
pnpm exec nuxt prepare
|
|
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
|
-
|
|
1
|
+
# @happydesigns/ui
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@happydesigns/ui)
|
|
4
|
+
[](https://www.npmjs.com/package/@happydesigns/ui)
|
|
5
|
+
[](https://github.com/happydesigns/ui/actions/workflows/ci.yml)
|
|
6
|
+
|
|
7
|
+
Reusable Nuxt layer for happydesigns websites, docs sites, and product apps.
|
|
8
|
+
|
|
9
|
+
The package provides shared Nuxt setup, Nuxt UI conventions, content collection schemas, public `H*` components, composables, variants, and app config conventions. Projects extend the layer and keep project-specific routes, content, branding, and deployment settings in the project that owns them.
|
|
10
|
+
|
|
11
|
+
[npm](https://www.npmjs.com/package/@happydesigns/ui) · [npmx](https://npmx.dev/package/@happydesigns/ui) · [GitHub](https://github.com/happydesigns/ui)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @happydesigns/ui @nuxt/ui tailwindcss
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
export default defineNuxtConfig({
|
|
21
|
+
extends: ['@happydesigns/ui'],
|
|
22
|
+
css: ['~/assets/css/main.css'],
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Create the application's single Tailwind entry point:
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
@import "tailwindcss";
|
|
30
|
+
@import "@nuxt/ui";
|
|
31
|
+
@import "@happydesigns/ui/styles.css";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Do not register another stylesheet that imports Tailwind or Nuxt UI. Keeping one compilation context ensures that Nuxt UI's generated responsive and color-mode variants share the application's theme and source graph.
|
|
35
|
+
|
|
36
|
+
Run Nuxt preparation after changing dependencies or layer configuration:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm exec nuxt prepare
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Content collections
|
|
43
|
+
|
|
44
|
+
The layer exports reusable schema profiles, but it does not register collection names, sources, or route prefixes for an application. Define those locally in the consumer's `content.config.ts`:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { collectionSchemas } from '@happydesigns/ui/schemas'
|
|
48
|
+
import { defineCollection, defineContentConfig } from '@nuxt/content'
|
|
49
|
+
|
|
50
|
+
export default defineContentConfig({
|
|
51
|
+
collections: {
|
|
52
|
+
news: defineCollection({
|
|
53
|
+
type: 'page',
|
|
54
|
+
source: 'news/**/*.md',
|
|
55
|
+
schema: collectionSchemas.article,
|
|
56
|
+
}),
|
|
57
|
+
legal: defineCollection({
|
|
58
|
+
type: 'page',
|
|
59
|
+
source: 'legal/**/*.md',
|
|
60
|
+
schema: collectionSchemas.content,
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This keeps the shared field model convenient while leaving collection names, file structure, routing, indexes, and additional project schemas under application control.
|
|
67
|
+
|
|
68
|
+
## Development
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pnpm install
|
|
72
|
+
pnpm prepare
|
|
73
|
+
pnpm dev
|
|
74
|
+
pnpm build
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`pnpm dev` starts the playground app. `pnpm build` builds the playground.
|
|
78
|
+
|
|
79
|
+
## Product Docs
|
|
80
|
+
|
|
81
|
+
The product docs live in `docs/` and are built with Docus.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pnpm docs
|
|
85
|
+
pnpm docs:build
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`pnpm docs:build` generates a static Docus build in `docs/.output/public`. Use `pnpm docs:build:server` only when the deployment target needs a server-capable Docus build for live MCP support.
|
|
89
|
+
|
|
90
|
+
The docs explain how to use the layer, content model, components, composables, variants, and configuration. Component props, slots, examples, variants, and collection tables are generated from the package source where possible.
|
|
91
|
+
|
|
92
|
+
## Package Scope
|
|
93
|
+
|
|
94
|
+
This package owns reusable interface and content foundations. It does not own project copy, customer-specific routes, final brand assets, deployment settings, or product-specific domain behavior.
|
|
95
|
+
|
|
96
|
+
Use the product docs for usage guidance. Use the source files for implementation facts.
|
package/app/app.config.ts
CHANGED
|
@@ -1,139 +1,143 @@
|
|
|
1
|
-
import type { AppConfigInput as NuxtUiConfigInput } from '@nuxt/schema'
|
|
1
|
+
import type { AppConfigInput as NuxtUiConfigInput } from '@nuxt/schema'
|
|
2
2
|
import type { BadgeProps, ButtonProps } from '@nuxt/ui'
|
|
3
|
-
import type { AppConfigInput as LayerAppConfigInput } from 'nuxt/schema'
|
|
4
|
-
import type { QueryConfig, SearchConfig } from './types/config'
|
|
5
|
-
|
|
6
|
-
export * from './types/config'
|
|
7
|
-
|
|
8
|
-
const ui = {
|
|
9
|
-
main: {
|
|
10
|
-
base: 'wrap-break-word',
|
|
11
|
-
},
|
|
12
|
-
} satisfies NonNullable<NuxtUiConfigInput['ui']>
|
|
13
|
-
|
|
14
|
-
export default defineAppConfig({
|
|
15
|
-
variants: {
|
|
16
|
-
// UI feature variants — config overrides (extends defined in nuxt.config.ts)
|
|
17
|
-
user: { config: { user: { target: '_blank' } } },
|
|
18
|
-
backButton: { config: { backButton: { icon: 'i-ph-arrow-left', label: 'Back' } as Pick<ButtonProps, 'icon' | 'label' | 'to'> } },
|
|
19
|
-
copyButton: {
|
|
20
|
-
config: {
|
|
21
|
-
copyButton: {
|
|
22
|
-
icon: 'i-ph-link-simple-duotone',
|
|
23
|
-
label: 'Copy URL',
|
|
24
|
-
successIcon: 'i-lucide-copy-check',
|
|
25
|
-
successLabel: 'Link copied to clipboard',
|
|
26
|
-
errorIcon: 'i-lucide-copy-x',
|
|
27
|
-
errorLabel: 'Link could not be copied',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
separator: { config: { separator: { buttons: [], separator: 'or' } } },
|
|
32
|
-
surround: {
|
|
33
|
-
config: {
|
|
34
|
-
surround: {
|
|
35
|
-
show: true,
|
|
36
|
-
prevIcon: 'i-lucide-arrow-left',
|
|
37
|
-
nextIcon: 'i-lucide-arrow-right',
|
|
38
|
-
prevLabel: 'Previous',
|
|
39
|
-
nextLabel: 'Next',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
// Collection variants — runtime config overrides only
|
|
45
|
-
article: {
|
|
46
|
-
config: {
|
|
47
|
-
query: {
|
|
48
|
-
fields: ['title', 'description', 'published', 'date'],
|
|
49
|
-
order: { field: 'date', direction: 'DESC' },
|
|
50
|
-
where: [{ field: 'published', operator: '=', value: true }],
|
|
51
|
-
} as QueryConfig,
|
|
52
|
-
categories: {} as Record<string, BadgeProps>,
|
|
53
|
-
breadcrumbs: [],
|
|
54
|
-
list: {
|
|
55
|
-
itemsPerPage: 12,
|
|
56
|
-
labelAll: 'All',
|
|
57
|
-
noResultsMessage: 'No articles found.',
|
|
58
|
-
noResultsIcon: 'i-ph-article-ny-times-light',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
event: {
|
|
63
|
-
config: {
|
|
64
|
-
query: {
|
|
65
|
-
fields: ['title', 'description', 'published', 'date', 'dateEnd', 'location'],
|
|
66
|
-
order: { field: 'date', direction: 'DESC' },
|
|
67
|
-
where: [{ field: 'published', operator: '=', value: true }],
|
|
68
|
-
} as QueryConfig,
|
|
69
|
-
categories: {} as Record<string, BadgeProps>,
|
|
70
|
-
breadcrumbs: [],
|
|
71
|
-
list: {
|
|
72
|
-
itemsPerPage: 12,
|
|
73
|
-
labelAll: 'All',
|
|
74
|
-
noResultsMessage: 'No events found.',
|
|
75
|
-
noResultsIcon: 'i-ph-calendar-blank',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
app: {
|
|
82
|
-
meta: {
|
|
83
|
-
copyright: {},
|
|
84
|
-
socials: [],
|
|
85
|
-
github: {
|
|
86
|
-
repo: '',
|
|
87
|
-
branch: 'main',
|
|
88
|
-
dir: 'content',
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
links: {
|
|
93
|
-
header: [],
|
|
94
|
-
footer: [],
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
3
|
+
import type { AppConfigInput as LayerAppConfigInput } from 'nuxt/schema'
|
|
4
|
+
import type { QueryConfig, SearchConfig } from './types/config'
|
|
5
|
+
|
|
6
|
+
export * from './types/config'
|
|
7
|
+
|
|
8
|
+
const ui = {
|
|
9
|
+
main: {
|
|
10
|
+
base: 'wrap-break-word',
|
|
11
|
+
},
|
|
12
|
+
} satisfies NonNullable<NuxtUiConfigInput['ui']>
|
|
13
|
+
|
|
14
|
+
export default defineAppConfig({
|
|
15
|
+
variants: {
|
|
16
|
+
// UI feature variants — config overrides (extends defined in nuxt.config.ts)
|
|
17
|
+
user: { config: { user: { target: '_blank' } } },
|
|
18
|
+
backButton: { config: { backButton: { icon: 'i-ph-arrow-left', label: 'Back' } as Pick<ButtonProps, 'icon' | 'label' | 'to'> } },
|
|
19
|
+
copyButton: {
|
|
20
|
+
config: {
|
|
21
|
+
copyButton: {
|
|
22
|
+
icon: 'i-ph-link-simple-duotone',
|
|
23
|
+
label: 'Copy URL',
|
|
24
|
+
successIcon: 'i-lucide-copy-check',
|
|
25
|
+
successLabel: 'Link copied to clipboard',
|
|
26
|
+
errorIcon: 'i-lucide-copy-x',
|
|
27
|
+
errorLabel: 'Link could not be copied',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
separator: { config: { separator: { buttons: [], separator: 'or' } } },
|
|
32
|
+
surround: {
|
|
33
|
+
config: {
|
|
34
|
+
surround: {
|
|
35
|
+
show: true,
|
|
36
|
+
prevIcon: 'i-lucide-arrow-left',
|
|
37
|
+
nextIcon: 'i-lucide-arrow-right',
|
|
38
|
+
prevLabel: 'Previous',
|
|
39
|
+
nextLabel: 'Next',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// Collection variants — runtime config overrides only
|
|
45
|
+
article: {
|
|
46
|
+
config: {
|
|
47
|
+
query: {
|
|
48
|
+
fields: ['title', 'description', 'published', 'date'],
|
|
49
|
+
order: { field: 'date', direction: 'DESC' },
|
|
50
|
+
where: [{ field: 'published', operator: '=', value: true }],
|
|
51
|
+
} as QueryConfig,
|
|
52
|
+
categories: {} as Record<string, BadgeProps>,
|
|
53
|
+
breadcrumbs: [],
|
|
54
|
+
list: {
|
|
55
|
+
itemsPerPage: 12,
|
|
56
|
+
labelAll: 'All',
|
|
57
|
+
noResultsMessage: 'No articles found.',
|
|
58
|
+
noResultsIcon: 'i-ph-article-ny-times-light',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
event: {
|
|
63
|
+
config: {
|
|
64
|
+
query: {
|
|
65
|
+
fields: ['title', 'description', 'published', 'date', 'dateEnd', 'location'],
|
|
66
|
+
order: { field: 'date', direction: 'DESC' },
|
|
67
|
+
where: [{ field: 'published', operator: '=', value: true }],
|
|
68
|
+
} as QueryConfig,
|
|
69
|
+
categories: {} as Record<string, BadgeProps>,
|
|
70
|
+
breadcrumbs: [],
|
|
71
|
+
list: {
|
|
72
|
+
itemsPerPage: 12,
|
|
73
|
+
labelAll: 'All',
|
|
74
|
+
noResultsMessage: 'No events found.',
|
|
75
|
+
noResultsIcon: 'i-ph-calendar-blank',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
app: {
|
|
82
|
+
meta: {
|
|
83
|
+
copyright: {},
|
|
84
|
+
socials: [],
|
|
85
|
+
github: {
|
|
86
|
+
repo: '',
|
|
87
|
+
branch: 'main',
|
|
88
|
+
dir: 'content',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
links: {
|
|
93
|
+
header: [],
|
|
94
|
+
footer: [],
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
content: {
|
|
98
|
+
userCollection: 'user',
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
search: {
|
|
102
|
+
title: 'Search',
|
|
103
|
+
description: 'Search the site content.',
|
|
104
|
+
placeholder: 'Search content…',
|
|
105
|
+
resultLimit: 20,
|
|
106
|
+
links: [],
|
|
107
|
+
groups: [],
|
|
108
|
+
cache: {
|
|
109
|
+
sharedMaxAge: 300,
|
|
110
|
+
staleWhileRevalidate: 3600,
|
|
111
|
+
},
|
|
112
|
+
error: {
|
|
113
|
+
title: 'Search unavailable',
|
|
114
|
+
description: 'The search index could not be loaded.',
|
|
115
|
+
retryLabel: 'Try again',
|
|
116
|
+
},
|
|
117
|
+
collections: [],
|
|
118
|
+
} satisfies SearchConfig,
|
|
119
|
+
|
|
120
|
+
icons: {} as Record<string, string>,
|
|
121
|
+
|
|
122
|
+
toc: {
|
|
123
|
+
title: '',
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
date: {
|
|
127
|
+
locale: 'en',
|
|
128
|
+
options: {
|
|
129
|
+
year: 'numeric',
|
|
130
|
+
month: 'short',
|
|
131
|
+
day: 'numeric',
|
|
132
|
+
} as Intl.DateTimeFormatOptions,
|
|
133
|
+
datetimeOptions: {
|
|
134
|
+
year: 'numeric',
|
|
135
|
+
month: 'short',
|
|
136
|
+
day: 'numeric',
|
|
137
|
+
hour: 'numeric',
|
|
138
|
+
minute: 'numeric',
|
|
139
|
+
} as Intl.DateTimeFormatOptions,
|
|
140
|
+
},
|
|
137
141
|
},
|
|
138
142
|
|
|
139
143
|
// The object is validated above; this bridges Nuxt's generated runtime-complete layer type.
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { PageCollections } from '@nuxt/content'
|
|
2
3
|
import type { Component } from 'vue'
|
|
4
|
+
import type { PageCollectionName } from '../types/content'
|
|
3
5
|
|
|
4
6
|
const props = withDefaults(defineProps<{
|
|
5
7
|
path: string
|
|
8
|
+
/** Consumer-owned page collection containing the fragment. */
|
|
9
|
+
collection?: PageCollectionName
|
|
6
10
|
prose?: boolean
|
|
7
11
|
components?: Record<string, Component>
|
|
8
12
|
}>(), {
|
|
13
|
+
collection: 'snippet',
|
|
9
14
|
prose: true,
|
|
10
15
|
components: undefined,
|
|
11
16
|
})
|
|
12
17
|
|
|
13
18
|
const path = computed(() => props.path)
|
|
14
|
-
const key = computed(() =>
|
|
19
|
+
const key = computed(() => `${props.collection}:${path.value}`)
|
|
15
20
|
|
|
16
21
|
const { data: snippet } = await useAsyncData(
|
|
17
22
|
key,
|
|
18
|
-
() => queryCollection(
|
|
23
|
+
() => queryCollection(props.collection as keyof PageCollections)
|
|
19
24
|
.path(path.value)
|
|
20
25
|
.first(),
|
|
21
26
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<script setup lang="ts" generic="C extends
|
|
2
|
-
import type { PageCollections } from '@nuxt/content'
|
|
1
|
+
<script setup lang="ts" generic="C extends PageCollectionName = 'article'">
|
|
3
2
|
import type { ArticleFilter } from '../../composables/useArticleList'
|
|
3
|
+
import type { PageCollectionName } from '../../types/content'
|
|
4
4
|
|
|
5
5
|
const props = withDefaults(defineProps<{
|
|
6
6
|
/** Optional fixed category to filter by */
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
interface HeaderBodyPage {
|
|
5
|
-
path?: string
|
|
6
|
-
authors?: string[]
|
|
7
|
-
links?:
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const props = defineProps<{
|
|
11
|
-
page?: HeaderBodyPage
|
|
12
|
-
collection?:
|
|
13
|
-
}>()
|
|
14
|
-
|
|
15
|
-
const { has } = useVariant(() => props.collection || 'article')
|
|
16
|
-
const hasAuthors = has('authors')
|
|
17
|
-
const hasLinks = has('links')
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<div class="mt-4 all:flex flex-wrap items-center gap-3">
|
|
22
|
-
<HAuthors v-if="hasAuthors" :authors="page?.authors" />
|
|
23
|
-
<HLinks v-if="hasLinks && page?.links?.length" :links="page.links" />
|
|
24
|
-
<slot />
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ContentLink, PageCollectionName } from '../../types/content'
|
|
3
|
+
|
|
4
|
+
interface HeaderBodyPage {
|
|
5
|
+
path?: string
|
|
6
|
+
authors?: string[]
|
|
7
|
+
links?: ContentLink[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
page?: HeaderBodyPage
|
|
12
|
+
collection?: PageCollectionName
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const { has } = useVariant(() => props.collection || 'article')
|
|
16
|
+
const hasAuthors = has('authors')
|
|
17
|
+
const hasLinks = has('links')
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div class="mt-4 all:flex flex-wrap items-center gap-3">
|
|
22
|
+
<HAuthors v-if="hasAuthors" :authors="page?.authors" />
|
|
23
|
+
<HLinks v-if="hasLinks && page?.links?.length" :links="page.links" />
|
|
24
|
+
<slot />
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
interface HeadlineMetaPage {
|
|
5
|
-
path?: string
|
|
6
|
-
category?: string
|
|
7
|
-
date?: string
|
|
8
|
-
dateEnd?: string
|
|
9
|
-
location?: {
|
|
10
|
-
name?: string
|
|
11
|
-
url?: string
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const props = defineProps<{
|
|
16
|
-
page?: HeadlineMetaPage
|
|
17
|
-
collection?:
|
|
18
|
-
}>()
|
|
19
|
-
|
|
20
|
-
const { has } = useVariant(() => props.collection || 'article')
|
|
21
|
-
|
|
22
|
-
const showCategory = computed(() => has('category').value && Boolean(props.page?.category))
|
|
23
|
-
const showDates = computed(() => has('dates').value && Boolean(props.page?.date))
|
|
24
|
-
const showLocation = computed(() => has('location').value && Boolean(props.page?.location?.name))
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<template>
|
|
28
|
-
<div class="all:flex flex-wrap items-center gap-x-3 gap-y-2 text-muted">
|
|
29
|
-
<HCategory v-if="showCategory" :category="page?.category" />
|
|
30
|
-
|
|
31
|
-
<span v-if="showCategory && showDates" class="all:hidden sm:inline opacity-50">·</span>
|
|
32
|
-
<HDates v-if="showDates" :date="page?.date" :date-end="page?.dateEnd" />
|
|
33
|
-
|
|
34
|
-
<span v-if="(showCategory || showDates) && showLocation" class="all:hidden sm:inline opacity-50">·</span>
|
|
35
|
-
<HLocation v-if="showLocation" :location="page?.location" />
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PageCollectionName } from '../../types/content'
|
|
3
|
+
|
|
4
|
+
interface HeadlineMetaPage {
|
|
5
|
+
path?: string
|
|
6
|
+
category?: string
|
|
7
|
+
date?: string
|
|
8
|
+
dateEnd?: string
|
|
9
|
+
location?: {
|
|
10
|
+
name?: string
|
|
11
|
+
url?: string
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
page?: HeadlineMetaPage
|
|
17
|
+
collection?: PageCollectionName
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const { has } = useVariant(() => props.collection || 'article')
|
|
21
|
+
|
|
22
|
+
const showCategory = computed(() => has('category').value && Boolean(props.page?.category))
|
|
23
|
+
const showDates = computed(() => has('dates').value && Boolean(props.page?.date))
|
|
24
|
+
const showLocation = computed(() => has('location').value && Boolean(props.page?.location?.name))
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div class="all:flex flex-wrap items-center gap-x-3 gap-y-2 text-muted">
|
|
29
|
+
<HCategory v-if="showCategory" :category="page?.category" />
|
|
30
|
+
|
|
31
|
+
<span v-if="showCategory && showDates" class="all:hidden sm:inline opacity-50">·</span>
|
|
32
|
+
<HDates v-if="showDates" :date="page?.date" :date-end="page?.dateEnd" />
|
|
33
|
+
|
|
34
|
+
<span v-if="(showCategory || showDates) && showLocation" class="all:hidden sm:inline opacity-50">·</span>
|
|
35
|
+
<HLocation v-if="showLocation" :location="page?.location" />
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<script setup lang="ts" generic="C extends
|
|
2
|
-
import type { PageCollections } from '@nuxt/content'
|
|
1
|
+
<script setup lang="ts" generic="C extends PageCollectionName = 'article'">
|
|
3
2
|
import type { ArticleFilter } from '../../composables/useArticleList'
|
|
3
|
+
import type { PageCollectionName } from '../../types/content'
|
|
4
4
|
import { useArticleListQuery } from '../../composables/useArticleListQuery'
|
|
5
5
|
|
|
6
6
|
const props = withDefaults(defineProps<{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { PageCollectionName } from '../../types/content'
|
|
3
3
|
|
|
4
4
|
const { collection = 'article', path } = defineProps<{
|
|
5
|
-
collection?:
|
|
5
|
+
collection?: PageCollectionName
|
|
6
6
|
path?: string
|
|
7
7
|
}>()
|
|
8
8
|
|
|
@@ -7,9 +7,10 @@ const props = defineProps<{
|
|
|
7
7
|
config?: { user?: Partial<UserProps> }
|
|
8
8
|
}>()
|
|
9
9
|
|
|
10
|
+
const appConfig = useAppConfig()
|
|
10
11
|
const userProps = computed(() => ({ ...(props.config?.user ?? {}), ...(props.target ? { target: props.target } : {}) }))
|
|
11
12
|
|
|
12
|
-
const resolvedAuthors = await resolveUsers(props.authors || [], userProps.value)
|
|
13
|
+
const resolvedAuthors = await resolveUsers(props.authors || [], userProps.value, appConfig.app.content.userCollection)
|
|
13
14
|
</script>
|
|
14
15
|
|
|
15
16
|
<template>
|