epos-unit 1.7.0 → 1.9.0

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.
@@ -12,6 +12,7 @@ declare class Unit<TRoot = unknown> {
12
12
  private [_root_];
13
13
  private [_parent_];
14
14
  private [_disposers_];
15
+ static get [epos.state.symbols.modelStrict](): boolean;
15
16
  constructor(parent: Unit<TRoot> | null);
16
17
  [epos.state.symbols.modelInit](): void;
17
18
  [epos.state.symbols.modelCleanup](): void;
package/dist/epos-unit.js CHANGED
@@ -5,6 +5,9 @@ var _root_ = Symbol("root");
5
5
  var _parent_ = Symbol("parent");
6
6
  var _disposers_ = Symbol("disposers");
7
7
  var Unit = class {
8
+ static get [epos.state.symbols.modelStrict]() {
9
+ return true;
10
+ }
8
11
  constructor(parent) {
9
12
  Reflect.defineProperty(this, _parent_, { get: () => parent });
10
13
  }
@@ -27,12 +30,12 @@ var Unit = class {
27
30
  }
28
31
  for (const key of keys) {
29
32
  if (typeof key === "symbol") continue;
30
- if (!key.startsWith("ui")) continue;
33
+ if (!key.endsWith("View")) continue;
31
34
  const descriptor = descriptors[key];
32
35
  if (descriptor.get || descriptor.set) continue;
33
36
  if (typeof _this[key] !== "function") continue;
34
- const componentName = [this["@"], key.replace("ui", "")].filter(Boolean).join("-");
35
- _this[key] = epos.component(componentName, _this[key]);
37
+ _this[key] = epos.component(_this[key]);
38
+ _this[key].displayName = `${this["@"]}.${key}`;
36
39
  }
37
40
  const log = createLog(this["@"]);
38
41
  Reflect.defineProperty(this, "log", { get: () => log });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epos-unit",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "imkost",
@@ -24,7 +24,7 @@
24
24
  "dist"
25
25
  ],
26
26
  "dependencies": {
27
- "@eposlabs/utils": "^1.9.0",
28
- "epos": "^1.17.0"
27
+ "@eposlabs/utils": "^1.10.0",
28
+ "epos": "^1.23.0"
29
29
  }
30
30
  }
package/src/epos-unit.ts CHANGED
@@ -15,6 +15,10 @@ export class Unit<TRoot = unknown> {
15
15
  declare private [_parent_]: Unit<TRoot> | null // Parent reference for not-yet-attached units
16
16
  declare private [_disposers_]: Set<() => void>
17
17
 
18
+ static get [epos.state.symbols.modelStrict]() {
19
+ return true
20
+ }
21
+
18
22
  constructor(parent: Unit<TRoot> | null) {
19
23
  // Define parent for not-yet-attached units
20
24
  Reflect.defineProperty(this, _parent_, { get: () => parent })
@@ -43,15 +47,15 @@ export class Unit<TRoot = unknown> {
43
47
  _this[key] = descriptor.value.bind(this)
44
48
  }
45
49
 
46
- // Wrap UI methods to components
50
+ // Create components out of `View` methods
47
51
  for (const key of keys) {
48
52
  if (typeof key === 'symbol') continue
49
- if (!key.startsWith('ui')) continue
53
+ if (!key.endsWith('View')) continue
50
54
  const descriptor = descriptors[key]
51
55
  if (descriptor.get || descriptor.set) continue
52
56
  if (typeof _this[key] !== 'function') continue
53
- const componentName = [this['@'], key.replace('ui', '')].filter(Boolean).join('-')
54
- _this[key] = epos.component(componentName, _this[key] as FC)
57
+ _this[key] = epos.component(_this[key] as FC)
58
+ _this[key].displayName = `${this['@']}.${key}`
55
59
  }
56
60
 
57
61
  // Define log method