viewkitjs 0.31.0 → 0.33.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 (449) hide show
  1. package/CHANGELOG.md +198 -0
  2. package/MIGRATION.md +40 -6
  3. package/README.md +1 -1
  4. package/fields/dist/index.d.ts +1 -1
  5. package/fields/dist/index.js +1 -1
  6. package/fields/dist/query/evaluate.d.ts +7 -0
  7. package/fields/dist/query/exact-number.d.ts +8 -2
  8. package/fields/dist/query/exact-number.js +14 -1
  9. package/fields/dist/query/index.d.ts +2 -0
  10. package/fields/dist/query/index.js +2 -0
  11. package/fields/dist/query/list-request.d.ts +148 -0
  12. package/fields/dist/query/list-request.js +125 -0
  13. package/fields/dist/query/saved-view.d.ts +15 -0
  14. package/fields/dist/query/saved-view.js +11 -0
  15. package/fields/dist/query/settings.d.ts +9 -0
  16. package/fields/dist/query/settings.js +9 -0
  17. package/fields/dist/query/sort.js +13 -10
  18. package/fields/dist/registry.js +5 -1
  19. package/fields/dist/types.d.ts +4 -1
  20. package/fields/dist/zod.d.ts +5 -0
  21. package/fields/dist/zod.js +10 -1
  22. package/fields/docs/guides/contact-values.md +12 -0
  23. package/fields/docs/guides/field-types.md +1 -1
  24. package/fields/docs/guides/queries.md +3 -1
  25. package/fields/docs/reference/fields.md +1 -0
  26. package/fields/docs/reference/query.md +66 -0
  27. package/package.json +5 -1
  28. package/postgres/README.md +1 -0
  29. package/postgres/dist/check.js +4 -1
  30. package/postgres/dist/definitions/formula-forms.js +3 -1
  31. package/postgres/dist/definitions/money.js +2 -1
  32. package/postgres/dist/handler.d.ts +53 -0
  33. package/postgres/dist/handler.js +211 -0
  34. package/postgres/dist/ids.d.ts +1 -1
  35. package/postgres/dist/ids.js +19 -1
  36. package/postgres/dist/index.d.ts +1 -0
  37. package/postgres/dist/index.js +1 -0
  38. package/postgres/dist/limits.d.ts +3 -1
  39. package/postgres/dist/limits.js +1 -1
  40. package/postgres/dist/list-fields.d.ts +10 -0
  41. package/postgres/dist/list-fields.js +36 -0
  42. package/postgres/dist/page.js +6 -3
  43. package/postgres/dist/readable.d.ts +4 -0
  44. package/postgres/dist/readable.js +4 -0
  45. package/postgres/dist/refusals.d.ts +9 -2
  46. package/postgres/dist/refusals.js +6 -0
  47. package/postgres/dist/rules.d.ts +15 -1
  48. package/postgres/dist/rules.js +16 -0
  49. package/postgres/dist/sort.js +7 -2
  50. package/postgres/docs/guides/definitions.md +1 -1
  51. package/postgres/docs/guides/field-map.md +3 -3
  52. package/postgres/docs/guides/list-handler.md +99 -0
  53. package/postgres/docs/index.md +1 -0
  54. package/postgres/docs/reference/definitions.md +1 -1
  55. package/postgres/docs/reference/postgres.md +12 -4
  56. package/views/README.md +2 -2
  57. package/views/dist/atoms/RowMenu.d.ts +7 -0
  58. package/views/dist/atoms/RowMenu.js +18 -16
  59. package/views/dist/atoms/ToolbarButton.d.ts +1 -1
  60. package/views/dist/atoms/ToolbarButton.js +4 -3
  61. package/views/dist/atoms/carried.d.ts +5 -0
  62. package/views/dist/atoms/carried.js +7 -0
  63. package/views/dist/atoms/frame-parts.d.ts +6 -0
  64. package/views/dist/atoms/frame-parts.js +15 -0
  65. package/views/dist/atoms/types.d.ts +19 -7
  66. package/views/dist/cells/cell-title.d.ts +3 -1
  67. package/views/dist/cells/cell-title.js +2 -2
  68. package/views/dist/cells/cell-values.js +2 -2
  69. package/views/dist/contract.d.ts +56 -11
  70. package/views/dist/contract.js +148 -0
  71. package/views/dist/controls/alert-dialog/alert-dialog.js +2 -1
  72. package/views/dist/controls/atoms.d.ts +2 -0
  73. package/views/dist/controls/atoms.js +2 -0
  74. package/views/dist/controls/avatar/avatar.d.ts +3 -3
  75. package/views/dist/controls/avatar/avatar.js +1 -1
  76. package/views/dist/controls/avatar/tokens.d.ts +44 -0
  77. package/views/dist/controls/avatar/tokens.js +11 -0
  78. package/views/dist/controls/avatar.css +22 -5
  79. package/views/dist/controls/button/map-button.js +2 -0
  80. package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
  81. package/views/dist/controls/checkbox/checkbox.js +2 -2
  82. package/views/dist/controls/choice/tokens.d.ts +0 -4
  83. package/views/dist/controls/choice/tokens.js +0 -1
  84. package/views/dist/controls/choice.css +3 -3
  85. package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
  86. package/views/dist/controls/compound-editor/name-parts.js +4 -4
  87. package/views/dist/controls/compound-editor/place-parts.js +19 -19
  88. package/views/dist/controls/compound-editor/range-parts.js +14 -14
  89. package/views/dist/controls/compound-editor/row.d.ts +3 -1
  90. package/views/dist/controls/compound-editor/row.js +2 -2
  91. package/views/dist/controls/controls.d.ts +8 -0
  92. package/views/dist/controls/controls.js +12 -2
  93. package/views/dist/controls/customize/customize.js +37 -35
  94. package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
  95. package/views/dist/controls/customize/map-customize-body.js +5 -1
  96. package/views/dist/controls/date-editor/date-days.js +2 -2
  97. package/views/dist/controls/date-editor/date-editor.js +18 -18
  98. package/views/dist/controls/date-editor/date-parts.js +6 -6
  99. package/views/dist/controls/date-editor/map-calendar.js +1 -1
  100. package/views/dist/controls/date-editor.css +2 -2
  101. package/views/dist/controls/field/field.d.ts +22 -4
  102. package/views/dist/controls/field/field.js +63 -5
  103. package/views/dist/controls/field/tokens.d.ts +4 -0
  104. package/views/dist/controls/field/tokens.js +1 -0
  105. package/views/dist/controls/field.css +41 -16
  106. package/views/dist/controls/filter-editor/block.d.ts +2 -2
  107. package/views/dist/controls/filter-editor/block.js +5 -5
  108. package/views/dist/controls/filter-editor/filter-editor.js +31 -33
  109. package/views/dist/controls/filter-editor/how.d.ts +3 -1
  110. package/views/dist/controls/filter-editor/map-filter-body.d.ts +1 -0
  111. package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
  112. package/views/dist/controls/filter-editor/map-rules.js +1 -1
  113. package/views/dist/controls/filter-editor/parts.js +2 -1
  114. package/views/dist/controls/glyphs/glyphs.d.ts +10 -0
  115. package/views/dist/controls/glyphs/glyphs.js +173 -0
  116. package/views/dist/controls/group-editor/group-editor.js +15 -13
  117. package/views/dist/controls/index.d.ts +4 -1
  118. package/views/dist/controls/index.js +3 -1
  119. package/views/dist/controls/input/input.js +6 -3
  120. package/views/dist/controls/input/map-input.js +2 -0
  121. package/views/dist/controls/input/tokens.d.ts +4 -0
  122. package/views/dist/controls/input/tokens.js +1 -0
  123. package/views/dist/controls/input.css +31 -3
  124. package/views/dist/controls/internal/editor-parts.js +1 -1
  125. package/views/dist/controls/internal/icons.js +10 -0
  126. package/views/dist/controls/internal/keep-focus.d.ts +2 -0
  127. package/views/dist/controls/internal/keep-focus.js +17 -0
  128. package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
  129. package/views/dist/controls/internal/map-panel-controls.js +20 -0
  130. package/views/dist/controls/internal/panel-controls.d.ts +50 -0
  131. package/views/dist/controls/internal/panel-controls.js +197 -0
  132. package/views/dist/controls/internal/part-slot.d.ts +12 -0
  133. package/views/dist/controls/internal/part-slot.js +5 -0
  134. package/views/dist/controls/internal/watch-frame.d.ts +2 -0
  135. package/views/dist/controls/internal/watch-frame.js +33 -0
  136. package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
  137. package/views/dist/controls/links-editor/links-editor.js +27 -27
  138. package/views/dist/controls/markdown/map-markdown.d.ts +4 -0
  139. package/views/dist/controls/markdown/map-markdown.js +5 -0
  140. package/views/dist/controls/menu/map-menu.d.ts +2 -2
  141. package/views/dist/controls/menu/map-menu.js +15 -12
  142. package/views/dist/controls/menu/menu.d.ts +2 -0
  143. package/views/dist/controls/menu/menu.js +3 -3
  144. package/views/dist/controls/menu-list/menu-list.d.ts +17 -4
  145. package/views/dist/controls/menu-list/menu-list.js +27 -25
  146. package/views/dist/controls/modal/modal.js +5 -1
  147. package/views/dist/controls/notice/notice.d.ts +3 -1
  148. package/views/dist/controls/notice/notice.js +2 -2
  149. package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
  150. package/views/dist/controls/number-editor/number-editor.js +13 -13
  151. package/views/dist/controls/number-field/number-field.js +5 -3
  152. package/views/dist/controls/pane/pane.d.ts +4 -2
  153. package/views/dist/controls/pane/pane.js +6 -5
  154. package/views/dist/controls/phone-header/header-bar.d.ts +5 -1
  155. package/views/dist/controls/phone-header/header-bar.js +2 -2
  156. package/views/dist/controls/phone-header.css +11 -1
  157. package/views/dist/controls/picker/map-picker.js +3 -0
  158. package/views/dist/controls/picker/picker.d.ts +16 -0
  159. package/views/dist/controls/picker/picker.js +61 -40
  160. package/views/dist/controls/picker/rows.d.ts +4 -0
  161. package/views/dist/controls/picker.css +2 -0
  162. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  163. package/views/dist/controls/popover/map-popover.js +4 -2
  164. package/views/dist/controls/popover/popover.js +2 -1
  165. package/views/dist/controls/quick-filters/quick-filters.js +4 -4
  166. package/views/dist/controls/radio/radio.d.ts +8 -3
  167. package/views/dist/controls/radio/radio.js +22 -5
  168. package/views/dist/controls/radio/tokens.d.ts +44 -0
  169. package/views/dist/controls/radio/tokens.js +11 -0
  170. package/views/dist/controls/radio.css +79 -1
  171. package/views/dist/controls/select/map-select.d.ts +3 -0
  172. package/views/dist/controls/select/map-select.js +8 -0
  173. package/views/dist/controls/select/select.d.ts +7 -0
  174. package/views/dist/controls/select/select.js +12 -6
  175. package/views/dist/controls/select/tokens.d.ts +8 -0
  176. package/views/dist/controls/select/tokens.js +2 -0
  177. package/views/dist/controls/select.css +17 -0
  178. package/views/dist/controls/setting-row/looks.d.ts +1 -1
  179. package/views/dist/controls/setting-row/looks.js +9 -4
  180. package/views/dist/controls/setting-row/setting-row.d.ts +45 -10
  181. package/views/dist/controls/setting-row/setting-row.js +82 -15
  182. package/views/dist/controls/setting-row/tokens.d.ts +74 -2
  183. package/views/dist/controls/setting-row/tokens.js +19 -1
  184. package/views/dist/controls/setting-row.css +135 -14
  185. package/views/dist/controls/sheet/bottom-sheet.d.ts +14 -2
  186. package/views/dist/controls/sheet/bottom-sheet.js +6 -3
  187. package/views/dist/controls/sheet/map-sheet.js +1 -1
  188. package/views/dist/controls/sheet.css +4 -1
  189. package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
  190. package/views/dist/controls/sort-editor/map-sort-body.js +7 -3
  191. package/views/dist/controls/sort-editor/sort-editor.js +25 -26
  192. package/views/dist/controls/sort-editor.css +13 -2
  193. package/views/dist/controls/switch-row/tokens.d.ts +0 -12
  194. package/views/dist/controls/switch-row/tokens.js +0 -3
  195. package/views/dist/controls/switch-row.css +3 -7
  196. package/views/dist/controls/switch.css +17 -7
  197. package/views/dist/controls/tag/tag.d.ts +3 -1
  198. package/views/dist/controls/tag/tag.js +2 -2
  199. package/views/dist/controls/tag/tokens.d.ts +4 -0
  200. package/views/dist/controls/tag/tokens.js +1 -0
  201. package/views/dist/controls/tag-field/tag-field.d.ts +5 -1
  202. package/views/dist/controls/tag-field/tag-field.js +11 -5
  203. package/views/dist/controls/tag-field/tokens.d.ts +16 -0
  204. package/views/dist/controls/tag-field/tokens.js +4 -0
  205. package/views/dist/controls/tag-field.css +19 -0
  206. package/views/dist/controls/tag.css +2 -0
  207. package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
  208. package/views/dist/controls/text-editor/text-editor.js +8 -8
  209. package/views/dist/controls/toolbar/toolbar.d.ts +15 -3
  210. package/views/dist/controls/toolbar/toolbar.js +22 -15
  211. package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +14 -0
  212. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +52 -0
  213. package/views/dist/controls/toolbar-button/toolbar-button.d.ts +1 -1
  214. package/views/dist/controls/toolbar-button/toolbar-button.js +2 -3
  215. package/views/dist/controls/toolbar-button.css +4 -0
  216. package/views/dist/controls/toolbar.css +5 -0
  217. package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
  218. package/views/dist/controls/values-editor/values-editor.js +22 -22
  219. package/views/dist/controls/views-list/map-view-menu.d.ts +3 -0
  220. package/views/dist/controls/views-list/map-view-menu.js +25 -0
  221. package/views/dist/controls/views-list/map-views-list-body.d.ts +28 -1
  222. package/views/dist/controls/views-list/map-views-list-body.js +39 -21
  223. package/views/dist/controls/views-list/rules.d.ts +2 -0
  224. package/views/dist/controls/views-list/view-menu.d.ts +7 -0
  225. package/views/dist/controls/views-list/view-menu.js +33 -29
  226. package/views/dist/controls/views-list/views-list.js +4 -4
  227. package/views/dist/controls/views-list/words.d.ts +2 -0
  228. package/views/dist/controls/views-list/words.js +1 -1
  229. package/views/dist/editors/EditorPanel.js +3 -2
  230. package/views/dist/editors/edit-session.js +2 -5
  231. package/views/dist/field-row/FieldRow.d.ts +4 -2
  232. package/views/dist/field-row/FieldRow.js +80 -20
  233. package/views/dist/field-row/FieldRowLane.d.ts +7 -2
  234. package/views/dist/field-row/FieldRowLane.js +4 -3
  235. package/views/dist/field-row/editors/RowEditor.d.ts +12 -0
  236. package/views/dist/field-row/editors/RowEditor.js +31 -1
  237. package/views/dist/field-row/editors/RowValueListEditor.d.ts +5 -1
  238. package/views/dist/field-row/editors/RowValueListEditor.js +4 -1
  239. package/views/dist/field-row/field-row-button.d.ts +5 -0
  240. package/views/dist/field-row/field-row-button.js +2 -0
  241. package/views/dist/fields/binding.d.ts +3 -2
  242. package/views/dist/fields/binding.js +38 -5
  243. package/views/dist/fields/money.d.ts +5 -2
  244. package/views/dist/fields/money.js +14 -2
  245. package/views/dist/grid/chrome/GridColumnMenu.d.ts +4 -2
  246. package/views/dist/grid/chrome/GridColumnMenu.js +3 -2
  247. package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -1
  248. package/views/dist/grid/chrome/GridGroupMenu.js +4 -3
  249. package/views/dist/grid/chrome/GridHeader.d.ts +4 -1
  250. package/views/dist/grid/chrome/GridHeader.js +2 -2
  251. package/views/dist/grid/chrome/GridRow.js +6 -5
  252. package/views/dist/grid/chrome/GridRowCells.js +6 -9
  253. package/views/dist/grid/chrome/GridStructure.d.ts +4 -1
  254. package/views/dist/grid/chrome/GridStructure.js +4 -4
  255. package/views/dist/grid/chrome/GridTable.js +9 -3
  256. package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
  257. package/views/dist/grid/chrome/cell-clipboard.js +2 -2
  258. package/views/dist/grid/chrome/cells.js +3 -1
  259. package/views/dist/grid/chrome/grid-column-menu-items.js +1 -1
  260. package/views/dist/grid/chrome/grid-row-menu-items.d.ts +27 -3
  261. package/views/dist/grid/chrome/grid-row-menu-items.js +93 -7
  262. package/views/dist/grid/chrome/grid-row-props.d.ts +7 -2
  263. package/views/dist/grid/chrome/grid-rows-menu.js +34 -6
  264. package/views/dist/grid/chrome/grid-table-props.d.ts +38 -7
  265. package/views/dist/grid/chrome/useGridBatchApi.d.ts +3 -1
  266. package/views/dist/grid/chrome/useGridBatchApi.js +4 -2
  267. package/views/dist/grid/chrome/useGridKeyboard.d.ts +7 -2
  268. package/views/dist/grid/chrome/useGridKeyboard.js +43 -14
  269. package/views/dist/grid/chrome/useGridPendingReconciliation.js +1 -2
  270. package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
  271. package/views/dist/grid/chrome/useGridTableInteractionModel.js +20 -7
  272. package/views/dist/grid/core/clipboard-model.d.ts +3 -1
  273. package/views/dist/grid/core/clipboard-model.js +9 -8
  274. package/views/dist/grid/core/commit-model.d.ts +20 -2
  275. package/views/dist/grid/core/editing-controller.d.ts +21 -0
  276. package/views/dist/grid/core/editing-controller.js +194 -42
  277. package/views/dist/grid/core/editing-model.d.ts +3 -0
  278. package/views/dist/grid/core/editing-model.js +3 -0
  279. package/views/dist/grid/core/edits-sink.d.ts +19 -0
  280. package/views/dist/grid/core/edits-sink.js +2 -0
  281. package/views/dist/grid/core/save-path.d.ts +24 -0
  282. package/views/dist/grid/core/save-path.js +122 -0
  283. package/views/dist/grid/core/spreadsheet-operations.d.ts +3 -0
  284. package/views/dist/grid/core/spreadsheet-operations.js +24 -1
  285. package/views/dist/grid/core/useGridEditing.d.ts +5 -0
  286. package/views/dist/grid/core/useGridEditing.js +6 -0
  287. package/views/dist/grid/index.d.ts +3 -2
  288. package/views/dist/grid/index.js +1 -0
  289. package/views/dist/internal/field-rows.d.ts +26 -0
  290. package/views/dist/internal/field-rows.js +8 -0
  291. package/views/dist/internal/page-close.d.ts +7 -0
  292. package/views/dist/internal/page-close.js +43 -0
  293. package/views/dist/list/answer.d.ts +40 -0
  294. package/views/dist/list/answer.js +43 -0
  295. package/views/dist/list/browser-views-store.d.ts +10 -0
  296. package/views/dist/list/browser-views-store.js +182 -0
  297. package/views/dist/list/bulk-bar.d.ts +7 -0
  298. package/views/dist/list/bulk-bar.js +10 -0
  299. package/views/dist/list/columns.d.ts +24 -0
  300. package/views/dist/list/columns.js +27 -0
  301. package/views/dist/list/edits.d.ts +19 -0
  302. package/views/dist/list/edits.js +56 -0
  303. package/views/dist/list/grid.d.ts +11 -0
  304. package/views/dist/list/grid.js +76 -0
  305. package/views/dist/list/index.d.ts +36 -0
  306. package/views/dist/list/index.js +11 -0
  307. package/views/dist/list/link.d.ts +8 -0
  308. package/views/dist/list/link.js +78 -0
  309. package/views/dist/list/list.d.ts +70 -0
  310. package/views/dist/list/list.js +14 -0
  311. package/views/dist/list/menu.d.ts +31 -0
  312. package/views/dist/list/menu.js +76 -0
  313. package/views/dist/list/parts.d.ts +6 -0
  314. package/views/dist/list/parts.js +66 -0
  315. package/views/dist/list/registry.d.ts +11 -0
  316. package/views/dist/list/registry.js +31 -0
  317. package/views/dist/list/root-base.d.ts +46 -0
  318. package/views/dist/list/root-base.js +137 -0
  319. package/views/dist/list/root.d.ts +41 -0
  320. package/views/dist/list/root.js +168 -0
  321. package/views/dist/list/slot.d.ts +14 -0
  322. package/views/dist/list/slot.js +22 -0
  323. package/views/dist/list/source-answers.d.ts +39 -0
  324. package/views/dist/list/source-answers.js +225 -0
  325. package/views/dist/list/source.d.ts +11 -0
  326. package/views/dist/list/source.js +31 -0
  327. package/views/dist/list/store.d.ts +119 -0
  328. package/views/dist/list/store.js +146 -0
  329. package/views/dist/list/toolbar.d.ts +7 -0
  330. package/views/dist/list/toolbar.js +371 -0
  331. package/views/dist/list/views-axis.d.ts +5 -0
  332. package/views/dist/list/views-axis.js +98 -0
  333. package/views/dist/list/views-store.d.ts +41 -0
  334. package/views/dist/list/views-store.js +1 -0
  335. package/views/dist/list/views.d.ts +72 -0
  336. package/views/dist/list/views.js +411 -0
  337. package/views/dist/model/column-capabilities.d.ts +13 -0
  338. package/views/dist/model/column-capabilities.js +23 -2
  339. package/views/dist/model/column-schema.d.ts +11 -1
  340. package/views/dist/model/preferences.js +1 -1
  341. package/views/dist/model/prefs-buckets.js +1 -1
  342. package/views/dist/model/view-rules.js +1 -0
  343. package/views/dist/panels/index.d.ts +3 -1
  344. package/views/dist/panels/index.js +1 -0
  345. package/views/dist/panels/model.d.ts +2 -0
  346. package/views/dist/panels/react/customize-body.js +1 -0
  347. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +47 -4
  348. package/views/dist/panels/react/toolbar/ReadyToolbar.js +6 -326
  349. package/views/dist/panels/react/toolbar/Toolbar.d.ts +17 -2
  350. package/views/dist/panels/react/toolbar/Toolbar.js +43 -23
  351. package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
  352. package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
  353. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
  354. package/views/dist/panels/react/toolbar/ToolbarButton.js +7 -1
  355. package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
  356. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -1
  357. package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
  358. package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
  359. package/views/dist/panels/react/toolbar/ToolbarNew.js +2 -2
  360. package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
  361. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +2 -2
  362. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +3 -1
  363. package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
  364. package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
  365. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
  366. package/views/dist/panels/react/toolbar/context.d.ts +20 -3
  367. package/views/dist/panels/react/toolbar/context.js +3 -1
  368. package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
  369. package/views/dist/panels/react/toolbar/panel-part.js +5 -3
  370. package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +1 -1
  371. package/views/dist/panels/react/views-row/FoldingViewRow.js +15 -4
  372. package/views/dist/panels/react/views-row/PillGroup.d.ts +5 -2
  373. package/views/dist/panels/react/views-row/PillGroup.js +16 -7
  374. package/views/dist/panels/react/views-row/ViewPicker.js +2 -12
  375. package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +4 -2
  376. package/views/dist/panels/react/views-row/ViewPickerRow.js +9 -5
  377. package/views/dist/panels/react.d.ts +2 -2
  378. package/views/dist/panels/settings/filter-groups.js +6 -1
  379. package/views/dist/panels/toolbar/edit-view.d.ts +7 -1
  380. package/views/dist/panels/toolbar/edit-view.js +14 -0
  381. package/views/dist/panels/toolbar/model.d.ts +5 -0
  382. package/views/dist/panels/toolbar/model.js +7 -3
  383. package/views/dist/panels/view-state.d.ts +5 -3
  384. package/views/dist/panels/views-row/model.d.ts +19 -2
  385. package/views/dist/panels/views-row/model.js +14 -0
  386. package/views/dist/provider/ViewsProvider.d.ts +21 -8
  387. package/views/dist/provider/ViewsProvider.js +40 -5
  388. package/views/dist/provider/components.d.ts +102 -2
  389. package/views/dist/provider/components.js +1 -1
  390. package/views/dist/provider/context.d.ts +6 -2
  391. package/views/dist/provider/context.js +1 -1
  392. package/views/dist/provider/own-control.d.ts +4 -0
  393. package/views/dist/provider/own-control.js +7 -0
  394. package/views/dist/provider/ports.d.ts +19 -12
  395. package/views/dist/provider/ports.js +69 -1
  396. package/views/dist/provider/select-items.d.ts +3 -0
  397. package/views/dist/provider/select-items.js +6 -0
  398. package/views/dist/react.d.ts +4 -2
  399. package/views/dist/react.js +2 -0
  400. package/views/dist/styles.css +503 -136
  401. package/views/dist/styles.unlayered.css +503 -136
  402. package/views/docs/contract.md +292 -34
  403. package/views/docs/controls/avatar.md +11 -0
  404. package/views/docs/controls/choice.md +0 -1
  405. package/views/docs/controls/compound-editor.md +4 -0
  406. package/views/docs/controls/customize.md +6 -0
  407. package/views/docs/controls/date-editor.md +4 -0
  408. package/views/docs/controls/field.md +7 -0
  409. package/views/docs/controls/filter-editor.md +8 -0
  410. package/views/docs/controls/group-editor.md +6 -0
  411. package/views/docs/controls/input.md +5 -0
  412. package/views/docs/controls/links-editor.md +4 -0
  413. package/views/docs/controls/menu-list.md +8 -0
  414. package/views/docs/controls/menu.md +4 -0
  415. package/views/docs/controls/notice.md +4 -0
  416. package/views/docs/controls/number-editor.md +4 -0
  417. package/views/docs/controls/pane.md +4 -0
  418. package/views/docs/controls/picker.md +8 -0
  419. package/views/docs/controls/quick-filters.md +6 -0
  420. package/views/docs/controls/radio.md +20 -1
  421. package/views/docs/controls/select.md +10 -0
  422. package/views/docs/controls/setting-row.md +18 -0
  423. package/views/docs/controls/sheet.md +4 -0
  424. package/views/docs/controls/sort-editor.md +8 -0
  425. package/views/docs/controls/switch-row.md +0 -3
  426. package/views/docs/controls/tag-field.md +4 -0
  427. package/views/docs/controls/tag.md +1 -0
  428. package/views/docs/controls/text-editor.md +4 -0
  429. package/views/docs/controls/values-editor.md +4 -0
  430. package/views/docs/controls/views-list.md +6 -0
  431. package/views/docs/getting-started.md +2 -2
  432. package/views/docs/guides/atoms.md +2 -2
  433. package/views/docs/guides/columns.md +1 -1
  434. package/views/docs/guides/ports.md +1 -1
  435. package/views/docs/guides/the-grid.md +36 -9
  436. package/views/docs/guides/the-provider.md +22 -3
  437. package/views/docs/index.md +1 -0
  438. package/views/docs/reference/controls.md +41 -29
  439. package/views/docs/reference/editors-session.md +1 -1
  440. package/views/docs/reference/field-row.md +9 -1
  441. package/views/docs/reference/grid.md +15 -9
  442. package/views/docs/reference/list.md +357 -0
  443. package/views/docs/reference/looks.md +1 -1
  444. package/views/docs/reference/panels-react.md +17 -12
  445. package/views/docs/reference/panels.md +8 -5
  446. package/views/docs/reference/react.md +24 -16
  447. package/views/docs/reference/views.md +10 -6
  448. package/views/docs/reshaping.md +6 -1
  449. package/views/skills/views/SKILL.md +9 -6
