@zoobzio/nuxt 0.0.10 → 0.0.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/README.md +119 -22
- package/app/app.d.ts +51 -0
- package/app/components/accordion.ts +13 -0
- package/app/components/breadcrumb.ts +12 -0
- package/app/components/browser.ts +41 -0
- package/app/components/calendar.ts +13 -0
- package/app/components/checkbox.ts +9 -0
- package/app/components/command.ts +20 -0
- package/app/components/date-filters.ts +22 -0
- package/app/components/date-picker.ts +14 -0
- package/app/components/date-range-picker.ts +14 -0
- package/app/components/directory.ts +12 -0
- package/app/components/editor.ts +11 -0
- package/app/components/facets.ts +13 -0
- package/app/components/file-input.ts +10 -0
- package/app/components/form-field.ts +25 -0
- package/app/components/form.ts +10 -0
- package/app/components/hero.ts +9 -0
- package/app/components/icon.ts +36 -0
- package/app/components/keywords.ts +20 -0
- package/app/components/menu.ts +17 -0
- package/app/components/multi-select.ts +12 -0
- package/app/components/pagination.ts +18 -0
- package/app/components/range-calendar.ts +13 -0
- package/app/components/rich-text.ts +11 -0
- package/app/components/scroller.ts +9 -0
- package/app/components/segmented-control.ts +12 -0
- package/app/components/select.ts +9 -0
- package/app/components/table.ts +50 -0
- package/app/components/tabs.ts +12 -0
- package/app/components/tags-input.ts +9 -0
- package/app/components/toast.ts +9 -0
- package/app/components/tree.ts +14 -0
- package/app/constants/editor.ts +23 -0
- package/app/types/icon.ts +10 -0
- package/app/utils/editor.ts +10 -0
- package/modules/imports/constant.ts +41 -6
- package/modules/imports/index.ts +1 -1
- package/nuxt.config.ts +11 -0
- package/package.json +9 -7
- package/app/components/breadcrumb.vue +0 -65
- package/app/components/browser.vue +0 -79
- package/app/components/directory.vue +0 -65
- package/app/components/hero.vue +0 -59
- package/app/components/menu.vue +0 -64
- package/app/components/segmented-control.vue +0 -67
- package/app/components/table.vue +0 -68
- package/app/components/tabs.vue +0 -63
- package/app/components/tree.vue +0 -67
package/README.md
CHANGED
|
@@ -21,14 +21,17 @@ behind Nuxt's two virtual modules stay live, filled only by
|
|
|
21
21
|
|
|
22
22
|
- `#components` carries the components of `@zoobzio/vue`. The ones that
|
|
23
23
|
hold links come as the layer's own wrappers, which render every link
|
|
24
|
-
through `NuxtLink` (see [Components](#components)).
|
|
24
|
+
through `NuxtLink` (see [Components](#components)). It also carries
|
|
25
|
+
`Icon`, from `@icon-sheets/nuxt` (see [Icons](#icons)).
|
|
25
26
|
- `#imports` carries the `define*` constructors of `@zoobzio/vue` and the
|
|
26
27
|
layer's own surface: the composables, factories, stores, and constants
|
|
27
28
|
as values, and everything under `types/` as types. It also carries the
|
|
28
29
|
types of `@zoobzio/vue` a consumer writes against: the component
|
|
29
|
-
contracts (`SelectProps`, `TableSlots`,
|
|
30
|
-
|
|
31
|
-
(`Definition`, `PT`, …).
|
|
30
|
+
contracts (`SelectProps`, `TableSlots`, …), the shared item types
|
|
31
|
+
(`Option`, `Link`, …), and the `define*` and `pt` vocabulary
|
|
32
|
+
(`Definition`, `PT`, …). Where the layer widens a vue item type, as
|
|
33
|
+
`MenuItem` with its `icon`, `#imports` serves the layer's under the
|
|
34
|
+
vue name.
|
|
32
35
|
|
|
33
36
|
A consumer never depends on `@zoobzio/vue` itself. The package's
|
|
34
37
|
composables are not registered, nor are the types behind them (`forward`,
|
|
@@ -54,18 +57,22 @@ import { createTable } from "@zoobzio/nuxt/factories/table";
|
|
|
54
57
|
## Components
|
|
55
58
|
|
|
56
59
|
The components of `@zoobzio/vue` render links through a `link` passthrough
|
|
57
|
-
part whose recipe is a plain anchor
|
|
58
|
-
holds
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
part whose recipe is a plain anchor, and leave their icons to slots. The
|
|
61
|
+
layer wraps each component that holds a `link` part, draws an icon, or
|
|
62
|
+
renders another wrapped component through a part (thirty of them, listed
|
|
63
|
+
in `WRAPPED` of `modules/imports/constant.ts`) in `app/components/`. A
|
|
64
|
+
wrapper lays `NuxtLink` under the `link` part, so navigation goes through
|
|
65
|
+
the router with no setup, and fills the icon slots from the contract (see
|
|
66
|
+
[Icons](#icons)). `#components` serves the wrapper under the vue
|
|
62
67
|
component's name; the vue component itself is not registered.
|
|
63
68
|
|
|
64
|
-
A wrapper is
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
`
|
|
69
|
+
A wrapper is one call to `wrap` of `@zoobzio/vue`: the vue component, a
|
|
70
|
+
`pt` layer, and the slot defaults of [Icons](#icons). It is typed as the
|
|
71
|
+
vue component itself, so it is the same contract (props, emits, slots,
|
|
72
|
+
and `ctx`) the `@zoobzio/vue` types on `#imports` describe. A consumer's
|
|
73
|
+
`pt.link` composes with the layer's, so an override keeps `NuxtLink`
|
|
74
|
+
unless it sets `as` itself. A disabled item has no `href`, and `NuxtLink`
|
|
75
|
+
renders it as an inert anchor.
|
|
69
76
|
|
|
70
77
|
```vue
|
|
71
78
|
<script setup lang="ts">
|
|
@@ -84,9 +91,98 @@ const items: BreadcrumbItem[] = [
|
|
|
84
91
|
</template>
|
|
85
92
|
```
|
|
86
93
|
|
|
87
|
-
`Table` and `Browser` lay the part under their nested manifests (`pt.body
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
`Table` and `Browser` lay the part under their nested manifests (`pt.body`
|
|
95
|
+
and `pt.files`), so a consumer's part at the same path composes the same
|
|
96
|
+
way. Where a vue component renders another of its own as a part, the
|
|
97
|
+
wrapper names the layer's wrapped component through the part's `as`, so
|
|
98
|
+
nested components navigate through `NuxtLink` and draw their icons
|
|
99
|
+
without the consumer reaching in: the table's row actions and the
|
|
100
|
+
browser's file and folder actions render through the layer's `Menu`, the
|
|
101
|
+
browser's trail through its `Breadcrumb`, the table's pagination, column
|
|
102
|
+
manager command, and checkboxes through its `Pagination`, `Command`, and
|
|
103
|
+
`Checkbox`, a form's fields through its `FormField` and that field's
|
|
104
|
+
controls through its `Select`, `MultiSelect`, `Checkbox`, `DatePicker`,
|
|
105
|
+
`TagsInput`, `FileInput`, and `RichText`, and the facets', keywords', and
|
|
106
|
+
date filters' popover contents through its `Command`, `TagsInput`,
|
|
107
|
+
`SegmentedControl`, `Calendar`, and `RangeCalendar`.
|
|
108
|
+
|
|
109
|
+
## Icons
|
|
110
|
+
|
|
111
|
+
The components of `@zoobzio/vue` draw no icons. Where one belongs beside
|
|
112
|
+
content, the component has a `prepend` and an `append` slot around it
|
|
113
|
+
(`itemPrepend`, `triggerAppend`, `prevPrepend`, …), so an icon can lead,
|
|
114
|
+
trail, or both; where a button is one item (a `Fab`), the component has
|
|
115
|
+
one slot that replaces it (`refresh`, `actions`, `first`, …). The layer
|
|
116
|
+
loads
|
|
117
|
+
[`@icon-sheets/nuxt`](https://github.com/zoobzio/icon-sheets) with the
|
|
118
|
+
foundation contract from [`@zoobzio/icons`](../../packages/icons/) as its
|
|
119
|
+
default `iconSheets` option, so an app that extends the layer gets the
|
|
120
|
+
sprite inlined on every page and `<Icon name="…" />` on `#components`
|
|
121
|
+
with no setup. `IconAlias` on `#imports` is the alias union the app
|
|
122
|
+
compiles against.
|
|
123
|
+
|
|
124
|
+
An app with its own icons package passes it the usual way, and Nuxt
|
|
125
|
+
merges it over the layer's: the app's aliases join the foundation's, and
|
|
126
|
+
an alias the app declares again is rebound. See the icons package for the
|
|
127
|
+
contract and the merge.
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
export default defineNuxtConfig({
|
|
131
|
+
extends: ["@zoobzio/nuxt"],
|
|
132
|
+
iconSheets: { ...config, sets, prefix },
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
A wrapper fills those slots from the contract by default through the
|
|
137
|
+
`slots` option of `wrap`: the consumer's slot wins whenever it renders
|
|
138
|
+
one, and the wrapper's default fills in while it does not. A fixed role
|
|
139
|
+
draws its alias: `expand` after a select's, multi select's, or
|
|
140
|
+
accordion's trigger and as a tree branch's toggle; `prev` and `next` on
|
|
141
|
+
the calendars and pickers and `calendar` on a picker's trigger; `search`
|
|
142
|
+
before a command's filter; `remove` on a tag's and a file's remove
|
|
143
|
+
button; `close` on a toast's; `top` on a scroller's back-to-top; `check`
|
|
144
|
+
in a checkbox; the editor's and rich text's tools by key (`bold`,
|
|
145
|
+
`heading`, `bullet-list`, `undo`, …, see `EDITOR_TOOL_ICONS`); and on
|
|
146
|
+
the table and browser, `refresh`, `columns`, `actions`, `drag`,
|
|
147
|
+
`sort-asc` or `sort-desc` after a sorted header, `folder` before a
|
|
148
|
+
folder, and the pagination's `first`, `prev`, `next`, and `last`. A slot
|
|
149
|
+
that replaces a Fab renders the part with the icon as its content, so the
|
|
150
|
+
label stays the button's `aria-label` and the visible text goes. The
|
|
151
|
+
facets', keywords', and date filters' triggers draw `filter`, `keywords`,
|
|
152
|
+
and `calendar` that way.
|
|
153
|
+
|
|
154
|
+
An item draws its own `icon`. The vue item types (`Option`, which the
|
|
155
|
+
tabs, segmented control, accordion, select, and command options extend,
|
|
156
|
+
plus `MenuItem`, `BreadcrumbItem`, `DirectoryItem`, and `FacetItem`) and
|
|
157
|
+
the action descriptors of `@zoobzio/table` and `@zoobzio/browser` are
|
|
158
|
+
interfaces, and `app/app.d.ts` widens each with an optional
|
|
159
|
+
`icon: IconAlias` by declaration merging, so the one type the package,
|
|
160
|
+
the layer, and the app share carries the field, and the wrapper draws it
|
|
161
|
+
in the item's `prepend` slot. A row, file, folder, or bulk action given to
|
|
162
|
+
`createTable` or `createBrowser` with an `icon` draws it the same way,
|
|
163
|
+
since the layer's `Menu` renders those actions.
|
|
164
|
+
|
|
165
|
+
```vue
|
|
166
|
+
<script setup lang="ts">
|
|
167
|
+
import { Menu } from "#components";
|
|
168
|
+
import type { MenuGroup } from "#imports";
|
|
169
|
+
|
|
170
|
+
const groups: MenuGroup[] = [
|
|
171
|
+
{
|
|
172
|
+
key: "account",
|
|
173
|
+
items: [
|
|
174
|
+
{ label: "Profile", link: { to: "/profile" }, icon: "next" },
|
|
175
|
+
{ label: "Sign out", icon: "close" },
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
];
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<template>
|
|
182
|
+
<!-- each item renders <Icon :name="item.icon" /> before its label -->
|
|
183
|
+
<Menu label="Account" :groups="groups" />
|
|
184
|
+
</template>
|
|
185
|
+
```
|
|
90
186
|
|
|
91
187
|
## Stores and factories
|
|
92
188
|
|
|
@@ -271,17 +367,18 @@ variant.
|
|
|
271
367
|
```
|
|
272
368
|
app/
|
|
273
369
|
app.vue — the root: reka providers, loading indicator, error boundary, toaster
|
|
370
|
+
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
|
|
274
371
|
error.vue — the error page
|
|
275
|
-
app.d.ts — RuntimeNuxtHooks augmentation for the relayed events
|
|
372
|
+
app.d.ts — RuntimeNuxtHooks augmentation for the relayed events; the vue item types and the headless action descriptors widened with `icon`
|
|
373
|
+
constants/ — error page status codes, log levels, the editor tools' icons
|
|
276
374
|
assets/css/ — reset.css, loaded by the layer config
|
|
277
375
|
composables/ — useAppError, useHooks, useLogger, useNotifications, useRequest, useLazyRequest
|
|
278
|
-
constants/ — error page status codes, log levels
|
|
279
376
|
factories/ — create<Name>(id, options) → use<Name>(): Service
|
|
280
377
|
plugins/ — log: provides $log and $logger
|
|
281
378
|
stores/ — access<Name>(id, …) → the id's shared state container; accessLogs, accessNotifications
|
|
282
|
-
types/ — per-feature options, initial state, and hook maps; hook, log, notification, error, request
|
|
283
|
-
utils/ — split (actions → descriptors + handlers), seed (state)
|
|
379
|
+
types/ — per-feature options, initial state, and hook maps; hook, log, notification, error, request; icon (IconAlias)
|
|
380
|
+
utils/ — split (actions → descriptors + handlers), seed (state), editor (a tool's icon by key)
|
|
284
381
|
modules/ — local Nuxt modules: imports/ fills #components and #imports (the @zoobzio/vue components, definitions, and types, and the layer's own surface) and references app.d.ts for consumers
|
|
285
382
|
tests/ — vitest + happy-dom, mirroring app/ path-for-path
|
|
286
|
-
nuxt.config.ts — layer config (no implicit imports, no component scanning or tag resolution; loads the reset)
|
|
383
|
+
nuxt.config.ts — layer config (no implicit imports, no component scanning or tag resolution; loads the reset and @icon-sheets/nuxt with the foundation contract)
|
|
287
384
|
```
|
package/app/app.d.ts
CHANGED
|
@@ -3,8 +3,59 @@ import type { CodeHooks } from "./types/code";
|
|
|
3
3
|
import type { EditorHooks } from "./types/editor";
|
|
4
4
|
import type { FormHooks } from "./types/form";
|
|
5
5
|
import type { Logger } from "./types/log";
|
|
6
|
+
import type { IconAlias } from "./types/icon";
|
|
6
7
|
import type { TableHooks } from "./types/table";
|
|
7
8
|
|
|
9
|
+
// The item types of @zoobzio/vue and the action descriptors of the headless
|
|
10
|
+
// packages are interfaces, so the layer widens the ones its wrappers draw
|
|
11
|
+
// icons for by declaration merging: the field joins the one type the
|
|
12
|
+
// package, the layer, and the app all share, and the wrapper's slot default
|
|
13
|
+
// reads it with the scope the component passes. A row, file, folder, or
|
|
14
|
+
// bulk action extends its descriptor, so an `icon` set in `createTable` or
|
|
15
|
+
// `createBrowser` reaches the service's live action and the menu item
|
|
16
|
+
// built from it.
|
|
17
|
+
declare module "@zoobzio/vue/types/common" {
|
|
18
|
+
interface Option {
|
|
19
|
+
icon?: IconAlias;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare module "@zoobzio/vue/types/components/menu" {
|
|
24
|
+
interface MenuItem {
|
|
25
|
+
icon?: IconAlias;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module "@zoobzio/vue/types/components/breadcrumb" {
|
|
30
|
+
interface BreadcrumbItem {
|
|
31
|
+
icon?: IconAlias;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare module "@zoobzio/vue/types/components/directory" {
|
|
36
|
+
interface DirectoryItem {
|
|
37
|
+
icon?: IconAlias;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare module "@zoobzio/vue/types/components/facets" {
|
|
42
|
+
interface FacetItem {
|
|
43
|
+
icon?: IconAlias;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare module "@zoobzio/table" {
|
|
48
|
+
interface ActionDescriptor {
|
|
49
|
+
icon?: IconAlias;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare module "@zoobzio/browser" {
|
|
54
|
+
interface ActionDescriptor {
|
|
55
|
+
icon?: IconAlias;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
8
59
|
declare module "#app" {
|
|
9
60
|
interface NuxtApp {
|
|
10
61
|
$log: Logger;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The vue accordion with an item's `icon` before its label and the
|
|
2
|
+
// `expand` icon after it.
|
|
3
|
+
import Core from "@zoobzio/vue/components/accordion.vue";
|
|
4
|
+
|
|
5
|
+
import { icon, iconOf } from "./icon";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
|
|
8
|
+
export default wrap(Core, {
|
|
9
|
+
slots: {
|
|
10
|
+
triggerPrepend: ({ item }) => iconOf(item.icon),
|
|
11
|
+
triggerAppend: () => [icon("expand")],
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The vue breadcrumb with NuxtLink under its `link` part and an item's
|
|
2
|
+
// `icon` drawn before its label.
|
|
3
|
+
import Core from "@zoobzio/vue/components/breadcrumb.vue";
|
|
4
|
+
|
|
5
|
+
import NuxtLink from "#app/components/nuxt-link";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
import { iconOf } from "./icon";
|
|
8
|
+
|
|
9
|
+
export default wrap(Core, {
|
|
10
|
+
pt: { link: () => ({ as: NuxtLink }) },
|
|
11
|
+
slots: { itemPrepend: ({ item }) => iconOf(item.icon) },
|
|
12
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// The vue browser with the layer's parts behind its own: the layer's
|
|
2
|
+
// Breadcrumb for the trail, the layer's Menu for file and folder actions
|
|
3
|
+
// (so an action's `icon` draws), the layer's Checkbox for the file
|
|
4
|
+
// checkboxes, and NuxtLink under the `link` part of its files. Its Fab
|
|
5
|
+
// slots draw the `refresh` and `actions` icons; a folder draws `folder`
|
|
6
|
+
// before its name; a bulk action draws its own `icon`.
|
|
7
|
+
import type { BrowserFilesPassthrough } from "@zoobzio/vue/types/components/browser-files";
|
|
8
|
+
import type { BrowserFoldersPassthrough } from "@zoobzio/vue/types/components/browser-folders";
|
|
9
|
+
|
|
10
|
+
import Core from "@zoobzio/vue/components/browser.vue";
|
|
11
|
+
|
|
12
|
+
import NuxtLink from "#app/components/nuxt-link";
|
|
13
|
+
import { layer } from "@zoobzio/vue/utils/passthrough";
|
|
14
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
15
|
+
import Breadcrumb from "./breadcrumb";
|
|
16
|
+
import Checkbox from "./checkbox";
|
|
17
|
+
import Menu from "./menu";
|
|
18
|
+
import { icon, iconOf, iconPart } from "./icon";
|
|
19
|
+
|
|
20
|
+
export default wrap(Core, {
|
|
21
|
+
pt: (pt) => ({
|
|
22
|
+
...pt,
|
|
23
|
+
breadcrumb: { as: Breadcrumb, ...pt?.breadcrumb },
|
|
24
|
+
files: layer<BrowserFilesPassthrough<unknown>>(pt?.files, {
|
|
25
|
+
link: () => ({ as: NuxtLink }),
|
|
26
|
+
rowCheckbox: { as: Checkbox },
|
|
27
|
+
actionsMenu: { as: Menu },
|
|
28
|
+
}),
|
|
29
|
+
folders: layer<BrowserFoldersPassthrough>(pt?.folders, {
|
|
30
|
+
actionsMenu: { as: Menu },
|
|
31
|
+
}),
|
|
32
|
+
}),
|
|
33
|
+
slots: {
|
|
34
|
+
refresh: ({ settings }) => iconPart(settings.refresh, "refresh"),
|
|
35
|
+
actions: ({ settings }) => iconPart(settings.actionsTrigger, "actions"),
|
|
36
|
+
folderActions: ({ settings }) =>
|
|
37
|
+
iconPart(settings.actionsTrigger, "actions"),
|
|
38
|
+
folderPrepend: () => [icon("folder")],
|
|
39
|
+
bulkActionPrepend: ({ action }) => iconOf(action.icon),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The vue calendar with the `prev` and `next` icons before its month
|
|
2
|
+
// controls.
|
|
3
|
+
import Core from "@zoobzio/vue/components/calendar.vue";
|
|
4
|
+
|
|
5
|
+
import { icon } from "./icon";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
|
|
8
|
+
export default wrap(Core, {
|
|
9
|
+
slots: {
|
|
10
|
+
prevPrepend: () => [icon("prev")],
|
|
11
|
+
nextPrepend: () => [icon("next")],
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The vue checkbox with the `check` icon as its indicator.
|
|
2
|
+
import Core from "@zoobzio/vue/components/checkbox.vue";
|
|
3
|
+
|
|
4
|
+
import { icon } from "./icon";
|
|
5
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
6
|
+
|
|
7
|
+
export default wrap(Core, {
|
|
8
|
+
slots: { icon: () => [icon("check")] },
|
|
9
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The vue command with the `search` icon before its filter, an item's
|
|
2
|
+
// `icon` before its label, the layer's Checkbox rendering each item's
|
|
3
|
+
// checkbox, and the layer's Scroller as its viewport.
|
|
4
|
+
import Core from "@zoobzio/vue/components/command.vue";
|
|
5
|
+
|
|
6
|
+
import { icon, iconOf } from "./icon";
|
|
7
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
8
|
+
import Checkbox from "./checkbox";
|
|
9
|
+
import Scroller from "./scroller";
|
|
10
|
+
|
|
11
|
+
export default wrap(Core, {
|
|
12
|
+
pt: {
|
|
13
|
+
viewport: { as: Scroller },
|
|
14
|
+
itemCheckbox: () => ({ as: Checkbox }),
|
|
15
|
+
},
|
|
16
|
+
slots: {
|
|
17
|
+
inputPrepend: () => [icon("search")],
|
|
18
|
+
itemPrepend: ({ item }) => iconOf(item.icon),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// The vue date filters with the `calendar` icon as the content of its
|
|
2
|
+
// trigger, the layer's Command behind its field and operator steps, and
|
|
3
|
+
// the layer's Calendar and RangeCalendar behind its date steps.
|
|
4
|
+
import Core from "@zoobzio/vue/components/date-filters.vue";
|
|
5
|
+
|
|
6
|
+
import { iconPart } from "./icon";
|
|
7
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
8
|
+
import Calendar from "./calendar";
|
|
9
|
+
import Command from "./command";
|
|
10
|
+
import RangeCalendar from "./range-calendar";
|
|
11
|
+
|
|
12
|
+
export default wrap(Core, {
|
|
13
|
+
pt: {
|
|
14
|
+
fieldCommand: { as: Command },
|
|
15
|
+
operatorCommand: { as: Command },
|
|
16
|
+
calendar: { as: Calendar },
|
|
17
|
+
rangeCalendar: { as: RangeCalendar },
|
|
18
|
+
},
|
|
19
|
+
slots: {
|
|
20
|
+
trigger: ({ settings }) => iconPart(settings.trigger, "calendar"),
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The vue date picker with the `calendar` icon before its trigger label and
|
|
2
|
+
// the `prev` and `next` icons before its month controls.
|
|
3
|
+
import Core from "@zoobzio/vue/components/date-picker.vue";
|
|
4
|
+
|
|
5
|
+
import { icon } from "./icon";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
|
|
8
|
+
export default wrap(Core, {
|
|
9
|
+
slots: {
|
|
10
|
+
triggerPrepend: () => [icon("calendar")],
|
|
11
|
+
prevPrepend: () => [icon("prev")],
|
|
12
|
+
nextPrepend: () => [icon("next")],
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The vue date range picker with the `calendar` icon before its trigger
|
|
2
|
+
// label and the `prev` and `next` icons before its month controls.
|
|
3
|
+
import Core from "@zoobzio/vue/components/date-range-picker.vue";
|
|
4
|
+
|
|
5
|
+
import { icon } from "./icon";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
|
|
8
|
+
export default wrap(Core, {
|
|
9
|
+
slots: {
|
|
10
|
+
triggerPrepend: () => [icon("calendar")],
|
|
11
|
+
prevPrepend: () => [icon("prev")],
|
|
12
|
+
nextPrepend: () => [icon("next")],
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The vue directory with NuxtLink under its `link` part and an item's
|
|
2
|
+
// `icon` drawn before its label.
|
|
3
|
+
import Core from "@zoobzio/vue/components/directory.vue";
|
|
4
|
+
|
|
5
|
+
import NuxtLink from "#app/components/nuxt-link";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
import { iconOf } from "./icon";
|
|
8
|
+
|
|
9
|
+
export default wrap(Core, {
|
|
10
|
+
pt: { link: () => ({ as: NuxtLink }) },
|
|
11
|
+
slots: { itemPrepend: ({ item }) => iconOf(item.icon) },
|
|
12
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// The vue editor with each tool's icon (`toolIcon`, by the tool's
|
|
2
|
+
// key) before its label.
|
|
3
|
+
import Core from "@zoobzio/vue/components/editor.vue";
|
|
4
|
+
|
|
5
|
+
import { iconOf } from "./icon";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
import { toolIcon } from "../utils/editor";
|
|
8
|
+
|
|
9
|
+
export default wrap(Core, {
|
|
10
|
+
slots: { toolPrepend: ({ tool }) => iconOf(toolIcon(tool.key)) },
|
|
11
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The vue facets with the `filter` icon as the content of its trigger and
|
|
2
|
+
// the layer's Command behind it, so a facet's `icon` draws before its
|
|
3
|
+
// label.
|
|
4
|
+
import Core from "@zoobzio/vue/components/facets.vue";
|
|
5
|
+
|
|
6
|
+
import { iconPart } from "./icon";
|
|
7
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
8
|
+
import Command from "./command";
|
|
9
|
+
|
|
10
|
+
export default wrap(Core, {
|
|
11
|
+
pt: { command: { as: Command } },
|
|
12
|
+
slots: { trigger: ({ settings }) => iconPart(settings.trigger, "filter") },
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// The vue file input with the `remove` icon before each file's remove
|
|
2
|
+
// label.
|
|
3
|
+
import Core from "@zoobzio/vue/components/file-input.vue";
|
|
4
|
+
|
|
5
|
+
import { icon } from "./icon";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
|
|
8
|
+
export default wrap(Core, {
|
|
9
|
+
slots: { itemRemovePrepend: () => [icon("remove")] },
|
|
10
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// The vue form field with the layer's wrapped controls behind its parts, so
|
|
2
|
+
// a field's select, multi select, checkbox, date picker, tags input, file
|
|
3
|
+
// input, and rich text draw their icons.
|
|
4
|
+
import Core from "@zoobzio/vue/components/form-field.vue";
|
|
5
|
+
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
import Checkbox from "./checkbox";
|
|
8
|
+
import DatePicker from "./date-picker";
|
|
9
|
+
import FileInput from "./file-input";
|
|
10
|
+
import MultiSelect from "./multi-select";
|
|
11
|
+
import RichText from "./rich-text";
|
|
12
|
+
import Select from "./select";
|
|
13
|
+
import TagsInput from "./tags-input";
|
|
14
|
+
|
|
15
|
+
export default wrap(Core, {
|
|
16
|
+
pt: {
|
|
17
|
+
select: { as: Select },
|
|
18
|
+
multiSelect: { as: MultiSelect },
|
|
19
|
+
checkbox: { as: Checkbox },
|
|
20
|
+
datePicker: { as: DatePicker },
|
|
21
|
+
tagsInput: { as: TagsInput },
|
|
22
|
+
fileInput: { as: FileInput },
|
|
23
|
+
richText: { as: RichText },
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// The vue form with the layer's FormField rendering each field, so every
|
|
2
|
+
// control draws its icons.
|
|
3
|
+
import Core from "@zoobzio/vue/components/form.vue";
|
|
4
|
+
|
|
5
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
6
|
+
import FormField from "./form-field";
|
|
7
|
+
|
|
8
|
+
export default wrap(Core, {
|
|
9
|
+
pt: { field: () => ({ as: FormField }) },
|
|
10
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The vue hero with NuxtLink under its `link` part.
|
|
2
|
+
import Core from "@zoobzio/vue/components/hero.vue";
|
|
3
|
+
|
|
4
|
+
import NuxtLink from "#app/components/nuxt-link";
|
|
5
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
6
|
+
|
|
7
|
+
export default wrap(Core, {
|
|
8
|
+
pt: { link: { as: NuxtLink } },
|
|
9
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// The icon glue of the wrappers: a sprite icon by alias, an optional one
|
|
2
|
+
// from an item, and a Fab part rendered with an icon as its content. It
|
|
3
|
+
// sits with the wrappers because only they may name `Icon`, which
|
|
4
|
+
// @icon-sheets/nuxt registers on `#components`.
|
|
5
|
+
import type { IconAlias } from "../types/icon";
|
|
6
|
+
import type { PrimitiveProps } from "@zoobzio/vue/types/components/primitive";
|
|
7
|
+
import type { VNode } from "vue";
|
|
8
|
+
|
|
9
|
+
import { Icon } from "#components";
|
|
10
|
+
import { h } from "vue";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* One icon of the app's sprite, by alias.
|
|
14
|
+
*/
|
|
15
|
+
export const icon = (name: IconAlias): VNode => h(Icon, { name });
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* An icon as a slot's content, or nothing where the item names none.
|
|
19
|
+
*/
|
|
20
|
+
export const iconOf = (name: IconAlias | undefined): VNode[] =>
|
|
21
|
+
name ? [icon(name)] : [];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A rendered part with an icon as its content: the default of a slot that
|
|
25
|
+
* replaces a Fab (`refresh`, `actions`, `first`, …). The part's resolved
|
|
26
|
+
* `settings` carry `as` and the props, as the vue template hands them to
|
|
27
|
+
* its `Primitive`; the icon fills the Fab's default slot in place of its
|
|
28
|
+
* label text, and the label stays its `aria-label`.
|
|
29
|
+
*/
|
|
30
|
+
export const iconPart = (
|
|
31
|
+
settings: PrimitiveProps & Record<string, unknown>,
|
|
32
|
+
name: IconAlias,
|
|
33
|
+
): VNode[] => {
|
|
34
|
+
const { as, ...props } = settings;
|
|
35
|
+
return [h(as, props, () => [icon(name)])];
|
|
36
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The vue keywords with the `keywords` icon as the content of its trigger,
|
|
2
|
+
// the layer's TagsInput behind its include and exclude inputs, and the
|
|
3
|
+
// layer's SegmentedControl as its match control.
|
|
4
|
+
import Core from "@zoobzio/vue/components/keywords.vue";
|
|
5
|
+
|
|
6
|
+
import { iconPart } from "./icon";
|
|
7
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
8
|
+
import SegmentedControl from "./segmented-control";
|
|
9
|
+
import TagsInput from "./tags-input";
|
|
10
|
+
|
|
11
|
+
export default wrap(Core, {
|
|
12
|
+
pt: {
|
|
13
|
+
includeInput: { as: TagsInput },
|
|
14
|
+
excludeInput: { as: TagsInput },
|
|
15
|
+
matchControl: { as: SegmentedControl },
|
|
16
|
+
},
|
|
17
|
+
slots: {
|
|
18
|
+
trigger: ({ settings }) => iconPart(settings.trigger, "keywords"),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The vue menu with NuxtLink under its `link` part, and an item's `icon`
|
|
2
|
+
// (the field app.d.ts adds to MenuItem) drawn in the `itemPrepend` slot
|
|
3
|
+
// unless the consumer renders that slot itself.
|
|
4
|
+
import Core from "@zoobzio/vue/components/menu.vue";
|
|
5
|
+
|
|
6
|
+
import NuxtLink from "#app/components/nuxt-link";
|
|
7
|
+
import { Icon } from "#components";
|
|
8
|
+
import { h } from "vue";
|
|
9
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
10
|
+
|
|
11
|
+
export default wrap(Core, {
|
|
12
|
+
pt: { link: () => ({ as: NuxtLink }) },
|
|
13
|
+
slots: {
|
|
14
|
+
itemPrepend: ({ item }) =>
|
|
15
|
+
item.icon ? [h(Icon, { name: item.icon })] : [],
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The vue multi select with the `expand` icon after its display and the
|
|
2
|
+
// layer's Checkbox rendering each item's checkbox.
|
|
3
|
+
import Core from "@zoobzio/vue/components/multi-select.vue";
|
|
4
|
+
|
|
5
|
+
import { icon } from "./icon";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
import Checkbox from "./checkbox";
|
|
8
|
+
|
|
9
|
+
export default wrap(Core, {
|
|
10
|
+
pt: { itemCheckbox: () => ({ as: Checkbox }) },
|
|
11
|
+
slots: { triggerAppend: () => [icon("expand")] },
|
|
12
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The vue pagination with the `first`, `prev`, `next`, and `last` icons as
|
|
2
|
+
// the content of its page controls, and the layer's Select as its size
|
|
3
|
+
// control.
|
|
4
|
+
import Core from "@zoobzio/vue/components/pagination.vue";
|
|
5
|
+
|
|
6
|
+
import { iconPart } from "./icon";
|
|
7
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
8
|
+
import Select from "./select";
|
|
9
|
+
|
|
10
|
+
export default wrap(Core, {
|
|
11
|
+
pt: { size: { as: Select } },
|
|
12
|
+
slots: {
|
|
13
|
+
first: ({ settings }) => iconPart(settings.first, "first"),
|
|
14
|
+
prev: ({ settings }) => iconPart(settings.prev, "prev"),
|
|
15
|
+
next: ({ settings }) => iconPart(settings.next, "next"),
|
|
16
|
+
last: ({ settings }) => iconPart(settings.last, "last"),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The vue range calendar with the `prev` and `next` icons before its month
|
|
2
|
+
// controls.
|
|
3
|
+
import Core from "@zoobzio/vue/components/range-calendar.vue";
|
|
4
|
+
|
|
5
|
+
import { icon } from "./icon";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
|
|
8
|
+
export default wrap(Core, {
|
|
9
|
+
slots: {
|
|
10
|
+
prevPrepend: () => [icon("prev")],
|
|
11
|
+
nextPrepend: () => [icon("next")],
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// The vue rich text with each tool's icon (`toolIcon`, by the tool's
|
|
2
|
+
// key) before its label, as the editor draws them.
|
|
3
|
+
import Core from "@zoobzio/vue/components/rich-text.vue";
|
|
4
|
+
|
|
5
|
+
import { iconOf } from "./icon";
|
|
6
|
+
import { wrap } from "@zoobzio/vue/utils/wrap";
|
|
7
|
+
import { toolIcon } from "../utils/editor";
|
|
8
|
+
|
|
9
|
+
export default wrap(Core, {
|
|
10
|
+
slots: { toolPrepend: ({ tool }) => iconOf(toolIcon(tool.key)) },
|
|
11
|
+
});
|