powerpagestoolkit 3.0.3 → 3.0.311

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
@@ -21,13 +21,13 @@ npm install powerpagestoolkit
21
21
 
22
22
  # Core Modules
23
23
 
24
- ### DOMNodeReference
24
+ ### PowerPagesElement
25
25
 
26
26
  A powerful class for managing DOM elements with automatic value synchronization and event handling.
27
27
 
28
28
  #### Basic Usage
29
29
 
30
- DOMNodeReferences are instantiated with the help of the following factory function: `createRef`
30
+ PowerPagesElements are instantiated with the help of the following factory function: `createRef`
31
31
 
32
32
  ```typescript
33
33
  createRef(
@@ -37,7 +37,7 @@ createRef(
37
37
  root: HTMLElement,
38
38
  timeoutMs:number
39
39
  }
40
- ): Promise<DOMNodeReference | DOMNodeReference[]>;
40
+ ): Promise<PowerPagesElement | PowerPagesElement[]>;
41
41
  ```
42
42
 
43
43
  createRef takes two main arguments:
@@ -76,13 +76,13 @@ createRef takes two main arguments:
76
76
  </tbody>
77
77
  </table>
78
78
 
79
- Import the utility function for creating DOMNodeReference(s)
79
+ Import the utility function for creating PowerPagesElement(s)
80
80
 
81
81
  ```typescript
82
82
  import { createRef } from "powerpagestoolkit";
83
83
  ```
84
84
 
85
- Instantiate one, or multiple instances of a DOMNodeReference, and optionally configure advanced options
85
+ Instantiate one, or multiple instances of a PowerPagesElement, and optionally configure advanced options
86
86
 
87
87
  ```javascript
88
88
  // Create a single reference (i.e. 'querySelector')
@@ -120,8 +120,8 @@ const nodes2 = await createRef("#target", {
120
120
  | value | any | Current synchronized value of the element |
121
121
  | isLoaded | boolean | Element load status |
122
122
  | target | HTMLElement \| string | Original target selector or element |
123
- | yesRadio | DOMNodeReference \| null | Reference to 'yes' radio (for boolean fields) |
124
- | noRadio | DOMNodeReference \| null | Reference to 'no' radio (for boolean fields) |
123
+ | yesRadio | PowerPagesElement \| null | Reference to 'yes' radio (for boolean fields) |
124
+ | noRadio | PowerPagesElement \| null | Reference to 'no' radio (for boolean fields) |
125
125
  | checked | boolean | Checkbox/radio checked state |
126
126
 
127
127
  #### Key Methods
@@ -151,8 +151,8 @@ _Method Signature:_
151
151
  ```typescript
152
152
  applyBusinessRule(
153
153
  rule: BusinessRule,
154
- dependencies: DOMNodeReference[]
155
- ): DOMNodeReference; /* Instance of this is returned for optional
154
+ dependencies: PowerPagesElement[]
155
+ ): PowerPagesElement; /* Instance of this is returned for optional
156
156
  method chaining */
157
157
  ```
158
158
 
@@ -370,7 +370,7 @@ bindForm("form-guid").then((form) => {
370
370
  * @param formGuid Unique identifier for the form
371
371
  * @returns Promise resolving to form element references
372
372
  */
373
- function bindForm(formGuid: string): Promise<DOMNodeReferenceArray & Record<string: DOMNodeReference>>;
373
+ function bindForm(formGuid: string): Promise<PowerPagesElementArray & Record<string: PowerPagesElement>>;
374
374
  ```
375
375
 
376
376
  ##### Benefits