@@ -365,7 +365,7 @@ Inside a relation rule, a rule on a field the related table doesn't define has n
365
365
 
366
366
  A rule ViewKit wouldn't accept (an operator its field doesn't offer, a value of the wrong shape, a part its type doesn't have, a day that doesn't exist) is refused as `bad-rule`, at its place in the tree, and so is a date rule sent with no `context`, or a `context` whose time zone, region or moment can't be read. A rule naming a field your map doesn't hold is refused as `unknown-field`, where ViewKit in memory would have no opinion: a list's settings set such a rule aside before it reaches you.
367
367
 
368
- A request is held to caps before anything reads its tree (`REQUEST_LIMITS`): 500 rules and groups in the filter it compiles, the quick-filter hold on top and the root among them; 32 levels deep, the root 1 and each group and each relation rule's `where` one deeper than the group holding it; 50 search words; and 30,000 values in any one statement, under Postgres's own 65,535. Past one, it is refused as `too-big`, its message naming the cap and the place (`filter: a filter holds at most 500 rules and groups`), never answered with a statement your database refuses or a stack that overflows. The busiest saved views we have seen hold a handful of rules three levels deep, so the caps are far above any real list. Lower any of them for a map with `limits` (`defineFieldMap({ …, limits: { depth: 3 } })` holds a request to the depth a list's settings allow); a cap above ViewKit's is refused as a `FieldMapError`.
368
+ A request is held to caps before anything reads its tree (`REQUEST_LIMITS`): 500 rules and groups in the filter it compiles, the quick-filter hold on top and the root among them; 32 levels deep, the root 1 and each group and each relation rule's `where` one deeper than the group holding it; 50 search words; 30,000 values in any one statement, under Postgres's own 65,535; and 100,000 ids an `ids` request answers. Past one, it is refused as `too-big`, its message naming the cap and the place (`filter: a filter holds at most 500 rules and groups`), never answered with a statement your database refuses or a stack that overflows. The busiest saved views we have seen hold a handful of rules three levels deep, so the caps are far above any real list. The ids' cap is twice the most ids a real select-all or bulk action takes (50,000): an `ids` request reads a count capped there first, so a list past it is refused (`ids: a list answers at most 100,000 ids; narrow the list first`) after one statement, before any id is read. A drag in a list in manual order reads the same ids, so it is refused too in a list that keeps more. Lower any of them for a map with `limits` (`defineFieldMap({ …, limits: { depth: 3 } })` holds a request to the depth a list's settings allow); a cap above ViewKit's is refused as a `FieldMapError`.
369
369
 
