wrec 0.20.3 → 0.20.5

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/dist/wrec.d.ts CHANGED
@@ -1,43 +1,66 @@
1
- import { ChangeListener, WrecState } from './wrec-state';
2
- import { getPathValue, setPathValue } from './paths';
3
- export type { ChangeListener, WrecState };
4
- export type { getPathValue, setPathValue };
5
- export declare function createElement(name: string, attributes: Record<string, string>, innerHTML: string): HTMLElement;
6
- export declare abstract class Wrec extends HTMLElement implements ChangeListener {
7
- #private;
8
- static attrToPropMap: Map<string, string>;
9
- static propToAttrMap: Map<string, string>;
10
- static css: string;
11
- static elementName: string;
12
- static formAssociated: boolean;
13
- static html: string;
14
- static properties: Record<string, any>;
15
- static propToComputedMap: Map<string, string[][]>;
16
- static propToExprsMap: Map<string, string[]>;
17
- static template: HTMLTemplateElement | null;
18
- [key: string]: any;
19
- static define(elementName: string): void;
20
- constructor();
21
- attributeChangedCallback(attrName: string, oldValue: string, newValue: string | number | boolean | undefined): void;
22
- changed(_statePath: string, componentProp: string, newValue: unknown): void;
23
- connectedCallback(): void;
24
- disconnectedCallback(): void;
25
- dispatch(name: string, detail: any): void;
26
- displayIfSet(value: any, display?: string): string;
27
- formAssociatedCallback(): void;
28
- formResetCallback(): void;
29
- static getAttrName(propName: string): string;
30
- static getPropName(attrName: string): string;
31
- static get observedAttributes(): string[];
32
- propertyChangedCallback(_propName: string, _oldValue: unknown, _newValue: unknown): void;
33
- setAttributeSafe(name: string, value: string): void;
34
- setFormValue(propName: string, value: string): void;
35
- /**
36
- * @param state - WrecState object
37
- * @param map - object whose keys are state properties and
38
- * whose values are component properties
39
- */
40
- useState(state: WrecState, map?: Record<string, string>): void;
41
- }
42
- export declare function css(strings: TemplateStringsArray, ...values: unknown[]): string;
43
- export declare function html(strings: TemplateStringsArray, ...values: unknown[]): string;
1
+ export declare type ChangeListener = {
2
+ changed: (statePath: string, componentProperty: string, newValue: unknown, oldValue: unknown, state: WrecState) => void;
3
+ };
4
+
5
+ export declare function createElement(name: string, attributes: Record<string, string>, innerHTML: string): HTMLElement;
6
+
7
+ export declare function css(strings: TemplateStringsArray, ...values: unknown[]): string;
8
+
9
+ export declare function html(strings: TemplateStringsArray, ...values: unknown[]): string;
10
+
11
+ declare type LooseObject = Record<string, unknown>;
12
+
13
+ export declare abstract class Wrec extends HTMLElement implements ChangeListener {
14
+ #private;
15
+ static attrToPropMap: Map<string, string>;
16
+ static propToAttrMap: Map<string, string>;
17
+ static css: string;
18
+ static elementName: string;
19
+ static formAssociated: boolean;
20
+ static html: string;
21
+ static properties: Record<string, any>;
22
+ static propToComputedMap: Map<string, string[][]>;
23
+ static propToExprsMap: Map<string, string[]>;
24
+ static template: HTMLTemplateElement | null;
25
+ [key: string]: any;
26
+ static define(elementName: string): void;
27
+ constructor();
28
+ attributeChangedCallback(attrName: string, oldValue: string, newValue: string | number | boolean | undefined): void;
29
+ changed(_statePath: string, componentProp: string, newValue: unknown): void;
30
+ connectedCallback(): void;
31
+ disconnectedCallback(): void;
32
+ dispatch(name: string, detail: any): void;
33
+ displayIfSet(value: any, display?: string): string;
34
+ formAssociatedCallback(): void;
35
+ formResetCallback(): void;
36
+ static getAttrName(propName: string): string;
37
+ static getPropName(attrName: string): string;
38
+ static get observedAttributes(): string[];
39
+ propertyChangedCallback(_propName: string, _oldValue: unknown, _newValue: unknown): void;
40
+ setAttributeSafe(name: string, value: string): void;
41
+ setFormValue(propName: string, value: string): void;
42
+ /**
43
+ * @param state - WrecState object
44
+ * @param map - object whose keys are state properties and
45
+ * whose values are component properties
46
+ */
47
+ useState(state: WrecState, map?: Record<string, string>): void;
48
+ }
49
+
50
+ export declare class WrecState {
51
+ #private;
52
+ static get(name: string): WrecState | undefined;
53
+ [key: string]: unknown;
54
+ constructor(name: string, persist: boolean, initial?: LooseObject);
55
+ /**
56
+ * @param listener - object that has a "changed" method
57
+ * @param map - map from state property paths to component properties
58
+ */
59
+ addListener(listener: ChangeListener, map?: Record<string, string>): void;
60
+ addProperty(propName: string, initialValue: unknown): void;
61
+ get id(): symbol;
62
+ log(): void;
63
+ removeListener(listener: ChangeListener): void;
64
+ }
65
+
66
+ export { }