@viewkitjs/views 0.0.0-stage → 0.2.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 (451) hide show
  1. package/CHANGELOG.md +615 -0
  2. package/LICENSE.md +7 -0
  3. package/README.md +99 -2
  4. package/dist/atoms/CommandMenu.d.ts +2 -0
  5. package/dist/atoms/CommandMenu.js +20 -0
  6. package/dist/atoms/List.d.ts +2 -0
  7. package/dist/atoms/List.js +6 -0
  8. package/dist/atoms/LoadMore.d.ts +2 -0
  9. package/dist/atoms/LoadMore.js +25 -0
  10. package/dist/atoms/Loading.d.ts +2 -0
  11. package/dist/atoms/Loading.js +7 -0
  12. package/dist/atoms/PlatformMark.d.ts +2 -0
  13. package/dist/atoms/PlatformMark.js +4 -0
  14. package/dist/atoms/RelationLink.d.ts +2 -0
  15. package/dist/atoms/RelationLink.js +6 -0
  16. package/dist/atoms/Row.d.ts +3 -0
  17. package/dist/atoms/Row.js +30 -0
  18. package/dist/atoms/RowMenu.d.ts +2 -0
  19. package/dist/atoms/RowMenu.js +112 -0
  20. package/dist/atoms/StatusBadge.d.ts +2 -0
  21. package/dist/atoms/StatusBadge.js +7 -0
  22. package/dist/atoms/StatusMarker.d.ts +2 -0
  23. package/dist/atoms/StatusMarker.js +19 -0
  24. package/dist/atoms/Tag.d.ts +2 -0
  25. package/dist/atoms/Tag.js +13 -0
  26. package/dist/atoms/TickBox.d.ts +2 -0
  27. package/dist/atoms/TickBox.js +8 -0
  28. package/dist/atoms/defaults.d.ts +2 -0
  29. package/dist/atoms/defaults.js +27 -0
  30. package/dist/atoms/tones.d.ts +5 -0
  31. package/dist/atoms/tones.js +28 -0
  32. package/dist/atoms/types.d.ts +178 -0
  33. package/dist/atoms/types.js +3 -0
  34. package/dist/cells/cell-format.d.ts +138 -0
  35. package/dist/cells/cell-format.js +16 -0
  36. package/dist/cells/cell-title.d.ts +17 -0
  37. package/dist/cells/cell-title.js +8 -0
  38. package/dist/cells/cell-values.d.ts +28 -0
  39. package/dist/cells/cell-values.js +87 -0
  40. package/dist/cells/index.d.ts +4 -0
  41. package/dist/cells/index.js +4 -0
  42. package/dist/cells/legacy-field.d.ts +52 -0
  43. package/dist/cells/legacy-field.js +164 -0
  44. package/dist/cells/relation-wrap.d.ts +3 -0
  45. package/dist/cells/relation-wrap.js +24 -0
  46. package/dist/cells/use-cell-format.d.ts +5 -0
  47. package/dist/cells/use-cell-format.js +10 -0
  48. package/dist/contract.d.ts +461 -0
  49. package/dist/contract.js +682 -0
  50. package/dist/display/actor.d.ts +4 -0
  51. package/dist/display/actor.js +26 -0
  52. package/dist/display/boolean.d.ts +18 -0
  53. package/dist/display/boolean.js +43 -0
  54. package/dist/display/breakdown.d.ts +15 -0
  55. package/dist/display/breakdown.js +32 -0
  56. package/dist/display/currency.d.ts +9 -0
  57. package/dist/display/currency.js +29 -0
  58. package/dist/display/date.d.ts +12 -0
  59. package/dist/display/date.js +26 -0
  60. package/dist/display/display-cores.d.ts +31 -0
  61. package/dist/display/display-cores.js +57 -0
  62. package/dist/display/entity-chip.d.ts +26 -0
  63. package/dist/display/entity-chip.js +9 -0
  64. package/dist/display/format.d.ts +66 -0
  65. package/dist/display/format.js +190 -0
  66. package/dist/display/index.d.ts +8 -0
  67. package/dist/display/index.js +7 -0
  68. package/dist/display/link.d.ts +29 -0
  69. package/dist/display/link.js +50 -0
  70. package/dist/display/location.d.ts +8 -0
  71. package/dist/display/location.js +22 -0
  72. package/dist/display/multi-value.d.ts +18 -0
  73. package/dist/display/multi-value.js +28 -0
  74. package/dist/display/name.d.ts +6 -0
  75. package/dist/display/name.js +14 -0
  76. package/dist/display/number.d.ts +11 -0
  77. package/dist/display/number.js +27 -0
  78. package/dist/display/options.d.ts +153 -0
  79. package/dist/display/options.js +1 -0
  80. package/dist/display/percent.d.ts +4 -0
  81. package/dist/display/percent.js +40 -0
  82. package/dist/display/phone.d.ts +11 -0
  83. package/dist/display/phone.js +45 -0
  84. package/dist/display/range.d.ts +6 -0
  85. package/dist/display/range.js +29 -0
  86. package/dist/display/relation.d.ts +4 -0
  87. package/dist/display/relation.js +29 -0
  88. package/dist/display/rich-text.d.ts +10 -0
  89. package/dist/display/rich-text.js +34 -0
  90. package/dist/display/select.d.ts +6 -0
  91. package/dist/display/select.js +38 -0
  92. package/dist/display/text-class.d.ts +23 -0
  93. package/dist/display/text-class.js +5 -0
  94. package/dist/display/text.d.ts +19 -0
  95. package/dist/display/text.js +8 -0
  96. package/dist/display/use-display-options.d.ts +2 -0
  97. package/dist/display/use-display-options.js +14 -0
  98. package/dist/display/user.d.ts +11 -0
  99. package/dist/display/user.js +10 -0
  100. package/dist/display/value-list.d.ts +10 -0
  101. package/dist/display/value-list.js +12 -0
  102. package/dist/display/viewer.d.ts +4 -0
  103. package/dist/display/viewer.js +11 -0
  104. package/dist/display/web-href.d.ts +8 -0
  105. package/dist/display/web-href.js +12 -0
  106. package/dist/editors/ChipsEditor.d.ts +59 -0
  107. package/dist/editors/ChipsEditor.js +73 -0
  108. package/dist/editors/DateEditor.d.ts +25 -0
  109. package/dist/editors/DateEditor.js +122 -0
  110. package/dist/editors/LocationEditor.d.ts +22 -0
  111. package/dist/editors/LocationEditor.js +228 -0
  112. package/dist/editors/NameEditor.d.ts +22 -0
  113. package/dist/editors/NameEditor.js +92 -0
  114. package/dist/editors/NumberEditor.d.ts +67 -0
  115. package/dist/editors/NumberEditor.js +86 -0
  116. package/dist/editors/RangeEditor.d.ts +22 -0
  117. package/dist/editors/RangeEditor.js +70 -0
  118. package/dist/editors/RelationEditor.d.ts +65 -0
  119. package/dist/editors/RelationEditor.js +64 -0
  120. package/dist/editors/SelectEditor.d.ts +72 -0
  121. package/dist/editors/SelectEditor.js +59 -0
  122. package/dist/editors/ValueListEditor.d.ts +38 -0
  123. package/dist/editors/ValueListEditor.js +217 -0
  124. package/dist/editors/edit-cores.d.ts +83 -0
  125. package/dist/editors/edit-cores.js +38 -0
  126. package/dist/editors/edit-session.d.ts +74 -0
  127. package/dist/editors/edit-session.js +35 -0
  128. package/dist/editors/open-values.d.ts +28 -0
  129. package/dist/editors/open-values.js +26 -0
  130. package/dist/editors/relation-source.d.ts +66 -0
  131. package/dist/editors/relation-source.js +102 -0
  132. package/dist/fields/binding.d.ts +87 -0
  133. package/dist/fields/binding.js +117 -0
  134. package/dist/fields/currency.d.ts +82 -0
  135. package/dist/fields/currency.js +41 -0
  136. package/dist/fields/denomination.d.ts +42 -0
  137. package/dist/fields/denomination.js +11 -0
  138. package/dist/fields/edit-core-types.d.ts +40 -0
  139. package/dist/fields/edit-core-types.js +29 -0
  140. package/dist/fields/format-knobs.d.ts +34 -0
  141. package/dist/fields/format-knobs.js +36 -0
  142. package/dist/fields/menus.d.ts +28 -0
  143. package/dist/fields/menus.js +1 -0
  144. package/dist/fields/money.d.ts +60 -0
  145. package/dist/fields/money.js +78 -0
  146. package/dist/fields/number-edit.d.ts +11 -0
  147. package/dist/fields/number-edit.js +17 -0
  148. package/dist/fields/prepare-write.d.ts +55 -0
  149. package/dist/fields/prepare-write.js +67 -0
  150. package/dist/fields/relation-source-types.d.ts +54 -0
  151. package/dist/fields/relation-source-types.js +1 -0
  152. package/dist/figures.d.ts +52 -0
  153. package/dist/figures.js +63 -0
  154. package/dist/filters/date-filter.d.ts +2 -0
  155. package/dist/filters/date-filter.js +1 -0
  156. package/dist/filters/filter-model.d.ts +176 -0
  157. package/dist/filters/filter-model.js +41 -0
  158. package/dist/filters/number-filter.d.ts +2 -0
  159. package/dist/filters/number-filter.js +1 -0
  160. package/dist/filters/range-filter.d.ts +2 -0
  161. package/dist/filters/range-filter.js +1 -0
  162. package/dist/filters/registry.d.ts +103 -0
  163. package/dist/filters/registry.js +8 -0
  164. package/dist/filters/relation-filter.d.ts +16 -0
  165. package/dist/filters/relation-filter.js +53 -0
  166. package/dist/filters/text-filter.d.ts +2 -0
  167. package/dist/filters/text-filter.js +1 -0
  168. package/dist/grid/chrome/GridAddColumn.d.ts +11 -0
  169. package/dist/grid/chrome/GridAddColumn.js +29 -0
  170. package/dist/grid/chrome/GridAggregateMenu.d.ts +31 -0
  171. package/dist/grid/chrome/GridAggregateMenu.js +27 -0
  172. package/dist/grid/chrome/GridCellEditors.d.ts +64 -0
  173. package/dist/grid/chrome/GridCellEditors.js +55 -0
  174. package/dist/grid/chrome/GridCellOutline.d.ts +70 -0
  175. package/dist/grid/chrome/GridCellOutline.js +21 -0
  176. package/dist/grid/chrome/GridChipsEditor.d.ts +28 -0
  177. package/dist/grid/chrome/GridChipsEditor.js +40 -0
  178. package/dist/grid/chrome/GridColumnColorSection.d.ts +11 -0
  179. package/dist/grid/chrome/GridColumnColorSection.js +40 -0
  180. package/dist/grid/chrome/GridColumnDateSection.d.ts +23 -0
  181. package/dist/grid/chrome/GridColumnDateSection.js +23 -0
  182. package/dist/grid/chrome/GridColumnDurationSection.d.ts +19 -0
  183. package/dist/grid/chrome/GridColumnDurationSection.js +24 -0
  184. package/dist/grid/chrome/GridColumnMenu.d.ts +101 -0
  185. package/dist/grid/chrome/GridColumnMenu.js +99 -0
  186. package/dist/grid/chrome/GridColumnNumberSection.d.ts +25 -0
  187. package/dist/grid/chrome/GridColumnNumberSection.js +27 -0
  188. package/dist/grid/chrome/GridColumnPercentSection.d.ts +15 -0
  189. package/dist/grid/chrome/GridColumnPercentSection.js +16 -0
  190. package/dist/grid/chrome/GridColumnSortSection.d.ts +18 -0
  191. package/dist/grid/chrome/GridColumnSortSection.js +16 -0
  192. package/dist/grid/chrome/GridDateEditor.d.ts +22 -0
  193. package/dist/grid/chrome/GridDateEditor.js +31 -0
  194. package/dist/grid/chrome/GridFlyout.d.ts +44 -0
  195. package/dist/grid/chrome/GridFlyout.js +80 -0
  196. package/dist/grid/chrome/GridFooter.d.ts +23 -0
  197. package/dist/grid/chrome/GridFooter.js +81 -0
  198. package/dist/grid/chrome/GridGroupMenu.d.ts +37 -0
  199. package/dist/grid/chrome/GridGroupMenu.js +57 -0
  200. package/dist/grid/chrome/GridHeader.d.ts +61 -0
  201. package/dist/grid/chrome/GridHeader.js +37 -0
  202. package/dist/grid/chrome/GridLongTextEditor.d.ts +36 -0
  203. package/dist/grid/chrome/GridLongTextEditor.js +127 -0
  204. package/dist/grid/chrome/GridMenuRow.d.ts +15 -0
  205. package/dist/grid/chrome/GridMenuRow.js +15 -0
  206. package/dist/grid/chrome/GridNameEditor.d.ts +19 -0
  207. package/dist/grid/chrome/GridNameEditor.js +36 -0
  208. package/dist/grid/chrome/GridNumberEditor.d.ts +35 -0
  209. package/dist/grid/chrome/GridNumberEditor.js +25 -0
  210. package/dist/grid/chrome/GridRangeEditor.d.ts +20 -0
  211. package/dist/grid/chrome/GridRangeEditor.js +25 -0
  212. package/dist/grid/chrome/GridRelationEditor.d.ts +21 -0
  213. package/dist/grid/chrome/GridRelationEditor.js +30 -0
  214. package/dist/grid/chrome/GridResizeHandle.d.ts +19 -0
  215. package/dist/grid/chrome/GridResizeHandle.js +19 -0
  216. package/dist/grid/chrome/GridRow.d.ts +25 -0
  217. package/dist/grid/chrome/GridRow.js +136 -0
  218. package/dist/grid/chrome/GridRowActions.d.ts +32 -0
  219. package/dist/grid/chrome/GridRowActions.js +25 -0
  220. package/dist/grid/chrome/GridRowCells.d.ts +4 -0
  221. package/dist/grid/chrome/GridRowCells.js +133 -0
  222. package/dist/grid/chrome/GridRowGlyph.d.ts +12 -0
  223. package/dist/grid/chrome/GridRowGlyph.js +13 -0
  224. package/dist/grid/chrome/GridSelectEditor.d.ts +18 -0
  225. package/dist/grid/chrome/GridSelectEditor.js +49 -0
  226. package/dist/grid/chrome/GridStructure.d.ts +48 -0
  227. package/dist/grid/chrome/GridStructure.js +45 -0
  228. package/dist/grid/chrome/GridTable.d.ts +4 -0
  229. package/dist/grid/chrome/GridTable.js +125 -0
  230. package/dist/grid/chrome/GridTableSurface.d.ts +15 -0
  231. package/dist/grid/chrome/GridTableSurface.js +6 -0
  232. package/dist/grid/chrome/GridTextEditor.d.ts +11 -0
  233. package/dist/grid/chrome/GridTextEditor.js +40 -0
  234. package/dist/grid/chrome/GridValueListEditor.d.ts +18 -0
  235. package/dist/grid/chrome/GridValueListEditor.js +36 -0
  236. package/dist/grid/chrome/StuckMarker.d.ts +16 -0
  237. package/dist/grid/chrome/StuckMarker.js +34 -0
  238. package/dist/grid/chrome/cell-clipboard.d.ts +9 -0
  239. package/dist/grid/chrome/cell-clipboard.js +28 -0
  240. package/dist/grid/chrome/cells.d.ts +21 -0
  241. package/dist/grid/chrome/cells.js +20 -0
  242. package/dist/grid/chrome/checks.d.ts +35 -0
  243. package/dist/grid/chrome/checks.js +22 -0
  244. package/dist/grid/chrome/column-glyph.d.ts +14 -0
  245. package/dist/grid/chrome/column-glyph.js +44 -0
  246. package/dist/grid/chrome/editors.d.ts +9 -0
  247. package/dist/grid/chrome/editors.js +10 -0
  248. package/dist/grid/chrome/grid-cell-classes.d.ts +59 -0
  249. package/dist/grid/chrome/grid-cell-classes.js +30 -0
  250. package/dist/grid/chrome/grid-menu-search.d.ts +7 -0
  251. package/dist/grid/chrome/grid-menu-search.js +7 -0
  252. package/dist/grid/chrome/grid-row-props.d.ts +131 -0
  253. package/dist/grid/chrome/grid-row-props.js +1 -0
  254. package/dist/grid/chrome/grid-styles.d.ts +37 -0
  255. package/dist/grid/chrome/grid-styles.js +8 -0
  256. package/dist/grid/chrome/grid-table-props.d.ts +173 -0
  257. package/dist/grid/chrome/grid-table-props.js +1 -0
  258. package/dist/grid/chrome/useGridBatchApi.d.ts +34 -0
  259. package/dist/grid/chrome/useGridBatchApi.js +35 -0
  260. package/dist/grid/chrome/useGridColumnLayout.d.ts +30 -0
  261. package/dist/grid/chrome/useGridColumnLayout.js +206 -0
  262. package/dist/grid/chrome/useGridHeaderDrag.d.ts +20 -0
  263. package/dist/grid/chrome/useGridHeaderDrag.js +37 -0
  264. package/dist/grid/chrome/useGridKeyboard.d.ts +47 -0
  265. package/dist/grid/chrome/useGridKeyboard.js +274 -0
  266. package/dist/grid/chrome/useGridPendingReconciliation.d.ts +12 -0
  267. package/dist/grid/chrome/useGridPendingReconciliation.js +32 -0
  268. package/dist/grid/chrome/useGridRailReveal.d.ts +57 -0
  269. package/dist/grid/chrome/useGridRailReveal.js +67 -0
  270. package/dist/grid/chrome/useGridRangeActions.d.ts +49 -0
  271. package/dist/grid/chrome/useGridRangeActions.js +188 -0
  272. package/dist/grid/chrome/useGridRangeGestures.d.ts +32 -0
  273. package/dist/grid/chrome/useGridRangeGestures.js +190 -0
  274. package/dist/grid/chrome/useGridRowContextMenu.d.ts +35 -0
  275. package/dist/grid/chrome/useGridRowContextMenu.js +127 -0
  276. package/dist/grid/chrome/useGridScaleStyles.d.ts +1 -0
  277. package/dist/grid/chrome/useGridScaleStyles.js +29 -0
  278. package/dist/grid/chrome/useGridScrollSync.d.ts +38 -0
  279. package/dist/grid/chrome/useGridScrollSync.js +176 -0
  280. package/dist/grid/chrome/useGridTableInteractionModel.d.ts +55 -0
  281. package/dist/grid/chrome/useGridTableInteractionModel.js +197 -0
  282. package/dist/grid/chrome/useGridTableSelection.d.ts +29 -0
  283. package/dist/grid/chrome/useGridTableSelection.js +55 -0
  284. package/dist/grid/chrome/useHeaderDragReorder.d.ts +21 -0
  285. package/dist/grid/chrome/useHeaderDragReorder.js +216 -0
  286. package/dist/grid/core/clipboard-model.d.ts +81 -0
  287. package/dist/grid/core/clipboard-model.js +291 -0
  288. package/dist/grid/core/column-values.d.ts +27 -0
  289. package/dist/grid/core/column-values.js +76 -0
  290. package/dist/grid/core/commit-model.d.ts +34 -0
  291. package/dist/grid/core/commit-model.js +3 -0
  292. package/dist/grid/core/coordinates.d.ts +48 -0
  293. package/dist/grid/core/coordinates.js +27 -0
  294. package/dist/grid/core/edit-values.d.ts +9 -0
  295. package/dist/grid/core/edit-values.js +1 -0
  296. package/dist/grid/core/editing-controller.d.ts +59 -0
  297. package/dist/grid/core/editing-controller.js +240 -0
  298. package/dist/grid/core/editing-model.d.ts +78 -0
  299. package/dist/grid/core/editing-model.js +136 -0
  300. package/dist/grid/core/grid-scale.d.ts +14 -0
  301. package/dist/grid/core/grid-scale.js +8 -0
  302. package/dist/grid/core/nav.d.ts +94 -0
  303. package/dist/grid/core/nav.js +92 -0
  304. package/dist/grid/core/pending-reconciliation.d.ts +50 -0
  305. package/dist/grid/core/pending-reconciliation.js +49 -0
  306. package/dist/grid/core/range-model.d.ts +25 -0
  307. package/dist/grid/core/range-model.js +59 -0
  308. package/dist/grid/core/spreadsheet-operations.d.ts +85 -0
  309. package/dist/grid/core/spreadsheet-operations.js +253 -0
  310. package/dist/grid/core/useGridEditing.d.ts +43 -0
  311. package/dist/grid/core/useGridEditing.js +90 -0
  312. package/dist/grid/core/useGridRange.d.ts +20 -0
  313. package/dist/grid/core/useGridRange.js +24 -0
  314. package/dist/grid/core/value-equality.d.ts +32 -0
  315. package/dist/grid/core/value-equality.js +34 -0
  316. package/dist/grid/index.d.ts +18 -0
  317. package/dist/grid/index.js +5 -0
  318. package/dist/grid/useGridTablePrefs.d.ts +50 -0
  319. package/dist/grid/useGridTablePrefs.js +101 -0
  320. package/dist/grouping/sort-groups.d.ts +18 -0
  321. package/dist/grouping/sort-groups.js +33 -0
  322. package/dist/grouping/types.d.ts +10 -0
  323. package/dist/grouping/types.js +1 -0
  324. package/dist/index.d.ts +28 -0
  325. package/dist/index.js +28 -0
  326. package/dist/internal/chip.d.ts +4 -0
  327. package/dist/internal/chip.js +3 -0
  328. package/dist/internal/cx.d.ts +3 -0
  329. package/dist/internal/cx.js +3 -0
  330. package/dist/internal/viewport.d.ts +5 -0
  331. package/dist/internal/viewport.js +29 -0
  332. package/dist/model/aggregates.d.ts +59 -0
  333. package/dist/model/aggregates.js +186 -0
  334. package/dist/model/card-density.d.ts +8 -0
  335. package/dist/model/card-density.js +10 -0
  336. package/dist/model/card-layout.d.ts +85 -0
  337. package/dist/model/card-layout.js +90 -0
  338. package/dist/model/column-capabilities.d.ts +162 -0
  339. package/dist/model/column-capabilities.js +233 -0
  340. package/dist/model/column-filters.d.ts +106 -0
  341. package/dist/model/column-filters.js +321 -0
  342. package/dist/model/column-format.d.ts +103 -0
  343. package/dist/model/column-format.js +1 -0
  344. package/dist/model/column-from.d.ts +28 -0
  345. package/dist/model/column-from.js +160 -0
  346. package/dist/model/column-inspect.d.ts +18 -0
  347. package/dist/model/column-inspect.js +6 -0
  348. package/dist/model/column-knobs.d.ts +20 -0
  349. package/dist/model/column-knobs.js +16 -0
  350. package/dist/model/column-money.d.ts +13 -0
  351. package/dist/model/column-money.js +27 -0
  352. package/dist/model/column-order.d.ts +36 -0
  353. package/dist/model/column-order.js +68 -0
  354. package/dist/model/column-schema.d.ts +335 -0
  355. package/dist/model/column-schema.js +1 -0
  356. package/dist/model/column-sort.d.ts +17 -0
  357. package/dist/model/column-sort.js +11 -0
  358. package/dist/model/column-state.d.ts +77 -0
  359. package/dist/model/column-state.js +95 -0
  360. package/dist/model/column-types.d.ts +109 -0
  361. package/dist/model/column-types.js +50 -0
  362. package/dist/model/column-warnings.d.ts +44 -0
  363. package/dist/model/column-warnings.js +24 -0
  364. package/dist/model/density.d.ts +3 -0
  365. package/dist/model/density.js +13 -0
  366. package/dist/model/field-type-of.d.ts +21 -0
  367. package/dist/model/field-type-of.js +11 -0
  368. package/dist/model/filter-capabilities.d.ts +1 -0
  369. package/dist/model/filter-capabilities.js +1 -0
  370. package/dist/model/index.d.ts +38 -0
  371. package/dist/model/index.js +20 -0
  372. package/dist/model/part-rows.d.ts +28 -0
  373. package/dist/model/part-rows.js +40 -0
  374. package/dist/model/preferences.d.ts +155 -0
  375. package/dist/model/preferences.js +84 -0
  376. package/dist/model/prefs-buckets.d.ts +173 -0
  377. package/dist/model/prefs-buckets.js +71 -0
  378. package/dist/model/relation-filters.d.ts +45 -0
  379. package/dist/model/relation-filters.js +78 -0
  380. package/dist/model/render-count.d.ts +2 -0
  381. package/dist/model/render-count.js +24 -0
  382. package/dist/model/row-icon.d.ts +23 -0
  383. package/dist/model/row-icon.js +5 -0
  384. package/dist/model/view-rules.d.ts +73 -0
  385. package/dist/model/view-rules.js +216 -0
  386. package/dist/provider/ViewsProvider.d.ts +26 -0
  387. package/dist/provider/ViewsProvider.js +16 -0
  388. package/dist/provider/components.d.ts +230 -0
  389. package/dist/provider/components.js +3 -0
  390. package/dist/provider/context.d.ts +20 -0
  391. package/dist/provider/context.js +10 -0
  392. package/dist/provider/icons.d.ts +6 -0
  393. package/dist/provider/icons.js +1 -0
  394. package/dist/provider/menu-groups.d.ts +8 -0
  395. package/dist/provider/menu-groups.js +38 -0
  396. package/dist/provider/ports.d.ts +57 -0
  397. package/dist/provider/ports.js +9 -0
  398. package/dist/react.d.ts +9 -0
  399. package/dist/react.js +4 -0
  400. package/dist/selection/SelectCheckbox.d.ts +17 -0
  401. package/dist/selection/SelectCheckbox.js +11 -0
  402. package/dist/selection/index.d.ts +7 -0
  403. package/dist/selection/index.js +6 -0
  404. package/dist/selection/model.d.ts +55 -0
  405. package/dist/selection/model.js +86 -0
  406. package/dist/selection/row-click.d.ts +35 -0
  407. package/dist/selection/row-click.js +20 -0
  408. package/dist/selection/types.d.ts +17 -0
  409. package/dist/selection/types.js +1 -0
  410. package/dist/selection/useCheckDragSelect.d.ts +61 -0
  411. package/dist/selection/useCheckDragSelect.js +165 -0
  412. package/dist/selection/useListSelection.d.ts +39 -0
  413. package/dist/selection/useListSelection.js +48 -0
  414. package/dist/selection/useListSelectionShortcuts.d.ts +6 -0
  415. package/dist/selection/useListSelectionShortcuts.js +14 -0
  416. package/dist/selection/useRestIntent.d.ts +18 -0
  417. package/dist/selection/useRestIntent.js +35 -0
  418. package/docs/contract.md +525 -0
  419. package/docs/getting-started.md +250 -0
  420. package/docs/guides/atoms.md +245 -0
  421. package/docs/guides/cells.md +302 -0
  422. package/docs/guides/columns.md +412 -0
  423. package/docs/guides/display.md +203 -0
  424. package/docs/guides/editors.md +404 -0
  425. package/docs/guides/ports.md +246 -0
  426. package/docs/guides/selection.md +270 -0
  427. package/docs/guides/the-grid.md +677 -0
  428. package/docs/guides/the-provider.md +446 -0
  429. package/docs/index.md +50 -0
  430. package/docs/install.md +67 -0
  431. package/docs/reference/cells.md +28 -0
  432. package/docs/reference/display.md +42 -0
  433. package/docs/reference/editors-chips.md +6 -0
  434. package/docs/reference/editors-date.md +6 -0
  435. package/docs/reference/editors-location.md +10 -0
  436. package/docs/reference/editors-name.md +6 -0
  437. package/docs/reference/editors-number.md +11 -0
  438. package/docs/reference/editors-open-values.md +9 -0
  439. package/docs/reference/editors-range.md +6 -0
  440. package/docs/reference/editors-relation.md +9 -0
  441. package/docs/reference/editors-select.md +8 -0
  442. package/docs/reference/editors-session.md +9 -0
  443. package/docs/reference/editors-value-list.md +6 -0
  444. package/docs/reference/editors.md +5 -0
  445. package/docs/reference/grid.md +39 -0
  446. package/docs/reference/react.md +86 -0
  447. package/docs/reference/selection.md +33 -0
  448. package/docs/reference/views.md +601 -0
  449. package/docs/reshaping.md +19 -0
  450. package/package.json +118 -3
  451. package/skills/views/SKILL.md +102 -0
