viewkitjs 0.31.0 → 0.32.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 (289) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/MIGRATION.md +40 -6
  3. package/README.md +1 -1
  4. package/fields/dist/query/index.d.ts +2 -0
  5. package/fields/dist/query/index.js +2 -0
  6. package/fields/dist/query/list-request.d.ts +148 -0
  7. package/fields/dist/query/list-request.js +125 -0
  8. package/fields/dist/query/saved-view.d.ts +15 -0
  9. package/fields/dist/query/saved-view.js +11 -0
  10. package/fields/dist/query/settings.d.ts +9 -0
  11. package/fields/dist/query/settings.js +9 -0
  12. package/fields/docs/reference/query.md +66 -0
  13. package/package.json +5 -1
  14. package/postgres/README.md +1 -0
  15. package/postgres/dist/handler.d.ts +53 -0
  16. package/postgres/dist/handler.js +211 -0
  17. package/postgres/dist/ids.d.ts +1 -1
  18. package/postgres/dist/ids.js +19 -1
  19. package/postgres/dist/index.d.ts +1 -0
  20. package/postgres/dist/index.js +1 -0
  21. package/postgres/dist/limits.d.ts +3 -1
  22. package/postgres/dist/limits.js +1 -1
  23. package/postgres/dist/list-fields.d.ts +10 -0
  24. package/postgres/dist/list-fields.js +36 -0
  25. package/postgres/dist/readable.d.ts +4 -0
  26. package/postgres/dist/readable.js +4 -0
  27. package/postgres/dist/refusals.d.ts +9 -2
  28. package/postgres/dist/refusals.js +6 -0
  29. package/postgres/docs/guides/field-map.md +2 -2
  30. package/postgres/docs/guides/list-handler.md +99 -0
  31. package/postgres/docs/index.md +1 -0
  32. package/postgres/docs/reference/postgres.md +11 -3
  33. package/views/README.md +2 -2
  34. package/views/dist/atoms/RowMenu.d.ts +7 -0
  35. package/views/dist/atoms/RowMenu.js +18 -16
  36. package/views/dist/atoms/carried.d.ts +5 -0
  37. package/views/dist/atoms/carried.js +7 -0
  38. package/views/dist/atoms/types.d.ts +3 -0
  39. package/views/dist/contract.d.ts +26 -6
  40. package/views/dist/contract.js +25 -0
  41. package/views/dist/controls/alert-dialog/alert-dialog.js +2 -1
  42. package/views/dist/controls/atoms.d.ts +2 -0
  43. package/views/dist/controls/atoms.js +2 -0
  44. package/views/dist/controls/avatar/avatar.d.ts +3 -3
  45. package/views/dist/controls/avatar/avatar.js +1 -1
  46. package/views/dist/controls/avatar/tokens.d.ts +44 -0
  47. package/views/dist/controls/avatar/tokens.js +11 -0
  48. package/views/dist/controls/avatar.css +22 -5
  49. package/views/dist/controls/choice/tokens.d.ts +0 -4
  50. package/views/dist/controls/choice/tokens.js +0 -1
  51. package/views/dist/controls/choice.css +3 -3
  52. package/views/dist/controls/controls.d.ts +6 -0
  53. package/views/dist/controls/controls.js +10 -2
  54. package/views/dist/controls/customize/map-customize-body.js +1 -1
  55. package/views/dist/controls/field/field.d.ts +19 -4
  56. package/views/dist/controls/field/field.js +63 -5
  57. package/views/dist/controls/field/tokens.d.ts +4 -0
  58. package/views/dist/controls/field/tokens.js +1 -0
  59. package/views/dist/controls/field.css +41 -16
  60. package/views/dist/controls/glyphs/glyphs.d.ts +10 -0
  61. package/views/dist/controls/glyphs/glyphs.js +173 -0
  62. package/views/dist/controls/index.d.ts +2 -1
  63. package/views/dist/controls/index.js +2 -1
  64. package/views/dist/controls/input/input.js +5 -2
  65. package/views/dist/controls/input/tokens.d.ts +4 -0
  66. package/views/dist/controls/input/tokens.js +1 -0
  67. package/views/dist/controls/input.css +31 -3
  68. package/views/dist/controls/internal/icons.js +10 -0
  69. package/views/dist/controls/internal/keep-focus.d.ts +2 -0
  70. package/views/dist/controls/internal/keep-focus.js +17 -0
  71. package/views/dist/controls/internal/watch-frame.d.ts +2 -0
  72. package/views/dist/controls/internal/watch-frame.js +33 -0
  73. package/views/dist/controls/markdown/map-markdown.d.ts +4 -0
  74. package/views/dist/controls/markdown/map-markdown.js +5 -0
  75. package/views/dist/controls/menu/map-menu.js +2 -2
  76. package/views/dist/controls/menu-list/menu-list.d.ts +3 -0
  77. package/views/dist/controls/menu-list/menu-list.js +5 -4
  78. package/views/dist/controls/modal/modal.js +5 -1
  79. package/views/dist/controls/pane/pane.js +2 -1
  80. package/views/dist/controls/phone-header/header-bar.d.ts +5 -1
  81. package/views/dist/controls/phone-header/header-bar.js +2 -2
  82. package/views/dist/controls/phone-header.css +11 -1
  83. package/views/dist/controls/picker/map-picker.js +3 -0
  84. package/views/dist/controls/picker/picker.d.ts +14 -0
  85. package/views/dist/controls/picker/picker.js +30 -10
  86. package/views/dist/controls/picker.css +2 -0
  87. package/views/dist/controls/popover/popover.js +2 -1
  88. package/views/dist/controls/radio/radio.d.ts +5 -3
  89. package/views/dist/controls/radio/radio.js +18 -2
  90. package/views/dist/controls/radio/tokens.d.ts +44 -0
  91. package/views/dist/controls/radio/tokens.js +11 -0
  92. package/views/dist/controls/radio.css +79 -1
  93. package/views/dist/controls/select/select.d.ts +4 -0
  94. package/views/dist/controls/select/select.js +11 -5
  95. package/views/dist/controls/select/tokens.d.ts +8 -0
  96. package/views/dist/controls/select/tokens.js +2 -0
  97. package/views/dist/controls/select.css +17 -0
  98. package/views/dist/controls/setting-row/looks.d.ts +1 -1
  99. package/views/dist/controls/setting-row/looks.js +9 -4
  100. package/views/dist/controls/setting-row/setting-row.d.ts +45 -10
  101. package/views/dist/controls/setting-row/setting-row.js +82 -15
  102. package/views/dist/controls/setting-row/tokens.d.ts +74 -2
  103. package/views/dist/controls/setting-row/tokens.js +19 -1
  104. package/views/dist/controls/setting-row.css +135 -14
  105. package/views/dist/controls/sheet/bottom-sheet.d.ts +10 -2
  106. package/views/dist/controls/sheet/bottom-sheet.js +6 -3
  107. package/views/dist/controls/sheet.css +4 -1
  108. package/views/dist/controls/sort-editor/sort-editor.js +3 -2
  109. package/views/dist/controls/sort-editor.css +8 -2
  110. package/views/dist/controls/switch-row/tokens.d.ts +0 -12
  111. package/views/dist/controls/switch-row/tokens.js +0 -3
  112. package/views/dist/controls/switch-row.css +3 -7
  113. package/views/dist/controls/switch.css +17 -7
  114. package/views/dist/controls/tag/tag.d.ts +3 -1
  115. package/views/dist/controls/tag/tag.js +2 -2
  116. package/views/dist/controls/tag/tokens.d.ts +4 -0
  117. package/views/dist/controls/tag/tokens.js +1 -0
  118. package/views/dist/controls/tag-field/tag-field.d.ts +5 -1
  119. package/views/dist/controls/tag-field/tag-field.js +11 -5
  120. package/views/dist/controls/tag-field/tokens.d.ts +16 -0
  121. package/views/dist/controls/tag-field/tokens.js +4 -0
  122. package/views/dist/controls/tag-field.css +19 -0
  123. package/views/dist/controls/tag.css +2 -0
  124. package/views/dist/controls/toolbar/toolbar.d.ts +15 -3
  125. package/views/dist/controls/toolbar/toolbar.js +22 -15
  126. package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +14 -0
  127. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +51 -0
  128. package/views/dist/controls/toolbar-button/toolbar-button.d.ts +1 -1
  129. package/views/dist/controls/toolbar-button/toolbar-button.js +2 -3
  130. package/views/dist/controls/toolbar-button.css +4 -0
  131. package/views/dist/controls/toolbar.css +5 -0
  132. package/views/dist/controls/views-list/map-view-menu.d.ts +3 -0
  133. package/views/dist/controls/views-list/map-view-menu.js +25 -0
  134. package/views/dist/controls/views-list/map-views-list-body.d.ts +28 -1
  135. package/views/dist/controls/views-list/map-views-list-body.js +39 -21
  136. package/views/dist/controls/views-list/rules.d.ts +2 -0
  137. package/views/dist/controls/views-list/view-menu.d.ts +7 -0
  138. package/views/dist/controls/views-list/view-menu.js +28 -24
  139. package/views/dist/controls/views-list/words.d.ts +2 -0
  140. package/views/dist/controls/views-list/words.js +1 -1
  141. package/views/dist/editors/EditorPanel.js +2 -1
  142. package/views/dist/editors/edit-session.js +2 -5
  143. package/views/dist/field-row/FieldRow.d.ts +4 -2
  144. package/views/dist/field-row/FieldRow.js +67 -20
  145. package/views/dist/field-row/FieldRowLane.d.ts +7 -2
  146. package/views/dist/field-row/FieldRowLane.js +4 -3
  147. package/views/dist/field-row/editors/RowEditor.d.ts +12 -0
  148. package/views/dist/field-row/editors/RowEditor.js +31 -1
  149. package/views/dist/field-row/editors/RowValueListEditor.d.ts +5 -1
  150. package/views/dist/field-row/editors/RowValueListEditor.js +4 -1
  151. package/views/dist/field-row/field-row-button.d.ts +5 -0
  152. package/views/dist/field-row/field-row-button.js +2 -0
  153. package/views/dist/fields/binding.d.ts +3 -2
  154. package/views/dist/fields/binding.js +38 -5
  155. package/views/dist/grid/chrome/GridColumnMenu.d.ts +4 -2
  156. package/views/dist/grid/chrome/GridColumnMenu.js +3 -2
  157. package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -1
  158. package/views/dist/grid/chrome/GridGroupMenu.js +4 -3
  159. package/views/dist/grid/chrome/GridHeader.d.ts +4 -1
  160. package/views/dist/grid/chrome/GridHeader.js +2 -2
  161. package/views/dist/grid/chrome/GridRow.js +6 -5
  162. package/views/dist/grid/chrome/GridRowCells.js +6 -9
  163. package/views/dist/grid/chrome/GridStructure.d.ts +4 -1
  164. package/views/dist/grid/chrome/GridStructure.js +4 -4
  165. package/views/dist/grid/chrome/GridTable.js +5 -2
  166. package/views/dist/grid/chrome/grid-column-menu-items.js +1 -1
  167. package/views/dist/grid/chrome/grid-row-menu-items.d.ts +27 -3
  168. package/views/dist/grid/chrome/grid-row-menu-items.js +92 -6
  169. package/views/dist/grid/chrome/grid-row-props.d.ts +7 -2
  170. package/views/dist/grid/chrome/grid-rows-menu.js +34 -6
  171. package/views/dist/grid/chrome/grid-table-props.d.ts +38 -7
  172. package/views/dist/grid/chrome/useGridBatchApi.d.ts +3 -1
  173. package/views/dist/grid/chrome/useGridBatchApi.js +4 -2
  174. package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -2
  175. package/views/dist/grid/chrome/useGridKeyboard.js +15 -9
  176. package/views/dist/grid/chrome/useGridPendingReconciliation.js +1 -2
  177. package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
  178. package/views/dist/grid/chrome/useGridTableInteractionModel.js +11 -5
  179. package/views/dist/grid/core/commit-model.d.ts +20 -2
  180. package/views/dist/grid/core/editing-controller.d.ts +18 -0
  181. package/views/dist/grid/core/editing-controller.js +188 -42
  182. package/views/dist/grid/core/editing-model.d.ts +3 -0
  183. package/views/dist/grid/core/editing-model.js +3 -0
  184. package/views/dist/grid/core/save-path.d.ts +24 -0
  185. package/views/dist/grid/core/save-path.js +122 -0
  186. package/views/dist/grid/core/spreadsheet-operations.d.ts +3 -0
  187. package/views/dist/grid/core/spreadsheet-operations.js +23 -0
  188. package/views/dist/grid/index.d.ts +3 -2
  189. package/views/dist/grid/index.js +1 -0
  190. package/views/dist/internal/field-rows.d.ts +26 -0
  191. package/views/dist/internal/field-rows.js +8 -0
  192. package/views/dist/internal/page-close.d.ts +7 -0
  193. package/views/dist/internal/page-close.js +43 -0
  194. package/views/dist/list/browser-views-store.d.ts +10 -0
  195. package/views/dist/list/browser-views-store.js +182 -0
  196. package/views/dist/list/index.d.ts +23 -0
  197. package/views/dist/list/index.js +8 -0
  198. package/views/dist/list/menu.d.ts +31 -0
  199. package/views/dist/list/menu.js +76 -0
  200. package/views/dist/list/parts.d.ts +6 -0
  201. package/views/dist/list/parts.js +59 -0
  202. package/views/dist/list/registry.d.ts +11 -0
  203. package/views/dist/list/registry.js +31 -0
  204. package/views/dist/list/root.d.ts +40 -0
  205. package/views/dist/list/root.js +128 -0
  206. package/views/dist/list/slot.d.ts +14 -0
  207. package/views/dist/list/slot.js +22 -0
  208. package/views/dist/list/source.d.ts +11 -0
  209. package/views/dist/list/source.js +31 -0
  210. package/views/dist/list/store.d.ts +87 -0
  211. package/views/dist/list/store.js +115 -0
  212. package/views/dist/list/toolbar.d.ts +6 -0
  213. package/views/dist/list/toolbar.js +359 -0
  214. package/views/dist/list/views-axis.d.ts +5 -0
  215. package/views/dist/list/views-axis.js +96 -0
  216. package/views/dist/list/views-store.d.ts +41 -0
  217. package/views/dist/list/views-store.js +1 -0
  218. package/views/dist/list/views.d.ts +67 -0
  219. package/views/dist/list/views.js +400 -0
  220. package/views/dist/model/preferences.js +1 -1
  221. package/views/dist/model/prefs-buckets.js +1 -1
  222. package/views/dist/panels/index.d.ts +3 -1
  223. package/views/dist/panels/index.js +1 -0
  224. package/views/dist/panels/react/customize-body.js +1 -0
  225. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +41 -4
  226. package/views/dist/panels/react/toolbar/ReadyToolbar.js +6 -326
  227. package/views/dist/panels/react/toolbar/Toolbar.d.ts +9 -1
  228. package/views/dist/panels/react/toolbar/Toolbar.js +34 -23
  229. package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
  230. package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
  231. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +2 -2
  232. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +3 -1
  233. package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
  234. package/views/dist/panels/react/toolbar/context.d.ts +10 -2
  235. package/views/dist/panels/react/toolbar/context.js +3 -1
  236. package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +1 -1
  237. package/views/dist/panels/react/views-row/FoldingViewRow.js +15 -4
  238. package/views/dist/panels/react/views-row/PillGroup.d.ts +5 -2
  239. package/views/dist/panels/react/views-row/PillGroup.js +16 -7
  240. package/views/dist/panels/react/views-row/ViewPicker.js +2 -12
  241. package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +4 -2
  242. package/views/dist/panels/react/views-row/ViewPickerRow.js +9 -5
  243. package/views/dist/panels/react.d.ts +2 -2
  244. package/views/dist/panels/toolbar/edit-view.d.ts +7 -1
  245. package/views/dist/panels/toolbar/edit-view.js +14 -0
  246. package/views/dist/panels/toolbar/model.d.ts +5 -0
  247. package/views/dist/panels/toolbar/model.js +7 -3
  248. package/views/dist/panels/view-state.d.ts +5 -3
  249. package/views/dist/panels/views-row/model.d.ts +19 -2
  250. package/views/dist/panels/views-row/model.js +14 -0
  251. package/views/dist/provider/ViewsProvider.d.ts +16 -7
  252. package/views/dist/provider/ViewsProvider.js +23 -5
  253. package/views/dist/provider/components.d.ts +43 -2
  254. package/views/dist/provider/context.d.ts +2 -1
  255. package/views/dist/provider/context.js +1 -1
  256. package/views/dist/provider/ports.d.ts +19 -12
  257. package/views/dist/provider/ports.js +69 -1
  258. package/views/dist/react.d.ts +1 -1
  259. package/views/dist/styles.css +418 -59
  260. package/views/dist/styles.unlayered.css +418 -59
  261. package/views/docs/contract.md +42 -31
  262. package/views/docs/controls/avatar.md +11 -0
  263. package/views/docs/controls/choice.md +0 -1
  264. package/views/docs/controls/field.md +3 -0
  265. package/views/docs/controls/input.md +1 -0
  266. package/views/docs/controls/radio.md +16 -1
  267. package/views/docs/controls/select.md +2 -0
  268. package/views/docs/controls/setting-row.md +18 -0
  269. package/views/docs/controls/switch-row.md +0 -3
  270. package/views/docs/controls/tag-field.md +4 -0
  271. package/views/docs/controls/tag.md +1 -0
  272. package/views/docs/getting-started.md +2 -2
  273. package/views/docs/guides/atoms.md +2 -2
  274. package/views/docs/guides/columns.md +1 -1
  275. package/views/docs/guides/ports.md +1 -1
  276. package/views/docs/guides/the-grid.md +34 -7
  277. package/views/docs/guides/the-provider.md +4 -2
  278. package/views/docs/index.md +1 -0
  279. package/views/docs/reference/controls.md +35 -25
  280. package/views/docs/reference/editors-session.md +1 -1
  281. package/views/docs/reference/field-row.md +9 -1
  282. package/views/docs/reference/grid.md +14 -8
  283. package/views/docs/reference/list.md +227 -0
  284. package/views/docs/reference/looks.md +1 -1
  285. package/views/docs/reference/panels-react.md +17 -12
  286. package/views/docs/reference/panels.md +8 -5
  287. package/views/docs/reference/react.md +11 -9
  288. package/views/docs/reference/views.md +2 -2
  289. package/views/skills/views/SKILL.md +9 -6
