@viewkitjs/views 0.5.0 → 0.6.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 (413) hide show
  1. package/CHANGELOG.md +620 -0
  2. package/README.md +4 -2
  3. package/dist/atoms/Avatar.d.ts +2 -0
  4. package/dist/atoms/Avatar.js +13 -0
  5. package/dist/atoms/CellMore.d.ts +2 -0
  6. package/dist/atoms/CellMore.js +4 -0
  7. package/dist/atoms/DisabledReason.d.ts +11 -0
  8. package/dist/atoms/DisabledReason.js +10 -0
  9. package/dist/atoms/DrillRows.d.ts +2 -2
  10. package/dist/atoms/DrillRows.js +7 -5
  11. package/dist/atoms/Loading.d.ts +6 -0
  12. package/dist/atoms/Loading.js +4 -1
  13. package/dist/atoms/PanelRows.js +3 -5
  14. package/dist/atoms/Pill.d.ts +2 -0
  15. package/dist/atoms/Pill.js +25 -0
  16. package/dist/atoms/RangeCalendar.d.ts +8 -0
  17. package/dist/atoms/RangeCalendar.js +30 -0
  18. package/dist/atoms/RelationRoles.js +2 -2
  19. package/dist/atoms/SelectionSheet.js +5 -4
  20. package/dist/atoms/ToolbarButton.d.ts +2 -0
  21. package/dist/atoms/ToolbarButton.js +18 -0
  22. package/dist/atoms/defaults.js +10 -0
  23. package/dist/atoms/types.d.ts +141 -1
  24. package/dist/cells/cell-format.d.ts +10 -1
  25. package/dist/cells/cell-title.d.ts +5 -1
  26. package/dist/cells/cell-title.js +2 -2
  27. package/dist/cells/cell-values.js +22 -7
  28. package/dist/cells/relation-wrap.js +1 -1
  29. package/dist/contract.d.ts +351 -15
  30. package/dist/contract.js +482 -4
  31. package/dist/display/actor.js +1 -1
  32. package/dist/display/boolean.js +5 -0
  33. package/dist/display/entity-chip.d.ts +12 -9
  34. package/dist/display/entity-chip.js +4 -5
  35. package/dist/display/fit-values.d.ts +34 -0
  36. package/dist/display/fit-values.js +45 -0
  37. package/dist/display/location.js +1 -1
  38. package/dist/display/multi-value.js +72 -8
  39. package/dist/display/options.d.ts +9 -1
  40. package/dist/display/relation.js +1 -1
  41. package/dist/display/rich-text.js +17 -6
  42. package/dist/display/select.js +6 -4
  43. package/dist/display/status-steps.d.ts +8 -0
  44. package/dist/display/status-steps.js +18 -0
  45. package/dist/display/viewer.js +1 -0
  46. package/dist/editors/BodyFrame.d.ts +29 -0
  47. package/dist/editors/BodyFrame.js +80 -0
  48. package/dist/editors/DateEditor.js +13 -17
  49. package/dist/editors/LocationEditor.d.ts +2 -0
  50. package/dist/editors/LocationEditor.js +29 -5
  51. package/dist/editors/NameEditor.d.ts +2 -0
  52. package/dist/editors/NameEditor.js +27 -7
  53. package/dist/editors/NumberEditor.d.ts +18 -0
  54. package/dist/editors/NumberEditor.js +29 -2
  55. package/dist/editors/RangeEditor.d.ts +2 -0
  56. package/dist/editors/RangeEditor.js +29 -4
  57. package/dist/editors/SelectEditor.d.ts +5 -0
  58. package/dist/editors/SelectEditor.js +3 -2
  59. package/dist/editors/TextEditor.d.ts +11 -1
  60. package/dist/editors/TextEditor.js +25 -8
  61. package/dist/editors/ValueListEditor.d.ts +7 -0
  62. package/dist/editors/ValueListEditor.js +60 -48
  63. package/dist/editors/body-panel.d.ts +7 -0
  64. package/dist/editors/body-panel.js +8 -0
  65. package/dist/editors/edit-session.d.ts +20 -3
  66. package/dist/editors/edit-session.js +43 -3
  67. package/dist/editors/leave-scope.d.ts +23 -0
  68. package/dist/editors/leave-scope.js +28 -0
  69. package/dist/editors/number-body.d.ts +29 -0
  70. package/dist/editors/number-body.js +37 -0
  71. package/dist/editors/parts-body.d.ts +66 -0
  72. package/dist/editors/parts-body.js +114 -0
  73. package/dist/editors/tab-ends.d.ts +5 -0
  74. package/dist/editors/tab-ends.js +7 -0
  75. package/dist/editors/text-body.d.ts +16 -0
  76. package/dist/editors/text-body.js +30 -0
  77. package/dist/editors/values-body.d.ts +47 -0
  78. package/dist/editors/values-body.js +140 -0
  79. package/dist/field-row/FieldRow.d.ts +7 -0
  80. package/dist/field-row/FieldRow.js +44 -24
  81. package/dist/field-row/FieldRowLane.js +12 -4
  82. package/dist/field-row/editors/RowChipsEditor.js +3 -1
  83. package/dist/field-row/editors/RowEditor.js +2 -1
  84. package/dist/field-row/editors/RowNameEditor.d.ts +5 -2
  85. package/dist/field-row/editors/RowNameEditor.js +12 -5
  86. package/dist/field-row/editors/RowNumberEditor.js +18 -2
  87. package/dist/field-row/editors/RowPlaceEditor.js +4 -2
  88. package/dist/field-row/editors/RowRangeEditor.d.ts +5 -2
  89. package/dist/field-row/editors/RowRangeEditor.js +13 -6
  90. package/dist/field-row/editors/RowRelationEditor.js +5 -2
  91. package/dist/field-row/editors/RowSelectEditor.js +4 -1
  92. package/dist/field-row/editors/RowTextEditor.d.ts +1 -1
  93. package/dist/field-row/editors/RowTextEditor.js +12 -3
  94. package/dist/field-row/editors/RowValueListEditor.d.ts +2 -1
  95. package/dist/field-row/editors/RowValueListEditor.js +17 -4
  96. package/dist/field-row/editors/host.d.ts +3 -0
  97. package/dist/field-row/editors/row-session.d.ts +12 -1
  98. package/dist/field-row/editors/row-session.js +52 -2
  99. package/dist/field-row/field-row-button.d.ts +40 -0
  100. package/dist/field-row/field-row-button.js +18 -0
  101. package/dist/field-row/field-row-checkbox.d.ts +9 -0
  102. package/dist/field-row/field-row-checkbox.js +7 -0
  103. package/dist/filters/filter-model.d.ts +2 -0
  104. package/dist/grid/chrome/GridAddColumn.js +17 -3
  105. package/dist/grid/chrome/GridAggregateMenu.d.ts +2 -0
  106. package/dist/grid/chrome/GridAggregateMenu.js +2 -0
  107. package/dist/grid/chrome/GridCellEditors.js +16 -6
  108. package/dist/grid/chrome/GridCellOutline.d.ts +7 -4
  109. package/dist/grid/chrome/GridCellOutline.js +4 -2
  110. package/dist/grid/chrome/GridChipsEditor.js +3 -1
  111. package/dist/grid/chrome/GridColumnMenu.d.ts +4 -1
  112. package/dist/grid/chrome/GridColumnMenu.js +5 -3
  113. package/dist/grid/chrome/GridColumnSortSection.d.ts +20 -0
  114. package/dist/grid/chrome/GridColumnSortSection.js +18 -1
  115. package/dist/grid/chrome/GridFooter.d.ts +4 -1
  116. package/dist/grid/chrome/GridFooter.js +6 -4
  117. package/dist/grid/chrome/GridGroupMenu.d.ts +5 -1
  118. package/dist/grid/chrome/GridGroupMenu.js +30 -8
  119. package/dist/grid/chrome/GridHeader.d.ts +5 -1
  120. package/dist/grid/chrome/GridHeader.js +9 -5
  121. package/dist/grid/chrome/GridLongTextEditor.js +15 -11
  122. package/dist/grid/chrome/GridNameEditor.js +4 -2
  123. package/dist/grid/chrome/GridNumberEditor.d.ts +8 -1
  124. package/dist/grid/chrome/GridNumberEditor.js +15 -3
  125. package/dist/grid/chrome/GridPager.d.ts +7 -0
  126. package/dist/grid/chrome/GridPager.js +34 -0
  127. package/dist/grid/chrome/GridPlaceEditor.js +4 -2
  128. package/dist/grid/chrome/GridRangeEditor.js +12 -4
  129. package/dist/grid/chrome/GridRelationEditor.js +5 -2
  130. package/dist/grid/chrome/GridRow.js +18 -6
  131. package/dist/grid/chrome/GridRowActions.d.ts +8 -3
  132. package/dist/grid/chrome/GridRowActions.js +16 -6
  133. package/dist/grid/chrome/GridRowCells.js +23 -7
  134. package/dist/grid/chrome/GridRowGlyph.d.ts +3 -1
  135. package/dist/grid/chrome/GridRowGlyph.js +7 -2
  136. package/dist/grid/chrome/GridSelectEditor.js +6 -3
  137. package/dist/grid/chrome/GridStructure.d.ts +6 -1
  138. package/dist/grid/chrome/GridStructure.js +32 -8
  139. package/dist/grid/chrome/GridTable.js +36 -24
  140. package/dist/grid/chrome/GridTableSurface.d.ts +5 -1
  141. package/dist/grid/chrome/GridTableSurface.js +5 -2
  142. package/dist/grid/chrome/GridTextEditor.d.ts +5 -1
  143. package/dist/grid/chrome/GridTextEditor.js +13 -3
  144. package/dist/grid/chrome/GridValueListEditor.d.ts +12 -4
  145. package/dist/grid/chrome/GridValueListEditor.js +11 -3
  146. package/dist/grid/chrome/StuckMarker.d.ts +3 -1
  147. package/dist/grid/chrome/StuckMarker.js +6 -2
  148. package/dist/grid/chrome/cells.d.ts +4 -2
  149. package/dist/grid/chrome/cells.js +2 -2
  150. package/dist/grid/chrome/grid-add-column-items.d.ts +1 -1
  151. package/dist/grid/chrome/grid-add-column-items.js +8 -1
  152. package/dist/grid/chrome/grid-button.d.ts +32 -0
  153. package/dist/grid/chrome/grid-button.js +12 -0
  154. package/dist/grid/chrome/grid-cell-classes.d.ts +38 -0
  155. package/dist/grid/chrome/grid-cell-classes.js +30 -0
  156. package/dist/grid/chrome/grid-column-menu-items.d.ts +3 -0
  157. package/dist/grid/chrome/grid-column-menu-items.js +32 -3
  158. package/dist/grid/chrome/grid-columns-template.d.ts +27 -0
  159. package/dist/grid/chrome/grid-columns-template.js +13 -0
  160. package/dist/grid/chrome/grid-edit-session.d.ts +4 -1
  161. package/dist/grid/chrome/grid-edit-session.js +11 -1
  162. package/dist/grid/chrome/grid-group-menu-items.d.ts +8 -1
  163. package/dist/grid/chrome/grid-group-menu-items.js +17 -0
  164. package/dist/grid/chrome/grid-group-menu-parts.d.ts +10 -6
  165. package/dist/grid/chrome/grid-group-menu-parts.js +4 -2
  166. package/dist/grid/chrome/grid-hover.d.ts +4 -1
  167. package/dist/grid/chrome/grid-hover.js +16 -6
  168. package/dist/grid/chrome/grid-pages.d.ts +15 -0
  169. package/dist/grid/chrome/grid-pages.js +9 -0
  170. package/dist/grid/chrome/grid-row-menu-items.js +18 -10
  171. package/dist/grid/chrome/grid-row-props.d.ts +6 -2
  172. package/dist/grid/chrome/grid-row-window.d.ts +7 -0
  173. package/dist/grid/chrome/grid-row-window.js +35 -1
  174. package/dist/grid/chrome/grid-table-props.d.ts +38 -4
  175. package/dist/grid/chrome/useGridColumnLayout.d.ts +3 -1
  176. package/dist/grid/chrome/useGridColumnLayout.js +29 -9
  177. package/dist/grid/chrome/useGridPartColumns.js +1 -1
  178. package/dist/grid/chrome/useGridScrollArea.js +2 -0
  179. package/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -0
  180. package/dist/grid/chrome/useGridTableInteractionModel.js +5 -3
  181. package/dist/grid/chrome/useGridTableSelection.d.ts +3 -1
  182. package/dist/grid/chrome/useGridTableSelection.js +2 -2
  183. package/dist/grid/chrome/useHeaderDragReorder.js +2 -0
  184. package/dist/grid/core/editing-controller.d.ts +36 -11
  185. package/dist/grid/core/editing-controller.js +92 -25
  186. package/dist/grid/core/grid-aria.d.ts +4 -0
  187. package/dist/grid/core/grid-aria.js +6 -4
  188. package/dist/grid/core/grid-focus.d.ts +6 -0
  189. package/dist/grid/core/grid-focus.js +28 -5
  190. package/dist/grid/core/useGridEditing.d.ts +11 -2
  191. package/dist/grid/core/useGridEditing.js +9 -5
  192. package/dist/grid/core/write-states.d.ts +20 -0
  193. package/dist/grid/core/write-states.js +21 -0
  194. package/dist/grid/grid-format-props.d.ts +26 -0
  195. package/dist/grid/grid-format-props.js +65 -0
  196. package/dist/grid/index.d.ts +3 -1
  197. package/dist/grid/index.js +1 -0
  198. package/dist/grid/useGridTablePrefs.d.ts +19 -20
  199. package/dist/grid/useGridTablePrefs.js +6 -58
  200. package/dist/grid/useGridTableSettings.d.ts +60 -0
  201. package/dist/grid/useGridTableSettings.js +61 -0
  202. package/dist/internal/count.d.ts +3 -0
  203. package/dist/internal/count.js +3 -0
  204. package/dist/model/body-frame.d.ts +16 -0
  205. package/dist/model/body-frame.js +5 -0
  206. package/dist/model/column-capabilities.d.ts +4 -1
  207. package/dist/model/column-capabilities.js +4 -1
  208. package/dist/model/column-filters.d.ts +7 -4
  209. package/dist/model/column-filters.js +26 -18
  210. package/dist/model/column-inspect.d.ts +3 -2
  211. package/dist/model/column-inspect.js +3 -1
  212. package/dist/model/column-sort.d.ts +11 -0
  213. package/dist/model/column-sort.js +14 -0
  214. package/dist/model/one-value.d.ts +6 -0
  215. package/dist/model/one-value.js +5 -0
  216. package/dist/model/part-write.js +1 -1
  217. package/dist/model/place-parts.d.ts +6 -0
  218. package/dist/model/place-parts.js +14 -0
  219. package/dist/model/relation-filters.d.ts +13 -2
  220. package/dist/model/relation-filters.js +9 -4
  221. package/dist/model/row-icon.d.ts +16 -6
  222. package/dist/model/settings-columns.d.ts +34 -0
  223. package/dist/model/settings-columns.js +146 -0
  224. package/dist/model/settings-look.d.ts +17 -0
  225. package/dist/model/settings-look.js +23 -0
  226. package/dist/model/view-rules.js +6 -2
  227. package/dist/panels/availability.d.ts +26 -0
  228. package/dist/panels/availability.js +28 -0
  229. package/dist/panels/filter/DateFilterBody.d.ts +42 -0
  230. package/dist/panels/filter/DateFilterBody.js +64 -0
  231. package/dist/panels/filter/DateFilterCalendar.d.ts +19 -0
  232. package/dist/panels/filter/DateFilterCalendar.js +37 -0
  233. package/dist/panels/filter/DateFilterInput.d.ts +16 -0
  234. package/dist/panels/filter/DateFilterInput.js +37 -0
  235. package/dist/panels/filter/FilterIcon.d.ts +7 -0
  236. package/dist/panels/filter/FilterIcon.js +15 -0
  237. package/dist/panels/filter/MenuSelect.d.ts +12 -0
  238. package/dist/panels/filter/MenuSelect.js +34 -0
  239. package/dist/panels/filter/NumberFilterBody.d.ts +21 -0
  240. package/dist/panels/filter/NumberFilterBody.js +76 -0
  241. package/dist/panels/filter/RangeFilterBody.d.ts +19 -0
  242. package/dist/panels/filter/RangeFilterBody.js +71 -0
  243. package/dist/panels/filter/RelationFilterBody.d.ts +17 -0
  244. package/dist/panels/filter/RelationFilterBody.js +20 -0
  245. package/dist/panels/filter/TextFilterBody.d.ts +31 -0
  246. package/dist/panels/filter/TextFilterBody.js +44 -0
  247. package/dist/panels/filter/TimeScopeDetail.d.ts +6 -0
  248. package/dist/panels/filter/TimeScopeDetail.js +47 -0
  249. package/dist/panels/filter/details.d.ts +17 -0
  250. package/dist/panels/filter/details.js +73 -0
  251. package/dist/panels/filter/filter-list.d.ts +23 -0
  252. package/dist/panels/filter/filter-list.js +38 -0
  253. package/dist/panels/group-sort.d.ts +24 -0
  254. package/dist/panels/group-sort.js +58 -0
  255. package/dist/panels/index.d.ts +24 -0
  256. package/dist/panels/index.js +17 -0
  257. package/dist/panels/labels.d.ts +37 -0
  258. package/dist/panels/labels.js +166 -0
  259. package/dist/panels/model.d.ts +343 -0
  260. package/dist/panels/model.js +77 -0
  261. package/dist/panels/react/GroupBucketsList.d.ts +16 -0
  262. package/dist/panels/react/GroupBucketsList.js +38 -0
  263. package/dist/panels/react/LayoutColumnsList.d.ts +24 -0
  264. package/dist/panels/react/LayoutColumnsList.js +71 -0
  265. package/dist/panels/react/PopoverColumnDetail.d.ts +11 -0
  266. package/dist/panels/react/PopoverColumnDetail.js +24 -0
  267. package/dist/panels/react/chrome.d.ts +17 -0
  268. package/dist/panels/react/chrome.js +8 -0
  269. package/dist/panels/react/column-refusals.d.ts +7 -0
  270. package/dist/panels/react/column-refusals.js +14 -0
  271. package/dist/panels/react/customize.d.ts +26 -0
  272. package/dist/panels/react/customize.js +98 -0
  273. package/dist/panels/react/drag.d.ts +2 -0
  274. package/dist/panels/react/drag.js +6 -0
  275. package/dist/panels/react/field-editor.d.ts +10 -0
  276. package/dist/panels/react/field-editor.js +1 -0
  277. package/dist/panels/react/filter-panel.d.ts +15 -0
  278. package/dist/panels/react/filter-panel.js +48 -0
  279. package/dist/panels/react/layout-detail.d.ts +4 -0
  280. package/dist/panels/react/layout-detail.js +21 -0
  281. package/dist/panels/react/order-details.d.ts +32 -0
  282. package/dist/panels/react/order-details.js +81 -0
  283. package/dist/panels/react/panel-header.d.ts +10 -0
  284. package/dist/panels/react/panel-header.js +12 -0
  285. package/dist/panels/react/panel-sheet.d.ts +19 -0
  286. package/dist/panels/react/panel-sheet.js +22 -0
  287. package/dist/panels/react/popover.d.ts +71 -0
  288. package/dist/panels/react/popover.js +47 -0
  289. package/dist/panels/react/root-list.d.ts +6 -0
  290. package/dist/panels/react/root-list.js +31 -0
  291. package/dist/panels/react/toolbar/ReadyToolbar.d.ts +42 -0
  292. package/dist/panels/react/toolbar/ReadyToolbar.js +92 -0
  293. package/dist/panels/react/toolbar/Toolbar.d.ts +16 -0
  294. package/dist/panels/react/toolbar/Toolbar.js +34 -0
  295. package/dist/panels/react/toolbar/ToolbarButton.d.ts +5 -0
  296. package/dist/panels/react/toolbar/ToolbarButton.js +9 -0
  297. package/dist/panels/react/toolbar/ToolbarFilter.d.ts +19 -0
  298. package/dist/panels/react/toolbar/ToolbarFilter.js +32 -0
  299. package/dist/panels/react/toolbar/ToolbarNew.d.ts +12 -0
  300. package/dist/panels/react/toolbar/ToolbarNew.js +21 -0
  301. package/dist/panels/react/toolbar/ToolbarOptions.d.ts +25 -0
  302. package/dist/panels/react/toolbar/ToolbarOptions.js +33 -0
  303. package/dist/panels/react/toolbar/ToolbarSearch.d.ts +9 -0
  304. package/dist/panels/react/toolbar/ToolbarSearch.js +41 -0
  305. package/dist/panels/react/toolbar/ToolbarSort.d.ts +12 -0
  306. package/dist/panels/react/toolbar/ToolbarSort.js +16 -0
  307. package/dist/panels/react/toolbar/ToolbarViews.d.ts +13 -0
  308. package/dist/panels/react/toolbar/ToolbarViews.js +24 -0
  309. package/dist/panels/react/toolbar/context.d.ts +29 -0
  310. package/dist/panels/react/toolbar/context.js +49 -0
  311. package/dist/panels/react/toolbar/panel-part.d.ts +37 -0
  312. package/dist/panels/react/toolbar/panel-part.js +37 -0
  313. package/dist/panels/react/toolbar/panel-state.d.ts +9 -0
  314. package/dist/panels/react/toolbar/panel-state.js +12 -0
  315. package/dist/panels/react/toolbar/use-box-narrow.d.ts +2 -0
  316. package/dist/panels/react/toolbar/use-box-narrow.js +18 -0
  317. package/dist/panels/react/toolbar/use-list-settings-state.d.ts +10 -0
  318. package/dist/panels/react/toolbar/use-list-settings-state.js +10 -0
  319. package/dist/panels/react/view-actions.d.ts +4 -0
  320. package/dist/panels/react/view-actions.js +37 -0
  321. package/dist/panels/react/view-footer.d.ts +16 -0
  322. package/dist/panels/react/view-footer.js +11 -0
  323. package/dist/panels/react/views-row/FoldingViewRow.d.ts +4 -0
  324. package/dist/panels/react/views-row/FoldingViewRow.js +105 -0
  325. package/dist/panels/react/views-row/HScrollRow.d.ts +7 -0
  326. package/dist/panels/react/views-row/HScrollRow.js +42 -0
  327. package/dist/panels/react/views-row/PillGroup.d.ts +30 -0
  328. package/dist/panels/react/views-row/PillGroup.js +86 -0
  329. package/dist/panels/react/views-row/ViewAxes.d.ts +6 -0
  330. package/dist/panels/react/views-row/ViewAxes.js +16 -0
  331. package/dist/panels/react/views-row/ViewCreatePill.d.ts +7 -0
  332. package/dist/panels/react/views-row/ViewCreatePill.js +11 -0
  333. package/dist/panels/react/views-row/ViewPicker.d.ts +5 -0
  334. package/dist/panels/react/views-row/ViewPicker.js +65 -0
  335. package/dist/panels/react/views-row/ViewPickerRow.d.ts +7 -0
  336. package/dist/panels/react/views-row/ViewPickerRow.js +18 -0
  337. package/dist/panels/react/views-row/ViewTabs.d.ts +31 -0
  338. package/dist/panels/react/views-row/ViewTabs.js +29 -0
  339. package/dist/panels/react/views-row/menu-classes.d.ts +6 -0
  340. package/dist/panels/react/views-row/menu-classes.js +3 -0
  341. package/dist/panels/react/views-row/use-anchored-toggle.d.ts +19 -0
  342. package/dist/panels/react/views-row/use-anchored-toggle.js +31 -0
  343. package/dist/panels/react.d.ts +51 -0
  344. package/dist/panels/react.js +43 -0
  345. package/dist/panels/settings/axes.d.ts +28 -0
  346. package/dist/panels/settings/axes.js +71 -0
  347. package/dist/panels/settings/filters.d.ts +5 -0
  348. package/dist/panels/settings/filters.js +62 -0
  349. package/dist/panels/settings/group-buckets.d.ts +23 -0
  350. package/dist/panels/settings/group-buckets.js +73 -0
  351. package/dist/panels/settings/input.d.ts +69 -0
  352. package/dist/panels/settings/input.js +1 -0
  353. package/dist/panels/settings/layout.d.ts +5 -0
  354. package/dist/panels/settings/layout.js +244 -0
  355. package/dist/panels/settings/order.d.ts +19 -0
  356. package/dist/panels/settings/order.js +271 -0
  357. package/dist/panels/settings/settings-panels.d.ts +17 -0
  358. package/dist/panels/settings/settings-panels.js +28 -0
  359. package/dist/panels/toolbar/clear.d.ts +9 -0
  360. package/dist/panels/toolbar/clear.js +26 -0
  361. package/dist/panels/toolbar/counts.d.ts +15 -0
  362. package/dist/panels/toolbar/counts.js +21 -0
  363. package/dist/panels/toolbar/edit-view.d.ts +5 -0
  364. package/dist/panels/toolbar/edit-view.js +18 -0
  365. package/dist/panels/toolbar/model.d.ts +34 -0
  366. package/dist/panels/toolbar/model.js +52 -0
  367. package/dist/panels/use-filter-opened.d.ts +8 -0
  368. package/dist/panels/use-filter-opened.js +11 -0
  369. package/dist/panels/view-state.d.ts +38 -0
  370. package/dist/panels/view-state.js +1 -0
  371. package/dist/panels/views-row/model.d.ts +131 -0
  372. package/dist/panels/views-row/model.js +14 -0
  373. package/dist/provider/ViewsProvider.d.ts +46 -6
  374. package/dist/provider/ViewsProvider.js +32 -2
  375. package/dist/provider/components.d.ts +258 -11
  376. package/dist/provider/context.d.ts +21 -2
  377. package/dist/react.d.ts +5 -2
  378. package/dist/selection/SelectionBar.js +13 -7
  379. package/dist/selection/bar-overflow.js +14 -1
  380. package/dist/selection/bar-parts.d.ts +4 -2
  381. package/dist/selection/bar-parts.js +5 -3
  382. package/dist/selection/useListSelectionShortcuts.d.ts +3 -2
  383. package/dist/selection/useListSelectionShortcuts.js +1 -1
  384. package/dist/selection/verbs.d.ts +7 -0
  385. package/docs/contract.md +307 -41
  386. package/docs/getting-started.md +1 -1
  387. package/docs/guides/atoms.md +37 -5
  388. package/docs/guides/columns.md +1 -1
  389. package/docs/guides/display.md +3 -2
  390. package/docs/guides/editors.md +4 -3
  391. package/docs/guides/selection.md +4 -2
  392. package/docs/guides/the-grid.md +21 -11
  393. package/docs/guides/the-provider.md +22 -6
  394. package/docs/index.md +2 -2
  395. package/docs/install.md +2 -3
  396. package/docs/reference/cells.md +1 -1
  397. package/docs/reference/display.md +5 -4
  398. package/docs/reference/editors-location.md +3 -1
  399. package/docs/reference/editors-name.md +3 -1
  400. package/docs/reference/editors-number.md +1 -0
  401. package/docs/reference/editors-range.md +3 -1
  402. package/docs/reference/editors-session.md +1 -0
  403. package/docs/reference/editors-text.md +2 -2
  404. package/docs/reference/editors-value-list.md +1 -1
  405. package/docs/reference/field-row.md +2 -2
  406. package/docs/reference/grid.md +8 -5
  407. package/docs/reference/panels-react.md +101 -0
  408. package/docs/reference/panels.md +123 -0
  409. package/docs/reference/react.md +39 -16
  410. package/docs/reference/selection.md +5 -5
  411. package/docs/reference/views.md +17 -12
  412. package/package.json +16 -6
  413. package/skills/views/SKILL.md +4 -3
