@nanahoshi/mona-ui 0.24.7 → 0.24.9

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 (97) hide show
  1. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  2. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +37 -9
  3. package/fesm2022/nanahoshi-mona-ui-button.mjs +8 -2
  4. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +4 -3
  5. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  6. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +101 -47
  7. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +339 -101
  8. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +119 -69
  9. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1 -1
  10. package/fesm2022/nanahoshi-mona-ui-editor.mjs +2 -2
  11. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-vXXNWmEN.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs} +2 -2
  12. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-DDgNmgE0.mjs → nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs} +4 -4
  13. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-Dzf6Vbs_.mjs → nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs} +2 -3
  14. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DAPNqnWV.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs} +4 -4
  15. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-B9rmDLq8.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs} +10 -10
  16. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  17. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +44 -3
  18. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +20 -4
  19. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +335 -45
  20. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +565 -197
  21. package/fesm2022/nanahoshi-mona-ui-internal.mjs +465 -23
  22. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +598 -208
  23. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +193 -71
  24. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +29 -3
  25. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -3
  26. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -3
  27. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +40 -3
  28. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +29 -3
  29. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -3
  30. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +29 -3
  31. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +29 -3
  32. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -3
  33. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +49 -3
  34. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +29 -3
  35. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +29 -3
  36. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +29 -3
  37. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +127 -133
  38. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1 -1
  39. package/fesm2022/nanahoshi-mona-ui-notification.mjs +473 -240
  40. package/fesm2022/nanahoshi-mona-ui-popover.mjs +202 -90
  41. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +609 -256
  42. package/fesm2022/nanahoshi-mona-ui-popup.mjs +2 -0
  43. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +45 -10
  44. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +102 -58
  45. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +286 -443
  46. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +205 -140
  47. package/fesm2022/nanahoshi-mona-ui-window.mjs +591 -310
  48. package/i18n/catalogs/en-US.messages.json +32 -6
  49. package/locales/ar-sa/ar-sa.messages.json +29 -3
  50. package/locales/de-de/de-de.messages.json +29 -3
  51. package/locales/es-es/es-es.messages.json +29 -3
  52. package/locales/fr-fr/fr-fr.messages.json +29 -3
  53. package/locales/id-id/id-id.messages.json +29 -3
  54. package/locales/it-it/it-it.messages.json +29 -3
  55. package/locales/ja-jp/ja-jp.messages.json +29 -3
  56. package/locales/ko-kr/ko-kr.messages.json +29 -3
  57. package/locales/pt-br/pt-br.messages.json +29 -3
  58. package/locales/ru-ru/ru-ru.messages.json +29 -3
  59. package/locales/tr-tr/tr-tr.messages.json +29 -3
  60. package/locales/zh-cn/zh-cn.messages.json +29 -3
  61. package/locales/zh-tw/zh-tw.messages.json +29 -3
  62. package/package.json +1 -1
  63. package/types/nanahoshi-mona-ui-button-group.d.ts +13 -3
  64. package/types/nanahoshi-mona-ui-button.d.ts +20 -3
  65. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -6
  66. package/types/nanahoshi-mona-ui-dialog.d.ts +131 -20
  67. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +75 -56
  68. package/types/nanahoshi-mona-ui-i18n.d.ts +69 -0
  69. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +14 -2
  70. package/types/nanahoshi-mona-ui-internal-list.d.ts +89 -10
  71. package/types/nanahoshi-mona-ui-internal-tree.d.ts +155 -40
  72. package/types/nanahoshi-mona-ui-internal.d.ts +128 -16
  73. package/types/nanahoshi-mona-ui-list-box.d.ts +148 -47
  74. package/types/nanahoshi-mona-ui-list-view.d.ts +112 -21
  75. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +26 -0
  76. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +26 -0
  77. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +26 -0
  78. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +26 -0
  79. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +26 -0
  80. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +26 -0
  81. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +26 -0
  82. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +26 -0
  83. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +26 -0
  84. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +26 -0
  85. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +26 -0
  86. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +26 -0
  87. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +26 -0
  88. package/types/nanahoshi-mona-ui-menubar.d.ts +65 -62
  89. package/types/nanahoshi-mona-ui-notification.d.ts +76 -16
  90. package/types/nanahoshi-mona-ui-popover.d.ts +44 -17
  91. package/types/nanahoshi-mona-ui-popup-menu.d.ts +110 -32
  92. package/types/nanahoshi-mona-ui-popup.d.ts +2 -0
  93. package/types/nanahoshi-mona-ui-sheet.d.ts +16 -5
  94. package/types/nanahoshi-mona-ui-split-button.d.ts +29 -7
  95. package/types/nanahoshi-mona-ui-tooltip.d.ts +43 -20
  96. package/types/nanahoshi-mona-ui-tree-view.d.ts +84 -40
  97. package/types/nanahoshi-mona-ui-window.d.ts +103 -14
@@ -1,9 +1,10 @@
1
+ import * as _nanahoshi_mona_ui_i18n from '@nanahoshi/mona-ui/i18n';
2
+ import { MonaTreeViewMessages } from '@nanahoshi/mona-ui/i18n';
1
3
  import * as _angular_core from '@angular/core';
2
4
  import { TemplateRef } from '@angular/core';
3
5
  import { ImmutableSet, Selector, List, Predicate } from '@mirei/ts-collections';
4
- import { PreventableEvent, FilterableOptions, FilterChangeEvent } from '@nanahoshi/mona-ui/common';
6
+ import { PreventableEvent, FilterChangeEvent, FilterableOptions } from '@nanahoshi/mona-ui/common';
5
7
  import { Observable, Subject, BehaviorSubject, ReplaySubject } from 'rxjs';
