@zoobzio/nuxt 0.1.9 → 0.1.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.
@@ -1,67 +1,59 @@
1
1
  import type { Bound } from "./actions";
2
2
  import type { Hooks } from "./hooks";
3
+ import type { MaybeRefOrGetter } from "vue";
3
4
  import type {
4
5
  ActionDescriptor,
5
6
  Actions,
6
7
  BulkAction,
7
8
  Config,
8
9
  Events,
10
+ Permissions,
9
11
  RowAction,
12
+ RowData,
10
13
  Service,
11
- State,
12
14
  } from "@zoobzio/table";
13
15
 
14
16
  /**
15
17
  * A row action: its descriptor and its handler, under the config key.
16
18
  */
17
- export type TableAction<T> = Bound<ActionDescriptor, RowAction<T>["action"]>;
19
+ export type TableAction<T extends RowData> = Bound<
20
+ ActionDescriptor,
21
+ RowAction<T>["action"]
22
+ >;
18
23
 
19
24
  /**
20
25
  * A bulk action over the selection: its descriptor and its handler, under
21
- * the config key.
26
+ * the config key. The handler is given the ids of the selected rows.
22
27
  */
23
28
  export type TableBulkAction = Bound<ActionDescriptor, BulkAction["action"]>;
24
29
 
25
- /**
26
- * The slice of the state container a table may start from: the paging,
27
- * sort, selection, column order, column widths, and committed query the
28
- * consumer chooses,
29
- * never what a fetch fills in. It seeds the `useState` record, so it must
30
- * survive Nuxt's payload (devalue carries the `Set`).
31
- */
32
- export type TableInitial<T> = Partial<
33
- Pick<
34
- State<T>,
35
- | "page"
36
- | "pageSize"
37
- | "sortField"
38
- | "sortDirection"
39
- | "selected"
40
- | "columnOrder"
41
- | "columnWidths"
42
- | "entries"
43
- >
44
- >;
45
-
46
30
  /**
47
31
  * What `createTable` takes: the headless config with each action's handler
48
- * joined to its descriptor, the fetch mechanism, and the initial state.
32
+ * joined to its descriptor, and the fetch mechanism. The config's
33
+ * `initialState` and `initialEntries` are what the table starts from: they
34
+ * seed the `useState` record, so they must survive Nuxt's payload.
49
35
  */
