phecda-core 2.0.0-alpha.3 → 2.0.0-alpha.4
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 +9 -9
- package/dist/index.global.js +11 -4
- package/dist/index.js +11 -4
- package/dist/index.mjs +11 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ interface UsePipeOptions {
|
|
|
7
7
|
transform?: boolean;
|
|
8
8
|
collectError?: boolean;
|
|
9
9
|
}
|
|
10
|
-
interface
|
|
10
|
+
interface InjectData {
|
|
11
11
|
[key: string]: any;
|
|
12
12
|
}
|
|
13
|
-
interface
|
|
13
|
+
interface Handler {
|
|
14
14
|
[key: string]: any;
|
|
15
15
|
}
|
|
16
16
|
interface Phecda {
|
|
@@ -20,7 +20,7 @@ interface Phecda {
|
|
|
20
20
|
__EXPOSE_VAR__: Set<PropertyKey>;
|
|
21
21
|
__IGNORE_VAR__: Set<PropertyKey>;
|
|
22
22
|
__STATE_VAR__: Set<PropertyKey>;
|
|
23
|
-
__STATE_HANDLER__: Map<PropertyKey,
|
|
23
|
+
__STATE_HANDLER__: Map<PropertyKey, Handler[]>;
|
|
24
24
|
__STATE_NAMESPACE__: Map<PropertyKey, Object>;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
@@ -89,9 +89,9 @@ declare function Tag(tag: string): (target: any) => void;
|
|
|
89
89
|
declare function Assign(cb: (instance?: any) => any): (target: any) => void;
|
|
90
90
|
declare function Global(target: any): void;
|
|
91
91
|
declare function Empty(_target: any): void;
|
|
92
|
-
declare const DataMap:
|
|
93
|
-
declare function Provide<K extends keyof
|
|
94
|
-
declare function Inject<K extends keyof
|
|
92
|
+
declare const DataMap: InjectData;
|
|
93
|
+
declare function Provide<K extends keyof InjectData>(key: K, value: InjectData[K]): void;
|
|
94
|
+
declare function Inject<K extends keyof InjectData>(key: K): InjectData[K];
|
|
95
95
|
|
|
96
96
|
declare function validate(p: RegExp | string | Function | Object | Number, v: any): Promise<any>;
|
|
97
97
|
declare function getTag<M extends new (...args: any) => any>(Model: M): any;
|
|
@@ -109,8 +109,8 @@ declare function getModelState(target: Phecda): PropertyKey[];
|
|
|
109
109
|
declare function getOwnExposeKey(target: Phecda): string[];
|
|
110
110
|
declare function getExposeKey(target: Phecda): PropertyKey[];
|
|
111
111
|
declare function getOwnIgnoreKey(target: Phecda): string[];
|
|
112
|
-
declare function regisHandler(target: Phecda, key: PropertyKey, handler:
|
|
113
|
-
declare function getOwnHandler(target: Phecda, key: PropertyKey):
|
|
112
|
+
declare function regisHandler(target: Phecda, key: PropertyKey, handler: Handler): void;
|
|
113
|
+
declare function getOwnHandler(target: Phecda, key: PropertyKey): Handler[];
|
|
114
114
|
declare function getHandler(target: Phecda, key: PropertyKey): any[];
|
|
115
115
|
declare function setState(target: Phecda, key: PropertyKey, state: Record<string, any>): void;
|
|
116
116
|
declare function getOwnState(target: Phecda, key: PropertyKey): Object;
|
|
@@ -128,4 +128,4 @@ declare function Watcher(eventName: keyof Events, options?: {
|
|
|
128
128
|
declare function Effect(eventName: string, options?: any): (obj: any, key: string) => void;
|
|
129
129
|
declare function Storage(storeKey?: string): (target: any, key?: PropertyKey) => void;
|
|
130
130
|
|
|
131
|
-
export { Assign, Bind, ClassValue, Clear, DataMap, Effect, Empty, Err, Events, Expose, Global, Ignore, Init, Inject, NameSpace, Phecda,
|
|
131
|
+
export { Assign, Bind, ClassValue, Clear, DataMap, Effect, Empty, Err, Events, Expose, Global, Handler, Ignore, Init, Inject, InjectData, NameSpace, Phecda, Pipe, Provide, Rule, Storage, Tag, UsePipeOptions, Watcher, activeInstance, addDecoToClass, classToValue, getBind, getExposeKey, getHandler, getInitEvent, getModelState, getOwnExposeKey, getOwnHandler, getOwnIgnoreKey, getOwnInitEvent, getOwnModelState, getOwnState, getProperty, getState, getTag, init, injectProperty, isPhecda, plainToClass, regisHandler, regisInitEvent, register, registerAsync, setExposeKey, setIgnoreKey, setModelVar, setState, snapShot, to, validate };
|
package/dist/index.global.js
CHANGED
|
@@ -367,11 +367,18 @@ var Phecda = (() => {
|
|
|
367
367
|
}
|
|
368
368
|
__name(Assign, "Assign");
|
|
369
369
|
function Global(target) {
|
|
370
|
-
if (!globalThis.__PHECDA__)
|
|
371
|
-
globalThis.__PHECDA__ = {};
|
|
372
370
|
const tag = target.prototype.__TAG__;
|
|
373
|
-
if (tag)
|
|
374
|
-
|
|
371
|
+
if (tag) {
|
|
372
|
+
init(target.prototype);
|
|
373
|
+
setModelVar(target.prototype, "__CLASS");
|
|
374
|
+
regisHandler(target.prototype, "__CLASS", {
|
|
375
|
+
init: async () => {
|
|
376
|
+
if (!globalThis.__PHECDA__)
|
|
377
|
+
globalThis.__PHECDA__ = {};
|
|
378
|
+
globalThis.__PHECDA__[tag] = target;
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
375
382
|
}
|
|
376
383
|
__name(Global, "Global");
|
|
377
384
|
function Empty(_target) {
|
package/dist/index.js
CHANGED
|
@@ -367,11 +367,18 @@ function Assign(cb) {
|
|
|
367
367
|
}
|
|
368
368
|
__name(Assign, "Assign");
|
|
369
369
|
function Global(target) {
|
|
370
|
-
if (!globalThis.__PHECDA__)
|
|
371
|
-
globalThis.__PHECDA__ = {};
|
|
372
370
|
const tag = target.prototype.__TAG__;
|
|
373
|
-
if (tag)
|
|
374
|
-
|
|
371
|
+
if (tag) {
|
|
372
|
+
init(target.prototype);
|
|
373
|
+
setModelVar(target.prototype, "__CLASS");
|
|
374
|
+
regisHandler(target.prototype, "__CLASS", {
|
|
375
|
+
init: async () => {
|
|
376
|
+
if (!globalThis.__PHECDA__)
|
|
377
|
+
globalThis.__PHECDA__ = {};
|
|
378
|
+
globalThis.__PHECDA__[tag] = target;
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
375
382
|
}
|
|
376
383
|
__name(Global, "Global");
|
|
377
384
|
function Empty(_target) {
|
package/dist/index.mjs
CHANGED
|
@@ -276,11 +276,18 @@ function Assign(cb) {
|
|
|
276
276
|
}
|
|
277
277
|
__name(Assign, "Assign");
|
|
278
278
|
function Global(target) {
|
|
279
|
-
if (!globalThis.__PHECDA__)
|
|
280
|
-
globalThis.__PHECDA__ = {};
|
|
281
279
|
const tag = target.prototype.__TAG__;
|
|
282
|
-
if (tag)
|
|
283
|
-
|
|
280
|
+
if (tag) {
|
|
281
|
+
init(target.prototype);
|
|
282
|
+
setModelVar(target.prototype, "__CLASS");
|
|
283
|
+
regisHandler(target.prototype, "__CLASS", {
|
|
284
|
+
init: async () => {
|
|
285
|
+
if (!globalThis.__PHECDA__)
|
|
286
|
+
globalThis.__PHECDA__ = {};
|
|
287
|
+
globalThis.__PHECDA__[tag] = target;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
284
291
|
}
|
|
285
292
|
__name(Global, "Global");
|
|
286
293
|
function Empty(_target) {
|