phecda-core 3.0.0-alpha.10 → 3.0.0-alpha.12

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.js CHANGED
@@ -34,7 +34,7 @@ __export(src_exports, {
34
34
  Init: () => Init,
35
35
  Inject: () => Inject,
36
36
  Isolate: () => Isolate,
37
- Nested: () => Nested,
37
+ PHECDA_KEY: () => PHECDA_KEY,
38
38
  Pipeline: () => Pipeline,
39
39
  Provide: () => Provide,
40
40
  SHARE_KEY: () => SHARE_KEY,
@@ -46,47 +46,50 @@ __export(src_exports, {
46
46
  Watcher: () => Watcher,
47
47
  activeInstance: () => activeInstance,
48
48
  addDecoToClass: () => addDecoToClass,
49
- classToValue: () => classToValue,
49
+ classToPlain: () => classToPlain,
50
50
  getBind: () => getBind,
51
51
  getExposeKey: () => getExposeKey,
52
52
  getHandler: () => getHandler,
53
- getModuleState: () => getModuleState,
54
53
  getOwnExposeKey: () => getOwnExposeKey,
55
54
  getOwnHandler: () => getOwnHandler,
56
55
  getOwnIgnoreKey: () => getOwnIgnoreKey,
57
- getOwnModuleState: () => getOwnModuleState,
58
56
  getOwnState: () => getOwnState,
57
+ getOwnStateVars: () => getOwnStateVars,
59
58
  getProperty: () => getProperty,
60
59
  getState: () => getState,
61
- getTag: () => getTag2,
60
+ getStateVars: () => getStateVars,
61
+ getTag: () => getTag,
62
62
  init: () => init,
63
63
  injectProperty: () => injectProperty,
64
64
  invokeHandler: () => invokeHandler,
65
+ isAsyncFunc: () => isAsyncFunc,
65
66
  isPhecda: () => isPhecda,
66
67
  plainToClass: () => plainToClass,
67
- regisHandler: () => regisHandler,
68
68
  setExposeKey: () => setExposeKey,
69
+ setHandler: () => setHandler,
69
70
  setIgnoreKey: () => setIgnoreKey,
70
71
  setState: () => setState,
71
- setVar: () => setVar,
72
+ setStateVar: () => setStateVar,
72
73
  snapShot: () => snapShot,
73
- transformClass: () => transformClass
74
+ transformClass: () => transformClass,
75
+ transformProperty: () => transformProperty
74
76
  });
75
77
  module.exports = __toCommonJS(src_exports);
76
78
 
77
79
  // src/core.ts
80
+ var SHARE_KEY = Symbol("phecda");
81
+ var PHECDA_KEY = Symbol("phecda");
78
82
  function isPhecda(module2) {
79
83
  if (typeof module2 === "function")
80
- return !!module2.prototype?._namespace;
84
+ return !!module2.prototype?.[PHECDA_KEY];
81
85
  return false;
82
86
  }
83
87
  __name(isPhecda, "isPhecda");
84
- var SHARE_KEY = Symbol("phecda-core");
85
88
  function init(proto) {
86
89
  if (!proto)
87
90
  return;
88
- if (!proto.hasOwnProperty("_namespace")) {
89
- proto._namespace = {
91
+ if (!proto.hasOwnProperty(PHECDA_KEY)) {
92
+ proto[PHECDA_KEY] = {
90
93
  __EXPOSE_VAR__: /* @__PURE__ */ new Set(),
91
94
  __IGNORE_VAR__: /* @__PURE__ */ new Set(),
92
95
  __STATE_VAR__: /* @__PURE__ */ new Set(),
@@ -96,55 +99,79 @@ function init(proto) {
96
99
  }
97
100
  }
98
101
  __name(init, "init");
99
- function setVar(proto, key) {
102
+ function getPhecdaFromTarget(target) {
103
+ if (typeof target === "function")
104
+ return target.prototype;
105
+ if (target.hasOwnProperty(PHECDA_KEY))
106
+ return target;
107
+ return Object.getPrototypeOf(target);
108
+ }
109
+ __name(getPhecdaFromTarget, "getPhecdaFromTarget");
110
+ function setStateVar(proto, key) {
100
111
  init(proto);
101
- proto._namespace.__STATE_VAR__.add(key);
112
+ proto[PHECDA_KEY].__STATE_VAR__.add(key);
102
113
  setExposeKey(proto, key);
103
114
  }
104
- __name(setVar, "setVar");
115
+ __name(setStateVar, "setStateVar");
105
116
  function setExposeKey(proto, key) {
106
117
  init(proto);
107
- proto._namespace.__EXPOSE_VAR__.add(key);
118
+ proto[PHECDA_KEY].__EXPOSE_VAR__.add(key);
108
119
  }
109
120
  __name(setExposeKey, "setExposeKey");
110
121
  function setIgnoreKey(proto, key) {
111
122
  init(proto);
112
- proto._namespace.__IGNORE_VAR__.add(key);
123
+ proto[PHECDA_KEY].__IGNORE_VAR__.add(key);
113
124
  }
114
125
  __name(setIgnoreKey, "setIgnoreKey");
115
- function getOwnModuleState(instance) {
116
- instance = Object.getPrototypeOf(instance);
126
+ function setHandler(proto, key, handler) {
127
+ init(proto);
128
+ if (!proto[PHECDA_KEY].__STATE_HANDLER__.has(key))
129
+ proto[PHECDA_KEY].__STATE_HANDLER__.set(key, [
130
+ handler
131
+ ]);
132
+ else
133
+ proto[PHECDA_KEY].__STATE_HANDLER__.get(key).push(handler);
134
+ }
135
+ __name(setHandler, "setHandler");
136
+ function setState(proto, key, state) {
137
+ init(proto);
138
+ const namespace = proto[PHECDA_KEY].__STATE_NAMESPACE__;
139
+ namespace.set(key, state);
140
+ }
141
+ __name(setState, "setState");
142
+ function getOwnStateVars(target) {
143
+ const proto = getPhecdaFromTarget(target);
117
144
  return [
118
- ...instance._namespace.__STATE_VAR__
145
+ ...proto[PHECDA_KEY].__STATE_VAR__
119
146
  ];
120
147
  }
121
- __name(getOwnModuleState, "getOwnModuleState");
122
- function getModuleState(instance) {
123
- let proto = Object.getPrototypeOf(instance);
148
+ __name(getOwnStateVars, "getOwnStateVars");
149
+ function getStateVars(target) {
150
+ let proto = getPhecdaFromTarget(target);
124
151
  const set = /* @__PURE__ */ new Set();
125
- while (proto?._namespace) {
126
- proto._namespace.__STATE_VAR__.forEach((item) => set.add(item));
152
+ while (proto?.[PHECDA_KEY]) {
153
+ proto[PHECDA_KEY].__STATE_VAR__.forEach((item) => set.add(item));
127
154
  proto = Object.getPrototypeOf(proto);
128
155
  }
129
156
  return [
130
157
  ...set
131
158
  ];
132
159
  }
133
- __name(getModuleState, "getModuleState");
134
- function getOwnExposeKey(instance) {
135
- instance = Object.getPrototypeOf(instance);
160
+ __name(getStateVars, "getStateVars");
161
+ function getOwnExposeKey(target) {
162
+ const proto = getPhecdaFromTarget(target);
136
163
  return [
137
- ...instance._namespace.__EXPOSE_VAR__
138
- ].filter((item) => !instance._namespace.__IGNORE_VAR__.has(item));
164
+ ...proto[PHECDA_KEY].__EXPOSE_VAR__
165
+ ].filter((item) => !proto[PHECDA_KEY].__IGNORE_VAR__.has(item));
139
166
  }
140
167
  __name(getOwnExposeKey, "getOwnExposeKey");
141
- function getExposeKey(instance) {
142
- let proto = Object.getPrototypeOf(instance);
168
+ function getExposeKey(target) {
169
+ let proto = getPhecdaFromTarget(target);
143
170
  const set = /* @__PURE__ */ new Set();
144
- while (proto?._namespace) {
171
+ while (proto?.[PHECDA_KEY]) {
145
172
  [
146
- ...proto._namespace.__EXPOSE_VAR__
147
- ].forEach((item) => !proto._namespace.__IGNORE_VAR__.has(item) && set.add(item));
173
+ ...proto[PHECDA_KEY].__EXPOSE_VAR__
174
+ ].forEach((item) => !proto[PHECDA_KEY].__IGNORE_VAR__.has(item) && set.add(item));
148
175
  proto = Object.getPrototypeOf(proto);
149
176
  }
150
177
  return [
@@ -152,35 +179,27 @@ function getExposeKey(instance) {
152
179
  ];
153
180
  }
154
181
  __name(getExposeKey, "getExposeKey");
155
- function getOwnIgnoreKey(instance) {
156
- if (!instance?._namespace)
182
+ function getOwnIgnoreKey(target) {
183
+ const proto = getPhecdaFromTarget(target);
184
+ if (!proto?.[PHECDA_KEY])
157
185
  return [];
158
186
  return [
159
- ...instance._namespace.__IGNORE_VAR__
187
+ ...proto[PHECDA_KEY].__IGNORE_VAR__
160
188
  ];
161
189
  }
162
190
  __name(getOwnIgnoreKey, "getOwnIgnoreKey");
163
- function regisHandler(proto, key, handler) {
164
- init(proto);
165
- if (!proto._namespace.__STATE_HANDLER__.has(key))
166
- proto._namespace.__STATE_HANDLER__.set(key, [
167
- handler
168
- ]);
169
- else
170
- proto._namespace.__STATE_HANDLER__.get(key).push(handler);
171
- }
172
- __name(regisHandler, "regisHandler");
173
- function getOwnHandler(instance, key) {
174
- if (!instance?._namespace)
191
+ function getOwnHandler(target, key) {
192
+ const proto = getPhecdaFromTarget(target);
193
+ if (!proto?.[PHECDA_KEY])
175
194
  return [];
176
- return instance._namespace.__STATE_HANDLER__.get(key) || [];
195
+ return proto[PHECDA_KEY].__STATE_HANDLER__.get(key) || [];
177
196
  }
178
197
  __name(getOwnHandler, "getOwnHandler");
179
- function getHandler(instance, key) {
180
- let proto = Object.getPrototypeOf(instance);
198
+ function getHandler(target, key) {
199
+ let proto = getPhecdaFromTarget(target);
181
200
  const set = /* @__PURE__ */ new Set();
182
- while (proto?._namespace) {
183
- proto._namespace.__STATE_HANDLER__.get(key)?.forEach((item) => set.add(item));
201
+ while (proto?.[PHECDA_KEY]) {
202
+ proto[PHECDA_KEY].__STATE_HANDLER__.get(key)?.forEach((item) => set.add(item));
184
203
  proto = Object.getPrototypeOf(proto);
185
204
  }
186
205
  return [
@@ -188,22 +207,11 @@ function getHandler(instance, key) {
188
207
  ];
189
208
  }
190
209
  __name(getHandler, "getHandler");
191
- function setState(proto, key, state) {
192
- init(proto);
193
- const namespace = proto._namespace.__STATE_NAMESPACE__;
194
- namespace.set(key, state);
195
- }
196
- __name(setState, "setState");
197
- function getOwnState(instance, key) {
198
- instance = Object.getPrototypeOf(instance);
199
- return instance._namespace.__STATE_NAMESPACE__.get(key) || {};
200
- }
201
- __name(getOwnState, "getOwnState");
202
- function getState(instance, key) {
203
- let proto = Object.getPrototypeOf(instance);
210
+ function getState(target, key) {
211
+ let proto = getPhecdaFromTarget(target);
204
212
  let ret = {};
205
- while (proto?._namespace) {
206
- const state = proto._namespace.__STATE_NAMESPACE__.get(key);
213
+ while (proto?.[PHECDA_KEY]) {
214
+ const state = proto[PHECDA_KEY].__STATE_NAMESPACE__.get(key);
207
215
  if (state)
208
216
  ret = {
209
217
  ...state,
@@ -214,6 +222,11 @@ function getState(instance, key) {
214
222
  return ret;
215
223
  }
216
224
  __name(getState, "getState");
225
+ function getOwnState(target, key) {
226
+ const proto = getPhecdaFromTarget(target);
227
+ return proto[PHECDA_KEY].__STATE_NAMESPACE__.get(key) || {};
228
+ }
229
+ __name(getOwnState, "getOwnState");
217
230
  function invokeHandler(event, instance) {
218
231
  const stateVars = getExposeKey(instance);
219
232
  const initHandlers = stateVars.map((item) => {
@@ -223,16 +236,66 @@ function invokeHandler(event, instance) {
223
236
  }
224
237
  __name(invokeHandler, "invokeHandler");
225
238
 
239
+ // src/decorators/core.ts
240
+ function Init(proto, key) {
241
+ setStateVar(proto, key);
242
+ setHandler(proto, key, {
243
+ async init(instance) {
244
+ return instance[key]();
245
+ }
246
+ });
247
+ }
248
+ __name(Init, "Init");
249
+ function Unmount(proto, key) {
250
+ setStateVar(proto, key);
251
+ setHandler(proto, key, {
252
+ async unmount(instance) {
253
+ return instance[key]();
254
+ }
255
+ });
256
+ }
257
+ __name(Unmount, "Unmount");
258
+ function Bind(value) {
259
+ return (proto, k) => {
260
+ setStateVar(proto, k);
261
+ setState(proto, k, {
262
+ value
263
+ });
264
+ };
265
+ }
266
+ __name(Bind, "Bind");
267
+ function Ignore(proto, key) {
268
+ setIgnoreKey(proto, key);
269
+ }
270
+ __name(Ignore, "Ignore");
271
+ function Clear(proto, key) {
272
+ init(proto);
273
+ proto[PHECDA_KEY].__EXPOSE_VAR__.delete(key);
274
+ proto[PHECDA_KEY].__IGNORE_VAR__.delete(key);
275
+ proto[PHECDA_KEY].__STATE_VAR__.delete(key);
276
+ proto[PHECDA_KEY].__STATE_HANDLER__.delete(key);
277
+ proto[PHECDA_KEY].__STATE_NAMESPACE__.delete(key);
278
+ }
279
+ __name(Clear, "Clear");
280
+ function Expose(proto, key) {
281
+ setExposeKey(proto, key);
282
+ }
283
+ __name(Expose, "Expose");
284
+ function Empty(module2) {
285
+ init(module2.prototype);
286
+ }
287
+ __name(Empty, "Empty");
288
+
226
289
  // src/helper.ts
227
- function getTag2(moduleOrInstance) {
290
+ function getTag(moduleOrInstance) {
228
291
  if (typeof moduleOrInstance === "object")
229
292
  moduleOrInstance = moduleOrInstance.constructor;
230
293
  return moduleOrInstance.prototype?.__TAG__ || moduleOrInstance.name;
231
294
  }
232
- __name(getTag2, "getTag");
295
+ __name(getTag, "getTag");
233
296
  function getBind(module2) {
234
297
  const instance = new module2();
235
- const keys = getModuleState(instance);
298
+ const keys = getStateVars(instance);
236
299
  const ret = {};
237
300
  for (const item of keys) {
238
301
  const state = getState(instance, item);
@@ -252,12 +315,14 @@ function plainToClass(module2, input) {
252
315
  __name(plainToClass, "plainToClass");
253
316
  async function transformClass(instance, force = false) {
254
317
  const err = [];
255
- const stateVars = getModuleState(instance);
256
- for (const item of stateVars) {
318
+ const keys = getExposeKey(instance);
319
+ for (const item of keys) {
257
320
  const handlers = getHandler(instance, item);
258
321
  if (handlers) {
259
322
  for (const handler of handlers) {
260
323
  const pipe = handler.pipe;
324
+ if (!pipe)
325
+ continue;
261
326
  try {
262
327
  await pipe(instance);
263
328
  } catch (e) {
@@ -271,14 +336,34 @@ async function transformClass(instance, force = false) {
271
336
  return err;
272
337
  }
273
338
  __name(transformClass, "transformClass");
274
- function classToValue(instance) {
339
+ async function transformProperty(instance, property, force = false) {
340
+ const err = [];
341
+ const handlers = getHandler(instance, property);
342
+ if (handlers) {
343
+ for (const handler of handlers) {
344
+ const pipe = handler.pipe;
345
+ if (!pipe)
346
+ continue;
347
+ try {
348
+ await pipe(instance);
349
+ } catch (e) {
350
+ err.push(e.message);
351
+ if (!force)
352
+ return err;
353
+ }
354
+ }
355
+ }
356
+ return err;
357
+ }
358
+ __name(transformProperty, "transformProperty");
359
+ function classToPlain(instance) {
275
360
  const data = {};
276
361
  const exposeVars = getExposeKey(instance);
277
362
  for (const item of exposeVars)
278
363
  data[item] = instance[item];
279
- return data;
364
+ return JSON.parse(JSON.stringify(data));
280
365
  }
281
- __name(classToValue, "classToValue");
366
+ __name(classToPlain, "classToPlain");
282
367
  function snapShot(data) {
283
368
  const snap = {};
284
369
  for (const i in data)
@@ -296,8 +381,8 @@ function snapShot(data) {
296
381
  };
297
382
  }
298
383
  __name(snapShot, "snapShot");
299
- function addDecoToClass(c, key, handler, type = "class") {
300
- handler(type === "class" ? c.prototype : c, key);
384
+ function addDecoToClass(c, key, handler) {
385
+ handler(key === SHARE_KEY ? c : c.prototype, key);
301
386
  }
302
387
  __name(addDecoToClass, "addDecoToClass");
303
388
  function Pipeline(...decos) {
@@ -307,73 +392,43 @@ function Pipeline(...decos) {
307
392
  };
308
393
  }
309
394
  __name(Pipeline, "Pipeline");
310
-
311
- // src/decorators.ts
312
- function Init(proto, key) {
313
- setVar(proto, key);
314
- regisHandler(proto, key, {
315
- async init(instance) {
316
- return instance[key]();
317
- }
318
- });
319
- }
320
- __name(Init, "Init");
321
- function Unmount(proto, key) {
322
- setVar(proto, key);
323
- regisHandler(proto, key, {
324
- async unmount(instance) {
325
- return instance[key]();
326
- }
327
- });
328
- }
329
- __name(Unmount, "Unmount");
330
- function Bind(value) {
331
- return (proto, k) => {
332
- setVar(proto, k);
333
- setState(proto, k, {
334
- value
335
- });
336
- };
395
+ function isAsyncFunc(fn) {
396
+ return fn[Symbol.toStringTag] === "AsyncFunction";
337
397
  }
338
- __name(Bind, "Bind");
339
- function Ignore(proto, key) {
340
- setIgnoreKey(proto, key);
398
+ __name(isAsyncFunc, "isAsyncFunc");
399
+
400
+ // src/di.ts
401
+ var DataMap = {};
402
+ function Provide(key, value) {
403
+ DataMap[key] = value;
341
404
  }
342
- __name(Ignore, "Ignore");
343
- function Clear(proto, key) {
344
- init(proto);
345
- proto._namespace.__EXPOSE_VAR__.delete(key);
346
- proto._namespace.__IGNORE_VAR__.delete(key);
347
- proto._namespace.__STATE_VAR__.delete(key);
348
- proto._namespace.__STATE_HANDLER__.delete(key);
349
- proto._namespace.__STATE_NAMESPACE__.delete(key);
405
+ __name(Provide, "Provide");
406
+ var EmptyProxy = new Proxy(Empty, {
407
+ apply() {
408
+ return EmptyProxy;
409
+ }
410
+ });
411
+ function Inject(key) {
412
+ return DataMap[key] || EmptyProxy;
350
413
  }
351
- __name(Clear, "Clear");
352
- function Err(cb) {
353
- return (proto, key) => {
354
- setVar(proto, key);
355
- regisHandler(proto, key, {
356
- error: cb
357
- });
358
- };
414
+ __name(Inject, "Inject");
415
+ var activeInstance = {};
416
+ function injectProperty(key, value) {
417
+ activeInstance[key] = value;
418
+ return activeInstance;
359
419
  }
360
- __name(Err, "Err");
361
- function Expose(proto, key) {
362
- setExposeKey(proto, key);
420
+ __name(injectProperty, "injectProperty");
421
+ function getProperty(key) {
422
+ return activeInstance[key];
363
423
  }
364
- __name(Expose, "Expose");
365
- function To(...callbacks) {
366
- return (proto, key) => {
367
- setVar(proto, key);
368
- regisHandler(proto, key, {
369
- async pipe(instance) {
370
- for (const cb of callbacks)
371
- instance[key] = await cb(instance[key], instance, key);
372
- }
373
- });
374
- };
424
+ __name(getProperty, "getProperty");
425
+
426
+ // src/decorators/function.ts
427
+ function Isolate(target) {
428
+ init(target.prototype);
429
+ target.prototype.__ISOLATE__ = true;
375
430
  }
376
- __name(To, "To");
431
+ __name(Isolate, "Isolate");
377
432
  function Tag(tag) {
378
433
  return (module2) => {
379
434
  init(module2.prototype);
@@ -391,8 +446,8 @@ __name(Unique, "Unique");
391
446
  function Assign(cb) {
392
447
  return (module2) => {
393
448
  init(module2.prototype);
394
- setVar(module2.prototype, SHARE_KEY);
395
- regisHandler(module2.prototype, SHARE_KEY, {
449
+ setStateVar(module2.prototype, SHARE_KEY);
450
+ setHandler(module2.prototype, SHARE_KEY, {
396
451
  init: async (instance) => {
397
452
  const value = await cb(instance);
398
453
  if (value && typeof value === "object" && !Array.isArray(value)) {
@@ -406,8 +461,8 @@ function Assign(cb) {
406
461
  __name(Assign, "Assign");
407
462
  function Global(module2) {
408
463
  init(module2.prototype);
409
- setVar(module2.prototype, SHARE_KEY);
410
- regisHandler(module2.prototype, SHARE_KEY, {
464
+ setStateVar(module2.prototype, SHARE_KEY);
465
+ setHandler(module2.prototype, SHARE_KEY, {
411
466
  init: async (instance) => {
412
467
  const tag = instance.__TAG__;
413
468
  if (!tag)
@@ -419,58 +474,57 @@ function Global(module2) {
419
474
  });
420
475
  }
421
476
  __name(Global, "Global");
422
- function Empty(module2) {
423
- init(module2.prototype);
424
- }
425
- __name(Empty, "Empty");
426
- var DataMap = {};
427
- function Provide(key, value) {
428
- DataMap[key] = value;
429
- }
430
- __name(Provide, "Provide");
431
- var EmptyProxy = new Proxy(Empty, {
432
- apply() {
433
- return EmptyProxy;
434
- }
435
- });
436
- function Inject(key) {
437
- return DataMap[key] || EmptyProxy;
438
- }
439
- __name(Inject, "Inject");
440
- function Nested(module2) {
441
- return To(async (property) => {
442
- const instance = plainToClass(module2, property);
443
- const err = await transformClass(instance);
444
- if (err.length > 0)
445
- throw new Error(err[0]);
446
- return instance;
447
- });
448
- }
449
- __name(Nested, "Nested");
450
- function Isolate() {
451
- return (target) => {
452
- init(target.prototype);
453
- target.prototype.__ISOLATE__ = true;
477
+ function To(...callbacks) {
478
+ return (proto, key) => {
479
+ setStateVar(proto, key);
480
+ setHandler(proto, key, {
481
+ async pipe(instance) {
482
+ for (const cb of callbacks)
483
+ instance[key] = await cb(instance[key], instance, key);
484
+ }
485
+ });
454
486
  };
455
487
  }
456
- __name(Isolate, "Isolate");
457
-
458
- // src/custom/decorator.ts
459
- var activeInstance = {};
460
- function injectProperty(key, value) {
461
- activeInstance[key] = value;
462
- return activeInstance;
463
- }
464
- __name(injectProperty, "injectProperty");
465
- function getProperty(key) {
466
- return activeInstance[key];
488
+ __name(To, "To");
489
+ function Err(cb, isCatch = false) {
490
+ return (proto, key) => {
491
+ setStateVar(proto, key);
492
+ setHandler(proto, key, {
493
+ init: (instance) => {
494
+ if (typeof instance[key] === "function") {
495
+ const oldFn = instance[key].bind(instance);
496
+ if (isAsyncFunc(oldFn)) {
497
+ instance[key] = async (...args) => {
498
+ try {
499
+ await oldFn(...args);
500
+ } catch (e) {
501
+ cb(e, instance, key);
502
+ if (!isCatch)
503
+ throw e;
504
+ }
505
+ };
506
+ } else {
507
+ instance[key] = (...args) => {
508
+ try {
509
+ oldFn(...args);
510
+ } catch (e) {
511
+ cb(e, instance, key);
512
+ if (!isCatch)
513
+ throw e;
514
+ }
515
+ };
516
+ }
517
+ }
518
+ }
519
+ });
520
+ };
467
521
  }
468
- __name(getProperty, "getProperty");
522
+ __name(Err, "Err");
469
523
  function Watcher(eventName, options) {
470
524
  let cb;
471
525
  return (proto, key) => {
472
- setVar(proto, key);
473
- regisHandler(proto, key, {
526
+ setStateVar(proto, key);
527
+ setHandler(proto, key, {
474
528
  init(instance) {
475
529
  return cb = getProperty("watcher")?.({
476
530
  eventName,
@@ -488,8 +542,8 @@ function Watcher(eventName, options) {
488
542
  __name(Watcher, "Watcher");
489
543
  function Effect(eventName, options) {
490
544
  return (proto, key) => {
491
- setVar(proto, key);
492
- regisHandler(proto, key, {
545
+ setStateVar(proto, key);
546
+ setHandler(proto, key, {
493
547
  init(instance) {
494
548
  instance[`$_${key}`] = instance[key];
495
549
  Object.defineProperty(instance, key, {
@@ -522,8 +576,8 @@ function Storage({ key: storeKey, toJSON, toString } = {}) {
522
576
  if (key) {
523
577
  init(proto);
524
578
  tag = storeKey || `${getTag(proto)}_${key}`;
525
- setVar(proto, key);
526
- regisHandler(proto, key, {
579
+ setStateVar(proto, key);
580
+ setHandler(proto, key, {
527
581
  init: (instance) => {
528
582
  return getProperty("storage")?.({
529
583
  instance,
@@ -537,8 +591,8 @@ function Storage({ key: storeKey, toJSON, toString } = {}) {
537
591
  } else {
538
592
  init(proto.prototype);
539
593
  tag = storeKey || getTag(proto);
540
- setVar(proto.prototype, SHARE_KEY);
541
- regisHandler(proto.prototype, SHARE_KEY, {
594
+ setStateVar(proto.prototype, SHARE_KEY);
595
+ setHandler(proto.prototype, SHARE_KEY, {
542
596
  init: (instance) => {
543
597
  return getProperty("storage")?.({
544
598
  instance,
@@ -568,7 +622,7 @@ __name(Storage, "Storage");
568
622
  Init,
569
623
  Inject,
570
624
  Isolate,
571
- Nested,
625
+ PHECDA_KEY,
572
626
  Pipeline,
573
627
  Provide,
574
628
  SHARE_KEY,
@@ -580,29 +634,31 @@ __name(Storage, "Storage");
580
634
  Watcher,
581
635
  activeInstance,
582
636
  addDecoToClass,
583
- classToValue,
637
+ classToPlain,
584
638
  getBind,
585
639
  getExposeKey,
586
640
  getHandler,
587
- getModuleState,
588
641
  getOwnExposeKey,
589
642
  getOwnHandler,
590
643
  getOwnIgnoreKey,
591
- getOwnModuleState,
592
644
  getOwnState,
645
+ getOwnStateVars,
593
646
  getProperty,
594
647
  getState,
648
+ getStateVars,
595
649
  getTag,
596
650
  init,
597
651
  injectProperty,
598
652
  invokeHandler,
653
+ isAsyncFunc,
599
654
  isPhecda,
600
655
  plainToClass,
601
- regisHandler,
602
656
  setExposeKey,
657
+ setHandler,
603
658
  setIgnoreKey,
604
659
  setState,
605
- setVar,
660
+ setStateVar,
606
661
  snapShot,
607
- transformClass
662
+ transformClass,
663
+ transformProperty
608
664
  });