phecda-vue 2.1.3-alpha.3 → 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 +14 -11
- package/dist/index.js +24 -3
- package/dist/index.mjs +22 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Events } from 'phecda-core';
|
|
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):
|
|
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;
|
|
@@ -38,13 +38,16 @@ type DeepPartial<T> = {
|
|
|
38
38
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
declare function useO<T extends
|
|
42
|
-
declare function useRaw<T extends
|
|
43
|
-
declare function usePatch<T extends
|
|
44
|
-
declare function useR<T extends
|
|
45
|
-
declare function useV<T extends
|
|
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
|
|
47
|
+
declare function initialize<M extends Construct>(module: M, deleteOtherProperty?: boolean): InstanceType<M> | void;
|
|
48
|
+
declare function waitUntilInit(...modules: Construct[]): Promise<void>;
|
|
49
|
+
|
|
50
|
+
declare function Isolate(): (target: any) => void;
|
|
48
51
|
|
|
49
52
|
declare const RE: RegExp;
|
|
50
53
|
declare function createFilter<Data extends Record<string, any>>(initState?: Object, option?: {
|
|
@@ -54,7 +57,7 @@ declare function createFilter<Data extends Record<string, any>>(initState?: Obje
|
|
|
54
57
|
errorHandler?: (error?: Error, errorPath?: string) => any;
|
|
55
58
|
}): {
|
|
56
59
|
filter: <Schema>(obj: Schema) => SchemaToObj<Schema>;
|
|
57
|
-
data: [Data] extends [
|
|
60
|
+
data: [Data] extends [_vue_reactivity.Ref<any>] ? Data : _vue_reactivity.Ref<_vue_reactivity.UnwrapRef<Data>>;
|
|
58
61
|
init: (params?: Data) => void;
|
|
59
62
|
setState: <Key extends string>(key: Key, value: Data[Key]) => void;
|
|
60
63
|
storeState: (key: string, params?: Data) => void;
|
|
@@ -75,4 +78,4 @@ declare class PV {
|
|
|
75
78
|
off<Key extends keyof Events>(type: Key, handler?: (arg: Events[Key]) => void): void;
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
export { PV, PhecdaEmitter, PhecdaInstance, RE, ReplaceInstanceValues, SchemaToObj, createFilter, createPhecda, emitter, getActivePhecda, getReactiveMap, initialize, interval, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useRaw, useV };
|
|
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,
|
|
@@ -44,7 +45,8 @@ __export(src_exports, {
|
|
|
44
45
|
usePatch: () => usePatch,
|
|
45
46
|
useR: () => useR,
|
|
46
47
|
useRaw: () => useRaw,
|
|
47
|
-
useV: () => useV
|
|
48
|
+
useV: () => useV,
|
|
49
|
+
waitUntilInit: () => waitUntilInit
|
|
48
50
|
});
|
|
49
51
|
module.exports = __toCommonJS(src_exports);
|
|
50
52
|
|
|
@@ -233,11 +235,16 @@ __name(createSharedReactive, "createSharedReactive");
|
|
|
233
235
|
// src/vue/composable.ts
|
|
234
236
|
function useO(module2) {
|
|
235
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
|
+
}
|
|
236
243
|
const tag = (0, import_phecda_core2.getTag)(module2) || module2.name;
|
|
237
244
|
if (!useOMap.has(tag)) {
|
|
238
245
|
const instance = (0, import_vue3.reactive)(new module2());
|
|
246
|
+
instance._promise = (0, import_phecda_core2.registerAsync)(instance);
|
|
239
247
|
useOMap.set(tag, instance);
|
|
240
|
-
(0, import_phecda_core2.register)(instance);
|
|
241
248
|
}
|
|
242
249
|
return useOMap.get(tag);
|
|
243
250
|
}
|
|
@@ -333,6 +340,18 @@ function initialize(module2, deleteOtherProperty = true) {
|
|
|
333
340
|
}
|
|
334
341
|
}
|
|
335
342
|
__name(initialize, "initialize");
|
|
343
|
+
async function waitUntilInit(...modules) {
|
|
344
|
+
await Promise.all(modules.map((m) => useO(m)._promise));
|
|
345
|
+
}
|
|
346
|
+
__name(waitUntilInit, "waitUntilInit");
|
|
347
|
+
|
|
348
|
+
// src/vue/decorator.ts
|
|
349
|
+
function Isolate() {
|
|
350
|
+
return (target) => {
|
|
351
|
+
target.prototype.__ISOLATE__ = true;
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
__name(Isolate, "Isolate");
|
|
336
355
|
|
|
337
356
|
// src/filter.ts
|
|
338
357
|
var import_vue4 = require("vue");
|
|
@@ -452,6 +471,7 @@ var PV = class {
|
|
|
452
471
|
__name(PV, "PV");
|
|
453
472
|
// Annotate the CommonJS export names for ESM import in node:
|
|
454
473
|
0 && (module.exports = {
|
|
474
|
+
Isolate,
|
|
455
475
|
PV,
|
|
456
476
|
RE,
|
|
457
477
|
createFilter,
|
|
@@ -468,5 +488,6 @@ __name(PV, "PV");
|
|
|
468
488
|
usePatch,
|
|
469
489
|
useR,
|
|
470
490
|
useRaw,
|
|
471
|
-
useV
|
|
491
|
+
useV,
|
|
492
|
+
waitUntilInit
|
|
472
493
|
});
|
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,
|
|
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";
|
|
@@ -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());
|
|
197
|
+
instance._promise = registerAsync(instance);
|
|
192
198
|
useOMap.set(tag, instance);
|
|
193
|
-
register(instance);
|
|
194
199
|
}
|
|
195
200
|
return useOMap.get(tag);
|
|
196
201
|
}
|
|
@@ -286,6 +291,18 @@ function initialize(module, deleteOtherProperty = true) {
|
|
|
286
291
|
}
|
|
287
292
|
}
|
|
288
293
|
__name(initialize, "initialize");
|
|
294
|
+
async function waitUntilInit(...modules) {
|
|
295
|
+
await Promise.all(modules.map((m) => useO(m)._promise));
|
|
296
|
+
}
|
|
297
|
+
__name(waitUntilInit, "waitUntilInit");
|
|
298
|
+
|
|
299
|
+
// src/vue/decorator.ts
|
|
300
|
+
function Isolate() {
|
|
301
|
+
return (target) => {
|
|
302
|
+
target.prototype.__ISOLATE__ = true;
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
__name(Isolate, "Isolate");
|
|
289
306
|
|
|
290
307
|
// src/filter.ts
|
|
291
308
|
import { effectScope as effectScope2, ref } from "vue";
|
|
@@ -404,6 +421,7 @@ var PV = class {
|
|
|
404
421
|
};
|
|
405
422
|
__name(PV, "PV");
|
|
406
423
|
export {
|
|
424
|
+
Isolate,
|
|
407
425
|
PV,
|
|
408
426
|
RE,
|
|
409
427
|
createFilter,
|
|
@@ -420,5 +438,6 @@ export {
|
|
|
420
438
|
usePatch,
|
|
421
439
|
useR,
|
|
422
440
|
useRaw,
|
|
423
|
-
useV
|
|
441
|
+
useV,
|
|
442
|
+
waitUntilInit
|
|
424
443
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-vue",
|
|
3
|
-
"version": "2.1.3-alpha.
|
|
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",
|
|
@@ -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.
|
|
17
|
+
"phecda-core": "3.0.0-alpha.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsup": "^6.5.0"
|