phecda-vue 2.1.3-alpha.4 → 2.1.3-alpha.5

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
@@ -1,7 +1,7 @@
1
1
  import { Events, Construct } from 'phecda-core';
2
2
  export * from 'phecda-core';
3
- import * as vue from 'vue';
4
3
  import { Ref, App, UnwrapNestedRefs } from 'vue';
4
+ import * as _vue_reactivity from '@vue/reactivity';
5
5
  import { Handler } from 'mitt';
6
6
 
7
7
  type ReplaceInstanceValues<I> = {
@@ -27,7 +27,7 @@ declare const emitter: PhecdaEmitter;
27
27
 
28
28
  declare const phecdaSymbol: unique symbol;
29
29
  declare const interval: any;
30
- declare function createPhecda(symbol?: string): vue.Raw<{
30
+ declare function createPhecda(symbol?: string): _vue_reactivity.Raw<{
31
31
  install(app: App): void;
32
32
  }>;
33
33
  declare function setActivePhecda(phecda: PhecdaInstance): void;
@@ -47,6 +47,8 @@ declare function useEvent<Key extends keyof Events>(eventName: Key, cb: Handler<
47
47
  declare function initialize<M extends Construct>(module: M, deleteOtherProperty?: boolean): InstanceType<M> | void;
48
48
  declare function waitUntilInit(...modules: Construct[]): Promise<void>;
49
49
 
50
+ declare function Isolate(): (target: any) => void;
51
+
50
52
  declare const RE: RegExp;
51
53
  declare function createFilter<Data extends Record<string, any>>(initState?: Object, option?: {
52
54
  RE?: RegExp;
@@ -55,7 +57,7 @@ declare function createFilter<Data extends Record<string, any>>(initState?: Obje
55
57
  errorHandler?: (error?: Error, errorPath?: string) => any;
56
58
  }): {
57
59
  filter: <Schema>(obj: Schema) => SchemaToObj<Schema>;
58
- data: [Data] extends [vue.Ref<any>] ? Data : vue.Ref<vue.UnwrapRef<Data>>;
60
+ data: [Data] extends [_vue_reactivity.Ref<any>] ? Data : _vue_reactivity.Ref<_vue_reactivity.UnwrapRef<Data>>;
59
61
  init: (params?: Data) => void;
60
62
  setState: <Key extends string>(key: Key, value: Data[Key]) => void;
61
63
  storeState: (key: string, params?: Data) => void;
@@ -76,4 +78,4 @@ declare class PV {
76
78
  off<Key extends keyof Events>(type: Key, handler?: (arg: Events[Key]) => void): void;
77
79
  }
78
80
 
79
- export { PV, PhecdaEmitter, PhecdaInstance, RE, ReplaceInstanceValues, SchemaToObj, createFilter, createPhecda, emitter, getActivePhecda, getReactiveMap, initialize, interval, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useRaw, useV, waitUntilInit };
81
+ export { Isolate, PV, PhecdaEmitter, PhecdaInstance, RE, ReplaceInstanceValues, SchemaToObj, createFilter, createPhecda, emitter, getActivePhecda, getReactiveMap, initialize, interval, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useRaw, useV, waitUntilInit };
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
28
28
  // src/index.ts
29
29
  var src_exports = {};
30
30
  __export(src_exports, {
31
+ Isolate: () => Isolate,
31
32
  PV: () => PV,
32
33
  RE: () => RE,
33
34
  createFilter: () => createFilter,
@@ -234,11 +235,16 @@ __name(createSharedReactive, "createSharedReactive");
234
235
  // src/vue/composable.ts
235
236
  function useO(module2) {
236
237
  const { useOMap } = getActivePhecda();
238
+ if (module2.prototype.__ISOLATE__) {
239
+ const instance = (0, import_vue3.reactive)(new module2());
240
+ instance._promise = (0, import_phecda_core2.registerAsync)(instance);
241
+ return instance;
242
+ }
237
243
  const tag = (0, import_phecda_core2.getTag)(module2) || module2.name;
238
244
  if (!useOMap.has(tag)) {
239
245
  const instance = (0, import_vue3.reactive)(new module2());
240
- useOMap.set(tag, instance);
241
246
  instance._promise = (0, import_phecda_core2.registerAsync)(instance);
247
+ useOMap.set(tag, instance);
242
248
  }
243
249
  return useOMap.get(tag);
244
250
  }
@@ -339,6 +345,14 @@ async function waitUntilInit(...modules) {
339
345
  }
340
346
  __name(waitUntilInit, "waitUntilInit");
341
347
 
348
+ // src/vue/decorator.ts
349
+ function Isolate() {
350
+ return (target) => {
351
+ target.prototype.__ISOLATE__ = true;
352
+ };
353
+ }
354
+ __name(Isolate, "Isolate");
355
+
342
356
  // src/filter.ts
343
357
  var import_vue4 = require("vue");
344
358
  var RE = /{{(.*)}}/;
@@ -457,6 +471,7 @@ var PV = class {
457
471
  __name(PV, "PV");
458
472
  // Annotate the CommonJS export names for ESM import in node:
459
473
  0 && (module.exports = {
474
+ Isolate,
460
475
  PV,
461
476
  RE,
462
477
  createFilter,
package/dist/index.mjs CHANGED
@@ -186,11 +186,16 @@ __name(createSharedReactive, "createSharedReactive");
186
186
  // src/vue/composable.ts
187
187
  function useO(module) {
188
188
  const { useOMap } = getActivePhecda();
189
+ if (module.prototype.__ISOLATE__) {
190
+ const instance = reactive(new module());
191
+ instance._promise = registerAsync(instance);
192
+ return instance;
193
+ }
189
194
  const tag = getTag2(module) || module.name;
190
195
  if (!useOMap.has(tag)) {
191
196
  const instance = reactive(new module());
192
- useOMap.set(tag, instance);
193
197
  instance._promise = registerAsync(instance);
198
+ useOMap.set(tag, instance);
194
199
  }
195
200
  return useOMap.get(tag);
196
201
  }
@@ -291,6 +296,14 @@ async function waitUntilInit(...modules) {
291
296
  }
292
297
  __name(waitUntilInit, "waitUntilInit");
293
298
 
299
+ // src/vue/decorator.ts
300
+ function Isolate() {
301
+ return (target) => {
302
+ target.prototype.__ISOLATE__ = true;
303
+ };
304
+ }
305
+ __name(Isolate, "Isolate");
306
+
294
307
  // src/filter.ts
295
308
  import { effectScope as effectScope2, ref } from "vue";
296
309
  var RE = /{{(.*)}}/;
@@ -408,6 +421,7 @@ var PV = class {
408
421
  };
409
422
  __name(PV, "PV");
410
423
  export {
424
+ Isolate,
411
425
  PV,
412
426
  RE,
413
427
  createFilter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "2.1.3-alpha.4",
3
+ "version": "2.1.3-alpha.5",
4
4
  "description": "provide store/form/table with phecda function to vue",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",