viewkitjs 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/package.json +1 -1
- package/views/dist/controls/grip/grip.d.ts +14 -0
- package/views/dist/controls/grip/grip.js +9 -0
- package/views/dist/controls/index.d.ts +6 -0
- package/views/dist/controls/index.js +6 -0
- package/views/dist/controls/internal/hold.d.ts +25 -0
- package/views/dist/controls/internal/hold.js +81 -0
- package/views/dist/controls/internal/icons.d.ts +8 -0
- package/views/dist/controls/internal/icons.js +65 -0
- package/views/dist/controls/internal/read-token.d.ts +6 -0
- package/views/dist/controls/internal/read-token.js +11 -0
- package/views/dist/controls/internal/reorder.d.ts +44 -0
- package/views/dist/controls/internal/reorder.js +83 -0
- package/views/dist/controls/list/tokens.d.ts +139 -0
- package/views/dist/controls/list/tokens.js +37 -0
- package/views/dist/controls/list.css +188 -0
- package/views/dist/controls/menu-list/keys.d.ts +7 -0
- package/views/dist/controls/menu-list/keys.js +29 -0
- package/views/dist/controls/menu-list/looks.d.ts +4 -0
- package/views/dist/controls/menu-list/looks.js +20 -0
- package/views/dist/controls/menu-list/menu-list.d.ts +196 -0
- package/views/dist/controls/menu-list/menu-list.js +346 -0
- package/views/dist/controls/menu-list/tokens.d.ts +187 -0
- package/views/dist/controls/menu-list/tokens.js +49 -0
- package/views/dist/controls/menu-list.css +259 -0
- package/views/dist/controls/sheet/bottom-sheet.js +3 -0
- package/views/dist/controls/sheet.css +3 -0
- package/views/dist/controls/tokens.js +4 -0
- package/views/dist/grid/chrome/grid-caret-keys.d.ts +7 -0
- package/views/dist/grid/chrome/grid-caret-keys.js +22 -0
- package/views/dist/grid/chrome/useGridFittedWidths.d.ts +3 -0
- package/views/dist/grid/chrome/useGridFittedWidths.js +16 -3
- package/views/dist/grid/chrome/useGridKeyboard.js +3 -0
- package/views/dist/looks/index.d.ts +1 -0
- package/views/dist/looks/index.js +1 -0
- package/views/dist/looks/looks.d.ts +10 -9
- package/views/dist/looks/pieces.js +2 -0
- package/views/dist/styles.css +443 -11
- package/views/dist/styles.unlayered.css +443 -11
- package/views/docs/controls/list.md +40 -0
- package/views/docs/controls/menu-list.md +52 -0
- package/views/docs/getting-started.md +1 -1
- package/views/docs/reference/controls.md +40 -0
- package/views/docs/reference/looks.md +3 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# The menu list's tokens
|
|
2
|
+
|
|
3
|
+
Every name the menu list's stylesheet (`menu-list.css`) reads, each optional: the ready stylesheet declares it at the Outright look's value, and your app declares it to change it. Each stands for one Outright token, which an app on the Outright tokens declares it as. Two are times its script reads, which the stylesheet hands it on each row: `--vk-hold-delay`, how long a finger rests on a phone's row before it lifts, and `--vk-submenu-delay`, how long the pointer rests on a row one level in before its panel opens. How the names are made, and the controls' other pages: [the controls' tokens](../contract.md#the-controls-tokens).
|
|
4
|
+
|
|
5
|
+
| name | kind | the Outright token | default |
|
|
6
|
+
| ---- | ---- | ------------------ | ------- |
|
|
7
|
+
| `--vk-border` | colour | `border` | `hsl(220 7% 90%)` · dark `hsl(225 7% 15%)` |
|
|
8
|
+
| `--vk-border-brand` | colour | `border-focused` | `hsl(219 90% 65.5%)` · dark `hsl(219 66% 47%)` |
|
|
9
|
+
| `--vk-border-overlay-card` | colour | `border-overlay-card` | `hsl(220 3% 86%)` · dark `hsl(220 4% 22%)` |
|
|
10
|
+
| `--vk-danger` | colour | `text-danger` | `hsl(0 81% 58%)` |
|
|
11
|
+
| `--vk-danger-subtlest` | colour | `background-danger-subtlest` | `hsl(6 100% 98%)` · dark `hsl(6 13% 10%)` |
|
|
12
|
+
| `--vk-fg` | colour | `text` | `hsl(210 6% 7%)` · dark `hsl(210 8% 95%)` |
|
|
13
|
+
| `--vk-fg-accent` | colour | `text-brand` | `hsl(219 87% 54%)` · dark `hsl(219 87% 59.5%)` |
|
|
14
|
+
| `--vk-fg-disabled` | colour | `text-disabled` | `hsl(210 1% 72%)` · dark `hsl(210 1% 37%)` |
|
|
15
|
+
| `--vk-fg-inverse` | colour | `text-inverse` | `hsl(0 0% 100%)` · dark `hsl(210 8% 95%)` |
|
|
16
|
+
| `--vk-fg-subtle` | colour | `text-subtle` | `hsl(0 0% 35%)` · dark `hsl(258 4% 72%)` |
|
|
17
|
+
| `--vk-fg-subtlest` | colour | `text-subtlest` | `hsl(210 1% 53.5%)` · dark `hsl(210 3% 53%)` |
|
|
18
|
+
| `--vk-label-amber` | colour | `label-amber` | `hsl(25 92% 41%)` |
|
|
19
|
+
| `--vk-label-amber-pressed` | colour | `label-amber-pressed` | `hsl(24 86% 35.5%)` · dark `hsl(21 66% 55%)` |
|
|
20
|
+
| `--vk-label-blue` | colour | `label-blue` | `hsl(219 87% 54%)` · dark `hsl(219 87% 59.5%)` |
|
|
21
|
+
| `--vk-label-blue-pressed` | colour | `label-blue-pressed` | `hsl(219 70% 46.5%)` · dark `hsl(219 95% 64%)` |
|
|
22
|
+
| `--vk-label-green` | colour | `label-green` | `hsl(158 98% 26%)` · dark `hsl(158 98% 34%)` |
|
|
23
|
+
| `--vk-label-green-pressed` | colour | `label-green-pressed` | `hsl(157 88% 24%)` · dark `hsl(150 45% 51.5%)` |
|
|
24
|
+
| `--vk-label-purple` | colour | `label-purple` | `hsl(260 100% 64.5%)` · dark `hsl(260 100% 69%)` |
|
|
25
|
+
| `--vk-label-purple-pressed` | colour | `label-purple-pressed` | `hsl(260 65% 55%)` · dark `hsl(256 100% 73%)` |
|
|
26
|
+
| `--vk-neutral` | colour | `background-neutral` | `hsl(0 0% 94%)` · dark `hsl(225 7% 11%)` |
|
|
27
|
+
| `--vk-overlay` | colour | `surface-overlay` | `hsl(0 0% 100%)` · dark `hsl(226 10% 10%)` |
|
|
28
|
+
| `--vk-overlay-card` | colour | `surface-overlay-card` | `hsl(0 0% 94%)` · dark `hsl(225 7% 15%)` |
|
|
29
|
+
| `--vk-overlay-card-pressed` | colour | `surface-overlay-card-pressed` | `hsl(220 7% 90%)` · dark `hsl(220 4% 22%)` |
|
|
30
|
+
| `--vk-overlay-pressed` | colour | `surface-overlay-pressed` | `hsl(0 0% 94%)` · dark `hsl(225 7% 15%)` |
|
|
31
|
+
| `--vk-shadow-2xl` | shadow | `shadow-2xl` | `0 25px 50px -12px rgb(0 0 0 / 0.25)` |
|
|
32
|
+
| `--vk-shadow-lg` | shadow | `shadow-lg` | `0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)` |
|
|
33
|
+
| `--vk-border-width` | size | `border-width` | `1px` |
|
|
34
|
+
| `--vk-focus-width` | size | `focus-width` | `2px` |
|
|
35
|
+
| `--vk-font-size-base` | size | `text-base` | `16px` |
|
|
36
|
+
| `--vk-font-size-sm` | size | `text-sm` | `14px` |
|
|
37
|
+
| `--vk-font-size-xs` | size | `text-xs` | `12px` |
|
|
38
|
+
| `--vk-font-weight-medium` | size | `font-weight-medium` | `500` |
|
|
39
|
+
| `--vk-layer-popup` | size | `layer-popup` | `50` |
|
|
40
|
+
| `--vk-line-height-base` | size | `text-base--line-height` | `1.5` |
|
|
41
|
+
| `--vk-line-height-sm` | size | `text-sm--line-height` | `1.4286` |
|
|
42
|
+
| `--vk-radius-2xl` | size | `radius-2xl` | `20px` |
|
|
43
|
+
| `--vk-radius-full` | size | `radius-full` | `9999px` |
|
|
44
|
+
| `--vk-radius-lg` | size | `radius-lg` | `10px` |
|
|
45
|
+
| `--vk-radius-sm` | size | `radius-sm` | `5px` |
|
|
46
|
+
| `--vk-radius-xl` | size | `radius-xl` | `15px` |
|
|
47
|
+
| `--vk-spacing` | size | `spacing` | `4px` |
|
|
48
|
+
| `--vk-duration-fast` | motion | `duration-fast` | `150ms` |
|
|
49
|
+
| `--vk-ease-in` | motion | `ease-in` | `cubic-bezier(0.4, 0, 1, 1)` |
|
|
50
|
+
| `--vk-ease-out` | motion | `ease-out` | `cubic-bezier(0, 0, 0.2, 1)` |
|
|
51
|
+
| `--vk-hold-delay` | motion | `hold-delay` | `500ms` |
|
|
52
|
+
| `--vk-submenu-delay` | motion | `submenu-delay` | `100ms` |
|
|
@@ -68,7 +68,7 @@ const DEAL_BINDINGS = bindFields<Deal, typeof DEAL_FIELDS>(DEAL_FIELDS, {
|
|
|
68
68
|
|
|
69
69
|
## Make the columns
|
|
70
70
|
|
|
71
|
-
A column is what the grid draws: a binding plus what only the grid knows, such as its `id` and its starting width in pixels. Leave the width out and the grid starts the column as wide as the values it first draws and its header need, up to 320 px; a width the person drags is kept over either. `columnFrom` derives the column's type, options, format and whether it can be edited from the field and the binding.
|
|
71
|
+
A column is what the grid draws: a binding plus what only the grid knows, such as its `id` and its starting width in pixels. Leave the width out and the grid starts the column as wide as the values it first draws and its header need, up to 320 px, read once the grid is laid out (a grid drawn hidden, in a tab or a step not yet shown, reads them when it shows); a width the person drags is kept over either. `columnFrom` derives the column's type, options, format and whether it can be edited from the field and the binding.
|
|
72
72
|
|
|
73
73
|
```tsx
|
|
74
74
|
const columns = [
|
|
@@ -196,6 +196,46 @@ Their stylesheets are `input.css`, `inline-input.css`, `field.css`, `toggle.css`
|
|
|
196
196
|
- `statusPlaceOf` — `statusPlaceOf(slot)`: where a status of a slot stands on the Status's path (`running` and `primary` are a step between).
|
|
197
197
|
- `quartersOf` — `quartersOf(steps, at)`: a step between at its quarters (1, 2 or 3) among the steps between, in their order.
|
|
198
198
|
|
|
199
|
+
## The menu list
|
|
200
|
+
|
|
201
|
+
- `MenuList` — what you can do with something on a phone, as rows you press, poured into a Sheet: tiles if it has them, then its rows in sections (a separator, a group or a pick starts one), a Close row first by `onClose`, a tick drawn as the Switch or, by `ticks="eye"`, an eye, and rows with a `grip` moved by a hold, then a drag (`onMove`). It owns no way of opening or closing.
|
|
202
|
+
- `MenuListProps` — its props.
|
|
203
|
+
- `MenuListRows` — a menu's rows on a computer, every kind of entry, each level in with its own panel beside it, placed inside a Base UI Menu or ContextMenu popup; `host` is the popup host its levels open in.
|
|
204
|
+
- `MenuListShown` — the same rows standing still on a page: `open` shows a level's rows beside it, `on` a row as under the pointer.
|
|
205
|
+
- `MenuListPanelRows` — a menu's rows in a panel that is no menu (a pane, a popover): one tab stop, ↑ ↓ wrapping, Home, End and a typed letter, Enter and Space press, → presses a row one level in, which `onOpen` hands its holder; `ticks` `box`, `switch` or `eye`; rows with a `grip` moved by it, the pointer or ↑ ↓ on it.
|
|
206
|
+
- `MenuListPanelRowsProps` — its props.
|
|
207
|
+
- `MenuListRow` — a name and its value as one row standing alone, at the list's own height and inset.
|
|
208
|
+
- `MenuScroll` — what scrolls in a menu's panel: its rows alone, the Scrollbar over them.
|
|
209
|
+
- `MenuEntry` — a row of a menu: an action, a link, a tick, a choice or actions one level in, a pick under a heading, a group, a separator.
|
|
210
|
+
- `MenuChoice` — a choice: its value, its name, its mark and its `detail`.
|
|
211
|
+
- `MenuListEntry` — a menu's entry with what a row adds: a `note` under its name, an `end` on its right, a `grip`.
|
|
212
|
+
- `MenuListTile` — one of the few done most, as a tile.
|
|
213
|
+
- `tilesOf` — `tilesOf(entries, allRows?)`: the first four plain actions as tiles when there are three or more, the rest as rows.
|
|
214
|
+
- `menuListRowsOf` — what its rows stand on, as worn around an element.
|
|
215
|
+
- `menuListCloseOf` — whether a Close row stands over its rows, as worn around an element (never under Words).
|
|
216
|
+
- `sheetFormOf` — the sheet its rows want: `floating` under Plain and Words, `edge` otherwise.
|
|
217
|
+
- `useMenuListOption` — one of its options as worn around a frame, kept up to date as it changes.
|
|
218
|
+
- `useMenuListRows` — what its rows stand on, the same way.
|
|
219
|
+
- `rowFor` — `rowFor(key, at, count, off)`: the row ↑, ↓, Home or End goes to, past those that can't be used.
|
|
220
|
+
- `rowStarting` — `rowStarting(names, at, typed, off)`: the next row whose name starts with what was typed.
|
|
221
|
+
|
|
222
|
+
## What the menu list stands on
|
|
223
|
+
|
|
224
|
+
- `Icon` — a Tabler icon by its name, at stroke 2 in the colour of its words, 15 unless `size` says; a name ending in `-filled` is drawn as a shape.
|
|
225
|
+
- `iconPaths` — an icon's paths, for a control that draws one of its parts itself.
|
|
226
|
+
- `Grip` — the Button a row is moved by, 20 × 24, its six dots faint, the grabbing hand; `label` names what it moves.
|
|
227
|
+
- `GRIP` — its six dots' paths.
|
|
228
|
+
- `GRIP_LOOK` — its own look.
|
|
229
|
+
- `useReorder` — `useReorder({ count, onMove, grip })`: a list's rows moved by their grips, by ↑ and ↓ or the pointer; it hands `gripProps(i)`, `lift(i)` and `dragging`.
|
|
230
|
+
- `useHoldDrag` — `useHoldDrag(root, gripProps, reads, on?)`: a phone's row moved by a hold, then a drag; `reads` reads a row's hold delay and swipe distance off it.
|
|
231
|
+
- `HoldDragProps` — what a held row carries.
|
|
232
|
+
- `HoldReads` — how a held row reads its hold delay, in ms, and how far a finger may move before the press is a swipe, in px.
|
|
233
|
+
- `moved` — `moved(list, from, to)`: a value moved from one place to another.
|
|
234
|
+
- `gapOf` — the gap after a row, on screen.
|
|
235
|
+
- `dragAt` — where a dragged row is, and the place it has passed half a row into.
|
|
236
|
+
- `ReorderDrag` — a drag.
|
|
237
|
+
- `RowEdges` — a row's top and bottom on screen.
|
|
238
|
+
|
|
199
239
|
<!-- The picker's: the Menu, the Select, the Avatar -->
|
|
200
240
|
|
|
201
241
|
<!-- The panels': the Pane, the toolbar button, the Radio, the Modal, the alert dialog, the Toast, the Collapsible, the Alert, the Notice -->
|
|
@@ -4,7 +4,7 @@ Import from `viewkitjs/views/looks` to pick a piece's look by name: each piece's
|
|
|
4
4
|
|
|
5
5
|
## The shape
|
|
6
6
|
|
|
7
|
-
- `PieceLooks` — a piece's options and looks: `id` (the piece's, the middle of its attributes' names), `name`, `options` (`LookOption`s, in the order a picker shows them) and `looks` (`Look`s). Nothing picked wears each option's `def`, My preset's pick, which no look need match whole.
|
|
7
|
+
- `PieceLooks` — a piece's options and looks: `id` (the piece's, the middle of its attributes' names), `name`, `options` (`LookOption`s, in the order a picker shows them) and `looks` (`Look`s, each picking every option, or only those its second type names, `PieceLooks<Id, Picked>`, the rest an app's own say). Nothing picked wears each option's `def`, My preset's pick, which no look need match whole.
|
|
8
8
|
- `LookOption` — one option: `id`, `name`, `def` (the value worn when nothing is picked, or when the pick is a value it doesn't have), `values` (`LookValue`s), and optionally `device` (a `LookDevice`), `kind` (`"steps"` for an ordered scale, `"list"` for a long list), `unless` (an option and a value, or several, under which this one means nothing) and `demo: false` (it changes nothing a whole list draws, so a list-wide picker may leave it out).
|
|
9
9
|
- `LookValue` — one value an option can hold: `id` and `name`.
|
|
10
10
|
- `Look` — a named set of picks: `id`, `name`, `picks` (one value for every option) and optionally `device`.
|
|
@@ -89,6 +89,8 @@ on a frame round the controls as `data-<piece>-*`, which each control's styleshe
|
|
|
89
89
|
- `StatusLookOptionId` — the Status's option ids.
|
|
90
90
|
- `SWITCH_LOOKS` — the Switch's: 4 options (`shape` a computer's, `phone` a phone's, `mark`, `motion`) and five looks, `slim`, `capsule`, `thin`, `hairline` and `classic`.
|
|
91
91
|
- `SwitchLookOptionId` — the Switch's option ids.
|
|
92
|
+
- `MENU_LIST_LOOKS` — the menu list's, each a phone's: 6 options (`rows`, what its rows stand on; `lines`; `height`, a scale from `48` to `56`; `corners`, a scale from `lg` to `2xl`; `close`, a Close row; `tiles`) and five looks, `stack`, `card`, `plain`, `joined` and `words`, which pick the first four and leave the Close row and the tiles to the app.
|
|
93
|
+
- `MenuListLookOptionId` — the menu list's option ids.
|
|
92
94
|
|
|
93
95
|
<!-- The picker's: the Menu, the Select, the Avatar -->
|
|
94
96
|
|