@rxdi/lit-html 0.7.145 → 0.7.148
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.
|
@@ -7,10 +7,10 @@ export interface CustomAttributeRegistry {
|
|
|
7
7
|
}
|
|
8
8
|
export interface ModifierOptions {
|
|
9
9
|
selector: string;
|
|
10
|
-
registry
|
|
10
|
+
registry?(this: HTMLElement): CustomAttributeRegistry;
|
|
11
11
|
}
|
|
12
|
-
export interface Modifier
|
|
13
|
-
options
|
|
12
|
+
export interface Modifier {
|
|
13
|
+
options: ModifierOptions;
|
|
14
14
|
}
|
|
15
15
|
export interface CustomElementConfig<T> {
|
|
16
16
|
selector: string;
|
|
@@ -71,7 +71,7 @@ const customElement = (tag, config = {}) => (Base) => {
|
|
|
71
71
|
registry = null;
|
|
72
72
|
}
|
|
73
73
|
connectedCallback() {
|
|
74
|
-
var _a;
|
|
74
|
+
var _a, _b;
|
|
75
75
|
connectedCallback.call(this);
|
|
76
76
|
OnInit.call(this);
|
|
77
77
|
if (isFunction(config.registry)) {
|
|
@@ -83,22 +83,18 @@ const customElement = (tag, config = {}) => (Base) => {
|
|
|
83
83
|
throw new Error(`Provided null value inside modifiers for component "${config.selector}"`);
|
|
84
84
|
}
|
|
85
85
|
if (!modifier.options) {
|
|
86
|
-
throw new Error(`Missing options for attribute inside ${
|
|
86
|
+
throw new Error(`Missing options for attribute inside ${config.selector}`);
|
|
87
87
|
}
|
|
88
|
-
if (
|
|
89
|
-
throw new Error(`
|
|
88
|
+
if (!((_b = modifier.options) === null || _b === void 0 ? void 0 : _b.selector)) {
|
|
89
|
+
throw new Error(`Missing attribute selector inside component "${config.selector}"`);
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
throw new Error(`Missing attribute name for ${modifier.name} inside component "${config.selector}"`);
|
|
94
|
-
}
|
|
95
|
-
if (!registry && options.registry) {
|
|
96
|
-
registry = options.registry;
|
|
91
|
+
if (!registry && typeof modifier.options.registry === 'function') {
|
|
92
|
+
registry = modifier.options.registry.call(this);
|
|
97
93
|
}
|
|
98
94
|
if (!registry) {
|
|
99
|
-
throw new Error(`Missing attribute registry for attribute "${options.selector}" and no default registry specified inside component "${config.selector}"`);
|
|
95
|
+
throw new Error(`Missing attribute registry for attribute "${modifier.options.selector}" and no default registry specified inside component "${config.selector}"`);
|
|
100
96
|
}
|
|
101
|
-
registry.define(options.selector, modifier);
|
|
97
|
+
registry.define(modifier.options.selector, modifier);
|
|
102
98
|
}
|
|
103
99
|
}
|
|
104
100
|
}
|