viewkitjs 0.38.0 → 0.39.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 (184) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/MIGRATION.md +7 -0
  3. package/fields/dist/query/figure-kinds.d.ts +2 -2
  4. package/fields/dist/query/figure-kinds.js +3 -0
  5. package/fields/dist/query/figures.d.ts +5 -3
  6. package/fields/dist/query/figures.js +13 -0
  7. package/fields/docs/reference/query.md +3 -3
  8. package/package.json +1 -1
  9. package/postgres/docs/guides/field-map.md +1 -1
  10. package/views/dist/atoms/HeaderChrome.d.ts +7 -0
  11. package/views/dist/atoms/HeaderChrome.js +15 -0
  12. package/views/dist/atoms/ToolbarButton.d.ts +1 -1
  13. package/views/dist/atoms/ToolbarButton.js +2 -2
  14. package/views/dist/atoms/defaults.js +4 -0
  15. package/views/dist/atoms/types.d.ts +39 -2
  16. package/views/dist/contract.d.ts +19 -8
  17. package/views/dist/contract.js +37 -6
  18. package/views/dist/controls/field/looks.d.ts +1 -1
  19. package/views/dist/controls/field/looks.js +7 -3
  20. package/views/dist/controls/field/tokens.d.ts +4 -0
  21. package/views/dist/controls/field/tokens.js +1 -0
  22. package/views/dist/controls/field.css +33 -0
  23. package/views/dist/controls/filter-editor/block.d.ts +3 -1
  24. package/views/dist/controls/filter-editor/block.js +4 -3
  25. package/views/dist/controls/filter-editor/filter-editor.d.ts +13 -2
  26. package/views/dist/controls/filter-editor/filter-editor.js +45 -15
  27. package/views/dist/controls/filter-editor/how.d.ts +3 -1
  28. package/views/dist/controls/filter-editor/map-filter-body.js +5 -4
  29. package/views/dist/controls/filter-editor/map-rules.d.ts +2 -1
  30. package/views/dist/controls/filter-editor/map-rules.js +3 -3
  31. package/views/dist/controls/internal/menu-items.d.ts +2 -0
  32. package/views/dist/controls/internal/menu-items.js +1 -1
  33. package/views/dist/controls/internal/part-slot.d.ts +1 -1
  34. package/views/dist/controls/internal/part-slot.js +1 -1
  35. package/views/dist/controls/internal/row-actions.d.ts +33 -0
  36. package/views/dist/controls/internal/row-actions.js +28 -0
  37. package/views/dist/controls/menu/map-menu.js +1 -1
  38. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  39. package/views/dist/controls/popover/map-popover.js +2 -2
  40. package/views/dist/controls/sheet/map-sheet.js +9 -6
  41. package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
  42. package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
  43. package/views/dist/controls/sort-editor/sort-editor.js +41 -13
  44. package/views/dist/controls/text-editor.css +20 -0
  45. package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +1 -1
  46. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +2 -2
  47. package/views/dist/editors/EditorPanel.js +1 -1
  48. package/views/dist/field-row/FieldRow.js +38 -16
  49. package/views/dist/field-row/editors/RowChipsEditor.js +3 -1
  50. package/views/dist/field-row/editors/RowDateEditor.js +3 -1
  51. package/views/dist/field-row/editors/RowNameEditor.js +3 -1
  52. package/views/dist/field-row/editors/RowPlaceEditor.js +4 -2
  53. package/views/dist/field-row/editors/RowRangeEditor.js +3 -1
  54. package/views/dist/field-row/editors/RowRelationEditor.js +5 -2
  55. package/views/dist/field-row/editors/RowSelectEditor.js +3 -1
  56. package/views/dist/field-row/editors/RowTextEditor.d.ts +7 -1
  57. package/views/dist/field-row/editors/RowTextEditor.js +25 -4
  58. package/views/dist/field-row/editors/RowValueListEditor.js +4 -4
  59. package/views/dist/field-row/editors/row-place.d.ts +33 -0
  60. package/views/dist/field-row/editors/row-place.js +141 -0
  61. package/views/dist/field-row/field-row-button.d.ts +9 -6
  62. package/views/dist/field-row/field-row-button.js +3 -3
  63. package/views/dist/field-row/row-target.d.ts +4 -1
  64. package/views/dist/field-row/row-target.js +1 -1
  65. package/views/dist/grid/chrome/GridAggregateMenu.d.ts +12 -11
  66. package/views/dist/grid/chrome/GridAggregateMenu.js +4 -3
  67. package/views/dist/grid/chrome/GridFooter.d.ts +12 -4
  68. package/views/dist/grid/chrome/GridFooter.js +11 -9
  69. package/views/dist/grid/chrome/GridHeader.js +4 -3
  70. package/views/dist/grid/chrome/GridResizeHandle.d.ts +7 -3
  71. package/views/dist/grid/chrome/GridResizeHandle.js +2 -3
  72. package/views/dist/grid/chrome/GridTable.js +1 -1
  73. package/views/dist/grid/chrome/GridTableSurface.js +1 -1
  74. package/views/dist/grid/chrome/grid-body-place.d.ts +2 -4
  75. package/views/dist/grid/chrome/grid-body-place.js +4 -5
  76. package/views/dist/grid/chrome/grid-figure-value.js +10 -4
  77. package/views/dist/grid/chrome/grid-table-props.d.ts +11 -3
  78. package/views/dist/grid/grid.css +7 -3
  79. package/views/dist/internal/over-cell.d.ts +8 -0
  80. package/views/dist/internal/over-cell.js +5 -0
  81. package/views/dist/list/bar-keys.d.ts +5 -0
  82. package/views/dist/list/bar-keys.js +2 -0
  83. package/views/dist/list/bar-parts.d.ts +27 -0
  84. package/views/dist/list/bar-parts.js +38 -0
  85. package/views/dist/list/buttons/clear-save.d.ts +7 -0
  86. package/views/dist/list/buttons/clear-save.js +15 -0
  87. package/views/dist/list/buttons/customize.d.ts +28 -0
  88. package/views/dist/list/buttons/customize.js +31 -0
  89. package/views/dist/list/buttons/filter.d.ts +32 -0
  90. package/views/dist/list/buttons/filter.js +60 -0
  91. package/views/dist/list/buttons/new.d.ts +18 -0
  92. package/views/dist/list/buttons/new.js +9 -0
  93. package/views/dist/list/buttons/quick.d.ts +15 -0
  94. package/views/dist/list/buttons/quick.js +24 -0
  95. package/views/dist/list/buttons/search.d.ts +18 -0
  96. package/views/dist/list/buttons/search.js +17 -0
  97. package/views/dist/list/buttons/shared.d.ts +91 -0
  98. package/views/dist/list/buttons/shared.js +131 -0
  99. package/views/dist/list/buttons/sort-filter.d.ts +6 -0
  100. package/views/dist/list/buttons/sort-filter.js +16 -0
  101. package/views/dist/list/buttons/sort.d.ts +17 -0
  102. package/views/dist/list/buttons/sort.js +34 -0
  103. package/views/dist/list/buttons/views.d.ts +21 -0
  104. package/views/dist/list/buttons/views.js +36 -0
  105. package/views/dist/list/editor-menus.d.ts +13 -0
  106. package/views/dist/list/editor-menus.js +13 -0
  107. package/views/dist/list/index.d.ts +41 -0
  108. package/views/dist/list/index.js +19 -0
  109. package/views/dist/list/line.d.ts +55 -0
  110. package/views/dist/list/line.js +221 -0
  111. package/views/dist/list/pane-box.d.ts +6 -0
  112. package/views/dist/list/pane-box.js +15 -0
  113. package/views/dist/list/panels/customize.d.ts +8 -0
  114. package/views/dist/list/panels/customize.js +23 -0
  115. package/views/dist/list/panels/filter-bar.d.ts +12 -0
  116. package/views/dist/list/panels/filter-bar.js +67 -0
  117. package/views/dist/list/panels/filter.d.ts +8 -0
  118. package/views/dist/list/panels/filter.js +23 -0
  119. package/views/dist/list/panels/quick.d.ts +7 -0
  120. package/views/dist/list/panels/quick.js +16 -0
  121. package/views/dist/list/panels/shared.d.ts +25 -0
  122. package/views/dist/list/panels/shared.js +33 -0
  123. package/views/dist/list/panels/sort.d.ts +8 -0
  124. package/views/dist/list/panels/sort.js +19 -0
  125. package/views/dist/list/panels/views.d.ts +13 -0
  126. package/views/dist/list/panels/views.js +27 -0
  127. package/views/dist/list/ready.d.ts +35 -0
  128. package/views/dist/list/ready.js +7 -0
  129. package/views/dist/list/root-base.d.ts +17 -0
  130. package/views/dist/list/root-base.js +9 -1
  131. package/views/dist/list/root.js +2 -2
  132. package/views/dist/list/store.d.ts +19 -0
  133. package/views/dist/list/store.js +40 -1
  134. package/views/dist/list/toolbar-model.d.ts +95 -0
  135. package/views/dist/list/toolbar-model.js +177 -0
  136. package/views/dist/list/toolbar.js +140 -328
  137. package/views/dist/list/views-axis.js +15 -4
  138. package/views/dist/model/aggregates.d.ts +18 -8
  139. package/views/dist/model/aggregates.js +16 -22
  140. package/views/dist/panels/react/filter/FilterEditor.d.ts +3 -1
  141. package/views/dist/panels/react/filter/FilterEditor.js +2 -2
  142. package/views/dist/panels/react/filter/filter-body.d.ts +3 -1
  143. package/views/dist/panels/react/filter/filter-body.js +2 -2
  144. package/views/dist/panels/react/sort/SortEditor.d.ts +3 -1
  145. package/views/dist/panels/react/sort/SortEditor.js +4 -4
  146. package/views/dist/panels/react/toolbar/Toolbar.d.ts +80 -3
  147. package/views/dist/panels/react/toolbar/Toolbar.js +85 -52
  148. package/views/dist/panels/react/toolbar/ToolbarBarSorts.d.ts +9 -0
  149. package/views/dist/panels/react/toolbar/ToolbarBarSorts.js +57 -0
  150. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +4 -1
  151. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -2
  152. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +30 -0
  153. package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -1
  154. package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
  155. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
  156. package/views/dist/panels/react/toolbar/ToolbarViews.d.ts +7 -1
  157. package/views/dist/panels/react/toolbar/ToolbarViews.js +4 -4
  158. package/views/dist/panels/react/toolbar/sheet-host.d.ts +3 -0
  159. package/views/dist/panels/react/toolbar/sheet-host.js +6 -0
  160. package/views/dist/panels/react/toolbar/use-give-way.d.ts +6 -0
  161. package/views/dist/panels/react/toolbar/use-give-way.js +8 -1
  162. package/views/dist/panels/react/views-row/ViewPicker.d.ts +8 -1
  163. package/views/dist/panels/react/views-row/ViewPicker.js +12 -7
  164. package/views/dist/panels/settings/filter-groups.js +7 -0
  165. package/views/dist/provider/components.d.ts +36 -2
  166. package/views/dist/react.d.ts +1 -1
  167. package/views/dist/styles.css +104 -1
  168. package/views/dist/styles.unlayered.css +104 -1
  169. package/views/docs/contract.md +20 -12
  170. package/views/docs/controls/field.md +1 -0
  171. package/views/docs/controls/filter-editor.md +1 -1
  172. package/views/docs/controls/menu.md +1 -1
  173. package/views/docs/controls/sort-editor.md +1 -1
  174. package/views/docs/guides/atoms.md +1 -0
  175. package/views/docs/guides/the-grid.md +2 -2
  176. package/views/docs/reference/controls.md +3 -3
  177. package/views/docs/reference/field-row.md +1 -1
  178. package/views/docs/reference/grid.md +4 -4
  179. package/views/docs/reference/list.md +168 -6
  180. package/views/docs/reference/looks.md +1 -1
  181. package/views/docs/reference/panels-react.md +7 -7
  182. package/views/docs/reference/react.md +13 -10
  183. package/views/docs/reference/views.md +8 -6
  184. package/views/skills/views/SKILL.md +2 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,75 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.39.0] — 2026-12-05