@@ -1,8 +1,10 @@
1
1
  import { gridCellKey, } from "./commit-model.js";
2
- import { applyGridPending, carryGridPutBack, createGridHistory, gridEditValue, gridOverlayValue, gridHistoryValue, gridKeptValue, groupGridPendingByRow, groupGridPendingSettlement, keepGridPending, markGridPendingSettlement, planGridPendingAssignments, pressGridHistory, pruneGridEntry, pruneGridHistoryEntry, reconcileGridPending, recordGridHistory, revertGridHistoryPress, rollbackGridPending, } from "./editing-model.js";
2
+ import { applyGridPending, carryGridPutBack, createGridHistory, gridEditValue, gridOverlayValue, gridHistoryValue, gridKeptValue, gridRestoreShown, groupGridPendingByRow, groupGridPendingSettlement, keepGridPending, markGridPendingSettlement, planGridPendingAssignments, pressGridHistory, pruneGridEntry, pruneGridHistoryEntry, reconcileGridPending, recordGridHistory, revertGridHistoryPress, rollbackGridPending, } from "./editing-model.js";
3
3
  import { setGridWriteStates } from "./write-states.js";
4
4
  import { refusalWords } from "./refusal-sentence.js";
5
+ import { isPageClosing, onPageClose } from "../../internal/page-close.js";
5
6
  import { noteGridEdited } from "./undo-owner.js";
