phecda-vue 4.0.0 → 4.0.1
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/README.md +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -9
- package/dist/index.mjs +10 -12
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare function useEvent<Key extends keyof Events>(eventName: Key, cb: (event:
|
|
|
28
28
|
declare function useR<T extends Construct>(model: T, phecda?: VuePhecda): UnwrapNestedRefs<InstanceType<T>>;
|
|
29
29
|
declare function useV<T extends Construct>(model: T, phecda?: VuePhecda): ReplaceInstanceValues<InstanceType<T>>;
|
|
30
30
|
|
|
31
|
-
declare function Shallow(model: any)
|
|
31
|
+
declare function Shallow(isShallow?: boolean): (model: any) => void;
|
|
32
32
|
declare function WatchEffect(option?: WatchOptions): (proto: any, key: string) => void;
|
|
33
33
|
|
|
34
34
|
declare function markRaw<T extends object>(value: T): Raw<T>;
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ __reExport(src_exports, require("phecda-web"), module.exports);
|
|
|
41
41
|
// src/core.ts
|
|
42
42
|
var import_vue = require("vue");
|
|
43
43
|
var import_phecda_web = require("phecda-web");
|
|
44
|
-
var phecdaSymbol = Symbol("phecda-vue");
|
|
44
|
+
var phecdaSymbol = Symbol(process.env.NODE_ENV === "development" ? "phecda-vue" : void 0);
|
|
45
45
|
var VuePhecda = class extends import_phecda_web.WebPhecda {
|
|
46
46
|
install(app) {
|
|
47
47
|
app.provide(phecdaSymbol, this);
|
|
@@ -50,7 +50,7 @@ var VuePhecda = class extends import_phecda_web.WebPhecda {
|
|
|
50
50
|
__name(VuePhecda, "VuePhecda");
|
|
51
51
|
function createPhecda() {
|
|
52
52
|
return new VuePhecda((instance) => {
|
|
53
|
-
return (0, import_phecda_web.get)(instance, "shallow") ? (0, import_vue.shallowReactive)(instance) : (0, import_vue.reactive)(instance);
|
|
53
|
+
return (0, import_phecda_web.bindMethod)((0, import_phecda_web.get)(instance, "shallow") ? (0, import_vue.shallowReactive)(instance) : (0, import_vue.reactive)(instance));
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
__name(createPhecda, "createPhecda");
|
|
@@ -127,11 +127,7 @@ function useV(model, phecda) {
|
|
|
127
127
|
const proxy = new Proxy(instance, {
|
|
128
128
|
get(target, key) {
|
|
129
129
|
if (typeof target[key] === "function") {
|
|
130
|
-
|
|
131
|
-
return target[key];
|
|
132
|
-
if (!cache[key])
|
|
133
|
-
cache[key] = target[key].bind(target);
|
|
134
|
-
return cache[key];
|
|
130
|
+
return target[key];
|
|
135
131
|
}
|
|
136
132
|
if (target[key]?.__v_skip)
|
|
137
133
|
return target[key];
|
|
@@ -155,8 +151,10 @@ __name(useV, "useV");
|
|
|
155
151
|
// src/decorator.ts
|
|
156
152
|
var import_phecda_web3 = require("phecda-web");
|
|
157
153
|
var import_vue4 = require("vue");
|
|
158
|
-
function Shallow(
|
|
159
|
-
|
|
154
|
+
function Shallow(isShallow = true) {
|
|
155
|
+
return (model) => {
|
|
156
|
+
(0, import_phecda_web3.set)(model.prototype, "shallow", isShallow);
|
|
157
|
+
};
|
|
160
158
|
}
|
|
161
159
|
__name(Shallow, "Shallow");
|
|
162
160
|
function WatchEffect(option) {
|
package/dist/index.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export * from "phecda-web";
|
|
|
6
6
|
|
|
7
7
|
// src/core.ts
|
|
8
8
|
import { reactive, shallowReactive } from "vue";
|
|
9
|
-
import { WebPhecda, get } from "phecda-web";
|
|
10
|
-
var phecdaSymbol = Symbol("phecda-vue");
|
|
9
|
+
import { WebPhecda, bindMethod, get } from "phecda-web";
|
|
10
|
+
var phecdaSymbol = Symbol(process.env.NODE_ENV === "development" ? "phecda-vue" : void 0);
|
|
11
11
|
var VuePhecda = class extends WebPhecda {
|
|
12
12
|
install(app) {
|
|
13
13
|
app.provide(phecdaSymbol, this);
|
|
@@ -16,13 +16,13 @@ var VuePhecda = class extends WebPhecda {
|
|
|
16
16
|
__name(VuePhecda, "VuePhecda");
|
|
17
17
|
function createPhecda() {
|
|
18
18
|
return new VuePhecda((instance) => {
|
|
19
|
-
return get(instance, "shallow") ? shallowReactive(instance) : reactive(instance);
|
|
19
|
+
return bindMethod(get(instance, "shallow") ? shallowReactive(instance) : reactive(instance));
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
__name(createPhecda, "createPhecda");
|
|
23
23
|
|
|
24
24
|
// src/composable.ts
|
|
25
|
-
import { bindMethod, emitter } from "phecda-web";
|
|
25
|
+
import { bindMethod as bindMethod2, emitter } from "phecda-web";
|
|
26
26
|
import { hasInjectionContext, inject, onBeforeUnmount, toRaw, toRef } from "vue";
|
|
27
27
|
|
|
28
28
|
// src/utils.ts
|
|
@@ -66,7 +66,7 @@ function usePhecda(phecda) {
|
|
|
66
66
|
if (!activePhecda)
|
|
67
67
|
throw new Error("[phecda-vue]: must install the vue plugin (if used in setup) or manually inject the phecda instance ");
|
|
68
68
|
if (!cacheMap.has(activePhecda))
|
|
69
|
-
cacheMap.set(activePhecda,
|
|
69
|
+
cacheMap.set(activePhecda, bindMethod2(activePhecda));
|
|
70
70
|
return cacheMap.get(activePhecda);
|
|
71
71
|
}
|
|
72
72
|
__name(usePhecda, "usePhecda");
|
|
@@ -93,11 +93,7 @@ function useV(model, phecda) {
|
|
|
93
93
|
const proxy = new Proxy(instance, {
|
|
94
94
|
get(target, key) {
|
|
95
95
|
if (typeof target[key] === "function") {
|
|
96
|
-
|
|
97
|
-
return target[key];
|
|
98
|
-
if (!cache[key])
|
|
99
|
-
cache[key] = target[key].bind(target);
|
|
100
|
-
return cache[key];
|
|
96
|
+
return target[key];
|
|
101
97
|
}
|
|
102
98
|
if (target[key]?.__v_skip)
|
|
103
99
|
return target[key];
|
|
@@ -121,8 +117,10 @@ __name(useV, "useV");
|
|
|
121
117
|
// src/decorator.ts
|
|
122
118
|
import { set, setHandler, setStateKey } from "phecda-web";
|
|
123
119
|
import { watchEffect } from "vue";
|
|
124
|
-
function Shallow(
|
|
125
|
-
|
|
120
|
+
function Shallow(isShallow = true) {
|
|
121
|
+
return (model) => {
|
|
122
|
+
set(model.prototype, "shallow", isShallow);
|
|
123
|
+
};
|
|
126
124
|
}
|
|
127
125
|
__name(Shallow, "Shallow");
|
|
128
126
|
function WatchEffect(option) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-vue",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "provide phecda function to vue",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"vue": "^3.2.45",
|
|
20
|
-
"phecda-web": "2.0.
|
|
20
|
+
"phecda-web": "2.0.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@vue/test-utils": "^2.4.6",
|