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

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,4 +1,4 @@
1
- import { Events } from 'phecda-core';
1
+ import { Events, Construct } from 'phecda-core';
2
2
  export * from 'phecda-core';
3
3
  import * as vue from 'vue';
4
4
  import { Ref, App, UnwrapNestedRefs } from 'vue';
@@ -38,13 +38,14 @@ type DeepPartial<T> = {
38
38
  [K in keyof T]?: DeepPartial<T[K]>;
39
39
  };
40
40
 
41
- declare function useO<T extends new (...args: any) => any>(module: T): UnwrapNestedRefs<InstanceType<T>>;
42
- declare function useRaw<T extends new (...args: any) => any>(module: T): InstanceType<T>;
43
- declare function usePatch<T extends new (...args: any) => any>(module: T, Data: DeepPartial<InstanceType<T>>): void;
44
- declare function useR<T extends new (...args: any) => any>(module: T): UnwrapNestedRefs<InstanceType<T>>;
45
- declare function useV<T extends new (...args: any) => any>(module: T): ReplaceInstanceValues<InstanceType<T>>;
41
+ declare function useO<T extends Construct>(module: T): UnwrapNestedRefs<InstanceType<T>>;
42
+ declare function useRaw<T extends Construct>(module: T): InstanceType<T>;
43
+ declare function usePatch<T extends Construct>(module: T, Data: DeepPartial<InstanceType<T>>): void;
44
+ declare function useR<T extends Construct>(module: T): UnwrapNestedRefs<InstanceType<T>>;
45
+ declare function useV<T extends Construct>(module: T): ReplaceInstanceValues<InstanceType<T>>;
46
46
  declare function useEvent<Key extends keyof Events>(eventName: Key, cb: Handler<Events[Key]>): () => void;
47
- declare function initialize<M extends new (...args: any) => any>(module: M, deleteOtherProperty?: boolean): InstanceType<M> | void;
47
+ declare function initialize<M extends Construct>(module: M, deleteOtherProperty?: boolean): InstanceType<M> | void;
48
+ declare function waitUntilInit(...modules: Construct[]): Promise<void>;
48
49
 
49
50
  declare const RE: RegExp;
50
51
  declare function createFilter<Data extends Record<string, any>>(initState?: Object, option?: {
@@ -75,4 +76,4 @@ declare class PV {
75
76
  off<Key extends keyof Events>(type: Key, handler?: (arg: Events[Key]) => void): void;
76
77
  }
77
78
 
78
- export { PV, PhecdaEmitter, PhecdaInstance, RE, ReplaceInstanceValues, SchemaToObj, createFilter, createPhecda, emitter, getActivePhecda, getReactiveMap, initialize, interval, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useRaw, useV };
79
+ export { 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
@@ -44,7 +44,8 @@ __export(src_exports, {
44
44
  usePatch: () => usePatch,
45
45
  useR: () => useR,
46
46
  useRaw: () => useRaw,
47
- useV: () => useV
47
+ useV: () => useV,
48
+ waitUntilInit: () => waitUntilInit
48
49
  });
49
50
  module.exports = __toCommonJS(src_exports);
50
51
 
@@ -237,7 +238,7 @@ function useO(module2) {
237
238
  if (!useOMap.has(tag)) {
238
239
  const instance = (0, import_vue3.reactive)(new module2());
239
240
  useOMap.set(tag, instance);
240
- (0, import_phecda_core2.register)(instance);
241
+ instance._promise = (0, import_phecda_core2.registerAsync)(instance);
241
242
  }
242
243
  return useOMap.get(tag);
243
244
  }
@@ -333,6 +334,10 @@ function initialize(module2, deleteOtherProperty = true) {
333
334
  }
334
335
  }
335
336
  __name(initialize, "initialize");
337
+ async function waitUntilInit(...modules) {
338
+ await Promise.all(modules.map((m) => useO(m)._promise));
339
+ }
340
+ __name(waitUntilInit, "waitUntilInit");
336
341
 
337
342
  // src/filter.ts
338
343
  var import_vue4 = require("vue");
@@ -468,5 +473,6 @@ __name(PV, "PV");
468
473
  usePatch,
469
474
  useR,
470
475
  useRaw,
471
- useV
476
+ useV,
477
+ waitUntilInit
472
478
  });
package/dist/index.mjs CHANGED
@@ -118,7 +118,7 @@ __name(getReactiveMap, "getReactiveMap");
118
118
 
119
119
  // src/vue/composable.ts
120
120
  import { onBeforeUnmount, reactive, toRaw, toRef } from "vue";
121
- import { getHandler, getTag as getTag2, register } from "phecda-core";
121
+ import { getHandler, getTag as getTag2, registerAsync } from "phecda-core";
122
122
 
123
123
  // src/vue/utils.ts
124
124
  import { effectScope, isReactive, isRef, onScopeDispose } from "vue";
@@ -190,7 +190,7 @@ function useO(module) {
190
190
  if (!useOMap.has(tag)) {
191
191
  const instance = reactive(new module());
192
192
  useOMap.set(tag, instance);
193
- register(instance);
193
+ instance._promise = registerAsync(instance);
194
194
  }
195
195
  return useOMap.get(tag);
196
196
  }
@@ -286,6 +286,10 @@ function initialize(module, deleteOtherProperty = true) {
286
286
  }
287
287
  }
288
288
  __name(initialize, "initialize");
289
+ async function waitUntilInit(...modules) {
290
+ await Promise.all(modules.map((m) => useO(m)._promise));
291
+ }
292
+ __name(waitUntilInit, "waitUntilInit");
289
293
 
290
294
  // src/filter.ts
291
295
  import { effectScope as effectScope2, ref } from "vue";
@@ -420,5 +424,6 @@ export {
420
424
  usePatch,
421
425
  useR,
422
426
  useRaw,
423
- useV
427
+ useV,
428
+ waitUntilInit
424
429
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "2.1.3-alpha.3",
3
+ "version": "2.1.3-alpha.4",
4
4
  "description": "provide store/form/table with phecda function to vue",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -14,7 +14,7 @@
14
14
  "dependencies": {
15
15
  "mitt": "^3.0.0",
16
16
  "vue": "^3.2.45",
17
- "phecda-core": "3.0.0-alpha.1"
17
+ "phecda-core": "3.0.0-alpha.2"
18
18
  },
19
19
  "devDependencies": {
20
20
  "tsup": "^6.5.0"