viewkitjs 0.28.0 → 0.30.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 (530) hide show
  1. package/CHANGELOG.md +218 -0
  2. package/MIGRATION.md +181 -11
  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 +2 -2
  41. package/views/dist/cells/cell-format.js +2 -2
  42. package/views/dist/cells/cell-values.js +9 -12
  43. package/views/dist/contract.d.ts +161 -18
  44. package/views/dist/contract.js +170 -28
  45. package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
  46. package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
  47. package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
  48. package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
  49. package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
  50. package/views/dist/controls/bulk-bar/looks.js +14 -0
  51. package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
  52. package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
  53. package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
  54. package/views/dist/controls/bulk-bar/tokens.js +36 -0
  55. package/views/dist/controls/bulk-bar/words.d.ts +50 -0
  56. package/views/dist/controls/bulk-bar/words.js +19 -0
  57. package/views/dist/controls/bulk-bar.css +96 -0
  58. package/views/dist/controls/button/button.js +3 -1
  59. package/views/dist/controls/button.css +5 -4
  60. package/views/dist/controls/checkbox/checkbox.js +3 -1
  61. package/views/dist/controls/checkbox.css +1 -1
  62. package/views/dist/controls/choice/tokens.d.ts +79 -0
  63. package/views/dist/controls/choice/tokens.js +22 -0
  64. package/views/dist/controls/choice.css +31 -0
  65. package/views/dist/controls/compound-editor/looks.js +1 -1
  66. package/views/dist/controls/controls.d.ts +8 -0
  67. package/views/dist/controls/controls.js +8 -0
  68. package/views/dist/controls/customize/customize.d.ts +176 -0
  69. package/views/dist/controls/customize/customize.js +348 -0
  70. package/views/dist/controls/customize/glide.d.ts +10 -0
  71. package/views/dist/controls/customize/glide.js +55 -0
  72. package/views/dist/controls/customize/looks.d.ts +13 -0
  73. package/views/dist/controls/customize/looks.js +11 -0
  74. package/views/dist/controls/customize/map-customize-body.d.ts +15 -0
  75. package/views/dist/controls/customize/map-customize-body.js +195 -0
  76. package/views/dist/controls/customize/map-ranges.d.ts +23 -0
  77. package/views/dist/controls/customize/map-ranges.js +41 -0
  78. package/views/dist/controls/customize/rules.d.ts +39 -0
  79. package/views/dist/controls/customize/rules.js +21 -0
  80. package/views/dist/controls/customize/tokens.d.ts +40 -0
  81. package/views/dist/controls/customize/tokens.js +12 -0
  82. package/views/dist/controls/customize/words.d.ts +65 -0
  83. package/views/dist/controls/customize/words.js +42 -0
  84. package/views/dist/controls/customize.css +57 -0
  85. package/views/dist/controls/date-editor/looks.js +1 -1
  86. package/views/dist/controls/filter-editor/block.d.ts +31 -0
  87. package/views/dist/controls/filter-editor/block.js +27 -0
  88. package/views/dist/controls/filter-editor/filter-editor.d.ts +4 -0
  89. package/views/dist/controls/filter-editor/filter-editor.js +86 -43
  90. package/views/dist/controls/filter-editor/how.d.ts +1 -1
  91. package/views/dist/controls/filter-editor/how.js +1 -0
  92. package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
  93. package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
  94. package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
  95. package/views/dist/controls/filter-editor/map-rules.js +73 -42
  96. package/views/dist/controls/filter-editor/rules.d.ts +42 -5
  97. package/views/dist/controls/filter-editor/rules.js +55 -2
  98. package/views/dist/controls/filter-editor/words.d.ts +15 -0
  99. package/views/dist/controls/filter-editor/words.js +6 -0
  100. package/views/dist/controls/filter-editor.css +18 -0
  101. package/views/dist/controls/index.d.ts +33 -9
  102. package/views/dist/controls/index.js +32 -9
  103. package/views/dist/controls/inline-input/looks.js +1 -1
  104. package/views/dist/controls/input/input.js +10 -4
  105. package/views/dist/controls/internal/phone.d.ts +5 -4
  106. package/views/dist/controls/internal/phone.js +7 -7
  107. package/views/dist/controls/internal/scroll.js +5 -1
  108. package/views/dist/controls/internal/typed-run.d.ts +2 -0
  109. package/views/dist/controls/internal/typed-run.js +5 -0
  110. package/views/dist/controls/menu/map-menu.js +2 -2
  111. package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
  112. package/views/dist/controls/menu-list/menu-list.js +26 -8
  113. package/views/dist/controls/menu-list.css +8 -0
  114. package/views/dist/controls/number-editor/looks.js +1 -1
  115. package/views/dist/controls/option/option.js +3 -1
  116. package/views/dist/controls/option.css +1 -1
  117. package/views/dist/controls/pane/pane.d.ts +4 -0
  118. package/views/dist/controls/pane/pane.js +2 -1
  119. package/views/dist/controls/picker/looks.js +1 -1
  120. package/views/dist/controls/picker/map-picker.d.ts +6 -2
  121. package/views/dist/controls/picker/map-picker.js +4 -2
  122. package/views/dist/controls/picker/picker.d.ts +7 -0
  123. package/views/dist/controls/picker/picker.js +57 -8
  124. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  125. package/views/dist/controls/popover/map-popover.js +2 -2
  126. package/views/dist/controls/popover/popover.js +2 -1
  127. package/views/dist/controls/popover.css +3 -0
  128. package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
  129. package/views/dist/controls/ports-host/map-ports-host.js +43 -0
  130. package/views/dist/controls/press/tokens.d.ts +8 -0
  131. package/views/dist/controls/press/tokens.js +4 -0
  132. package/views/dist/controls/press.css +44 -0
  133. package/views/dist/controls/quick-filters/looks.d.ts +11 -0
  134. package/views/dist/controls/quick-filters/looks.js +9 -0
  135. package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
  136. package/views/dist/controls/quick-filters/map-quick-filters-body.js +59 -0
  137. package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
  138. package/views/dist/controls/quick-filters/quick-filters.js +89 -0
  139. package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
  140. package/views/dist/controls/quick-filters/reminder.js +41 -0
  141. package/views/dist/controls/quick-filters/rules.d.ts +89 -0
  142. package/views/dist/controls/quick-filters/rules.js +52 -0
  143. package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
  144. package/views/dist/controls/quick-filters/tokens.js +30 -0
  145. package/views/dist/controls/quick-filters/words.d.ts +25 -0
  146. package/views/dist/controls/quick-filters/words.js +13 -0
  147. package/views/dist/controls/quick-filters.css +118 -0
  148. package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
  149. package/views/dist/controls/sheet/bottom-sheet.js +4 -4
  150. package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
  151. package/views/dist/controls/sheet/map-sheet.js +19 -6
  152. package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
  153. package/views/dist/controls/sheet/sheet-parts.js +2 -0
  154. package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
  155. package/views/dist/controls/switch-row/switch-row.js +9 -0
  156. package/views/dist/controls/switch-row/tokens.d.ts +51 -0
  157. package/views/dist/controls/switch-row/tokens.js +15 -0
  158. package/views/dist/controls/switch-row.css +39 -0
  159. package/views/dist/controls/switch.css +1 -1
  160. package/views/dist/controls/tag/tag.js +3 -1
  161. package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
  162. package/views/dist/controls/tag-field/tag-field.js +19 -0
  163. package/views/dist/controls/tag-field/tokens.d.ts +7 -0
  164. package/views/dist/controls/tag-field/tokens.js +4 -0
  165. package/views/dist/controls/tag-field.css +13 -0
  166. package/views/dist/controls/text-editor/looks.js +1 -1
  167. package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
  168. package/views/dist/controls/text-editor/map-text-body.js +2 -2
  169. package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
  170. package/views/dist/controls/text-editor/text-editor.js +17 -7
  171. package/views/dist/controls/text-editor.css +11 -0
  172. package/views/dist/controls/toast/toast.d.ts +5 -1
  173. package/views/dist/controls/toast/toast.js +5 -3
  174. package/views/dist/controls/tokens.js +18 -0
  175. package/views/dist/controls/toolbar/keys.d.ts +3 -0
  176. package/views/dist/controls/toolbar/keys.js +11 -0
  177. package/views/dist/controls/toolbar/looks.d.ts +10 -0
  178. package/views/dist/controls/toolbar/looks.js +40 -0
  179. package/views/dist/controls/toolbar/tokens.d.ts +28 -0
  180. package/views/dist/controls/toolbar/tokens.js +9 -0
  181. package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
  182. package/views/dist/controls/toolbar/toolbar.js +370 -0
  183. package/views/dist/controls/toolbar/words.d.ts +28 -0
  184. package/views/dist/controls/toolbar/words.js +17 -0
  185. package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
  186. package/views/dist/controls/toolbar-button/looks.js +21 -0
  187. package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
  188. package/views/dist/controls/toolbar-button/tokens.js +28 -0
  189. package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
  190. package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
  191. package/views/dist/controls/toolbar-button.css +75 -0
  192. package/views/dist/controls/toolbar.css +65 -0
  193. package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
  194. package/views/dist/controls/tooltip/map-tooltip.js +2 -2
  195. package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
  196. package/views/dist/controls/tooltip/tooltip.js +2 -2
  197. package/views/dist/controls/values-editor/looks.js +1 -1
  198. package/views/dist/controls/values-editor/values.js +6 -2
  199. package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
  200. package/views/dist/controls/views-list/map-views-list-body.js +128 -4
  201. package/views/dist/controls/views-list/rules.d.ts +26 -0
  202. package/views/dist/controls/views-list/rules.js +63 -0
  203. package/views/dist/controls/views-list/view-menu.d.ts +84 -0
  204. package/views/dist/controls/views-list/view-menu.js +201 -0
  205. package/views/dist/controls/views-list/views-list.d.ts +8 -1
  206. package/views/dist/controls/views-list/views-list.js +18 -3
  207. package/views/dist/controls/views-list/words.d.ts +54 -0
  208. package/views/dist/controls/views-list/words.js +10 -1
  209. package/views/dist/controls/views-list.css +5 -1
  210. package/views/dist/display/date.js +3 -3
  211. package/views/dist/display/format.d.ts +6 -0
  212. package/views/dist/display/format.js +3 -0
  213. package/views/dist/display/index.d.ts +1 -1
  214. package/views/dist/display/index.js +1 -1
  215. package/views/dist/display/options.d.ts +1 -1
  216. package/views/dist/display/range.d.ts +2 -1
  217. package/views/dist/display/range.js +4 -1
  218. package/views/dist/display/rich-text.js +0 -1
  219. package/views/dist/editors/ChipsEditor.d.ts +4 -5
  220. package/views/dist/editors/ChipsEditor.js +12 -78
  221. package/views/dist/editors/DateEditor.d.ts +12 -16
  222. package/views/dist/editors/DateEditor.js +40 -191
  223. package/views/dist/editors/EditorPanel.d.ts +2 -6
  224. package/views/dist/editors/EditorPanel.js +2 -2
  225. package/views/dist/editors/LocationEditor.d.ts +11 -19
  226. package/views/dist/editors/LocationEditor.js +19 -211
  227. package/views/dist/editors/NameEditor.d.ts +8 -16
  228. package/views/dist/editors/NameEditor.js +11 -100
  229. package/views/dist/editors/NumberEditor.d.ts +14 -21
  230. package/views/dist/editors/NumberEditor.js +22 -49
  231. package/views/dist/editors/RangeEditor.d.ts +9 -33
  232. package/views/dist/editors/RangeEditor.js +12 -97
  233. package/views/dist/editors/RelationEditor.d.ts +6 -9
  234. package/views/dist/editors/RelationEditor.js +11 -30
  235. package/views/dist/editors/RelationSetEditor.d.ts +13 -24
  236. package/views/dist/editors/RelationSetEditor.js +33 -101
  237. package/views/dist/editors/SelectEditor.d.ts +15 -17
  238. package/views/dist/editors/SelectEditor.js +15 -94
  239. package/views/dist/editors/TextEditor.d.ts +23 -26
  240. package/views/dist/editors/TextEditor.js +11 -48
  241. package/views/dist/editors/ValueListEditor.d.ts +14 -23
  242. package/views/dist/editors/ValueListEditor.js +16 -202
  243. package/views/dist/editors/body-panel.d.ts +13 -7
  244. package/views/dist/editors/body-panel.js +3 -7
  245. package/views/dist/editors/edit-cores.d.ts +15 -15
  246. package/views/dist/editors/edit-cores.js +14 -14
  247. package/views/dist/editors/number-body.d.ts +1 -1
  248. package/views/dist/editors/number-step.d.ts +0 -34
  249. package/views/dist/editors/number-step.js +0 -37
  250. package/views/dist/editors/option-add-flow.d.ts +1 -13
  251. package/views/dist/editors/option-add-flow.js +0 -22
  252. package/views/dist/editors/relation-links-body.d.ts +2 -3
  253. package/views/dist/editors/relation-picker.d.ts +13 -3
  254. package/views/dist/editors/relation-source.d.ts +0 -22
  255. package/views/dist/editors/relation-source.js +0 -21
  256. package/views/dist/field-row/FieldRow.js +5 -6
  257. package/views/dist/field-row/FieldRowLane.js +0 -1
  258. package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
  259. package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
  260. package/views/dist/field-row/editors/RowDateEditor.js +2 -2
  261. package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
  262. package/views/dist/field-row/editors/RowNameEditor.js +7 -12
  263. package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
  264. package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
  265. package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
  266. package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
  267. package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
  268. package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
  269. package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
  270. package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
  271. package/views/dist/field-row/editors/RowTextEditor.js +3 -4
  272. package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
  273. package/views/dist/field-row/field-row-button.d.ts +6 -9
  274. package/views/dist/field-row/field-row-button.js +1 -6
  275. package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
  276. package/views/dist/field-row/row-target.d.ts +0 -7
  277. package/views/dist/field-row/row-target.js +0 -2
  278. package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
  279. package/views/dist/grid/chrome/GridAddColumn.js +8 -66
  280. package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
  281. package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
  282. package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
  283. package/views/dist/grid/chrome/GridCellEditors.js +12 -12
  284. package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
  285. package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
  286. package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
  287. package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
  288. package/views/dist/grid/chrome/GridDateEditor.js +3 -3
  289. package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
  290. package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
  291. package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
  292. package/views/dist/grid/chrome/GridHeader.js +3 -2
  293. package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
  294. package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
  295. package/views/dist/grid/chrome/GridNameEditor.js +4 -4
  296. package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
  297. package/views/dist/grid/chrome/GridNumberEditor.js +5 -6
  298. package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
  299. package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
  300. package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
  301. package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
  302. package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
  303. package/views/dist/grid/chrome/GridRow.js +0 -3
  304. package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
  305. package/views/dist/grid/chrome/GridRowActions.js +0 -5
  306. package/views/dist/grid/chrome/GridRowCells.js +11 -7
  307. package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
  308. package/views/dist/grid/chrome/GridStructure.js +0 -1
  309. package/views/dist/grid/chrome/GridTable.js +1 -1
  310. package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
  311. package/views/dist/grid/chrome/GridTextEditor.js +5 -18
  312. package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
  313. package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
  314. package/views/dist/grid/chrome/grid-body-place.js +4 -8
  315. package/views/dist/grid/chrome/grid-button.d.ts +7 -10
  316. package/views/dist/grid/chrome/grid-button.js +1 -6
  317. package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
  318. package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
  319. package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
  320. package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
  321. package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
  322. package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
  323. package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
  324. package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
  325. package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
  326. package/views/dist/grid/chrome/grid-hover.js +0 -1
  327. package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
  328. package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
  329. package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
  330. package/views/dist/grid/chrome/grid-styles.js +0 -1
  331. package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
  332. package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
  333. package/views/dist/grid/core/clipboard-model.js +9 -4
  334. package/views/dist/grid/core/editing-controller.d.ts +2 -1
  335. package/views/dist/grid/core/editing-controller.js +10 -2
  336. package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
  337. package/views/dist/grid/core/refusal-sentence.js +2 -2
  338. package/views/dist/grid/core/write-states.d.ts +3 -1
  339. package/views/dist/grid/core/write-states.js +6 -2
  340. package/views/dist/grid/grid.css +240 -0
  341. package/views/dist/grid/looks.d.ts +5 -1
  342. package/views/dist/grid/looks.js +20 -12
  343. package/views/dist/grid-tokens.d.ts +109 -0
  344. package/views/dist/grid-tokens.js +29 -0
  345. package/views/dist/looks/index.d.ts +5 -0
  346. package/views/dist/looks/index.js +5 -0
  347. package/views/dist/looks/pieces.js +10 -0
  348. package/views/dist/model/body-frame.d.ts +0 -32
  349. package/views/dist/model/body-frame.js +1 -15
  350. package/views/dist/model/column-capabilities.d.ts +2 -0
  351. package/views/dist/model/column-filters.d.ts +2 -1
  352. package/views/dist/model/column-from.js +2 -2
  353. package/views/dist/model/column-inspect.d.ts +5 -5
  354. package/views/dist/model/column-inspect.js +2 -2
  355. package/views/dist/model/relation-filters.d.ts +2 -0
  356. package/views/dist/panels/customize-body.d.ts +1 -10
  357. package/views/dist/panels/customize-body.js +0 -3
  358. package/views/dist/panels/filter/MenuSelect.js +0 -5
  359. package/views/dist/panels/filter/RangeFilterBody.js +0 -1
  360. package/views/dist/panels/filter/details.d.ts +1 -5
  361. package/views/dist/panels/filter/details.js +0 -13
  362. package/views/dist/panels/filter/filter-list.d.ts +0 -1
  363. package/views/dist/panels/filter/filter-list.js +1 -1
  364. package/views/dist/panels/index.d.ts +2 -2
  365. package/views/dist/panels/index.js +2 -2
  366. package/views/dist/panels/labels.d.ts +4 -0
  367. package/views/dist/panels/labels.js +8 -0
  368. package/views/dist/panels/model.d.ts +10 -2
  369. package/views/dist/panels/panel-button.d.ts +10 -12
  370. package/views/dist/panels/panel-button.js +1 -6
  371. package/views/dist/panels/quick/model.d.ts +4 -0
  372. package/views/dist/panels/react/chrome.d.ts +0 -17
  373. package/views/dist/panels/react/chrome.js +0 -8
  374. package/views/dist/panels/react/customize-body.d.ts +14 -12
  375. package/views/dist/panels/react/customize-body.js +93 -19
  376. package/views/dist/panels/react/customize.d.ts +16 -12
  377. package/views/dist/panels/react/customize.js +4 -110
  378. package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
  379. package/views/dist/panels/react/filter/FilterEditor.js +6 -330
  380. package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
  381. package/views/dist/panels/react/filter/FilterFieldList.js +27 -51
  382. package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
  383. package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
  384. package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
  385. package/views/dist/panels/react/filter/editor-ctx.js +5 -33
  386. package/views/dist/panels/react/filter/filter-body.js +5 -2
  387. package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
  388. package/views/dist/panels/react/filter/filter-part-body.js +0 -5
  389. package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
  390. package/views/dist/panels/react/filter/rule-writes.js +4 -95
  391. package/views/dist/panels/react/order-details.d.ts +1 -26
  392. package/views/dist/panels/react/order-details.js +3 -69
  393. package/views/dist/panels/react/panel-header.js +0 -1
  394. package/views/dist/panels/react/panel-step.d.ts +3 -0
  395. package/views/dist/panels/react/panel-step.js +2 -1
  396. package/views/dist/panels/react/popover.d.ts +4 -7
  397. package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
  398. package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -136
  399. package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
  400. package/views/dist/panels/react/sort/SortEditor.js +8 -245
  401. package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
  402. package/views/dist/panels/react/sort/SortFieldList.js +11 -25
  403. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
  404. package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
  405. package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
  406. package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
  407. package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
  408. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +16 -18
  409. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
  410. package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
  411. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
  412. package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
  413. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  414. package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
  415. package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
  416. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
  417. package/views/dist/panels/react/view-actions.js +0 -1
  418. package/views/dist/panels/react/views-row/FoldingViewRow.js +2 -5
  419. package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
  420. package/views/dist/panels/react/views-row/ViewPicker.js +30 -45
  421. package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
  422. package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
  423. package/views/dist/panels/react/views-row/menu-classes.js +0 -2
  424. package/views/dist/panels/react.d.ts +5 -12
  425. package/views/dist/panels/react.js +5 -12
  426. package/views/dist/panels/settings/filter-groups.d.ts +3 -0
  427. package/views/dist/panels/settings/filter-groups.js +40 -9
  428. package/views/dist/panels/settings/filters.d.ts +5 -0
  429. package/views/dist/panels/settings/filters.js +12 -6
  430. package/views/dist/panels/views-row/model.d.ts +10 -1
  431. package/views/dist/provider/ViewsProvider.d.ts +2 -46
  432. package/views/dist/provider/ViewsProvider.js +31 -27
  433. package/views/dist/provider/components.d.ts +295 -107
  434. package/views/dist/provider/context.d.ts +7 -21
  435. package/views/dist/provider/missing-slot.d.ts +3 -7
  436. package/views/dist/provider/missing-slot.js +2 -9
  437. package/views/dist/provider/ports.d.ts +18 -6
  438. package/views/dist/provider/ports.js +2 -1
  439. package/views/dist/react.d.ts +2 -3
  440. package/views/dist/react.js +1 -1
  441. package/views/dist/selection/SelectionBar.d.ts +2 -16
  442. package/views/dist/selection/SelectionBar.js +6 -4
  443. package/views/dist/selection/bar-props.d.ts +26 -0
  444. package/views/dist/selection/bar-props.js +1 -0
  445. package/views/dist/selection/index.d.ts +1 -1
  446. package/views/dist/selection/verbs.d.ts +32 -5
  447. package/views/dist/styles.css +694 -191
  448. package/views/dist/styles.unlayered.css +691 -188
  449. package/views/docs/contract.md +133 -130
  450. package/views/docs/controls/bulk-bar.md +41 -0
  451. package/views/docs/controls/choice.md +25 -0
  452. package/views/docs/controls/customize.md +17 -0
  453. package/views/docs/controls/popover.md +2 -0
  454. package/views/docs/controls/press.md +9 -0
  455. package/views/docs/controls/quick-filters.md +35 -0
  456. package/views/docs/controls/radio.md +1 -1
  457. package/views/docs/controls/switch-row.md +18 -0
  458. package/views/docs/controls/tag-field.md +7 -0
  459. package/views/docs/controls/toolbar-button.md +31 -0
  460. package/views/docs/controls/toolbar.md +14 -0
  461. package/views/docs/getting-started.md +222 -2
  462. package/views/docs/guides/atoms.md +2 -2
  463. package/views/docs/guides/cells.md +224 -4
  464. package/views/docs/guides/display.md +3 -3
  465. package/views/docs/guides/editors.md +235 -20
  466. package/views/docs/guides/looks.md +8 -2
  467. package/views/docs/guides/ports.md +7 -7
  468. package/views/docs/guides/selection.md +5 -1
  469. package/views/docs/guides/the-grid.md +15 -17
  470. package/views/docs/guides/the-provider.md +9 -15
  471. package/views/docs/install.md +4 -1
  472. package/views/docs/reference/cells.md +2 -2
  473. package/views/docs/reference/controls.md +215 -21
  474. package/views/docs/reference/display.md +1 -0
  475. package/views/docs/reference/editors-chips.md +2 -2
  476. package/views/docs/reference/editors-date.md +4 -4
  477. package/views/docs/reference/editors-location.md +4 -7
  478. package/views/docs/reference/editors-name.md +3 -5
  479. package/views/docs/reference/editors-number.md +10 -10
  480. package/views/docs/reference/editors-panel.md +3 -3
  481. package/views/docs/reference/editors-range.md +3 -5
  482. package/views/docs/reference/editors-relation.md +4 -4
  483. package/views/docs/reference/editors-select.md +3 -3
  484. package/views/docs/reference/editors-text.md +3 -4
  485. package/views/docs/reference/editors-value-list.md +3 -3
  486. package/views/docs/reference/field-row.md +1 -1
  487. package/views/docs/reference/grid.md +2 -2
  488. package/views/docs/reference/looks.md +25 -11
  489. package/views/docs/reference/panels-react.md +23 -37
  490. package/views/docs/reference/panels.md +8 -6
  491. package/views/docs/reference/react.md +24 -24
  492. package/views/docs/reference/selection.md +4 -2
  493. package/views/docs/reference/views.md +12 -11
  494. package/views/skills/views/SKILL.md +2 -2
  495. package/views/dist/editors/relation-panel.d.ts +0 -69
  496. package/views/dist/editors/relation-panel.js +0 -46
  497. package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
  498. package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
  499. package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
  500. package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
  501. package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
  502. package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
  503. package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
  504. package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
  505. package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
  506. package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
  507. package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
  508. package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
  509. package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
  510. package/views/dist/grid/chrome/GridFlyout.js +0 -80
  511. package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
  512. package/views/dist/grid/chrome/GridMenuRow.js +0 -15
  513. package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
  514. package/views/dist/grid/chrome/grid-menu-search.js +0 -7
  515. package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
  516. package/views/dist/panels/react/GroupBucketsList.js +0 -44
  517. package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
  518. package/views/dist/panels/react/LayoutColumnsList.js +0 -101
  519. package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
  520. package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
  521. package/views/dist/panels/react/drag.d.ts +0 -2
  522. package/views/dist/panels/react/drag.js +0 -5
  523. package/views/dist/panels/react/layout-detail.d.ts +0 -4
  524. package/views/dist/panels/react/layout-detail.js +0 -29
  525. package/views/dist/panels/react/root-list.d.ts +0 -6
  526. package/views/dist/panels/react/root-list.js +0 -31
  527. package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
  528. package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
  529. package/views/dist/panels/react/view-footer.d.ts +0 -20
  530. package/views/dist/panels/react/view-footer.js +0 -41
