@zoobzio/nuxt 0.1.10 → 0.1.12
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/README.md +18 -15
- package/app/components/calendar.ts +15 -4
- package/app/components/checkbox.ts +8 -2
- package/app/components/table.ts +33 -3
- package/app/constants/views.ts +51 -14
- package/app/factories/calendar.ts +34 -6
- package/app/stores/table.ts +1 -1
- package/app/types/browser.ts +2 -2
- package/app/types/calendar.ts +2 -2
- package/app/types/table.ts +1 -1
- package/app/types/views.ts +9 -1
- package/modules/imports/constant.ts +6 -1
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ names no icon of its own (the text literal, the one that opens the quote
|
|
|
147
147
|
free text is typed in); `remove` on a tag's, a file's, and an image
|
|
148
148
|
input's remove button, `image` in an image input's placeholder and
|
|
149
149
|
`camera` before its pick label; `remove` also after an autocomplete chip's label; `close` on a toast's; `top` on a scroller's back-to-top; `check`
|
|
150
|
-
in a checkbox; the editor's and rich text's tools by key (`bold`,
|
|
150
|
+
in a checkbox, and `indeterminate` in its place while the checkbox is neither on nor off, as a table's or a browser's select-all is over some of its rows; the editor's and rich text's tools by key (`bold`,
|
|
151
151
|
`bullet-list`, `undo`, …, see `EDITOR_TOOL_ICONS`), each drawn in place
|
|
152
152
|
of the button's text so the toolbar is icon-only, with the tool's label in
|
|
153
153
|
the visitor's locale as the button's accessible name and its `title`, and
|
|
@@ -156,7 +156,9 @@ visitor's locale as its entries do; the calendar's steps by key (`prev`,
|
|
|
156
156
|
`next`, see `CALENDAR_TOOL_ICONS`), drawn the same way, while today and
|
|
157
157
|
the views keep their names as text; and on
|
|
158
158
|
the table and browser, `refresh`, `columns`, `actions`, `drag`,
|
|
159
|
-
`sort-asc` or `sort-desc` after a sorted header, `
|
|
159
|
+
`sort-asc` or `sort-desc` after a sorted header, `pin` as the button of a
|
|
160
|
+
column's pin menu (`unpin` once the column is pinned) with `pin-start`,
|
|
161
|
+
`pin-end`, and `unpin` before its items, `folder` before a
|
|
160
162
|
folder, `folder-open` before the root crumb of the browser's trail, `sort`
|
|
161
163
|
as the browser's sort trigger until its files sort by a column and
|
|
162
164
|
`sort-asc` or `sort-desc` from then on, as after that column's item in the
|
|
@@ -414,15 +416,15 @@ const users = useUsers(() => ({
|
|
|
414
416
|
}));
|
|
415
417
|
```
|
|
416
418
|
|
|
417
|
-
| Factory | Store | Hooks relayed
|
|
418
|
-
| ---------------- | ---------------- |
|
|
419
|
-
| `createTable` | `accessTable` | `table:updated`, `table:filtered`, `table:restored`
|
|
420
|
-
| `createForm` | `accessForm` | `form:initialized`, `form:submitted`, `form:rejected`, `form:restored`, `form:reset`, `form:failed`
|
|
421
|
-
| `createBrowser` | `accessBrowser` | `browser:updated`, `browser:navigated`, `browser:filtered`, `browser:restored`
|
|
422
|
-
| `createEditor` | `accessEditor` | `editor:loaded`, `editor:updated`, `editor:mounted`, `editor:unmounted`
|
|
423
|
-
| `createCode` | `accessCode` | `code:loaded`, `code:updated`, `code:mounted`, `code:unmounted`
|
|
424
|
-
| `createCalendar` | `accessCalendar` | `calendar:navigated`, `calendar:loaded`, `calendar:changed`, `calendar:selected`
|
|
425
|
-
| `createViews` | `accessViews` | `views:initialized`, `views:selected`, `views:saved`, `views:renamed`, `views:removed`, `views:reverted`, `views:failed`
|
|
419
|
+
| Factory | Store | Hooks relayed |
|
|
420
|
+
| ---------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
421
|
+
| `createTable` | `accessTable` | `table:updated`, `table:filtered`, `table:restored` |
|
|
422
|
+
| `createForm` | `accessForm` | `form:initialized`, `form:submitted`, `form:rejected`, `form:restored`, `form:reset`, `form:failed` |
|
|
423
|
+
| `createBrowser` | `accessBrowser` | `browser:updated`, `browser:navigated`, `browser:filtered`, `browser:restored` |
|
|
424
|
+
| `createEditor` | `accessEditor` | `editor:loaded`, `editor:updated`, `editor:mounted`, `editor:unmounted` |
|
|
425
|
+
| `createCode` | `accessCode` | `code:loaded`, `code:updated`, `code:mounted`, `code:unmounted` |
|
|
426
|
+
| `createCalendar` | `accessCalendar` | `calendar:navigated`, `calendar:loaded`, `calendar:changed`, `calendar:selected`, `calendar:filtered`, `calendar:restored` |
|
|
427
|
+
| `createViews` | `accessViews` | `views:initialized`, `views:selected`, `views:saved`, `views:renamed`, `views:removed`, `views:reverted`, `views:failed` |
|
|
426
428
|
|
|
427
429
|
Every relayed payload carries the service's `id`. `useHooks` subscribes
|
|
428
430
|
for one instance: each listener fires for events with that id only, and
|
|
@@ -442,9 +444,10 @@ Each relay is also logged at `debug` under the service's id (see
|
|
|
442
444
|
|
|
443
445
|
`createViews` builds saved views over another service. Its composable
|
|
444
446
|
takes what the views are over, anything with a `snapshot` and a `restore`,
|
|
445
|
-
which a table and a
|
|
446
|
-
`BROWSER_VIEW_SCHEMA` are
|
|
447
|
-
|
|
447
|
+
which a table, a browser, and a calendar service each have;
|
|
448
|
+
`TABLE_VIEW_SCHEMA`, `BROWSER_VIEW_SCHEMA`, and `CALENDAR_VIEW_SCHEMA` are
|
|
449
|
+
the Zod schemas of what each yields, and `TableView`, `BrowserView`, and
|
|
450
|
+
`CalendarView` their types. Without a `load`, a `save`, and
|
|
448
451
|
a `remove` the views live in the store alone.
|
|
449
452
|
|
|
450
453
|
```ts
|
|
@@ -592,7 +595,7 @@ app/
|
|
|
592
595
|
components/ — the wrapped vue components: wrap(<Core>, { pt, slots }), NuxtLink under link parts, icons in the slots, the layer's components under nested parts; icon.ts is the icon glue they share
|
|
593
596
|
error.vue — the error page
|
|
594
597
|
app.d.ts — RuntimeNuxtHooks augmentation for the relayed events; the vue item types and the headless action descriptors widened with `icon`
|
|
595
|
-
constants/ — error page status codes, log levels, the editor's and the calendar's tools' icons and text, the table's search key, the schemas of a table's and a
|
|
598
|
+
constants/ — error page status codes, log levels, the editor's and the calendar's tools' icons and text, the table's search key, the schemas of a table's, a browser's and a calendar's saved view
|
|
596
599
|
assets/css/ — reset.css, loaded by the layer config
|
|
597
600
|
composables/ — useAppError, useFocusKey, useHooks, useLogger, useNotifications, useRequest, useLazyRequest
|
|
598
601
|
factories/ — create<Name>(id, options) → use<Name>(): Service
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
// The vue calendar with its toolbar dressed: each tool is named in the
|
|
2
2
|
// visitor's locale, the name its accessible name and its tooltip, and the
|
|
3
3
|
// two steps draw their icons in place of their labels; today and the views
|
|
4
|
-
// keep their names as text.
|
|
5
|
-
//
|
|
4
|
+
// keep their names as text. Its search, where the service is searchable,
|
|
5
|
+
// is the layer's TableSearch (the Autocomplete with the `magic` icon, the
|
|
6
|
+
// search key, and that key focusing it), under the visitor's placeholder,
|
|
7
|
+
// and its refresh draws the `refresh` icon under the visitor's label. An
|
|
8
|
+
// untitled occurrence and the empty agenda read in the visitor's locale
|
|
9
|
+
// too.
|
|
6
10
|
import type {
|
|
7
11
|
CalendarPassthrough,
|
|
8
12
|
CalendarTool,
|
|
@@ -14,7 +18,8 @@ import Core from "@zoobzio/vue/components/calendar.vue";
|
|
|
14
18
|
import { h } from "vue";
|
|
15
19
|
import { layer } from "@zoobzio/vue/utils/passthrough";
|
|
16
20
|
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
17
|
-
import
|
|
21
|
+
import TableSearch from "./table-search";
|
|
22
|
+
import { iconOf, iconPart } from "./icon";
|
|
18
23
|
import { text, textIn, textSlot } from "./text";
|
|
19
24
|
import { toolIcon, toolText } from "../utils/calendar";
|
|
20
25
|
|
|
@@ -40,8 +45,14 @@ const toolLabel = (tool: CalendarTool): VNode[] => {
|
|
|
40
45
|
};
|
|
41
46
|
|
|
42
47
|
export default wrap(Core, {
|
|
43
|
-
pt: (pt) =>
|
|
48
|
+
pt: (pt) =>
|
|
49
|
+
layer<CalendarPassthrough>(pt, {
|
|
50
|
+
search: { as: TableSearch, placeholder: text("calendar.search") },
|
|
51
|
+
refresh: { label: text("calendar.refresh") },
|
|
52
|
+
tool: toolLayer,
|
|
53
|
+
}),
|
|
44
54
|
slots: {
|
|
55
|
+
refresh: ({ settings }) => iconPart(settings.refresh, "refresh"),
|
|
45
56
|
toolLabel: ({ tool }) => toolLabel(tool),
|
|
46
57
|
// A title is the entry's own text, never a message; only the name of
|
|
47
58
|
// an entry without one is the layer's.
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
// The vue checkbox with the `check` icon as its indicator
|
|
1
|
+
// The vue checkbox with the `check` icon as its indicator, and
|
|
2
|
+
// `indeterminate` in its place while the checkbox is neither on nor off: a
|
|
3
|
+
// select-all over some of the rows.
|
|
2
4
|
import Core from "@zoobzio/vue/components/checkbox.vue";
|
|
3
5
|
|
|
4
6
|
import { icon } from "./icon";
|
|
5
7
|
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
6
8
|
|
|
7
9
|
export default wrap(Core, {
|
|
8
|
-
slots: {
|
|
10
|
+
slots: {
|
|
11
|
+
icon: ({ modelValue }) => [
|
|
12
|
+
icon(modelValue.value === "indeterminate" ? "indeterminate" : "check"),
|
|
13
|
+
],
|
|
14
|
+
},
|
|
9
15
|
});
|
package/app/components/table.ts
CHANGED
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
// element, and the layer's Pagination.
|
|
8
8
|
// Its Fab slots draw the `refresh`, `columns`, and `actions` icons; the
|
|
9
9
|
// head draws `drag` on each handle, a column's own `icon` before its
|
|
10
|
-
// header, and `sort-asc` or `sort-desc` after a sorted header; a
|
|
11
|
-
//
|
|
10
|
+
// header, and `sort-asc` or `sort-desc` after a sorted header; a column's
|
|
11
|
+
// pin menu is the layer's Menu, opened by `pin` (`unpin` on a pinned
|
|
12
|
+
// column), its items drawn with `pin-start`, `pin-end`, and `unpin`; a bulk
|
|
13
|
+
// action draws its own `icon`. Its own text — the toolbar's labels and
|
|
12
14
|
// placeholders, the empty state, the clear button, the name of a column's
|
|
13
15
|
// resizer — reads in the
|
|
14
16
|
// visitor's locale, and a date, number, currency, file size or boolean
|
|
@@ -23,7 +25,7 @@ import type { TableColumnsPassthrough } from "@zoobzio/vue/types/components/tabl
|
|
|
23
25
|
import type { TableHeadPassthrough } from "@zoobzio/vue/types/components/table-head";
|
|
24
26
|
|
|
25
27
|
import Core from "@zoobzio/vue/components/table.vue";
|
|
26
|
-
import { columnLabel } from "@zoobzio/vue/utils/table";
|
|
28
|
+
import { columnLabel, pinItems } from "@zoobzio/vue/utils/table";
|
|
27
29
|
|
|
28
30
|
import NuxtLink from "#app/components/nuxt-link";
|
|
29
31
|
import { layer } from "@zoobzio/vue/utils/passthrough";
|
|
@@ -38,6 +40,13 @@ import { icon, iconOf, iconPart } from "./icon";
|
|
|
38
40
|
import { cellSlots } from "./cell";
|
|
39
41
|
import { text, textSlot } from "./text";
|
|
40
42
|
|
|
43
|
+
/** The icon of each item of a column's pin menu. */
|
|
44
|
+
const PIN_ICONS = {
|
|
45
|
+
start: "pin-start",
|
|
46
|
+
end: "pin-end",
|
|
47
|
+
none: "unpin",
|
|
48
|
+
} as const;
|
|
49
|
+
|
|
41
50
|
export default wrap(Core, {
|
|
42
51
|
pt: (pt) => ({
|
|
43
52
|
...pt,
|
|
@@ -56,6 +65,22 @@ export default wrap(Core, {
|
|
|
56
65
|
column: text(columnLabel(column)),
|
|
57
66
|
}),
|
|
58
67
|
}),
|
|
68
|
+
pinMenu: (column) => ({
|
|
69
|
+
as: Menu,
|
|
70
|
+
groups: [
|
|
71
|
+
{
|
|
72
|
+
key: "pin",
|
|
73
|
+
items: pinItems(column, {
|
|
74
|
+
start: text("table.pinStart"),
|
|
75
|
+
end: text("table.pinEnd"),
|
|
76
|
+
none: text("table.unpin"),
|
|
77
|
+
}).map((item) => ({ ...item, icon: PIN_ICONS[item.key] })),
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
}),
|
|
81
|
+
pinTrigger: (column) => ({
|
|
82
|
+
label: text("table.pin", { column: text(columnLabel(column)) }),
|
|
83
|
+
}),
|
|
59
84
|
}),
|
|
60
85
|
body: layer<TableBodyPassthrough<RowData>>(pt?.body, {
|
|
61
86
|
link: () => ({ as: NuxtLink }),
|
|
@@ -74,6 +99,11 @@ export default wrap(Core, {
|
|
|
74
99
|
columns: ({ settings }) => iconPart(settings.trigger, "columns"),
|
|
75
100
|
actions: ({ settings }) => iconPart(settings.actionsTrigger, "actions"),
|
|
76
101
|
dragPrepend: () => [icon("drag")],
|
|
102
|
+
pin: ({ settings, column }) =>
|
|
103
|
+
iconPart(
|
|
104
|
+
{ ...settings.pinTrigger(column), class: "f-data-table-pin" },
|
|
105
|
+
column.getIsPinned() ? "unpin" : "pin",
|
|
106
|
+
),
|
|
77
107
|
headerPrepend: ({ column }) => iconOf(column.columnDef.meta?.icon),
|
|
78
108
|
headerAppend: ({ column }) => {
|
|
79
109
|
const sorted = column.getIsSorted();
|
package/app/constants/views.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const clause = z.discriminatedUnion("kind", [
|
|
4
4
|
z.object({
|
|
5
5
|
kind: z.literal("literal"),
|
|
6
6
|
key: z.string(),
|
|
@@ -14,27 +14,64 @@ const entry = z.discriminatedUnion("kind", [
|
|
|
14
14
|
}),
|
|
15
15
|
]);
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* A stored payload as the schemas read it: one saved while the query's
|
|
19
|
+
* clauses were its `entries` carries them under `clauses`, so a view
|
|
20
|
+
* stored before the rename keeps its search rather than reading as none.
|
|
21
|
+
*/
|
|
22
|
+
const renamed = (payload: unknown): unknown => {
|
|
23
|
+
if (typeof payload !== "object" || payload === null) return payload;
|
|
24
|
+
if (!("entries" in payload) || "clauses" in payload) return payload;
|
|
25
|
+
const { entries, ...rest } = payload;
|
|
26
|
+
return { ...rest, clauses: entries };
|
|
27
|
+
};
|
|
28
|
+
|
|
17
29
|
/**
|
|
18
30
|
* The schema of a table's saved view: what the table's `snapshot` yields
|
|
19
31
|
* and its `restore` takes. Hand it to `createViews` for views over a
|
|
20
32
|
* table. Every member has a default, so a view stored before a member
|
|
21
|
-
* existed still reads; an app with more to save in a view extends
|
|
33
|
+
* existed still reads; an app with more to save in a view extends the
|
|
34
|
+
* object the schema reads into, its `out`.
|
|
22
35
|
*/
|
|
23
|
-
export const TABLE_VIEW_SCHEMA = z.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
export const TABLE_VIEW_SCHEMA = z.preprocess(
|
|
37
|
+
renamed,
|
|
38
|
+
z.object({
|
|
39
|
+
sorting: z
|
|
40
|
+
.array(z.object({ id: z.string(), desc: z.boolean() }))
|
|
41
|
+
.default([]),
|
|
42
|
+
columnOrder: z.array(z.string()).default([]),
|
|
43
|
+
columnPinning: z
|
|
44
|
+
.object({
|
|
45
|
+
start: z.array(z.string()).default([]),
|
|
46
|
+
end: z.array(z.string()).default([]),
|
|
47
|
+
})
|
|
48
|
+
.default({ start: [], end: [] }),
|
|
49
|
+
columnVisibility: z.record(z.string(), z.boolean()).default({}),
|
|
50
|
+
columnSizing: z.record(z.string(), z.number()).default({}),
|
|
51
|
+
pageSize: z.number().int().positive().default(10),
|
|
52
|
+
clauses: z.array(clause).default([]),
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The schema of a calendar's saved view: what the calendar's `snapshot`
|
|
58
|
+
* yields and its `restore` takes. The view alone, and the search: a saved
|
|
59
|
+
* view opens on the day the calendar stands on.
|
|
60
|
+
*/
|
|
61
|
+
export const CALENDAR_VIEW_SCHEMA = z.object({
|
|
62
|
+
view: z.enum(["month", "week", "day", "agenda"]).default("month"),
|
|
63
|
+
clauses: z.array(clause).default([]),
|
|
30
64
|
});
|
|
31
65
|
|
|
32
66
|
/**
|
|
33
67
|
* The schema of a browser's saved view: what the browser's `snapshot`
|
|
34
68
|
* yields and its `restore` takes.
|
|
35
69
|
*/
|
|
36
|
-
export const BROWSER_VIEW_SCHEMA = z.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
70
|
+
export const BROWSER_VIEW_SCHEMA = z.preprocess(
|
|
71
|
+
renamed,
|
|
72
|
+
z.object({
|
|
73
|
+
sortField: z.string().nullable().default(null),
|
|
74
|
+
sortDirection: z.enum(["asc", "desc"]).default("asc"),
|
|
75
|
+
clauses: z.array(clause).default([]),
|
|
76
|
+
}),
|
|
77
|
+
);
|
|
@@ -3,7 +3,9 @@ import type { Actions, Config, Service } from "@zoobzio/calendar";
|
|
|
3
3
|
|
|
4
4
|
import { useNuxtApp } from "#app";
|
|
5
5
|
import { CalendarService } from "@zoobzio/calendar";
|
|
6
|
+
import { QUERY_TEXT_KEY, QUERY_TEXT_LITERAL } from "@zoobzio/query";
|
|
6
7
|
import { accessCalendar } from "../stores/calendar";
|
|
8
|
+
import { resolveTexts } from "../utils/text";
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Builds the id-scoped composable of a calendar. Call it at module scope:
|
|
@@ -11,9 +13,15 @@ import { accessCalendar } from "../stores/calendar";
|
|
|
11
13
|
* reader, the writer, the fetch, the save), and `id` keys everything that
|
|
12
14
|
* follows. Each call of the composable, in setup, builds a service over
|
|
13
15
|
* the id's shared store and relays its domain events onto the app logger
|
|
14
|
-
* and the Nuxt hook bus under the `calendar:` prefix.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* and the Nuxt hook bus under the `calendar:` prefix. Every text of the
|
|
17
|
+
* config, the labels of the query's fields and literals, resolves through
|
|
18
|
+
* the app's prosary service as the service is built, so a label that is a
|
|
19
|
+
* key of the app's contract reaches the machine, and the search that
|
|
20
|
+
* matches a typed prefix against it, as the visitor reads it. A config
|
|
21
|
+
* that searches and names no literals takes the query's text literal
|
|
22
|
+
* under the contract's `calendar.text`. The machine itself is
|
|
23
|
+
* `@zoobzio/calendar`; the Vue calendar renders it through its `service`
|
|
24
|
+
* prop.
|
|
17
25
|
*/
|
|
18
26
|
export const createCalendar = <I, O>(
|
|
19
27
|
id: string,
|
|
@@ -21,12 +29,24 @@ export const createCalendar = <I, O>(
|
|
|
21
29
|
): UseCalendar<I, O> => {
|
|
22
30
|
const { read, write, fetch, save, now, uid, initial, ...config } = options;
|
|
23
31
|
const wiring: Actions<I, O> = { read, write, fetch, save, now, uid };
|
|
24
|
-
|
|
32
|
+
// A calendar that names neither fields nor literals renders no search,
|
|
33
|
+
// and naming the literal here would say it does.
|
|
34
|
+
const searches = config.searchable ?? config.fields !== undefined;
|
|
35
|
+
const settings: Config = {
|
|
36
|
+
...config,
|
|
37
|
+
...(searches &&
|
|
38
|
+
config.literals === undefined && {
|
|
39
|
+
literals: {
|
|
40
|
+
[QUERY_TEXT_KEY]: { ...QUERY_TEXT_LITERAL, label: "calendar.text" },
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
25
44
|
return (): Service<I, O> => {
|
|
26
45
|
const nuxt = useNuxtApp();
|
|
27
46
|
const log = nuxt.$logger(id);
|
|
28
|
-
const
|
|
29
|
-
const
|
|
47
|
+
const resolved = resolveTexts(nuxt.$prosary, settings);
|
|
48
|
+
const state = accessCalendar(id, resolved, initial);
|
|
49
|
+
const service = new CalendarService<I, O>(id, resolved, state, wiring);
|
|
30
50
|
service.on("navigated", (event) => {
|
|
31
51
|
log.debug("Calendar navigated", event);
|
|
32
52
|
nuxt.callHook("calendar:navigated", event);
|
|
@@ -43,6 +63,14 @@ export const createCalendar = <I, O>(
|
|
|
43
63
|
log.debug("Calendar selected", event);
|
|
44
64
|
nuxt.callHook("calendar:selected", event);
|
|
45
65
|
});
|
|
66
|
+
service.on("filtered", (event) => {
|
|
67
|
+
log.debug("Calendar filtered", event);
|
|
68
|
+
nuxt.callHook("calendar:filtered", event);
|
|
69
|
+
});
|
|
70
|
+
service.on("restored", (event) => {
|
|
71
|
+
log.debug("Calendar restored", event);
|
|
72
|
+
nuxt.callHook("calendar:restored", event);
|
|
73
|
+
});
|
|
46
74
|
return service;
|
|
47
75
|
};
|
|
48
76
|
};
|
package/app/stores/table.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { createTableState } from "@zoobzio/table";
|
|
|
8
8
|
* keyed `table-<id>`. Its value is a reactive proxy, so the service's field
|
|
9
9
|
* writes are tracked; instances sharing an id share the container across
|
|
10
10
|
* the app, and it survives SSR hydration. `config` shapes the record once,
|
|
11
|
-
* when it is first created, its `initialState` and `
|
|
11
|
+
* when it is first created, its `initialState` and `initialClauses`
|
|
12
12
|
* included; later calls under the same id get the record as it stands.
|
|
13
13
|
*/
|
|
14
14
|
export const accessTable = <T extends RowData>(
|
package/app/types/browser.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type BrowserBulkAction = Bound<ActionDescriptor, BulkAction["action"]>;
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* The slice of the state container a browser may start from: the trail,
|
|
36
|
-
* the file sort, the selection, and the search's
|
|
36
|
+
* the file sort, the selection, and the search's clauses the consumer
|
|
37
37
|
* chooses, never what a fetch fills in. It seeds the `useState` record, so it must survive Nuxt's
|
|
38
38
|
* payload (devalue carries the `Set`).
|
|
39
39
|
*/
|
|
@@ -45,7 +45,7 @@ export type BrowserInitial<T> = Partial<
|
|
|
45
45
|
| "sortDirection"
|
|
46
46
|
| "selected"
|
|
47
47
|
| "selectedFolders"
|
|
48
|
-
| "
|
|
48
|
+
| "clauses"
|
|
49
49
|
>
|
|
50
50
|
>;
|
|
51
51
|
|
package/app/types/calendar.ts
CHANGED
|
@@ -28,8 +28,8 @@ export type CalendarOptions<I, O> = Config &
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* The Nuxt hooks a calendar relays: `calendar:navigated`,
|
|
31
|
-
* `calendar:loaded`, `calendar:changed`,
|
|
32
|
-
* carrying the service's payload with its scoping `id`.
|
|
31
|
+
* `calendar:loaded`, `calendar:changed`, `calendar:selected`,
|
|
32
|
+
* `calendar:filtered`, and `calendar:restored`, each carrying the service's payload with its scoping `id`.
|
|
33
33
|
*/
|
|
34
34
|
export type CalendarHooks = Hooks<"calendar", Events<unknown>>;
|
|
35
35
|
|
package/app/types/table.ts
CHANGED
|
@@ -30,7 +30,7 @@ export type TableBulkAction = Bound<ActionDescriptor, BulkAction["action"]>;
|
|
|
30
30
|
/**
|
|
31
31
|
* What `createTable` takes: the headless config with each action's handler
|
|
32
32
|
* joined to its descriptor, and the fetch mechanism. The config's
|
|
33
|
-
* `initialState` and `
|
|
33
|
+
* `initialState` and `initialClauses` are what the table starts from: they
|
|
34
34
|
* seed the `useState` record, so they must survive Nuxt's payload.
|
|
35
35
|
*/
|
|
36
36
|
export type TableOptions<T extends RowData> = Omit<
|
package/app/types/views.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Hooks } from "./hooks";
|
|
2
2
|
import type {
|
|
3
3
|
BROWSER_VIEW_SCHEMA,
|
|
4
|
+
CALENDAR_VIEW_SCHEMA,
|
|
4
5
|
TABLE_VIEW_SCHEMA,
|
|
5
6
|
} from "../constants/views";
|
|
6
7
|
import type { Actions, Config, Events, Service } from "@zoobzio/views";
|
|
@@ -18,9 +19,16 @@ export type TableView = z.output<typeof TABLE_VIEW_SCHEMA>;
|
|
|
18
19
|
*/
|
|
19
20
|
export type BrowserView = z.output<typeof BROWSER_VIEW_SCHEMA>;
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* The payload of a calendar's saved view, as `CALENDAR_VIEW_SCHEMA` yields
|
|
24
|
+
* it: the calendar's `Snapshot`.
|
|
25
|
+
*/
|
|
26
|
+
export type CalendarView = z.output<typeof CALENDAR_VIEW_SCHEMA>;
|
|
27
|
+
|
|
21
28
|
/**
|
|
22
29
|
* What views are over: anything that yields its arrangement and takes one
|
|
23
|
-
* back. A table service
|
|
30
|
+
* back. A table service, a browser service, and a calendar service are
|
|
31
|
+
* each one. `snapshot`
|
|
24
32
|
* must read reactive state for the drift to show.
|
|
25
33
|
*/
|
|
26
34
|
export type ViewsTarget<P> = {
|
|
@@ -165,7 +165,11 @@ export const LAYER = {
|
|
|
165
165
|
],
|
|
166
166
|
"constants/log": ["LOG_ROOT_NAME", "LOG_LEVELS"],
|
|
167
167
|
"constants/table": ["TABLE_SEARCH_KEY"],
|
|
168
|
-
"constants/views": [
|
|
168
|
+
"constants/views": [
|
|
169
|
+
"TABLE_VIEW_SCHEMA",
|
|
170
|
+
"BROWSER_VIEW_SCHEMA",
|
|
171
|
+
"CALENDAR_VIEW_SCHEMA",
|
|
172
|
+
],
|
|
169
173
|
"factories/browser": ["createBrowser"],
|
|
170
174
|
"factories/calendar": ["createCalendar"],
|
|
171
175
|
"factories/code": ["createCode"],
|
|
@@ -235,6 +239,7 @@ export const LAYER_TYPES = {
|
|
|
235
239
|
"types/views": [
|
|
236
240
|
"TableView",
|
|
237
241
|
"BrowserView",
|
|
242
|
+
"CalendarView",
|
|
238
243
|
"ViewsTarget",
|
|
239
244
|
"ViewsOptions",
|
|
240
245
|
"ViewsHooks",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoobzio/nuxt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
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": {
|
|
@@ -47,19 +47,19 @@
|
|
|
47
47
|
"prosary": "0.0.11",
|
|
48
48
|
"reka-ui": "^2.6.0",
|
|
49
49
|
"untheme": "^0.6.1",
|
|
50
|
-
"@zoobzio/
|
|
51
|
-
"@zoobzio/
|
|
52
|
-
"@zoobzio/
|
|
53
|
-
"@zoobzio/
|
|
54
|
-
"@zoobzio/
|
|
55
|
-
"@zoobzio/
|
|
56
|
-
"@zoobzio/
|
|
57
|
-
"@zoobzio/
|
|
58
|
-
"@zoobzio/
|
|
59
|
-
"@zoobzio/
|
|
60
|
-
"@zoobzio/
|
|
61
|
-
"@zoobzio/
|
|
62
|
-
"@zoobzio/
|
|
50
|
+
"@zoobzio/calendar": "0.1.12",
|
|
51
|
+
"@zoobzio/code": "0.1.12",
|
|
52
|
+
"@zoobzio/browser": "0.1.12",
|
|
53
|
+
"@zoobzio/form": "0.1.12",
|
|
54
|
+
"@zoobzio/editor": "0.1.12",
|
|
55
|
+
"@zoobzio/icons": "0.1.12",
|
|
56
|
+
"@zoobzio/kit": "0.1.12",
|
|
57
|
+
"@zoobzio/prose": "0.1.12",
|
|
58
|
+
"@zoobzio/query": "0.1.12",
|
|
59
|
+
"@zoobzio/table": "0.1.12",
|
|
60
|
+
"@zoobzio/theme": "0.1.12",
|
|
61
|
+
"@zoobzio/views": "0.1.12",
|
|
62
|
+
"@zoobzio/vue": "0.1.12"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@codemirror/state": "^6.7.6",
|