7
+ import { markGridKeptValue } from "./value-equality.js";
6
8
  const confirmed = (outcome) => outcome ?? { status: "confirmed" };
7
9
  export class GridEditingController {
8
10
  callbacks;
@@ -95,9 +97,16 @@ export class GridEditingController {
95
97
  });
96
98
  }
97
99
  reconcile(matchedKeys) {
98
- if (matchedKeys.length === 0)
100
+ for (const pin of this.pins)
101
+ pin.heldBack.clear();
102
+ const settled = matchedKeys.filter((key) => {
103
+ const pin = this.unsentPressOn(key);
104
+ pin?.heldBack.add(key);
105
+ return pin == null;
106
+ });
107
+ if (settled.length === 0)
99
108
  return;
100
- const next = reconcileGridPending(this.pending, matchedKeys);
109
+ const next = reconcileGridPending(this.pending, settled);
101
110
  if (next.size === this.pending.size)
102
111
  return;
103
112
  this.publishPending(next);
@@ -152,11 +161,14 @@ export class GridEditingController {
152
161
  const owned = assignments.filter((assignment) => requested.has(assignment.key));
153
162
  if (owned.length > 0)
154
163
  next = markGridPendingSettlement(next, owned, "requested");
164
+ this.reviseCovered(kept.map((each) => each.assignment), { stored: storedByKey });
165
+ this.reviseCovered(owned, { settlement: "requested" });
155
166
  if (next !== this.pending)
156
167
  this.publishPending(next);
157
168
  }
158
169
  hasInflight(rowId, columnId) {
159
- return (this.inflight.get(gridCellKey(rowId, columnId))?.size ?? 0) > 0;
170
+ const key = gridCellKey(rowId, columnId);
171
+ return (this.inflight.get(key)?.size ?? 0) > 0 || this.unsentPressOn(key) != null;
160
172
  }
161
173
  sent(rowId, columnId) {
162
174
  const newest = this.lastSent.get(gridCellKey(rowId, columnId))?.writes.at(-1);
@@ -348,27 +360,34 @@ export class GridEditingController {
348
360
  }
349
361
  let commit;
350
362
  try {
363
+ const closing = isPageClosing();
351
364
  commit = Promise.resolve(context === "restore"
352
- ? onCellCommit(row, columnId, value, { kind: "restore", expected: baseline })
353
- : onCellCommit(row, columnId, value));
365
+ ? onCellCommit(row, columnId, value, { kind: "restore", expected: baseline, ...(closing ? { closing } : {}) })
366
+ : closing
367
+ ? onCellCommit(row, columnId, value, { kind: "commit", closing })
368
+ : onCellCommit(row, columnId, value));
354
369
  }
355
370
  catch (error) {
356
371
  commit = Promise.reject(error);
357
372
  }
373
+ const refuse = (result) => {
374
+ if (sentToken)
375
+ this.dropSent(key, sentToken);
376
+ if (assignments.length > 0) {
377
+ this.publishPending(rollbackGridPending(this.pending, assignments));
378
+ this.reviseCovered(assignments, "drop");
379
+ }
380
+ return result;
381
+ };
358
382
  const promise = commit.then((outcome) => {
359
383
  const result = confirmed(outcome);
384
+ if (result.status === "failed")
385
+ return refuse(result);
360
386
  if (sentToken)
361
387
  this.settleSent(key, sentToken, result, value);
362
388
  this.settle([key], [result], assignments);
363
389
  return result;
364
- }, (error) => {
365
- if (sentToken)
366
- this.dropSent(key, sentToken);
367
- if (assignments.length > 0) {
368
- this.publishPending(rollbackGridPending(this.pending, assignments));
369
- }
370
- return { status: "failed", error };
371
- });
390
+ }, (error) => refuse({ status: "failed", error }));
372
391
  this.registerInflight([key], promise);
