@viewkitjs/views 0.1.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 (390) hide show
  1. package/CHANGELOG.md +767 -1
  2. package/README.md +92 -41
  3. package/dist/atoms/LoadMore.js +11 -1
  4. package/dist/atoms/Row.js +1 -1
  5. package/dist/atoms/RowMenu.d.ts +1 -1
  6. package/dist/atoms/RowMenu.js +20 -6
  7. package/dist/atoms/types.d.ts +4 -4
  8. package/dist/cells/cell-format.d.ts +3 -3
  9. package/dist/cells/cell-title.d.ts +1 -2
  10. package/dist/cells/cell-title.js +2 -2
  11. package/dist/cells/cell-values.js +6 -3
  12. package/dist/contract.d.ts +79 -8
  13. package/dist/contract.js +55 -8
  14. package/dist/display/converted.d.ts +19 -0
  15. package/dist/display/converted.js +12 -0
  16. package/dist/display/format.d.ts +16 -1
  17. package/dist/display/format.js +10 -1
  18. package/dist/display/index.d.ts +2 -1
  19. package/dist/display/index.js +2 -1
  20. package/dist/display/link-click.d.ts +11 -0
  21. package/dist/display/link-click.js +3 -0
  22. package/dist/display/link.js +12 -6
  23. package/dist/display/location.d.ts +4 -3
  24. package/dist/display/location.js +12 -5
  25. package/dist/display/multi-value.d.ts +1 -1
  26. package/dist/display/multi-value.js +1 -1
  27. package/dist/display/options.d.ts +8 -2
  28. package/dist/display/percent.js +10 -3
  29. package/dist/display/phone.d.ts +2 -1
  30. package/dist/display/phone.js +11 -2
  31. package/dist/display/relation.js +1 -1
  32. package/dist/editors/ChipsEditor.d.ts +9 -4
  33. package/dist/editors/ChipsEditor.js +7 -3
  34. package/dist/editors/DateEditor.d.ts +21 -6
  35. package/dist/editors/DateEditor.js +118 -30
  36. package/dist/editors/EditorPanel.d.ts +61 -0
  37. package/dist/editors/EditorPanel.js +54 -0
  38. package/dist/editors/LocationEditor.d.ts +3 -0
  39. package/dist/editors/LocationEditor.js +28 -21
  40. package/dist/editors/NameEditor.d.ts +3 -0
  41. package/dist/editors/NameEditor.js +15 -10
  42. package/dist/editors/NumberEditor.d.ts +3 -0
  43. package/dist/editors/NumberEditor.js +7 -7
  44. package/dist/editors/RangeEditor.d.ts +16 -1
  45. package/dist/editors/RangeEditor.js +22 -6
  46. package/dist/editors/RelationEditor.d.ts +13 -28
  47. package/dist/editors/RelationEditor.js +17 -40
  48. package/dist/editors/RelationSetEditor.d.ts +53 -0
  49. package/dist/editors/RelationSetEditor.js +112 -0
  50. package/dist/editors/SelectEditor.d.ts +21 -3
  51. package/dist/editors/SelectEditor.js +55 -9
  52. package/dist/editors/TextEditor.d.ts +51 -0
  53. package/dist/editors/TextEditor.js +81 -0
  54. package/dist/editors/ValueListEditor.d.ts +5 -2
  55. package/dist/editors/ValueListEditor.js +11 -9
  56. package/dist/editors/edit-cores.d.ts +13 -10
  57. package/dist/editors/edit-cores.js +7 -6
  58. package/dist/editors/edit-session.d.ts +21 -11
  59. package/dist/editors/edit-session.js +19 -5
  60. package/dist/editors/keep-inside.d.ts +12 -0
  61. package/dist/editors/keep-inside.js +20 -0
  62. package/dist/editors/open-value.d.ts +21 -0
  63. package/dist/editors/open-value.js +36 -0
  64. package/dist/editors/open-values.d.ts +4 -0
  65. package/dist/editors/open-values.js +7 -0
  66. package/dist/editors/relation-kinds.d.ts +7 -0
  67. package/dist/editors/relation-kinds.js +21 -0
  68. package/dist/editors/relation-panel.d.ts +69 -0
  69. package/dist/editors/relation-panel.js +40 -0
  70. package/dist/field-row/FieldNoteLine.d.ts +14 -0
  71. package/dist/field-row/FieldNoteLine.js +14 -0
  72. package/dist/field-row/FieldRow.d.ts +73 -0
  73. package/dist/field-row/FieldRow.js +157 -0
  74. package/dist/field-row/FieldRowLane.d.ts +19 -0
  75. package/dist/field-row/FieldRowLane.js +11 -0
  76. package/dist/field-row/editors/RowChipsEditor.d.ts +11 -0
  77. package/dist/field-row/editors/RowChipsEditor.js +25 -0
  78. package/dist/field-row/editors/RowDateEditor.d.ts +16 -0
  79. package/dist/field-row/editors/RowDateEditor.js +18 -0
  80. package/dist/field-row/editors/RowEditor.d.ts +39 -0
  81. package/dist/field-row/editors/RowEditor.js +64 -0
  82. package/dist/field-row/editors/RowNameEditor.d.ts +4 -0
  83. package/dist/field-row/editors/RowNameEditor.js +15 -0
  84. package/dist/field-row/editors/RowNumberEditor.d.ts +12 -0
  85. package/dist/field-row/editors/RowNumberEditor.js +18 -0
  86. package/dist/field-row/editors/RowPlaceEditor.d.ts +8 -0
  87. package/dist/field-row/editors/RowPlaceEditor.js +18 -0
  88. package/dist/field-row/editors/RowRangeEditor.d.ts +4 -0
  89. package/dist/field-row/editors/RowRangeEditor.js +15 -0
  90. package/dist/field-row/editors/RowRelationEditor.d.ts +20 -0
  91. package/dist/field-row/editors/RowRelationEditor.js +77 -0
  92. package/dist/field-row/editors/RowSelectEditor.d.ts +13 -0
  93. package/dist/field-row/editors/RowSelectEditor.js +23 -0
  94. package/dist/field-row/editors/RowTextEditor.d.ts +15 -0
  95. package/dist/field-row/editors/RowTextEditor.js +16 -0
  96. package/dist/field-row/editors/RowValueListEditor.d.ts +4 -0
  97. package/dist/field-row/editors/RowValueListEditor.js +21 -0
  98. package/dist/field-row/editors/host.d.ts +59 -0
  99. package/dist/field-row/editors/host.js +1 -0
  100. package/dist/field-row/editors/row-session.d.ts +49 -0
  101. package/dist/field-row/editors/row-session.js +49 -0
  102. package/dist/field-row/index.d.ts +5 -0
  103. package/dist/field-row/index.js +5 -0
  104. package/dist/field-row/row-target.d.ts +20 -0
  105. package/dist/field-row/row-target.js +3 -0
  106. package/dist/field-row/useFieldWrite.d.ts +45 -0
  107. package/dist/field-row/useFieldWrite.js +190 -0
  108. package/dist/field-row/useRowSettlement.d.ts +33 -0
  109. package/dist/field-row/useRowSettlement.js +23 -0
  110. package/dist/fields/binding.d.ts +7 -2
  111. package/dist/fields/binding.js +13 -6
  112. package/dist/fields/currency.d.ts +0 -10
  113. package/dist/fields/currency.js +0 -14
  114. package/dist/fields/edit-core-types.d.ts +9 -9
  115. package/dist/fields/edit-core-types.js +6 -6
  116. package/dist/fields/money.d.ts +6 -0
  117. package/dist/fields/money.js +11 -0
  118. package/dist/fields/number-edit.d.ts +6 -0
  119. package/dist/fields/number-edit.js +4 -0
  120. package/dist/fields/prepare-write.js +6 -1
  121. package/dist/fields/relation-source-types.d.ts +12 -0
  122. package/dist/fields/write-target.d.ts +50 -0
  123. package/dist/fields/write-target.js +10 -0
  124. package/dist/filters/filter-model.d.ts +0 -1
  125. package/dist/filters/registry.d.ts +3 -36
  126. package/dist/filters/registry.js +0 -38
  127. package/dist/grid/chrome/GridAddColumn.d.ts +11 -0
  128. package/dist/grid/chrome/GridAddColumn.js +29 -0
  129. package/dist/grid/chrome/GridAggregateMenu.d.ts +31 -0
  130. package/dist/grid/chrome/GridAggregateMenu.js +29 -0
  131. package/dist/grid/chrome/GridCellEditors.d.ts +71 -0
  132. package/dist/grid/chrome/GridCellEditors.js +126 -0
  133. package/dist/grid/chrome/GridCellOutline.d.ts +49 -0
  134. package/dist/grid/chrome/GridCellOutline.js +16 -0
  135. package/dist/grid/chrome/GridChipsEditor.d.ts +38 -0
  136. package/dist/grid/chrome/GridChipsEditor.js +35 -0
  137. package/dist/grid/chrome/GridColumnColorSection.d.ts +11 -0
  138. package/dist/grid/chrome/GridColumnColorSection.js +40 -0
  139. package/dist/grid/chrome/GridColumnDateSection.d.ts +23 -0
  140. package/dist/grid/chrome/GridColumnDateSection.js +23 -0
  141. package/dist/grid/chrome/GridColumnDurationSection.d.ts +19 -0
  142. package/dist/grid/chrome/GridColumnDurationSection.js +24 -0
  143. package/dist/grid/chrome/GridColumnMenu.d.ts +101 -0
  144. package/dist/grid/chrome/GridColumnMenu.js +103 -0
  145. package/dist/grid/chrome/GridColumnNumberSection.d.ts +25 -0
  146. package/dist/grid/chrome/GridColumnNumberSection.js +27 -0
  147. package/dist/grid/chrome/GridColumnPercentSection.d.ts +15 -0
  148. package/dist/grid/chrome/GridColumnPercentSection.js +16 -0
  149. package/dist/grid/chrome/GridColumnSortSection.d.ts +18 -0
  150. package/dist/grid/chrome/GridColumnSortSection.js +16 -0
  151. package/dist/grid/chrome/GridDateEditor.d.ts +34 -0
  152. package/dist/grid/chrome/GridDateEditor.js +19 -0
  153. package/dist/grid/chrome/GridFlyout.d.ts +44 -0
  154. package/dist/grid/chrome/GridFlyout.js +80 -0
  155. package/dist/grid/chrome/GridFooter.d.ts +33 -0
  156. package/dist/grid/chrome/GridFooter.js +85 -0
  157. package/dist/grid/chrome/GridGroupMenu.d.ts +37 -0
  158. package/dist/grid/chrome/GridGroupMenu.js +64 -0
  159. package/dist/grid/chrome/GridHeader.d.ts +66 -0
  160. package/dist/grid/chrome/GridHeader.js +42 -0
  161. package/dist/grid/chrome/GridLongTextEditor.d.ts +55 -0
  162. package/dist/grid/chrome/GridLongTextEditor.js +69 -0
  163. package/dist/grid/chrome/GridMenuRow.d.ts +15 -0
  164. package/dist/grid/chrome/GridMenuRow.js +15 -0
  165. package/dist/grid/chrome/GridNameEditor.d.ts +24 -0
  166. package/dist/grid/chrome/GridNameEditor.js +21 -0
  167. package/dist/grid/chrome/GridNumberEditor.d.ts +49 -0
  168. package/dist/grid/chrome/GridNumberEditor.js +51 -0
  169. package/dist/grid/chrome/GridPlaceEditor.d.ts +26 -0
  170. package/dist/grid/chrome/GridPlaceEditor.js +22 -0
  171. package/dist/grid/chrome/GridRangeEditor.d.ts +30 -0
  172. package/dist/grid/chrome/GridRangeEditor.js +21 -0
  173. package/dist/grid/chrome/GridRelationEditor.d.ts +45 -0
  174. package/dist/grid/chrome/GridRelationEditor.js +92 -0
  175. package/dist/grid/chrome/GridResizeHandle.d.ts +19 -0
  176. package/dist/grid/chrome/GridResizeHandle.js +19 -0
  177. package/dist/grid/chrome/GridRow.d.ts +31 -0
  178. package/dist/grid/chrome/GridRow.js +179 -0
  179. package/dist/grid/chrome/GridRowActions.d.ts +32 -0
  180. package/dist/grid/chrome/GridRowActions.js +25 -0
  181. package/dist/grid/chrome/GridRowCells.d.ts +4 -0
  182. package/dist/grid/chrome/GridRowCells.js +128 -0
  183. package/dist/grid/chrome/GridRowGlyph.d.ts +12 -0
  184. package/dist/grid/chrome/GridRowGlyph.js +13 -0
  185. package/dist/grid/chrome/GridSelectEditor.d.ts +33 -0
  186. package/dist/grid/chrome/GridSelectEditor.js +43 -0
  187. package/dist/grid/chrome/GridStructure.d.ts +47 -0
  188. package/dist/grid/chrome/GridStructure.js +41 -0
  189. package/dist/grid/chrome/GridTable.d.ts +4 -0
  190. package/dist/grid/chrome/GridTable.js +192 -0
  191. package/dist/grid/chrome/GridTableSurface.d.ts +52 -0
  192. package/dist/grid/chrome/GridTableSurface.js +15 -0
  193. package/dist/grid/chrome/GridTextEditor.d.ts +45 -0
  194. package/dist/grid/chrome/GridTextEditor.js +38 -0
  195. package/dist/grid/chrome/GridValueListEditor.d.ts +30 -0
  196. package/dist/grid/chrome/GridValueListEditor.js +19 -0
  197. package/dist/grid/chrome/StuckMarker.d.ts +16 -0
  198. package/dist/grid/chrome/StuckMarker.js +34 -0
  199. package/dist/grid/chrome/cell-clipboard.d.ts +9 -0
  200. package/dist/grid/chrome/cell-clipboard.js +28 -0
  201. package/dist/grid/chrome/cell-cut-off.d.ts +11 -0
  202. package/dist/grid/chrome/cell-cut-off.js +20 -0
  203. package/dist/grid/chrome/cells.d.ts +21 -0
  204. package/dist/grid/chrome/cells.js +19 -0
  205. package/dist/grid/chrome/checks.d.ts +32 -0
  206. package/dist/grid/chrome/checks.js +32 -0
  207. package/dist/grid/chrome/column-glyph.d.ts +14 -0
  208. package/dist/grid/chrome/column-glyph.js +44 -0
  209. package/dist/grid/chrome/editors.d.ts +9 -0
  210. package/dist/grid/chrome/editors.js +10 -0
  211. package/dist/grid/chrome/grid-cell-classes.d.ts +53 -0
  212. package/dist/grid/chrome/grid-cell-classes.js +32 -0
  213. package/dist/grid/chrome/grid-cell-link.d.ts +13 -0
  214. package/dist/grid/chrome/grid-cell-link.js +9 -0
  215. package/dist/grid/chrome/grid-edit-session.d.ts +63 -0
  216. package/dist/grid/chrome/grid-edit-session.js +118 -0
  217. package/dist/grid/chrome/grid-hover.d.ts +60 -0
  218. package/dist/grid/chrome/grid-hover.js +81 -0
  219. package/dist/grid/chrome/grid-menu-focus.d.ts +43 -0
  220. package/dist/grid/chrome/grid-menu-focus.js +93 -0
  221. package/dist/grid/chrome/grid-menu-search.d.ts +7 -0
  222. package/dist/grid/chrome/grid-menu-search.js +7 -0
  223. package/dist/grid/chrome/grid-row-menu-key.d.ts +15 -0
  224. package/dist/grid/chrome/grid-row-menu-key.js +36 -0
  225. package/dist/grid/chrome/grid-row-props.d.ts +143 -0
  226. package/dist/grid/chrome/grid-row-props.js +1 -0
  227. package/dist/grid/chrome/grid-row-window.d.ts +61 -0
  228. package/dist/grid/chrome/grid-row-window.js +212 -0
  229. package/dist/grid/chrome/grid-scroll-owner.d.ts +38 -0
  230. package/dist/grid/chrome/grid-scroll-owner.js +75 -0
  231. package/dist/grid/chrome/grid-styles.d.ts +40 -0
  232. package/dist/grid/chrome/grid-styles.js +9 -0
  233. package/dist/grid/chrome/grid-table-props.d.ts +172 -0
  234. package/dist/grid/chrome/grid-table-props.js +1 -0
  235. package/dist/grid/chrome/useGridBatchApi.d.ts +34 -0
  236. package/dist/grid/chrome/useGridBatchApi.js +35 -0
  237. package/dist/grid/chrome/useGridColumnLayout.d.ts +30 -0
  238. package/dist/grid/chrome/useGridColumnLayout.js +206 -0
  239. package/dist/grid/chrome/useGridFocus.d.ts +45 -0
  240. package/dist/grid/chrome/useGridFocus.js +122 -0
  241. package/dist/grid/chrome/useGridHeaderDrag.d.ts +20 -0
  242. package/dist/grid/chrome/useGridHeaderDrag.js +37 -0
  243. package/dist/grid/chrome/useGridKeyboard.d.ts +64 -0
  244. package/dist/grid/chrome/useGridKeyboard.js +450 -0
  245. package/dist/grid/chrome/useGridPendingReconciliation.d.ts +12 -0
  246. package/dist/grid/chrome/useGridPendingReconciliation.js +32 -0
  247. package/dist/grid/chrome/useGridRailReveal.d.ts +57 -0
  248. package/dist/grid/chrome/useGridRailReveal.js +67 -0
  249. package/dist/grid/chrome/useGridRangeActions.d.ts +51 -0
  250. package/dist/grid/chrome/useGridRangeActions.js +195 -0
  251. package/dist/grid/chrome/useGridRangeGestures.d.ts +32 -0
  252. package/dist/grid/chrome/useGridRangeGestures.js +237 -0
  253. package/dist/grid/chrome/useGridRowContextMenu.d.ts +37 -0
  254. package/dist/grid/chrome/useGridRowContextMenu.js +153 -0
  255. package/dist/grid/chrome/useGridScaleStyles.d.ts +3 -0
  256. package/dist/grid/chrome/useGridScaleStyles.js +28 -0
  257. package/dist/grid/chrome/useGridScrollArea.d.ts +21 -0
  258. package/dist/grid/chrome/useGridScrollArea.js +65 -0
  259. package/dist/grid/chrome/useGridTableInteractionModel.d.ts +78 -0
  260. package/dist/grid/chrome/useGridTableInteractionModel.js +249 -0
  261. package/dist/grid/chrome/useGridTableSelection.d.ts +29 -0
  262. package/dist/grid/chrome/useGridTableSelection.js +55 -0
  263. package/dist/grid/chrome/useHeaderDragReorder.d.ts +21 -0
  264. package/dist/grid/chrome/useHeaderDragReorder.js +216 -0
  265. package/dist/grid/core/clipboard-model.d.ts +83 -0
  266. package/dist/grid/core/clipboard-model.js +291 -0
  267. package/dist/grid/core/column-values.d.ts +27 -0
  268. package/dist/grid/core/column-values.js +76 -0
  269. package/dist/grid/core/commit-model.d.ts +41 -0
  270. package/dist/grid/core/commit-model.js +3 -0
  271. package/dist/grid/core/coordinates.d.ts +48 -0
  272. package/dist/grid/core/coordinates.js +27 -0
  273. package/dist/grid/core/edge-scroll.d.ts +21 -0
  274. package/dist/grid/core/edge-scroll.js +23 -0
  275. package/dist/grid/core/edit-values.d.ts +9 -0
  276. package/dist/grid/core/edit-values.js +1 -0
  277. package/dist/grid/core/editing-controller.d.ts +60 -0
  278. package/dist/grid/core/editing-controller.js +266 -0
  279. package/dist/grid/core/editing-model.d.ts +87 -0
  280. package/dist/grid/core/editing-model.js +148 -0
  281. package/dist/grid/core/flat-rows.d.ts +35 -0
  282. package/dist/grid/core/flat-rows.js +20 -0
  283. package/dist/grid/core/grid-aria.d.ts +27 -0
  284. package/dist/grid/core/grid-aria.js +39 -0
  285. package/dist/grid/core/grid-focus.d.ts +54 -0
  286. package/dist/grid/core/grid-focus.js +148 -0
  287. package/dist/grid/core/grid-scale.d.ts +14 -0
  288. package/dist/grid/core/grid-scale.js +8 -0
  289. package/dist/grid/core/nav.d.ts +94 -0
  290. package/dist/grid/core/nav.js +92 -0
  291. package/dist/grid/core/pending-reconciliation.d.ts +53 -0
  292. package/dist/grid/core/pending-reconciliation.js +51 -0
  293. package/dist/grid/core/range-model.d.ts +25 -0
  294. package/dist/grid/core/range-model.js +59 -0
  295. package/dist/grid/core/row-window.d.ts +40 -0
  296. package/dist/grid/core/row-window.js +43 -0
  297. package/dist/grid/core/spreadsheet-operations.d.ts +101 -0
  298. package/dist/grid/core/spreadsheet-operations.js +280 -0
  299. package/dist/grid/core/useGridEditing.d.ts +46 -0
  300. package/dist/grid/core/useGridEditing.js +93 -0
  301. package/dist/grid/core/useGridRange.d.ts +20 -0
  302. package/dist/grid/core/useGridRange.js +24 -0
  303. package/dist/grid/core/value-equality.d.ts +54 -0
  304. package/dist/grid/core/value-equality.js +80 -0
  305. package/dist/grid/index.d.ts +18 -0
  306. package/dist/grid/index.js +5 -0
  307. package/dist/grid/useGridTablePrefs.d.ts +49 -0
  308. package/dist/grid/useGridTablePrefs.js +99 -0
  309. package/dist/index.d.ts +1 -1
  310. package/dist/index.js +1 -1
  311. package/dist/internal/viewport.d.ts +3 -0
  312. package/dist/internal/viewport.js +15 -0
  313. package/dist/model/column-capabilities.d.ts +3 -2
  314. package/dist/model/column-capabilities.js +28 -8
  315. package/dist/model/column-from.js +3 -0
  316. package/dist/model/column-inspect.d.ts +10 -2
  317. package/dist/model/column-inspect.js +9 -0
  318. package/dist/model/column-schema.d.ts +6 -1
  319. package/dist/model/column-state.d.ts +1 -1
  320. package/dist/model/column-types.d.ts +3 -1
  321. package/dist/model/column-types.js +1 -1
  322. package/dist/model/density.js +3 -3
  323. package/dist/model/filter-capabilities.d.ts +1 -1
  324. package/dist/model/filter-capabilities.js +1 -1
  325. package/dist/model/index.d.ts +4 -6
  326. package/dist/model/index.js +0 -1
  327. package/dist/model/preferences.d.ts +7 -7
  328. package/dist/model/preferences.js +0 -1
  329. package/dist/model/prefs-buckets.d.ts +0 -1
  330. package/dist/model/prefs-buckets.js +0 -3
  331. package/dist/model/render-count.d.ts +6 -0
  332. package/dist/model/render-count.js +11 -0
  333. package/dist/provider/ViewsProvider.d.ts +6 -2
  334. package/dist/provider/ViewsProvider.js +12 -2
  335. package/dist/provider/components.d.ts +35 -9
  336. package/dist/provider/components.js +4 -2
  337. package/dist/provider/context.d.ts +8 -4
  338. package/dist/provider/desktop.d.ts +9 -0
  339. package/dist/provider/desktop.js +22 -0
  340. package/dist/provider/menu-groups.d.ts +8 -0
  341. package/dist/provider/menu-groups.js +38 -0
  342. package/dist/provider/plain-input.d.ts +8 -0
  343. package/dist/provider/plain-input.js +5 -0
  344. package/dist/provider/ports.d.ts +22 -0
  345. package/dist/provider/ports.js +1 -0
  346. package/dist/react.d.ts +3 -2
  347. package/dist/react.js +1 -0
  348. package/dist/selection/SelectCheckbox.d.ts +3 -1
  349. package/dist/selection/SelectCheckbox.js +2 -2
  350. package/dist/selection/useCheckDragSelect.js +6 -5
  351. package/docs/contract.md +202 -72
  352. package/docs/getting-started.md +250 -0
  353. package/docs/guides/atoms.md +245 -0
  354. package/docs/guides/cells.md +302 -0
  355. package/docs/guides/columns.md +413 -0
  356. package/docs/guides/display.md +204 -0
  357. package/docs/guides/editors.md +462 -0
  358. package/docs/guides/ports.md +246 -0
  359. package/docs/guides/selection.md +270 -0
  360. package/docs/guides/the-grid.md +696 -0
  361. package/docs/guides/the-provider.md +448 -0
  362. package/docs/index.md +52 -0
  363. package/docs/install.md +9 -47
  364. package/docs/reference/cells.md +28 -0
  365. package/docs/reference/display.md +44 -0
  366. package/docs/reference/editors-chips.md +6 -0
  367. package/docs/reference/editors-date.md +6 -0
  368. package/docs/reference/editors-location.md +10 -0
  369. package/docs/reference/editors-name.md +6 -0
  370. package/docs/reference/editors-number.md +11 -0
  371. package/docs/reference/editors-open-values.md +10 -0
  372. package/docs/reference/editors-panel.md +12 -0
  373. package/docs/reference/editors-range.md +6 -0
  374. package/docs/reference/editors-relation.md +12 -0
  375. package/docs/reference/editors-select.md +9 -0
  376. package/docs/reference/editors-session.md +11 -0
  377. package/docs/reference/editors-text.md +9 -0
  378. package/docs/reference/editors-value-list.md +6 -0
  379. package/docs/reference/editors.md +5 -0
  380. package/docs/reference/field-row.md +16 -0
  381. package/docs/reference/grid.md +39 -0
  382. package/docs/reference/react.md +89 -0
  383. package/docs/reference/selection.md +33 -0
  384. package/docs/reference/views.md +622 -0
  385. package/package.json +27 -4
  386. package/skills/views/SKILL.md +20 -5
  387. package/dist/filters/types.d.ts +0 -27
  388. package/dist/filters/types.js +0 -1
  389. package/dist/model/filter-pushdown.d.ts +0 -106
  390. package/dist/model/filter-pushdown.js +0 -147
