phecda-vue 3.0.0-alpha.13 → 3.0.0-alpha.15

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
@@ -243,7 +243,6 @@ __name(createSharedReactive, "createSharedReactive");
243
243
 
244
244
  // src/composable.ts
245
245
  var REF_SYMBOL = Symbol("ref");
246
- var REACTIVE_SYMBOL = Symbol("reactive");
247
246
  function useO(module2) {
248
247
  const { state, origin } = (0, import_phecda_web3.getActiveInstance)();
249
248
  const proxyFn = module2.prototype.__SHALLOW__ ? import_vue4.shallowReactive : import_vue4.reactive;
@@ -272,34 +271,7 @@ function usePatch(module2, Data) {
272
271
  }
273
272
  __name(usePatch, "usePatch");
274
273
  function useR(module2) {
275
- const { cache: cacheMap } = (0, import_phecda_web3.getActiveInstance)();
276
- const instance = useO(module2);
277
- const cache = cacheMap.get(instance) || {};
278
- if (cache[REACTIVE_SYMBOL])
279
- return cache[REACTIVE_SYMBOL];
280
- const proxy = new Proxy(instance, {
281
- get(target, key) {
282
- if (typeof target[key] === "function") {
283
- if (cache[key])
284
- return cache[key];
285
- const errorHandler = (0, import_phecda_web3.getHandler)(target, key).find((item) => item.error)?.error;
286
- if (!errorHandler)
287
- return target[key].bind(target);
288
- const wrapper = (0, import_phecda_web3.wrapError)(target, key, errorHandler);
289
- cache[key] = wrapper;
290
- return wrapper;
291
- }
292
- return target[key];
293
- },
294
- set(target, key, v) {
295
- target[key] = v;
296
- return true;
297
- }
298
- });
299
- cache[REACTIVE_SYMBOL] = proxy;
300
- if (!cacheMap.has(instance))
301
- cacheMap.set(instance, cache);
302
- return proxy;
274
+ return useO(module2);
303
275
  }
304
276
  __name(useR, "useR");
305
277
  function useV(module2) {
@@ -311,14 +283,9 @@ function useV(module2) {
311
283
  const proxy = new Proxy(instance, {
312
284
  get(target, key) {
313
285
  if (typeof target[key] === "function") {
314
- if (cache[key])
315
- return cache[key];
316
- const errorHandler = (0, import_phecda_web3.getHandler)(target, key).find((item) => item.error)?.error;
317
- if (!errorHandler)
318
- return target[key].bind(target);
319
- const wrapper = (0, import_phecda_web3.wrapError)(target, key, errorHandler);
320
- cache[key] = wrapper;
321
- return wrapper;
286
+ if (!cache[key])
287
+ cache[key] = target[key].bind(this);
288
+ return cache[key];
322
289
  }
323
290
  if (target[key]?.__v_skip)
324
291
  return target[key];
package/dist/index.mjs CHANGED
@@ -149,7 +149,7 @@ __name(createPhecda, "createPhecda");
149
149
 
150
150
  // src/composable.ts
151
151
  import { onBeforeUnmount, reactive, shallowReactive, toRaw, toRef } from "vue";
152
- import { emitter as emitter2, getActiveInstance as getActiveInstance2, getHandler, getTag, invokeHandler as invokeHandler2, wrapError } from "phecda-web";
152
+ import { emitter as emitter2, getActiveInstance as getActiveInstance2, getTag, invokeHandler as invokeHandler2 } from "phecda-web";
153
153
 
154
154
  // src/utils.ts
155
155
  import { effectScope as effectScope2, isReactive, isRef, onScopeDispose, markRaw as raw } from "vue";
@@ -202,7 +202,6 @@ __name(createSharedReactive, "createSharedReactive");
202
202
 
203
203
  // src/composable.ts
204
204
  var REF_SYMBOL = Symbol("ref");
205
- var REACTIVE_SYMBOL = Symbol("reactive");
206
205
  function useO(module) {
207
206
  const { state, origin } = getActiveInstance2();
208
207
  const proxyFn = module.prototype.__SHALLOW__ ? shallowReactive : reactive;
@@ -231,34 +230,7 @@ function usePatch(module, Data) {
231
230
  }
232
231
  __name(usePatch, "usePatch");
233
232
  function useR(module) {
234
- const { cache: cacheMap } = getActiveInstance2();
235
- const instance = useO(module);
236
- const cache = cacheMap.get(instance) || {};
237
- if (cache[REACTIVE_SYMBOL])
238
- return cache[REACTIVE_SYMBOL];
239
- const proxy = new Proxy(instance, {
240
- get(target, key) {
241
- if (typeof target[key] === "function") {
242
- if (cache[key])
243
- return cache[key];
244
- const errorHandler = getHandler(target, key).find((item) => item.error)?.error;
245
- if (!errorHandler)
246
- return target[key].bind(target);
247
- const wrapper = wrapError(target, key, errorHandler);
248
- cache[key] = wrapper;
249
- return wrapper;
250
- }
251
- return target[key];
252
- },
253
- set(target, key, v) {
254
- target[key] = v;
255
- return true;
256
- }
257
- });
258
- cache[REACTIVE_SYMBOL] = proxy;
259
- if (!cacheMap.has(instance))
260
- cacheMap.set(instance, cache);
261
- return proxy;
233
+ return useO(module);
262
234
  }
263
235
  __name(useR, "useR");
264
236
  function useV(module) {
@@ -270,14 +242,9 @@ function useV(module) {
270
242
  const proxy = new Proxy(instance, {
271
243
  get(target, key) {
272
244
  if (typeof target[key] === "function") {
273
- if (cache[key])
274
- return cache[key];
275
- const errorHandler = getHandler(target, key).find((item) => item.error)?.error;
276
- if (!errorHandler)
277
- return target[key].bind(target);
278
- const wrapper = wrapError(target, key, errorHandler);
279
- cache[key] = wrapper;
280
- return wrapper;
245
+ if (!cache[key])
246
+ cache[key] = target[key].bind(this);
247
+ return cache[key];
281
248
  }
282
249
  if (target[key]?.__v_skip)
283
250
  return target[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "3.0.0-alpha.13",
3
+ "version": "3.0.0-alpha.15",
4
4
  "description": "provide phecda function to vue",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -13,7 +13,7 @@
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
15
  "vue": "^3.2.45",
16
- "phecda-web": "1.0.1-alpha.7"
16
+ "phecda-web": "1.0.1-alpha.9"
17
17
  },
18
18
  "devDependencies": {
19
19
  "tsup": "^6.5.0"