phecda-core 4.0.0 → 4.1.0-alpha.0
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.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +25 -2
- package/dist/index.mjs +21 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -88,6 +88,9 @@ declare function invokeInit(instance: any): Promise<PromiseSettledResult<any>[]>
|
|
|
88
88
|
declare function invokeUnmount(instance: any): Promise<PromiseSettledResult<any>[]>;
|
|
89
89
|
declare function If(value: Boolean, ...decorators: (ClassDecorator[]) | (PropertyDecorator[]) | (ParameterDecorator[])): (...args: any[]) => void;
|
|
90
90
|
declare function getMergedMeta(target: any, property?: PropertyKey, index?: number, merger?: (prev: any, cur: any) => any): any;
|
|
91
|
+
declare function wait(...instances: InstanceType<Construct>[]): Promise<any[]>;
|
|
92
|
+
declare function objectToClass<Obj extends Record<string, any>>(obj: Obj): new () => Obj;
|
|
93
|
+
declare function functionToClass<Func extends (...args: any) => object>(fn: Func): new (...args: Parameters<Func>) => ReturnType<Func>;
|
|
91
94
|
|
|
92
95
|
declare const DataMap: InjectData;
|
|
93
96
|
declare function Provide<K extends keyof InjectData>(key: K, value: InjectData[K]): void;
|
|
@@ -110,4 +113,4 @@ declare abstract class Base {
|
|
|
110
113
|
private _unmount;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
export { type AbConstruct, Assign, Base, CLEAR_KEY, type ClassValue, Clear, type Construct, DataMap, Effect, Empty, Err, type Events, Expose, Global, If, Init, Inject, type InjectData, Injectable, Isolate, type NameSpace, PHECDA_KEY, type Phecda, Pipeline, Provide, SHARE_KEY, Storage, type StorageParam, Tag, Unique, Unmount, Watcher, type WatcherParam, activeInstance, addDecoToClass, get, getInject, getMergedMeta, getMeta, getMetaKey, getMetaParams, getOwnMeta, getOwnMetaKey, getOwnMetaParams, getPhecdaFromTarget, getTag, init, invoke, invokeInit, invokeUnmount, isAsyncFunc, isPhecda, set, setInject, setMeta };
|
|
116
|
+
export { type AbConstruct, Assign, Base, CLEAR_KEY, type ClassValue, Clear, type Construct, DataMap, Effect, Empty, Err, type Events, Expose, Global, If, Init, Inject, type InjectData, Injectable, Isolate, type NameSpace, PHECDA_KEY, type Phecda, Pipeline, Provide, SHARE_KEY, Storage, type StorageParam, Tag, Unique, Unmount, Watcher, type WatcherParam, activeInstance, addDecoToClass, functionToClass, get, getInject, getMergedMeta, getMeta, getMetaKey, getMetaParams, getOwnMeta, getOwnMetaKey, getOwnMetaParams, getPhecdaFromTarget, getTag, init, invoke, invokeInit, invokeUnmount, isAsyncFunc, isPhecda, objectToClass, set, setInject, setMeta, wait };
|
package/dist/index.d.ts
CHANGED
|
@@ -88,6 +88,9 @@ declare function invokeInit(instance: any): Promise<PromiseSettledResult<any>[]>
|
|
|
88
88
|
declare function invokeUnmount(instance: any): Promise<PromiseSettledResult<any>[]>;
|
|
89
89
|
declare function If(value: Boolean, ...decorators: (ClassDecorator[]) | (PropertyDecorator[]) | (ParameterDecorator[])): (...args: any[]) => void;
|
|
90
90
|
declare function getMergedMeta(target: any, property?: PropertyKey, index?: number, merger?: (prev: any, cur: any) => any): any;
|
|
91
|
+
declare function wait(...instances: InstanceType<Construct>[]): Promise<any[]>;
|
|
92
|
+
declare function objectToClass<Obj extends Record<string, any>>(obj: Obj): new () => Obj;
|
|
93
|
+
declare function functionToClass<Func extends (...args: any) => object>(fn: Func): new (...args: Parameters<Func>) => ReturnType<Func>;
|
|
91
94
|
|
|
92
95
|
declare const DataMap: InjectData;
|
|
93
96
|
declare function Provide<K extends keyof InjectData>(key: K, value: InjectData[K]): void;
|
|
@@ -110,4 +113,4 @@ declare abstract class Base {
|
|
|
110
113
|
private _unmount;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
export { type AbConstruct, Assign, Base, CLEAR_KEY, type ClassValue, Clear, type Construct, DataMap, Effect, Empty, Err, type Events, Expose, Global, If, Init, Inject, type InjectData, Injectable, Isolate, type NameSpace, PHECDA_KEY, type Phecda, Pipeline, Provide, SHARE_KEY, Storage, type StorageParam, Tag, Unique, Unmount, Watcher, type WatcherParam, activeInstance, addDecoToClass, get, getInject, getMergedMeta, getMeta, getMetaKey, getMetaParams, getOwnMeta, getOwnMetaKey, getOwnMetaParams, getPhecdaFromTarget, getTag, init, invoke, invokeInit, invokeUnmount, isAsyncFunc, isPhecda, set, setInject, setMeta };
|
|
116
|
+
export { type AbConstruct, Assign, Base, CLEAR_KEY, type ClassValue, Clear, type Construct, DataMap, Effect, Empty, Err, type Events, Expose, Global, If, Init, Inject, type InjectData, Injectable, Isolate, type NameSpace, PHECDA_KEY, type Phecda, Pipeline, Provide, SHARE_KEY, Storage, type StorageParam, Tag, Unique, Unmount, Watcher, type WatcherParam, activeInstance, addDecoToClass, functionToClass, get, getInject, getMergedMeta, getMeta, getMetaKey, getMetaParams, getOwnMeta, getOwnMetaKey, getOwnMetaParams, getPhecdaFromTarget, getTag, init, invoke, invokeInit, invokeUnmount, isAsyncFunc, isPhecda, objectToClass, set, setInject, setMeta, wait };
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,7 @@ __export(src_exports, {
|
|
|
54
54
|
Watcher: () => Watcher,
|
|
55
55
|
activeInstance: () => activeInstance,
|
|
56
56
|
addDecoToClass: () => addDecoToClass,
|
|
57
|
+
functionToClass: () => functionToClass,
|
|
57
58
|
get: () => get,
|
|
58
59
|
getInject: () => getInject,
|
|
59
60
|
getMergedMeta: () => getMergedMeta,
|
|
@@ -71,9 +72,11 @@ __export(src_exports, {
|
|
|
71
72
|
invokeUnmount: () => invokeUnmount,
|
|
72
73
|
isAsyncFunc: () => isAsyncFunc,
|
|
73
74
|
isPhecda: () => isPhecda,
|
|
75
|
+
objectToClass: () => objectToClass,
|
|
74
76
|
set: () => set,
|
|
75
77
|
setInject: () => setInject,
|
|
76
|
-
setMeta: () => setMeta
|
|
78
|
+
setMeta: () => setMeta,
|
|
79
|
+
wait: () => wait
|
|
77
80
|
});
|
|
78
81
|
module.exports = __toCommonJS(src_exports);
|
|
79
82
|
|
|
@@ -304,6 +307,23 @@ function defaultMerger(prev, cur) {
|
|
|
304
307
|
}
|
|
305
308
|
return newMeta;
|
|
306
309
|
}
|
|
310
|
+
function wait(...instances) {
|
|
311
|
+
return Promise.all(instances.map((i) => i.__PROMISE_SYMBOL__));
|
|
312
|
+
}
|
|
313
|
+
function objectToClass(obj) {
|
|
314
|
+
return class {
|
|
315
|
+
constructor() {
|
|
316
|
+
Object.assign(this, obj);
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function functionToClass(fn) {
|
|
321
|
+
return class {
|
|
322
|
+
constructor(...args) {
|
|
323
|
+
Object.setPrototypeOf(this, fn(...args));
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
307
327
|
|
|
308
328
|
// src/di.ts
|
|
309
329
|
var DataMap = {};
|
|
@@ -502,6 +522,7 @@ Base = __decorateClass([
|
|
|
502
522
|
Watcher,
|
|
503
523
|
activeInstance,
|
|
504
524
|
addDecoToClass,
|
|
525
|
+
functionToClass,
|
|
505
526
|
get,
|
|
506
527
|
getInject,
|
|
507
528
|
getMergedMeta,
|
|
@@ -519,7 +540,9 @@ Base = __decorateClass([
|
|
|
519
540
|
invokeUnmount,
|
|
520
541
|
isAsyncFunc,
|
|
521
542
|
isPhecda,
|
|
543
|
+
objectToClass,
|
|
522
544
|
set,
|
|
523
545
|
setInject,
|
|
524
|
-
setMeta
|
|
546
|
+
setMeta,
|
|
547
|
+
wait
|
|
525
548
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -236,6 +236,23 @@ function defaultMerger(prev, cur) {
|
|
|
236
236
|
}
|
|
237
237
|
return newMeta;
|
|
238
238
|
}
|
|
239
|
+
function wait(...instances) {
|
|
240
|
+
return Promise.all(instances.map((i) => i.__PROMISE_SYMBOL__));
|
|
241
|
+
}
|
|
242
|
+
function objectToClass(obj) {
|
|
243
|
+
return class {
|
|
244
|
+
constructor() {
|
|
245
|
+
Object.assign(this, obj);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function functionToClass(fn) {
|
|
250
|
+
return class {
|
|
251
|
+
constructor(...args) {
|
|
252
|
+
Object.setPrototypeOf(this, fn(...args));
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
}
|
|
239
256
|
|
|
240
257
|
// src/di.ts
|
|
241
258
|
var DataMap = {};
|
|
@@ -433,6 +450,7 @@ export {
|
|
|
433
450
|
Watcher,
|
|
434
451
|
activeInstance,
|
|
435
452
|
addDecoToClass,
|
|
453
|
+
functionToClass,
|
|
436
454
|
get,
|
|
437
455
|
getInject,
|
|
438
456
|
getMergedMeta,
|
|
@@ -450,7 +468,9 @@ export {
|
|
|
450
468
|
invokeUnmount,
|
|
451
469
|
isAsyncFunc,
|
|
452
470
|
isPhecda,
|
|
471
|
+
objectToClass,
|
|
453
472
|
set,
|
|
454
473
|
setInject,
|
|
455
|
-
setMeta
|
|
474
|
+
setMeta,
|
|
475
|
+
wait
|
|
456
476
|
};
|