@@ -0,0 +1,95 @@
1
+ export const LIST_DEFAULT_MIN_WIDTH = 60;
2
+ export const LIST_DECIMALS_CHOICES = [0, 1, 2, 3, 4];
3
+ export function columnHideable(col) {
4
+ return col.type !== "title";
5
+ }
6
+ export function columnDefaultHidden(col, viewId) {
7
+ if (viewId === "list" && col.list?.hidden !== undefined)
8
+ return col.list.hidden;
9
+ return col.defaultHidden === true;
10
+ }
11
+ export function isColumnHidden(col, state, viewId) {
12
+ if (!columnHideable(col))
13
+ return false;
14
+ if (state?.hidden?.includes(col.id))
15
+ return true;
16
+ if (columnDefaultHidden(col, viewId))
17
+ return !state?.visible?.includes(col.id);
18
+ return false;
19
+ }
20
+ export function toggleColumnHidden(state, col, hide, viewId) {
21
+ const next = { ...state };
22
+ if (columnDefaultHidden(col, viewId)) {
23
+ const visible = new Set(next.visible ?? []);
24
+ if (hide)
25
+ visible.delete(col.id);
26
+ else
27
+ visible.add(col.id);
28
+ if (visible.size === 0)
29
+ delete next.visible;
30
+ else
31
+ next.visible = [...visible];
32
+ if (next.hidden?.includes(col.id)) {
33
+ const hidden = next.hidden.filter((id) => id !== col.id);
34
+ if (hidden.length === 0)
35
+ delete next.hidden;
36
+ else
37
+ next.hidden = hidden;
38
+ }
39
+ return next;
40
+ }
41
+ const hidden = new Set(next.hidden ?? []);
42
+ if (hide)
43
+ hidden.add(col.id);
44
+ else
45
+ hidden.delete(col.id);
46
+ if (hidden.size === 0)
47
+ delete next.hidden;
48
+ else
49
+ next.hidden = [...hidden];
50
+ return next;
51
+ }
52
+ export function clampColumnWidth(col, width) {
53
+ const min = col.grid?.minWidth ?? LIST_DEFAULT_MIN_WIDTH;
54
+ return Math.round(Math.min(col.grid?.maxWidth ?? Infinity, Math.max(min, width)));
55
+ }
56
+ export function resolveColumnOrder(declared, order) {
57
+ if (!order || order.length === 0)
58
+ return declared;
59
+ const byId = new Map(declared.map((col) => [col.id, col]));
60
+ const result = order.filter((id) => byId.has(id));
61
+ for (let index = 0; index < declared.length; index++) {
62
+ const id = declared[index].id;
63
+ if (result.includes(id))
64
+ continue;
65
+ let insertAt = 0;
66
+ for (let previous = index - 1; previous >= 0; previous--) {
67
+ const resolvedIndex = result.indexOf(declared[previous].id);
68
+ if (resolvedIndex !== -1) {
69
+ insertAt = resolvedIndex + 1;
70
+ break;
71
+ }
72
+ }
73
+ result.splice(insertAt, 0, id);
74
+ }
75
+ return result.map((id) => byId.get(id));
76
+ }
77
+ export function resolveVisibleColumns(declared, state, viewId) {
78
+ const ordered = resolveColumnOrder(declared, state?.order);
79
+ const visible = ordered.filter((col) => !isColumnHidden(col, state, viewId));
80
+ return visible.length > 0 ? visible : ordered.slice(0, 1);
81
+ }
82
+ export function resolveColumnWidths(visible, widths) {
83
+ const resolved = {};
84
+ for (const col of visible) {
85
+ const width = widths?.[col.id];
86
+ resolved[col.id] = width != null ? clampColumnWidth(col, width) : col.width;
87
+ }
88
+ return resolved;
89
+ }
90
+ export function prettifyOptionValue(value) {
91
+ return value.replace(/[_-]+/g, " ").replace(/\b\w/g, (character) => character.toUpperCase());
92
+ }
93
+ export function computeMinWidth(columns, gutterPx) {
94
+ return columns.reduce((sum, column) => sum + column.width, gutterPx);
95
+ }
@@ -0,0 +1,109 @@
1
+ import type { ReactNode } from "react";
2
+ import type { RelationSource } from "../fields/relation-source-types.js";
3
+ import type { ListColumn, ListColumnType, ListRelationValue } from "./column-schema.js";
4
+ /**
5
+ * ONE declaration per column type — what the machinery may do with it.
6
+ *
7
+ * This exists because adding a type used to cost six edits in six files and the
8
+ * compiler only caught two of them. The column-glyph map (`LIST_TYPE_ICONS`,
9
+ * `cells/icons.tsx`) and the filter map were exhaustive `Record`s, but the
10
+ * editor map was `Partial` and both the render and the paste switch carried a
11
+ * `default` — so forgetting the renderer or the paste rule compiled clean and
12
+ * failed at runtime, which is the worst shape a bug takes here. "The grid
13
+ * supports N types" was a thing six files happened to agree on rather than a
14
+ * fact anything enforced.
15
+ *
16
+ * Now the three CORE answers live here in one exhaustive map, so a new member of
17
+ * `ListColumnType` cannot be added without answering all of them. The two that
18
+ * remain outside are the ones that need JSX, which core may not hold: the glyph
19
+ * (`LIST_TYPE_ICONS` in `cells/icons.tsx`, exhaustive — it takes each storage
20
+ * type's mark from `shared/fields/type-icons` and adds the list's own `title`
21
+ * role (the text mark) and `status`) and the cell renderer (`renderTypedCell` in `chrome/`,
22
+ * exhaustive via a `never` check). Four enforced points beats six unenforced
23
+ * ones, and the layering stays intact.
24
+ *
25
+ * The shape is deliberately DECLARATIVE — each field names a strategy rather
26
+ * than holding a function. A new type picks from strategies that already exist
27
+ * and are already tested, instead of arriving with its own bespoke behaviour.
28
+ */
29
+ /** Which editor a writable column mounts when clicked, Entered or typed into. */
30
+ export type GridEditorId = "text" | "select" | "number" | "date" | "relation" | "chips" | "range" | "name"
31
+ /** Several values of one kind (`multiple` email, phone, url or domain), each with its label and a main one. */
32
+ | "values";
33
+ /** Which editor this type opens in the Filter drill-in. `none` lists the
34
+ * column and opens nothing — a structured value with no rule to write. */
35
+ export type ListFilterEditor = "options" | "text" | "number" | "date" | "boolean" | "range" | "none";
36
+ /**
37
+ * How a pasted clipboard cell becomes this type's commit payload.
38
+ * `none` means the type refuses paste — the honest answer for a display-only
39
+ * type, and the same answer it gives about mounting an editor.
40
+ */
41
+ export type GridPasteKind = "text" | "option" | "number" | "date" | "boolean"
42
+ /** Match the pasted TEXT against the candidates' LABELS and commit the id —
43
+ * `option`'s strategy with one hop, because what a person copies out of a
44
+ * relation cell is the name, not the uuid. */
45
+ | "relation"
46
+ /** Split the pasted TEXT into several values — the mirror of how a list is
47
+ * copied, so a cell-to-cell paste round-trips and a spreadsheet column of
48
+ * comma-separated labels arrives whole. */
49
+ | "list"
50
+ /** A low and a high end: an in-grid copy carries the pair; outside text is
51
+ * read the way a range is written — "11–50", "10,001+", "up to 50", "7". */
52
+ | "range" | "none";
53
+ /**
54
+ * What a committed value has to LOOK like for this type — the write gate's
55
+ * rules, stated per type rather than re-checked at each call site.
56
+ * `any` is the honest default: most types accept whatever their editor emits.
57
+ */
58
+ export type GridValueKind = "any" | "email" | "url" | "boolean" | "relation" | "list";
59
+ export type GridTypeRule = {
60
+ /** `null` = no editor. Booleans are `null` and still writable: they commit
61
+ * instantly, so there is nothing to mount. */
62
+ editor: GridEditorId | null;
63
+ filter: ListFilterEditor;
64
+ paste: GridPasteKind;
65
+ value: GridValueKind;
66
+ };
67
+ export declare const GRID_TYPE_RULES: Record<ListColumnType, GridTypeRule>;
68
+ /** This type's rules, or null for a column that declares no type at all. */
69
+ export declare function typeRule(type: ListColumnType | undefined): GridTypeRule | null;
70
+ /**
71
+ * How a paste becomes this column's value. A column of several values (`multiple`) pastes as a list, whatever its
72
+ * type: an in-grid copy carries its items, outside text splits into values. A `multiple` column of a type that holds
73
+ * no list, or that presents no field to read its values, takes no paste, as it mounts no editor (`gridEditorKind`).
74
+ */
75
+ export declare function gridPasteKind<Row>(col: ListColumn<Row>): GridPasteKind | null;
76
+ /**
77
+ * A relation value with the column's default KIND filled in.
78
+ *
79
+ * The rule itself is the contract's (`resolveRelationValue`), because a display
80
+ * core has to answer it without a column to look at. What the list adds is the
81
+ * one thing the contract has no word for: where the default kind comes from —
82
+ * `col.relation.entity`, the monomorphic column's single answer. The value's
83
+ * own `entity` still wins, which is the polymorphic case.
84
+ *
85
+ * The result is typed as `ListRelationValue` because the list's value is the
86
+ * contract's plus an optional per-value `icon`, so a resolved value that
87
+ * carried one still has it.
88
+ */
89
+ export declare function resolveGridRelation<Row>(col: ListColumn<Row>, raw: unknown): ListRelationValue | null;
90
+ /**
91
+ * The column's candidates, each wearing the glyph its KIND wears everywhere
92
+ * else in the app — what the picker offers.
93
+ *
94
+ * Lives in core, beside `resolveGridRelation`, because it is the same rule
95
+ * applied to a different input: the CELL fills in the column's default kind to
96
+ * decide what it draws, and the PICKER has to fill in the same default to dress
97
+ * the row you are about to choose. Split across two layers, those drift, and
98
+ * the symptom is a list where the option you pick doesn't look like the value
99
+ * you get.
100
+ *
101
+ * `entityIcon` arrives as a RESOLVER, which is what keeps this file free of any
102
+ * app's entity vocabulary — core knows there is such a thing as a kind, never
103
+ * which kinds exist. Absent (a host that wired none), the candidates come back
104
+ * untouched and the picker draws no glyph lane at all.
105
+ *
106
+ * A value that brought its OWN icon keeps it: the polymorphic case, where the
107
+ * column has no single answer to give.
108
+ */
109
+ export declare function gridRelationSource<Row>(col: ListColumn<Row>, entityIcon?: (kind: string | undefined) => ReactNode): RelationSource;
@@ -0,0 +1,50 @@
1
+ import { isMultipleType, resolveRelationValue } from "@viewkitjs/fields";
2
+ export const GRID_TYPE_RULES = {
3
+ title: { editor: "text", filter: "text", paste: "text", value: "any" },
4
+ text: { editor: "text", filter: "text", paste: "text", value: "any" },
5
+ number: { editor: "number", filter: "number", paste: "number", value: "any" },
6
+ percent: { editor: "number", filter: "number", paste: "number", value: "any" },
7
+ currency: { editor: "number", filter: "number", paste: "number", value: "any" },
8
+ date: { editor: "date", filter: "date", paste: "date", value: "any" },
9
+ datetime: { editor: "date", filter: "date", paste: "date", value: "any" },
10
+ status: { editor: "select", filter: "options", paste: "option", value: "any" },
11
+ select: { editor: "select", filter: "options", paste: "option", value: "any" },
12
+ multiselect: { editor: "chips", filter: "options", paste: "list", value: "list" },
13
+ boolean: { editor: null, filter: "boolean", paste: "boolean", value: "boolean" },
14
+ relation: { editor: "relation", filter: "options", paste: "relation", value: "relation" },
15
+ user: { editor: "relation", filter: "options", paste: "relation", value: "relation" },
16
+ phone: { editor: "text", filter: "text", paste: "text", value: "any" },
17
+ location: { editor: null, filter: "none", paste: "none", value: "any" },
18
+ name: { editor: "name", filter: "text", paste: "text", value: "any" },
19
+ actor: { editor: null, filter: "options", paste: "none", value: "any" },
20
+ rich_text: { editor: "text", filter: "text", paste: "text", value: "any" },
21
+ range: { editor: "range", filter: "range", paste: "range", value: "any" },
22
+ url: { editor: "text", filter: "text", paste: "text", value: "url" },
23
+ domain: { editor: "text", filter: "text", paste: "text", value: "any" },
24
+ email: { editor: "text", filter: "text", paste: "text", value: "email" },
25
+ };
26
+ export function typeRule(type) {
27
+ return type ? GRID_TYPE_RULES[type] : null;
28
+ }
29
+ export function gridPasteKind(col) {
30
+ if (col.multiple)
31
+ return col.field && col.type && isMultipleType(col.type) ? "list" : null;
32
+ return typeRule(col.type)?.paste ?? null;
33
+ }
34
+ export function resolveGridRelation(col, raw) {
35
+ return resolveRelationValue(raw, col.relation?.entity);
36
+ }
37
+ export function gridRelationSource(col, entityIcon) {
38
+ const source = col.relation?.source ?? { kind: "static", items: col.relation?.options ?? [] };
39
+ if (!entityIcon)
40
+ return source;
41
+ const dress = (option) => option.icon
42
+ ? option
43
+ : { ...option, icon: entityIcon(resolveGridRelation(col, option)?.entity) };
44
+ if (source.kind === "static")
45
+ return { ...source, items: source.items.map(dress) };
46
+ return {
47
+ ...source,
48
+ search: async (query, signal, offset) => (await source.search(query, signal, offset)).map(dress),
49
+ };
50
+ }
@@ -0,0 +1,44 @@
1
+ import type { ListColumn } from "./column-schema.js";
2
+ /**
3
+ * THE DECLARATIONS THAT LIE — mistakes a column can make that nothing else can
4
+ * catch.
5
+ *
6
+ * Both of these are pure and list-shaped rather than boolean, so the caller can
7
+ * NAME the offenders, and both are wired as dev-only warnings at the mount site
8
+ * (`ListBody`). They live apart from the capability answers they consult because
9
+ * they are a different job: `column-capabilities` tells a running grid what it
10
+ * may do, these two tell the person writing the page that they wrote something
11
+ * the grid will quietly ignore.
12
+ *
13
+ * Enforcing either at the type level would mean threading a second generic
14
+ * through every file that writes `ListColumn<Row>`, for mistakes that only exist
15
+ * while a page is being written.
16
+ */
17
+ /**
18
+ * Every `sortKey` a column advertises that the host's sort vocabulary doesn't
19
+ * know — i.e. the sort trap, made checkable.
20
+ *
21
+ * The grid never sorts: the header menu offers "Sort A→Z" for ANY column
22
+ * carrying a `sortKey` and hands that plain string to the host's `onChange`.
23
+ * `sortKey` is not typed against the host's key union, so the two ways this
24
+ * goes wrong are both silent — a typo falls through to whatever the host's
25
+ * comparator does last (a wrong order, no error), and a correct key missing
26
+ * from `sort.options` renders as its raw camelCase in the toolbar's Sort row.
27
+ */
28
+ export declare function unknownSortKeys<Row>(columns: readonly ListColumn<Row>[], sortOptions: readonly {
29
+ value: string;
30
+ }[]): string[];
31
+ /**
32
+ * Every column that declares `editable` for a type which cannot mount an
33
+ * editor — a promise the grid silently drops.
34
+ *
35
+ * `url` names no editor, so `editable: true` on it type-checks, reads as
36
+ * writable in the declaration, and then refuses every write at runtime with no
37
+ * error and nothing to explain it. That is the worst shape a capability bug
38
+ * takes: the code says yes, the UI says nothing, and the user concludes the cell
39
+ * is broken.
40
+ *
41
+ * Booleans are excluded on purpose — they are writable WITHOUT an editor, which
42
+ * is the whole reason `columnWritable` exists apart from `gridColumnHasEditor`.
43
+ */
44
+ export declare function columnsClaimingAbsentEditors<Row>(columns: readonly ListColumn<Row>[]): string[];
@@ -0,0 +1,24 @@
1
+ import { isMultipleType } from "@viewkitjs/fields";
2
+ import { hasEditCore } from "../fields/edit-core-types.js";
3
+ import { gridBooleanMode, gridColumnHasEditor } from "./column-capabilities.js";
4
+ export function unknownSortKeys(columns, sortOptions) {
5
+ const known = new Set(sortOptions.map((option) => option.value));
6
+ const missing = new Set();
7
+ for (const col of columns) {
8
+ if (col.sortKey && !known.has(col.sortKey))
9
+ missing.add(col.sortKey);
10
+ }
11
+ return [...missing];
12
+ }
13
+ export function columnsClaimingAbsentEditors(columns) {
14
+ return columns
15
+ .filter((col) => col.editable && !columnMountsEditor(col) && gridBooleanMode(col) == null)
16
+ .map((col) => col.id);
17
+ }
18
+ function columnMountsEditor(col) {
19
+ if (col.multiple)
20
+ return !!col.field && !!col.type && isMultipleType(col.type);
21
+ if (col.field && hasEditCore(col.field.type))
22
+ return true;
23
+ return gridColumnHasEditor(col);
24
+ }
@@ -0,0 +1,3 @@
1
+ import type { CSSProperties } from "react";
2
+ import type { ListDensity } from "./column-state.js";
3
+ export declare function densityStyle(density: ListDensity): CSSProperties & Record<string, string>;
@@ -0,0 +1,13 @@
1
+ const DENSITY = {
2
+ compact: { py: "0.375rem", headMb: "0.25rem", gap: "0.5rem" },
3
+ default: { py: "0.75rem", headMb: "0.5rem", gap: "0.75rem" },
4
+ spacious: { py: "1.125rem", headMb: "0.75rem", gap: "1rem" },
5
+ };
6
+ export function densityStyle(density) {
7
+ const spec = DENSITY[density] ?? DENSITY.default;
8
+ return {
9
+ "--vk-row-py": spec.py,
10
+ "--vk-head-mb": spec.headMb,
11
+ "--vk-row-gap": spec.gap,
12
+ };
13
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The storage type behind a column — what `FORMAT_KNOBS` and the query
3
+ * contract are keyed by.
4
+ *
5
+ * A column that declares a field answers with its VALUE type — a rollup or
6
+ * formula is its result. One that does not is read off `ListColumnType`,
7
+ * which IS the value-type vocabulary plus the one column role: `title` is the
8
+ * text a row is called. A column with no type at all is a hand-rendered cell,
9
+ * and text is the reading that offers it nothing rather than the wrong thing.
10
+ *
11
+ * Kept in its own file rather than appended to `column-schema.ts`: that file
12
+ * is held under the component ratchet's line ceiling, and the policy is split,
13
+ * never raise it.
14
+ */
15
+ import { type ValueType } from "@viewkitjs/fields";
16
+ import type { TemporalKind } from "@viewkitjs/fields/query";
17
+ import type { ListColumn } from "./column-schema.js";
18
+ export declare function fieldTypeOf<Row>(col: ListColumn<Row>): ValueType;
19
+ /** The temporal kind: a bound column's field decides; a field-less column's
20
+ * own type does — `date` is a calendar day, `datetime` an instant. */
21
+ export declare function temporalKindOf<Row>(col: ListColumn<Row>): TemporalKind;
@@ -0,0 +1,11 @@
1
+ import { valueTypeOf } from "@viewkitjs/fields";
2
+ export function fieldTypeOf(col) {
3
+ if (col.field)
4
+ return valueTypeOf(col.field);
5
+ if (!col.type || col.type === "title")
6
+ return "text";
7
+ return col.type;
8
+ }
9
+ export function temporalKindOf(col) {
10
+ return fieldTypeOf(col) === "date" ? "date" : "datetime";
11
+ }
@@ -0,0 +1 @@
1
+ export { type ListFilterCapability, type ListFilterCapabilities } from "../filters/registry.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ /**
2
+ * THE VIEW-NEUTRAL LIST MODEL.
3
+ *
4
+ * What a list's columns ARE (`column-schema`), what may be DONE to them
5
+ * (`column-capabilities`), which of them are shown and in what order
6
+ * (`column-state`), how they narrow a cohort (`column-filters`), and what a
7
+ * user has persisted about them (`preferences`).
8
+ *
9
+ * It lives OUTSIDE `grid/` because none of it is about a spreadsheet.
10
+ * A table view reads the same schema to align its columns; a card view reads
11
+ * it to find the title field; a board would read a `select` column's `options`
12
+ * to get its lanes; and all of them must ask `column-capabilities` before a
13
+ * write, or a workspace lock would protect the grid and nothing else.
14
+ *
15
+ * What stayed behind in `grid/` is what only a spreadsheet does: cell
16
+ * editors, range selection, clipboard, keyboard navigation, and the pixel
17
+ * scale (`core/grid-scale.ts`).
18
+ */
19
+ export * from "./column-schema.js";
20
+ export * from "./field-type-of.js";
21
+ export * from "./column-knobs.js";
22
+ export * from "./column-sort.js";
23
+ export * from "./column-order.js";
24
+ export * from "./column-from.js";
25
+ export * from "./row-icon.js";
26
+ export * from "./column-state.js";
27
+ export * from "./column-types.js";
28
+ export * from "./column-capabilities.js";
29
+ export * from "./column-warnings.js";
30
+ export * from "./column-filters.js";
31
+ export * from "./filter-capabilities.js";
32
+ export * from "./preferences.js";
33
+ export * from "./view-rules.js";
34
+ export * from "./part-rows.js";
35
+ export * from "./prefs-buckets.js";
36
+ export * from "./density.js";
37
+ export * from "./aggregates.js";
38
+ export { countRowRender, takeRowRenders } from "./render-count.js";
@@ -0,0 +1,20 @@
1
+ export * from "./column-schema.js";
2
+ export * from "./field-type-of.js";
3
+ export * from "./column-knobs.js";
4
+ export * from "./column-sort.js";
5
+ export * from "./column-order.js";
6
+ export * from "./column-from.js";
7
+ export * from "./row-icon.js";
8
+ export * from "./column-state.js";
9
+ export * from "./column-types.js";
10
+ export * from "./column-capabilities.js";
11
+ export * from "./column-warnings.js";
12
+ export * from "./column-filters.js";
13
+ export * from "./filter-capabilities.js";
14
+ export * from "./preferences.js";
15
+ export * from "./view-rules.js";
16
+ export * from "./part-rows.js";
17
+ export * from "./prefs-buckets.js";
18
+ export * from "./density.js";
19
+ export * from "./aggregates.js";
20
+ export { countRowRender, takeRowRenders } from "./render-count.js";
@@ -0,0 +1,28 @@
1
+ import type { FieldType } from "@viewkitjs/fields";
2
+ import { type ViewsMessageResolver } from "../contract.js";
3
+ /** Joins a row's id and its part. A part never holds it, so a key splits at its last one. */
4
+ export declare const PART_KEY_SEPARATOR = "::";
5
+ /** A row's key for one part: a column id (Filter) or a field key (Sort, Group), then the part. */
6
+ export declare function partKey(id: string, part: string): string;
7
+ /** `{ id }` for a whole-value key, `{ id, part }` for a part key; split at the LAST separator. */
8
+ export declare function parsePartKey(key: string): {
9
+ id: string;
10
+ part?: string;
11
+ };
12
+ /** The parts each type offers a Filter row for, in the order the rows are listed. A name's full name has none: the
13
+ * name's own row already reads it. */
14
+ export declare const FILTER_PART_ROWS: {
15
+ readonly [K in FieldType]?: readonly string[];
16
+ };
17
+ /** The orders each type offers a Sort option for, beyond its whole-value sort (a name's is its full name). */
18
+ export declare const SORT_PART_ROWS: {
19
+ readonly [K in FieldType]?: readonly string[];
20
+ };
21
+ /** The orders each type offers a Group dimension for, beyond grouping by the whole value. */
22
+ export declare const GROUP_PART_ROWS: {
23
+ readonly [K in FieldType]?: readonly string[];
24
+ };
25
+ /** A part's word ("Country", "Given name"); undefined for a part no table lists. */
26
+ export declare function partWord(type: FieldType, part: string, messages?: ViewsMessageResolver): string | undefined;
27
+ /** "Location · Country": the field's label and the part's word, through `views.menus.part-row`. */
28
+ export declare function partLabel(fieldLabel: string, type: FieldType, part: string, messages?: ViewsMessageResolver): string;
@@ -0,0 +1,40 @@
1
+ import { LOCATION_FILTER_PARTS, LOCATION_ORDERS } from "@viewkitjs/fields/query";
2
+ import { resolveViewsMessage } from "../contract.js";
3
+ export const PART_KEY_SEPARATOR = "::";
4
+ export function partKey(id, part) {
5
+ return `${id}${PART_KEY_SEPARATOR}${part}`;
6
+ }
7
+ export function parsePartKey(key) {
8
+ const at = key.lastIndexOf(PART_KEY_SEPARATOR);
9
+ if (at < 0)
10
+ return { id: key };
11
+ return { id: key.slice(0, at), part: key.slice(at + PART_KEY_SEPARATOR.length) };
12
+ }
13
+ export const FILTER_PART_ROWS = {
14
+ location: LOCATION_FILTER_PARTS,
15
+ name: ["given", "family"],
16
+ };
17
+ export const SORT_PART_ROWS = {
18
+ location: LOCATION_ORDERS,
19
+ name: ["family", "given"],
20
+ };
21
+ export const GROUP_PART_ROWS = {
22
+ location: LOCATION_ORDERS,
23
+ };
24
+ const PART_WORDS = {
25
+ location: {
26
+ countryCode: "views.editors.place-country",
27
+ region: "views.editors.place-region",
28
+ city: "views.editors.place-city-city",
29
+ postalCode: "views.editors.place-postal-postal",
30
+ },
31
+ name: { given: "views.editors.name-given", family: "views.editors.name-family" },
32
+ };
33
+ export function partWord(type, part, messages = resolveViewsMessage) {
34
+ const words = PART_WORDS[type];
35
+ const key = words && Object.hasOwn(words, part) ? words[part] : undefined;
36
+ return key ? messages({ key }) : undefined;
37
+ }
38
+ export function partLabel(fieldLabel, type, part, messages = resolveViewsMessage) {
39
+ return messages({ key: "views.menus.part-row", values: { field: fieldLabel, part: partWord(type, part, messages) ?? part } });
40
+ }