powerpagestoolkit 2.6.3323 → 2.6.3327

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.
@@ -11,7 +11,7 @@ declare const _debounceTime: unique symbol;
11
11
  declare const _observers: unique symbol;
12
12
  declare const _boundEventListeners: unique symbol;
13
13
  export default class DOMNodeReference {
14
- target: HTMLElement | QuerySelector;
14
+ target: HTMLElement | string;
15
15
  root: HTMLElement;
16
16
  private [_debounceTime];
17
17
  private isLoaded;
package/dist/bundle.js CHANGED
@@ -1026,10 +1026,30 @@ var DOMNodeReference = class _DOMNodeReference {
1026
1026
  async function createDOMNodeReference(target, options = {
1027
1027
  multiple: false,
1028
1028
  root: document.body,
1029
- timeout: 1e3
1029
+ timeout: 0
1030
1030
  }) {
1031
- const { multiple = false, root = document.body, timeout = 0 } = options;
1032
1031
  try {
1032
+ if (typeof options !== "object") {
1033
+ throw new Error(
1034
+ `'options' must be of type 'object'. Received type: '${typeof options}'`
1035
+ );
1036
+ }
1037
+ const { multiple = false, root = document.body, timeout = 0 } = options;
1038
+ if (typeof multiple !== "boolean" && typeof multiple !== "function") {
1039
+ throw new Error(
1040
+ `'multiple' must be of type 'boolean' or 'function'. Received type: '${typeof multiple}'`
1041
+ );
1042
+ }
1043
+ if (!(root instanceof HTMLElement)) {
1044
+ throw new Error(
1045
+ `'root' must be of type 'HTMLElement'. Received type: '${typeof root}'`
1046
+ );
1047
+ }
1048
+ if (typeof timeout !== "number") {
1049
+ throw new Error(
1050
+ `'timeout' must be of type 'number'. Received type: '${typeof timeout}'`
1051
+ );
1052
+ }
1033
1053
  const isMultiple = typeof multiple === "function" ? multiple() : multiple;
1034
1054
  if (isMultiple) {
1035
1055
  if (typeof target !== "string") {
@@ -1,10 +1,10 @@
1
1
  import DOMNodeReference from "./DOMNodeReference.js";
2
- export default function createDOMNodeReference(target: HTMLElement | QuerySelector, options?: {
2
+ export default function createDOMNodeReference(target: HTMLElement | string, options?: {
3
3
  multiple?: (() => boolean) | false;
4
4
  root?: HTMLElement;
5
5
  timeout?: number;
6
6
  }): Promise<DOMNodeReference>;
7
- export default function createDOMNodeReference(target: HTMLElement | QuerySelector, options?: {
7
+ export default function createDOMNodeReference(target: string, options?: {
8
8
  multiple?: (() => true) | true;
9
9
  root?: HTMLElement;
10
10
  timeout?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerpagestoolkit",
3
- "version": "2.6.3323",
3
+ "version": "2.6.3327",
4
4
  "description": "Reference, manipulate, and engage with Power Pages sites through the nodes in the DOM; use a variety of custom methods that allow customizing your power pages site quicker and easier. ",
5
5
  "main": "./dist/bundle.js",
6
6
  "types": "./dist/index.d.ts",