370
370
  ### A quick-filter hold
371
371
 
@@ -412,7 +412,7 @@ assert.deepEqual(unserved, []);
412
412
  - A word of one or two letters reads every row: a trigram index has nothing to look it up by.
413
413
  - The indexes serve a statement Postgres plans with its values, as it plans one sent unnamed (`pg`, Prisma's driver adapters, a transaction pooler). A prepared statement planned generically reads every row, with the same answers.
414
414
  - A relation's column, when it is your expression, now runs on every row a search reads, so it must never raise.
415
- - An index holds only immutable SQL. A `search` read, a label or a formula that calls a function Postgres won't index (`concat_ws`, `concat`, `to_char`, `unaccent`, `now()`) is named in `unserved` (`notImmutable`, or `farLabel` for a relation's far label) and never printed. A name kept in parts is labelled in immutable SQL, so its index builds. Write your own label the same way: `COALESCE(given || ' ' || family, given, family)`, not `concat_ws`. A stable cast (text to a date or a timestamp) is not recognised: an index on one is printed, and `CREATE INDEX` refuses it (`42P17`).
415
+ - An index holds only immutable SQL. A `search` read, a label or a formula that calls a function Postgres won't index (`concat_ws`, `concat`, `to_char`, `unaccent`, `now()`) is named in `unserved` (`notImmutable`, or `farLabel` for a relation's far label) and never printed. A name kept in parts is labelled in immutable SQL, so its index builds, and so is a formula's `join` and `concat` of text; a formula that reads a day, an instant or a number into text still reaches `to_char` and is named unserved. Write your own label the same way: `COALESCE(given || ' ' || family, given, family)`, not `concat_ws`. A stable cast (text to a date or a timestamp) is not recognised: an index on one is printed, and `CREATE INDEX` refuses it (`42P17`).
416
416
  - Each trigram index adds cost to every insert and update on its table, so index only the fields a list searches. Built without `CONCURRENTLY` inside a migration's transaction, an index blocks writes to its table until the migration commits.