50
- export type TableOptions<T> = Omit<Config<T>, "actions" | "bulkActions"> & {
36
+ export type TableOptions<T extends RowData> = Omit<
37
+ Config<T>,
38
+ "actions" | "bulkActions"
39
+ > & {
51
40
  fetch: Actions<T>["fetch"];
52
41
  actions?: Record<string, TableAction<T>>;
53
42
  bulkActions?: Record<string, TableBulkAction>;
54
- initial?: TableInitial<T>;
55
43
  };
56
44
 
57
45
  /**
58
- * The Nuxt hooks a table relays: `table:updated` and `table:filtered`,
59
- * each carrying the service's payload with its scoping `id`.
46
+ * The Nuxt hooks a table relays: `table:updated`, `table:filtered`, and
47
+ * `table:restored`, each carrying the service's payload with its scoping `id`.
60
48
  */
61
- export type TableHooks = Hooks<"table", Events<unknown>>;
49
+ export type TableHooks = Hooks<"table", Events<RowData>>;
62
50
 
63
51
  /**
64
52
  * The id-scoped composable `createTable` returns. Call it in setup; every
65
- * call yields a service over the same shared container.
53
+ * call yields a service over the same shared container. The permissions it
54
+ * is given are what this visitor may do, over the options' own: a ref or a
55
+ * getter is read on every check, so the table follows it as it changes.
66
56
  */
67
- export type UseTable<T> = () => Service<T>;
57
+ export type UseTable<T extends RowData> = (
58
+ permissions?: MaybeRefOrGetter<Permissions | undefined>,
59
+ ) => Service<T>;
@@ -0,0 +1,51 @@
1
+ import type { Hooks } from "./hooks";
2
+ import type {
3
+ BROWSER_VIEW_SCHEMA,
4
+ TABLE_VIEW_SCHEMA,
5
+ } from "../constants/views";
6
+ import type { Actions, Config, Events, Service } from "@zoobzio/views";
7
+ import type { z } from "zod";
8
+
9
+ /**
10
+ * The payload of a table's saved view, as `TABLE_VIEW_SCHEMA` yields it:
11
+ * the table's `Snapshot`.
12
+ */
13
+ export type TableView = z.output<typeof TABLE_VIEW_SCHEMA>;
14
+
15
+ /**
16
+ * The payload of a browser's saved view, as `BROWSER_VIEW_SCHEMA` yields
17
+ * it: the browser's `Snapshot`.
18
+ */
19
+ export type BrowserView = z.output<typeof BROWSER_VIEW_SCHEMA>;
20
+
21
+ /**
22
+ * What views are over: anything that yields its arrangement and takes one
23
+ * back. A table service and a browser service are each one. `snapshot`
24
+ * must read reactive state for the drift to show.
25
+ */
26
+ export type ViewsTarget<P> = {
27
+ snapshot(): P;
28
+ restore(payload: P): void;
29
+ };
30
+
31
+ /**
32
+ * What `createViews` takes: the headless config and the storage. The
33
+ * config's `views` seed the `useState` record, so their payloads must
34
+ * survive Nuxt's payload. `read` and `apply` are not among the options:
35
+ * the composable is handed the target they reach.
36
+ */
37
+ export type ViewsOptions<P> = Config<P> &
38
+ Pick<Actions<P>, "load" | "save" | "remove" | "key">;
39
+
40
+ /**
41
+ * The Nuxt hooks the views relay, under the `views:` prefix, each carrying
42
+ * the service's payload with its scoping `id`.
43
+ */
44
+ export type ViewsHooks = Hooks<"views", Events<unknown>>;
45
+
46
+ /**
47
+ * The id-scoped composable `createViews` returns. Call it in setup with
48
+ * what the views are over; every call yields a service over the same
49
+ * shared container.
50
+ */
51
+ export type UseViews<P> = (target: ViewsTarget<P>) => Service<P>;
@@ -0,0 +1,18 @@
1
+ import type { IconAlias } from "../types/icon";
2
+ import type { AppMessage } from "../types/text";
3
+
4
+ import { CALENDAR_TOOL_ICONS, CALENDAR_TOOL_TEXT } from "../constants/calendar";
5
+
6
+ /**
7
+ * The icon of a calendar tool, by its key. Today and the views have none,
8
+ * and neither does a tool the layer does not name.
9
+ */
10
+ export const toolIcon = (key: string): IconAlias | undefined =>
11
+ CALENDAR_TOOL_ICONS[key];
12
+
13
+ /**
14
+ * The text of a calendar tool, by its key, as a message of the contract.
15
+ * A tool the layer does not name has none, and its own label stands.
16
+ */
17
+ export const toolText = (key: string): AppMessage | undefined =>
18
+ CALENDAR_TOOL_TEXT[key];
@@ -7,12 +7,15 @@ export const COMPONENTS = [
7
7
  "browser-bulk-actions",
8
8
  "browser-files",
9
9
  "browser-folders",
10
+ "browser-head",
10
11
  "calendar",
11
12
  "checkbox",
12
13
  "code",
13
14
  "command",
14
15
  "date-filters",
16
+ "date-grid",
15
17
  "date-picker",
18
+ "date-range-grid",
16
19
  "date-range-picker",
17
20
  "dialog",
18
21
  "directory",
@@ -23,6 +26,7 @@ export const COMPONENTS = [
23
26
  "form",
24
27
  "form-field",
25
28
  "hero",
29
+ "image-input",
26
30
  "keywords",
27
31
  "listbox",
28
32
  "menu",
@@ -31,7 +35,6 @@ export const COMPONENTS = [
31
35
  "popover",
32
36
  "primitive",
33
37
  "radio",
34
- "range-calendar",
35
38
  "rich-text",
36
39
  "scroller",
37
40
  "segmented-control",
@@ -47,6 +50,7 @@ export const COMPONENTS = [
47
50
  "toaster",
48
51
  "tooltip",
49
52
  "tree",
53
+ "views",
50
54
  ] as const;
51
55
 
52
56
  // The components the layer wraps through `wrap` of @zoobzio/vue: one holds
@@ -65,7 +69,9 @@ export const WRAPPED = [
65
69
  "code",
66
70
  "command",
67
71
  "date-filters",
72
+ "date-grid",
68
73
  "date-picker",
74
+ "date-range-grid",
69
75
  "date-range-picker",
70
76
  "dialog",
71
77
  "directory",
@@ -76,13 +82,13 @@ export const WRAPPED = [
76
82
  "form",
77
83
  "form-field",
78
84
  "hero",
85
+ "image-input",
79
86
  "keywords",
80
87
  "listbox",
81
88
  "menu",
82
89
  "multi-select",
83
90
  "pagination",
84
91
  "radio",
85
- "range-calendar",
86
92
  "rich-text",
87
93
  "scroller",
88
94
  "segmented-control",
@@ -92,6 +98,7 @@ export const WRAPPED = [
92
98
  "tags-input",
93
99
  "toast",
94
100
  "tree",
101
+ "views",
95
102
  ] as const satisfies readonly (typeof COMPONENTS)[number][];
96
103
 
97
104
  export const DEFINITIONS = [
@@ -105,7 +112,9 @@ export const DEFINITIONS = [
105
112
  "code",
106
113
  "command",
107
114
  "date-filters",
115
+ "date-grid",
108
116
  "date-picker",
117
+ "date-range-grid",
109
118
  "date-range-picker",
110
119
  "dialog",
111
120
  "directory",
@@ -115,6 +124,7 @@ export const DEFINITIONS = [
115
124
  "file-input",
116
125
  "form",
117
126
  "hero",
127
+ "image-input",
118
128
  "keywords",
119
129
  "listbox",
120
130
  "menu",
@@ -122,7 +132,6 @@ export const DEFINITIONS = [
122
132
  "pagination",
123
133
  "popover",
124
134
  "radio",
125
- "range-calendar",
126
135
  "rich-text",
127
136
  "scroller",
128
137
  "segmented-control",
@@ -134,6 +143,7 @@ export const DEFINITIONS = [
134
143
  "toaster",
135
144
  "tooltip",
136
145
  "tree",
146
+ "views",
137
147
  ] as const;
138
148
 
139
149
  // The layer's own consumer surface, keyed by the `app/` subpath that
@@ -147,6 +157,7 @@ export const LAYER = {
147
157
  "composables/log": ["useLogger"],
148
158
  "composables/notification": ["useNotifications"],
149
159
  "composables/request": ["useRequest", "useLazyRequest"],
160
+ "constants/calendar": ["CALENDAR_TOOL_ICONS", "CALENDAR_TOOL_TEXT"],
150
161
  "constants/editor": ["EDITOR_TOOL_ICONS", "EDITOR_TOOL_TEXT"],
151
162
  "constants/error": [
152
163
  "ERROR_DEFAULT_STATUS_CODE",
@@ -154,18 +165,23 @@ export const LAYER = {
154
165
  ],
155
166
  "constants/log": ["LOG_ROOT_NAME", "LOG_LEVELS"],
156
167
  "constants/table": ["TABLE_SEARCH_KEY"],
168
+ "constants/views": ["TABLE_VIEW_SCHEMA", "BROWSER_VIEW_SCHEMA"],
157
169
  "factories/browser": ["createBrowser"],
170
+ "factories/calendar": ["createCalendar"],
158
171
  "factories/code": ["createCode"],
159
172
  "factories/editor": ["createEditor"],
160
173
  "factories/form": ["createForm"],
161
174
  "factories/table": ["createTable"],
175
+ "factories/views": ["createViews"],
162
176
  "stores/browser": ["accessBrowser"],
177
+ "stores/calendar": ["accessCalendar"],
163
178
  "stores/code": ["accessCode"],
164
179
  "stores/editor": ["accessEditor"],
165
180
  "stores/form": ["accessForm"],
166
181
  "stores/log": ["accessLogs"],
167
182
  "stores/notification": ["accessNotifications"],
168
183
  "stores/table": ["accessTable"],
184
+ "stores/views": ["accessViews"],
169
185
  "utils/text": ["resolveText", "resolveTexts"],
170
186
  } as const satisfies Record<string, readonly string[]>;
171
187
 
@@ -186,6 +202,12 @@ export const LAYER_TYPES = {
186
202
  "BrowserHooks",
187
203
  "UseBrowser",
188
204
  ],
205
+ "types/calendar": [
206
+ "CalendarInitial",
207
+ "CalendarOptions",
208
+ "CalendarHooks",
209
+ "UseCalendar",
210
+ ],
189
211
  "types/code": ["CodeOptions", "CodeHooks", "UseCode"],
190
212
  "types/editor": ["EditorOptions", "EditorHooks", "UseEditor"],
191
213
  "types/error": ["ErrorData", "ErrorOptions", "AppError"],
@@ -206,11 +228,18 @@ export const LAYER_TYPES = {
206
228
  "types/table": [
207
229
  "TableAction",
208
230
  "TableBulkAction",
209
- "TableInitial",
210
231
  "TableOptions",
211
232
  "TableHooks",
212
233
  "UseTable",
213
234
  ],
235
+ "types/views": [
236
+ "TableView",
237
+ "BrowserView",
238
+ "ViewsTarget",
239
+ "ViewsOptions",
240
+ "ViewsHooks",
241
+ "UseViews",
242
+ ],
214
243
  } as const satisfies Record<string, readonly string[]>;
215
244
 
216
245
  // Type-only exports of @zoobzio/vue, keyed by the `types/` subpath, registered
@@ -297,8 +326,16 @@ export const VUE_TYPES = {
297
326
  "BrowserFoldersContext",
298
327
  "BrowserFoldersSlots",
299
328
  ],
300
- "components/browser": [
329
+ "components/browser-head": [
301
330
  "BrowserCrumbItem",
331
+ "BrowserHeadPassthrough",
332
+ "BrowserHeadProps",
333
+ "BrowserHeadContext",
334
+ "BrowserCrumbContext",
335
+ "BrowserHeadSlots",
336
+ ],
337
+ "components/browser": [
338
+ "BrowserSortItem",
302
339
  "BrowserPassthrough",
303
340
  "BrowserProps",
304
341
  "BrowserEmits",
@@ -307,8 +344,12 @@ export const VUE_TYPES = {
307
344
  "BrowserDefinition",
308
345
  ],
309
346
  "components/calendar": [
310
- "CalendarView",
311
- "CalendarMonth",
347
+ "CalendarTool",
348
+ "CalendarToolKind",
349
+ "CalendarToolGroup",
350
+ "CalendarGroup",
351
+ "CalendarWeekday",
352
+ "CalendarDay",
312
353
  "CalendarPassthrough",
313
354
  "CalendarProps",
314
355
  "CalendarEmits",
@@ -354,6 +395,16 @@ export const VUE_TYPES = {
354
395
  "DateFiltersSlots",
355
396
  "DateFiltersDefinition",
356
397
  ],
398
+ "components/date-grid": [
399
+ "DateGridView",
400
+ "DateGridMonth",
401
+ "DateGridPassthrough",
402
+ "DateGridProps",
403
+ "DateGridEmits",
404
+ "DateGridContext",
405
+ "DateGridSlots",
406
+ "DateGridDefinition",
407
+ ],
357
408
  "components/date-picker": [
358
409
  "DatePickerFieldProps",
359
410
  "DatePickerCalendarProps",
@@ -369,6 +420,16 @@ export const VUE_TYPES = {
369
420
  "DatePickerSlots",
370
421
  "DatePickerDefinition",
371
422
  ],
423
+ "components/date-range-grid": [
424
+ "DateRangeGridView",
425
+ "DateRangeGridMonth",
426
+ "DateRangeGridPassthrough",
427
+ "DateRangeGridProps",
428
+ "DateRangeGridEmits",
429
+ "DateRangeGridContext",
430
+ "DateRangeGridSlots",
431
+ "DateRangeGridDefinition",
432
+ ],
372
433
  "components/date-range-picker": [
373
434
  "DateRangePickerFieldProps",
374
435
  "DateRangePickerCalendarProps",
@@ -441,6 +502,15 @@ export const VUE_TYPES = {
441
502
  "FileInputSlots",
442
503
  "FileInputDefinition",
443
504
  ],
505
+ "components/image-input": [
506
+ "ImageInputValue",
507
+ "ImageInputPassthrough",
508
+ "ImageInputProps",
509
+ "ImageInputEmits",
510
+ "ImageInputContext",
511
+ "ImageInputSlots",
512
+ "ImageInputDefinition",
513
+ ],
444
514
  "components/form-field": [
445
515
  "FormFieldPassthrough",
446
516
  "FormFieldControl",
@@ -525,16 +595,6 @@ export const VUE_TYPES = {
525
595
  "RadioSlots",
526
596
  "RadioDefinition",
527
597
  ],
528
- "components/range-calendar": [
529
- "RangeCalendarView",
530
- "RangeCalendarMonth",
531
- "RangeCalendarPassthrough",
532
- "RangeCalendarProps",
533
- "RangeCalendarEmits",
534
- "RangeCalendarContext",
535
- "RangeCalendarSlots",
536
- "RangeCalendarDefinition",
537
- ],
538
598
  "components/scroller": [
539
599
  "ScrollerType",
540
600
  "ScrollerDir",
@@ -565,7 +625,7 @@ export const VUE_TYPES = {
565
625
  ],
566
626
  "components/table-body": [
567
627
  "TableActionItem",
568
- "TableCell",
628
+ "TableCellScope",
569
629
  "TableBodyPassthrough",
570
630
  "TableBodyProps",
571
631
  "TableBodyContext",
@@ -657,4 +717,15 @@ export const VUE_TYPES = {
657
717
  "TreeSlots",
658
718
  "TreeDefinition",
659
719
  ],
720
+ "components/views": [
721
+ "ViewsTab",
722
+ "ViewsAction",
723
+ "ViewsNaming",
724
+ "ViewsPassthrough",
725
+ "ViewsProps",
726
+ "ViewsEmits",
727
+ "ViewsContext",
728
+ "ViewsSlots",
729
+ "ViewsDefinition",
730
+ ],
660
731
  } as const satisfies Record<string, readonly string[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoobzio/nuxt",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Nuxt layer for the foundation design system: the Nuxt wiring over @zoobzio/vue and the headless services (useState stores, hook-bus factories, app shell).",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -39,6 +39,7 @@
39
39
  "@icon-sheets/nuxt": "0.0.8",
40
40
  "@nuxt/kit": "^4.5.0",
41
41
  "@prosary/nuxt": "0.0.11",
42
+ "@tanstack/table-core": "^9.3.1",
42
43
  "@untheme/nuxt": "^0.6.1",
43
44
  "@vueuse/core": "^14.3.0",
44
45
  "ltrl-http": "^0.0.20",
@@ -46,17 +47,19 @@
46
47
  "prosary": "0.0.11",
47
48
  "reka-ui": "^2.6.0",
48
49
  "untheme": "^0.6.1",
49
- "@zoobzio/browser": "0.1.9",
50
- "@zoobzio/code": "0.1.9",
51
- "@zoobzio/editor": "0.1.9",
52
- "@zoobzio/form": "0.1.9",
53
- "@zoobzio/icons": "0.1.9",
54
- "@zoobzio/kit": "0.1.9",
55
- "@zoobzio/prose": "0.1.9",
56
- "@zoobzio/query": "0.1.9",
57
- "@zoobzio/table": "0.1.9",
58
- "@zoobzio/theme": "0.1.9",
59
- "@zoobzio/vue": "0.1.9"
50
+ "@zoobzio/browser": "0.1.11",
51
+ "@zoobzio/calendar": "0.1.11",
52
+ "@zoobzio/code": "0.1.11",
53
+ "@zoobzio/form": "0.1.11",
54
+ "@zoobzio/editor": "0.1.11",
55
+ "@zoobzio/icons": "0.1.11",
56
+ "@zoobzio/kit": "0.1.11",
57
+ "@zoobzio/prose": "0.1.11",
58
+ "@zoobzio/query": "0.1.11",
59
+ "@zoobzio/table": "0.1.11",
60
+ "@zoobzio/theme": "0.1.11",
61
+ "@zoobzio/views": "0.1.11",
62
+ "@zoobzio/vue": "0.1.11"
60
63
  },
61
64
  "devDependencies": {
62
65
  "@codemirror/state": "^6.7.6",