@@ -1,23 +1,26 @@
1
- import { type ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  /**
3
3
  * THE identity of an entity reference, anywhere one is drawn inline — a grid
4
4
  * relation cell, a board-card chip, the activity feed's entity link.
5
5
  *
6
- * The convention it enforces: **avatar first, icon second.** An entity with a
7
- * real image (a person's photo, someday a company logo) shows it; only when
8
- * there is none does the glyph chain take over — host-supplied icon → the
9
- * caller's fallback. Surfaces supply the data
10
- * (`avatarUrl` rides the relation value); this component owns the rule, so
11
- * "should this show the picture?" is never re-decided per surface.
6
+ * The picture is the `Avatar` atom's: handed whose it is, its url, its kind and
7
+ * the glyph this chip draws without one. The default draws the picture while it
8
+ * loads and the glyph otherwise (avatar first, icon second); an app's own draws
9
+ * initials on a tone, or a record in its own shape. The glyph chain under it is
10
+ * this component's: host-supplied icon → the caller's fallback. Surfaces supply
11
+ * the data (`avatarUrl` rides the relation value), so "should this show the
12
+ * picture?" is never re-decided per surface.
12
13
  *
13
- * Renders a fragment (glyph + label as siblings) — the CALLER owns the flex
14
+ * Renders a fragment (picture + label as siblings) — the CALLER owns the flex
14
15
  * container, its gap, and the interactivity around it. That is what lets the
15
16
  * grid chip, with its own hover/link contract, and the feed link, with its
16
17
  * primary-colored label, share one identity without sharing chrome.
17
18
  */
18
- export declare function EntityChipIdentity({ label, avatarUrl, iconOverride, fallbackIcon, labelClassName, }: {
19
+ export declare function EntityChipIdentity({ label, avatarUrl, kind, iconOverride, fallbackIcon, labelClassName, }: {
19
20
  label: string;
20
21
  avatarUrl?: string | null;
22
+ /** The record's kind as the app names it, handed to the Avatar for its shape. */
23
+ kind?: string;
21
24
  /** Host-resolved glyph — never beats a real avatar. */
22
25
  iconOverride?: ReactNode;
23
26
  /** Rendered when neither an avatar nor an override exists. */
@@ -1,9 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
3
  import { cx } from "../internal/cx.js";
5
- export function EntityChipIdentity({ label, avatarUrl, iconOverride, fallbackIcon, labelClassName, }) {
6
- const [avatarBroken, setAvatarBroken] = useState(false);
7
- const glyph = avatarUrl && !avatarBroken ? (_jsx("img", { src: avatarUrl, alt: "", className: "h-4 w-4 -my-0.5 shrink-0 rounded-full object-cover", draggable: false, onError: () => setAvatarBroken(true) })) : ((iconOverride ?? fallbackIcon ?? null));
8
- return (_jsxs(_Fragment, { children: [glyph, _jsx("span", { className: cx("min-w-0", labelClassName), children: label })] }));
4
+ import { useViews } from "../provider/context.js";
5
+ export function EntityChipIdentity({ label, avatarUrl, kind, iconOverride, fallbackIcon, labelClassName, }) {
6
+ const { Avatar } = useViews().atoms;
7
+ return (_jsxs(_Fragment, { children: [_jsx(Avatar, { label: label, avatarUrl: avatarUrl, kind: kind, size: "chip", fallback: iconOverride ?? fallbackIcon ?? null }), _jsx("span", { className: cx("min-w-0", labelClassName), children: label })] }));
9
8
  }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * HOW MANY OF A CELL'S VALUES FIT — the arithmetic and the one observer behind `severalValues: "fit"`.
3
+ *
4
+ * A cell of several values measures them once, when it mounts and when they change: each value's right
5
+ * edge, and the room the count needs. From then on a change of its width is arithmetic over what it kept,
6
+ * so a column resize reads nothing from the page and draws again only the cells whose number changed.
7
+ */
8
+ /** How a cell of several values draws on one line (`ViewsProvider`'s `severalValues`). `first`: its first
9
+ * value and a count, at any width, as on 0.5.0. `fit`: as many whole values as fit its width, then a count. */
10
+ export type ViewsSeveralValues = "first" | "fit";
11
+ /** The most values drawn to be measured: no column fits more, and a cell of 200 records doesn't draw 200
12
+ * chips to find out. */
13
+ export declare const FIT_MEASURE_CAP = 20;
14
+ /**
15
+ * How many values to show. `ends[i]` is value i's right edge from the box's left, for the first
16
+ * `ends.length` of `total` values; `room` is the box's width; `more` is the count's own width plus the gap
17
+ * before it. All of them when every value was measured and the last one's edge is inside the room;
18
+ * otherwise as many as leave room for the count, and never fewer than one, which shows cut. One in a box
19
+ * that isn't laid out (`room` 0), as on 0.5.0.
20
+ */
21
+ export declare function fitCount(ends: readonly number[], total: number, room: number, more: number): number;
22
+ /** One layout read of a cell's values. Counted always: an increment is free, and the grid's count tests read it. */
23
+ export declare function countValuesMeasure(): void;
24
+ /** The layout reads since the last take; the count starts again. */
25
+ export declare function takeValuesMeasures(): number;
26
+ /**
27
+ * Hands `onWidth` the box's width whenever it changes, through ONE observer for the whole page, made on the
28
+ * first call: a grid with fit on holds one observer and a box per drawn cell of several values, and a page
29
+ * with fit off holds none. The returned function lets the box go. No `ResizeObserver` (a server, an old
30
+ * engine): nothing is observed, and the cell keeps the width it measured.
31
+ */
32
+ export declare function observeWidth(box: Element, onWidth: (width: number) => void): () => void;
33
+ /** For a test that swaps `ResizeObserver`: forget the page's observer, so the next box makes a new one. */
34
+ export declare function forgetWidthObserverInTest(): void;
@@ -0,0 +1,45 @@
1
+ export const FIT_MEASURE_CAP = 20;
2
+ const SLACK = 1;
3
+ export function fitCount(ends, total, room, more) {
4
+ if (room <= 0 || ends.length === 0)
5
+ return 1;
6
+ const limit = room + SLACK;
7
+ if (total === ends.length && ends[ends.length - 1] <= limit)
8
+ return total;
9
+ let shown = 1;
10
+ for (let k = 2; k <= ends.length; k++) {
11
+ if (ends[k - 1] + more > limit)
12
+ break;
13
+ shown = k;
14
+ }
15
+ return shown;
16
+ }
17
+ let measures = 0;
18
+ export function countValuesMeasure() {
19
+ measures += 1;
20
+ }
21
+ export function takeValuesMeasures() {
22
+ const count = measures;
23
+ measures = 0;
24
+ return count;
25
+ }
26
+ let observer = null;
27
+ const handlers = new WeakMap();
28
+ export function observeWidth(box, onWidth) {
29
+ if (typeof ResizeObserver === "undefined")
30
+ return () => undefined;
31
+ observer ??= new ResizeObserver((entries) => {
32
+ for (const entry of entries)
33
+ handlers.get(entry.target)?.(entry.contentRect.width);
34
+ });
35
+ handlers.set(box, onWidth);
36
+ observer.observe(box);
37
+ return () => {
38
+ handlers.delete(box);
39
+ observer?.unobserve(box);
40
+ };
41
+ }
42
+ export function forgetWidthObserverInTest() {
43
+ observer?.disconnect();
44
+ observer = null;
45
+ }
@@ -13,7 +13,7 @@ export function renderLocation(field, value, opts) {
13
13
  function PlaceValue({ value, opts: given }) {
14
14
  const opts = useDisplayOptions(given);
15
15
  const write = opts.wrap === "full" ? locationText : locationShort;
16
- const locale = opts.viewer?.locale;
16
+ const locale = opts.viewer?.language ?? opts.viewer?.locale;
17
17
  if (Array.isArray(value)) {
18
18
  const places = value.map((place) => write(place, locale)).filter(Boolean);
19
19
  return (_jsx(MultiValueCell, { items: places, wrap: !!opts.wrap, title: places.join(", "), slotOwnsClick: opts.slotOwnsClick }));
@@ -1,27 +1,91 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useRef, useState } from "react";
3
+ import { useLayoutEffect, useRef, useState } from "react";
4
+ import { DefaultCellMore } from "../atoms/CellMore.js";
4
5
  import { cx } from "../internal/cx.js";
5
6
  import { ELEMENT_RESET } from "../internal/reset.js";
6
7
  import { useViews } from "../provider/context.js";
8
+ import { FIT_MEASURE_CAP, countValuesMeasure, fitCount, observeWidth } from "./fit-values.js";
7
9
  const VISIBLE_FLAT = 1;
8
10
  const VISIBLE_WRAPPED = 3;
9
11
  const ROW_INSET = 14;
12
+ const MORE_LOOK = cx("shrink-0 rounded-md [corner-shape:squircle] border border-(color:--vk-border)", "bg-(color:--vk-ground) px-1 text-[10px] leading-[0.9rem] text-(color:--vk-fg-subtle) shadow-xs", "transition-colors hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)");
13
+ const MORE_TEXT = "shrink-0 text-[10px] leading-[0.9rem] text-(color:--vk-fg-subtle)";
10
14
  export function MultiValueCell({ items, details, wrap, title, slotOwnsClick, }) {
11
- const { atoms, components, messages } = useViews();
15
+ const { atoms, components, messages, severalValues } = useViews();
16
+ const { CellMore } = atoms;
17
+ const ownCount = CellMore === DefaultCellMore;
12
18
  const [open, setOpen] = useState(false);
13
19
  const anchor = useRef(null);
14
20
  const trigger = useRef(null);
21
+ const fit = severalValues === "fit" && !wrap && items.length > 1;
22
+ const key = `${items.length}\u0000${title ?? ""}`;
23
+ const keyRef = useRef(key);
24
+ useLayoutEffect(() => {
25
+ keyRef.current = key;
26
+ }, [key]);
27
+ const kept = useRef(null);
28
+ const [fitted, setFitted] = useState(null);
29
+ const measuring = fit && (fitted === null || fitted.key !== key || "measure" in fitted);
30
+ useLayoutEffect(() => {
31
+ if (!measuring)
32
+ return;
33
+ const box = anchor.current;
34
+ if (!box)
35
+ return;
36
+ const measure = () => {
37
+ countValuesMeasure();
38
+ const room = box.getBoundingClientRect();
39
+ const valueBoxes = [...box.querySelectorAll(":scope > [data-vk-fit-value]")];
40
+ const ends = valueBoxes.map((value) => value.getBoundingClientRect().right - room.left);
41
+ const count = box.querySelector(':scope > [data-slot="vk-cell-more"]')?.getBoundingClientRect();
42
+ if (room.width <= 0 || ends.every((end) => end <= 0) || !count) {
43
+ kept.current = null;
44
+ setFitted({ key, shown: 1 });
45
+ return;
46
+ }
47
+ const more = count.right - room.left - ends[ends.length - 1];
48
+ kept.current = { key, ends, more, total: items.length };
49
+ setFitted({ key, shown: fitCount(ends, items.length, room.width, more) });
50
+ };
51
+ measure();
52
+ }, [measuring, key, items.length]);
53
+ useLayoutEffect(() => {
54
+ const box = anchor.current;
55
+ if (!fit || !box)
56
+ return;
57
+ return observeWidth(box, (width) => {
58
+ const at = kept.current;
59
+ if (!at || at.key !== keyRef.current) {
60
+ if (width > 0)
61
+ setFitted({ key: keyRef.current, measure: true });
62
+ return;
63
+ }
64
+ const shown = fitCount(at.ends, at.total, width, at.more);
65
+ setFitted((current) => (current && "shown" in current && current.key === at.key && current.shown === shown ? current : { key: at.key, shown }));
66
+ });
67
+ }, [fit]);
15
68
  if (items.length === 0)
16
69
  return null;
17
- const shown = items.slice(0, wrap ? VISIBLE_WRAPPED : VISIBLE_FLAT);
18
- const hidden = items.length - shown.length;
19
- const content = (_jsxs("span", { ref: anchor, className: cx("flex min-w-0 items-center gap-1", wrap && "flex-wrap gap-y-0.5"), title: title, children: [shown.map((item, index) => (_jsx("span", { className: "flex min-w-0 items-center truncate *:min-w-0 *:truncate", children: typeof item === "string" || typeof item === "number" ? _jsx("span", { children: item }) : item }, index))), hidden > 0 &&
20
- (slotOwnsClick ? (_jsxs("span", { className: "shrink-0 text-[10px] leading-[0.9rem] text-(color:--vk-fg-subtle)", children: ["+", hidden] })) : (_jsxs("button", { ref: trigger, type: "button", tabIndex: -1, "data-no-nav": true, "aria-label": messages({ key: "views.display.show-all", values: { count: items.length } }), "aria-haspopup": "dialog", "aria-expanded": open, onClick: (event) => {
70
+ const shownCount = !fit
71
+ ? wrap
72
+ ? VISIBLE_WRAPPED
73
+ : VISIBLE_FLAT
74
+ : measuring
75
+ ? FIT_MEASURE_CAP
76
+ : fitted && "shown" in fitted
77
+ ? fitted.shown
78
+ : VISIBLE_FLAT;
79
+ const shown = items.slice(0, shownCount);
80
+ const hidden = measuring ? items.length : items.length - shown.length;
81
+ const content = (_jsxs("span", { ref: anchor, className: cx("flex min-w-0 items-center gap-1", wrap && "flex-wrap gap-y-0.5", fit && "flex-1"), title: title, "data-vk-fit": fit ? "" : undefined, children: [shown.map((item, index) => (_jsx("span", { "data-vk-fit-value": fit ? "" : undefined, className: measuring
82
+ ? "flex shrink-0 items-center whitespace-nowrap"
83
+ : "flex min-w-0 items-center truncate *:min-w-0 *:truncate", children: typeof item === "string" || typeof item === "number" ? _jsx("span", { children: item }) : item }, index))), hidden > 0 &&
84
+ (slotOwnsClick ? (_jsx("span", { "data-slot": "vk-cell-more", className: ownCount ? MORE_TEXT : "shrink-0", children: _jsx(CellMore, { count: hidden, inert: true }) })) : (_jsx("button", { ref: trigger, type: "button", tabIndex: -1, "data-no-nav": true, "data-slot": "vk-cell-more", "data-open": open ? "" : undefined, "aria-label": messages({ key: "views.display.show-all", values: { count: items.length } }), "aria-haspopup": "dialog", "aria-expanded": open, onClick: (event) => {
21
85
  event.stopPropagation();
22
86
  setOpen((current) => !current);
23
- }, className: cx(ELEMENT_RESET, "shrink-0 rounded-md [corner-shape:squircle] border border-(color:--vk-border)", "bg-(color:--vk-ground) px-1 text-[10px] leading-[0.9rem] text-(color:--vk-fg-subtle) shadow-xs", "transition-colors hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)"), children: ["+", hidden] })))] }));
24
- if (hidden === 0 || slotOwnsClick)
87
+ }, className: ownCount ? cx(ELEMENT_RESET, MORE_LOOK) : cx(ELEMENT_RESET, "shrink-0"), children: _jsx(CellMore, { count: hidden, inert: false }) })))] }));
88
+ if (hidden === 0 || slotOwnsClick || measuring)
25
89
  return content;
26
90
  const { Popover } = components;
27
91
  const { List, Row } = atoms;
@@ -1,8 +1,9 @@
1
- import type { ReactNode } from "react";
1
+ import type { ComponentType, ReactNode } from "react";
2
2
  import type { CategoryColor } from "@viewkitjs/fields/design/category-colors";
3
3
  import type { CurrencyFormat, DateStyle, FieldMessageResolver, NumberFormat, PercentDisplay, PercentFormat, RelationValue } from "@viewkitjs/fields";
4
4
  import type { DurationStyle } from "@viewkitjs/fields/format/time";
5
5
  import type { ViewsMessageResolver } from "../contract.js";
6
+ import type { ViewsCheckboxProps } from "../provider/components.js";
6
7
  /**
7
8
  * What the number FORMATTER accepts — wider than what a number FIELD declares.
8
9
  *
@@ -45,6 +46,9 @@ export type RelationWrap = (relation: RelationValue, chip: ReactNode) => ReactNo
45
46
  /** Viewer-owned context. No mutable locale or timezone singleton lives in fields. */
46
47
  export type FieldViewerContext = {
47
48
  locale: string;
49
+ /** The language names are written in (a place's country and region): the conventions' `language`. Absent,
50
+ * `locale`. */
51
+ language?: string;
48
52
  timeZone?: string;
49
53
  /** The viewer's country, from the conventions: a phone of that country is written as at home. */
50
54
  region?: string;
@@ -139,6 +143,10 @@ export type DisplayOptions = {
139
143
  onToggle?: (next: boolean) => void;
140
144
  /** Temporarily disables a two-way control while preserving its rendered shape. */
141
145
  booleanDisabled?: boolean;
146
+ /** boolean `checkbox` style: the control that draws the box, handed `checked`, the field's label, `tabIndex` -1 and
147
+ * `onCheckedChange` (or `readOnly` without `onToggle`). Absent: ViewKit's `TickBox`, in its own switch button when
148
+ * `onToggle` is handed. The grid hands the components map's `Checkbox` while `gridCheckboxes` is `checkbox`. */
149
+ booleanCheckbox?: ComponentType<ViewsCheckboxProps>;
142
150
  /** relation: the caller's glyph for a kind. The field core has no app registry. */
143
151
  entityIcon?: (kind: string | undefined) => ReactNode;
144
152
  /** relation: the caller wraps each chip with its own click-through. Absent = inert. */
@@ -37,7 +37,7 @@ function RelationChip({ field, relation, opts, }) {
37
37
  const Glyph = views.icons.relation;
38
38
  const { RelationRoles } = views.atoms;
39
39
  const roles = roleLabels(field, relation);
40
- const chip = (_jsxs(_Fragment, { children: [_jsx(EntityChipIdentity, { label: relation.label, avatarUrl: relation.avatarUrl, iconOverride: relation.icon ?? opts?.entityIcon?.(relation.entity), fallbackIcon: _jsx(Glyph, { className: "h-3 w-3 shrink-0 text-(color:--vk-fg-subtlest)" }), labelClassName: cellTextClass(opts?.wrap) }), roles.length > 0 ? _jsx(RelationRoles, { relation: relation, roles: roles }) : null] }));
40
+ const chip = (_jsxs(_Fragment, { children: [_jsx(EntityChipIdentity, { label: relation.label, avatarUrl: relation.avatarUrl, kind: relation.entity, iconOverride: relation.icon ?? opts?.entityIcon?.(relation.entity), fallbackIcon: _jsx(Glyph, { className: "h-3 w-3 shrink-0 text-(color:--vk-fg-subtlest)" }), labelClassName: cellTextClass(opts?.wrap) }), roles.length > 0 ? _jsx(RelationRoles, { relation: relation, roles: roles }) : null] }));
41
41
  if (opts?.relationWrap)
42
42
  return opts.relationWrap(relation, chip);
43
43
  return (_jsx("span", { className: CHIP_BASE, title: chipTitle(relation, roles), children: chip }));
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useLayoutEffect, useRef, useState } from "react";
4
4
  import { markdownFirstLine, markdownPlainText } from "@viewkitjs/fields";
5
5
  import { cx } from "../internal/cx.js";
6
- import { ELEMENT_RESET } from "../internal/reset.js";
6
+ import { drawFieldRowButton } from "../field-row/field-row-button.js";
7
7
  import { useViews } from "../provider/context.js";
8
8
  import { cellTextClass } from "./text-class.js";
9
9
  const FOLDED_PX = 160;
@@ -18,7 +18,8 @@ export function renderRichText(_field, value, opts) {
18
18
  return (_jsx("span", { className: cellTextClass(false), title: line, children: line }));
19
19
  }
20
20
  function RichTextBlock({ source }) {
21
- const { components, messages } = useViews();
21
+ const views = useViews();
22
+ const { components, messages } = views;
22
23
  const { Markdown } = components;
23
24
  const boxRef = useRef(null);
24
25
  const [tall, setTall] = useState(false);
@@ -28,8 +29,18 @@ function RichTextBlock({ source }) {
28
29
  if (el)
29
30
  setTall(el.scrollHeight > FOLDED_PX + 8);
30
31
  }, [source]);
31
- return (_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { ref: boxRef, className: cx("relative min-w-0 overflow-hidden", !open && tall && "max-h-40"), children: [_jsx(Markdown, { source: source }), !open && tall && (_jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-linear-to-t from-(color:--vk-ground) to-transparent" }))] }), tall && (_jsx("button", { type: "button", "data-no-nav": true, onClick: (event) => {
32
- event.stopPropagation();
33
- setOpen((was) => !was);
34
- }, className: cx(ELEMENT_RESET, "mt-1 text-xs text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)"), children: messages({ key: open ? "views.display.show-less" : "views.display.show-more" }) }))] }));
32
+ return (_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { ref: boxRef, className: cx("relative min-w-0 overflow-hidden", !open && tall && "max-h-40"), children: [_jsx(Markdown, { source: source }), !open && tall && (_jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-linear-to-t from-(color:--vk-ground) to-transparent" }))] }), tall &&
33
+ drawFieldRowButton(views, {
34
+ own: "mt-1 text-xs text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)",
35
+ frame: "mt-1 -mx-1 h-auto px-1 py-0.5 text-xs",
36
+ variant: "ghost",
37
+ size: "sm",
38
+ "data-slot": "vk-show-more",
39
+ noNav: true,
40
+ onClick: (event) => {
41
+ event.stopPropagation();
42
+ setOpen((was) => !was);
43
+ },
44
+ children: messages({ key: open ? "views.display.show-less" : "views.display.show-more" }),
45
+ })] }));
35
46
  }
@@ -4,6 +4,7 @@ import { resolveCategoryColor } from "@viewkitjs/fields/design/category-colors";
4
4
  import { optionFor } from "@viewkitjs/fields";
5
5
  import { useViews } from "../provider/context.js";
6
6
  import { MultiValueCell } from "./multi-value.js";
7
+ import { placeAmong, statusSteps } from "./status-steps.js";
7
8
  export function renderSelect(field, value, opts) {
8
9
  return renderOptionValue(field, String(value), "category", opts, field.vocabulary === "custom-values");
9
10
  }
@@ -20,17 +21,18 @@ function renderOptionValue(field, value, style, opts, selfLabelled = false) {
20
21
  const label = option?.label ?? opts?.labelFallback?.(value) ?? (selfLabelled ? value : undefined);
21
22
  if (label === undefined)
22
23
  return _jsx(StrayOption, { value: value });
23
- if (style === "status")
24
- return _jsx(OptionStatus, { slot: option?.slot ?? "muted", label: label, icon: option?.icon });
24
+ if (style === "status") {
25
+ return (_jsx(OptionStatus, { slot: option?.slot ?? "muted", label: label, icon: option?.icon, place: placeAmong(statusSteps(field), value) }));
26
+ }
25
27
  return (_jsx(OptionCategory, { label: label, color: resolveCategoryColor(value, field.options, opts?.optionColors), icon: option?.icon }));
26
28
  }
27
29
  function StrayOption({ value }) {
28
30
  const { messages } = useViews();
29
31
  return (_jsx("span", { className: "text-(color:--vk-fg-subtle)", title: messages({ key: "views.display.not-an-option" }), children: value }));
30
32
  }
31
- function OptionStatus({ slot, label, icon }) {
33
+ function OptionStatus({ slot, label, icon, place, }) {
32
34
  const { atoms: { StatusBadge }, components: { AppIcon }, } = useViews();
33
- return (_jsx(StatusBadge, { slot: slot, label: label, className: "border-0", leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
35
+ return (_jsx(StatusBadge, { slot: slot, label: label, place: place, className: "border-0", leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
34
36
  }
35
37
  function OptionCategory({ label, color, icon }) {
36
38
  const { atoms: { Tag }, components: { AppIcon }, } = useViews();
@@ -0,0 +1,8 @@
1
+ import { type FieldOption } from "@viewkitjs/fields";
2
+ import type { ViewsStatusOption, ViewsStatusPlace } from "../atoms/types.js";
3
+ /** A field's steps: its active options, archived out, in declared order. The same array for the same options. */
4
+ export declare function statusSteps(holder: {
5
+ options?: readonly FieldOption[];
6
+ }): readonly FieldOption[];
7
+ /** A value's place among the steps, or none for a value that is no step (a stray, an archived value, the None row). */
8
+ export declare function placeAmong(steps: readonly ViewsStatusOption[], value: string): ViewsStatusPlace | undefined;
@@ -0,0 +1,18 @@
1
+ import { optionsOf } from "@viewkitjs/fields";
2
+ const STEPS = new WeakMap();
3
+ const NONE = [];
4
+ export function statusSteps(holder) {
5
+ const options = holder.options;
6
+ if (!options)
7
+ return NONE;
8
+ let steps = STEPS.get(options);
9
+ if (!steps) {
10
+ steps = optionsOf(holder);
11
+ STEPS.set(options, steps);
12
+ }
13
+ return steps;
14
+ }
15
+ export function placeAmong(steps, value) {
16
+ const index = steps.findIndex((step) => step.value === value);
17
+ return index < 0 ? undefined : { index, options: steps };
18
+ }
@@ -2,6 +2,7 @@ import { resolveViewsMessage } from "../contract.js";
2
2
  export function viewerFrom(conventions, messages = resolveViewsMessage, now = new Date()) {
3
3
  return {
4
4
  locale: conventions.locale,
5
+ language: conventions.language,
5
6
  timeZone: conventions.timeZone,
6
7
  ...(conventions.region ? { region: conventions.region } : {}),
7
8
  now,
@@ -0,0 +1,29 @@
1
+ import { type ReactNode } from "react";
2
+ import type { CloseReason } from "@viewkitjs/fields";
3
+ /**
4
+ * The box around an app's whole body (a parts body, a values body, a text body, a number body): Escape and Tab from inside its element are the
5
+ * editor's, taken before the body hears them, so the field type's Escape rule decides what an Escape keeps and Tab walks the body's
6
+ * controls and closes from either end. A key that starts outside its element, in a popup the body draws in a portal
7
+ * (React still bubbles its events through here), is left to the body: its own list closes on its own Escape. Enter
8
+ * and every other key go to the body. `slot` names the body on the frame (`data-slot`); `innerEscape` marks it
9
+ * `EDITOR_INNER_ESCAPE`, so a popover that hears Escape on the document first leaves it to the frame (an editor whose
10
+ * session keeps on Escape).
11
+ *
12
+ * A text body's frame and a number body's take more: `closeOnModEnter`, ⌘ or Ctrl Enter from inside its element closes as Enter (ViewKit's own
13
+ * close for a line and a paragraph); `closeOnBlur`, the focus leaving its element for somewhere neither inside it nor in the
14
+ * body's own popup closes as a blur, as ViewKit's own box does in place, except the blur a press on the body's own surface
15
+ * causes (the cell around it takes the focus): the focus is put back instead; `inPlace`, it stands in a grid cell, so a Tab
16
+ * between the body's controls is stopped from reaching the grid, which cancels Tab while a cell edits. The package's own; no
17
+ * entry point exports it.
18
+ */
19
+ export declare function BodyFrame({ slot, innerEscape, closeOnModEnter, closeOnBlur, inPlace, onRequestClose, children, }: {
20
+ slot: "vk-parts-body" | "vk-values-body" | "vk-text-body" | "vk-number-body";
21
+ innerEscape?: boolean;
22
+ /** ⌘ or Ctrl Enter closes as Enter: `true` without Shift or Alt (a text body), `"any"` whatever else is held (a number
23
+ * body: ViewKit's own number box closes on Enter with any modifier). */
24
+ closeOnModEnter?: boolean | "any";
25
+ closeOnBlur?: boolean;
26
+ inPlace?: boolean;
27
+ onRequestClose: (reason: CloseReason) => void;
28
+ children: ReactNode;
29
+ }): ReactNode;
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useRef } from "react";
4
+ import { EDITOR_INNER_ESCAPE } from "./EditorPanel.js";
5
+ import { tabEnds } from "./tab-ends.js";
6
+ const inBodyPopup = (node) => node instanceof Element && node.closest(`[${EDITOR_INNER_ESCAPE}]`) !== null;
7
+ export function BodyFrame({ slot, innerEscape = false, closeOnModEnter = false, closeOnBlur = false, inPlace = false, onRequestClose, children, }) {
8
+ const tabbingRef = useRef(null);
9
+ const pressedRef = useRef(false);
10
+ const onKey = (event) => {
11
+ if (!event.currentTarget.contains(event.target))
12
+ return;
13
+ if (event.nativeEvent.isComposing)
14
+ return;
15
+ if (closeOnModEnter &&
16
+ event.key === "Enter" &&
17
+ (event.metaKey || event.ctrlKey) &&
18
+ (closeOnModEnter === "any" || (!event.altKey && !event.shiftKey))) {
19
+ event.preventDefault();
20
+ event.stopPropagation();
21
+ onRequestClose("enter");
22
+ return;
23
+ }
24
+ if (event.altKey || event.ctrlKey || event.metaKey)
25
+ return;
26
+ if (event.key === "Escape") {
27
+ event.preventDefault();
28
+ event.stopPropagation();
29
+ onRequestClose("escape");
30
+ return;
31
+ }
32
+ if (event.key !== "Tab")
33
+ return;
34
+ const { first, last } = tabEnds(event.currentTarget);
35
+ const leaving = event.shiftKey ? event.target === first : event.target === last;
36
+ if (!leaving) {
37
+ if (inPlace)
38
+ event.stopPropagation();
39
+ tabbingRef.current = event.shiftKey ? "shift-tab" : "tab";
40
+ setTimeout(() => (tabbingRef.current = null), 0);
41
+ return;
42
+ }
43
+ event.preventDefault();
44
+ event.stopPropagation();
45
+ onRequestClose(event.shiftKey ? "shift-tab" : "tab");
46
+ };
47
+ const onBlurAway = (event) => {
48
+ const to = event.relatedTarget;
49
+ if (to && event.currentTarget.contains(to))
50
+ return;
51
+ const via = tabbingRef.current;
52
+ if (via) {
53
+ tabbingRef.current = null;
54
+ onRequestClose(via);
55
+ return;
56
+ }
57
+ if (!closeOnBlur || inBodyPopup(to))
58
+ return;
59
+ if (pressedRef.current) {
60
+ const lost = event.target;
61
+ const frame = event.currentTarget;
62
+ setTimeout(() => {
63
+ const at = document.activeElement;
64
+ if (at && (frame.contains(at) || inBodyPopup(at)))
65
+ return;
66
+ if (lost.isConnected)
67
+ lost.focus({ preventScroll: true });
68
+ }, 0);
69
+ return;
70
+ }
71
+ onRequestClose("blur");
72
+ };
73
+ const onPress = () => {
74
+ if (!closeOnBlur)
75
+ return;
76
+ pressedRef.current = true;
77
+ setTimeout(() => (pressedRef.current = false), 0);
78
+ };
79
+ return (_jsx("div", { "data-slot": slot, ...(innerEscape ? { [EDITOR_INNER_ESCAPE]: "" } : {}), className: "contents", onKeyDownCapture: onKey, onBlurCapture: onBlurAway, onPointerDownCapture: onPress, onMouseDownCapture: onPress, children: children }));
80
+ }
@@ -8,22 +8,17 @@ import { ELEMENT_RESET } from "../internal/reset.js";
8
8
  import { useViews } from "../provider/context.js";
9
9
  import { isDesktopNow } from "../provider/desktop.js";
10
10
  import { usePickerForm } from "./picker-slot.js";
11
- const QUICK_DAYS = [
12
- { key: "date.today", offset: () => 0 },
13
- { key: "date.tomorrow", offset: () => 1 },
14
- { key: "date.next-monday", offset: (weekday) => (8 - weekday) % 7 || 7 },
15
- ];
11
+ import { tabEnds } from "./tab-ends.js";
12
+ const QUICK_DAYS = {
13
+ today: { key: "date.today", offset: () => 0 },
14
+ tomorrow: { key: "date.tomorrow", offset: () => 1 },
15
+ "next-monday": { key: "date.next-monday", offset: (weekday) => (8 - weekday) % 7 || 7 },
16
+ "in-a-week": { key: "date.in-a-week", offset: () => 7 },
17
+ };
16
18
  function quickDay(offset) {
17
19
  const now = new Date();
18
20
  return new Date(now.getFullYear(), now.getMonth(), now.getDate() + offset(now.getDay()));
19
21
  }
20
- const FOCUSABLE = "input, select, textarea, button, a[href], [tabindex]";
21
- function tabEnds(root) {
22
- const reachable = Array.from(root.querySelectorAll(FOCUSABLE)).filter((element) => element.tabIndex >= 0 &&
23
- !element.disabled &&
24
- element.closest("[hidden], [inert]") === null);
25
- return { first: reachable[0], last: reachable.at(-1) };
26
- }
27
22
  const CALENDAR_START = "1900-01";
28
23
  const CALENDAR_END = `${new Date().getFullYear() + 10}-12`;
29
24
  const TIME_OPTIONS = Array.from({ length: 96 }, (_, i) => {
@@ -48,7 +43,7 @@ function readBodyValue(value) {
48
43
  const time = normalizeTime(value.slice(11));
49
44
  return time ? { day, time } : null;
50
45
  }
51
- const DATE_BODY_PICKS = ["today", "tomorrow", "next-monday"];
46
+ const DEFAULT_DATE_PICKS = ["today", "tomorrow", "next-monday"];
52
47
  function initialHasTime(iso, parsed) {
53
48
  if (!iso || !parsed)
54
49
  return false;
@@ -61,6 +56,7 @@ export const DateEditor = forwardRef(function DateEditor({ initial, timeOptional
61
56
  const words = message ?? views.conventions.messages;
62
57
  const { Calendar, Input, DateBody } = views.components;
63
58
  const { List, Row } = views.atoms;
59
+ const quickPicks = views.datePicks ?? DEFAULT_DATE_PICKS;
64
60
  const DateGlyph = views.icons.date;
65
61
  const TimeGlyph = views.icons.time;
66
62
  const [timeOpen, setTimeOpen] = useState(false);
@@ -215,7 +211,7 @@ export const DateEditor = forwardRef(function DateEditor({ initial, timeOptional
215
211
  }
216
212
  onTabOut(event);
217
213
  };
218
- return (_jsx("div", { "data-slot": "vk-date-editor", className: "contents", onKeyDownCapture: onBodyKey, onBlurCapture: onTabAway, children: _jsx(DateBody, { label: label ?? words({ key: "date.label" }), value: bodyValue, onValueChange: takeBodyValue, onDone: () => onRequestClose("pick"), time: !dayOnly, empty: clearable, picks: clearable ? [...DATE_BODY_PICKS, "none"] : [...DATE_BODY_PICKS], today: toDayKey(new Date()), typed: seed, autoFocus: focusDate || seed != null, form: form }) }));
214
+ return (_jsx("div", { "data-slot": "vk-date-editor", className: "contents", onKeyDownCapture: onBodyKey, onBlurCapture: onTabAway, children: _jsx(DateBody, { label: label ?? words({ key: "date.label" }), value: bodyValue, onValueChange: takeBodyValue, onDone: () => onRequestClose("pick"), time: !dayOnly, empty: clearable, picks: clearable ? [...quickPicks, "none"] : [...quickPicks], today: toDayKey(new Date()), typed: seed, autoFocus: focusDate || seed != null, form: form }) }));
219
215
  }
220
216
  return (_jsxs("div", { "data-slot": "vk-date-editor", className: "contents", onKeyDownCapture: onTabOut, onBlurCapture: onTabAway, children: [_jsxs("div", { className: "flex items-center gap-1.5 border-b border-(color:--vk-border) p-2", children: [_jsxs("div", { className: "flex h-8 min-w-0 flex-1 items-center gap-2 rounded-lg bg-(color:--vk-neutral) px-2.5 focus-within:bg-(color:--vk-neutral-hovered)", children: [_jsx(DateGlyph, { className: "h-3.5 w-3.5 shrink-0 text-(color:--vk-fg-subtlest)" }), _jsx(Input, { ref: dateRef, type: "text", value: dateVal, onChange: (e) => {
221
217
  touchedRef.current = true;
@@ -260,10 +256,10 @@ export const DateEditor = forwardRef(function DateEditor({ initial, timeOptional
260
256
  setTimeOpen(false);
261
257
  timeRef.current?.focus();
262
258
  }, className: cx(ELEMENT_RESET, "w-full px-3 py-1.5 text-left text-sm tabular-nums hover:bg-(color:--vk-hovered)", active ? "bg-(color:--vk-neutral) font-medium text-(color:--vk-fg)" : "text-(color:--vk-fg-subtle)"), children: t }, t));
263
- }) }))] }))] }), _jsx("div", { className: "flex gap-1 px-2 pt-2", children: QUICK_DAYS.map((quick) => (_jsx("button", { type: "button", onClick: (e) => {
259
+ }) }))] }))] }), _jsx("div", { className: "flex gap-1 px-2 pt-2", children: quickPicks.map((pick) => (_jsx("button", { type: "button", onClick: (e) => {
264
260
  e.stopPropagation();
265
- chooseDay(quickDay(quick.offset));
266
- }, className: cx(ELEMENT_RESET, "h-7 rounded-md bg-(color:--vk-neutral) px-2 text-xs text-(color:--vk-fg-subtle) hover:bg-(color:--vk-neutral-hovered) hover:text-(color:--vk-fg)"), children: words({ key: quick.key }) }, quick.key))) }), _jsx(Calendar, { locale: views.conventions.locale, ...(fill ? { className: "w-full" } : {}), value: (day ?? valid) ? toDayKey((day ?? valid)) : null, onChange: (picked) => {
261
+ chooseDay(quickDay(QUICK_DAYS[pick].offset));
262
+ }, className: cx(ELEMENT_RESET, "h-7 rounded-md bg-(color:--vk-neutral) px-2 text-xs text-(color:--vk-fg-subtle) hover:bg-(color:--vk-neutral-hovered) hover:text-(color:--vk-fg)"), children: words({ key: QUICK_DAYS[pick].key }) }, pick))) }), _jsx(Calendar, { locale: views.conventions.locale, ...(fill ? { className: "w-full" } : {}), value: (day ?? valid) ? toDayKey((day ?? valid)) : null, onChange: (picked) => {
267
263
  const d = picked ? fromDayKey(picked) : null;
268
264
  if (d)
269
265
  chooseDay(d);
@@ -21,5 +21,7 @@ export declare const LocationEditor: import("react").ForwardRefExoticComponent<{
21
21
  /** How each part's box is drawn: `bare` for a popover's compact rows, `field` where the boxes stand on their
22
22
  * own (a phone's sheet), each in the app's field frame. Default `bare`. */
23
23
  chrome?: "bare" | "field";
24
+ /** The field's name, for an app's `PartsBody`. Default: the field's label. */
25
+ label?: string;
24
26
  onRequestClose: (reason: CloseReason) => void;
25
27
  } & import("react").RefAttributes<LocationEditorHandle>>;