373
392
  this.trackWrite([{ rowId, columnId }], promise.then((result) => [result]));
374
393
  return promise;
@@ -396,6 +415,7 @@ export class GridEditingController {
396
415
  }
397
416
  let commit;
398
417
  try {
418
+ const closing = isPageClosing();
399
419
  commit = Promise.resolve(onCellsCommit(cells.map(({ row, cell }) => ({
400
420
  row,
401
421
  columnId: cell.columnId,
@@ -405,9 +425,12 @@ export class GridEditingController {
405
425
  context: {
406
426
  kind: "restore",
407
427
  expected: gridHistoryValue(cell, side === "next" ? "prev" : "next"),
428
+ ...(closing ? { closing } : {}),
408
429
  },
409
430
  }
410
- : {}),
431
+ : closing
432
+ ? { context: { kind: "commit", closing } }
433
+ : {}),
411
434
  }))));
412
435
  }
413
436
  catch (error) {
@@ -420,7 +443,9 @@ export class GridEditingController {
420
443
  .filter((_, index) => results[index]?.status === "failed")
421
444
  .map(({ cell }) => gridCellKey(cell.rowId, cell.columnId)));
422
445
  if (failedKeys.size > 0) {
423
- this.publishPending(rollbackGridPending(this.pending, assignments.filter((assignment) => failedKeys.has(assignment.key))));
446
+ const failed = assignments.filter((assignment) => failedKeys.has(assignment.key));
447
+ this.publishPending(rollbackGridPending(this.pending, failed));
448
+ this.reviseCovered(failed, "drop");
424
449
  }
425
450
  const settled = cells.map((_, index) => results[index] ?? { status: "failed" });
426
451
  if (sentTokens) {
@@ -440,7 +465,9 @@ export class GridEditingController {
440
465
  .filter((_, index) => carried[index]?.status === "failed")
441
466
  .map(({ cell }) => gridCellKey(cell.rowId, cell.columnId)));
442
467
  if (failedKeys.size > 0) {
443
- this.publishPending(rollbackGridPending(this.pending, assignments.filter((assignment) => failedKeys.has(assignment.key))));
468
+ const failed = assignments.filter((assignment) => failedKeys.has(assignment.key));
469
+ this.publishPending(rollbackGridPending(this.pending, failed));
470
+ this.reviseCovered(failed, "drop");
444
471
  }
445
472
  return carried;
446
473
  }
@@ -448,6 +475,7 @@ export class GridEditingController {
448
475
  keys.forEach((key, index) => this.dropSent(key, sentTokens[index] ?? null));
449
476
  if (assignments.length > 0) {
450
477
  this.publishPending(rollbackGridPending(this.pending, assignments));
478
+ this.reviseCovered(assignments, "drop");
451
479
  }
452
480
  return cells.map(() => ({ status: "failed", error }));
453
481
  });