417
417
 
418
418
  Measured on a list of about 26,000 records searched across five fields, one a formula and one a relation: with every word of three letters or more, each statement took under 50 ms through its indexes, where reading every row took 110–270 ms.
@@ -682,7 +682,7 @@ Each of these counts or pages the rows `keysQuery` keeps, under the same permiss
682
682
 
683
683
  - **`fieldValuesQuery(request, fieldKey)`** is an open field's values, for a filter's options when the field has no fixed list: an open select's or tag list's values, a relation's, a user's or an actor's records, each named in `labels`, the most held first, then by value in the database's order, cut at 1,000 (`FIELD_VALUES_LIMIT`). It reads the request's whole filter and search: hand in the rows you mean (a record tab's pin, say, and no view filter, so picking a value never makes the others vanish). Any other field is refused as `no-options`. A record its own table's condition hides is never offered. It also answers a far field's values, for a Where row inside a relation rule, through a path of one or two relations: `<relation>.<far field>` or `<relation>.<relation>.<far field>`, each relation a field of the table the one before reaches. They are the distinct values of the far records the kept rows reach, each relation's own `where` applied (never its `within`), named as the list's own are, every table read under its own condition, and counted by the rows that reach them. A key your map holds as written is its own field. A path it can't follow is refused as `unknown-field`, one reaching a table whose fields your map doesn't describe as `no-fields`.
684
684
  - **`viewCountsQuery`** counts each view in one statement, each view's `filter` beside the request's own filter and search (a quick filter, a pin), at most 100 views (`VIEW_COUNTS_LIMIT`).
685
- - **`idsQuery`** is every key the list keeps, in the order its pages hold them, read a page of 1,000 a step with no cap: the ids behind "select all matching", and with manual order and no filter, the order a drag splices into.
685
+ - **`idsQuery`** is every key the list keeps, in the order its pages hold them, read a page of 1,000 a step, at most the map's `limits.ids` (100,000 unless lowered; past it, refused `too-big` after one capped count): the ids behind "select all matching", and with manual order and no filter, the order a drag splices into.
686
686
  - **`groupPageQuery`** pages one group's rows, by keyset, under the list's sorts or its manual order: exactly the rows the group counts. Its cursor is bound to the group and its key, so a cursor of one group is refused for another.
687
687
  - **`lanesQuery`** is a board's lanes: every lane's count, then one statement holding the first `size` cards (25, `LANE_ROWS`) of the first `fill` lanes shown (10, `LANES_FILLED`). Hand the board's field as a group (fields' `boardAxis`): a status, a select, a yes-or-no, a relation of one record or a user; a board by a relation that names `sortBy` opens a lane for each far record the reader may see, an empty one answered filled, with no cards; any other is refused as `no-layout`. A set-aside board field is no board field: replace it with `boardAxis(defaultBoardField(…), lanes)` before you ask; a `board` that still carries the mark gets one `"_all"` lane of every row, its field checked only for whether the reader may read it. Each lane's `next` is read by `groupPageQuery` for that lane.
688
688
  - **`calendarQuery`** is a calendar's month in the request's zone, in one statement: each day's count, the first 500 rows in date order (`CALENDAR_ROWS_LIMIT`), and every day those didn't reach topped up with its first 2 (`CALENDAR_DAY_ROWS`), so each cell draws what it holds and its "+N" is the day's real count. At most 42 days (`CALENDAR_DAYS_LIMIT`); a date or a date and time only, else `no-layout`. The zone is read only in each day's first instant, worked out in JavaScript.
