wrec 0.20.2 → 0.20.4

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