powerpagestoolkit 1.3.304 → 1.3.502

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.
@@ -1084,9 +1084,15 @@ var DOMNodeReference = /*#__PURE__*/function () {
1084
1084
  return this;
1085
1085
  }
1086
1086
  }, {
1087
- key: "setTextContent",
1088
- value: function setTextContent(text) {
1089
- this.element.innerHTML = text;
1087
+ key: "setInnerHTML",
1088
+ value: function setInnerHTML(string) {
1089
+ this.element.innerHTML = string;
1090
+ return this;
1091
+ }
1092
+ }, {
1093
+ key: "remove",
1094
+ value: function remove() {
1095
+ this.element.remove();
1090
1096
  return this;
1091
1097
  }
1092
1098
  }, {
@@ -1241,9 +1247,10 @@ function _createDOMNodeReference() {
1241
1247
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
1242
1248
  args[_key6] = arguments[_key6];
1243
1249
  }
1244
- return target.onceLoaded(function () {
1250
+ target.onceLoaded(function () {
1245
1251
  return value.apply(target, args);
1246
1252
  });
1253
+ return target;
1247
1254
  };
1248
1255
  }
1249
1256
  return value;
package/index.d.ts CHANGED
@@ -47,55 +47,64 @@ class DOMNodeReference {
47
47
 
48
48
  /**
49
49
  * Hides the element by setting its display style to "none".
50
+ * @returns {DOMNodeReference} Returns 'this'
50
51
  */
51
- hide(): void;
52
+ hide(): DOMNodeReference;
52
53
 
53
54
  /**
54
55
  * Shows the element by restoring its default display style.
56
+ * @returns {DOMNodeReference} Returns 'this'
55
57
  */
56
- show(): void;
58
+ show(): DOMNodeReference;
57
59
 
58
60
  /**
59
61
  * Sets the value of the HTML element.
60
62
  * @param {() => any} value - The value to set for the HTML element.
61
63
  * for parents of boolean radios, pass true or false as value, or
62
64
  * an expression returning a boolean
65
+ * @returns {DOMNodeReference} Returns 'this'
63
66
  */
64
- setValue(value: string): void;
67
+ setValue(value: string): DOMNodeReference;
65
68
 
66
69
  /**
67
70
  * Disables the element so that users cannot input any data
71
+ * @returns {DOMNodeReference} Returns 'this'
68
72
  */
69
- disable(): void;
73
+ disable(): DOMNodeReference;
70
74
 
71
75
  /**
72
76
  * Enables the element so that users can input data
77
+ * @returns {DOMNodeReference} Returns 'this'
73
78
  */
74
- enable(): void;
79
+ enable(): DOMNodeReference;
75
80
 
76
81
  /**
77
82
  * Prepends elements to the target
78
83
  * @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to prepend to the HTML element
84
+ * @returns {DOMNodeReference} Returns 'this'
79
85
  */
80
- prepend(...nodes: HTMLElement[] | DOMNodeReference[]): void;
86
+ prepend(...nodes: HTMLElement[] | DOMNodeReference[]): DOMNodeReference;
81
87
 
82
88
  /**
83
89
  * Appends child elements to the HTML element.
84
90
  * @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to append to the HTML element.
91
+ * @returns {DOMNodeReference} Returns 'this'
85
92
  */
86
- append(...nodes: HTMLElement[] | DOMNodeReference[]): void;
93
+ append(...nodes: HTMLElement[] | DOMNodeReference[]): DOMNodeReference;
87
94
 
88
95
  /**
89
96
  * Inserts elements before the HTML element.
90
97
  * @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to insert before the HTML element.
98
+ * @returns {DOMNodeReference} Returns 'this'
91
99
  */
92
- before(...nodes: HTMLElement[] | DOMNodeReference[]): void;
100
+ before(...nodes: HTMLElement[] | DOMNodeReference[]): DOMNodeReference;
93
101
 
94
102
  /**
95
103
  * Inserts elements after the HTML element.
96
104
  * @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to insert after the HTML element.
105
+ * @returns {DOMNodeReference} Returns 'this'
97
106
  */
98
- after(...nodes: HTMLElement[] | DOMNodeReference[]): void;
107
+ after(...nodes: HTMLElement[] | DOMNodeReference[]): DOMNodeReference;
99
108
 
100
109
  /**
101
110
  * Retrieves the label associated with the HTML element.
@@ -107,8 +116,9 @@ class DOMNodeReference {
107
116
  /**
108
117
  * Appends child elements to the label associated with the HTML element.
109
118
  * @param {...HTMLElement} elements - The elements to append to the label.
119
+ * @returns {DOMNodeReference} Returns 'this'
110
120
  */
111
- appendToLabel(...elements: HTMLElement[]): void;
121
+ appendToLabel(...elements: HTMLElement[]): DOMNodeReference;
112
122
 
113
123
  /**
114
124
  * Sets up an event listener based on the specified event type, executing the specified
@@ -116,12 +126,15 @@ class DOMNodeReference {
116
126
  * @param {string} eventType - The DOM event to watch for
117
127
  * @param {(this: DOMNodeReference, e: Event) => void} eventHandler - The callback function that runs when the
118
128
  * specified event occurs
129
+ * @returns {DOMNodeReference} Returns 'this'
119
130
  */
120
- on(eventType: string, eventHandler: (event: Event) => void): void;
131
+ on(eventType: string, eventHandler: (event: Event) => void): DOMNodeReference;
132
+
121
133
  /**
122
134
  * Unchecks both the yes and no radio buttons if they exist.
135
+ * @returns {DOMNodeReference} Returns 'this'
123
136
  */
124
- uncheckRadios(): void;
137
+ uncheckRadios(): DOMNodeReference;
125
138
 
126
139
  /**
127
140
  * Sets up validation and requirement rules for the field. This function dynamically updates the field's required status and validates its input based on the specified conditions.
@@ -130,53 +143,66 @@ class DOMNodeReference {
130
143
  * @param {function(this: DOMNodeReference): boolean} isValid - A function that checks if the field's input is valid. Returns `true` if valid, `false` otherwise.
131
144
  * @param {string} fieldDisplayName - The name of the field, used in error messages if validation fails.
132
145
  * @param {Array<DOMNodeReference>} [dependencies] Other fields that this field’s requirement depends on. When these fields change, the required status of this field is re-evaluated. Make sure any DOMNodeReference used in `isRequired` or `isValid` is included in this array.
146
+ * @returns {DOMNodeReference} Returns 'this'
133
147
  */
134
148
  configureValidationAndRequirements(
135
149
  isRequired: (this: this) => boolean,
136
150
  isValid: (this: this) => boolean,
137
151
  fieldDisplayName: string,
138
152
  dependencies: Array<DOMNodeReference>
139
- ): void;
153
+ ): DOMNodeReference;
140
154
 
141
155
  /**
142
156
  * Sets the required level for the field by adding or removing the "required-field" class on the label.
143
157
  *
144
158
  * @param {boolean} isRequired - Determines whether the field should be marked as required.
145
159
  * If true, the "required-field" class is added to the label; if false, it is removed.
160
+ * @returns {DOMNodeReference} Returns 'this'
146
161
  */
147
- setRequiredLevel(isRequired: boolean): void;
162
+ setRequiredLevel(isRequired: boolean): DOMNodeReference;
148
163
 
149
164
  /**
150
165
  * Adds a tooltip with specified text to the label associated with the HTML element.
151
166
  * @param {string} text - The text to display in the tooltip.
167
+ * @returns {DOMNodeReference} Returns 'this'
152
168
  */
153
- addLabelTooltip(text: string): void;
169
+ addLabelTooltip(text: string): DOMNodeReference;
154
170
 
155
171
  /**
156
172
  * Adds a tooltip with the specified text to the element
157
173
  * @param {string} text - The text to display in the tooltip
174
+ * @returns {DOMNodeReference} Returns 'this'
158
175
  */
159
- addTooltip(text: string): void;
176
+ addTooltip(text: string): DOMNodeReference;
160
177
 
161
178
  /**
162
179
  * Sets the inner HTML content of the HTML element.
163
180
  * @param {string} text - The text to set as the inner HTML of the element.
181
+ * @returns {DOMNodeReference} Returns 'this'
182
+ */
183
+ setInnerHTML(text: string): DOMNodeReference;
184
+
185
+ /**
186
+ * Removes the element from the DOM
187
+ * @returns {DOMNodeReference} Returns 'this'
164
188
  */
165
- setTextContent(text: string): void;
189
+ remove(): DOMNodeReference;
166
190
 
167
191
  /**
168
192
  *
169
193
  * @param {Partial<CSSStyleDeclaration>} options - An object with the style properties (keys) and updated styles (values)
170
194
  * to apply to the this. {"key": "value"}
195
+ * @returns {DOMNodeReference} Returns 'this'
171
196
  */
172
- setStyle(options: Partial<CSSStyleDeclaration>): void;
197
+ setStyle(options: Partial<CSSStyleDeclaration>): DOMNodeReference;
173
198
 
174
199
  /**
175
200
  *
176
201
  * @param {boolean} shouldShow shows or hides the target
177
202
  * if = true => show, if = false => hide
203
+ * @returns {DOMNodeReference} Returns 'this'
178
204
  */
179
- toggleVisibility(shouldShow: boolean): void;
205
+ toggleVisibility(shouldShow: boolean): DOMNodeReference;
180
206
 
181
207
  /**
182
208
  * Configures conditional rendering for the target element based on a condition
@@ -188,11 +214,12 @@ class DOMNodeReference {
188
214
  * @param {Array<DOMNodeReference>} dependencies - An array of `DOMNodeReference` instances. Event listeners are
189
215
  * registered on each to toggle the visibility of the target element based on the `condition` and the visibility of
190
216
  * the target node.
217
+ * @returns {DOMNodeReference} Returns 'this'
191
218
  */
192
219
  configureConditionalRendering(
193
220
  condition: (this: DOMNodeReference) => boolean,
194
221
  dependencies: DOMNodeReference[]
195
- ): void;
222
+ ): DOMNodeReference;
196
223
 
197
224
  /**
198
225
  * Executes a callback function once the element is fully loaded.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerpagestoolkit",
3
- "version": "1.3.304",
3
+ "version": "1.3.502",
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/index.bundle.js",
6
6
  "types": "index.d.ts",