@happydesigns/ui 0.13.5 → 0.15.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 (40) hide show
  1. package/README.md +53 -94
  2. package/app/app.config.ts +168 -169
  3. package/app/app.vue +11 -0
  4. package/app/components/article/ArticleGrid.vue +134 -158
  5. package/app/components/article/ArticleGridDate.vue +1 -1
  6. package/app/components/article/ArticleHeaderBody.vue +20 -20
  7. package/app/components/article/ArticleHeadlineMeta.vue +26 -26
  8. package/app/components/article/ArticleList.vue +80 -95
  9. package/app/components/article/ArticlePage.vue +17 -16
  10. package/app/components/footer/FooterColumnHeading.vue +5 -5
  11. package/app/components/footer/FooterColumns.vue +16 -20
  12. package/app/components/footer/FooterCopyright.vue +35 -29
  13. package/app/components/traits/Authors.vue +21 -20
  14. package/app/components/traits/BackButton.vue +15 -26
  15. package/app/components/traits/Category.vue +9 -9
  16. package/app/components/traits/CopyButton.vue +32 -39
  17. package/app/components/traits/Dates.vue +20 -20
  18. package/app/components/traits/Links.vue +17 -17
  19. package/app/components/traits/Location.vue +20 -20
  20. package/app/components/traits/Separator.vue +21 -26
  21. package/app/components/traits/SeparatorButtons.vue +54 -56
  22. package/app/components/traits/Surround.vue +51 -60
  23. package/app/components/traits/Toc.vue +16 -16
  24. package/app/composables/useArticleList.ts +13 -15
  25. package/app/composables/useArticleListQuery.ts +54 -0
  26. package/app/composables/useCategoryBadge.ts +27 -27
  27. package/app/composables/useClipboard.ts +26 -26
  28. package/app/composables/usePageContent.ts +18 -18
  29. package/app/composables/usePageSeo.ts +30 -30
  30. package/app/layouts/article.vue +120 -128
  31. package/app/layouts/content.vue +59 -67
  32. package/app/layouts/default.vue +1 -10
  33. package/app/types/config.ts +13 -6
  34. package/app/utils/resolveUsers.ts +32 -3
  35. package/content.config.ts +6 -6
  36. package/nuxt.config.ts +72 -80
  37. package/package.json +29 -18
  38. package/schemas/collections.ts +46 -46
  39. package/schemas/index.ts +2 -2
  40. package/schemas/traits.ts +90 -90
package/README.md CHANGED
@@ -1,94 +1,53 @@
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
+ Reusable Nuxt layer for happydesigns websites, docs sites, and product apps.
4
+
5
+ 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.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pnpm add @happydesigns/ui
11
+ ```
12
+
13
+ ```ts
14
+ export default defineNuxtConfig({
15
+ extends: ['@happydesigns/ui'],
16
+ })
17
+ ```
18
+
19
+ Run Nuxt preparation after changing dependencies or layer configuration:
20
+
21
+ ```bash
22
+ pnpm exec nuxt prepare
23
+ ```
24
+
25
+ ## Development
26
+
27
+ ```bash
28
+ pnpm install
29
+ pnpm prepare
30
+ pnpm dev
31
+ pnpm build
32
+ ```
33
+
34
+ `pnpm dev` starts the playground app. `pnpm build` builds the playground.
35
+
36
+ ## Product Docs
37
+
38
+ The product docs live in `docs/` and are built with Docus.
39
+
40
+ ```bash
41
+ pnpm docs
42
+ pnpm docs:build
43
+ ```
44
+
45
+ `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.
46
+
47
+ 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.
48
+
49
+ ## Package Scope
50
+
51
+ 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.
52
+
53
+ Use the product docs for usage guidance. Use the source files for implementation facts.
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>