phecda-core 2.0.0-alpha.3 → 2.0.0-alpha.5

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 CHANGED
@@ -7,10 +7,10 @@ interface UsePipeOptions {
7
7
  transform?: boolean;
8
8
  collectError?: boolean;
9
9
  }
10
- interface PhecdaInjectData {
10
+ interface InjectData {
11
11
  [key: string]: any;
12
12
  }
13
- interface PhecdaHandler {
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, PhecdaHandler[]>;
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: PhecdaInjectData;
93
- declare function Provide<K extends keyof PhecdaInjectData>(key: K, value: PhecdaInjectData[K]): void;
94
- declare function Inject<K extends keyof PhecdaInjectData>(key: K): PhecdaInjectData[K];
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: PhecdaHandler): void;
113
- declare function getOwnHandler(target: Phecda, key: PropertyKey): PhecdaHandler[];
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, PhecdaHandler, PhecdaInjectData, 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 };
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 };
@@ -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
- const tag = target.prototype.__TAG__;
373
- if (tag)
374
- globalThis.__PHECDA__[tag] = target;
370
+ init(target.prototype);
371
+ setModelVar(target.prototype, "__CLASS");
372
+ regisHandler(target.prototype, "__CLASS", {
373
+ init: async () => {
374
+ const tag = target.prototype.__TAG__;
375
+ if (!tag)
376
+ return;
377
+ if (!globalThis.__PHECDA__)
378
+ globalThis.__PHECDA__ = {};
379
+ globalThis.__PHECDA__[tag] = target;
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
- const tag = target.prototype.__TAG__;
373
- if (tag)
374
- globalThis.__PHECDA__[tag] = target;
370
+ init(target.prototype);
371
+ setModelVar(target.prototype, "__CLASS");
372
+ regisHandler(target.prototype, "__CLASS", {
373
+ init: async () => {
374
+ const tag = target.prototype.__TAG__;
375
+ if (!tag)
376
+ return;
377
+ if (!globalThis.__PHECDA__)
378
+ globalThis.__PHECDA__ = {};
379
+ globalThis.__PHECDA__[tag] = target;
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
- const tag = target.prototype.__TAG__;
282
- if (tag)
283
- globalThis.__PHECDA__[tag] = target;
279
+ init(target.prototype);
280
+ setModelVar(target.prototype, "__CLASS");
281
+ regisHandler(target.prototype, "__CLASS", {
282
+ init: async () => {
283
+ const tag = target.prototype.__TAG__;
284
+ if (!tag)
285
+ return;
286
+ if (!globalThis.__PHECDA__)
287
+ globalThis.__PHECDA__ = {};
288
+ globalThis.__PHECDA__[tag] = target;
289
+ }
290
+ });
284
291
  }
285
292
  __name(Global, "Global");
286
293
  function Empty(_target) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-core",
3
- "version": "2.0.0-alpha.3",
3
+ "version": "2.0.0-alpha.5",
4
4
  "description": "provide base function and abstract limit to other phecda module ",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",