wunderbaum 0.10.0 → 0.10.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.
package/src/types.ts CHANGED
@@ -358,12 +358,13 @@ export interface ColumnDefinition {
358
358
  * Default: unset.
359
359
  */
360
360
  customWidthPx?: number;
361
- /** Allow user to sort the column.
362
- * Default: false.
361
+ /** Allow user to sort the column. Default: false. <br>
362
+ * **Note:** Sorting is not implemented yet.
363
363
  */
364
364
  sortable?: boolean;
365
365
  /** Optional custom column sort orde when user clicked the sort icon.
366
- * Default: unset.
366
+ * Default: unset. <br>
367
+ * **Note:** Sorting is not implemented yet.
367
368
  */
368
369
  sortOrder?: SortOrderType;
369
370
  /** Optional class names that are added to all `span.wb-col` header AND data
package/src/util.ts CHANGED
@@ -521,7 +521,7 @@ export function isArray(obj: any) {
521
521
  return Array.isArray(obj);
522
522
  }
523
523
 
524
- /** Return true if `obj` is of type `Object` and has no propertied. */
524
+ /** Return true if `obj` is of type `Object` and has no properties. */
525
525
  export function isEmptyObject(obj: any) {
526
526
  return Object.keys(obj).length === 0 && obj.constructor === Object;
527
527
  }
@@ -770,7 +770,9 @@ export function toSet(val: any): Set<string> {
770
770
  *
771
771
  * Example:
772
772
  * ```js
773
- * const width = util.toPixel("123px", 100);
773
+ * let x = undefined;
774
+ * let y = "123px";
775
+ * const width = util.toPixel(x, y, 100); // returns 123
774
776
  * ```
775
777
  */
776
778
  export function toPixel(
@@ -792,11 +794,11 @@ export function toPixel(
792
794
  throw new Error(`Expected a string like '123px': ${defaults}`);
793
795
  }
794
796
 
795
- /** Evaluate a boolean value using default if undefined.
797
+ /** Return the the boolean value of the first non-null element.
796
798
  * Example:
797
799
  * ```js
798
800
  * const opts = { flag: true };
799
- * const value = util.toBool(opts.flag, otherVar, false);
801
+ * const value = util.toBool(opts.foo, opts.flag, false); // returns true
800
802
  * ```
801
803
  */
802
804
  export function toBool(
@@ -52,6 +52,10 @@ export class FilterExtension extends WunderbaumExtension<FilterOptionsType> {
52
52
  const connectInput = this.getPluginOption("connectInput");
53
53
  if (connectInput) {
54
54
  this.queryInput = elemFromSelector(connectInput) as HTMLInputElement;
55
+ assert(
56
+ this.queryInput,
57
+ `Invalid 'filter.connectInput' option: ${connectInput}.`
58
+ );
55
59
  onEvent(
56
60
  this.queryInput,
57
61
  "input",
@@ -183,8 +183,8 @@ div.wunderbaum {
183
183
  position: sticky;
184
184
  top: 0;
185
185
  z-index: 2;
186
- user-select: none;
187
186
  -webkit-user-select: none; /* Safari */
187
+ user-select: none;
188
188
  }
189
189
 
190
190
  div.wb-header,
@@ -386,8 +386,8 @@ div.wunderbaum {
386
386
  border: none;
387
387
  border-right: 2px solid var(--wb-border-color);
388
388
  height: 100%;
389
- user-select: none;
390
389
  -webkit-user-select: none; // Safari
390
+ user-select: none;
391
391
  &.wb-col-resizer-active {
392
392
  cursor: col-resize;
393
393
  // border-right-color: red;
@@ -412,8 +412,8 @@ div.wunderbaum {
412
412
  }
413
413
 
414
414
  span.wb-node {
415
- user-select: none;
416
415
  -webkit-user-select: none; // Safari
416
+ user-select: none;
417
417
  // &:first-of-type {
418
418
  // margin-left: 8px; // leftmost icon gets a little margin
419
419
  // }
@@ -773,12 +773,12 @@ div.wunderbaum {
773
773
  }
774
774
 
775
775
  .wb-no-select {
776
- user-select: none;
777
776
  -webkit-user-select: none; // Safari
777
+ user-select: none;
778
778
 
779
779
  span.wb-title {
780
- user-select: contain;
781
780
  -webkit-user-select: contain; // Safari
781
+ user-select: contain;
782
782
  }
783
783
  }
784
784
 
package/src/wunderbaum.ts CHANGED
@@ -2242,6 +2242,10 @@ export class Wunderbaum {
2242
2242
  }
2243
2243
 
2244
2244
  if (this.options.connectTopBreadcrumb) {
2245
+ util.assert(
2246
+ this.options.connectTopBreadcrumb.textContent != null,
2247
+ `Invalid 'connectTopBreadcrumb' option (input element expected).`
2248
+ );
2245
2249
  let path = this.getTopmostVpNode(true)?.getPath(false, "title", " > ");
2246
2250
  path = path ? path + " >" : "";
2247
2251
  this.options.connectTopBreadcrumb.textContent = path;