nexus-shared 3.0.0 → 3.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 (162) hide show
  1. package/CHANGELOG.md +442 -0
  2. package/README.md +1123 -1000
  3. package/dist/Client.Index.d.ts +6 -0
  4. package/dist/Client.Index.js +6 -0
  5. package/dist/Components/Chats/ChatParts.d.ts +2 -2
  6. package/dist/Components/Chats/ChatParts.js +3 -7
  7. package/dist/Components/Chats/ChatThread.js +3 -3
  8. package/dist/Components/Documents/Button.d.ts +6 -1
  9. package/dist/Components/Documents/Button.js +2 -2
  10. package/dist/Components/Documents/Menu.js +21 -9
  11. package/dist/Components/Documents/SplitButton.d.ts +3 -1
  12. package/dist/Components/Documents/SplitButton.js +7 -5
  13. package/dist/Components/Documents/TabButtons.d.ts +5 -2
  14. package/dist/Components/Documents/TabButtons.js +2 -2
  15. package/dist/Components/Forms/ApiForm.d.ts +1 -1
  16. package/dist/Components/Forms/ApiForm.js +1 -1
  17. package/dist/Components/Forms/Crud.js +486 -206
  18. package/dist/Components/Forms/CrudHistory.d.ts +66 -0
  19. package/dist/Components/Forms/CrudHistory.js +140 -0
  20. package/dist/Components/Forms/CrudParts.d.ts +5 -1
  21. package/dist/Components/Forms/CrudParts.js +38 -5
  22. package/dist/Components/Forms/ExcelImport.d.ts +23 -7
  23. package/dist/Components/Forms/ExcelImport.js +189 -60
  24. package/dist/Components/Forms/Form.js +9 -14
  25. package/dist/Components/Forms/SubmitForm.d.ts +11 -2
  26. package/dist/Components/Forms/SubmitForm.js +23 -12
  27. package/dist/Components/Inputs/CodeBox.d.ts +69 -0
  28. package/dist/Components/Inputs/CodeBox.js +316 -0
  29. package/dist/Components/Inputs/DatePicker.js +4 -1
  30. package/dist/Components/Inputs/DateRangePicker.js +4 -1
  31. package/dist/Components/Inputs/DateTimePicker.js +4 -1
  32. package/dist/Components/Inputs/Dropdown.js +4 -1
  33. package/dist/Components/Inputs/DropdownParts.d.ts +1 -1
  34. package/dist/Components/Inputs/DropdownParts.js +4 -6
  35. package/dist/Components/Inputs/InputRenderer.js +3 -0
  36. package/dist/Components/Inputs/NumberBox.js +26 -2
  37. package/dist/Components/Inputs/RowsInput.js +2 -2
  38. package/dist/Components/Inputs/Slider.js +4 -1
  39. package/dist/Components/Inputs/TabularForm.js +42 -10
  40. package/dist/Components/Inputs/TextArea.js +4 -1
  41. package/dist/Components/Inputs/TextBox.js +4 -1
  42. package/dist/Components/Inputs/TimePanel.js +4 -3
  43. package/dist/Components/Inputs/TimePicker.js +4 -1
  44. package/dist/Components/Inputs/TreeView.d.ts +55 -5
  45. package/dist/Components/Inputs/TreeView.js +372 -23
  46. package/dist/Components/Layouts/Popup.js +1 -4
  47. package/dist/Components/Layouts/ThemePicker.d.ts +21 -3
  48. package/dist/Components/Layouts/ThemePicker.js +89 -6
  49. package/dist/Components/Layouts/ThemeScript.d.ts +4 -2
  50. package/dist/Components/Layouts/ThemeScript.js +4 -2
  51. package/dist/Components/Layouts/ThemeSwitcher.d.ts +6 -3
  52. package/dist/Components/Layouts/ThemeSwitcher.js +9 -8
  53. package/dist/Components/Viewers/Avatar.d.ts +21 -0
  54. package/dist/Components/Viewers/Avatar.js +21 -0
  55. package/dist/Components/Viewers/DataTable.js +252 -62
  56. package/dist/Components/Viewers/DataTableColumns.d.ts +7 -3
  57. package/dist/Components/Viewers/DataTableColumns.js +25 -68
  58. package/dist/Components/Viewers/DataTableFilters.d.ts +21 -0
  59. package/dist/Components/Viewers/DataTableFilters.js +68 -0
  60. package/dist/Components/Viewers/DataTableParts.d.ts +28 -10
  61. package/dist/Components/Viewers/DataTableParts.js +42 -13
  62. package/dist/Helpers/AnimationHelpers.d.ts +11 -0
  63. package/dist/Helpers/AnimationHelpers.js +20 -2
  64. package/dist/Helpers/ApiModules.d.ts +3 -34
  65. package/dist/Helpers/ApiModules.js +3 -3
  66. package/dist/Helpers/ApiRoutes.d.ts +68 -26
  67. package/dist/Helpers/ApiRoutes.js +31 -27
  68. package/dist/Helpers/ArrayHelpers.d.ts +0 -0
  69. package/dist/Helpers/ArrayHelpers.js +2 -0
  70. package/dist/Helpers/CodeHelpers.d.ts +97 -0
  71. package/dist/Helpers/CodeHelpers.js +332 -0
  72. package/dist/Helpers/CrudBackend.d.ts +101 -8
  73. package/dist/Helpers/CrudBackend.js +172 -11
  74. package/dist/Helpers/CrudColumns.d.ts +51 -0
  75. package/dist/Helpers/CrudColumns.js +69 -0
  76. package/dist/Helpers/CrudHelpers.d.ts +50 -5
  77. package/dist/Helpers/CrudHelpers.js +109 -12
  78. package/dist/Helpers/ExcelBackend.d.ts +3 -3
  79. package/dist/Helpers/ExcelBackend.js +8 -2
  80. package/dist/Helpers/ExcelHelpers.d.ts +36 -8
  81. package/dist/Helpers/ExcelHelpers.js +55 -13
  82. package/dist/Helpers/FormStore.d.ts +9 -5
  83. package/dist/Helpers/FormStore.js +25 -5
  84. package/dist/Helpers/InputParamsHelpers.js +8 -0
  85. package/dist/Helpers/MessageBuilder.js +3 -0
  86. package/dist/Helpers/NexusHelpers.d.ts +0 -0
  87. package/dist/Helpers/NexusHelpers.js +1 -0
  88. package/dist/Helpers/NumberHelpers.d.ts +7 -1
  89. package/dist/Helpers/NumberHelpers.js +41 -3
  90. package/dist/Helpers/PopoverHelpers.d.ts +17 -5
  91. package/dist/Helpers/PopoverHelpers.js +52 -17
  92. package/dist/Helpers/PopoverHooks.d.ts +24 -0
  93. package/dist/Helpers/PopoverHooks.js +62 -0
  94. package/dist/Helpers/RequestCache.d.ts +35 -0
  95. package/dist/Helpers/RequestCache.js +113 -0
  96. package/dist/Helpers/RowsStore.d.ts +7 -2
  97. package/dist/Helpers/RowsStore.js +15 -3
  98. package/dist/Helpers/TableFilters.d.ts +25 -0
  99. package/dist/Helpers/TableFilters.js +162 -0
  100. package/dist/Helpers/TableHelpers.d.ts +7 -4
  101. package/dist/Helpers/TableHelpers.js +15 -6
  102. package/dist/Helpers/TableJoins.d.ts +70 -0
  103. package/dist/Helpers/TableJoins.js +250 -0
  104. package/dist/Helpers/TableStore.d.ts +16 -3
  105. package/dist/Helpers/TableStore.js +25 -5
  106. package/dist/Helpers/ThemeHelpers.d.ts +21 -4
  107. package/dist/Helpers/ThemeHelpers.js +46 -9
  108. package/dist/Helpers/TreeStore.d.ts +225 -11
  109. package/dist/Helpers/TreeStore.js +683 -90
  110. package/dist/Helpers/UserPreferences.d.ts +22 -0
  111. package/dist/Helpers/UserPreferences.js +116 -0
  112. package/dist/Interfaces/CrudInterfaces.d.ts +67 -10
  113. package/dist/Interfaces/ExcelInterfaces.d.ts +12 -0
  114. package/dist/Interfaces/FormInterfaces.d.ts +37 -6
  115. package/dist/Interfaces/InputInterfaces.d.ts +24 -0
  116. package/dist/Interfaces/MessageInterfaces.d.ts +1 -1
  117. package/dist/Interfaces/PreferenceInterfaces.d.ts +51 -0
  118. package/dist/Interfaces/PreferenceInterfaces.js +25 -0
  119. package/dist/Interfaces/TableInterfaces.d.ts +145 -16
  120. package/dist/Interfaces/ThemeInterfaces.d.ts +25 -0
  121. package/dist/Interfaces/ThemeInterfaces.js +15 -0
  122. package/dist/Services/ApiProxy.d.ts +36 -1
  123. package/dist/Services/ApiProxy.js +182 -52
  124. package/dist/Services/ApiProxyRules.d.ts +203 -0
  125. package/dist/Services/ApiProxyRules.js +426 -0
  126. package/dist/Services/ExcelApi.d.ts +3 -1
  127. package/dist/Services/ExcelApi.js +1 -1
  128. package/dist/Services/JoinSources.d.ts +48 -0
  129. package/dist/Services/JoinSources.js +74 -0
  130. package/dist/Services/ServerApi.d.ts +13 -2
  131. package/dist/Services/ServerApi.js +8 -3
  132. package/dist/Services/ThemeService.d.ts +18 -2
  133. package/dist/Services/ThemeService.js +80 -16
  134. package/dist/Shared.Index.d.ts +6 -0
  135. package/dist/Shared.Index.js +6 -0
  136. package/package.json +4 -2
  137. package/src/Styles/Nexus.Avatar.css +79 -0
  138. package/src/Styles/Nexus.Base.css +51 -4
  139. package/src/Styles/Nexus.Button.css +27 -0
  140. package/src/Styles/Nexus.Calendar.css +4 -6
  141. package/src/Styles/Nexus.Chat.css +5 -51
  142. package/src/Styles/Nexus.Choice.css +4 -6
  143. package/src/Styles/Nexus.Crud.css +16 -9
  144. package/src/Styles/Nexus.Dropdown.css +12 -61
  145. package/src/Styles/Nexus.Editor.css +4 -6
  146. package/src/Styles/Nexus.Excel.css +34 -15
  147. package/src/Styles/Nexus.Form.css +25 -67
  148. package/src/Styles/Nexus.Index.css +1 -0
  149. package/src/Styles/Nexus.Input.css +794 -637
  150. package/src/Styles/Nexus.Markdown.css +0 -28
  151. package/src/Styles/Nexus.Menu.css +8 -30
  152. package/src/Styles/Nexus.Popup.css +22 -29
  153. package/src/Styles/Nexus.RichText.css +2 -32
  154. package/src/Styles/Nexus.Rows.css +51 -10
  155. package/src/Styles/Nexus.Slider.css +3 -5
  156. package/src/Styles/Nexus.Tab.Buttons.css +20 -7
  157. package/src/Styles/Nexus.Table.css +1387 -1296
  158. package/src/Styles/Nexus.Theme.Picker.css +342 -232
  159. package/src/Styles/Nexus.Time.css +9 -12
  160. package/src/Styles/Nexus.Toast.css +6 -8
  161. package/src/Styles/Nexus.Tokens.css +17 -0
  162. package/src/Styles/Nexus.Tree.css +76 -11
