powerpagestoolkit 2.7.121 → 2.7.132

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.
@@ -1,4 +1,34 @@
1
1
  import * as s from "@/constants/symbols.js";
2
+ declare type BusinessRule = {
3
+ /**
4
+ * @param condition A function that returns a boolean to determine
5
+ * the visibility of the target element. If `condition()` returns true, the element is shown;
6
+ * otherwise, it is hidden.
7
+
8
+ * @param clearValuesOnHide Should the values in the targeted field be cleared when hidden? Defaults to true
9
+ */
10
+ setVisibility?: [condition: () => boolean, clearValuesOnHide?: boolean];
11
+ /**
12
+ * @param isRequired Function determining if field is required
13
+ * @param isValid Function validating field input.
14
+ */
15
+ setRequired?: [
16
+ isRequired: () => boolean,
17
+ isValid: (isRequired: boolean) => boolean
18
+ ];
19
+ /**
20
+ * @param condition A function to determine if the value provided should be applied to this field
21
+ * @param value The value to set for the HTML element.
22
+ * for parents of boolean radios, pass true or false as value, or
23
+ * an expression returning a boolean
24
+ */
25
+ setValue?: [condition: () => boolean, value: () => any | any];
26
+ /**
27
+ * @param condition A function to determine if this field
28
+ * should be enabled in a form, or disabled. True || 1 = disabled. False || 0 = enabled
29
+ */
30
+ setDisabled?: () => boolean;
31
+ };
2
32
  export default class DOMNodeReference {
3
33
  target: Element | string;
4
34
  logicalName?: string;
@@ -251,3 +281,4 @@ export default class DOMNodeReference {
251
281
  */
252
282
  onceLoaded(callback: (instance: DOMNodeReference) => any): any;
253
283
  }
284
+ export {};
@@ -1,10 +1,13 @@
1
1
  import DOMNodeReference from "./DOMNodeReference.js";
2
2
  import DOMNodeReferenceArray from "./DOMNodeReferenceArray.js";
3
+ declare type BoundForm = DOMNodeReferenceArray & Record<string, DOMNodeReference>;
3
4
  /**
4
5
  * Get all controls related to the form for manipulating with the
5
6
  * DOMNodeReference class. Rather than having to instantiate each fields that you need manually,
6
7
  * you can call this method once with the form ID and gain access to all fields
7
8
  * @param formId The string GUID of the form you want to bind to
8
- * @returns An array of DOMNodeReferences
9
+ * @returns An array of DOMNodeReferences, accessible as properties of a Record<string, DOMNodeReference> i.e. formProp = form["some_logicalName"]
10
+ * @see {@link BoundForm}
9
11
  */
10
- export default function bindForm<T extends string>(formId: string): Promise<DOMNodeReferenceArray & Record<T, DOMNodeReference>>;
12
+ export default function bindForm(formId: string): Promise<BoundForm>;
13
+ export {};
@@ -7,7 +7,7 @@ import DOMNodeReferenceArray from "./DOMNodeReferenceArray.js";
7
7
  * @param options Options for advanced retrieval of elements
8
8
  * @param options.multiple - Should this call return an array of instantiated references, or just a single? Defaults to false, returning a single instance
9
9
  * @param options.root - Optionally specify the element within to search for the element targeted by 'target'. Defaults to 'document.body'
10
- * @param options.timeoutMs - Optionally specify the amount of time that should be waited to find the targeted element before throwing error - useful for async DOM loading. Relies on MutationObserver. WARNING: Implementing multiple references with timeout can results in infinite loading.
10
+ * @param options.timeoutMs - Optionally specify the amount of time that should be waited to find the targeted element before throwing error - useful for async DOM loading. Relies on MutationObserver. ***WARNING***: Implementing multiple references with timeout can result in infinite loading.
11
11
  * @returns A promise that resolves to a Proxy of the initialized DOMNodeReference instance.
12
12
  */
13
13
  export default function createDOMNodeReference(target: string | HTMLElement, options?: {
@@ -1,6 +1,6 @@
1
1
  import "./style.css";
2
2
  import API from "./core/API.js";
3
3
  import createRef from "./core/createDOMNodeReferences.js";
4
- import waitFor from "./utils/waitFor.js";
4
+ import waitFor from "./core/waitFor.js";
5
5
  import bindForm from "./core/bindForm.js";
6
6
  export { API, createRef, waitFor, bindForm };
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "powerpagestoolkit",
3
- "version": "2.7.121",
3
+ "version": "2.7.132",
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",
7
+ "unpkg": "./dist/index.iife.js",
8
+ "jsdelivr": "./dist/index.iife.js",
9
+ "browser": "./dist/index.iife.js",
10
+ "typesVersions": {
11
+ "*": {
12
+ "*": ["./dist/types/*"]
13
+ }
14
+ },
7
15
  "scripts": {
8
16
  "typecheck": "tsc",
9
17
  "node:build": "node build.js",
@@ -17,7 +25,7 @@
17
25
  "@types/node": "^22.8.6",
18
26
  "@typescript-eslint/parser": "^8.20.0",
19
27
  "css-loader": "^7.1.2",
20
- "esbuild": "^0.24.0",
28
+ "esbuild": "^0.24.2",
21
29
  "esbuild-css-modules-plugin": "^3.1.2",
22
30
  "eslint": "^8.57.1",
23
31
  "eslint-plugin-import": "^2.31.0",
@@ -60,6 +68,7 @@
60
68
  "files": [
61
69
  "dist/bundle.js",
62
70
  "dist/bundle.css",
71
+ "dist/index.iife.js",
63
72
  "dist/types/**/*.d.ts",
64
73
  "assets/**"
65
74
  ],
File without changes