viewkitjs 0.37.0 → 0.38.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 (56) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/package.json +1 -1
  3. package/views/dist/contract.d.ts +6 -3
  4. package/views/dist/contract.js +4 -0
  5. package/views/dist/controls/field/looks.d.ts +1 -1
  6. package/views/dist/controls/field/looks.js +5 -3
  7. package/views/dist/controls/field.css +60 -1
  8. package/views/dist/controls/glyphs/glyphs.js +2 -0
  9. package/views/dist/controls/inline-input.css +3 -2
  10. package/views/dist/controls/internal/read-token.d.ts +2 -1
  11. package/views/dist/controls/internal/read-token.js +2 -1
  12. package/views/dist/controls/number-editor/tokens.d.ts +8 -0
  13. package/views/dist/controls/number-editor/tokens.js +2 -0
  14. package/views/dist/controls/number-editor.css +20 -0
  15. package/views/dist/controls/text-editor/tokens.d.ts +8 -0
  16. package/views/dist/controls/text-editor/tokens.js +2 -0
  17. package/views/dist/controls/text-editor.css +24 -2
  18. package/views/dist/controls/tooltip/tooltip.js +2 -1
  19. package/views/dist/field-row/FieldRow.js +15 -6
  20. package/views/dist/field-row/field-row-button.d.ts +12 -0
  21. package/views/dist/field-row/field-row-button.js +5 -0
  22. package/views/dist/fields/binding.d.ts +4 -0
  23. package/views/dist/grid/chrome/GridCellEditors.d.ts +1 -1
  24. package/views/dist/grid/chrome/GridCellOutline.d.ts +13 -1
  25. package/views/dist/grid/chrome/GridCellOutline.js +17 -0
  26. package/views/dist/grid/chrome/GridNumberEditor.js +2 -1
  27. package/views/dist/grid/chrome/GridRowCells.js +1 -1
  28. package/views/dist/grid/chrome/GridStructure.js +3 -3
  29. package/views/dist/grid/chrome/GridTextEditor.js +3 -1
  30. package/views/dist/grid/chrome/grid-body-place.js +2 -1
  31. package/views/dist/grid/chrome/grid-edit-session.d.ts +7 -3
  32. package/views/dist/grid/chrome/grid-edit-session.js +12 -3
  33. package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -4
  34. package/views/dist/grid/chrome/grid-row-props.d.ts +1 -1
  35. package/views/dist/grid/chrome/useGridKeyboard.d.ts +5 -1
  36. package/views/dist/grid/chrome/useGridKeyboard.js +9 -5
  37. package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
  38. package/views/dist/grid/chrome/useGridTableInteractionModel.js +8 -3
  39. package/views/dist/internal/length.d.ts +2 -0
  40. package/views/dist/internal/length.js +16 -0
  41. package/views/dist/provider/components.d.ts +2 -1
  42. package/views/dist/selection/bar-overflow.d.ts +2 -0
  43. package/views/dist/selection/bar-overflow.js +2 -1
  44. package/views/dist/selection/bar-props.d.ts +1 -1
  45. package/views/dist/selection/verbs.d.ts +2 -2
  46. package/views/dist/styles.css +165 -5
  47. package/views/dist/styles.unlayered.css +165 -5
  48. package/views/docs/contract.md +9 -3
  49. package/views/docs/controls/number-editor.md +2 -0
  50. package/views/docs/controls/text-editor.md +2 -0
  51. package/views/docs/guides/selection.md +1 -1
  52. package/views/docs/guides/the-grid.md +1 -1
  53. package/views/docs/reference/field-row.md +1 -1
  54. package/views/docs/reference/looks.md +1 -1
  55. package/views/docs/reference/selection.md +1 -1
  56. package/views/docs/reference/views.md +1 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,32 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.38.0] — 2026-12-04
