phecda-vue 4.0.8 → 5.0.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.js CHANGED
@@ -428,7 +428,7 @@ function usePhecda() {
428
428
  return cacheMap.get(activePhecda);
429
429
  }
430
430
  __name(usePhecda, "usePhecda");
431
- function setStateToComponent(model) {
431
+ function setMetaToComponent(model) {
432
432
  if (USE_DEVTOOLS) {
433
433
  const currentInstance = (0, import_vue3.getCurrentInstance)();
434
434
  if (currentInstance && currentInstance.proxy) {
@@ -439,7 +439,7 @@ function setStateToComponent(model) {
439
439
  }
440
440
  }
441
441
  }
442
- __name(setStateToComponent, "setStateToComponent");
442
+ __name(setMetaToComponent, "setMetaToComponent");
443
443
  function getPhecda(phecda) {
444
444
  const activePhecda = phecda || (0, import_phecda_web2.getDefaultPhecda)("vue");
445
445
  if (!activePhecda) throw new Error("[phecda-vue]: manually inject the phecda instance if there is no default phecda");
@@ -459,7 +459,7 @@ function useEvent(eventName, cb) {
459
459
  }
460
460
  __name(useEvent, "useEvent");
461
461
  function useR(model) {
462
- setStateToComponent(model);
462
+ setMetaToComponent(model);
463
463
  return usePhecda().init(model);
464
464
  }
465
465
  __name(useR, "useR");
@@ -468,7 +468,7 @@ function getR(model, phecda) {
468
468
  }
469
469
  __name(getR, "getR");
470
470
  function useV(model) {
471
- setStateToComponent(model);
471
+ setMetaToComponent(model);
472
472
  const instance = usePhecda().init(model);
473
473
  if (cacheMap.has(instance)) return cacheMap.get(instance);
474
474
  const cache = {};
@@ -524,9 +524,8 @@ function Shallow(model) {
524
524
  __name(Shallow, "Shallow");
525
525
  function WatchEffect(option) {
526
526
  return (proto, key) => {
527
- (0, import_phecda_web3.setStateKey)(proto, key);
528
527
  let stopHandler;
529
- (0, import_phecda_web3.setHandler)(proto, key, {
528
+ (0, import_phecda_web3.setMeta)(proto, key, void 0, {
530
529
  init(instance) {
531
530
  if (typeof instance[key] !== "function") throw new Error("WatchEffect must decorate function");
532
531
  stopHandler = (0, import_vue4.watchEffect)(instance[key].bind(instance), option);
package/dist/index.mjs CHANGED
@@ -390,7 +390,7 @@ function usePhecda() {
390
390
  return cacheMap.get(activePhecda);
391
391
  }
392
392
  __name(usePhecda, "usePhecda");
393
- function setStateToComponent(model) {
393
+ function setMetaToComponent(model) {
394
394
  if (USE_DEVTOOLS) {
395
395
  const currentInstance = getCurrentInstance();
396
396
  if (currentInstance && currentInstance.proxy) {
@@ -401,7 +401,7 @@ function setStateToComponent(model) {
401
401
  }
402
402
  }
403
403
  }
404
- __name(setStateToComponent, "setStateToComponent");
404
+ __name(setMetaToComponent, "setMetaToComponent");
405
405
  function getPhecda(phecda) {
406
406
  const activePhecda = phecda || getDefaultPhecda("vue");
407
407
  if (!activePhecda) throw new Error("[phecda-vue]: manually inject the phecda instance if there is no default phecda");
@@ -421,7 +421,7 @@ function useEvent(eventName, cb) {
421
421
  }
422
422
  __name(useEvent, "useEvent");
423
423
  function useR(model) {
424
- setStateToComponent(model);
424
+ setMetaToComponent(model);
425
425
  return usePhecda().init(model);
426
426
  }
427
427
  __name(useR, "useR");
@@ -430,7 +430,7 @@ function getR(model, phecda) {
430
430
  }
431
431
  __name(getR, "getR");
432
432
  function useV(model) {
433
- setStateToComponent(model);
433
+ setMetaToComponent(model);
434
434
  const instance = usePhecda().init(model);
435
435
  if (cacheMap.has(instance)) return cacheMap.get(instance);
436
436
  const cache = {};
@@ -478,7 +478,7 @@ function getV(model, phecda) {
478
478
  __name(getV, "getV");
479
479
 
480
480
  // src/decorator.ts
481
- import { set, setHandler, setStateKey } from "phecda-web";
481
+ import { set, setMeta } from "phecda-web";
482
482
  import { watchEffect } from "vue";
483
483
  function Shallow(model) {
484
484
  set(model.prototype, "shallow", true);
@@ -486,9 +486,8 @@ function Shallow(model) {
486
486
  __name(Shallow, "Shallow");
487
487
  function WatchEffect(option) {
488
488
  return (proto, key) => {
489
- setStateKey(proto, key);
490
489
  let stopHandler;
491
- setHandler(proto, key, {
490
+ setMeta(proto, key, void 0, {
492
491
  init(instance) {
493
492
  if (typeof instance[key] !== "function") throw new Error("WatchEffect must decorate function");
494
493
  stopHandler = watchEffect(instance[key].bind(instance), option);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "4.0.8",
3
+ "version": "5.0.0",
4
4
  "description": "provide phecda function to vue",
5
5
  "author": "fgsreally",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@vue/devtools-api": "^6.6.3",
20
20
  "vue": "^3.2.45",
21
- "phecda-web": "2.0.8"
21
+ "phecda-web": "3.0.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@vue/test-utils": "^2.4.6",