viewkitjs 0.21.0 → 0.23.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 (237) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/MIGRATION.md +1 -1
  3. package/README.md +1 -1
  4. package/fields/dist/conventions.d.ts +15 -3
  5. package/fields/dist/conventions.js +25 -0
  6. package/fields/dist/design/category-colors.d.ts +12 -5
  7. package/fields/dist/design/category-colors.js +7 -7
  8. package/fields/dist/query/buckets.js +42 -35
  9. package/fields/dist/query/date.js +2 -13
  10. package/fields/docs/guides/conventions.md +1 -1
  11. package/fields/docs/guides/options.md +2 -1
  12. package/fields/docs/reference/design-category-colors.md +2 -2
  13. package/fields/docs/reference/fields.md +1 -1
  14. package/package.json +13 -1
  15. package/views/dist/atoms/tones.js +7 -7
  16. package/views/dist/contract.d.ts +6 -1
  17. package/views/dist/contract.js +1 -0
  18. package/views/dist/controls/atoms.d.ts +8 -0
  19. package/views/dist/controls/atoms.js +8 -0
  20. package/views/dist/controls/button/button.d.ts +40 -0
  21. package/views/dist/controls/button/button.js +40 -0
  22. package/views/dist/controls/button/looks.d.ts +4 -0
  23. package/views/dist/controls/button/looks.js +20 -0
  24. package/views/dist/controls/button/map-button.d.ts +11 -0
  25. package/views/dist/controls/button/map-button.js +20 -0
  26. package/views/dist/controls/button/own-look.d.ts +59 -0
  27. package/views/dist/controls/button/own-look.js +33 -0
  28. package/views/dist/controls/button/tokens.d.ts +351 -0
  29. package/views/dist/controls/button/tokens.js +90 -0
  30. package/views/dist/controls/button.css +530 -0
  31. package/views/dist/controls/checkbox/checkbox.d.ts +28 -0
  32. package/views/dist/controls/checkbox/checkbox.js +15 -0
  33. package/views/dist/controls/checkbox/looks.d.ts +3 -0
  34. package/views/dist/controls/checkbox/looks.js +8 -0
  35. package/views/dist/controls/checkbox/map-checkbox.d.ts +2 -0
  36. package/views/dist/controls/checkbox/map-checkbox.js +5 -0
  37. package/views/dist/controls/checkbox/tokens.d.ts +131 -0
  38. package/views/dist/controls/checkbox/tokens.js +35 -0
  39. package/views/dist/controls/checkbox.css +133 -0
  40. package/views/dist/controls/controls.d.ts +14 -0
  41. package/views/dist/controls/controls.js +14 -0
  42. package/views/dist/controls/field/field.d.ts +94 -0
  43. package/views/dist/controls/field/field.js +46 -0
  44. package/views/dist/controls/field/looks.d.ts +13 -0
  45. package/views/dist/controls/field/looks.js +22 -0
  46. package/views/dist/controls/field/tokens.d.ts +75 -0
  47. package/views/dist/controls/field/tokens.js +21 -0
  48. package/views/dist/controls/field.css +98 -0
  49. package/views/dist/controls/glass-button/glass-button.d.ts +40 -0
  50. package/views/dist/controls/glass-button/glass-button.js +16 -0
  51. package/views/dist/controls/glass-button/looks.d.ts +4 -0
  52. package/views/dist/controls/glass-button/looks.js +4 -0
  53. package/views/dist/controls/glass-button/tokens.d.ts +127 -0
  54. package/views/dist/controls/glass-button/tokens.js +34 -0
  55. package/views/dist/controls/glass-button.css +111 -0
  56. package/views/dist/controls/index.d.ts +37 -0
  57. package/views/dist/controls/index.js +31 -0
  58. package/views/dist/controls/inline-input/inline-input.d.ts +14 -0
  59. package/views/dist/controls/inline-input/inline-input.js +10 -0
  60. package/views/dist/controls/inline-input/looks.d.ts +3 -0
  61. package/views/dist/controls/inline-input/looks.js +16 -0
  62. package/views/dist/controls/inline-input/tokens.d.ts +79 -0
  63. package/views/dist/controls/inline-input/tokens.js +22 -0
  64. package/views/dist/controls/inline-input.css +78 -0
  65. package/views/dist/controls/input/autofill.d.ts +25 -0
  66. package/views/dist/controls/input/autofill.js +17 -0
  67. package/views/dist/controls/input/input.d.ts +119 -0
  68. package/views/dist/controls/input/input.js +127 -0
  69. package/views/dist/controls/input/looks.d.ts +41 -0
  70. package/views/dist/controls/input/looks.js +48 -0
  71. package/views/dist/controls/input/map-input.d.ts +2 -0
  72. package/views/dist/controls/input/map-input.js +5 -0
  73. package/views/dist/controls/input/tokens.d.ts +171 -0
  74. package/views/dist/controls/input/tokens.js +45 -0
  75. package/views/dist/controls/input.css +381 -0
  76. package/views/dist/controls/internal/anchor.d.ts +16 -0
  77. package/views/dist/controls/internal/anchor.js +8 -0
  78. package/views/dist/controls/internal/close-reason.d.ts +5 -0
  79. package/views/dist/controls/internal/close-reason.js +2 -0
  80. package/views/dist/controls/internal/popup-host.d.ts +7 -0
  81. package/views/dist/controls/internal/popup-host.js +10 -0
  82. package/views/dist/controls/internal/scroll.d.ts +11 -0
  83. package/views/dist/controls/internal/scroll.js +14 -0
  84. package/views/dist/controls/kbd/kbd.d.ts +13 -0
  85. package/views/dist/controls/kbd/kbd.js +10 -0
  86. package/views/dist/controls/kbd/looks.d.ts +4 -0
  87. package/views/dist/controls/kbd/looks.js +4 -0
  88. package/views/dist/controls/kbd/tokens.d.ts +47 -0
  89. package/views/dist/controls/kbd/tokens.js +14 -0
  90. package/views/dist/controls/kbd.css +46 -0
  91. package/views/dist/controls/number-field/number-field.d.ts +48 -0
  92. package/views/dist/controls/number-field/number-field.js +34 -0
  93. package/views/dist/controls/number-field/tokens.d.ts +47 -0
  94. package/views/dist/controls/number-field/tokens.js +14 -0
  95. package/views/dist/controls/number-field.css +54 -0
  96. package/views/dist/controls/option/atom-tag.d.ts +6 -0
  97. package/views/dist/controls/option/atom-tag.js +6 -0
  98. package/views/dist/controls/option/looks.d.ts +7 -0
  99. package/views/dist/controls/option/looks.js +21 -0
  100. package/views/dist/controls/option/option.d.ts +35 -0
  101. package/views/dist/controls/option/option.js +32 -0
  102. package/views/dist/controls/option/tokens.d.ts +223 -0
  103. package/views/dist/controls/option/tokens.js +58 -0
  104. package/views/dist/controls/option.css +92 -0
  105. package/views/dist/controls/phone-header/header-bar.d.ts +18 -0
  106. package/views/dist/controls/phone-header/header-bar.js +9 -0
  107. package/views/dist/controls/phone-header/looks.d.ts +4 -0
  108. package/views/dist/controls/phone-header/looks.js +4 -0
  109. package/views/dist/controls/phone-header/soft-edge.d.ts +5 -0
  110. package/views/dist/controls/phone-header/soft-edge.js +3 -0
  111. package/views/dist/controls/phone-header/tokens.d.ts +59 -0
  112. package/views/dist/controls/phone-header/tokens.js +17 -0
  113. package/views/dist/controls/phone-header.css +51 -0
  114. package/views/dist/controls/popover/looks.d.ts +4 -0
  115. package/views/dist/controls/popover/looks.js +10 -0
  116. package/views/dist/controls/popover/map-popover.d.ts +3 -0
  117. package/views/dist/controls/popover/map-popover.js +5 -0
  118. package/views/dist/controls/popover/popover.d.ts +74 -0
  119. package/views/dist/controls/popover/popover.js +106 -0
  120. package/views/dist/controls/popover/tokens.d.ts +83 -0
  121. package/views/dist/controls/popover/tokens.js +23 -0
  122. package/views/dist/controls/popover.css +94 -0
  123. package/views/dist/controls/scrollbar/scrollbar.d.ts +10 -0
  124. package/views/dist/controls/scrollbar/scrollbar.js +143 -0
  125. package/views/dist/controls/scrollbar/tokens.d.ts +43 -0
  126. package/views/dist/controls/scrollbar/tokens.js +13 -0
  127. package/views/dist/controls/scrollbar.css +47 -0
  128. package/views/dist/controls/sheet/bottom-sheet.d.ts +98 -0
  129. package/views/dist/controls/sheet/bottom-sheet.js +372 -0
  130. package/views/dist/controls/sheet/forms.d.ts +38 -0
  131. package/views/dist/controls/sheet/forms.js +26 -0
  132. package/views/dist/controls/sheet/looks.d.ts +4 -0
  133. package/views/dist/controls/sheet/looks.js +10 -0
  134. package/views/dist/controls/sheet/map-sheet.d.ts +3 -0
  135. package/views/dist/controls/sheet/map-sheet.js +12 -0
  136. package/views/dist/controls/sheet/spring.d.ts +22 -0
  137. package/views/dist/controls/sheet/spring.js +48 -0
  138. package/views/dist/controls/sheet/tokens.d.ts +143 -0
  139. package/views/dist/controls/sheet/tokens.js +38 -0
  140. package/views/dist/controls/sheet.css +220 -0
  141. package/views/dist/controls/smooth.css +101 -0
  142. package/views/dist/controls/spinner/looks.d.ts +4 -0
  143. package/views/dist/controls/spinner/looks.js +32 -0
  144. package/views/dist/controls/spinner/spinner.d.ts +23 -0
  145. package/views/dist/controls/spinner/spinner.js +16 -0
  146. package/views/dist/controls/spinner/tokens.d.ts +55 -0
  147. package/views/dist/controls/spinner/tokens.js +16 -0
  148. package/views/dist/controls/spinner.css +147 -0
  149. package/views/dist/controls/status/atom-status-badge.d.ts +10 -0
  150. package/views/dist/controls/status/atom-status-badge.js +13 -0
  151. package/views/dist/controls/status/looks.d.ts +4 -0
  152. package/views/dist/controls/status/looks.js +22 -0
  153. package/views/dist/controls/status/marks.d.ts +26 -0
  154. package/views/dist/controls/status/marks.js +73 -0
  155. package/views/dist/controls/status/status.d.ts +43 -0
  156. package/views/dist/controls/status/status.js +26 -0
  157. package/views/dist/controls/status/tokens.d.ts +407 -0
  158. package/views/dist/controls/status/tokens.js +104 -0
  159. package/views/dist/controls/status.css +164 -0
  160. package/views/dist/controls/switch/looks.d.ts +4 -0
  161. package/views/dist/controls/switch/looks.js +19 -0
  162. package/views/dist/controls/switch/switch.d.ts +15 -0
  163. package/views/dist/controls/switch/switch.js +11 -0
  164. package/views/dist/controls/switch/tokens.d.ts +139 -0
  165. package/views/dist/controls/switch/tokens.js +37 -0
  166. package/views/dist/controls/switch.css +169 -0
  167. package/views/dist/controls/tag/atom-cell-more.d.ts +3 -0
  168. package/views/dist/controls/tag/atom-cell-more.js +5 -0
  169. package/views/dist/controls/tag/looks.d.ts +4 -0
  170. package/views/dist/controls/tag/looks.js +4 -0
  171. package/views/dist/controls/tag/tag.d.ts +25 -0
  172. package/views/dist/controls/tag/tag.js +19 -0
  173. package/views/dist/controls/tag/tokens.d.ts +63 -0
  174. package/views/dist/controls/tag/tokens.js +18 -0
  175. package/views/dist/controls/tag.css +81 -0
  176. package/views/dist/controls/toggle/looks.d.ts +3 -0
  177. package/views/dist/controls/toggle/looks.js +12 -0
  178. package/views/dist/controls/toggle/toggle.d.ts +47 -0
  179. package/views/dist/controls/toggle/toggle.js +23 -0
  180. package/views/dist/controls/toggle/tokens.d.ts +55 -0
  181. package/views/dist/controls/toggle/tokens.js +16 -0
  182. package/views/dist/controls/toggle.css +67 -0
  183. package/views/dist/controls/tokens.d.ts +16 -0
  184. package/views/dist/controls/tokens.js +45 -0
  185. package/views/dist/controls/tooltip/looks.d.ts +4 -0
  186. package/views/dist/controls/tooltip/looks.js +4 -0
  187. package/views/dist/controls/tooltip/map-tooltip.d.ts +3 -0
  188. package/views/dist/controls/tooltip/map-tooltip.js +5 -0
  189. package/views/dist/controls/tooltip/tokens.d.ts +75 -0
  190. package/views/dist/controls/tooltip/tokens.js +21 -0
  191. package/views/dist/controls/tooltip/tooltip.d.ts +54 -0
  192. package/views/dist/controls/tooltip/tooltip.js +78 -0
  193. package/views/dist/controls/tooltip.css +94 -0
  194. package/views/dist/display/date.js +15 -2
  195. package/views/dist/grid/chrome/GridTable.js +21 -19
  196. package/views/dist/grid/chrome/grid-row-window.js +3 -0
  197. package/views/dist/grid/chrome/useGridColumnLayout.d.ts +4 -1
  198. package/views/dist/grid/chrome/useGridColumnLayout.js +17 -2
  199. package/views/dist/grid/chrome/useGridFittedWidths.d.ts +29 -0
  200. package/views/dist/grid/chrome/useGridFittedWidths.js +46 -0
  201. package/views/dist/looks/index.d.ts +17 -0
  202. package/views/dist/looks/index.js +17 -0
  203. package/views/dist/looks/looks.d.ts +2 -1
  204. package/views/dist/looks/pieces.js +37 -1
  205. package/views/dist/model/column-schema.d.ts +3 -2
  206. package/views/dist/model/column-state.d.ts +11 -1
  207. package/views/dist/model/column-state.js +8 -2
  208. package/views/dist/panels/react/views-row/FoldingViewRow.js +8 -8
  209. package/views/dist/styles.css +2748 -56
  210. package/views/dist/styles.unlayered.css +2765 -56
  211. package/views/docs/contract.md +39 -8
  212. package/views/docs/controls/button.md +93 -0
  213. package/views/docs/controls/checkbox.md +38 -0
  214. package/views/docs/controls/field.md +26 -0
  215. package/views/docs/controls/glass-button.md +37 -0
  216. package/views/docs/controls/inline-input.md +27 -0
  217. package/views/docs/controls/input.md +48 -0
  218. package/views/docs/controls/kbd.md +17 -0
  219. package/views/docs/controls/number-field.md +17 -0
  220. package/views/docs/controls/option.md +61 -0
  221. package/views/docs/controls/phone-header.md +20 -0
  222. package/views/docs/controls/popover.md +26 -0
  223. package/views/docs/controls/scrollbar.md +16 -0
  224. package/views/docs/controls/sheet.md +41 -0
  225. package/views/docs/controls/spinner.md +19 -0
  226. package/views/docs/controls/status.md +107 -0
  227. package/views/docs/controls/switch.md +40 -0
  228. package/views/docs/controls/tag.md +21 -0
  229. package/views/docs/controls/toggle.md +19 -0
  230. package/views/docs/controls/tooltip.md +24 -0
  231. package/views/docs/getting-started.md +1 -1
  232. package/views/docs/guides/the-provider.md +1 -1
  233. package/views/docs/index.md +1 -0
  234. package/views/docs/install.md +2 -0
  235. package/views/docs/reference/controls.md +207 -0
  236. package/views/docs/reference/looks.md +77 -2
  237. package/views/docs/reference/views.md +10 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,55 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.23.0] — 2026-11-25
