@happydesigns/ui 0.13.5 → 0.14.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 +94 -94
- package/app/app.config.ts +168 -169
- package/app/app.vue +11 -0
- package/app/components/article/ArticleGrid.vue +125 -149
- package/app/components/article/ArticleHeaderBody.vue +20 -20
- package/app/components/article/ArticleHeadlineMeta.vue +26 -26
- package/app/components/article/ArticleList.vue +80 -95
- package/app/components/article/ArticlePage.vue +15 -14
- package/app/components/footer/FooterColumnHeading.vue +5 -5
- package/app/components/footer/FooterCopyright.vue +29 -29
- package/app/components/traits/Authors.vue +19 -20
- package/app/components/traits/BackButton.vue +15 -26
- package/app/components/traits/Category.vue +9 -9
- package/app/components/traits/CopyButton.vue +32 -39
- package/app/components/traits/Dates.vue +20 -20
- package/app/components/traits/Links.vue +17 -17
- package/app/components/traits/Location.vue +20 -20
- package/app/components/traits/Separator.vue +21 -26
- package/app/components/traits/SeparatorButtons.vue +53 -56
- package/app/components/traits/Surround.vue +48 -60
- package/app/components/traits/Toc.vue +16 -16
- package/app/composables/useArticleList.ts +24 -26
- package/app/composables/useArticleListQuery.ts +54 -0
- package/app/composables/useCategoryBadge.ts +27 -27
- package/app/composables/useClipboard.ts +26 -26
- package/app/composables/usePageContent.ts +18 -18
- package/app/composables/usePageSeo.ts +30 -30
- package/app/layouts/article.vue +117 -125
- package/app/layouts/content.vue +57 -65
- package/app/layouts/default.vue +3 -12
- package/app/types/config.ts +13 -6
- package/content.config.ts +6 -6
- package/nuxt.config.ts +80 -80
- package/package.json +3 -3
- package/schemas/collections.ts +46 -46
- package/schemas/index.ts +2 -2
- package/schemas/traits.ts +90 -90
package/README.md
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
# @happydesigns/ui
|
|
2
|
-
|
|
3
|
-
A foundational **Nuxt Layer** providing a consistent UI and content structure for Nuxt applications. Built with Nuxt 4, Nuxt UI 4, and Nuxt Content 3.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🎨 **Nuxt UI v4 Integration**: Pre-configured with Tailwind and a set of reusable components.
|
|
8
|
-
- 📝 **Nuxt Content v3 Ready**: Provides pre-defined collections for pages and snippets to jumpstart content-driven sites.
|
|
9
|
-
- 🔌 **Extendable**: Designed as a Nuxt Layer that can be easily extended and customized by consuming projects.
|
|
10
|
-
- 🧱 **Prefixed Components**: Layer components are automatically prefixed with `H` (e.g., `<HFooterButtons />`) to avoid naming collisions.
|
|
11
|
-
- ✨ **Studio Ready**: Integrated with [Nuxt Studio](https://nuxt.studio/) for a seamless content editing experience.
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
Install the package in your Nuxt project:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
pnpm add @happydesigns/ui
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Add the layer to your `nuxt.config.ts`:
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
export default defineNuxtConfig({
|
|
25
|
-
extends: ['@happydesigns/ui']
|
|
26
|
-
})
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Configuration
|
|
30
|
-
|
|
31
|
-
This layer provides a type-safe configuration via `app.config.ts`. You can override these values in your project's own `app.config.ts`:
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
export default defineAppConfig({
|
|
35
|
-
app: {
|
|
36
|
-
meta: {
|
|
37
|
-
copyright: {
|
|
38
|
-
copyrightYear: 2026,
|
|
39
|
-
copyrightHolder: 'happydesigns',
|
|
40
|
-
copyrightHomepage: 'https://happydesigns.de'
|
|
41
|
-
},
|
|
42
|
-
socials: [
|
|
43
|
-
{ icon: 'i-simple-icons-github', to: 'https://github.com/happydesigns', target: '_blank' }
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
links: {
|
|
47
|
-
footer: [
|
|
48
|
-
{ label: 'Privacy Policy', to: '/privacy' },
|
|
49
|
-
{ label: 'Terms of Service', to: '/terms' }
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Content Configuration
|
|
57
|
-
|
|
58
|
-
By default, this layer provides a `content.config.ts` that defines two collections: `page` (sourced from `pages/`) and `snippet` (sourced from `snippets/`).
|
|
59
|
-
|
|
60
|
-
You can use these as-is by following the default directory structure, or you can define your own `content.config.ts` in your main application to extend or completely override these collections:
|
|
61
|
-
|
|
62
|
-
```ts
|
|
63
|
-
// your-app/content.config.ts
|
|
64
|
-
import { pageCollectionConfig, snippetCollectionConfig } from '@happydesigns/ui/content.config'
|
|
65
|
-
import { defineContentConfig } from '@nuxt/content'
|
|
66
|
-
|
|
67
|
-
export default defineContentConfig({
|
|
68
|
-
collections: {
|
|
69
|
-
// Reuse the layer's configs
|
|
70
|
-
page: pageCollectionConfig,
|
|
71
|
-
snippet: snippetCollectionConfig,
|
|
72
|
-
// Or add your own
|
|
73
|
-
posts: defineCollection({ })
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Development
|
|
79
|
-
|
|
80
|
-
If you want to contribute to the layer or run it locally:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# Install dependencies
|
|
84
|
-
pnpm install
|
|
85
|
-
|
|
86
|
-
# Prepare types
|
|
87
|
-
pnpm prepare
|
|
88
|
-
|
|
89
|
-
# Start the playground (dev server)
|
|
90
|
-
pnpm dev
|
|
91
|
-
|
|
92
|
-
# Build the playground
|
|
93
|
-
pnpm build
|
|
94
|
-
```
|
|
1
|
+
# @happydesigns/ui
|
|
2
|
+
|
|
3
|
+
A foundational **Nuxt Layer** providing a consistent UI and content structure for Nuxt applications. Built with Nuxt 4, Nuxt UI 4, and Nuxt Content 3.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Nuxt UI v4 Integration**: Pre-configured with Tailwind and a set of reusable components.
|
|
8
|
+
- 📝 **Nuxt Content v3 Ready**: Provides pre-defined collections for pages and snippets to jumpstart content-driven sites.
|
|
9
|
+
- 🔌 **Extendable**: Designed as a Nuxt Layer that can be easily extended and customized by consuming projects.
|
|
10
|
+
- 🧱 **Prefixed Components**: Layer components are automatically prefixed with `H` (e.g., `<HFooterButtons />`) to avoid naming collisions.
|
|
11
|
+
- ✨ **Studio Ready**: Integrated with [Nuxt Studio](https://nuxt.studio/) for a seamless content editing experience.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Install the package in your Nuxt project:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @happydesigns/ui
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Add the layer to your `nuxt.config.ts`:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
export default defineNuxtConfig({
|
|
25
|
+
extends: ['@happydesigns/ui']
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Configuration
|
|
30
|
+
|
|
31
|
+
This layer provides a type-safe configuration via `app.config.ts`. You can override these values in your project's own `app.config.ts`:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
export default defineAppConfig({
|
|
35
|
+
app: {
|
|
36
|
+
meta: {
|
|
37
|
+
copyright: {
|
|
38
|
+
copyrightYear: 2026,
|
|
39
|
+
copyrightHolder: 'happydesigns',
|
|
40
|
+
copyrightHomepage: 'https://happydesigns.de'
|
|
41
|
+
},
|
|
42
|
+
socials: [
|
|
43
|
+
{ icon: 'i-simple-icons-github', to: 'https://github.com/happydesigns', target: '_blank' }
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
links: {
|
|
47
|
+
footer: [
|
|
48
|
+
{ label: 'Privacy Policy', to: '/privacy' },
|
|
49
|
+
{ label: 'Terms of Service', to: '/terms' }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Content Configuration
|
|
57
|
+
|
|
58
|
+
By default, this layer provides a `content.config.ts` that defines two collections: `page` (sourced from `pages/`) and `snippet` (sourced from `snippets/`).
|
|
59
|
+
|
|
60
|
+
You can use these as-is by following the default directory structure, or you can define your own `content.config.ts` in your main application to extend or completely override these collections:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// your-app/content.config.ts
|
|
64
|
+
import { pageCollectionConfig, snippetCollectionConfig } from '@happydesigns/ui/content.config'
|
|
65
|
+
import { defineContentConfig } from '@nuxt/content'
|
|
66
|
+
|
|
67
|
+
export default defineContentConfig({
|
|
68
|
+
collections: {
|
|
69
|
+
// Reuse the layer's configs
|
|
70
|
+
page: pageCollectionConfig,
|
|
71
|
+
snippet: snippetCollectionConfig,
|
|
72
|
+
// Or add your own
|
|
73
|
+
posts: defineCollection({ })
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Development
|
|
79
|
+
|
|
80
|
+
If you want to contribute to the layer or run it locally:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Install dependencies
|
|
84
|
+
pnpm install
|
|
85
|
+
|
|
86
|
+
# Prepare types
|
|
87
|
+
pnpm prepare
|
|
88
|
+
|
|
89
|
+
# Start the playground (dev server)
|
|
90
|
+
pnpm dev
|
|
91
|
+
|
|
92
|
+
# Build the playground
|
|
93
|
+
pnpm build
|
|
94
|
+
```
|
package/app/app.config.ts
CHANGED
|
@@ -1,169 +1,168 @@
|
|
|
1
|
-
import type { ButtonProps, FooterColumn } from '@nuxt/ui'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
copyButton: {
|
|
12
|
-
config: {
|
|
13
|
-
copyButton: {
|
|
14
|
-
icon: 'i-ph-link-simple-duotone',
|
|
15
|
-
label: 'Copy URL',
|
|
16
|
-
successIcon: 'i-lucide-copy-check',
|
|
17
|
-
successLabel: 'Link copied to clipboard',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
separator: { config: { separator: { buttons: [], separator: 'or' } } },
|
|
22
|
-
surround: {
|
|
23
|
-
config: {
|
|
24
|
-
surround: {
|
|
25
|
-
show: true,
|
|
26
|
-
prevIcon: 'i-lucide-arrow-left',
|
|
27
|
-
nextIcon: 'i-lucide-arrow-right',
|
|
28
|
-
prevLabel: 'Previous',
|
|
29
|
-
nextLabel: 'Next',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
// Collection variants — runtime config overrides only
|
|
35
|
-
article: {
|
|
36
|
-
config: {
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
1
|
+
import type { BadgeProps, ButtonProps, FooterColumn } from '@nuxt/ui'
|
|
2
|
+
import type { QueryConfig } from './types/config'
|
|
3
|
+
|
|
4
|
+
export * from './types/config'
|
|
5
|
+
|
|
6
|
+
export default defineAppConfig({
|
|
7
|
+
variants: {
|
|
8
|
+
// UI feature variants — config overrides (extends defined in nuxt.config.ts)
|
|
9
|
+
user: { config: { user: { target: '_blank' } } },
|
|
10
|
+
backButton: { config: { backButton: { icon: 'i-ph-arrow-left', label: 'Back' } as Pick<ButtonProps, 'icon' | 'label' | 'to'> } },
|
|
11
|
+
copyButton: {
|
|
12
|
+
config: {
|
|
13
|
+
copyButton: {
|
|
14
|
+
icon: 'i-ph-link-simple-duotone',
|
|
15
|
+
label: 'Copy URL',
|
|
16
|
+
successIcon: 'i-lucide-copy-check',
|
|
17
|
+
successLabel: 'Link copied to clipboard',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
separator: { config: { separator: { buttons: [], separator: 'or' } } },
|
|
22
|
+
surround: {
|
|
23
|
+
config: {
|
|
24
|
+
surround: {
|
|
25
|
+
show: true,
|
|
26
|
+
prevIcon: 'i-lucide-arrow-left',
|
|
27
|
+
nextIcon: 'i-lucide-arrow-right',
|
|
28
|
+
prevLabel: 'Previous',
|
|
29
|
+
nextLabel: 'Next',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
// Collection variants — runtime config overrides only
|
|
35
|
+
article: {
|
|
36
|
+
config: {
|
|
37
|
+
query: {
|
|
38
|
+
fields: ['title', 'description', 'status', 'date'],
|
|
39
|
+
order: { field: 'date', direction: 'DESC' },
|
|
40
|
+
where: [{ field: 'status', operator: '=', value: 'published' }],
|
|
41
|
+
} as QueryConfig,
|
|
42
|
+
categories: {} as Record<string, BadgeProps>,
|
|
43
|
+
breadcrumbs: [],
|
|
44
|
+
list: {
|
|
45
|
+
itemsPerPage: 12,
|
|
46
|
+
labelAll: 'All',
|
|
47
|
+
noResultsMessage: 'No articles found.',
|
|
48
|
+
noResultsIcon: 'i-ph-article-ny-times-light',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
event: {
|
|
53
|
+
config: {
|
|
54
|
+
query: {
|
|
55
|
+
fields: ['title', 'description', 'status', 'date', 'dateEnd', 'location'],
|
|
56
|
+
order: { field: 'date', direction: 'DESC' },
|
|
57
|
+
where: [{ field: 'status', operator: '=', value: 'published' }],
|
|
58
|
+
} as QueryConfig,
|
|
59
|
+
categories: {} as Record<string, BadgeProps>,
|
|
60
|
+
breadcrumbs: [],
|
|
61
|
+
list: {
|
|
62
|
+
itemsPerPage: 12,
|
|
63
|
+
labelAll: 'All',
|
|
64
|
+
noResultsMessage: 'No events found.',
|
|
65
|
+
noResultsIcon: 'i-ph-calendar-blank',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
app: {
|
|
72
|
+
meta: {
|
|
73
|
+
copyright: {},
|
|
74
|
+
socials: [],
|
|
75
|
+
github: {
|
|
76
|
+
repo: '',
|
|
77
|
+
branch: 'main',
|
|
78
|
+
dir: 'content',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
links: {
|
|
83
|
+
header: [],
|
|
84
|
+
footer: [],
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
icons: {} as Record<string, string>,
|
|
88
|
+
|
|
89
|
+
toc: {
|
|
90
|
+
title: '',
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
date: {
|
|
94
|
+
locale: 'en',
|
|
95
|
+
options: {
|
|
96
|
+
year: 'numeric',
|
|
97
|
+
month: 'short',
|
|
98
|
+
day: 'numeric',
|
|
99
|
+
} as Intl.DateTimeFormatOptions,
|
|
100
|
+
datetimeOptions: {
|
|
101
|
+
year: 'numeric',
|
|
102
|
+
month: 'short',
|
|
103
|
+
day: 'numeric',
|
|
104
|
+
hour: 'numeric',
|
|
105
|
+
minute: 'numeric',
|
|
106
|
+
} as Intl.DateTimeFormatOptions,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
ui: {
|
|
111
|
+
main: {
|
|
112
|
+
base: 'wrap-break-word',
|
|
113
|
+
},
|
|
114
|
+
footerColumns: {
|
|
115
|
+
slots: {},
|
|
116
|
+
columns: {},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
declare module '@nuxt/schema' {
|
|
122
|
+
interface AppConfigInput {
|
|
123
|
+
app?: {
|
|
124
|
+
[key: string]: any
|
|
125
|
+
meta?: {
|
|
126
|
+
copyright?: {
|
|
127
|
+
/** The year in which the copyright was issued */
|
|
128
|
+
copyrightYear?: number
|
|
129
|
+
/** The name of the copyright holder */
|
|
130
|
+
copyrightHolder?: string
|
|
131
|
+
/** The homepage URL of the copyright holder */
|
|
132
|
+
copyrightHomepage?: string
|
|
133
|
+
}
|
|
134
|
+
/** Social button definitions (e.g. Instagram, Facebook, GitHub) */
|
|
135
|
+
socials?: Array<ButtonProps>
|
|
136
|
+
/** Configuration for GitHub repository info */
|
|
137
|
+
github?: {
|
|
138
|
+
/** The repository identifier (e.g. 'sfbiberach/schachfreunde-biberach.de') */
|
|
139
|
+
repo?: string
|
|
140
|
+
/** The branch name (e.g. 'main') */
|
|
141
|
+
branch?: string
|
|
142
|
+
/** The directory where the content is stored (e.g. 'content') */
|
|
143
|
+
dir?: string
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/** Link collections for various UI regions (e.g. header, footer) */
|
|
147
|
+
links?: {
|
|
148
|
+
header?: Array<FooterColumn>
|
|
149
|
+
footer?: Array<FooterColumn>
|
|
150
|
+
}
|
|
151
|
+
/** Configuration for the table of contents */
|
|
152
|
+
toc?: {
|
|
153
|
+
/** The default title to be shown in the table of contents */
|
|
154
|
+
title?: string
|
|
155
|
+
}
|
|
156
|
+
/** A mapping of internal identifier strings to icon strings */
|
|
157
|
+
icons?: Record<string, string>
|
|
158
|
+
date?: {
|
|
159
|
+
/** The locale used for date formatting (e.g. 'en', 'de') */
|
|
160
|
+
locale?: string
|
|
161
|
+
/** Options for Intl.DateTimeFormat for dates */
|
|
162
|
+
options?: Intl.DateTimeFormatOptions
|
|
163
|
+
/** Options for Intl.DateTimeFormat for datetimes */
|
|
164
|
+
datetimeOptions?: Intl.DateTimeFormatOptions
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|