viewkitjs 0.27.0 → 0.29.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 (469) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/MIGRATION.md +123 -5
  3. package/fields/dist/derived.d.ts +2 -1
  4. package/fields/dist/derived.js +9 -3
  5. package/fields/dist/entities.js +41 -3
  6. package/fields/dist/index.d.ts +1 -1
  7. package/fields/dist/index.js +1 -1
  8. package/fields/dist/messages.d.ts +8 -2
  9. package/fields/dist/messages.js +3 -0
  10. package/fields/dist/range.d.ts +6 -0
  11. package/fields/dist/range.js +8 -0
  12. package/fields/dist/registry.js +11 -1
  13. package/fields/dist/spec-changes.js +1 -0
  14. package/fields/dist/types.d.ts +23 -1
  15. package/fields/docs/guides/derived-fields.md +7 -5
  16. package/fields/docs/guides/field-types.md +2 -2
  17. package/fields/docs/guides/the-index.md +1 -1
  18. package/fields/docs/reference/fields.md +3 -1
  19. package/fields/docs/reference/types.md +3 -1
  20. package/fields/skills/viewkit/SKILL.md +1 -1
  21. package/package.json +2 -1
  22. package/postgres/dist/definitions/build.js +29 -5
  23. package/postgres/dist/definitions/label.d.ts +7 -0
  24. package/postgres/dist/definitions/label.js +9 -1
  25. package/postgres/dist/definitions/lookup.js +6 -2
  26. package/postgres/dist/definitions/place.d.ts +6 -3
  27. package/postgres/dist/definitions/rollup.js +5 -1
  28. package/postgres/dist/definitions/storage.d.ts +15 -0
  29. package/postgres/dist/definitions/storage.js +52 -1
  30. package/postgres/dist/definitions/stored.js +21 -0
  31. package/postgres/dist/phone.d.ts +13 -1
  32. package/postgres/dist/phone.js +23 -3
  33. package/postgres/dist/search-indexes.d.ts +6 -1
  34. package/postgres/dist/search-indexes.js +71 -25
  35. package/postgres/dist/search.js +3 -3
  36. package/postgres/docs/guides/definitions.md +22 -5
  37. package/postgres/docs/guides/field-map.md +5 -4
  38. package/postgres/docs/reference/definitions.md +3 -3
  39. package/postgres/docs/reference/postgres.md +1 -1
  40. package/views/dist/cells/cell-format.d.ts +3 -1
  41. package/views/dist/cells/cell-format.js +3 -3
  42. package/views/dist/cells/cell-values.js +9 -10
  43. package/views/dist/cells/use-cell-format.d.ts +8 -1
  44. package/views/dist/cells/use-cell-format.js +13 -2
  45. package/views/dist/contract.d.ts +218 -5
  46. package/views/dist/contract.js +233 -1
  47. package/views/dist/controls/alert/alert.d.ts +46 -0
  48. package/views/dist/controls/alert/alert.js +11 -0
  49. package/views/dist/controls/alert/looks.d.ts +4 -0
  50. package/views/dist/controls/alert/looks.js +19 -0
  51. package/views/dist/controls/alert/tokens.d.ts +92 -0
  52. package/views/dist/controls/alert/tokens.js +25 -0
  53. package/views/dist/controls/alert-dialog/alert-dialog.d.ts +50 -0
  54. package/views/dist/controls/alert-dialog/alert-dialog.js +67 -0
  55. package/views/dist/controls/alert-dialog/confirm.d.ts +13 -0
  56. package/views/dist/controls/alert-dialog/confirm.js +11 -0
  57. package/views/dist/controls/alert-dialog/looks.d.ts +4 -0
  58. package/views/dist/controls/alert-dialog/looks.js +17 -0
  59. package/views/dist/controls/alert-dialog/tokens.d.ts +119 -0
  60. package/views/dist/controls/alert-dialog/tokens.js +32 -0
  61. package/views/dist/controls/alert-dialog.css +95 -0
  62. package/views/dist/controls/alert.css +51 -0
  63. package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
  64. package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
  65. package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
  66. package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
  67. package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
  68. package/views/dist/controls/bulk-bar/looks.js +14 -0
  69. package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
  70. package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
  71. package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
  72. package/views/dist/controls/bulk-bar/tokens.js +36 -0
  73. package/views/dist/controls/bulk-bar/words.d.ts +50 -0
  74. package/views/dist/controls/bulk-bar/words.js +19 -0
  75. package/views/dist/controls/bulk-bar.css +96 -0
  76. package/views/dist/controls/button/button.js +3 -1
  77. package/views/dist/controls/button.css +5 -4
  78. package/views/dist/controls/checkbox/checkbox.js +3 -1
  79. package/views/dist/controls/checkbox.css +1 -1
  80. package/views/dist/controls/choice/tokens.d.ts +79 -0
  81. package/views/dist/controls/choice/tokens.js +22 -0
  82. package/views/dist/controls/choice.css +31 -0
  83. package/views/dist/controls/collapsible/collapsible.d.ts +39 -0
  84. package/views/dist/controls/collapsible/collapsible.js +18 -0
  85. package/views/dist/controls/collapsible/looks.d.ts +4 -0
  86. package/views/dist/controls/collapsible/looks.js +5 -0
  87. package/views/dist/controls/collapsible/map-collapse.d.ts +2 -0
  88. package/views/dist/controls/collapsible/map-collapse.js +6 -0
  89. package/views/dist/controls/collapsible/tokens.d.ts +68 -0
  90. package/views/dist/controls/collapsible/tokens.js +19 -0
  91. package/views/dist/controls/collapsible.css +83 -0
  92. package/views/dist/controls/compound-editor/looks.js +1 -1
  93. package/views/dist/controls/compound-editor/place-parts.js +5 -1
  94. package/views/dist/controls/controls.d.ts +19 -0
  95. package/views/dist/controls/controls.js +17 -0
  96. package/views/dist/controls/customize/customize.d.ts +125 -0
  97. package/views/dist/controls/customize/customize.js +243 -0
  98. package/views/dist/controls/customize/glide.d.ts +10 -0
  99. package/views/dist/controls/customize/glide.js +55 -0
  100. package/views/dist/controls/customize/looks.d.ts +13 -0
  101. package/views/dist/controls/customize/looks.js +11 -0
  102. package/views/dist/controls/customize/map-customize-body.d.ts +18 -0
  103. package/views/dist/controls/customize/map-customize-body.js +160 -0
  104. package/views/dist/controls/customize/rules.d.ts +23 -0
  105. package/views/dist/controls/customize/rules.js +19 -0
  106. package/views/dist/controls/customize/tokens.d.ts +40 -0
  107. package/views/dist/controls/customize/tokens.js +12 -0
  108. package/views/dist/controls/customize/words.d.ts +58 -0
  109. package/views/dist/controls/customize/words.js +37 -0
  110. package/views/dist/controls/customize.css +54 -0
  111. package/views/dist/controls/date-editor/date-editor.d.ts +2 -1
  112. package/views/dist/controls/date-editor/looks.js +1 -1
  113. package/views/dist/controls/date-editor/map-calendar.js +3 -1
  114. package/views/dist/controls/filter-editor/block.d.ts +31 -0
  115. package/views/dist/controls/filter-editor/block.js +27 -0
  116. package/views/dist/controls/filter-editor/filter-editor.d.ts +58 -0
  117. package/views/dist/controls/filter-editor/filter-editor.js +250 -0
  118. package/views/dist/controls/filter-editor/how.d.ts +23 -0
  119. package/views/dist/controls/filter-editor/how.js +14 -0
  120. package/views/dist/controls/filter-editor/map-filter-body.d.ts +33 -0
  121. package/views/dist/controls/filter-editor/map-filter-body.js +190 -0
  122. package/views/dist/controls/filter-editor/map-rules.d.ts +101 -0
  123. package/views/dist/controls/filter-editor/map-rules.js +304 -0
  124. package/views/dist/controls/filter-editor/parts.d.ts +46 -0
  125. package/views/dist/controls/filter-editor/parts.js +75 -0
  126. package/views/dist/controls/filter-editor/rules.d.ts +142 -0
  127. package/views/dist/controls/filter-editor/rules.js +201 -0
  128. package/views/dist/controls/filter-editor/tokens.d.ts +83 -0
  129. package/views/dist/controls/filter-editor/tokens.js +23 -0
  130. package/views/dist/controls/filter-editor/words.d.ts +74 -0
  131. package/views/dist/controls/filter-editor/words.js +46 -0
  132. package/views/dist/controls/filter-editor.css +142 -0
  133. package/views/dist/controls/group-editor/group-editor.d.ts +56 -0
  134. package/views/dist/controls/group-editor/group-editor.js +126 -0
  135. package/views/dist/controls/group-editor/map-group-body.d.ts +19 -0
  136. package/views/dist/controls/group-editor/map-group-body.js +106 -0
  137. package/views/dist/controls/group-editor/rules.d.ts +48 -0
  138. package/views/dist/controls/group-editor/rules.js +41 -0
  139. package/views/dist/controls/group-editor/tokens.d.ts +15 -0
  140. package/views/dist/controls/group-editor/tokens.js +6 -0
  141. package/views/dist/controls/group-editor/words.d.ts +39 -0
  142. package/views/dist/controls/group-editor/words.js +21 -0
  143. package/views/dist/controls/group-editor.css +20 -0
  144. package/views/dist/controls/index.d.ts +45 -3
  145. package/views/dist/controls/index.js +44 -3
  146. package/views/dist/controls/inline-input/looks.js +1 -1
  147. package/views/dist/controls/input/input.js +10 -4
  148. package/views/dist/controls/internal/editor-parts.d.ts +8 -1
  149. package/views/dist/controls/internal/editor-parts.js +5 -0
  150. package/views/dist/controls/internal/phone.d.ts +5 -4
  151. package/views/dist/controls/internal/phone.js +7 -7
  152. package/views/dist/controls/internal/scroll.js +5 -1
  153. package/views/dist/controls/internal/step-return.d.ts +9 -0
  154. package/views/dist/controls/internal/step-return.js +27 -0
  155. package/views/dist/controls/internal/typed-run.d.ts +2 -0
  156. package/views/dist/controls/internal/typed-run.js +5 -0
  157. package/views/dist/controls/links-editor/links-editor.d.ts +5 -3
  158. package/views/dist/controls/links-editor/links-editor.js +38 -17
  159. package/views/dist/controls/links-editor/map-links-body.js +4 -1
  160. package/views/dist/controls/links-editor.css +1 -1
  161. package/views/dist/controls/menu/map-menu.js +2 -2
  162. package/views/dist/controls/menu-list/menu-list.d.ts +17 -2
  163. package/views/dist/controls/menu-list/menu-list.js +25 -16
  164. package/views/dist/controls/modal/looks.d.ts +4 -0
  165. package/views/dist/controls/modal/looks.js +25 -0
  166. package/views/dist/controls/modal/modal.d.ts +69 -0
  167. package/views/dist/controls/modal/modal.js +62 -0
  168. package/views/dist/controls/modal/tokens.d.ts +192 -0
  169. package/views/dist/controls/modal/tokens.js +50 -0
  170. package/views/dist/controls/modal.css +130 -0
  171. package/views/dist/controls/notice/notice.d.ts +49 -0
  172. package/views/dist/controls/notice/notice.js +35 -0
  173. package/views/dist/controls/notice/tokens.d.ts +99 -0
  174. package/views/dist/controls/notice/tokens.js +27 -0
  175. package/views/dist/controls/notice.css +100 -0
  176. package/views/dist/controls/number-editor/looks.js +1 -1
  177. package/views/dist/controls/number-editor/number-editor.js +1 -1
  178. package/views/dist/controls/option/option.js +3 -1
  179. package/views/dist/controls/option.css +1 -1
  180. package/views/dist/controls/pane/looks.d.ts +4 -0
  181. package/views/dist/controls/pane/looks.js +11 -0
  182. package/views/dist/controls/pane/pane.d.ts +67 -0
  183. package/views/dist/controls/pane/pane.js +99 -0
  184. package/views/dist/controls/pane/state.d.ts +14 -0
  185. package/views/dist/controls/pane/state.js +7 -0
  186. package/views/dist/controls/pane/tokens.d.ts +79 -0
  187. package/views/dist/controls/pane/tokens.js +22 -0
  188. package/views/dist/controls/pane.css +104 -0
  189. package/views/dist/controls/picker/looks.js +1 -1
  190. package/views/dist/controls/picker/map-picker.d.ts +6 -2
  191. package/views/dist/controls/picker/map-picker.js +4 -2
  192. package/views/dist/controls/picker/picker.d.ts +7 -0
  193. package/views/dist/controls/picker/picker.js +57 -8
  194. package/views/dist/controls/picker/rows.d.ts +4 -2
  195. package/views/dist/controls/picker/rows.js +4 -3
  196. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  197. package/views/dist/controls/popover/map-popover.js +2 -2
  198. package/views/dist/controls/popover/popover.js +2 -1
  199. package/views/dist/controls/popover.css +3 -0
  200. package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
  201. package/views/dist/controls/ports-host/map-ports-host.js +43 -0
  202. package/views/dist/controls/press/tokens.d.ts +8 -0
  203. package/views/dist/controls/press/tokens.js +4 -0
  204. package/views/dist/controls/press.css +44 -0
  205. package/views/dist/controls/quick-filters/looks.d.ts +11 -0
  206. package/views/dist/controls/quick-filters/looks.js +9 -0
  207. package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
  208. package/views/dist/controls/quick-filters/map-quick-filters-body.js +56 -0
  209. package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
  210. package/views/dist/controls/quick-filters/quick-filters.js +89 -0
  211. package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
  212. package/views/dist/controls/quick-filters/reminder.js +41 -0
  213. package/views/dist/controls/quick-filters/rules.d.ts +89 -0
  214. package/views/dist/controls/quick-filters/rules.js +52 -0
  215. package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
  216. package/views/dist/controls/quick-filters/tokens.js +30 -0
  217. package/views/dist/controls/quick-filters/words.d.ts +25 -0
  218. package/views/dist/controls/quick-filters/words.js +13 -0
  219. package/views/dist/controls/quick-filters.css +118 -0
  220. package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
  221. package/views/dist/controls/sheet/bottom-sheet.js +4 -4
  222. package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
  223. package/views/dist/controls/sheet/map-sheet.js +19 -6
  224. package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
  225. package/views/dist/controls/sheet/sheet-parts.js +2 -0
  226. package/views/dist/controls/sort-editor/map-sort-body.d.ts +9 -0
  227. package/views/dist/controls/sort-editor/map-sort-body.js +81 -0
  228. package/views/dist/controls/sort-editor/rules.d.ts +48 -0
  229. package/views/dist/controls/sort-editor/rules.js +24 -0
  230. package/views/dist/controls/sort-editor/sort-editor.d.ts +58 -0
  231. package/views/dist/controls/sort-editor/sort-editor.js +180 -0
  232. package/views/dist/controls/sort-editor/tokens.d.ts +79 -0
  233. package/views/dist/controls/sort-editor/tokens.js +22 -0
  234. package/views/dist/controls/sort-editor/words.d.ts +48 -0
  235. package/views/dist/controls/sort-editor/words.js +25 -0
  236. package/views/dist/controls/sort-editor.css +96 -0
  237. package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
  238. package/views/dist/controls/switch-row/switch-row.js +9 -0
  239. package/views/dist/controls/switch-row/tokens.d.ts +51 -0
  240. package/views/dist/controls/switch-row/tokens.js +15 -0
  241. package/views/dist/controls/switch-row.css +39 -0
  242. package/views/dist/controls/switch.css +1 -1
  243. package/views/dist/controls/tag/tag.js +3 -1
  244. package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
  245. package/views/dist/controls/tag-field/tag-field.js +19 -0
  246. package/views/dist/controls/tag-field/tokens.d.ts +7 -0
  247. package/views/dist/controls/tag-field/tokens.js +4 -0
  248. package/views/dist/controls/tag-field.css +13 -0
  249. package/views/dist/controls/text-editor/looks.js +1 -1
  250. package/views/dist/controls/text-editor/text-editor.js +1 -5
  251. package/views/dist/controls/toast/toast.d.ts +79 -0
  252. package/views/dist/controls/toast/toast.js +101 -0
  253. package/views/dist/controls/toast/tokens.d.ts +100 -0
  254. package/views/dist/controls/toast/tokens.js +27 -0
  255. package/views/dist/controls/toast.css +93 -0
  256. package/views/dist/controls/tokens.js +38 -0
  257. package/views/dist/controls/toolbar/keys.d.ts +3 -0
  258. package/views/dist/controls/toolbar/keys.js +11 -0
  259. package/views/dist/controls/toolbar/looks.d.ts +10 -0
  260. package/views/dist/controls/toolbar/looks.js +40 -0
  261. package/views/dist/controls/toolbar/tokens.d.ts +28 -0
  262. package/views/dist/controls/toolbar/tokens.js +9 -0
  263. package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
  264. package/views/dist/controls/toolbar/toolbar.js +370 -0
  265. package/views/dist/controls/toolbar/words.d.ts +28 -0
  266. package/views/dist/controls/toolbar/words.js +17 -0
  267. package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
  268. package/views/dist/controls/toolbar-button/looks.js +21 -0
  269. package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
  270. package/views/dist/controls/toolbar-button/tokens.js +28 -0
  271. package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
  272. package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
  273. package/views/dist/controls/toolbar-button.css +75 -0
  274. package/views/dist/controls/toolbar.css +65 -0
  275. package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
  276. package/views/dist/controls/tooltip/map-tooltip.js +2 -2
  277. package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
  278. package/views/dist/controls/tooltip/tooltip.js +2 -2
  279. package/views/dist/controls/values-editor/looks.js +1 -1
  280. package/views/dist/controls/values-editor/values-editor.js +7 -1
  281. package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
  282. package/views/dist/controls/views-list/map-views-list-body.js +128 -4
  283. package/views/dist/controls/views-list/rules.d.ts +26 -0
  284. package/views/dist/controls/views-list/rules.js +63 -0
  285. package/views/dist/controls/views-list/view-menu.d.ts +84 -0
  286. package/views/dist/controls/views-list/view-menu.js +201 -0
  287. package/views/dist/controls/views-list/views-list.d.ts +8 -1
  288. package/views/dist/controls/views-list/views-list.js +18 -3
  289. package/views/dist/controls/views-list/words.d.ts +54 -0
  290. package/views/dist/controls/views-list/words.js +10 -1
  291. package/views/dist/controls/views-list.css +5 -1
  292. package/views/dist/display/date.js +5 -5
  293. package/views/dist/display/format.d.ts +6 -0
  294. package/views/dist/display/format.js +13 -2
  295. package/views/dist/display/index.d.ts +1 -1
  296. package/views/dist/display/index.js +1 -1
  297. package/views/dist/display/options.d.ts +3 -1
  298. package/views/dist/display/range.d.ts +2 -1
  299. package/views/dist/display/range.js +4 -1
  300. package/views/dist/display/use-display-options.d.ts +3 -0
  301. package/views/dist/display/use-display-options.js +10 -2
  302. package/views/dist/display/viewer.d.ts +1 -1
  303. package/views/dist/display/viewer.js +1 -1
  304. package/views/dist/editors/DateEditor.js +11 -9
  305. package/views/dist/editors/relation-panel.js +7 -1
  306. package/views/dist/editors/relation-picker.d.ts +2 -1
  307. package/views/dist/editors/relation-picker.js +4 -3
  308. package/views/dist/editors/relation-source.d.ts +4 -1
  309. package/views/dist/editors/relation-source.js +5 -2
  310. package/views/dist/field-row/editors/RowNumberEditor.js +2 -2
  311. package/views/dist/fields/number-edit.d.ts +6 -0
  312. package/views/dist/fields/number-edit.js +8 -1
  313. package/views/dist/grid/chrome/GridCellEditors.js +2 -2
  314. package/views/dist/grid/chrome/GridColumnDateSection.d.ts +4 -3
  315. package/views/dist/grid/chrome/GridColumnDateSection.js +4 -4
  316. package/views/dist/grid/chrome/GridColumnDurationSection.js +2 -2
  317. package/views/dist/grid/chrome/GridColumnMenu.js +6 -4
  318. package/views/dist/grid/chrome/GridFooter.js +2 -2
  319. package/views/dist/grid/chrome/GridHeader.js +2 -1
  320. package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
  321. package/views/dist/grid/chrome/GridRowCells.js +2 -1
  322. package/views/dist/grid/chrome/GridTextEditor.js +2 -2
  323. package/views/dist/grid/chrome/grid-column-menu-items.js +4 -2
  324. package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
  325. package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
  326. package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
  327. package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
  328. package/views/dist/grid/chrome/useGridBandFigures.js +2 -2
  329. package/views/dist/grid/chrome/useGridFittedWidths.d.ts +3 -0
  330. package/views/dist/grid/chrome/useGridFittedWidths.js +9 -3
  331. package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
  332. package/views/dist/grid/chrome/useGridKeyboard.js +5 -2
  333. package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -1
  334. package/views/dist/grid/core/clipboard-model.js +9 -4
  335. package/views/dist/grid/core/commit-model.d.ts +7 -0
  336. package/views/dist/grid/core/commit-model.js +5 -1
  337. package/views/dist/grid/core/editing-controller.js +10 -2
  338. package/views/dist/grid/core/editing-model.js +3 -7
  339. package/views/dist/grid/core/undo-owner.d.ts +6 -0
  340. package/views/dist/grid/core/undo-owner.js +13 -0
  341. package/views/dist/grid/core/useGridEditing.d.ts +2 -0
  342. package/views/dist/grid/core/useGridEditing.js +4 -0
  343. package/views/dist/grid/grid.css +240 -0
  344. package/views/dist/grid/looks.d.ts +5 -1
  345. package/views/dist/grid/looks.js +20 -12
  346. package/views/dist/grid-tokens.d.ts +109 -0
  347. package/views/dist/grid-tokens.js +29 -0
  348. package/views/dist/looks/index.d.ts +10 -0
  349. package/views/dist/looks/index.js +10 -0
  350. package/views/dist/looks/pieces.js +20 -0
  351. package/views/dist/model/column-capabilities.d.ts +2 -0
  352. package/views/dist/model/column-filters.d.ts +2 -1
  353. package/views/dist/model/column-from.js +2 -2
  354. package/views/dist/model/relation-filters.d.ts +2 -0
  355. package/views/dist/panels/index.d.ts +2 -2
  356. package/views/dist/panels/index.js +2 -2
  357. package/views/dist/panels/labels.d.ts +4 -0
  358. package/views/dist/panels/labels.js +8 -0
  359. package/views/dist/panels/model.d.ts +14 -1
  360. package/views/dist/panels/quick/model.d.ts +4 -0
  361. package/views/dist/panels/react/customize-body.d.ts +12 -5
  362. package/views/dist/panels/react/customize-body.js +41 -13
  363. package/views/dist/panels/react/customize.d.ts +8 -1
  364. package/views/dist/panels/react/customize.js +11 -6
  365. package/views/dist/panels/react/filter/FilterEditor.js +6 -6
  366. package/views/dist/panels/react/filter/FilterFieldList.js +10 -2
  367. package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +8 -2
  368. package/views/dist/panels/react/filter/PhoneFilterEditor.js +12 -9
  369. package/views/dist/panels/react/filter/filter-body.d.ts +8 -5
  370. package/views/dist/panels/react/filter/filter-body.js +21 -7
  371. package/views/dist/panels/react/filter/filter-part-body.d.ts +4 -1
  372. package/views/dist/panels/react/filter/filter-part-body.js +3 -1
  373. package/views/dist/panels/react/panel-sheet.d.ts +5 -1
  374. package/views/dist/panels/react/panel-sheet.js +6 -2
  375. package/views/dist/panels/react/panel-step.d.ts +15 -0
  376. package/views/dist/panels/react/panel-step.js +27 -0
  377. package/views/dist/panels/react/quick/QuickFiltersPanel.js +1 -0
  378. package/views/dist/panels/react/sort/SortEditor.d.ts +4 -0
  379. package/views/dist/panels/react/sort/SortEditor.js +5 -2
  380. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +18 -0
  381. package/views/dist/panels/react/toolbar/ReadyToolbar.js +93 -4
  382. package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
  383. package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
  384. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +15 -5
  385. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +16 -0
  386. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +50 -0
  387. package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +3 -1
  388. package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +4 -1
  389. package/views/dist/panels/react/toolbar/ToolbarFilters.js +38 -23
  390. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
  391. package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
  392. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +4 -1
  393. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +2 -2
  394. package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
  395. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +15 -6
  396. package/views/dist/panels/react/toolbar/panel-part.d.ts +5 -1
  397. package/views/dist/panels/react/toolbar/panel-part.js +2 -2
  398. package/views/dist/panels/react/toolbar/use-filter-add.d.ts +16 -0
  399. package/views/dist/panels/react/toolbar/use-filter-add.js +32 -0
  400. package/views/dist/panels/react/view-footer.d.ts +1 -1
  401. package/views/dist/panels/react/views-row/ViewPicker.js +25 -4
  402. package/views/dist/panels/react.d.ts +1 -0
  403. package/views/dist/panels/react.js +1 -0
  404. package/views/dist/panels/settings/filter-groups.d.ts +3 -0
  405. package/views/dist/panels/settings/filter-groups.js +72 -7
  406. package/views/dist/panels/settings/filters.d.ts +5 -0
  407. package/views/dist/panels/settings/filters.js +12 -6
  408. package/views/dist/panels/settings/group-buckets.js +1 -0
  409. package/views/dist/panels/views-row/model.d.ts +10 -1
  410. package/views/dist/provider/ViewsProvider.d.ts +7 -1
  411. package/views/dist/provider/ViewsProvider.js +50 -6
  412. package/views/dist/provider/components.d.ts +178 -11
  413. package/views/dist/provider/context.d.ts +6 -0
  414. package/views/dist/provider/moment.d.ts +6 -0
  415. package/views/dist/provider/moment.js +10 -0
  416. package/views/dist/provider/ports.d.ts +18 -6
  417. package/views/dist/provider/ports.js +2 -1
  418. package/views/dist/react.d.ts +2 -2
  419. package/views/dist/react.js +1 -1
  420. package/views/dist/selection/SelectionBar.d.ts +2 -16
  421. package/views/dist/selection/SelectionBar.js +4 -1
  422. package/views/dist/selection/bar-props.d.ts +26 -0
  423. package/views/dist/selection/bar-props.js +1 -0
  424. package/views/dist/selection/index.d.ts +1 -1
  425. package/views/dist/selection/verbs.d.ts +32 -5
  426. package/views/dist/styles.css +1499 -73
  427. package/views/dist/styles.unlayered.css +1497 -70
  428. package/views/docs/contract.md +56 -23
  429. package/views/docs/controls/alert-dialog.md +37 -0
  430. package/views/docs/controls/alert.md +30 -0
  431. package/views/docs/controls/bulk-bar.md +41 -0
  432. package/views/docs/controls/choice.md +25 -0
  433. package/views/docs/controls/collapsible.md +22 -0
  434. package/views/docs/controls/customize.md +17 -0
  435. package/views/docs/controls/filter-editor.md +28 -0
  436. package/views/docs/controls/group-editor.md +11 -0
  437. package/views/docs/controls/modal.md +55 -0
  438. package/views/docs/controls/notice.md +32 -0
  439. package/views/docs/controls/pane.md +25 -0
  440. package/views/docs/controls/popover.md +2 -0
  441. package/views/docs/controls/press.md +9 -0
  442. package/views/docs/controls/quick-filters.md +35 -0
  443. package/views/docs/controls/radio.md +1 -1
  444. package/views/docs/controls/sort-editor.md +27 -0
  445. package/views/docs/controls/switch-row.md +18 -0
  446. package/views/docs/controls/tag-field.md +7 -0
  447. package/views/docs/controls/toast.md +32 -0
  448. package/views/docs/controls/toolbar-button.md +31 -0
  449. package/views/docs/controls/toolbar.md +14 -0
  450. package/views/docs/guides/atoms.md +2 -2
  451. package/views/docs/guides/cells.md +3 -3
  452. package/views/docs/guides/display.md +3 -3
  453. package/views/docs/guides/looks.md +8 -2
  454. package/views/docs/guides/ports.md +6 -6
  455. package/views/docs/guides/selection.md +5 -1
  456. package/views/docs/guides/the-grid.md +2 -2
  457. package/views/docs/guides/the-provider.md +21 -2
  458. package/views/docs/install.md +4 -1
  459. package/views/docs/reference/cells.md +3 -3
  460. package/views/docs/reference/controls.md +403 -16
  461. package/views/docs/reference/display.md +3 -2
  462. package/views/docs/reference/editors-relation.md +1 -1
  463. package/views/docs/reference/looks.md +35 -11
  464. package/views/docs/reference/panels-react.md +11 -10
  465. package/views/docs/reference/panels.md +9 -7
  466. package/views/docs/reference/react.md +20 -13
  467. package/views/docs/reference/selection.md +4 -2
  468. package/views/docs/reference/views.md +8 -6
  469. package/views/skills/views/SKILL.md +2 -2
