powerpagestoolkit 2.7.1211 → 2.7.1311

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/README.md CHANGED
@@ -35,7 +35,7 @@ createRef(
35
35
  options: {
36
36
  multiple: (() => boolean) | boolean = false,
37
37
  root: HTMLElement,
38
- timeout: number
38
+ timeoutMs:number
39
39
  }
40
40
  ): Promise<DOMNodeReference | DOMNodeReference[]>;
41
41
  ```
@@ -66,7 +66,7 @@ createRef takes two main arguments:
66
66
  <pre><code class="language-javascript">{
67
67
  multiple: () => boolean | boolean,
68
68
  root: HTMLElement,
69
- timeout: number
69
+ timeoutMs:number
70
70
  }</code></pre>
71
71
  </td>
72
72
  <td style="border: 1px solid #ddd; padding: 8px;">
@@ -98,7 +98,7 @@ const nodes = await createRef(".my-class", { multiple: true });
98
98
 
99
99
  // If the node you are targeting is not available at the initial execution
100
100
  // of the script, set a timeout for 2 seconds
101
- const node2 = await createRef("#target", { timeout: 2000 });
101
+ const node2 = await createRef("#target", { timeoutMs:2000 });
102
102
 
103
103
  // need to target a node within a specific node? use that node as the root
104
104
  const otherElement = document.getElementById("id");
@@ -107,7 +107,7 @@ const node3 = await createRef("#target", { root: otherElement });
107
107
  // implement all options:
108
108
  const nodes2 = await createRef("#target", {
109
109
  multiple: true,
110
- timeout: 4000,
110
+ timeoutMs:4000,
111
111
  root: otherElement,
112
112
  });
113
113
  ```
package/dist/bundle.js CHANGED
@@ -102,11 +102,11 @@ var API = {
102
102
  };
103
103
  var API_default = API;
104
104
 
105
- // src/utils/waitFor.ts
105
+ // src/core/waitFor.ts
106
106
  function waitFor(target, root = document, multiple = false, debounceTime2) {
107
107
  return new Promise((resolve, reject) => {
108
108
  if (multiple) {
109
- let timeout;
109
+ let timeoutMs;
110
110
  const observedElements = [];
111
111
  const observedSet = /* @__PURE__ */ new Set();
112
112
  if (debounceTime2 < 1) {
@@ -122,8 +122,8 @@ function waitFor(target, root = document, multiple = false, debounceTime2) {
122
122
  observedElements.push(element);
123
123
  }
124
124
  });
125
- clearTimeout(timeout);
126
- timeout = setTimeout(() => {
125
+ clearTimeout(timeoutMs);
126
+ timeoutMs = setTimeout(() => {
127
127
  if (observedElements.length > 0) {
128
128
  observer.disconnect();
129
129
  resolve(observedElements);
@@ -613,10 +613,15 @@ var DOMNodeReference = class _DOMNodeReference {
613
613
  }
614
614
  const eventType = this.determineEventType();
615
615
  this.element.dispatchEvent(new Event(eventType, { bubbles: false }));
616
- if (this.element.classList.contains("boolean-radio") && this.yesRadio instanceof _DOMNodeReference && this.noRadio instanceof _DOMNodeReference) {
616
+ if (this.yesRadio instanceof _DOMNodeReference && this.noRadio instanceof _DOMNodeReference) {
617
617
  this.yesRadio.element.checked = value;
618
618
  this.noRadio.element.checked = !value;
619
619
  this.value = value;
620
+ this.checked = value;
621
+ this.element.checked = value;
622
+ } else if (this.isRadio || this.element.type === "radio") {
623
+ this.checked = value;
624
+ this.element.checked = value;
620
625
  } else {
621
626
  this.element.value = value;
622
627
  }
@@ -892,7 +897,7 @@ var DOMNodeReference = class _DOMNodeReference {
892
897
  evaluationfunction: () => {
893
898
  const isFieldRequired = isRequired.bind(this)();
894
899
  const isFieldVisible = window.getComputedStyle(this.visibilityController).display !== "none";
895
- return !isFieldRequired || !isFieldVisible || isValid.bind(this)();
900
+ return !isFieldRequired || !isFieldVisible || isValid.bind(this)(isFieldRequired);
896
901
  }
897
902
  });
898
903
  Page_Validators.push(newValidator);