@@ -447,7 +447,7 @@ await API.updateRecord("contacts", "record-guid", {
447
447
 
448
448
  ## Best Practices
449
449
 
450
- 1. Always await DOMNodeReference creation:
450
+ 1. Always await PowerPagesElement creation:
451
451
 
452
452
  ```typescript
453
453
  const node = await createRef("#element");
@@ -1,4 +1,7 @@
1
1
  /// <reference path="../globals.d.ts" />
2
+ import type VisibilityManager from "../ancillary/VisibilityManager.d.ts";
3
+ import type EventManager from "../ancillary/EventManager.d.ts";
4
+ import type ValueManager from "../ancillary/ValueManager.d.ts";
2
5
  export default class DOMNodeReference {
3
6
  static instances: DOMNodeReference[];
4
7
  [key: symbol]: (...arg: any[]) => any;
@@ -7,38 +10,32 @@ export default class DOMNodeReference {
7
10
  root: Element;
8
11
  protected timeoutMs: number;
9
12
  protected isLoaded: boolean;
10
- protected defaultDisplay: string;
11
- protected observers: Array<MutationObserver | ResizeObserver>;
12
- protected boundListeners: Array<BoundEventListener>;
13
- protected dependents: Dependents;
14
- protected isRadio: boolean;
15
- protected radioType: RadioType | null;
16
13
  /**
17
14
  * The value of the element that this node represents
18
15
  * stays in syncs with the live DOM elements?.,m via event handler
19
16
  */
20
- value: any;
17
+ get value(): any;
18
+ set value(newValue: any);
19
+ get checked(): boolean;
21
20
  /**
22
21
  * The element targeted when instantiating DOMNodeReference.
23
22
  * Made available in order to perform normal DOM traversal,
24
23
  * or access properties not available through this class.
25
24
  */
26
25
  element: HTMLElement;
27
- protected visibilityController: HTMLElement;
28
- checked: boolean;
29
- radioParent: DOMNodeReference | null;
26
+ visibilityManager: VisibilityManager | null;
27
+ valueManager: ValueManager | null;
28
+ eventManager: EventManager | null;
30
29
  /**
31
30
  * Represents the 'yes' option of a boolean radio field.
32
31
  * This property is only available when the parent node
33
32
  * is a main field for a boolean radio input.
34
33
  */
35
- yesRadio: DOMNodeReference | null;
36
34
  /**
37
35
  * Represents the 'no' option of a boolean radio field.
38
36
  * This property is only available when the parent node
39
37
  * is a main field for a boolean radio input.
40
38
  */
41
- noRadio: DOMNodeReference | null;
42
39
  /**
43
40
  * Creates an instance of DOMNodeReference.
44
41
  * @param target - The CSS selector to find the desired DOM element.
@@ -55,16 +52,7 @@ export default class DOMNodeReference {
55
52
  protected _determineEventType(): keyof HTMLElementEventMap;
56
53
  protected _isDateInput(): boolean;
57
54
  protected _isValidFormElement(element: Element): element is FormElement;
58
- protected _registerEventListener(element: Element, eventType: keyof HTMLElementEventMap, handler: (e: Event) => unknown): void;
59
55
  protected _dateSync(element: HTMLInputElement): Promise<void>;
60
- /**
61
- * Gets the current value of the element based on its type
62
- * @protected
63
- * @returns Object containing value and optional checked state
64
- */
65
- protected _getElementValue(): Promise<ElementValue>;
66
- protected _attachVisibilityController(): void;
67
- protected _attachRadioButtons(): Promise<void>;
68
56
  protected _bindMethods(): void;
69
57
  /**
70
58
  * Updates the value and checked state based on element type
@@ -72,7 +60,6 @@ export default class DOMNodeReference {
72
60
  */
73
61
  updateValue(e?: Event): Promise<void>;
74
62
  protected triggerDependentsHandlers(): void;
75
- protected _validateValue(value: any): any;
76
63
  /**
77
64
  * Sets up an event listener based on the specified event type, executing the specified
78
65
  * event handler
@@ -115,13 +102,10 @@ export default class DOMNodeReference {
115
102
  * Clears all values and states of the element.
116
103
  * Handles different input types appropriately, and can be called
117
104
  * on an element containing N child inputs to clear all
118
- *
119
- * @returns - Instance of this [provides option to method chain]
120
- * @throws If clearing values fails
121
105
  */
122
- clearValue(): Promise<DOMNodeReference>;
106
+ clearValue(): void;
123
107
  protected _getChildren(): DOMNodeReference[] | null;
124
- protected callAgainstChildInputs(func: (child: DOMNodeReference) => any): void;
108
+ protected callAgainstChildrenInputs(callback: (child: DOMNodeReference) => any): void;
125
109
  /**
126
110
  * Enables the element so that users can input data
127
111
  * @returns - Instance of this [provides option to method chain]
@@ -181,15 +165,11 @@ export default class DOMNodeReference {
181
165
  */
182
166
  remove(): this;
183
167
  /**
184
- * @param options and object containing the styles you want to set : {key: value} e.g.: {'display': 'block'}
185
- * @returns - Instance of this [provides option to method chain]
168
+ * Sets inline CSS styles on the element.
169
+ * @param options - An object containing CSS property-value pairs, e.g., { display: 'block' }.
170
+ * @returns The instance, enabling method chaining.
186
171
  */
187
172
  setStyle(options: Partial<CSSStyleDeclaration>): this;
188
- /**
189
- * Unchecks both the yes and no radio buttons if they exist.
190
- * @returns - Instance of this [provides option to method chain]
191
- */
192
- uncheckRadios(): DOMNodeReference;
193
173
  /**
194
174
  * Applies a business rule to manage visibility, required state, value, and disabled state dynamically.
195
175
  * @see {@link BusinessRule}
@@ -197,7 +177,7 @@ export default class DOMNodeReference {
197
177
  * @param dependencies For re-evaluation of conditions when the state of the dependencies change
198
178
  * @returns Instance of this for method chaining.
199
179
  */
200
- applyBusinessRule(rule: BusinessRule, dependencies: DOMNodeReference[]): DOMNodeReference;
180
+ applyBusinessRule(rule: BusinessRule, dependencies: DependencyArray<DOMNodeReference>): DOMNodeReference;
201
181
  protected _returnBusinessRuleHandler(rule: BusinessRule): BusinessRuleHandler;
202
182
  protected _createValidator(evaluationFunction: () => boolean): void;
203
183
  /**
@@ -208,8 +188,6 @@ export default class DOMNodeReference {
208
188
  * all other options defaults to true
209
189
  */
210
190
  protected _configureDependencyTracking(handler: DependencyHandler, dependencies: DOMNodeReference[]): void;
211
- protected _getVisibility(): boolean;
212
- protected _receiveNotification(): void;
213
191
  /**
214
192
  * Sets the required level for the field by adding or removing the "required-field" class on the label.
215
193
  *
@@ -0,0 +1,25 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import type DOMNodeReference from "./DOMNodeReference.d.ts";
3
+ declare type EventType = string;
4
+ declare type Handler = (this: DOMNodeReference, ...args: any[]) => void;
5
+ /********/ /********/ export default class EventManager {
6
+ private readonly events;
7
+ private readonly listeners;
8
+ private readonly dependencyHandlers;
9
+ private observers;
10
+ private boundListeners;
11
+ constructor();
12
+ dispatchDependencyHandlers(): void;
13
+ registerDependent(dependency: DOMNodeReference, handler: Handler): true | false;
14
+ registerEvent(event: EventType, handler: Handler): true | false;
15
+ registerListener(event: EventType, listener: DOMNodeReference): true | false;
16
+ emit(eventType: EventType, ...args: any[]): void;
17
+ stopListening(listener: DOMNodeReference): void;
18
+ registerObserver(observer: MutationObserver | ResizeObserver, observerOptions: {
19
+ nodeToObserve: Element;
20
+ options: Partial<ResizeObserverOptions> | Partial<MutationObserverInit>;
21
+ }): void;
22
+ registerDOMEventListener(element: Element, eventType: keyof HTMLElementEventMap, handler: (e: Event) => unknown): void;
23
+ destroy(): void;
24
+ }
25
+ export {};
@@ -0,0 +1,8 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import DOMNodeReference from "./DOMNodeReference.d.ts";
3
+ export default class Radio extends DOMNodeReference {
4
+ [key: symbol]: (...arg: any[]) => any;
5
+ protected radioType: RadioType | null;
6
+ radioParent: DOMNodeReference | undefined;
7
+ constructor(parent: DOMNodeReference, target: Element | string, root: Element | undefined, timeoutMs: number, radioType: RadioType);
8
+ }
@@ -0,0 +1,27 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import type DOMNodeReference from "./DOMNodeReference.d.ts";
3
+ import Radio from "./Radio.d.ts";
4
+ declare interface ValueManagerProps {
5
+ element: HTMLElement;
6
+ noRadio?: Radio;
7
+ yesRadio?: Radio;
8
+ radioParent?: DOMNodeReference;
9
+ isRadio: boolean;
10
+ }
11
+ export default class ValueManager {
12
+ value: any;
13
+ checked: true | false;
14
+ private element;
15
+ private noRadio?;
16
+ private yesRadio?;
17
+ radioParent?: DOMNodeReference | undefined;
18
+ private isRadio;
19
+ constructor(properties: ValueManagerProps);
20
+ setValue(value: any): void;
21
+ updateValue(e?: Event): Promise<void>;
22
+ getElementValue(): Promise<ElementValue>;
23
+ protected _validateValue(value: any): any;
24
+ clearValue(): void;
25
+ destroy(): void;
26
+ }
27
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ export default class VisibilityManager {
3
+ private visibilityController;
4
+ private defaultVisibility;
5
+ constructor(target: HTMLElement);
6
+ hide(): void;
7
+ show(): void;
8
+ toggleVisibility(shouldShow: boolean): void;
9
+ getVisibility(): true | false;
10
+ destroy(): void;
11
+ }
@@ -1,7 +1,7 @@
1
1
  /// <reference path="../globals.d.ts" />
2
2
  /**
3
- * For use in setting up event management in the instances of DOMNodeReference
4
- * @see {@link DOMNodeReference}
3
+ * For use in setting up event management in the instances of PowerPagesElement
4
+ * @see {@link PowerPagesElement}
5
5
  */
6
6
  export declare const EventTypes: {
7
7
  readonly CHECKBOX: "click";
@@ -0,0 +1,32 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import DOMNodeReference from "../ancillary/DOMNodeReference.d.ts";
3
+ import Radio from "../ancillary/Radio.d.ts";
4
+ export default class PowerPagesElement extends DOMNodeReference {
5
+ [key: symbol]: (...arg: any[]) => any;
6
+ /**
7
+ * Represents the 'yes' option of a boolean radio field.
8
+ * This property is only available when the parent node
9
+ * is a main field for a boolean radio input.
10
+ */
11
+ yesRadio: Radio | undefined;
12
+ /**
13
+ * Represents the 'no' option of a boolean radio field.
14
+ * This property is only available when the parent node
15
+ * is a main field for a boolean radio input.
16
+ */
17
+ noRadio: Radio | undefined;
18
+ /**
19
+ * Creates an instance of PowerPagesElement.
20
+ * @param target - The CSS selector to find the desired DOM element.
21
+ * @param root - Optionally specify the element within to search for the element targeted by 'target'
22
+ * Defaults to 'document.body'
23
+ */
24
+ /******/ /******/ constructor(target: Element | string, root: Element | undefined, timeoutMs: number);
25
+ protected _attachRadioButtons(): Promise<void>;
26
+ clearValue(): void;
27
+ /**
28
+ * Unchecks both the yes and no radio buttons if they exist.
29
+ * @returns - Instance of this [provides option to method chain]
30
+ */
31
+ uncheckRadios(): DOMNodeReference;
32
+ }
@@ -0,0 +1,12 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import type PowerPagesElement from "./PowerPagesElement.d.ts";
3
+ export default class PowerPagesElementArray extends Array<PowerPagesElement> {
4
+ /**
5
+ * Hides all the containers of the PowerPagesElement instances in the array.
6
+ */
7
+ hideAll(this: PowerPagesElementArray): PowerPagesElementArray;
8
+ /**
9
+ * Shows all the containers of the PowerPagesElement instances in the array.
10
+ */
11
+ showAll(this: PowerPagesElementArray): PowerPagesElementArray;
12
+ }
@@ -1,14 +1,14 @@
1
1
  /// <reference path="../globals.d.ts" />
2
- import type DOMNodeReference from "./DOMNodeReference.d.ts";
3
- import type DOMNodeReferenceArray from "./DOMNodeReferenceArray.d.ts";
2
+ import type PowerPagesElementArray from "./PowerPagesElementArray.d.ts";
3
+ import type PowerPagesElement from "./PowerPagesElement.d.ts";
4
4
  /**
5
5
  * When loading into a page in PowerPages that has a form,
6
6
  * you can use this function by passing in the GUID of the form, and you will receive an array/record
7
- * of {@link DOMNodeReference}s that represent all fields, sections, sub-grids, and tabs of the given form.
7
+ * of {@link PowerPagesElement}s that represent all fields, sections, sub-grids, and tabs of the given form.
8
8
  * Access these properties of the {@link BoundForm} using the logical name of the control you need to access: form['logical_name']
9
- * you can then execute all the methods available from DOMNodeReference
9
+ * you can then execute all the methods available from PowerPagesElement
10
10
  * @param formId - The string GUID of the form you want to bind to
11
- * @returns An array of DOMNodeReferences, accessible as properties of a Record<string, DOMNodeReference> i.e. formProp = form["some_logicalName"]
11
+ * @returns An array of PowerPagesElements, accessible as properties of a Record<string, PowerPagesElement> i.e. formProp = form["some_logicalName"]
12
12
  * @example
13
13
  * ```js
14
14
  * bindForm("form-guid-0000").then((form) => {
@@ -23,6 +23,6 @@ import type DOMNodeReferenceArray from "./DOMNodeReferenceArray.d.ts";
23
23
  * const form = await bindForm("form-guid-0000")
24
24
  * ```
25
25
  * @see {@link BoundForm}
26
- * @see {@link DOMNodeReference}
26
+ * @see {@link PowerPagesElement}
27
27
  */
28
- export default function bindForm(formId: string): Promise<DOMNodeReferenceArray & Record<string, DOMNodeReference>>;
28
+ export default function bindForm(formId: string): Promise<PowerPagesElementArray & Record<string, PowerPagesElement>>;
@@ -1,21 +1,21 @@
1
1
  /// <reference path="../globals.d.ts" />
2
- import DOMNodeReference from "./DOMNodeReference.d.ts";
3
- import type DOMNodeReferenceArray from "./DOMNodeReferenceArray.d.ts";
2
+ import type PowerPagesElementArray from "./PowerPagesElementArray.d.ts";
3
+ import PowerPagesElement from "./PowerPagesElement.d.ts";
4
4
  /**
5
- * Creates and initializes a DOMNodeReference instance.
5
+ * Creates and initializes a PowerPagesElement instance.
6
6
  * @see {@link CreationOptions}
7
- * @param **target** - The selector, using `querySelector` syntax, for the desired DOM element. Or, the `HTMLElement` itself for which to create a DOMNodeReference.
7
+ * @param **target** - The selector, using `querySelector` syntax, for the desired DOM element. Or, the `HTMLElement` itself for which to create a PowerPagesElement.
8
8
  * @param **options** - Options for advanced retrieval of elements
9
9
  * @param **options.multiple** - Should this call return an array of instantiated references, or just a single? Defaults to false, returning a single instance
10
10
  * @param **options.root** - Optionally specify the element within to search for the element targeted by 'target'. Defaults to `document.body`
11
11
  * @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.
12
- * @returns A promise that resolves to a Proxy of the initialized DOMNodeReference instance.
12
+ * @returns A promise that resolves to a Proxy of the initialized PowerPagesElement instance.
13
13
  *
14
- * @see {@link DOMNodeReference}
15
- * @see {@link DOMNodeReferenceArray}
14
+ * @see {@link PowerPagesElement}
15
+ * @see {@link PowerPagesElementArray}
16
16
  * @see {@link enhanceArray}
17
17
  */
18
- export default function createDOMNodeReference(target: string | HTMLElement, options?: {
18
+ export default function createPowerPagesElement(target: string | HTMLElement, options?: {
19
19
  /**
20
20
  * Should this call return an array of instantiated references, or just a single?
21
21
  * Defaults to false, returning a single instance.
@@ -32,8 +32,8 @@ export default function createDOMNodeReference(target: string | HTMLElement, opt
32
32
  * WARNING: Implementing multiple references with timeout can result in infinite loading.
33
33
  */
34
34
  timeoutMs?: number;
35
- }): Promise<DOMNodeReference>;
36
- export default function createDOMNodeReference(target: string, options?: {
35
+ }): Promise<PowerPagesElement>;
36
+ export default function createPowerPagesElement(target: string, options?: {
37
37
  /**
38
38
  * Should this call return an array of instantiated references, or just a single?
39
39
  * Defaults to false, returning a single instance.
@@ -50,8 +50,8 @@ export default function createDOMNodeReference(target: string, options?: {
50
50
  * WARNING: Implementing multiple references with timeout can result in infinite loading.
51
51
  */
52
52
  timeoutMs?: number;
53
- }): Promise<DOMNodeReference>;
54
- export default function createDOMNodeReference(target: Element, options?: {
53
+ }): Promise<PowerPagesElement>;
54
+ export default function createPowerPagesElement(target: Element, options?: {
55
55
  /**
56
56
  * Optionally specify the element within which to search for the element targeted by 'target'.
57
57
  * Defaults to 'document.body'.
@@ -63,8 +63,8 @@ export default function createDOMNodeReference(target: Element, options?: {
63
63
  * WARNING: Implementing multiple references with timeout can result in infinite loading.
64
64
  */
65
65
  timeoutMs?: number;
66
- }): Promise<DOMNodeReference>;
67
- export default function createDOMNodeReference(target: string, options?: {
66
+ }): Promise<PowerPagesElement>;
67
+ export default function createPowerPagesElement(target: string, options?: {
68
68
  /**
69
69
  * Should this call return an array of instantiated references, or just a single?
70
70
  * Defaults to false, returning a single instance.
@@ -81,8 +81,8 @@ export default function createDOMNodeReference(target: string, options?: {
81
81
  * WARNING: Implementing multiple references with timeout can result in infinite loading.
82
82
  */
83
83
  timeoutMs?: number;
84
- }): Promise<DOMNodeReferenceArray>;
84
+ }): Promise<PowerPagesElementArray>;
85
85
  export declare function validateOptions(options: Partial<CreationOptions>): void;
86
86
  export declare function createProxyHandler(): {
87
- get: (target: DOMNodeReference, prop: string | symbol) => any;
87
+ get: (target: PowerPagesElement, prop: string | symbol) => any;
88
88
  };
@@ -1,14 +1,37 @@
1
1
  /// <reference path="../globals.d.ts" />
2
- import type DOMNodeReference from "../core/DOMNodeReference.d.ts";
3
- export declare class DOMNodeInitializationError extends Error {
4
- constructor(instance: DOMNodeReference, error: string);
2
+ import type DOMNodeReference from "../ancillary/DOMNodeReference.d.ts";
3
+ declare class CustomError extends Error {
4
+ node: DOMNodeReference;
5
+ constructor(node: DOMNodeReference, message: string);
5
6
  }
6
- export declare class DOMNodeNotFoundError extends Error {
7
- constructor(instance: DOMNodeReference);
7
+ declare class InitializationError extends CustomError {
8
+ constructor(node: DOMNodeReference, error: string);
8
9
  }
9
- export declare class ConditionalRenderingError extends Error {
10
- constructor(instance: DOMNodeReference, error: string);
10
+ declare class NodeNotFoundError extends CustomError {
11
+ constructor(node: DOMNodeReference);
11
12
  }
12
- export declare class ValidationConfigError extends Error {
13
- constructor(node: DOMNodeReference, message: string);
13
+ declare class Page_ValidatorsNotFoundError extends CustomError {
14
+ constructor(node: DOMNodeReference);
15
+ }
16
+ declare class BusinessRuleError extends CustomError {
17
+ constructor(node: DOMNodeReference);
18
+ }
19
+ declare class SelfReferenceError extends CustomError {
20
+ constructor(node: DOMNodeReference);
21
+ }
22
+ declare class LabelNotFoundError extends CustomError {
23
+ constructor(node: DOMNodeReference);
24
+ }
25
+ declare class IncorrectParameterError extends CustomError {
26
+ constructor(node: DOMNodeReference, functionName: string, argName: string, expectedTypes: string[], receivedType: any);
14
27
  }
28
+ declare const Errors: {
29
+ NodeNotFoundError: typeof NodeNotFoundError;
30
+ InitializationError: typeof InitializationError;
31
+ Page_ValidatorsNotFoundError: typeof Page_ValidatorsNotFoundError;
32
+ BusinessRuleError: typeof BusinessRuleError;
33
+ SelfReferenceError: typeof SelfReferenceError;
34
+ LabelNotFoundError: typeof LabelNotFoundError;
35
+ IncorrectParameterError: typeof IncorrectParameterError;
36
+ };
37
+ export default Errors;
@@ -1,4 +1,4 @@
1
- /// <reference path="../core/DOMNodeReference.ts"/>
1
+ /// <reference path="../core/PowerPagesElement.ts"/>
2
2
 
3
3
  declare type EventCallback = () => any;
4
4
 
@@ -77,18 +77,18 @@ declare interface BusinessRule {
77
77
  * otherwise, it is hidden.
78
78
 
79
79
  */
80
- setVisibility?: (this: DOMNodeReference) => boolean;
80
+ setVisibility?: (this: PowerPagesElement) => boolean;
81
81
  /**
82
82
  * Configuration function for determining the required level, and field validity of the given fields
83
83
  * @param isRequired - Function determining if field is required
84
- * @param isRequired.this - Reference to this DOMNodeReference
84
+ * @param isRequired.this - Reference to this PowerPagesElement
85
85
  * @param isValid - Function validating field input.
86
- * @param isValid.this - Reference to this DOMNodeReference
86
+ * @param isValid.this - Reference to this PowerPagesElement
87
87
  * @param isValid.isRequiredResult - Only available if 'isRequired' is also returned from the configuration function
88
88
  */
89
89
  setRequirements?: () => {
90
- isRequired?: (this: DOMNodeReference) => boolean;
91
- isValid?: (this: DOMNodeReference, isRequiredResult?: boolean) => boolean;
90
+ isRequired?: (this: PowerPagesElement) => boolean;
91
+ isValid?: (this: PowerPagesElement, isRequiredResult?: boolean) => boolean;
92
92
  };
93
93
 
94
94
  /**
@@ -98,16 +98,18 @@ declare interface BusinessRule {
98
98
  * an expression returning a boolean
99
99
  */
100
100
  setValue?: () => {
101
- condition: (this: DOMNodeReference) => boolean;
101
+ condition: (this: PowerPagesElement) => boolean;
102
102
  value: (() => any) | any;
103
103
  };
104
104
  /**
105
105
  * @param condition A function to determine if this field
106
106
  * should be enabled in a form, or disabled. True || 1 = disabled. False || 0 = enabled
107
107
  */
108
- setDisabled?: (this: DOMNodeReference) => boolean;
108
+ setDisabled?: (this: PowerPagesElement) => boolean;
109
109
  }
110
110
 
111
+ declare type DependencyArray<T> = [T, ...T[]];
112
+
111
113
  declare interface CreationOptions {
112
114
  /**
113
115
  * Should this call return an array of instantiated references, or just a single?
@@ -133,7 +135,7 @@ declare type DependencyHandler = () => void;
133
135
 
134
136
  declare interface BusinessRuleHandler extends DependencyHandler {}
135
137
 
136
- declare type Dependents = Map<DOMNodeReference, DependencyHandler>;
138
+ declare type Dependents = Map<PowerPagesElement, DependencyHandler>;
137
139
 
138
140
  declare type ValueElement =
139
141
  | HTMLInputElement
@@ -1,5 +1,5 @@
1
1
  import API from "./core/API.d.ts";
2
- import createRef from "./core/createDOMNodeReferences.d.ts";
2
+ import get from "./core/getPowerPagesElement.d.ts";
3
3
  import waitFor from "./core/waitFor.d.ts";
4
4
  import bindForm from "./core/bindForm.d.ts";
5
- export { API, bindForm, createRef, waitFor };
5
+ export { API, bindForm, get, waitFor };