viewkitjs 0.30.1 → 0.32.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.
Files changed (298) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/MIGRATION.md +40 -6
  3. package/README.md +1 -1
  4. package/fields/dist/query/index.d.ts +2 -0
  5. package/fields/dist/query/index.js +2 -0
  6. package/fields/dist/query/list-request.d.ts +148 -0
  7. package/fields/dist/query/list-request.js +125 -0
  8. package/fields/dist/query/saved-view.d.ts +15 -0
  9. package/fields/dist/query/saved-view.js +11 -0
  10. package/fields/dist/query/settings.d.ts +9 -0
  11. package/fields/dist/query/settings.js +9 -0
  12. package/fields/docs/reference/query.md +66 -0
  13. package/package.json +8 -2
  14. package/postgres/README.md +1 -0
  15. package/postgres/dist/handler.d.ts +53 -0
  16. package/postgres/dist/handler.js +211 -0
  17. package/postgres/dist/ids.d.ts +1 -1
  18. package/postgres/dist/ids.js +19 -1
  19. package/postgres/dist/index.d.ts +1 -0
  20. package/postgres/dist/index.js +1 -0
  21. package/postgres/dist/limits.d.ts +3 -1
  22. package/postgres/dist/limits.js +1 -1
  23. package/postgres/dist/list-fields.d.ts +10 -0
  24. package/postgres/dist/list-fields.js +36 -0
  25. package/postgres/dist/readable.d.ts +4 -0
  26. package/postgres/dist/readable.js +4 -0
  27. package/postgres/dist/refusals.d.ts +9 -2
  28. package/postgres/dist/refusals.js +6 -0
  29. package/postgres/docs/guides/field-map.md +2 -2
  30. package/postgres/docs/guides/list-handler.md +99 -0
  31. package/postgres/docs/index.md +1 -0
  32. package/postgres/docs/reference/postgres.md +11 -3
  33. package/views/README.md +2 -2
  34. package/views/dist/atoms/RowMenu.d.ts +7 -0
  35. package/views/dist/atoms/RowMenu.js +18 -16
  36. package/views/dist/atoms/carried.d.ts +5 -0
  37. package/views/dist/atoms/carried.js +7 -0
  38. package/views/dist/atoms/types.d.ts +3 -0
  39. package/views/dist/contract.d.ts +26 -6
  40. package/views/dist/contract.js +25 -0
  41. package/views/dist/controls/alert-dialog/alert-dialog.js +2 -1
  42. package/views/dist/controls/atoms.d.ts +2 -0
  43. package/views/dist/controls/atoms.js +2 -0
  44. package/views/dist/controls/avatar/avatar.d.ts +10 -4
  45. package/views/dist/controls/avatar/avatar.js +5 -3
  46. package/views/dist/controls/avatar/tokens.d.ts +104 -0
  47. package/views/dist/controls/avatar/tokens.js +26 -0
  48. package/views/dist/controls/avatar.css +46 -15
  49. package/views/dist/controls/choice/tokens.d.ts +0 -4
  50. package/views/dist/controls/choice/tokens.js +0 -1
  51. package/views/dist/controls/choice.css +3 -3
  52. package/views/dist/controls/controls.d.ts +6 -0
  53. package/views/dist/controls/controls.js +10 -2
  54. package/views/dist/controls/customize/map-customize-body.js +1 -1
  55. package/views/dist/controls/field/field.d.ts +19 -4
  56. package/views/dist/controls/field/field.js +63 -5
  57. package/views/dist/controls/field/tokens.d.ts +4 -0
  58. package/views/dist/controls/field/tokens.js +1 -0
  59. package/views/dist/controls/field.css +41 -16
  60. package/views/dist/controls/glyphs/glyphs.d.ts +10 -0
  61. package/views/dist/controls/glyphs/glyphs.js +173 -0
  62. package/views/dist/controls/index.d.ts +4 -2
  63. package/views/dist/controls/index.js +3 -1
  64. package/views/dist/controls/input/input.d.ts +12 -1
  65. package/views/dist/controls/input/input.js +10 -6
  66. package/views/dist/controls/input/save-mark.d.ts +8 -0
  67. package/views/dist/controls/input/save-mark.js +26 -0
  68. package/views/dist/controls/input/tokens.d.ts +20 -0
  69. package/views/dist/controls/input/tokens.js +5 -0
  70. package/views/dist/controls/input.css +49 -3
  71. package/views/dist/controls/internal/icons.js +10 -0
  72. package/views/dist/controls/internal/keep-focus.d.ts +2 -0
  73. package/views/dist/controls/internal/keep-focus.js +17 -0
  74. package/views/dist/controls/internal/watch-frame.d.ts +2 -0
  75. package/views/dist/controls/internal/watch-frame.js +33 -0
  76. package/views/dist/controls/markdown/map-markdown.d.ts +4 -0
  77. package/views/dist/controls/markdown/map-markdown.js +5 -0
  78. package/views/dist/controls/menu/map-menu.js +2 -2
  79. package/views/dist/controls/menu-list/menu-list.d.ts +3 -0
  80. package/views/dist/controls/menu-list/menu-list.js +5 -4
  81. package/views/dist/controls/modal/modal.js +5 -1
  82. package/views/dist/controls/pane/pane.js +2 -1
  83. package/views/dist/controls/phone-header/header-bar.d.ts +5 -1
  84. package/views/dist/controls/phone-header/header-bar.js +2 -2
  85. package/views/dist/controls/phone-header.css +11 -1
  86. package/views/dist/controls/picker/map-picker.js +3 -0
  87. package/views/dist/controls/picker/picker.d.ts +14 -0
  88. package/views/dist/controls/picker/picker.js +30 -10
  89. package/views/dist/controls/picker.css +2 -0
  90. package/views/dist/controls/popover/popover.js +2 -1
  91. package/views/dist/controls/radio/radio.d.ts +12 -3
  92. package/views/dist/controls/radio/radio.js +25 -5
  93. package/views/dist/controls/radio/tokens.d.ts +84 -0
  94. package/views/dist/controls/radio/tokens.js +21 -0
  95. package/views/dist/controls/radio.css +130 -3
  96. package/views/dist/controls/select/select.d.ts +12 -2
  97. package/views/dist/controls/select/select.js +15 -7
  98. package/views/dist/controls/select/tokens.d.ts +8 -0
  99. package/views/dist/controls/select/tokens.js +2 -0
  100. package/views/dist/controls/select.css +17 -0
  101. package/views/dist/controls/setting-row/looks.d.ts +10 -0
  102. package/views/dist/controls/setting-row/looks.js +22 -0
  103. package/views/dist/controls/setting-row/setting-row.d.ts +100 -0
  104. package/views/dist/controls/setting-row/setting-row.js +133 -0
  105. package/views/dist/controls/setting-row/tokens.d.ts +156 -0
  106. package/views/dist/controls/setting-row/tokens.js +41 -0
  107. package/views/dist/controls/setting-row.css +215 -0
  108. package/views/dist/controls/sheet/bottom-sheet.d.ts +10 -2
  109. package/views/dist/controls/sheet/bottom-sheet.js +6 -3
  110. package/views/dist/controls/sheet.css +4 -1
  111. package/views/dist/controls/sort-editor/sort-editor.js +3 -2
  112. package/views/dist/controls/sort-editor.css +8 -2
  113. package/views/dist/controls/switch-row/switch-row.d.ts +1 -15
  114. package/views/dist/controls/switch-row/switch-row.js +1 -9
  115. package/views/dist/controls/switch-row/tokens.d.ts +0 -12
  116. package/views/dist/controls/switch-row/tokens.js +0 -3
  117. package/views/dist/controls/switch-row.css +3 -7
  118. package/views/dist/controls/switch.css +17 -7
  119. package/views/dist/controls/tag/tag.d.ts +3 -1
  120. package/views/dist/controls/tag/tag.js +2 -2
  121. package/views/dist/controls/tag/tokens.d.ts +4 -0
  122. package/views/dist/controls/tag/tokens.js +1 -0
  123. package/views/dist/controls/tag-field/tag-field.d.ts +5 -1
  124. package/views/dist/controls/tag-field/tag-field.js +11 -5
  125. package/views/dist/controls/tag-field/tokens.d.ts +16 -0
  126. package/views/dist/controls/tag-field/tokens.js +4 -0
  127. package/views/dist/controls/tag-field.css +19 -0
  128. package/views/dist/controls/tag.css +2 -0
  129. package/views/dist/controls/tokens.js +2 -0
  130. package/views/dist/controls/toolbar/toolbar.d.ts +15 -3
  131. package/views/dist/controls/toolbar/toolbar.js +22 -15
  132. package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +14 -0
  133. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +51 -0
  134. package/views/dist/controls/toolbar-button/toolbar-button.d.ts +1 -1
  135. package/views/dist/controls/toolbar-button/toolbar-button.js +2 -3
  136. package/views/dist/controls/toolbar-button.css +4 -0
  137. package/views/dist/controls/toolbar.css +5 -0
  138. package/views/dist/controls/views-list/map-view-menu.d.ts +3 -0
  139. package/views/dist/controls/views-list/map-view-menu.js +25 -0
  140. package/views/dist/controls/views-list/map-views-list-body.d.ts +28 -1
  141. package/views/dist/controls/views-list/map-views-list-body.js +39 -21
  142. package/views/dist/controls/views-list/rules.d.ts +2 -0
  143. package/views/dist/controls/views-list/view-menu.d.ts +7 -0
  144. package/views/dist/controls/views-list/view-menu.js +28 -24
  145. package/views/dist/controls/views-list/words.d.ts +2 -0
  146. package/views/dist/controls/views-list/words.js +1 -1
  147. package/views/dist/editors/EditorPanel.js +2 -1
  148. package/views/dist/editors/edit-session.js +2 -5
  149. package/views/dist/field-row/FieldRow.d.ts +4 -2
  150. package/views/dist/field-row/FieldRow.js +67 -20
  151. package/views/dist/field-row/FieldRowLane.d.ts +7 -2
  152. package/views/dist/field-row/FieldRowLane.js +4 -3
  153. package/views/dist/field-row/editors/RowEditor.d.ts +12 -0
  154. package/views/dist/field-row/editors/RowEditor.js +31 -1
  155. package/views/dist/field-row/editors/RowValueListEditor.d.ts +5 -1
  156. package/views/dist/field-row/editors/RowValueListEditor.js +4 -1
  157. package/views/dist/field-row/field-row-button.d.ts +5 -0
  158. package/views/dist/field-row/field-row-button.js +2 -0
  159. package/views/dist/fields/binding.d.ts +3 -2
  160. package/views/dist/fields/binding.js +38 -5
  161. package/views/dist/grid/chrome/GridColumnMenu.d.ts +4 -2
  162. package/views/dist/grid/chrome/GridColumnMenu.js +3 -2
  163. package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -1
  164. package/views/dist/grid/chrome/GridGroupMenu.js +4 -3
  165. package/views/dist/grid/chrome/GridHeader.d.ts +4 -1
  166. package/views/dist/grid/chrome/GridHeader.js +2 -2
  167. package/views/dist/grid/chrome/GridRow.js +6 -5
  168. package/views/dist/grid/chrome/GridRowCells.js +6 -9
  169. package/views/dist/grid/chrome/GridStructure.d.ts +4 -1
  170. package/views/dist/grid/chrome/GridStructure.js +4 -4
  171. package/views/dist/grid/chrome/GridTable.js +5 -2
  172. package/views/dist/grid/chrome/grid-column-menu-items.js +1 -1
  173. package/views/dist/grid/chrome/grid-row-menu-items.d.ts +27 -3
  174. package/views/dist/grid/chrome/grid-row-menu-items.js +92 -6
  175. package/views/dist/grid/chrome/grid-row-props.d.ts +7 -2
  176. package/views/dist/grid/chrome/grid-rows-menu.js +34 -6
  177. package/views/dist/grid/chrome/grid-table-props.d.ts +38 -7
  178. package/views/dist/grid/chrome/useGridBatchApi.d.ts +3 -1
  179. package/views/dist/grid/chrome/useGridBatchApi.js +4 -2
  180. package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -2
  181. package/views/dist/grid/chrome/useGridKeyboard.js +15 -9
  182. package/views/dist/grid/chrome/useGridPendingReconciliation.js +1 -2
  183. package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
  184. package/views/dist/grid/chrome/useGridTableInteractionModel.js +11 -5
  185. package/views/dist/grid/core/commit-model.d.ts +20 -2
  186. package/views/dist/grid/core/editing-controller.d.ts +18 -0
  187. package/views/dist/grid/core/editing-controller.js +188 -42
  188. package/views/dist/grid/core/editing-model.d.ts +3 -0
  189. package/views/dist/grid/core/editing-model.js +3 -0
  190. package/views/dist/grid/core/save-path.d.ts +24 -0
  191. package/views/dist/grid/core/save-path.js +122 -0
  192. package/views/dist/grid/core/spreadsheet-operations.d.ts +3 -0
  193. package/views/dist/grid/core/spreadsheet-operations.js +23 -0
  194. package/views/dist/grid/index.d.ts +3 -2
  195. package/views/dist/grid/index.js +1 -0
  196. package/views/dist/internal/field-rows.d.ts +26 -0
  197. package/views/dist/internal/field-rows.js +8 -0
  198. package/views/dist/internal/page-close.d.ts +7 -0
  199. package/views/dist/internal/page-close.js +43 -0
  200. package/views/dist/list/browser-views-store.d.ts +10 -0
  201. package/views/dist/list/browser-views-store.js +182 -0
  202. package/views/dist/list/index.d.ts +23 -0
  203. package/views/dist/list/index.js +8 -0
  204. package/views/dist/list/menu.d.ts +31 -0
  205. package/views/dist/list/menu.js +76 -0
  206. package/views/dist/list/parts.d.ts +6 -0
  207. package/views/dist/list/parts.js +59 -0
  208. package/views/dist/list/registry.d.ts +11 -0
  209. package/views/dist/list/registry.js +31 -0
  210. package/views/dist/list/root.d.ts +40 -0
  211. package/views/dist/list/root.js +128 -0
  212. package/views/dist/list/slot.d.ts +14 -0
  213. package/views/dist/list/slot.js +22 -0
  214. package/views/dist/list/source.d.ts +11 -0
  215. package/views/dist/list/source.js +31 -0
  216. package/views/dist/list/store.d.ts +87 -0
  217. package/views/dist/list/store.js +115 -0
  218. package/views/dist/list/toolbar.d.ts +6 -0
  219. package/views/dist/list/toolbar.js +359 -0
  220. package/views/dist/list/views-axis.d.ts +5 -0
  221. package/views/dist/list/views-axis.js +96 -0
  222. package/views/dist/list/views-store.d.ts +41 -0
  223. package/views/dist/list/views-store.js +1 -0
  224. package/views/dist/list/views.d.ts +67 -0
  225. package/views/dist/list/views.js +400 -0
  226. package/views/dist/looks/index.d.ts +1 -0
  227. package/views/dist/looks/index.js +1 -0
  228. package/views/dist/looks/pieces.js +2 -0
  229. package/views/dist/model/preferences.js +1 -1
  230. package/views/dist/model/prefs-buckets.js +1 -1
  231. package/views/dist/panels/index.d.ts +3 -1
  232. package/views/dist/panels/index.js +1 -0
  233. package/views/dist/panels/react/customize-body.js +1 -0
  234. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +41 -4
  235. package/views/dist/panels/react/toolbar/ReadyToolbar.js +6 -326
  236. package/views/dist/panels/react/toolbar/Toolbar.d.ts +9 -1
  237. package/views/dist/panels/react/toolbar/Toolbar.js +34 -23
  238. package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
  239. package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
  240. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +2 -2
  241. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +3 -1
  242. package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
  243. package/views/dist/panels/react/toolbar/context.d.ts +10 -2
  244. package/views/dist/panels/react/toolbar/context.js +3 -1
  245. package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +1 -1
  246. package/views/dist/panels/react/views-row/FoldingViewRow.js +15 -4
  247. package/views/dist/panels/react/views-row/PillGroup.d.ts +5 -2
  248. package/views/dist/panels/react/views-row/PillGroup.js +16 -7
  249. package/views/dist/panels/react/views-row/ViewPicker.js +2 -12
  250. package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +4 -2
  251. package/views/dist/panels/react/views-row/ViewPickerRow.js +9 -5
  252. package/views/dist/panels/react.d.ts +2 -2
  253. package/views/dist/panels/toolbar/edit-view.d.ts +7 -1
  254. package/views/dist/panels/toolbar/edit-view.js +14 -0
  255. package/views/dist/panels/toolbar/model.d.ts +5 -0
  256. package/views/dist/panels/toolbar/model.js +7 -3
  257. package/views/dist/panels/view-state.d.ts +5 -3
  258. package/views/dist/panels/views-row/model.d.ts +19 -2
  259. package/views/dist/panels/views-row/model.js +14 -0
  260. package/views/dist/provider/ViewsProvider.d.ts +16 -7
  261. package/views/dist/provider/ViewsProvider.js +23 -5
  262. package/views/dist/provider/components.d.ts +43 -2
  263. package/views/dist/provider/context.d.ts +2 -1
  264. package/views/dist/provider/context.js +1 -1
  265. package/views/dist/provider/ports.d.ts +19 -12
  266. package/views/dist/provider/ports.js +69 -1
  267. package/views/dist/react.d.ts +1 -1
  268. package/views/dist/styles.css +583 -61
  269. package/views/dist/styles.unlayered.css +583 -61
  270. package/views/docs/contract.md +42 -31
  271. package/views/docs/controls/avatar.md +26 -0
  272. package/views/docs/controls/choice.md +0 -1
  273. package/views/docs/controls/field.md +3 -0
  274. package/views/docs/controls/input.md +9 -0
  275. package/views/docs/controls/radio.md +33 -0
  276. package/views/docs/controls/select.md +6 -0
  277. package/views/docs/controls/setting-row.md +44 -0
  278. package/views/docs/controls/switch-row.md +0 -3
  279. package/views/docs/controls/tag-field.md +4 -0
  280. package/views/docs/controls/tag.md +1 -0
  281. package/views/docs/getting-started.md +2 -2
  282. package/views/docs/guides/atoms.md +2 -2
  283. package/views/docs/guides/columns.md +1 -1
  284. package/views/docs/guides/ports.md +1 -1
  285. package/views/docs/guides/the-grid.md +34 -7
  286. package/views/docs/guides/the-provider.md +4 -2
  287. package/views/docs/index.md +1 -0
  288. package/views/docs/reference/controls.md +54 -27
  289. package/views/docs/reference/editors-session.md +1 -1
  290. package/views/docs/reference/field-row.md +9 -1
  291. package/views/docs/reference/grid.md +14 -8
  292. package/views/docs/reference/list.md +227 -0
  293. package/views/docs/reference/looks.md +3 -0
  294. package/views/docs/reference/panels-react.md +17 -12
  295. package/views/docs/reference/panels.md +8 -5
  296. package/views/docs/reference/react.md +11 -9
  297. package/views/docs/reference/views.md +2 -2
  298. package/views/skills/views/SKILL.md +9 -6
