@viewkitjs/views 0.2.0 → 0.3.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 (292) hide show
  1. package/CHANGELOG.md +571 -0
  2. package/README.md +5 -3
  3. package/dist/atoms/LoadMore.js +11 -1
  4. package/dist/atoms/RowMenu.js +5 -2
  5. package/dist/cells/cell-format.d.ts +3 -3
  6. package/dist/cells/cell-title.d.ts +1 -2
  7. package/dist/cells/cell-title.js +2 -2
  8. package/dist/cells/cell-values.js +6 -3
  9. package/dist/contract.d.ts +50 -9
  10. package/dist/contract.js +33 -5
  11. package/dist/display/converted.d.ts +19 -0
  12. package/dist/display/converted.js +12 -0
  13. package/dist/display/index.d.ts +1 -0
  14. package/dist/display/index.js +1 -0
  15. package/dist/display/link-click.d.ts +11 -0
  16. package/dist/display/link-click.js +3 -0
  17. package/dist/display/link.js +7 -3
  18. package/dist/display/multi-value.d.ts +1 -1
  19. package/dist/display/multi-value.js +1 -1
  20. package/dist/display/options.d.ts +7 -1
  21. package/dist/display/phone.js +3 -1
  22. package/dist/editors/ChipsEditor.d.ts +9 -4
  23. package/dist/editors/ChipsEditor.js +6 -2
  24. package/dist/editors/DateEditor.d.ts +21 -6
  25. package/dist/editors/DateEditor.js +118 -30
  26. package/dist/editors/EditorPanel.d.ts +61 -0
  27. package/dist/editors/EditorPanel.js +54 -0
  28. package/dist/editors/LocationEditor.d.ts +3 -0
  29. package/dist/editors/LocationEditor.js +14 -6
  30. package/dist/editors/NameEditor.d.ts +3 -0
  31. package/dist/editors/NameEditor.js +11 -7
  32. package/dist/editors/NumberEditor.d.ts +3 -0
  33. package/dist/editors/NumberEditor.js +6 -6
  34. package/dist/editors/RangeEditor.d.ts +16 -1
  35. package/dist/editors/RangeEditor.js +21 -5
  36. package/dist/editors/RelationEditor.d.ts +13 -28
  37. package/dist/editors/RelationEditor.js +17 -40
  38. package/dist/editors/RelationSetEditor.d.ts +53 -0
  39. package/dist/editors/RelationSetEditor.js +112 -0
  40. package/dist/editors/SelectEditor.d.ts +21 -3
  41. package/dist/editors/SelectEditor.js +55 -9
  42. package/dist/editors/TextEditor.d.ts +51 -0
  43. package/dist/editors/TextEditor.js +81 -0
  44. package/dist/editors/ValueListEditor.d.ts +3 -0
  45. package/dist/editors/ValueListEditor.js +4 -2
  46. package/dist/editors/edit-cores.d.ts +12 -9
  47. package/dist/editors/edit-cores.js +7 -6
  48. package/dist/editors/edit-session.d.ts +21 -11
  49. package/dist/editors/edit-session.js +19 -5
  50. package/dist/editors/keep-inside.d.ts +12 -0
  51. package/dist/editors/keep-inside.js +20 -0
  52. package/dist/editors/open-value.d.ts +21 -0
  53. package/dist/editors/open-value.js +36 -0
  54. package/dist/editors/open-values.d.ts +4 -0
  55. package/dist/editors/open-values.js +7 -0
  56. package/dist/editors/relation-kinds.d.ts +7 -0
  57. package/dist/editors/relation-kinds.js +21 -0
  58. package/dist/editors/relation-panel.d.ts +69 -0
  59. package/dist/editors/relation-panel.js +40 -0
  60. package/dist/field-row/FieldNoteLine.d.ts +14 -0
  61. package/dist/field-row/FieldNoteLine.js +14 -0
  62. package/dist/field-row/FieldRow.d.ts +73 -0
  63. package/dist/field-row/FieldRow.js +157 -0
  64. package/dist/field-row/FieldRowLane.d.ts +19 -0
  65. package/dist/field-row/FieldRowLane.js +11 -0
  66. package/dist/field-row/editors/RowChipsEditor.d.ts +11 -0
  67. package/dist/field-row/editors/RowChipsEditor.js +25 -0
  68. package/dist/field-row/editors/RowDateEditor.d.ts +16 -0
  69. package/dist/field-row/editors/RowDateEditor.js +18 -0
  70. package/dist/field-row/editors/RowEditor.d.ts +39 -0
  71. package/dist/field-row/editors/RowEditor.js +64 -0
  72. package/dist/field-row/editors/RowNameEditor.d.ts +4 -0
  73. package/dist/field-row/editors/RowNameEditor.js +15 -0
  74. package/dist/field-row/editors/RowNumberEditor.d.ts +12 -0
  75. package/dist/field-row/editors/RowNumberEditor.js +18 -0
  76. package/dist/field-row/editors/RowPlaceEditor.d.ts +8 -0
  77. package/dist/field-row/editors/RowPlaceEditor.js +18 -0
  78. package/dist/field-row/editors/RowRangeEditor.d.ts +4 -0
  79. package/dist/field-row/editors/RowRangeEditor.js +15 -0
  80. package/dist/field-row/editors/RowRelationEditor.d.ts +20 -0
  81. package/dist/field-row/editors/RowRelationEditor.js +77 -0
  82. package/dist/field-row/editors/RowSelectEditor.d.ts +13 -0
  83. package/dist/field-row/editors/RowSelectEditor.js +23 -0
  84. package/dist/field-row/editors/RowTextEditor.d.ts +15 -0
  85. package/dist/field-row/editors/RowTextEditor.js +16 -0
  86. package/dist/field-row/editors/RowValueListEditor.d.ts +4 -0
  87. package/dist/field-row/editors/RowValueListEditor.js +21 -0
  88. package/dist/field-row/editors/host.d.ts +59 -0
  89. package/dist/field-row/editors/host.js +1 -0
  90. package/dist/field-row/editors/row-session.d.ts +49 -0
  91. package/dist/field-row/editors/row-session.js +49 -0
  92. package/dist/field-row/index.d.ts +5 -0
  93. package/dist/field-row/index.js +5 -0
  94. package/dist/field-row/row-target.d.ts +20 -0
  95. package/dist/field-row/row-target.js +3 -0
  96. package/dist/field-row/useFieldWrite.d.ts +45 -0
  97. package/dist/field-row/useFieldWrite.js +190 -0
  98. package/dist/field-row/useRowSettlement.d.ts +33 -0
  99. package/dist/field-row/useRowSettlement.js +23 -0
  100. package/dist/fields/binding.d.ts +6 -1
  101. package/dist/fields/binding.js +13 -6
  102. package/dist/fields/edit-core-types.d.ts +9 -9
  103. package/dist/fields/edit-core-types.js +6 -6
  104. package/dist/fields/money.d.ts +5 -0
  105. package/dist/fields/money.js +10 -0
  106. package/dist/fields/number-edit.d.ts +6 -0
  107. package/dist/fields/number-edit.js +4 -0
  108. package/dist/fields/prepare-write.js +6 -1
  109. package/dist/fields/relation-source-types.d.ts +12 -0
  110. package/dist/fields/write-target.d.ts +50 -0
  111. package/dist/fields/write-target.js +10 -0
  112. package/dist/grid/chrome/GridAddColumn.js +1 -1
  113. package/dist/grid/chrome/GridAggregateMenu.d.ts +1 -1
  114. package/dist/grid/chrome/GridAggregateMenu.js +8 -6
  115. package/dist/grid/chrome/GridCellEditors.d.ts +7 -0
  116. package/dist/grid/chrome/GridCellEditors.js +87 -16
  117. package/dist/grid/chrome/GridCellOutline.d.ts +22 -43
  118. package/dist/grid/chrome/GridCellOutline.js +2 -7
  119. package/dist/grid/chrome/GridChipsEditor.d.ts +16 -6
  120. package/dist/grid/chrome/GridChipsEditor.js +21 -26
  121. package/dist/grid/chrome/GridColumnMenu.d.ts +1 -1
  122. package/dist/grid/chrome/GridColumnMenu.js +7 -3
  123. package/dist/grid/chrome/GridDateEditor.d.ts +23 -11
  124. package/dist/grid/chrome/GridDateEditor.js +13 -25
  125. package/dist/grid/chrome/GridFooter.d.ts +12 -2
  126. package/dist/grid/chrome/GridFooter.js +10 -6
  127. package/dist/grid/chrome/GridGroupMenu.js +20 -13
  128. package/dist/grid/chrome/GridHeader.d.ts +9 -4
  129. package/dist/grid/chrome/GridHeader.js +15 -10
  130. package/dist/grid/chrome/GridLongTextEditor.d.ts +28 -9
  131. package/dist/grid/chrome/GridLongTextEditor.js +16 -74
  132. package/dist/grid/chrome/GridNameEditor.d.ts +11 -6
  133. package/dist/grid/chrome/GridNameEditor.js +12 -27
  134. package/dist/grid/chrome/GridNumberEditor.d.ts +20 -6
  135. package/dist/grid/chrome/GridNumberEditor.js +46 -20
  136. package/dist/grid/chrome/GridPlaceEditor.d.ts +26 -0
  137. package/dist/grid/chrome/GridPlaceEditor.js +22 -0
  138. package/dist/grid/chrome/GridRangeEditor.d.ts +15 -5
  139. package/dist/grid/chrome/GridRangeEditor.js +16 -20
  140. package/dist/grid/chrome/GridRelationEditor.d.ts +38 -14
  141. package/dist/grid/chrome/GridRelationEditor.js +86 -24
  142. package/dist/grid/chrome/GridRow.d.ts +7 -1
  143. package/dist/grid/chrome/GridRow.js +57 -14
  144. package/dist/grid/chrome/GridRowActions.js +1 -1
  145. package/dist/grid/chrome/GridRowCells.js +18 -23
  146. package/dist/grid/chrome/GridSelectEditor.d.ts +19 -4
  147. package/dist/grid/chrome/GridSelectEditor.js +21 -27
  148. package/dist/grid/chrome/GridStructure.d.ts +9 -10
  149. package/dist/grid/chrome/GridStructure.js +10 -14
  150. package/dist/grid/chrome/GridTable.js +97 -30
  151. package/dist/grid/chrome/GridTableSurface.d.ts +39 -2
  152. package/dist/grid/chrome/GridTableSurface.js +12 -3
  153. package/dist/grid/chrome/GridTextEditor.d.ts +35 -1
  154. package/dist/grid/chrome/GridTextEditor.js +35 -37
  155. package/dist/grid/chrome/GridValueListEditor.d.ts +15 -3
  156. package/dist/grid/chrome/GridValueListEditor.js +10 -27
  157. package/dist/grid/chrome/cell-cut-off.d.ts +11 -0
  158. package/dist/grid/chrome/cell-cut-off.js +20 -0
  159. package/dist/grid/chrome/cells.js +1 -2
  160. package/dist/grid/chrome/checks.d.ts +2 -5
  161. package/dist/grid/chrome/checks.js +15 -5
  162. package/dist/grid/chrome/editors.d.ts +1 -1
  163. package/dist/grid/chrome/editors.js +1 -1
  164. package/dist/grid/chrome/grid-cell-classes.d.ts +2 -8
  165. package/dist/grid/chrome/grid-cell-classes.js +10 -8
  166. package/dist/grid/chrome/grid-cell-link.d.ts +13 -0
  167. package/dist/grid/chrome/grid-cell-link.js +9 -0
  168. package/dist/grid/chrome/grid-edit-session.d.ts +63 -0
  169. package/dist/grid/chrome/grid-edit-session.js +118 -0
  170. package/dist/grid/chrome/grid-hover.d.ts +60 -0
  171. package/dist/grid/chrome/grid-hover.js +81 -0
  172. package/dist/grid/chrome/grid-menu-focus.d.ts +43 -0
  173. package/dist/grid/chrome/grid-menu-focus.js +93 -0
  174. package/dist/grid/chrome/grid-row-menu-key.d.ts +15 -0
  175. package/dist/grid/chrome/grid-row-menu-key.js +36 -0
  176. package/dist/grid/chrome/grid-row-props.d.ts +16 -4
  177. package/dist/grid/chrome/grid-row-window.d.ts +61 -0
  178. package/dist/grid/chrome/grid-row-window.js +212 -0
  179. package/dist/grid/chrome/grid-scroll-owner.d.ts +38 -0
  180. package/dist/grid/chrome/grid-scroll-owner.js +75 -0
  181. package/dist/grid/chrome/grid-styles.d.ts +4 -1
  182. package/dist/grid/chrome/grid-styles.js +1 -0
  183. package/dist/grid/chrome/grid-table-props.d.ts +2 -3
  184. package/dist/grid/chrome/useGridFocus.d.ts +45 -0
  185. package/dist/grid/chrome/useGridFocus.js +122 -0
  186. package/dist/grid/chrome/useGridKeyboard.d.ts +21 -4
  187. package/dist/grid/chrome/useGridKeyboard.js +214 -38
  188. package/dist/grid/chrome/useGridRangeActions.d.ts +3 -1
  189. package/dist/grid/chrome/useGridRangeActions.js +17 -10
  190. package/dist/grid/chrome/useGridRangeGestures.js +68 -21
  191. package/dist/grid/chrome/useGridRowContextMenu.d.ts +4 -2
  192. package/dist/grid/chrome/useGridRowContextMenu.js +28 -2
  193. package/dist/grid/chrome/useGridScaleStyles.d.ts +3 -1
  194. package/dist/grid/chrome/useGridScaleStyles.js +6 -7
  195. package/dist/grid/chrome/useGridScrollArea.d.ts +21 -0
  196. package/dist/grid/chrome/useGridScrollArea.js +65 -0
  197. package/dist/grid/chrome/useGridTableInteractionModel.d.ts +28 -5
  198. package/dist/grid/chrome/useGridTableInteractionModel.js +66 -14
  199. package/dist/grid/chrome/useHeaderDragReorder.d.ts +2 -2
  200. package/dist/grid/core/clipboard-model.d.ts +2 -0
  201. package/dist/grid/core/clipboard-model.js +1 -1
  202. package/dist/grid/core/commit-model.d.ts +7 -0
  203. package/dist/grid/core/edge-scroll.d.ts +21 -0
  204. package/dist/grid/core/edge-scroll.js +23 -0
  205. package/dist/grid/core/editing-controller.d.ts +2 -1
  206. package/dist/grid/core/editing-controller.js +35 -9
  207. package/dist/grid/core/editing-model.d.ts +9 -0
  208. package/dist/grid/core/editing-model.js +12 -0
  209. package/dist/grid/core/flat-rows.d.ts +35 -0
  210. package/dist/grid/core/flat-rows.js +20 -0
  211. package/dist/grid/core/grid-aria.d.ts +27 -0
  212. package/dist/grid/core/grid-aria.js +39 -0
  213. package/dist/grid/core/grid-focus.d.ts +54 -0
  214. package/dist/grid/core/grid-focus.js +148 -0
  215. package/dist/grid/core/nav.d.ts +2 -2
  216. package/dist/grid/core/pending-reconciliation.d.ts +3 -0
  217. package/dist/grid/core/pending-reconciliation.js +5 -3
  218. package/dist/grid/core/row-window.d.ts +40 -0
  219. package/dist/grid/core/row-window.js +43 -0
  220. package/dist/grid/core/spreadsheet-operations.d.ts +17 -1
  221. package/dist/grid/core/spreadsheet-operations.js +33 -6
  222. package/dist/grid/core/useGridEditing.d.ts +3 -0
  223. package/dist/grid/core/useGridEditing.js +6 -3
  224. package/dist/grid/core/value-equality.d.ts +23 -1
  225. package/dist/grid/core/value-equality.js +46 -0
  226. package/dist/grid/useGridTablePrefs.d.ts +0 -1
  227. package/dist/grid/useGridTablePrefs.js +1 -3
  228. package/dist/index.d.ts +1 -0
  229. package/dist/index.js +1 -0
  230. package/dist/internal/viewport.d.ts +0 -2
  231. package/dist/internal/viewport.js +0 -14
  232. package/dist/model/column-capabilities.d.ts +2 -1
  233. package/dist/model/column-capabilities.js +28 -8
  234. package/dist/model/column-from.js +3 -0
  235. package/dist/model/column-inspect.d.ts +10 -2
  236. package/dist/model/column-inspect.js +9 -0
  237. package/dist/model/column-schema.d.ts +6 -1
  238. package/dist/model/column-types.d.ts +3 -1
  239. package/dist/model/column-types.js +1 -1
  240. package/dist/model/preferences.d.ts +0 -4
  241. package/dist/model/preferences.js +0 -1
  242. package/dist/model/prefs-buckets.d.ts +0 -1
  243. package/dist/model/prefs-buckets.js +0 -3
  244. package/dist/model/render-count.d.ts +6 -0
  245. package/dist/model/render-count.js +11 -0
  246. package/dist/provider/ViewsProvider.d.ts +5 -1
  247. package/dist/provider/ViewsProvider.js +9 -3
  248. package/dist/provider/components.d.ts +19 -1
  249. package/dist/provider/components.js +4 -2
  250. package/dist/provider/context.d.ts +5 -2
  251. package/dist/provider/desktop.d.ts +9 -0
  252. package/dist/provider/desktop.js +22 -0
  253. package/dist/provider/plain-input.d.ts +8 -0
  254. package/dist/provider/plain-input.js +5 -0
  255. package/dist/react.d.ts +2 -1
  256. package/dist/react.js +1 -0
  257. package/dist/selection/SelectCheckbox.d.ts +3 -1
  258. package/dist/selection/SelectCheckbox.js +2 -2
  259. package/dist/selection/useCheckDragSelect.js +6 -5
  260. package/docs/contract.md +93 -35
  261. package/docs/guides/atoms.md +1 -1
  262. package/docs/guides/cells.md +2 -2
  263. package/docs/guides/columns.md +3 -2
  264. package/docs/guides/display.md +1 -0
  265. package/docs/guides/editors.md +71 -13
  266. package/docs/guides/the-grid.md +32 -13
  267. package/docs/guides/the-provider.md +3 -1
  268. package/docs/index.md +3 -1
  269. package/docs/install.md +1 -1
  270. package/docs/reference/cells.md +1 -1
  271. package/docs/reference/display.md +3 -1
  272. package/docs/reference/editors-chips.md +2 -2
  273. package/docs/reference/editors-date.md +3 -3
  274. package/docs/reference/editors-location.md +1 -1
  275. package/docs/reference/editors-number.md +1 -1
  276. package/docs/reference/editors-open-values.md +1 -0
  277. package/docs/reference/editors-panel.md +12 -0
  278. package/docs/reference/editors-range.md +1 -1
  279. package/docs/reference/editors-relation.md +6 -3
  280. package/docs/reference/editors-select.md +3 -2
  281. package/docs/reference/editors-session.md +4 -2
  282. package/docs/reference/editors-text.md +9 -0
  283. package/docs/reference/editors-value-list.md +1 -1
  284. package/docs/reference/editors.md +2 -2
  285. package/docs/reference/field-row.md +16 -0
  286. package/docs/reference/grid.md +3 -3
  287. package/docs/reference/react.md +8 -5
  288. package/docs/reference/views.md +36 -15
  289. package/package.json +23 -4
  290. package/skills/views/SKILL.md +4 -4
  291. package/dist/grid/chrome/useGridScrollSync.d.ts +0 -38
  292. package/dist/grid/chrome/useGridScrollSync.js +0 -176
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A row's menu by keyboard. Shift+F10 and the menu key are ARIA's keys for a context menu; ⌘⇧\ (Ctrl+Shift+\ off a
3
+ * Mac) is Google Sheets', the one a Mac keyboard reaches without fn (decided 11 Nov). Matched on the key's place
4
+ * (`code`), so Shift's "|" and a layout's own backslash read the same.
5
+ */
6
+ export declare function isGridRowMenuKey(event: Pick<KeyboardEvent, "key" | "code" | "shiftKey" | "metaKey" | "ctrlKey" | "altKey">): boolean;
7
+ /**
8
+ * Opens the row's menu from its focused cell the way the row's ⋯ does: a right-click dispatched on the cell, under
9
+ * it, which the row's menu (the app's `RowMenu`, or the default) answers with the rows a right-click on that cell
10
+ * gets. Then it watches the page until a menu has come and gone, and puts focus back on the cell when it fell to the
11
+ * body (a menu with no trigger gives it back to nothing), as the column and footer menus do. Focus put elsewhere (a
12
+ * click away, a dialog a pick opened) is left there. Returns what stops the watch: the next key on the cell, or the
13
+ * grid leaving the page, for a menu that never opened.
14
+ */
15
+ export declare function openGridRowMenu(cell: HTMLElement): () => void;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ export function isGridRowMenuKey(event) {
3
+ const { key, code, shiftKey, metaKey, ctrlKey, altKey } = event;
4
+ if (key === "ContextMenu")
5
+ return !shiftKey && !metaKey && !ctrlKey && !altKey;
6
+ if (key === "F10")
7
+ return shiftKey && !metaKey && !ctrlKey && !altKey;
8
+ return code === "Backslash" && shiftKey && (metaKey || ctrlKey) && !altKey;
9
+ }
10
+ const MENU = '[role="menu"]';
11
+ export function openGridRowMenu(cell) {
12
+ const rect = cell.getBoundingClientRect();
13
+ cell.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX: rect.left, clientY: rect.bottom }));
14
+ if (typeof MutationObserver === "undefined")
15
+ return () => { };
16
+ let entered = document.activeElement?.closest?.(MENU) != null;
17
+ const onFocusIn = (event) => {
18
+ if (event.target?.closest?.(MENU))
19
+ entered = true;
20
+ };
21
+ const stop = () => {
22
+ watch.disconnect();
23
+ document.removeEventListener("focusin", onFocusIn, true);
24
+ };
25
+ const watch = new MutationObserver(() => {
26
+ if (!entered || document.querySelector(MENU))
27
+ return;
28
+ stop();
29
+ const active = document.activeElement;
30
+ if ((active == null || active === document.body) && cell.isConnected)
31
+ cell.focus({ preventScroll: true });
32
+ });
33
+ document.addEventListener("focusin", onFocusIn, true);
34
+ watch.observe(document.body, { childList: true, subtree: true });
35
+ return stop;
36
+ }
@@ -15,7 +15,6 @@ export type GridRowProps<Row> = {
15
15
  * under several groups. Focus, the editor, arrows and ranges are in terms of
16
16
  * it; see `GridCellPos`. */
17
17
  rowKey: string;
18
- gridTemplate: string;
19
18
  columns: ListColumn<Row>[];
20
19
  selectable: boolean;
21
20
  selected: boolean;
@@ -43,8 +42,6 @@ export type GridRowProps<Row> = {
43
42
  * turned the "Row icon" toggle off, or the list has no icon to draw. */
44
43
  rowIcon?: ListRowIconAccessor<Row>;
45
44
  verticalBorders?: boolean;
46
- /** Cells wrap to at most 3 lines and the row grows to its tallest cell. */
47
- wrapCells?: boolean;
48
45
  optionColors?: ListOptionColorOverrides;
49
46
  dateStyles?: ListDateStyleOverrides;
50
47
  /** Per-field duration rendering (override → `format.durationStyle` → adaptive). */
@@ -72,6 +69,16 @@ export type GridRowProps<Row> = {
72
69
  * memo-stable (GridTable caches identity per row). Undefined when no
73
70
  * multi-cell range touches the row — the common case renders as before. */
74
71
  rowRange?: GridRowRangeSpan[];
72
+ /** The row's number among every row of the grid, bars, column names and footers included (1-based). */
73
+ ariaRowIndex?: number;
74
+ /** In a tree grid (a grouped grid): 2, a group's row; its place in its group and the group's size. */
75
+ ariaLevel?: number;
76
+ ariaPosInSet?: number;
77
+ ariaSetSize?: number;
78
+ /** Columns before the first data column: 1 with the checkbox lane, else 0. */
79
+ ariaColOffset?: number;
80
+ /** The tail's column (the row's ⋯): the last. */
81
+ ariaTailIndex?: number;
75
82
  /** How many LEADING columns are pinned to the left edge. A plain number, so a
76
83
  * memoized row doesn't re-render on every scroll; the row computes its own
77
84
  * sticky offsets from it. 0 = nothing frozen. */
@@ -83,7 +90,9 @@ export type GridRowProps<Row> = {
83
90
  * what the columns declare. Memo-stable: threaded straight from the host. */
84
91
  listConfig?: ListSettingsConfig;
85
92
  onFocusCell: (rowId: string, columnId: string) => void;
86
- onStartEdit: (rowId: string, columnId: string) => void;
93
+ /** Open a cell's editor. `seed`: the character that opened it (type-to-replace). `whole`: the
94
+ * text was cut off in its cell, so it opens whole in the panel over the cell. */
95
+ onStartEdit: (rowId: string, columnId: string, seed?: string | null, whole?: boolean) => void;
87
96
  /** A second click or a double-click on a cell that opens nothing: the grid
88
97
  * says why it can't be edited (or nothing, when it can be written). */
89
98
  onRefuseEdit?: (columnId: string) => void;
@@ -95,6 +104,9 @@ export type GridRowProps<Row> = {
95
104
  /** Type-to-replace seed: the character that opened THIS row's editor, or null.
96
105
  * Used as the editor's initial value in place of the cell's own. */
97
106
  editSeed?: string | null;
107
+ /** THIS row's open text was cut off when it opened: it shows whole in the panel over the cell.
108
+ * False on every row but the editing one. */
109
+ editWhole?: boolean;
98
110
  /** Shift-click: extend the active range to this cell (anchor stays). */
99
111
  onExtendCell: (rowId: string, columnId: string) => void;
100
112
  /** ⌘-click: add this cell as its own range. */
@@ -0,0 +1,61 @@
1
+ import { type ReactNode, type RefObject } from "react";
2
+ import type { GridFlatRows, GridRowPlace } from "../core/flat-rows.js";
3
+ import { type GridRowRange } from "../core/row-window.js";
4
+ /**
5
+ * THE ROWS ON SCREEN. Each group draws only the rows its scroll owner shows, plus `GRID_WINDOW_OVERSCAN` each side,
6
+ * in flow between spacers as tall as the rows they stand for, so every group's box stays as tall as the group and its
7
+ * head pins as before (`prototypes/pinned-group-header/`). The rows kept drawn wherever they are (the focused, the editing, a focused checkbox's, the last revealed)
8
+ * are their own runs between spacers.
9
+ *
10
+ * One store per table, like the hover store: a scroll anywhere (one capture listener on the document, which hears the
11
+ * grid's own area and the page alike) and a resize write each group's range, and each group's rows subscribe to their
12
+ * own, so a scroll redraws only the rows lists whose range changed: never the table, a head or a footer.
13
+ */
14
+ /** A group's window. `range` is undefined until the first measure writes one: its rows draw their fallback. */
15
+ export type GridRowWindowSnapshot = {
16
+ range: GridRowRange | undefined;
17
+ revealed: number | null;
18
+ };
19
+ export type GridRowWindowStore = {
20
+ get(groupKey: string): GridRowWindowSnapshot;
21
+ /** Writes every group's range; notifies only the groups whose snapshot changed. */
22
+ setRanges(ranges: ReadonlyMap<string, GridRowRange>): void;
23
+ /** Marks one row as revealed (kept drawn) and clears the last one. */
24
+ reveal(place: GridRowPlace | null): void;
25
+ subscribe(groupKey: string, listener: () => void): () => void;
26
+ };
27
+ export declare function createGridRowWindowStore(): GridRowWindowStore;
28
+ export declare const GridRowWindowContext: import("react").Context<GridRowWindowStore | null>;
29
+ /** One group's window. With no store (rows drawn outside a table), every row. */
30
+ export declare function useGridGroupWindow(groupKey: string): GridRowWindowSnapshot;
31
+ /** What an open group draws where nothing can be measured: its first rows. A collapsed group draws none. */
32
+ export declare function fallbackRange(count: number, collapsed: boolean): GridRowRange;
33
+ /**
34
+ * Measures the groups' rows regions, follows every scroll, and answers the reveal seam (`revealGridCell`'s
35
+ * `revealRow`). Positions are read in the content box's coordinates: a group's rows start at its region's top, and
36
+ * its region ends where its box does, so a collapsing group draws only what its clip still shows.
37
+ */
38
+ export declare function useGridRowWindow<Row>({ rootRef, flat, rowHeight, }: {
39
+ rootRef: RefObject<HTMLDivElement | null>;
40
+ flat: GridFlatRows<Row>;
41
+ /** One row's height in px: `GRID_ROW_PX` times the grid's scale, what `--vk-row-h` resolves to. */
42
+ rowHeight: number;
43
+ }): {
44
+ store: GridRowWindowStore;
45
+ revealRow: (rowKey: string, columnId?: string) => void;
46
+ };
47
+ /**
48
+ * The row lines an undrawn stretch shows: one hairline a row apart, the rows' own bottom border, so a fling that
49
+ * outruns the drawing shows empty rows filling in, never a blank.
50
+ */
51
+ export declare const GRID_GAP_LINES = "repeating-linear-gradient(to bottom, transparent 0 calc(var(--vk-row-h) - 1px), var(--vk-border-subtle) calc(var(--vk-row-h) - 1px) var(--vk-row-h))";
52
+ /** One section's rows: its window's rows and the kept ones between spacers, inside its rows region. */
53
+ export declare function GridWindowRows<Row>({ groupKey, items, collapsed, kept, renderRow, }: {
54
+ groupKey: string;
55
+ items: Row[];
56
+ /** A shut group: before the first measure it draws none. */
57
+ collapsed: boolean;
58
+ /** Indices drawn wherever they are: the focused and the editing row. */
59
+ kept: readonly number[];
60
+ renderRow: (row: Row, index: number, items: Row[], groupKey: string) => ReactNode;
61
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,212 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useCallback, useContext, useLayoutEffect, useRef, useState, useSyncExternalStore, } from "react";
4
+ import { flushSync } from "react-dom";
5
+ import { GRID_WINDOW_FALLBACK_ROWS, gridGroupRange, gridRowSegments, } from "../core/row-window.js";
6
+ import { findGridScrollOwner, gridVisibleBox } from "./grid-scroll-owner.js";
7
+ const sameRange = (a, b) => a === b || (a != null && b != null && a.start === b.start && a.end === b.end);
8
+ export function createGridRowWindowStore() {
9
+ const snapshots = new Map();
10
+ const listeners = new Map();
11
+ let revealed = null;
12
+ const notify = (groupKey) => {
13
+ for (const listener of listeners.get(groupKey) ?? [])
14
+ listener();
15
+ };
16
+ const get = (groupKey) => {
17
+ let snapshot = snapshots.get(groupKey);
18
+ if (!snapshot) {
19
+ snapshot = { range: undefined, revealed: revealed?.groupKey === groupKey ? revealed.index : null };
20
+ snapshots.set(groupKey, snapshot);
21
+ }
22
+ return snapshot;
23
+ };
24
+ const put = (groupKey, next) => {
25
+ const current = get(groupKey);
26
+ if (sameRange(current.range, next.range) && current.revealed === next.revealed)
27
+ return;
28
+ snapshots.set(groupKey, next);
29
+ notify(groupKey);
30
+ };
31
+ return {
32
+ get,
33
+ setRanges(ranges) {
34
+ for (const [groupKey, range] of ranges) {
35
+ let kept = get(groupKey).revealed;
36
+ if (kept != null && range && kept >= range.start && kept < range.end) {
37
+ kept = null;
38
+ revealed = null;
39
+ }
40
+ put(groupKey, { range, revealed: kept });
41
+ }
42
+ },
43
+ reveal(place) {
44
+ const last = revealed;
45
+ if (place)
46
+ get(place.groupKey);
47
+ revealed = place;
48
+ if (last && last.groupKey !== place?.groupKey)
49
+ put(last.groupKey, { ...get(last.groupKey), revealed: null });
50
+ if (place)
51
+ put(place.groupKey, { ...get(place.groupKey), revealed: place.index });
52
+ },
53
+ subscribe(groupKey, listener) {
54
+ let set = listeners.get(groupKey);
55
+ if (!set)
56
+ listeners.set(groupKey, (set = new Set()));
57
+ set.add(listener);
58
+ return () => {
59
+ set.delete(listener);
60
+ };
61
+ },
62
+ };
63
+ }
64
+ export const GridRowWindowContext = createContext(null);
65
+ const EVERY_ROW = { range: { start: 0, end: Number.MAX_SAFE_INTEGER }, revealed: null };
66
+ const NO_STORE = () => () => { };
67
+ export function useGridGroupWindow(groupKey) {
68
+ const store = useContext(GridRowWindowContext);
69
+ const subscribe = useCallback((listener) => (store ? store.subscribe(groupKey, listener) : NO_STORE()), [store, groupKey]);
70
+ const read = () => (store ? store.get(groupKey) : EVERY_ROW);
71
+ return useSyncExternalStore(subscribe, read, read);
72
+ }
73
+ export function fallbackRange(count, collapsed) {
74
+ if (collapsed || count === 0)
75
+ return null;
76
+ return { start: 0, end: Math.min(count, GRID_WINDOW_FALLBACK_ROWS) };
77
+ }
78
+ const ROWS_SELECTOR = '[data-slot="vk-grid-rows"]';
79
+ export function useGridRowWindow({ rootRef, flat, rowHeight, }) {
80
+ const flatRef = useRef(flat);
81
+ useLayoutEffect(() => {
82
+ flatRef.current = flat;
83
+ }, [flat]);
84
+ const [store] = useState(createGridRowWindowStore);
85
+ const regionsRef = useRef(null);
86
+ const measuredRowRef = useRef(null);
87
+ const content = useCallback(() => {
88
+ const area = rootRef.current?.querySelector('[data-slot="vk-grid-scroll"]');
89
+ return area?.firstElementChild ?? null;
90
+ }, [rootRef]);
91
+ const ranges = useCallback(() => {
92
+ const out = new Map();
93
+ const regions = regionsRef.current;
94
+ const root = rootRef.current;
95
+ const box = content();
96
+ if (!regions || !root || !box) {
97
+ for (const s of flatRef.current.sections)
98
+ out.set(s.groupKey, fallbackRange(s.items.length, s.collapsed));
99
+ return out;
100
+ }
101
+ const top = box.getBoundingClientRect().top;
102
+ const visible = gridVisibleBox(root, findGridScrollOwner(box));
103
+ const view = { top: visible.top - top, bottom: visible.bottom - top };
104
+ if (!Number.isFinite(view.top) || !Number.isFinite(view.bottom)) {
105
+ for (const s of flatRef.current.sections)
106
+ out.set(s.groupKey, fallbackRange(s.items.length, s.collapsed));
107
+ return out;
108
+ }
109
+ const height = measuredRowRef.current ?? rowHeight;
110
+ for (const s of flatRef.current.sections) {
111
+ const region = regions.get(s.groupKey);
112
+ out.set(s.groupKey, region ? gridGroupRange({ view, region, rowHeight: height, count: s.items.length }) : null);
113
+ }
114
+ return out;
115
+ }, [content, rootRef, rowHeight]);
116
+ const measure = useCallback(() => {
117
+ const box = content();
118
+ if (!box)
119
+ return;
120
+ const outer = box.getBoundingClientRect();
121
+ if (outer.height <= 0) {
122
+ regionsRef.current = null;
123
+ return;
124
+ }
125
+ const regions = new Map();
126
+ for (const el of box.querySelectorAll(ROWS_SELECTOR)) {
127
+ const key = el.getAttribute("data-group-key");
128
+ if (key == null)
129
+ continue;
130
+ const rect = el.getBoundingClientRect();
131
+ const group = el.closest('[data-slot="vk-grid-group"]')?.getBoundingClientRect();
132
+ const region = {
133
+ top: rect.top - outer.top,
134
+ bottom: Math.min(rect.bottom, group?.bottom ?? rect.bottom) - outer.top,
135
+ };
136
+ if (!Number.isFinite(region.top) || !Number.isFinite(region.bottom)) {
137
+ regionsRef.current = null;
138
+ return;
139
+ }
140
+ regions.set(key, region);
141
+ }
142
+ regionsRef.current = regions;
143
+ const row = box.querySelector('[data-slot="vk-grid-row"]')?.getBoundingClientRect().height;
144
+ measuredRowRef.current = row != null && row > 0 ? row : null;
145
+ }, [content]);
146
+ useLayoutEffect(() => {
147
+ measure();
148
+ store.setRanges(ranges());
149
+ }, [flat, measure, ranges, store]);
150
+ useLayoutEffect(() => {
151
+ const area = rootRef.current?.querySelector('[data-slot="vk-grid-scroll"]');
152
+ const box = content();
153
+ if (!area || !box)
154
+ return;
155
+ const redraw = () => {
156
+ const next = ranges();
157
+ for (const [groupKey, range] of next) {
158
+ if (!sameRange(store.get(groupKey).range, range)) {
159
+ flushSync(() => store.setRanges(next));
160
+ return;
161
+ }
162
+ }
163
+ };
164
+ const onScroll = () => redraw();
165
+ document.addEventListener("scroll", onScroll, { capture: true, passive: true });
166
+ window.addEventListener("resize", onScroll, { passive: true });
167
+ let observer = null;
168
+ if (typeof ResizeObserver !== "undefined") {
169
+ observer = new ResizeObserver(() => {
170
+ measure();
171
+ redraw();
172
+ });
173
+ observer.observe(area);
174
+ observer.observe(box);
175
+ }
176
+ return () => {
177
+ document.removeEventListener("scroll", onScroll, { capture: true });
178
+ window.removeEventListener("resize", onScroll);
179
+ observer?.disconnect();
180
+ };
181
+ }, [content, measure, ranges, rootRef, store]);
182
+ const revealRow = useCallback((rowKey, columnId) => {
183
+ const place = flatRef.current.place.get(rowKey);
184
+ if (!place)
185
+ return;
186
+ flushSync(() => store.reveal(place));
187
+ const row = rootRef.current?.querySelector(`[data-row-id="${CSS.escape(rowKey)}"]`);
188
+ if (!row)
189
+ return;
190
+ const cell = columnId ? (row.querySelector(`[data-col-id="${CSS.escape(columnId)}"]`) ?? row) : row;
191
+ cell.scrollIntoView({ block: "nearest", inline: "nearest" });
192
+ }, [rootRef, store]);
193
+ return { store, revealRow };
194
+ }
195
+ export const GRID_GAP_LINES = "repeating-linear-gradient(to bottom, transparent 0 calc(var(--vk-row-h) - 1px), var(--vk-border-subtle) calc(var(--vk-row-h) - 1px) var(--vk-row-h))";
196
+ export function GridWindowRows({ groupKey, items, collapsed, kept, renderRow, }) {
197
+ const snapshot = useGridGroupWindow(groupKey);
198
+ const range = snapshot.range === undefined ? fallbackRange(items.length, collapsed) : snapshot.range;
199
+ const { revealed } = snapshot;
200
+ const segments = gridRowSegments(items.length, range, revealed == null ? kept : [...kept, revealed]);
201
+ const children = [];
202
+ for (const segment of segments) {
203
+ if (segment.kind === "gap") {
204
+ children.push(_jsx("div", { "data-slot": "vk-grid-gap", "aria-hidden": true, style: { height: `calc(var(--vk-row-h) * ${segment.end - segment.start})`, background: GRID_GAP_LINES } }, `gap-${segment.end}`));
205
+ continue;
206
+ }
207
+ for (let index = segment.start; index < segment.end; index++) {
208
+ children.push(renderRow(items[index], index, items, groupKey));
209
+ }
210
+ }
211
+ return (_jsx("div", { "data-slot": "vk-grid-rows", "data-group-key": groupKey, children: children }));
212
+ }
@@ -0,0 +1,38 @@
1
+ import type { GridCellPos } from "../core/coordinates.js";
2
+ import { type GridBox } from "../core/edge-scroll.js";
3
+ /**
4
+ * The element that scrolls the grid vertically where `from` sits: the nearest ancestor whose `overflow-y` scrolls
5
+ * and whose content is taller than its box, else the page's scrolling element. That is the grid's own area
6
+ * (`data-slot="vk-grid-scroll"`), or the page where an app gives the grid no height. An ancestor that only scrolls
7
+ * sideways (`overflow-y: clip`) is skipped.
8
+ */
9
+ export declare function findGridScrollOwner(from: Element): HTMLElement;
10
+ /**
11
+ * The box the grid is visible in: the grid's own rect, inside its scroll owner's (the window for the page), inside the
12
+ * window. A drag's hit-test is clamped into it, and its edges are where a drag scrolls.
13
+ */
14
+ export declare function gridVisibleBox(root: HTMLElement, owner: HTMLElement): GridBox;
15
+ /**
16
+ * How far a drag at `y` scrolls `owner` this frame: `gridEdgeScrollStep` against the box the grid is visible in, and
17
+ * nothing towards an edge the grid already shows its end at. Where the owner is the grid's own area (inside the
18
+ * frame), the frame ends where the area does, so the grid's end is how far the area can still scroll. Where it is the
19
+ * page (a grid given no height), it is where the frame's box stops, so a drag over the last row doesn't scroll the
20
+ * page on past the grid.
21
+ */
22
+ export declare function gridDragScrollStep(root: HTMLElement, owner: HTMLElement, y: number): number;
23
+ /**
24
+ * The cell of `root` at the point clamped into `box`: its row KEY and, where the point is on a cell, its column.
25
+ * A point on something that isn't a row (the header stuck to the top, a group's header) steps toward the box's middle
26
+ * until it reaches a row, so a drag held past an edge always has the row at that edge. Null when the grid shows none.
27
+ */
28
+ export declare function gridHitAtPoint(root: HTMLElement, x: number, y: number, box: GridBox): {
29
+ rowId: string;
30
+ columnId: string | null;
31
+ } | null;
32
+ /**
33
+ * THE one reveal: every path that brings a cell into view (the keyboard, an undo or a redo, a paste's selection)
34
+ * comes through here. A row the page holds scrolls its cell into view; a row it doesn't (only the rows on screen are
35
+ * drawn) goes to `revealRow` with its row KEY and the column, the table's row window (`grid-row-window.tsx`), which
36
+ * draws the row in its place and scrolls its cell into view.
37
+ */
38
+ export declare function revealGridCell(root: HTMLElement | null, pos: GridCellPos, behavior: ScrollBehavior, revealRow?: (rowKey: string, columnId?: string) => void): void;
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ import { clampIntoBox, gridEdgeScrollStep, intersectBoxes } from "../core/edge-scroll.js";
3
+ const HIT_STEP_PX = 8;
4
+ const SCROLLS_Y = new Set(["auto", "scroll", "overlay"]);
5
+ export function findGridScrollOwner(from) {
6
+ for (let el = from.parentElement; el; el = el.parentElement) {
7
+ if (el === document.body || el === document.documentElement)
8
+ break;
9
+ if (SCROLLS_Y.has(getComputedStyle(el).overflowY) && el.scrollHeight > el.clientHeight)
10
+ return el;
11
+ }
12
+ return (document.scrollingElement ?? document.documentElement);
13
+ }
14
+ function windowBox() {
15
+ return { top: 0, left: 0, bottom: window.innerHeight, right: window.innerWidth };
16
+ }
17
+ function rectBox(el) {
18
+ const rect = el.getBoundingClientRect();
19
+ return { top: rect.top, bottom: rect.bottom, left: rect.left, right: rect.right };
20
+ }
21
+ function ownerBox(owner) {
22
+ const page = owner === document.scrollingElement || owner === document.documentElement;
23
+ return page ? windowBox() : intersectBoxes(rectBox(owner), windowBox());
24
+ }
25
+ export function gridVisibleBox(root, owner) {
26
+ return intersectBoxes(rectBox(root), ownerBox(owner));
27
+ }
28
+ export function gridDragScrollStep(root, owner, y) {
29
+ const step = gridEdgeScrollStep(y, gridVisibleBox(root, owner));
30
+ if (step === 0)
31
+ return 0;
32
+ if (root.contains(owner)) {
33
+ if (step < 0 && owner.scrollTop <= 0)
34
+ return 0;
35
+ if (step > 0 && owner.scrollTop >= owner.scrollHeight - owner.clientHeight)
36
+ return 0;
37
+ return step;
38
+ }
39
+ const grid = rectBox(root);
40
+ const box = ownerBox(owner);
41
+ if (step < 0 && grid.top >= box.top)
42
+ return 0;
43
+ if (step > 0 && grid.bottom <= box.bottom)
44
+ return 0;
45
+ return step;
46
+ }
47
+ export function gridHitAtPoint(root, x, y, box) {
48
+ if (box.bottom <= box.top || box.right <= box.left)
49
+ return null;
50
+ const point = clampIntoBox(x, y, box);
51
+ const middle = (box.top + box.bottom) / 2;
52
+ const step = point.y <= middle ? HIT_STEP_PX : -HIT_STEP_PX;
53
+ const reach = (box.bottom - box.top) / 2;
54
+ for (let moved = 0; moved <= reach; moved += HIT_STEP_PX) {
55
+ const element = document.elementFromPoint?.(point.x, point.y + Math.sign(step) * moved);
56
+ const row = element?.closest?.("[data-row-id]");
57
+ if (row && root.contains(row)) {
58
+ const cell = element?.closest?.("[data-col-id]");
59
+ return {
60
+ rowId: row.getAttribute("data-row-id"),
61
+ columnId: cell && row.contains(cell) ? cell.getAttribute("data-col-id") : null,
62
+ };
63
+ }
64
+ }
65
+ return null;
66
+ }
67
+ export function revealGridCell(root, pos, behavior, revealRow) {
68
+ const row = root?.querySelector(`[data-row-id="${CSS.escape(pos.rowId)}"]`);
69
+ if (!row) {
70
+ revealRow?.(pos.rowId, pos.columnId);
71
+ return;
72
+ }
73
+ const cell = row.querySelector(`[data-col-id="${CSS.escape(pos.columnId)}"]`) ?? row;
74
+ cell.scrollIntoView({ block: "nearest", inline: "nearest", behavior });
75
+ }
@@ -5,13 +5,16 @@ export declare const GRID_CONTENT_PAD = "pl-[calc(var(--vk-gutter,0px)+var(--vk-
5
5
  * checkboxes, an outlined row action, the header's drag ghost. The page's ground, without
6
6
  * re-declaring its states: every host the grid mounts in carries the page's own. */
7
7
  export declare const GRID_GROUND = "bg-(color:--vk-ground)";
8
+ /** The keyboard's mark on a part that isn't a data cell (a column name, a footer cell, a bar's name): the cells'
9
+ * brand ring, inset, only for focus a key put there, so a click draws nothing new. */
10
+ export declare const GRID_CHROME_FOCUS = "outline-none focus-visible:shadow-[inset_0_0_0_2px_var(--vk-brand)]";
8
11
  /** THE endFill-tail ⋯ button look: each row's menu button. Its hover is the caller's: neutral, or
9
12
  * brand on a selected row. */
10
13
  export declare const GRID_TAIL_BUTTON_BASE = "inline-flex h-8 w-9 items-center justify-center rounded-sm text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)";
11
14
  export declare const GRID_HEADER_BG = "bg-[linear-gradient(to_bottom,var(--vk-ground)_calc(100%-2px),transparent_calc(100%-2px))]";
12
15
  /**
13
16
  * A FROZEN header cell's OWN paint — the same band, alpha-gated on
14
- * `--vk-scrolled` (0/1, from the scroll sync), like the frozen z-tier and the
17
+ * `--vk-scrolled` (0/1, from the scroll area), like the frozen z-tier and the
15
18
  * head fade. It needs to be opaque only while cells pass underneath it; at rest
16
19
  * the strip's own GRID_HEADER_BG already covers the band.
17
20
  *
@@ -2,6 +2,7 @@ export const GRID_BLEED = "-mx-(--vk-gutter,0px)";
2
2
  export const GRID_ROW_PAD = "px-(--vk-gutter,0px)";
3
3
  export const GRID_CONTENT_PAD = "pl-[calc(var(--vk-gutter,0px)+var(--vk-indent,0px))] pr-(--vk-gutter,0px)";
4
4
  export const GRID_GROUND = "bg-(color:--vk-ground)";
5
+ export const GRID_CHROME_FOCUS = "outline-none focus-visible:shadow-[inset_0_0_0_2px_var(--vk-brand)]";
5
6
  export const GRID_TAIL_BUTTON_BASE = "inline-flex h-8 w-9 items-center justify-center rounded-sm text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)";
6
7
  export const GRID_HEADER_BG = "bg-[linear-gradient(to_bottom,var(--vk-ground)_calc(100%-2px),transparent_calc(100%-2px))]";
7
8
  export const GRID_HEADER_BG_FROZEN = "bg-[linear-gradient(to_bottom,color-mix(in_oklab,_var(--vk-ground)_calc(var(--vk-scrolled,0)*100%),_transparent)_calc(100%-2px),transparent_calc(100%-2px))]";
@@ -92,6 +92,8 @@ export type GridTableProps<Row> = {
92
92
  rowClassName?: (row: Row) => string | undefined;
93
93
  onRowDelete?: (id: string) => Promise<void>;
94
94
  deleteLabel?: string;
95
+ /** The name's actions: buttons on the title cell of the row under the pointer, and rows of each row's menu (after
96
+ * Select) for those that apply to it, so a key reaches them. */
95
97
  rowActions?: ListCellAction<Row>[];
96
98
  /** The leading glyph in the title cell, as a DESCRIPTOR — the grid decides
97
99
  * size and color from it. See `ListRowIconAccessor`. */
@@ -158,9 +160,6 @@ export type GridTableProps<Row> = {
158
160
  /** Per-user "Freeze identity columns" toggle: pins every column through the
159
161
  * title to the left edge while the rest scrolls under them. */
160
162
  freezeIdentity?: boolean;
161
- /** Per-user "Wrap columns" toggle: typed cells wrap to at most 3 lines and
162
- * rows grow to fit their tallest cell, instead of one line per row. */
163
- wrapCells?: boolean;
164
163
  /** Per-user "Show checkboxes always" toggle: holds the checkbox rail open
165
164
  * instead of revealing it on hover. Same state a live selection forces. */
166
165
  alwaysCheckboxes?: boolean;
@@ -0,0 +1,45 @@
1
+ import { type RefObject } from "react";
2
+ import type { GridCellPos } from "../core/coordinates.js";
3
+ import { type GridChromeTarget, type GridFocusTarget } from "../core/grid-focus.js";
4
+ /** Text entry and overlay surfaces: they own their keys and their focus wherever they live, inside the grid or out
5
+ * (an editor's input, a rename, a menu, a dialog). A checkbox is no text entry: the grid's Space ticks it. */
6
+ export declare const GRID_KEY_OWNING_SURFACES = "input:not([type=\"checkbox\"]), textarea, select, [contenteditable=\"true\"], [role=\"menu\"], [role=\"dialog\"]";
7
+ /** The element a target draws, found in the grid's own DOM; null when it isn't drawn. */
8
+ export declare function gridFocusElement(root: HTMLElement, target: GridFocusTarget): HTMLElement | null;
9
+ /**
10
+ * A mouse press on a part that takes focus (a cell, a column name, a footer cell) focuses it at once without scrolling:
11
+ * the browser's own focus on mousedown would scroll a part half under the pinned head or the frozen columns into
12
+ * view, and finds it already focused. A press in text being typed, or inside the part already holding focus (its open
13
+ * editor), is left alone.
14
+ */
15
+ export declare function gridFocusOnPress(event: {
16
+ pointerType: string;
17
+ button: number;
18
+ target: EventTarget | null;
19
+ }, part: string): void;
20
+ /**
21
+ * Where a chrome target goes when the element it stood for is gone (a column hidden or the list regrouped from its
22
+ * own menu, a group's ⋯ that no longer draws): the same row's first cell where that row is still drawn, the bar's
23
+ * name for its ⋯; null where nothing of it is left.
24
+ */
25
+ export declare function gridChromeFallback(root: HTMLElement, target: GridChromeTarget): GridChromeTarget | null;
26
+ /**
27
+ * Where real focus belongs in the grid, and the effect that puts it there. A data cell's focus stays the editing
28
+ * model's `focusedCell`; a column name, a footer cell, a bar or a checkbox is the `chrome` target beside it. After a
29
+ * render that moved the target, real focus follows it, but only while nothing else on the page has the focus (it is
30
+ * on the body, the frame, a guard or inside the grid) and no editor is open: the grid never takes focus from the
31
+ * toolbar, and an open editor keeps its own. An editor that answered by Enter or Tab and still plays its close is not
32
+ * open: the focused cell has moved on, and the focus follows it at once.
33
+ */
34
+ export declare function useGridFocus({ rootRef, focusedCell, editingCell, }: {
35
+ rootRef: RefObject<HTMLDivElement | null>;
36
+ focusedCell: GridCellPos | null;
37
+ editingCell: GridCellPos | null;
38
+ }): {
39
+ chrome: GridChromeTarget | null;
40
+ setChrome: (target: GridChromeTarget | null) => void;
41
+ target: GridFocusTarget | null;
42
+ releaseToFrame: () => void;
43
+ /** The last data cell that held the focus, for coming back in after a let-go. */
44
+ lastCellRef: RefObject<GridCellPos | null>;
45
+ };