@@ -0,0 +1,99 @@
1
+ # Answering a list's requests
2
+
3
+ A list on the page asks its server for what it shows: a page of rows (or of groups), one group's next page, every matching id, the counts beside a filter's options, an open field's values, each saved view's count. Each request is one value, `listRequestSchema` in `viewkitjs/fields/query`, and its answer is one value too. `listHandler` answers all of them in one route; `answerList` is the same answer called directly, for a server action.
4
+
5
+ ## The route
6
+
7
+ You hand it three things, all your server's: the field map, how your app runs a statement, and who is asking, read from your own session on every request.
8
+
9
+ ```ts
10
+ import assert from "node:assert/strict";
11
+ import { defineFieldMap, EVERY_FIELD, listHandler, sql, type ListReader, type Row, type Run } from "viewkitjs/postgres";
12
+
13
+ const map = defineFieldMap({
14
+ table: "deals",
15
+ tables: {
16
+ deals: { name: "crm.deals", key: "id", softDelete: "deleted_at", keyStored: "uuid" },
17
+ companies: { name: "crm.companies", key: "id", softDelete: "deleted_at", label: "name", keyStored: "uuid" },
18
+ },
19
+ relations: { company: { from: "deals", to: "companies", column: "company_id" } },
20
+ definitions: [
21
+ { key: "title", label: "Title", type: "text" },
22
+ { key: "stage", label: "Stage", type: "select", options: [{ value: "won", label: "Won" }] },
23
+ { key: "company", label: "Company", type: "relation", relation: { kind: "company" } },
24
+ ],
25
+ fields: {
26
+ title: { value: "title", stored: "text" },
27
+ stage: { value: "stage", stored: "text" },
28
+ company: { value: { relation: "company" }, stored: "uuid" },
29
+ },
30
+ });
31
+
32
+ // Your database client: a pool's query, Prisma's raw query. This one finds nothing: every count is 0, every read empty.
33
+ const run: Run = async (query) => (query.text.startsWith("SELECT count(*)") ? [{ total: 0 }] : []);
34
+
35
+ // Your own session: who is signed in, and in which workspace. Never the request's body.
36
+ async function sessionOf(request: Request): Promise<{ workspaceId: string } | null> {
37
+ void request;
38
+ return null;
39
+ }
40
+
41
+ async function readerOf(request: Request): Promise<ListReader | null> {
42
+ const session = await sessionOf(request);
43
+ if (session === null) return null;
44
+ const inWorkspace = (row: Row) => sql`${row.column("workspace_id")} = ${session.workspaceId}`;
45
+ return {
46
+ access: { deals: inWorkspace, companies: inWorkspace },
47
+ readable: { deals: EVERY_FIELD, companies: EVERY_FIELD },
48
+ };
49
+ }
50
+
51
+ // app/api/deals/list/route.ts in a Next app; any framework that hands a Request and takes a Response.
52
+ export const POST = listHandler({ map, run, access: readerOf });
53
+
54
+ const nobody = await POST(new Request("https://app.example/api/deals/list", { method: "POST", body: "{}" }));
55
+ assert.equal(nobody.status, 401);
56
+ ```
57
+
58
+ What each answer means:
59
+
60
+ - **200**: the answer, as JSON.
61
+ - **400**: a refusal, `{ refused: { code, message } }`: the body is no list request (`bad-request`, a locale Intl doesn't know included), it names a field the reader may not read (`hidden-field`), it passes a cap (`too-big`, a group whose key is longer than an answer holds included). The views side's `fetchSource` reads it as a refusal, not a failure.
62
+ - **401**: `access` handed back null. The body is never read.
63
+
64
+ Every answer is sent with `cache-control: no-store`. The handler only reads, so it sets no method and no size of its own: your route says which method it takes, and caps the body's size, since the handler reads the whole body before it parses it.
65
+
66
+ ## Called directly
67
+
68
+ `answerList` takes the request as it came (any value: it is checked first) and the reader's own `access` and `readable`. It hands back the answer or the refusal as a value, never a throw, so a server action hands it back as it is.
69
+
70
+ ```ts
71
+ import { answerList } from "viewkitjs/postgres";
72
+
73
+ // In a server action: the reader from your session, as the route's `readerOf` reads it.
74
+ const inW1 = (row: Row) => sql`${row.column("workspace_id")} = ${"w1"}`;
75
+ const answered = await answerList(
76
+ { version: 1, part: "ids", settings: { filter: { op: "and", items: [] }, sorts: [], group: null } },
77
+ { map, run, access: { deals: inW1, companies: inW1 }, readable: EVERY_FIELD }
78
+ );
79
+ assert.deepEqual(answered, { part: "ids", ids: [] });
80
+ ```
81
+
82
+ ## What your reader hands in
83
+
84
+ - **A condition for every table the map's fields reach**: the list's own and each far table a relation reads, here `companies` too. A request that reads a table with no condition is refused (`no-condition`), never read whole.
85
+ - **The fields they may read**, a list for every table the map's fields reach (`companies` too), or `EVERY_FIELD` for all of them: a request reading a table with no list is refused (`no-field-list`), the default fields included. A request naming a field outside them is refused before any statement runs; the fields a row or a search reads by default leave it out.
86
+ - A page's pinned narrowing ("this company's deals") is not in the request. Add it in your reader's condition, ANDed onto the reader's own, never in its place: `` (row) => sql`${row.column("workspace_id")} = ${id} AND ${row.column("company_id")} = ${company}` ``.
87
+
88
+ ## Which fields a row and a search read
89
+
90
+ - **A row** carries the fields the request names (`fields`), or, when it names none, every field the reader may read whose value they may read. A field whose value reads one they may not (a relation filtered by a field they can't see) is left out of the default; named, it is refused.
91
+ - **A search** reads the fields you name in `search` on the handler, or, when you name none, every field of the list's table the reader may read that a search answers: text, an option by its label, a phone, a relation of one record by its far record's label. A field you name that this reader may not read is left out for them; one the map doesn't hold, or one no search answers yet (a field of several values, a relation of several records, a name, a place, a user), refuses every request that searches, so name only fields a search reads. The request carries only the search's words.
92
+
93
+ ## A grouped list
94
+
95
+ A `rows` request on a grouped list answers every group, each with its count, and the first ten that aren't hidden carry their first 25 rows and the cursor of their next page; a `group` request pages one further, `page.size` rows at a time. A grouped `rows` request takes no cursor. `total` counts the whole list, on a first page only.
96
+
97
+ ## Every matching id
98
+
99
+ An `ids` request answers every id the list keeps, up to 100,000 of them: a count capped there first, then one statement for each 1,000 ids, one after another. It is what "select all matching" reads, and what a drag reads in a list in manual order with no filter. 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 that one count, before any id is read, the drag's read among them; lower the cap on the map with `limits: { ids }`.
@@ -6,6 +6,7 @@ Every example on these pages is compiled and run against the packed package befo
6
6
 
7
7
  - [The field map and the permission condition](guides/field-map.md): tables, fields, relations, the condition, what the translator trusts, filtering, and ordering a page
8
8
  - [A field map from your definitions](guides/definitions.md): a storage declaration and your field definitions turned into the field map, the tables and columns it reads, and what it leaves out
9
+ - [Answering a list's requests](guides/list-handler.md): one route for every request a list makes, `listHandler`, or `answerList` in a server action; what each status means, which fields a row and a search read, and what your reader hands in
9
10
  - [Proving your answers with the test kit](guides/test-kit.md): a backend for `viewkitjs/fields/testing` built on the translator, and running it over your own database
10
11
  - [Reference](reference/postgres.md): every export
11
12
  - [Reference: definitions](reference/definitions.md): every export of `viewkitjs/postgres/definitions`
@@ -19,7 +19,7 @@ A field map from your definitions and a storage declaration. Guide: [a field map
19
19
 
20
20
  ## Your money function
21
21
 
22
- - `ConvertMoney` — your one money function, `({ amount, currency, day, into }) => Sql`: the amount converted, as SQL; a zero or missing rate reads null, never raises. Called wherever a definition converts an amount, on the list's own rows, in the currency the request's `context.currencies` names for the field.
22
+ - `ConvertMoney` — your one money function, `({ amount, currency, day, into }) => Sql`: the amount converted, as SQL; a zero or missing rate reads null, never raises. Called wherever a definition converts an amount, on the list's own rows, in the currency the request's `context.currencies` names for the field, and in a sort by such a field that it names none for, in `context.sortCurrency`.
23
23
  - `MoneyAsk` — one conversion: the amount (`numeric`), its currency (the row's code, as text), the day it converts on, and the currency it converts into.
24
24
  - `MoneyDay` — the day an amount converts on: `{ ask }`, the request's moment, read as its UTC day; or `{ row, type }`, a row's own date (`"date"`) or instant (`"datetime"`, a `timestamptz`), read as its UTC day.
25
25
  - `MoneyInto` — the currency an amount converts into: the request's, as text, or the one a rollup's result names, a fixed code or its record's own as SQL.
@@ -27,7 +27,7 @@ The one door. Guide: [the field map and the permission condition](../guides/fiel
27
27
  - `Row` — a row the translator opened: `alias` is the plain name it was opened under (`vk_r0`), `column(name)` quotes a column under it, `key` is its key column.
28
28
  - `Several` — how a field of several values keeps them: an array, a json array, or rows of their own, which may name their main mark (`main`, a boolean column or your condition over the row) for a sort by the main one, whether at most one row per record holds that mark (`oneMain: true`, your write path's promise), which reads the main rows through one join, and the columns that pick one field's rows out of a table many fields share (`pick`).
29
29
  - `Stored` — the SQL type a value is kept as. A select or a status is kept as `text` or `uuid`.
30
- - `REQUEST_LIMITS` — the most a list request compiles: 500 rules and groups in a filter, the root among them (`rules`); 32 levels deep, the root 1 and each group and each relation rule's `where` one deeper than the group holding it, a rule no level (`depth`); 50 search words (`searchWords`); 30,000 values a statement (`parameters`). The filter counted is the one compiled, the quick-filter hold on top. An app lowers any on its map, never past these.
30
+ - `REQUEST_LIMITS` — the most a list request compiles: 500 rules and groups in a filter, the root among them (`rules`); 32 levels deep, the root 1 and each group and each relation rule's `where` one deeper than the group holding it, a rule no level (`depth`); 50 search words (`searchWords`); 30,000 values a statement (`parameters`); 100,000 ids an `ids` request answers (`ids`). The filter counted is the one compiled, the quick-filter hold on top. An app lowers any on its map, never past these.
31
31
  - `RequestLimits` — the caps a map holds (`FieldMap.limits`): ViewKit's, or lower where the app lowered them.
32
32
  - `TextSort` — how every text a sort reads is compared: `collation`, the one collation it compares under, quoted whole, and `length`, how many characters of it are read. Neither: as its column compares it, whole.
33
33
  - `TableMap` — one of the app's tables or views: its name, its key column, its soft-delete column or null, what a person reads its records by (`label`, a column or your expression over its row returning text), which a search, a sort or a group by a relation to it reads, and how its key is kept (`keyStored`), which a page and a read by id need; on a table many kinds share, the columns that pick this kind's records out of it (`pick`).
@@ -47,7 +47,15 @@ The one door. Guide: [the field map and the permission condition](../guides/fiel
47
47
  - `EveryField` — `EVERY_FIELD`'s own type: a symbol no other symbol passes for, kept as it is in a request built apart from its call.
48
48
  - `Readable` — the fields the reader may read: `EVERY_FIELD`, or per table of the map, by its table keys, a list of field keys or `EVERY_FIELD`. A request names a field it doesn't hold, in a filter, a hold, a sort, a group, a board, a calendar, a count, a figure, a search or a read of values, and is refused as `hidden-field`, a rule set aside or still being typed included. A far field is held by its own table's list. A field worked out from others (a lookup, a rollup, a formula, an amount that converts, a relation of several records pointing back) is readable only when each field it reads is, on its own table's list. A table's label is no field: whoever may see a record reads its label, so hiding a table's name field doesn't hide its label. A key the map doesn't place grants nothing and is no refusal.
49
49
  - `RefusedRequest` — a request the translator writes no SQL for; `code` says why.
50
- - `RefusalCode` — why a request is refused: `not-a-map`, `unknown-table`, `not-a-condition`, `no-condition`, `no-sql`, `unknown-field`, `unsafe-mapping`, `bad-rule` (a filter rule ViewKit wouldn't accept, at its place, or a search text Postgres can't keep), `bad-hold` (a quick-filter hold fields' `listHoldSchema` refuses, at its place), `bad-sort` (a sort or a manual order it can't answer, at its place), `bad-cursor` (a cursor read under other settings, or one it can't read), `no-label` (a search or a sort by a relation whose far table names no label), `no-options` (a field with no options to count, or none whose values it offers), `too-many` (more keys or date buckets than the limit), `too-big` (a filter, a search or a statement past one of the request's caps, its message naming the cap and the place), `no-layout` (a board or a calendar laid out by a field that can't lay one out), `no-fields` (a relation rule, a far value or a sort by a far field reaching a table whose fields the map doesn't describe), `no-field-list` (a request handing no list of readable fields, or none for a table one of its reads reaches), `not-a-field-list` (a table's readable fields that are neither a list of keys nor `EVERY_FIELD`), `hidden-field` (a field the reader may not read, or one worked out from such a field, named at its place in the map, never with a value) or `not-yet`.
50
+ - `RefusalCode` — why a request is refused: `not-a-map`, `unknown-table`, `not-a-condition`, `no-condition`, `no-sql`, `unknown-field`, `unsafe-mapping`, `bad-rule` (a filter rule ViewKit wouldn't accept, at its place, or a search text Postgres can't keep), `bad-hold` (a quick-filter hold fields' `listHoldSchema` refuses, at its place), `bad-sort` (a sort or a manual order it can't answer, at its place), `bad-cursor` (a cursor read under other settings, or one it can't read, or a cursor on a grouped list's first read), `no-label` (a search or a sort by a relation whose far table names no label), `no-options` (a field with no options to count, or none whose values it offers), `too-many` (more keys or date buckets than the limit), `too-big` (a filter, a search or a statement past one of the request's caps, its message naming the cap and the place, or a group whose key is longer than a list's answer holds), `no-layout` (a board or a calendar laid out by a field that can't lay one out), `no-fields` (a relation rule, a far value or a sort by a far field reaching a table whose fields the map doesn't describe), `no-field-list` (a request handing no list of readable fields, or none for a table one of its reads reaches), `not-a-field-list` (a table's readable fields that are neither a list of keys nor `EVERY_FIELD`), `hidden-field` (a field the reader may not read, or one worked out from such a field, named at its place in the map, never with a value), `bad-request` (a body that is no list request, its first issue at its place, a locale or names language Intl doesn't know, or a group's page asked with no group), `reserved-id` (a field map holding a field keyed `id`, the key a list's answer keeps for the record's id) or `not-yet`.
51
+
52
+ ## Answering a list request
53
+
54
+ - `answerList` — `(request, options)`: the answer to a list request (fields' `listRequestSchema`, the one the views side sends), one part's answer as fields' `ListAnswer`, or `{ refused: { code, message } }`, never a thrown refusal. It reads the request under the options' map, condition and readable fields only, runs one statement at a time through `run`, and answers each part: `rows` (a page with its cursor and, on a first page, the exact `total`; grouped, every group, the first ten not hidden carrying their first 25 rows and their `next`), `group` (one group's next page), `ids` (refused `too-big` past the map's `limits.ids`), `counts`, `values` and `view-counts`. A row is `{ id, ...values }`, `id` the record's key as text. A row reads the fields the request names, or every field the reader may read whose value they may read; a search reads the options' `search` fields (one the reader may not read left out; an unknown one, or one no search answers yet, refuses every searched request), or every field the reader may read that a search answers. A grouped answer whose group key is longer than the answer holds (512 characters) is refused `too-big`. A field the request names that the reader may not read is refused before any statement runs; one the defaults or the options' `search` would read is left out.
55
+ - `AnswerListOptions` — `map`, `run`, `access` and `readable` (the reader's, from your session), and `search`, the keys of the list's own table a search reads.
56
+ - `listHandler` — `(options)`: a route for every list request a page makes, a Fetch `Request` in and a `Response` out (Next, Hono, a Worker). It reads the reader with `options.access(request)` first, and answers 401 with no body read when it hands back null; then 400 with the refusal, or 200 with the answer, as JSON, never cached (`cache-control: no-store`). Its `Request` and `Response` are your runtime's own types.
57
+ - `ListHandlerOptions` — `map`, `run`, `access` (the request's reader, or null when there is none, read from your own session, never from the body) and `search`, as `answerList`'s.
58
+ - `ListReader` — one request's reader: `access`, the condition per table, and `readable`, the fields per table.
51
59
 
52
60
  ## Statements
53
61
 
@@ -64,7 +72,7 @@ The one door. Guide: [the field map and the permission condition](../guides/fiel
64
72
  - `PageQuery` — a page's SQL text and values, and `readPage(rows)`, which reads the rows the app ran it for into a page.
65
73
  - `groupPageQuery` — one page of one group's rows under the list's sorts or its manual order, after a cursor or by its number: exactly the rows the group counts, its cursor bound to the group and its key. A board lane's next page.
66
74
  - `GroupPageRequest` — a page's request, the list's `group` (ViewKit's `GroupSpec`) and the `key` of the group it pages.
67
- - `idsQuery` — every key the list keeps, in its page order, a page of `IDS_PAGE` a step, uncapped: the ids behind "select all matching", and the order a drag splices into.
75
+ - `idsQuery` — every key the list keeps, in its page order, a page of `IDS_PAGE` a step, after a count capped at the map's `limits.ids` (100,000 unless lowered): the ids behind "select all matching", and the order a drag splices into. A list past the cap is refused `too-big` after that count, before any id is read, the drag's read among them; rows added after the count are refused once the pages pass it.
68
76
  - `IdsRequest` — a page's request without its size, cursor or number.
69
77
  - `IDS_PAGE` — 1000: the ids one step of `idsQuery` reads.
70
78
  - `valuesQuery` — the values of the records a request names by key, under the same condition, filter and search: each record the reader may see once, in the order named, with each field asked as ViewKit draws it, `VALUES_PAGE` keys a step, uncapped.
@@ -73,7 +81,7 @@ The one door. Guide: [the field map and the permission condition](../guides/fiel
73
81
  - `VALUES_PAGE` — 1000: the keys one step of `valuesQuery` reads.
74
82
  - `Page` — a page's `keys` in order, and `next`, the cursor the next page starts after, or null after the last.
75
83
  - `KeysRequest` — a request: the app's map, its permission condition and the fields the reader may read (`readable`, required); the list's filter tree (relation rules and a value's parts included), its search (each word in some field it names, or the whole text a row's key), its quick-filter `hold` (fields' `ListHold`, on top of the filter: every statement keeps only rows that pass both, and a page's cursor is bound to it), and the context a date rule reads.
76
- - `FilterContext` — what a rule reads beside its row: the reader's time zone and the moment relative days count from, which a date rule needs, and the reader's `region` (two letters), which a phone typed without its country code is read in; `since`, the instant a relation's `within` reads a rule's records from, never bound into a cursor; and `currencies`, the currency each field whose definition converts is read in, by key, bound into a page's cursor when it sorts, filters or groups by one.
84
+ - `FilterContext` — what a rule reads beside its row: the reader's time zone and the moment relative days count from, which a date rule needs, and the reader's `region` (two letters), which a phone typed without its country code is read in; `since`, the instant a relation's `within` reads a rule's records from, never bound into a cursor; `currencies`, the currency each field whose definition converts is read in, by key, bound into a page's cursor when it sorts, filters or groups by one; and `sortCurrency`, the currency such a field is sorted in when `currencies` names none for it (your app's own): its amount converted into it orders the rows while each still reads as kept, bound into the cursor of a page sorted by one.
77
85
 
78
86
  ## Counts and groups
79
87
 
package/views/README.md CHANGED
@@ -10,7 +10,7 @@ The grid, its cells, the field display and the editors over typed fields: a head
10
10
  pnpm add viewkitjs zod
11
11
  ```
12
12
 
13
- ESM only. Node 20 or later. `viewkitjs/fields` ships in the same package. `zod` `^4.1.12` is a peer; `react` and `react-dom` 19 are optional peers that the views part needs, which a React app already has; `@dnd-kit/core`, `@dnd-kit/sortable` and `@dnd-kit/utilities` are optional ones, for the panels' parts that drag (the views row's pills, the sort's rules, the Columns list, the group order), which the door loads with `import()` as it loads: `/panels/react` itself loads without them. Import its stylesheet in one line (`@import "viewkitjs/views/styles.css";`), or let your own Tailwind compile it with one `@source` line: [docs/install.md](./docs/install.md).
13
+ ESM only. Node 20 or later. `viewkitjs/fields` ships in the same package. `zod` `^4.1.12` is a peer; `react` and `react-dom` 19 are optional peers that the views part needs, which a React app already has; `@dnd-kit/core`, `@dnd-kit/sortable` and `@dnd-kit/utilities` are optional ones, for the panels' parts that drag (the views row's pills, the sort's rules, the Columns list, the group order), which the door loads with `import()` as it loads: `/panels/react` and `/list` themselves load without them. Import its stylesheet in one line (`@import "viewkitjs/views/styles.css";`), or let your own Tailwind compile it with one `@source` line: [docs/install.md](./docs/install.md).
14
14
 
15
15
  ## Getting started
16
16
 
@@ -69,7 +69,7 @@ Guides:
69
69
  - [The grid](./docs/guides/the-grid.md): grouping, sorting, writes, preferences, figures and the editing rules.
70
70
  - [The rendering contract](./docs/contract.md): every public name and what each door holds; [reshaping a view](./docs/reshaping.md): the cheapest change first.
71
71
 
72
- References, one per door, each naming every export: [`viewkitjs/views`](./docs/reference/views.md), [`/react`](./docs/reference/react.md), [`/display`](./docs/reference/display.md), [`/editors`](./docs/reference/editors.md), [`/editors/select`](./docs/reference/editors-select.md), [`/editors/text`](./docs/reference/editors-text.md), [`/editors/relation`](./docs/reference/editors-relation.md), [`/editors/number`](./docs/reference/editors-number.md), [`/editors/range`](./docs/reference/editors-range.md), [`/editors/name`](./docs/reference/editors-name.md), [`/editors/location`](./docs/reference/editors-location.md), [`/editors/value-list`](./docs/reference/editors-value-list.md), [`/editors/date`](./docs/reference/editors-date.md), [`/editors/chips`](./docs/reference/editors-chips.md), [`/editors/session`](./docs/reference/editors-session.md), [`/editors/panel`](./docs/reference/editors-panel.md), [`/editors/open-values`](./docs/reference/editors-open-values.md), [`/field-row`](./docs/reference/field-row.md), [`/cells`](./docs/reference/cells.md), [`/selection`](./docs/reference/selection.md), [`/grid`](./docs/reference/grid.md), [`/panels`](./docs/reference/panels.md) and [`/panels/react`](./docs/reference/panels-react.md).
72
+ References, one per door, each naming every export: [`viewkitjs/views`](./docs/reference/views.md), [`/react`](./docs/reference/react.md), [`/display`](./docs/reference/display.md), [`/editors`](./docs/reference/editors.md), [`/editors/select`](./docs/reference/editors-select.md), [`/editors/text`](./docs/reference/editors-text.md), [`/editors/relation`](./docs/reference/editors-relation.md), [`/editors/number`](./docs/reference/editors-number.md), [`/editors/range`](./docs/reference/editors-range.md), [`/editors/name`](./docs/reference/editors-name.md), [`/editors/location`](./docs/reference/editors-location.md), [`/editors/value-list`](./docs/reference/editors-value-list.md), [`/editors/date`](./docs/reference/editors-date.md), [`/editors/chips`](./docs/reference/editors-chips.md), [`/editors/session`](./docs/reference/editors-session.md), [`/editors/panel`](./docs/reference/editors-panel.md), [`/editors/open-values`](./docs/reference/editors-open-values.md), [`/field-row`](./docs/reference/field-row.md), [`/cells`](./docs/reference/cells.md), [`/selection`](./docs/reference/selection.md), [`/grid`](./docs/reference/grid.md), [`/panels`](./docs/reference/panels.md), [`/panels/react`](./docs/reference/panels-react.md) and [`/list`](./docs/reference/list.md).
73
73
 
74
74
  ## Doors
75
75
 
@@ -1,2 +1,9 @@
1
+ import { useViews } from "../provider/context.js";
1
2
  import type { ViewsRowMenuProps } from "./types.js";
3
+ /**
4
+ * A row's Delete: asks the confirm port, then deletes. A confirm that throws or rejects is a no, and nothing is tried;
5
+ * a delete that throws or rejects leaves the row on screen, so the toast says why it stayed. The default `RowMenu`'s
6
+ * Delete, and the grid's `row-delete` under `menus.row`.
7
+ */
8
+ export declare function deleteAsking({ messages, ports }: Pick<ReturnType<typeof useViews>, "messages" | "ports">, onDelete: (rowId: string) => Promise<void>, rowId: string, deleteLabel?: string): void;
2
9
  export declare function DefaultRowMenu({ children, rowId, items, openHref, onDelete, deleteLabel }: ViewsRowMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -35,8 +35,24 @@ function hostEntry(item, index) {
35
35
  },
36
36
  };
37
37
  }
38
+ export function deleteAsking({ messages, ports }, onDelete, rowId, deleteLabel) {
39
+ const request = {
40
+ message: messages({ key: "views.menus.row-delete-confirm" }),
41
+ confirmLabel: messages({ key: "views.menus.row-delete" }),
42
+ ...(deleteLabel !== undefined && { subject: deleteLabel }),
43
+ destructive: true,
44
+ };
45
+ void new Promise((resolve) => resolve(ports.confirm(request)))
46
+ .catch(() => false)
47
+ .then((yes) => {
48
+ if (!yes)
49
+ return;
50
+ return new Promise((resolve) => resolve(onDelete(rowId))).catch(() => ports.toast.error(messages({ key: "views.menus.row-delete-failed" })));
51
+ });
52
+ }
38
53
  export function DefaultRowMenu({ children, rowId, items, openHref, onDelete, deleteLabel }) {
39
- const { components, icons, messages, ports } = useViews();
54
+ const views = useViews();
55
+ const { components, icons, messages } = views;
40
56
  const { Menu } = components;
41
57
  const [point, setPoint] = useState(null);
42
58
  const openedAt = useRef(0);
@@ -68,21 +84,7 @@ export function DefaultRowMenu({ children, rowId, items, openHref, onDelete, del
68
84
  label: messages({ key: "views.menus.row-delete" }),
69
85
  icon: _jsx(Delete, { className: "h-4 w-4" }),
70
86
  destructive: true,
71
- onSelect: () => {
72
- const request = {
73
- message: messages({ key: "views.menus.row-delete-confirm" }),
74
- confirmLabel: messages({ key: "views.menus.row-delete" }),
75
- ...(deleteLabel !== undefined && { subject: deleteLabel }),
76
- destructive: true,
77
- };
78
- void new Promise((resolve) => resolve(ports.confirm(request)))
79
- .catch(() => false)
80
- .then((yes) => {
81
- if (!yes)
82
- return;
83
- return new Promise((resolve) => resolve(onDelete(rowId))).catch(() => ports.toast.error(messages({ key: "views.menus.row-delete-failed" })));
84
- });
85
- },
87
+ onSelect: () => deleteAsking(views, onDelete, rowId, deleteLabel),
86
88
  },
87
89
  });
88
90
  }
@@ -1,2 +1,2 @@
1
1
  import type { ViewsToolbarButtonProps } from "./types.js";
2
- export declare function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, onContextMenu, onClick, onPointerDown, ref, }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, className, onContextMenu, onClick, onPointerDown, ref, }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -4,8 +4,9 @@ import { DisabledReason } from "./DisabledReason.js";
4
4
  import { cx } from "../internal/cx.js";
5
5
  import { ELEMENT_RESET } from "../internal/reset.js";
6
6
  import { useViews } from "../provider/context.js";
7
+ import { isFramePart } from "./frame-parts.js";
7
8
  const flag = (on) => (on ? "" : undefined);
8
- export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, onContextMenu, onClick, onPointerDown, ref, }) {
9
+ export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, className, onContextMenu, onClick, onPointerDown, ref, }) {
9
10
  const { messages, icons } = useViews();
10
11
  const Chevron = icons.chevronDown;
11
12
  const chevron = part === "views-chip" || part === "views-more";
@@ -13,7 +14,7 @@ export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, o
13
14
  const reasoned = !!disabled && !!disabledReason;
14
15
  const worded = children != null && !iconAlone;
15
16
  const shownMore = iconAlone ? undefined : more;
16
- const button = (describedBy) => (_jsxs("span", { className: cx("relative inline-flex shrink-0", worded && "min-w-0 max-w-full"), children: [_jsxs("button", { ref: ref, type: "button", "aria-describedby": describedBy, "aria-label": worded ? undefined : label, "aria-haspopup": popup, "aria-expanded": popup ? Boolean(open) : undefined, "aria-disabled": reasoned ? true : undefined, disabled: disabled && !reasoned, "aria-current": current ? "true" : undefined, "data-slot": part ? PART_SLOT[part] : "vk-toolbar-button", "data-tab": current !== undefined ? "" : undefined, "data-current": flag(current), "data-open": flag(open), "data-changed": flag(changed), "data-edge": flag(edge), "data-disabled": flag(disabled), "data-empty": flag(empty), "data-icon-alone": flag(iconAlone), "data-aside": flag(aside), "data-foot": flag(foot), "data-joined": joined, "data-waits": flag(waits), onClick: reasoned ? (event) => event.preventDefault() : onClick, onPointerDown: reasoned ? undefined : onPointerDown, onContextMenu: reasoned ? undefined : onContextMenu, className: cx(ELEMENT_RESET, "inline-flex shrink-0 items-center justify-center transition-colors duration-150", joined ? JOINED_CLASS[joined] : "rounded-full", worded && "min-w-0 max-w-full", foot
17
+ const button = (describedBy) => (_jsxs("span", { className: cx("relative inline-flex shrink-0", worded && "min-w-0 max-w-full"), children: [_jsxs("button", { ref: ref, type: "button", "aria-describedby": describedBy, "aria-label": worded ? undefined : label, "aria-haspopup": popup, "aria-expanded": popup ? Boolean(open) : undefined, "aria-disabled": reasoned ? true : undefined, disabled: disabled && !reasoned, "aria-current": current ? "true" : undefined, "data-slot": isFramePart(part) ? PART_SLOT[part] : "vk-toolbar-button", "data-tab": current !== undefined ? "" : undefined, "data-current": flag(current), "data-open": flag(open), "data-changed": flag(changed), "data-edge": flag(edge), "data-disabled": flag(disabled), "data-empty": flag(empty), "data-icon-alone": flag(iconAlone), "data-aside": flag(aside), "data-foot": flag(foot), "data-joined": joined, "data-waits": flag(waits), onClick: reasoned ? (event) => event.preventDefault() : onClick, onPointerDown: reasoned ? undefined : onPointerDown, onContextMenu: reasoned ? undefined : onContextMenu, className: cx(ELEMENT_RESET, "inline-flex shrink-0 items-center justify-center transition-colors duration-150", joined ? JOINED_CLASS[joined] : "rounded-full", worded && "min-w-0 max-w-full", foot
17
18
  ? "h-11 w-11"
18
19
  : worded || shownMore
19
20
  ? cx("gap-1.5 px-3", size === "sm" ? "h-8" : "h-9")
@@ -26,7 +27,7 @@ export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, o
26
27
  ? "bg-(color:--vk-pressed) text-(color:--vk-fg)"
27
28
  : current
28
29
  ? "bg-(color:--vk-selected,var(--vk-neutral)) text-(color:--vk-fg)"
29
- : cx("hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", aside || part === "save" ? undefined : changed ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtle)"), disabled && "pointer-events-none opacity-40"), children: [icon, worded ? (_jsx("span", { "data-slot": "vk-toolbar-words", className: cx("min-w-0 truncate whitespace-nowrap text-sm", waits && "text-(color:--vk-fg-subtlest)"), children: children })) : (word !== null &&
30
+ : cx("hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", aside || part === "save" ? undefined : changed ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtle)"), disabled && "pointer-events-none opacity-40", className), children: [icon, worded ? (_jsx("span", { "data-slot": "vk-toolbar-words", className: cx("min-w-0 truncate whitespace-nowrap text-sm", waits && "text-(color:--vk-fg-subtlest)"), children: children })) : (word !== null &&
30
31
  !iconAlone && (_jsx("span", { "data-slot": "vk-toolbar-word", className: "hidden text-sm font-medium", children: word ?? label }))), worded && shownMore && " ", shownMore && (_jsx("span", { "data-slot": "vk-toolbar-more", className: "text-sm tabular-nums text-(color:--vk-fg-subtle)", children: shownMore })), chevron && (_jsx("span", { "aria-hidden": true, "data-slot": "vk-toolbar-chevron", className: "inline-flex shrink-0 opacity-60", children: _jsx(Chevron, { className: "h-3.5 w-3.5" }) }))] }), dot && (_jsx("span", { "aria-hidden": true, "data-slot": "vk-toolbar-dot", className: "pointer-events-none absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-(color:--vk-brand)" })), counted &&
31
32
  (onClear ? (_jsx("button", { type: "button", "data-slot": "vk-toolbar-count", "aria-label": messages({ key: "views.panels.toolbar-clear" }), disabled: disabled, onClick: (event) => {
32
33
  event.stopPropagation();
@@ -0,0 +1,5 @@
1
+ import type { ViewsAtoms } from "./types.js";
2
+ /** The map itself, carrying `atoms` for the provider to lay under the app's own. */
3
+ export declare function carryAtoms<Map extends object>(map: Map, atoms: Partial<ViewsAtoms>): Map;
4
+ /** The atoms a components map carries, if any. */
5
+ export declare function carriedAtoms(map: object): Partial<ViewsAtoms> | undefined;
@@ -0,0 +1,7 @@
1
+ const CARRIED_ATOMS = Symbol.for("viewkitjs.views.carried-atoms");
2
+ export function carryAtoms(map, atoms) {
3
+ return Object.defineProperty(map, CARRIED_ATOMS, { value: atoms, enumerable: false });
4
+ }
5
+ export function carriedAtoms(map) {
6
+ return map[CARRIED_ATOMS];
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { ViewsFramePart, ViewsToolbarButtonPart } from "./types.js";
2
+ /** One of the six an app's own frame hands: the views row's parts, Clear and Save. */
3
+ export declare const isFramePart: (part: ViewsToolbarButtonPart | undefined) => part is ViewsFramePart;
4
+ /** The place's key as a part's name, where it names one of the toolbar's own places; else nothing (an app's own key, or
5
+ * no place: an app's own frame). */
6
+ export declare const placePart: (key: string | undefined) => ViewsToolbarButtonPart | undefined;
@@ -0,0 +1,15 @@
1
+ const FRAME_PARTS = new Set(["views-chip", "views-tab", "views-more", "views-add", "clear", "save"]);
2
+ export const isFramePart = (part) => part !== undefined && FRAME_PARTS.has(part);
3
+ const PLACE_PARTS = new Set([
4
+ "options",
5
+ "search",
6
+ "quick",
7
+ "new",
8
+ "sort",
9
+ "filter",
10
+ "filter-add",
11
+ "filters",
12
+ "advanced-filters",
13
+ "sort-pill",
14
+ ]);
15
+ export const placePart = (key) => key !== undefined && PLACE_PARTS.has(key) ? key : undefined;
@@ -189,6 +189,9 @@ export type ViewsRowMenuItem = {
189
189
  separator: true;
190
190
  } | {
191
191
  separator?: false;
192
+ /** Its name in the row menu's items (`menus.row`): the grid's own rows carry theirs (`copy`, `row-select`…); one of
193
+ * yours without one is named by its label. */
194
+ key?: string;
192
195
  label: string;
193
196
  icon?: ReactNode;
194
197
  onClick: () => void;
@@ -452,20 +455,29 @@ export type ViewsToolbarButtonProps = {
452
455
  popup?: "menu" | "dialog";
453
456
  /** A view tab: one of a row where one is open. `true`, the open one, `aria-current="true"`. */
454
457
  current?: boolean;
455
- /** Which of the toolbar's own buttons it stands for, where an app's own frame draws it: the views chip (a switcher: it
456
- * names the view open and opens the rest), a view tab, the views row's "+N" and "+", Clear, and Save (the bar's
457
- * keep-this-change). Draw it as its `data-slot`: `vk-views-chip`, `vk-views-tab`, `vk-views-more`, `vk-views-add`,
458
- * `vk-toolbar-clear`, `vk-toolbar-save-button`. */
458
+ /** Which of the toolbar's buttons it stands for (VK-984): every button the toolbar draws hands one, named after the
459
+ * `toolbarParts` place it stands in (`options`, `search`, `quick`, `new`, `sort`, `filter`, `filter-add`, `filters`,
460
+ * `advanced-filters`, `sort-pill`), a place's second kind of button by a name of its own (`sort-add`, `more-filters`), and
461
+ * ⋯ `more`. In an app's own frame also the views chip (a switcher: it names the view open and opens the rest), a view
462
+ * tab, the views row's "+N" and "+", Clear, and Save (the bar's keep-this-change), the frame's parts
463
+ * (`ViewsFramePart`): draw those as their `data-slot`, `vk-views-chip`, `vk-views-tab`, `vk-views-more`, `vk-views-add`,
464
+ * `vk-toolbar-clear`, `vk-toolbar-save-button`. An atom that spreads its leftover props onto its element takes `part`
465
+ * out first. */
459
466
  part?: ViewsToolbarButtonPart;
467
+ /** The class its toolbar place hands (`ToolbarPartPlace.className`, VK-984): put it on the button itself. */
468
+ className?: string;
460
469
  /** A right-click: a tab's verbs open on it. */
461
470
  onContextMenu?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
462
471
  onClick?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
463
472
  onPointerDown?: (event: ReactPointerEvent<HTMLButtonElement>) => void;
464
473
  ref?: Ref<HTMLButtonElement>;
465
474
  };
466
- /** Which of the toolbar's own buttons a `ToolbarButton` stands for, where an app's own frame draws it (VK-629): its kind
467
- * and its hook. */
468
- export type ViewsToolbarButtonPart = "views-chip" | "views-tab" | "views-more" | "views-add" | "clear" | "save";
475
+ /** The toolbar's buttons a `ToolbarButton` stands for only where an app's own frame draws them (VK-629): its kind and its
476
+ * hook. */
477
+ export type ViewsFramePart = "views-chip" | "views-tab" | "views-more" | "views-add" | "clear" | "save";
478
+ /** Which of the toolbar's buttons a `ToolbarButton` stands for (VK-984): the frame's parts, and every other button by the
479
+ * key of the place it stands in, or, a place's second kind of button, by a name of its own. */
480
+ export type ViewsToolbarButtonPart = ViewsFramePart | "options" | "search" | "quick" | "new" | "sort" | "filter" | "filter-add" | "filters" | "advanced-filters" | "sort-pill" | "sort-add" | "more-filters" | "more";
469
481
  export type ViewsAtoms = {
470
482
  List: ComponentType<ViewsListProps>;
471
483
  Row: ComponentType<ViewsRowProps>;
@@ -17,4 +17,6 @@ export declare function renderTitleCell<Row>(col: ListColumn<Row>, row: Row, con
17
17
  /** The surface's part on the name link: the grid hands `vk-grid-title`; elsewhere none. */
18
18
  data?: {
19
19
  readonly "data-slot": string;
20
- }): ReactNode;
20
+ },
21
+ /** The value the cell shows, handed to the column's indicator; absent, what `accessor` reads. */
22
+ value?: unknown): ReactNode;
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cellTextClass } from "../display/text-class.js";
4
4
  import { cx } from "../internal/cx.js";
5
- export function renderTitleCell(col, row, content, data) {
6
- const indicator = col.indicator?.(row);
5
+ export function renderTitleCell(col, row, content, data, value = col.accessor?.(row)) {
6
+ const indicator = col.indicator?.(row, { value });
7
7
  return (_jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx("span", { ...data, "data-cell-open": true, className: cx("min-w-0 cursor-pointer font-medium text-(color:--vk-fg)", cellTextClass()), children: content }), indicator] }));
8
8
  }
@@ -22,7 +22,7 @@ export function renderTypedCellValue(col, row, opts) {
22
22
  if (!col.type)
23
23
  return null;
24
24
  if (col.type === "title")
25
- return renderTitleCell(col, row, identityContent(col, row, value, opts), opts?.titleData);
25
+ return renderTitleCell(col, row, identityContent(col, row, value, opts), opts?.titleData, value);
26
26
  const field = col.field ?? legacyFieldFromColumn(col);
27
27
  const drawOpts = verbs && col.type === "user" ? { ...opts, slotOwnsClick: true } : opts;
28
28
  const cell = renderFieldValue(field, value, displayOptionsFor(col, row, drawOpts));
@@ -70,7 +70,7 @@ function CommandCell({ col, cell, items, }) {
70
70
  }
71
71
  return (_jsx(CommandMenu, { items: verbs, align: "start", label: columnLabel(col), trigger: drawGridButton(views, {
72
72
  "aria-label": columnLabel(col),
73
- frame: "h-auto min-w-0 max-w-full justify-start gap-1 -mx-1 px-1 py-0 text-left [font:inherit]",
73
+ frame: "h-auto min-w-0 max-w-[calc(100%+0.5rem)] justify-start gap-1 -mx-1 px-1 py-0 text-left [font:inherit]",
74
74
  variant: "ghost",
75
75
  size: "sm",
76
76
  children: (_jsxs(_Fragment, { children: [cell, _jsx(Chevron, { className: "h-3 w-3 opacity-60" })] })),