6
- import { MonaTreeViewMessages } from '@nanahoshi/mona-ui/i18n';
7
8
 
8
9
  interface CheckableOptions {
9
10
  /**
@@ -65,6 +66,8 @@ declare class TreeNode<T> {
65
66
  readonly checked: _angular_core.WritableSignal<boolean>;
66
67
  readonly children: _angular_core.WritableSignal<ImmutableSet<TreeNode<T>>>;
67
68
  readonly data: T;
69
+ /** Whether the last load of this node's children from an asynchronous children selector failed. */
70
+ readonly loadFailed: _angular_core.WritableSignal<boolean>;
68
71
  readonly loading: _angular_core.WritableSignal<boolean>;
69
72
  readonly uid: string;
70
73
  /**
@@ -105,9 +108,9 @@ declare class NodeClickEvent<T> extends PreventableEvent {
105
108
  get nodeItem(): NodeItem<T>;
106
109
  }
107
110
 
108
- declare abstract class NodeEvent<T> extends PreventableEvent<MouseEvent | TouchEvent> {
111
+ declare abstract class NodeEvent<T, E extends Event = MouseEvent | TouchEvent> extends PreventableEvent<E> {
109
112
  #private;
110
- protected constructor(type: string, node: TreeNode<T>, event: MouseEvent | TouchEvent);
113
+ protected constructor(type: string, node: TreeNode<T>, event: E);
111
114
  get nodeItem(): NodeItem<T>;
112
115
  }
113
116
 
@@ -145,7 +148,11 @@ interface ITreeView<T> {
145
148
  undoMoveNode(snapshot: NodeMoveSnapshot): void;
146
149
  }
147
150
 
148
- declare class NodeDropEvent<T> extends NodeEvent<T> {
151
+ /**
152
+ * A request to move a node: a drop, or a keyboard move (Ctrl+Shift+Arrow), whose original event is then the
153
+ * `KeyboardEvent`.
154
+ */
155
+ declare class NodeDropEvent<T> extends NodeEvent<T, NodeDropOriginalEvent> {
149
156
  #private;
150
157
  constructor(params: NodeDropEventArgs<T>);
151
158
  get position(): DropPosition;
@@ -153,16 +160,18 @@ declare class NodeDropEvent<T> extends NodeEvent<T> {
153
160
  get targetNode(): NodeItem<T>;
154
161
  get treeView(): ITreeView<T>;
155
162
  }
156
- declare class NodeDropEventSansTree<T> extends NodeEvent<T> {
163
+ declare class NodeDropEventSansTree<T> extends NodeEvent<T, NodeDropOriginalEvent> {
157
164
  #private;
158
165
  constructor(params: NodeDropEventArgsSansTree<T>);
159
- get event(): MouseEvent | TouchEvent;
166
+ get event(): NodeDropOriginalEvent;
160
167
  get position(): DropPosition;
161
168
  get sourceNode(): TreeNode<T>;
162
169
  get targetNode(): TreeNode<T>;
163
170
  }
171
+ /** The event behind a `nodeDrop`: the pointer event of a drop, or the key press of a keyboard move. */
172
+ type NodeDropOriginalEvent = MouseEvent | TouchEvent | KeyboardEvent;
164
173
  interface NodeDropEventArgs<T> {
165
- event: MouseEvent | TouchEvent;
174
+ event: NodeDropOriginalEvent;
166
175
  position: DropPosition;
167
176
  sourceNode: TreeNode<T>;
168
177
  targetNode: TreeNode<T>;
@@ -213,26 +222,49 @@ interface TreeNodeExpandEvent<T> {
213
222
  node: TreeNode<T>;
214
223
  }
215
224
 
225
+ /** The ways Ctrl+Shift+Arrow moves a node: past a sibling, into the previous sibling, or out of its parent. */
226
+ type TreeKeyboardMoveDirection = "down" | "in" | "out" | "up";
227
+ /** Where a keyboard move takes a node. */
228
+ interface TreeKeyboardMove<T> {
229
+ readonly position: Exclude<DropPosition, "outside">;
230
+ readonly targetNode: TreeNode<T>;
231
+ }
232
+
216
233
  interface TreeNodeSelectEvent<T> {
217
234
  node: TreeNode<T>;
218
235
  selected: boolean;
219
236
  }
220
237
 
221
238
  type ChildrenSelector<T> = string | Selector<T, Iterable<T> | Observable<Iterable<T>>>;
222
- type NodeKeySelector<T, K = any> = string | Selector<T, K> | null;
239
+ type NodeKeySelector<T, K = unknown> = string | Selector<T, K> | null;
223
240
 
224
241
  declare class TreeService<T> {
225
242
  #private;
226
- readonly animationTemporarilyDisabled: _angular_core.WritableSignal<boolean>;
227
243
  readonly animationEnabled: _angular_core.WritableSignal<boolean>;
244
+ readonly animationTemporarilyDisabled: _angular_core.WritableSignal<boolean>;
228
245
  readonly blur$: Subject<FocusEvent>;
229
246
  readonly checkBy: _angular_core.WritableSignal<NodeKeySelector<T>>;
230
247
  readonly checkableOptions: _angular_core.WritableSignal<CheckableOptions>;
231
- readonly checkedKeys$: Observable<ImmutableSet<any>>;
248
+ /**
249
+ * The checked keys after the user checks or unchecks a node. Keys set from code, and keys the tree derives on its
250
+ * own (parents with `checkParents`, lazily loaded children of a checked node, ancestors after a move), aren't
251
+ * reported here.
252
+ */
253
+ readonly checkedKeysChange$: Subject<ImmutableSet<unknown>>;
232
254
  readonly children: _angular_core.WritableSignal<ChildrenSelector<T>>;
255
+ /**
256
+ * A node's children failed to load from an asynchronous children selector. The node is collapsed again (not
257
+ * reported through `expandedKeysChange$`), and expanding it retries the load.
258
+ */
259
+ readonly childrenLoadError$: Subject<{
260
+ readonly error: unknown;
261
+ readonly node: TreeNode<T>;
262
+ }>;
263
+ /** A node started loading its children from an asynchronous children selector. */
264
+ readonly childrenLoadStart$: Subject<TreeNode<T>>;
233
265
  readonly disableBy: _angular_core.WritableSignal<NodeKeySelector<T>>;
234
266
  readonly disableOptions: _angular_core.WritableSignal<DisableOptions>;
235
- readonly disabledKeys: _angular_core.WritableSignal<ImmutableSet<any>>;
267
+ readonly disabledKeys: _angular_core.WritableSignal<ImmutableSet<unknown>>;
236
268
  readonly draggableOptions: _angular_core.WritableSignal<DraggableOptions>;
237
269
  readonly dragging: _angular_core.WritableSignal<boolean>;
238
270
  readonly dragging$: Observable<boolean>;
@@ -241,14 +273,21 @@ declare class TreeService<T> {
241
273
  readonly dropPositionSignal: _angular_core.Signal<DropPositionChangeEvent<T> | null>;
242
274
  readonly expandBy: _angular_core.WritableSignal<NodeKeySelector<T>>;
243
275
  readonly expandableOptions: _angular_core.WritableSignal<ExpandableOptions>;
244
- readonly expandedKeys: _angular_core.Signal<ImmutableSet<any>>;
245
- readonly expandedKeys$: Observable<ImmutableSet<any>>;
246
- readonly filterableOptions: _angular_core.WritableSignal<FilterableOptions>;
276
+ readonly expandedKeys: _angular_core.Signal<ImmutableSet<unknown>>;
277
+ /**
278
+ * The expanded keys after the user expands or collapses a node outside filtering. The expansion a filter applies,
279
+ * and the user's changes to it while filtering, are view state and aren't reported.
280
+ */
281
+ readonly expandedKeysChange$: Subject<ImmutableSet<unknown>>;
247
282
  readonly filter$: ReplaySubject<string>;
248
283
  readonly filterChange$: Subject<FilterChangeEvent>;
249
284
  readonly filterPlaceholder: _angular_core.WritableSignal<string>;
285
+ /** The applied filter. Typing is debounced by the filter input; a filter set from code applies at once. */
250
286
  readonly filterText: _angular_core.Signal<string>;
287
+ readonly filterableOptions: _angular_core.Signal<FilterableOptions>;
251
288
  readonly focus$: Subject<FocusEvent>;
289
+ /** The number of nodes whose text matches the filter (their ancestors, shown for context, aren't counted). */
290
+ readonly matchCount: _angular_core.Signal<number>;
252
291
  readonly navigatedNode: _angular_core.WritableSignal<TreeNode<T> | null>;
253
292
  readonly nodeCheck$: Subject<NodeCheckEvent<T>>;
254
293
  readonly nodeCheckChange$: Subject<TreeNodeCheckEvent<T>>;
@@ -261,16 +300,21 @@ declare class TreeService<T> {
261
300
  readonly nodeSelect$: Subject<NodeSelectEvent<T>>;
262
301
  readonly nodeSelectChange$: Subject<TreeNodeSelectEvent<T>>;
263
302
  readonly nodeSet: _angular_core.WritableSignal<ImmutableSet<TreeNode<T>>>;
264
- readonly nodeTemplate: _angular_core.WritableSignal<TemplateRef<any> | null>;
303
+ readonly nodeTemplate: _angular_core.WritableSignal<TemplateRef<unknown> | null>;
265
304
  readonly selectBy: _angular_core.WritableSignal<NodeKeySelector<T>>;
266
305
  readonly selectableOptions: _angular_core.WritableSignal<SelectableOptions>;
267
- readonly selectedKeys: _angular_core.WritableSignal<ImmutableSet<any>>;
268
- readonly selectedKeys$: Observable<ImmutableSet<any>>;
306
+ readonly selectedKeys: _angular_core.WritableSignal<ImmutableSet<unknown>>;
307
+ /** The selected keys after the user selects or deselects a node. Keys set from code aren't reported. */
308
+ readonly selectedKeysChange$: Subject<ImmutableSet<unknown>>;
269
309
  readonly selectedNodes: _angular_core.Signal<ImmutableSet<TreeNode<T>>>;
270
310
  readonly selectionChange$: Subject<NodeItem<T>>;
271
311
  readonly textField: _angular_core.WritableSignal<string | Selector<T, string>>;
272
312
  readonly viewNodeSet: _angular_core.Signal<ImmutableSet<TreeNode<T>>>;
273
313
  constructor();
314
+ /** Whether two key sets hold the same keys, in any order. */
315
+ /** Reads a field of a data item by name (for the string forms of the key, id and children selectors). */
316
+ private static readField;
317
+ private static sameKeys;
274
318
  static flatten<T>(nodes: Iterable<TreeNode<T>>): List<TreeNode<T>>;
275
319
  clearFilter(): void;
276
320
  detachNode(node: TreeNode<T>): void;
@@ -279,12 +323,28 @@ declare class TreeService<T> {
279
323
  */
280
324
  expandSiblings(node: TreeNode<T>): void;
281
325
  /**
282
- * Finds the next visible node, after the navigated node and wrapping around, whose text starts with `prefix`
283
- * (case-insensitive). Used for typeahead.
326
+ * The node of the current nodes that stands for `node`: the node itself, or after a data refresh rebuilt the
327
+ * nodes, the node of the same data item (or, for flat data, of the same id).
328
+ */
329
+ findCounterpart(node: TreeNode<T>): TreeNode<T> | null;
330
+ /**
331
+ * Finds the next visible node whose text starts with `prefix` (case-insensitive), wrapping around. Used for
332
+ * typeahead: a first character searches after the navigated node, and each further character keeps the
333
+ * navigated node while it still matches.
284
334
  */
285
335
  findNodeByText(prefix: string): TreeNode<T> | null;
336
+ getCheckKey(node: TreeNode<T>): unknown;
337
+ getDisableKey(node: TreeNode<T>): unknown;
338
+ /**
339
+ * Where a keyboard move takes a node: before its previous or after its next visible sibling (`"up"`, `"down"`),
340
+ * inside its previous visible sibling as the last child (`"in"`), or after its parent (`"out"`). `null` when the
341
+ * node can't move that way or is disabled.
342
+ */
343
+ getKeyboardMove(node: TreeNode<T>, direction: TreeKeyboardMoveDirection): TreeKeyboardMove<T> | null;
286
344
  getNodeByUid(uid: string): TreeNode<T> | null;
287
345
  getNodeElementId(uid: string): string;
346
+ /** What identifies a node's data item across data refreshes: its id for flat data, else the item itself. */
347
+ getNodeIdentity(node: TreeNode<T>): unknown;
288
348
  getNodeText(node: TreeNode<T>): string;
289
349
  hasChildren(node: TreeNode<T> | null): boolean;
290
350
  insertNodeAtIndex(node: TreeNode<T>, parentUid: string | null, index: number): void;
@@ -304,46 +364,53 @@ declare class TreeService<T> {
304
364
  loadNodeChildren(node: TreeNode<T>, reload?: boolean): void;
305
365
  /**
306
366
  * Moves a node relative to a target node. Moving a node onto itself or into its own subtree is ignored,
307
- * because it would detach the subtree and create a parent cycle.
367
+ * because it would detach the subtree and create a parent cycle, and so is moving it inside its own parent or
368
+ * a disabled node, or `"outside"`.
369
+ * @returns whether the node moved.
308
370
  */
309
- moveNode(sourceNode: TreeNode<T>, targetNode: TreeNode<T>, position: DropPosition): void;
371
+ moveNode(sourceNode: TreeNode<T>, targetNode: TreeNode<T>, position: DropPosition): boolean;
310
372
  navigate(direction: "next" | "previous" | "first" | "last"): TreeNode<T> | null;
311
373
  notifySelectionChange(node: TreeNode<T>): void;
374
+ /**
375
+ * Whether selecting `node` the way the user does (a click, or Enter) changes the selection. It doesn't for the
376
+ * selected node of a single selection that can't be toggled off.
377
+ */
378
+ selectionWouldChange(node: TreeNode<T>): boolean;
312
379
  setAnimationEnabled(enabled: boolean): void;
313
- setChildrenSelector(selector: string | Selector<T, Iterable<T> | Observable<Iterable<T>>>): void;
314
380
  setCheckBy(selector: NodeKeySelector<T>): void;
315
381
  setCheckableOptions(options: Partial<CheckableOptions>): void;
316
- setCheckedKeys(keys: Iterable<any>): void;
382
+ setCheckedKeys(keys: Iterable<unknown>): void;
383
+ setChildrenSelector(selector: string | Selector<T, Iterable<T> | Observable<Iterable<T>>>): void;
317
384
  setData(data: Iterable<T>): void;
318
385
  setDataStructure(structure: DataStructure): void;
319
386
  setDisableBy(selector: NodeKeySelector<T>): void;
320
387
  setDisableOptions(options: Partial<DisableOptions>): void;
321
- setDisabledKeys(keys: Iterable<any>): void;
388
+ setDisabledKeys(keys: Iterable<unknown>): void;
322
389
  setDraggableOptions(options: Partial<DraggableOptions>): void;
323
390
  setExpandBy(selector: NodeKeySelector<T>): void;
324
391
  setExpandableOptions(options: Partial<ExpandableOptions>): void;
325
- setExpandedKeys(keys: Iterable<any>): void;
392
+ setExpandedKeys(keys: Iterable<unknown>): void;
326
393
  setFilterableOptions(options: Partial<FilterableOptions>): void;
327
394
  setFlatIdField(field: string): void;
328
395
  setFlatParentIdField(field: string): void;
329
396
  setHasCheckboxPredicate(fn: ((data: T, uid: string) => boolean) | null): void;
330
- setHasChildrenPredicate(predicate: Predicate<any> | null): void;
397
+ setHasChildrenPredicate(predicate: Predicate<T> | null): void;
331
398
  setNodeCheck(node: TreeNode<T>, checked: boolean): void;
332
399
  setNodeExpand(node: TreeNode<T>, expanded: boolean): void;
333
- setNodeSelect(node: TreeNode<T>, selected: boolean): void;
400
+ /** @returns whether the selection changed. */
401
+ setNodeSelect(node: TreeNode<T>, selected: boolean): boolean;
334
402
  setSelectBy(selector: NodeKeySelector<T>): void;
335
403
  setSelectableOptions(options: Partial<SelectableOptions>): void;
336
404
  setSelectedDataItems(dataItems: Iterable<T>): void;
337
- setSelectedKeys(keys: Iterable<any>): void;
405
+ setSelectedKeys(keys: Iterable<unknown>): void;
338
406
  setTextField(selector: string | Selector<T, string>): void;
339
407
  /**
340
408
  * Expands or collapses a node the way user interaction does: disabled nodes are left alone, children of an
341
- * asynchronous children selector are loaded on first expand, and `nodeExpand$` is notified.
409
+ * asynchronous children selector are loaded on first expand, and `nodeExpand$` is notified. Without expanding
410
+ * (every node is then open), nothing changes.
342
411
  * @returns whether the expand state changed.
343
412
  */
344
413
  toggleNodeExpand(node: TreeNode<T>, expanded: boolean): boolean;
345
- getCheckKey(node: TreeNode<T>): any;
346
- getDisableKey(node: TreeNode<T>): any;
347
414
  private applyCheckedKeysToNodes;
348
415
  private computeVisibleUids;
349
416
  private createFlatNodes;
@@ -364,14 +431,22 @@ declare class TreeService<T> {
364
431
  * `checkDisabledChildren` is set, only enabled ones, because the user cannot change disabled children.
365
432
  */
366
433
  private getCheckStateChildren;
367
- private getExpandKey;
368
434
  private getChildNodes;
369
435
  private getDataItemSelectKey;
436
+ private getExpandKey;
370
437
  private getParentNodes;
371
438
  private getSelectKey;
372
439
  private isAnyParentCollapsed;
373
440
  private isFiltered;
441
+ /**
442
+ * Keeps `aria-activedescendant` on a rendered node: when the active node is hidden by a collapse or a filter, the
443
+ * nearest visible ancestor takes over (else the first visible node); a node re-created by new data with the same
444
+ * uid is swapped in.
445
+ */
446
+ private keepNavigatedNodeVisible;
374
447
  private loadCheckedKeysForChildren;
448
+ /** Loads the children of the expanded, shown nodes whose children come from an observable and aren't loaded. */
449
+ private loadExpandedNodes;
375
450
  private moveNodeAfter;
376
451
  private moveNodeBefore;
377
452
  private moveNodeInside;
@@ -386,16 +461,45 @@ declare class TreeService<T> {
386
461
 
387
462
  declare class TreeComponent<T> {
388
463
  #private;
389
- protected readonly isRtl: _angular_core.Signal<boolean>;
390
464
  protected readonly activeDescendantId: _angular_core.Signal<string | null>;
391
465
  protected readonly baseClass: _angular_core.Signal<string>;
466
+ protected readonly isRtl: _angular_core.Signal<boolean>;
467
+ protected readonly keyShortcuts: _angular_core.Signal<"Control+Shift+ArrowUp Control+Shift+ArrowDown Control+Shift+ArrowLeft Control+Shift+ArrowRight" | null>;
468
+ protected readonly messages: _angular_core.Signal<_nanahoshi_mona_ui_i18n.MonaTreeViewMessages>;
469
+ /**
470
+ * With checkboxes, nodes report `aria-checked` and not `aria-selected`, so the tree isn't multiselectable in the
471
+ * `aria-selected` sense.
472
+ */
473
+ protected readonly multiselectable: _angular_core.Signal<true | null>;
474
+ readonly ariaDescribedBy: _angular_core.InputSignal<string>;
392
475
  readonly ariaLabel: _angular_core.InputSignal<string>;
476
+ readonly ariaLabelledBy: _angular_core.InputSignal<string>;
393
477
  readonly data: _angular_core.InputSignal<Iterable<T> | undefined>;
394
478
  readonly nodeTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
395
479
  readonly treeService: TreeService<T>;
396
480
  constructor();
397
- private handleMouseMoveWhileDragging;
398
- private isMouseOutsideTree;
481
+ /**
482
+ * Once the tree has rendered after a keyboard move, finds out whether the `nodeDrop` handler applied it (through
483
+ * `data` or `moveNode`). A move that was applied keeps the node active, opens the node it went into, and is
484
+ * announced.
485
+ */
486
+ private afterKeyboardMove;
487
+ /** Ctrl+Shift+Arrow (Cmd+Shift+Arrow on macOS) moves the active node while dragging is on. */
488
+ private handleMoveKey;
489
+ private handlePointerMoveWhileDragging;
490
+ private isPointerOutsideTree;
491
+ /**
492
+ * Whether a key event is meant for the tree: from the tree itself or one of its nodes. Keys pressed in controls
493
+ * of a node template (or in a tree nested in one) are left to those controls.
494
+ */
495
+ private isTreeKeyTarget;
496
+ private locationOf;
497
+ private moveDirection;
498
+ /**
499
+ * Asks for a keyboard move the way a drop does: `nodeDrop` is emitted, and its handler applies the move. The
500
+ * keyboard event is the drop event's original event.
501
+ */
502
+ private moveWithKeyboard;
399
503
  private notifyDropPositionChange;
400
504
  private setFocusSubscription;
401
505
  private setKeydownSubscription;
@@ -403,7 +507,7 @@ declare class TreeComponent<T> {
403
507
  private setSubscriptions;
404
508
  private setTypeaheadSubscription;
405
509
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TreeComponent<any>, never>;
406
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TreeComponent<any>, "mona-tree", never, { "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, ["nodeTemplate"], never, true, never>;
510
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TreeComponent<any>, "mona-tree", never, { "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, ["nodeTemplate"], never, true, never>;
407
511
  }
408
512
 
409
513
  declare class TreeNodeTemplateDirective {
@@ -413,6 +517,17 @@ declare class TreeNodeTemplateDirective {
413
517
 
414
518
  declare const TREE_DEFAULT_MESSAGES: MonaTreeViewMessages;
415
519
 
520
+ /**
521
+ * Reports that the children of a node couldn't be loaded from an asynchronous children selector. The node is
522
+ * collapsed again, and expanding it retries the load.
523
+ */
524
+ interface ChildrenLoadErrorEvent<T> {
525
+ /** What the children observable errored with. */
526
+ readonly error: unknown;
527
+ /** The node whose children failed to load. */
528
+ readonly node: NodeItem<T>;
529
+ }
530
+
416
531
  /**
417
532
  * Moves a node within a generic flat tree structure that uses parentId references.
418
533
  * @param treeData - The flat array of tree nodes.
@@ -423,7 +538,7 @@ declare const TREE_DEFAULT_MESSAGES: MonaTreeViewMessages;
423
538
  * The array is returned unchanged when the position is "outside" or the target is the dragged node or one of its
424
539
  * descendants, which would otherwise create a parent cycle.
425
540
  */
426
- declare function moveFlatTreeNode<T extends Record<string, any>>(treeData: Iterable<T>, event: NodeDropEvent<T>, idKey: keyof T, parentIdKey: keyof T): T[];
541
+ declare function moveFlatTreeNode<T extends object>(treeData: Iterable<T>, event: NodeDropEvent<T>, idKey: keyof T, parentIdKey: keyof T): T[];
427
542
 
428
543
  /**
429
544
  * Moves a node within a generic hierarchical tree structure.
@@ -436,7 +551,7 @@ declare function moveFlatTreeNode<T extends Record<string, any>>(treeData: Itera
436
551
  * The move is skipped, returning the tree unchanged, when the position is "outside", the target is missing,
437
552
  * or the target is the dragged node or one of its descendants, so a node is never lost or made its own ancestor.
438
553
  */
439
- declare function moveTreeNode<T extends Record<string, any>>(treeData: Iterable<T>, event: NodeDropEvent<T>, idKey: keyof T, childrenKey: keyof T): T[];
554
+ declare function moveTreeNode<T extends object>(treeData: Iterable<T>, event: NodeDropEvent<T>, idKey: keyof T, childrenKey: keyof T): T[];
440
555
 
441
556
  export { InternalNodeDragEvent, NodeCheckEvent, NodeClickEvent, NodeDragEndEvent, NodeDragEvent, NodeDragStartEvent, NodeDropEvent, NodeDropEventSansTree, NodeEvent, NodeSelectEvent, TREE_DEFAULT_MESSAGES, TreeComponent, TreeNode, TreeNodeTemplateDirective, TreeService, moveFlatTreeNode, moveTreeNode };
442
- export type { CheckableOptions, ChildrenSelector, DataStructure, DisableOptions, DraggableOptions, DropPosition, DropPositionChangeEvent, ExpandableOptions, ITreeView, NodeDropEventArgs, NodeDropEventArgsSansTree, NodeItem, NodeKeySelector, NodeMoveSnapshot, SelectableOptions, TreeNodeCheckEvent, TreeNodeExpandEvent, TreeNodeSelectEvent };
557
+ export type { CheckableOptions, ChildrenLoadErrorEvent, ChildrenSelector, DataStructure, DisableOptions, DraggableOptions, DropPosition, DropPositionChangeEvent, ExpandableOptions, ITreeView, NodeDropEventArgs, NodeDropEventArgsSansTree, NodeDropOriginalEvent, NodeItem, NodeKeySelector, NodeMoveSnapshot, SelectableOptions, TreeKeyboardMove, TreeKeyboardMoveDirection, TreeNodeCheckEvent, TreeNodeExpandEvent, TreeNodeSelectEvent };
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ElementRef, DestroyRef, Signal } from '@angular/core';
2
+ import { ElementRef, Signal, DestroyRef } from '@angular/core';
3
+ import { OverlayRef, ConnectionPositionPair } from '@angular/cdk/overlay';
3
4
  import { Observable } from 'rxjs';
4
- import { OverlayRef } from '@angular/cdk/overlay';
5
5
 
6
6
  type AttributeConfig = Record<string, unknown>;
7
7
 
@@ -70,6 +70,15 @@ declare const string2rgba: (rgbText: string) => RGBA;
70
70
 
71
71
  type Action<P = void, R = void> = (arg: P) => R;
72
72
 
73
+ /**
74
+ * Adds `id` to an id-list attribute such as `aria-describedby`, keeping the ids already there.
75
+ */
76
+ declare const addAriaReference: (element: Element, attribute: string, id: string) => void;
77
+ /**
78
+ * Removes `id` from an id-list attribute, and the attribute itself once it holds no ids.
79
+ */
80
+ declare const removeAriaReference: (element: Element, attribute: string, id: string) => void;
81
+
73
82
  /**
74
83
  * Generates a unique control ID for an element.
75
84
  * The ID consists of the `mona-` prefix followed by a random hexadecimal string.
@@ -90,6 +99,37 @@ declare function focusCanReturn(document: Document, ...containers: ReadonlyArray
90
99
 
91
100
  declare function focusElement(host: HTMLElement, element: HTMLElement | ElementRef<HTMLElement> | string): void;
92
101
 
102
+ /**
103
+ * Makes everything outside a modal overlay inert, so assistive technology, the pointer and Tab can't reach the page
104
+ * behind it. Walking up from `element` to `<body>`, every sibling is made inert, except that inside the CDK overlay
105
+ * container only the overlays opened before this one are: popups opened later (a dropdown inside the dialog) stay
106
+ * usable. Elements that were inert already are left as they are.
107
+ * @param element the overlay's host element (the CDK overlay wrapper)
108
+ * @returns the function that releases what this call made inert
109
+ */
110
+ declare const inertOutside: (element: Element) => (() => void);
111
+
112
+ /**
113
+ * The text of the elements an `aria-labelledby` value points to, joined with spaces, for names built from a
114
+ * component's name ("Filter {name}"). It's read after every render, so it follows the labelling elements' text.
115
+ * Call it in an injection context.
116
+ * @param ids Returns the space-separated element ids.
117
+ */
118
+ declare function injectLabelledByText(ids: () => string): Signal<string>;
119
+
120
+ interface GlobalOverlayPosition {
121
+ /** Distance from the viewport's left edge in pixels; centered horizontally when omitted. Physical in RTL too. */
122
+ readonly left?: number | null;
123
+ /** Distance from the viewport's top edge in pixels; centered vertically when omitted. */
124
+ readonly top?: number | null;
125
+ }
126
+ /**
127
+ * Places a global overlay through its position strategy, so later `updatePosition()` calls (a direction change, a
128
+ * resize) keep it where it is instead of resetting inline styles. Each axis is independent: a `top` alone keeps the
129
+ * overlay centered horizontally. Centering follows the overlay's size as it grows or shrinks.
130
+ */
131
+ declare const positionGlobalOverlay: (overlayRef: OverlayRef, position: GlobalOverlayPosition) => void;
132
+
93
133
  declare const rxFromResize: (target: Element | Iterable<Element>, options?: ResizeObserverOptions) => Observable<ResizeObserverEntry[]>;
94
134
 
95
135
  declare const rxTimeout: (destroyRef: DestroyRef, fn: Action, delay?: number) => void;
@@ -105,18 +145,90 @@ declare const themeRaisedSurfaceClasses = "\n [background-color:var(--mona-ef
105
145
  declare const themeOverlayBackdropClasses = "\n [background-image:var(--mona-effect-overlay-background-image,none)]\n [backdrop-filter:var(--mona-effect-overlay-backdrop-filter,none)]\n [-webkit-backdrop-filter:var(--mona-effect-overlay-backdrop-filter,none)]\n";
106
146
  declare const themeOverlaySurfaceClasses = "\n [background-color:var(--mona-effect-overlay-background-color,var(--color-surface-overlay))]\n \n [background-image:var(--mona-effect-overlay-background-image,none)]\n [backdrop-filter:var(--mona-effect-overlay-backdrop-filter,none)]\n [-webkit-backdrop-filter:var(--mona-effect-overlay-backdrop-filter,none)]\n\n";
107
147
 
108
- declare const restoreOverlayScroll: (overlayRef: OverlayRef, element: HTMLElement) => void;
109
-
110
- interface WindowStyleSettings {
111
- left?: number;
112
- maxHeight?: number;
113
- maxWidth?: number;
114
- minHeight?: number;
115
- minWidth?: number;
116
- top?: number;
117
- windowClass?: string | string[];
148
+ /**
149
+ * How long a popup opened by hovering waits after the pointer leaves its anchor, so the pointer can cross the gap
150
+ * onto the popup and stay there (WCAG 1.4.13, Content on Hover or Focus).
151
+ */
152
+ declare const HOVER_GRACE = 100;
153
+ /** What made an anchor active: the pointer resting on it, or focus inside it. */
154
+ type HoverSource = "focus" | "pointer";
155
+ interface HoverIntentConfig {
156
+ /** Closes the open popup. */
157
+ readonly hide: () => void;
158
+ /** Read each time a hide is scheduled, in milliseconds. */
159
+ readonly hideDelay: () => number;
160
+ /** Opens the popup for `anchor`; report it with `opened()` once it exists. */
161
+ readonly show: (anchor: HTMLElement) => void;
162
+ /** Read each time a show is scheduled, in milliseconds. */
163
+ readonly showDelay: () => number;
118
164
  }
119
- declare const setWindowStyles: (element: HTMLElement, settings: WindowStyleSettings) => void;
165
+ /**
166
+ * When to show and hide a popup that follows the pointer and focus, shared by the tooltip and the hover popover.
167
+ *
168
+ * - A show waits for `showDelay`, and leaving the anchor first cancels it.
169
+ * - The popup stays while the pointer is on the anchor or on the popup, or focus is on the anchor. Leaving waits for
170
+ * `hideDelay` (at least {@link HOVER_GRACE} for the pointer), and coming back cancels the hide.
171
+ * - Moving to another anchor replaces the popup.
172
+ * - After a dismissal (Escape), the popup stays closed until the pointer and focus have left that anchor.
173
+ */
174
+ declare class HoverIntent {
175
+ #private;
176
+ constructor(config: HoverIntentConfig);
177
+ /**
178
+ * Reports that the popup for `anchor` started closing for a reason of its own (Escape, an outside click, being
179
+ * disabled). With `dismissed`, it stays closed until the pointer and focus have left the anchor.
180
+ */
181
+ closed(anchor: HTMLElement, dismissed?: boolean): void;
182
+ /** Stops every timer and forgets every anchor, without closing anything. */
183
+ dispose(): void;
184
+ /** The pointer moved onto `anchor`, or focus moved into it. */
185
+ enter(anchor: HTMLElement, source: HoverSource): void;
186
+ /** Hides the popup now, as leaving would, and cancels a pending show. */
187
+ hideNow(): void;
188
+ /** The pointer left `anchor`, or focus left it. */
189
+ leave(anchor: HTMLElement, source: HoverSource): void;
190
+ /**
191
+ * Reports that the popup for `anchor` is open. While the pointer is on `panel`, the popup stays.
192
+ */
193
+ opened(anchor: HTMLElement, panel: HTMLElement | null): void;
194
+ /** The anchor whose popup is open, if any. */
195
+ get anchor(): HTMLElement | null;
196
+ }
197
+ /**
198
+ * Feeds a {@link HoverIntent} from pointer and focus events delegated on `root`, so anchors added, removed or
199
+ * re-rendered later need no listeners of their own. Touch pointers are ignored: a tap that focuses the anchor shows
200
+ * the popup through focus instead, and it isn't hidden again by the pointer leaving after the tap.
201
+ * @param resolve the anchor an event target belongs to, or `null`
202
+ * @returns the function that removes the listeners
203
+ */
204
+ declare const listenForHover: (root: Document | HTMLElement, resolve: (node: Element) => HTMLElement | null, intent: HoverIntent) => (() => void);
205
+ /**
206
+ * Calls `callback` once `element` leaves the document, for a popup that would otherwise stay anchored to nothing.
207
+ * @returns the function that stops watching
208
+ */
209
+ declare const onDisconnect: (element: Element, callback: () => void) => (() => void);
210
+
211
+ /**
212
+ * The side of its anchor a tooltip or popover opens on. `left` and `right` are physical in every direction; `start`
213
+ * and `end` follow the text direction.
214
+ */
215
+ type OverlaySide = "bottom" | "end" | "left" | "right" | "start" | "top";
216
+ /** A side resolved against the text direction. */
217
+ type PhysicalOverlaySide = "bottom" | "left" | "right" | "top";
218
+ declare const resolveOverlaySide: (side: OverlaySide, direction: "ltr" | "rtl") => PhysicalOverlaySide;
219
+ /**
220
+ * Positions for a popup centered on `side` of its anchor, flipping to the opposite side when it doesn't fit. Each
221
+ * position carries its own offset, so the gap stays between the popup and its anchor after a flip.
222
+ * @param gap the distance between the anchor and the popup, in pixels
223
+ * @param direction the overlay's direction
224
+ */
225
+ declare const overlaySidePositions: (side: PhysicalOverlaySide, gap: number, direction: "ltr" | "rtl") => ConnectionPositionPair[];
226
+ /**
227
+ * The physical side of its anchor a popup ended up on, from the position the overlay chose.
228
+ */
229
+ declare const sideOfPosition: (position: Pick<ConnectionPositionPair, "originY" | "overlayX" | "overlayY">, direction: "ltr" | "rtl") => PhysicalOverlaySide;
230
+
231
+ declare const restoreOverlayScroll: (overlayRef: OverlayRef, element: HTMLElement) => void;
120
232
 
121
233
  /**
122
234
  * Converts a number or a string into a CSS-compliant value.
@@ -142,7 +254,7 @@ declare enum NavigationKeys {
142
254
  PageUp = "PageUp",
143
255
  Space = " "
144
256
  }
145
- declare const NavigationKeysList: string[];
257
+ declare const NavigationKeysList: readonly string[];
146
258
  declare const isNavigationKey: (key: string) => boolean;
147
259
 
148
260
  /**
@@ -163,5 +275,5 @@ declare const isTypeaheadKey: (key: string, modifiers?: TypeaheadModifiers) => b
163
275
  declare const TYPEAHEAD_RESET_DELAY = 200;
164
276
  declare const setupTypeahead: (typeaheadKey$: Observable<string>) => Observable<string>;
165
277
 
166
- export { AttributeBinderDirective, NavigationKeys, NavigationKeysList, TYPEAHEAD_RESET_DELAY, createElementControlId, focusCanReturn, focusElement, hex2rgba, hsla2hsva, hsva2rgba, isNavigationKey, isTypeaheadKey, isValidHex, isValidHsla, isValidRgb, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, rxFromResize, rxTimeout, setWindowStyles, setupTypeahead, string2Hsla, string2rgba, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, toCssValue };
167
- export type { Action, AttributeConfig, Channel, ColorScheme, HSL, HSLA, HSV, HSVA, HSVChannel, RGB, RGBA, RGBAChannel, RGBChannel, TypeaheadModifiers, VariantInputs, WindowStyleSettings };
278
+ export { AttributeBinderDirective, HOVER_GRACE, HoverIntent, NavigationKeys, NavigationKeysList, TYPEAHEAD_RESET_DELAY, addAriaReference, createElementControlId, focusCanReturn, focusElement, hex2rgba, hsla2hsva, hsva2rgba, inertOutside, injectLabelledByText, isNavigationKey, isTypeaheadKey, isValidHex, isValidHsla, isValidRgb, listenForHover, onDisconnect, overlaySidePositions, positionGlobalOverlay, removeAriaReference, resolveOverlaySide, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, rxFromResize, rxTimeout, setupTypeahead, sideOfPosition, string2Hsla, string2rgba, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, toCssValue };
279
+ export type { Action, AttributeConfig, Channel, ColorScheme, GlobalOverlayPosition, HSL, HSLA, HSV, HSVA, HSVChannel, HoverIntentConfig, HoverSource, OverlaySide, PhysicalOverlaySide, RGB, RGBA, RGBAChannel, RGBChannel, TypeaheadModifiers, VariantInputs };