9
+
10
+ viewkitjs/views/controls: the Option, the Tag, the Status and the Switch, their looks in viewkitjs/views/looks; CONTROL_ATOMS draws ViewKit's Tag, StatusBadge and CellMore atoms with them for an app that spreads it into its atoms.
11
+
12
+ ### Added
13
+
14
+ - `viewkitjs/views/controls`: the bottom Sheet (`Sheet`, `SheetHead`, `SheetBody`, `SheetFoot`, `SheetStep`, `SheetButton`, `SheetClose`, `useSheetCloseAll`, `STOPS`), with its forms, its stops and its spring, and the phone's header bar (`HeaderBar`) with the soft edge it stands on (`SoftEdge`), join the default controls, on Base UI. `CONTROLS` now also holds `Sheet`. Their stylesheets are `viewkitjs/views/controls/sheet.css` and `phone-header.css`, and the ready stylesheet carries them.
15
+ - `viewkitjs/views/looks`: `SHEET_LOOKS` and `PHONE_HEADER_LOOKS`, by the Outright kit's names.
16
+ - `viewkitjs/views/controls`: the Popover, the Tooltip (with `TooltipGroup`, `TooltipShown` and `TOOLTIP_TIMING`), the Kbd, the Glass button (with `GlassButtonGroup`) and the Scrollbar join the default controls, on Base UI; `POPUP_HOST` and `popupHostOf` name where a popup stands. `CONTROLS` now also holds `Popover` and `Tooltip`. Each control's stylesheet is `viewkitjs/views/controls/<piece>.css` (`popover`, `tooltip`, `kbd`, `glass-button`, `scrollbar`), every name it reads listed on its page under `docs/controls/`, and the ready stylesheet carries them.
17
+ - `viewkitjs/views/looks`: `POPOVER_LOOKS`, `TOOLTIP_LOOKS`, `KBD_LOOKS` and `GLASS_BUTTON_LOOKS`, each control's options by the Outright kit's names.
18
+ - `viewkitjs/views/controls`: the Input (with its InputGroup, addons, buttons and segments, and a box's own look), the inline input, the Field (with FieldSet, FieldSeparator and Field rows), the Toggle and its group, the number field and the Checkbox (with its mark and list), on Base UI, as the Outright kit draws them; and `useAutofill`, which turns the browser's and the password managers' filling off on a box.
19
+ - `CONTROLS` draws the components map's `Input` and `Checkbox`.
20
+ - Their options and looks on `viewkitjs/views/looks`: `INPUT_LOOKS`, `INLINE_INPUT_LOOKS`, `FIELD_LOOKS`, `TOGGLE_LOOKS`, `CHECKBOX_LOOKS`; a box's own look beside the Input's (`InputOwnLook`, `inputAttrs`, `inputOwnAttrs`, `inputFrameAttrs`, `kindLook`, `attioBox`) and a Field rows card's (`fieldRowsAttrs`, `FieldRowsLook`).
21
+ - `VK_CONTROL_TOKENS_BY_PIECE` and `ControlToken`: each default control's own list of the names its stylesheet reads, with each name's kind and the Outright token it stands for (`outright`). `VK_CONTROL_TOKENS` gathers them, once each.
22
+ - Each control's names, kinds, Outright tokens and defaults are on its own page, `views/docs/controls/<piece>.md`.
23
+
24
+ ### Changed
25
+
26
+ - `viewkitjs/views`: a column's `width` is optional. A grid column with no width of its own, and none the person or the saved view set, starts as wide as the values it first draws and its header need: never narrower than its header, at most 320 px, within the column's own `grid.minWidth` and `grid.maxWidth`. It keeps that width as rows scroll, load or change; a resize still wins, and a double-click on the handle goes back to it. On a phone the pinned columns with no width start at 160 px, so the rest of the row stays in view. A column that names a width is unchanged.
27
+ - The Sheet settles on the quick spring, with the smooth corner and the light dim where nothing is picked: My preset's picks, the Outright look's defaults.
28
+ - Where nothing says otherwise, the phone header's surface is Glass and two Glass buttons stand together on the pill, as their options' defaults say; only `data-phone-header-surface="flat"` or `data-glass-button-pair="separate"` set them apart.
29
+ - The default Popover's shadow is `md` and two Glass buttons share the glass pill unless something round them says `separate`: My preset's picks, the Outright look's defaults.
30
+ - The inline input's default is the Outright look's: the line, `md` corners, on a 20% tint of the brand (it was the `attio` look: `sm` corners on the overlay's ground). An app that picks none of its options, or only some, draws the new defaults for the rest.
31
+ - Their stylesheets, `viewkitjs/views/controls/{input,inline-input,field,toggle,number-field,checkbox}.css`, in the ready stylesheet too, and each one's tokens page under `views/docs/controls/`. Their phone rules hold below 640px, by the Outright Showcase's hooks (`o-phone`, `data-computer-host`), named in the controls' reference page.
32
+ - The number field's stepper gap is named with the addon it stands in (`.o-input-addon.o-number-steps`), so it wins over the addon's own gap whatever order the stylesheets load in.
33
+ - The controls' stylesheet doors are one pattern, `viewkitjs/views/controls/<piece>.css` (the outline's `smooth.css`, the Button's `button.css`, the Spinner's `spinner.css`), the same paths as before.
34
+
35
+ ## [0.22.0] — 2026-11-25
36
+
37
+ ### Added
38
+
39
+ - `viewkitjs/views/controls`: ViewKit's default controls, on Base UI. `CONTROLS` holds the components map's defaults, today the `Button`: spread it first and your own controls after, `components={{ ...CONTROLS, ...own }}`, and whatever you hand wins. It is the one door that needs `@base-ui/react`, a new optional peer (`^1.6.0`): an app that hands every control never imports it and never installs Base UI. The door also exports the `Button` itself (its kinds, sizes and forms, `loading`, icons and its own look), `ButtonGroup`, `ButtonGroupText`, `ButtonGroupSeparator`, `buttonClass`, `Spinner` and `LoadingBar`.
40
+ - The ready stylesheet (`viewkitjs/views/styles.css`) carries the controls. Every token they read is a new optional `--vk-*` name declared at the Outright look's value, light and dark, which an app declares to change ([the contract's controls' tokens](views/docs/contract.md#the-controls-tokens)). An app on the Outright tokens can instead import `viewkitjs/views/controls/smooth.css`, `button.css` and `spinner.css`, in that order, and declare each of those names as its own Outright token on the controls.
41
+ - `viewkitjs/views/looks`: the Button's options and looks (`BUTTON_LOOKS`: `classic`, `keycap`, `pill`, `soft-lift`) and the Spinner's (`SPINNER_LOOKS`, thirteen looks), listed in `LOOKS`. With nothing picked the Spinner is the tail and the loading bar's ends are soft, the Outright look's picks.
42
+
43
+ ### Changed
44
+
45
+ - A piece's looks: nothing picked wears each option's default, the Outright look's pick, which no look need match whole (it was the first look).
46
+ - `CATEGORY_COLOR_CLASSES`, from `viewkitjs/fields/design/category-colors`, draws the default Tag's pill: each hue's fill, its edge drawn inside, and its words a strong step, which read at 4.5:1 or more on their fill in every hue, light and dark (before, the hue's own words on its `-soft` rung, as low as 3.75:1 for red). The classes now read `--vk-label-<hue>-fill`, `--vk-label-<hue>-edge` and `--vk-label-<hue>-strong` in place of your theme's `label-<hue>` and `label-<hue>-soft` colours; undeclared, each comes from your `--vk-label-<hue>` (else ViewKit's own hue), mixed into `--vk-ground` and `--vk-fg`. An app with its own Tailwind that drew these chips from its `--label-*` tokens declares the three rungs, or at least `--vk-label-<hue>`, `--vk-ground` and `--vk-fg`, to keep its hues. Gray is unchanged.
47
+ - Before: `CATEGORY_COLOR_CLASSES.red` was `bg-label-red-soft text-label-red`.
48
+ - Now: the default Tag's red, word for word: a fill that reads `--vk-label-red-fill`, an inset edge that reads `--vk-label-red-edge` and words, typed as a colour, that read `--vk-label-red-strong`, each with the fallback above.
49
+
50
+ ### Fixed
51
+
52
+ - A views row whose tabs don't fit no longer makes its page scroll sideways. The hidden copy of the row it measures its tabs on, as wide as every tab together, now stands in a box that clips it; the row itself clips nothing, so a tab's focus ring and a tab being dragged are drawn whole. It folds the same tabs into "+N" as before.
53
+ - `viewkitjs/views`: a date or a moment mounts the app's `Tooltip` at the first mouse or pen move over it with no button down, where it mounted at the first pointerenter, and never inside a press. A press whose element was swapped for the tooltip's fired no click, so a list whose title is a date could miss its first click on a row: in Safari, every time the list was drawn under a resting pointer. The long form still shows on a resting pointer.
54
+ - A date filter's summary writes its month's word in the conventions' `language`, the language the interface reads in, while the day's order and digits keep `locale`: `{ locale: "ro", language: "en" }` reads "After 24 Nov 2026", where it read "After 24 nov. 2026". An app that states no `language` sees no change.
55
+ - A date group's heading, by day, week or month, and a relative or due grouping's month groups, write their month's word in the conventions' `language`, while the day's order and digits keep `locale`, as a date filter's summary does: `{ locale: "ro", language: "en" }` heads a month "November 2026" and a day "24 Nov 2026", where they read "noiembrie 2026" and "24 nov. 2026". An app that states no `language` sees no change.
56
+
8
57
  ## [0.21.0] — 2026-11-25
9
58
 
10
59
  ### Added
package/MIGRATION.md CHANGED
@@ -68,7 +68,7 @@ installs none of them.
68
68
  | `@viewkitjs/postgres/definitions` | `viewkitjs/postgres/definitions` |
69
69
 
70
70
  There is no `viewkitjs` entry on its own: every path names its part. A door added since, such as
71
- `viewkitjs/views/looks`, has no old path: an app starts on it under `viewkitjs`. The three `package.json` entries move the
71
+ `viewkitjs/views/looks` or `viewkitjs/views/controls`, has no old path: an app starts on it under `viewkitjs`. The three `package.json` entries move the
72
72
  same way (`@viewkitjs/fields/package.json` is `viewkitjs/package.json`, one manifest for all three parts).
73
73
 
74
74
  ## The names your app narrows
package/README.md CHANGED
@@ -8,7 +8,7 @@ ViewKit: typed fields, the grid and its editors, and a list's SQL, for record li
8
8
  pnpm add viewkitjs zod
9
9
  ```
10
10
 
11
- Add `react` and `react-dom` 19 for `viewkitjs/views/*`, and `@dnd-kit/core`, `@dnd-kit/sortable` and `@dnd-kit/utilities` for the panels' parts that drag in `viewkitjs/views/panels/react`. All five are optional peers: an app that uses only fields or postgres installs none of them. ESM only, Node 20 or later.
11
+ Add `react` and `react-dom` 19 for `viewkitjs/views/*`, and `@dnd-kit/core`, `@dnd-kit/sortable` and `@dnd-kit/utilities` for the panels' parts that drag in `viewkitjs/views/panels/react`, and `@base-ui/react` (1.6 or later) only to take ViewKit's default controls from `viewkitjs/views/controls`. All six are optional peers: an app that uses only fields or postgres installs none of them. ESM only, Node 20 or later.
12
12
 
13
13
  ## The parts
14
14
 
@@ -5,8 +5,9 @@ export type DecimalSeparator = "." | ",";
5
5
  export type ConventionsInput = {
6
6
  /** BCP 47. Drives text sort order and every date label. Default "en-GB". */
7
7
  locale?: string;
8
- /** BCP 47. The language the interface reads in: the names the library writes (a country's, a region's) are in
9
- * it, while dates, numbers and text order keep `locale`. Default: `locale`. */
8
+ /** BCP 47. The language the interface reads in: the names the library writes (a country's, a region's, the month
9
+ * of a date filter's summary and of a date group's heading) are in it, while dates' order and digits, numbers and
10
+ * text order keep `locale`. Default: `locale`. */
10
11
  language?: string;
11
12
  /** IANA zone. Which calendar day an instant falls on. Default "UTC". */
12
13
  timeZone?: string;
@@ -33,7 +34,8 @@ export type ConventionsOverrides = Omit<ConventionsInput, "decimal" | "region">
33
34
  };
34
35
  export type FieldConventions = {
35
36
  readonly locale: string;
36
- /** The names language: a country's and a region's names are written in it. `locale` when none was stated. */
37
+ /** The names language: a country's and a region's names, and the month of a date filter's summary and of a date
38
+ * group's heading, are written in it. `locale` when none was stated. */
37
39
  readonly language: string;
38
40
  readonly timeZone: string;
39
41
  readonly decimal?: DecimalSeparator;
@@ -59,3 +61,13 @@ export declare const DEFAULT_CONVENTIONS: FieldConventions;
59
61
  * is passed bare — `["contains"].map(textFilterOperatorLabel)` — and reads the
60
62
  * defaults instead of throwing. Internal: not exported from the package. */
61
63
  export declare function conventionsOr(cv: unknown): FieldConventions;
64
+ /** `day`: "24 Nov 2026"; `month`: "November 2026". */
65
+ export type DayStyle = "day" | "month";
66
+ /**
67
+ * A calendar day written for a person: its order and digits in `cv.locale`, its month's word in `cv.language`, the
68
+ * language the interface reads in. Romanian dates under an English interface read "24 Nov 2026" and "November 2026";
69
+ * with no language stated (it defaults to the locale), the locale writes it all. A date filter's summary and a date
70
+ * group's heading both write through here. A day is not an instant: it is formatted AS UTC so no zone can move it, and
71
+ * the caller hands it built as UTC midnight (`utcDay`). Not part of the package's surface.
72
+ */
73
+ export declare function writeDay(at: Date, style: DayStyle, cv: FieldConventions): string;
@@ -95,3 +95,28 @@ export function conventionsOr(cv) {
95
95
  ? cv
96
96
  : DEFAULT_CONVENTIONS;
97
97
  }
98
+ const DAY_FORMATS = new Map();
99
+ function formatIn(locale, style) {
100
+ const id = `${locale}|${style}`;
101
+ let format = DAY_FORMATS.get(id);
102
+ if (!format) {
103
+ format = new Intl.DateTimeFormat(locale, {
104
+ ...(style === "day" ? { day: "numeric", month: "short" } : { month: "long" }),
105
+ year: "numeric",
106
+ timeZone: "UTC",
107
+ });
108
+ DAY_FORMATS.set(id, format);
109
+ }
110
+ return format;
111
+ }
112
+ export function writeDay(at, style, cv) {
113
+ if (cv.language === cv.locale)
114
+ return formatIn(cv.locale, style).format(at);
115
+ const month = formatIn(cv.language, style)
116
+ .formatToParts(at)
117
+ .find((part) => part.type === "month")?.value;
118
+ return formatIn(cv.locale, style)
119
+ .formatToParts(at)
120
+ .map((part) => (part.type === "month" && month !== undefined ? month : part.value))
121
+ .join("");
122
+ }
@@ -1,10 +1,17 @@
1
1
  export type CategoryColor = "gray" | "blue" | "green" | "amber" | "red" | "purple" | "pink" | "teal";
2
2
  /**
3
- * Classes per colour — the label palette's `-soft` rung as the chip fill, the
4
- * colour itself as text. The palette is the host stylesheet's `--label-*`: eight fixed
5
- * hues, the same in every theme (a label's colour is the user's choice, not
6
- * the theme's), with the soft rung derived into the live background so the
7
- * chip reads on a dark theme too. No `dark:` variants for that reason.
3
+ * Classes per colour — the default Tag's pill: each hue's fill,
4
+ * its edge drawn inside and its words a strong step, 4.5:1 and more on the
5
+ * fill in every hue, light and dark. Each rung is a name an app may declare,
6
+ * `--vk-label-<hue>-fill`, `-edge` and `-strong`; undeclared, it is the app's
7
+ * own `--vk-label-<hue>` (else ViewKit's hue) mixed 15% and 40% into
8
+ * `--vk-ground` and 60% into `--vk-fg`, so an app that declares only its hues
9
+ * keeps them. The same strings as views' `TAG_TONE`, written out here because
10
+ * an app's Tailwind finds a class by its literal text in the files it scans;
11
+ * views' tag-contrast test holds the two equal and the ratios. The words carry
12
+ * the colour type hint, so an app's tailwind-merge doesn't read them as a font
13
+ * size and drop the chip's own size. Gray stays the
14
+ * muted ground with its muted words. No `dark:` variants: every name carries dark.
8
15
  */
9
16
  export declare const CATEGORY_COLOR_CLASSES: Record<CategoryColor, string>;
10
17
  /** Solid dot color per category color (for the reserved `dot` variant). */
@@ -1,12 +1,12 @@
1
1
  export const CATEGORY_COLOR_CLASSES = {
2
2
  gray: "bg-muted text-muted-foreground",
3
- blue: "bg-label-blue-soft text-label-blue",
4
- green: "bg-label-green-soft text-label-green",
5
- amber: "bg-label-amber-soft text-label-amber",
6
- red: "bg-label-red-soft text-label-red",
7
- purple: "bg-label-purple-soft text-label-purple",
8
- pink: "bg-label-pink-soft text-label-pink",
9
- teal: "bg-label-teal-soft text-label-teal",
3
+ blue: "bg-[var(--vk-label-blue-fill,color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-blue-edge,color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-blue-strong,color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_60%,var(--vk-fg)))]",
4
+ green: "bg-[var(--vk-label-green-fill,color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-green-edge,color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-green-strong,color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_60%,var(--vk-fg)))]",
5
+ amber: "bg-[var(--vk-label-amber-fill,color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-amber-edge,color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-amber-strong,color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_60%,var(--vk-fg)))]",
6
+ red: "bg-[var(--vk-label-red-fill,color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-red-edge,color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-red-strong,color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_60%,var(--vk-fg)))]",
7
+ purple: "bg-[var(--vk-label-purple-fill,color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-purple-edge,color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-purple-strong,color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_60%,var(--vk-fg)))]",
8
+ pink: "bg-[var(--vk-label-pink-fill,color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-pink-edge,color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-pink-strong,color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_60%,var(--vk-fg)))]",
9
+ teal: "bg-[var(--vk-label-teal-fill,color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-teal-edge,color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-teal-strong,color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_60%,var(--vk-fg)))]",
10
10
  };
11
11
  export const CATEGORY_DOT_CLASSES = {
12
12
  gray: "bg-description-foreground",
@@ -1,5 +1,5 @@
1
1
  import { localDay, utcDay } from "../codecs.js";
2
- import { DEFAULT_CONVENTIONS } from "../conventions.js";
2
+ import { DEFAULT_CONVENTIONS, writeDay } from "../conventions.js";
3
3
  import { isEmptyRange, isRangeValue, presetOf, rangeText } from "../range.js";
4
4
  import { actorKey, actorTypeOfKey, isActorValue } from "../actor.js";
5
5
  import { orderLinks, relationIdOf, relationKey } from "../relation.js";
@@ -25,27 +25,19 @@ function isLinkObject(v) {
25
25
  }
26
26
  export const UNCATEGORIZED_KEY = "";
27
27
  export const UNGROUPED_KEY = "_all";
28
- const LABELS = new Map();
29
- function labelFormat(cv, kind) {
30
- const id = `${cv.locale}|${kind}`;
31
- let format = LABELS.get(id);
32
- if (!format) {
33
- format = new Intl.DateTimeFormat(cv.locale, {
34
- ...(kind === "day" ? { day: "numeric", month: "short" } : { month: "long" }),
35
- year: "numeric",
36
- timeZone: "UTC",
37
- });
38
- LABELS.set(id, format);
39
- }
40
- return format;
41
- }
42
28
  const RELATIVE_BUCKET = {
43
- "rel:future": "future", "rel:today": "today", "rel:yesterday": "yesterday",
44
- "rel:last_7_days": "last_7_days", "rel:last_30_days": "last_30_days",
29
+ "rel:future": "future",
30
+ "rel:today": "today",
31
+ "rel:yesterday": "yesterday",
32
+ "rel:last_7_days": "last_7_days",
33
+ "rel:last_30_days": "last_30_days",
45
34
  };
46
35
  const DUE_BUCKET = {
47
- "due:overdue": "overdue", "due:today": "today", "due:tomorrow": "tomorrow",
48
- "due:next_7_days": "next_7_days", "due:next_30_days": "next_30_days",
36
+ "due:overdue": "overdue",
37
+ "due:today": "today",
38
+ "due:tomorrow": "tomorrow",
39
+ "due:next_7_days": "next_7_days",
40
+ "due:next_30_days": "next_30_days",
49
41
  };
50
42
  const FIRST_DAY = "0001-01-01";
51
43
  const LAST_DAY = "9999-12-31";
@@ -98,11 +90,16 @@ function relativeRange(key, today) {
98
90
  const monthsFrom = monthStart(today, -12);
99
91
  const windowsFrom = shiftDay(today, -30);
100
92
  switch (key) {
101
- case "rel:future": return { from: shiftDay(today, 1), to: LAST_DAY };
102
- case "rel:today": return { from: today, to: shiftDay(today, 1) };
103
- case "rel:yesterday": return { from: shiftDay(today, -1), to: today };
104
- case "rel:last_7_days": return { from: shiftDay(today, -7), to: shiftDay(today, -1) };
105
- case "rel:last_30_days": return { from: windowsFrom, to: shiftDay(today, -7) };
93
+ case "rel:future":
94
+ return { from: shiftDay(today, 1), to: LAST_DAY };
95
+ case "rel:today":
96
+ return { from: today, to: shiftDay(today, 1) };
97
+ case "rel:yesterday":
98
+ return { from: shiftDay(today, -1), to: today };
99
+ case "rel:last_7_days":
100
+ return { from: shiftDay(today, -7), to: shiftDay(today, -1) };
101
+ case "rel:last_30_days":
102
+ return { from: windowsFrom, to: shiftDay(today, -7) };
106
103
  }
107
104
  const month = /^rel:m:(\d{4}-\d{2})$/.exec(key)?.[1];
108
105
  if (month && fromDayKey(`${month}-01`)) {
@@ -118,11 +115,16 @@ function dueRange(key, today) {
118
115
  const monthsFrom = shiftDay(today, 31);
119
116
  const yearsFrom = monthStart(today, 13);
120
117
  switch (key) {
121
- case "due:overdue": return { from: FIRST_DAY, to: today };
122
- case "due:today": return { from: today, to: shiftDay(today, 1) };
123
- case "due:tomorrow": return { from: shiftDay(today, 1), to: shiftDay(today, 2) };
124
- case "due:next_7_days": return { from: shiftDay(today, 2), to: shiftDay(today, 8) };
125
- case "due:next_30_days": return { from: shiftDay(today, 8), to: monthsFrom };
118
+ case "due:overdue":
119
+ return { from: FIRST_DAY, to: today };
120
+ case "due:today":
121
+ return { from: today, to: shiftDay(today, 1) };
122
+ case "due:tomorrow":
123
+ return { from: shiftDay(today, 1), to: shiftDay(today, 2) };
124
+ case "due:next_7_days":
125
+ return { from: shiftDay(today, 2), to: shiftDay(today, 8) };
126
+ case "due:next_30_days":
127
+ return { from: shiftDay(today, 8), to: monthsFrom };
126
128
  }
127
129
  const month = /^due:m:(\d{4}-\d{2})$/.exec(key)?.[1];
128
130
  if (month && fromDayKey(`${month}-01`)) {
@@ -163,7 +165,7 @@ function dateLabel(_field, key, granularity = "month", cv = DEFAULT_CONVENTIONS)
163
165
  if (granularity === "relative" || granularity === "due") {
164
166
  const month = /^(?:rel|due):m:(\d{4})-(\d{2})$/.exec(key);
165
167
  if (month) {
166
- return labelFormat(cv, "month").format(utcDay(Number(month[1]), Number(month[2]), 1));
168
+ return writeDay(utcDay(Number(month[1]), Number(month[2]), 1), "month", cv);
167
169
  }
168
170
  const year = /^(?:rel|due):y:(\d{4})$/.exec(key)?.[1];
169
171
  if (year)
@@ -181,14 +183,14 @@ function dateLabel(_field, key, granularity = "month", cv = DEFAULT_CONVENTIONS)
181
183
  case "year":
182
184
  return String(y);
183
185
  case "month":
184
- return labelFormat(cv, "month").format(at);
186
+ return writeDay(at, "month", cv);
185
187
  case "week":
186
188
  return cv.messages({
187
189
  key: "group.week-of",
188
- values: { day: labelFormat(cv, "day").format(at) },
190
+ values: { day: writeDay(at, "day", cv) },
189
191
  });
190
192
  case "day":
191
- return labelFormat(cv, "day").format(at);
193
+ return writeDay(at, "day", cv);
192
194
  }
193
195
  }
194
196
  export function dateBucketRange(key, granularity, now = new Date(), cv = DEFAULT_CONVENTIONS) {
@@ -223,7 +225,10 @@ const byOption = {
223
225
  allKeys: (field) => optionValues(asOptionField(field)),
224
226
  };
225
227
  export const BUCKET_RULES = {
226
- select: { ...byOption, allKeys: (field) => (isOpenVocabulary(field) ? [] : optionValues(asOptionField(field))) },
228
+ select: {
229
+ ...byOption,
230
+ allKeys: (field) => (isOpenVocabulary(field) ? [] : optionValues(asOptionField(field))),
231
+ },
227
232
  status: {
228
233
  ...byOption,
229
234
  allKeys: (field) => statusOptionOrder(field),
@@ -295,7 +300,9 @@ export const BUCKET_RULES = {
295
300
  const preset = presetOf(def, v);
296
301
  if (preset)
297
302
  return preset.key;
298
- return isRangeValue(v) && !isEmptyRange(v) ? `${v.low ?? ""}–${v.high ?? ""}` : UNCATEGORIZED_KEY;
303
+ return isRangeValue(v) && !isEmptyRange(v)
304
+ ? `${v.low ?? ""}–${v.high ?? ""}`
305
+ : UNCATEGORIZED_KEY;
299
306
  },
300
307
  labelOf: (field, key, _g, cv = DEFAULT_CONVENTIONS) => {
301
308
  if (key === UNCATEGORIZED_KEY)
@@ -1,5 +1,5 @@
1
1
  import { localDay, utcDay } from "../codecs.js";
2
- import { DEFAULT_CONVENTIONS, conventionsOr } from "../conventions.js";
2
+ import { DEFAULT_CONVENTIONS, conventionsOr, writeDay, } from "../conventions.js";
3
3
  export const DATE_FILTER_OPERATORS = [
4
4
  { value: "is", label: "Is", dates: 1 },
5
5
  { value: "is_not", label: "Is not", dates: 1 },
@@ -168,22 +168,11 @@ export function isDateRuleActive(rule) {
168
168
  return false;
169
169
  return dates === 1 || !!rule.to;
170
170
  }
171
- const SHORT_DAY = new Map();
172
171
  function short(key, cv) {
173
172
  const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(key);
174
173
  if (!match || !fromDayKey(key))
175
174
  return key;
176
- let format = SHORT_DAY.get(cv.locale);
177
- if (!format) {
178
- format = new Intl.DateTimeFormat(cv.locale, {
179
- day: "numeric",
180
- month: "short",
181
- year: "numeric",
182
- timeZone: "UTC",
183
- });
184
- SHORT_DAY.set(cv.locale, format);
185
- }
186
- return format.format(utcDay(Number(match[1]), Number(match[2]), Number(match[3])));
175
+ return writeDay(utcDay(Number(match[1]), Number(match[2]), Number(match[3])), "day", cv);
187
176
  }
188
177
  export function dateRuleLabel(rule, cv = DEFAULT_CONVENTIONS) {
189
178
  cv = conventionsOr(cv);
@@ -102,7 +102,7 @@ assert.equal(
102
102
 
103
103
  ## `language`
104
104
 
105
- The language is a BCP 47 tag too: the language your interface reads in. The names the library writes from data are in it, a place's country and region, while dates, numbers and the order text sorts in keep `locale`. So an app that writes its dates the Romanian way in an English interface states both. Unstated, it is `locale`, and `.with({ locale })` moves it along until you state one.
105
+ The language is a BCP 47 tag too: the language your interface reads in. The names the library writes from data are in it, a place's country and region, and so is the month's word in a date filter's summary and in a date group's heading, while dates' order and digits, numbers and the order text sorts in keep `locale`. So an app that writes its dates the Romanian way in an English interface states both, and a date filter's summary reads "After 24 Nov 2026" where the locale alone writes "After 24 nov. 2026": the day's order and digits are the locale's, its month's word the language's. A group's heading by day, week or month reads the same way: "November 2026", "24 Nov 2026", "Week of 24 Nov 2026". Unstated, it is `locale`, and `.with({ locale })` moves it along until you state one.
106
106
 
107
107
  ```ts
108
108
  import { countryName, locationShort } from "viewkitjs/fields";
@@ -314,7 +314,8 @@ assert.equal(resolveCategoryColor("Software", industryOptions, { Software: "teal
314
314
  // A value no option colours takes its derived colour, the same every time.
315
315
  assert.equal(resolveCategoryColor("Retail", industryOptions, undefined), deriveCategoryColor("Retail"));
316
316
  assert.equal(deriveCategoryColor("Retail"), deriveCategoryColor("Retail"));
317
- assert.equal(CATEGORY_COLOR_CLASSES.purple, "bg-label-purple-soft text-label-purple");
317
+ // A chip wears the default Tag's pill: its words read the hue's strong step.
318
+ assert.ok(CATEGORY_COLOR_CLASSES.purple.includes("var(--vk-label-purple-strong,"));
318
319
  ```
319
320
 
320
321
  ## A stage mark
@@ -1,8 +1,8 @@
1
1
  # `viewkitjs/fields/design/category-colors`
2
2
 
3
- Import from `viewkitjs/fields/design/category-colors` where you draw a value of a `select` or a `multiselect`. These colours are decorative: they tell one category from another and say nothing about state, which is a status's slot. The class names read your stylesheet's `--label-*` tokens, eight hues that stay the same in every theme. Under `viewkitjs/views/styles.css` instead of your own Tailwind, a chip's text reads `--vk-label-<hue>` and its fill `--vk-label-<hue>-soft`, both names you can declare. The [options guide](../guides/options.md) shows an option with its colour.
3
+ Import from `viewkitjs/fields/design/category-colors` where you draw a value of a `select` or a `multiselect`. These colours are decorative: they tell one category from another and say nothing about state, which is a status's slot. A chip wears the default Tag's pill: each hue's fill, its edge drawn inside and its words a strong step, which read at 4.5:1 or more on their fill in every hue, light and dark. Each rung reads a name you can declare, `--vk-label-<hue>-fill`, `--vk-label-<hue>-edge` and `--vk-label-<hue>-strong`; undeclared, it comes from your `--vk-label-<hue>` (else ViewKit's own hue), 15% and 40% into `--vk-ground` and 60% into `--vk-fg`, so with your own Tailwind map `--vk-ground` and `--vk-fg` at least. Under `viewkitjs/views/styles.css` the rungs are the Outright look's. Gray is your theme's `muted` ground with its `muted-foreground` words. The [options guide](../guides/options.md) shows an option with its colour.
4
4
  - `CategoryColor` — the eight colours: `gray`, `blue`, `green`, `amber`, `red`, `purple`, `pink` and `teal`.
5
- - `CATEGORY_COLOR_CLASSES` — a chip's class names per colour: the colour's soft rung as the fill and the colour as text.
5
+ - `CATEGORY_COLOR_CLASSES` — a chip's class names per colour: the default Tag's pill, the same strings as the Tag's.
6
6
  - `CATEGORY_DOT_CLASSES` — a solid dot's class name per colour.
7
7
  - `deriveCategoryColor` — a colour worked out from a value's text, the same every time, for an option that declares none.
8
8
  - `resolveCategoryColor` — the colour a value wears: a person's own override first, then the option's declared colour, then `deriveCategoryColor`.
@@ -49,7 +49,7 @@ Guide: [the index](../guides/the-index.md).
49
49
 
50
50
  Guide: [conventions](../guides/conventions.md).
51
51
 
52
- - `defineConventions` — builds a host's frozen conventions: its locale, its names language (`language`, the language a place's country and region are named in; default its locale), time zone, decimal separator, region, id formats, message resolver and link platforms. It throws `FieldConventionsError` on a locale, zone, region or platform it cannot use, and the result's `with` returns a new copy with some of them stated differently.
52
+ - `defineConventions` — builds a host's frozen conventions: its locale, its names language (`language`, the language a place's country and region are named in, and the month of a date filter's summary and of a date group's heading; default its locale), time zone, decimal separator, region, id formats, message resolver and link platforms. It throws `FieldConventionsError` on a locale, zone, region or platform it cannot use, and the result's `with` returns a new copy with some of them stated differently.
53
53
  - `DEFAULT_CONVENTIONS` — the conventions a function uses when it is handed none: `en-GB`, UTC, both decimal styles read, no region and the neutral English messages. They never depend on the runtime, so a server and a browser that state nothing agree.
54
54
  - `ConventionsInput` — what a host may state to `defineConventions`; every member is optional.
55
55
  - `ConventionsOverrides` — what `with` takes: any member of `ConventionsInput`, and `null` for `decimal` or `region` to state none.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewkitjs",
3
- "version": "0.21.0",
3
+ "version": "0.23.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": {
@@ -172,6 +172,10 @@
172
172
  "types": "./views/dist/looks/index.d.ts",
173
173
  "default": "./views/dist/looks/index.js"
174
174
  },
175
+ "./views/controls": {
176
+ "types": "./views/dist/controls/index.d.ts",
177
+ "default": "./views/dist/controls/index.js"
178
+ },
175
179
  "./views/panels": {
176
180
  "types": "./views/dist/panels/index.d.ts",
177
181
  "default": "./views/dist/panels/index.js"
@@ -182,6 +186,7 @@
182
186
  },
183
187
  "./views/styles.css": "./views/dist/styles.css",
184
188
  "./views/styles.unlayered.css": "./views/dist/styles.unlayered.css",
189
+ "./views/controls/*.css": "./views/dist/controls/*.css",
185
190
  "./postgres": {
186
191
  "types": "./postgres/dist/index.d.ts",
187
192
  "default": "./postgres/dist/index.js"
@@ -201,6 +206,7 @@
201
206
  "tldts": "7.5.5"
202
207
  },
203
208
  "peerDependencies": {
209
+ "@base-ui/react": "^1.6.0",
204
210
  "@dnd-kit/core": "^6.3.1",
205
211
  "@dnd-kit/sortable": "^10.0.0",
206
212
  "@dnd-kit/utilities": "^3.2.2",
@@ -209,6 +215,9 @@
209
215
  "zod": "^4.1.12"
210
216
  },
211
217
  "peerDependenciesMeta": {
218
+ "@base-ui/react": {
219
+ "optional": true
220
+ },
212
221
  "@dnd-kit/core": {
213
222
  "optional": true
214
223
  },
@@ -226,6 +235,7 @@
226
235
  }
227
236
  },
228
237
  "devDependencies": {
238
+ "@base-ui/react": "1.6.0",
229
239
  "@dnd-kit/core": "^6.3.1",
230
240
  "@dnd-kit/sortable": "^10.0.0",
231
241
  "@dnd-kit/utilities": "^3.2.2",
@@ -268,7 +278,9 @@
268
278
  "bench:picking": "node views/bench/picking-check.ts",
269
279
  "bench:footer": "node views/bench/footer-check.ts",
270
280
  "bench:chip": "node views/bench/chip-check.ts",
281
+ "bench:views-row": "node views/bench/views-row-check.ts",
271
282
  "bench:shift": "node views/bench/shift-check.ts",
283
+ "bench:title-click": "node views/bench/title-click-check.ts",
272
284
  "styles:defaults": "node views/styles/defaults.ts",
273
285
  "bench:stylesheet": "node views/bench/stylesheet-check.ts"
274
286
  }
@@ -18,11 +18,11 @@ export const STATUS_DOT = {
18
18
  };
19
19
  export const TAG_TONE = {
20
20
  gray: "bg-(color:--vk-neutral) text-(color:--vk-fg-subtle)",
21
- blue: "bg-[var(--vk-label-blue-fill,color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-blue-edge,color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_40%,var(--vk-ground)))] text-[var(--vk-label-blue-strong,color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_60%,var(--vk-fg)))]",
22
- green: "bg-[var(--vk-label-green-fill,color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-green-edge,color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_40%,var(--vk-ground)))] text-[var(--vk-label-green-strong,color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_60%,var(--vk-fg)))]",
23
- amber: "bg-[var(--vk-label-amber-fill,color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-amber-edge,color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_40%,var(--vk-ground)))] text-[var(--vk-label-amber-strong,color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_60%,var(--vk-fg)))]",
24
- red: "bg-[var(--vk-label-red-fill,color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-red-edge,color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_40%,var(--vk-ground)))] text-[var(--vk-label-red-strong,color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_60%,var(--vk-fg)))]",
25
- purple: "bg-[var(--vk-label-purple-fill,color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-purple-edge,color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_40%,var(--vk-ground)))] text-[var(--vk-label-purple-strong,color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_60%,var(--vk-fg)))]",
26
- pink: "bg-[var(--vk-label-pink-fill,color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-pink-edge,color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_40%,var(--vk-ground)))] text-[var(--vk-label-pink-strong,color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_60%,var(--vk-fg)))]",
27
- teal: "bg-[var(--vk-label-teal-fill,color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-teal-edge,color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_40%,var(--vk-ground)))] text-[var(--vk-label-teal-strong,color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_60%,var(--vk-fg)))]",
21
+ blue: "bg-[var(--vk-label-blue-fill,color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-blue-edge,color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-blue-strong,color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_60%,var(--vk-fg)))]",
22
+ green: "bg-[var(--vk-label-green-fill,color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-green-edge,color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-green-strong,color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_60%,var(--vk-fg)))]",
23
+ amber: "bg-[var(--vk-label-amber-fill,color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-amber-edge,color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-amber-strong,color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_60%,var(--vk-fg)))]",
24
+ red: "bg-[var(--vk-label-red-fill,color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-red-edge,color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-red-strong,color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_60%,var(--vk-fg)))]",
25
+ purple: "bg-[var(--vk-label-purple-fill,color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-purple-edge,color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-purple-strong,color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_60%,var(--vk-fg)))]",
26
+ pink: "bg-[var(--vk-label-pink-fill,color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-pink-edge,color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-pink-strong,color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_60%,var(--vk-fg)))]",
27
+ teal: "bg-[var(--vk-label-teal-fill,color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_15%,var(--vk-ground)))] shadow-[inset_0_0_0_1px_var(--vk-label-teal-edge,color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_40%,var(--vk-ground)))] text-[color:var(--vk-label-teal-strong,color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_60%,var(--vk-fg)))]",
28
28
  };
@@ -82,6 +82,12 @@ export declare const VK_INTERNAL_FAMILIES: readonly ["--vk-col-w-"];
82
82
  * marks its box `vk-fit` and each value's box `vk-fit-value`, which its measure reads. */
83
83
  export declare const VK_INTERNAL_MARKS: readonly ["vk-fit", "vk-fit-value"];
84
84
  export type VkInternalMark = (typeof VK_INTERNAL_MARKS)[number];
85
+ /** THE CONTROLS' TOKENS: every name ViewKit's default controls (`viewkitjs/views/controls`) read, each with its kind and the
86
+ * Outright token it stands for, gathered from each control's own list (`controls/<piece>/tokens.ts`). All optional: the
87
+ * ready stylesheet declares each at the Outright look's value, and an app declares one to change it. The rule that names
88
+ * them is in docs/contract.md (Tokens, The controls' tokens); each control's names are on its page under docs/controls/. */
89
+ export { VK_CONTROL_PRIVATE_FAMILIES, VK_CONTROL_TOKENS, VK_CONTROL_TOKENS_BY_PIECE, type ControlToken } from "./controls/tokens.js";
90
+ export type VkControlToken = import("./controls/tokens.js").ControlToken["name"];
85
91
  /** The primitives an app hands in through the provider. */
86
92
  export declare const COMPONENT_NAMES: readonly ["Button", "Popover", "Tooltip", "Checkbox", "Menu", "Collapse", "Sheet", "AppIcon", "Markdown"];
87
93
  export type ComponentName = (typeof COMPONENT_NAMES)[number];
@@ -1339,4 +1345,3 @@ export declare const VIEWS_MESSAGE_KEYS: readonly ["views.editors.tag-remove", "
1339
1345
  export type ViewsMessageResolver = (message: ViewsMessage) => string;
1340
1346
  /** The package's English, one line per key. */
1341
1347
  export declare function resolveViewsMessage(message: ViewsMessage): string;
1342
- export {};
@@ -199,6 +199,7 @@ export const VK_INTERNAL = [
199
199
  ];
200
200
  export const VK_INTERNAL_FAMILIES = ["--vk-col-w-"];
201
201
  export const VK_INTERNAL_MARKS = ["vk-fit", "vk-fit-value"];
202
+ export { VK_CONTROL_PRIVATE_FAMILIES, VK_CONTROL_TOKENS, VK_CONTROL_TOKENS_BY_PIECE } from "./controls/tokens.js";
202
203
  export const COMPONENT_NAMES = [
203
204
  "Button",
204
205
  "Popover",
@@ -0,0 +1,8 @@
1
+ import { OptionTag } from "./option/atom-tag.js";
2
+ import { StatusBadgeAtom } from "./status/atom-status-badge.js";
3
+ import { TagCellMore } from "./tag/atom-cell-more.js";
4
+ export declare const CONTROL_ATOMS: {
5
+ readonly Tag: typeof OptionTag;
6
+ readonly StatusBadge: typeof StatusBadgeAtom;
7
+ readonly CellMore: typeof TagCellMore;
8
+ };
@@ -0,0 +1,8 @@
1
+ import { OptionTag } from "./option/atom-tag.js";
2
+ import { StatusBadgeAtom } from "./status/atom-status-badge.js";
3
+ import { TagCellMore } from "./tag/atom-cell-more.js";
4
+ export const CONTROL_ATOMS = {
5
+ Tag: OptionTag,
6
+ StatusBadge: StatusBadgeAtom,
7
+ CellMore: TagCellMore,
8
+ };
@@ -0,0 +1,40 @@
1
+ import * as React from "react";
2
+ import { Button as BaseButton } from "@base-ui/react/button";
3
+ import { type ButtonOwnLook } from "./own-look.js";
4
+ export type ButtonKind = "primary" | "outline" | "soft" | "quiet" | "danger" | "information" | "success" | "warning" | "link" | "text";
5
+ export type ButtonSize = "2xs" | "xs" | "sm" | "md" | "lg" | "44" | "20" | "22" | "26" | "20x24" | "32x44" | "40x44" | "line";
6
+ export type ButtonShape = "default" | "icon" | "round";
7
+ /** The Button's classes for a kind, a size and a form; left out, outline, md and default. */
8
+ export declare function buttonClass(kind?: ButtonKind | null, size?: ButtonSize | null, shape?: ButtonShape | null): string;
9
+ export interface ButtonProps extends Omit<BaseButton.Props, "className"> {
10
+ kind?: ButtonKind | null;
11
+ size?: ButtonSize | null;
12
+ shape?: ButtonShape | null;
13
+ /** Working: the label keeps the button's width under a spinner, and a press does nothing. */
14
+ loading?: boolean;
15
+ /** An icon before the label (15px); an icon-only button's one icon. */
16
+ icon?: React.ReactNode;
17
+ /** An icon after the label: a menu's chevron. */
18
+ iconEnd?: React.ReactNode;
19
+ /** A Button's own look: the options it names, set on it. */
20
+ look?: ButtonOwnLook;
21
+ className?: string;
22
+ }
23
+ /** What a person presses to make something happen. */
24
+ export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
25
+ /** Buttons joined in one row (or a column): the corners between them square, the edges shared, as one control. It holds
26
+ * Buttons, a ButtonGroupText, a ButtonGroupSeparator, or groups of its own, set apart. */
27
+ export declare function ButtonGroup({ orientation, className, children, ...props }: {
28
+ orientation?: "horizontal" | "vertical";
29
+ className?: string;
30
+ children: React.ReactNode;
31
+ } & React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
32
+ /** Words inside a group, on the neutral ground with the group's edge: a unit, a count, what the buttons act on. */
33
+ export declare function ButtonGroupText({ className, children, ...props }: {
34
+ className?: string;
35
+ children: React.ReactNode;
36
+ } & React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
37
+ /** A line between two buttons of a group that have no edge of their own (the soft kind, the primary). */
38
+ export declare function ButtonGroupSeparator({ className }: {
39
+ className?: string;
40
+ }): import("react/jsx-runtime").JSX.Element;