@zoobzio/nuxt 0.0.1 → 0.0.2

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.
@@ -0,0 +1,67 @@
1
+ <script lang="ts">
2
+ import type {
3
+ TreeContext,
4
+ TreeEmits,
5
+ TreeNode,
6
+ TreePassthrough,
7
+ TreeProps,
8
+ TreeSlots,
9
+ } from "@zoobzio/vue/types/components/tree";
10
+ import type { Context } from "@zoobzio/vue/types/context";
11
+ import type { Passthrough } from "@zoobzio/vue/types/passthrough";
12
+ import type { VNodeProps } from "vue";
13
+
14
+ import Core from "@zoobzio/vue/components/tree.vue";
15
+
16
+ import NuxtLink from "#app/components/nuxt-link";
17
+ import { shallowRef, useAttrs } from "vue";
18
+ import { useContext } from "@zoobzio/vue/composables/context";
19
+ import { useExplicit } from "@zoobzio/vue/composables/explicit";
20
+ import { useForward } from "@zoobzio/vue/composables/forward";
21
+ import { usePassthrough } from "@zoobzio/vue/composables/passthrough";
22
+ </script>
23
+
24
+ <script setup lang="ts" generic="T extends TreeNode & { children?: T[] }">
25
+ defineOptions({ inheritAttrs: false });
26
+
27
+ const props = defineProps<TreeProps<T>>();
28
+
29
+ const emit = defineEmits<TreeEmits<T>>();
30
+
31
+ const slots = defineSlots<TreeSlots<T>>();
32
+
33
+ const attrs = useAttrs();
34
+
35
+ const explicit = useExplicit(props);
36
+
37
+ const el = shallowRef<{ ctx: Context<TreeContext<T>> } | null>(null);
38
+
39
+ const pt = usePassthrough<TreePassthrough<T>>(() => ({
40
+ pt: props.pt,
41
+ layer: { link: () => ({ as: NuxtLink }) },
42
+ }));
43
+
44
+ const ctx = useContext(() => el.value?.ctx);
45
+
46
+ const Tree = useForward<Passthrough<TreeProps<T>, TreeEmits<T>> & VNodeProps>({
47
+ component: Core,
48
+ props: () => ({
49
+ ...attrs,
50
+ ...explicit.value,
51
+ pt: pt.value,
52
+ ref: el,
53
+ "onUpdate:modelValue": (value: T | undefined) =>
54
+ emit("update:modelValue", value),
55
+ "onUpdate:expanded": (value: string[]) => emit("update:expanded", value),
56
+ onSelect: (node: T) => emit("select", node),
57
+ onToggle: (node: T, expanded: boolean) => emit("toggle", node, expanded),
58
+ }),
59
+ slots,
60
+ });
61
+
62
+ defineExpose({ ctx });
63
+ </script>
64
+
65
+ <template>
66
+ <Tree />
67
+ </template>
@@ -1,7 +1,7 @@
1
1
  import type { AppError, ErrorData, ErrorOptions } from "../types/error";
2
2
  import type { HTTPCode } from "ltrl-http";
3
3
 
4
- import { createError } from "#imports";
4
+ import { createError } from "#app";
5
5
  import { useHTTPCode } from "ltrl-http";
6
6
 
