@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.
Files changed (37) hide show
  1. package/README.md +94 -94
  2. package/app/app.config.ts +168 -169
  3. package/app/app.vue +11 -0
  4. package/app/components/article/ArticleGrid.vue +125 -149
  5. package/app/components/article/ArticleHeaderBody.vue +20 -20
  6. package/app/components/article/ArticleHeadlineMeta.vue +26 -26
  7. package/app/components/article/ArticleList.vue +80 -95
  8. package/app/components/article/ArticlePage.vue +15 -14
  9. package/app/components/footer/FooterColumnHeading.vue +5 -5
  10. package/app/components/footer/FooterCopyright.vue +29 -29
  11. package/app/components/traits/Authors.vue +19 -20
  12. package/app/components/traits/BackButton.vue +15 -26
  13. package/app/components/traits/Category.vue +9 -9
  14. package/app/components/traits/CopyButton.vue +32 -39
  15. package/app/components/traits/Dates.vue +20 -20
  16. package/app/components/traits/Links.vue +17 -17
  17. package/app/components/traits/Location.vue +20 -20
  18. package/app/components/traits/Separator.vue +21 -26
  19. package/app/components/traits/SeparatorButtons.vue +53 -56
  20. package/app/components/traits/Surround.vue +48 -60
  21. package/app/components/traits/Toc.vue +16 -16
  22. package/app/composables/useArticleList.ts +24 -26
  23. package/app/composables/useArticleListQuery.ts +54 -0
  24. package/app/composables/useCategoryBadge.ts +27 -27
  25. package/app/composables/useClipboard.ts +26 -26
  26. package/app/composables/usePageContent.ts +18 -18
  27. package/app/composables/usePageSeo.ts +30 -30
  28. package/app/layouts/article.vue +117 -125
  29. package/app/layouts/content.vue +57 -65
  30. package/app/layouts/default.vue +3 -12
  31. package/app/types/config.ts +13 -6
  32. package/content.config.ts +6 -6
  33. package/nuxt.config.ts +80 -80
  34. package/package.json +3 -3
  35. package/schemas/collections.ts +46 -46
  36. package/schemas/index.ts +2 -2
  37. 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
- export * from './types/config'
4
-
5
- export default defineAppConfig({
6
- variants: {
7
- // UI feature variants — config overrides (extends defined in nuxt.config.ts)
8
- user: { config: { user: { target: '_blank' } } },
9
- backButton: { config: { backButton: { icon: 'i-ph-arrow-left', label: 'Back' } as Pick<ButtonProps, 'icon' | 'label' | 'to'> } },
10
- dates: { config: { helloThere: 'general kenobi' } },
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
- youShallNot: 'pass',
38
- query: {
39
- fields: ['title', 'description', 'status', 'date'],
40
- order: { field: 'date', direction: 'DESC' },
41
- where: [{ field: 'status', operator: '=', value: 'published' }],
42
- },
43
- categories: {},
44
- breadcrumbs: [],
45
- list: {
46
- itemsPerPage: 12,
47
- labelAll: 'All',
48
- noResultsMessage: 'No articles found.',
49
- noResultsIcon: 'i-ph-article-ny-times-light',
50
- },
51
- },
52
- },
53
- event: {
54
- config: {
55
- query: {
56
- fields: ['title', 'description', 'status', 'date', 'dateEnd', 'location'],
57
- order: { field: 'date', direction: 'DESC' },
58
- where: [{ field: 'status', operator: '=', value: 'published' }],
59
- },
60
- categories: {},
61
- breadcrumbs: [],
62
- list: {
63
- itemsPerPage: 12,
64
- labelAll: 'All',
65
- noResultsMessage: 'No events found.',
66
- noResultsIcon: 'i-ph-calendar-blank',
67
- },
68
- },
69
- },
70
- },
71
-
72
- app: {
73
- meta: {
74
- copyright: {},
75
- socials: [],
76
- github: {
77
- repo: '',
78
- branch: 'main',
79
- dir: 'content',
80
- },
81
- },
82
-
83
- links: {
84
- header: [],
85
- footer: [],
86
- },
87
-
88
- icons: {} as Record<string, string>,
89
-
90
- toc: {
91
- title: '',
92
- },
93
-
94
- date: {
95
- locale: 'en',
96
- options: {
97
- year: 'numeric',
98
- month: 'short',
99
- day: 'numeric',
100
- } as Intl.DateTimeFormatOptions,
101
- datetimeOptions: {
102
- year: 'numeric',
103
- month: 'short',
104
- day: 'numeric',
105
- hour: 'numeric',
106
- minute: 'numeric',
107
- } as Intl.DateTimeFormatOptions,
108
- },
109
- },
110
-
111
- ui: {
112
- main: {
113
- base: 'wrap-break-word',
114
- },
115
- footerColumns: {
116
- slots: {},
117
- columns: {},
118
- },
119
- },
120
- })
121
-
122
- declare module '@nuxt/schema' {
123
- interface AppConfigInput {
124
- app?: {
125
- [key: string]: any
126
- meta?: {
127
- copyright?: {
128
- /** The year in which the copyright was issued */
129
- copyrightYear?: number
130
- /** The name of the copyright holder */
131
- copyrightHolder?: string
132
- /** The homepage URL of the copyright holder */
133
- copyrightHomepage?: string
134
- }
135
- /** Social button definitions (e.g. Instagram, Facebook, GitHub) */
136
- socials?: Array<ButtonProps>
137
- /** Configuration for GitHub repository info */
138
- github?: {
139
- /** The repository identifier (e.g. 'sfbiberach/schachfreunde-biberach.de') */
140
- repo?: string
141
- /** The branch name (e.g. 'main') */
142
- branch?: string
143
- /** The directory where the content is stored (e.g. 'content') */
144
- dir?: string
145
- }
146
- }
147
- /** Link collections for various UI regions (e.g. header, footer) */
148
- links?: {
149
- header?: Array<FooterColumn>
150
- footer?: Array<FooterColumn>
151
- }
152
- /** Configuration for the table of contents */
153
- toc?: {
154
- /** The default title to be shown in the table of contents */
155
- title?: string
156
- }
157
- /** A mapping of internal identifier strings to icon strings */
158
- icons?: Record<string, string>
159
- date?: {
160
- /** The locale used for date formatting (e.g. 'en', 'de') */
161
- locale?: string
162
- /** Options for Intl.DateTimeFormat for dates */
163
- options?: Intl.DateTimeFormatOptions
164
- /** Options for Intl.DateTimeFormat for datetimes */
165
- datetimeOptions?: Intl.DateTimeFormatOptions
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
+ }
package/app/app.vue ADDED
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <UApp>
3
+ <AppHeader />
4
+ <UMain>
5
+ <NuxtLayout>
6
+ <NuxtPage />
7
+ </NuxtLayout>
8
+ </UMain>
9
+ <AppFooter />
10
+ </UApp>
11
+ </template>