viewkitjs 0.28.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 (305) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/MIGRATION.md +85 -4
  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.js +2 -2
  41. package/views/dist/cells/cell-values.js +9 -10
  42. package/views/dist/contract.d.ts +149 -3
  43. package/views/dist/contract.js +157 -1
  44. package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
  45. package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
  46. package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
  47. package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
  48. package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
  49. package/views/dist/controls/bulk-bar/looks.js +14 -0
  50. package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
  51. package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
  52. package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
  53. package/views/dist/controls/bulk-bar/tokens.js +36 -0
  54. package/views/dist/controls/bulk-bar/words.d.ts +50 -0
  55. package/views/dist/controls/bulk-bar/words.js +19 -0
  56. package/views/dist/controls/bulk-bar.css +96 -0
  57. package/views/dist/controls/button/button.js +3 -1
  58. package/views/dist/controls/button.css +5 -4
  59. package/views/dist/controls/checkbox/checkbox.js +3 -1
  60. package/views/dist/controls/checkbox.css +1 -1
  61. package/views/dist/controls/choice/tokens.d.ts +79 -0
  62. package/views/dist/controls/choice/tokens.js +22 -0
  63. package/views/dist/controls/choice.css +31 -0
  64. package/views/dist/controls/compound-editor/looks.js +1 -1
  65. package/views/dist/controls/controls.d.ts +10 -0
  66. package/views/dist/controls/controls.js +8 -0
  67. package/views/dist/controls/customize/customize.d.ts +125 -0
  68. package/views/dist/controls/customize/customize.js +243 -0
  69. package/views/dist/controls/customize/glide.d.ts +10 -0
  70. package/views/dist/controls/customize/glide.js +55 -0
  71. package/views/dist/controls/customize/looks.d.ts +13 -0
  72. package/views/dist/controls/customize/looks.js +11 -0
  73. package/views/dist/controls/customize/map-customize-body.d.ts +18 -0
  74. package/views/dist/controls/customize/map-customize-body.js +160 -0
  75. package/views/dist/controls/customize/rules.d.ts +23 -0
  76. package/views/dist/controls/customize/rules.js +19 -0
  77. package/views/dist/controls/customize/tokens.d.ts +40 -0
  78. package/views/dist/controls/customize/tokens.js +12 -0
  79. package/views/dist/controls/customize/words.d.ts +58 -0
  80. package/views/dist/controls/customize/words.js +37 -0
  81. package/views/dist/controls/customize.css +54 -0
  82. package/views/dist/controls/date-editor/looks.js +1 -1
  83. package/views/dist/controls/filter-editor/block.d.ts +31 -0
  84. package/views/dist/controls/filter-editor/block.js +27 -0
  85. package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
  86. package/views/dist/controls/filter-editor/filter-editor.js +85 -43
  87. package/views/dist/controls/filter-editor/how.d.ts +1 -1
  88. package/views/dist/controls/filter-editor/how.js +1 -0
  89. package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
  90. package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
  91. package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
  92. package/views/dist/controls/filter-editor/map-rules.js +73 -42
  93. package/views/dist/controls/filter-editor/rules.d.ts +43 -5
  94. package/views/dist/controls/filter-editor/rules.js +55 -2
  95. package/views/dist/controls/filter-editor/words.d.ts +15 -0
  96. package/views/dist/controls/filter-editor/words.js +6 -0
  97. package/views/dist/controls/filter-editor.css +18 -0
  98. package/views/dist/controls/index.d.ts +26 -2
  99. package/views/dist/controls/index.js +25 -2
  100. package/views/dist/controls/inline-input/looks.js +1 -1
  101. package/views/dist/controls/input/input.js +10 -4
  102. package/views/dist/controls/internal/phone.d.ts +5 -4
  103. package/views/dist/controls/internal/phone.js +7 -7
  104. package/views/dist/controls/internal/scroll.js +5 -1
  105. package/views/dist/controls/internal/typed-run.d.ts +2 -0
  106. package/views/dist/controls/internal/typed-run.js +5 -0
  107. package/views/dist/controls/menu/map-menu.js +2 -2
  108. package/views/dist/controls/number-editor/looks.js +1 -1
  109. package/views/dist/controls/option/option.js +3 -1
  110. package/views/dist/controls/option.css +1 -1
  111. package/views/dist/controls/pane/pane.d.ts +4 -0
  112. package/views/dist/controls/pane/pane.js +2 -1
  113. package/views/dist/controls/picker/looks.js +1 -1
  114. package/views/dist/controls/picker/map-picker.d.ts +6 -2
  115. package/views/dist/controls/picker/map-picker.js +4 -2
  116. package/views/dist/controls/picker/picker.d.ts +7 -0
  117. package/views/dist/controls/picker/picker.js +57 -8
  118. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  119. package/views/dist/controls/popover/map-popover.js +2 -2
  120. package/views/dist/controls/popover/popover.js +2 -1
  121. package/views/dist/controls/popover.css +3 -0
  122. package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
  123. package/views/dist/controls/ports-host/map-ports-host.js +43 -0
  124. package/views/dist/controls/press/tokens.d.ts +8 -0
  125. package/views/dist/controls/press/tokens.js +4 -0
  126. package/views/dist/controls/press.css +44 -0
  127. package/views/dist/controls/quick-filters/looks.d.ts +11 -0
  128. package/views/dist/controls/quick-filters/looks.js +9 -0
  129. package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
  130. package/views/dist/controls/quick-filters/map-quick-filters-body.js +56 -0
  131. package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
  132. package/views/dist/controls/quick-filters/quick-filters.js +89 -0
  133. package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
  134. package/views/dist/controls/quick-filters/reminder.js +41 -0
  135. package/views/dist/controls/quick-filters/rules.d.ts +89 -0
  136. package/views/dist/controls/quick-filters/rules.js +52 -0
  137. package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
  138. package/views/dist/controls/quick-filters/tokens.js +30 -0
  139. package/views/dist/controls/quick-filters/words.d.ts +25 -0
  140. package/views/dist/controls/quick-filters/words.js +13 -0
  141. package/views/dist/controls/quick-filters.css +118 -0
  142. package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
  143. package/views/dist/controls/sheet/bottom-sheet.js +4 -4
  144. package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
  145. package/views/dist/controls/sheet/map-sheet.js +19 -6
  146. package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
  147. package/views/dist/controls/sheet/sheet-parts.js +2 -0
  148. package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
  149. package/views/dist/controls/switch-row/switch-row.js +9 -0
  150. package/views/dist/controls/switch-row/tokens.d.ts +51 -0
  151. package/views/dist/controls/switch-row/tokens.js +15 -0
  152. package/views/dist/controls/switch-row.css +39 -0
  153. package/views/dist/controls/switch.css +1 -1
  154. package/views/dist/controls/tag/tag.js +3 -1
  155. package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
  156. package/views/dist/controls/tag-field/tag-field.js +19 -0
  157. package/views/dist/controls/tag-field/tokens.d.ts +7 -0
  158. package/views/dist/controls/tag-field/tokens.js +4 -0
  159. package/views/dist/controls/tag-field.css +13 -0
  160. package/views/dist/controls/text-editor/looks.js +1 -1
  161. package/views/dist/controls/text-editor/text-editor.js +1 -5
  162. package/views/dist/controls/toast/toast.d.ts +5 -1
  163. package/views/dist/controls/toast/toast.js +5 -3
  164. package/views/dist/controls/tokens.js +18 -0
  165. package/views/dist/controls/toolbar/keys.d.ts +3 -0
  166. package/views/dist/controls/toolbar/keys.js +11 -0
  167. package/views/dist/controls/toolbar/looks.d.ts +10 -0
  168. package/views/dist/controls/toolbar/looks.js +40 -0
  169. package/views/dist/controls/toolbar/tokens.d.ts +28 -0
  170. package/views/dist/controls/toolbar/tokens.js +9 -0
  171. package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
  172. package/views/dist/controls/toolbar/toolbar.js +370 -0
  173. package/views/dist/controls/toolbar/words.d.ts +28 -0
  174. package/views/dist/controls/toolbar/words.js +17 -0
  175. package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
  176. package/views/dist/controls/toolbar-button/looks.js +21 -0
  177. package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
  178. package/views/dist/controls/toolbar-button/tokens.js +28 -0
  179. package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
  180. package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
  181. package/views/dist/controls/toolbar-button.css +75 -0
  182. package/views/dist/controls/toolbar.css +65 -0
  183. package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
  184. package/views/dist/controls/tooltip/map-tooltip.js +2 -2
  185. package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
  186. package/views/dist/controls/tooltip/tooltip.js +2 -2
  187. package/views/dist/controls/values-editor/looks.js +1 -1
  188. package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
  189. package/views/dist/controls/views-list/map-views-list-body.js +128 -4
  190. package/views/dist/controls/views-list/rules.d.ts +26 -0
  191. package/views/dist/controls/views-list/rules.js +63 -0
  192. package/views/dist/controls/views-list/view-menu.d.ts +84 -0
  193. package/views/dist/controls/views-list/view-menu.js +201 -0
  194. package/views/dist/controls/views-list/views-list.d.ts +8 -1
  195. package/views/dist/controls/views-list/views-list.js +18 -3
  196. package/views/dist/controls/views-list/words.d.ts +54 -0
  197. package/views/dist/controls/views-list/words.js +10 -1
  198. package/views/dist/controls/views-list.css +5 -1
  199. package/views/dist/display/date.js +3 -3
  200. package/views/dist/display/format.d.ts +6 -0
  201. package/views/dist/display/format.js +3 -0
  202. package/views/dist/display/index.d.ts +1 -1
  203. package/views/dist/display/index.js +1 -1
  204. package/views/dist/display/range.d.ts +2 -1
  205. package/views/dist/display/range.js +4 -1
  206. package/views/dist/grid/chrome/GridHeader.js +2 -1
  207. package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
  208. package/views/dist/grid/chrome/GridRowCells.js +2 -1
  209. package/views/dist/grid/chrome/GridTextEditor.js +2 -2
  210. package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
  211. package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
  212. package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
  213. package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
  214. package/views/dist/grid/core/clipboard-model.js +9 -4
  215. package/views/dist/grid/grid.css +240 -0
  216. package/views/dist/grid/looks.d.ts +5 -1
  217. package/views/dist/grid/looks.js +20 -12
  218. package/views/dist/grid-tokens.d.ts +109 -0
  219. package/views/dist/grid-tokens.js +29 -0
  220. package/views/dist/looks/index.d.ts +5 -0
  221. package/views/dist/looks/index.js +5 -0
  222. package/views/dist/looks/pieces.js +10 -0
  223. package/views/dist/model/column-capabilities.d.ts +2 -0
  224. package/views/dist/model/column-filters.d.ts +2 -1
  225. package/views/dist/model/column-from.js +2 -2
  226. package/views/dist/model/relation-filters.d.ts +2 -0
  227. package/views/dist/panels/index.d.ts +2 -2
  228. package/views/dist/panels/index.js +2 -2
  229. package/views/dist/panels/labels.d.ts +4 -0
  230. package/views/dist/panels/labels.js +8 -0
  231. package/views/dist/panels/model.d.ts +10 -2
  232. package/views/dist/panels/quick/model.d.ts +4 -0
  233. package/views/dist/panels/react/customize-body.d.ts +9 -4
  234. package/views/dist/panels/react/customize-body.js +39 -11
  235. package/views/dist/panels/react/customize.d.ts +8 -1
  236. package/views/dist/panels/react/customize.js +9 -6
  237. package/views/dist/panels/react/filter/FilterEditor.js +4 -4
  238. package/views/dist/panels/react/filter/FilterFieldList.js +10 -2
  239. package/views/dist/panels/react/filter/PhoneFilterEditor.js +3 -3
  240. package/views/dist/panels/react/filter/filter-body.js +5 -2
  241. package/views/dist/panels/react/panel-step.d.ts +3 -0
  242. package/views/dist/panels/react/panel-step.js +2 -1
  243. package/views/dist/panels/react/quick/QuickFiltersPanel.js +1 -0
  244. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
  245. package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
  246. package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
  247. package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
  248. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +13 -3
  249. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
  250. package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
  251. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
  252. package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
  253. package/views/dist/panels/react/view-footer.d.ts +1 -1
  254. package/views/dist/panels/react/views-row/ViewPicker.js +25 -4
  255. package/views/dist/panels/settings/filter-groups.d.ts +3 -0
  256. package/views/dist/panels/settings/filter-groups.js +40 -9
  257. package/views/dist/panels/settings/filters.d.ts +5 -0
  258. package/views/dist/panels/settings/filters.js +12 -6
  259. package/views/dist/panels/views-row/model.d.ts +10 -1
  260. package/views/dist/provider/ViewsProvider.js +29 -5
  261. package/views/dist/provider/components.d.ts +149 -8
  262. package/views/dist/provider/context.d.ts +6 -0
  263. package/views/dist/provider/ports.d.ts +18 -6
  264. package/views/dist/provider/ports.js +2 -1
  265. package/views/dist/react.d.ts +2 -2
  266. package/views/dist/react.js +1 -1
  267. package/views/dist/selection/SelectionBar.d.ts +2 -16
  268. package/views/dist/selection/SelectionBar.js +4 -1
  269. package/views/dist/selection/bar-props.d.ts +26 -0
  270. package/views/dist/selection/bar-props.js +1 -0
  271. package/views/dist/selection/index.d.ts +1 -1
  272. package/views/dist/selection/verbs.d.ts +32 -5
  273. package/views/dist/styles.css +656 -25
  274. package/views/dist/styles.unlayered.css +653 -22
  275. package/views/docs/contract.md +44 -17
  276. package/views/docs/controls/bulk-bar.md +41 -0
  277. package/views/docs/controls/choice.md +25 -0
  278. package/views/docs/controls/customize.md +17 -0
  279. package/views/docs/controls/popover.md +2 -0
  280. package/views/docs/controls/press.md +9 -0
  281. package/views/docs/controls/quick-filters.md +35 -0
  282. package/views/docs/controls/radio.md +1 -1
  283. package/views/docs/controls/switch-row.md +18 -0
  284. package/views/docs/controls/tag-field.md +7 -0
  285. package/views/docs/controls/toolbar-button.md +31 -0
  286. package/views/docs/controls/toolbar.md +14 -0
  287. package/views/docs/guides/atoms.md +2 -2
  288. package/views/docs/guides/cells.md +2 -2
  289. package/views/docs/guides/display.md +2 -2
  290. package/views/docs/guides/looks.md +8 -2
  291. package/views/docs/guides/ports.md +6 -6
  292. package/views/docs/guides/selection.md +5 -1
  293. package/views/docs/guides/the-grid.md +1 -1
  294. package/views/docs/guides/the-provider.md +2 -2
  295. package/views/docs/install.md +4 -1
  296. package/views/docs/reference/cells.md +1 -1
  297. package/views/docs/reference/controls.md +194 -13
  298. package/views/docs/reference/display.md +1 -0
  299. package/views/docs/reference/looks.md +25 -11
  300. package/views/docs/reference/panels-react.md +7 -7
  301. package/views/docs/reference/panels.md +8 -6
  302. package/views/docs/reference/react.md +13 -6
  303. package/views/docs/reference/selection.md +4 -2
  304. package/views/docs/reference/views.md +7 -6
  305. package/views/skills/views/SKILL.md +2 -2
