undocs 0.4.10 → 0.4.11

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
@@ -4,6 +4,8 @@ export default defineAppConfig({
4
4
  logo: '/icon.svg',
5
5
  github: undefined,
6
6
  socials: {},
7
+ banner: {},
8
+ versions: [],
7
9
  },
8
10
  ui: {
9
11
  colors: {
package/app/app.vue CHANGED
@@ -1,4 +1,6 @@
1
1
  <script setup lang="ts">
2
+ import type { BannerProps } from '@nuxt/ui'
3
+
2
4
  const appConfig = useAppConfig()
3
5
 
4
6
  const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content'))
@@ -52,6 +54,7 @@ provide('navigation', navigation)
52
54
  <template>
53
55
  <UApp>
54
56
  <NuxtLoadingIndicator color="var(--ui-primary)" />
57
+ <UBanner v-if="appConfig.docs.banner?.title" v-bind="appConfig.docs.banner as BannerProps" />
55
58
  <AppHeader />
56
59
 
57
60
  <UMain>
@@ -41,11 +41,18 @@ const mobileLinks = computed(() => {
41
41
 
42
42
  <template>
43
43
  <UHeader to="/">
44
- <template #title>
45
- <img :src="appConfig.docs.logo" :alt="`${appConfig.site.name} logo`" class="h-7 w-7" />
46
- <span>
47
- {{ appConfig.site.name }}
48
- </span>
44
+ <template #left>
45
+ <NuxtLink
46
+ to="/"
47
+ class="focus-visible:outline-primary shrink-0 font-bold text-xl text-highlighted flex items-end gap-1.5"
48
+ :aria-label="appConfig.site.name"
49
+ >
50
+ <img :src="appConfig.docs.logo" :alt="`${appConfig.site.name} logo`" class="h-7 w-7" />
51
+ <span>
52
+ {{ appConfig.site.name }}
53
+ </span>
54
+ </NuxtLink>
55
+ <AppHeaderVersionsMenu v-if="appConfig.docs.versions?.length" />
49
56
  </template>
50
57
 
51
58
  <UNavigationMenu v-if="headerLinks.length > 1" :items="headerLinks" variant="link" />
@@ -0,0 +1,47 @@
1
+ <script setup lang="ts">
2
+ const appConfig = useAppConfig()
3
+
4
+ const activeVersion = computed(() => {
5
+ return appConfig.docs.versions.find((version) => version.active) || appConfig.docs.versions[0]
6
+ })
7
+ const items = computed(() => {
8
+ return appConfig.docs.versions.map((version) => {
9
+ if (activeVersion.value === version) {
10
+ return {
11
+ label: version.label,
12
+ type: 'checkbox' as const,
13
+ color: 'primary' as const,
14
+ checked: true,
15
+ }
16
+ }
17
+ return {
18
+ label: version.label,
19
+ to: version.to,
20
+ }
21
+ })
22
+ })
23
+ </script>
24
+
25
+ <template>
26
+ <UDropdownMenu
27
+ v-slot="{ open }"
28
+ :modal="false"
29
+ :items="items"
30
+ :content="{ align: 'start' }"
31
+ :ui="{ content: 'min-w-fit' }"
32
+ size="xs"
33
+ class="ml-1"
34
+ >
35
+ <UButton
36
+ :label="activeVersion?.label"
37
+ variant="subtle"
38
+ trailing-icon="i-lucide-chevron-down"
39
+ size="xs"
40
+ class="-mb-[6px] font-semibold rounded-full truncate"
41
+ :class="[open && 'bg-primary/15']"
42
+ :ui="{
43
+ trailingIcon: ['transition-transform duration-200', open ? 'rotate-180' : undefined].filter(Boolean).join(' '),
44
+ }"
45
+ />
46
+ </UDropdownMenu>
47
+ </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undocs",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "repository": "unjs/undocs",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,3 +1,5 @@
1
+ import type { BannerProps } from '@nuxt/ui'
2
+
1
3
  export interface DocsConfig {
2
4
  dir?: string
3
5
  name?: string
@@ -7,6 +9,8 @@ export interface DocsConfig {
7
9
  github?: string
8
10
  socials?: Record<string, string>
9
11
  branch?: string
12
+ banner?: BannerProps
13
+ versions?: { label: string; to: string; active?: boolean }[]
10
14
  themeColor?: string
11
15
  redirects?: Record<string, string>
12
16
  automd?: unknown
@@ -55,6 +55,169 @@
55
55
  "type": "string",
56
56
  "description": "The branch of the GitHub repository for the documentation site."
57
57
  },
58
+ "banner": {
59
+ "type": "object",
60
+ "description": "Banner configuration",
61
+ "additionalProperties": false,
62
+ "properties": {
63
+ "id": {
64
+ "type": "string",
65
+ "description": "A unique id saved to local storage to remember if the banner has been dismissed. Change this value to show the banner again."
66
+ },
67
+ "icon": {
68
+ "type": "string",
69
+ "description": "The icon displayed next to the title (e.g., 'i-lucide-info')."
70
+ },
71
+ "title": {
72
+ "type": "string",
73
+ "description": "The banner title text."
74
+ },
75
+ "actions": {
76
+ "type": "array",
77
+ "description": "Display a list of action buttons next to the title.",
78
+ "items": {
79
+ "type": "object",
80
+ "properties": {
81
+ "label": {
82
+ "type": "string",
83
+ "description": "Button label text"
84
+ },
85
+ "icon": {
86
+ "type": "string",
87
+ "description": "Button icon"
88
+ },
89
+ "to": {
90
+ "type": "string",
91
+ "description": "Button link destination"
92
+ },
93
+ "target": {
94
+ "type": "string",
95
+ "enum": ["_blank", "_parent", "_self", "_top"],
96
+ "description": "Link target attribute"
97
+ },
98
+ "color": {
99
+ "type": "string",
100
+ "enum": ["primary", "secondary", "success", "info", "warning", "error", "neutral"],
101
+ "description": "Button color"
102
+ },
103
+ "size": {
104
+ "type": "string",
105
+ "enum": ["xs", "sm", "md", "lg", "xl"],
106
+ "description": "Button size"
107
+ },
108
+ "variant": {
109
+ "type": "string",
110
+ "enum": ["solid", "outline", "soft", "subtle", "ghost", "link"],
111
+ "description": "Button variant"
112
+ }
113
+ }
114
+ }
115
+ },
116
+ "to": {
117
+ "type": "string",
118
+ "description": "Link destination URL or route path."
119
+ },
120
+ "target": {
121
+ "type": "string",
122
+ "enum": ["_blank", "_parent", "_self", "_top"],
123
+ "description": "Link target attribute."
124
+ },
125
+ "color": {
126
+ "type": "string",
127
+ "enum": ["primary", "secondary", "success", "info", "warning", "error", "neutral"],
128
+ "description": "Banner color theme.",
129
+ "default": "primary"
130
+ },
131
+ "close": {
132
+ "oneOf": [
133
+ {
134
+ "type": "boolean",
135
+ "description": "Display a close button to dismiss the banner."
136
+ },
137
+ {
138
+ "type": "object",
139
+ "description": "Close button configuration.",
140
+ "properties": {
141
+ "size": {
142
+ "type": "string",
143
+ "enum": ["xs", "sm", "md", "lg", "xl"],
144
+ "description": "Close button size"
145
+ },
146
+ "color": {
147
+ "type": "string",
148
+ "enum": ["primary", "secondary", "success", "info", "warning", "error", "neutral"],
149
+ "description": "Close button color"
150
+ },
151
+ "variant": {
152
+ "type": "string",
153
+ "enum": ["solid", "outline", "soft", "subtle", "ghost", "link"],
154
+ "description": "Close button variant"
155
+ }
156
+ }
157
+ }
158
+ ]
159
+ },
160
+ "closeIcon": {
161
+ "type": "string",
162
+ "description": "The icon displayed in the close button (e.g., 'i-lucide-x').",
163
+ "default": "i-lucide-x"
164
+ },
165
+ "ui": {
166
+ "type": "object",
167
+ "description": "UI customization classes for banner components.",
168
+ "properties": {
169
+ "root": {
170
+ "description": "Root element classes"
171
+ },
172
+ "container": {
173
+ "description": "Container element classes"
174
+ },
175
+ "left": {
176
+ "description": "Left section classes"
177
+ },
178
+ "center": {
179
+ "description": "Center section classes"
180
+ },
181
+ "right": {
182
+ "description": "Right section classes"
183
+ },
184
+ "icon": {
185
+ "description": "Icon element classes"
186
+ },
187
+ "title": {
188
+ "description": "Title element classes"
189
+ },
190
+ "actions": {
191
+ "description": "Actions container classes"
192
+ },
193
+ "close": {
194
+ "description": "Close button classes"
195
+ }
196
+ }
197
+ }
198
+ }
199
+ },
200
+ "versions": {
201
+ "type": "array",
202
+ "description": "The versions of the documentation site.",
203
+ "items": {
204
+ "type": "object",
205
+ "properties": {
206
+ "label": {
207
+ "type": "string",
208
+ "description": "The label of the version."
209
+ },
210
+ "to": {
211
+ "type": "string",
212
+ "description": "The URL to the version."
213
+ },
214
+ "active": {
215
+ "type": "boolean",
216
+ "description": "Whether the version is active on this documentation site."
217
+ }
218
+ }
219
+ }
220
+ },
58
221
  "themeColor": {
59
222
  "type": "string",
60
223
  "description": "The theme color of the documentation site.\nIt will be used as the `theme-color` meta tag and a full palette of colors will be generated from it."