phecda-core 3.0.0-alpha.8 → 3.0.0-beta.13
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/index.d.ts +73 -47
- package/dist/index.js +373 -268
- package/dist/index.mjs +356 -256
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
declare function Init(proto: any, key: PropertyKey): void;
|
|
2
|
+
declare function Unmount(proto: any, key: PropertyKey): void;
|
|
3
|
+
declare function Bind(value: any): (proto: any, k: PropertyKey) => void;
|
|
4
|
+
declare function Ignore(proto: any, key: PropertyKey): void;
|
|
5
|
+
declare function Clear(proto: any, key: PropertyKey): void;
|
|
6
|
+
declare function Expose(proto: any, key: PropertyKey): void;
|
|
7
|
+
declare function Empty(module: any): void;
|
|
8
|
+
|
|
9
|
+
declare const SHARE_KEY: unique symbol;
|
|
10
|
+
declare const PHECDA_KEY: unique symbol;
|
|
11
|
+
declare function isPhecda(module: any): module is Construct;
|
|
12
|
+
declare function init(proto: Phecda): void;
|
|
13
|
+
declare function setStateVar(proto: Phecda, key: PropertyKey): void;
|
|
14
|
+
declare function setExposeKey(proto: Phecda, key: PropertyKey): void;
|
|
15
|
+
declare function setIgnoreKey(proto: Phecda, key: PropertyKey): void;
|
|
16
|
+
declare function setHandler(proto: Phecda, key: PropertyKey, handler: Handler): void;
|
|
17
|
+
declare function setState(proto: Phecda, key: PropertyKey, state: Record<string, any>): void;
|
|
18
|
+
declare function getOwnStateVars(target: any): string[];
|
|
19
|
+
declare function getStateVars(target: any): PropertyKey[];
|
|
20
|
+
declare function getOwnExposeKey(target: any): string[];
|
|
21
|
+
declare function getExposeKey(target: any): PropertyKey[];
|
|
22
|
+
declare function getOwnIgnoreKey(target: any): string[];
|
|
23
|
+
declare function getOwnHandler(target: any, key: PropertyKey): Handler[];
|
|
24
|
+
declare function getHandler(target: any, key: PropertyKey): any[];
|
|
25
|
+
declare function getState(target: any, key: PropertyKey): any;
|
|
26
|
+
declare function getOwnState(target: any, key: PropertyKey): Record<string, any>;
|
|
27
|
+
declare function invokeHandler(event: string, instance: Phecda): Promise<any[]>;
|
|
28
|
+
declare function set(proto: Phecda, key: string, value: any): void;
|
|
29
|
+
declare function get(proto: Phecda, key: string): any;
|
|
30
|
+
|
|
1
31
|
interface NameSpace {
|
|
2
32
|
[name: string]: Phecda;
|
|
3
33
|
}
|
|
@@ -11,12 +41,13 @@ interface Handler {
|
|
|
11
41
|
}
|
|
12
42
|
interface Phecda {
|
|
13
43
|
prototype: any;
|
|
14
|
-
|
|
44
|
+
[PHECDA_KEY]: {
|
|
15
45
|
__EXPOSE_VAR__: Set<PropertyKey>;
|
|
16
46
|
__IGNORE_VAR__: Set<PropertyKey>;
|
|
17
47
|
__STATE_VAR__: Set<PropertyKey>;
|
|
18
48
|
__STATE_HANDLER__: Map<PropertyKey, Handler[]>;
|
|
19
49
|
__STATE_NAMESPACE__: Map<PropertyKey, Object>;
|
|
50
|
+
[key: string]: any;
|
|
20
51
|
};
|
|
21
52
|
}
|
|
22
53
|
type ClassValue<I> = {
|
|
@@ -25,66 +56,61 @@ type ClassValue<I> = {
|
|
|
25
56
|
interface Events {
|
|
26
57
|
}
|
|
27
58
|
|
|
28
|
-
declare function
|
|
29
|
-
declare function Unmount(proto: any, key: PropertyKey): void;
|
|
30
|
-
declare function Bind(value: any): (proto: any, k: PropertyKey) => void;
|
|
31
|
-
declare function Ignore(proto: any, key: PropertyKey): void;
|
|
32
|
-
declare function Clear(proto: any, key: PropertyKey): void;
|
|
33
|
-
declare function Err<Fn extends (...args: any) => any>(cb: Fn): (proto: any, key: PropertyKey) => void;
|
|
34
|
-
declare function Expose(proto: any, key: PropertyKey): void;
|
|
35
|
-
declare function To(...callbacks: ((arg: any, instance: any, key: string) => any)[]): (proto: any, key: PropertyKey) => void;
|
|
59
|
+
declare function Isolate(module: any): void;
|
|
36
60
|
declare function Tag(tag: PropertyKey): (module: any) => void;
|
|
37
61
|
declare function Unique(desc?: string): (module: any) => void;
|
|
38
62
|
declare function Assign(cb: (instance?: any) => any): (module: any) => void;
|
|
39
63
|
declare function Global(module: any): void;
|
|
40
|
-
declare function
|
|
41
|
-
declare
|
|
42
|
-
declare function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
declare function To(...callbacks: ((arg: any, instance: any, key: string) => any)[]): (proto: any, key: PropertyKey) => void;
|
|
65
|
+
declare function Rule(cb: ((arg: any) => boolean | Promise<boolean>), info: string | (() => string)): (proto: any, key: PropertyKey) => void;
|
|
66
|
+
declare function Err(cb: (e: Error | any, instance: any, key: string) => void, isCatch?: boolean): (proto: any, key: PropertyKey) => void;
|
|
67
|
+
interface StorageParam {
|
|
68
|
+
key?: string;
|
|
69
|
+
instance: any;
|
|
70
|
+
tag: string;
|
|
71
|
+
toJSON: (str: string) => any;
|
|
72
|
+
toString: (arg: any) => string;
|
|
73
|
+
}
|
|
74
|
+
interface WatcherParam {
|
|
75
|
+
key: string;
|
|
76
|
+
instance: any;
|
|
77
|
+
eventName: string;
|
|
78
|
+
options?: {
|
|
79
|
+
once?: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
declare function Watcher(eventName: keyof Events, options?: {
|
|
83
|
+
once?: boolean;
|
|
84
|
+
}): (proto: any, key: string) => void;
|
|
85
|
+
declare function Effect(cb: (value: any, instance: any, key: string) => void): (proto: any, key: string) => void;
|
|
86
|
+
declare function Storage({ key: storeKey, toJSON, toString }?: {
|
|
87
|
+
toJSON?: (str: string) => any;
|
|
88
|
+
toString?: (arg: any) => string;
|
|
89
|
+
key?: string;
|
|
90
|
+
}): (proto: any, key?: PropertyKey) => void;
|
|
46
91
|
|
|
47
92
|
declare function getTag<M extends Construct | AbConstruct>(moduleOrInstance: M | InstanceType<M>): PropertyKey;
|
|
48
93
|
declare function getBind<M extends Construct | AbConstruct>(module: M): any;
|
|
49
94
|
declare function plainToClass<M extends Construct, Data extends Record<PropertyKey, any>>(module: M, input: Data): InstanceType<M>;
|
|
50
|
-
declare function
|
|
51
|
-
declare function
|
|
95
|
+
declare function transformInstance<M extends Construct>(instance: InstanceType<M>, force?: boolean): string[];
|
|
96
|
+
declare function transformInstanceAsync<M extends Construct>(instance: InstanceType<M>, force?: boolean): Promise<string[]>;
|
|
97
|
+
declare function transformProperty<M extends Construct>(instance: InstanceType<M>, property: keyof InstanceType<M>, force?: boolean): string[];
|
|
98
|
+
declare function transformPropertyAsync<M extends Construct>(instance: InstanceType<M>, property: keyof InstanceType<M>, force?: boolean): Promise<string[]>;
|
|
99
|
+
declare function classToPlain<M>(instance: M): ClassValue<M>;
|
|
52
100
|
declare function snapShot<T extends Construct>(data: InstanceType<T>): {
|
|
53
101
|
data: InstanceType<T>;
|
|
54
102
|
clear(): void;
|
|
55
103
|
apply(): void;
|
|
56
104
|
};
|
|
57
|
-
declare function addDecoToClass<M extends Construct | AbConstruct>(c: M, key: keyof InstanceType<M> |
|
|
105
|
+
declare function addDecoToClass<M extends Construct | AbConstruct>(c: M, key: keyof InstanceType<M> | PropertyKey, handler: PropertyDecorator | ClassDecorator): void;
|
|
58
106
|
declare function Pipeline(...decos: ((...args: any) => void)[]): (...args: any) => void;
|
|
107
|
+
declare function isAsyncFunc(fn: Function): boolean;
|
|
59
108
|
|
|
60
|
-
declare
|
|
61
|
-
declare
|
|
62
|
-
declare function
|
|
63
|
-
declare function setVar(proto: Phecda, key: PropertyKey): void;
|
|
64
|
-
declare function setExposeKey(proto: Phecda, key: PropertyKey): void;
|
|
65
|
-
declare function setIgnoreKey(proto: Phecda, key: PropertyKey): void;
|
|
66
|
-
declare function getOwnModuleState(instance: Phecda): string[];
|
|
67
|
-
declare function getModuleState(instance: Phecda): PropertyKey[];
|
|
68
|
-
declare function getOwnExposeKey(instance: Phecda): string[];
|
|
69
|
-
declare function getExposeKey(instance: Phecda): PropertyKey[];
|
|
70
|
-
declare function getOwnIgnoreKey(instance: Phecda): string[];
|
|
71
|
-
declare function regisHandler(proto: Phecda, key: PropertyKey, handler: Handler): void;
|
|
72
|
-
declare function getOwnHandler(instance: Phecda, key: PropertyKey): Handler[];
|
|
73
|
-
declare function getHandler(instance: Phecda, key: PropertyKey): any[];
|
|
74
|
-
declare function setState(proto: Phecda, key: PropertyKey, state: Record<string, any>): void;
|
|
75
|
-
declare function getOwnState(instance: Phecda, key: PropertyKey): Object;
|
|
76
|
-
declare function getState(instance: Phecda, key: PropertyKey): any;
|
|
77
|
-
declare function registerParallel(instance: Phecda): Promise<any[]>;
|
|
78
|
-
declare function registerSerial(instance: Phecda): Promise<void>;
|
|
79
|
-
declare function unmountParallel(instance: Phecda): Promise<any[]>;
|
|
80
|
-
|
|
109
|
+
declare const DataMap: InjectData;
|
|
110
|
+
declare function Provide<K extends keyof InjectData>(key: K, value: InjectData[K]): void;
|
|
111
|
+
declare function Inject<K extends keyof InjectData>(key: K): InjectData[K];
|
|
81
112
|
declare const activeInstance: Record<string, any>;
|
|
82
|
-
declare function
|
|
83
|
-
declare function
|
|
84
|
-
declare function Watcher(eventName: keyof Events, options?: {
|
|
85
|
-
once: boolean;
|
|
86
|
-
}): (proto: any, key: string) => void;
|
|
87
|
-
declare function Effect(eventName: string, options?: any): (proto: any, key: string) => void;
|
|
88
|
-
declare function Storage(storeKey?: string): (proto: any, key?: PropertyKey) => void;
|
|
113
|
+
declare function injectKey(key: string, value: any): Record<string, any>;
|
|
114
|
+
declare function getKey(key: string): any;
|
|
89
115
|
|
|
90
|
-
export { AbConstruct, Assign, Bind, ClassValue, Clear, Construct, DataMap, Effect, Empty, Err, Events, Expose, Global, Handler, Ignore, Init, Inject, InjectData, Isolate, NameSpace,
|
|
116
|
+
export { AbConstruct, Assign, Bind, ClassValue, Clear, Construct, DataMap, Effect, Empty, Err, Events, Expose, Global, Handler, Ignore, Init, Inject, InjectData, Isolate, NameSpace, PHECDA_KEY, Phecda, Pipeline, Provide, Rule, SHARE_KEY, Storage, StorageParam, Tag, To, Unique, Unmount, Watcher, WatcherParam, activeInstance, addDecoToClass, classToPlain, get, getBind, getExposeKey, getHandler, getKey, getOwnExposeKey, getOwnHandler, getOwnIgnoreKey, getOwnState, getOwnStateVars, getState, getStateVars, getTag, init, injectKey, invokeHandler, isAsyncFunc, isPhecda, plainToClass, set, setExposeKey, setHandler, setIgnoreKey, setState, setStateVar, snapShot, transformInstance, transformInstanceAsync, transformProperty, transformPropertyAsync };
|