@@ -1,11 +1,19 @@
1
1
  "use client";
2
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { resolveViewsMessage } from "../../contract.js";
5
5
  import { ViewsContext } from "../../provider/context.js";
6
+ import { HeaderBar } from "../phone-header/header-bar.js";
7
+ import { useToldStep } from "../internal/told-step.js";
8
+ import { useViewMenu } from "./view-menu.js";
9
+ import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
10
+ import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-list/menu-list.js";
6
11
  import { menuEntries } from "../menu/map-menu.js";
7
- import { pickerWordsOf } from "../picker/map-picker.js";
12
+ import { menuWordsOf, pickerWordsOf } from "../picker/map-picker.js";
8
13
  import { useViewsList } from "./views-list.js";
14
+ import { SheetButton } from "../sheet/bottom-sheet.js";
15
+ import { SheetPartsFrom } from "../sheet/sheet-parts.js";
16
+ import { Icon } from "../internal/icons.js";
9
17
  export function viewsListWordsOf(say, createLabel) {
10
18
  return {
11
19
  label: say({ key: "views.panels.views-list" }),
@@ -16,6 +24,7 @@ export function viewsListWordsOf(say, createLabel) {
16
24
  justMe: say({ key: "views.panels.views-personal" }),
17
25
  none: say({ key: "views.panels.views-none" }),
18
26
  picker: pickerWordsOf(say),
27
+ menu: menuWordsOf(say),
19
28
  };
20
29
  }
21
30
  export function orderToWrite(views, order, canDrag) {
@@ -57,9 +66,124 @@ export function viewsListPropsOf(p, words, notNow, AppIcon) {
57
66
  words,
58
67
  };
59
68
  }
69
+ export function viewMenuWordsOf(say) {
70
+ return {
71
+ rename: say({ key: "views.panels.view-rename" }),
72
+ renameShort: say({ key: "views.panels.view-rename-short" }),
73
+ edit: say({ key: "views.panels.view-edit" }),
74
+ privateView: say({ key: "views.panels.view-private-toggle" }),
75
+ saveEveryone: say({ key: "views.panels.view-save-everyone" }),
76
+ reset: say({ key: "views.panels.view-reset" }),
77
+ saveNew: say({ key: "views.panels.view-save-new" }),
78
+ copyLink: say({ key: "views.panels.copy-link" }),
79
+ copyLinkShort: say({ key: "views.panels.view-copy-link-short" }),
80
+ favorite: say({ key: "views.panels.view-favorite" }),
81
+ unfavorite: say({ key: "views.panels.view-unfavorite" }),
82
+ duplicate: say({ key: "views.panels.view-duplicate" }),
83
+ duplicateShort: say({ key: "views.panels.view-duplicate-short" }),
84
+ delete: say({ key: "views.panels.view-delete" }),
85
+ keepOne: say({ key: "views.panels.view-keep-one" }),
86
+ unsaved: say({ key: "views.panels.view-unsaved" }),
87
+ thisView: say({ key: "views.panels.view-this" }),
88
+ renameTitle: say({ key: "views.panels.view-rename-title" }),
89
+ save: say({ key: "views.panels.view-save" }),
90
+ newView: say({ key: "views.panels.view-create" }),
91
+ createView: say({ key: "views.panels.view-create-action" }),
92
+ layout: say({ key: "views.panels.layout" }),
93
+ name: say({ key: "views.panels.view-name" }),
94
+ cancel: say({ key: "views.picker.cancel" }),
95
+ close: say({ key: "views.panels.close" }),
96
+ failed: say({ key: "views.panels.alert-failed" }),
97
+ tryAgain: say({ key: "views.picker.retry" }),
98
+ deleteTitle: (name) => say({ key: "views.panels.view-delete-title", values: { name } }),
99
+ deleted: (name) => say({ key: "views.panels.view-deleted", values: { name } }),
100
+ copyOf: (name) => say({ key: "views.panels.view-copy-name", values: { name } }),
101
+ stay: (records) => say({ key: "views.panels.view-delete-stays", values: { records } }),
102
+ goes: say({ key: "views.panels.view-delete-goes" }),
103
+ columns: (layout) => say({ key: "views.panels.view-columns", values: { layout } }),
104
+ };
105
+ }
60
106
  export function MapViewsListBody(props) {
107
+ return props.verbs ? _jsx(WithVerbs, { ...props, verbs: props.verbs }) : _jsx(Plain, { ...props });
108
+ }
109
+ const _menuChangeIsTheSlots = true;
110
+ const _menuAskIsTheConfirmPort = true;
111
+ void _menuChangeIsTheSlots;
112
+ void _menuAskIsTheConfirmPort;
113
+ function useStepHead(step, props) {
114
+ useToldStep({ head: { ...(step ? { onBack: step.onBack } : {}) }, ...(step ? { title: step.title } : {}) }, props.onStepChange);
115
+ const setParts = React.useContext(SheetPartsFrom);
116
+ React.useLayoutEffect(() => { setParts?.(step ? { title: step.title, head: { onBack: step.onBack } } : null); });
117
+ React.useLayoutEffect(() => () => setParts?.(null), [setParts]);
118
+ return step && props.actions?.back && !setParts ? (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: step.title }), right: _jsx("span", {}), left: _jsx(SheetButton, { "aria-label": props.actions.back.label, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: props.actions.back.onPress }) }) })) : null;
119
+ }
120
+ function Plain(props) {
61
121
  const context = React.useContext(ViewsContext);
62
122
  const say = context?.messages ?? resolveViewsMessage;
63
- const words = React.useMemo(() => viewsListWordsOf(say, props.createLabel), [say, props.createLabel]);
64
- return _jsx(_Fragment, { children: useViewsList(viewsListPropsOf(props, words, say({ key: "views.menus.not-now" }), context?.components.AppIcon)).body });
123
+ const words = React.useMemo(() => ({ ...viewsListWordsOf(say, props.createLabel), back: say({ key: "views.panels.back" }) }), [say, props.createLabel]);
124
+ const base = viewsListPropsOf(props, words, say({ key: "views.menus.not-now" }), context?.components.AppIcon);
125
+ const [menuFor, setMenuFor] = React.useState(null);
126
+ const [mark, setMark] = React.useState(null);
127
+ const closeShown = useMenuListOption(mark, "close"), rowsAre = useMenuListRows(mark), closeRow = closeShown === "shown" && rowsAre !== "words";
128
+ const shown = props.form === "phone" ? props.views.find((v) => v.value === menuFor) : undefined;
129
+ const step = shown ? {
130
+ title: shown.label, onBack: () => setMenuFor(null),
131
+ body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: shown.label, ...tilesOf(leavingFirst(base.entries(shown.value), () => setMenuFor(null))), ...(closeRow ? { onClose: () => setMenuFor(null) } : {}), closeWord: words.menu?.close ?? say({ key: "views.panels.close" }) }) }),
132
+ } : null;
133
+ const list = useViewsList({ ...base, onMenu: setMenuFor, step });
134
+ const head = useStepHead(step, props);
135
+ return _jsxs(_Fragment, { children: [_jsx("span", { ref: setMark, hidden: true }), head, list.body] });
136
+ }
137
+ function leavingFirst(list, leave) {
138
+ return list.map((e) => e.kind === undefined || e.kind === "action" ? { ...e, onSelect: () => { leave(); e.onSelect?.(); } } : e.kind === "group" ? { ...e, entries: leavingFirst(e.entries, leave) } : e);
139
+ }
140
+ function WithVerbs(props) {
141
+ const { verbs } = props;
142
+ const context = React.useContext(ViewsContext);
143
+ const say = context?.messages ?? resolveViewsMessage;
144
+ const AppIcon = context?.components.AppIcon;
145
+ const words = React.useMemo(() => ({ ...viewsListWordsOf(say, props.createLabel), back: say({ key: "views.panels.back" }) }), [say, props.createLabel]);
146
+ const menuWords = React.useMemo(() => viewMenuWordsOf(say), [say]);
147
+ const base = viewsListPropsOf(props, words, say({ key: "views.menus.not-now" }), AppIcon);
148
+ const layouts = [
149
+ ...verbs.layouts.map((l) => ({ id: l.id, name: l.name, line: l.line, ...(l.columns ? { columns: true } : {}), mark: AppIcon ? _jsx(AppIcon, { name: l.icon }) : null })),
150
+ ...base.layouts.filter((l) => !verbs.layouts.some((v) => v.id === l.id)),
151
+ ];
152
+ const views = props.views.map((v) => ({
153
+ id: v.value, name: v.label, layout: v.layout ?? v.icon ?? "",
154
+ ...(v.private ? { private: true } : {}), ...(v.favorite ? { favorite: true } : {}), ...(v.changed ? { changed: true } : {}),
155
+ ...(typeof v.count === "number" ? { count: v.count } : {}),
156
+ }));
157
+ const ports = context?.ports;
158
+ const computer = props.form === "computer";
159
+ const menu = useViewMenu({
160
+ views, open: props.value, layouts,
161
+ ...(verbs.columns ? { columns: { fields: verbs.columns.fields.map((f) => ({ value: f.value, label: f.label })), value: verbs.columns.value } } : {}),
162
+ records: verbs.records,
163
+ onChange: (c) => {
164
+ if (c.kind === "open")
165
+ props.onViewChange(c.id);
166
+ else if (c.kind === "order") {
167
+ const block = orderToWrite(props.views, c.ids, props.canDrag);
168
+ if (block)
169
+ props.onReorder?.(block);
170
+ }
171
+ else
172
+ verbs.onChange(c);
173
+ },
174
+ onDone: props.onDone, form: props.form, steps: true, words: menuWords,
175
+ ...(computer && ports && !context.confirmFallback ? { ask: async (request) => {
176
+ props.onHold?.(true);
177
+ try {
178
+ return await ports.confirm(request);
179
+ }
180
+ finally {
181
+ requestAnimationFrame(() => props.onHold?.(false));
182
+ }
183
+ } } : {}),
184
+ ...(ports && !context.toastFallback ? { report: (message, options) => ports.toast.success(message, options) } : {}),
185
+ });
186
+ const list = useViewsList({ ...base, layouts, views, entries: menu.entries, ...(props.onCreate ? { onNew: () => menu.startNew() } : {}), onMenu: menu.openMenu, step: menu.step });
187
+ const head = useStepHead(menu.step, props);
188
+ return _jsxs(_Fragment, { children: [head, list.body, menu.dialogs] });
65
189
  }
