@rxdi/lit-html 0.7.142 → 0.7.145

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.
@@ -6,11 +6,10 @@ export interface CustomAttributeRegistry {
6
6
  unsubscribe(): void;
7
7
  }
8
8
  export interface ModifierOptions {
9
- name: string;
9
+ selector: string;
10
10
  registry?: CustomAttributeRegistry;
11
11
  }
12
12
  export interface Modifier extends Function {
13
- name: string;
14
13
  options(): ModifierOptions;
15
14
  }
16
15
  export interface CustomElementConfig<T> {
@@ -74,6 +74,9 @@ const customElement = (tag, config = {}) => (Base) => {
74
74
  var _a;
75
75
  connectedCallback.call(this);
76
76
  OnInit.call(this);
77
+ if (isFunction(config.registry)) {
78
+ registry = config.registry.call(this);
79
+ }
77
80
  if ((_a = config.modifiers) === null || _a === void 0 ? void 0 : _a.length) {
78
81
  for (const modifier of config.modifiers) {
79
82
  if (!modifier) {
@@ -86,18 +89,16 @@ const customElement = (tag, config = {}) => (Base) => {
86
89
  throw new Error(`Modifier options is not a function ${modifier.name} and component "${config.selector}"`);
87
90
  }
88
91
  const options = modifier.options.call(this);
89
- if (!(options === null || options === void 0 ? void 0 : options.name)) {
92
+ if (!(options === null || options === void 0 ? void 0 : options.selector)) {
90
93
  throw new Error(`Missing attribute name for ${modifier.name} inside component "${config.selector}"`);
91
94
  }
92
- if (!registry) {
93
- registry = (isFunction(config.registry)
94
- ? config.registry.call(this)
95
- : options.registry);
95
+ if (!registry && options.registry) {
96
+ registry = options.registry;
96
97
  }
97
98
  if (!registry) {
98
- throw new Error(`Missing attribute registry for attribute "${options.name}" and no default registry specified inside component "${config.selector}"`);
99
+ throw new Error(`Missing attribute registry for attribute "${options.selector}" and no default registry specified inside component "${config.selector}"`);
99
100
  }
100
- registry.define(options.name, modifier);
101
+ registry.define(options.selector, modifier);
101
102
  }
102
103
  }
103
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxdi/lit-html",
3
- "version": "0.7.142",
3
+ "version": "0.7.145",
4
4
  "main": "./dist/index.js",
5
5
  "author": "Kristiyan Tachev",
6
6
  "license": "MIT",