@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 +81 -86
- package/app/components/traits/Breadcrumbs.vue +40 -0
- package/app/layouts/article.vue +19 -31
- package/package.json +7 -3
- package/schemas/variants.ts +5 -3
- package/shared/types/app-config.d.ts +0 -10
package/app/app.config.ts
CHANGED
|
@@ -1,84 +1,80 @@
|
|
|
1
|
-
import type { AppConfigInput
|
|
2
|
-
import type { BadgeProps, ButtonProps } from '@nuxt/ui'
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
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
|
-
|
|
144
|
-
|
|
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>
|
package/app/layouts/article.vue
CHANGED
|
@@ -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
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
<
|
|
82
|
-
:
|
|
83
|
-
:
|
|
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="
|
|
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.
|
|
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.
|
|
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",
|
package/schemas/variants.ts
CHANGED
|
@@ -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 —
|
|
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
|
+
})
|