phecda-core 1.6.0 → 1.7.0

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
@@ -118,6 +118,7 @@ declare function getProperty(key: string): any;
118
118
  declare function Watcher(eventName: keyof Events, options?: {
119
119
  once: boolean;
120
120
  }): (obj: any, key: string) => void;
121
+ declare function Effect(eventName: string, options?: any): (obj: any, key: string) => void;
121
122
  declare function Storage(storeKey?: string): (target: any, key?: PropertyKey) => void;
122
123
 
123
- export { Assign, Bind, ClassValue, Clear, DataMap, 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, getIgnoreKey, getInitEvent, getModelState, getProperty, getState, getTag, init, injectProperty, isPhecda, mergeOptions, mergeState, plainToClass, regisHandler, regisInitEvent, register, registerAsync, setExposeKey, setIgnoreKey, setModalVar, snapShot, to, validate };
124
+ 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, getIgnoreKey, getInitEvent, getModelState, getProperty, getState, getTag, init, injectProperty, isPhecda, mergeOptions, mergeState, plainToClass, regisHandler, regisInitEvent, register, registerAsync, setExposeKey, setIgnoreKey, setModalVar, snapShot, to, validate };
@@ -26,6 +26,7 @@ var Phecda = (() => {
26
26
  Bind: () => Bind,
27
27
  Clear: () => Clear,
28
28
  DataMap: () => DataMap,
29
+ Effect: () => Effect,
29
30
  Empty: () => Empty,
30
31
  Err: () => Err,
31
32
  Expose: () => Expose,
@@ -451,6 +452,32 @@ var Phecda = (() => {
451
452
  };
452
453
  }
453
454
  __name(Watcher, "Watcher");
455
+ function Effect(eventName, options) {
456
+ return (obj, key) => {
457
+ setModalVar(obj, key);
458
+ regisHandler(obj, key, {
459
+ init(instance) {
460
+ instance[`$_${key}`] = instance[key];
461
+ Object.defineProperty(instance, key, {
462
+ get() {
463
+ return instance[`$_${key}`];
464
+ },
465
+ set(v) {
466
+ instance[`$_${key}`] = v;
467
+ getProperty(`effect-${eventName}`)?.({
468
+ instance,
469
+ key,
470
+ value: v,
471
+ options
472
+ });
473
+ return true;
474
+ }
475
+ });
476
+ }
477
+ });
478
+ };
479
+ }
480
+ __name(Effect, "Effect");
454
481
  function Storage(storeKey) {
455
482
  return (target, key) => {
456
483
  let tag;
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ __export(src_exports, {
25
25
  Bind: () => Bind,
26
26
  Clear: () => Clear,
27
27
  DataMap: () => DataMap,
28
+ Effect: () => Effect,
28
29
  Empty: () => Empty,
29
30
  Err: () => Err,
30
31
  Expose: () => Expose,
@@ -451,6 +452,32 @@ function Watcher(eventName, options) {
451
452
  };
452
453
  }
453
454
  __name(Watcher, "Watcher");
455
+ function Effect(eventName, options) {
456
+ return (obj, key) => {
457
+ setModalVar(obj, key);
458
+ regisHandler(obj, key, {
459
+ init(instance) {
460
+ instance[`$_${key}`] = instance[key];
461
+ Object.defineProperty(instance, key, {
462
+ get() {
463
+ return instance[`$_${key}`];
464
+ },
465
+ set(v) {
466
+ instance[`$_${key}`] = v;
467
+ getProperty(`effect-${eventName}`)?.({
468
+ instance,
469
+ key,
470
+ value: v,
471
+ options
472
+ });
473
+ return true;
474
+ }
475
+ });
476
+ }
477
+ });
478
+ };
479
+ }
480
+ __name(Effect, "Effect");
454
481
  function Storage(storeKey) {
455
482
  return (target, key) => {
456
483
  let tag;
@@ -492,6 +519,7 @@ __name(Storage, "Storage");
492
519
  Bind,
493
520
  Clear,
494
521
  DataMap,
522
+ Effect,
495
523
  Empty,
496
524
  Err,
497
525
  Expose,
package/dist/index.mjs CHANGED
@@ -383,6 +383,32 @@ function Watcher(eventName, options) {
383
383
  };
384
384
  }
385
385
  __name(Watcher, "Watcher");
386
+ function Effect(eventName, options) {
387
+ return (obj, key) => {
388
+ setModalVar(obj, key);
389
+ regisHandler(obj, key, {
390
+ init(instance) {
391
+ instance[`$_${key}`] = instance[key];
392
+ Object.defineProperty(instance, key, {
393
+ get() {
394
+ return instance[`$_${key}`];
395
+ },
396
+ set(v) {
397
+ instance[`$_${key}`] = v;
398
+ getProperty(`effect-${eventName}`)?.({
399
+ instance,
400
+ key,
401
+ value: v,
402
+ options
403
+ });
404
+ return true;
405
+ }
406
+ });
407
+ }
408
+ });
409
+ };
410
+ }
411
+ __name(Effect, "Effect");
386
412
  function Storage(storeKey) {
387
413
  return (target, key) => {
388
414
  let tag;
@@ -423,6 +449,7 @@ export {
423
449
  Bind,
424
450
  Clear,
425
451
  DataMap,
452
+ Effect,
426
453
  Empty,
427
454
  Err,
428
455
  Expose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-core",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
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",