@@ -1,3 +1,4 @@
1
+ import { RequestCache } from "./RequestCache.ts";
1
2
  export type TreeValue = string | number;
2
3
  /** An item of a tree: any object with a value, a parent value, and a label under the keys the tree is given. */
3
4
  export type TreeItem = object;
@@ -25,9 +26,79 @@ export interface TreeStoreOptions<TItem extends TreeItem = TreeItem> {
25
26
  cascade?: boolean;
26
27
  /** Default `leaves`. Ignored without `cascade`, where the value is every checked item. */
27
28
  valueMode?: TreeValueMode;
29
+ /**
30
+ * Children come later, a page at a time: a node with none loaded yet can be expanded, and `rows` shows its loading,
31
+ * failed, or Load more state. A node whose children come in the items counts as loaded. Default false.
32
+ */
33
+ lazy?: boolean;
34
+ /** With `lazy`: the top level comes from the loader too, and the items given (if any) are only a start. Default false. */
35
+ lazyRoots?: boolean;
36
+ /**
37
+ * With `lazy`: the item field saying whether it has children before they are loaded - a boolean, or a count (more
38
+ * than 0). Without it, or when the field is empty, a node counts as having children until its first page answers.
39
+ */
40
+ hasChildrenKey?: string;
41
+ }
42
+ /** A row that is not an item, under a parent of a lazy tree: its page is on its way, failed (Retry), or more can be loaded. */
43
+ export type TreeStatusKind = "loading" | "error" | "more";
44
+ /** Where a lazy parent's children stand: what was asked of the loader, and what it said. */
45
+ export interface TreeChildPages {
46
+ /** `idle`: nothing asked yet; `loading`: a page is on its way; `failed`: the last page failed; `ready`: answered. */
47
+ status: "idle" | "loading" | "failed" | "ready";
48
+ /** Children the loader gave so far, as it counted them: the next page skips this many. */
49
+ loaded: number;
50
+ /** All of the parent's children on the server, when the loader said. */
51
+ total?: number;
52
+ /** Whether another page follows. */
53
+ hasMore: boolean;
54
+ /** A refresh made the pages old: they are drawn until fresh ones replace them. */
55
+ stale: boolean;
56
+ /** The request now current; an answer to an older one is ignored. */
57
+ request: number;
58
+ }
59
+ /** What a lazy tree's loader is asked for: one page of a parent's children. */
60
+ export interface TreeChildrenRequest<TItem extends TreeItem = TreeItem> {
61
+ /** The item whose children to load, or `null` for the top level. */
62
+ parent: TItem | null;
63
+ /** Its value, or `null` for the top level. */
64
+ parentValue: TreeValue | null;
65
+ /** Children already loaded: the page starts after them (an API's skip count). */
66
+ skip: number;
67
+ /** The most to return: the page size (an API's max count). */
68
+ take: number;
69
+ /** Aborted when the tree unmounts before the answer, unless a `cacheKey` keeps the answer for the next tree. */
70
+ signal: AbortSignal;
28
71
  }