9
+
10
+ ### Added
11
+
12
+ - `viewkitjs/views`: `menus.sortEditor` and `menus.filterEditor` reshape the buttons at a rule's end (`ctx.menu: "row"`: hide ×, ⋮ or ⋯, add your own beside them) and at the editors' feet (`foot`: drop Add sort, Add filter, Clear or Delete group, add your own), in every form; your buttons draw as `vk-sort-row-action`, `vk-sort-foot-action`, `vk-filter-row-action` and `vk-filter-foot-action`, with `data-key`. An app that hands nothing draws as before.
13
+ - `viewkitjs/views/field-row`: the Field's Open (`row-open`: `below`, `over`; `data-field-row-open="over"` on any frame round the rows). Under `over`, on a computer, every popover editor a record's field row opens (a select, a status, a person or a record, a date, tags, a place, a name, a range, several values) stands on top of the row's box: its first line (the search, the typed date, the first value, the first box) with its words exactly where the value's words were, at least as wide as the box and covering it, nothing under it moving, and no jump as it opens. Your `Popover` is handed a negative `sideOffset`, an `alignOffset` and a `style.minWidth`, so your own Popover places it the same way. A phone keeps its sheets. With nothing set, every editor opens under its value as before.
14
+ - `viewkitjs/views/field-row`: the Field's Long (`row-long`: `full`, `line`; `data-field-row-long="line"` on any frame round the rows). Under `line`, a record's field row outside a card draws a writable long text or rich text as one line at rest, its end fading (a mask, never "…"), so one description no longer makes a record uneven, and a writable text that would wrap keeps to one line ending in "…", so it keeps its height as it is typed in. On a computer, a press on the long text opens its editor on top of the row's box: a textarea in your `Popover`, placed as the Field's Open places a body (whatever `row-open` says), its first line exactly where the words were, growing down over the rows below up to `--vk-editor-max-h`, then scrolling; nothing under it moves and it doesn't jump as it opens. Its keys are a long text's: Enter is a new line, ⌘/Ctrl+Enter and a press outside save, Escape throws the edit away. The row keeps its value under the popover, as a picker's does. A phone keeps its box in place. A read-only long text still reads in full. With nothing set, a long text reads in full and edits in place as before.
15
+ - `viewkitjs/views/field-row`: the Field's Link (`row-link`: `beside`, `words`; `data-field-row-link="words"` on any frame round the rows). Under `words`, a record's writable field row holding one url, email, phone or domain draws its words as the link itself: a press on them opens a url in a new page, an email in a mail and a phone in a call, and a press on the rest of its box edits it in place, its words where they were under the Field's Box. The open action beside the box isn't drawn. The box (the row's button, named by the field alone) is one Tab stop, its Enter edits, and the link is the next. Under the Field's Action (`row-action: icon`) its icon is ✎ (`edit`), shown, with the box's hover, whether the pointer is on the words or past them (on the words, the hover ViewKit's own Button draws; an app's own Button shows its hover past them). A phone's Field rows card keeps its rows as they were. A server-rendered row draws `beside` until it is alive. With nothing set, a link's words edit and its action beside opens it, as before.
16
+ - `viewkitjs/views/looks`: the Field's look `attio`, Attio's record rows in one pick: no type icon (`row-icon: off`), one box for a row's hover, its press, its in-place input and the place a picker opens from (`row-box: box`), the icon of what a click does at the box's end (`row-action: icon`), every picker on top of the box (`row-open: over`), a long text one fading line at rest (`row-long: line`) and a link's words opening it (`row-link: words`), the card's own picks unchanged. Wear it with one call on the frame round a record's rows, so every record drawer and record page changes together: `<section {...lookAttrs(FIELD_LOOKS, lookPicks(FIELD_LOOKS, "attio"))}>`. A phone keeps its Field rows card and its sheets. Nothing changes for an app that doesn't wear it.
17
+ - `viewkitjs/views/list`: the ready toolbar's buttons as parts you place anywhere: `ListViews`, `ListSearch`, `ListSort`, `ListFilter`, `ListQuickFilters`, `ListCustomize`, `ListSortFilter`, `ListClearSave` and `ListNew` (each with its `…Props`). Written under a `ListRoot`, or through a `ListFill` in your page header, each reads and changes the list with nothing wired, as the ready toolbar's own button does; each panel is its own in the root's radio (`list-sort`, `list-filter`, `list-customize`, `list-quick`). With nothing placed, `<List />` and `ListToolbar` draw exactly as before.
18
+ - `viewkitjs/views/list`: what a placed button opens, `opens` (`ListOpens`): `popover` (the default), `pane` (your map's Pane in the root's new `ListPaneBox`), `sheet`, or a function of your own, called with the button; on `ListSort` and `ListFilter` also `bar`, a picked rule standing on the filter bar `ListToolbar` draws. `empty` on `ListSort` and `ListFilter`: `fields` (the default) or `editor`, the editor saying nothing sorts or filters yet, with Add. `words` (`ListWords`: `both`, `icon`, `word`) on every worded button, each default as today; `ListSearch` `shows="input"` stands as a field; `ListViews` `shows="button"` is one button naming the open view.
19
+ - `viewkitjs/views/list`: `ListPaneBox` (`ListPaneBoxProps`), the box round your grid where a placed button's Pane stands.
20
+ - `viewkitjs/views/list`: `ListState`'s `panels.placed` (what stands under the root, counted) and `panels.barOpen` (the filter bar asked open by Sort and filter), with `place(key)` and `setBarOpen(open)`.
21
+ - `viewkitjs/views`: the filter and sort editors' computer forms take `empty` (`"fields"`, the default, or `"editor"`: with nothing set, they say so over Add filter or Add sort, and stay open as the last rule goes); so do `ViewsFilterBodyProps` and `ViewsSortBodyProps` (a body of your own that ignores it draws as before), `ToolbarFilterAdd` and `ToolbarSortPill`, which also takes `fieldsOnly`.
22
+ - `viewkitjs/views`: `ViewsToolbarButtonProps` takes `expanded` (`aria-expanded`, for a button that shows and hides a part of the page rather than opening a popup) and the part `sort-filter`.
23
+ - A new message key, `views.panels.sort-filter`: "Sort and filter".
24
+ - `viewkitjs/views/list`: the ready toolbar's panels as parts you stand anywhere under a `ListRoot` (or through a `ListFill`): `ListViewsPanel`, `ListFilterPanel`, `ListSortPanel`, `ListQuickFiltersPanel`, `ListCustomizePanel` and `ListFilterBar` (each with its `…Props`). Each stands open where you write it, reading and changing the list as its button's popover does, with `shows` (`ListPanelShows`): `always`, `filled` (once it holds something) or `button` (while its button shows it, with a ✕).
25
+ - `viewkitjs/views/list`: a placed button whose panel is placed under the same root shows that panel, points to it (the focus) or hides it, and opens no popover; `ListViews` so with `shows="button"`.
26
+ - `viewkitjs/views/list`: `ListFilterBar` takes `sorts`: `no` (the sort pill while the sort differs) or `yes`, each sort rule standing on the bar as its field, its direction and ×, edited in place, Add sort with none and no sort editor. `shows="button"` stands while `ListSortFilter` holds it open. Placed, `ListToolbar` leaves its bar's sort and filters to it.
27
+ - `viewkitjs/views/list`: `ListState`'s `panels.shown` and `panels.standing`, with `setShown(key, shown)` and `stand(key, stands)`.
28
+ - `viewkitjs/views/list`: `opens="bar"` on `ListSort` and `ListFilter` asks a bar standing by its button open as it opens, and says it has no bar to stand on at its press, not as it mounts.
29
+ - `viewkitjs/views/panels/react`: `ViewPicker` and `ToolbarViews` take `press` (`{ onPress, expanded, lit? }`): the chip calls it and opens no list, for a views list standing elsewhere.
30
+ - `viewkitjs/fields/query`: three figure kinds, `empty`, `percentEmpty` and `percentFilled` (`FigureKind`, `FIGURE_KINDS`): how many of a column's values are empty, and the empty and the filled each as a whole percent of the rows. `figureFor` reads them from a group's rows and `filled`, and answers none of them from an answer that carries no `filled`; `figureOfValues` works them out over the rows in hand. A saved view may store them as a column's `figure`.
31
+ - `viewkitjs/views`: `aggregateWord(kind, messages?)`, a figure's word after its value in the footer, and `AggregatePlace`, `{ first }`, the place `aggregateOptions` and `resolveAggregateKind` now take as their last argument.
32
+ - A new message key, `views.grid.figure-word` (`{ kind }`): the word after a footer figure's value: "count", "empty", "filled", "sum", "average", "min", "max", "unique", "ratio"; a percent's "empty" or "filled"; none for `none`.
33
+ - `viewkitjs/views/list`: `ListLine` and `ListGap` (with `ListLineProps` and `ListGapProps`), lines of your own written with the toolbar's parts. A line stands its parts in the order you write them, the first gap splitting its start from its end, and folds them as the ready toolbar's line folds as it narrows: words to icons, then the views' tabs into "+N", then the filter bar's filters into "+N filters", then into ⋯. `kind="bar"` is a filter bar's line. Every placed part folds in a line as it does in the ready toolbar's row, and `ListFilterBar` written in one stands its pieces as the line's items.
34
+ - `ListViews` takes `menu` (a view's menu as data) and `moreViews` (the views' "+N" as you draw it), as the ready toolbar's `menus.view` and `moreViews`.
35
+ - `ListCustomize` takes `menu`: Customize's rows as data, as the ready toolbar's `menus.customize`.
36
+ - `ListLine` takes `more` (⋯'s rows as data) and `overflow` (⋯ as you draw it), as the ready toolbar's `menus.more` and `overflow`; ⋯ stays one element, open, as the parts in a line change.
37
+ - `ListEditorMenus`: the sort, filter and group editors' menus as data for every part under it.
38
+ - `viewkitjs/views`: the components map's `Popover` is handed `finalFocus`, the twin of `initialFocus`: false moves no focus as the popup closes, because what opened it hands the focus back itself. A field row's editor hands it false. A `Popover` of your own should forward it to its popup's return of focus; one that doesn't keeps working as before.
39
+ - `viewkitjs/views/grid`: `GridMenus.figure`, `(items, { column, group, current }) => items`: a footer cell's calculation picker as data, reshaped by your function (`menu.drop`, `menu.rename`, `menu.add`, `menu.move`), its rows keyed by their figure.
40
+ - `viewkitjs/views`: every row ViewKit's own Menu draws carries its item's key as `data-key`, also where the menu names no slot (it then draws no `data-slot`). The calculation picker is `data-slot="vk-grid-figure-menu"`, each of its rows named by that and `-row`, `data-key` its figure.
41
+ - `viewkitjs/views`: three atoms draw a grid header cell's chrome your own way: `HeaderGlyph` (the column's type glyph before its name, handed the column's `columnId`, `type` and `fieldKey`, ViewKit's own glyph as `fallback` and the `className` it draws with), `HeaderSortMark` (a sorted column's mark after its name where the grid's `sortMark` is on, handed `dir`) and `HeaderResizeHandle` (what the resize handle shows, handed `active` while the column is resized). The cell, its menu, its drag to reorder and the handle's grab zone stay ViewKit's, so sorting from a header, dragging it and resizing it work with yours; a handle of your own that reaches past the zone still resizes from a press anywhere on it. Their props are `ViewsHeaderGlyphProps`, `ViewsHeaderSortMarkProps` and `ViewsHeaderResizeHandleProps`, from `viewkitjs/views/react`. Handed none, the header draws exactly as before.
42
+
43
+ ### Changed
44
+
45
+ - `viewkitjs/views`: `menus.sortEditor` and `menus.filterEditor` are now also called with `ctx.menu` `row` and `foot`. A function that drops `delete` (or `more`, `add`, `clear`) without checking `ctx.menu` now also hides the sort's ×, a filter group's Delete or the foot's buttons, making rules unremovable; one that adds or renames rows without checking it now adds a button at every rule's end and foot, or renames each rule's ×; a `switch (ctx.menu)` that lists every case gains two. Check `ctx.menu`.
46
+ - `viewkitjs/views/field-row`: each row editor's body now stands in a `display: contents` span inside its popover or sheet, at every width and with or without the Field's Open. It changes no layout; a selector that reads the panel's direct child sees the span.
47
+ - `viewkitjs/views/grid`: the footer's cells are right-aligned on every column, whatever the column's alignment, in every look.
48
+ - `viewkitjs/views/grid`: under Figures Value first, the empty cell's offer ("+ Add calculation") is drawn at the rows' text size in the subtlest colour, and a result reads its value then its word ("13 count"), both at the rows' size. Word first keeps its small capitals before the value.
49
+ - `viewkitjs/views/grid`: the offer stays shown while its cell's picker is open, and a narrow column cuts it at its right edge ("+ Add calc") instead of wrapping.
50
+ - `viewkitjs/views/grid`: the footer draws a line under itself in every look, not only with `verticalBorders`, and a pinned footer draws a line along its top while rows pass under it (at rest the last row's own line stands above it).
51
+ - `viewkitjs/views/grid`: `pinFooter` on a computer sticks the footer to the area's foot but never pushes it below its last row: under a table shorter than the area it now stands right after the last row, where it used to stand at the area's foot. A phone's pinned footer still stands at the foot. A grouped grid's footers behave as before.
52
+ - `viewkitjs/views`: what a footer column offers. Before: a number Sum, Avg, Min, Max and Count; any other column Count, Filled and Unique. Now: the first column Count alone; every other column Count empty, Count filled, Percent empty and Percent filled; a number and money also Sum, Average, Min and Max; a percent never sums and keeps its Ratio where it declares one. On a source list the four counts are offered on a column bound to a field (a pick asks your service for that key's figures, which carry `filled`).
53
+ - `viewkitjs/views`: a pick a column no longer offers reads None and stays stored: a Count saved on any column but the first, a Unique, and on whichever column is now first (a reader hid or moved the name) any pick but Count. A column's declared `defaultAggregate` or `footerKinds` naming those reads the same: a declared Count off the first column or a declared Unique shows None, and a column whose `footerKinds` leaves nothing but None draws no picker. A Filled saved off the first column keeps showing, now worded "Count filled".
54
+ - `views.grid.figure`'s English: "Avg" is "Average" and "Filled" is "Count filled"; the three new kinds read "Count empty", "Percent empty" and "Percent filled". The footer's label now reads `views.grid.figure-word`, so under Word first a figure reads "AVERAGE", "EMPTY" where it read "AVG", "FILLED". `views.grid.figure-pick` reads "Add calculation" (was "Calculate").
55
+ - A `Record<FigureKind, …>` of yours (your catalog's words, say) needs the three new keys.
56
+ - The tarball: its unpacked size budget rises from 11560 kB to 11600 kB, for the footer's figures, words and docs on top of this release's other growth.
57
+ - `viewkitjs/views/grid`: the footer's calculation picker opens above its cell with its right edge on the cell's, on every column, where it used to follow the column's alignment.
58
+ - `viewkitjs/views/list`: every part placed under one root reads one model of the list, built once for each change of what it reads, and `ListToolbar` builds its own model only when something it reads changes; a filter tree works out each field's values once.
59
+ - The tarball's unpacked budget is 11620 kB (from 11560): the lines and their reference add about 19 kB unpacked, beside what the release's other changes add.
60
+ - `ListToolbar` and `<List />` are put together from the parts you can place yourself, in lines of their own, and draw as before: a fix to a part reaches the default toolbar.
61
+ - A rule held for the filter bar until whole (from a Filter with `opens="bar"`) while a bar standing by its button is hidden opens that bar.
62
+ - `viewkitjs/views/panels/react`'s size budget is raised to 175 kB and the tarball's to 11640 kB: `ReadyToolbar` now draws the list's parts.
63
+ - `viewkitjs/views`: a filter rule on a related record's field names it in its `data-key` as the relation and the field joined by a dot, `company.industry`, where it held the two joined by a NUL character, which no stylesheet could select. A selector or test that named the old value names the new one: `[data-key="company.industry"]`. `FilterField` (`viewkitjs/views/controls`) takes an optional `key`, the `data-key` a rule on it draws; absent, its `value`, as before.
64
+ - The size budget for the tarball is raised from 11640 to 11670 kB unpacked: the release fold adds each version's notes to the shipped `CHANGELOG.md` after `main` has measured it, and 0.39.0's notes (about 20 kB) took the release past 11640 kB.
65
+ - `viewkitjs/views/controls`: `PartSlot`'s `slot` is optional (`slot?: string`), and `menuEntries` keys every entry (`slot: { key }`) whether or not it is handed a `rowSlot`. A renderer of yours that reads `entry.slot.slot` now reads `string | undefined`: draw `data-slot` only when it holds one.
66
+
67
+ ### Fixed
68
+
69
+ - `viewkitjs/views/field-row`: under the Field's Action (`row-action: icon`), a long text typed in place keeps the icon's room at its box's end, so its lines break where they did at rest.
70
+ - `viewkitjs/views/field-row`: a long value in a writable row asked for one line (`wrap: false`) no longer runs under the row's own action or past its box (VK-981). What the app's Button wraps the words in now shrinks with the box, and the value ends in its "…" before the action beside a link, before ✎ under the Field's Link, and at the box's end otherwise (a long text, a name). A long link that wraps wraps before its action. Rows whose value fits draw as before, and a select's tag keeps its own cut.
71
+ - `viewkitjs/views/field-row`: on a computer, while a record's field row has a picker open (a select, a status, a person or a record, a date, several values), the value it keeps in its place stands in the row's own button's box: its words no longer drop 2-3px and move 1px left, and the row no longer grows 4-6px, so the rows below it stay put. A popover opening under the value now opens 8px under the row's box, where it opened up to 14px under it. Under the Field's Open (`row-open: over`) the editor's first line lands where the value's words were and nothing under it moves, with or without the Field's Box. The edge is read off your `Button` as the editor opens, so a ghost Button with no border and one with a 1px border both keep their place.
72
+ - `viewkitjs/views/field-row`: on a computer, under the Field's Long (`row-long: line`) without the Field's Box, a long text's editor now covers the row's box whole when your `Button` draws a border: its edge no longer shows 1px of the value under it along the editor's left and top. The editor's text box stands as far in from the popover's edge as your Button's border, so its words still land where the value's words were, and it still stops at `--vk-editor-max-h`; a ghost Button with no border is placed as before.
73
+ - `viewkitjs/views`: a field row's editor closed by Escape gives the focus back to its row. Before, the focus could land on something pressed earlier, such as another row whose editor a press elsewhere had closed.
74
+ - `viewkitjs/views/controls`: in a Field rows card on a phone, a row asked for one line (`opts.wrap: false`) cuts a long value with "…" before its ›. Before, the value ran under the › and past the card's edge.
75
+ - `viewkitjs/views/controls`: `CONTROLS.Sheet` stands where what opened it stands, as the Select's and the Menu's sheets do: inside a phone's screen a page draws (`PhoneHost`), else inside the popup host round it. Before, a field row's editor opened from a row in such a screen rose over the whole window.
76
+
8
77
  ## [0.38.0] — 2026-12-04
9
78
 
10
79
  ### Added
package/MIGRATION.md CHANGED
@@ -803,6 +803,13 @@ The panels: quick filters, set-aside rules, dragging:
803
803
  | `views.panels.filter-fieldless` | Not a field of this list; a view cannot filter on it. |
804
804
  | `views.panels.toolbar-row` | List tools |
805
805
  | `views.panels.toolbar-bar` | Sort and filters |
806
+ | `views.panels.sort-filter` | Sort and filter |
807
+
808
+ The grid's footer:
809
+
810
+ | Key | English |
811
+ | --- | --- |
812
+ | `views.grid.figure-word` | The word after a footer figure's value, by `{ kind }`: count, empty, filled, sum, average, min, max, unique, ratio |
806
813
 
807
814
  The field row in a Field rows card, holding nothing:
808
815
 
@@ -1,7 +1,7 @@
1
1
  /** The footer picks, as `model/column-schema.ts` names them (`ListAggregateKind`). */
2
- export type FigureKind = "none" | "sum" | "avg" | "min" | "max" | "count" | "filled" | "unique" | "ratio";
2
+ export type FigureKind = "none" | "sum" | "avg" | "min" | "max" | "count" | "filled" | "empty" | "percentEmpty" | "percentFilled" | "unique" | "ratio";
3
3
  /** The figures a column may ask for: every kind but none. */
4
- export declare const FIGURE_KINDS: readonly ["sum", "avg", "min", "max", "count", "filled", "unique", "ratio"];
4
+ export declare const FIGURE_KINDS: readonly ["sum", "avg", "min", "max", "count", "filled", "empty", "percentEmpty", "percentFilled", "unique", "ratio"];
5
5
  /** A figure after the list's first: the total under one column, named by its id. */
6
6
  export type ListGroupFigurePart = `total:${string}`;
7
7
  /** The figures a group header can carry: its count, and its totals. `total` is the list's FIRST figure, named after
@@ -5,6 +5,9 @@ export const FIGURE_KINDS = [
5
5
  "max",
6
6
  "count",
7
7
  "filled",
8
+ "empty",
9
+ "percentEmpty",
10
+ "percentFilled",
8
11
  "unique",
9
12
  "ratio",
10
13
  ];
@@ -26,8 +26,9 @@ export declare function figureOf(values: readonly (number | null | undefined)[])
26
26
  /**
27
27
  * The number a figure shows, read from a group's figures, or null for nothing to show. It agrees with
28
28
  * `figureOfValues` over the same rows: over no values, sum, avg, min and max are null; Count is the group's rows;
29
- * Filled is the values present (`filled`, or the numbers present for an answer that doesn't carry it). Unique and
30
- * Ratio are not the database's to answer.
29
+ * Filled is the values present (`filled`, or the numbers present for an answer that doesn't carry it); Empty and the
30
+ * two percents read `filled` against the rows, and answer nothing where the answer carries no `filled` (counted
31
+ * numbers say nothing of a text's empty values). Unique and Ratio are not the database's to answer.
31
32
  */
32
33
  export declare function figureFor(kind: FigureKind, figures: GroupFigures, key: string): number | null;
33
34
  /**
@@ -57,7 +58,8 @@ export declare function figureNumber(value: unknown, field?: FieldDef): number |
57
58
  * having one and unique as the set of their keys; a place, a name and a phone by their text (a list of them value by
58
59
  * value); a range with neither end set as blank, and unique by its two ends; a person, a related record or an actor
59
60
  * unique by its key, as an option's count keys it; anything else as it is, a blank not filled. Sum, average, smallest and largest read the numbers, a blank
60
- * not a zero. None and Ratio answer null here: a ratio reads two columns (`ratioOf`).
61
+ * not a zero. Empty is how many values aren't filled, and Percent empty and Percent filled each count over all of them,
62
+ * whole, none over no values. None and Ratio answer null here: a ratio reads two columns (`ratioOf`).
61
63
  */
62
64
  export declare function figureOfValues(kind: FigureKind, values: readonly unknown[], reading: FigureReading): number | null;
63
65
  /** Sum over sum, as a whole percent (0–100, rounded): each pair a row's numerator and denominator, a blank counted
@@ -30,6 +30,15 @@ export function figureOf(values) {
30
30
  }
31
31
  return figure;
32
32
  }
33
+ const isEmptyOrPercent = (kind) => kind === "empty" || kind === "percentEmpty" || kind === "percentFilled";
34
+ function emptyOrPercent(kind, rows, filled) {
35
+ const empty = Math.max(0, rows - filled);
36
+ if (kind === "empty")
37
+ return empty;
38
+ if (rows === 0)
39
+ return null;
40
+ return Math.round(((kind === "percentEmpty" ? empty : filled) / rows) * 100);
41
+ }
33
42
  export function figureFor(kind, figures, key) {
34
43
  if (kind === "none" || kind === "unique" || kind === "ratio")
35
44
  return null;
@@ -40,6 +49,8 @@ export function figureFor(kind, figures, key) {
40
49
  return null;
41
50
  if (kind === "filled")
42
51
  return figure.filled ?? figure.count;
52
+ if (isEmptyOrPercent(kind))
53
+ return figure.filled === undefined ? null : emptyOrPercent(kind, figures.rows, figure.filled);
43
54
  if (figure.count === 0)
44
55
  return null;
45
56
  if (kind === "sum")
@@ -115,6 +126,8 @@ export function figureOfValues(kind, values, reading) {
115
126
  return null;
116
127
  if (kind === "count")
117
128
  return values.length;
129
+ if (isEmptyOrPercent(kind))
130
+ return emptyOrPercent(kind, values.length, figureOfValues("filled", values, reading) ?? 0);
118
131
  if (kind === "filled" || kind === "unique") {
119
132
  const type = reading.type;
120
133
  if (reading.multiple && isMultipleType(type)) {
@@ -306,7 +306,7 @@ What a list asks its server for, and what comes back, checked the same way in th
306
306
  - `ListDensity` — the density every view shares: `compact`, `default` or `spacious`. Each view spends it its own way.
307
307
  - `partKey` — an id and one part joined: a column id (a column state, a Filter row) or a field key (Sort, Group), `::`, then the part.
308
308
  - `parsePartKey` — splits a key at its last separator: `{ id }` for a whole value, `{ id, part }` for a part.
309
- - `FigureKind` — the footer picks: `none`, `sum`, `avg`, `min`, `max`, `count`, `filled`, `unique` or `ratio`.
309
+ - `FigureKind` — the footer picks: `none`, `sum`, `avg`, `min`, `max`, `count`, `filled`, `empty`, `percentEmpty`, `percentFilled`, `unique` or `ratio`.
310
310
  - `FIGURE_KINDS` — the figures a column may ask for: every kind but none.
311
311
  - `ListGroupFigurePart` — a figure after the list's first in a group header: `total:` and a column id.
312
312
  - `ListGroupSummaryPart` — one figure a group header can carry: `count`, `total` (the list's first figure) or a `ListGroupFigurePart` for each figure after it.
@@ -331,7 +331,7 @@ What a list asks its server for, and what comes back, checked the same way in th
331
331
 
332
332
  - `NumberFigureKind` — the four figures that add numbers: sum, average, smallest and largest.
333
333
  - `FigureReading` — what a column's values are, for its figure: their type, whether each holds several values, and the field they belong to, so a breakdown totals by its headline.
334
- - `figureOfValues` — one column's figure over one set of rows' values, as a grid shows it: the count of values, the filled and the different ones read as a person reads them (several values by their keys, a place, a name or a phone by its text, a range by its two ends and one with neither end set as blank, a person, a related record or an actor by its key), and the sum, average, smallest and largest of the numbers, a blank not a zero. Null for none, for a ratio, and for numbers over no values.
334
+ - `figureOfValues` — one column's figure over one set of rows' values, as a grid shows it: the count of values, the filled and the different ones read as a person reads them (several values by their keys, a place, a name or a phone by its text, a range by its two ends and one with neither end set as blank, a person, a related record or an actor by its key), how many aren't filled and each as a whole percent of the values (none over no values), and the sum, average, smallest and largest of the numbers, a blank not a zero. Null for none, for a ratio, and for numbers over no values.
335
335
  - `figureOfNumbers` — the sum, average, smallest or largest of some numbers; null over none.
336
336
  - `figureNumber` — a value read as a number for a figure: a finite number, or text that reads as one, a breakdown by its headline; null for anything else (a list, a yes/no, blank text), never a zero.
337
337
  - `ratioOf` — sum over sum as a whole percent, from each row's numerator and denominator, a blank counted as nothing; null when the denominators add up to nothing.
@@ -341,7 +341,7 @@ What a list asks its server for, and what comes back, checked the same way in th
341
341
  - `combineFigure` — two parts' figures as the figure of both, exactly, a missing value never a zero; `filled` adds each side's own, or its count where it carries none.
342
342
  - `figureOf` — the figure of some numbers, a blank not counted.
343
343
  - `figuresOf` — each key's figure over some rows, read through the reader, in the shape a database answers, its `filled` counted as `figureOfValues` counts Filled; a key the reader does not know answers the empty figure.
344
- - `figureFor` — the number a figure shows, read from a group's figures, agreeing with `figureOfValues` over the same rows (Filled reading `filled`, else the count); null where there is nothing to show, and for unique and ratio, which a database does not answer this way.
344
+ - `figureFor` — the number a figure shows, read from a group's figures, agreeing with `figureOfValues` over the same rows (Filled reading `filled`, else the count; Empty the rows less `filled`, and Percent empty and Percent filled that count over the rows, whole, none of the three from an answer that carries no `filled`); null where there is nothing to show, and for unique and ratio, which a database does not answer this way.
345
345
  - `ratioFigure` — a ratio from its two parts' figures: sum over sum as a whole percent, divided once; null when either part was not totalled or the denominator is empty.
346
346
  - `isGroupFigures` — says whether a value has the shape of `GroupFigures`.
347
347
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewkitjs",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "description": "ViewKit — typed fields, the grid and its editors, and a list's SQL for record lists, in one package: viewkitjs/fields, viewkitjs/views and viewkitjs/postgres. By Sheaf.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -656,7 +656,7 @@ A value is grouped as it is kept and turned into text only once grouped, so noth
656
656
 
657
657
  ## Figures
658
658
 
659
- **`figuresQuery`** works out what a list shows under its columns, over the rows its filter and search keep, as fields' `figuresOf` does: the rows it counted, and per field in `keys`, of any type, the sum, the count of numbers present, the smallest and the largest (a number field's; null, 0, null and null for any other), and `filled`, its values present as fields' Filled counts them. An average and a filled count follow from those with fields' `figureFor`; unique and ratio are not the database's to answer.
659
+ **`figuresQuery`** works out what a list shows under its columns, over the rows its filter and search keep, as fields' `figuresOf` does: the rows it counted, and per field in `keys`, of any type, the sum, the count of numbers present, the smallest and the largest (a number field's; null, 0, null and null for any other), and `filled`, its values present as fields' Filled counts them. An average, a filled count, an empty count and the two percents follow from those with fields' `figureFor`; unique and ratio are not the database's to answer.
660
660
 
661
661
  ```ts
662
662
  import { figuresQuery } from "viewkitjs/postgres";
@@ -0,0 +1,7 @@
1
+ import type { ViewsHeaderGlyphProps, ViewsHeaderResizeHandleProps, ViewsHeaderSortMarkProps } from "./types.js";
2
+ /** ViewKit's own glyph for the column, as it is. */
3
+ export declare function DefaultHeaderGlyph({ fallback }: ViewsHeaderGlyphProps): import("react/jsx-runtime").JSX.Element;
4
+ /** The provider's sort arrow, the way the list sorts by the column. */
5
+ export declare function DefaultHeaderSortMark({ dir, className }: ViewsHeaderSortMarkProps): import("react/jsx-runtime").JSX.Element;
6
+ /** A hairline in the brand's colour on the cell's edge, shown under the pointer and while the column is resized. */
7
+ export declare function DefaultHeaderResizeHandle({ active }: ViewsHeaderResizeHandleProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
+ import { cx } from "../internal/cx.js";
4
+ import { useViews } from "../provider/context.js";
5
+ export function DefaultHeaderGlyph({ fallback }) {
6
+ return _jsx(_Fragment, { children: fallback });
7
+ }
8
+ export function DefaultHeaderSortMark({ dir, className }) {
9
+ const { icons } = useViews();
10
+ const Mark = dir === "asc" ? icons.sortAsc : icons.sortDesc;
11
+ return _jsx(Mark, { className: className });
12
+ }
13
+ export function DefaultHeaderResizeHandle({ active }) {
14
+ return (_jsx("div", { className: cx("absolute inset-y-0 right-0 w-[3px] rounded-full bg-(color:--vk-brand)", active ? "opacity-100" : "opacity-0 group-hover/gridresize:opacity-100") }));
15
+ }
@@ -1,2 +1,2 @@
1
1
  import type { ViewsToolbarButtonProps } from "./types.js";
2
- export declare function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, className, onContextMenu, onClick, onPointerDown, ref, }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, expanded, current, part, className, onContextMenu, onClick, onPointerDown, ref, }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,7 @@ import { ELEMENT_RESET } from "../internal/reset.js";
6
6
  import { useViews } from "../provider/context.js";
7
7
  import { isFramePart } from "./frame-parts.js";
8
8
  const flag = (on) => (on ? "" : undefined);
9
- export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, className, onContextMenu, onClick, onPointerDown, ref, }) {
9
+ export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, expanded, current, part, className, onContextMenu, onClick, onPointerDown, ref, }) {
10
10
  const { messages, icons } = useViews();
11
11
  const Chevron = icons.chevronDown;
12
12
  const chevron = part === "views-chip" || part === "views-more";
@@ -14,7 +14,7 @@ export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, o
14
14
  const reasoned = !!disabled && !!disabledReason;
15
15
  const worded = children != null && !iconAlone;
16
16
  const shownMore = iconAlone ? undefined : more;
17
- const button = (describedBy) => (_jsxs("span", { className: cx("relative inline-flex shrink-0", worded && "min-w-0 max-w-full"), children: [_jsxs("button", { ref: ref, type: "button", "aria-describedby": describedBy, "aria-label": worded ? undefined : label, "aria-haspopup": popup, "aria-expanded": popup ? Boolean(open) : undefined, "aria-disabled": reasoned ? true : undefined, disabled: disabled && !reasoned, "aria-current": current ? "true" : undefined, "data-slot": isFramePart(part) ? PART_SLOT[part] : "vk-toolbar-button", "data-tab": current !== undefined ? "" : undefined, "data-current": flag(current), "data-open": flag(open), "data-changed": flag(changed), "data-edge": flag(edge), "data-disabled": flag(disabled), "data-empty": flag(empty), "data-icon-alone": flag(iconAlone), "data-aside": flag(aside), "data-foot": flag(foot), "data-joined": joined, "data-waits": flag(waits), onClick: reasoned ? (event) => event.preventDefault() : onClick, onPointerDown: reasoned ? undefined : onPointerDown, onContextMenu: reasoned ? undefined : onContextMenu, className: cx(ELEMENT_RESET, "inline-flex shrink-0 items-center justify-center transition-colors duration-150", joined ? JOINED_CLASS[joined] : "rounded-full", worded && "min-w-0 max-w-full", foot
17
+ const button = (describedBy) => (_jsxs("span", { className: cx("relative inline-flex shrink-0", worded && "min-w-0 max-w-full"), children: [_jsxs("button", { ref: ref, type: "button", "aria-describedby": describedBy, "aria-label": worded ? undefined : label, "aria-haspopup": popup, "aria-expanded": popup ? Boolean(open) : expanded, "aria-disabled": reasoned ? true : undefined, disabled: disabled && !reasoned, "aria-current": current ? "true" : undefined, "data-slot": isFramePart(part) ? PART_SLOT[part] : "vk-toolbar-button", "data-tab": current !== undefined ? "" : undefined, "data-current": flag(current), "data-open": flag(open), "data-changed": flag(changed), "data-edge": flag(edge), "data-disabled": flag(disabled), "data-empty": flag(empty), "data-icon-alone": flag(iconAlone), "data-aside": flag(aside), "data-foot": flag(foot), "data-joined": joined, "data-waits": flag(waits), onClick: reasoned ? (event) => event.preventDefault() : onClick, onPointerDown: reasoned ? undefined : onPointerDown, onContextMenu: reasoned ? undefined : onContextMenu, className: cx(ELEMENT_RESET, "inline-flex shrink-0 items-center justify-center transition-colors duration-150", joined ? JOINED_CLASS[joined] : "rounded-full", worded && "min-w-0 max-w-full", foot
18
18
  ? "h-11 w-11"
19
19
  : worded || shownMore
20
20
  ? cx("gap-1.5 px-3", size === "sm" ? "h-8" : "h-9")
@@ -5,6 +5,7 @@ import { DefaultCheckRow, DefaultChoiceRow, DefaultDirectionButton, DefaultRadio
5
5
  import { DefaultPanelSearch } from "./PanelSearch.js";
6
6
  import { DefaultPill } from "./Pill.js";
7
7
  import { DefaultList } from "./List.js";
8
+ import { DefaultHeaderGlyph, DefaultHeaderResizeHandle, DefaultHeaderSortMark } from "./HeaderChrome.js";
8
9
  import { DefaultLoading } from "./Loading.js";
9
10
  import { DefaultLoadMore } from "./LoadMore.js";
10
11
  import { DefaultPlatformMark } from "./PlatformMark.js";
@@ -50,4 +51,7 @@ export const DEFAULT_VIEWS_ATOMS = {
50
51
  Pill: DefaultPill,
51
52
  RangeCalendar: DefaultRangeCalendar,
52
53
  ToolbarButton: DefaultToolbarButton,
54
+ HeaderGlyph: DefaultHeaderGlyph,
55
+ HeaderSortMark: DefaultHeaderSortMark,
56
+ HeaderResizeHandle: DefaultHeaderResizeHandle,
53
57
  };
@@ -1,5 +1,5 @@
1
1
  import type { ComponentType, HTMLAttributes, KeyboardEvent, MouseEventHandler, MouseEvent as ReactMouseEvent, PointerEvent as ReactPointerEvent, ReactElement, ReactNode, Ref, RefObject } from "react";
2
- import type { LinkPlatform, RelationValue } from "viewkitjs/fields";
2
+ import type { LinkPlatform, RelationValue, ValueType } from "viewkitjs/fields";
3
3
  import type { CategoryColor } from "viewkitjs/fields/design/category-colors";
4
4
  import type { StatusSlot } from "viewkitjs/fields/design/status-slots";
5
5
  import type { FieldRowMenuItem } from "../fields/menus.js";
@@ -198,6 +198,37 @@ export type ViewsCellMoreProps = {
198
198
  count: number;
199
199
  inert: boolean;
200
200
  };
201
+ /** A grid header cell's type glyph (VK-999), drawn before the column's name where ViewKit's own stood. The default draws
202
+ * `fallback`, ViewKit's own glyph for the column (its `icon`, its binding's, its field's mark, else its type's; null
203
+ * where it has none), so with nothing handed the header is as it was. Yours draws your own glyph, by the column's
204
+ * `type` or `fieldKey`, or wraps the fallback; `className` is what ViewKit's own draws with (its size,
205
+ * `--vk-head-glyph`, its colour and its opacity). The cell, its menu and its drag stay ViewKit's. */
206
+ export type ViewsHeaderGlyphProps = {
207
+ columnId: string;
208
+ /** The column's list type, where it has one: a field's value type, or `title`. */
209
+ type?: ValueType | "title";
210
+ /** The key of the field the column draws, where it draws one. */
211
+ fieldKey?: string;
212
+ fallback: ReactNode;
213
+ className: string;
214
+ };
215
+ /** A sorted column's mark in its header (VK-999), drawn after its name where the grid's `sortMark` is on and the list
216
+ * sorts by the column, inside ViewKit's own `aria-hidden` box: the cell's `aria-sort` says the sort. The default draws
217
+ * the provider's `icons.sortAsc` or `icons.sortDesc` with `className`. Draw nothing to show no mark. */
218
+ export type ViewsHeaderSortMarkProps = {
219
+ columnId: string;
220
+ dir: "asc" | "desc";
221
+ className: string;
222
+ };
223
+ /** What a header cell's resize handle shows (VK-999), drawn inside ViewKit's grab zone at the cell's right edge
224
+ * (`data-slot="vk-grid-resize-handle"`), which keeps the press, the drag, the double-click that resets the width and
225
+ * the menu kept shut. The default is a hairline in `--vk-brand`, shown while the pointer is over the zone or while
226
+ * `active`. Yours may reach past the zone: a press on it still resizes. */
227
+ export type ViewsHeaderResizeHandleProps = {
228
+ columnId: string;
229
+ /** True while this column is being resized. */
230
+ active: boolean;
231
+ };
201
232
  /** A wait: the whole list reloading (`body`), or more rows arriving (`footer`). The default is a
202
233
  * plain ring; an app swaps in its own loader. */
203
234
  export type ViewsLoadingProps = {
@@ -495,6 +526,9 @@ export type ViewsToolbarButtonProps = {
495
526
  size: "md" | "sm";
496
527
  /** Set when it opens a popup: `aria-haspopup`, and `aria-expanded` from `open`. */
497
528
  popup?: "menu" | "dialog";
529
+ /** It shows and hides a part of the page rather than opening a popup (VK-1091: Sort and filter, the filter bar):
530
+ * `aria-expanded`, whether that part shows. */
531
+ expanded?: boolean;
498
532
  /** A view tab: one of a row where one is open. `true`, the open one, `aria-current="true"`. */
499
533
  current?: boolean;
500
534
  /** Which of the toolbar's buttons it stands for (VK-984): every button the toolbar draws hands one, named after the
@@ -519,7 +553,7 @@ export type ViewsToolbarButtonProps = {
519
553
  export type ViewsFramePart = "views-chip" | "views-tab" | "views-more" | "views-add" | "clear" | "save";
520
554
  /** Which of the toolbar's buttons a `ToolbarButton` stands for (VK-984): the frame's parts, and every other button by the
521
555
  * key of the place it stands in, or, a place's second kind of button, by a name of its own. */
522
- export type ViewsToolbarButtonPart = ViewsFramePart | "options" | "search" | "quick" | "new" | "sort" | "filter" | "filter-add" | "filters" | "advanced-filters" | "sort-pill" | "sort-add" | "more-filters" | "more";
556
+ export type ViewsToolbarButtonPart = ViewsFramePart | "options" | "search" | "quick" | "new" | "sort" | "filter" | "filter-add" | "filters" | "advanced-filters" | "sort-pill" | "sort-add" | "more-filters" | "sort-filter" | "more";
523
557
  export type ViewsAtoms = {
524
558
  List: ComponentType<ViewsListProps>;
525
559
  Row: ComponentType<ViewsRowProps>;
@@ -570,4 +604,7 @@ export type ViewsAtoms = {
570
604
  Pill: ComponentType<ViewsPillProps>;
571
605
  RangeCalendar: ComponentType<ViewsRangeCalendarProps>;
572
606
  ToolbarButton: ComponentType<ViewsToolbarButtonProps>;
607
+ HeaderGlyph: ComponentType<ViewsHeaderGlyphProps>;
608
+ HeaderSortMark: ComponentType<ViewsHeaderSortMarkProps>;
609
+ HeaderResizeHandle: ComponentType<ViewsHeaderResizeHandleProps>;
573
610
  };