7
7
  /**
@@ -4,7 +4,8 @@ import type {
4
4
  ScopedEvent,
5
5
  } from "../types/hook";
6
6
 
7
- import { onScopeDispose, useNuxtApp } from "#imports";
7
+ import { useNuxtApp } from "#app";
8
+ import { onScopeDispose } from "vue";
8
9
  import { entries } from "objectively";
9
10
 
10
11
  /**
@@ -2,7 +2,8 @@ import type { AppError } from "../types/error";
2
2
  import type { RequestOptions } from "../types/request";
3
3
  import type { MaybeRefOrGetter } from "vue";
4
4
 
5
- import { toValue, useAsyncData, useLazyAsyncData, watch } from "#imports";
5
+ import { useAsyncData, useLazyAsyncData } from "#app";
6
+ import { toValue, watch } from "vue";
6
7
  import { status } from "ltrl-http";
7
8
  import { useLogger } from "./log";
8
9
  import { useAppError } from "./error";
package/app/error.vue CHANGED
@@ -1,7 +1,8 @@
1
1
  <script lang="ts">
2
2
  import type { NuxtError } from "#app";
3
3
 
4
- import { clearError, computed } from "#imports";
4
+ import { clearError } from "#app";
5
+ import { computed } from "vue";
5
6
  import {
6
7
  ERROR_DEFAULT_STATUS_CODE,
7
8
  ERROR_NOT_FOUND_STATUS_CODE,
@@ -1,7 +1,7 @@
1
1
  import type { BrowserOptions, UseBrowser } from "../types/browser";
2
2
  import type { Actions, Config, Service } from "@zoobzio/browser";
3
3
 
4
- import { useNuxtApp } from "#imports";
4
+ import { useNuxtApp } from "#app";
5
5
  import { BrowserService } from "@zoobzio/browser";
6
6
  import { accessBrowser } from "../stores/browser";
7
7
  import { split } from "../utils/actions";
@@ -1,7 +1,7 @@
1
1
  import type { FormOptions, UseForm } from "../types/form";
2
2
  import type { Actions, Service } from "@zoobzio/form";
3
3
 
4
- import { useNuxtApp } from "#imports";
4
+ import { useNuxtApp } from "#app";
5
5
  import { FormService } from "@zoobzio/form";
6
6
  import { accessForm } from "../stores/form";
7
7
 
@@ -1,7 +1,7 @@
1
1
  import type { TableOptions, UseTable } from "../types/table";
2
2
  import type { Actions, Config, Service } from "@zoobzio/table";
3
3
 
4
- import { useNuxtApp } from "#imports";
4
+ import { useNuxtApp } from "#app";
5
5
  import { TableService } from "@zoobzio/table";
6
6
  import { accessTable } from "../stores/table";
7
7
  import { split } from "../utils/actions";
@@ -1,4 +1,4 @@
1
- import { defineNuxtPlugin } from "#imports";
1
+ import { defineNuxtPlugin } from "#app";
2
2
  import { useLogger } from "../composables/log";
3
3
  import { LOG_ROOT_NAME } from "../constants/log";
4
4
 
@@ -1,7 +1,7 @@
1
1
  import type { BrowserInitial } from "../types/browser";
2
2
  import type { State } from "@zoobzio/browser";
3
3
 
4
- import { useState } from "#imports";
4
+ import { useState } from "#app";
5
5
  import { createBrowserState } from "@zoobzio/browser";
6
6
  import { seed } from "../utils/state";
7
7
 
@@ -1,7 +1,7 @@
1
1
  import type { FormInitial } from "../types/form";
2
2
  import type { Config, State } from "@zoobzio/form";
3
3
 
4
- import { useState } from "#imports";
4
+ import { useState } from "#app";
5
5
  import { createFormState } from "@zoobzio/form";
6
6
  import { seed } from "../utils/state";
7
7
 
package/app/stores/log.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { LogLevel, LogLine } from "../types/log";
2
2
 
3
- import { useState } from "#imports";
3
+ import { useState } from "#app";
4
4
 
5
5
  /**
6
6
  * The Nuxt backing for the app's logs: the current level under `log:level`
@@ -1,6 +1,6 @@
1
1
  import type { Notification } from "../types/notification";
2
2
 
3
- import { useState } from "#imports";
3
+ import { useState } from "#app";
4
4
 
5
5
  /**
6
6
  * The Nuxt backing for the app's notifications: one `useState` record,
@@ -1,7 +1,7 @@
1
1
  import type { TableInitial } from "../types/table";
2
2
  import type { Config, State } from "@zoobzio/table";
3
3
 
4
- import { useState } from "#imports";
4
+ import { useState } from "#app";
5
5
  import { createTableState } from "@zoobzio/table";
6
6
  import { seed } from "../utils/state";
7
7
 
@@ -44,6 +44,22 @@ export const COMPONENTS = [
44
44
  "tree",
45
45
  ] as const;
46
46
 
47
+ // The components the layer wraps: each holds a `link` part, and the layer's
48
+ // own component of the same name lays `NuxtLink` under it. These resolve to
49
+ // `app/components/` instead of @zoobzio/vue, so `#components` serves the
50
+ // Nuxt version only.
51
+ export const WRAPPED = [
52
+ "breadcrumb",
53
+ "browser",
54
+ "directory",
55
+ "hero",
56
+ "menu",
57
+ "segmented-control",
58
+ "table",
59
+ "tabs",
60
+ "tree",
61
+ ] as const satisfies readonly (typeof COMPONENTS)[number][];
62
+
47
63
  export const DEFINITIONS = [
48
64
  "accordion",
49
65
  "autocomplete",
@@ -144,3 +160,405 @@ export const LAYER_TYPES = {
144
160
  "UseTable",
145
161
  ],
146
162
  } as const satisfies Record<string, readonly string[]>;
163
+
164
+ // Type-only exports of @zoobzio/vue, keyed by the `types/` subpath, registered
165
+ // the same way as LAYER_TYPES so `import type { SelectProps } from "#imports"`
166
+ // resolves without a consumer dependency on @zoobzio/vue. The consumer
167
+ // surface: the shared item types (`common`), the `define*` and `pt`
168
+ // vocabulary (`definition`, `passthrough`), and every component contract
169
+ // (props, emits, context, slots, definition, passthrough manifest, and the
170
+ // item shapes they name). The remaining `types/` files (`context`, `events`,
171
+ // `forward`, `refs`, `service`, `slots`) and `PassthroughSource` back the
172
+ // package's composables, which are not registered either.
173
+ export const VUE_TYPES = {
174
+ common: [
175
+ "Option",
176
+ "Link",
177
+ "LinkTarget",
178
+ "LinkProps",
179
+ "Hierarchy",
180
+ "TocLink",
181
+ "ButtonShortcut",
182
+ ],
183
+ definition: ["Definition", "DefinitionSource"],
184
+ passthrough: ["Passthrough", "PassthroughIter", "PT"],
185
+ "components/accordion": [
186
+ "AccordionPassthrough",
187
+ "AccordionProps",
188
+ "AccordionEmits",
189
+ "AccordionContext",
190
+ "AccordionSlots",
191
+ "AccordionDefinition",
192
+ ],
193
+ "components/autocomplete": [
194
+ "AutocompleteAnchor",
195
+ "AutocompleteChipAnchor",
196
+ "AutocompletePassthrough",
197
+ "AutocompleteProps",
198
+ "AutocompleteEmits",
199
+ "AutocompleteContext",
200
+ "AutocompleteOptionContext",
201
+ "AutocompleteChipContext",
202
+ "AutocompleteSlots",
203
+ "AutocompleteDefinition",
204
+ ],
205
+ "components/avatar": [
206
+ "AvatarPassthrough",
207
+ "AvatarProps",
208
+ "AvatarEmits",
209
+ "AvatarContext",
210
+ "AvatarSlots",
211
+ "AvatarDefinition",
212
+ ],
213
+ "components/breadcrumb": [
214
+ "BreadcrumbItem",
215
+ "BreadcrumbPassthrough",
216
+ "BreadcrumbProps",
217
+ "BreadcrumbEmits",
218
+ "BreadcrumbContext",
219
+ "BreadcrumbSlots",
220
+ "BreadcrumbDefinition",
221
+ ],
222
+ "components/browser-bulk-actions": [
223
+ "BrowserBulkActionsProps",
224
+ "BrowserBulkActionsContext",
225
+ "BrowserBulkActionsSlots",
226
+ ],
227
+ "components/browser-files": [
228
+ "BrowserActionItem",
229
+ "BrowserFileCell",
230
+ "BrowserFilesPassthrough",
231
+ "BrowserFilesProps",
232
+ "BrowserFilesContext",
233
+ "BrowserFileCellContext",
234
+ "BrowserFilesSlots",
235
+ ],
236
+ "components/browser-folders": [
237
+ "BrowserFoldersPassthrough",
238
+ "BrowserFoldersProps",
239
+ "BrowserFoldersContext",
240
+ "BrowserFoldersSlots",
241
+ ],
242
+ "components/browser": [
243
+ "BrowserCrumbItem",
244
+ "BrowserPassthrough",
245
+ "BrowserProps",
246
+ "BrowserEmits",
247
+ "BrowserContext",
248
+ "BrowserSlots",
249
+ "BrowserDefinition",
250
+ ],
251
+ "components/calendar": [
252
+ "CalendarView",
253
+ "CalendarMonth",
254
+ "CalendarPassthrough",
255
+ "CalendarProps",
256
+ "CalendarEmits",
257
+ "CalendarContext",
258
+ "CalendarSlots",
259
+ "CalendarDefinition",
260
+ ],
261
+ "components/checkbox": [
262
+ "CheckboxPassthrough",
263
+ "CheckboxProps",
264
+ "CheckboxEmits",
265
+ "CheckboxContext",
266
+ "CheckboxSlots",
267
+ "CheckboxDefinition",
268
+ ],
269
+ "components/command": [
270
+ "CommandOption",
271
+ "CommandGroup",
272
+ "CommandPassthrough",
273
+ "CommandProps",
274
+ "CommandEmits",
275
+ "CommandContext",
276
+ "OptionContext",
277
+ "CommandSlots",
278
+ "CommandDefinition",
279
+ ],
280
+ "components/date-filters": [
281
+ "DateFilterOperator",
282
+ "DateFilter",
283
+ "DateFieldConfig",
284
+ "DateFiltersPassthrough",
285
+ "DateFiltersProps",
286
+ "DateFiltersEmits",
287
+ "DateFiltersContext",
288
+ "DateFiltersSlots",
289
+ "DateFiltersDefinition",
290
+ ],
291
+ "components/date-picker": [
292
+ "DatePickerFieldProps",
293
+ "DatePickerCalendarProps",
294
+ "DatePickerFieldSlotProps",
295
+ "DatePickerSegment",
296
+ "DatePickerSegments",
297
+ "DatePickerView",
298
+ "DatePickerMonth",
299
+ "DatePickerPassthrough",
300
+ "DatePickerProps",
301
+ "DatePickerEmits",
302
+ "DatePickerContext",
303
+ "DatePickerSlots",
304
+ "DatePickerDefinition",
305
+ ],
306
+ "components/date-range-picker": [
307
+ "DateRangePickerFieldProps",
308
+ "DateRangePickerCalendarProps",
309
+ "DateRangePickerFieldSlotProps",
310
+ "DateRangePickerSegment",
311
+ "DateRangePickerSegments",
312
+ "DateRangePickerInputItem",
313
+ "DateRangePickerView",
314
+ "DateRangePickerMonth",
315
+ "DateRangePickerPassthrough",
316
+ "DateRangePickerProps",
317
+ "DateRangePickerEmits",
318
+ "DateRangePickerContext",
319
+ "DateRangePickerSlots",
320
+ "DateRangePickerDefinition",
321
+ ],
322
+ "components/dialog": [
323
+ "DialogPassthrough",
324
+ "DialogProps",
325
+ "DialogEmits",
326
+ "DialogContext",
327
+ "DialogSlots",
328
+ "DialogDefinition",
329
+ ],
330
+ "components/directory": [
331
+ "DirectoryItem",
332
+ "DirectoryGroup",
333
+ "DirectoryPassthrough",
334
+ "DirectoryProps",
335
+ "DirectoryEmits",
336
+ "DirectoryContext",
337
+ "DirectorySlots",
338
+ "DirectoryDefinition",
339
+ ],
340
+ "components/fab": [
341
+ "FabProps",
342
+ "FabEmits",
343
+ "FabContext",
344
+ "FabSlots",
345
+ "FabDefinition",
346
+ ],
347
+ "components/facets": [
348
+ "FacetItem",
349
+ "FacetGroup",
350
+ "FacetsPassthrough",
351
+ "FacetsProps",
352
+ "FacetsEmits",
353
+ "FacetsContext",
354
+ "FacetsSlots",
355
+ "FacetsDefinition",
356
+ ],
357
+ "components/form-field": [
358
+ "FormFieldPassthrough",
359
+ "FormFieldControl",
360
+ "FormFieldResolved",
361
+ "FormFieldProps",
362
+ "FormFieldContext",
363
+ "FormFieldSlots",
364
+ ],
365
+ "components/form": [
366
+ "FormPassthrough",
367
+ "FormProps",
368
+ "FormEmits",
369
+ "FormContext",
370
+ "FormSlots",
371
+ "FormDefinition",
372
+ ],
373
+ "components/hero": [
374
+ "HeroPassthrough",
375
+ "HeroProps",
376
+ "HeroEmits",
377
+ "HeroContext",
378
+ "HeroSlots",
379
+ "HeroDefinition",
380
+ ],
381
+ "components/keywords": [
382
+ "KeywordsMatchMode",
383
+ "KeywordsPassthrough",
384
+ "KeywordsProps",
385
+ "KeywordsEmits",
386
+ "KeywordsContext",
387
+ "KeywordsSlots",
388
+ "KeywordsDefinition",
389
+ ],
390
+ "components/listbox": [
391
+ "ListboxPassthrough",
392
+ "ListboxProps",
393
+ "ListboxEmits",
394
+ "ListboxContext",
395
+ "ListboxSlots",
396
+ "ListboxDefinition",
397
+ ],
398
+ "components/menu": [
399
+ "MenuItem",
400
+ "MenuGroup",
401
+ "MenuPassthrough",
402
+ "MenuProps",
403
+ "MenuEmits",
404
+ "MenuContext",
405
+ "MenuSlots",
406
+ "MenuDefinition",
407
+ ],
408
+ "components/multi-select": [
409
+ "MultiSelectPassthrough",
410
+ "MultiSelectProps",
411
+ "MultiSelectEmits",
412
+ "MultiSelectContext",
413
+ "MultiSelectSlots",
414
+ "MultiSelectDefinition",
415
+ ],
416
+ "components/pagination": [
417
+ "PaginationPassthrough",
418
+ "PaginationProps",
419
+ "PaginationEmits",
420
+ "PaginationContext",
421
+ "PaginationSlots",
422
+ "PaginationDefinition",
423
+ ],
424
+ "components/popover": [
425
+ "PopoverPassthrough",
426
+ "PopoverProps",
427
+ "PopoverEmits",
428
+ "PopoverContext",
429
+ "PopoverSlots",
430
+ "PopoverDefinition",
431
+ ],
432
+ "components/radio": [
433
+ "RadioPassthrough",
434
+ "RadioProps",
435
+ "RadioEmits",
436
+ "RadioContext",
437
+ "RadioSlots",
438
+ "RadioDefinition",
439
+ ],
440
+ "components/range-calendar": [
441
+ "RangeCalendarView",
442
+ "RangeCalendarMonth",
443
+ "RangeCalendarPassthrough",
444
+ "RangeCalendarProps",
445
+ "RangeCalendarEmits",
446
+ "RangeCalendarContext",
447
+ "RangeCalendarSlots",
448
+ "RangeCalendarDefinition",
449
+ ],
450
+ "components/scroller": [
451
+ "ScrollerType",
452
+ "ScrollerDir",
453
+ "ScrollerOrientation",
454
+ "ScrollerPassthrough",
455
+ "ScrollerProps",
456
+ "ScrollerEmits",
457
+ "ScrollerContext",
458
+ "ScrollerSlots",
459
+ "ScrollerDefinition",
460
+ ],
461
+ "components/segmented-control": [
462
+ "SegmentedControlOption",
463
+ "SegmentedControlPassthrough",
464
+ "SegmentedControlProps",
465
+ "SegmentedControlEmits",
466
+ "SegmentedControlContext",
467
+ "SegmentedControlSlots",
468
+ "SegmentedControlDefinition",
469
+ ],
470
+ "components/select": [
471
+ "SelectPassthrough",
472
+ "SelectProps",
473
+ "SelectEmits",
474
+ "SelectContext",
475
+ "SelectSlots",
476
+ "SelectDefinition",
477
+ ],
478
+ "components/table-body": [
479
+ "TableActionItem",
480
+ "TableCell",
481
+ "TableBodyPassthrough",
482
+ "TableBodyProps",
483
+ "TableBodyContext",
484
+ "TableCellContext",
485
+ "TableBodySlots",
486
+ ],
487
+ "components/table-bulk-actions": [
488
+ "TableBulkActionsProps",
489
+ "TableBulkActionsContext",
490
+ "TableBulkActionsSlots",
491
+ ],
492
+ "components/table-columns": [
493
+ "TableColumnsPassthrough",
494
+ "TableColumnsProps",
495
+ "TableColumnsEmits",
496
+ "TableColumnsContext",
497
+ "TableColumnsSlots",
498
+ ],
499
+ "components/table-head": [
500
+ "TableHeadPassthrough",
501
+ "TableHeadProps",
502
+ "TableHeadContext",
503
+ "TableHeadSlots",
504
+ ],
505
+ "components/table": [
506
+ "TablePassthrough",
507
+ "TableProps",
508
+ "TableEmits",
509
+ "TableContext",
510
+ "TableSlots",
511
+ "TableDefinition",
512
+ ],
513
+ "components/tabs": [
514
+ "TabsOption",
515
+ "TabsPassthrough",
516
+ "TabsProps",
517
+ "TabsEmits",
518
+ "TabsContext",
519
+ "TabsSlots",
520
+ "TabsDefinition",
521
+ ],
522
+ "components/tags-input": [
523
+ "TagsInputPassthrough",
524
+ "TagsInputProps",
525
+ "TagsInputEmits",
526
+ "TagsInputContext",
527
+ "TagsInputSlots",
528
+ "TagsInputDefinition",
529
+ ],
530
+ "components/toast": [
531
+ "ToastVariant",
532
+ "ToastPassthrough",
533
+ "ToastProps",
534
+ "ToastEmits",
535
+ "ToastContext",
536
+ "ToastSlots",
537
+ "ToastDefinition",
538
+ ],
539
+ "components/toaster": [
540
+ "ToasterPassthrough",
541
+ "ToasterProps",
542
+ "ToasterEmits",
543
+ "ToasterContext",
544
+ "ToasterSlots",
545
+ "ToasterDefinition",
546
+ ],
547
+ "components/tooltip": [
548
+ "TooltipPassthrough",
549
+ "TooltipProps",
550
+ "TooltipEmits",
551
+ "TooltipContext",
552
+ "TooltipSlots",
553
+ "TooltipDefinition",
554
+ ],
555
+ "components/tree": [
556
+ "TreeNode",
557
+ "TreePassthrough",
558
+ "TreeProps",
559
+ "TreeEmits",
560
+ "TreeContext",
561
+ "TreeSlots",
562
+ "TreeDefinition",
563
+ ],
564
+ } as const satisfies Record<string, readonly string[]>;