72
+ /** One page of children, as the loader answers it. */
73
+ export interface TreeChildrenPage<TItem extends TreeItem = TreeItem> {
74
+ /** The children, in order. Their parent field is not read: they go under the parent that was asked for. */
75
+ items: readonly TItem[];
76
+ /** All of the parent's children on the server: Load more says how many are left. */
77
+ total?: number;
78
+ /** Whether another page follows. Default: `total` says so, or the page was full. */
79
+ hasMore?: boolean;
80
+ }
81
+ /** Children's pages kept for every lazy tree on the page that names a `cacheKey`, for 5 minutes: see `RequestCache`. */
82
+ export declare const treePages: RequestCache<TreeChildrenPage<object>>;
83
+ /** The start of every key a tree keeps its pages under, or one parent's pages (`null`: the top level). */
84
+ export declare function treePagesKey(cacheKey: string, parent?: TreeValue | null): string;
85
+ /** The key one page is kept under. */
86
+ export declare function treePageKey(cacheKey: string, parent: TreeValue | null, skip: number, take: number): string;
87
+ /**
88
+ * Drops the kept pages of a tree's source - all of them, one parent's (`null`: the top level), or several parents' -
89
+ * after the records behind them changed elsewhere. Returns how many were dropped. A tree on screen keeps what it shows:
90
+ * its `refresh()` loads that again.
91
+ */
92
+ export declare function expireTreePages(cacheKey: string, parent?: TreeValue | null | readonly (TreeValue | null)[]): number;
93
+ /** A has-children field read as the tree reads it: a boolean, or a count above 0; `undefined` when it says nothing. */
94
+ export declare function treeHasChildren(value: unknown): boolean | undefined;
95
+ /** The key of the status row under a parent (`null`: the top level), as `TreeNode.key` holds it. */
96
+ export declare function treeStatusKey(parentKey: string | null): string;
29
97
  export interface TreeNode<TItem extends TreeItem = TreeItem> {
30
- /** A number unique to this node for its whole life, for React keys and element ids. */
98
+ /**
99
+ * A number unique to this node in its store for its whole life, for React keys and element ids. Counted per store,
100
+ * so a tree rendered on the server numbers its rows as the browser does.
101
+ */
31
102
  readonly uid: number;
32
103
  /** The value as text: the key in maps, so `7` and `"7"` are the same item. */
33
104
  key: string;
@@ -59,6 +130,19 @@ export interface TreeNode<TItem extends TreeItem = TreeItem> {
59
130
  openChecked: number;
60
131
  /** Being created and not saved yet: not part of the value or the items. */
61
132
  draft: boolean;
133
+ /** With `lazy`: where its children's pages stand. */
134
+ pages?: TreeChildPages;
135
+ /**
136
+ * With `lazy`: not everything under it is loaded yet - its own pages, or a node's under it. With `cascade` such a node
137
+ * cannot be checked or unchecked as a whole (see `TreeStore.toggle`), and never shows checked unless the value names it.
138
+ */
139
+ partial: boolean;
140
+ /**
141
+ * Set only on a status row, a row that is not an item: under its `parent` (`null`: the top level) a page is on its
142
+ * way, failed, or more can be loaded. A status row is in `rows` only - never in `children`, the value, or the items -
143
+ * and its `item` is an empty object.
144
+ */
145
+ status?: TreeStatusKind;
62
146
  }
63
147
  /** What expanding or collapsing did to the visible rows, for an animation. */
64
148
  export interface TreeRowsChange<TItem extends TreeItem = TreeItem> {
@@ -86,12 +170,31 @@ export declare class TreeStore<TItem extends TreeItem = TreeItem> {
86
170
  readonly labelKey: string;
87
171
  readonly cascade: boolean;
88
172
  readonly valueMode: TreeValueMode;
173
+ /** Children come a page at a time from a loader. */
174
+ readonly lazy: boolean;
175
+ private readonly hasChildrenKey;
89
176
  private readonly isDisabled;
90
177
  private readonly isChecked;
91
178
  roots: TreeNode<TItem>[];
92
- /** The visible rows in order: top-level items, and the children of every expanded item whose parents are expanded. A new array after each change. */
179
+ /**
180
+ * The visible rows in order: top-level items, and the children of every expanded item whose parents are expanded,
181
+ * with a lazy parent's status row after its children. A new array after each change.
182
+ */
93
183
  rows: readonly TreeNode<TItem>[];
184
+ /** With `lazyRoots`: where the top level's pages stand. `null` when the top level comes from the items. */
185
+ rootPages: TreeChildPages | null;
94
186
  private byKey;
187
+ /** The status row of each lazy parent that has had one, by the parent's key ("" for the top level). */
188
+ private statusRows;
189
+ /**
190
+ * With `lazy`: checked values whose items are not loaded yet, or not settled (see `settle`). They stay in the value,
191
+ * and check their items when the items come, so a saved value is never lost to a page not opened yet.
192
+ */
193
+ private pending;
194
+ /** Whether the checks came from a value rather than from the items' own flags; items that come later follow the same rule. */
195
+ private valueGiven;
196
+ private requests;
197
+ private nextUid;
95
198
  /** Without `cascade`: checked nodes, nodes that are not locked, and the checked ones among them. */
96
199
  private checkedNodes;
97
200
  private openNodes;
@@ -102,33 +205,53 @@ export declare class TreeStore<TItem extends TreeItem = TreeItem> {
102
205
  get size(): number;
103
206
  /** The node of a value. */
104
207
  get(value: TreeValue | null | undefined): TreeNode<TItem> | undefined;
208
+ /** The node or status row whose `key` this is: what a view keeps for its focused row. */
209
+ find(key: string): TreeNode<TItem> | undefined;
210
+ /** Where a lazy parent's children stand (`null`: the top level); `undefined` when they do not come from a loader. */
211
+ pagesOf(parent: TreeNode<TItem> | null): TreeChildPages | undefined;
105
212
  /**
106
213
  * Replaces the items. Expanded items stay expanded. The checked items come from `value` when given, otherwise from
107
- * the items' own flags.
214
+ * the items' own flags. In a lazy tree, an item whose children were loaded keeps them, unless the items now give it
215
+ * children of their own.
108
216
  */
109
217
  setItems(items: readonly TItem[], value?: readonly TreeValue[]): void;
218
+ /** Moves the loaded children (and pages) of a node that is being built again onto its new node. */
219
+ private adoptChildren;
110
220
  /** Every item in tree order, without drafts. */
111
221
  items(): TItem[];
112
222
  /** A node and everything under it, in tree order. */
113
223
  subtree(node: TreeNode<TItem>): TreeNode<TItem>[];
114
224
  /** The node's parents, the top-level one first. */
115
225
  path(node: TreeNode<TItem>): TreeNode<TItem>[];
116
- /** The state of a node's box. */
226
+ /**
227
+ * The state of a node's box. With `cascade`, a lazy parent whose items are not all loaded is never `checked` - its
228
+ * unloaded items are not in the value - unless the value names it (`valueMode: "checked"`, where it stands for all).
229
+ */
117
230
  state(node: TreeNode<TItem>): TreeCheckState;
118
231
  /** Checked boxes and all boxes: leaves with `cascade`, every item without it. Drafts count. */
119
232
  counts(): {
120
233
  checked: number;
121
234
  total: number;
122
235
  };
123
- /** The checked values, in tree order, following `valueMode`. */
236
+ /**
237
+ * The checked values, in tree order, following `valueMode`. In a lazy tree, values whose items are not loaded yet
238
+ * (or not settled) follow the others, so a saved value survives until its items come.
239
+ */
124
240
  value(): TreeValue[];
125
- /** The items of the value, in the same order. */
241
+ /** The items of the value, in the same order. In a lazy tree it holds only the items loaded, so it can be shorter than `value()`. */
126
242
  valueItems(): TItem[];
127
- /** Checks exactly these values. Locks do not apply: this is the saved state, not a user's change. Returns whether anything changed. */
243
+ /**
244
+ * Checks exactly these values. Locks do not apply: this is the saved state, not a user's change. In a lazy tree a
245
+ * value whose item is not loaded is kept, and checks the item when it comes. Returns whether anything changed.
246
+ */
128
247
  setValue(values: readonly TreeValue[]): boolean;
129
248
  /**
130
249
  * What a click on the node's box does. With `cascade` it checks every item under the node that is not locked, or
131
250
  * unchecks them when they are all checked already. Returns whether anything changed; nothing does on a locked node.
251
+ *
252
+ * In a lazy tree with `cascade`, a node whose items are not all loaded (`partial`) does not change either: a check
253
+ * stands for everything under it, and the value can only hold the items that were loaded, so checking it would
254
+ * silently leave the rest out. The items under it whose own items are all loaded can still be checked one by one.
132
255
  */
133
256
  toggle(node: TreeNode<TItem>): boolean;
134
257
  /** Checks or unchecks a node; with `cascade`, every item under it that is not locked. Returns whether anything changed. */
@@ -137,25 +260,65 @@ export declare class TreeStore<TItem extends TreeItem = TreeItem> {
137
260
  allState(): TreeCheckState | null;
138
261
  /** What a click on a "select all" box does: checks every item that is not locked, or unchecks them all when all are checked. */
139
262
  toggleAll(): boolean;
140
- /** Checks or unchecks every item that is not locked. Returns whether anything changed. */
263
+ /**
264
+ * Checks or unchecks every item that is not locked. Returns whether anything changed. In a lazy tree with `cascade`,
265
+ * a node whose items are not all loaded is passed over and the loaded parts under it are changed; values whose
266
+ * items are not loaded stay as they are.
267
+ */
141
268
  checkAll(checked: boolean): boolean;
142
269
  /** Whether every parent of the node is expanded, so the node is a row. */
143
270
  isVisible(node: TreeNode<TItem>): boolean;
271
+ /** Whether the node can be expanded: it has children, or (lazy) it may have some not loaded yet. */
272
+ canExpand(node: TreeNode<TItem>): boolean;
144
273
  /** The node's row index, or -1 when it is not a row. */
145
274
  indexOf(node: TreeNode<TItem>): number;
146
- /** Expands a node. Returns the rows it added, or `null` when no rows changed. */
275
+ /** Expands a node. Returns the rows it added (a lazy node's status row too), or `null` when no rows changed. */
147
276
  expand(node: TreeNode<TItem>): TreeRowsChange<TItem> | null;
148
277
  /** Collapses a node. Returns the rows it removed, or `null` when no rows changed. */
149
278
  collapse(node: TreeNode<TItem>): TreeRowsChange<TItem> | null;
150
- /** Expands every item, or only the first `levels` levels (1 expands the top-level items). */
279
+ /**
280
+ * Expands every item, or only the first `levels` levels (1 expands the top-level items). In a lazy tree it opens the
281
+ * items whose children are loaded, and asks for nothing: a node open on a page still on its way stays open.
282
+ */
151
283
  expandAll(levels?: number): void;
152
284
  collapseAll(): void;
153
- /** Expands these items and their parents, so the items and their children show. */
285
+ /** Expands these items and their parents, so the items and their children show. In a lazy tree, only items whose children are loaded. */
154
286
  expandValues(values: readonly TreeValue[]): void;
155
287
  /** The values of the expanded items, in tree order. */
156
288
  expandedValues(): TreeValue[];
157
289
  /** Expands the parents of a node so it becomes a row. Returns whether rows changed. */
158
290
  reveal(node: TreeNode<TItem>): boolean;
291
+ /**
292
+ * Marks a parent's next page as on its way (`null`: the top level) and returns the request's number, which the
293
+ * answer is given back with. An earlier request still out is forgotten. Returns 0 when the parent has no pages.
294
+ */
295
+ beginLoad(parent: TreeNode<TItem> | null): number;
296
+ /**
297
+ * Adds a page of children that `request` asked for, after the ones loaded, and works out what follows: `hasMore`
298
+ * when the page says, else whether `total` is reached, else whether the page was full (`take` items). Their parent
299
+ * field is not read: they go under `parent`. A value already in the tree is passed over, so a page that overlaps
300
+ * the last one adds no row twice. Returns the nodes added and the rows they added (for an animation), or `null` when
301
+ * the answer is to an older request or the parent is gone.
302
+ */
303
+ receivePage(parent: TreeNode<TItem> | null, request: number, page: TreeChildrenPage<TItem>, take: number): {
304
+ added: TreeNode<TItem>[];
305
+ change: TreeRowsChange<TItem> | null;
306
+ } | null;
307
+ /** The page `request` asked for failed: the parent shows a failed row with Retry. Returns false for an older request. */
308
+ failLoad(parent: TreeNode<TItem> | null, request: number): boolean;
309
+ /**
310
+ * Replaces a parent's children with fresh pages after a refresh (`request` from `beginLoad`): an item still there
311
+ * keeps its node - what is expanded and loaded under it - and takes the fresh item; one no longer there goes, and a
312
+ * value it held waits in the value for its item to come back. Returns false for an older request.
313
+ */
314
+ replacePages(parent: TreeNode<TItem> | null, request: number, answers: readonly TreeChildrenPage<TItem>[], take: number): boolean;
315
+ /**
316
+ * Marks loaded pages old, for a refresh: every lazy parent (`null`), or a node and everything under it. The view
317
+ * loads again the ones on screen, and the rest load when next expanded; a page on its way is forgotten, and a node
318
+ * that had answered with no children may have some now.
319
+ */
320
+ markStale(node?: TreeNode<TItem> | null): void;
321
+ private stalePages;
159
322
  /**
160
323
  * Adds an item under `parent` (at the top level for `null`), as its last child unless `index` is given, and expands
161
324
  * the parent. A `draft` is not part of the value or the items until `update` saves it. Throws on a value in use.
@@ -164,6 +327,12 @@ export declare class TreeStore<TItem extends TreeItem = TreeItem> {
164
327
  index?: number;
165
328
  draft?: boolean;
166
329
  }): TreeNode<TItem>;
330
+ /**
331
+ * Adds many items under `parent` (at the top level for `null`) after its children, in one pass: counts are updated
332
+ * along one path, not over the whole tree, so a page of 50 joins a tree of 100,000 in well under a millisecond. A
333
+ * value already in the tree is passed over. The parent is not expanded. Returns the nodes added.
334
+ */
335
+ insertMany(parent: TreeNode<TItem> | null, items: readonly TItem[]): TreeNode<TItem>[];
167
336
  /**
168
337
  * Replaces a node's item, e.g. after a rename, or once a draft is saved and the server gave it an id. The value can
169
338
  * change; the parent cannot. Throws on a value another item uses.
@@ -174,11 +343,56 @@ export declare class TreeStore<TItem extends TreeItem = TreeItem> {
174
343
  /** Removes a node and everything under it. Returns the removed nodes in tree order. */
175
344
  remove(node: TreeNode<TItem>): TreeNode<TItem>[];
176
345
  private createNode;
346
+ /** A lazy node's pages before anything is asked: none to ask for when its item says it has no children. */
347
+ private newPages;
348
+ /** Whether a parent (`null`: the top level) is still in the tree, so an answer for it applies. */
349
+ private owns;
350
+ /** After a parent's pages changed state: its `partial` and counts along its path, and its rows. */
351
+ private changedPages;
352
+ /**
353
+ * Creates nodes for items under a parent, after its children, and updates counts along the parent's path only. A
354
+ * value already in the tree is passed over.
355
+ */
356
+ private addNodes;
357
+ /** Adds (1) or takes away (-1) nodes' share of the counts kept for a tree without `cascade`. */
358
+ private count;
359
+ /** Whether an item that has just come starts checked: its value is waiting, a parent's value stands for it, or its own flag. */
360
+ private arrivalChecked;
361
+ /**
362
+ * Whether a waiting value is settled now that its item is here, so the tree's own checks say it all:
363
+ * - without `cascade`, at once - the item is its own value, and came checked;
364
+ * - with `cascade`, a parent named in a value of leaves (or of every parent with a checked item) means nothing, as in
365
+ * a tree loaded whole;
366
+ * - with `cascade`, any other waits until everything under its item is loaded: an unloaded item, or a "checked"-mode
367
+ * parent that stands for all of its items, loaded or not.
368
+ */
369
+ private settle;
370
+ private settleAll;
371
+ private settleAround;
372
+ private dropClaimsAbove;
373
+ /** With `cascade`: the highest nodes whose items are all loaded - the roots, or below a partial node its loaded parts. */
374
+ private settledTops;
375
+ /**
376
+ * Fresh items in place of a parent's children: a node whose value is still there is kept (with what is expanded and
377
+ * loaded under it) and takes the fresh item; one not there goes, unless it is a draft being named.
378
+ */
379
+ private reconcile;
380
+ /** Rows again for a parent's block (`null`: every row), when it is expanded and a row: its children's rows and its status row. */
381
+ private refreshBlock;
382
+ /** The rows these nodes show - each node, then the rows of its children when it is expanded - and, in a lazy tree, each expanded parent's status row after its children. `parent` owns `nodes`, for its own status row. */
383
+ private visibleRows;
384
+ /** The status row an expanded parent (`null`: the top level) shows after its children, if its pages need one. */
385
+ private statusRowOf;
177
386
  private keysOf;
178
387
  /** With `valueMode: "checked"`, a parent in the value stands for all of its items. */
179
388
  private checkedByParent;
180
389
  /** Locks and counts for every node, given in tree order: parents pass locks down, children pass counts up. */
181
390
  private recount;
391
+ /**
392
+ * A node's lock, `partial`, and counts, from its own flags and its children's (already worked out): what `recount`
393
+ * does for every node, and what a page of children does for each node on its parent's path.
394
+ */
395
+ private aggregate;
182
396
  /** Sets every open leaf under a node (the node itself for a leaf), updating counts up the path of each leaf that changes. */
183
397
  private setLeaves;
184
398
  private setNodeChecked;