@@ -470,8 +498,22 @@ export class GridEditingController {
470
498
  if (!entry)
471
499
  return false;
472
500
  this.history = pressed.state;
473
- const pin = { kind, entry, since: this.nextHistoryId, written: new Map(), notes: [] };
501
+ const pin = {
502
+ kind,
503
+ entry,
504
+ since: this.nextHistoryId,
505
+ written: new Map(),
506
+ notes: [],
507
+ laid: [],
508
+ covered: new Map(),
509
+ sent: false,
510
+ heldBack: new Set(),
511
+ revealFailed: false,
512
+ closeOff: () => { },
513
+ };
474
514
  this.pins.add(pin);
515
+ pin.closeOff = onPageClose(() => this.sendAtClose(pin, resolveRow));
516
+ const revision = this.nextPendingRevision++;
475
517
  const side = kind === "undo" ? "prev" : "next";
476
518
  const other = kind === "undo" ? "next" : "prev";
477
519
  for (const cell of entry.edits) {
@@ -488,53 +530,124 @@ export class GridEditingController {
488
530
  const write = this.notePutBack(cell, putBack, gridKeptValue(cell, other), entry.id, dropped);
489
531
  if (write)
490
532
  pin.notes.push({ key, write, from: carried?.from ?? null });
533
+ if (cell.overlay) {
534
+ pin.laid.push({
535
+ key,
536
+ value: carried && !cell.shown ? carried.value : gridRestoreShown(cell, side),
537
+ baseline: gridRestoreShown(cell, other),
538
+ revision,
539
+ });
540
+ }
541
+ }
542
+ if (pin.laid.length > 0) {
543
+ for (const { key } of pin.laid)
544
+ pin.covered.set(key, this.pending.get(key));
545
+ this.publishPending(applyGridPending(this.pending, pin.laid));
546
+ }
547
+ const first = entry.edits[0];
548
+ try {
549
+ if (first)
550
+ onApply?.({ rowId: first.rowId, columnId: first.columnId });
551
+ }
552
+ catch {
553
+ pin.revealFailed = true;
554
+ this.liftPress(pin, pin.laid.map((laid) => laid.key));
491
555
  }
492
- this.applyChain = this.applyChain.then(() => this.applyPin(pin, resolveRow, onApply));
556
+ this.applyChain = this.applyChain.then(() => this.applyPin(pin, resolveRow));
493
557
  return true;
494
558
  }
495
- async applyPin(pin, resolveRow, onApply) {
496
- let sent = false;
559
+ liftPress(pin, keys) {
560
+ let next = null;
561
+ for (const key of keys) {
562
+ const laid = pin.laid.find((each) => each.key === key);
563
+ if (!laid)
564
+ continue;
565
+ const under = pin.covered.get(key);
566
+ for (const other of this.pins) {
567
+ if (other !== pin && other.covered.get(key)?.revision === laid.revision)
568
+ other.covered.set(key, under);
569
+ }
570
+ const now = next ?? this.pending;
571
+ if (now.get(key)?.revision !== laid.revision)
572
+ continue;
573
+ next ??= new Map(this.pending);
574
+ if (under)
575
+ next.set(key, under);
576
+ else
577
+ next.delete(key);
578
+ }
579
+ if (next)
580
+ this.publishPending(next);
581
+ }
582
+ reviseCovered(assignments, change) {
583
+ if (this.pins.size === 0 || assignments.length === 0)
584
+ return;
585
+ for (const pin of this.pins) {
586
+ for (const assignment of assignments) {
587
+ const held = pin.covered.get(assignment.key);
588
+ if (!held || held.revision !== assignment.revision)
589
+ continue;
590
+ if (change === "drop")
591
+ pin.covered.set(assignment.key, undefined);
592
+ else if ("stored" in change) {
593
+ if (!change.stored.has(assignment.key))
594
+ continue;
595
+ const value = change.stored.get(assignment.key);
596
+ markGridKeptValue(value);
597
+ pin.covered.set(assignment.key, { ...held, value });
598
+ }
599
+ else
600
+ pin.covered.set(assignment.key, { ...held, settlement: change.settlement });
601
+ }
602
+ }
603
+ }
604
+ unsentPressOn(key) {
605
+ const revision = this.pending.get(key)?.revision;
606
+ if (revision === undefined)
607
+ return null;
608
+ for (const pin of this.pins) {
609
+ if (!pin.sent && pin.laid.some((each) => each.key === key && each.revision === revision))
610
+ return pin;
611
+ }
612
+ return null;
613
+ }
614
+ async applyPin(pin, resolveRow) {
615
+ const kept = new Set();
497
616
  try {
498
617
  if (pin.entry) {
499
618
  const inflight = this.inflightFor(pin.entry);
500
619
  if (inflight.length > 0)
501
620
  await Promise.allSettled(inflight);
502
621
  }
503
- const entry = pin.entry;
504
- if (!entry || entry.edits.length === 0)
505
- return;
506
- const first = entry.edits[0];
507
- onApply?.({ rowId: first.rowId, columnId: first.columnId });
508
- const edits = entry.edits.filter((cell) => !(pin.written.get(gridCellKey(cell.rowId, cell.columnId))?.size ?? 0));
509
- if (edits.length === 0) {
510
- this.carryPutBack(pin, entry);
622
+ pin.sending ??= this.sendPin(pin, resolveRow);
623
+ const sending = await pin.sending;
624
+ if (!sending)
511
625
  return;
512
- }
513
- const cells = edits.map((cell) => ({
514
- row: resolveRow(cell.rowId) ?? cell.rowSnapshot,
515
- cell,
516
- }));
517
- const overwritten = cells.map(({ cell }) => {
518
- const key = gridCellKey(cell.rowId, cell.columnId);
519
- const held = this.pending.get(key);
520
- return held ? { key, value: held.value, revision: held.revision } : null;
521
- });
522
- sent = true;
523
- const results = await this.performBatch(cells, pin.kind === "undo" ? "prev" : "next", "restore");
626
+ const { entry, cells, overwritten, results } = sending;
524
627
  this.reportRefusals(cells, results);
628
+ cells.forEach(({ cell }, index) => {
629
+ if (results[index]?.status === "confirmed")
630
+ kept.add(gridCellKey(cell.rowId, cell.columnId));
631
+ });
632
+ this.settle(cells.map(({ cell }) => gridCellKey(cell.rowId, cell.columnId)), results, pin.laid.filter((laid) => kept.has(laid.key)));
525
633
  const cleared = overwritten.filter((held, index) => held != null && results[index]?.status === "confirmed");
526
634
  if (cleared.length > 0)
527
635
  this.publishPending(rollbackGridPending(this.pending, cleared));
636
+ const landed = pin.laid.filter((laid) => kept.has(laid.key) && pin.heldBack.has(laid.key) && this.pending.get(laid.key)?.revision === laid.revision);
637
+ if (landed.length > 0)
638
+ this.publishPending(rollbackGridPending(this.pending, landed));
528
639
  if (results.every((result) => result.status === "confirmed"))
529
640
  this.carryPutBack(pin, entry);
530
641
  else
531
642
  this.refusePin(pin, entry);
532
643
  }
533
644
  catch {
534
- if (!sent && pin.entry)
645
+ if (!pin.sent && pin.entry)
535
646
  this.refusePin(pin, pin.entry);
536
647
  }
537
648
  finally {
649
+ pin.closeOff();
650
+ this.liftPress(pin, pin.laid.filter((laid) => !kept.has(laid.key)).map((laid) => laid.key));
538
651
  for (const { key, write } of pin.notes) {
539
652
  this.openNotes.delete(write.token);
540
653
  this.dropSent(key, write.token);
@@ -543,6 +656,39 @@ export class GridEditingController {
543
656
  this.settleCarriedNotes();
544
657
  }
545
658
  }
659
+ async sendPin(pin, resolveRow) {
660
+ const entry = pin.entry;
661
+ if (!entry || entry.edits.length === 0)
662
+ return null;
663
+ if (pin.revealFailed) {
664
+ this.refusePin(pin, entry);
665
+ return null;
666
+ }
667
+ const edits = entry.edits.filter((cell) => !(pin.written.get(gridCellKey(cell.rowId, cell.columnId))?.size ?? 0));
668
+ if (edits.length === 0) {
669
+ this.carryPutBack(pin, entry);
670
+ return null;
671
+ }
672
+ const cells = edits.map((cell) => ({
673
+ row: resolveRow(cell.rowId) ?? cell.rowSnapshot,
674
+ cell,
675
+ }));
676
+ const pressed = new Set([...this.pins].flatMap((each) => each.laid.map((laid) => laid.revision)));
677
+ const overwritten = cells.map(({ cell }) => {
678
+ const key = gridCellKey(cell.rowId, cell.columnId);
679
+ const held = this.pending.get(key);
680
+ return held && !pressed.has(held.revision) ? { key, value: held.value, revision: held.revision } : null;
681
+ });
682
+ pin.sent = true;
683
+ const results = await this.performBatch(cells, pin.kind === "undo" ? "prev" : "next", "restore");
684
+ return { entry, cells, overwritten, results };
685
+ }
686
+ sendAtClose(pin, resolveRow) {
687
+ if (pin.sending)
688
+ return;
689
+ pin.sending = this.sendPin(pin, resolveRow);
690
+ pin.sending.catch(() => { });
691
+ }
546
692
  carryPutBack(pin, entry) {
547
693
  const side = pin.kind === "undo" ? "prev" : "next";
548
694
  for (const cell of entry.edits) {
@@ -59,6 +59,9 @@ export declare function gridOverlayValue<Row>(cell: GridEditCell<Row>, side: "ne
59
59
  * with no `historyPrev`), else what was typed. An app's own `history` snapshots set both sides and are not editor
60
60
  * values; what the app stored beside them is kept as `storedNext`. */
61
61
  export declare function gridKeptValue<Row>(cell: GridEditCell<Row>, side: "next" | "prev"): unknown;
62
+ /** What an undo (`prev`) or a redo (`next`) draws over its cell from its press until the rows show it: a figure's number
63
+ * (`shown`), else the editor value the side holds as the rows read it (`gridKeptValue`). */
64
+ export declare function gridRestoreShown<Row>(cell: GridEditCell<Row>, side: "next" | "prev"): unknown;
62
65
  /** An edit written over a cell while ⌘Z or ⌘⇧Z waited carries what that press put back, as what its own undo puts
63
66
  * back: its `prev`, and its `historyPrev` only where the app answered it with its own snapshots. */
64
67
  export declare function carryGridPutBack<Row>(cell: GridEditCell<Row>, prev: unknown, historyPrev: unknown): GridEditCell<Row>;
@@ -67,6 +67,9 @@ export function gridKeptValue(cell, side) {
67
67
  return cell.historyNext;
68
68
  return gridEditValue(cell, side);
69
69
  }
70
+ export function gridRestoreShown(cell, side) {
71
+ return cell.shown ? cell.shown[side] : gridKeptValue(cell, side);
72
+ }
70
73
  export function carryGridPutBack(cell, prev, historyPrev) {
71
74
  return "historyPrev" in cell ? { ...cell, prev, historyPrev } : { ...cell, prev };
72
75
  }
@@ -0,0 +1,24 @@
1
+ import type { GridCellCommitFn, GridCellsCommitFn, GridCommitContext, ListSave } from "./commit-model.js";
2
+ export type GridSaveOptions<Row> = {
3
+ /** The record's id, which `save` is sent as `id`. */
4
+ getRowId: (row: Row) => string;
5
+ /** One cell's change as the values `save` is sent; throw to refuse it (its message is said through the toast).
6
+ * Default: `{ [columnId]: value }` (fields bound by their key). */
7
+ values?: (row: Row, columnId: string, value: unknown, context: GridCommitContext) => Record<string, unknown>;
8
+ /** A column's value off a row, to read what `stored` kept. Default: `row[columnId]`. */
9
+ read?: (row: Row, columnId: string) => unknown;
10
+ };
11
+ /**
12
+ * The grid's two commit functions over one save: every write (an edit, a paste, a fill, an undo, a redo) is one call
13
+ * per record, its cells' values merged, and a record has one call in flight at a time, the next waiting for it to
14
+ * settle. When the page goes, every change still waiting is sent at once, marked `closing`, and leaves its record's
15
+ * queue: its own answer settles it; a call already out is not sent again. A cell whose `getRowId` or `values` throws
16
+ * is refused alone; a save that rejects refuses that record's cells with its error. Neither function ever rejects.
17
+ *
18
+ * The queues live in what one call returns: make it once per grid (at module scope, in a `useState` initializer, or a
19
+ * `useMemo` on a stable `save`), never in a render, or each render starts with empty queues.
20
+ */
21
+ export declare function gridSave<Row>(save: ListSave<Row>, options: GridSaveOptions<Row>): {
22
+ onCellCommit: GridCellCommitFn<Row>;
23
+ onCellsCommit: GridCellsCommitFn<Row>;
24
+ };
@@ -0,0 +1,122 @@
1
+ import { isPageClosing, onPageClose } from "../../internal/page-close.js";
2
+ function keptOutcome(stored, keys, kept) {
3
+ if (!stored || !keys.some((key) => key in stored))
4
+ return { status: "confirmed" };
5
+ try {
6
+ return { status: "confirmed", stored: kept() };
7
+ }
8
+ catch {
9
+ return { status: "confirmed" };
10
+ }
11
+ }
12
+ const bindByKey = (_row, columnId, value) => ({ [columnId]: value });
13
+ const readByKey = (row, columnId) => row[columnId];
14
+ export function gridSave(save, options) {
15
+ const { getRowId } = options;
16
+ const values = options.values ?? bindByKey;
17
+ const read = options.read ?? readByKey;
18
+ const records = new Map();
19
+ let waitingCount = 0;
20
+ let closeOff = null;
21
+ const send = (change, settle) => {
22
+ const record = records.get(change.id) ?? { inflight: 0, waiting: [] };
23
+ records.set(change.id, record);
24
+ record.inflight += 1;
25
+ let answer;
26
+ try {
27
+ answer = Promise.resolve(save(change));
28
+ }
29
+ catch (error) {
30
+ answer = Promise.reject(error);
31
+ }
32
+ void answer
33
+ .then((result) => settle({ ok: true, ...(result?.stored ? { stored: result.stored } : {}) }), (error) => settle({ ok: false, error }))
34
+ .finally(() => {
35
+ record.inflight -= 1;
36
+ if (record.inflight > 0)
37
+ return;
38
+ const next = record.waiting.shift();
39
+ if (next) {
40
+ leftWaiting(1);
41
+ send(next.change, next.settle);
42
+ }
43
+ else
44
+ records.delete(change.id);
45
+ });
46
+ };
47
+ const leftWaiting = (count) => {
48
+ waitingCount -= count;
49
+ if (waitingCount > 0)
50
+ return;
51
+ closeOff?.();
52
+ closeOff = null;
53
+ };
54
+ const sendAll = () => {
55
+ for (const record of records.values()) {
56
+ const waiting = record.waiting.splice(0);
57
+ leftWaiting(waiting.length);
58
+ for (const each of waiting)
59
+ send({ ...each.change, closing: true }, each.settle);
60
+ }
61
+ };
62
+ const admit = (change) => new Promise((settle) => {
63
+ const record = records.get(change.id);
64
+ const closing = isPageClosing();
65
+ if (closing && closeOff)
66
+ sendAll();
67
+ if (!record || record.inflight === 0 || closing) {
68
+ send(closing ? { ...change, closing: true } : change, settle);
69
+ return;
70
+ }
71
+ record.waiting.push({ change, settle });
72
+ waitingCount += 1;
73
+ closeOff ??= onPageClose(sendAll);
74
+ });
75
+ const onCellsCommit = async (edits) => {
76
+ const outcomes = new Array(edits.length);
77
+ const groups = new Map();
78
+ edits.forEach((edit, index) => {
79
+ let id;
80
+ let cellValues;
81
+ let keys;
82
+ try {
83
+ id = getRowId(edit.row);
84
+ cellValues = values(edit.row, edit.columnId, edit.value, edit.context ?? { kind: "commit" });
85
+ keys = Object.keys(cellValues);
86
+ }
87
+ catch (error) {
88
+ outcomes[index] = { status: "failed", error };
89
+ return;
90
+ }
91
+ const group = groups.get(id) ?? { row: edit.row, cells: [], values: {}, closing: false };
92
+ groups.set(id, group);
93
+ if (edit.context?.closing)
94
+ group.closing = true;
95
+ Object.assign(group.values, cellValues);
96
+ group.cells.push({ index, keys });
97
+ });
98
+ await Promise.all([...groups].map(async ([id, group]) => {
99
+ if (group.cells.length === 0)
100
+ return;
101
+ const answer = await admit({
102
+ id,
103
+ row: group.row,
104
+ values: group.values,
105
+ ...(group.closing ? { closing: true } : {}),
106
+ });
107
+ for (const { index, keys } of group.cells) {
108
+ const edit = edits[index];
109
+ if (!answer.ok)
110
+ outcomes[index] = { status: "failed", error: answer.error };
111
+ else
112
+ outcomes[index] = keptOutcome(answer.stored, keys, () => read({ ...group.row, ...group.values, ...answer.stored }, edit.columnId));
113
+ }
114
+ }));
115
+ return outcomes;
116
+ };
117
+ const onCellCommit = async (row, columnId, value, context) => {
118
+ const [outcome] = await onCellsCommit([{ row, columnId, value, ...(context ? { context } : {}) }]);
119
+ return outcome;
120
+ };
121
+ return { onCellCommit, onCellsCommit };
122
+ }
@@ -46,6 +46,9 @@ export type GridSpreadsheetModel<Row> = {
46
46
  /** The list's settings (the grid's `listConfig`): a column they lock takes no write from a
47
47
  * clear, a paste or a fill, and is refused in the sentence an edit of one cell says. */
48
48
  listConfig?: ListSettingsConfig;
49
+ /** The grid's `rowWritable`: a row it refuses takes no write from a clear, a paste or a fill, each of its cells
50
+ * refused as "Cell is read-only". Absent: every row writes as its columns say. */
51
+ rowWritable?: (row: Row) => boolean;
49
52
  };
50
53
  type GridPlannedEdit<Row> = GridEditCell<Row> & {
51
54
  row: Row;
@@ -16,6 +16,12 @@ function cellRefusal(model, col) {
16
16
  return ((col && gridEditRefusal(col, model.listConfig, model.conventions, messages)) ||
17
17
  messages({ key: "views.grid.cell-read-only" }));
18
18
  }
19
+ function rowWrites(model, row) {
20
+ return model.rowWritable?.(row) ?? true;
21
+ }
22
+ function rowRefusal(model) {
23
+ return (model.messages ?? resolveViewsMessage)({ key: "views.grid.cell-read-only" });
24
+ }
19
25
  export function buildGridCopyMatrix(model, rect) {
20
26
  const matrix = [];
21
27
  for (let r = rect.r1; r <= rect.r2; r++) {
@@ -61,10 +67,16 @@ export function planGridClear(model, rect) {
61
67
  if (entry == null)
62
68
  continue;
63
69
  const { row, rowId } = entry;
70
+ const rowOk = rowWrites(model, row);
64
71
  for (let c = rect.c1; c <= rect.c2; c++) {
65
72
  const col = model.visibleColumns[c];
66
73
  if (!col || !columnWritable(col))
67
74
  continue;
75
+ if (!rowOk && !gridColumnLocked(col, model.listConfig)) {
76
+ if (col.clearable || gridBooleanMode(col))
77
+ addRefusal(refusals, rowRefusal(model));
78
+ continue;
79
+ }
68
80
  if (!col.clearable && !gridBooleanMode(col)) {
69
81
  const held = cellEditBaseline(col, row, model.pendingByRow.get(rowId));
70
82
  if (!gridColumnLocked(col, model.listConfig) && !holdsNothing(held))
@@ -137,6 +149,11 @@ export function planGridPaste(model, matrix, anchor, activeRect, selectValuesByC
137
149
  addRefusal(refusals, cellRefusal(model, col));
138
150
  continue;
139
151
  }
152
+ if (!rowWrites(model, row)) {
153
+ skipped++;
154
+ addRefusal(refusals, rowRefusal(model));
155
+ continue;
156
+ }
140
157
  const coerced = coercePaste(col, source, {
141
158
  conventions: model.conventions,
142
159
  messages: model.messages,
@@ -231,6 +248,7 @@ export function planGridFill(model, ranges, focused, targetRowId) {
231
248
  continue;
232
249
  const { row: sourceRow, rowId: sourceRowId } = source;
233
250
  const { row: nextRow, rowId: nextRowId } = next_;
251
+ const rowOk = rowWrites(model, nextRow);
234
252
  for (let c = rect.c1; c <= rect.c2; c++) {
235
253
  const col = model.visibleColumns[c];
236
254
  if (!col || !columnWritable(col))
@@ -240,6 +258,11 @@ export function planGridFill(model, ranges, focused, targetRowId) {
240
258
  addRefusal(refusals, cellRefusal(model, col));
241
259
  continue;
242
260
  }
261
+ if (!rowOk) {
262
+ skipped++;
263
+ addRefusal(refusals, rowRefusal(model));
264
+ continue;
265
+ }
243
266
  const sourceBaseline = cellEditBaseline(col, sourceRow, model.pendingByRow.get(sourceRowId));
244
267
  const empty = sourceBaseline == null || sourceBaseline === "";
245
268
  if (empty && !col.clearable && !gridBooleanMode(col))
@@ -15,8 +15,9 @@ export type { GridGroupByState, GridSortState } from "./chrome/GridColumnMenu.js
15
15
  export type { GridGroupSortOption } from "./chrome/GridGroupMenu.js";
16
16
  export type { GridGroupMenuPart } from "./chrome/grid-group-menu-parts.js";
17
17
  export type { GridRowOpenedFrom } from "./core/row-opened-from.js";
18
- export type { GridCellAt, GridCellPick, GridDeclaredFigure, GridDrawnFigure, GridGroupFigure, GridPages, GroupCountNoun, } from "./chrome/grid-table-props.js";
19
- export type { GridCellCommitFn, GridCellsCommitFn, GridCommitContext, GridCommitOutcome, } from "./core/commit-model.js";
18
+ export type { GridCellAt, GridCellPick, GridDeclaredFigure, GridDrawnFigure, GridGroupFigure, GridMenus, GridPages, GroupCountNoun, } from "./chrome/grid-table-props.js";
19
+ export type { GridCellCommitFn, GridCellsCommitFn, GridCommitContext, GridCommitOutcome, ListChange, ListSave, } from "./core/commit-model.js";
20
+ export { gridSave, type GridSaveOptions } from "./core/save-path.js";
20
21
  export { deriveGridRelationValues, deriveGridSelectValues } from "./core/column-values.js";
21
22
  export { cellCopyText, cellEditBaseline } from "./core/clipboard-model.js";
22
23
  export { GRID_TITLE_LINK_CLASS } from "./chrome/grid-cell-classes.js";
@@ -1,6 +1,7 @@
1
1
  export { useGridTablePrefs } from "./useGridTablePrefs.js";
2
2
  export { useGridTableSettings } from "./useGridTableSettings.js";
3
3
  export { GridTable } from "./chrome/GridTable.js";
4
+ export { gridSave } from "./core/save-path.js";
4
5
  export { deriveGridRelationValues, deriveGridSelectValues } from "./core/column-values.js";
5
6
  export { cellCopyText, cellEditBaseline } from "./core/clipboard-model.js";
6
7
  export { GRID_TITLE_LINK_CLASS } from "./chrome/grid-cell-classes.js";
@@ -0,0 +1,26 @@
1
+ import * as React from "react";
2
+ /** Field rows' card, as a Field in it sees it: where its note and error go, under the card. */
3
+ export interface FieldRowsCard {
4
+ /** A Field joins the card as it comes, and leaves it as it goes: the foot keeps its Fields' notes in that order, the rows'. */
5
+ enter(id: string): () => void;
6
+ /** A Field says whether it has a note or an error to show under the card; the card draws its foot while any does. */
7
+ need(id: string, on: boolean): void;
8
+ /** The Field's own place in the foot, once drawn: it portals its note and error into it. */
9
+ slot(id: string): HTMLElement | null;
10
+ }
11
+ export declare const FieldRowsCardContext: React.Context<FieldRowsCard | null>;
12
+ /** True inside a computer's SettingRows whose Fields option is At the end (VK-985): a Field placed in it is one of its rows, its
13
+ * control at the row's end. */
14
+ export declare const SettingRowField: React.Context<boolean>;
15
+ /** What stands at the end of such a Field row, and the row's name when its label is words: a RadioGroup there draws as a Select
16
+ * of its Radios, named by it. */
17
+ export declare const AtSettingRowEnd: React.Context<{
18
+ name?: string;
19
+ } | null>;
20
+ /** True inside a Field drawn as a row of Field rows: its Input or InputGroup stands typed in place, with no box. */
21
+ export declare const InFieldRow: React.Context<boolean>;
22
+ /** A place of its own: what it holds stands as it does anywhere else, no row of a Field rows card around it, whatever holds it.
23
+ * A popup, an editor and a record's row are each one (React's context reaches through a portal). */
24
+ export declare function OutOfFieldRows({ children }: {
25
+ children?: React.ReactNode;
26
+ }): React.ReactNode;
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ export const FieldRowsCardContext = React.createContext(null);
3
+ export const SettingRowField = React.createContext(false);
4
+ export const AtSettingRowEnd = React.createContext(null);
5
+ export const InFieldRow = React.createContext(false);
6
+ export function OutOfFieldRows({ children }) {
7
+ return React.createElement(FieldRowsCardContext.Provider, { value: null }, React.createElement(InFieldRow.Provider, { value: false }, React.createElement(SettingRowField.Provider, { value: false }, React.createElement(AtSettingRowEnd.Provider, { value: null }, children))));
8
+ }
@@ -0,0 +1,7 @@
1
+ export type PageClosePhase = "drafts" | "sends";
2
+ /** Whether the page is going: from its `pagehide` until a `pageshow` brings it back (the back-forward cache). False
3
+ * where there is no window. */
4
+ export declare function isPageClosing(): boolean;
5
+ /** Calls `flush` inside the page's `pagehide`, synchronously, in the order the flushes were added: every `"drafts"`
6
+ * flush, then every `"sends"` one. Returns what takes it off. Nothing where there is no window. */
7
+ export declare function onPageClose(flush: () => void, phase?: PageClosePhase): () => void;