9
+
10
+ ### Added
11
+
12
+ - `viewkitjs/views/field-row`: the Field's Box (`row-box`: `target`, `box`; `data-field-row-box="box"` on any frame round the rows). Under `box`, a computer's field row draws one rectangle for its hover, its press, its in-place text and number input and the place a picker opens from, so the words never move and the row keeps its height; the press doesn't scale, and the input's ring is drawn outside the box. In a narrow window the stacked row takes the same box at rest, hovered and pressed, and its editor stays the phone's. Its size, reach and corner are `--vk-field-row-box-h`, `--vk-field-row-box-x` and `--vk-field-row-box-r` (32, 8 and 8). Rows in a Field rows card keep their card's row.
13
+ - `viewkitjs/views/field-row`: the Field's Action (`row-action`: `none`, `icon`; `data-field-row-action="icon"` on any frame round the rows). Under `icon`, a record's field row outside a Field rows card shows one icon at its box's right end when the box is hovered or has the keyboard's focus, saying what a click does: edit where its editor opens in a popover (a select, a status, a person or a record, a date, tags, a place, a name, a range, several values), expand for a long text or a rich text, and none where the box is the input (a text, a number, one email, phone, link or domain). The icon is 15px in a 24px square, 4px in from the box's end and centred on the value's first line; the box keeps that room at its end, so a long value ends before it (on one line, cut with its "…"), and the words don't move at rest, hovered, pressed or while a picker is open. It draws with or without the Field's Box. The lock, ⋯ and › stay at the row's end as before. With nothing set, no row draws an icon.
14
+ - `viewkitjs/views`: a field binding's `action` (`"none" | "edit" | "expand"`) picks that icon for its field, in place of the one its type picks.
15
+ - `viewkitjs/views`: the icon name `expand` (a long text opens), drawn by `CONTROL_ICONS` as Tabler's arrows-diagonal.
16
+
17
+ ### Changed
18
+
19
+ - `viewkitjs/views/field-row`: outside a Field rows card, a record's field row's target (your `Button`) is handed `data-key="vk-field-row-target"` (`vk-field-row-beside` beside a link's action, `vk-field-row-under` under a rich text), whether or not the Box is picked; forward it to your element, as `ViewsButtonProps` asks. Your Button's own `data-slot` stays its own.
20
+ - `viewkitjs/views/styles.css`'s and `viewkitjs/views/styles.unlayered.css`'s size budgets rise from 145 to 150 kB gzipped: the Field's Box brought them to 145.7 and 145.1 kB.
21
+ - `viewkitjs/views/grid`: a key pressed while a cell's picker plays its close (after Escape, a pick, or Enter) is the cell's. The focus is back on the cell the moment the picker starts to close, not once its exit ends: a second Escape lets the cell go, an arrow or Tab moves the pick, and ⌘Z takes back the pick just made. Before, that key was lost in the closing panel. A key that would open or write the cell waits for the exit, as before.
22
+
23
+ ### Fixed
24
+
25
+ - `viewkitjs/views`: a spacing (`--vk-spacing`) or a border width (`--vk-border-width`) you declare in rem, em or a `calc()` is read as the length it comes to. A grid editor over its cell, a menu's or a picker's distance from what opened it, and a tooltip's gap took `0.25rem` as a quarter of a pixel; they now take it as 4px under a 16px root, as they always took `4px`.
26
+ - `viewkitjs/views/grid`: in a grouped grid, a group's first row starts right on its column names' line. It stood 2px below them, and once the list scrolled and the group's head pinned, an 8px band of the page's ground under the names covered the rows and cut the column lines. A pinned head now ends at its names' line, its shadow falling on the rows passing under it.
27
+ - `viewkitjs/views/grid`: a cell typed in (a text, an email, a link, a phone, a number) keeps the selected cell's ring while you type, the same line in the same place, so it still shows where you are. When the value runs past the cell, the ring goes round all the box covers. Since 0.37.0 it showed only the caret. The editors that open over their cell (a picker, a date) still draw nothing on it, and nothing typed in lifts or tints.
28
+ - `viewkitjs/views/selection`: ViewKit's own selection bar keeps a verb marked `more: true` in More, as the components map's `SelectionBar` already did. Before, it stood the first four verbs on the bar whatever they said, so a verb you meant to tuck away could stand on it. The bar now holds the first four verbs not marked `more`; More lists the marked ones first, then the verbs past those four. A list that marks no verb `more` draws exactly as before.
29
+
30
+ ### For an adapter
31
+
32
+ - An app that hands the provider its own `icons` adds `expand` to them (`icons.expand`): the icon map names every meaning, so it doesn't typecheck without it. An app that hands no `icons` draws it through its `AppIcon` by its name, as every meaning.
33
+
8
34
  ## [0.37.0] — 2026-12-04
9
35
 
10
36
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewkitjs",
3
- "version": "0.37.0",
3
+ "version": "0.38.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": {
@@ -71,12 +71,15 @@ export type VkOptionalColour = (typeof VK_OPTIONAL_COLOURS)[number];
71
71
  * (VK-953): `--vk-field-row-label-w` its label column on a desktop (undeclared `calc(var(--spacing)*32)`, what `w-32` drew), `--vk-field-row-gap` the gap
72
72
  * between its glyph, label, value and lane (`calc(var(--spacing)*3)`), `--vk-field-row-h` its least height, its content standing in
73
73
  * the middle (`auto`), `--vk-field-row-py` its padding above and below (`calc(var(--spacing)*2.5)`) and `--vk-field-row-line-w` the
74
- * line under every row but the last (`1px`; `0px` draws none). A panel's, an editor's and a menu's size on a computer (VK-992):
74
+ * line under every row but the last (`1px`; `0px` draws none). Its box under the Field's Box (VK-1079), read only there
75
+ * (`data-field-row-box="box"`, field.css): `--vk-field-row-box-h` its height (undeclared `calc(var(--vk-spacing) * 8)`, 32),
76
+ * `--vk-field-row-box-x` how far it reaches past the words (`calc(var(--vk-spacing) * 2)`, 8) and `--vk-field-row-box-r` its
77
+ * corner (`calc(var(--vk-spacing) * 2)`, 8). A panel's, an editor's and a menu's size on a computer (VK-992):
75
78
  * `--vk-panel-w` and `--vk-panel-max-h` a toolbar panel's, `--vk-editor-w` and `--vk-editor-max-h` a field editor's popover's,
76
79
  * `--vk-menu-w` and `--vk-menu-max-h` a menu's, each place keeping its own undeclared; `--vk-list-rows` how many rows a
77
80
  * computer's list stands before it scrolls (undeclared `8.5`, or `--list-rows`, its old name). ViewKit's own controls read
78
81
  * these as well as their control tokens. */
79
- export declare const VK_OPTIONAL_LAYOUT: readonly ["--vk-field-row-label-w", "--vk-field-row-gap", "--vk-field-row-h", "--vk-field-row-py", "--vk-field-row-line-w", "--vk-toolbar-foot", "--vk-toolbar-line-py", "--vk-toolbar-line-gap", "--vk-toolbar-line-w", "--vk-gutter", "--vk-scroll-inset-bottom", "--vk-panel-padding", "--vk-scroll-row-inset", "--vk-scroll-row-end", "--vk-outline-radius", "--vk-group-gap", "--vk-duration", "--vk-caption-text", "--vk-caption-leading", "--vk-caps-tracking", "--vk-input-text", "--vk-panel-title-text", "--vk-sheet-text", "--vk-underline-offset", "--vk-underline-width", "--vk-thick-line", "--vk-selected-stroke", "--vk-frozen-shadow-width", "--vk-panel-w", "--vk-panel-max-h", "--vk-editor-w", "--vk-editor-max-h", "--vk-menu-w", "--vk-menu-max-h", "--vk-list-rows", "--vk-popup-open-duration", "--vk-popup-close-duration", "--vk-popup-open-ease", "--vk-popup-close-ease", "--vk-popup-nudge", "--vk-popup-scale"];
82
+ export declare const VK_OPTIONAL_LAYOUT: readonly ["--vk-field-row-label-w", "--vk-field-row-gap", "--vk-field-row-h", "--vk-field-row-py", "--vk-field-row-line-w", "--vk-field-row-box-h", "--vk-field-row-box-x", "--vk-field-row-box-r", "--vk-toolbar-foot", "--vk-toolbar-line-py", "--vk-toolbar-line-gap", "--vk-toolbar-line-w", "--vk-gutter", "--vk-scroll-inset-bottom", "--vk-panel-padding", "--vk-scroll-row-inset", "--vk-scroll-row-end", "--vk-outline-radius", "--vk-group-gap", "--vk-duration", "--vk-caption-text", "--vk-caption-leading", "--vk-caps-tracking", "--vk-input-text", "--vk-panel-title-text", "--vk-sheet-text", "--vk-underline-offset", "--vk-underline-width", "--vk-thick-line", "--vk-selected-stroke", "--vk-frozen-shadow-width", "--vk-panel-w", "--vk-panel-max-h", "--vk-editor-w", "--vk-editor-max-h", "--vk-menu-w", "--vk-menu-max-h", "--vk-list-rows", "--vk-popup-open-duration", "--vk-popup-close-duration", "--vk-popup-open-ease", "--vk-popup-close-ease", "--vk-popup-nudge", "--vk-popup-scale"];
80
83
  export type VkOptionalLayout = (typeof VK_OPTIONAL_LAYOUT)[number];
81
84
  /** The grid's own machinery, set and read by the grid alone: prefixed because they share the
82
85
  * global namespace, and not public. An app neither sets nor reads them, and they may change in
@@ -184,7 +187,7 @@ export declare const PORT_NAMES: readonly ["toast", "haptics", "clipboard", "vie
184
187
  export type PortName = (typeof PORT_NAMES)[number];
185
188
  /** The glyphs the rendering asks the app for, by what they mean, never by a
186
189
  * library's name. The app maps each to its own icon component. */
187
- export declare const ICON_NAMES: readonly ["text", "longText", "number", "percent", "currency", "date", "datetime", "duration", "boolean", "select", "status", "multiselect", "relation", "user", "url", "domain", "email", "phone", "location", "name", "actor", "rich_text", "range", "lookup", "rollup", "formula", "computed", "automation", "apiKey", "system", "add", "edit", "delete", "copy", "cut", "paste", "clear", "hide", "show", "lock", "pin", "wrap", "more", "close", "check", "warning", "drag", "resize", "open", "selectRow", "chevronDown", "chevronRight", "caretDown", "caretRight", "sortAsc", "sortDesc", "enter", "calendar", "time", "progress", "moveLeft", "moveRight", "group", "clearSort", "sortRowsUp", "sortRowsDown", "search", "reset", "moreVertical", "options", "person", "filter", "filterStatus", "filterCategory", "filterMetric", "layout", "columns", "sort", "back", "copyLink", "export", "share", "loading"];
190
+ export declare const ICON_NAMES: readonly ["text", "longText", "number", "percent", "currency", "date", "datetime", "duration", "boolean", "select", "status", "multiselect", "relation", "user", "url", "domain", "email", "phone", "location", "name", "actor", "rich_text", "range", "lookup", "rollup", "formula", "computed", "automation", "apiKey", "system", "add", "edit", "delete", "copy", "cut", "paste", "clear", "hide", "show", "lock", "pin", "wrap", "more", "close", "check", "warning", "drag", "resize", "open", "expand", "selectRow", "chevronDown", "chevronRight", "caretDown", "caretRight", "sortAsc", "sortDesc", "enter", "calendar", "time", "progress", "moveLeft", "moveRight", "group", "clearSort", "sortRowsUp", "sortRowsDown", "search", "reset", "moreVertical", "options", "person", "filter", "filterStatus", "filterCategory", "filterMetric", "layout", "columns", "sort", "back", "copyLink", "export", "share", "loading"];
188
191
  export type ViewsIconName = (typeof ICON_NAMES)[number];
189
192
  /** Every visible string the views package owns is a key under one of these. */
190
193
  export declare const MESSAGE_NAMESPACES: readonly ["views.grid", "views.editors", "views.menus", "views.display", "views.selection", "views.panels", "views.field-row"];
@@ -173,6 +173,9 @@ export const VK_OPTIONAL_LAYOUT = [
173
173
  "--vk-field-row-h",
174
174
  "--vk-field-row-py",
175
175
  "--vk-field-row-line-w",
176
+ "--vk-field-row-box-h",
177
+ "--vk-field-row-box-x",
178
+ "--vk-field-row-box-r",
176
179
  "--vk-toolbar-foot",
177
180
  "--vk-toolbar-line-py",
178
181
  "--vk-toolbar-line-gap",
@@ -615,6 +618,7 @@ export const ICON_NAMES = [
615
618
  "drag",
616
619
  "resize",
617
620
  "open",
621
+ "expand",
618
622
  "selectRow",
619
623
  "chevronDown",
620
624
  "chevronRight",
@@ -1,5 +1,5 @@
1
1
  import type { PieceLooks } from "../../looks/looks.js";
2
- export type FieldLookOptionId = "rows-cards" | "rows-edge" | "rows-height" | "rows-label" | "rows-lines" | "row-icon";
2
+ export type FieldLookOptionId = "rows-cards" | "rows-edge" | "rows-height" | "rows-label" | "rows-lines" | "row-icon" | "row-box" | "row-action";
3
3
  /** A card's own look, handed by its place (an editor's look): each option, an option left out taking its default. */
4
4
  export type FieldRowsLook = Partial<{
5
5
  cards: "one" | "each";
@@ -5,15 +5,17 @@ const options = [
5
5
  { id: "rows-label", name: "Label", def: "104", device: "phone", demo: false, values: [{ id: "104", name: "104" }, { id: "none", name: "None" }] },
6
6
  { id: "rows-lines", name: "Lines", def: "words", device: "phone", demo: false, values: [{ id: "words", name: "From the words" }, { id: "across", name: "Across" }, { id: "none", name: "None" }] },
7
7
  { id: "row-icon", name: "Icon", def: "on", device: "desktop", demo: false, values: [{ id: "on", name: "On" }, { id: "off", name: "Off" }] },
8
+ { id: "row-box", name: "Box", def: "target", device: "desktop", demo: false, values: [{ id: "target", name: "Target" }, { id: "box", name: "Box" }] },
9
+ { id: "row-action", name: "Action", def: "none", device: "desktop", demo: false, values: [{ id: "none", name: "None" }, { id: "icon", name: "Icon" }] },
8
10
  ];
9
11
  export const FIELD_LOOKS = {
10
12
  id: "field",
11
13
  name: "Field",
12
14
  options,
13
15
  looks: [
14
- { id: "card", name: "Card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "on", "rows-height": "52", "rows-label": "104", "rows-lines": "words", "row-icon": "on" } },
15
- { id: "each", name: "A card each", device: "phone", picks: { "rows-cards": "each", "rows-edge": "on", "rows-height": "56", "rows-label": "104", "rows-lines": "none", "row-icon": "on" } },
16
- { id: "rows", name: "Rows in a card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "off", "rows-height": "48", "rows-label": "104", "rows-lines": "across", "row-icon": "on" } },
16
+ { id: "card", name: "Card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "on", "rows-height": "52", "rows-label": "104", "rows-lines": "words", "row-icon": "on", "row-box": "target", "row-action": "none" } },
17
+ { id: "each", name: "A card each", device: "phone", picks: { "rows-cards": "each", "rows-edge": "on", "rows-height": "56", "rows-label": "104", "rows-lines": "none", "row-icon": "on", "row-box": "target", "row-action": "none" } },
18
+ { id: "rows", name: "Rows in a card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "off", "rows-height": "48", "rows-label": "104", "rows-lines": "across", "row-icon": "on", "row-box": "target", "row-action": "none" } },
17
19
  ],
18
20
  };
19
21
  const known = (o, v) => (v && o.values.some((x) => x.id === v) ? v : o.def);
@@ -2,7 +2,8 @@
2
2
  fields, and a field beside its label, as shadcn's Field draws them, on public names. A field's label and a group's
3
3
  legend (which reads as one) are both .o-field-label; a field's label can be quiet instead.
4
4
 
5
- The rules sit in the components layer, so a utility class still wins. */
5
+ The rules sit in the components layer, so a utility class still wins, but for the Field's Box's and the Field's Action's
6
+ geometry, which is !important (the Box's section says why). */
6
7
  @layer components {
7
8
 
8
9
  /* ── A field: its label, then its control, then its note or its error ──────────────────────────────── */
@@ -114,6 +115,64 @@ button.o-field-row { cursor: pointer; }
114
115
  .o-field-rows-slot + .o-field-rows-slot::before { content: " "; }
115
116
  .o-field-rows-slot > .o-field-error { color: var(--vk-danger); }
116
117
  .o-field-rows-foot:has(.o-field-error) .o-field-note { display: none; }
118
+ /* ── The Field's Box (row-box: box, looks.ts; data-field-row-box="box" on a frame round the rows): a record's field row outside a
119
+ card (data-field-row, field-row/FieldRow.tsx) draws one rectangle for its hover, its press, its in-place input and the value
120
+ an open picker keeps in its place, so its words never move and it keeps its height. The row reads the app's three names
121
+ (--vk-field-row-box-h, -x, -r; undeclared 32, 8 and 8) into its own, and how far the box stands above and below its one 20px
122
+ line (y). Its target (the app's Button, data-key="vk-field-row-target", -beside beside a link's action, -under under a rich text;
123
+ and data-field-row-anchor, the value an open picker keeps in its place) stands where it stood, pulled out by that reach and
124
+ that y, as tall as the box, no edge of its own (the words stand x from the box's edge whatever the app's Button draws), its
125
+ corner, no press. The
126
+ in-place text and number editors read the same names round data-field-row-editor (text-editor.css, number-editor.css). Below
127
+ the desktop line the gap under the label is y, so the box meets the label's line without covering it. Its geometry is
128
+ !important: the row's own classes are Tailwind's, and an app that compiles them into its own utilities layer (Tailwind's source scanning), or
129
+ whose own Tailwind writes the same names, puts them in a later layer, which no specificity here would outweigh. Nothing of it
130
+ applies without the attribute. ──────────────────────────────────────────────────────────────────────────────────────── */
131
+ :where([data-field-row-box="box"]) [data-field-row] {
132
+ --field-row-box-h: var(--vk-field-row-box-h, calc(var(--vk-spacing) * 8));
133
+ --field-row-box-x: var(--vk-field-row-box-x, calc(var(--vk-spacing) * 2));
134
+ --field-row-box-r: var(--vk-field-row-box-r, calc(var(--vk-spacing) * 2));
135
+ --field-row-box-y: calc((var(--field-row-box-h) - var(--vk-spacing) * 5) / 2);
136
+ }
137
+ :where([data-field-row-box="box"]) [data-field-row][data-form="phone"] { row-gap: var(--field-row-box-y) !important; }
138
+ :where([data-field-row-box="box"]) :is([data-key="vk-field-row-target"], [data-key="vk-field-row-beside"], [data-key="vk-field-row-under"], [data-field-row-anchor]) {
139
+ box-sizing: border-box !important; min-height: var(--field-row-box-h) !important;
140
+ padding: var(--field-row-box-y) var(--field-row-box-x) !important;
141
+ margin: calc(var(--field-row-box-y) * -1) calc(var(--field-row-box-x) * -1) !important;
142
+ width: calc(100% + var(--field-row-box-x) * 2) !important;
143
+ border-width: 0 !important; border-radius: var(--field-row-box-r) !important; --button-r: var(--field-row-box-r); --vk-press-scale: 1;
144
+ }
145
+ /* Beside a link's open action: its left edge only, the action keeping its place. */
146
+ :where([data-field-row-box="box"]) [data-key="vk-field-row-beside"] { margin-right: 0 !important; width: auto !important; }
147
+ /* Under a rich text: laid over the value's footprint, pulled out by the box's reach and its y. */
148
+ :where([data-field-row-box="box"]) [data-key="vk-field-row-under"] {
149
+ inset: calc(var(--field-row-box-y) * -1) calc(var(--field-row-box-x) * -1) !important; margin: 0 !important; padding: 0 !important;
150
+ width: auto !important; min-height: 0 !important;
151
+ }
152
+
153
+ /* ── The Field's Action (row-action: icon, looks.ts; data-field-row-action="icon" on a frame round the rows): a record's field row
154
+ outside a card shows one icon at its box's right end, on the box's hover and keyboard focus, saying what a click does. The row
155
+ draws it inside its target and inside the value an open picker keeps in its place (data-field-row-act: edit or expand, none
156
+ drawn where the box is the input; field-row/FieldRow.tsx), hidden by its class until this lays it out: 24 square, 4 in from the
157
+ box's end, centred on the value's first line (the box's y above it, or the target's 4), its glyph 15. The box keeps the icon's
158
+ room at its end (32, the icon and 4 either side), so the value ends there, cut with its "…" where it can't wrap, its label
159
+ allowed to shrink to the box; the words laid over a rich text's empty target keep the same room. It stands, never moving the
160
+ words, so the box draws the same rectangle at rest, hovered, pressed and while a picker is open, where it stays hidden. As the
161
+ box's, the geometry is !important: the frame's classes are Tailwind's (the Field's Box, above, says why). ───────────────── */
162
+ :where([data-field-row-action="icon"]) [data-field-row] :is([data-key="vk-field-row-target"], [data-key="vk-field-row-beside"], [data-field-row-anchor]):has([data-field-row-act]) {
163
+ position: relative; padding-right: calc(var(--vk-spacing) * 8) !important;
164
+ }
165
+ :where([data-field-row-action="icon"]) [data-field-row] :is([data-key="vk-field-row-target"], [data-key="vk-field-row-beside"], [data-field-row-anchor]):has([data-field-row-act]) > * { min-width: 0; }
166
+ :where([data-field-row-action="icon"]) [data-field-row] [data-key="vk-field-row-under"]:has([data-field-row-act]) + [data-slot="vk-row-value-layer"] {
167
+ padding-right: calc(var(--vk-spacing) * 8 - var(--field-row-box-x, var(--vk-spacing) * 2));
168
+ }
169
+ :where([data-field-row-action="icon"]) [data-field-row] [data-field-row-act] {
170
+ display: grid !important; place-items: center; position: absolute; right: var(--vk-spacing);
171
+ top: calc(var(--field-row-box-y, var(--vk-spacing)) + var(--vk-spacing) * 2.5); translate: 0 -50%;
172
+ width: calc(var(--vk-spacing) * 6); height: calc(var(--vk-spacing) * 6); color: var(--vk-fg-subtle); pointer-events: none; visibility: hidden;
173
+ }
174
+ :where([data-field-row-action="icon"]) [data-field-row] :is([data-key="vk-field-row-target"], [data-key="vk-field-row-beside"], [data-key="vk-field-row-under"]):is(:hover, :focus-visible) [data-field-row-act] { visibility: visible; }
175
+
117
176
  /* A phone's first paint: server-rendered, Field rows' card stands twice, the phone's form and the computer's (`ScreenForms`,
118
177
  internal/screen-forms.tsx), and this shows the screen's at ViewKit's own line, as the toolbar's stylesheet does: here for an app
119
178
  that imports this card's stylesheet alone, on a page whose policy refuses an inline style. Kept on one line, as screenFormsCss writes it. */
@@ -64,6 +64,7 @@ const IconCheck = glyph(["M5 12l5 5l10 -10"]);
64
64
  const IconAlertTriangle = glyph(["M12 9v4", "M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0", "M12 16h.01"]);
65
65
  const IconGripVertical = glyph(["M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"]);
66
66
  const IconArrowUpRight = glyph(["M17 7l-10 10", "M8 7l9 0l0 9"]);
67
+ const IconArrowsDiagonal = glyph(["M16 4l4 0l0 4", "M14 10l6 -6", "M8 20l-4 0l0 -4", "M4 20l6 -6"]);
67
68
  const IconSquareCheck = glyph(["M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14", "M9 12l2 2l4 -4"]);
68
69
  const IconChevronDown = glyph(["M6 9l6 6l6 -6"]);
69
70
  const IconChevronRight = glyph(["M9 6l6 6l-6 6"]);
@@ -131,6 +132,7 @@ export const CONTROL_ICONS = {
131
132
  drag: IconGripVertical,
132
133
  resize: IconArrowsHorizontal,
133
134
  open: IconArrowUpRight,
135
+ expand: IconArrowsDiagonal,
134
136
  selectRow: IconSquareCheck,
135
137
  chevronDown: IconChevronDown,
136
138
  chevronRight: IconChevronRight,
@@ -42,9 +42,10 @@
42
42
  [data-inline-input-tint="10"] { --inline-input-tint: 100%; }
43
43
  [data-inline-input-ground="none"] { --inline-input-ground: var(--vk-input); }
44
44
 
45
- /* ── In a grid's cell: only the caret ─────────────────────────────────────────────────────────────────────────────────────
45
+ /* ── In a grid's cell: the cell itself ────────────────────────────────────────────────────────────────────────────────────
46
46
  Where the grid says its box stands in a cell (data-inline-input-place="cell", on its type-in's layer), the cell itself is the
47
- box: no edge, no ring and no ground, whatever a frame picks, so the cell shows as it was. Grown past its cell (data-grown, on
47
+ box: no edge, no ring and no ground of its own, whatever a frame picks, so the cell shows as it was, the grid's own selected
48
+ ring round it (the grid draws that ring on the box). Grown past its cell (data-grown, on
48
49
  the body or the box that fits it), it takes the plain ground, so the values it stands over don't show through. */
49
50
  [data-inline-input-place="cell"] { --inline-input-edge: 0px; --inline-input-ring: 0px; --inline-input-ground: transparent; }
50
51
  [data-inline-input-place="cell"] [data-grown] { --inline-input-ground: var(--vk-overlay); }
@@ -1,6 +1,7 @@
1
1
  /** A time in milliseconds ("500ms" is 500, "4s" 4000), 0 where nothing declares it. */
2
2
  export declare function msOf(el: Element | null | undefined, prop: `--${string}`): number;
3
- /** A length in px ("1px" is 1), 0 where nothing declares it. */
3
+ /** A length in px ("1px" is 1, "0.25rem" 4 under a 16px root: whatever unit the app declares it in), 0 where nothing
4
+ * declares it. */
4
5
  export declare function pxOf(el: Element | null | undefined, prop: `--${string}`): number;
5
6
  /** Steps of the spacing name, in px (1.5 steps is 6px at the default 4px), read off `el`; with no element (a popup outside any
6
7
  * popup host), off the page's root, where the ready stylesheet declares it. */
@@ -1,3 +1,4 @@
1
+ import { lengthPx } from "../../internal/length.js";
1
2
  const read = (el, prop) => !el || typeof getComputedStyle === "undefined" ? "" : getComputedStyle(el).getPropertyValue(prop).trim();
2
3
  export function msOf(el, prop) {
3
4
  const v = read(el, prop), n = parseFloat(v);
@@ -6,6 +7,6 @@ export function msOf(el, prop) {
6
7
  return /\dms$/.test(v) ? n : /\ds$/.test(v) ? n * 1000 : n;
7
8
  }
8
9
  export function pxOf(el, prop) {
9
- return parseFloat(read(el, prop)) || 0;
10
+ return lengthPx(el, prop);
10
11
  }
11
12
  export const spacingPx = (steps, el) => pxOf(el ?? (typeof document === "undefined" ? undefined : document.documentElement), "--vk-spacing") * steps;
@@ -18,6 +18,14 @@ export declare const NUMBER_EDITOR_TOKENS: readonly [{
18
18
  readonly name: "--vk-font-size-sm";
19
19
  readonly kind: "size";
20
20
  readonly outright: "--text-sm";
21
+ }, {
22
+ readonly name: "--vk-shadow-field-focus";
23
+ readonly kind: "shadow";
24
+ readonly outright: "--shadow-field-focus";
25
+ }, {
26
+ readonly name: "--vk-shadow-field-focus-danger";
27
+ readonly kind: "shadow";
28
+ readonly outright: "--shadow-field-focus-danger";
21
29
  }, {
22
30
  readonly name: "--vk-spacing";
23
31
  readonly kind: "size";
@@ -4,6 +4,8 @@ export const NUMBER_EDITOR_TOKENS = [
4
4
  { name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
5
5
  { name: "--vk-font-size-base", kind: "size", outright: "--text-base" },
6
6
  { name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
7
+ { name: "--vk-shadow-field-focus", kind: "shadow", outright: "--shadow-field-focus" },
8
+ { name: "--vk-shadow-field-focus-danger", kind: "shadow", outright: "--shadow-field-focus-danger" },
7
9
  { name: "--vk-spacing", kind: "size", outright: "--spacing" },
8
10
  ];
9
11
  export const NUMBER_EDITOR_PRIVATE = ["--number-editor-"];
@@ -24,6 +24,26 @@ span.o-number-editor-code { color: var(--vk-fg-subtle); }
24
24
  .o-number-editor-sign, .o-number-editor-unit { flex: none; color: var(--vk-fg-subtle); }
25
25
  .o-number-editor[data-number-form="computer"] .o-number-editor-sign { margin-right: auto; }
26
26
 
27
+ /* ── In a record's row that wears the Field's Box (data-field-row-box="box" on a frame round the rows; the row marks its open
28
+ editor data-field-row-editor): on a computer the number's box is the row's own, as the Text editor's is (text-editor.css):
29
+ where the row's hover and press drew it, as tall, its words as far in, no edge of its own, the row's ground, its ring
30
+ outside it, red when refused. ─────────────────────────────────────────────────────────────────────────────────────────── */
31
+ :where([data-field-row-box="box"] [data-field-row-editor]) .o-number-editor[data-number-form="computer"] {
32
+ --inline-input-row: var(--field-row-box-h); --inline-input-edge: 0px; --inline-input-ring: 0px;
33
+ width: calc(100% + var(--field-row-box-x) * 2); height: var(--field-row-box-h);
34
+ margin: calc(var(--field-row-box-y) * -1) calc(var(--field-row-box-x) * -1);
35
+ }
36
+ :where([data-field-row-box="box"] [data-field-row-editor]) .o-number-editor[data-number-form="computer"] :is(.o-number-editor-field, .o-number-editor-field > .o-inline-input-group) {
37
+ height: var(--field-row-box-h); min-height: var(--field-row-box-h);
38
+ }
39
+ :where([data-field-row-box="box"] [data-field-row-editor]) .o-number-editor[data-number-form="computer"] .o-inline-input {
40
+ --inline-input-words: var(--field-row-box-x); border-radius: var(--field-row-box-r); background-color: transparent;
41
+ box-shadow: 0 0 0 var(--vk-border-width) var(--inline-input-colour), var(--vk-shadow-field-focus);
42
+ }
43
+ :where([data-field-row-box="box"] [data-field-row-editor]) .o-number-editor[data-number-form="computer"] .o-inline-input:is([aria-invalid="true"], :has(.o-input-control[aria-invalid="true"])) {
44
+ box-shadow: 0 0 0 var(--vk-border-width) var(--inline-input-colour), var(--vk-shadow-field-focus-danger);
45
+ }
46
+
27
47
  /* ── On a phone: the box and what is under it ───────────────────────────────────────────────────────────────────── */
28
48
  .o-number-editor[data-number-form="phone"] { display: grid; gap: calc(var(--vk-spacing) * 2); }
29
49
 
@@ -46,6 +46,14 @@ export declare const TEXT_EDITOR_TOKENS: readonly [{
46
46
  readonly name: "--vk-radius-md";
47
47
  readonly kind: "size";
48
48
  readonly outright: "--radius-md";
49
+ }, {
50
+ readonly name: "--vk-shadow-field-focus";
51
+ readonly kind: "shadow";
52
+ readonly outright: "--shadow-field-focus";
53
+ }, {
54
+ readonly name: "--vk-shadow-field-focus-danger";
55
+ readonly kind: "shadow";
56
+ readonly outright: "--shadow-field-focus-danger";
49
57
  }, {
50
58
  readonly name: "--vk-shadow-lg";
51
59
  readonly kind: "shadow";
@@ -11,6 +11,8 @@ export const TEXT_EDITOR_TOKENS = [
11
11
  { name: "--vk-line-height-xs", kind: "size", outright: "--text-xs--line-height" },
12
12
  { name: "--vk-overlay", kind: "colour", outright: "--surface-overlay" },
13
13
  { name: "--vk-radius-md", kind: "size", outright: "--radius-md" },
14
+ { name: "--vk-shadow-field-focus", kind: "shadow", outright: "--shadow-field-focus" },
15
+ { name: "--vk-shadow-field-focus-danger", kind: "shadow", outright: "--shadow-field-focus-danger" },
14
16
  { name: "--vk-shadow-lg", kind: "shadow", outright: "--shadow-lg" },
15
17
  { name: "--vk-shadow-menu", kind: "shadow", outright: "--shadow-menu" },
16
18
  { name: "--vk-spacing", kind: "size", outright: "--spacing" },
@@ -35,8 +35,8 @@
35
35
  width: max(100%, calc(var(--vk-spacing) * 75)); max-width: none; max-height: calc(var(--vk-spacing) * 80);
36
36
  box-shadow: var(--vk-shadow-lg), inset 0 0 0 var(--inline-input-ring, 0px) var(--inline-input-colour);
37
37
  }
38
- /* In a grid's cell (data-inline-input-place="cell", inline-input.css), never lifted, grown or long: the cell typed in shows only
39
- the caret. (0,5,0): over the two lifts above. */
38
+ /* In a grid's cell (data-inline-input-place="cell", inline-input.css), never lifted, grown or long: the cell typed in wears only
39
+ the selected cell's ring. (0,5,0): over the two lifts above. */
40
40
  [data-inline-input-place="cell"] .o-text-editor[data-text-box][data-grown] .o-text-editor-box,
41
41
  [data-inline-input-place="cell"] .o-text-editor[data-text-box][data-text-kind="long"] .o-text-editor-box {
42
42
  box-shadow: inset 0 0 0 var(--inline-input-ring, 0px) var(--inline-input-colour);
@@ -79,6 +79,28 @@
79
79
  .o-text-editor[data-text-place="row"][data-text-form] .o-text-editor-phone { position: relative; top: auto; left: auto; width: 100%; height: var(--inline-input-row); }
80
80
  .o-text-editor[data-text-place="row"][data-text-form] .o-text-editor-note { position: relative; top: auto; left: auto; margin-top: var(--vk-spacing); max-width: 100%; }
81
81
 
82
+ /* ── In a record's row that wears the Field's Box (data-field-row-box="box" on a frame round the rows; the row marks its open
83
+ editor data-field-row-editor): on a computer the box is the row's own, the rectangle its hover and its press drew. It stands
84
+ where that rectangle stood, pulled out by the box's reach and its height round the row's one line (the row's
85
+ --field-row-box-* variables, field.css), its words that reach in, no edge of its own, the row's ground: so
86
+ not a pixel of the words moves and the row keeps its height. Its ring is drawn outside it, a line of the brand and the
87
+ focus glow, red when refused. A line of text stays one line, scrolling sideways; long text still grows. A phone's form is
88
+ the phone's own. ─────────────────────────────────────────────────────────────────────────────────────────────────── */
89
+ :where([data-field-row-box="box"] [data-field-row-editor]) .o-text-editor[data-text-place="row"][data-text-form="computer"] {
90
+ --inline-input-row: var(--field-row-box-h); --inline-input-edge: 0px; --inline-input-ring: 0px;
91
+ width: calc(100% + var(--field-row-box-x) * 2); margin: calc(var(--field-row-box-y) * -1) calc(var(--field-row-box-x) * -1);
92
+ }
93
+ :where([data-field-row-box="box"] [data-field-row-editor]) .o-text-editor[data-text-place="row"][data-text-form="computer"] :is(.o-text-editor-box, .o-text-editor-phone) {
94
+ --inline-input-words: var(--field-row-box-x); border-radius: var(--field-row-box-r); background-color: transparent;
95
+ box-shadow: 0 0 0 var(--vk-border-width) var(--inline-input-colour), var(--vk-shadow-field-focus);
96
+ }
97
+ :where([data-field-row-box="box"] [data-field-row-editor]) .o-text-editor[data-text-place="row"][data-text-form="computer"] :is(.o-text-editor-box, .o-text-editor-phone):is([aria-invalid="true"], [data-refused]) {
98
+ box-shadow: 0 0 0 var(--vk-border-width) var(--inline-input-colour), var(--vk-shadow-field-focus-danger);
99
+ }
100
+ :where([data-field-row-box="box"] [data-field-row-editor]) .o-text-editor[data-text-place="row"][data-text-form="computer"]:not([data-text-kind="long"]) .o-text-editor-box {
101
+ white-space: pre; overflow: hidden;
102
+ }
103
+
82
104
  /* ── On a phone: the Input at the phone's size; long text one tall box; a phone's country in the box's start side ──── */
83
105
  .o-text-editor[data-text-form="phone"] { display: grid; }
84
106
  .o-text-editor[data-text-form="phone"] .o-text-editor-country { gap: calc(var(--vk-spacing) * 0.75); }
@@ -3,6 +3,7 @@ import * as React from "react";
3
3
  import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
4
4
  import { cx } from "../../internal/cx.js";
5
5
  import { usePopupHost } from "../internal/popup-host.js";
6
+ import { pxOf } from "../internal/read-token.js";
6
7
  import { Kbd } from "../kbd/kbd.js";
7
8
  export const TOOLTIP_TIMING = { delay: 500, warm: 300, tap: 4000 };
8
9
  function readMs(el, name, fallback) {
@@ -11,7 +12,7 @@ function readMs(el, name, fallback) {
11
12
  }
12
13
  const GroupWarm = React.createContext(null);
13
14
  const Box = ({ label, keys }) => _jsxs(_Fragment, { children: [label, keys && _jsx(Kbd, { keys: keys })] });
14
- const gap = (trigger, popup) => (parseFloat(popup ? getComputedStyle(popup).getPropertyValue("--vk-spacing") : "") || 4) * (trigger?.closest('[data-tooltip-arrow="soft"]') ? 2.5 : 1.5);
15
+ const gap = (trigger, popup) => (pxOf(popup, "--vk-spacing") || 4) * (trigger?.closest('[data-tooltip-arrow="soft"]') ? 2.5 : 1.5);
15
16
  export function Tooltip({ label, keys, reason, side = "top", align = "center", sideOffset, alignOffset = 0, open, defaultOpen, onOpenChange, disabled, delay, className, children }) {
16
17
  const ref = React.useRef(null), popup = React.useRef(null), host = usePopupHost(ref), id = React.useId();
17
18
  const [wait, setWait] = React.useState(TOOLTIP_TIMING.delay), tellWarm = React.useContext(GroupWarm);
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { memo, useContext, useEffect, useLayoutEffect, useRef, useState, } from "react";
4
4
  import { optimisticDisplay, phoneText, presentedDef, resolveFieldMessage, } from "viewkitjs/fields";
5
5
  import { ConvertedFigure } from "../display/converted.js";
@@ -17,7 +17,7 @@ import { RowEditor, rowOpensSheet } from "./editors/RowEditor.js";
17
17
  import { drawnText } from "./drawn-text.js";
18
18
  import { FieldNoteLine } from "./FieldNoteLine.js";
19
19
  import { FieldRowCheckbox } from "./field-row-checkbox.js";
20
- import { FIELD_ROW_FRAME, FIELD_ROW_FRAME_BESIDE, FIELD_ROW_FRAME_ROWS, FIELD_ROW_FRAME_ROWS_UNDER, FIELD_ROW_FRAME_UNDER, FieldRowButton, drawFieldRowButton, } from "./field-row-button.js";
20
+ import { FIELD_ROW_FRAME, FIELD_ROW_FRAME_BESIDE, FIELD_ROW_FRAME_ROWS, FIELD_ROW_FRAME_ROWS_UNDER, FIELD_ROW_FRAME_UNDER, FieldRowButton, drawFieldRowButton, TARGET_KEY, } from "./field-row-button.js";
21
21
  import { FieldRowLane } from "./FieldRowLane.js";
22
22
  import { FieldWriteReconciliationRequired, } from "../fields/write-target.js";
23
23
  import { OpenValueAction, isOpenableType } from "../editors/open-value.js";
@@ -251,6 +251,14 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
251
251
  setByKey(byKey);
252
252
  setEditing(true);
253
253
  };
254
+ const action = binding.action ??
255
+ ((field.type === "text" && field.format?.long) || field.type === "rich_text"
256
+ ? "expand"
257
+ : rowOpensSheet(field, oneValue)
258
+ ? "edit"
259
+ : "none");
260
+ const Act = inRows || action === "none" ? null : icons[action];
261
+ const actIcon = Act ? (_jsx("span", { "data-field-row-act": action, "aria-hidden": "true", className: "hidden", children: _jsx(Act, { className: "size-3.75" }) })) : null;
254
262
  const frameOf = (shape) => inRows
255
263
  ? shape === "under"
256
264
  ? FIELD_ROW_FRAME_ROWS_UNDER
@@ -262,7 +270,7 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
262
270
  : shape === "beside"
263
271
  ? FIELD_ROW_FRAME_BESIDE
264
272
  : FIELD_ROW_FRAME;
265
- const editButton = (shape, children) => (_jsx(FieldRowButton, { views: views, frame: cx(frameOf(shape), "disabled:pointer-events-none aria-disabled:pointer-events-none", shape !== "under" && pending && "opacity-70"), variant: "ghost", size: "sm", ref: buttonRef, "aria-label": unread || shape === "under" || !shownText ? field.label : `${field.label}, ${shownText}`, disabled: !ready, "aria-disabled": pending ? true : undefined, onClick: (event) => open(event.detail === 0), children: children }));
273
+ const editButton = (shape, children) => (_jsx(FieldRowButton, { views: views, frame: cx(frameOf(shape), "disabled:pointer-events-none aria-disabled:pointer-events-none", shape !== "under" && pending && "opacity-70"), variant: "ghost", size: "sm", ref: buttonRef, "data-key": inRows ? undefined : TARGET_KEY[shape], "aria-label": unread || shape === "under" || !shownText ? field.label : `${field.label}, ${shownText}`, disabled: !ready, "aria-disabled": pending ? true : undefined, onClick: (event) => open(event.detail === 0), children: children }));
266
274
  const rowRef = useRef(null);
267
275
  const downWhileEditing = useRef(false);
268
276
  const pressOpens = inRows && writable && shownDef.type !== "boolean" && !hasMenu && !unread && !editing && !pending && ready;
@@ -287,7 +295,7 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
287
295
  ?
288
296
  cx("o-field-row py-3", pressOpens && "cursor-pointer")
289
297
  :
290
- "group/field-row grid content-center items-start data-[form=computer]:grid-cols-[auto_var(--vk-field-row-label-w,calc(var(--spacing)*32))_minmax(0,1fr)_auto] data-[form=computer]:in-data-[field-row-icon=off]:grid-cols-[var(--vk-field-row-label-w,calc(var(--spacing)*32))_minmax(0,1fr)_auto] data-[form=phone]:grid-cols-[auto_minmax(0,1fr)_auto] data-[form=phone]:gap-y-1", !inRows && FIELD_ROW_FRAME_READS), "aria-busy": pending ? "true" : undefined, onClick: inRows ? onRowPress : undefined, onPointerDown: inRows
298
+ "group/field-row grid content-center items-start data-[form=computer]:grid-cols-[auto_var(--vk-field-row-label-w,calc(var(--spacing)*32))_minmax(0,1fr)_auto] data-[form=computer]:in-data-[field-row-icon=off]:grid-cols-[var(--vk-field-row-label-w,calc(var(--spacing)*32))_minmax(0,1fr)_auto] data-[form=phone]:grid-cols-[auto_minmax(0,1fr)_auto] data-[form=phone]:gap-y-1", !inRows && FIELD_ROW_FRAME_READS), "data-field-row": inRows ? undefined : "", "aria-busy": pending ? "true" : undefined, onClick: inRows ? onRowPress : undefined, onPointerDown: inRows
291
299
  ? () => {
292
300
  downWhileEditing.current = editing;
293
301
  }
@@ -295,7 +303,7 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
295
303
  ? "o-field-row-glyph"
296
304
  : "flex h-5 w-3.5 shrink-0 items-center justify-center group-data-[form=computer]/field-row:in-data-[field-row-icon=off]:hidden", children: glyph }), _jsx("span", { className: inRows
297
305
  ? "o-field-row-label"
298
- : "text-sm leading-5 text-(color:--vk-field-row-label-fg,var(--vk-fg-subtle))", children: field.label }), _jsxs("div", { className: cx(inRows ? "min-w-0 flex-1" : "min-w-0 flex-1 text-sm leading-5 text-(color:--vk-fg)", !inRows && "group-data-[form=phone]/field-row:col-span-2 group-data-[form=phone]/field-row:col-start-2 group-data-[form=phone]/field-row:row-start-2", settlement.requested && "italic opacity-80"), ...settlementAttributes(settlement.requested, field.provenance, conventions), children: [editing ? (_jsx("div", { children: _jsx(RowEditor, { binding: binding, row: row, initial: retryDraft ? retryDraft.commit : editValue, refused: retryDraft?.reason, shown: shown, conversion: convertedFrom ? body : undefined, anchor: inRows ? (_jsx("span", { className: "flex min-w-0", children: valueNode })) : (_jsx("span", { className: cx(TARGET, "bg-(color:--vk-neutral)"), children: valueNode })), onAttempt: (resolution) => {
306
+ : "text-sm leading-5 text-(color:--vk-field-row-label-fg,var(--vk-fg-subtle))", children: field.label }), _jsxs("div", { className: cx(inRows ? "min-w-0 flex-1" : "min-w-0 flex-1 text-sm leading-5 text-(color:--vk-fg)", !inRows && "group-data-[form=phone]/field-row:col-span-2 group-data-[form=phone]/field-row:col-start-2 group-data-[form=phone]/field-row:row-start-2", settlement.requested && "italic opacity-80"), ...settlementAttributes(settlement.requested, field.provenance, conventions), children: [editing ? (_jsx("div", { "data-field-row-editor": inRows ? undefined : "", children: _jsx(RowEditor, { binding: binding, row: row, initial: retryDraft ? retryDraft.commit : editValue, refused: retryDraft?.reason, shown: shown, conversion: convertedFrom ? body : undefined, anchor: inRows ? (_jsx("span", { className: "flex min-w-0", children: valueNode })) : (_jsxs("span", { className: cx(TARGET, "bg-(color:--vk-neutral)"), "data-field-row-anchor": "", children: [valueNode, actIcon] })), onAttempt: (resolution) => {
299
307
  watchLeaving();
300
308
  const answer = attempt(resolution);
301
309
  if (answer.accepted && leaving.current)
@@ -303,12 +311,13 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
303
311
  return answer;
304
312
  }, onClose: closed, message: message, kindIcon: kindIcon, openedByKey: byKey }) })) : hasMenu && !verbsInLane ? (_jsx(CommandMenu, { trigger: drawFieldRowButton(views, {
305
313
  frame: inRows ? FIELD_ROW_FRAME_ROWS : FIELD_ROW_FRAME,
314
+ ...(inRows ? {} : { "data-key": TARGET_KEY.target }),
306
315
  variant: "ghost",
307
316
  size: "sm",
308
317
  "aria-label": field.label,
309
318
  disabled: !ready,
310
319
  children: valueNode,
311
- }), items: menuItems, align: "start" })) : writable && shownDef.type !== "boolean" ? (valueOverButton ? (_jsxs("div", { className: "relative min-w-0", children: [editButton("under"), _jsx("span", { "data-slot": "vk-row-value-layer", className: cx("pointer-events-none relative block min-w-0 [&_a]:pointer-events-auto [&_button]:pointer-events-auto", pending && "opacity-70"), children: valueNode })] })) : openType ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1", children: [editButton("beside", valueNode), _jsx(OpenValueAction, { type: openType, value: openValue, label: openLabel, compact: true })] })) : (editButton("target", valueNode))) : (_jsx("span", { className: "block min-w-0", children: valueNode })), !editing && note ? (_jsx(FieldNoteLine, { note: typeof note === "string" ? { text: note } : note })) : null, !editing && error && retryDraft ? (_jsx("div", { role: "alert", className: "mt-1 text-xs text-(color:--vk-danger)", children: _jsx("button", { type: "button", "data-slot": "vk-field-retry", onClick: () => {
320
+ }), items: menuItems, align: "start" })) : writable && shownDef.type !== "boolean" ? (valueOverButton ? (_jsxs("div", { className: "relative min-w-0", children: [editButton("under", actIcon), _jsx("span", { "data-slot": "vk-row-value-layer", className: cx("pointer-events-none relative block min-w-0 [&_a]:pointer-events-auto [&_button]:pointer-events-auto", pending && "opacity-70"), children: valueNode })] })) : openType ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1", children: [editButton("beside", _jsxs(_Fragment, { children: [valueNode, actIcon] })), _jsx(OpenValueAction, { type: openType, value: openValue, label: openLabel, compact: true })] })) : (editButton("target", _jsxs(_Fragment, { children: [valueNode, actIcon] })))) : (_jsx("span", { className: "block min-w-0", children: valueNode })), !editing && note ? (_jsx(FieldNoteLine, { note: typeof note === "string" ? { text: note } : note })) : null, !editing && error && retryDraft ? (_jsx("div", { role: "alert", className: "mt-1 text-xs text-(color:--vk-danger)", children: _jsx("button", { type: "button", "data-slot": "vk-field-retry", onClick: () => {
312
321
  setError(null);
313
322
  const retried = attempt({ kind: "commit", payload: retryDraft.commit });
314
323
  if (!retried.accepted)
@@ -2,6 +2,16 @@ import type { MouseEvent as ReactMouseEvent, ReactElement, ReactNode, Ref } from
2
2
  import type { ViewsContextValue } from "../provider/context.js";
3
3
  /** What a field row's button reads from the provider: the app's `Button`. */
4
4
  export type FieldRowButtonViews = Pick<ViewsContextValue, "components">;
5
+ /** The row's target outside a Field rows card, named for the Field's Box (`data-field-row-box="box"`, field.css), which dresses it:
6
+ * the button, the button beside a link's open action, or the empty one laid under a rich text. Named in its `data-key`, which the
7
+ * app's Button forwards and writes nothing of its own into, so its own `data-slot` stays its own. The value an open picker keeps
8
+ * drawn in its place is ViewKit's own span, marked `data-field-row-anchor`. */
9
+ export type FieldRowTargetShape = "target" | "beside" | "under";
10
+ export declare const TARGET_KEY: {
11
+ readonly target: "vk-field-row-target";
12
+ readonly beside: "vk-field-row-beside";
13
+ readonly under: "vk-field-row-under";
14
+ };
5
15
  /** One button a field row draws itself, as each of its places describes it. */
6
16
  export type FieldRowButtonDraw = {
7
17
  /** The box ViewKit keeps on the app's `Button`: its size and its place. The look is the app's. */
@@ -13,6 +23,8 @@ export type FieldRowButtonDraw = {
13
23
  "aria-disabled"?: boolean;
14
24
  "aria-label"?: string;
15
25
  "data-slot"?: string;
26
+ /** Which of the row's targets this is, outside a Field rows card (`TARGET_KEY`). */
27
+ "data-key"?: string;
16
28
  /** Marks the press as the host's own: `data-no-nav` on a `display: contents` span around the app's button. */
17
29
  noNav?: boolean;
18
30
  onClick?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
@@ -1,5 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ export const TARGET_KEY = {
4
+ target: "vk-field-row-target",
5
+ beside: "vk-field-row-beside",
6
+ under: "vk-field-row-under",
7
+ };
3
8
  export const FIELD_ROW_FRAME = "-mx-2 -my-1 flex h-auto min-h-7 w-[calc(100%+1rem)] min-w-0 items-center justify-start whitespace-normal px-2 py-1 text-left [font:inherit]";
4
9
  export const FIELD_ROW_FRAME_BESIDE = "-ml-2 -my-1 flex h-auto min-h-7 min-w-0 flex-1 items-center justify-start whitespace-normal px-2 py-1 text-left [font:inherit]";
5
10
  export const FIELD_ROW_FRAME_UNDER = "absolute -inset-x-2 -inset-y-1 h-auto w-auto p-0";
@@ -67,6 +67,10 @@ export type FieldBinding<Row, D extends FieldDef = FieldDef> = {
67
67
  addOption?: OptionAdd;
68
68
  /** The app's own icon name for this field, drawn by the app's AppIcon; the type's glyph when absent. */
69
69
  icon?: string;
70
+ /** What a field row's one icon says a click does, under the Field's Action (`row-action: icon`): `edit` (an editor
71
+ * opens), `expand` (a long text opens) or `none`. Absent, the row answers by its type: expand for a long text or a rich
72
+ * text, edit where its editor opens in a popover, none where the box is the input. */
73
+ action?: "none" | "edit" | "expand";
70
74
  /** This row keeps only the values of a `multiple` field (a plain list column): its editor offers no label box.
71
75
  * Absent, each value keeps its label. */
72
76
  labels?: false;
@@ -39,7 +39,7 @@ export type GridCellEditorContext<Row> = {
39
39
  onCancel: () => void;
40
40
  /** Told the moment the editor starts to close (its session accepted an answer), with the reason, before its exit
41
41
  * plays: the cell stops wearing `data-editing` then, and a press away lets the pick go. */
42
- onClosing?: (reason: CloseReason | null) => void;
42
+ onClosing?: (reason: CloseReason | null, popover: boolean) => void;
43
43
  onTab: (backwards: boolean) => void;
44
44
  onEnter: () => void;
45
45
  };
@@ -49,5 +49,17 @@ export declare const GRID_CELL_HOVER_SHADOW = "hover:shadow-[var(--vk-outline-ho
49
49
  */
50
50
  export declare const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-(--vk-outline-radius,var(--radius-sm)) hover:after:border hover:after:border-(color:--vk-outline-hover,var(--vk-border-bold))";
51
51
  /** The selection ring, in the same geometry the hover ring draws. Drawn on a selected cell, never while its editor is
52
- * open: an open editor shows no ring, no lift and no tint on its cell. */
52
+ * open: an open editor shows no lift and no tint on its cell, a popover no ring, and a cell typed in this same ring drawn
53
+ * by its box (`GRID_TYPED_RING`). */
53
54
  export declare function GridCellOutline(): import("react/jsx-runtime").JSX.Element;
55
+ /**
56
+ * The selection ring on the box a cell is typed in (a text, an email, a link, a phone, a number): the same line, colour and
57
+ * corners as `GridCellOutline`, where it stood, so typing in keeps the cell marked; worn by the box itself, it goes round all
58
+ * the box covers as it grows past the cell. On the grid's type-in layer, which stands a pixel past the cell on each side
59
+ * (`GRID_EDITOR_LAYER`), so the line is set two lines in and the corners a line rounder, lying exactly on the selected
60
+ * ring. Refused, the box's own red ring stands alone. A text box is a textarea, whose own corners weigh a tag more.
61
+ */
62
+ export declare const GRID_TYPED_RING: {
63
+ readonly text: string;
64
+ readonly number: string;
65
+ };