@happydesigns/ui 0.19.2 → 0.19.3

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/app/app.config.ts CHANGED
@@ -1,84 +1,80 @@
1
- import type { AppConfigInput as NuxtUiConfigInput } from '@nuxt/schema'
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: {
1
+ import type { AppConfigInput } from '@nuxt/schema'
2
+ import type { BadgeProps, ButtonProps } from '@nuxt/ui'
3
+ import type { QueryConfig, SearchConfig } from './types/config'
4
+
5
+ export * from './types/config'
6
+
7
+ const ui = {
8
+ main: {
9
+ base: 'wrap-break-word',
10
+ },
11
+ } satisfies NonNullable<AppConfigInput['ui']>
12
+
13
+ export default defineAppConfig({
14
+ variants: {
15
+ user: { config: { user: { target: '_blank' } } },
16
+ backButton: { config: { backButton: { icon: 'i-ph-arrow-left', label: 'Back' } as Pick<ButtonProps, 'icon' | 'label' | 'to'> } },
17
+ copyButton: {
18
+ config: {
19
+ copyButton: {
20
+ icon: 'i-ph-link-simple-duotone',
21
+ label: 'Copy URL',
22
+ successIcon: 'i-lucide-copy-check',
23
+ successLabel: 'Link copied to clipboard',
24
+ errorIcon: 'i-lucide-copy-x',
25
+ errorLabel: 'Link could not be copied',
26
+ },
27
+ },
28
+ },
29
+ separator: { config: { separator: { buttons: [], separator: 'or' } } },
30
+ surround: {
31
+ config: {
32
+ surround: {
33
+ show: true,
34
+ prevIcon: 'i-lucide-arrow-left',
35
+ nextIcon: 'i-lucide-arrow-right',
36
+ prevLabel: 'Previous',
37
+ nextLabel: 'Next',
38
+ },
39
+ },
40
+ },
41
+ article: {
42
+ config: {
43
+ query: {
44
+ fields: ['title', 'description', 'published', 'date'],
45
+ order: { field: 'date', direction: 'DESC' },
46
+ where: [{ field: 'published', operator: '=', value: true }],
47
+ } as QueryConfig,
48
+ categories: {} as Record<string, BadgeProps>,
49
+ breadcrumbs: [],
50
+ list: {
51
+ itemsPerPage: 12,
52
+ labelAll: 'All',
53
+ noResultsMessage: 'No articles found.',
54
+ noResultsIcon: 'i-ph-article-ny-times-light',
55
+ },
56
+ },
57
+ },
58
+ event: {
59
+ config: {
60
+ query: {
61
+ fields: ['title', 'description', 'published', 'date', 'dateEnd', 'location'],
62
+ order: { field: 'date', direction: 'DESC' },
63
+ where: [{ field: 'published', operator: '=', value: true }],
64
+ } as QueryConfig,
65
+ categories: {} as Record<string, BadgeProps>,
66
+ breadcrumbs: [],
67
+ list: {
68
+ itemsPerPage: 12,
69
+ labelAll: 'All',
70
+ noResultsMessage: 'No events found.',
71
+ noResultsIcon: 'i-ph-calendar-blank',
72
+ },
73
+ },
74
+ },
75
+ },
76
+
77
+ app: {
82
78
  meta: {
83
79
  copyright: {},
84
80
  socials: [],
@@ -138,8 +134,7 @@ export default defineAppConfig({
138
134
  minute: 'numeric',
139
135
  } as Intl.DateTimeFormatOptions,
140
136
  },
141
- },
142
-
143
- // The object is validated above; this bridges Nuxt's generated runtime-complete layer type.
144
- ui: ui as unknown as LayerAppConfigInput['ui'],
145
- })
137
+ },
138
+
139
+ ui,
140
+ })
@@ -0,0 +1,40 @@
1
+ <script setup lang="ts">
2
+ import type { BreadcrumbItem } from '@nuxt/ui'
3
+
4
+ const props = withDefaults(defineProps<{
5
+ items?: BreadcrumbItem[]
6
+ current?: BreadcrumbItem
7
+ }>(), {
8
+ items: () => [],
9
+ })
10
+
11
+ const breadcrumbItems = computed(() => {
12
+ const baseItems = props.items.map((item, index) => ({
13
+ ...item,
14
+ ui: {
15
+ ...item.ui,
16
+ ...(index === 0 ? { item: 'shrink-0', link: 'shrink-0' } : {}),
17
+ ...(props.current && index === props.items.length - 1
18
+ ? { separator: 'hidden sm:flex' }
19
+ : {}),
20
+ },
21
+ }))
22
+
23
+ return props.current
24
+ ? [
25
+ ...baseItems,
26
+ {
27
+ ...props.current,
28
+ ui: { ...props.current.ui, item: 'hidden sm:flex' },
29
+ },
30
+ ]
31
+ : baseItems
32
+ })
33
+ </script>
34
+
35
+ <template>
36
+ <UBreadcrumb
37
+ :ui="{ root: 'max-w-full' }"
38
+ :items="breadcrumbItems"
39
+ />
40
+ </template>
@@ -2,13 +2,14 @@
2
2
  import type { BreadcrumbItem } from '@nuxt/ui'
3
3
  import type { PageCollectionName } from '../types/content'
4
4
 