@@ -70,3 +70,29 @@ export type ViewsListChange = {
70
70
  export declare const SHARED = "Shared", JUST_ME = "Just me";
71
71
  /** The views as the list shows them: as they are; with private views on, the shared ones, then the private ones, each in its order. */
72
72
  export declare function listed(views: ListView[], privateViews: boolean): ListView[];
73
+ /** The views and the one open. */
74
+ export interface ViewsState {
75
+ views: ListView[];
76
+ open: string;
77
+ }
78
+ /** A copy's name: "Copy of <name>", then "Copy of <name> 2", 3… while the name is taken. `copyOf`: the words, given the name. */
79
+ export declare function copyName(name: string, names: string[], copyOf?: (name: string) => string): string;
80
+ /** Whether a view can be deleted: a list keeps one view. */
81
+ export declare const canDelete: (views: ListView[]) => boolean;
82
+ /** The delete question's line's words: the records staying, given their noun, and the view going for everyone. */
83
+ export type DeleteLineWords = {
84
+ stay: (records: string) => string;
85
+ goes: string;
86
+ };
87
+ /** The delete question's line: the view goes for everyone who uses it (a private view only for its maker), and the records stay. */
88
+ export declare function deleteLine(view: ListView, records: string, words?: DeleteLineWords): string;
89
+ /** The label of the field a layout's columns follow, after the layout's name ("Board columns"). */
90
+ export declare const columnsLabel: (layoutName: string, words?: (layoutName: string) => string) => string;
91
+ /** The views and the open one after a change. `newId` names the view a change makes (create, duplicate): with none, they make
92
+ * nothing. `privateViews` says how the list stands its views, for the first listed. `copyOf`: a duplicate's name's words. What
93
+ * changes nothing hands back the same state. */
94
+ export declare function viewsAfter(state: ViewsState, change: ViewsListChange, o?: {
95
+ newId?: string;
96
+ privateViews?: boolean;
97
+ copyOf?: (name: string) => string;
98
+ }): ViewsState;
@@ -2,3 +2,66 @@ export const SHARED = "Shared", JUST_ME = "Just me";
2
2
  export function listed(views, privateViews) {
3
3
  return privateViews ? [...views.filter((v) => !v.private), ...views.filter((v) => v.private)] : views;
4
4
  }
5
+ export function copyName(name, names, copyOf = (n) => `Copy of ${n}`) {
6
+ const base = copyOf(name), taken = new Set(names);
7
+ if (!taken.has(base))
8
+ return base;
9
+ let n = 2;
10
+ while (taken.has(`${base} ${n}`))
11
+ n++;
12
+ return `${base} ${n}`;
13
+ }
14
+ export const canDelete = (views) => views.length > 1;
15
+ const DELETE_LINE = { stay: (records) => `The ${records} in it stay as they are.`, goes: "The view goes for everyone who uses it." };
16
+ export function deleteLine(view, records, words = DELETE_LINE) {
17
+ const stay = words.stay(records);
18
+ return view.private ? stay : `${words.goes} ${stay}`;
19
+ }
20
+ export const columnsLabel = (layoutName, words = (l) => `${l} columns`) => words(layoutName);
21
+ const set = (views, id, change) => views.map((v) => (v.id === id ? { ...v, ...change } : v));
22
+ const has = (views, id) => views.some((v) => v.id === id);
23
+ export function viewsAfter(state, change, o = {}) {
24
+ const { views, open } = state;
25
+ switch (change.kind) {
26
+ case "open": return has(views, change.id) ? { views, open: change.id } : state;
27
+ case "order": {
28
+ const by = new Map(views.map((v) => [v.id, v])), first = change.ids.flatMap((id) => (by.has(id) ? [by.get(id)] : []));
29
+ return { views: [...first, ...views.filter((v) => !change.ids.includes(v.id))], open };
30
+ }
31
+ case "rename": {
32
+ const name = change.name.trim();
33
+ return name && has(views, change.id) ? { views: set(views, change.id, { name }), open } : state;
34
+ }
35
+ case "create": {
36
+ const name = change.name.trim();
37
+ if (!o.newId || !name)
38
+ return state;
39
+ const from = change.from && has(views, change.from) ? set(views, change.from, { changed: false }) : views;
40
+ return { views: [...from, { id: o.newId, name, layout: change.layout }], open: o.newId };
41
+ }
42
+ case "duplicate": {
43
+ const at = views.findIndex((v) => v.id === change.id);
44
+ if (!o.newId || at < 0)
45
+ return state;
46
+ const copy = { ...views[at], id: o.newId, name: copyName(views[at].name, views.map((v) => v.name), o.copyOf), changed: false, favorite: false };
47
+ return { views: [...views.slice(0, at + 1), copy, ...views.slice(at + 1)], open: o.newId };
48
+ }
49
+ case "delete": {
50
+ if (!canDelete(views) || !has(views, change.id))
51
+ return state;
52
+ const rest = views.filter((v) => v.id !== change.id);
53
+ return { views: rest, open: open === change.id ? listed(rest, !!o.privateViews)[0].id : open };
54
+ }
55
+ case "restore": {
56
+ if (has(views, change.view.id))
57
+ return state;
58
+ const at = Math.max(0, Math.min(change.at, views.length));
59
+ return { views: [...views.slice(0, at), change.view, ...views.slice(at)], open: change.open ? change.view.id : open };
60
+ }
61
+ case "save":
62
+ case "reset": return has(views, change.id) ? { views: set(views, change.id, { changed: false }), open } : state;
63
+ case "favorite": return has(views, change.id) ? { views: set(views, change.id, { favorite: change.on }), open } : state;
64
+ case "private": return has(views, change.id) ? { views: set(views, change.id, { private: change.on }), open } : state;
65
+ default: return state;
66
+ }
67
+ }
@@ -0,0 +1,84 @@
1
+ import * as React from "react";
2
+ import { type MenuEntry } from "../menu-list/menu-list.js";
3
+ import { type PickerItem } from "../picker/picker.js";
4
+ import { type ListView, type ViewsListChange, type ViewsListLayout } from "./rules.js";
5
+ import { LOCK, useViewsListWorn } from "./views-list.js";
6
+ import { type ViewMenuWords } from "./words.js";
7
+ /** The delete question as the menu asks it of its holder (an app's `confirm` port takes the same shape: the map checks it). */
8
+ export type ViewMenuAsk = {
9
+ message: string;
10
+ confirmLabel: string;
11
+ subject?: string;
12
+ detail?: string;
13
+ destructive?: boolean;
14
+ };
15
+ /** What a page shows standing open: Rename, New view, or the delete question. */
16
+ export type ViewMenuShows = {
17
+ what: "rename";
18
+ id: string;
19
+ } | {
20
+ what: "new";
21
+ layout?: string;
22
+ name?: string;
23
+ from?: string;
24
+ } | {
25
+ what: "delete";
26
+ id: string;
27
+ };
28
+ export interface ViewMenuProps {
29
+ views: ListView[];
30
+ open: string;
31
+ layouts: ViewsListLayout[];
32
+ /** The fields a board's columns can follow, and the one filled in. */
33
+ columns?: {
34
+ fields: PickerItem[];
35
+ value: string;
36
+ };
37
+ /** What the list holds, in the delete question's line ("deals"). */
38
+ records: string;
39
+ onChange: (change: ViewsListChange) => void;
40
+ /** A change opened a view, ended in the Toast, or asked for Customize (Edit view…): what holds the list closes it. */
41
+ onDone?: () => void;
42
+ /** Which form; by default the phone's in a phone's window or in a PhoneHost screen, else the computer's. */
43
+ form?: "computer" | "phone";
44
+ /** For a page that shows one standing: a Modal or the question standing open, where, and standing. */
45
+ shows?: ViewMenuShows;
46
+ container?: HTMLElement | null;
47
+ standing?: boolean;
48
+ /** Its words, over the English. */
49
+ words?: Partial<ViewMenuWords>;
50
+ /** On a computer, asks the delete question here (an app's `confirm` port) in place of drawing its own alert dialog. */
51
+ ask?: (request: ViewMenuAsk) => Promise<boolean>;
52
+ /** Says a view was deleted here (an app's `toast` port's `success`) in place of `useToast()`. */
53
+ report?: (message: string, options: {
54
+ undo: () => void;
55
+ }) => void;
56
+ /** On a phone, its caller draws `step` in its one Sheet: the menu, Rename, New view and the delete question become steps. Left
57
+ * out, a phone's Rename, New view and delete question open as today (the kit's sheets), and `step` stays null.
58
+ * CONTROLS.ViewsListBody hands it. */
59
+ steps?: boolean;
60
+ }
61
+ /** On a phone, what stands in the list's one Sheet in place of the list: the view's menu, Rename, New view, or the delete
62
+ * question. Back goes one step back. */
63
+ export type ViewMenuStep = {
64
+ title: string;
65
+ body: React.ReactNode;
66
+ onBack: () => void;
67
+ };
68
+ export interface ViewMenuParts {
69
+ /** A view's menu, as the Picker's row hands it (`PickerItem.menu`) or a Menu opens it. */
70
+ entries: (id: string) => MenuEntry[];
71
+ /** New view's Modal, opened; Save as new view… opens it from a view, that view's layout picked. */
72
+ startNew: (from?: string) => void;
73
+ /** The Modals and the question: what the holder renders beside the list. */
74
+ dialogs: React.ReactNode;
75
+ /** One of them stands open. */
76
+ asking: boolean;
77
+ /** On a phone with `steps`: opens a view's menu as a step (a row's ⋯). */
78
+ openMenu: (id: string) => void;
79
+ /** On a phone with `steps`: the step standing, or null while the list stands. Always null on a computer and without `steps`. */
80
+ step: ViewMenuStep | null;
81
+ }
82
+ export { LOCK, useViewsListWorn };
83
+ /** A view's menu's state, its entries, and what it opens. */
84
+ export declare function useViewMenu(props: ViewMenuProps): ViewMenuParts;
@@ -0,0 +1,201 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Alert } from "../alert/alert.js";
4
+ import { AlertDialog } from "../alert-dialog/alert-dialog.js";
5
+ import { Button } from "../button/button.js";
6
+ import { Field } from "../field/field.js";
7
+ import { Input } from "../input/input.js";
8
+ import { asSelect, OnTop } from "../internal/editor-parts.js";
9
+ import { Icon } from "../internal/icons.js";
10
+ import { PhoneHost, usePhone } from "../internal/phone.js";
11
+ import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
12
+ import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-list/menu-list.js";
13
+ import { Modal } from "../modal/modal.js";
14
+ import { Picker } from "../picker/picker.js";
15
+ import { Radio, RadioGroup } from "../radio/radio.js";
16
+ import { Select } from "../select/select.js";
17
+ import { useInToast, useToast } from "../toast/toast.js";
18
+ import { canDelete, deleteLine } from "./rules.js";
19
+ import { LOCK, useViewsListWorn } from "./views-list.js";
20
+ import { VIEW_MENU_WORDS } from "./words.js";
21
+ export { LOCK, useViewsListWorn };
22
+ function ToastBridge({ onSend }) {
23
+ const toast = useToast();
24
+ React.useEffect(() => {
25
+ onSend(toast);
26
+ return () => onSend(null);
27
+ }, [toast, onSend]);
28
+ return null;
29
+ }
30
+ export function useViewMenu(props) {
31
+ const { views, open, layouts, columns, records, onChange, onDone, ask: askPort, report } = props;
32
+ const w = React.useMemo(() => ({ ...VIEW_MENU_WORDS, ...props.words }), [props.words]);
33
+ const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
34
+ const stepping = phone && !!props.steps;
35
+ const [mark, setMark] = React.useState(null), worn = useViewsListWorn(mark);
36
+ const closeShown = useMenuListOption(mark, "close"), rowsAre = useMenuListRows(mark), closeRow = closeShown === "shown" && rowsAre !== "words";
37
+ const inToast = useInToast(), send = React.useRef(null);
38
+ const onSend = React.useCallback((s) => { send.current = s; }, []);
39
+ const now = React.useRef({ views, open });
40
+ React.useLayoutEffect(() => { now.current = { views, open }; });
41
+ const viewOf = (id) => views.find((v) => v.id === id);
42
+ const [asked, setAsked] = React.useState(props.shows ?? null), [shown, setShown] = React.useState(!!props.shows);
43
+ const ask = (a) => { setAsked(a); setShown(true); };
44
+ const close = () => setShown(false);
45
+ const toList = () => { setAsked(null); setShown(false); };
46
+ const [name, setName] = React.useState(() => (props.shows?.what === "rename" ? viewOf(props.shows.id)?.name ?? "" : props.shows?.what === "new" ? props.shows.name ?? "" : ""));
47
+ const [layout, setLayout] = React.useState(() => (props.shows?.what === "new" ? props.shows.layout ?? layouts[0]?.id : layouts[0]?.id) ?? "");
48
+ const [column, setColumn] = React.useState(columns?.value ?? "");
49
+ const [picking, setPicking] = React.useState(null);
50
+ const [making, setMaking] = React.useState(null);
51
+ const rename = (id) => { setName(viewOf(id)?.name ?? ""); ask({ what: "rename", id }); };
52
+ const startNew = (from) => {
53
+ setName("");
54
+ setLayout((from && viewOf(from)?.layout) || layouts[0]?.id || "");
55
+ setColumn(columns?.value ?? "");
56
+ setMaking({ from });
57
+ ask({ what: "new", from });
58
+ };
59
+ const box = React.useRef(null);
60
+ const naming = shown && !props.standing && (asked?.what === "rename" || asked?.what === "new") ? asked.what : null;
61
+ React.useEffect(() => {
62
+ if (!naming)
63
+ return;
64
+ const frame = requestAnimationFrame(() => { const el = box.current; if (el) {
65
+ el.focus({ preventScroll: true });
66
+ if (naming === "rename")
67
+ el.select();
68
+ } });
69
+ return () => cancelAnimationFrame(frame);
70
+ }, [naming]);
71
+ const saveName = () => {
72
+ if (asked?.what !== "rename")
73
+ return;
74
+ const typed = name.trim(), was = viewOf(asked.id)?.name;
75
+ if (typed && typed !== was)
76
+ onChange({ kind: "rename", id: asked.id, name: typed });
77
+ };
78
+ const chosen = layouts.find((l) => l.id === layout);
79
+ const create = () => {
80
+ if (asked?.what !== "new" || !name.trim())
81
+ return;
82
+ onChange({ kind: "create", layout, name: name.trim(), ...(chosen?.columns && column ? { columns: column } : {}), ...(asked.from ? { from: asked.from } : {}) });
83
+ onDone?.();
84
+ };
85
+ const enter = (run) => (e) => {
86
+ if (e.key !== "Enter" || !name.trim())
87
+ return;
88
+ e.preventDefault();
89
+ run();
90
+ if (stepping)
91
+ toList();
92
+ else
93
+ close();
94
+ };
95
+ const say = (message, undo) => {
96
+ if (report)
97
+ report(message, { undo });
98
+ else
99
+ send.current?.({ words: message, undo });
100
+ };
101
+ const remove = (id) => {
102
+ const at = now.current.views.findIndex((v) => v.id === id), view = now.current.views[at];
103
+ if (!view)
104
+ return;
105
+ const wasOpen = now.current.open === id;
106
+ onChange({ kind: "delete", id });
107
+ onDone?.();
108
+ say(w.deleted(view.name), () => onChange({ kind: "restore", view, at, open: wasOpen }));
109
+ };
110
+ const lineOf = (v) => deleteLine(worn.privateViews ? v : { ...v, private: false }, records, { stay: w.stay, goes: w.goes });
111
+ const askDelete = (id) => {
112
+ const v = viewOf(id);
113
+ if (!stepping && askPort && v) {
114
+ void Promise.resolve(askPort({ message: w.deleteTitle(v.name), detail: lineOf(v), confirmLabel: w.delete, subject: v.name, destructive: true }))
115
+ .then((yes) => { if (yes)
116
+ remove(id); }, () => { });
117
+ return;
118
+ }
119
+ ask({ what: "delete", id });
120
+ };
121
+ const entries = (id) => {
122
+ const v = viewOf(id);
123
+ if (!v)
124
+ return [];
125
+ const icon = (n) => _jsx(Icon, { name: n });
126
+ const changed = v.changed ? [
127
+ { icon: icon("check"), label: w.saveEveryone, onSelect: () => onChange({ kind: "save", id }) },
128
+ { icon: icon("undo"), label: w.reset, onSelect: () => onChange({ kind: "reset", id }) },
129
+ { icon: icon("plus"), label: w.saveNew, onSelect: () => startNew(id) },
130
+ ] : [];
131
+ const favorite = worn.favorites ? [{ icon: icon(v.favorite ? "star-filled" : "star"), label: v.favorite ? w.unfavorite : w.favorite, onSelect: () => onChange({ kind: "favorite", id, on: !v.favorite }) }] : [];
132
+ const privately = worn.privateViews ? [{ kind: "check", label: w.privateView, ...(phone ? { icon: LOCK } : {}), checked: !!v.private, onCheckedChange: (on) => onChange({ kind: "private", id, on }) }] : [];
133
+ const edit = { icon: icon("settings"), label: w.edit, onSelect: () => { onChange({ kind: "edit", id }); onDone?.(); } };
134
+ const link = { icon: icon("link"), label: phone ? w.copyLinkShort : w.copyLink, onSelect: () => onChange({ kind: "link", id }) };
135
+ const duplicate = { icon: icon("copy"), label: phone ? w.duplicateShort : w.duplicate, onSelect: () => { onChange({ kind: "duplicate", id }); onDone?.(); } };
136
+ const del = { icon: icon("trash"), label: w.delete, danger: true, ...(canDelete(views) ? {} : { disabled: w.keepOne }), onSelect: () => askDelete(id) };
137
+ if (phone)
138
+ return [
139
+ link, ...favorite, { icon: icon("rename"), label: w.renameShort, onSelect: () => rename(id) }, duplicate,
140
+ ...(changed.length ? [{ kind: "group", heading: w.unsaved, entries: changed }] : []),
141
+ { kind: "group", heading: w.thisView, entries: [...privately, edit] },
142
+ { kind: "separator" }, del,
143
+ ];
144
+ return [
145
+ { icon: icon("rename"), label: w.rename, onSelect: () => rename(id) }, edit, ...privately,
146
+ { kind: "separator" }, ...(changed.length ? [...changed, { kind: "separator" }] : []),
147
+ link, ...favorite,
148
+ { kind: "separator" }, duplicate, del,
149
+ ];
150
+ };
151
+ const where = props.container ?? undefined, standing = props.standing;
152
+ const target = asked && (asked.what === "rename" || asked.what === "delete" || asked.what === "menu") ? viewOf(asked.id) : undefined;
153
+ const asking = shown;
154
+ const nameField = (run) => (_jsx(Field, { label: w.name, children: _jsx(Input, { ref: box, value: name, onValueChange: (v) => setName(v), onKeyDown: enter(run), autoComplete: "off" }) }));
155
+ const columnsField = chosen?.columns && columns && (phone
156
+ ? _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: w.columns(chosen.name), entries: [{ kind: "choices", icon: null, label: w.columns(chosen.name), value: column, choices: columns.fields.map((f) => ({ value: f.value, label: f.label })) }], onOpen: () => (stepping ? ask({ what: "columns" }) : setPicking({ open: true })) }) })
157
+ : _jsx(Field, { label: w.columns(chosen.name), nativeLabel: false, children: _jsx(Select, { "aria-label": w.columns(chosen.name), items: asSelect(columns.fields), value: column, onValueChange: (v) => { if (typeof v === "string")
158
+ setColumn(v); } }) }));
159
+ const newForm = (_jsxs("div", { className: "o-views-list-form", children: [_jsx(RadioGroup, { row: true, label: w.layout, value: layout, onValueChange: (v) => { if (typeof v === "string")
160
+ setLayout(v); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, note: l.line }, l.id)) }), nameField(create), columnsField] }));
161
+ const modalWords = { close: w.close };
162
+ const stepOf = () => {
163
+ if (!stepping || !asked || !shown)
164
+ return null;
165
+ const done = (run, disabled, label) => (_jsx("div", { className: "o-views-list-step-foot", children: _jsx(Button, { kind: "primary", className: "o-views-list-step-act", disabled: disabled, onClick: () => { run(); toList(); }, children: label }) }));
166
+ if (asked.what === "menu" && target) {
167
+ const leaving = (list) => list.map((e) => e.kind === undefined || e.kind === "action" ? { ...e, onSelect: () => { toList(); e.onSelect?.(); } } : e.kind === "group" ? { ...e, entries: leaving(e.entries) } : e);
168
+ return { title: target.name, onBack: toList, body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: target.name, ...tilesOf(leaving(entries(target.id))), ...(closeRow ? { onClose: toList } : {}), closeWord: w.close }) }) };
169
+ }
170
+ if (asked.what === "rename" && target)
171
+ return { title: w.renameTitle, onBack: () => ask({ what: "menu", id: target.id }), body: _jsxs(_Fragment, { children: [_jsx("div", { className: "o-views-list-form", children: nameField(saveName) }), done(saveName, !name.trim(), w.save)] }) };
172
+ if (asked.what === "new")
173
+ return { title: w.newView, onBack: making?.from ? () => ask({ what: "menu", id: making.from }) : toList, body: _jsxs(_Fragment, { children: [newForm, done(create, !name.trim(), w.createView)] }) };
174
+ if (asked.what === "columns" && chosen && columns)
175
+ return {
176
+ title: w.columns(chosen.name), onBack: () => ask({ what: "new", ...(making?.from ? { from: making.from } : {}) }),
177
+ body: _jsx(Picker, { label: w.columns(chosen.name), items: columns.fields, value: column, onValueChange: (v) => { if (typeof v === "string")
178
+ setColumn(v); ask({ what: "new", ...(making?.from ? { from: making.from } : {}) }); } }),
179
+ };
180
+ if (asked.what === "delete" && target)
181
+ return {
182
+ title: "", onBack: () => ask({ what: "menu", id: target.id }),
183
+ body: _jsx(Alert, { title: w.deleteTitle(target.name), line: lineOf(target), action: w.delete, kind: "danger", cancel: w.cancel, phone: true, shell: "sheet", words: { tryAgain: w.tryAgain }, onAnswer: (yes) => { if (yes) {
184
+ toList();
185
+ remove(target.id);
186
+ }
187
+ else
188
+ ask({ what: "menu", id: target.id }); } }),
189
+ };
190
+ return null;
191
+ };
192
+ const bridge = !report && inToast ? _jsx(ToastBridge, { onSend: onSend }) : null;
193
+ const dialogs = stepping ? (_jsxs(_Fragment, { children: [_jsx("span", { ref: setMark, hidden: true }), bridge] })) : (_jsxs(_Fragment, { children: [_jsx("span", { ref: setMark, hidden: true }), bridge, asked?.what === "rename" && (_jsx(Modal, { open: shown, onOpenChange: (o) => { if (!o)
194
+ close(); }, title: w.renameTitle, size: "sm", action: { label: w.save, disabled: !name.trim(), run: saveName }, cancel: w.cancel, words: modalWords, container: where, standing: standing, children: nameField(saveName) })), asked?.what === "new" && (_jsxs(Modal, { open: shown, onOpenChange: (o) => { if (!o)
195
+ close(); }, title: w.newView, size: "md", action: { label: w.createView, disabled: !name.trim(), run: create }, cancel: w.cancel, words: modalWords, container: where, standing: standing, children: [newForm, phone && picking && chosen && columns && (_jsx(OnTop, { open: picking.open, onOpenChange: (o) => setPicking(o ? { open: true } : { open: false }), onGone: () => setPicking(null), title: w.columns(chosen.name), container: where ?? screen, standing: !!standing, picker: { label: w.columns(chosen.name), items: columns.fields, value: column, onValueChange: (v) => { if (typeof v === "string")
196
+ setColumn(v); } } }))] })), asked?.what === "delete" && target && (_jsx(AlertDialog, { open: shown, onAnswer: (yes) => { close(); if (yes)
197
+ remove(target.id); }, title: w.deleteTitle(target.name), line: lineOf(target), action: w.delete, kind: "danger", cancel: w.cancel, words: { close: w.close, failed: w.failed, tryAgain: w.tryAgain }, container: where, standing: standing }))] }));
198
+ const openMenu = (id) => { if (stepping)
199
+ ask({ what: "menu", id }); };
200
+ return { entries, startNew, dialogs, asking, openMenu, step: stepOf() };
201
+ }
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  import type { MenuEntry } from "../menu-list/menu-list.js";
3
3
  import { type PickerParts } from "../picker/picker.js";