@@ -0,0 +1,142 @@
1
+ import { type FilterField } from "./how.js";
2
+ /** One rule: the field it reads (one level in, its path's value: company.region), how it compares, its value: a choice's value
3
+ * or several, a number, words, a day ("2026-12-31"), a range's From and To (either may be none); none while it has none, or for a
4
+ * way that takes none. */
5
+ export interface FilterRule {
6
+ id: string;
7
+ field: string;
8
+ how: string;
9
+ value: string | string[] | number | [number | null, number | null] | null;
10
+ /** Set aside by ViewKit: its field's name and why, in words, and whether Put back fits. Drawn set aside, whatever its field. */
11
+ aside?: FilterAside;
12
+ }
13
+ /** A rule ViewKit set aside, in words: its field's name, why, and whether it can be put back. */
14
+ export interface FilterAside {
15
+ label: string;
16
+ why: string;
17
+ putBack: boolean;
18
+ }
19
+ /** The prefix of a way only ViewKit words: `vk:<operator>`. */
20
+ export declare const OWN_WAY = "vk:";
21
+ /** Whether a rule's way is one only ViewKit words: the kit has no word for it. */
22
+ export declare const isOwnWay: (how: string) => boolean;
23
+ /** How a relation rule's block holds its related records: any, none or every of them match its rules. */
24
+ export type Quantifier = "any" | "none" | "every";
25
+ export declare const QUANTIFIERS: readonly Quantifier[];
26
+ /** A level of rules, joined by its one join; the filter itself is one. `exclude`: it keeps what its rules don't match (a `not`
27
+ * group, joined by And alone). `relation`: a relation rule's block, its rules on that relation's fields: the kit field of the
28
+ * relation (its Related records row; open on a relation's where, ViewKit's field key), its name where the fields don't hold
29
+ * it, its quantifier, and why nothing can be added (`gone`). */
30
+ export interface FilterGroup {
31
+ id: string;
32
+ join: "and" | "or";
33
+ rules: (FilterRule | FilterGroup)[];
34
+ exclude?: true;
35
+ relation?: {
36
+ field: string;
37
+ label?: string;
38
+ quantifier: Quantifier;
39
+ gone?: string;
40
+ };
41
+ }
42
+ export type FilterItem = FilterRule | FilterGroup;
43
+ /** How many levels deep rules stand at most, the filter itself the first: a rule three deep can't become a group. */
44
+ export declare const FILTER_DEPTH = 3;
45
+ /** The filter with nothing in it. */
46
+ export declare const NO_FILTER: FilterGroup;
47
+ export declare const isGroup: (x: FilterItem) => x is FilterGroup;
48
+ /** Whether an item is a relation rule's block. */
49
+ export declare const isBlock: (x: FilterItem) => x is FilterGroup & {
50
+ relation: NonNullable<FilterGroup["relation"]>;
51
+ };
52
+ /** Whether a value is a range's From and To: two ends, each a number or none. */
53
+ export declare const isPair: (v: FilterRule["value"]) => v is [number | null, number | null];
54
+ /** The field a rule reads, at the top or one level in; nothing once it is gone. */
55
+ export declare const fieldOf: (fields: FilterField[], field: string) => FilterField | undefined;
56
+ /** Every id in the filter, its own, each group's and each rule's. */
57
+ export declare const idsOf: (g: FilterGroup) => string[];
58
+ /** Every rule, in order, groups opened. */
59
+ export declare const rulesOf: (f: FilterGroup) => FilterRule[];
60
+ /** The rule or group by its id, wherever it stands. */
61
+ export declare function itemOf(f: FilterGroup, id: string): FilterItem | undefined;
62
+ /** A rule on `field`, with its type's first way and no value, added at the end of the group `into` (the filter's own unless said);
63
+ * its id with it, never one in the filter or in `taken`. A field it can't find, or a group that isn't there, adds nothing. */
64
+ export declare function addRule(f: FilterGroup, field: string, fields: FilterField[], into?: string, taken?: readonly string[]): {
65
+ filter: FilterGroup;
66
+ id: string;
67
+ };
68
+ /** The filter with the rule or group `id` taken away, and any group it leaves with no rules with it (never one that held none
69
+ * before); the filter's own last rule leaves it empty. */
70
+ export declare function removeRule(f: FilterGroup, id: string): FilterGroup;
71
+ /** The group `groupId`'s join, which is every join at its level; a group that excludes its matches stays joined by And. */
72
+ export declare function setJoin(f: FilterGroup, groupId: string, join: FilterGroup["join"]): FilterGroup;
73
+ /** How many levels hold `id`: the filter itself 0, a rule or group in it 1, one in a group in it 2; -1 if it isn't there. */
74
+ export declare function depthOf(f: FilterGroup, id: string, at?: number): number;
75
+ /** Whether the rule `id` can become a group: a rule standing less than `levels` deep (three unless said; an advanced filter's group,
76
+ * itself a level of the view, two). */
77
+ export declare const canGroup: (f: FilterGroup, id: string, levels?: number) => boolean;
78
+ /** The rule `ruleId` turned into a group of its own, joined by And, holding it, its id never one in the filter or in `taken`; a rule
79
+ * `levels` deep, or a group, stays as it is. */
80
+ export declare function toGroup(f: FilterGroup, ruleId: string, taken?: readonly string[], levels?: number): FilterGroup;
81
+ /** The block `id` stands in, itself included; none outside one. */
82
+ export declare const blockAround: (f: FilterGroup, id: string) => FilterGroup | undefined;
83
+ /** The field a rule's field stands under one level in (a deal's Company for Company › Region); none at the top. */
84
+ export declare function relationOf(fields: FilterField[], field: string): FilterField | undefined;
85
+ /** The fields a rule in group `id` may name: a block's relation's own (its `level`; none where the fields don't list it, so
86
+ * nothing outside the relation is offered), else every field. The filter itself open on a relation's where (`relation` on the
87
+ * root) holds that relation's fields as its own. */
88
+ export declare function fieldsIn(f: FilterGroup, id: string, fields: FilterField[]): FilterField[];
89
+ /** Whether the group `id` can exclude its matches: a group, not a block, joined by And. The filter itself answers so too: whether
90
+ * it may (an advanced filter's own group, not a whole filter) is its holder's to say (`excludable`). */
91
+ export declare const canExclude: (f: FilterGroup, id: string) => boolean;
92
+ /** The group `id` excluding its matches or not; only a group joined by And takes it, and setting it on an Or group changes nothing. */
93
+ export declare function setExclude(f: FilterGroup, id: string, exclude: boolean): FilterGroup;
94
+ /** The block `id`'s quantifier. */
95
+ export declare const setQuantifier: (f: FilterGroup, id: string, quantifier: Quantifier) => FilterGroup;
96
+ /** The rule `ruleId`, on a related field and not inside a block, turned into a block of that relation with `quantifier`, holding
97
+ * it, its id never one in the filter or in `taken`; anything else, or a rule `levels` deep, stays. "any" changes nothing. */
98
+ export declare function toBlock(f: FilterGroup, ruleId: string, quantifier: Quantifier, fields: FilterField[], taken?: readonly string[], levels?: number): FilterGroup;
99
+ /** Whether Every fits a block's rules: at least one of them, at any depth, is whole (isWhole) and not set aside, as ViewKit's
100
+ * everyBlocked counts. */
101
+ export declare const everyFits: (rules: FilterItem[], fields: FilterField[]) => boolean;
102
+ /** A set-aside rule put back: its `aside` dropped, so it is written as a rule again; anything else stays. */
103
+ export declare function putBack(f: FilterGroup, id: string): FilterGroup;
104
+ /** The filter with nothing in it, its id and join kept. */
105
+ export declare const clearAll: (f: FilterGroup) => FilterGroup;
106
+ /** The rule `id` changed: a new field keeps its way where the new type has it (else the type's first) and starts with no value;
107
+ * a new way keeps the value it can (one of several, several of one, From of a range's two, two from one) and none for a way that
108
+ * takes none; a value as given. */
109
+ export declare function changeRule(f: FilterGroup, id: string, change: Partial<Pick<FilterRule, "field" | "how" | "value">>, fields: FilterField[]): FilterGroup;
110
+ /** What a rule's way takes, by its field's type; nothing for a rule set aside. */
111
+ export declare const takesOf: (rule: FilterRule, fields: FilterField[]) => import("./how.js").Takes | undefined;
112
+ /** Whether a rule narrows the list: its field there, its way its type's, and its value whole for what the way takes. */
113
+ export declare function isWhole(rule: FilterRule, fields: FilterField[]): boolean;
114
+ /** Whether the filter is advanced: an Or between its rules, or a group in it. */
115
+ export declare const isAdvanced: (f: FilterGroup) => boolean;
116
+ /** A filter as the filter bar shows it: a plain one, its rule, or an advanced one, its group and how many rules it holds. */
117
+ export type BarFilter = {
118
+ kind: "plain";
119
+ rule: FilterRule;
120
+ } | {
121
+ kind: "advanced";
122
+ group: FilterGroup;
123
+ count: number;
124
+ };
125
+ /** The filter as the bar reads it, in order: each rule at the filter's own level a plain filter, each group there an advanced one,
126
+ * counted by every rule in it. */
127
+ export declare const barOf: (f: FilterGroup) => BarFilter[];
128
+ /** The rule `ruleId` at the filter's own level turned advanced: a group of its own at its place, joined by And, holding it.
129
+ * Anything else stays as it is. */
130
+ export declare function toAdvanced(f: FilterGroup, ruleId: string): FilterGroup;
131
+ /** The group of `group`'s id at the filter's own level replaced by it, as the filter editor changed it; taken away once it holds
132
+ * no rules. */
133
+ export declare function setGroup(f: FilterGroup, group: FilterGroup): FilterGroup;
134
+ /** Whether a rule is set aside: ViewKit set it aside, or its field is no longer the list's (a rule on a way only ViewKit words, on
135
+ * a field the kit doesn't list, is ViewKit's to word, never set aside). */
136
+ export declare const isSetAside: (rule: FilterRule, fields: FilterField[]) => boolean;
137
+ /** A rule's value in words: a choice's name, several joined, a number with its thousands, a range's From – To (an end with none
138
+ * "…", as ViewKit says it), a day as a cell shows it, words as typed. */
139
+ export declare function valueText(rule: FilterRule, fields: FilterField[]): string;
140
+ /** A rule in words, its field named by its path: "Stage is any of Qualified, Proposal", "Company › Region is EMEA"; a rule set
141
+ * aside keeps what it has. */
142
+ export declare function ruleText(rule: FilterRule, fields: FilterField[]): string;
@@ -0,0 +1,201 @@
1
+ import { cellText } from "../date-editor/calendar.js";
2
+ import { findItem, itemLabel } from "../picker/rows.js";
3
+ import { HOW, wayOf } from "./how.js";
4
+ export const OWN_WAY = "vk:";
5
+ export const isOwnWay = (how) => how.startsWith(OWN_WAY);
6
+ export const QUANTIFIERS = ["any", "none", "every"];
7
+ export const FILTER_DEPTH = 3;
8
+ export const NO_FILTER = { id: "root", join: "and", rules: [] };
9
+ export const isGroup = (x) => "rules" in x;
10
+ export const isBlock = (x) => isGroup(x) && !!x.relation;
11
+ export const isPair = (v) => Array.isArray(v) && v.length === 2 && v.every((n) => n === null || typeof n === "number");
12
+ export const fieldOf = (fields, field) => findItem(fields, field)?.item;
13
+ export const idsOf = (g) => [g.id, ...g.rules.flatMap((r) => (isGroup(r) ? idsOf(r) : [r.id]))];
14
+ const nextId = (f, prefix, taken = []) => {
15
+ const all = new Set([...idsOf(f), ...taken]);
16
+ let n = 1;
17
+ while (all.has(`${prefix}${n}`))
18
+ n++;
19
+ return `${prefix}${n}`;
20
+ };
21
+ const inGroup = (g, id, fn) => g.id === id ? fn(g) : { ...g, rules: g.rules.map((r) => (isGroup(r) ? inGroup(r, id, fn) : r)) };
22
+ export const rulesOf = (f) => f.rules.flatMap((r) => (isGroup(r) ? rulesOf(r) : [r]));
23
+ export function itemOf(f, id) {
24
+ if (f.id === id)
25
+ return f;
26
+ for (const r of f.rules) {
27
+ if (r.id === id)
28
+ return r;
29
+ if (isGroup(r)) {
30
+ const x = itemOf(r, id);
31
+ if (x)
32
+ return x;
33
+ }
34
+ }
35
+ return undefined;
36
+ }
37
+ export function addRule(f, field, fields, into = f.id, taken = []) {
38
+ const type = fieldOf(fields, field)?.type, target = itemOf(f, into);
39
+ if (!type || !target || !isGroup(target))
40
+ return { filter: f, id: "" };
41
+ const id = nextId(f, "r", taken), rule = { id, field, how: HOW[type][0].value, value: null };
42
+ return { filter: inGroup(f, into, (g) => ({ ...g, rules: [...g.rules, rule] })), id };
43
+ }
44
+ export function removeRule(f, id) {
45
+ if (f.id === id)
46
+ return clearAll(f);
47
+ const without = (g) => ({ ...g, rules: g.rules.filter((r) => r.id !== id).flatMap((r) => {
48
+ if (!isGroup(r))
49
+ return [r];
50
+ const next = without(r);
51
+ return next.rules.length === 0 && r.rules.length > 0 ? [] : [next];
52
+ }) });
53
+ return without(f);
54
+ }
55
+ export function setJoin(f, groupId, join) {
56
+ const g = itemOf(f, groupId);
57
+ return g && isGroup(g) && g.exclude ? f : inGroup(f, groupId, (x) => ({ ...x, join }));
58
+ }
59
+ export function depthOf(f, id, at = 0) {
60
+ if (f.id === id)
61
+ return at;
62
+ for (const r of f.rules) {
63
+ if (r.id === id)
64
+ return at + 1;
65
+ if (isGroup(r)) {
66
+ const d = depthOf(r, id, at + 1);
67
+ if (d >= 0)
68
+ return d;
69
+ }
70
+ }
71
+ return -1;
72
+ }
73
+ export const canGroup = (f, id, levels = FILTER_DEPTH) => { const x = itemOf(f, id), d = depthOf(f, id); return !!x && !isGroup(x) && d > 0 && d < levels; };
74
+ export function toGroup(f, ruleId, taken = [], levels = FILTER_DEPTH) {
75
+ if (!canGroup(f, ruleId, levels))
76
+ return f;
77
+ const id = nextId(f, "g", taken);
78
+ const wrap = (g) => ({ ...g, rules: g.rules.map((r) => (r.id === ruleId ? { id, join: "and", rules: [r] } : isGroup(r) ? wrap(r) : r)) });
79
+ return wrap(f);
80
+ }
81
+ function groupsAround(f, id) {
82
+ if (f.id === id)
83
+ return [f];
84
+ for (const r of f.rules) {
85
+ if (r.id === id)
86
+ return isGroup(r) ? [f, r] : [f];
87
+ if (isGroup(r)) {
88
+ const inner = groupsAround(r, id);
89
+ if (inner.length)
90
+ return [f, ...inner];
91
+ }
92
+ }
93
+ return [];
94
+ }
95
+ export const blockAround = (f, id) => groupsAround(f, id).reverse().find((g) => !!g.relation);
96
+ export function relationOf(fields, field) {
97
+ return findItem(fields, field)?.path[0];
98
+ }
99
+ export function fieldsIn(f, id, fields) {
100
+ const block = blockAround(f, id);
101
+ if (!block || block === f)
102
+ return fields;
103
+ return fieldOf(fields, block.relation.field)?.level ?? [];
104
+ }
105
+ export const canExclude = (f, id) => { const g = itemOf(f, id); return !!g && isGroup(g) && !g.relation && g.join === "and"; };
106
+ export function setExclude(f, id, exclude) {
107
+ if (!canExclude(f, id))
108
+ return f;
109
+ return inGroup(f, id, ({ exclude: _was, ...g }) => (exclude ? { ...g, exclude: true } : g));
110
+ }
111
+ export const setQuantifier = (f, id, quantifier) => inGroup(f, id, (g) => (g.relation ? { ...g, relation: { ...g.relation, quantifier } } : g));
112
+ export function toBlock(f, ruleId, quantifier, fields, taken = [], levels = FILTER_DEPTH) {
113
+ const r = itemOf(f, ruleId);
114
+ if (quantifier === "any" || !r || isGroup(r) || blockAround(f, ruleId) || !canGroup(f, ruleId, levels))
115
+ return f;
116
+ const relation = relationOf(fields, r.field);
117
+ if (!relation)
118
+ return f;
119
+ const id = nextId(f, "g", taken);
120
+ const wrap = (g) => ({ ...g, rules: g.rules.map((x) => (x.id === ruleId ? { id, join: "and", relation: { field: relation.value, quantifier }, rules: [x] } : isGroup(x) ? wrap(x) : x)) });
121
+ return wrap(f);
122
+ }
123
+ export const everyFits = (rules, fields) => rules.some((r) => (isGroup(r) ? everyFits(r.rules, fields) : !r.aside && isWhole(r, fields)));
124
+ export function putBack(f, id) {
125
+ const walk = (g) => ({ ...g, rules: g.rules.map((r) => (isGroup(r) ? walk(r) : r.id === id && r.aside ? (({ aside: _gone, ...rest }) => rest)(r) : r)) });
126
+ return walk(f);
127
+ }
128
+ export const clearAll = (f) => ({ ...f, rules: [] });
129
+ export function changeRule(f, id, change, fields) {
130
+ const one = (r) => {
131
+ if (change.field !== undefined && change.field !== r.field) {
132
+ const type = fieldOf(fields, change.field)?.type;
133
+ if (!type)
134
+ return r;
135
+ return { ...r, field: change.field, how: wayOf(type, r.how) ? r.how : HOW[type][0].value, value: null };
136
+ }
137
+ if (change.how !== undefined && change.how !== r.how) {
138
+ const type = fieldOf(fields, r.field)?.type, was = type && wayOf(type, r.how)?.takes, next = type && wayOf(type, change.how)?.takes;
139
+ if (!next)
140
+ return r;
141
+ const v = r.value;
142
+ const value = next === "none" ? null : next === was ? v
143
+ : next === "two" ? (isPair(v) ? v : typeof v === "number" ? [v, null] : null)
144
+ : isPair(v) ? v[0]
145
+ : next === "several" ? (typeof v === "string" ? [v] : Array.isArray(v) ? v : null)
146
+ : Array.isArray(v) ? v[0] ?? null : v;
147
+ return { ...r, how: change.how, value };
148
+ }
149
+ return "value" in change ? { ...r, value: change.value ?? null } : r;
150
+ };
151
+ const walk = (g) => ({ ...g, rules: g.rules.map((r) => (isGroup(r) ? walk(r) : r.id === id ? one(r) : r)) });
152
+ return walk(f);
153
+ }
154
+ export const takesOf = (rule, fields) => { const t = fieldOf(fields, rule.field)?.type; return t ? wayOf(t, rule.how)?.takes : undefined; };
155
+ export function isWhole(rule, fields) {
156
+ if (rule.aside || isOwnWay(rule.how))
157
+ return true;
158
+ const type = fieldOf(fields, rule.field)?.type, takes = type && wayOf(type, rule.how)?.takes, v = rule.value;
159
+ if (!type || !takes)
160
+ return false;
161
+ if (takes === "none")
162
+ return true;
163
+ if (takes === "several")
164
+ return Array.isArray(v) && v.length > 0;
165
+ if (takes === "two")
166
+ return isPair(v) && v.some((n) => typeof n === "number" && Number.isFinite(n));
167
+ if (type === "number" || type === "range")
168
+ return typeof v === "number" && Number.isFinite(v);
169
+ return typeof v === "string" && v.trim() !== "";
170
+ }
171
+ export const isAdvanced = (f) => f.rules.some(isGroup) || (f.join === "or" && f.rules.length > 1);
172
+ export const barOf = (f) => f.rules.map((r) => (isGroup(r) ? { kind: "advanced", group: r, count: rulesOf(r).length } : { kind: "plain", rule: r }));
173
+ export function toAdvanced(f, ruleId) {
174
+ if (!f.rules.some((r) => !isGroup(r) && r.id === ruleId))
175
+ return f;
176
+ const id = nextId(f, "g");
177
+ return { ...f, rules: f.rules.map((r) => (r.id === ruleId ? { id, join: "and", rules: [r] } : r)) };
178
+ }
179
+ export function setGroup(f, group) {
180
+ const empty = rulesOf(group).length === 0;
181
+ return { ...f, rules: f.rules.flatMap((r) => (isGroup(r) && r.id === group.id ? (empty ? [] : [group]) : [r])) };
182
+ }
183
+ export const isSetAside = (rule, fields) => !!rule.aside || (!fieldOf(fields, rule.field) && !isOwnWay(rule.how));
184
+ const NUMBER = new Intl.NumberFormat("en-GB");
185
+ export function valueText(rule, fields) {
186
+ const field = fieldOf(fields, rule.field), v = rule.value, name = (x) => field?.choices?.find((c) => c.value === x)?.label ?? x;
187
+ if (v == null || v === "")
188
+ return "";
189
+ if (isPair(v))
190
+ return v.map((n) => (n === null ? "…" : NUMBER.format(n))).join(" – ");
191
+ if (Array.isArray(v))
192
+ return v.map(name).join(", ");
193
+ if (typeof v === "number")
194
+ return NUMBER.format(v);
195
+ return field?.type === "date" ? cellText(v, v) : field?.choices ? name(v) : v;
196
+ }
197
+ export function ruleText(rule, fields) {
198
+ const type = fieldOf(fields, rule.field)?.type;
199
+ const how = (type && wayOf(type, rule.how)?.label) ?? rule.how.replace(/-/g, " ");
200
+ return [itemLabel(fields, rule.field), how, valueText(rule, fields)].filter(Boolean).join(" ");
201
+ }
@@ -0,0 +1,83 @@
1
+ export declare const FILTER_EDITOR_TOKENS: readonly [{
2
+ readonly name: "--vk-border";
3
+ readonly kind: "colour";
4
+ readonly outright: "--border";
5
+ }, {
6
+ readonly name: "--vk-border-input";
7
+ readonly kind: "colour";
8
+ readonly outright: "--border-input";
9
+ }, {
10
+ readonly name: "--vk-border-warning";
11
+ readonly kind: "colour";
12
+ readonly outright: "--border-warning";
13
+ }, {
14
+ readonly name: "--vk-border-width";
15
+ readonly kind: "size";
16
+ readonly outright: "--border-width";
17
+ }, {
18
+ readonly name: "--vk-fg";
19
+ readonly kind: "colour";
20
+ readonly outright: "--text";
21
+ }, {
22
+ readonly name: "--vk-fg-subtle";
23
+ readonly kind: "colour";
24
+ readonly outright: "--text-subtle";
25
+ }, {
26
+ readonly name: "--vk-font-size-base";
27
+ readonly kind: "size";
28
+ readonly outright: "--text-base";
29
+ }, {
30
+ readonly name: "--vk-font-size-sm";
31
+ readonly kind: "size";
32
+ readonly outright: "--text-sm";
33
+ }, {
34
+ readonly name: "--vk-font-size-xs";
35
+ readonly kind: "size";
36
+ readonly outright: "--text-xs";
37
+ }, {
38
+ readonly name: "--vk-font-weight-medium";
39
+ readonly kind: "size";
40
+ readonly outright: "--font-weight-medium";
41
+ }, {
42
+ readonly name: "--vk-layer-popup";
43
+ readonly kind: "size";
44
+ readonly outright: "--layer-popup";
45
+ }, {
46
+ readonly name: "--vk-line-height-base";
47
+ readonly kind: "size";
48
+ readonly outright: "--text-base--line-height";
49
+ }, {
50
+ readonly name: "--vk-line-height-sm";
51
+ readonly kind: "size";
52
+ readonly outright: "--text-sm--line-height";
53
+ }, {
54
+ readonly name: "--vk-line-height-xs";
55
+ readonly kind: "size";
56
+ readonly outright: "--text-xs--line-height";
57
+ }, {
58
+ readonly name: "--vk-overlay";
59
+ readonly kind: "colour";
60
+ readonly outright: "--surface-overlay";
61
+ }, {
62
+ readonly name: "--vk-radius-lg";
63
+ readonly kind: "size";
64
+ readonly outright: "--radius-lg";
65
+ }, {
66
+ readonly name: "--vk-radius-xl";
67
+ readonly kind: "size";
68
+ readonly outright: "--radius-xl";
69
+ }, {
70
+ readonly name: "--vk-spacing";
71
+ readonly kind: "size";
72
+ readonly outright: "--spacing";
73
+ }, {
74
+ readonly name: "--vk-sunken";
75
+ readonly kind: "colour";
76
+ readonly outright: "--surface-sunken";
77
+ }, {
78
+ readonly name: "--vk-warning";
79
+ readonly kind: "colour";
80
+ readonly outright: "--text-warning";
81
+ }];
82
+ /** The prefixes of the filter editor's own machinery, set and read by it alone: none. */
83
+ export declare const FILTER_EDITOR_PRIVATE: readonly [];
@@ -0,0 +1,23 @@
1
+ export const FILTER_EDITOR_TOKENS = [
2
+ { name: "--vk-border", kind: "colour", outright: "--border" },
3
+ { name: "--vk-border-input", kind: "colour", outright: "--border-input" },
4
+ { name: "--vk-border-warning", kind: "colour", outright: "--border-warning" },
5
+ { name: "--vk-border-width", kind: "size", outright: "--border-width" },
6
+ { name: "--vk-fg", kind: "colour", outright: "--text" },
7
+ { name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
8
+ { name: "--vk-font-size-base", kind: "size", outright: "--text-base" },
9
+ { name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
10
+ { name: "--vk-font-size-xs", kind: "size", outright: "--text-xs" },
11
+ { name: "--vk-font-weight-medium", kind: "size", outright: "--font-weight-medium" },
12
+ { name: "--vk-layer-popup", kind: "size", outright: "--layer-popup" },
13
+ { name: "--vk-line-height-base", kind: "size", outright: "--text-base--line-height" },
14
+ { name: "--vk-line-height-sm", kind: "size", outright: "--text-sm--line-height" },
15
+ { name: "--vk-line-height-xs", kind: "size", outright: "--text-xs--line-height" },
16
+ { name: "--vk-overlay", kind: "colour", outright: "--surface-overlay" },
17
+ { name: "--vk-radius-lg", kind: "size", outright: "--radius-lg" },
18
+ { name: "--vk-radius-xl", kind: "size", outright: "--radius-xl" },
19
+ { name: "--vk-spacing", kind: "size", outright: "--spacing" },
20
+ { name: "--vk-sunken", kind: "colour", outright: "--surface-sunken" },
21
+ { name: "--vk-warning", kind: "colour", outright: "--text-warning" },
22
+ ];
23
+ export const FILTER_EDITOR_PRIVATE = [];
@@ -0,0 +1,74 @@
1
+ import type { MenuListWords } from "../menu-list/menu-list.js";
2
+ import type { PickerWords } from "../picker/picker.js";
3
+ import type { Quantifier } from "./rules.js";
4
+ export interface FilterEditorWords {
5
+ /** What stands before a level's first rule. */
6
+ where: string;
7
+ /** A level's join, as its second rule's Button and the rest's lead say it. */
8
+ join: (join: "and" | "or") => string;
9
+ /** Add filter, and its list's name and step's title. */
10
+ add: string;
11
+ /** A computer's Clear all, at the foot. */
12
+ clearAllFilters: string;
13
+ /** A phone's and the narrow form's Clear all. */
14
+ clearAll: string;
15
+ /** A rule's menu rows. */
16
+ toGroup: string;
17
+ deleteRule: string;
18
+ /** A group's Delete. */
19
+ deleteGroup: string;
20
+ /** What the body says with nothing filtered, and its line under it. */
21
+ none: string;
22
+ noneLine: string;
23
+ /** A rule's field box and way box, to a screen reader; the field box's step's title on a phone. */
24
+ field: string;
25
+ how: string;
26
+ /** A group's level of rules, to a screen reader. */
27
+ group: string;
28
+ /** A rule's ⋮ and its menu, by its field. */
29
+ ruleOf: (label: string) => string;
30
+ /** A rule's ways, as a list's name and a way's step's title, by its field. */
31
+ howOf: (label: string) => string;
32
+ /** A value's placeholders: a date's, a number's, words', a choice's. */
33
+ chooseDate: string;
34
+ typeNumber: string;
35
+ typeValue: string;
36
+ choose: string;
37
+ /** A range's two ends, and each one's name by its field. */
38
+ from: string;
39
+ to: string;
40
+ fromOf: (label: string) => string;
41
+ toOf: (label: string) => string;
42
+ /** The fields' search, before anything is typed. */
43
+ search: string;
44
+ /** A yes/no's two values. */
45
+ checked: string;
46
+ unchecked: string;
47
+ /** A way's words, by its value (`is-any-of`): the kit's of 17 Nov 2026. */
48
+ way: (value: string) => string;
49
+ /** A step's ‹, back to the rules. */
50
+ back: string;
51
+ /** The phone's ✕ and ✓, round an editor whose holder draws no head of its own (useDecide). */
52
+ close: string;
53
+ save: string;
54
+ /** A set-aside rule's menu row putting it back. */
55
+ putBack: string;
56
+ /** A block's quantifier, as its box and a related rule's ⋮ say it ("none where"). */
57
+ quantifier: (q: Quantifier) => string;
58
+ /** Why Every can't be picked yet, by the relation's name in lower case. */
59
+ everyNeedsWhere: (one: string) => string;
60
+ /** A group's ⋮, to a screen reader, and its menu's (or its phone step's) name. */
61
+ groupActions: string;
62
+ /** A group's ⋮ row that keeps what its rules don't match, and why it can't (an Or group). */
63
+ exclude: string;
64
+ excludeNeedsAnd: string;
65
+ /** What an excluded group says at its top. */
66
+ excluded: string;
67
+ /** The lists' own words (the Picker's). */
68
+ picker?: Partial<PickerWords>;
69
+ /** A ⋯'s rows on a phone's step (a group's Exclude matches its Switch): the Menu list's own words. */
70
+ list?: Partial<MenuListWords>;
71
+ }
72
+ export declare const FILTER_EDITOR_WORDS: FilterEditorWords;
73
+ /** The filter editor's words: the handed ones over the English. */
74
+ export declare const filterWords: (given?: Partial<FilterEditorWords>) => FilterEditorWords;
@@ -0,0 +1,46 @@
1
+ const WAYS = {
2
+ is: "is", "is-not": "is not", "is-any-of": "is any of", "is-none-of": "is none of", empty: "empty", "not-empty": "not empty",
3
+ "less-than": "less than", "greater-than": "greater than", contains: "contains", "does-not-contain": "does not contain",
4
+ "starts-with": "starts with", "ends-with": "ends with", before: "before", after: "after",
5
+ "any-part-between": "any part between", "entirely-within": "entirely within", includes: "includes", "at-least": "at least", "at-most": "at most",
6
+ };
7
+ export const FILTER_EDITOR_WORDS = {
8
+ where: "Where",
9
+ join: (join) => (join === "or" ? "Or" : "And"),
10
+ add: "Add filter",
11
+ clearAllFilters: "Clear all filters",
12
+ clearAll: "Clear all",
13
+ toGroup: "Convert to group",
14
+ deleteRule: "Delete condition",
15
+ deleteGroup: "Delete group",
16
+ none: "No filtering set up yet",
17
+ noneLine: "Choose a field to filter by",
18
+ field: "Field",
19
+ how: "How it compares",
20
+ group: "Group",
21
+ ruleOf: (label) => `${label}'s rule`,
22
+ howOf: (label) => `How ${label} compares`,
23
+ chooseDate: "Choose a date",
24
+ typeNumber: "Type a number",
25
+ typeValue: "Type a value",
26
+ choose: "Choose",
27
+ from: "From",
28
+ to: "To",
29
+ fromOf: (label) => `${label} from`,
30
+ toOf: (label) => `${label} to`,
31
+ search: "Filter by…",
32
+ checked: "Checked",
33
+ unchecked: "Unchecked",
34
+ way: (value) => WAYS[value] ?? value.replace(/-/g, " "),
35
+ back: "Back",
36
+ close: "Close",
37
+ save: "Save",
38
+ putBack: "Put back",
39
+ quantifier: (q) => `${q} where`,
40
+ everyNeedsWhere: (one) => `Pick a ${one} field under Where first`,
41
+ groupActions: "Actions for this group",
42
+ exclude: "Exclude matches",
43
+ excludeNeedsAnd: "Join by And to exclude matches",
44
+ excluded: "Not all of these",
45
+ };
46
+ export const filterWords = (given) => (given ? { ...FILTER_EDITOR_WORDS, ...given } : FILTER_EDITOR_WORDS);