@@ -0,0 +1,450 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useRef } from "react";
3
+ import { useViews } from "../../provider/context.js";
4
+ import { cellClearPrev, cellEditBaseline } from "../core/clipboard-model.js";
5
+ import { gridBooleanMode, gridClearRefusal, columnEffectiveWritable, gridColumnHasEditor, } from "../../model/column-capabilities.js";
6
+ import { gridColumnInspectable, isWholeTextColumn } from "../../model/column-inspect.js";
7
+ import { findGridCell, gridCellCutOff } from "./cell-cut-off.js";
8
+ import { gridRowIdFromKey } from "../core/coordinates.js";
9
+ import { activeRangeHead, gridNavIntent, nextCellLinear, nextCellPos, resolveNavTarget, wholeTableRect, } from "../core/nav.js";
10
+ import { copyCell } from "./cell-clipboard.js";
11
+ import { GRID_KEY_OWNING_SURFACES, gridFocusElement } from "./useGridFocus.js";
12
+ import { isGridRowMenuKey, openGridRowMenu } from "./grid-row-menu-key.js";
13
+ import { gridBarArrow, gridFocusStep, gridFocusTab, } from "../core/grid-focus.js";
14
+ const NAV_KEYS = {
15
+ ArrowUp: "up",
16
+ ArrowDown: "down",
17
+ ArrowLeft: "left",
18
+ ArrowRight: "right",
19
+ };
20
+ const KEY_OWNING_SURFACES = GRID_KEY_OWNING_SURFACES;
21
+ const INTERACTIVE = 'button, a[href], [role="button"], [tabindex]:not([tabindex="-1"])';
22
+ function eventBelongsElsewhere(target, root) {
23
+ if (!target?.closest)
24
+ return false;
25
+ if (target.closest(KEY_OWNING_SURFACES))
26
+ return true;
27
+ return !!target.closest(INTERACTIVE) && !root?.contains(target);
28
+ }
29
+ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnabled, listConfig, visibleRowIds, rowByKey, visibleColIds, visibleColumns, rows, getRowId, pendingByRow, rangeVerbsRef, focusCell, clearFocus, startEdit, cancelEdit, commitEdit, refuseEdit, undo, redo, rangeSetRect, rangeExtendTo, ranges, revealCell, releaseToFrame, lastCellRef, chrome = null, setChrome = () => { }, shape, toggleGroup, }) {
30
+ const { ports, messages } = useViews();
31
+ const navFromEditorRef = useRef({ tab: () => { }, enter: () => { } });
32
+ const onEditorTab = useCallback((rowId, columnId, backwards) => navFromEditorRef.current.tab(rowId, columnId, backwards), []);
33
+ const onEditorEnter = useCallback((rowId, columnId) => navFromEditorRef.current.enter(rowId, columnId), []);
34
+ const rowMenuWatchRef = useRef(null);
35
+ useEffect(() => () => rowMenuWatchRef.current?.(), []);
36
+ useEffect(() => {
37
+ navFromEditorRef.current = {
38
+ tab: (rowId, columnId, backwards) => {
39
+ const next = nextCellLinear({ rowId, columnId }, backwards, visibleRowIds, visibleColIds);
40
+ if (!next)
41
+ return;
42
+ focusCell(next.rowId, next.columnId);
43
+ revealCell(next, "auto");
44
+ },
45
+ enter: (rowId, columnId) => {
46
+ const next = nextCellPos({ rowId, columnId }, "down", visibleRowIds, visibleColIds);
47
+ if (!next)
48
+ return;
49
+ focusCell(next.rowId, next.columnId);
50
+ revealCell(next, "auto");
51
+ },
52
+ };
53
+ }, [focusCell, revealCell, visibleColIds, visibleRowIds]);
54
+ useEffect(() => {
55
+ if (!editingEnabled)
56
+ return;
57
+ const scrollToCell = ({ rowId, columnId }) => {
58
+ const key = rowByKey.has(rowId) ? rowId : visibleRowIds.find((k) => gridRowIdFromKey(k) === rowId);
59
+ if (key == null)
60
+ return;
61
+ const pos = { rowId: key, columnId };
62
+ focusCell(key, columnId);
63
+ requestAnimationFrame(() => revealCell(pos, "smooth"));
64
+ };
65
+ const onKeyDown = (event) => {
66
+ if (!(event.metaKey || event.ctrlKey) || event.altKey || event.key.toLowerCase() !== "z") {
67
+ return;
68
+ }
69
+ if (eventBelongsElsewhere(event.target, rootRef.current))
70
+ return;
71
+ const resolveRow = (rowId) => rows.find((row) => getRowId(row) === rowId);
72
+ const handled = event.shiftKey
73
+ ? redo(resolveRow, scrollToCell)
74
+ : undo(resolveRow, scrollToCell);
75
+ if (handled)
76
+ event.preventDefault();
77
+ };
78
+ window.addEventListener("keydown", onKeyDown, true);
79
+ return () => window.removeEventListener("keydown", onKeyDown, true);
80
+ }, [editingEnabled, focusCell, getRowId, redo, revealCell, rootRef, rowByKey, rows, undo, visibleRowIds]);
81
+ const entryCell = useCallback(() => {
82
+ const root = rootRef.current;
83
+ const columnId = visibleColIds[0];
84
+ if (!root || columnId == null)
85
+ return null;
86
+ const visible = new Set(visibleRowIds);
87
+ const top = root.querySelector('[data-slot="vk-grid-scroll"]')?.getBoundingClientRect().top ?? 0;
88
+ let first = null;
89
+ for (const row of root.querySelectorAll('[data-slot="vk-grid-row"]')) {
90
+ const key = row.getAttribute("data-row-id");
91
+ if (key == null || !visible.has(key))
92
+ continue;
93
+ first ??= key;
94
+ if (row.getBoundingClientRect().top >= top) {
95
+ first = key;
96
+ break;
97
+ }
98
+ }
99
+ first ??= visibleRowIds[0] ?? null;
100
+ return first == null ? null : { rowId: first, columnId };
101
+ }, [rootRef, visibleColIds, visibleRowIds]);
102
+ const enterGrid = useCallback((_which, from) => {
103
+ const root = rootRef.current;
104
+ if (!root || (from != null && root.contains(from)))
105
+ return;
106
+ if (focusedCell) {
107
+ revealCell(focusedCell, "auto");
108
+ gridFocusElement(root, { kind: "cell", pos: focusedCell })?.focus({ preventScroll: true });
109
+ return;
110
+ }
111
+ const chromeElement = chrome ? gridFocusElement(root, chrome) : null;
112
+ if (chromeElement) {
113
+ chromeElement.focus({ preventScroll: true });
114
+ return;
115
+ }
116
+ if (chrome)
117
+ setChrome(null);
118
+ const entry = entryCell();
119
+ if (entry) {
120
+ focusCell(entry.rowId, entry.columnId);
121
+ return;
122
+ }
123
+ const head = root.querySelector('[data-slot="vk-grid-header"] [data-headcell]');
124
+ const groupKey = head?.closest('[data-slot="vk-grid-header"]')?.getAttribute("data-group-key");
125
+ const columnId = head?.getAttribute("data-headcell");
126
+ if (groupKey != null && columnId != null)
127
+ setChrome({ kind: "head", groupKey, columnId });
128
+ }, [chrome, entryCell, focusCell, focusedCell, revealCell, rootRef, setChrome]);
129
+ useEffect(() => {
130
+ const root = rootRef.current;
131
+ if (!root)
132
+ return;
133
+ const leave = (backwards) => root.querySelector(`[data-grid-guard="${backwards ? "start" : "end"}"]`)?.focus({ preventScroll: true });
134
+ const onFrameKey = (event) => {
135
+ if (event.target !== root)
136
+ return;
137
+ if (event.key === "Tab" && !event.metaKey && !event.ctrlKey && !event.altKey) {
138
+ leave(event.shiftKey);
139
+ return;
140
+ }
141
+ if (!NAV_KEYS[event.key] || event.metaKey || event.ctrlKey || event.altKey)
142
+ return;
143
+ event.preventDefault();
144
+ const last = lastCellRef.current;
145
+ const back = last && visibleRowIds.includes(last.rowId) && visibleColIds.includes(last.columnId) ? last : entryCell();
146
+ if (!back)
147
+ return;
148
+ focusCell(back.rowId, back.columnId);
149
+ revealCell(back, "auto");
150
+ };
151
+ const moveTo = (next) => {
152
+ if (next.kind === "cell") {
153
+ setChrome(null);
154
+ focusCell(next.pos.rowId, next.pos.columnId);
155
+ revealCell(next.pos, "auto");
156
+ return;
157
+ }
158
+ if (focusedCell)
159
+ clearFocus();
160
+ setChrome(next);
161
+ };
162
+ const onChromeKey = (event, at) => {
163
+ if (!shape)
164
+ return;
165
+ const plain = !event.metaKey && !event.ctrlKey && !event.altKey;
166
+ if (event.key === "Escape") {
167
+ event.stopPropagation();
168
+ setChrome(null);
169
+ releaseToFrame();
170
+ return;
171
+ }
172
+ if (event.key === "Tab" && plain) {
173
+ const next = gridFocusTab(at, event.shiftKey, shape);
174
+ if (!next) {
175
+ setChrome(null);
176
+ leave(event.shiftKey);
177
+ return;
178
+ }
179
+ event.preventDefault();
180
+ moveTo(next);
181
+ return;
182
+ }
183
+ const dir = NAV_KEYS[event.key];
184
+ if (dir && plain && !event.shiftKey) {
185
+ event.preventDefault();
186
+ if (at.kind === "bar" && at.part === "name" && (dir === "left" || dir === "right")) {
187
+ const section = shape.sections.find((s) => s.groupKey === at.groupKey);
188
+ const move = gridBarArrow(section?.collapsed ?? false, dir, section?.menu ?? false);
189
+ if (move === "collapse" || move === "open") {
190
+ toggleGroup?.(at.groupKey);
191
+ return;
192
+ }
193
+ if (move === "none")
194
+ return;
195
+ }
196
+ const next = gridFocusStep(at, dir, shape);
197
+ if (next)
198
+ moveTo(next);
199
+ return;
200
+ }
201
+ if ((event.key === "Enter" || event.key === " ") && plain && !event.shiftKey) {
202
+ event.preventDefault();
203
+ if (at.kind === "bar" && at.part === "name") {
204
+ toggleGroup?.(at.groupKey);
205
+ return;
206
+ }
207
+ gridFocusElement(root, at)?.click();
208
+ }
209
+ };
210
+ const onKeyDown = (event) => {
211
+ const target = event.target;
212
+ if (target?.closest?.(KEY_OWNING_SURFACES))
213
+ return;
214
+ if (chrome) {
215
+ onChromeKey(event, chrome);
216
+ return;
217
+ }
218
+ if (!focusedCell) {
219
+ onFrameKey(event);
220
+ return;
221
+ }
222
+ if (target !== root && !target?.closest?.('[data-slot="vk-grid-cell"]'))
223
+ return;
224
+ handleCellKey(event, focusedCell, leave);
225
+ };
226
+ const resolveFocusedAt = (focusedCell) => {
227
+ const entry = rowByKey.get(focusedCell.rowId);
228
+ return {
229
+ column: visibleColumns.find((column) => column.id === focusedCell.columnId),
230
+ row: entry?.row,
231
+ rowId: entry?.rowId ?? focusedCell.rowId,
232
+ };
233
+ };
234
+ function handleCellKey(event, focusedCell, leave) {
235
+ const resolveFocused = () => resolveFocusedAt(focusedCell);
236
+ const mod = (event.metaKey || event.ctrlKey) && !event.shiftKey && !event.altKey;
237
+ const bare = !event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
238
+ const navDirection = NAV_KEYS[event.key];
239
+ const navIntent = gridNavIntent(event);
240
+ rowMenuWatchRef.current?.();
241
+ rowMenuWatchRef.current = null;
242
+ if (isGridRowMenuKey(event) && !editingCell) {
243
+ event.preventDefault();
244
+ const cell = root ? gridFocusElement(root, { kind: "cell", pos: focusedCell }) : null;
245
+ if (cell)
246
+ rowMenuWatchRef.current = openGridRowMenu(cell);
247
+ return;
248
+ }
249
+ if (event.key === "Escape") {
250
+ event.stopPropagation();
251
+ if (editingCell)
252
+ cancelEdit();
253
+ else {
254
+ clearFocus();
255
+ releaseToFrame();
256
+ }
257
+ }
258
+ else if (navDirection && bare && !editingCell) {
259
+ event.preventDefault();
260
+ if (shape && navDirection !== "right") {
261
+ const step = gridFocusStep({ kind: "cell", pos: focusedCell }, navDirection, shape);
262
+ if (step)
263
+ moveTo(step);
264
+ return;
265
+ }
266
+ const next = nextCellPos(focusedCell, navDirection, visibleRowIds, visibleColIds);
267
+ if (!next)
268
+ return;
269
+ focusCell(next.rowId, next.columnId);
270
+ revealCell(next, "auto");
271
+ }
272
+ else if (navIntent && !editingCell) {
273
+ event.preventDefault();
274
+ if (navIntent.kind === "selectAll") {
275
+ const rect = wholeTableRect(visibleRowIds, visibleColIds);
276
+ if (rect)
277
+ rangeSetRect(rect.anchor, rect.head);
278
+ return;
279
+ }
280
+ const head = navIntent.extend
281
+ ? activeRangeHead(ranges, visibleRowIds, visibleColIds)
282
+ : null;
283
+ const from = head ?? focusedCell;
284
+ const next = resolveNavTarget(from, navIntent.target, visibleRowIds, visibleColIds);
285
+ if (!next)
286
+ return;
287
+ if (next.rowId === from.rowId && next.columnId === from.columnId)
288
+ return;
289
+ if (!navIntent.extend)
290
+ focusCell(next.rowId, next.columnId);
291
+ else if (head)
292
+ rangeExtendTo(next);
293
+ else
294
+ rangeSetRect(focusedCell, next);
295
+ revealCell(next, "auto");
296
+ }
297
+ else if (event.key === "Tab" && !event.metaKey && !event.ctrlKey && !event.altKey) {
298
+ if (editingCell) {
299
+ event.preventDefault();
300
+ return;
301
+ }
302
+ const next = nextCellLinear(focusedCell, event.shiftKey, visibleRowIds, visibleColIds);
303
+ if (!next) {
304
+ leave(event.shiftKey);
305
+ return;
306
+ }
307
+ event.preventDefault();
308
+ focusCell(next.rowId, next.columnId);
309
+ revealCell(next, "auto");
310
+ }
311
+ else if (event.key === "Enter" && !editingCell) {
312
+ const column = visibleColumns.find((item) => item.id === focusedCell.columnId);
313
+ event.preventDefault();
314
+ const whole = column != null &&
315
+ isWholeTextColumn(column) &&
316
+ gridCellCutOff(findGridCell(rootRef.current, focusedCell));
317
+ if (column &&
318
+ ((editingEnabled && gridColumnHasEditor(column)) || gridColumnInspectable(column) || whole)) {
319
+ startEdit(focusedCell.rowId, focusedCell.columnId, undefined, whole);
320
+ return;
321
+ }
322
+ if (column &&
323
+ editingEnabled &&
324
+ gridBooleanMode(column) === "toggle" &&
325
+ columnEffectiveWritable(column, listConfig)) {
326
+ const { row, rowId } = resolveFocused();
327
+ if (row != null) {
328
+ const on = cellEditBaseline(column, row, pendingByRow.get(rowId)) === true;
329
+ commitEdit(row, rowId, column.id, on, !on);
330
+ return;
331
+ }
332
+ }
333
+ const next = nextCellPos(focusedCell, "down", visibleRowIds, visibleColIds);
334
+ if (!next)
335
+ return;
336
+ focusCell(next.rowId, next.columnId);
337
+ revealCell(next, "auto");
338
+ }
339
+ else if (mod && event.key.toLowerCase() === "c" && !editingCell) {
340
+ event.preventDefault();
341
+ if (rangeVerbsRef.current?.activeRangeIsMulti()) {
342
+ rangeVerbsRef.current.copyRange();
343
+ return;
344
+ }
345
+ const { column, row, rowId } = resolveFocused();
346
+ if (!column || row == null)
347
+ return;
348
+ const baseline = cellEditBaseline(column, row, pendingByRow.get(rowId));
349
+ void copyCell(ports.clipboard.writeText, column, baseline, column.editUnit?.value(row));
350
+ }
351
+ else if (mod && event.key.toLowerCase() === "x" && !editingCell) {
352
+ event.preventDefault();
353
+ if (rangeVerbsRef.current?.activeRangeIsMulti()) {
354
+ if (editingEnabled)
355
+ rangeVerbsRef.current.cutRange();
356
+ return;
357
+ }
358
+ const { column, row, rowId } = resolveFocused();
359
+ if (!column || row == null)
360
+ return;
361
+ if (!editingEnabled || !columnEffectiveWritable(column, listConfig))
362
+ return;
363
+ if (!gridBooleanMode(column) && !column.clearable)
364
+ return;
365
+ const baseline = cellEditBaseline(column, row, pendingByRow.get(rowId));
366
+ void copyCell(ports.clipboard.writeText, column, baseline, column.editUnit?.value(row));
367
+ commitEdit(row, rowId, column.id, cellClearPrev(column, row, pendingByRow.get(rowId)), "");
368
+ }
369
+ else if ((event.key === "Delete" || event.key === "Backspace") && !editingCell) {
370
+ event.preventDefault();
371
+ if (rangeVerbsRef.current?.activeRangeIsMulti()) {
372
+ if (editingEnabled)
373
+ rangeVerbsRef.current.clearRange();
374
+ return;
375
+ }
376
+ const { column, row, rowId } = resolveFocused();
377
+ if (!column || row == null || !editingEnabled)
378
+ return;
379
+ if (!columnEffectiveWritable(column, listConfig)) {
380
+ if (!refuseEdit(column.id))
381
+ ports.toast.error(gridClearRefusal(column, listConfig, messages));
382
+ return;
383
+ }
384
+ if (!gridBooleanMode(column) && !column.clearable) {
385
+ ports.toast.error(gridClearRefusal(column, listConfig, messages));
386
+ return;
387
+ }
388
+ commitEdit(row, rowId, column.id, cellClearPrev(column, row, pendingByRow.get(rowId)), "");
389
+ }
390
+ else if (!editingCell &&
391
+ editingEnabled &&
392
+ event.key.length === 1 &&
393
+ !event.metaKey &&
394
+ !event.ctrlKey &&
395
+ !event.altKey &&
396
+ !event.isComposing) {
397
+ const column = visibleColumns.find((item) => item.id === focusedCell.columnId);
398
+ if (!column)
399
+ return;
400
+ if (!columnEffectiveWritable(column, listConfig)) {
401
+ if (refuseEdit(column.id))
402
+ event.preventDefault();
403
+ return;
404
+ }
405
+ if (!gridColumnHasEditor(column))
406
+ return;
407
+ event.preventDefault();
408
+ const seedable = column.type !== "multiselect" &&
409
+ !column.multiple;
410
+ startEdit(focusedCell.rowId, focusedCell.columnId, seedable ? event.key : undefined);
411
+ }
412
+ }
413
+ root.addEventListener("keydown", onKeyDown);
414
+ return () => root.removeEventListener("keydown", onKeyDown);
415
+ }, [
416
+ cancelEdit,
417
+ chrome,
418
+ clearFocus,
419
+ commitEdit,
420
+ editingCell,
421
+ editingEnabled,
422
+ entryCell,
423
+ focusCell,
424
+ focusedCell,
425
+ getRowId,
426
+ lastCellRef,
427
+ listConfig,
428
+ releaseToFrame,
429
+ messages,
430
+ pendingByRow,
431
+ ports,
432
+ refuseEdit,
433
+ rowByKey,
434
+ rangeVerbsRef,
435
+ ranges,
436
+ rangeSetRect,
437
+ rangeExtendTo,
438
+ revealCell,
439
+ rootRef,
440
+ rows,
441
+ setChrome,
442
+ shape,
443
+ startEdit,
444
+ toggleGroup,
445
+ visibleColIds,
446
+ visibleColumns,
447
+ visibleRowIds,
448
+ ]);
449
+ return { onEditorTab, onEditorEnter, enterGrid };
450
+ }
@@ -0,0 +1,12 @@
1
+ import type { ListColumn } from "../../model/column-schema.js";
2
+ export declare function useGridPendingReconciliation<Row>({ rows, columns, getRowId, pendingByRow, reconcile, hasInflight, pendingBaseline, }: {
3
+ rows: Row[];
4
+ columns: ListColumn<Row>[];
5
+ getRowId: (row: Row) => string;
6
+ pendingByRow: ReadonlyMap<string, Record<string, unknown>>;
7
+ reconcile: (matchedKeys: string[]) => void;
8
+ hasInflight?: (rowId: string, columnId: string) => boolean;
9
+ /** Enables the concurrent-write warning; without it reconciliation still
10
+ * clears the overlay, just silently, as it always did. */
11
+ pendingBaseline?: (rowId: string, columnId: string) => unknown;
12
+ }): void;
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { useEffect, useRef } from "react";
3
+ import { useViews } from "../../provider/context.js";
4
+ import { findGridPendingMatches, findSupersededCells } from "../core/pending-reconciliation.js";
5
+ import { columnLabel } from "../../model/column-capabilities.js";
6
+ export function useGridPendingReconciliation({ rows, columns, getRowId, pendingByRow, reconcile, hasInflight, pendingBaseline, }) {
7
+ const { ports, messages } = useViews();
8
+ const reconciledRowsRef = useRef(null);
9
+ useEffect(() => {
10
+ if (pendingByRow.size === 0) {
11
+ reconciledRowsRef.current = rows;
12
+ return;
13
+ }
14
+ if (reconciledRowsRef.current === rows)
15
+ return;
16
+ reconciledRowsRef.current = rows;
17
+ if (hasInflight && pendingBaseline) {
18
+ const taken = findSupersededCells(rows, columns, getRowId, pendingByRow, hasInflight, pendingBaseline);
19
+ if (taken.length === 1) {
20
+ ports.toast.warning(messages({ key: "views.grid.changed-elsewhere", values: { field: columnLabel(taken[0].column) } }), { description: messages({ key: "views.grid.saved-value" }) });
21
+ }
22
+ else if (taken.length > 1) {
23
+ ports.toast.warning(messages({ key: "views.grid.changed-elsewhere-cells", values: { count: taken.length } }), {
24
+ description: messages({ key: "views.grid.saved-values" }),
25
+ });
26
+ }
27
+ }
28
+ const matched = findGridPendingMatches(rows, columns, getRowId, pendingByRow, hasInflight);
29
+ if (matched.length > 0)
30
+ reconcile(matched);
31
+ }, [columns, getRowId, hasInflight, messages, pendingBaseline, pendingByRow, ports, reconcile, rows]);
32
+ }
@@ -0,0 +1,57 @@
1
+ import { type RefObject } from "react";
2
+ /**
3
+ * When the checkbox rail holds its space, and how it is asked to.
4
+ *
5
+ * The rail is not free: parking it reserves `--vk-rail-w` at the table's left
6
+ * edge and stops the columns there. So it parks only when it is earning that,
7
+ * and otherwise travels off with its row so the table can run clean to the edge.
8
+ *
9
+ * Two sources, one signal — `data-rail` on the table root, which every rail slot
10
+ * reads through `group-data-[rail=on]/gridtable`:
11
+ *
12
+ * · EARNED — a selection is running, so every checkbox has to stay reachable
13
+ * whatever the pointer is doing.
14
+ * · HOVERED — the pointer is in the strip the rail parks in, AND the rail is
15
+ * actually parked there. Both halves matter: unscrolled, that strip is empty
16
+ * space with the checkboxes still out at the page gutter, so reacting to it
17
+ * would be reacting to a hover over nothing.
18
+ *
19
+ * A FROZEN BLOCK IS NOT ONE OF THEM. It parks at `--vk-rail-w` regardless,
20
+ * which keeps the checkbox's slot open ahead of it — but an open slot is not a
21
+ * reason to fill it. Treating "this table has a pinned column" as earned meant
22
+ * every such table showed a full column of checkboxes at rest, permanently.
23
+ *
24
+ * NONE of this touches the per-row reveal: pointing at a row always shows THAT
25
+ * row's checkbox, rail or no rail. This is only the "show me all of them" state.
26
+ *
27
+ * ONE attribute rather than React state, and that is the point. The hover half
28
+ * flips on every pass of the pointer, and this grid has no virtualisation — a
29
+ * re-render is every row of a possibly thousand-row table. Flipping an attribute
30
+ * re-renders nothing and lets CSS fade the lane in.
31
+ */
32
+ export declare function useGridRailReveal({ rootRef, earned, }: {
33
+ rootRef: RefObject<HTMLElement | null>;
34
+ /** The rail must show regardless of the pointer — a live selection. */
35
+ earned: boolean;
36
+ }): {
37
+ probeRef: RefObject<HTMLSpanElement | null>;
38
+ rootProps: {
39
+ onPointerEnter: () => void;
40
+ onPointerMove: (event: React.PointerEvent) => void;
41
+ onWheel: () => void;
42
+ onPointerLeave: () => void;
43
+ } | {
44
+ onPointerEnter?: undefined;
45
+ onPointerMove?: undefined;
46
+ onWheel?: undefined;
47
+ onPointerLeave?: undefined;
48
+ };
49
+ };
50
+ /**
51
+ * The strip the rail parks in, laid out but never painted or hit — its only job
52
+ * is to be measured, so the boundary follows the CSS instead of being
53
+ * duplicated in JS.
54
+ */
55
+ export declare function GridRailProbe({ probeRef }: {
56
+ probeRef: RefObject<HTMLSpanElement | null>;
57
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useCallback, useEffect, useRef } from "react";
4
+ import { useHasHover } from "../../internal/viewport.js";
5
+ export function useGridRailReveal({ rootRef, earned, }) {
6
+ const hoverable = useHasHover();
7
+ const earnedRef = useRef(earned);
8
+ const onRef = useRef(false);
9
+ const edgeRef = useRef(0);
10
+ const probeRef = useRef(null);
11
+ const setRail = useCallback((on) => {
12
+ if (onRef.current === on)
13
+ return;
14
+ onRef.current = on;
15
+ rootRef.current?.setAttribute("data-rail", on ? "on" : "off");
16
+ }, [rootRef]);
17
+ useEffect(() => {
18
+ earnedRef.current = earned;
19
+ if (earned)
20
+ setRail(true);
21
+ else
22
+ setRail(false);
23
+ }, [earned, setRail]);
24
+ const measure = useCallback(() => {
25
+ const probe = probeRef.current;
26
+ if (probe)
27
+ edgeRef.current = probe.getBoundingClientRect().right;
28
+ }, []);
29
+ useEffect(() => {
30
+ const probe = probeRef.current;
31
+ if (!probe)
32
+ return;
33
+ measure();
34
+ const observer = new ResizeObserver(measure);
35
+ observer.observe(probe);
36
+ window.addEventListener("resize", measure);
37
+ return () => {
38
+ observer.disconnect();
39
+ window.removeEventListener("resize", measure);
40
+ };
41
+ }, [measure]);
42
+ const pointerXRef = useRef(Number.POSITIVE_INFINITY);
43
+ const evaluate = useCallback(() => {
44
+ if (earnedRef.current)
45
+ return setRail(true);
46
+ const parked = rootRef.current?.style.getPropertyValue("--vk-parked") === "1";
47
+ setRail(parked && pointerXRef.current <= edgeRef.current);
48
+ }, [rootRef, setRail]);
49
+ const rootProps = hoverable
50
+ ? {
51
+ onPointerEnter: measure,
52
+ onPointerMove: (event) => {
53
+ pointerXRef.current = event.clientX;
54
+ evaluate();
55
+ },
56
+ onWheel: evaluate,
57
+ onPointerLeave: () => {
58
+ pointerXRef.current = Number.POSITIVE_INFINITY;
59
+ evaluate();
60
+ },
61
+ }
62
+ : {};
63
+ return { probeRef, rootProps };
64
+ }
65
+ export function GridRailProbe({ probeRef }) {
66
+ return (_jsx("span", { "aria-hidden": true, ref: probeRef, className: "pointer-events-none absolute top-0 h-0 w-(--vk-rail-w)", style: { left: "calc(-1 * var(--vk-gutter,0px))" } }));
67
+ }
@@ -0,0 +1,51 @@
1
+ import type { GridCellPos } from "../core/coordinates.js";
2
+ import type { GridEditCell } from "../core/editing-model.js";
3
+ import { type GridCellRange } from "../core/range-model.js";
4
+ import { type GridSpreadsheetModel } from "../core/spreadsheet-operations.js";
5
+ import type { ListColumn } from "../../model/column-schema.js";
6
+ import { type GridPasteSource } from "./cell-clipboard.js";
7
+ export type GridRangeVerbs = {
8
+ copyRange: () => void;
9
+ cutRange: () => void;
10
+ clearRange: () => void;
11
+ pasteMatrix: (matrix: GridPasteSource[][], anchor: {
12
+ rowIdx: number;
13
+ colIdx: number;
14
+ }) => void;
15
+ pasteAtCell: (rowId: string, columnId: string) => void;
16
+ pasteAtRangeOrigin: () => void;
17
+ activeRangeIsMulti: () => boolean;
18
+ activeRangeHasClearable: () => boolean;
19
+ cellInActiveRange: (rowId: string, columnId: string) => boolean;
20
+ };
21
+ export declare function useGridRangeActions<Row>({ ranges, focusedCell, editingCell, editingEnabled, fillTargetRow, visibleRowIds, visibleColumns, spreadsheetModel, commitBatch, focusCell, rangeSetRect, rangeExtendTo, revealCell, }: {
22
+ ranges: GridCellRange[];
23
+ focusedCell: GridCellPos | null;
24
+ editingCell: GridCellPos | null;
25
+ editingEnabled: boolean;
26
+ fillTargetRow: string | null;
27
+ visibleRowIds: string[];
28
+ visibleColumns: ListColumn<Row>[];
29
+ spreadsheetModel: GridSpreadsheetModel<Row>;
30
+ commitBatch: (edits: (GridEditCell<Row> & {
31
+ row: Row;
32
+ })[]) => void;
33
+ focusCell: (rowId: string, columnId: string) => void;
34
+ rangeSetRect: (anchor: GridCellPos, head: GridCellPos) => void;
35
+ rangeExtendTo: (pos: GridCellPos, fallbackAnchor?: GridCellPos) => void;
36
+ /** The grid's one reveal: a paste brings where it landed into view, drawn or not. */
37
+ revealCell: (pos: GridCellPos, behavior: ScrollBehavior) => void;
38
+ }): {
39
+ visibleColIds: string[];
40
+ rowSpansMap: Map<string, import("../core/range-model.js").GridRowRangeSpan[]>;
41
+ selectValuesByColumn: Record<string, string[]>;
42
+ finishFill: (targetRowId: string) => void;
43
+ onRangeCopy: () => void | undefined;
44
+ onRangeCut: () => void | undefined;
45
+ onRangeClear: () => void | undefined;
46
+ onRangePaste: () => void | undefined;
47
+ onPasteAtCell: (rowId: string, columnId: string) => void | undefined;
48
+ inActiveRange: (rowId: string, columnId: string) => boolean;
49
+ rangeCanClear: () => boolean;
50
+ rangeVerbsRef: import("react").RefObject<GridRangeVerbs | null>;
51
+ };