4
4
  import { type ListView, type ViewsListChange, type ViewsListLayout } from "./rules.js";
5
+ import type { ViewMenuStep } from "./view-menu.js";
5
6
  import { type ViewsListWords } from "./words.js";
6
7
  /** Held back from the controls door until VK-727: `viewkitjs/views/react`'s atom already has the name. */
7
8
  export interface ViewsListProps {
@@ -22,6 +23,12 @@ export interface ViewsListProps {
22
23
  entries?: (id: string) => MenuEntry[];
23
24
  /** New view, the list's action; left out, no action. */
24
25
  onNew?: () => void;
26
+ /** On a phone, a view's ⋯ hands its id here and opens no menu sheet of its own: the holder turns the list into the view's menu
27
+ * (`step`). On a computer it changes nothing. */
28
+ onMenu?: (id: string) => void;
29
+ /** On a phone, what stands in the Sheet in place of the list (a view's menu, Rename, New view, the delete question): its body,
30
+ * and its title and Back in the Sheet's head. Null or left out, the list stands. */
31
+ step?: ViewMenuStep | null;
25
32
  /** Shared and Just me, a private view's lock; left out, the Private views option worn round it. */
26
33
  privateViews?: boolean;
27
34
  /** false: no row moves. */
@@ -30,7 +37,7 @@ export interface ViewsListProps {
30
37
  }
31
38
  export interface ViewsListParts {
32
39
  body: React.ReactNode;
33
- /** On a phone, the Sheet head's buttons, the Picker's; {} on a computer. */
40
+ /** On a phone, the Sheet head's buttons, the Picker's; {} on a computer. On a step, its Back and its title. */
34
41
  head: PickerParts["head"];
35
42
  }
36
43
  /** A private view's lock, as the list draws it after its name. */
@@ -5,6 +5,8 @@ import { Icon } from "../internal/icons.js";
5
5
  import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
6
6
  import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
7
7
  import { usePicker } from "../picker/picker.js";
8
+ import { SheetButton } from "../sheet/bottom-sheet.js";
9
+ import { openerAt, useStepReturn } from "../internal/step-return.js";
8
10
  import { VIEWS_LIST_ATTRS, viewsListWornOf } from "./looks.js";
9
11
  import { listed } from "./rules.js";
10
12
  import { viewsListWords } from "./words.js";
@@ -28,6 +30,7 @@ export function useViewsList(props) {
28
30
  const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
29
31
  const [root, setRoot] = React.useState(null), worn = useViewsListWorn(props.privateViews === undefined ? root : null);
30
32
  const privateViews = props.privateViews ?? worn.privateViews;
33
+ const [opener, setOpener] = React.useState(null);
31
34
  const markOf = (layout) => {
32
35
  const mark = layouts.find((l) => l.id === layout)?.mark;
33
36
  return mark == null ? {} : { as: { mark: _jsx("span", { className: "o-views-list-mark", children: mark }) } };
@@ -44,12 +47,24 @@ export function useViewsList(props) {
44
47
  onChange({ kind: "open", id: v }); },
45
48
  onDone,
46
49
  ...(props.reorder !== false ? { onOrderChange: (ids) => onChange({ kind: "order", ids }) } : {}),
47
- ...(props.onNew ? { actions: [{ id: "new", label: w.newView, icon: _jsx(Icon, { name: "plus" }), onSelect: props.onNew }] } : {}),
50
+ ...(props.onNew ? { actions: [{ id: "new", label: w.newView, icon: _jsx(Icon, { name: "plus" }), onSelect: () => { setOpener(null); props.onNew(); } }] } : {}),
48
51
  search: phone ? w.find : w.search, searchShown: true, heldInPlace: true, actionsUnder: true, fromHeld: true,
49
- ...(w.none ? { none: w.none } : {}), ...(w.picker ? { words: w.picker } : {}),
52
+ ...(w.none ? { none: w.none } : {}), ...(w.picker ? { words: w.picker } : {}), ...(w.menu ? { menuWords: w.menu } : {}),
50
53
  menuFrame: MENU_LIST_CARD_FRAME,
54
+ ...(phone && props.onMenu ? { onRowMenu: (id) => { setOpener(views.find((v) => v.id === id)?.name ?? null); props.onMenu(id); } } : {}),
51
55
  });
52
- const body = (_jsx("div", { ref: setRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": phone ? "phone" : "computer", ...phoneMark(!!screen || small), children: picker.body }));
56
+ const step = phone ? props.step ?? null : null;
57
+ const rootRef = React.useRef(null);
58
+ const placeRoot = React.useCallback((el) => { rootRef.current = el; setRoot(el); }, [setRoot]);
59
+ useStepReturn(rootRef, step && opener ? [openerAt(() => `[role="option"][data-name="${CSS.escape(opener)}"] .o-picker-row-menu`)] : []);
60
+ if (step) {
61
+ const back = _jsx(SheetButton, { "aria-label": w.back, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: step.onBack });
62
+ return {
63
+ body: _jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": "phone", "data-views-step": "", ...phoneMark(!!screen || small), children: step.body }),
64
+ head: { left: back, children: step.title, right: _jsx("span", {}) },
65
+ };
66
+ }
67
+ const body = (_jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": phone ? "phone" : "computer", ...phoneMark(!!screen || small), children: picker.body }));
53
68
  return { body, head: picker.head };
54
69
  }
55
70
  export function ViewsList(props) {