package/CHANGELOG.md CHANGED
@@ -5,6 +5,149 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.32.0] — 2026-12-03
9
+
10
+ ### Added
11
+
12
+ - `viewkitjs/views/grid`: `GridTable`'s `menus.row` may answer a promise, for a host whose verbs depend on the row and its server. It is asked once each time a row's menu opens (a right-click, the row's ⋯, the menu key), never for a row drawn or pressed; until it answers, the menu holds one greyed row with the `loading` glyph, "Loading…" (`row-waiting`, the new message `views.menus.row-waiting`), and none of the rows the answer may take away. An answer a later opening has outrun is dropped; one that fails draws the grid's own rows. A `menus.row` that answers at once draws as before.
13
+ - `viewkitjs/views/grid`: under `menus.row`, a row's Open page and Delete are among its items, `row-open` and `row-delete` (Delete still asking the `confirm` port), so a host offers Delete on some rows and not others by dropping `row-delete`; the `RowMenu` atom is then handed no `openHref` or `onDelete`. Without `menus.row`, the atom draws them as before.
14
+ - `viewkitjs/views/list`: a list's saved views behind a store ViewKit owns. A `ListRoot` handed no `settings` keeps the list's saved views, each person's draft over a view and their own layer through a `ViewsStore`: `browserViewsStore()` by default, in `localStorage` and followed across tabs, or your app's own store over its API. Hand your own views as `views={{ seed }}` (listed first, read-only), the list's start as `defaults`, and the address's reading as `link`. `ListToolbar` draws the views row from it: open, save, save as new view, rename, duplicate, delete with Undo through ViewKit's toast, reorder by dragging. New on the door: `browserViewsStore`, `BrowserViewsStoreOptions`, `ListViewsOptions`, `ListViewsState`, `SavedViewInput`, `ViewDraft`, `ViewSeed`, `ViewsStore`; `ListState.views`.
15
+ - A new word, `views.panels.view-save-own` ("Save"): a person's own view's Save, in its menu and Customize's foot.
16
+ - `viewkitjs/views/react`: `ViewsProvider` needs only `components`. `<ViewsProvider components={CONTROLS}>` draws every list with ViewKit's own glyphs, the browser's clipboard, a per-device store on `localStorage` and `en-US` in `UTC`. `icons`, `ports` and `conventions` are optional, and each port is optional on its own: hand only what your app does its own way, and what you hand wins.
17
+ - `viewkitjs/views/react`: a provider handed no `icons` draws each meaning through your components map's `AppIcon` by its name.
18
+ - `viewkitjs/views/react`: the ports' defaults: `haptics` that do nothing; the browser's own `clipboard`, resolving `false` and `null` where it refuses; a `viewPrefs` store keeping each value as JSON on `localStorage` at the package's own `vk:` key. Each reads the browser only when it is called, so a server render reaches none.
19
+ - `viewkitjs/views/react`: `conventions` default to `en-US` in `UTC`, one object, so the server and the browser draw the same.
20
+ - `viewkitjs/views/controls`: `CONTROLS.AppIcon` draws ViewKit's own glyph of each meaning's name (a Tabler icon as the Outright kit draws it), and `CONTROLS.Markdown` draws rich text as it stands, its line breaks kept, with no renderer. `CONTROLS` now fills every required slot.
21
+ - `viewkitjs/views/controls`: `CONTROL_ICONS`, ViewKit's default glyphs by meaning, for an app with its own `AppIcon` that keeps them: `icons={CONTROL_ICONS}`.
22
+ - `viewkitjs/views/grid`: `gridSave(save, { getRowId, values?, read? })`, the grid's two commit functions over one save your app gives, and its types `ListChange` and `ListSave`. Every write (an edit, a paste, a fill, an undo, a redo) is one `save` call per record with its cells' values merged, one call in flight per record, and what still waits is sent at once, marked `closing`, when the page closes. A cell whose `values` throws is refused alone; a save that rejects rolls back that record's cells; `stored` shows in the cells whose keys it holds.
23
+ - `viewkitjs/views/list`: `ListRoot` and `useList`. A list root holds one list's state (its settings, its open panel, its selection) in a store outside React, for every part inside it, wherever it stands. A part reads it with `useList(select)` and re-renders only when what it selected changes.
24
+ - `viewkitjs/views/list`: `ListToolbar`, the ready toolbar's parts reading the root around them, and the types `ListRootProps`, `ListState` and `ListToolbarProps`.
25
+ - `viewkitjs/views/list`: `ListSlot` and `ListFill`. Put `<ListSlot name="header" />` where you want it (your page header), and `<ListFill name="header">…</ListFill>` inside a `ListRoot`: what the fill holds draws in the slot and still reads and changes that list, as if it stood inside. With no slot of its name standing, a fill draws nothing. `ListSlotProps` and `ListFillProps` with them.
26
+ - `viewkitjs/views/list`: `useList(id, select, equal?)` reads a list by its root's `id` from anywhere under the `ViewsProvider` (a count in a page header, a drawer, a sidebar); `undefined` while no root of that id stands. `useList(select, equal?)` inside a root is unchanged.
27
+ - Each line of a `Toolbar` (the ready toolbar's row and its filter bar) draws `role="toolbar"` with its own name, from two new words: `views.panels.toolbar-row` ("List tools") and `views.panels.toolbar-bar` ("Sort and filters").
28
+ - `viewkitjs/views/list`: a list's menus hand you their default items as data (+ Add column takes no function yet). `ListMenus` holds a function per menu (`column`, `row`, `group`, `view`, `add`, `more`), each handed the menu's items, every row keyed, and returning the items it shows; a menu with no function is as before. `menu.drop`, `menu.rename`, `menu.add` and `menu.move` make the usual changes, pure, keeping dividers whole; `MenuPlace` says where a row goes (`{ after: key }` or `{ before: key }`). Every default key is listed in the reference ("Default keys").
29
+ - `viewkitjs/views/grid`: `GridTable`'s `menus` (`GridMenus`): `column(items, { field, column })`, `row(items, { row })` and `group(items, { group })` reshape a column's menu, a row's and a group band's.
30
+ - `viewkitjs/views/panels/react`: `ReadyToolbar`'s and `ListToolbar`'s `menus` (`ToolbarMenus`): `view(items, { view })` reshapes a view's menu, `add(items)` New's items (your `addItems`, or with `onAdd` alone one row keyed `new`), `more(items, { line })` the folded parts' ⋯, told which line's (`row` or `bar`). `Toolbar` takes `more` (`ToolbarMore`).
31
+ - `viewkitjs/views/panels`: `withViewMenu(views, fn)` sets a view's menu function on every axis, beside `withEditView`; `ViewMenuFn` is its type.
32
+ - `viewkitjs/views`: `ViewsMenuItem.render` draws a plain row's inside yourself, its `label` still its name; `ViewsViewVerbs.menu` is a view's menu as data; `ViewsRowMenuItem.key` names a row of the row's menu.
33
+ - `viewkitjs/postgres`: `listHandler({ map, run, access })` answers every list request a page makes, from a Fetch Request to a Response (Next, Hono, a Worker): 200 with the answer, 400 with a refusal, 401 when `access` finds no reader. `answerList(request, { map, run, access, readable })` is the same answer called directly, for a server action. The map, the permission condition and the readable fields are always the server's, never the request's. A search reads the fields you name in `search`, or every field the reader may read that a search answers.
34
+ - `viewkitjs/postgres`: the refusal codes `bad-request` (the body is no list request) and `reserved-id` (a field map holding a field keyed `id`, the key a list's answer keeps for the record's id).
35
+ - `viewkitjs/views/grid`: `GridTable` takes `rowWritable`, `(row) => boolean`, a per-row answer to whether a row's cells write, for a reader who may edit some records and not others. A row it refuses opens no editor, takes no typing, paste, fill, clear, cut or bulk-bar write, marks its cells `aria-readonly`, and answers a person's try with the existing `views.grid.cell-read-only` ("Cell is read-only"); a paste, fill or clear over it writes the other rows and says how many cells it refused. It only takes away from what the columns and `listConfig` allow. Left out, the grid is unchanged.
36
+ - `viewkitjs/fields/query`: one list request and its answer, the same in the browser and on a server.
37
+ - `listRequestSchema` is version 1, by part: `rows`, `group`, `ids`, `counts`, `values` and `view-counts`. Its settings are the settings' own parts.
38
+ - `listAnswerSchema` has one answer per part, plus a refusal as a value. A row is your own flat row, `{ id, ...values }`.
39
+ - With them: `answerFor`, `isRefused`, and their types.
40
+ - `viewkitjs/fields/query`: `savedViewSchema` and `SavedView`, a saved view whose settings never keep the search. Also `listRequestSettingsSchema` and `savedSettingsSchema`.
41
+ - `viewkitjs/views/list`, a new entry: `ListSource`, one function from a list request to its answer, so a server action is a source as it stands; and `fetchSource(url)`, a source that POSTs the request to a route.
42
+ - `viewkitjs/views/controls`: `CONTROL_ATOMS.ToolbarButton` draws the ready toolbar's buttons with the toolbar button control, in the Outright look. The search's button, New, the sort, Filter, View settings and a filter's joined parts get it. In your own toolbar frame, so do the views chip, the view tabs, "+N", "+", Clear and Save. New takes the form the Toolbar's New option picks (nothing set: primary, with its word), and the view tabs take the Toolbar's tabs option. An app that doesn't spread `CONTROL_ATOMS` keeps ViewKit's own button.
43
+ - `viewkitjs/views/controls`: the Picker draws + Add. Handed `onAdd`, it offers a row after the matches, "Add “word”", while the word is typed and no option names it; a press or Enter on it calls `onAdd` with the word and picks nothing. Handed `adding`, the row reads "Adding “word”…", greyed with a spinner, and can't be pressed; handed `addRefused`, those words stand where the row was until something else is typed. On a phone the bar's Add does the same. `PickerWords` gains `add`, `adding` and `addButton` (English: "Add “word”", "Adding “word”…", "Add").
44
+ - `viewkitjs/postgres`: `REQUEST_LIMITS.ids` (100,000), which a field map lowers with `limits: { ids }` like the other caps.
45
+ - `viewkitjs/views/controls`: a setting row's action takes its kind, `SettingAction.kind` (`"outline"` or `"danger"`); left out it is what it was, danger in the danger zone and outline elsewhere, so a danger zone can hold an undoable action outlined (Leave) beside a final one in red (VK-942).
46
+ - `viewkitjs/views/controls`: `SettingRow` takes `state` (`SettingState`: `label`, `colour`), a word of state before its control on a computer, drawn as the Option in its colour (Connected, green), before the locked reason; a phone draws none yet. An app drawing it loads the Option's stylesheets (`tag.css`, `option.css`) beside the setting row's (VK-943).
47
+ - `viewkitjs/views/controls`: the Select takes `labelAt: "inside"`. Its label stands inside its box, before its value, in the quieter words; the box is the outline Button's own (its ground, edge, depth and states) at the Select's size, as wide as what it holds and never wider than its place: a filter, Person Anyone ⌄. It is named by its label and its value, as with the label above. A field typed into (`searchIn="field"`) keeps its label above.
48
+ - `viewkitjs/views/controls`: `Icon` draws `archive`, `key`, `user-plus`, `bot`, `layers`, `sliders`, `lock` and `dots-vertical`, Tabler's at stroke 2, like the rest.
49
+ - `viewkitjs/views`: the components map takes `ViewMenu` (`ViewsViewMenuProps`), optional: one view's whole menu at an anchor, handed `open`, `onOpenChange`, `anchor`, `align`, the view (`view`), the axis's views (`views`), the view in use (`value`), `verbs`, `onDone` and `onHold`. On a computer, where the axis hands `verbs`, a views row's pill opens it (the open pill on a click on it again or a right-click, another on a right-click) and so does a folded view's ⋮ in the "+N" list; left out, they open the view's `menu` rows, as before.
50
+ - `viewkitjs/views/controls`: `CONTROLS.ViewMenu`, the views list's own view menu at a pill: Rename…, Edit view…, Save, Reset, Save as new view…, Copy link, Duplicate and Delete, its items reshaped by `verbs.menu` and drawn by your `Menu`; Rename and New view ask in the Modal, Delete asks through your `confirm` port and says so through your `toast` port, with Undo.
51
+ - `viewkitjs/views/panels/react`: `PillGroup` and `ViewPickerRow` take `viewMenu` (`PillViewMenu`, from `viewkitjs/views/panels`); `FoldingViewRow` hands it where the axis hands `verbs` and your map draws `ViewMenu`.
52
+ - `viewkitjs/views`: the TagField takes `fixed` (tags that stay first, with no remove button, which Backspace passes by) and `asides` (a quiet word after a tag's name, by its name); the Tag takes `aside`. The Tag's stylesheet reads `--vk-font-weight-normal`.
53
+ - `viewkitjs/views/controls`: `--field-rows-line-end`, a length a place sets round its Field rows cards: the rule between two rows then ends that far short of the row's right edge. Unset, 0, as before.
54
+ - `viewkitjs/views/controls`: `SettingRow` takes `colour`, a label colour for its icon's tile, and `SettingIcon` draws a row's icon on its own, for a list that draws its names itself.
55
+ - `viewkitjs/views/looks`: the setting row's `icon` option, a phone's: `line` (the default), the glyph alone in the subtle text, or `tile`, a white glyph on a tile of the row's `colour` (grey when none), set by `data-setting-row-icon`.
56
+ - `viewkitjs/views/field-row`: the field row's frame is yours to set, by seven variables declared on a section or any ancestor of its rows: `--vk-field-row-label-w` (the label column on a desktop, undeclared what `w-32` drew), `--vk-field-row-gap` (the gap between glyph, label, value and lane, what `gap-3` drew), `--vk-field-row-h` (the row's least height, its content standing in the middle, `auto`), `--vk-field-row-py` (its padding above and below, what `py-2.5` drew), `--vk-field-row-line-w` (the line under every row but the last, `1px`; `0px` draws none), `--vk-field-row-line` (that line's colour, `--vk-border`) and `--vk-field-row-label-fg` (the label's colour, `--vk-fg-subtle`). Undeclared, every row draws as before. Inside a `FieldRows` card on a phone the row is drawn by the card's frame instead, and none of them apply.
57
+ - `viewkitjs/views/field-row`: on a phone, a field row inside a `FieldRows` card is one of the card's rows: its glyph in the card's glyph lane, its label in the card's label column and its value on the same line, in the card's height, insets and line. A `›` in its lane says where its press opens a sheet (a pick, a date, a record, several values), and a press anywhere on the row opens what its edit button opens (never on a control of its own, a row whose value is a verb menu, while its write is pending or while the record loads). On a computer, and outside a card, the row is unchanged; ViewKit's own editor panel, `Sheet` and `Modal` opened from a card's row draw their rows as rows outside any card (an app's own dialog drawn inside the card keeps the card's form). A row's padding gives a value that wraps room above and below it; a one-line row keeps the card's height.
58
+ - A new message key, `views.field-row.set` (`{ label }`): what a writable empty row in a card reads, "Set" and its label, each word lower-cased unless a capital stands inside it ("Set source", "Set VAT number", "Set LinkedIn URL"). A resolver that words every key words this one too.
59
+ - `FieldRows`: a row may open with a glyph lane (`o-field-row-glyph`), 20 wide, its glyph centred; a row holding one starts the line above it from the words, after the lane; a label's one long word breaks inside its column.
60
+ - `viewkitjs/views`: the Avatar draws at 96 (`size={96}`, a photo on a phone), its initials at `--vk-font-size-4xl`, a square's corner two steps past 64's (`--vk-radius-2xl` at Medium; `--vk-radius-xl`, `--vk-radius-3xl`, `--vk-radius-4xl` at Small, Large and Extra large). The Avatar reads three new names: `--vk-font-size-4xl`, `--vk-radius-3xl`, `--vk-radius-4xl`.
61
+ - `viewkitjs/views`: on a phone (`data-vk-phone`), the Radio's swatches stand 28 across, 13 apart, on a card of their own (`--vk-overlay-card`, `--vk-radius-xl`), the chosen one ringed in the text colour, grey keeping the field's edge; its pictured cards stand as three phones, 46 × 88, spaced round on a card of their own, each over its name, the chosen one framed in the brand and its name a pill in the brand, the mark out of sight. On a computer nothing changes.
62
+ - `viewkitjs/views/controls`: `HeaderBar` and `SheetHead` take `mark`, a record's mark (an `Avatar`, 24 suits the bar) drawn before the title. It never shrinks while a long title cuts with … beside it; the two stand together, centred, or at the left after the left place when `titleAt` is `left`; with a description the mark stands beside both lines. It is hidden from screen readers, since the title says the name, and the sheet keeps its title as its name. A bar with no `mark` renders and draws as before.
63
+ - `viewkitjs/views/controls`: `ToolbarControl` takes `fill`: its row's worded buttons grow to share the row's width while its square ones keep theirs, and as the row narrows the first worded button with an icon keeps its words until the rest have given theirs up and folded into ⋯. The filter bar under it draws as before.
64
+ - `viewkitjs/views/controls`: `ToolbarControl` takes `more`, a list of Menu entries: ⋯ then stands at the row's end holding them, and what folds joins them in the row's order (an empty list: ⋯ stands there once something folds). A Toolbar handed neither draws as before.
65
+ - `viewkitjs/views/controls`: a `Field` placed in `FieldRows` draws as the card's row, as iOS's Settings draws a field: its label in the row's column, its `Input` or `InputGroup` typed in place beside it (no box in any state, the text colour, the caret in the brand, cut with "…" at rest; read-only in the quietest text with no caret), an `InputGroup`'s start words its prefix and its end button in the brand, and `saving` and `saved` at the row's end, the end button out of their way. Its note and error stand under the card, in a foot `FieldRows` draws after it while any Field in it has one (`.o-field-rows-foot`): the notes as one in the order their Fields came (the rows' order, unless a row came later), an error in their place, each still tied to its control by `aria-describedby`; a disabled value in the disabled text. A Field inside a `FieldRowsRow`, and every `FieldRowsRow`, draws as before, and so does a Field in a place of its own under the card: a `Popover`, a `Sheet`, a `Pane`, a `Modal`, an `AlertDialog`, an editor's panel, a record's `FieldRow`. The Input reads `--vk-fg-brand`, the Field `--vk-fg-subtlest`.
66
+ - `viewkitjs/views`: `SheetHead` takes `step` (`{ id: string; back?: boolean }`), the step it heads, as its body's `SheetStep` names it. Its row is drawn afresh for each step id and says `data-step="in"` or `"back"`, and what stands in it (its buttons and its title, never its soft edge) slides in with the step as `SheetStep` does, from the left going back, and not under reduced motion. A sheet whose steps each have their own head (settings in a sheet) now moves its head with its body. A head with no step changes in place, as before.
67
+ - `viewkitjs/views/panels/react`: `ReadyToolbar` (and `ListToolbar`, `viewkitjs/views/list`) take `toolbarParts`, a function handed every form's parts as data (`ToolbarPartPlace`: `key`, `line`, `side`, `words`, and `node` for a part of your own) that hands back where each one stands, in your order: the row and the filter bar on a computer, a phone's one line (New at the list's foot or on the line), the row arrangement and its line below. Handed nothing, every arrangement draws as before. New types: `ToolbarParts`, `ToolbarPartPlace`, `ToolbarPartsContext`.
68
+ - `viewkitjs/views/panels/react`: a part's `words` (`"both"` or `"icon"`): `"icon"` stands its button as its icon alone; `"both"` gives the search's button its word, "Search", where the look's words show, as Sort and Filter show theirs. `foot: false` keeps New on a phone's line.
69
+ - `viewkitjs/views/controls`: `ToolbarInput` takes `words`: `"both"` shows "Search" beside the shut search's icon as the buttons on the right show their words.
70
+ - `viewkitjs/views/list`: `menu.drop`, `menu.add` and `menu.move` take any list of keyed rows, the toolbar's parts included.
71
+ - `viewkitjs/views/controls`: on a phone, a Select with its label inside (`labelAt="inside"`) is a pill: the Glass button's worded pill at its small size, its value and ⌄, the label kept for a screen reader and titling the Sheet it opens. It wears `glass-button.css`, so an app that draws one on a phone loads that stylesheet too.
72
+ - `viewkitjs/views/controls`: on a phone, a group of card Radios (`card`) is iOS's ✓ rows on one card: a rule between each row, the chosen one's ✓ at its end in `--vk-fg-accent`. The Radio reads `--vk-border-overlay-card`, `--vk-font-size-base` and `--vk-line-height-base` for it.
73
+ - `viewkitjs/views/controls`: the Icon has `share`, iOS's box with its arrow up.
74
+ - `viewkitjs/views/controls`: a `TagField` placed in `FieldRows` draws as the card's row, as iOS draws a To field: its tags fill the row as tokens (30 tall, a pill on the neutral fill, no edge, no icon, the row's words), 6 apart and wrapping as they grow, the caret after the last and the placeholder only while it holds none. Its label still names the box but stands out of sight, for its place to title the group; its note and error stand under the card as every Field row's. Outside Field rows it draws as before. The TagField reads `--vk-border-width`, `--vk-font-weight-normal`, `--vk-neutral` and `--vk-radius-full`.
75
+ - `viewkitjs/views/controls`: on a phone `SettingRows` is Field rows' card for a `Field` placed in it: the Field draws as its row beside the setting rows, a rule between them, its note and error in a foot after the card, as in `FieldRows`. On a computer a Field in it stays a box. What a `SettingRow` holds is never a row of its card.
76
+ - `viewkitjs/views/controls`: `SettingChevron`, the setting row's phone ›, 9 × 15, for a list's row that stands beside setting rows, so every › on a phone's settings page is one glyph.
77
+ - `viewkitjs/views/controls`: `--vk-opacity-off`, what a locked setting row's control fades to (0.45 by default).
78
+ - `viewkitjs/views/looks`: the setting row has a third look, Linear, and four values to make it: the Card option's Edged (the card on its ground with a firm edge, the danger zone's card plain, a lone row a card of its own, an icon on a grey tile), the Rows option's Inset (60 tall at least, the line between rows inset at both ends), and two new options, End (Buttons, the default; or Words: an action as its words, a state as a dot and its words, a locked row's reason in its control's place) and Fields (Boxes, the default; or At the end). Nothing picked draws as before.
79
+ - `viewkitjs/views/controls`: under the Fields option's At the end, a `Field` placed in a computer's `SettingRows` is one of its rows, its label and note on the left, its error in the note's place and its control at the row's end; a `RadioGroup` standing there draws as a Select of its Radios (a group of swatches stays swatches); every select at a row's end is as wide as its value.
80
+ - `viewkitjs/views/controls`: a setting row's action may stand after a `value` and be its icon alone (`SettingAction.iconOnly`, its `label` naming it).
81
+ - `viewkitjs/views/controls`: `useSettingRowWorn(el)` reads the setting row's options off the frame round an element, kept up to date; `useSettingRowsRow()` tells a part of an app's own that it stands as a row of such a card.
82
+ - `viewkitjs/views/controls`: `Icon` draws `arrow-down`, a single arrow pointing down.
83
+
84
+ ### Changed
85
+
86
+ - `viewkitjs/views`: an untouched list's identity columns (everything through the title) start pinned at the left edge, whichever way your grid is drawn. `LIST_VIEW_PREF_DEFAULTS.gridFreezeIdentity` is `true`, and a view's look (`seenLook`) and a view's layout (`readViewLayout`) default to pinned, as the bare `GridTable`'s `freezeIdentity` and the grid's look ("Name column": Pinned) already did. A list whose stored preferences, view or person's layer say `false` keeps it; preferences your app saved whole, defaults included, hold `false` and stay unpinned. To open a list unpinned, start your prefs with `gridFreezeIdentity: false`, or hand `freezeIdentity={false}`.
87
+ - A view's menu hides Rename, Delete, Private view and Save for everyone on a view the reader can't change: `readOnly` on a views axis's option (`ViewTabOption.readOnly`, `ViewsViewsListItem.readOnly`). Reset, Save as new view, Copy link and Duplicate stay.
88
+ - A person's own view's Save says "Save" (in its menu for a private view, and in Customize's foot where the view state says `own`); shared views keep "Save for everyone".
89
+ - `viewkitjs/views/react`: `ViewsResolvedPorts` is `Required<ViewsPorts>`: `useViews().ports` carries every port, your own or its default.
90
+ - `viewkitjs/views/grid`: ⌘Z and ⌘⇧Z show their value, and take the focus to their cell, as they are pressed, after a fill or a text save too; the write still waits for the edit it takes back to answer. An undo or a redo still waiting is sent at `pagehide`, after any open editor's draft. Back from the back-forward cache, an undo sent at the close may have reached the server before the edit it takes back: the cell then ends on the edit's stored value while redo still offers the undo.
91
+ - `viewkitjs/views/grid`: `GridCommitContext` may carry `closing: true`, on a commit or a restore sent while the page goes; send it so it outlives the page (`fetch(…, { keepalive: true })`). A commit sent then carries `{ kind: "commit", closing: true }` where it carried no context before.
92
+ - `viewkitjs/views/grid`: a `stored` answer to an undo or a redo now shows in its cell until the rows carry it.
93
+ - `viewkitjs/views/grid`: a single cell's write that `onCellCommit` answers with `{ status: "failed" }` now rolls its cell back, as a rejection did; it kept the refused value on screen before.
94
+ - `ReadyToolbar` is a `ListRoot` around `ListToolbar`. It takes every prop it took before and draws the same.
95
+ - Inside a `ListRoot`, `Toolbar` and `ToolbarRadioProvider` share the root's radio, so one panel is open per list, whichever frame opened it. Outside a root, each frame keeps its own radio as before.
96
+ - `size-budget.json`: `viewkitjs/views/list` goes from 75 to 165 kB gzipped (146.0 kB measured). The door now carries the ready toolbar's parts (`ListToolbar`), the same parts `viewkitjs/views/panels/react` carries within its own 165 kB. An app that imports only `fetchSource` from it pays for the whole door until the source moves to a door of its own.
97
+ - `viewkitjs/views/grid`: a column's menu offers Group by and Ungroup wherever you hand `groupBy`, saved view or not. `viewBacked` no longer decides them: it keeps Sort on every bound column and figures for field-backed columns. A grid that hands `groupBy` without `viewBacked` now offers Group by.
98
+ - `viewkitjs/views/controls`: `CONTROLS.Menu` draws the icon of a row that ticks and keeps the menu open (`checked` with `keepOpen`), as it draws every other row's.
99
+ - `viewkitjs/views`: `bindFields(registry, specs?)` binds a field you give no spec by its key, where it used to throw "registry field is not bound": it reads `row[key]` and, where anyone may write the field, writes `{ [key]: value }`; a number, a percent or an amount writes the number its editor commits (decimal text under `storage: "decimal"`). Write specs only for the fields that differ, or none: `bindFields(registry)`. A field its key can't bind still throws `FieldBindingError`, its message `binding: "<key>": not bound, and its key can't bind it: <why>`: a writable relation (its candidates), a writable amount whose currency is the row's (its `unit`), a ratio formula (its `ratio` readers) and a writable datetime (its editor commits a local time, which only your time zone turns into an instant).
100
+ - `viewkitjs/views/controls`: an app that spreads `CONTROL_ATOMS` now gets its toolbar buttons too. Its count is a count: the ✕ badge that cleared what it counted is not drawn. To keep your own button, spread yours after it: `atoms={{ ...CONTROL_ATOMS, ToolbarButton: Own }}`.
101
+ - `viewkitjs/views/controls`: the toolbar button and the Toolbar read their frame's options through one observer for the whole page, not one per button.
102
+ - `viewkitjs/postgres`: an `ids` request answers at most 100,000 ids. A list that keeps more is refused `too-big` (`ids: a list answers at most 100,000 ids; narrow the list first`, 400 from `listHandler`) after one capped count, before any id is read; that includes the ids a drag reads in a list in manual order. `idsQuery` reads that count as its first step.
103
+ - `viewkitjs/views/controls`: a switch row (`SettingRow switch`, `SwitchRow`) switches only from its Switch: its root is a `div`, not a `label`, so a press on its name, line or mark does nothing, and the row takes no pointer cursor or hovered ground (`setting-row.css`, `switch-row.css`); the Switch no longer reads the row under the pointer as its own hover (`switch.css`). The Switch is named by the row's name (`aria-labelledby`) and described by its line (`aria-describedby`). `switch-row.css` no longer reads `--vk-hovered`, `--vk-duration-fast` or `--vk-ease-out`. Classes and props are unchanged (VK-941).
104
+ - `viewkitjs/views/controls`: a read-only Input, or an InputGroup holding one, stands on `--vk-sunken` with its words `--vk-fg-subtle`, in focus too; one that opens something (`aria-haspopup`) keeps a resting field's ground (`input.css`) (VK-944).
105
+
106
+ What an app changes: nothing.
107
+ - `viewkitjs/views/controls`: Field rows' options (`data-field-rows-edge`, `-cards`, `-height`, `-label`, `-lines`) are declared again on every Field rows card that carries no pick of its own, so the card resolves its ground, rule, edge and corners where it stands. A place that sets the card's colours again round it (`--vk-overlay-card`, `--vk-border-overlay-card`, `--vk-radius-xl`) now reaches the card under every option. A card that carries its own look keeps it. Nothing changes where nothing is set again.
108
+ - `viewkitjs/views/controls`: on a phone the setting row stands as iOS's Settings draws it. A value is in the quietest grey, the name's size, before a 9 × 15 › at the row's end (a select's row stopped short of it); a button's words stand in the link colour at the row's end, a press of their own, where the whole row was the button; a word of state (`state`) shows as the grey value before ›, the row the press of its action; in a danger card each row is the press, its action's `icon` first, in red; a lone row (`alone`) is a card of its own, its name in the link colour, where it fell back to the computer's bare row; a locked row fades but for its line; and a card's rows stand one way: where any row has an icon or a mark, every row keeps its room, the words in one line, each rule starting at the words (a row says what starts it, `data-setting-row-start`).
109
+ - `viewkitjs/views/controls`: on a phone the Switch's Capsule, what nothing picked draws, is 28 × 63 with a 24 × 37 thumb (it was 31 × 71, 27 × 41), its thumb is white on or off in both themes (it took the darkest ground when on in dark), and a locked Switch is faded with no lock in its thumb. A computer's `sm` and `md` switches are unchanged; `lg` with nothing picked draws the same Capsule anywhere, so it is 28 × 63 on a computer too.
110
+ - The setting row reads `--vk-fg-brand`, `--vk-border-brand`, `--vk-focus-width`, `--vk-focus-offset`, `--vk-label-*`, `--vk-fg-inverse` (a tile's white glyph) and `--vk-icon-disclosure` (a phone's ›).
111
+ - `viewkitjs/views`: on a phone (`data-vk-phone`), the Radio's swatches stand in their colour's bold shade, as round 3 of the settings canvas draws them: `--vk-label-<colour>`, grey `--vk-fg-subtlest`, where a computer's keep the label's pale fill. Grey no longer carries the field's edge on a phone. The Radio reads eight more names, each already in the ready stylesheet: `--vk-label-amber`, `--vk-label-blue`, `--vk-label-green`, `--vk-label-pink`, `--vk-label-purple`, `--vk-label-red`, `--vk-label-teal`, `--vk-fg-subtlest`. On a computer nothing changes.
112
+ - `viewkitjs/views/panels/react`: a phone's folding `Toolbar` line keeps the order its parts are handed in, the filter bar's start going in right after the views; before, the views were pulled to the front. A toolbar that hands the views first draws as before.
113
+ - `viewkitjs/views`: `ViewsViewMenuProps.view` is optional. Left out, the slot stands on New view's Modal in place of a menu, as the row's + opens it, and tells `onOpenChange(false)` once the Modal has closed. `CONTROLS.ViewMenu` does.
114
+ - `viewkitjs/views/controls`: `CONTROLS` brings `CONTROL_ATOMS` with it, so `<ViewsProvider components={CONTROLS}>` alone draws the ready toolbar's buttons as the toolbar button, a select's value as the Option's tag, a status as the Status and a cell's "+N" as the Tag's count. The provider's `atoms` still win, atom by atom, over CONTROL_ATOMS'. An app that hands `components={CONTROLS}` and no `atoms` sees those pieces change look; one that already hands `atoms={CONTROL_ATOMS}` draws as before, and so does one that hands a map spread from `CONTROLS` (`{ ...CONTROLS, ...own }`), which brings no atoms: it hands `atoms={{ ...CONTROL_ATOMS, ...own }}` for them.
115
+ - `viewkitjs/views/controls`: on a phone an agent's Avatar on its own `colour` stands bold, the hue under a white letter, as an app's tile; a thing's and the workspace's keep the hue's pale fill, and a computer draws every Avatar as before. The Avatar reads `--vk-label-<hue>` and `--vk-fg-inverse` for it.
116
+
117
+ ### Fixed
118
+
119
+ - `viewkitjs/views`: in the Sheet, and in the Modal on a computer, a field row edited in place keeps its box: pressing the row opens its editor with the focus in it, ready to type, instead of the popup taking the focus back and the editor closing as it opened.
120
+ - `viewkitjs/views/controls`: `CONTROLS.Picker` draws + Add, so a select or multiselect whose binding carries `addOption` offers a way to add an option at ViewKit's defaults. Its words are the existing messages `views.editors.add-option`, `views.editors.adding-option` and, for a phone's button, `views.editors.values-add`. An app that hands its own `Picker` keeps drawing its own add row.
121
+ - `viewkitjs/views`: a chosen choice card (a card Radio or a card Checkbox) keeps the card's ground, its edge and a hairline ring just outside it in the selected colour, as a marked card does; a disabled one draws no ring. The choice's stylesheet no longer reads `--vk-selected`.
122
+ - `viewkitjs/views/panels/react`: on a computer, the views row's + of an axis that hands `verbs` (a `ListRoot` that keeps its views) opens New view's Modal, the layouts and the name, and creates through `verbs.onChange`, where your map draws `ViewMenu`. It did nothing: the root's axis hands an `onCreate` that waits for a views list. An axis without `verbs`, or a map without `ViewMenu`, still calls its `onCreate`.
123
+ - `viewkitjs/views/controls`: the sort editor's direction box on a computer is as wide as the longer of the app's two words for Ascending and Descending, so a longer word (Romanian's "Descrescător") reads whole instead of ending in "…". It keeps one width whichever is picked, never narrower than before (152 px, so English draws as it did) nor wider than 240 px, where a longer word still ends in "…". An app's own width on `.o-sort-editor-direction` still wins.
124
+
125
+ ### Removed
126
+
127
+ - The rendering contract no longer names the four getters (`getGridProps`, `getHeaderProps`, `getRowProps`, `getCellProps`): nothing defined them.
128
+ - `viewkitjs/views/grid`: `GridTableProps.renderColumnMenuRows`, deprecated and read by nothing since 0.30. Hand the same rows as data through `columnMenuItems`, or reshape the whole menu with `menus.column`:
129
+
130
+ ```tsx
131
+ // before
132
+ <GridTable {...grid} renderColumnMenuRows={(key, close) => <EditFieldRow onClick={() => { close(); openEdit(key); }} />} />
133
+ // after
134
+ <GridTable {...grid} columnMenuItems={(key) => [{ key: "edit-field", label: "Edit field", onSelect: () => openEdit(key) }]} />
135
+ ```
136
+
137
+ ## [0.31.0] — 2026-12-02
138
+
139
+ ### Added
140
+
141
+ - `viewkitjs/views/controls`: the `Avatar` takes `colour`, one of the label hues (`AvatarColour`: blue, green, amber, red, purple, pink, teal or grey, the Option's list). A thing's, an agent's or the workspace's square stands on the hue's fill, its letters or icon in the hue's strong ink, with no edge; a person keeps their tone. Its stylesheet reads the label hues' `--vk-label-<hue>-fill` and `--vk-label-<hue>-strong`.
142
+ - `viewkitjs/views/controls`: the `Avatar` draws at 56 (`AvatarSize`), between 40 and 64, its letters at `--vk-font-size-xl` and a square's corners on 64's steps. An `AvatarStack` takes neither 16 nor 56.
143
+ - The setting row, on `viewkitjs/views/controls`: `SettingRow` draws one setting as a row, its name and a line under it, at its end a switch (`switch`), a select (`select`), a button (`action`) or › to its page (`onOpen`, with its `value`), a `mark` or an `icon` at its start; `locked` (the reason) shuts its control; `alone` stands a lone row bare. `SettingRows` holds them in a card, a line between each, `danger` the danger zone's red edge with each button the Button's danger kind. On a phone the card and its rows are Field rows'. Its stylesheet is `viewkitjs/views/controls/setting-row.css`, in the ready stylesheet; its names are on `docs/controls/setting-row.md`.
144
+ - Its options and looks, `SETTING_ROW_LOOKS` on `viewkitjs/views/looks`: the card (`outlined` or `raised`) and the rows (`snug` or `roomy`), each a computer's, set on the frame as `data-setting-row-card` and `data-setting-row-rows`; two looks, `outright` (nothing picked) and `attio` (`raised`, `roomy`). With them `settingRowWornOf` and `SETTING_ROW_ATTRS`.
145
+ - `SwitchRow` and `SwitchRows` are now the setting row's switch kind, with the props and the classes they had: an app that draws them changes nothing. They draw as before with `switch-row.css`, which stays; an app that imports the controls one by one may import `setting-row.css` in its place to draw the other kinds too (the Showcase does). The portal, Atlas and outright-base draw no SwitchRow and change nothing.
146
+ - `viewkitjs/views/controls`: the Radio's `swatch`, one of the label colours (`blue`, `green`, `amber`, `red`, `purple`, `pink`, `teal`, `grey`) drawn as a 24px dot in place of its ring, for picking a colour. Give it an `aria-label`, the colour's name. Chosen, it is ringed in the selected colour just outside a thin ring of the ground; hovered, the same ring in the field's hovered edge; focused, the focus outline outside that ring; disabled, grey and dashed, passed by the arrows. A `row` group stands them 10 apart. It reads `--vk-label-<hue>-fill` and `--vk-neutral`.
147
+ - `viewkitjs/views/controls`: a marked card's `picture` on the Radio: what your app draws (Light, Dark or System as a little app) fills the card's width, 120 tall, over its mark and its name, which stand side by side under it. A picture makes the card marked with a mark or without. Chosen, its words take the text colour. A `row` group stands pictured cards one beside another at equal widths, on a phone too. New names the Radio reads: `--vk-fg`, `--vk-font-weight-medium`, `--vk-radius-sm`, and the seven `--vk-label-<hue>-fill`.
148
+ - `viewkitjs/views/controls`: `saving` and `saved` on the `Input`, the `InputGroup` and every `Select` field, for a field that saves on its own. Saving, the Spinner stands at the field's end (before a Select's chevron) and the field is busy (`aria-busy`), still typed into; saved, a check and the word "Saved" stand there in the success colour, announced, fade after `--vk-saved-hold` and leave the field. It shows again each time `saved` turns on; saving wins when both are on. `data-force="saved"` holds Saved on a page that shows it. A save that fails is still the Field's `error`, your app putting the value before back.
149
+ - The new name `--vk-saved-hold` (motion; 2000ms at the Outright look), and the Input now reads `--vk-success`, `--vk-duration-base` and `--vk-ease-in`. The Spinner's label is "Saving".
150
+
8
151
  ## [0.30.1] — 2026-12-01
9
152
 
10
153
  ### Fixed
package/MIGRATION.md CHANGED
@@ -69,7 +69,7 @@ installs none of them.
69
69
  | `@viewkitjs/postgres/definitions` | `viewkitjs/postgres/definitions` |
70
70
 
71
71
  There is no `viewkitjs` entry on its own: every path names its part. A door added since, such as
72
- `viewkitjs/views/looks` or `viewkitjs/views/controls`, has no old path: an app starts on it under `viewkitjs`. The three `package.json` entries move the
72
+ `viewkitjs/views/looks`, `viewkitjs/views/controls` or `viewkitjs/views/list`, has no old path: an app starts on it under `viewkitjs`. The three `package.json` entries move the
73
73
  same way (`@viewkitjs/fields/package.json` is `viewkitjs/package.json`, one manifest for all three parts).
74
74
 
75
75
  ## The names your app narrows
@@ -227,17 +227,27 @@ Nothing was removed except what is below.
227
227
  app body's popover is your `Popover` at its own width, a grid body opens over its cell, and the grid says a refused
228
228
  edit through your toast's `error`, so stop toasting your own (step 8). `GRID_SLOTS` loses `vk-grid-column-menu`,
229
229
  `vk-grid-flyout`, `vk-grid-group-menu` and `vk-grid-aggregate-menu`: style the grid's menus as your `Menu`.
230
- `Command` is deprecated and read by nothing: leave it out. The grid's `renderColumnMenuRows` is deprecated and read
231
- by nothing: a row drawn as a node has nowhere to stand in your `Menu`, so hand the same rows as data through
232
- `columnMenuItems` (outright-base's Edit field row, say).
230
+ `Command` is deprecated and read by nothing: leave it out. The grid's `renderColumnMenuRows`, deprecated and read
231
+ by nothing since 0.30, is gone since 0.32 (below).
233
232
 
234
233
  ```tsx
235
234
  // before
236
235
  <ViewsProvider {...rest} menus="menu" bodyFrame="popover" gridBodyPlace="over" sayRefusals />
237
- <GridTable {...grid} renderColumnMenuRows={(key, close) => (edits[key] ? <EditFieldRow onClick={() => { close(); openEdit(key); }} /> : null)} />
238
236
  // after
239
237
  <ViewsProvider {...rest} />
238
+ ```
239
+
240
+ - **The grid's `renderColumnMenuRows` is gone** (0.32): a row drawn as a node had nowhere to stand in your `Menu`. Hand
241
+ the same rows as data through `columnMenuItems` (outright-base's Edit field row, say), or reshape the whole menu,
242
+ the grid's own rows too, with `menus.column`.
243
+
244
+ ```tsx
245
+ // before
246
+ <GridTable {...grid} renderColumnMenuRows={(key, close) => (edits[key] ? <EditFieldRow onClick={() => { close(); openEdit(key); }} /> : null)} />
247
+ // after
240
248
  <GridTable {...grid} columnMenuItems={(key) => (edits[key] ? [{ key: "edit-field", label: "Edit field", onSelect: () => openEdit(key) }] : null)} />
249
+ // or, the whole menu as data
250
+ <GridTable {...grid} menus={{ column: (items, { field, column }) => (field && !column.partOf && edits[field.key] ? menu.add(items, { key: "edit-field", label: "Edit field", onSelect: () => openEdit(field.key) }, { before: "hide-column" }) : items) }} />
241
251
  ```
242
252
 
243
253
  - **The older hosts that open your bodies take host names** (0.30), with no alias: `TextEditor` and `TextEditorProps`
@@ -334,7 +344,7 @@ It holds `Button`, `Tooltip`, `Popover`, `Sheet`, `Input`, `Checkbox` and `Menu`
334
344
  a name, a place and a range; the Number editor (`NumberBody`) for a number, money or a percent; the Values editor (`ValuesBody`) for several emails, phones, links or domains; the Links editor (`LinksBody`) for a relation whose field declares `links`; the views list (`ViewsListBody`), what the view switcher opens; and the group editor (`GroupBody`), what Customize's Group opens, where an app that hands none keeps ViewKit's own group pages; and the Collapsible (`Collapse`), the fold a grid's group, a field's note and the selection sheet open in; and `PortsHost`, which answers the `toast` and `confirm` ports an app leaves out with ViewKit's Toast and alert dialog. **An app that spreads it hands no `Calendar`:** the filter panel's date, its date
335
345
  ranges and its custom time scope open ViewKit's own month. An app's own `Calendar` or `RangeCalendar` atom is
336
346
  kept. You still hand `AppIcon` and `Markdown`. `CONTROL_ATOMS` (0.23) does the same for the atoms
337
- (`Tag`, `StatusBadge`, `CellMore`): `atoms={{ ...CONTROL_ATOMS, ...ownAtoms }}`.
347
+ (`Tag`, `StatusBadge`, `CellMore`, and since 0.32 `ToolbarButton`): `atoms={{ ...CONTROL_ATOMS, ...ownAtoms }}`.
338
348
 
339
349
  The controls' stylesheet is in `viewkitjs/views/styles.css` (step 9). An app that imports the controls'
340
350
  stylesheets one by one instead imports `smooth.css` first, then each control's own, and now adds
@@ -431,6 +441,20 @@ hydrates.
431
441
  `PartsBody`, `ValuesBody`, `LinksBody`) takes none of ViewKit's width or padding and is marked `data-vk-body`; in
432
442
  the grid it opens over its cell. The grid says a refused edit through your toast's `error`. An app that set
433
443
  `menus="menu"`, `bodyFrame="popover"`, `gridBodyPlace="over"` and `sayRefusals` sees no change.
444
+ - An untouched list's identity columns start pinned at the left edge (0.32): `LIST_VIEW_PREF_DEFAULTS` holds
445
+ `gridFreezeIdentity: true`, and a view's look and a view's layout default to pinned, as the bare `GridTable` and
446
+ the grid's look already did. A list whose stored preferences, view or person's layer say `false` keeps it. To
447
+ open unpinned, start your prefs with `gridFreezeIdentity: false`.
448
+ - `bindFields` binds a field you give no spec by its key, reading `row[key]` and writing `{ [key]: value }`, where
449
+ it used to throw (0.32). A field its key can't bind still throws, naming why: a writable relation, a writable
450
+ amount whose currency is the row's, a ratio formula and a writable datetime.
451
+ - ⌘Z and ⌘⇧Z show their value, and take the focus to their cell, as they are pressed, after a fill or a text save
452
+ too; the write still waits for the edit it takes back to answer (0.32).
453
+ - A write the grid sends while the page goes (`pagehide`) carries `closing: true` in its context: an editor still
454
+ open then writes its draft with `{ kind: "commit", closing: true }`, where it passed no context before, and an
455
+ undo still waiting is sent then too (0.32).
456
+ - One cell's write that `onCellCommit` answers with `{ status: "failed" }` rolls the cell back, as a rejection
457
+ does (0.32); it kept the refused value on screen before.
434
458
 
435
459
  **Toolbar and panels**
436
460
 
@@ -539,6 +563,7 @@ The Compound editor, the Number editor, the Menu and the number box (`CONTROLS.P
539
563
  | `views.editors.number-search-unit` | Search for a unit |
540
564
  | `views.editors.number-unit-named` | {unit}: {name} (the code button's name: "Currency: Euro") |
541
565
  | `views.menus.not-now` | Not now |
566
+ | `views.menus.row-waiting` | Loading… |
542
567
 
543
568
  The Picker (`CONTROLS.Picker`, `CONTROLS.FieldsBody`):
544
569
 
@@ -654,6 +679,7 @@ A view's menu and what it opens (`CONTROLS.ViewsListBody` where the axis hands `
654
679
  | `views.panels.view-edit` | Edit view… |
655
680
  | `views.panels.view-private-toggle` | Private view |
656
681
  | `views.panels.view-save-everyone` | Save for everyone |
682
+ | `views.panels.view-save-own` | Save |
657
683
  | `views.panels.view-save-new` | Save as new view… |
658
684
  | `views.panels.view-copy-link-short` | Copy link |
659
685
  | `views.panels.view-favorite` | Favorite |
@@ -768,6 +794,14 @@ The panels: quick filters, set-aside rules, dragging:
768
794
  | `views.panels.drag-dropped` | Draggable item {label} was dropped. |
769
795
  | `views.panels.drag-cancelled` | Dragging was cancelled. Draggable item {label} was dropped. |
770
796
  | `views.panels.filter-fieldless` | Not a field of this list; a view cannot filter on it. |
797
+ | `views.panels.toolbar-row` | List tools |
798
+ | `views.panels.toolbar-bar` | Sort and filters |
799
+
800
+ The field row in a Field rows card, holding nothing:
801
+
802
+ | Key | English |
803
+ | --- | --- |
804
+ | `views.field-row.set` | Set {label}, each word lower-cased unless a capital stands inside it |
771
805
 
772
806
  `viewkitjs/fields` (the conventions' `messages`):
773
807
 
package/README.md CHANGED
@@ -8,7 +8,7 @@ ViewKit: typed fields, the grid and its editors, and a list's SQL, for record li
8
8
  pnpm add viewkitjs zod
9
9
  ```
10
10
 
11
- Add `react` and `react-dom` 19 for `viewkitjs/views/*`, and `@dnd-kit/core`, `@dnd-kit/sortable` and `@dnd-kit/utilities` for the panels' parts that drag in `viewkitjs/views/panels/react`, and `@base-ui/react` (1.6 or later) only to take ViewKit's default controls from `viewkitjs/views/controls`. All six are optional peers: an app that uses only fields or postgres installs none of them. ESM only, Node 20 or later.
11
+ Add `react` and `react-dom` 19 for `viewkitjs/views/*`, and `@dnd-kit/core`, `@dnd-kit/sortable` and `@dnd-kit/utilities` for the panels' parts that drag in `viewkitjs/views/panels/react` (and `viewkitjs/views/list`'s toolbar), and `@base-ui/react` (1.6 or later) only to take ViewKit's default controls from `viewkitjs/views/controls`. All six are optional peers: an app that uses only fields or postgres installs none of them. ESM only, Node 20 or later.
12
12
 
13
13
  ## The parts
14
14
 
@@ -23,3 +23,5 @@ export * from "./set-aside.js";
23
23
  export * from "./change.js";
24
24
  export * from "./layer.js";
25
25
  export * from "./list-link.js";
26
+ export * from "./list-request.js";
27
+ export * from "./saved-view.js";
@@ -23,3 +23,5 @@ export * from "./set-aside.js";
23
23
  export * from "./change.js";
24
24
  export * from "./layer.js";
25
25
  export * from "./list-link.js";
26
+ export * from "./list-request.js";
27
+ export * from "./saved-view.js";
@@ -0,0 +1,148 @@
1
+ import { z } from "zod";
2
+ import { type FilterTree } from "./filter.js";
3
+ import { type ListHold } from "./hold.js";
4
+ import { type ListRequestSettings } from "./settings.js";
5
+ /** The version every request carries. */
6
+ export declare const LIST_REQUEST_VERSION = 1;
7
+ /** The parts a list asks for: a page of rows (or of groups), one group's next page, every matching id, option counts,
8
+ * one field's values, and each saved view's count. */
9
+ export declare const LIST_PARTS: readonly ["rows", "group", "ids", "counts", "values", "view-counts"];
10
+ export type ListPart = (typeof LIST_PARTS)[number];
11
+ /** The bounds a request is held to beside the settings' own: a page's rows (postgres answers at most 1000), a
12
+ * cursor's and a group key's length, the fields a row is asked for, the fields counted at once, the views counted. */
13
+ export declare const LIST_REQUEST_LIMITS: {
14
+ readonly pageSize: 1000;
15
+ readonly cursor: 16384;
16
+ readonly groupKey: 512;
17
+ readonly fields: 200;
18
+ readonly countFields: 50;
19
+ readonly views: 100;
20
+ };
21
+ /** The reader's context: the moment a relative date reads from (an ISO instant with its offset), the time zone a day
22
+ * is read in, the locale and the names language. Each absent is the server's own. */
23
+ export type ListContext = {
24
+ now?: string;
25
+ timeZone?: string;
26
+ locale?: string;
27
+ language?: string;
28
+ };
29
+ /** A page asked for: how many rows, and the cursor the page before handed back (absent or null: the first). */
30
+ export type ListPageAsk = {
31
+ size: number;
32
+ after?: string | null;
33
+ };
34
+ type Base = {
35
+ version: 1;
36
+ settings: ListRequestSettings;
37
+ hold?: ListHold;
38
+ context?: ListContext;
39
+ };
40
+ /** A list request, one member per part. `fields`: the fields each row carries; absent, every field the reader may
41
+ * read. `group.key`: the group's key, `""` for the rows with no value. `counts.of`: `"filter"` counts a filter's
42
+ * options (the field's own rules left out), `"hold"` a quick filter's (the hold's other fields applied). */
43
+ export type ListRequest = (Base & {
44
+ part: "rows";
45
+ page: ListPageAsk;
46
+ fields?: readonly string[];
47
+ }) | (Base & {
48
+ part: "group";
49
+ group: {
50
+ key: string;
51
+ };
52
+ page: ListPageAsk;
53
+ fields?: readonly string[];
54
+ }) | (Base & {
55
+ part: "ids";
56
+ }) | (Base & {
57
+ part: "counts";
58
+ counts: {
59
+ of: "filter" | "hold";
60
+ fields: readonly string[];
61
+ };
62
+ }) | (Base & {
63
+ part: "values";
64
+ field: string;
65
+ }) | (Base & {
66
+ part: "view-counts";
67
+ views: readonly {
68
+ id: string;
69
+ filter: FilterTree;
70
+ }[];
71
+ });
72
+ /** The request of one part. */
73
+ export type ListRequestOf<P extends ListPart> = Extract<ListRequest, {
74
+ part: P;
75
+ }>;
76
+ /** The one schema of a list request, the same in the browser and on a server. */
77
+ export declare const listRequestSchema: z.ZodType<ListRequest>;
78
+ /** One row of an answer: the app's own flat row, its record's key as text under `id`. */
79
+ export type ListRow = {
80
+ id: string;
81
+ } & Record<string, unknown>;
82
+ /** How many rows match: `count` exactly, or, not `exact`, as far as the server counted. */
83
+ export type ListTotal = {
84
+ count: number;
85
+ exact: boolean;
86
+ };
87
+ /** One group of a grouped answer: its key (`""` for the rows with no value), the name the server read for it (null:
88
+ * the list names it), how many rows it holds, and whether it is hidden. Carrying `rows`, it is loaded, and `next` is
89
+ * its next page's cursor; without them, a `group` request loads it. */
90
+ export type ListAnswerGroup<Row extends ListRow = ListRow> = {
91
+ key: string;
92
+ label: string | null;
93
+ count: number;
94
+ hidden: boolean;
95
+ rows?: Row[];
96
+ next?: string | null;
97
+ };
98
+ /** A refused request: its code and the sentence that says why. A value, never a throw, so a server action hands it
99
+ * back as it is. */
100
+ export type ListRefused = {
101
+ refused: {
102
+ code: string;
103
+ message: string;
104
+ };
105
+ };
106
+ /** An answer, one member per part, or a refusal. A grouped `rows` answer holds its rows in its groups: its own `rows`
107
+ * is `[]` and its `next` null, and its `total` is the whole list's. `total` is null where the server didn't count. */
108
+ export type ListAnswer<Row extends ListRow = ListRow> = {
109
+ part: "rows";
110
+ rows: Row[];
111
+ next: string | null;
112
+ total: ListTotal | null;
113
+ groups: ListAnswerGroup<Row>[] | null;
114
+ } | {
115
+ part: "group";
116
+ key: string;
117
+ rows: Row[];
118
+ next: string | null;
119
+ } | {
120
+ part: "ids";
121
+ ids: string[];
122
+ } | {
123
+ part: "counts";
124
+ counts: Record<string, {
125
+ counts: Record<string, number>;
126
+ labels: Record<string, string>;
127
+ }>;
128
+ } | {
129
+ part: "values";
130
+ field: string;
131
+ values: string[];
132
+ labels: Record<string, string>;
133
+ } | {
134
+ part: "view-counts";
135
+ counts: Record<string, number>;
136
+ } | ListRefused;
137
+ /** The answer of one part. */
138
+ export type ListAnswerOf<P extends ListPart, Row extends ListRow = ListRow> = Extract<ListAnswer<Row>, {
139
+ part: P;
140
+ }>;
141
+ /** The one schema of an answer, the same on a server and in the browser. */
142
+ export declare const listAnswerSchema: z.ZodType<ListAnswer>;
143
+ /** Whether an answer is a refusal. */
144
+ export declare function isRefused<Row extends ListRow>(answer: ListAnswer<Row>): answer is ListRefused;
145
+ /** The answer to `request`, checked to be its part's or a refusal: an answer to another part throws, naming both. Every
146
+ * source's answer passes through it, a server action's as `fetchSource`'s. */
147
+ export declare function answerFor<R extends ListRequest, Row extends ListRow = ListRow>(request: R, answer: ListAnswer<Row>): ListAnswerOf<R["part"], Row> | ListRefused;
148
+ export {};
@@ -0,0 +1,125 @@
1
+ import { z } from "zod";
2
+ import { filterTreeSchema } from "./filter.js";
3
+ import { listHoldSchema } from "./hold.js";
4
+ import { LIST_SETTINGS_LIMITS, listRequestSettingsSchema } from "./settings.js";
5
+ export const LIST_REQUEST_VERSION = 1;
6
+ export const LIST_PARTS = ["rows", "group", "ids", "counts", "values", "view-counts"];
7
+ export const LIST_REQUEST_LIMITS = {
8
+ pageSize: 1000,
9
+ cursor: 16_384,
10
+ groupKey: 512,
11
+ fields: LIST_SETTINGS_LIMITS.columns,
12
+ countFields: 50,
13
+ views: 100,
14
+ };
15
+ const L = LIST_REQUEST_LIMITS;
16
+ const ID_REASON = `"id" is the record's id, never a field's key`;
17
+ const key = z.string().min(1).max(LIST_SETTINGS_LIMITS.key);
18
+ const fieldKey = key.refine((value) => value !== "id", ID_REASON);
19
+ const cursor = z.string().min(1).max(L.cursor);
20
+ const groupKey = z.string().max(L.groupKey);
21
+ const fieldKeys = (most) => z
22
+ .array(fieldKey)
23
+ .max(most)
24
+ .superRefine((keys, ctx) => {
25
+ const seen = new Set();
26
+ for (const one of keys) {
27
+ if (seen.has(one))
28
+ ctx.addIssue({ code: "custom", message: `"${one}" is asked twice` });
29
+ seen.add(one);
30
+ }
31
+ });
32
+ const base = {
33
+ version: z.literal(LIST_REQUEST_VERSION, { error: "a list request is version 1" }),
34
+ settings: listRequestSettingsSchema,
35
+ hold: listHoldSchema.optional(),
36
+ context: z
37
+ .strictObject({
38
+ now: z.iso.datetime({ offset: true }).optional(),
39
+ timeZone: z.string().min(1).max(64).optional(),
40
+ locale: z.string().min(1).max(35).optional(),
41
+ language: z.string().min(1).max(35).optional(),
42
+ })
43
+ .optional(),
44
+ };
45
+ const page = z.strictObject({ size: z.number().int().min(1).max(L.pageSize), after: cursor.nullable().optional() });
46
+ const PART_REASON = `a list request's part is one of ${LIST_PARTS.join(", ")}`;
47
+ export const listRequestSchema = z.discriminatedUnion("part", [
48
+ z.strictObject({ ...base, part: z.literal("rows"), page, fields: fieldKeys(L.fields).optional() }),
49
+ z.strictObject({
50
+ ...base,
51
+ part: z.literal("group"),
52
+ group: z.strictObject({ key: groupKey }),
53
+ page,
54
+ fields: fieldKeys(L.fields).optional(),
55
+ }),
56
+ z.strictObject({ ...base, part: z.literal("ids") }),
57
+ z.strictObject({
58
+ ...base,
59
+ part: z.literal("counts"),
60
+ counts: z.strictObject({ of: z.enum(["filter", "hold"]), fields: fieldKeys(L.countFields).min(1) }),
61
+ }),
62
+ z.strictObject({ ...base, part: z.literal("values"), field: fieldKey }),
63
+ z.strictObject({
64
+ ...base,
65
+ part: z.literal("view-counts"),
66
+ views: z
67
+ .array(z.strictObject({ id: key, filter: filterTreeSchema }))
68
+ .max(L.views)
69
+ .superRefine((views, ctx) => {
70
+ const seen = new Set();
71
+ for (const view of views) {
72
+ if (seen.has(view.id))
73
+ ctx.addIssue({ code: "custom", message: `view "${view.id}" is counted twice` });
74
+ seen.add(view.id);
75
+ }
76
+ }),
77
+ }),
78
+ ], { error: (issue) => (issue.code === "invalid_union" ? PART_REASON : undefined) });
79
+ const count = z.number().int().min(0);
80
+ const row = z.looseObject({ id: z.string().min(1) });
81
+ const rows = z.array(row);
82
+ const next = z.string().min(1).nullable();
83
+ const labels = z.record(z.string(), z.string());
84
+ const answered = z.discriminatedUnion("part", [
85
+ z
86
+ .object({
87
+ part: z.literal("rows"),
88
+ rows,
89
+ next,
90
+ total: z.object({ count, exact: z.boolean() }).nullable(),
91
+ groups: z
92
+ .array(z.object({
93
+ key: groupKey,
94
+ label: z.string().nullable(),
95
+ count,
96
+ hidden: z.boolean(),
97
+ rows: rows.optional(),
98
+ next: next.optional(),
99
+ }))
100
+ .nullable(),
101
+ })
102
+ .refine((answer) => answer.groups === null || (answer.rows.length === 0 && answer.next === null), {
103
+ message: "a grouped answer holds its rows in its groups",
104
+ }),
105
+ z.object({ part: z.literal("group"), key: groupKey, rows, next }),
106
+ z.object({ part: z.literal("ids"), ids: z.array(z.string().min(1)) }),
107
+ z.object({
108
+ part: z.literal("counts"),
109
+ counts: z.record(z.string(), z.object({ counts: z.record(z.string(), count), labels })),
110
+ }),
111
+ z.object({ part: z.literal("values"), field: z.string(), values: z.array(z.string()), labels }),
112
+ z.object({ part: z.literal("view-counts"), counts: z.record(z.string(), count) }),
113
+ ]);
114
+ const refused = z.object({ refused: z.object({ code: z.string().min(1), message: z.string() }) });
115
+ export const listAnswerSchema = z.union([answered, refused]);
116
+ export function isRefused(answer) {
117
+ return "refused" in answer;
118
+ }
119
+ export function answerFor(request, answer) {
120
+ if (isRefused(answer))
121
+ return answer;
122
+ if (answer.part !== request.part)
123
+ throw new Error(`answered part ${answer.part} to a ${request.part} request`);
124
+ return answer;
125
+ }
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ import { type SavedListSettings } from "./settings.js";
3
+ /** One saved view: shared with everyone or a person's own, its settings without the search, its place in its scope's
4
+ * row and when it last changed (an ISO instant). `readOnly`: a view the app declares in its code. */
5
+ export type SavedView = {
6
+ id: string;
7
+ name: string;
8
+ scope: "shared" | "personal";
9
+ settings: SavedListSettings;
10
+ position: number;
11
+ updatedAt: string;
12
+ readOnly?: boolean;
13
+ };
14
+ /** The one schema of a saved view. Strict: an unknown key, and a search in its settings, are refused. */
15
+ export declare const savedViewSchema: z.ZodType<SavedView>;
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ import { LIST_SETTINGS_LIMITS, savedSettingsSchema } from "./settings.js";
3
+ export const savedViewSchema = z.strictObject({
4
+ id: z.string().min(1).max(LIST_SETTINGS_LIMITS.key),
5
+ name: z.string().min(1).max(200),
6
+ scope: z.enum(["shared", "personal"]),
7
+ settings: savedSettingsSchema,
8
+ position: z.number().finite(),
9
+ updatedAt: z.iso.datetime({ offset: true }),
10
+ readOnly: z.boolean().optional(),
11
+ });