5
- const props = defineProps<{
6
- path?: string
7
- collection?: C
8
- }>()
9
-
10
- const route = useRoute()
11
- const collection = computed(() => props.collection ?? 'article')
5
+ const props = defineProps<{
6
+ path?: string
7
+ collection?: C
8
+ }>()
9
+
10
+ const route = useRoute()
11
+ const collection = computed(() => props.collection ?? 'article')
12
+ const surroundCollection = computed<PageCollectionName>(() => collection.value)
12
13
 
13
14
  const { data: page } = await usePageContent({
14
15
  path: () => props.path,
@@ -39,23 +40,10 @@ const header = computed(() => resolvePageHeader(page.value))
39
40
 
40
41
  const breadcrumbsBase = computed(() => (config.value.breadcrumbs ?? []) as BreadcrumbItem[])
41
42
 
42
- const breadcrumbItems = computed(() => {
43
- const baseItems = breadcrumbsBase.value.map((item, index) => ({
44
- ...item,
45
- ...(index === breadcrumbsBase.value.length - 1
46
- ? { ui: { ...item.ui, separator: 'hidden sm:flex' } }
47
- : {}),
48
- }))
49
-
50
- return [
51
- ...baseItems,
52
- {
53
- label: page.value?.title,
54
- to: page.value?.path,
55
- ui: { item: 'hidden sm:flex' },
56
- },
57
- ]
58
- })
43
+ const currentBreadcrumb = computed<BreadcrumbItem>(() => ({
44
+ label: page.value?.title,
45
+ to: page.value?.path,
46
+ }))
59
47
 
60
48
  const backLink = computed(() => {
61
49
  const lastBreadcrumb = breadcrumbsBase.value.at(-1)
@@ -78,10 +66,10 @@ const backLink = computed(() => {
78
66
  }"
79
67
  >
80
68
  <template #headline>
81
- <UBreadcrumb
82
- :ui="{ root: 'max-w-full' }"
83
- :items="breadcrumbItems"
84
- />
69
+ <HBreadcrumbs
70
+ :items="breadcrumbsBase"
71
+ :current="currentBreadcrumb"
72
+ />
85
73
  <HArticleHeadlineMeta :page="page" :collection="collection" />
86
74
  </template>
87
75
  <HArticleHeaderBody :page="page" :collection="collection">
@@ -113,9 +101,9 @@ const backLink = computed(() => {
113
101
  v-bind="config.separator"
114
102
  />
115
103
 
116
- <HSurround
117
- v-if="hasSurround"
118
- :collection="collection"
104
+ <HSurround
105
+ v-if="hasSurround"
106
+ :collection="surroundCollection"
119
107
  v-bind="config.surround"
120
108
  :query="config.query"
121
109
  />
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@happydesigns/ui",
3
3
  "type": "module",
4
- "version": "0.19.2",
4
+ "version": "0.19.3",
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.",
@@ -37,6 +37,9 @@
37
37
  "server",
38
38
  "shared"
39
39
  ],
40
+ "engines": {
41
+ "node": "^22.19.0 || ^24.11.0 || >=26.0.0"
42
+ },
40
43
  "publishConfig": {
41
44
  "access": "public"
42
45
  },
@@ -62,10 +65,11 @@
62
65
  "release:beta": "changelogen --release --versionSuffix beta.0"
63
66
  },
64
67
  "peerDependencies": {
65
- "tailwindcss": "^4.3.2"
68
+ "tailwindcss": "^4.3.2",
69
+ "vue": "^3.5.41"
66
70
  },
67
71
  "dependencies": {
68
- "@happydesigns/nuxt-variants": "^0.1.1",
72
+ "@happydesigns/nuxt-variants": "^0.2.0",
69
73
  "@iconify-json/heroicons": "^1.2.3",
70
74
  "@iconify-json/lucide": "^1.2.116",
71
75
  "@iconify-json/simple-icons": "^1.2.89",
@@ -1,10 +1,12 @@
1
+ import { defineVariantRegistry } from '@happydesigns/nuxt-variants/schemas'
2
+
1
3
  /**
2
4
  * Public variant registry shared by the Nuxt module and schema composition.
3
5
  *
4
6
  * Keeping the registry in one place guarantees that runtime inheritance and
5
7
  * Nuxt Content schemas are derived from the same explicit variant graph.
6
8
  */
7
- export const variantRegistry = {
9
+ export const variantRegistry = defineVariantRegistry({
8
10
  // Data features — schema only, no config
9
11
  dates: {},
10
12
  authors: {},
@@ -17,7 +19,7 @@ export const variantRegistry = {
17
19
  layout: {},
18
20
  separatorButtons: {},
19
21
 
20
- // UI features — config defined in app.config.ts
22
+ // UI features — values are supplied through app.config.ts.
21
23
  user: {},
22
24
  backButton: {},
23
25
  copyButton: {},
@@ -38,4 +40,4 @@ export const variantRegistry = {
38
40
  extends: ['layout', 'header', 'toc'],
39
41
  config: {},
40
42
  },
41
- }
43
+ })
@@ -10,14 +10,4 @@ declare module '@nuxt/schema' {
10
10
  }
11
11
  }
12
12
 
13
- declare module 'nuxt/schema' {
14
- interface AppConfigInput {
15
- app?: HAppConfigInput
16
- }
17
-
18
- interface AppConfig {
19
- app: HAppConfig
20
- }
21
- }
22
-
23
13
  export {}