@@ -3,6 +3,8 @@ import type { FieldType } from "viewkitjs/fields";
3
3
  import type { CategoryColor } from "viewkitjs/fields/design/category-colors";
4
4
  import type { StatusSlot } from "viewkitjs/fields/design/status-slots";
5
5
  import type { BucketOrderMode, FILTER_OPERATORS, FilterGroup, FilterRelationRule, FilterRule, SetAsideReason, SortDirection } from "viewkitjs/fields/query";
6
+ import type { ViewsConfirmPort, ViewsToastPort } from "./ports.js";
7
+ import type { SelectionBarProps } from "../selection/bar-props.js";
6
8
  /** Where a floating part attaches: an element, a ref to one, or a point (a context menu). */
7
9
  export type ViewsAnchor = HTMLElement | RefObject<HTMLElement | null> | {
8
10
  x: number;
@@ -762,6 +764,8 @@ export type ViewsQuickFiltersBodyProps = {
762
764
  key: string;
763
765
  label: string;
764
766
  searchPlaceholder?: string;
767
+ /** Its options as the app hands them (`QuickFilterField`'s): each value's mark is its option's. */
768
+ options?: readonly ViewsPickerItem[];
765
769
  /** Each value: its key as the hold keeps it (an option, an id, "true" or "false", "" for none), its words, how
766
770
  * many rows a press on it shows (absent when the app counts none or counts are hidden), and whether it is held. */
767
771
  values: readonly {
@@ -805,10 +809,14 @@ export type ViewsFilterBodyField = {
805
809
  type: keyof typeof FILTER_OPERATORS;
806
810
  /** A relation's far fields, one level in: a rule on one is a relation rule (any, none or every where …). */
807
811
  far?: readonly ViewsFilterBodyField[];
808
- /** A choice field's values (a status's, a select's, a person's, a record's), each as the Picker draws it, where ViewKit holds
812
+ /** A choice field's values (a status's, a select's, a person's, a record's), or a place's country's names (its `countryCode`
813
+ * part, VK-735), each as the Picker draws it, where ViewKit holds
809
814
  * them as the list opens: your body may list them in the rule's value box. Absent where its values are read on demand, or the
810
815
  * field is no choice: open `ruleValue` there. */
811
816
  options?: readonly ViewsPickerItem[];
817
+ /** Why no rule can be made on it, in words (a column the list can't filter); absent, it can. Draw it greyed, in its place,
818
+ * and never write a rule on it, nor put back a set-aside rule on it: ViewKit refuses a level that holds one. */
819
+ disabled?: string;
812
820
  };
813
821
  /** The filter editor's body, which your app draws (`FilterBody`): what an advanced filter's pill opens on a computer and
814
822
  * Filter opens in the phone's Sheet, in place of ViewKit's own. A panel's body, as every panel's: handed the level it is
@@ -818,7 +826,8 @@ export type ViewsFilterBodyProps = {
818
826
  /** The filter's name ("Advanced filter" on a computer, "Filter" on a phone): a phone's title, and the rules' name to a
819
827
  * screen reader. */
820
828
  label: string;
821
- /** The fields a rule may name, in the person's order, then each relation with its far fields one level in. */
829
+ /** The fields a rule may name, in the person's order, each column the list can't filter among them in its place (its
830
+ * `disabled` saying why: draw it greyed, never name it), then each relation with its far fields one level in. */
822
831
  fields: readonly ViewsFilterBodyField[];
823
832
  /** The level it is open on, its items joined by its `op`: on a computer the advanced filter's own group (`and`, `or`,
824
833
  * or `not` for one that excludes its matches; a top joined by Or as one group of its own), on a phone the whole
@@ -980,6 +989,93 @@ export type ViewsViewsListItem = {
980
989
  /** The view's own verbs (Rename, Duplicate, Delete…), as your app gave them: ViewKit's own list offers them on the
981
990
  * view in use. */
982
991
  menu?: ViewsMenuItem[];
992
+ /** Its layout, by `ViewsViewVerbs.layouts`' id. */
993
+ layout?: string;
994
+ /** It holds changes not saved. */
995
+ changed?: boolean;
996
+ /** One of the reader's favorites. */
997
+ favorite?: boolean;
998
+ };
999
+ /** A view as a restore hands it back. */
1000
+ export type ViewsViewRecord = {
1001
+ id: string;
1002
+ name: string;
1003
+ layout: string;
1004
+ private?: boolean;
1005
+ favorite?: boolean;
1006
+ changed?: boolean;
1007
+ count?: number;
1008
+ };
1009
+ /** A change a view's menu makes, as the axis's `verbs.onChange` takes it: the views list's own `ViewsListChange` but `open` and
1010
+ * `order`, which go to the axis's `onChange` and `onReorder`. Written out here, since the provider reaches nothing in the controls. */
1011
+ export type ViewsViewChange = {
1012
+ kind: "rename";
1013
+ id: string;
1014
+ name: string;
1015
+ } | {
1016
+ kind: "create";
1017
+ layout: string;
1018
+ name: string;
1019
+ columns?: string;
1020
+ from?: string;
1021
+ } | {
1022
+ kind: "duplicate";
1023
+ id: string;
1024
+ } | {
1025
+ kind: "delete";
1026
+ id: string;
1027
+ } | {
1028
+ kind: "restore";
1029
+ view: ViewsViewRecord;
1030
+ at: number;
1031
+ open: boolean;
1032
+ } | {
1033
+ kind: "save";
1034
+ id: string;
1035
+ } | {
1036
+ kind: "reset";
1037
+ id: string;
1038
+ } | {
1039
+ kind: "edit";
1040
+ id: string;
1041
+ } | {
1042
+ kind: "link";
1043
+ id: string;
1044
+ } | {
1045
+ kind: "favorite";
1046
+ id: string;
1047
+ on: boolean;
1048
+ } | {
1049
+ kind: "private";
1050
+ id: string;
1051
+ on: boolean;
1052
+ };
1053
+ /** A layout a new view can take: its glyph by your own icon's name (AppIcon), its name, its one line; `columns` where it asks
1054
+ * which field makes its columns (a board). */
1055
+ export type ViewsViewLayout = {
1056
+ id: string;
1057
+ name: string;
1058
+ icon: string;
1059
+ line: string;
1060
+ columns?: boolean;
1061
+ };
1062
+ /** A view's verbs, handed where your app lets ViewKit draw a view's menu (CONTROLS: Rename, New view, the delete question, Undo). */
1063
+ export type ViewsViewVerbs = {
1064
+ layouts: readonly ViewsViewLayout[];
1065
+ /** What the list holds, in the delete question's line ("deals"). */
1066
+ records: string;
1067
+ /** The fields a board's columns can follow, and the one filled in. */
1068
+ columns?: {
1069
+ fields: readonly {
1070
+ value: string;
1071
+ label: string;
1072
+ }[];
1073
+ value: string;
1074
+ };
1075
+ /** Each change a view's menu makes. ViewKit moves no view itself: open the right one here (the first listed when the open one
1076
+ * is deleted, the view again on a restore with `open`, the new one on a create or a duplicate, whose ids your app makes).
1077
+ * `viewsAfter` (viewkitjs/views/controls) does all of it over your views. */
1078
+ onChange: (change: ViewsViewChange) => void;
983
1079
  };
984
1080
  /** The views list's body, which your app draws (`ViewsListBody`): what the view picker's chip opens on a computer and in
985
1081
  * the phone's Sheet, in place of ViewKit's own list. A panel's body, as every panel's: handed the axis's views as data,
@@ -1007,8 +1103,17 @@ export type ViewsViewsListBodyProps = {
1007
1103
  /** The job is done and what holds it closes. */
1008
1104
  onDone: () => void;
1009
1105
  /** On a phone where the sheet's head doesn't draw it (`sheetActions: "bar"`): its ✕, closing the list, for your
1010
- * body's own head. Absent on a computer, and under `head`, where the sheet holds it. */
1106
+ * body's own head, and Back while the body stands on a step (`onStepChange`). Absent on a computer, and under `head`,
1107
+ * where the sheet holds them. */
1011
1108
  actions?: ViewsSheetActions;
1109
+ /** Handed where the axis hands `verbs`: draw a view's whole menu from them (CONTROLS does), not only `menu`. */
1110
+ verbs?: ViewsViewVerbs;
1111
+ /** On a phone, the body stands on a step of its own (a view's menu, Rename…): its title and Back go to the sheet's head, and
1112
+ * the sheet's Escape goes back a step. Absent on a computer. */
1113
+ onStepChange?: (step: ViewsBodyStep | null) => void;
1114
+ /** While true, a press outside the list and Escape close nothing: the body asks a question outside it (your `confirm` port's
1115
+ * dialog, which stands outside the list's popover), and the list stays when it is answered. On a computer. */
1116
+ onHold?: (holding: boolean) => void;
1012
1117
  };
1013
1118
  /** A field a list can be grouped by, as the group body is handed it (`ViewsGroupBodyProps.dimensions`): the panels'
1014
1119
  * `GroupDimension` (`viewkitjs/views/panels`), written out here, since the provider reaches nothing inside the panels. */
@@ -1212,7 +1317,7 @@ export type ViewsCustomizeBodyProps = {
1212
1317
  group?: Omit<ViewsGroupBodyProps, "form" | "onDone" | "actions" | "onStepChange">;
1213
1318
  /** The list's own toggles, Show counts among them (read from the view). */
1214
1319
  toggles: readonly ViewsCustomizeToggle[];
1215
- /** On a shared view: how far the reader has drifted from it, and Reset and Set default for everyone. */
1320
+ /** On a shared view: how far the reader has drifted from it, and Reset and Save for everyone. */
1216
1321
  view?: {
1217
1322
  changes: number;
1218
1323
  /** Everyone's view moved after the reader's changes began. */
@@ -1237,6 +1342,19 @@ export type ViewsCustomizeBodyProps = {
1237
1342
  /** On a phone where the sheet's head doesn't draw it (`sheetActions: "bar"`): its ✕, closing it, for your body's own
1238
1343
  * head. Absent on a computer, and under `head`, where the sheet holds it. */
1239
1344
  actions?: ViewsSheetActions;
1345
+ /** The view's name, as the app hands it through the toolbar (`viewName`): draw it, renamed in place, only with `onRename`. */
1346
+ name?: string;
1347
+ /** Renames the view (the toolbar's `onRenameView`): handed only where the app can rename it. */
1348
+ onRename?: (name: string) => void;
1349
+ /** Copy link to view, where the app hands it. */
1350
+ onCopyLink?: () => void;
1351
+ /** Export CSV, where the app hands it. */
1352
+ onExport?: () => void;
1353
+ /** What Export CSV takes, in words ("12 deals"), shown beside it. */
1354
+ exportCount?: string;
1355
+ /** On a phone: the level of its own your body stands on inside a section (the group editor's Group by), or `null` once
1356
+ * it is back, so the sheet's Escape goes back a level instead of closing. */
1357
+ onStepChange?: (step: ViewsBodyStep | null) => void;
1240
1358
  };
1241
1359
  /** Where the editor panel's ✕ and ✓, and a toolbar panel's ✕, stand on a phone: `bar`, the panel's own inside the
1242
1360
  * Sheet; `head`, handed to the Sheet as `actions` for its own head, with none drawn inside. */
@@ -1314,6 +1432,16 @@ export type ViewsRowsWaitProps = {
1314
1432
  pending: boolean;
1315
1433
  children: ReactNode;
1316
1434
  };
1435
+ /** What the components map's `PortsHost` is told: which ports the app left out, and where to hand ViewKit's own once they
1436
+ * stand. */
1437
+ export type ViewsPortsHostProps = {
1438
+ toast: boolean;
1439
+ confirm: boolean;
1440
+ onReady: (ports: {
1441
+ toast?: ViewsToastPort;
1442
+ confirm?: ViewsConfirmPort;
1443
+ }) => void;
1444
+ };
1317
1445
  export type ViewsComponents = {
1318
1446
  Button: ComponentType<ViewsButtonProps>;
1319
1447
  Popover: ComponentType<ViewsPopoverProps>;
@@ -1398,16 +1526,29 @@ export type ViewsComponents = {
1398
1526
  GroupBody?: ComponentType<ViewsGroupBodyProps>;
1399
1527
  /** Optional: Customize's whole body, which your app draws. Handed one, Options opens it on a computer and in the
1400
1528
  * phone's Sheet, and so does anything else that draws ViewKit's Customize, handed the view's settings as data; left
1401
- * out, it opens ViewKit's own Customize. */
1402
- CustomizeBody?: ComponentType<ViewsCustomizeBodyProps>;
1529
+ * out, it opens ViewKit's own Customize. A body that can't draw everything a list hands carries `stepsAside`: given the
1530
+ * props it would be handed, true, and ViewKit draws its own Customize instead. */
1531
+ CustomizeBody?: ComponentType<ViewsCustomizeBodyProps> & {
1532
+ stepsAside?: (props: ViewsCustomizeBodyProps) => boolean;
1533
+ };
1403
1534
  /** Optional: the toolbar's search box, which your app draws. Handed one, the search opens it in place of its own
1404
1535
  * field, on a computer and on a phone; left out, ViewKit draws its own. */
1405
1536
  SearchField?: ComponentType<ViewsSearchFieldProps>;
1537
+ /** Optional: what draws the ports an app leaves out (CONTROLS: ViewKit's Toast and alert dialog). Mounted once by the
1538
+ * provider, after it first renders in the browser, only when the app hands no `toast` or no `confirm`; left out, a
1539
+ * missing `toast` draws nothing and a missing `confirm` is the browser's. */
1540
+ PortsHost?: ComponentType<ViewsPortsHostProps>;
1541
+ /** Optional: the selection bar, which your app draws (CONTROLS: the Outright bulk bar). Handed one, ViewKit's `SelectionBar`
1542
+ * draws it in its own place, in the box that holds it, at every count (zero included, so it can leave), handed its props;
1543
+ * left out, ViewKit draws its own bar, portalled to the screen's foot. */
1544
+ SelectionBar?: ComponentType<ViewsSelectionBarProps>;
1406
1545
  };
1546
+ /** The selection bar's props, as your `SelectionBar` is handed them: ViewKit's `SelectionBar`'s own. */
1547
+ export type ViewsSelectionBarProps = SelectionBarProps;
1407
1548
  /** The map as the views read it: `Input`, `Command` and `Calendar` always filled, the app's or the
1408
1549
  * package's own; `Picker`, `LinksBody`, `DateBody`, `PartsBody`, `ValuesBody`, `TextBody`, `NumberBody`, `SortBody`, `FilterBody`,
1409
- * `FieldsBody`, `FilterPartBody`, `RowsWait`, `QuickFiltersBody`, `ViewsListBody`, `GroupBody`, `CustomizeBody` and
1410
- * `SearchField` as the app handed them. */
1550
+ * `FieldsBody`, `FilterPartBody`, `RowsWait`, `QuickFiltersBody`, `ViewsListBody`, `GroupBody`, `CustomizeBody`,
1551
+ * `SearchField`, `PortsHost` and `SelectionBar` as the app handed them. */
1411
1552
  export type ViewsResolvedComponents = ViewsComponents & {
1412
1553
  Input: ComponentType<ViewsInputProps>;
1413
1554
  Command: ViewsCommandParts;
@@ -16,6 +16,12 @@ export type ViewsContextValue = {
16
16
  icons: ViewsIcons;
17
17
  /** The app's ports, with `confirm` always a function (the browser's where the app handed none). */
18
18
  ports: ViewsResolvedPorts;
19
+ /** No `confirm` of the app's and no `PortsHost` to draw ViewKit's: `ports.confirm` is the browser's own. A control that can ask
20
+ * in a dialog of its own (a view's menu, VK-823) asks there instead. */
21
+ confirmFallback: boolean;
22
+ /** No `toast` of the app's and no `PortsHost`: `ports.toast` draws nothing. A control that can say it through a Toast of its
23
+ * own standing round it (a view's menu) does so instead. */
24
+ toastFallback: boolean;
19
25
  messages: ViewsMessageResolver;
20
26
  conventions: FieldConventions;
21
27
  /** The app's formatting: given the package's defaults, return the app's. */
@@ -1,5 +1,8 @@
1
1
  export type ViewsToastPort = {
2
- success: (message: string) => void;
2
+ /** `undo`: the act can be taken back; the toast offers Undo, which calls it. An app's toast may ignore it. */
3
+ success: (message: string, options?: {
4
+ undo?: () => void;
5
+ }) => void;
3
6
  error: (message: string) => void;
4
7
  info: (message: string) => void;
5
8
  /** A change the person did not make — a value someone else wrote — said with a second line. */
@@ -33,25 +36,34 @@ export type ViewsConfirmRequest = {
33
36
  confirmLabel: string;
34
37
  /** What the act is done to, as the host names it (a row's `deleteLabel`). Absent when it names nothing. */
35
38
  subject?: string;
39
+ /** One line under the question, on what follows (a view's delete: `deleteLine`). */
40
+ detail?: string;
36
41
  /** The act removes something: the app draws its destructive look. */
37
42
  destructive?: boolean;
38
43
  };
39
44
  /** Resolves to whether the person said yes. */
40
45
  export type ViewsConfirmPort = (request: ViewsConfirmRequest) => Promise<boolean>;
41
46
  export type ViewsPorts = {
42
- toast: ViewsToastPort;
47
+ /** What ViewKit reports. Absent: ViewKit's Toast where the components map hands `PortsHost` (CONTROLS does), else nothing. */
48
+ toast?: ViewsToastPort;
43
49
  haptics: ViewsHapticsPort;
44
50
  clipboard: ViewsClipboardPort;
45
51
  viewPrefs: ViewsPrefsPort;
46
- /** Asks before a destructive act (a row's Delete). Absent: the browser's own confirm with `message`. */
52
+ /** Asks before a destructive act (a row's Delete). Absent: ViewKit's alert dialog where the components map hands
53
+ * `PortsHost` (CONTROLS does), else the browser's own confirm with `message`. */
47
54
  confirm?: ViewsConfirmPort;
48
55
  };
49
- /** The ports as the provider hands them on: `confirm` always there, the browser's where the app
50
- * handed none. */
56
+ /** The ports as the provider hands them on: `toast` and `confirm` always there, `PortsHost`'s where the app handed none,
57
+ * else a toast that draws nothing and the browser's confirm. */
51
58
  export type ViewsResolvedPorts = ViewsPorts & {
59
+ toast: ViewsToastPort;
52
60
  confirm: ViewsConfirmPort;
53
61
  };
54
62
  /** The browser's own dialog, read when it is asked, so a server render never reaches `window`. */
55
63
  export declare const browserConfirm: ViewsConfirmPort;
64
+ /** A toast that draws nothing: where an app hands none and nothing draws ViewKit's. */
65
+ export declare const NOOP_TOAST: ViewsToastPort;
56
66
  /** Ports that do nothing: a server render, a test, an app without a device. */
57
- export declare const NOOP_PORTS: ViewsPorts;
67
+ export declare const NOOP_PORTS: ViewsPorts & {
68
+ toast: ViewsToastPort;
69
+ };
@@ -1,8 +1,9 @@
1
1
  export const browserConfirm = async ({ message }) => window.confirm(message);
2
2
  const _portsMatchContract = true;
3
3
  void _portsMatchContract;
4
+ export const NOOP_TOAST = { success() { }, error() { }, info() { }, warning() { } };
4
5
  export const NOOP_PORTS = {
5
- toast: { success() { }, error() { }, info() { }, warning() { } },
6
+ toast: NOOP_TOAST,
6
7
  haptics: { selection() { }, impact() { }, notification() { } },
7
8
  clipboard: { writeText: async () => false, readText: async () => null },
8
9
  viewPrefs: { get: () => undefined, set() { }, subscribe: () => () => { } },
@@ -5,9 +5,9 @@ export type { ViewsOneValueEditors } from "./model/one-value.js";
5
5
  export type { ViewsBodyFrame, ViewsGridBodyPlace } from "./model/body-frame.js";
6
6
  export { DEFAULT_DESKTOP_QUERY } from "./provider/desktop.js";
7
7
  export type { ViewsSeveralValues } from "./display/fit-values.js";
8
- export type { ViewsAlign, ViewsAnchor, ViewsBarPlacement, ViewsButtonProps, ViewsCalendarProps, ViewsCheckboxProps, ViewsCloseReason, ViewsCollapseProps, ViewsCommandParts, ViewsComponents, ViewsCustomizeBodyProps, ViewsCustomizeChoice, ViewsCustomizeColumn, ViewsCustomizeColumns, ViewsCustomizeLayout, ViewsCustomizePage, ViewsCustomizeToggle, ViewsDateBodyProps, ViewsDatePick, ViewsDatePicks, ViewsGridButtons, ViewsSelectionChip, ViewsGridCheckboxes, ViewsFieldRowButtons, ViewsFieldRowCheckboxes, ViewsPanelButtons, ViewsInputProps, ViewsFieldsBodyField, ViewsFieldsBodyProps, ViewsFilterBodyField, ViewsFilterBodyProps, ViewsFilterPartBodyProps, ViewsGroupBodyProps, ViewsGroupDimension, ViewsGroupEntry, ViewsGroupValue, ViewsMenuItem, ViewsMenuProps, ViewsMenuRoute, ViewsNumberBodyProps, ViewsOpenChange, ViewsPartsBodyProps, ViewsPickerAction, ViewsPickerItem, ViewsPickerProps, ViewsLink, ViewsLinkRole, ViewsLinksBodyProps, ViewsPlacePart, ViewsPlaceParts, ViewsPopoverProps, ViewsQuickFiltersBodyProps, ViewsResolvedComponents, ViewsRowsWaitProps, ViewsSearchFieldProps, ViewsSelectionBarSettings, ViewsSheetAction, ViewsSheetActions, ViewsBodyStep, ViewsSheetActionsPlace, ViewsSheetProps, ViewsSide, ViewsSortBodyProps, ViewsTextBodyProps, ViewsTooltipProps, ViewsValueLine, ViewsValuesBodyProps, ViewsViewsListBodyProps, ViewsViewsListItem, } from "./provider/components.js";
8
+ export type { ViewsAlign, ViewsAnchor, ViewsBarPlacement, ViewsButtonProps, ViewsCalendarProps, ViewsCheckboxProps, ViewsCloseReason, ViewsCollapseProps, ViewsCommandParts, ViewsComponents, ViewsCustomizeBodyProps, ViewsCustomizeChoice, ViewsCustomizeColumn, ViewsCustomizeColumns, ViewsCustomizeLayout, ViewsCustomizePage, ViewsCustomizeToggle, ViewsDateBodyProps, ViewsDatePick, ViewsDatePicks, ViewsGridButtons, ViewsSelectionChip, ViewsGridCheckboxes, ViewsFieldRowButtons, ViewsFieldRowCheckboxes, ViewsPanelButtons, ViewsInputProps, ViewsFieldsBodyField, ViewsFieldsBodyProps, ViewsFilterBodyField, ViewsFilterBodyProps, ViewsFilterPartBodyProps, ViewsGroupBodyProps, ViewsGroupDimension, ViewsGroupEntry, ViewsGroupValue, ViewsMenuItem, ViewsMenuProps, ViewsMenuRoute, ViewsNumberBodyProps, ViewsOpenChange, ViewsPartsBodyProps, ViewsPickerAction, ViewsPickerItem, ViewsPickerProps, ViewsLink, ViewsLinkRole, ViewsLinksBodyProps, ViewsPlacePart, ViewsPlaceParts, ViewsPopoverProps, ViewsPortsHostProps, ViewsSelectionBarProps, ViewsQuickFiltersBodyProps, ViewsResolvedComponents, ViewsRowsWaitProps, ViewsSearchFieldProps, ViewsSelectionBarSettings, ViewsSheetAction, ViewsSheetActions, ViewsBodyStep, ViewsSheetActionsPlace, ViewsSheetProps, ViewsSide, ViewsSortBodyProps, ViewsTextBodyProps, ViewsTooltipProps, ViewsValueLine, ViewsValuesBodyProps, ViewsViewsListBodyProps, ViewsViewsListItem, ViewsViewChange, ViewsViewLayout, ViewsViewRecord, ViewsViewVerbs, } from "./provider/components.js";
9
9
  export type { ViewsIconProps, ViewsIcons } from "./provider/icons.js";
10
- export { NOOP_PORTS } from "./provider/ports.js";
10
+ export { NOOP_PORTS, NOOP_TOAST } from "./provider/ports.js";
11
11
  export type { ViewsClipboardPort, ViewsConfirmPort, ViewsConfirmRequest, ViewsHapticsPort, ViewsPorts, ViewsPrefsPort, ViewsResolvedPorts, ViewsToastPort, } from "./provider/ports.js";
12
12
  export { DEFAULT_VIEWS_ATOMS } from "./atoms/defaults.js";
13
13
  export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsCellMoreProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusOption, ViewsStatusPlace, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, ViewsPillProps, ViewsRangeCalendarProps, ViewsToolbarButtonProps, ViewsToolbarButtonPart, } from "./atoms/types.js";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
2
  export { ViewsProvider, useViews } from "./provider/ViewsProvider.js";
3
3
  export { DEFAULT_DESKTOP_QUERY } from "./provider/desktop.js";
4
- export { NOOP_PORTS } from "./provider/ports.js";
4
+ export { NOOP_PORTS, NOOP_TOAST } from "./provider/ports.js";
5
5
  export { DEFAULT_VIEWS_ATOMS } from "./atoms/defaults.js";
@@ -1,18 +1,4 @@
1
1
  import { type ReactNode } from "react";
2
- import type { SelectionVerb } from "./verbs.js";
3
- export type SelectionBarProps = {
4
- /** How many rows are selected. The bar draws nothing at zero. */
5
- count: number;
6
- /** Clears the selection: the count chip, the phone's ✕. */
7
- onClear: () => void;
8
- /** What the selection lets a person do, in order: the first four on the bar, the rest in More. */
9
- verbs: readonly SelectionVerb[];
10
- /** A batch is running: every control is disabled until it ends. */
11
- busy?: boolean;
12
- /** Deletes the selection. The bar's own verb, drawn as the trailing trash in the same place on every list;
13
- * never a verb in `verbs`. A list with no bulk delete leaves it out. */
14
- onDelete?: () => void;
15
- /** The trash's accessible name and tooltip. Default: the `views.selection.delete` message. */
16
- deleteLabel?: string;
17
- };
2
+ export type { SelectionBarProps } from "./bar-props.js";
3
+ import type { SelectionBarProps } from "./bar-props.js";
18
4
  export declare function SelectionBar(props: SelectionBarProps): ReactNode;
@@ -14,12 +14,15 @@ import { SelectionBarPhone } from "./SelectionBarPhone.js";
14
14
  const DEFAULT_BOTTOM = "calc(1rem + env(safe-area-inset-bottom))";
15
15
  const DEFAULT_LAYER = 50;
16
16
  export function SelectionBar(props) {
17
- const { selectionBar } = useViews();
17
+ const { selectionBar, components } = useViews();
18
+ const Own = components.SelectionBar;
18
19
  const barRoomRef = useContext(BarRoomContext);
19
20
  const desktop = useDesktop();
20
21
  const phoneQuery = selectionBar?.phoneQuery;
21
22
  const phoneByQuery = useMediaQuery(phoneQuery ?? "not all", false);
22
23
  const phone = phoneQuery ? phoneByQuery : !desktop;
24
+ if (Own)
25
+ return _jsx(Own, { ...props });
23
26
  if (props.count === 0 || typeof document === "undefined")
24
27
  return null;
25
28
  const placement = phone ? selectionBar?.phone : selectionBar?.desktop;
@@ -0,0 +1,26 @@
1
+ import type { ReactNode } from "react";
2
+ import type { SelectionRun, SelectionVerb } from "./verbs.js";
3
+ export type SelectionBarProps = {
4
+ /** How many rows are selected. ViewKit's own bar draws nothing at zero; the components map's stays, leaving. */
5
+ count: number;
6
+ /** What a row is, one and many ("deal", "deals"), for the components map's bar ("3 deals selected"). Left out, its own
7
+ * (the `views.selection.noun-one` and `noun-other` messages). ViewKit's own bar doesn't read it. */
8
+ noun?: {
9
+ one: string;
10
+ other: string;
11
+ };
12
+ /** Clears the selection: the count chip, the phone's ✕. */
13
+ onClear: () => void;
14
+ /** What the selection lets a person do, in order: the first four on the bar, the rest in More. */
15
+ verbs: readonly SelectionVerb[];
16
+ /** A batch is running: every control is disabled until it ends. */
17
+ busy?: boolean;
18
+ /** Deletes the selection. The bar's own verb, drawn as the trailing trash in the same place on every list;
19
+ * never a verb in `verbs`. A list with no bulk delete leaves it out. The components map's bar (CONTROLS') asks first,
20
+ * then calls it, and shows what it hands back; ViewKit's own calls it at once. */
21
+ onDelete?: SelectionRun;
22
+ /** The trash's accessible name and tooltip. Default: the `views.selection.delete` message. */
23
+ deleteLabel?: string;
24
+ /** The line under the components map's question ("They move to the trash."). ViewKit's own bar asks nothing. */
25
+ deleteLine?: ReactNode;
26
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  export type { ListBatchApi, ListSelectionConfig } from "./types.js";
2
2
  export { SelectionBar, type SelectionBarProps } from "./SelectionBar.js";
3
- export type { SelectionOptionsVerb, SelectionVerb, SelectionVerbItem } from "./verbs.js";
3
+ export type { SelectionDone, SelectionOptionsVerb, SelectionRun, SelectionVerb, SelectionVerbItem } from "./verbs.js";
4
4
  export { SelectCheckbox } from "./SelectCheckbox.js";
5
5
  export { useCheckDragSelect, ROW_CHECK_ATTR } from "./useCheckDragSelect.js";
6
6
  export { preventShiftTextSelect, selectFromClick, ROW_INTERACTIVE_SELECTOR, ROW_NO_TEXT_SELECT, ROW_OPEN_STOP_SELECTOR, } from "./row-click.js";
@@ -1,11 +1,21 @@
1
1
  import type { ReactNode } from "react";
2
- import type { PickerOption } from "../editors/SelectEditor.js";
2
+ import type { ViewsPickerItem } from "../provider/components.js";
3
+ /** What a press hands back, for the bar that shows it (CONTROLS.SelectionBar's): what its Toast says, and how it is taken back.
4
+ * Nothing: no Toast. ViewKit's own bar shows none either way. */
5
+ export type SelectionDone = {
6
+ words: string;
7
+ undo?: () => void;
8
+ };
9
+ /** A press: done at once, or once its promise settles; one that throws or rejects is a press that didn't go through. What it
10
+ * hands back is read only where it is a `SelectionDone` (or a promise of one), so a press that returns anything else, as
11
+ * `() => list.push(id)` does, is still one. */
12
+ export type SelectionRun = () => unknown;
3
13
  /** One verb, or one row of a `group`. */
4
14
  export type SelectionVerbItem = {
5
15
  label: string;
6
16
  /** The app's glyph, drawn before the words. */
7
17
  icon?: ReactNode;
8
- onClick: () => void;
18
+ onClick: SelectionRun;
9
19
  /** A verb that undoes or removes something (Cancel, Disconnect): drawn in the danger colour. Delete
10
20
  * itself is the bar's own `onDelete`, never a verb. */
11
21
  destructive?: boolean;
@@ -14,7 +24,7 @@ export type SelectionVerbItem = {
14
24
  disabledReason?: string;
15
25
  };
16
26
  /** "Set this field on every selected row": the field's values as their badges, the same rows a cell's
17
- * editor picks from. No current value: the rows may already hold several. */
27
+ * editor picks from. ViewKit's own bar marks no current value: the rows may already hold several. */
18
28
  export type SelectionOptionsVerb = {
19
29
  kind: "options";
20
30
  label: string;
@@ -22,17 +32,34 @@ export type SelectionOptionsVerb = {
22
32
  disabled?: boolean;
23
33
  /** Why it is disabled, in the person's words: More's rows, the bar's button and the phone sheet carry it. */
24
34
  disabledReason?: string;
25
- options: PickerOption[];
26
- onSelect: (value: string) => void;
35
+ /** Its values: a status by its `slot`, a category by its `color`, a person or a company by `avatarUrl` (null: their initials)
36
+ * and `kind`. ViewKit's own bar reads the value, the label, the slot and the colour. */
37
+ options: ViewsPickerItem[];
38
+ /** Kept off the bar, in More (CONTROLS.SelectionBar's bar). */
39
+ more?: boolean;
40
+ /** What every picked row holds, when they hold the same: a value, or null when every one is empty; left out, they differ.
41
+ * CONTROLS.SelectionBar's bar marks it. */
42
+ value?: string | null;
43
+ /** The empty row's words ("No owner"): a pick of it calls `onEmpty`. Left out, the field can't be emptied. */
44
+ empty?: string;
45
+ /** Empties the field on every picked row: the empty row's press, where `empty` is handed. */
46
+ onEmpty?: SelectionRun;
47
+ /** What its search says before anything is typed ("Search people"); left out, no search. */
48
+ search?: string;
49
+ /** A pick sets every picked row to the value picked. What it hands back is read as `SelectionRun`'s is. */
50
+ onSelect: (value: string) => unknown;
27
51
  };
28
52
  /** A verb on the bar: a direct `action`, a `group` that opens a small menu of related verbs, or an
29
53
  * `options` verb whose values are picked as badges. */
30
54
  export type SelectionVerb = ({
31
55
  kind: "action";
56
+ more?: boolean;
32
57
  } & SelectionVerbItem) | {
33
58
  kind: "group";
34
59
  label: string;
35
60
  icon?: ReactNode;
61
+ /** Kept off the bar, in More (CONTROLS.SelectionBar's bar). */
62
+ more?: boolean;
36
63
  disabled?: boolean;
37
64
  /** Why the group is disabled: its own button and More's row carry it, and so does each of its rows that
38
65
  * gives none. */