@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,64 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useRef, useState } from "react";
4
+ import { useViews } from "../../provider/context.js";
5
+ import { cx } from "../../internal/cx.js";
6
+ import { GridMenuRow, GridMenuSeparator } from "./GridMenuRow.js";
7
+ import { GRID_MENU_SEARCH_AFTER, matchMenuOptions } from "./grid-menu-search.js";
8
+ import { GRID_CHROME_FOCUS } from "./grid-styles.js";
9
+ import { gridMenuArrows, gridMenuSearchArrows, useGridMenuFocus } from "./grid-menu-focus.js";
10
+ const EYEBROW = "px-2 pb-1 pt-2 text-[11px] font-medium uppercase tracking-wide text-(color:--vk-fg-subtle)";
11
+ export function GridGroupMenu({ sort, sortOptions, summary, onSummaryChange, figures = [], onHide, }) {
12
+ const [open, setOpen] = useState(false);
13
+ const [anchor, setAnchor] = useState(null);
14
+ const menuFocus = useGridMenuFocus(open, anchor);
15
+ const rowsBox = useRef(null);
16
+ const searchField = useRef(null);
17
+ const { atoms, components, icons, messages } = useViews();
18
+ const { Popover, Command } = components;
19
+ const { List, Row, RowContent } = atoms;
20
+ const More = icons.more;
21
+ const [query, setQuery] = useState("");
22
+ const close = () => {
23
+ setOpen(false);
24
+ setQuery("");
25
+ };
26
+ const offered = sort ? sortOptions : [];
27
+ const searchable = offered.length > GRID_MENU_SEARCH_AFTER;
28
+ const sorts = matchMenuOptions(offered, query);
29
+ const pick = (opt) => {
30
+ if (!sort)
31
+ return;
32
+ const active = sort.value === opt.value;
33
+ const dir = active
34
+ ? sort.dir === "asc"
35
+ ? "desc"
36
+ : "asc"
37
+ : (opt.defaultDir ?? "asc");
38
+ sort.onChange({ value: opt.value, dir });
39
+ close();
40
+ };
41
+ const sortGlyph = (opt) => {
42
+ const active = sort.value === opt.value;
43
+ const Glyph = active && sort.dir === "desc" ? icons.sortRowsDown : icons.sortRowsUp;
44
+ return (_jsx(Glyph, { className: cx("size-3.5", active ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtlest)") }));
45
+ };
46
+ return (_jsxs(_Fragment, { children: [_jsx("button", { ref: setAnchor, type: "button", tabIndex: -1, "aria-label": messages({ key: "views.menus.group-options" }), "aria-haspopup": "dialog", "aria-expanded": open, onClick: (e) => {
47
+ e.stopPropagation();
48
+ if (open)
49
+ close();
50
+ else {
51
+ menuFocus.noteOpen(e);
52
+ setOpen(true);
53
+ }
54
+ }, className: cx("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-(color:--vk-fg-subtle)", "transition-opacity hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", "md:opacity-0 md:group-hover/gridlabel:opacity-100 aria-expanded:opacity-100 md:focus-visible:opacity-100", GRID_CHROME_FOCUS), children: _jsx(More, { className: "h-3.5 w-3.5" }) }), _jsx(Popover, { open: open, onOpenChange: (next) => (next ? setOpen(true) : close()), anchor: anchor, side: "bottom", align: "start", sideOffset: 4, initialFocus: menuFocus.initialFocus, chrome: "menu", panelData: { "data-slot": "vk-grid-group-menu" }, onPanelClick: (e) => e.stopPropagation(), className: "w-52", onOutsidePress: (event) => (anchor?.contains(event.target) ? false : undefined), children: _jsx("div", { ref: rowsBox, onKeyDown: (e) => gridMenuArrows(e, searchField.current), children: _jsxs(List, { children: [offered.length > 0 && _jsx("div", { className: EYEBROW, children: messages({ key: "views.menus.group-sort" }) }), searchable ? (_jsxs(Command.Root, { shouldFilter: false, loop: true, label: messages({ key: "views.menus.search" }), children: [_jsx(Command.Input, { ref: searchField, onKeyDown: (e) => gridMenuSearchArrows(e, rowsBox.current), value: query, onValueChange: setQuery, placeholder: messages({ key: "views.menus.search" }) }), _jsx(Command.List, { className: "max-h-64 overscroll-contain", children: _jsx(Command.Group, { className: "p-0", children: sorts.map((opt) => {
55
+ const active = sort.value === opt.value;
56
+ return (_jsx(Command.Item, { value: opt.value, onSelect: () => pick(opt), chosen: active, children: _jsx(RowContent, { label: opt.label, leading: sortGlyph(opt), chosen: active }) }, opt.value));
57
+ }) }) })] })) : (sorts.map((opt) => (_jsx(Row, { chosen: sort.value === opt.value, label: opt.label, leading: sortGlyph(opt), onClick: () => pick(opt) }, opt.value)))), figures.length > 0 && onSummaryChange && (_jsxs(_Fragment, { children: [offered.length > 0 && _jsx(GridMenuSeparator, {}), _jsx("div", { className: EYEBROW, children: messages({ key: "views.menus.group-show" }) }), [
58
+ { part: "count", label: messages({ key: "views.menus.group-count" }) },
59
+ ...figures,
60
+ ].map((s) => (_jsx(Row, { chosen: (summary ?? []).includes(s.part), label: s.label, onClick: () => onSummaryChange(s.part, !(summary ?? []).includes(s.part)) }, s.part)))] })), onHide && (_jsxs(_Fragment, { children: [(offered.length > 0 || (figures.length > 0 && onSummaryChange)) && _jsx(GridMenuSeparator, {}), _jsx(GridMenuRow, { label: messages({ key: "views.menus.group-hide" }), icon: "hide", onClick: () => {
61
+ onHide();
62
+ close();
63
+ } })] }))] }) }) })] }));
64
+ }
@@ -0,0 +1,66 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ListColumnsConfig } from "../../model/column-state.js";
3
+ import type { ListSettingsConfig } from "../../model/column-capabilities.js";
4
+ import type { ListColumn, ListOptionColorOverrides, ListSelectColor } from "../../model/column-schema.js";
5
+ import type { ListDateStyle, ListDateStyleOverrides, ListDurationStyle, ListDurationStyleOverrides, ListNumberFormatOverrides, ListPercentDisplayOverrides, ListShowTimeOverrides } from "../../model/column-format.js";
6
+ import type { PercentDisplay } from "@viewkitjs/fields";
7
+ import { type GridGroupByState, type GridSortState } from "./GridColumnMenu.js";
8
+ import type { useHeaderDragReorder } from "./useHeaderDragReorder.js";
9
+ type HeaderDrag = ReturnType<typeof useHeaderDragReorder>;
10
+ export declare function GridHeader<Row>({ showAddColumn, checkbox, groupKey, ariaRowIndex, ariaLevel, ariaColOffset, ariaTailIndex, columns, columnManager, minWidth, sort, selectValues, optionColors, onOptionColorChange, dateStyles, onDateStyleChange, durationStyles, onDurationStyleChange, numberFormats, onNumberFormatChange, showTimeOverrides, onShowTimeChange, percentDisplays, onPercentDisplayChange, columnStateEnabled, listConfig, groupBy, resizingId, startResize, moveResize, endResize, resetColumnWidth, hideColumn, moveColumn, headerDrag, frozenCount, frozenLeft, viewBacked, formatsWritable, renderAddColumn, renderColumnMenuRows, }: {
11
+ /** The table sized the tail for "+ Add column": the desktop strip of a grid with column state. */
12
+ showAddColumn?: boolean;
13
+ checkbox?: ReactNode;
14
+ /** The section this column-name row heads: the keyboard finds its cells by it. */
15
+ groupKey?: string;
16
+ /** What a screen reader reads (`core/grid-aria.ts`): the row's number, its level in a tree grid, the columns
17
+ * before the first data column (the checkbox lane), and the tail's column. */
18
+ ariaRowIndex?: number;
19
+ ariaLevel?: number;
20
+ ariaColOffset?: number;
21
+ ariaTailIndex?: number;
22
+ columns: ListColumn<Row>[];
23
+ columnManager: ListColumnsConfig | null;
24
+ minWidth: string;
25
+ sort?: GridSortState;
26
+ selectValues: Record<string, string[]>;
27
+ optionColors?: ListOptionColorOverrides;
28
+ onOptionColorChange?: (key: string, value: string, color: ListSelectColor | null) => void;
29
+ dateStyles?: ListDateStyleOverrides;
30
+ onDateStyleChange?: (key: string, style: ListDateStyle) => void;
31
+ durationStyles?: ListDurationStyleOverrides;
32
+ onDurationStyleChange?: (key: string, style: ListDurationStyle) => void;
33
+ numberFormats?: ListNumberFormatOverrides;
34
+ onNumberFormatChange?: (key: string, patch: {
35
+ decimals?: number | null;
36
+ currency?: string;
37
+ }) => void;
38
+ showTimeOverrides?: ListShowTimeOverrides;
39
+ onShowTimeChange?: (key: string, show: boolean) => void;
40
+ percentDisplays?: ListPercentDisplayOverrides;
41
+ onPercentDisplayChange?: (key: string, display: PercentDisplay) => void;
42
+ columnStateEnabled: boolean;
43
+ /** Workspace list config — the read-only indicator reads its `readOnly`. */
44
+ listConfig?: ListSettingsConfig;
45
+ /** The view's group, for the header menu's Group by / Ungroup row. */
46
+ groupBy?: GridGroupByState;
47
+ resizingId: string | null;
48
+ startResize: (column: ListColumn<Row>, event: React.PointerEvent<HTMLElement>) => void;
49
+ moveResize: (event: React.PointerEvent<HTMLElement>) => void;
50
+ endResize: () => void;
51
+ resetColumnWidth: (column: ListColumn<Row>) => void;
52
+ hideColumn: (column: ListColumn<Row>) => void;
53
+ moveColumn: (column: ListColumn<Row>, direction: -1 | 1) => void;
54
+ headerDrag: HeaderDrag;
55
+ /** How many LEADING columns are pinned to the left edge (0 = nothing). */
56
+ frozenCount?: number;
57
+ /** Sticky `left` for the frozen column at visible index i — a calc() over the
58
+ * width vars, so live resize re-lays the frozen stack without React. */
59
+ frozenLeft?: (i: number) => string;
60
+ viewBacked?: boolean;
61
+ /** The host's rules and slots, passed on from the grid's props (grid-table-props). */
62
+ formatsWritable?: boolean;
63
+ renderAddColumn?: (columns: ListColumnsConfig) => ReactNode;
64
+ renderColumnMenuRows?: (fieldKey: string, close: () => void) => ReactNode;
65
+ }): import("react/jsx-runtime").JSX.Element;
66
+ export {};
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { cx } from "../../internal/cx.js";
4
+ import { columnHideable } from "../../model/column-state.js";
5
+ import { fieldKeyOf } from "../../model/view-rules.js";
6
+ import { GridRailSpacer } from "./checks.js";
7
+ import { GridAddColumn } from "./GridAddColumn.js";
8
+ import { GridColumnMenu, gridColumnMenuEnabled, } from "./GridColumnMenu.js";
9
+ import { GridResizeHandle } from "./GridResizeHandle.js";
10
+ import { GRID_CHROME_FOCUS, GRID_CONTENT_PAD, GRID_HEADER_BG_FROZEN, GRID_HEADER_BG_FROZEN_HOVER, } from "./grid-styles.js";
11
+ import { useViews } from "../../provider/context.js";
12
+ import { gridColumnGlyph } from "./column-glyph.js";
13
+ import { gridFocusOnPress } from "./useGridFocus.js";
14
+ import { effectiveSortKey } from "../../model/column-sort.js";
15
+ import { columnPlacedByView } from "../../model/column-capabilities.js";
16
+ export function GridHeader({ showAddColumn = false, checkbox, groupKey, ariaRowIndex, ariaLevel, ariaColOffset = 0, ariaTailIndex, columns, columnManager, minWidth, sort, selectValues, optionColors, onOptionColorChange, dateStyles, onDateStyleChange, durationStyles, onDurationStyleChange, numberFormats, onNumberFormatChange, showTimeOverrides, onShowTimeChange, percentDisplays, onPercentDisplayChange, columnStateEnabled, listConfig, groupBy, resizingId, startResize, moveResize, endResize, resetColumnWidth, hideColumn, moveColumn, headerDrag, frozenCount = 0, frozenLeft, viewBacked = false, formatsWritable, renderAddColumn, renderColumnMenuRows, }) {
17
+ const { icons, components, messages } = useViews();
18
+ const addColumn = columnManager && showAddColumn
19
+ ? renderAddColumn?.(columnManager) || _jsx(GridAddColumn, { columns: columnManager })
20
+ : null;
21
+ const cells = (_jsxs(_Fragment, { children: [checkbox ?? _jsx(GridRailSpacer, { selecting: false, bordered: true }), columns.map((column, index) => {
22
+ const canMove = columnStateEnabled && (!viewBacked || columnPlacedByView(column));
23
+ const canHide = canMove && columnHideable(column) && columns.length > 1;
24
+ const menuEnabled = gridColumnMenuEnabled(column);
25
+ const frozen = index < frozenCount && !!frozenLeft;
26
+ const cell = (_jsxs("div", { "data-slot": "vk-grid-header-cell", "data-headcell": column.id, tabIndex: -1, role: "columnheader", "aria-colindex": ariaColOffset + index + 1, "aria-sort": sort && sort.value === effectiveSortKey(column, viewBacked)
27
+ ? sort.dir === "asc"
28
+ ? "ascending"
29
+ : "descending"
30
+ : undefined, "aria-label": column.header ? undefined : (column.field?.label ?? column.id), style: {
31
+ ...headerDrag.cellStyle(column.id, index),
32
+ ...(frozen ? { left: frozenLeft(index) } : null),
33
+ }, onPointerDown: (event) => {
34
+ gridFocusOnPress(event, "[data-headcell]");
35
+ headerDrag.onCellPointerDown(column.id, index)(event);
36
+ }, onPointerMove: headerDrag.onCellPointerMove, onPointerUp: headerDrag.onCellPointerUp, onPointerCancel: headerDrag.onCellPointerCancel, onClickCapture: headerDrag.onCellClickCapture, className: cx("flex h-(--vk-head-h) min-w-0 select-none items-center gap-1.5 overflow-hidden whitespace-nowrap border-b border-(color:--vk-border-subtle) px-(--vk-px) text-(length:--vk-head-text) text-(color:--vk-fg-subtle)", GRID_CHROME_FOCUS, !frozen && "hover:bg-(color:--vk-hovered)", column.align === "center" && "justify-center", menuEnabled ? "cursor-pointer" : "cursor-default", "translate-x-(--vk-drag-shift,0px)", frozen ? cx("sticky z-7", GRID_HEADER_BG_FROZEN, GRID_HEADER_BG_FROZEN_HOVER) : "relative"), children: [gridColumnGlyph({ icons, AppIcon: components.AppIcon }, column, "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0 opacity-70"), column.header ? _jsx("span", { className: "truncate", children: column.header }) : null, columnStateEnabled && (_jsx(GridResizeHandle, { active: resizingId === column.id, onResizeStart: (event) => startResize(column, event), onResizeMove: moveResize, onResizeEnd: endResize, onReset: () => resetColumnWidth(column) }))] }, column.id));
37
+ if (!menuEnabled)
38
+ return cell;
39
+ return (_jsx(GridColumnMenu, { column: column, values: selectValues[column.id] ?? [], viewBacked: viewBacked, sort: sort, groupBy: groupBy, optionColors: optionColors?.[fieldKeyOf(column)], onOptionColorChange: onOptionColorChange, dateStyle: dateStyles?.[fieldKeyOf(column)], onDateStyleChange: onDateStyleChange, durationStyle: durationStyles?.[fieldKeyOf(column)], onDurationStyleChange: onDurationStyleChange, numberFormat: numberFormats?.[fieldKeyOf(column)], onNumberFormatChange: onNumberFormatChange, showTime: showTimeOverrides?.[fieldKeyOf(column)] ?? column.format?.withTime ?? false, onShowTimeChange: column.type === "datetime" ? onShowTimeChange : undefined, percentDisplay: percentDisplays?.[fieldKeyOf(column)], onPercentDisplayChange: onPercentDisplayChange, onMoveLeft: canMove && index > 0 ? () => moveColumn(column, -1) : undefined, onMoveRight: canMove && index < columns.length - 1 ? () => moveColumn(column, 1) : undefined, onHide: canHide ? () => hideColumn(column) : undefined, formatsWritable: formatsWritable, renderColumnMenuRows: renderColumnMenuRows, children: cell }, column.id));
40
+ }), _jsxs("div", { "data-slot": "vk-grid-tail", role: "columnheader", "aria-colindex": ariaTailIndex, className: cx("flex h-(--vk-head-h) min-w-0 items-center gap-2 border-b border-(color:--vk-border-subtle)", addColumn ? "pl-0" : "pl-(--vk-px)"), children: [listConfig?.readOnly && (_jsxs("span", { title: messages({ key: "views.grid.read-only-why" }), className: cx("inline-flex shrink-0 items-center gap-1 whitespace-nowrap text-(length:--vk-head-text) text-(color:--vk-fg-subtle)", !!addColumn && "pl-(--vk-px)"), children: [_jsx(icons.lock, { className: "h-3 w-3" }), messages({ key: "views.grid.read-only" })] })), addColumn && _jsx("div", { className: "flex h-full min-w-0 flex-1 items-stretch", children: addColumn })] })] }));
41
+ return (_jsx("div", { "data-slot": "vk-grid-header", "data-group-key": groupKey, role: "row", "aria-rowindex": ariaRowIndex, "aria-level": ariaLevel, className: cx("group/gridhead grid grid-cols-(--vk-cols)", GRID_CONTENT_PAD), style: { minWidth }, children: cells }));
42
+ }
@@ -0,0 +1,55 @@
1
+ import { type ReactNode } from "react";
2
+ import { type TextEditorType } from "../../editors/TextEditor.js";
3
+ /**
4
+ * The GRID's long-text panel — reading and editing a paragraph in ONE surface.
5
+ *
6
+ * A `format.long` text is a paragraph, and a paragraph in a 37px cell is one
7
+ * clipped line with no way in. So editing it does not swap the cell for a
8
+ * one-line input: it opens a panel ON the cell (top-left on the cell's
9
+ * top-left, the column's width) holding the whole value in the shared
10
+ * `TextEditor` as a paragraph, the caret at the end — Attio's model.
11
+ * Inspection is the same panel read-only: the value is selectable, copyable,
12
+ * and never written.
13
+ *
14
+ * Anchored like the select and date editors: the cell's own content stays on
15
+ * screen behind the popover, `useAnchoredEditSession` owns the one-answer
16
+ * guard and the exit gap, and the app's popover owns the viewport — with no
17
+ * room below the panel opens above the cell. On a phone it opens in the sheet
18
+ * instead (`EditorPanel`), titled with the column's header; the answer waits
19
+ * for the sheet to slide away, and ✓ never moves the selection.
20
+ *
21
+ * It also opens a LINE whole (`paragraph={false}`): a plain text or a text
22
+ * name its cell cut off. The box wraps so all of it shows, but it is
23
+ * still a line: Enter commits and advances, and a newline is written as a space.
24
+ *
25
+ * Keys are a paragraph's: Enter is a newline; ⌘ or Ctrl Enter commits and
26
+ * advances; Tab commits and moves; Escape cancels; an outside click commits.
27
+ * The host grid's click-away listener clears the cell's focus after that commit.
28
+ */
29
+ export declare function GridLongTextEditor({ initial, seed, readOnly, markdown, paragraph, type, title, refuse, onCommit, onCancel, onTab, onEnter, }: {
30
+ /** The stored value the session opens on ("" when unset). */
31
+ initial: string;
32
+ /** Type-to-replace: the character that opened this editor replaces the value. */
33
+ seed?: string;
34
+ /** Inspection: the panel shows the value, selectable, and never commits. */
35
+ readOnly?: boolean;
36
+ /** Markdown keeps its first line's indent: it is tidied only at its edges
37
+ * (`normalizeMarkdown`), where plain long text is trimmed. */
38
+ markdown?: boolean;
39
+ /** A paragraph (default): Enter is a newline. False: a line shown whole, where Enter commits. */
40
+ paragraph?: boolean;
41
+ /** The text editor's type for a line (its keyboard on a phone). Default: rich text when
42
+ * `markdown`, else text. */
43
+ type?: TextEditorType;
44
+ /** The sheet's title on a phone: the column's header. */
45
+ title?: ReactNode;
46
+ onCommit: (value: string) => void;
47
+ onCancel: () => void;
48
+ /** Commit happened via Tab — move to the next cell in reading order. */
49
+ onTab?: (backwards: boolean) => void;
50
+ /** Commit happened via ⌘-Enter — advance one row down. */
51
+ onEnter?: () => void;
52
+ /** The grid's judgement of a value before it is written: its reason when it would refuse it.
53
+ * A refused value stays open in the panel with that reason. */
54
+ refuse?: (value: string) => string | null;
55
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useLayoutEffect, useRef, useState } from "react";
4
+ import { EditorPanel } from "../../editors/EditorPanel.js";
5
+ import { TextEditor } from "../../editors/TextEditor.js";
6
+ import { useViews } from "../../provider/context.js";
7
+ import { cx } from "../../internal/cx.js";
8
+ import { useGridEditSession } from "./grid-edit-session.js";
9
+ const MIN_W = 320;
10
+ const MAX_W = 512;
11
+ export function GridLongTextEditor({ initial, seed, readOnly = false, markdown = false, paragraph = true, type, title, refuse, onCommit, onCancel, onTab, onEnter, }) {
12
+ const { messages } = useViews();
13
+ const anchorRef = useRef(null);
14
+ const editorRef = useRef(null);
15
+ const [cell, setCell] = useState(null);
16
+ useLayoutEffect(() => {
17
+ const anchor = anchorRef.current;
18
+ if (anchor)
19
+ setCell(measureCell(anchor));
20
+ }, []);
21
+ const { session, close } = useGridEditSession({
22
+ editorRef,
23
+ refuse: refuse && ((value) => refuse(value)),
24
+ onCommit: (payload) => onCommit(payload),
25
+ onCancel,
26
+ onTab,
27
+ onEnter,
28
+ });
29
+ const width = cell ? Math.min(MAX_W, Math.max(MIN_W, cell.width)) : MIN_W;
30
+ const padY = cell ? Math.max(0, (cell.height - cell.lineHeight) / 2 - 1) : 8;
31
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title ?? "", anchor: anchorRef, align: "start", sideOffset: cell ? -cell.height : 0, initialFocus: false, panelData: { "data-slot": "vk-grid-editor" }, onPanelClick: (e) => e.stopPropagation(), chrome: "menu", className: cx("z-90 rounded-sm p-0", readOnly ? "border-(color:--vk-border)" : "border-(color:--vk-border-brand)"), style: { width }, children: (surface) => (_jsx(TextEditor, { ref: editorRef, type: type ?? (markdown ? "rich_text" : "text"), multiline: paragraph, wraps: !paragraph, initial: initial, seed: seed, readOnly: readOnly, closeOnBlur: false, label: messages({ key: readOnly ? "views.grid.value" : "views.grid.edit-value" }), boxData: { "data-grid-editor": "" }, onRequestClose: close, style: cell && surface === "popover"
32
+ ? {
33
+ paddingLeft: cell.paddingX,
34
+ paddingRight: cell.paddingX,
35
+ paddingTop: padY,
36
+ paddingBottom: padY,
37
+ fontSize: cell.fontSize,
38
+ lineHeight: `${cell.lineHeight}px`,
39
+ }
40
+ : undefined, className: cx("block w-full resize-none select-text bg-transparent text-(color:--vk-fg) outline-hidden", "overflow-y-auto overscroll-contain", surface === "sheet" && "px-4 py-2") })) })] }));
41
+ }
42
+ function measureCell(anchor) {
43
+ const box = anchor.getBoundingClientRect();
44
+ const cell = anchor.parentElement ?? anchor;
45
+ const style = getComputedStyle(cell);
46
+ const lineVar = style.getPropertyValue("--vk-line-h").trim();
47
+ return {
48
+ width: box.width,
49
+ height: box.height,
50
+ paddingX: parseFloat(style.paddingLeft) || 12,
51
+ fontSize: style.fontSize || "14px",
52
+ lineHeight: resolveLength(cell, lineVar) || 22,
53
+ };
54
+ }
55
+ function resolveLength(host, value) {
56
+ if (!value)
57
+ return 0;
58
+ const direct = parseFloat(value);
59
+ if (!Number.isNaN(direct) && /^-?[\d.]+px$/.test(value))
60
+ return direct;
61
+ const probe = document.createElement("div");
62
+ probe.style.position = "absolute";
63
+ probe.style.visibility = "hidden";
64
+ probe.style.height = value;
65
+ host.appendChild(probe);
66
+ const px = probe.getBoundingClientRect().height;
67
+ host.removeChild(probe);
68
+ return px;
69
+ }
@@ -0,0 +1,15 @@
1
+ import type { ReactElement } from "react";
2
+ import type { ViewsIconName } from "../../contract.js";
3
+ /** A knob row's leading glyph, by meaning, in the subtle ink every verb row's glyph wears at rest. */
4
+ export declare function KnobGlyph({ name }: {
5
+ name: ViewsIconName;
6
+ }): ReactElement;
7
+ /** One verb row in a grid menu: a glyph, a label, the chosen mark while active (its glyph then in the brand ink). */
8
+ export declare function GridMenuRow({ label, icon, onClick, active, }: {
9
+ label: string;
10
+ icon: ViewsIconName;
11
+ onClick: () => void;
12
+ active?: boolean;
13
+ }): ReactElement;
14
+ /** The divider between a grid menu's blocks. */
15
+ export declare function GridMenuSeparator(): ReactElement;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useViews } from "../../provider/context.js";
4
+ export function KnobGlyph({ name }) {
5
+ const Glyph = useViews().icons[name];
6
+ return _jsx(Glyph, { className: "size-4 text-(color:--vk-fg-subtle)" });
7
+ }
8
+ export function GridMenuRow({ label, icon, onClick, active = false, }) {
9
+ const { atoms, icons } = useViews();
10
+ const Glyph = icons[icon];
11
+ return (_jsx(atoms.Row, { label: label, chosen: active, leading: _jsx(Glyph, { className: active ? "size-4 text-(color:--vk-fg-brand)" : "size-4 text-(color:--vk-fg-subtle)" }), onClick: onClick }));
12
+ }
13
+ export function GridMenuSeparator() {
14
+ return _jsx("div", { role: "separator", className: "-mx-1 my-1.5 h-px bg-(color:--vk-border)" });
15
+ }
@@ -0,0 +1,24 @@
1
+ import { type ReactNode } from "react";
2
+ import type { NameValue } from "@viewkitjs/fields";
3
+ /**
4
+ * The GRID's host around the shared `NameEditor`. Anchored, like the place and
5
+ * value list editors: three boxes do not fit a cell, so they open in a panel
6
+ * under it while the cell's own name stays on screen. The edit session owns the
7
+ * one-answer guard and the exit gap; the editor panel opens the popover on a
8
+ * desktop and the sheet on a phone, titled with the column's header, where the
9
+ * boxes wear the app's field frame. A blur onto another box is not a close, and
10
+ * in the sheet no blur is one (a tap on ✕ or ✓ blurs a box first).
11
+ */
12
+ export declare function GridNameEditor({ title, initial, seed, allowEmpty, onCommit, onCancel, onTab, onEnter, }: {
13
+ /** The field's name: the sheet's title on a phone. */
14
+ title: ReactNode;
15
+ initial: NameValue | null;
16
+ /** Type-to-replace: the character that opened this editor replaces the given box. */
17
+ seed?: string;
18
+ allowEmpty?: boolean;
19
+ onCommit: (payload: NameValue | null) => void;
20
+ onCancel: () => void;
21
+ onTab?: (backwards: boolean) => void;
22
+ /** Commit happened via Enter — advance one row down. */
23
+ onEnter?: () => void;
24
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useRef } from "react";
4
+ import { EditorPanel } from "../../editors/EditorPanel.js";
5
+ import { NameEditor } from "../../editors/NameEditor.js";
6
+ import { useGridEditSession } from "./grid-edit-session.js";
7
+ export function GridNameEditor({ title, initial, seed, allowEmpty = false, onCommit, onCancel, onTab, onEnter, }) {
8
+ const anchorRef = useRef(null);
9
+ const editorRef = useRef(null);
10
+ const { session, close } = useGridEditSession({
11
+ editorRef,
12
+ onCommit: (payload) => onCommit(payload),
13
+ onCancel,
14
+ onTab,
15
+ onEnter,
16
+ });
17
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, panelData: { "data-slot": "vk-grid-editor" }, onPanelClick: (e) => e.stopPropagation(), chrome: "menu", className: "z-90 w-80 p-2", children: (surface) => {
18
+ const editor = (_jsx(NameEditor, { ref: editorRef, initial: initial, seed: seed, allowEmpty: allowEmpty, chrome: surface === "sheet" ? "field" : "bare", onRequestClose: close }));
19
+ return surface === "sheet" ? _jsx("div", { className: "px-4 pb-4", children: editor }) : editor;
20
+ } })] }));
21
+ }
@@ -0,0 +1,49 @@
1
+ import { type ReactNode } from "react";
2
+ import type { DurationUnit } from "@viewkitjs/fields/query";
3
+ import type { GridNumberEditValue } from "../core/edit-values.js";
4
+ /**
5
+ * The GRID's host around the shared `NumberEditor` (`@viewkitjs/views/editors/number`) —
6
+ * the typed field and its unit chip are one component across every surface;
7
+ * the edit session owns the one-answer guard, and the editor panel decides where
8
+ * it opens. This host owns the grid's part: the write, and the focus move that
9
+ * follows it.
10
+ *
11
+ * On a desktop it is INLINE — it replaces the cell's content rather than opening
12
+ * a panel over it, so there is no animation to play out and the commit lands at
13
+ * once, before the focus moves: the order undo depends on. On a phone it opens in
14
+ * the sheet (a cell is too small to type into under a finger), and the answer
15
+ * waits for the sheet to slide away.
16
+ */
17
+ export declare function GridNumberEditor({ title, initial, seed, unit, unitOptions, code, decimals, durationUnit, allowEmpty, unitLeft, conversion, onCommit, onCancel, onTab, onEnter, refuse, }: {
18
+ /** The field's name: the sheet's title on a phone. */
19
+ title: ReactNode;
20
+ /** Signed raw value (e.g. -47.50 for an "out" transaction in its own currency). */
21
+ initial: number;
22
+ /** Type-to-replace: the character that opened this editor. */
23
+ seed?: string;
24
+ /** The row's current unit (currency). Undefined = plain number, no chip. */
25
+ unit?: string;
26
+ /** Selectable units — presence makes the chip a picker. */
27
+ unitOptions?: string[];
28
+ /** A fixed currency's code, drawn beside the amount (never committed). */
29
+ code?: string;
30
+ /** Rounding + initial formatting precision. */
31
+ decimals?: number;
32
+ /** A duration column's STORED unit — the core edits it as human text. */
33
+ durationUnit?: DurationUnit;
34
+ allowEmpty?: boolean;
35
+ /** Right-aligned columns put the chip on the LEFT so the number stays flush
36
+ * with the column's right edge. */
37
+ unitLeft?: boolean;
38
+ /** The figure the cell showed, when it showed the row's amount converted into another currency: named under
39
+ * the editor, which opens on the row's own amount. */
40
+ conversion?: ReactNode;
41
+ onCommit: (payload: GridNumberEditValue) => void;
42
+ onCancel: () => void;
43
+ onTab?: (backwards: boolean) => void;
44
+ /** Commit happened via Enter — advance one row down (Sheets). */
45
+ onEnter?: () => void;
46
+ /** The grid's judgement of a value before it is written: its reason when it would refuse it.
47
+ * A refused value keeps the editor open with that reason. */
48
+ refuse?: (value: GridNumberEditValue) => string | null;
49
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useLayoutEffect, useRef } from "react";
4
+ import { NumberEditor } from "../../editors/NumberEditor.js";
5
+ import { EditorPanel } from "../../editors/EditorPanel.js";
6
+ import { ConversionLine } from "../../display/converted.js";
7
+ import { useKeepInside } from "../../editors/keep-inside.js";
8
+ import { cx } from "../../internal/cx.js";
9
+ import { GRID_GROUND } from "./grid-styles.js";
10
+ import { GridRefusal, UNDER_CELL_CLASS, useGridEditSession } from "./grid-edit-session.js";
11
+ export function GridNumberEditor({ title, initial, seed, unit, unitOptions, code, decimals = 2, durationUnit, allowEmpty = false, unitLeft = false, conversion, onCommit, onCancel, onTab, onEnter, refuse, }) {
12
+ const editorRef = useRef(null);
13
+ const anchorRef = useRef(null);
14
+ const { session, close } = useGridEditSession({
15
+ editorRef,
16
+ inPlace: true,
17
+ refuse: refuse && ((value) => refuse(value)),
18
+ onCommit: (payload) => onCommit(payload),
19
+ onCancel,
20
+ onTab,
21
+ onEnter,
22
+ });
23
+ const editor = (_jsx(NumberEditor, { ref: editorRef, initial: initial, seed: seed, unit: unit, unitOptions: unitOptions, code: code, decimals: decimals, durationUnit: durationUnit, allowEmpty: allowEmpty, unitLeft: unitLeft, onRequestClose: close }));
24
+ return (_jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, inPlace: true, sheetOnPhone: true, children: (surface) => surface === "sheet" ? (_jsxs("div", { className: "px-2 pb-3", children: [_jsx("div", { className: "flex h-10 min-w-0 items-center rounded-md border border-(color:--vk-border) px-2", children: editor }), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1.5" }) : null] })) : (_jsxs("span", { "data-slot": "vk-grid-editor", className: cx("relative flex h-full w-full min-w-0", unitLeft && "justify-end"), children: [_jsx(FittedBox, { boxRef: anchorRef, children: editor }), _jsx(GridRefusal, { reason: session.refusal }), conversion && !session.refusal ? _jsx(UnderCellConversion, { figure: conversion }) : null] })) }));
25
+ }
26
+ const FITTED_MAX_PX = 320;
27
+ function FittedBox({ boxRef, children }) {
28
+ const fit = useCallback(() => {
29
+ const box = boxRef.current;
30
+ const input = box?.querySelector("input");
31
+ if (!box || !input)
32
+ return;
33
+ box.style.minWidth = "";
34
+ const over = input.scrollWidth - input.clientWidth;
35
+ const width = over > 0 ? Math.min(box.offsetWidth + over + 1, FITTED_MAX_PX) : 0;
36
+ if (width > box.offsetWidth) {
37
+ box.style.minWidth = `${width}px`;
38
+ box.dataset.grown = "";
39
+ }
40
+ else {
41
+ delete box.dataset.grown;
42
+ }
43
+ }, [boxRef]);
44
+ useLayoutEffect(fit, [fit]);
45
+ return (_jsxs("span", { ref: boxRef, onInput: fit, className: "group/fitted relative flex h-full w-full min-w-0 shrink-0 data-grown:z-2", children: [_jsx("span", { "aria-hidden": true, className: cx("pointer-events-none absolute inset-y-0 -inset-x-(--vk-px) -z-1 hidden rounded-sm border border-(color:--vk-border-brand) shadow-lg shadow-black/20 group-data-grown/fitted:block dark:shadow-black/50", GRID_GROUND) }), children] }));
46
+ }
47
+ function UnderCellConversion({ figure }) {
48
+ const ref = useRef(null);
49
+ useKeepInside(ref);
50
+ return (_jsx("span", { ref: ref, className: UNDER_CELL_CLASS, children: _jsx(ConversionLine, { figure: figure }) }));
51
+ }
@@ -0,0 +1,26 @@
1
+ import { type ReactNode } from "react";
2
+ import type { FieldDefOf, LocationValue } from "@viewkitjs/fields";
3
+ /**
4
+ * The GRID's host around the shared `LocationEditor`. Anchored, like the name
5
+ * and value list editors: a country and its parts do not fit a cell, so they
6
+ * open in a panel under it while the cell's own place stays on screen. The edit
7
+ * session owns the one-answer guard and the exit gap; the editor panel opens the
8
+ * popover on a desktop and the sheet on a phone, titled with the column's
9
+ * header. An emptied place always reaches `refuse`, so a field that can't be
10
+ * emptied says so in the editor rather than closing on nothing. No seed: a key
11
+ * typed on a place cell opens the place as it is.
12
+ */
13
+ export declare function GridPlaceEditor({ field, title, initial, refuse, onCommit, onCancel, onTab, onEnter, }: {
14
+ field: FieldDefOf<"location">;
15
+ /** The field's name: the sheet's title on a phone. */
16
+ title: ReactNode;
17
+ initial: LocationValue | null;
18
+ /** The grid's judgement of a place before it is written, an emptied one (`null`) included: its
19
+ * reason when it would refuse it. A refused place keeps the editor open with that reason. */
20
+ refuse?: (place: LocationValue | null) => string | null;
21
+ onCommit: (place: LocationValue | null) => void;
22
+ onCancel: () => void;
23
+ onTab?: (backwards: boolean) => void;
24
+ /** Commit happened via Enter — advance one row down. */
25
+ onEnter?: () => void;
26
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useRef } from "react";
4
+ import { EditorPanel } from "../../editors/EditorPanel.js";
5
+ import { LocationEditor } from "../../editors/LocationEditor.js";
6
+ import { useGridEditSession } from "./grid-edit-session.js";
7
+ export function GridPlaceEditor({ field, title, initial, refuse, onCommit, onCancel, onTab, onEnter, }) {
8
+ const anchorRef = useRef(null);
9
+ const editorRef = useRef(null);
10
+ const { session, close } = useGridEditSession({
11
+ editorRef,
12
+ refuse: refuse && ((place) => refuse(place)),
13
+ onCommit: (place) => onCommit(place),
14
+ onCancel,
15
+ onTab,
16
+ onEnter,
17
+ });
18
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, panelData: { "data-slot": "vk-grid-editor" }, onPanelClick: (e) => e.stopPropagation(), chrome: "menu", className: "z-90 w-96 p-2", children: (surface) => {
19
+ const editor = (_jsx(LocationEditor, { ref: editorRef, field: field, initial: initial, allowEmpty: true, onRequestClose: close }));
20
+ return surface === "sheet" ? _jsx("div", { className: "px-4 pb-4", children: editor }) : editor;
21
+ } })] }));
22
+ }
@@ -0,0 +1,30 @@
1
+ import { type ReactNode } from "react";
2
+ import type { RangePreset, RangeValue } from "@viewkitjs/fields";
3
+ /**
4
+ * The GRID's host around the shared `RangeEditor` — like the number host: the
5
+ * edit session owns the one-answer guard and the editor panel decides where it
6
+ * opens. On a desktop the two boxes replace the cell's content, the write lands
7
+ * at once, and only then does focus move; on a phone they open in the sheet and
8
+ * the answer waits for the sheet to slide away.
9
+ */
10
+ export declare function GridRangeEditor({ title, initial, seed, decimals, allowEmpty, suffix, bands, onCommit, onCancel, onTab, onEnter, refuse, }: {
11
+ /** The field's name: the sheet's title on a phone. */
12
+ title: ReactNode;
13
+ initial: RangeValue | null;
14
+ /** Type-to-replace: the character that opened this editor replaces the low box. */
15
+ seed?: string;
16
+ decimals?: number;
17
+ allowEmpty?: boolean;
18
+ /** "%", a currency code — drawn after the high box. */
19
+ suffix?: string;
20
+ /** The field's bands: a menu under the cell on the desktop, listed under the boxes in the sheet. */
21
+ bands?: readonly RangePreset[];
22
+ onCommit: (payload: RangeValue) => void;
23
+ onCancel: () => void;
24
+ onTab?: (backwards: boolean) => void;
25
+ /** Commit happened via Enter — advance one row down. */
26
+ onEnter?: () => void;
27
+ /** The grid's judgement of a value before it is written: its reason when it would refuse it.
28
+ * A refused value keeps the editor open with that reason. */
29
+ refuse?: (value: RangeValue) => string | null;
30
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useRef } from "react";
4
+ import { RangeEditor } from "../../editors/RangeEditor.js";
5
+ import { EditorPanel } from "../../editors/EditorPanel.js";
6
+ import { GridRefusal, useGridEditSession } from "./grid-edit-session.js";
7
+ export function GridRangeEditor({ title, initial, seed, decimals = 0, allowEmpty = false, suffix, bands, onCommit, onCancel, onTab, onEnter, refuse, }) {
8
+ const editorRef = useRef(null);
9
+ const anchorRef = useRef(null);
10
+ const { session, close } = useGridEditSession({
11
+ editorRef,
12
+ inPlace: true,
13
+ refuse: refuse && ((value) => refuse(value)),
14
+ onCommit: (payload) => onCommit(payload),
15
+ onCancel,
16
+ onTab,
17
+ onEnter,
18
+ });
19
+ const editor = (sheet) => (_jsx(RangeEditor, { ref: editorRef, initial: initial, seed: seed, decimals: decimals, allowEmpty: allowEmpty, suffix: suffix, bands: bands, bandsAt: sheet ? "below" : "popover", boxClassName: sheet ? "h-10 rounded-md border border-(color:--vk-border) px-2" : undefined, onRequestClose: close }));
20
+ return (_jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, inPlace: true, sheetOnPhone: true, children: (surface) => surface === "sheet" ? (_jsx("div", { className: "px-2 pb-3", children: editor(true) })) : (_jsxs("span", { ref: anchorRef, "data-slot": "vk-grid-editor", className: "relative flex h-full w-full min-w-0", children: [editor(false), _jsx(GridRefusal, { reason: session.refusal })] })) }));
21
+ }