@ghostvue/nuxt 0.0.0-stage → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GhostVue contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
- # Temporary Holding Version
1
+ # @ghostvue/nuxt
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Nuxt module for GhostVue. By default it auto-imports every headless `Ghost*`
4
+ component and public `useGhost*` composable from
5
+ [`@ghostvue/vue`](https://www.npmjs.com/package/@ghostvue/vue) and adds no CSS.
6
+ Themed wrappers and theme stylesheets from
7
+ [`@ghostvue/themes`](https://www.npmjs.com/package/@ghostvue/themes) are an
8
+ explicit opt-in.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pnpm add @ghostvue/vue @ghostvue/nuxt
14
+ ```
15
+
16
+ Nuxt `^4.6.0` is a peer dependency. Add `@ghostvue/themes` only if you opt in
17
+ to themed components or CSS.
18
+
19
+ ## Usage
20
+
21
+ ```ts
22
+ // nuxt.config.ts
23
+ export default defineNuxtConfig({
24
+ modules: ['@ghostvue/nuxt'],
25
+ })
26
+ ```
27
+
28
+ To use themed wrappers and a flagship stylesheet:
29
+
30
+ ```ts
31
+ // nuxt.config.ts
32
+ export default defineNuxtConfig({
33
+ modules: ['@ghostvue/nuxt'],
34
+ ghostvue: {
35
+ components: 'themed',
36
+ css: ['calm'],
37
+ },
38
+ })
39
+ ```
40
+
41
+ ## Documentation
42
+
43
+ [ghostvue.dev](https://ghostvue.dev): see
44
+ [Nuxt and auto-imports](https://ghostvue.dev/auto-imports) for every option.
@@ -0,0 +1,7 @@
1
+ /** @generated by pnpm registries:write — do not edit. */
2
+ /** Headless `Ghost*` components exported by `@ghostvue/vue`. */
3
+ export declare const headlessComponentNames: readonly string[];
4
+ /** Public `useGhost*` composables exported by `@ghostvue/vue`. */
5
+ export declare const headlessComposableNames: readonly string[];
6
+ /** Themed `Ghost*` wrappers exported by `@ghostvue/themes`. */
7
+ export declare const themedComponentNames: readonly string[];
@@ -0,0 +1,423 @@
1
+ /** @generated by pnpm registries:write — do not edit. */
2
+ /** Headless `Ghost*` components exported by `@ghostvue/vue`. */
3
+ export const headlessComponentNames = [
4
+ 'GhostAccordion',
5
+ 'GhostAccordionContent',
6
+ 'GhostAccordionItem',
7
+ 'GhostAccordionTrigger',
8
+ 'GhostAvatar',
9
+ 'GhostBadge',
10
+ 'GhostBreadcrumb',
11
+ 'GhostBreadcrumbEllipsis',
12
+ 'GhostBreadcrumbItem',
13
+ 'GhostBreadcrumbLink',
14
+ 'GhostBreadcrumbList',
15
+ 'GhostBreadcrumbPage',
16
+ 'GhostBreadcrumbSeparator',
17
+ 'GhostButton',
18
+ 'GhostCalendar',
19
+ 'GhostCalendarCell',
20
+ 'GhostCalendarGrid',
21
+ 'GhostCalendarHeader',
22
+ 'GhostCalendarHeading',
23
+ 'GhostCalendarNextButton',
24
+ 'GhostCalendarPrevButton',
25
+ 'GhostCard',
26
+ 'GhostCheckbox',
27
+ 'GhostCollapsible',
28
+ 'GhostCollapsibleContent',
29
+ 'GhostCollapsibleTrigger',
30
+ 'GhostCombobox',
31
+ 'GhostComboboxContent',
32
+ 'GhostComboboxEmpty',
33
+ 'GhostComboboxGroup',
34
+ 'GhostComboboxInput',
35
+ 'GhostComboboxLabel',
36
+ 'GhostComboboxOption',
37
+ 'GhostComboboxTrigger',
38
+ 'GhostCommandPalette',
39
+ 'GhostCommandPaletteContent',
40
+ 'GhostCommandPaletteEmpty',
41
+ 'GhostCommandPaletteGroup',
42
+ 'GhostCommandPaletteInput',
43
+ 'GhostCommandPaletteItem',
44
+ 'GhostCommandPaletteLabel',
45
+ 'GhostCommandPaletteList',
46
+ 'GhostCommandPaletteOverlay',
47
+ 'GhostCommandPaletteSeparator',
48
+ 'GhostCommandPaletteTitle',
49
+ 'GhostCommandPaletteTrigger',
50
+ 'GhostContextMenu',
51
+ 'GhostContextMenuCheckboxItem',
52
+ 'GhostContextMenuContent',
53
+ 'GhostContextMenuGroup',
54
+ 'GhostContextMenuItem',
55
+ 'GhostContextMenuLabel',
56
+ 'GhostContextMenuRadioGroup',
57
+ 'GhostContextMenuRadioItem',
58
+ 'GhostContextMenuSeparator',
59
+ 'GhostContextMenuTrigger',
60
+ 'GhostDataTable',
61
+ 'GhostDataTablePreset',
62
+ 'GhostDataTableTable',
63
+ 'GhostDatePicker',
64
+ 'GhostDatePickerCalendar',
65
+ 'GhostDatePickerContent',
66
+ 'GhostDatePickerInput',
67
+ 'GhostDatePickerTrigger',
68
+ 'GhostDialog',
69
+ 'GhostDialogClose',
70
+ 'GhostDialogContent',
71
+ 'GhostDialogDescription',
72
+ 'GhostDialogOverlay',
73
+ 'GhostDialogTitle',
74
+ 'GhostDialogTrigger',
75
+ 'GhostDrawer',
76
+ 'GhostDrawerClose',
77
+ 'GhostDrawerContent',
78
+ 'GhostDrawerDescription',
79
+ 'GhostDrawerOverlay',
80
+ 'GhostDrawerTitle',
81
+ 'GhostDrawerTrigger',
82
+ 'GhostDropdownMenu',
83
+ 'GhostDropdownMenuCheckboxItem',
84
+ 'GhostDropdownMenuContent',
85
+ 'GhostDropdownMenuGroup',
86
+ 'GhostDropdownMenuItem',
87
+ 'GhostDropdownMenuLabel',
88
+ 'GhostDropdownMenuRadioGroup',
89
+ 'GhostDropdownMenuRadioItem',
90
+ 'GhostDropdownMenuSeparator',
91
+ 'GhostDropdownMenuTrigger',
92
+ 'GhostEmptyState',
93
+ 'GhostField',
94
+ 'GhostFieldControl',
95
+ 'GhostFieldDescription',
96
+ 'GhostFieldError',
97
+ 'GhostFieldLabel',
98
+ 'GhostFileUpload',
99
+ 'GhostFileUploadDropzone',
100
+ 'GhostFileUploadItem',
101
+ 'GhostFileUploadItemRemove',
102
+ 'GhostFileUploadList',
103
+ 'GhostFileUploadTrigger',
104
+ 'GhostHoverCard',
105
+ 'GhostHoverCardContent',
106
+ 'GhostHoverCardTrigger',
107
+ 'GhostInlineAlert',
108
+ 'GhostInput',
109
+ 'GhostInteractiveSurface',
110
+ 'GhostKbd',
111
+ 'GhostLink',
112
+ 'GhostMenubar',
113
+ 'GhostMenubarCheckboxItem',
114
+ 'GhostMenubarContent',
115
+ 'GhostMenubarGroup',
116
+ 'GhostMenubarItem',
117
+ 'GhostMenubarLabel',
118
+ 'GhostMenubarMenu',
119
+ 'GhostMenubarRadioGroup',
120
+ 'GhostMenubarRadioItem',
121
+ 'GhostMenubarSeparator',
122
+ 'GhostMenubarTrigger',
123
+ 'GhostNumberInput',
124
+ 'GhostPagination',
125
+ 'GhostPopover',
126
+ 'GhostPopoverClose',
127
+ 'GhostPopoverContent',
128
+ 'GhostPopoverTrigger',
129
+ 'GhostPortal',
130
+ 'GhostProgress',
131
+ 'GhostRadioGroup',
132
+ 'GhostRadioGroupItem',
133
+ 'GhostScrollArea',
134
+ 'GhostScrollSpy',
135
+ 'GhostScrollSpyItem',
136
+ 'GhostScrollSpyLink',
137
+ 'GhostScrollSpyList',
138
+ 'GhostSegmentedControl',
139
+ 'GhostSegmentedControlItem',
140
+ 'GhostSelect',
141
+ 'GhostSelectContent',
142
+ 'GhostSelectGroup',
143
+ 'GhostSelectLabel',
144
+ 'GhostSelectOption',
145
+ 'GhostSelectTrigger',
146
+ 'GhostSelectValue',
147
+ 'GhostSeparator',
148
+ 'GhostSkeleton',
149
+ 'GhostSlider',
150
+ 'GhostSpinner',
151
+ 'GhostSwitch',
152
+ 'GhostTable',
153
+ 'GhostTableBody',
154
+ 'GhostTableCaption',
155
+ 'GhostTableCell',
156
+ 'GhostTableFoot',
157
+ 'GhostTableHead',
158
+ 'GhostTableHeaderCell',
159
+ 'GhostTableRow',
160
+ 'GhostTabs',
161
+ 'GhostTabsContent',
162
+ 'GhostTabsList',
163
+ 'GhostTabsTrigger',
164
+ 'GhostTextarea',
165
+ 'GhostToast',
166
+ 'GhostToastAction',
167
+ 'GhostToastClose',
168
+ 'GhostToastDescription',
169
+ 'GhostToastProvider',
170
+ 'GhostToastTitle',
171
+ 'GhostToastViewport',
172
+ 'GhostToggleGroup',
173
+ 'GhostToggleGroupItem',
174
+ 'GhostToolbar',
175
+ 'GhostTooltip',
176
+ 'GhostTooltipContent',
177
+ 'GhostTooltipProvider',
178
+ 'GhostTooltipTrigger',
179
+ 'GhostTree',
180
+ 'GhostTreeGroup',
181
+ 'GhostTreeItem',
182
+ 'GhostTreeTrigger',
183
+ 'GhostVisuallyHidden',
184
+ ];
185
+ /** Public `useGhost*` composables exported by `@ghostvue/vue`. */
186
+ export const headlessComposableNames = [
187
+ 'useGhostAccordion',
188
+ 'useGhostAvatar',
189
+ 'useGhostBadge',
190
+ 'useGhostBreadcrumb',
191
+ 'useGhostButton',
192
+ 'useGhostCalendar',
193
+ 'useGhostCard',
194
+ 'useGhostCheckbox',
195
+ 'useGhostCollapsible',
196
+ 'useGhostCombobox',
197
+ 'useGhostComboboxAsyncSearch',
198
+ 'useGhostCommandPalette',
199
+ 'useGhostCommandPaletteAsyncSearch',
200
+ 'useGhostContextMenu',
201
+ 'useGhostDataTable',
202
+ 'useGhostDataTableServerRequest',
203
+ 'useGhostDatePicker',
204
+ 'useGhostDialog',
205
+ 'useGhostDrawer',
206
+ 'useGhostDropdownMenu',
207
+ 'useGhostEmptyState',
208
+ 'useGhostField',
209
+ 'useGhostFileUpload',
210
+ 'useGhostHoverCard',
211
+ 'useGhostId',
212
+ 'useGhostInlineAlert',
213
+ 'useGhostInput',
214
+ 'useGhostInteractiveSurface',
215
+ 'useGhostKbd',
216
+ 'useGhostLink',
217
+ 'useGhostMenubar',
218
+ 'useGhostMenubarMenu',
219
+ 'useGhostMenuCollection',
220
+ 'useGhostNumberInput',
221
+ 'useGhostPagination',
222
+ 'useGhostPopover',
223
+ 'useGhostProgress',
224
+ 'useGhostRadioGroup',
225
+ 'useGhostScrollArea',
226
+ 'useGhostScrollSpy',
227
+ 'useGhostSegmentedControl',
228
+ 'useGhostSelect',
229
+ 'useGhostSeparator',
230
+ 'useGhostSkeleton',
231
+ 'useGhostSlider',
232
+ 'useGhostSpinner',
233
+ 'useGhostSwitch',
234
+ 'useGhostTable',
235
+ 'useGhostTableBody',
236
+ 'useGhostTableCaption',
237
+ 'useGhostTableCell',
238
+ 'useGhostTableFoot',
239
+ 'useGhostTableHead',
240
+ 'useGhostTableHeaderCell',
241
+ 'useGhostTableRow',
242
+ 'useGhostTabs',
243
+ 'useGhostTextarea',
244
+ 'useGhostToast',
245
+ 'useGhostToggleGroup',
246
+ 'useGhostToolbar',
247
+ 'useGhostTooltip',
248
+ 'useGhostTree',
249
+ 'useGhostVisuallyHidden',
250
+ ];
251
+ /** Themed `Ghost*` wrappers exported by `@ghostvue/themes`. */
252
+ export const themedComponentNames = [
253
+ 'GhostAccordion',
254
+ 'GhostAccordionContent',
255
+ 'GhostAccordionItem',
256
+ 'GhostAccordionTrigger',
257
+ 'GhostAvatar',
258
+ 'GhostBadge',
259
+ 'GhostBreadcrumb',
260
+ 'GhostBreadcrumbEllipsis',
261
+ 'GhostBreadcrumbItem',
262
+ 'GhostBreadcrumbLink',
263
+ 'GhostBreadcrumbList',
264
+ 'GhostBreadcrumbPage',
265
+ 'GhostBreadcrumbSeparator',
266
+ 'GhostButton',
267
+ 'GhostCalendar',
268
+ 'GhostCalendarCell',
269
+ 'GhostCalendarGrid',
270
+ 'GhostCalendarHeader',
271
+ 'GhostCalendarHeading',
272
+ 'GhostCalendarNextButton',
273
+ 'GhostCalendarPrevButton',
274
+ 'GhostCard',
275
+ 'GhostCheckbox',
276
+ 'GhostCollapsible',
277
+ 'GhostCollapsibleContent',
278
+ 'GhostCollapsibleTrigger',
279
+ 'GhostCombobox',
280
+ 'GhostComboboxContent',
281
+ 'GhostComboboxEmpty',
282
+ 'GhostComboboxGroup',
283
+ 'GhostComboboxInput',
284
+ 'GhostComboboxLabel',
285
+ 'GhostComboboxOption',
286
+ 'GhostComboboxTrigger',
287
+ 'GhostCommandPalette',
288
+ 'GhostCommandPaletteContent',
289
+ 'GhostCommandPaletteEmpty',
290
+ 'GhostCommandPaletteGroup',
291
+ 'GhostCommandPaletteInput',
292
+ 'GhostCommandPaletteItem',
293
+ 'GhostCommandPaletteLabel',
294
+ 'GhostCommandPaletteList',
295
+ 'GhostCommandPaletteOverlay',
296
+ 'GhostCommandPaletteSeparator',
297
+ 'GhostCommandPaletteTitle',
298
+ 'GhostCommandPaletteTrigger',
299
+ 'GhostContextMenu',
300
+ 'GhostContextMenuCheckboxItem',
301
+ 'GhostContextMenuContent',
302
+ 'GhostContextMenuGroup',
303
+ 'GhostContextMenuItem',
304
+ 'GhostContextMenuLabel',
305
+ 'GhostContextMenuRadioGroup',
306
+ 'GhostContextMenuRadioItem',
307
+ 'GhostContextMenuSeparator',
308
+ 'GhostContextMenuTrigger',
309
+ 'GhostDataTable',
310
+ 'GhostDataTablePreset',
311
+ 'GhostDataTableTable',
312
+ 'GhostDatePicker',
313
+ 'GhostDatePickerCalendar',
314
+ 'GhostDatePickerContent',
315
+ 'GhostDatePickerInput',
316
+ 'GhostDatePickerTrigger',
317
+ 'GhostDialog',
318
+ 'GhostDialogClose',
319
+ 'GhostDialogContent',
320
+ 'GhostDialogDescription',
321
+ 'GhostDialogOverlay',
322
+ 'GhostDialogTitle',
323
+ 'GhostDialogTrigger',
324
+ 'GhostDrawer',
325
+ 'GhostDrawerClose',
326
+ 'GhostDrawerContent',
327
+ 'GhostDrawerDescription',
328
+ 'GhostDrawerOverlay',
329
+ 'GhostDrawerTitle',
330
+ 'GhostDrawerTrigger',
331
+ 'GhostDropdownMenu',
332
+ 'GhostDropdownMenuCheckboxItem',
333
+ 'GhostDropdownMenuContent',
334
+ 'GhostDropdownMenuGroup',
335
+ 'GhostDropdownMenuItem',
336
+ 'GhostDropdownMenuLabel',
337
+ 'GhostDropdownMenuRadioGroup',
338
+ 'GhostDropdownMenuRadioItem',
339
+ 'GhostDropdownMenuSeparator',
340
+ 'GhostDropdownMenuTrigger',
341
+ 'GhostEmptyState',
342
+ 'GhostField',
343
+ 'GhostFieldControl',
344
+ 'GhostFieldDescription',
345
+ 'GhostFieldError',
346
+ 'GhostFieldLabel',
347
+ 'GhostFileUpload',
348
+ 'GhostFileUploadDropzone',
349
+ 'GhostFileUploadItem',
350
+ 'GhostFileUploadItemRemove',
351
+ 'GhostFileUploadList',
352
+ 'GhostFileUploadTrigger',
353
+ 'GhostHoverCard',
354
+ 'GhostHoverCardContent',
355
+ 'GhostHoverCardTrigger',
356
+ 'GhostInlineAlert',
357
+ 'GhostInput',
358
+ 'GhostInteractiveSurface',
359
+ 'GhostKbd',
360
+ 'GhostLink',
361
+ 'GhostMenubar',
362
+ 'GhostMenubarCheckboxItem',
363
+ 'GhostMenubarContent',
364
+ 'GhostMenubarGroup',
365
+ 'GhostMenubarItem',
366
+ 'GhostMenubarLabel',
367
+ 'GhostMenubarMenu',
368
+ 'GhostMenubarRadioGroup',
369
+ 'GhostMenubarRadioItem',
370
+ 'GhostMenubarSeparator',
371
+ 'GhostMenubarTrigger',
372
+ 'GhostNumberInput',
373
+ 'GhostPagination',
374
+ 'GhostPopover',
375
+ 'GhostPopoverClose',
376
+ 'GhostPopoverContent',
377
+ 'GhostPopoverTrigger',
378
+ 'GhostProgress',
379
+ 'GhostRadioGroup',
380
+ 'GhostRadioGroupItem',
381
+ 'GhostScrollArea',
382
+ 'GhostScrollSpy',
383
+ 'GhostScrollSpyItem',
384
+ 'GhostScrollSpyLink',
385
+ 'GhostScrollSpyList',
386
+ 'GhostSegmentedControl',
387
+ 'GhostSegmentedControlItem',
388
+ 'GhostSelect',
389
+ 'GhostSelectContent',
390
+ 'GhostSelectGroup',
391
+ 'GhostSelectLabel',
392
+ 'GhostSelectOption',
393
+ 'GhostSelectTrigger',
394
+ 'GhostSelectValue',
395
+ 'GhostSeparator',
396
+ 'GhostSkeleton',
397
+ 'GhostSlider',
398
+ 'GhostSpinner',
399
+ 'GhostSwitch',
400
+ 'GhostTable',
401
+ 'GhostTabs',
402
+ 'GhostTabsContent',
403
+ 'GhostTabsList',
404
+ 'GhostTabsTrigger',
405
+ 'GhostTextarea',
406
+ 'GhostToast',
407
+ 'GhostToastAction',
408
+ 'GhostToastClose',
409
+ 'GhostToastDescription',
410
+ 'GhostToastProvider',
411
+ 'GhostToastTitle',
412
+ 'GhostToastViewport',
413
+ 'GhostToggleGroup',
414
+ 'GhostToggleGroupItem',
415
+ 'GhostToolbar',
416
+ 'GhostTooltip',
417
+ 'GhostTooltipContent',
418
+ 'GhostTooltipTrigger',
419
+ 'GhostTree',
420
+ 'GhostTreeGroup',
421
+ 'GhostTreeItem',
422
+ 'GhostTreeTrigger',
423
+ ];
@@ -0,0 +1,19 @@
1
+ import type { NuxtModule } from '@nuxt/schema';
2
+ import { type GhostVueNuxtOptions } from './plan.js';
3
+ export { ghostVueNuxtStylesheets, type GhostVueNuxtComponents, type GhostVueNuxtOptions, type GhostVueNuxtStylesheet, } from './plan.js';
4
+ /**
5
+ * Nuxt module. Add `'@ghostvue/nuxt'` to `modules` and configure it under the
6
+ * `ghostvue` key. Defaults auto-import headless components and `useGhost*`
7
+ * composables from `@ghostvue/vue` and inject no CSS.
8
+ */
9
+ declare const ghostVueNuxtModule: NuxtModule<GhostVueNuxtOptions>;
10
+ export default ghostVueNuxtModule;
11
+ declare module '@nuxt/schema' {
12
+ interface NuxtConfig {
13
+ /** GhostVue auto-import options for `@ghostvue/nuxt`. */
14
+ ghostvue?: GhostVueNuxtOptions;
15
+ }
16
+ interface NuxtOptions {
17
+ ghostvue?: GhostVueNuxtOptions;
18
+ }
19
+ }
package/dist/index.js ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * `@ghostvue/nuxt`: Nuxt module that registers GhostVue auto-imports.
3
+ *
4
+ * Dependency direction: this package points toward `@ghostvue/vue` (required
5
+ * peer) and, only when a consumer opts in, `@ghostvue/themes` (optional peer).
6
+ * Neither of those packages knows about Nuxt. The module references both by
7
+ * package name only, so the consumer's own installation (and its single Vue
8
+ * runtime) is what Nuxt bundles.
9
+ *
10
+ * Named imports from `@ghostvue/vue` / `@ghostvue/themes` stay the primary
11
+ * library API; this module only spares Nuxt apps from writing them.
12
+ */
13
+ import { pathToFileURL } from 'node:url';
14
+ import { addComponent, addImports, defineNuxtModule, tryResolveModule, useLogger, } from '@nuxt/kit';
15
+ import { planGhostVueNuxt, THEMES_PACKAGE, } from './plan.js';
16
+ export { ghostVueNuxtStylesheets, } from './plan.js';
17
+ /** `nuxt.config` key that holds {@link GhostVueNuxtOptions}. */
18
+ const CONFIG_KEY = 'ghostvue';
19
+ /**
20
+ * Nuxt module. Add `'@ghostvue/nuxt'` to `modules` and configure it under the
21
+ * `ghostvue` key. Defaults auto-import headless components and `useGhost*`
22
+ * composables from `@ghostvue/vue` and inject no CSS.
23
+ */
24
+ const ghostVueNuxtModule = defineNuxtModule({
25
+ meta: {
26
+ name: '@ghostvue/nuxt',
27
+ configKey: CONFIG_KEY,
28
+ compatibility: { nuxt: '>=4.6.0' },
29
+ },
30
+ defaults: {
31
+ components: 'headless',
32
+ composables: true,
33
+ css: [],
34
+ },
35
+ async setup(options, nuxt) {
36
+ const logger = useLogger('@ghostvue/nuxt');
37
+ const plan = planGhostVueNuxt(options);
38
+ if (plan.requiresThemes) {
39
+ // Fail at build time with the fix instead of emitting imports that only
40
+ // break once Vite tries to resolve them.
41
+ const searchFrom = [
42
+ nuxt.options.rootDir,
43
+ ...nuxt.options.modulesDir,
44
+ ].map((directory) => pathToFileURL(`${directory}/`));
45
+ if (!(await tryResolveModule(THEMES_PACKAGE, searchFrom))) {
46
+ throw new Error(`[@ghostvue/nuxt] ghostvue.components: 'themed' and ghostvue.css need ${THEMES_PACKAGE}. Install it, or keep the headless default.`);
47
+ }
48
+ // The themes entry imports its stylesheet. Transpiling keeps that CSS
49
+ // import inside Vite during SSR instead of handing a `.css` import to
50
+ // Node, which cannot load it.
51
+ if (!nuxt.options.build.transpile.includes(THEMES_PACKAGE)) {
52
+ nuxt.options.build.transpile.push(THEMES_PACKAGE);
53
+ }
54
+ }
55
+ for (const specifier of plan.css) {
56
+ if (!nuxt.options.css.includes(specifier)) {
57
+ nuxt.options.css.push(specifier);
58
+ }
59
+ }
60
+ for (const { name, from } of plan.components) {
61
+ addComponent({ name, export: name, filePath: from });
62
+ }
63
+ if (plan.components.length > 0) {
64
+ // App and layer component directories register with a higher priority
65
+ // than module components, so Nuxt would otherwise drop ours silently
66
+ // when an app also defines e.g. `components/GhostButton.vue`. This hook
67
+ // runs after the registrations above and reports each tag that now
68
+ // resolves somewhere else.
69
+ const ours = new Map(plan.components.map((entry) => [entry.name, entry]));
70
+ nuxt.hook('components:extend', (components) => {
71
+ for (const component of components) {
72
+ const expected = ours.get(component.pascalName);
73
+ if (expected && component.filePath !== expected.from) {
74
+ logger.warn(`<${expected.name}> resolves to ${component.filePath}, not ${expected.from}. Rename one of them, or import the GhostVue component explicitly.`);
75
+ }
76
+ }
77
+ });
78
+ }
79
+ if (plan.composables.length > 0) {
80
+ addImports(plan.composables.map(({ name, from }) => ({ name, as: name, from })));
81
+ }
82
+ },
83
+ });
84
+ export default ghostVueNuxtModule;
package/dist/plan.d.ts ADDED
@@ -0,0 +1,70 @@
1
+ /** Package that headless components and composables import from. */
2
+ export declare const HEADLESS_PACKAGE = "@ghostvue/vue";
3
+ /** Optional package that themed wrappers and theme stylesheets come from. */
4
+ export declare const THEMES_PACKAGE = "@ghostvue/themes";
5
+ /**
6
+ * Which layer auto-imported `Ghost*` component tags resolve to.
7
+ *
8
+ * - `'headless'` (default): every tag resolves to `@ghostvue/vue`. No CSS.
9
+ * - `'themed'`: tags with a themed wrapper resolve to `@ghostvue/themes`
10
+ * (which loads its base stylesheet); the few headless-only utilities
11
+ * (`GhostPortal`, `GhostVisuallyHidden`, ...) keep resolving to
12
+ * `@ghostvue/vue`. Requires `@ghostvue/themes` to be installed.
13
+ * - `false`: register no components; use named imports instead.
14
+ */
15
+ export type GhostVueNuxtComponents = 'headless' | 'themed' | false;
16
+ /**
17
+ * Stylesheet exported by `@ghostvue/themes` as `@ghostvue/themes/<name>.css`.
18
+ * `default`, `calm`, `vibrant`, and `mono` are full themes; `tokens` is the
19
+ * token custom properties alone.
20
+ */
21
+ export type GhostVueNuxtStylesheet = 'default' | 'calm' | 'vibrant' | 'mono' | 'tokens';
22
+ /** Every accepted stylesheet name, in documentation order. */
23
+ export declare const ghostVueNuxtStylesheets: readonly GhostVueNuxtStylesheet[];
24
+ /** Options for the `ghostvue` key in `nuxt.config`. */
25
+ export interface GhostVueNuxtOptions {
26
+ /**
27
+ * Layer that auto-imported `Ghost*` components resolve to.
28
+ *
29
+ * @defaultValue `'headless'`
30
+ */
31
+ components?: GhostVueNuxtComponents;
32
+ /**
33
+ * Auto-import the public `useGhost*` composables from `@ghostvue/vue`.
34
+ * Lower-level helpers such as `useFocusScope` remain named imports.
35
+ *
36
+ * @defaultValue `true`
37
+ */
38
+ composables?: boolean;
39
+ /**
40
+ * Theme stylesheets to add to `nuxt.options.css`. Nothing is injected by
41
+ * default, so headless apps ship no GhostVue CSS. Requires
42
+ * `@ghostvue/themes` when non-empty.
43
+ *
44
+ * @defaultValue `[]`
45
+ */
46
+ css?: readonly GhostVueNuxtStylesheet[];
47
+ }
48
+ /** One name the module registers, with the package it imports from. */
49
+ export interface GhostVueNuxtImport {
50
+ readonly name: string;
51
+ readonly from: typeof HEADLESS_PACKAGE | typeof THEMES_PACKAGE;
52
+ }
53
+ /** What the module registers for a given set of options. */
54
+ export interface GhostVueNuxtPlan {
55
+ readonly components: readonly GhostVueNuxtImport[];
56
+ readonly composables: readonly GhostVueNuxtImport[];
57
+ /** Module specifiers appended to `nuxt.options.css`. */
58
+ readonly css: readonly string[];
59
+ /** True when the plan imports anything from `@ghostvue/themes`. */
60
+ readonly requiresThemes: boolean;
61
+ }
62
+ /**
63
+ * Resolves options to the exact components, composables, and stylesheets to
64
+ * register. Each component name appears once, so the headless and themed
65
+ * layers never register competing definitions for the same tag.
66
+ *
67
+ * @throws TypeError for an unknown `components` mode or stylesheet name, so a
68
+ * typo fails the build instead of silently shipping a different layer.
69
+ */
70
+ export declare function planGhostVueNuxt(options?: GhostVueNuxtOptions): GhostVueNuxtPlan;
package/dist/plan.js ADDED
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Pure resolution plan for the Nuxt module. Kept free of `@nuxt/kit` so the
3
+ * headless-versus-themed rules are unit-testable without booting Nuxt.
4
+ */
5
+ import { headlessComponentNames, headlessComposableNames, themedComponentNames, } from './.registries/auto-imports.generated.js';
6
+ /** Package that headless components and composables import from. */
7
+ export const HEADLESS_PACKAGE = '@ghostvue/vue';
8
+ /** Optional package that themed wrappers and theme stylesheets come from. */
9
+ export const THEMES_PACKAGE = '@ghostvue/themes';
10
+ /** Every accepted stylesheet name, in documentation order. */
11
+ export const ghostVueNuxtStylesheets = [
12
+ 'default',
13
+ 'calm',
14
+ 'vibrant',
15
+ 'mono',
16
+ 'tokens',
17
+ ];
18
+ /**
19
+ * Resolves options to the exact components, composables, and stylesheets to
20
+ * register. Each component name appears once, so the headless and themed
21
+ * layers never register competing definitions for the same tag.
22
+ *
23
+ * @throws TypeError for an unknown `components` mode or stylesheet name, so a
24
+ * typo fails the build instead of silently shipping a different layer.
25
+ */
26
+ export function planGhostVueNuxt(options = {}) {
27
+ const mode = options.components ?? 'headless';
28
+ // Runtime guard for untyped (JavaScript) nuxt.config files.
29
+ const modes = ['headless', 'themed', false];
30
+ if (!modes.includes(mode)) {
31
+ throw new TypeError(`[@ghostvue/nuxt] Unknown components mode ${JSON.stringify(mode)}. Use 'headless', 'themed', or false.`);
32
+ }
33
+ const themed = new Set(themedComponentNames);
34
+ // Themed mode covers the union so a future themed-only wrapper still
35
+ // registers; today every themed name also exists headless.
36
+ const names = mode === 'themed'
37
+ ? [...new Set([...headlessComponentNames, ...themedComponentNames])]
38
+ : headlessComponentNames;
39
+ const components = mode === false
40
+ ? []
41
+ : names.map((name) => ({
42
+ name,
43
+ from: mode === 'themed' && themed.has(name)
44
+ ? THEMES_PACKAGE
45
+ : HEADLESS_PACKAGE,
46
+ }));
47
+ const composables = options.composables === false
48
+ ? []
49
+ : headlessComposableNames.map((name) => ({
50
+ name,
51
+ from: HEADLESS_PACKAGE,
52
+ }));
53
+ const known = new Set(ghostVueNuxtStylesheets);
54
+ const css = [];
55
+ for (const sheet of options.css ?? []) {
56
+ if (!known.has(sheet)) {
57
+ throw new TypeError(`[@ghostvue/nuxt] Unknown stylesheet ${JSON.stringify(sheet)}. Use one of: ${ghostVueNuxtStylesheets.join(', ')}.`);
58
+ }
59
+ const specifier = `${THEMES_PACKAGE}/${sheet}.css`;
60
+ if (!css.includes(specifier))
61
+ css.push(specifier);
62
+ }
63
+ return {
64
+ components,
65
+ composables,
66
+ css,
67
+ requiresThemes: css.length > 0 || components.some(({ from }) => from === THEMES_PACKAGE),
68
+ };
69
+ }
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@ghostvue/nuxt",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Nuxt module for GhostVue: headless auto-imports by default, opt-in themed wrappers and theme CSS.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/zprue743/ghostvue.git",
9
+ "directory": "packages/nuxt"
10
+ },
11
+ "type": "module",
12
+ "sideEffects": false,
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "types": "./dist/index.d.ts",
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public",
25
+ "provenance": true
26
+ },
27
+ "dependencies": {
28
+ "@nuxt/kit": "4.6.4",
29
+ "@nuxt/schema": "4.6.4"
30
+ },
31
+ "peerDependencies": {
32
+ "nuxt": "^4.6.0",
33
+ "@ghostvue/themes": "^0.1.0",
34
+ "@ghostvue/vue": "^0.1.0"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "@ghostvue/themes": {
38
+ "optional": true
39
+ }
40
+ },
41
+ "devDependencies": {
42
+ "nuxt": "4.6.4",
43
+ "vite": "8.3.5",
44
+ "@ghostvue/themes": "0.1.0",
45
+ "@ghostvue/vue": "0.1.0"
46
+ },
47
+ "scripts": {
48
+ "prebuild": "pnpm -w registries:write",
49
+ "build": "tsc -p tsconfig.build.json",
50
+ "pretypecheck": "pnpm -w registries:write",
51
+ "typecheck": "tsc -p tsconfig.json --noEmit"
52
+ }
53
+ }