wunderbaum 0.8.0 → 0.8.1

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.
@@ -298,7 +298,7 @@ function throttle(func, wait = 0, options = {}) {
298
298
  /*!
299
299
  * Wunderbaum - util
300
300
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
301
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
301
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
302
302
  */
303
303
  /** @module util */
304
304
  /** Readable names for `MouseEvent.button` */
@@ -1096,7 +1096,7 @@ var util = /*#__PURE__*/Object.freeze({
1096
1096
  /*!
1097
1097
  * Wunderbaum - types
1098
1098
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1099
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
1099
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
1100
1100
  */
1101
1101
  /**
1102
1102
  * Possible values for {@link WunderbaumNode.update()} and {@link Wunderbaum.update()}.
@@ -1160,7 +1160,7 @@ var NavModeEnum;
1160
1160
  /*!
1161
1161
  * Wunderbaum - wb_extension_base
1162
1162
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1163
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
1163
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
1164
1164
  */
1165
1165
  class WunderbaumExtension {
1166
1166
  constructor(tree, id, defaults) {
@@ -1219,7 +1219,7 @@ class WunderbaumExtension {
1219
1219
  /*!
1220
1220
  * Wunderbaum - ext-filter
1221
1221
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1222
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
1222
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
1223
1223
  */
1224
1224
  const START_MARKER = "\uFFF7";
1225
1225
  const END_MARKER = "\uFFF8";
@@ -1524,7 +1524,7 @@ function _markFuzzyMatchedChars(text, matches, escapeTitles = true) {
1524
1524
  /*!
1525
1525
  * Wunderbaum - ext-keynav
1526
1526
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1527
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
1527
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
1528
1528
  */
1529
1529
  const QUICKSEARCH_DELAY = 500;
1530
1530
  class KeynavExtension extends WunderbaumExtension {
@@ -1888,7 +1888,7 @@ class KeynavExtension extends WunderbaumExtension {
1888
1888
  /*!
1889
1889
  * Wunderbaum - ext-logger
1890
1890
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1891
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
1891
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
1892
1892
  */
1893
1893
  class LoggerExtension extends WunderbaumExtension {
1894
1894
  constructor(tree) {
@@ -1930,7 +1930,7 @@ class LoggerExtension extends WunderbaumExtension {
1930
1930
  /*!
1931
1931
  * Wunderbaum - common
1932
1932
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1933
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
1933
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
1934
1934
  */
1935
1935
  const DEFAULT_DEBUGLEVEL = 3; // Replaced by rollup script
1936
1936
  /**
@@ -2253,7 +2253,7 @@ function decompressSourceData(source) {
2253
2253
  /*!
2254
2254
  * Wunderbaum - ext-dnd
2255
2255
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2256
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
2256
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
2257
2257
  */
2258
2258
  const nodeMimeType = "application/x-wunderbaum-node";
2259
2259
  class DndExtension extends WunderbaumExtension {
@@ -2492,7 +2492,7 @@ class DndExtension extends WunderbaumExtension {
2492
2492
  const dndOpts = this.treeOpts.dnd;
2493
2493
  const srcNode = Wunderbaum.getNode(e);
2494
2494
  if (!srcNode) {
2495
- this.tree.logWarn(`onDragEvent.${e.type} no node`);
2495
+ this.tree.logWarn(`onDragEvent.${e.type}: no node`);
2496
2496
  return;
2497
2497
  }
2498
2498
  if (["dragstart", "dragend"].includes(e.type)) {
@@ -2567,6 +2567,13 @@ class DndExtension extends WunderbaumExtension {
2567
2567
  const dndOpts = this.treeOpts.dnd;
2568
2568
  const dt = e.dataTransfer;
2569
2569
  const dropRegion = this._calcDropRegion(e, this.lastAllowedDropRegions);
2570
+ /** Helper to log a message if predicate is false. */
2571
+ const _t = (pred, msg) => {
2572
+ if (pred) {
2573
+ this.tree.log(`Prevented drop operation (${msg}).`);
2574
+ }
2575
+ return pred;
2576
+ };
2570
2577
  if (!targetNode) {
2571
2578
  this._leaveNode();
2572
2579
  return;
@@ -2577,6 +2584,7 @@ class DndExtension extends WunderbaumExtension {
2577
2584
  }
2578
2585
  // --- dragenter ---
2579
2586
  if (e.type === "dragenter") {
2587
+ // this.tree.logWarn(` onDropEvent.${e.type} targetNode: ${targetNode}`, e);
2580
2588
  this.lastAllowedDropRegions = null;
2581
2589
  // `dragleave` is not reliable with event delegation, so we generate it
2582
2590
  // from dragenter:
@@ -2587,29 +2595,33 @@ class DndExtension extends WunderbaumExtension {
2587
2595
  this.lastEnterStamp = Date.now();
2588
2596
  if (
2589
2597
  // Don't drop on status node:
2590
- targetNode.isStatusNode() ||
2598
+ _t(targetNode.isStatusNode(), "is status node") ||
2591
2599
  // Prevent dropping nodes from different Wunderbaum trees:
2592
- (dndOpts.preventForeignNodes && targetNode.tree !== srcTree) ||
2600
+ _t(dndOpts.preventForeignNodes && targetNode.tree !== srcTree, "preventForeignNodes") ||
2593
2601
  // Prevent dropping items on unloaded lazy Wunderbaum tree nodes:
2594
- (dndOpts.preventLazyParents && !targetNode.isLoaded()) ||
2602
+ _t(dndOpts.preventLazyParents && !targetNode.isLoaded(), "preventLazyParents") ||
2595
2603
  // Prevent dropping items other than Wunderbaum tree nodes:
2596
- (dndOpts.preventNonNodes && !srcNode) ||
2604
+ _t(dndOpts.preventNonNodes && !srcNode, "preventNonNodes") ||
2597
2605
  // Prevent dropping nodes on own descendants:
2598
- (dndOpts.preventRecursion && (srcNode === null || srcNode === void 0 ? void 0 : srcNode.isAncestorOf(targetNode))) ||
2606
+ _t(dndOpts.preventRecursion && (srcNode === null || srcNode === void 0 ? void 0 : srcNode.isAncestorOf(targetNode)), "preventRecursion") ||
2599
2607
  // Prevent dropping nodes under same direct parent:
2600
2608
  (dndOpts.preventSameParent &&
2601
2609
  srcNode &&
2602
- targetNode.parent === srcNode.parent) ||
2610
+ targetNode.parent === srcNode.parent,
2611
+ "preventSameParent") ||
2603
2612
  // Don't allow void operation ('drop on self'): TODO: should be checked on move only
2604
2613
  (dndOpts.preventVoidMoves && targetNode === srcNode)) {
2605
2614
  dt.dropEffect = "none";
2606
- this.tree.log("Prevented drop operation");
2615
+ // this.tree.log("Prevented drop operation");
2607
2616
  return true; // Prevent drop operation
2608
2617
  }
2609
2618
  // User may return a set of regions (or `false` to prevent drop)
2610
2619
  // Figure out a drop effect (copy/link/move) using opinated conventions.
2611
2620
  dt.dropEffect = this._guessDropEffect(e) || "none";
2612
- let regionSet = targetNode._callEvent("dnd.dragEnter", { event: e });
2621
+ let regionSet = targetNode._callEvent("dnd.dragEnter", {
2622
+ event: e,
2623
+ sourceNode: srcNode,
2624
+ });
2613
2625
  //
2614
2626
  regionSet = this.unifyDragover(regionSet);
2615
2627
  if (!regionSet) {
@@ -2627,7 +2639,7 @@ class DndExtension extends WunderbaumExtension {
2627
2639
  const viewportY = e.clientY - this.tree.element.offsetTop;
2628
2640
  this._autoScroll(viewportY);
2629
2641
  dt.dropEffect = this._guessDropEffect(e) || "none";
2630
- targetNode._callEvent("dnd.dragOver", { event: e });
2642
+ targetNode._callEvent("dnd.dragOver", { event: e, sourceNode: srcNode });
2631
2643
  const region = this._calcDropRegion(e, this.lastAllowedDropRegions);
2632
2644
  this.lastDropRegion = region;
2633
2645
  this.lastDropEffect = dt.dropEffect;
@@ -2635,7 +2647,10 @@ class DndExtension extends WunderbaumExtension {
2635
2647
  targetNode.isExpandable(true) &&
2636
2648
  !targetNode._isLoading &&
2637
2649
  Date.now() - this.lastEnterStamp > dndOpts.autoExpandMS &&
2638
- targetNode._callEvent("dnd.dragExpand", { event: e }) !== false) {
2650
+ targetNode._callEvent("dnd.dragExpand", {
2651
+ event: e,
2652
+ sourceNode: srcNode,
2653
+ }) !== false) {
2639
2654
  targetNode.setExpanded();
2640
2655
  }
2641
2656
  if (!region || this._isVoidDrop(targetNode, srcNode, region)) {
@@ -2651,7 +2666,7 @@ class DndExtension extends WunderbaumExtension {
2651
2666
  else if (e.type === "dragleave") {
2652
2667
  // NOTE: we cannot trust this event, since it is always fired,
2653
2668
  // Instead we remove the marker on dragenter
2654
- targetNode._callEvent("dnd.dragLeave", { event: e });
2669
+ targetNode._callEvent("dnd.dragLeave", { event: e, sourceNode: srcNode });
2655
2670
  // --- drop ---
2656
2671
  }
2657
2672
  else if (e.type === "drop") {
@@ -2684,7 +2699,7 @@ class DndExtension extends WunderbaumExtension {
2684
2699
  /*!
2685
2700
  * Wunderbaum - drag_observer
2686
2701
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2687
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
2702
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
2688
2703
  */
2689
2704
  /**
2690
2705
  * Convert mouse- and touch events to 'dragstart', 'drag', and 'dragstop'.
@@ -2820,7 +2835,7 @@ class DragObserver {
2820
2835
  /*!
2821
2836
  * Wunderbaum - ext-grid
2822
2837
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2823
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
2838
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
2824
2839
  */
2825
2840
  class GridExtension extends WunderbaumExtension {
2826
2841
  constructor(tree) {
@@ -2857,7 +2872,7 @@ class GridExtension extends WunderbaumExtension {
2857
2872
  /*!
2858
2873
  * Wunderbaum - deferred
2859
2874
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2860
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
2875
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
2861
2876
  */
2862
2877
  /**
2863
2878
  * Implement a ES6 Promise, that exposes a resolve() and reject() method.
@@ -2910,7 +2925,7 @@ class Deferred {
2910
2925
  /*!
2911
2926
  * Wunderbaum - wunderbaum_node
2912
2927
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2913
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
2928
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
2914
2929
  */
2915
2930
  /** WunderbaumNode properties that can be passed with source data.
2916
2931
  * (Any other source properties will be stored as `node.data.PROP`.)
@@ -3870,13 +3885,20 @@ class WunderbaumNode {
3870
3885
  }
3871
3886
  }
3872
3887
  }
3873
- /**Load content of a lazy node. */
3888
+ /**
3889
+ * Load content of a lazy node.
3890
+ * If the node is already loaded, nothing happens.
3891
+ * @param [forceReload=false] If true, reload even if already loaded.
3892
+ */
3874
3893
  async loadLazy(forceReload = false) {
3875
3894
  const wasExpanded = this.expanded;
3876
3895
  assert(this.lazy, "load() requires a lazy node");
3877
- // _assert( forceReload || this.isUndefined(), "Pass forceReload=true to re-load a lazy node" );
3878
3896
  if (!forceReload && !this.isUnloaded()) {
3879
- return;
3897
+ return; // Already loaded: nothing to do
3898
+ }
3899
+ if (this.isLoading()) {
3900
+ this.logWarn("loadLazy() called while already loading: ignored.");
3901
+ return; // Already loading: prevent duplicate requests
3880
3902
  }
3881
3903
  if (this.isLoaded()) {
3882
3904
  this.resetLazy(); // Also collapses if currently expanded
@@ -3892,7 +3914,7 @@ class WunderbaumNode {
3892
3914
  }
3893
3915
  assert(isArray(source) || (source && source.url), "The lazyLoad event must return a node list, `{url: ...}`, or false.");
3894
3916
  await this.load(source);
3895
- this.setStatus(NodeStatusType.ok);
3917
+ this.setStatus(NodeStatusType.ok); // Also resets `this._isLoading`
3896
3918
  if (wasExpanded) {
3897
3919
  this.expanded = true;
3898
3920
  this.tree.update(ChangeType.structure);
@@ -3904,33 +3926,41 @@ class WunderbaumNode {
3904
3926
  catch (e) {
3905
3927
  this.logError("Error during loadLazy()", e);
3906
3928
  this._callEvent("error", { error: e });
3929
+ // Also resets `this._isLoading`:
3907
3930
  this.setStatus(NodeStatusType.error, { message: "" + e });
3908
3931
  }
3909
3932
  return;
3910
3933
  }
3911
- /** Alias for `logDebug` */
3934
+ /** Write to `console.log` with node name as prefix if opts.debugLevel >= 4.
3935
+ * @see {@link WunderbaumNode.logDebug}
3936
+ */
3912
3937
  log(...args) {
3913
- this.logDebug(...args);
3938
+ if (this.tree.options.debugLevel >= 4) {
3939
+ console.log(this.toString(), ...args); // eslint-disable-line no-console
3940
+ }
3914
3941
  }
3915
- /* Log to console if opts.debugLevel >= 4 */
3942
+ /** Write to `console.debug` with node name as prefix if opts.debugLevel >= 4
3943
+ * and browser console level includes debug/verbose messages.
3944
+ * @see {@link WunderbaumNode.log}
3945
+ */
3916
3946
  logDebug(...args) {
3917
3947
  if (this.tree.options.debugLevel >= 4) {
3918
- console.log(this.toString(), ...args); // eslint-disable-line no-console
3948
+ console.debug(this.toString(), ...args); // eslint-disable-line no-console
3919
3949
  }
3920
3950
  }
3921
- /* Log error to console. */
3951
+ /** Write to `console.error` with node name as prefix if opts.debugLevel >= 1. */
3922
3952
  logError(...args) {
3923
3953
  if (this.tree.options.debugLevel >= 1) {
3924
3954
  console.error(this.toString(), ...args); // eslint-disable-line no-console
3925
3955
  }
3926
3956
  }
3927
- /* Log to console if opts.debugLevel >= 3 */
3957
+ /** Write to `console.info` with node name as prefix if opts.debugLevel >= 3. */
3928
3958
  logInfo(...args) {
3929
3959
  if (this.tree.options.debugLevel >= 3) {
3930
3960
  console.info(this.toString(), ...args); // eslint-disable-line no-console
3931
3961
  }
3932
3962
  }
3933
- /* Log warning to console if opts.debugLevel >= 2 */
3963
+ /** Write to `console.warn` with node name as prefix if opts.debugLevel >= 2. */
3934
3964
  logWarn(...args) {
3935
3965
  if (this.tree.options.debugLevel >= 2) {
3936
3966
  console.warn(this.toString(), ...args); // eslint-disable-line no-console
@@ -4121,15 +4151,16 @@ class WunderbaumNode {
4121
4151
  }
4122
4152
  /** Remove all descendants of this node. */
4123
4153
  removeChildren() {
4154
+ var _a, _b;
4124
4155
  const tree = this.tree;
4125
4156
  if (!this.children) {
4126
4157
  return;
4127
4158
  }
4128
- if (tree.activeNode && tree.activeNode.isDescendantOf(this)) {
4159
+ if ((_a = tree.activeNode) === null || _a === void 0 ? void 0 : _a.isDescendantOf(this)) {
4129
4160
  tree.activeNode.setActive(false); // TODO: don't fire events
4130
4161
  }
4131
- if (tree.focusNode && tree.focusNode.isDescendantOf(this)) {
4132
- tree.focusNode = null;
4162
+ if ((_b = tree.focusNode) === null || _b === void 0 ? void 0 : _b.isDescendantOf(this)) {
4163
+ tree._setFocusNode(null);
4133
4164
  }
4134
4165
  // TODO: persist must take care to clear select and expand cookies
4135
4166
  // Unlink children to support GC
@@ -4728,7 +4759,7 @@ class WunderbaumNode {
4728
4759
  */
4729
4760
  async setActive(flag = true, options) {
4730
4761
  const tree = this.tree;
4731
- const prev = tree.activeNode;
4762
+ const prev = tree.getActiveNode();
4732
4763
  const retrigger = options === null || options === void 0 ? void 0 : options.retrigger; // Default: false
4733
4764
  const focusTree = options === null || options === void 0 ? void 0 : options.focusTree; // Default: false
4734
4765
  // const focusNode = options?.focusNode !== false; // Default: true
@@ -4751,7 +4782,7 @@ class WunderbaumNode {
4751
4782
  }) === false) {
4752
4783
  return;
4753
4784
  }
4754
- tree.activeNode = null;
4785
+ tree._setActiveNode(null);
4755
4786
  prev === null || prev === void 0 ? void 0 : prev.update(ChangeType.status);
4756
4787
  }
4757
4788
  }
@@ -4761,7 +4792,7 @@ class WunderbaumNode {
4761
4792
  }
4762
4793
  if (prev !== this) {
4763
4794
  if (flag) {
4764
- tree.activeNode = this;
4795
+ tree._setActiveNode(this);
4765
4796
  }
4766
4797
  prev === null || prev === void 0 ? void 0 : prev.update(ChangeType.status);
4767
4798
  this.update(ChangeType.status);
@@ -4770,7 +4801,7 @@ class WunderbaumNode {
4770
4801
  if (flag) {
4771
4802
  if (focusTree || edit) {
4772
4803
  tree.setFocus();
4773
- tree.focusNode = this;
4804
+ tree._setFocusNode(this);
4774
4805
  tree.focusNode.setFocus();
4775
4806
  }
4776
4807
  // if (focusNode || edit) {
@@ -4796,7 +4827,7 @@ class WunderbaumNode {
4796
4827
  this.isExpanded() &&
4797
4828
  this.getLevel() <= this.tree.getOption("minExpandLevel") &&
4798
4829
  !force) {
4799
- this.logDebug("Ignored collapse request below expandLevel.");
4830
+ this.logDebug("Ignored collapse request below minExpandLevel.");
4800
4831
  return;
4801
4832
  }
4802
4833
  if (!flag === !this.expanded) {
@@ -4835,7 +4866,7 @@ class WunderbaumNode {
4835
4866
  setFocus(flag = true) {
4836
4867
  assert(!!flag, "Blur is not yet implemented");
4837
4868
  const prev = this.tree.focusNode;
4838
- this.tree.focusNode = this;
4869
+ this.tree._setFocusNode(this);
4839
4870
  prev === null || prev === void 0 ? void 0 : prev.update();
4840
4871
  this.update();
4841
4872
  }
@@ -5288,7 +5319,7 @@ WunderbaumNode.sequence = 0;
5288
5319
  /*!
5289
5320
  * Wunderbaum - ext-edit
5290
5321
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
5291
- * v0.8.0, Thu, 11 Jan 2024 19:37:23 GMT (https://github.com/mar10/wunderbaum)
5322
+ * v0.8.1, Sat, 20 Jan 2024 15:57:59 GMT (https://github.com/mar10/wunderbaum)
5292
5323
  */
5293
5324
  // const START_MARKER = "\uFFF7";
5294
5325
  class EditExtension extends WunderbaumExtension {
@@ -5617,8 +5648,8 @@ class EditExtension extends WunderbaumExtension {
5617
5648
  * https://github.com/mar10/wunderbaum
5618
5649
  *
5619
5650
  * Released under the MIT license.
5620
- * @version v0.8.0
5621
- * @date Thu, 11 Jan 2024 19:37:23 GMT
5651
+ * @version v0.8.1
5652
+ * @date Sat, 20 Jan 2024 15:57:59 GMT
5622
5653
  */
5623
5654
  // import "./wunderbaum.scss";
5624
5655
  class WbSystemRoot extends WunderbaumNode {
@@ -5638,6 +5669,22 @@ class WbSystemRoot extends WunderbaumNode {
5638
5669
  * See also {@link WunderbaumOptions}.
5639
5670
  */
5640
5671
  class Wunderbaum {
5672
+ /** Currently active node if any.
5673
+ * Use @link {WunderbaumNode.setActive|setActive} to modify.
5674
+ */
5675
+ get activeNode() {
5676
+ var _a;
5677
+ // Check for deleted node, i.e. node.tree === null
5678
+ return ((_a = this._activeNode) === null || _a === void 0 ? void 0 : _a.tree) ? this._activeNode : null;
5679
+ }
5680
+ /** Current node hat has keyboard focus if any.
5681
+ * Use @link {WunderbaumNode.setFocus|setFocus()} to modify.
5682
+ */
5683
+ get focusNode() {
5684
+ var _a;
5685
+ // Check for deleted node, i.e. node.tree === null
5686
+ return ((_a = this._focusNode) === null || _a === void 0 ? void 0 : _a.tree) ? this._focusNode : null;
5687
+ }
5641
5688
  constructor(options) {
5642
5689
  this.enabled = true;
5643
5690
  /** Contains additional data that was sent as response to an Ajax source load request. */
@@ -5649,10 +5696,8 @@ class Wunderbaum {
5649
5696
  this.treeRowCount = 0;
5650
5697
  this._disableUpdateCount = 0;
5651
5698
  this._disableUpdateIgnoreCount = 0;
5652
- /** Currently active node if any. */
5653
- this.activeNode = null;
5654
- /** Current node hat has keyboard focus if any. */
5655
- this.focusNode = null;
5699
+ this._activeNode = null;
5700
+ this._focusNode = null;
5656
5701
  /** Shared properties, referenced by `node.type`. */
5657
5702
  this.types = {};
5658
5703
  /** List of column definitions. */
@@ -5678,10 +5723,6 @@ class Wunderbaum {
5678
5723
  this.lastQuicksearchTerm = "";
5679
5724
  // --- EDIT ---
5680
5725
  this.lastClickTime = 0;
5681
- /** Alias for {@link Wunderbaum.logDebug}.
5682
- * @alias Wunderbaum.logDebug
5683
- */
5684
- this.log = this.logDebug;
5685
5726
  const opts = (this.options = extend({
5686
5727
  id: null,
5687
5728
  source: null,
@@ -6071,7 +6112,8 @@ class Wunderbaum {
6071
6112
  /** Add node to tree's bookkeeping data structures. */
6072
6113
  _registerNode(node) {
6073
6114
  const key = node.key;
6074
- assert(key != null && !this.keyMap.has(key), `Missing or duplicate key: '${key}'.`);
6115
+ assert(key != null, `Missing key: '${node}'.`);
6116
+ assert(!this.keyMap.has(key), `Duplicate key: '${key}': ${node}.`);
6075
6117
  this.keyMap.set(key, node);
6076
6118
  const rk = node.refKey;
6077
6119
  if (rk != null) {
@@ -6352,8 +6394,8 @@ class Wunderbaum {
6352
6394
  this.keyMap.clear();
6353
6395
  this.refKeyMap.clear();
6354
6396
  this.treeRowCount = 0;
6355
- this.activeNode = null;
6356
- this.focusNode = null;
6397
+ this._activeNode = null;
6398
+ this._focusNode = null;
6357
6399
  // this.types = {};
6358
6400
  // this. columns =[];
6359
6401
  // this._columnsById = {};
@@ -6752,10 +6794,13 @@ class Wunderbaum {
6752
6794
  return null;
6753
6795
  }
6754
6796
  /**
6755
- * Return the currently active node or null.
6797
+ * Return the currently active node or null (alias for `tree.activeNode`).
6798
+ * Alias for {@link Wunderbaum.activeNode}.
6799
+ *
6756
6800
  * @see {@link WunderbaumNode.setActive}
6757
6801
  * @see {@link WunderbaumNode.isActive}
6758
- * @see {@link WunderbaumNode.getFocusNode}
6802
+ * @see {@link Wunderbaum.activeNode}
6803
+ * @see {@link Wunderbaum.focusNode}
6759
6804
  */
6760
6805
  getActiveNode() {
6761
6806
  return this.activeNode;
@@ -6768,7 +6813,11 @@ class Wunderbaum {
6768
6813
  }
6769
6814
  /**
6770
6815
  * Return the node that currently has keyboard focus or null.
6771
- * @see {@link WunderbaumNode.getActiveNode}
6816
+ * Alias for {@link Wunderbaum.focusNode}.
6817
+ * @see {@link WunderbaumNode.setFocus}
6818
+ * @see {@link WunderbaumNode.hasFocus}
6819
+ * @see {@link Wunderbaum.activeNode}
6820
+ * @see {@link Wunderbaum.focusNode}
6772
6821
  */
6773
6822
  getFocusNode() {
6774
6823
  return this.focusNode;
@@ -6874,19 +6923,30 @@ class Wunderbaum {
6874
6923
  }, true);
6875
6924
  return res;
6876
6925
  }
6877
- /** Log to console if opts.debugLevel >= 4 */
6878
- logDebug(...args) {
6926
+ /** Write to `console.log` with tree name as prefix if opts.debugLevel >= 4.
6927
+ * @see {@link Wunderbaum.logDebug}
6928
+ */
6929
+ log(...args) {
6879
6930
  if (this.options.debugLevel >= 4) {
6880
6931
  console.log(this.toString(), ...args); // eslint-disable-line no-console
6881
6932
  }
6882
6933
  }
6883
- /** Log error to console. */
6934
+ /** Write to `console.debug` with tree name as prefix if opts.debugLevel >= 4.
6935
+ * and browser console level includes debug/verbose messages.
6936
+ * @see {@link Wunderbaum.log}
6937
+ */
6938
+ logDebug(...args) {
6939
+ if (this.options.debugLevel >= 4) {
6940
+ console.debug(this.toString(), ...args); // eslint-disable-line no-console
6941
+ }
6942
+ }
6943
+ /** Write to `console.error` with tree name as prefix. */
6884
6944
  logError(...args) {
6885
6945
  if (this.options.debugLevel >= 1) {
6886
6946
  console.error(this.toString(), ...args); // eslint-disable-line no-console
6887
6947
  }
6888
6948
  }
6889
- /** Log to console if opts.debugLevel >= 3 */
6949
+ /** Write to `console.info` with tree name as prefix if opts.debugLevel >= 3. */
6890
6950
  logInfo(...args) {
6891
6951
  if (this.options.debugLevel >= 3) {
6892
6952
  console.info(this.toString(), ...args); // eslint-disable-line no-console
@@ -6905,7 +6965,7 @@ class Wunderbaum {
6905
6965
  console.timeEnd(this + ": " + label); // eslint-disable-line no-console
6906
6966
  }
6907
6967
  }
6908
- /** Log to console if opts.debugLevel >= 2 */
6968
+ /** Write to `console.warn` with tree name as prefix with if opts.debugLevel >= 2. */
6909
6969
  logWarn(...args) {
6910
6970
  if (this.options.debugLevel >= 2) {
6911
6971
  console.warn(this.toString(), ...args); // eslint-disable-line no-console
@@ -7043,6 +7103,10 @@ class Wunderbaum {
7043
7103
  }
7044
7104
  }
7045
7105
  }
7106
+ /* Set or remove keyboard focus to the tree container. @internal */
7107
+ _setActiveNode(node) {
7108
+ this._activeNode = node;
7109
+ }
7046
7110
  /** Set or remove keyboard focus to the tree container. */
7047
7111
  setActiveNode(key, flag = true, options) {
7048
7112
  var _a;
@@ -7057,6 +7121,10 @@ class Wunderbaum {
7057
7121
  this.element.blur();
7058
7122
  }
7059
7123
  }
7124
+ /* Set or remove keyboard focus to the tree container. @internal */
7125
+ _setFocusNode(node) {
7126
+ this._focusNode = node;
7127
+ }
7060
7128
  update(change, node, options) {
7061
7129
  // this.log(`update(${change}) node=${node}`);
7062
7130
  if (!(node instanceof WunderbaumNode)) {
@@ -7799,7 +7867,7 @@ class Wunderbaum {
7799
7867
  }
7800
7868
  Wunderbaum.sequence = 0;
7801
7869
  /** Wunderbaum release version number "MAJOR.MINOR.PATCH". */
7802
- Wunderbaum.version = "v0.8.0"; // Set to semver by 'grunt release'
7870
+ Wunderbaum.version = "v0.8.1"; // Set to semver by 'grunt release'
7803
7871
  /** Expose some useful methods of the util.ts module as `Wunderbaum.util`. */
7804
7872
  Wunderbaum.util = util;
7805
7873