@slotform/react-ui 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +44 -2
- package/dist/density.d.ts +4 -0
- package/dist/density.d.ts.map +1 -0
- package/dist/density.js +8 -0
- package/dist/density.js.map +1 -0
- package/dist/index.d.ts +400 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +388 -0
- package/dist/index.js.map +1 -0
- package/dist/node/canvas.d.ts +3 -0
- package/dist/node/canvas.d.ts.map +1 -0
- package/dist/node/canvas.js +13 -0
- package/dist/node/canvas.js.map +1 -0
- package/dist/node/codegen.d.ts +6 -0
- package/dist/node/codegen.d.ts.map +1 -0
- package/dist/node/codegen.js +70 -0
- package/dist/node/codegen.js.map +1 -0
- package/dist/node/css-escape.d.ts +8 -0
- package/dist/node/css-escape.d.ts.map +1 -0
- package/dist/node/css-escape.js +12 -0
- package/dist/node/css-escape.js.map +1 -0
- package/dist/node/fonts.d.ts +6 -0
- package/dist/node/fonts.d.ts.map +1 -0
- package/dist/node/fonts.js +219 -0
- package/dist/node/fonts.js.map +1 -0
- package/dist/node/lint.d.ts +3 -0
- package/dist/node/lint.d.ts.map +1 -0
- package/dist/node/lint.js +23 -0
- package/dist/node/lint.js.map +1 -0
- package/dist/node/mode.d.ts +9 -0
- package/dist/node/mode.d.ts.map +1 -0
- package/dist/node/mode.js +38 -0
- package/dist/node/mode.js.map +1 -0
- package/dist/node/theme.d.ts +13 -0
- package/dist/node/theme.d.ts.map +1 -0
- package/dist/node/theme.js +160 -0
- package/dist/node/theme.js.map +1 -0
- package/dist/types.d.ts +250 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +80 -0
- package/dist/types.js.map +1 -0
- package/guide/acts.md +61 -0
- package/guide/audio.md +77 -0
- package/guide/blocks.md +82 -0
- package/guide/canvas-choosing.md +34 -0
- package/guide/canvas-editing.md +36 -0
- package/guide/canvas-layout.md +46 -0
- package/guide/canvas-opening.md +47 -0
- package/guide/canvas-overview.md +24 -0
- package/guide/canvas-states.md +37 -0
- package/guide/canvas-view.md +46 -0
- package/guide/canvas.md +94 -0
- package/guide/containers.md +60 -0
- package/guide/content.md +40 -0
- package/guide/controls.md +89 -0
- package/guide/density.md +48 -0
- package/guide/dock.md +42 -0
- package/guide/drag.md +38 -0
- package/guide/figures.md +25 -0
- package/guide/forms.md +82 -0
- package/guide/pane-bar.md +11 -0
- package/guide/pane.md +50 -0
- package/guide/reference.md +74 -0
- package/guide/rules.md +109 -0
- package/guide/section.md +29 -0
- package/guide/shell.md +26 -0
- package/guide/shots.md +37 -0
- package/guide/sidebar.md +30 -0
- package/guide/table.md +119 -0
- package/lint/no-arbitrary-value.grit +9 -0
- package/lint/no-class-on-component.grit +12 -0
- package/lint/no-density.grit +8 -0
- package/lint/no-host-look.grit +38 -0
- package/lint/no-img.grit +10 -0
- package/lint/no-navigate-act.grit +22 -0
- package/lint/no-raw-style.grit +8 -0
- package/package.json +150 -3
- package/src/density.ts +9 -0
- package/src/index.ts +503 -0
- package/src/node/canvas.ts +14 -0
- package/src/node/codegen.ts +100 -0
- package/src/node/css-escape.ts +27 -0
- package/src/node/fonts.ts +260 -0
- package/src/node/lint.ts +25 -0
- package/src/node/mode.ts +64 -0
- package/src/node/theme.ts +232 -0
- package/src/types.ts +120 -0
- package/src/ui/atoms/avatar/base.tsx +42 -0
- package/src/ui/atoms/button/glyph.tsx +244 -0
- package/src/ui/atoms/button/link.tsx +81 -0
- package/src/ui/atoms/button/look.ts +32 -0
- package/src/ui/atoms/button/reason.tsx +69 -0
- package/src/ui/atoms/chip/base.tsx +85 -0
- package/src/ui/atoms/count/base.tsx +27 -0
- package/src/ui/atoms/icon/index.tsx +51 -0
- package/src/ui/atoms/message/waiting.tsx +19 -0
- package/src/ui/atoms/prose/painted.tsx +35 -0
- package/src/ui/atoms/row/badges.tsx +226 -0
- package/src/ui/atoms/row/leading.tsx +166 -0
- package/src/ui/atoms/row/lock.tsx +17 -0
- package/src/ui/atoms/row/marks.tsx +79 -0
- package/src/ui/atoms/section/card.tsx +27 -0
- package/src/ui/atoms/spinner/index.tsx +42 -0
- package/src/ui/atoms/status/base.tsx +51 -0
- package/src/ui/atoms/status/change.tsx +29 -0
- package/src/ui/atoms/status/dot.tsx +45 -0
- package/src/ui/atoms/switch/checkbox.tsx +121 -0
- package/src/ui/atoms/turn.tsx +28 -0
- package/src/ui/components/action-bar/base.tsx +276 -0
- package/src/ui/components/action-bar/index.tsx +20 -0
- package/src/ui/components/avatar/index.tsx +21 -0
- package/src/ui/components/banner/index.tsx +207 -0
- package/src/ui/components/banner/pending.tsx +109 -0
- package/src/ui/components/bar-chart/index.tsx +701 -0
- package/src/ui/components/button/base.tsx +214 -0
- package/src/ui/components/button/face.tsx +84 -0
- package/src/ui/components/button/index.tsx +206 -0
- package/src/ui/components/canvas/connection.tsx +26 -0
- package/src/ui/components/canvas/edges.tsx +116 -0
- package/src/ui/components/canvas/elk.ts +260 -0
- package/src/ui/components/canvas/floor.ts +173 -0
- package/src/ui/components/canvas/geometry.ts +772 -0
- package/src/ui/components/canvas/ground.tsx +97 -0
- package/src/ui/components/canvas/group.tsx +156 -0
- package/src/ui/components/canvas/hit.ts +40 -0
- package/src/ui/components/canvas/index.tsx +497 -0
- package/src/ui/components/canvas/label.tsx +53 -0
- package/src/ui/components/canvas/layout.ts +543 -0
- package/src/ui/components/canvas/lift.ts +272 -0
- package/src/ui/components/canvas/look.ts +129 -0
- package/src/ui/components/canvas/node.tsx +689 -0
- package/src/ui/components/canvas/open.ts +243 -0
- package/src/ui/components/canvas/opening.ts +240 -0
- package/src/ui/components/canvas/view.ts +621 -0
- package/src/ui/components/canvas/viewport.ts +417 -0
- package/src/ui/components/canvas/zoom.tsx +113 -0
- package/src/ui/components/card/index.tsx +20 -0
- package/src/ui/components/chip/index.tsx +24 -0
- package/src/ui/components/code/frame.ts +2 -0
- package/src/ui/components/code/index.tsx +234 -0
- package/src/ui/components/columns/index.tsx +51 -0
- package/src/ui/components/count/index.tsx +17 -0
- package/src/ui/components/diff/index.tsx +249 -0
- package/src/ui/components/diff/word.tsx +104 -0
- package/src/ui/components/dock/index.tsx +262 -0
- package/src/ui/components/file-row/index.tsx +213 -0
- package/src/ui/components/form/base.tsx +280 -0
- package/src/ui/components/form/derive.tsx +269 -0
- package/src/ui/components/form/index.tsx +49 -0
- package/src/ui/components/form/saved.tsx +39 -0
- package/src/ui/components/form-field/index.tsx +658 -0
- package/src/ui/components/gallery/index.tsx +83 -0
- package/src/ui/components/gate/index.tsx +183 -0
- package/src/ui/components/image/base.tsx +245 -0
- package/src/ui/components/image/index.tsx +58 -0
- package/src/ui/components/input/base.tsx +246 -0
- package/src/ui/components/input/code.tsx +108 -0
- package/src/ui/components/input/drop.ts +37 -0
- package/src/ui/components/input/file.tsx +154 -0
- package/src/ui/components/input/index.tsx +132 -0
- package/src/ui/components/input/prose.tsx +107 -0
- package/src/ui/components/input/refusal.tsx +30 -0
- package/src/ui/components/item-header/base.tsx +410 -0
- package/src/ui/components/menu/base.tsx +319 -0
- package/src/ui/components/message/attachments.tsx +101 -0
- package/src/ui/components/message/base.tsx +266 -0
- package/src/ui/components/message-input/index.tsx +377 -0
- package/src/ui/components/missing/base.tsx +45 -0
- package/src/ui/components/pane/head.tsx +399 -0
- package/src/ui/components/pane/index.tsx +325 -0
- package/src/ui/components/picker/base.tsx +1551 -0
- package/src/ui/components/picker/index.tsx +224 -0
- package/src/ui/components/picker/list.tsx +423 -0
- package/src/ui/components/picker/segments.tsx +183 -0
- package/src/ui/components/prose/index.tsx +259 -0
- package/src/ui/components/qr-code/index.tsx +65 -0
- package/src/ui/components/row/acts.tsx +126 -0
- package/src/ui/components/row/fact.tsx +54 -0
- package/src/ui/components/row/index.tsx +1370 -0
- package/src/ui/components/row/progress.tsx +38 -0
- package/src/ui/components/row/status.tsx +54 -0
- package/src/ui/components/row/title.ts +7 -0
- package/src/ui/components/rules/index.tsx +290 -0
- package/src/ui/components/section/band.tsx +39 -0
- package/src/ui/components/section/head.tsx +267 -0
- package/src/ui/components/section/index.tsx +409 -0
- package/src/ui/components/section/rows.tsx +356 -0
- package/src/ui/components/sheet/base.tsx +272 -0
- package/src/ui/components/sheet/confirm.tsx +79 -0
- package/src/ui/components/sheet/docked.tsx +218 -0
- package/src/ui/components/sheet/form.tsx +76 -0
- package/src/ui/components/sheet/head.tsx +120 -0
- package/src/ui/components/sheet/index.tsx +45 -0
- package/src/ui/components/sheet/layer.tsx +168 -0
- package/src/ui/components/sheet/outlet.tsx +58 -0
- package/src/ui/components/sheet/task.tsx +41 -0
- package/src/ui/components/shell/cut.tsx +116 -0
- package/src/ui/components/shell/drag.tsx +45 -0
- package/src/ui/components/shell/host.tsx +71 -0
- package/src/ui/components/shell/index.tsx +737 -0
- package/src/ui/components/shell/panes.tsx +76 -0
- package/src/ui/components/shell/preview.ts +230 -0
- package/src/ui/components/shell/rail.tsx +163 -0
- package/src/ui/components/shell/row.ts +11 -0
- package/src/ui/components/shell/switcher.tsx +143 -0
- package/src/ui/components/shell/tree.tsx +252 -0
- package/src/ui/components/slider/base.tsx +139 -0
- package/src/ui/components/slider/index.tsx +57 -0
- package/src/ui/components/stages/index.tsx +198 -0
- package/src/ui/components/stats/count-links.tsx +47 -0
- package/src/ui/components/stats/index.tsx +203 -0
- package/src/ui/components/stats/meter.tsx +213 -0
- package/src/ui/components/stats/parts.ts +10 -0
- package/src/ui/components/step-count/index.tsx +45 -0
- package/src/ui/components/switch/base.tsx +86 -0
- package/src/ui/components/switch/index.tsx +38 -0
- package/src/ui/components/table/columns.tsx +131 -0
- package/src/ui/components/table/index.tsx +2215 -0
- package/src/ui/components/text/index.tsx +37 -0
- package/src/ui/components/thread/index.tsx +503 -0
- package/src/ui/components/thread/latest.tsx +59 -0
- package/src/ui/components/toast/index.tsx +113 -0
- package/src/ui/components/toast/layer.tsx +26 -0
- package/src/ui/components/toolbar/filters.tsx +161 -0
- package/src/ui/components/toolbar/index.tsx +125 -0
- package/src/ui/components/waveform/index.tsx +205 -0
- package/src/ui/globals.css +427 -0
- package/src/ui/lib/act.ts +60 -0
- package/src/ui/lib/age.ts +49 -0
- package/src/ui/lib/bound.ts +16 -0
- package/src/ui/lib/canvas-layout.ts +11 -0
- package/src/ui/lib/caret.ts +9 -0
- package/src/ui/lib/chip-lines.ts +3 -0
- package/src/ui/lib/closed.ts +8 -0
- package/src/ui/lib/code.tsx +184 -0
- package/src/ui/lib/columns.ts +39 -0
- package/src/ui/lib/commit.ts +24 -0
- package/src/ui/lib/container.ts +112 -0
- package/src/ui/lib/copy.ts +29 -0
- package/src/ui/lib/drag.ts +575 -0
- package/src/ui/lib/empty.tsx +85 -0
- package/src/ui/lib/field.ts +39 -0
- package/src/ui/lib/focus.ts +175 -0
- package/src/ui/lib/folds.ts +67 -0
- package/src/ui/lib/follow.ts +220 -0
- package/src/ui/lib/form.ts +19 -0
- package/src/ui/lib/guards.ts +38 -0
- package/src/ui/lib/heading.ts +14 -0
- package/src/ui/lib/ink.ts +26 -0
- package/src/ui/lib/lang.ts +7 -0
- package/src/ui/lib/leave.ts +14 -0
- package/src/ui/lib/lockup.tsx +145 -0
- package/src/ui/lib/measure.ts +22 -0
- package/src/ui/lib/media.ts +63 -0
- package/src/ui/lib/modality.ts +69 -0
- package/src/ui/lib/moment.ts +13 -0
- package/src/ui/lib/more.tsx +76 -0
- package/src/ui/lib/navigate.ts +210 -0
- package/src/ui/lib/noop.ts +3 -0
- package/src/ui/lib/not-found.tsx +40 -0
- package/src/ui/lib/paint.tsx +55 -0
- package/src/ui/lib/parts-line.tsx +54 -0
- package/src/ui/lib/picked.ts +18 -0
- package/src/ui/lib/player-store.ts +38 -0
- package/src/ui/lib/player.ts +139 -0
- package/src/ui/lib/portal.ts +12 -0
- package/src/ui/lib/read.tsx +269 -0
- package/src/ui/lib/region.tsx +49 -0
- package/src/ui/lib/reorder.ts +154 -0
- package/src/ui/lib/rest.ts +16 -0
- package/src/ui/lib/saved.ts +29 -0
- package/src/ui/lib/scramble.tsx +147 -0
- package/src/ui/lib/scrolls.ts +70 -0
- package/src/ui/lib/style.ts +6 -0
- package/src/ui/lib/swap.tsx +107 -0
- package/src/ui/lib/toast.ts +39 -0
- package/src/ui/lib/walk-classes.ts +16 -0
- package/src/ui/lib/window.tsx +376 -0
- package/src/ui/worker.d.ts +4 -0
package/guide/table.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
Records as rows and columns: a grid where the density is desktop, a list on touch. This page is what
|
|
4
|
+
a `Table` takes, its columns and row regions, the rows a viewer ticks, its keys and its form on touch. A narrow container (a list beside an open record) keeps the grid and scrolls it sideways under its frozen leading column.
|
|
5
|
+
|
|
6
|
+
| Prop | Is |
|
|
7
|
+
| --- | --- |
|
|
8
|
+
| `items` | the records: constants, a selection, or a window read (`orpc.x.list.window(input)`), which sizes the grid to its total and loads the pages the view covers |
|
|
9
|
+
| `columns` | the columns in order, the first the row's name ([columns](#columns)) |
|
|
10
|
+
| `row` | the row's regions, each read from the item ([row regions](#row-regions)) |
|
|
11
|
+
| `label` | its accessible name, for a page that holds more than one table; it also names the viewer's column choice |
|
|
12
|
+
| `empty` | what the table says in its own box when its `items` selection answers none, `{ sentence, act? }` (`act` an act that runs, or a `{ label, href }`): a constant from the parent, so a screen with a filter on gives the sentence for it; the `Toolbar` and the `Pane` above stand through it, and without it the generic sentence stands |
|
|
13
|
+
| `selected` | the open record's id, washed as selected |
|
|
14
|
+
| `current` | the id of the current row, apart from the open record (what is playing, the step a run is at): the current bar at the row's start and `aria-current`, never a fill; on touch the bar and the wash |
|
|
15
|
+
| `onOpen` | opens a record: a press on its row, or Enter on any of its cells but an editable one |
|
|
16
|
+
| `onEdit(id, key, value)` | hears each committed edit of a cell whose column has `edit: "input"`; return the save's promise and the cell holds the viewer's value while it pends, a refusal putting it back with its reason. A table that edits also takes `onOpen`, since a phone edits through the record it shows |
|
|
17
|
+
| `choose` | the rows the viewer ticks ([choosing rows](#choosing-rows)) |
|
|
18
|
+
| `drag`, `reorder` | rows dragged onto a drop, or moved within the grid while it is unsorted ([drag, drop and reorder](./drag.md)) |
|
|
19
|
+
|
|
20
|
+
## Columns
|
|
21
|
+
|
|
22
|
+
A wide table is columns as data and nothing else:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
const COLUMNS: TableColumn<Task>[] = [
|
|
26
|
+
{ key: "title", label: "Title", sortable: true, cell: (t) => t.title }, // the row's name: frozen, never hidden
|
|
27
|
+
{ key: "owner", label: "Owner", sortable: true, cell: (t) => t.owner },
|
|
28
|
+
{ key: "points", label: "Points", kind: "number", sortable: true, cell: (t) => t.points }, // a figure: narrow
|
|
29
|
+
{ key: "added", label: "Added", kind: "age", hidden: true, cell: (t) => t.added }, // starts out of the grid
|
|
30
|
+
];
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Field | Is |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| `key` | the column's key, unique in the table |
|
|
36
|
+
| `label` | its head, a short phrase that wraps between its words to a second line before it cuts |
|
|
37
|
+
| `kind` | `text` (the default), `source` (mono) and `number` edit; `chip`, `status`, `age` (an ISO moment) and `change` (`{ before, after }`) are read only |
|
|
38
|
+
| `cell` | reads the cell's value from the item: a string, a number, a `StatusMark`, a change, `null` for empty; a `chip` cell returns the label (on the column's `family`) or `{ label, family }` for a hue of its own |
|
|
39
|
+
| `family` | a `chip` column's chip family |
|
|
40
|
+
| `sortable` | its head sorts: words from A, figures and ages largest first, then turned over, then off; over a paginated read whose procedure declares `sort` the server sorts |
|
|
41
|
+
| `width` | `measure-short` or `1/4`; with none, a `number` column stands at half the short measure, an `age` column at its longest relative word ("59 seconds ago"), a `chip` or `status` column at the short measure, and a text column shares what is left, never under the short measure |
|
|
42
|
+
| `wrap` | its cells wrap and hyphenate instead of truncating; on touch the cell is the row's `line` |
|
|
43
|
+
| `edit` | `"input"`: its cells edit in place (`text`, `source`, `number`) |
|
|
44
|
+
| `locked` | read only in this table: its cells never edit and its head draws a lock |
|
|
45
|
+
| `hidden` | starts out of the grid; the leading column is never hidden |
|
|
46
|
+
|
|
47
|
+
When the columns outrun the page the grid scrolls sideways inside its card under the frozen leading column, never the page. A table with eight or more columns, or any hidden one, draws a columns menu at the end of a bar over the grid (a check row per column after the leading one, a Reset row at its end), and the browser keeps what the viewer chose per table, named by its `label` and its columns' keys, so it holds as a record opens beside it; where the device keeps nothing it holds for the visit. A windowed read's total stands over the grid, formatted.
|
|
48
|
+
|
|
49
|
+
## Row regions
|
|
50
|
+
|
|
51
|
+
| Field | Is |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `id` | the row's id, unique in the table |
|
|
54
|
+
| `href` | the leading cell's link, so the row opens in a new tab |
|
|
55
|
+
| `editable` | `false`: its cells draw the plain value, no mark, no act, for a row that is simply not editable in place |
|
|
56
|
+
| `locked` | the column keys it draws read only with the lock, the hold of an open change set |
|
|
57
|
+
| `warning` | what is wrong with the row, after its leading cell's name |
|
|
58
|
+
| `change` | where the row stands in a change set, its mark ahead of the name |
|
|
59
|
+
| `act` | the row's one act at its end, with its wiring: an `IconAct` or an `IconLinkAct` (`node_modules/@slotform/ui-core/guide/links.md#icon-acts`) |
|
|
60
|
+
| `more` | its other acts, in a menu after `act` |
|
|
61
|
+
| `drop` | the drop the row is, as a `PlaceSpec`'s |
|
|
62
|
+
|
|
63
|
+
A table draws `act` and `more` in an acts column at the grid's end, frozen there like the leading column, and on touch as the list row's act and menu. Completing a task row is this:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
row={{
|
|
67
|
+
id: (t) => t.id,
|
|
68
|
+
act: (t) => ({ icon: "Check", label: `Complete ${t.title}`, onAct: () => complete.mutateAsync(t.id) }),
|
|
69
|
+
more: (t) => [{ label: "Copy title", onAct: () => copy(t.title) }],
|
|
70
|
+
}}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Choosing rows
|
|
74
|
+
|
|
75
|
+
| `choose` field | Is |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| `chosen` | the ticked ids |
|
|
78
|
+
| `onChange` | hears the set a tick makes: apply your rule to it and return the ruled set through `chosen` |
|
|
79
|
+
| `picked`, `onPick` | in place of `chosen` and `onChange` over a paginated read: a `Picked`, the ids or the query less the ids unticked, which the head tick sets to the whole query and a mutation takes whole (`selector()` of `@slotform/api`) |
|
|
80
|
+
| `blocked` | reads why a row cannot be ticked from its item, a short phrase under its leading cell |
|
|
81
|
+
| `moved` | reads why a rule moved a row's tick, the same way |
|
|
82
|
+
|
|
83
|
+
The acts that apply to the ticked rows are the `Pane`'s `foot`, which the route gives: an `ActionBar` with `chosen` ([acts](./acts.md#the-chosen-bar)), whose `blocked` reasons you read off your own `chosen`.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
const reach = rows.filter((row) => !held(row)).map((row) => row.id);
|
|
87
|
+
|
|
88
|
+
<Pane
|
|
89
|
+
title="Changes"
|
|
90
|
+
foot={
|
|
91
|
+
<ActionBar
|
|
92
|
+
acts={[publish]}
|
|
93
|
+
chosen={{ count: ids.length, of: reach.length, noun: "promotable", onAll: (all) => setIds(ruled(all ? reach : [])) }}
|
|
94
|
+
/>
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
<Table items={rows} choose={{ chosen: ids, onChange: (next) => setIds(ruled(next)), blocked: held }} … />
|
|
98
|
+
</Pane>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Keys
|
|
102
|
+
|
|
103
|
+
The grid is one Tab stop and its keyboard is a cell cursor: the arrows move by a cell, PageUp and PageDown by a page of rows (a row off the loaded window scrolls into view and its page loads), Home and End along the row and Ctrl with them to the first and last cell; the active row washes along its width.
|
|
104
|
+
|
|
105
|
+
| Key | Does |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| Enter | opens the active row from any cell (its `href` or `onOpen`); on an editable cell it starts the edit; where the row opens nothing it runs the row's `act` |
|
|
108
|
+
| Shift+Enter | runs the row's `act` from any cell |
|
|
109
|
+
| Context Menu, Shift+F10 | opens the row's `more` |
|
|
110
|
+
| Enter or Space on the acts cell | presses its act, else its menu |
|
|
111
|
+
| Space, `x` | with `choose`, ticks the active row |
|
|
112
|
+
| Shift+Up, Shift+Down | with `choose`, ticks the loaded rows the cursor crosses; turning back unticks them |
|
|
113
|
+
| Alt+Up, Down, Home, End | with `reorder`, moves the active row |
|
|
114
|
+
|
|
115
|
+
A key runs the act as a press does (confirm, run, toast, go). The act icons stay out of the Tab order. Without `choose` Space is not claimed: the grid leaves it unprevented, and a `Dock` takes it, which also skips a key the grid took (`preventDefault`) and the arrows while focus is in a `role="grid"`.
|
|
116
|
+
|
|
117
|
+
## On touch
|
|
118
|
+
|
|
119
|
+
A `Table` on touch is one row per record: each status column a status badge with its tone mark (the first leads the row's badges; several say their column, `Staging: Passing`), a column of changes and a column with `wrap` its `line` (several joined by "; "), a value longer than the short measure its `line` too, said whole with its column's label, and values of a kind that stands in several columns each saying their column. The sort's pick stands bare above the list.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
language js(typescript, jsx)
|
|
2
|
+
|
|
3
|
+
// A utility with a bracketed value (`h-[34px]`, `bg-[#fff]`, `grid-cols-[1fr_2fr]`). A variant or a
|
|
4
|
+
// selector in brackets (`[&>svg]:size-4`, `data-[open]:flex`, `min-[400px]:flex`) is followed by `:`.
|
|
5
|
+
jsx_attribute(name=$n) as $a where {
|
|
6
|
+
$n <: r"(?:class|className)",
|
|
7
|
+
$a <: r"(?s).*[a-z]-\[[^\]\s]+\](?:[^:].*|$)",
|
|
8
|
+
register_diagnostic(span=$a, message="A class takes tokens, never an arbitrary value")
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
language js(typescript, jsx)
|
|
2
|
+
|
|
3
|
+
// A component takes no class, className, classList or style.
|
|
4
|
+
jsx_attribute(name=$n) as $a where {
|
|
5
|
+
$n <: r"(?:class|className|classList|style)",
|
|
6
|
+
$a <: within or {
|
|
7
|
+
jsx_opening_element(name=$t),
|
|
8
|
+
jsx_self_closing_element(name=$t)
|
|
9
|
+
},
|
|
10
|
+
$t <: r"[A-Z].*",
|
|
11
|
+
register_diagnostic(span=$a, message="A component takes no class, className, classList or style")
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
language js(typescript, jsx)
|
|
2
|
+
|
|
3
|
+
// An element of your own takes no `data-density`: a screen read from across a room declares `distance` on its `Panes`.
|
|
4
|
+
|
|
5
|
+
jsx_attribute(name=$n) as $a where {
|
|
6
|
+
$n <: r"data-density",
|
|
7
|
+
register_diagnostic(span=$a, message="Never a density of your own on an element: a screen read from across a room declares its distance, and a narrow desktop window pins <html> outside JSX")
|
|
8
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
language js(typescript, jsx)
|
|
2
|
+
|
|
3
|
+
// A look on a host element, matched per whitespace token of the class string: a fill, radius, border,
|
|
4
|
+
// shadow, weight or transition, or a numeric dimension. A token is preceded by a quote, a space, a
|
|
5
|
+
// variant's colon or `!`. Each branch skips its own reset (`bg-none`, `border-0`), which is no look.
|
|
6
|
+
jsx_attribute(name=$n) as $a where {
|
|
7
|
+
$n <: r"(?:class|className)",
|
|
8
|
+
$a <: within or {
|
|
9
|
+
jsx_opening_element(name=$t),
|
|
10
|
+
jsx_self_closing_element(name=$t)
|
|
11
|
+
},
|
|
12
|
+
$t <: r"[a-z].*",
|
|
13
|
+
or {
|
|
14
|
+
and {
|
|
15
|
+
$a <: r"(?s).*[\s\"'`:!]bg-[^\s\"'`]+(?:[\s\"'`].*|$)",
|
|
16
|
+
not $a <: r"(?s).*[\s\"'`:!]bg-none(?:[\s\"'`].*|$)"
|
|
17
|
+
},
|
|
18
|
+
and {
|
|
19
|
+
$a <: r"(?s).*[\s\"'`:!]rounded(?:-[^\s\"'`]+)?(?:[\s\"'`].*|$)",
|
|
20
|
+
not $a <: r"(?s).*[\s\"'`:!]rounded-none(?:[\s\"'`].*|$)"
|
|
21
|
+
},
|
|
22
|
+
and {
|
|
23
|
+
$a <: r"(?s).*[\s\"'`:!]shadow(?:-[^\s\"'`]+)?(?:[\s\"'`].*|$)",
|
|
24
|
+
not $a <: r"(?s).*[\s\"'`:!]shadow-none(?:[\s\"'`].*|$)"
|
|
25
|
+
},
|
|
26
|
+
and {
|
|
27
|
+
$a <: r"(?s).*[\s\"'`:!]transition(?:-[^\s\"'`]+)?(?:[\s\"'`].*|$)",
|
|
28
|
+
not $a <: r"(?s).*[\s\"'`:!]transition-none(?:[\s\"'`].*|$)"
|
|
29
|
+
},
|
|
30
|
+
and {
|
|
31
|
+
$a <: r"(?s).*[\s\"'`:!]border(?:-[^\s\"'`]+)?(?:[\s\"'`].*|$)",
|
|
32
|
+
not $a <: r"(?s).*[\s\"'`:!]border(?:-[xytrblse])?-(?:0|none)(?:[\s\"'`].*|$)"
|
|
33
|
+
},
|
|
34
|
+
$a <: r"(?s).*[\s\"'`:!](?:font|duration|ease|delay)-[^\s\"'`]+(?:[\s\"'`].*|$)",
|
|
35
|
+
$a <: r"(?s).*[\s\"'`:!]-?(?:size|[wh]|min-[wh]|max-[wh]|[pm][xytrblse]?|gap(?:-[xy])?|space-[xy]|inset(?:-[xy])?|top|right|bottom|left|start|end)-(?:[1-9][0-9]*(?:\.[0-9]+)?|0\.[0-9]+)(?:[\s\"'`].*|$)"
|
|
36
|
+
},
|
|
37
|
+
register_diagnostic(span=$a, message="A host element carries geometry only, never a look: fill, radius, border, shadow, weight, transition or a numeric dimension")
|
|
38
|
+
}
|
package/lint/no-img.grit
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
language js(typescript, jsx)
|
|
2
|
+
|
|
3
|
+
// An act whose `onAct` only calls `navigate(...)` is a link act, `{ label, href }`
|
|
4
|
+
// (guide/rules.md, "A route act is a link"). The call may be an expression body
|
|
5
|
+
// or the only statement of a block body, whatever its argument (a path or a
|
|
6
|
+
// `{ to, params }`).
|
|
7
|
+
or {
|
|
8
|
+
`onAct: () => navigate($route)`,
|
|
9
|
+
`onAct: () => { navigate($route) }`,
|
|
10
|
+
`onAct: () => { navigate($route); }`,
|
|
11
|
+
`onAct: () => { return navigate($route) }`,
|
|
12
|
+
`onAct: () => { return navigate($route); }`,
|
|
13
|
+
`onAct: function () { navigate($route) }`,
|
|
14
|
+
`onAct() { navigate($route) }`,
|
|
15
|
+
`onAct: async () => navigate($route)`,
|
|
16
|
+
`onAct: async () => { await navigate($route) }`,
|
|
17
|
+
`onAct={() => navigate($route)}`,
|
|
18
|
+
`onAct={() => { navigate($route) }}`,
|
|
19
|
+
`onAct={() => { navigate($route); }}`
|
|
20
|
+
} as $act where {
|
|
21
|
+
register_diagnostic(span=$act, message="An act whose onAct only calls navigate(...) is a link act: give { label, href } (rules.md, A route act is a link)")
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
language js(typescript, jsx)
|
|
2
|
+
|
|
3
|
+
// A literal colour or a raw pixel size in a `style`.
|
|
4
|
+
jsx_attribute(name=$n) as $a where {
|
|
5
|
+
$n <: r"style",
|
|
6
|
+
$a <: r"(?s).*(?:#[0-9a-fA-F]{3,8}\b|\b(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\(|\b[0-9]+(?:\.[0-9]+)?px\b).*",
|
|
7
|
+
register_diagnostic(span=$a, message="Every colour and size is a contract token, never a literal colour or a raw pixel size")
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,153 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slotform/react-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "The web half of the Slotform design system: the @slotform/ui-core contract rendered on Tailwind v4, with the roster.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/fcalell/slotform.git",
|
|
9
|
+
"directory": "plugins/react-ui"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/fcalell/slotform/tree/master/plugins/react-ui#readme",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=24.14.0"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"sideEffects": [
|
|
20
|
+
"**/*.css"
|
|
21
|
+
],
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./node/fonts": {
|
|
28
|
+
"types": "./dist/node/fonts.d.ts",
|
|
29
|
+
"default": "./dist/node/fonts.js"
|
|
30
|
+
},
|
|
31
|
+
"./node/canvas": {
|
|
32
|
+
"types": "./dist/node/canvas.d.ts",
|
|
33
|
+
"default": "./dist/node/canvas.js"
|
|
34
|
+
},
|
|
35
|
+
"./node/mode": {
|
|
36
|
+
"types": "./dist/node/mode.d.ts",
|
|
37
|
+
"default": "./dist/node/mode.js"
|
|
38
|
+
},
|
|
39
|
+
"./density": {
|
|
40
|
+
"types": "./dist/density.d.ts",
|
|
41
|
+
"default": "./dist/density.js"
|
|
42
|
+
},
|
|
43
|
+
"./globals.css": "./src/ui/globals.css",
|
|
44
|
+
"./components/action-bar": "./src/ui/components/action-bar/index.tsx",
|
|
45
|
+
"./components/banner": "./src/ui/components/banner/index.tsx",
|
|
46
|
+
"./components/bar-chart": "./src/ui/components/bar-chart/index.tsx",
|
|
47
|
+
"./components/button": "./src/ui/components/button/index.tsx",
|
|
48
|
+
"./components/canvas": "./src/ui/components/canvas/index.tsx",
|
|
49
|
+
"./components/card": "./src/ui/components/card/index.tsx",
|
|
50
|
+
"./components/code": "./src/ui/components/code/index.tsx",
|
|
51
|
+
"./components/columns": "./src/ui/components/columns/index.tsx",
|
|
52
|
+
"./components/diff": "./src/ui/components/diff/index.tsx",
|
|
53
|
+
"./components/dock": "./src/ui/components/dock/index.tsx",
|
|
54
|
+
"./components/form": "./src/ui/components/form/index.tsx",
|
|
55
|
+
"./components/gate": "./src/ui/components/gate/index.tsx",
|
|
56
|
+
"./components/gallery": "./src/ui/components/gallery/index.tsx",
|
|
57
|
+
"./components/image": "./src/ui/components/image/index.tsx",
|
|
58
|
+
"./components/input": "./src/ui/components/input/index.tsx",
|
|
59
|
+
"./components/pane": "./src/ui/components/pane/index.tsx",
|
|
60
|
+
"./components/picker": "./src/ui/components/picker/index.tsx",
|
|
61
|
+
"./components/prose": "./src/ui/components/prose/index.tsx",
|
|
62
|
+
"./components/qr-code": "./src/ui/components/qr-code/index.tsx",
|
|
63
|
+
"./components/rules": "./src/ui/components/rules/index.tsx",
|
|
64
|
+
"./components/section": "./src/ui/components/section/index.tsx",
|
|
65
|
+
"./components/sheet": "./src/ui/components/sheet/index.tsx",
|
|
66
|
+
"./components/shell": "./src/ui/components/shell/index.tsx",
|
|
67
|
+
"./components/slider": "./src/ui/components/slider/index.tsx",
|
|
68
|
+
"./components/stages": "./src/ui/components/stages/index.tsx",
|
|
69
|
+
"./components/stats": "./src/ui/components/stats/index.tsx",
|
|
70
|
+
"./components/switch": "./src/ui/components/switch/index.tsx",
|
|
71
|
+
"./components/table": "./src/ui/components/table/index.tsx",
|
|
72
|
+
"./components/text": "./src/ui/components/text/index.tsx",
|
|
73
|
+
"./components/thread": "./src/ui/components/thread/index.tsx",
|
|
74
|
+
"./components/toolbar": "./src/ui/components/toolbar/index.tsx",
|
|
75
|
+
"./components/waveform": "./src/ui/components/waveform/index.tsx",
|
|
76
|
+
"./lib/act": "./src/ui/lib/act.ts",
|
|
77
|
+
"./lib/age": "./src/ui/lib/age.ts",
|
|
78
|
+
"./lib/canvas-layout": "./src/ui/lib/canvas-layout.ts",
|
|
79
|
+
"./lib/lockup": "./src/ui/lib/lockup.tsx",
|
|
80
|
+
"./lib/media": "./src/ui/lib/media.ts",
|
|
81
|
+
"./lib/moment": "./src/ui/lib/moment.ts",
|
|
82
|
+
"./lib/navigate": "./src/ui/lib/navigate.ts",
|
|
83
|
+
"./lib/not-found": "./src/ui/lib/not-found.tsx",
|
|
84
|
+
"./lib/player": "./src/ui/lib/player.ts",
|
|
85
|
+
"./lib/toast": "./src/ui/lib/toast.ts"
|
|
86
|
+
},
|
|
87
|
+
"files": [
|
|
88
|
+
"dist",
|
|
89
|
+
"src",
|
|
90
|
+
"guide",
|
|
91
|
+
"lint",
|
|
92
|
+
"README.md",
|
|
93
|
+
"LICENSE",
|
|
94
|
+
"!src/**/*.test.ts",
|
|
95
|
+
"!src/**/__fixtures__",
|
|
96
|
+
"!dist/**/*.test.*"
|
|
97
|
+
],
|
|
98
|
+
"peerDependencies": {
|
|
99
|
+
"@tailwindcss/vite": "^4.3.5",
|
|
100
|
+
"react": "^19.3.0",
|
|
101
|
+
"react-dom": "^19.3.0",
|
|
102
|
+
"tailwindcss": "^4.3.5",
|
|
103
|
+
"zod": "^4.6.7"
|
|
104
|
+
},
|
|
105
|
+
"peerDependenciesMeta": {
|
|
106
|
+
"@tailwindcss/vite": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"tailwindcss": {
|
|
110
|
+
"optional": true
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"dependencies": {
|
|
114
|
+
"@base-ui/react": "^1.9.0",
|
|
115
|
+
"@slotform/cli": "^0.1.1",
|
|
116
|
+
"@slotform/auth": "^0.1.1",
|
|
117
|
+
"@slotform/react": "^0.1.1",
|
|
118
|
+
"@slotform/screens": "^0.1.1",
|
|
119
|
+
"@slotform/vite": "^0.1.1",
|
|
120
|
+
"@slotform/ui-core": "^0.1.1",
|
|
121
|
+
"@fontsource-variable/ibm-plex-sans": "^5.3.0",
|
|
122
|
+
"@fontsource/ibm-plex-mono": "^5.3.0",
|
|
123
|
+
"@tanstack/react-virtual": "~3.14.26",
|
|
124
|
+
"@types/d3-selection": "^3.0.11",
|
|
125
|
+
"@types/d3-zoom": "^3.0.8",
|
|
126
|
+
"d3-selection": "^3.0.1",
|
|
127
|
+
"d3-zoom": "^3.0.1",
|
|
128
|
+
"diff": "^9.0.0",
|
|
129
|
+
"elkjs": "^0.12.1",
|
|
130
|
+
"lucide": "^1.73.0",
|
|
131
|
+
"lucide-react": "^1.73.0",
|
|
132
|
+
"marked": "^18.2.0"
|
|
133
|
+
},
|
|
134
|
+
"devDependencies": {
|
|
135
|
+
"@slotform/typescript-config": "^0.1.1",
|
|
136
|
+
"@tailwindcss/vite": "^4.3.5",
|
|
137
|
+
"@types/node": "^26.6.6",
|
|
138
|
+
"@types/react": "^19.3.0",
|
|
139
|
+
"@types/react-dom": "^19.3.0",
|
|
140
|
+
"react": "19.3.0",
|
|
141
|
+
"react-dom": "19.3.0",
|
|
142
|
+
"tailwindcss": "^4.3.5",
|
|
143
|
+
"typescript": "^7.0.2",
|
|
144
|
+
"vite": "^8.3.8",
|
|
145
|
+
"zod": "^4.6.7"
|
|
146
|
+
},
|
|
147
|
+
"scripts": {
|
|
148
|
+
"build": "tsc -p tsconfig.build.json",
|
|
149
|
+
"check-types": "tsc --noEmit --pretty",
|
|
150
|
+
"test": "node --test 'src/**/*.test.ts'",
|
|
151
|
+
"clear": "rm -rf dist node_modules .turbo"
|
|
152
|
+
}
|
|
6
153
|
}
|
package/src/density.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BREAKPOINT_PX } from "@slotform/ui-core/tokens";
|
|
2
|
+
|
|
3
|
+
// The density rule, one query for the layer, `touch:` and `useTouch`: docs/architecture/plugins/react-ui.md, "Density".
|
|
4
|
+
export const DESKTOP_MEDIA = `(pointer: fine) and (width >= ${BREAKPOINT_PX.tablet}px)`;
|
|
5
|
+
export const TOUCH_MEDIA = `not (${DESKTOP_MEDIA})`;
|
|
6
|
+
|
|
7
|
+
// The room set draws under the attribute, on the root as a pin or on the
|
|
8
|
+
// `Panes` that declares its `distance`: no query detects the viewing distance.
|
|
9
|
+
export const ROOM_SCOPE = '[data-density="room"]';
|