epos-unit 1.0.0 → 1.0.2
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/epos-unit.d.ts +5 -8
- package/dist/epos-unit.js +8 -6
- package/package.json +1 -1
package/dist/epos-unit.d.ts
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { epos } from 'epos';
|
|
2
1
|
import { type Cls } from '@eposlabs/utils';
|
|
3
|
-
|
|
4
|
-
declare const
|
|
5
|
-
declare const
|
|
6
|
-
|
|
2
|
+
import { epos } from 'epos';
|
|
3
|
+
export declare const _root_: unique symbol;
|
|
4
|
+
export declare const _disposers_: unique symbol;
|
|
5
|
+
export declare const _tempParent_: unique symbol;
|
|
7
6
|
export declare class Unit {
|
|
8
7
|
'@': string;
|
|
9
8
|
private [_root_];
|
|
10
9
|
private [_disposers_];
|
|
11
10
|
private [_tempParent_];
|
|
12
|
-
[epos.store.symbols.model.parent]: Unit | null;
|
|
13
11
|
[key: PropertyKey]: unknown;
|
|
14
12
|
constructor(parent?: Unit | null);
|
|
15
13
|
[epos.store.symbols.model.init](): void;
|
|
16
14
|
[epos.store.symbols.model.cleanup](): void;
|
|
17
15
|
static get [epos.store.symbols.model.versioner](): unknown;
|
|
18
|
-
static defineVersioner(versioner:
|
|
16
|
+
static defineVersioner(versioner: Record<number, (this: any, unit: any) => void>): Record<number, (this: any, unit: any) => void>;
|
|
19
17
|
get $(): Unit;
|
|
20
18
|
up<T extends Unit>(Ancestor: Cls<T>): T | null;
|
|
21
19
|
autorun(...args: Parameters<typeof epos.libs.mobx.autorun>): import("mobx").IReactionDisposer;
|
|
@@ -23,4 +21,3 @@ export declare class Unit {
|
|
|
23
21
|
setTimeout(...args: Parameters<typeof self.setTimeout>): number;
|
|
24
22
|
setInterval(...args: Parameters<typeof self.setInterval>): number;
|
|
25
23
|
}
|
|
26
|
-
export {};
|
package/dist/epos-unit.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { epos } from 'epos';
|
|
2
1
|
import { createLog } from '@eposlabs/utils';
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
2
|
+
import { epos } from 'epos';
|
|
3
|
+
export const _root_ = Symbol('root');
|
|
4
|
+
export const _disposers_ = Symbol('disposers');
|
|
5
|
+
export const _tempParent_ = Symbol('parent');
|
|
6
6
|
export class Unit {
|
|
7
7
|
constructor(parent = null) {
|
|
8
8
|
this[_tempParent_] = parent;
|
|
@@ -19,6 +19,8 @@ export class Unit {
|
|
|
19
19
|
for (const key of prototypeKeys) {
|
|
20
20
|
if (typeof this[key] !== 'function')
|
|
21
21
|
continue;
|
|
22
|
+
if (key === 'constructor')
|
|
23
|
+
continue;
|
|
22
24
|
this[key] = this[key].bind(this);
|
|
23
25
|
}
|
|
24
26
|
// Wrap UI methods to components
|
|
@@ -102,8 +104,8 @@ export class Unit {
|
|
|
102
104
|
function isUiKey(key) {
|
|
103
105
|
return key === 'ui' || /^[A-Z][a-zA-Z0-9]*$/.test(key);
|
|
104
106
|
}
|
|
105
|
-
function getParent(
|
|
106
|
-
return
|
|
107
|
+
function getParent(child) {
|
|
108
|
+
return child[_tempParent_] ?? child[epos.store.symbols.model.parent];
|
|
107
109
|
}
|
|
108
110
|
function findRoot(unit) {
|
|
109
111
|
let root = unit;
|