phecda-vue 1.2.5 → 1.2.7

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
@@ -27,15 +27,10 @@ declare const emitter: PhecdaEmitter;
27
27
  declare const phecdaSymbol: unique symbol;
28
28
  declare function createPhecda(symbol?: string): vue.Raw<{
29
29
  install(app: App): void;
30
- useVMap: WeakMap<object, any>;
31
- useOMap: WeakMap<object, any>;
32
- useRMap: WeakMap<object, any>;
33
- fnMap: WeakMap<object, any>;
34
- computedMap: WeakMap<object, any>;
35
30
  }>;
36
31
  interface PhecdaInstance {
37
32
  useVMap: WeakMap<any, any>;
38
- useOMap: WeakMap<any, any>;
33
+ useOMap: Map<any, any>;
39
34
  useRMap: WeakMap<any, any>;
40
35
  fnMap: WeakMap<any, any>;
41
36
  computedMap: WeakMap<any, any>;
package/dist/index.js CHANGED
@@ -80,7 +80,8 @@ function createPhecda(symbol) {
80
80
  instance: phecda,
81
81
  snapshot: () => {
82
82
  const ret = [];
83
- for (const [key, value] of phecda.useOMap)
83
+ const { useOMap } = getActivePhecda();
84
+ for (const [key, value] of useOMap)
84
85
  ret.push({
85
86
  key: (0, import_phecda_core.getTag)(key) || key.name,
86
87
  value
@@ -118,19 +119,14 @@ function createPhecda(symbol) {
118
119
  delete window.__PHECDA_VUE__[symbol];
119
120
  originUnmount();
120
121
  };
121
- },
122
- useVMap: /* @__PURE__ */ new WeakMap(),
123
- useOMap: new (symbol ? Map : WeakMap)(),
124
- useRMap: /* @__PURE__ */ new WeakMap(),
125
- fnMap: /* @__PURE__ */ new WeakMap(),
126
- computedMap: /* @__PURE__ */ new WeakMap()
122
+ }
127
123
  });
128
124
  return phecda;
129
125
  }
130
126
  __name(createPhecda, "createPhecda");
131
127
  var activePhecda = {
132
128
  useVMap: /* @__PURE__ */ new WeakMap(),
133
- useOMap: /* @__PURE__ */ new WeakMap(),
129
+ useOMap: /* @__PURE__ */ new Map(),
134
130
  useRMap: /* @__PURE__ */ new WeakMap(),
135
131
  fnMap: /* @__PURE__ */ new WeakMap(),
136
132
  computedMap: /* @__PURE__ */ new WeakMap()
@@ -223,11 +219,6 @@ __name(createSharedReactive, "createSharedReactive");
223
219
 
224
220
  // src/vue/composable.ts
225
221
  function useO(Model) {
226
- if ((0, import_vue3.getCurrentInstance)()) {
227
- const cur = (0, import_vue3.inject)(phecdaSymbol, null);
228
- if (cur)
229
- setActivePhecda(cur);
230
- }
231
222
  const { useOMap } = getActivePhecda();
232
223
  if (!useOMap.has(Model)) {
233
224
  const instance = (0, import_vue3.reactive)(new Model());
@@ -356,7 +347,7 @@ function createFilter(initState = {}, option = {}) {
356
347
  let store = {};
357
348
  function traverse(obj, path) {
358
349
  for (const i in obj) {
359
- if (Array.isArray(obj[i]) || resolveOption.exclude.includes(i))
350
+ if (resolveOption.exclude.includes(i))
360
351
  continue;
361
352
  const errorPath = path ? `${path}.${i}` : i;
362
353
  if (typeof obj[i] === "object" && obj[i])
package/dist/index.mjs CHANGED
@@ -21,7 +21,8 @@ function createPhecda(symbol) {
21
21
  instance: phecda,
22
22
  snapshot: () => {
23
23
  const ret = [];
24
- for (const [key, value] of phecda.useOMap)
24
+ const { useOMap } = getActivePhecda();
25
+ for (const [key, value] of useOMap)
25
26
  ret.push({
26
27
  key: getTag(key) || key.name,
27
28
  value
@@ -59,19 +60,14 @@ function createPhecda(symbol) {
59
60
  delete window.__PHECDA_VUE__[symbol];
60
61
  originUnmount();
61
62
  };
62
- },
63
- useVMap: /* @__PURE__ */ new WeakMap(),
64
- useOMap: new (symbol ? Map : WeakMap)(),
65
- useRMap: /* @__PURE__ */ new WeakMap(),
66
- fnMap: /* @__PURE__ */ new WeakMap(),
67
- computedMap: /* @__PURE__ */ new WeakMap()
63
+ }
68
64
  });
69
65
  return phecda;
70
66
  }
71
67
  __name(createPhecda, "createPhecda");
72
68
  var activePhecda = {
73
69
  useVMap: /* @__PURE__ */ new WeakMap(),
74
- useOMap: /* @__PURE__ */ new WeakMap(),
70
+ useOMap: /* @__PURE__ */ new Map(),
75
71
  useRMap: /* @__PURE__ */ new WeakMap(),
76
72
  fnMap: /* @__PURE__ */ new WeakMap(),
77
73
  computedMap: /* @__PURE__ */ new WeakMap()
@@ -96,7 +92,7 @@ function getReactiveMap(symbol) {
96
92
  __name(getReactiveMap, "getReactiveMap");
97
93
 
98
94
  // src/vue/composable.ts
99
- import { computed, getCurrentInstance, inject, onBeforeUnmount, reactive } from "vue";
95
+ import { computed, onBeforeUnmount, reactive } from "vue";
100
96
  import { getHandler, register } from "phecda-core";
101
97
 
102
98
  // src/vue/utils.ts
@@ -164,11 +160,6 @@ __name(createSharedReactive, "createSharedReactive");
164
160
 
165
161
  // src/vue/composable.ts
166
162
  function useO(Model) {
167
- if (getCurrentInstance()) {
168
- const cur = inject(phecdaSymbol, null);
169
- if (cur)
170
- setActivePhecda(cur);
171
- }
172
163
  const { useOMap } = getActivePhecda();
173
164
  if (!useOMap.has(Model)) {
174
165
  const instance = reactive(new Model());
@@ -297,7 +288,7 @@ function createFilter(initState = {}, option = {}) {
297
288
  let store = {};
298
289
  function traverse(obj, path) {
299
290
  for (const i in obj) {
300
- if (Array.isArray(obj[i]) || resolveOption.exclude.includes(i))
291
+ if (resolveOption.exclude.includes(i))
301
292
  continue;
302
293
  const errorPath = path ? `${path}.${i}` : i;
303
294
  if (typeof obj[i] === "object" && obj[i])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",