@aom-js/core 0.0.1
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/cjs/constants/errors.d.ts +3 -0
- package/dist/cjs/constants/errors.d.ts.map +1 -0
- package/dist/cjs/constants/errors.js +6 -0
- package/dist/cjs/constants/errors.js.map +1 -0
- package/dist/cjs/constants/index.d.ts +2 -0
- package/dist/cjs/constants/index.d.ts.map +1 -0
- package/dist/cjs/constants/index.js +18 -0
- package/dist/cjs/constants/index.js.map +1 -0
- package/dist/cjs/defines/classes.d.ts +9 -0
- package/dist/cjs/defines/classes.d.ts.map +1 -0
- package/dist/cjs/defines/classes.js +23 -0
- package/dist/cjs/defines/classes.js.map +1 -0
- package/dist/cjs/defines/core.d.ts +71 -0
- package/dist/cjs/defines/core.d.ts.map +1 -0
- package/dist/cjs/defines/core.js +229 -0
- package/dist/cjs/defines/core.js.map +1 -0
- package/dist/cjs/defines/functions.d.ts +4 -0
- package/dist/cjs/defines/functions.d.ts.map +1 -0
- package/dist/cjs/defines/functions.js +11 -0
- package/dist/cjs/defines/functions.js.map +1 -0
- package/dist/cjs/defines/index.d.ts +5 -0
- package/dist/cjs/defines/index.d.ts.map +1 -0
- package/dist/cjs/defines/index.js +21 -0
- package/dist/cjs/defines/index.js.map +1 -0
- package/dist/cjs/defines/types.d.ts +12 -0
- package/dist/cjs/defines/types.d.ts.map +1 -0
- package/dist/cjs/defines/types.js +11 -0
- package/dist/cjs/defines/types.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/mjs/constants/errors.js +3 -0
- package/dist/mjs/constants/errors.js.map +1 -0
- package/dist/mjs/constants/index.js +2 -0
- package/dist/mjs/constants/index.js.map +1 -0
- package/dist/mjs/defines/classes.js +19 -0
- package/dist/mjs/defines/classes.js.map +1 -0
- package/dist/mjs/defines/core.js +225 -0
- package/dist/mjs/defines/core.js.map +1 -0
- package/dist/mjs/defines/functions.js +7 -0
- package/dist/mjs/defines/functions.js.map +1 -0
- package/dist/mjs/defines/index.js +5 -0
- package/dist/mjs/defines/index.js.map +1 -0
- package/dist/mjs/defines/types.js +8 -0
- package/dist/mjs/defines/types.js.map +1 -0
- package/dist/mjs/index.js +2 -0
- package/dist/mjs/index.js.map +1 -0
- package/dist/types/constants/errors.d.ts +2 -0
- package/dist/types/constants/index.d.ts +1 -0
- package/dist/types/defines/classes.d.ts +8 -0
- package/dist/types/defines/core.d.ts +70 -0
- package/dist/types/defines/functions.d.ts +3 -0
- package/dist/types/defines/index.d.ts +4 -0
- package/dist/types/defines/types.d.ts +11 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +48 -0
- package/readme.md +5 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/constants/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,+BAA+B,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONSTRUCTOR_PROPERTY_TYPE_ERROR = exports.CONSTRUCTOR_TYPE_ERROR = void 0;
|
|
4
|
+
exports.CONSTRUCTOR_TYPE_ERROR = "CONSTRUCTOR_TYPE_ERROR";
|
|
5
|
+
exports.CONSTRUCTOR_PROPERTY_TYPE_ERROR = "CONSTRUCTOR_PROPERTY_TYPE_ERROR";
|
|
6
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/constants/errors.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAClD,QAAA,+BAA+B,GAAG,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./errors"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ClassConstructor } from "./types";
|
|
2
|
+
export declare class ClassInstanceMap {
|
|
3
|
+
private map;
|
|
4
|
+
set<T extends object>(key: ClassConstructor<T>, value: T): this;
|
|
5
|
+
get<T extends object>(key: ClassConstructor<T>): T | undefined;
|
|
6
|
+
has<T extends object>(key: ClassConstructor<T>): boolean;
|
|
7
|
+
delete<T extends object>(key: ClassConstructor<T>): boolean;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=classes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classes.d.ts","sourceRoot":"","sources":["../../../src/defines/classes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAe,MAAM,SAAS,CAAC;AAGxD,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,GAAG,CAAsC;IAIjD,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAO/D,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;IAO9D,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO;IAKxD,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO;CAG5D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClassInstanceMap = void 0;
|
|
4
|
+
class ClassInstanceMap {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.map = new WeakMap();
|
|
7
|
+
}
|
|
8
|
+
set(key, value) {
|
|
9
|
+
this.map.set(key, value);
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
get(key) {
|
|
13
|
+
return this.map.get(key);
|
|
14
|
+
}
|
|
15
|
+
has(key) {
|
|
16
|
+
return this.map.has(key);
|
|
17
|
+
}
|
|
18
|
+
delete(key) {
|
|
19
|
+
return this.map.delete(key);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ClassInstanceMap = ClassInstanceMap;
|
|
23
|
+
//# sourceMappingURL=classes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classes.js","sourceRoot":"","sources":["../../../src/defines/classes.ts"],"names":[],"mappings":";;;AAGA,MAAa,gBAAgB;IAA7B;QAEU,QAAG,GAAG,IAAI,OAAO,EAAuB,CAAC;IA0BnD,CAAC;IAtBC,GAAG,CAAmB,GAAwB,EAAE,KAAQ;QACtD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAID,GAAG,CAAmB,GAAwB;QAG5C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAkB,CAAC;IAC5C,CAAC;IAGD,GAAG,CAAmB,GAAwB;QAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAGD,MAAM,CAAmB,GAAwB;QAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF;AA5BD,4CA4BC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ClassConstructor, CombinedDecorator, Property, DecoratorsQueueStore, InstanceTarget } from "./types";
|
|
2
|
+
declare type AomHandler<T extends AomCore> = ($: T) => void;
|
|
3
|
+
declare type AomСombinedHandler<T extends AomCore> = ($: T, descriptor?: PropertyDescriptor) => void;
|
|
4
|
+
declare type AomMethodHandler<T extends AomCore> = ($: T, descriptor: PropertyDescriptor) => PropertyDescriptor | void;
|
|
5
|
+
declare type AomPropertyHandler<T extends AomCore> = ($: T) => void;
|
|
6
|
+
declare type AomParameterHandler<T extends AomCore> = ($: T, parameterIndex: number) => void;
|
|
7
|
+
type AomClass<T extends AomCore> = ClassConstructor<T> & typeof AomCore;
|
|
8
|
+
type LazyCall<T extends AomCore> = [
|
|
9
|
+
(AomHandler<T> | AomСombinedHandler<T> | AomMethodHandler<T> | AomPropertyHandler<T> | AomParameterHandler<T>),
|
|
10
|
+
args: [T, ...any]
|
|
11
|
+
];
|
|
12
|
+
type OriginDescriptor = {
|
|
13
|
+
target: InstanceTarget;
|
|
14
|
+
property: Property;
|
|
15
|
+
descriptor: PropertyDescriptor;
|
|
16
|
+
};
|
|
17
|
+
declare class AomCallstackQueue<T extends AomCore> {
|
|
18
|
+
private queue;
|
|
19
|
+
private fired;
|
|
20
|
+
private callstack;
|
|
21
|
+
private type?;
|
|
22
|
+
private async;
|
|
23
|
+
private indexed;
|
|
24
|
+
constructor(callstack: AomCallstack<T>, type: DecoratorsQueueStore, indexed?: boolean);
|
|
25
|
+
add(value: LazyCall<T>, index?: number): any;
|
|
26
|
+
exec(): void;
|
|
27
|
+
run([handler, args]: LazyCall<T>): any;
|
|
28
|
+
transferTo(target: T): void;
|
|
29
|
+
}
|
|
30
|
+
declare class AomCallstack<T extends AomCore> {
|
|
31
|
+
_: AomNode<T>;
|
|
32
|
+
stores: {
|
|
33
|
+
[key in DecoratorsQueueStore]: AomCallstackQueue<T>;
|
|
34
|
+
};
|
|
35
|
+
indexes: {
|
|
36
|
+
[key in DecoratorsQueueStore]: AomCallstackQueue<T>;
|
|
37
|
+
};
|
|
38
|
+
constructor(_: AomNode<T>);
|
|
39
|
+
add(value: LazyCall<T>, storeFlag: DecoratorsQueueStore, index?: number): void;
|
|
40
|
+
apply(): void;
|
|
41
|
+
transferTo(target: T): void;
|
|
42
|
+
}
|
|
43
|
+
declare class AomNode<T extends AomCore> {
|
|
44
|
+
base: AomClass<T>;
|
|
45
|
+
target: ClassConstructor;
|
|
46
|
+
property?: Property;
|
|
47
|
+
currentProperty: T | undefined;
|
|
48
|
+
root: T;
|
|
49
|
+
self: T;
|
|
50
|
+
origins: OriginDescriptor[];
|
|
51
|
+
properties: Map<Property, T>;
|
|
52
|
+
statics: Map<Property, T>;
|
|
53
|
+
callstack: AomCallstack<T>;
|
|
54
|
+
constructor(self: T, base: AomClass<any>, target: ClassConstructor, property?: Property, origin?: OriginDescriptor);
|
|
55
|
+
apply(): void;
|
|
56
|
+
}
|
|
57
|
+
export declare class AomCore {
|
|
58
|
+
_: AomNode<this>;
|
|
59
|
+
constructor(base: AomClass<any>, target: ClassConstructor, property?: Property, origin?: OriginDescriptor);
|
|
60
|
+
private static instancesMap;
|
|
61
|
+
private static instanceKey;
|
|
62
|
+
static checkExists<T extends AomCore, E extends InstanceTarget, K = keyof E>(this: AomClass<T>, target: E, property?: K & Property): T | undefined;
|
|
63
|
+
static instance<T extends AomCore, E extends InstanceTarget, K = keyof E>(this: AomClass<T>, target: E, property?: K & Property): T;
|
|
64
|
+
static classDecorator<T extends AomCore>(this: AomClass<T>, handler: AomHandler<T>, storeFlag?: DecoratorsQueueStore): ClassDecorator;
|
|
65
|
+
static combinedDecorator<T extends AomCore>(this: AomClass<T>, handler: AomСombinedHandler<T>, storeFlag?: DecoratorsQueueStore): CombinedDecorator;
|
|
66
|
+
static methodDecorator<T extends AomCore>(this: AomClass<T>, handler: AomMethodHandler<T>, storeFlag?: DecoratorsQueueStore): MethodDecorator;
|
|
67
|
+
static propertyDecorator<T extends AomCore>(this: AomClass<T>, handler: AomPropertyHandler<T>, storeFlag?: DecoratorsQueueStore): PropertyDecorator;
|
|
68
|
+
static parameterDecorator<T extends AomCore>(this: AomClass<T>, handler: AomParameterHandler<T>, storeFlag?: DecoratorsQueueStore): ParameterDecorator;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/defines/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EAEjB,QAAQ,EACR,oBAAoB,EACpB,cAAc,EACf,MAAM,SAAS,CAAC;AAGjB,OAAO,MAAM,UAAU,CAAC,CAAC,SAAS,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAA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AAO,EACxC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC9B,SAAS,GAAE,oBAAiD,GAC3D,iBAAiB;IAYpB,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,OAAO,EACtC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC5B,SAAS,GAAE,oBAAiD,GAC3D,eAAe;IAWlB,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,OAAO,EACxC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC9B,SAAS,GAAE,oBAAiD,GAC3D,iBAAiB;IAWpB,MAAM,CAAC,kBAAkB,CAAC,CAAC,SAAS,OAAO,EACzC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAC/B,SAAS,GAAE,oBAAiD,GAC3D,kBAAkB;CAatB"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AomCore = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
const functions_1 = require("./functions");
|
|
6
|
+
class AomCallstackQueue {
|
|
7
|
+
constructor(callstack, type, indexed) {
|
|
8
|
+
this.callstack = callstack;
|
|
9
|
+
this.queue = [];
|
|
10
|
+
this.fired = [];
|
|
11
|
+
this.type = type;
|
|
12
|
+
this.indexed = indexed;
|
|
13
|
+
this.async = [types_1.DecoratorsQueueStore.DELAY].includes(type);
|
|
14
|
+
}
|
|
15
|
+
add(value, index) {
|
|
16
|
+
const { type } = this;
|
|
17
|
+
if ([types_1.DecoratorsQueueStore.LAST, types_1.DecoratorsQueueStore.DELAY].includes(type)) {
|
|
18
|
+
index >= 0 ? (this.queue[index] = value) : this.queue.push(value);
|
|
19
|
+
}
|
|
20
|
+
else if ([types_1.DecoratorsQueueStore.FIRST].includes(type)) {
|
|
21
|
+
index >= 0 ? (this.fired[index] = value) : this.fired.push(value);
|
|
22
|
+
return this.run(value);
|
|
23
|
+
}
|
|
24
|
+
else if (type === types_1.DecoratorsQueueStore.INSTANT) {
|
|
25
|
+
return this.run(value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exec() {
|
|
29
|
+
while (this.queue.length) {
|
|
30
|
+
const value = this.queue.shift();
|
|
31
|
+
this.run(value);
|
|
32
|
+
this.fired.push(value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
run([handler, args]) {
|
|
36
|
+
if (this.async) {
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
Reflect.apply(handler, null, args);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return Reflect.apply(handler, null, args);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
transferTo(target) {
|
|
46
|
+
const { type, indexed } = this;
|
|
47
|
+
const replaceContext = (value, index) => {
|
|
48
|
+
const [handler, args] = value;
|
|
49
|
+
args[0] = target;
|
|
50
|
+
return target._.callstack.add([handler, args], type, index);
|
|
51
|
+
};
|
|
52
|
+
if (indexed) {
|
|
53
|
+
const targetIndexedStore = target._.callstack.indexes[type];
|
|
54
|
+
const targetExistsIndexed = targetIndexedStore.queue.length || targetIndexedStore.fired.length;
|
|
55
|
+
if (!targetExistsIndexed) {
|
|
56
|
+
this.fired.forEach((value, index) => replaceContext(value, index));
|
|
57
|
+
this.queue.forEach((value, index) => replaceContext(value, index));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.fired.forEach((value) => replaceContext(value));
|
|
62
|
+
this.queue.forEach((value) => replaceContext(value));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class AomCallstack {
|
|
67
|
+
constructor(_) {
|
|
68
|
+
this._ = _;
|
|
69
|
+
this.stores = {};
|
|
70
|
+
this.indexes = {};
|
|
71
|
+
Object.values(types_1.DecoratorsQueueStore).forEach((type) => {
|
|
72
|
+
this.stores[type] = new AomCallstackQueue(this, type);
|
|
73
|
+
this.indexes[type] = new AomCallstackQueue(this, type, true);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
add(value, storeFlag, index) {
|
|
77
|
+
if (index >= 0) {
|
|
78
|
+
this.indexes[storeFlag].add(value, index);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.stores[storeFlag].add(value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
apply() {
|
|
85
|
+
Object.values(types_1.DecoratorsQueueStore).forEach((type) => {
|
|
86
|
+
this.stores[type].exec();
|
|
87
|
+
this.indexes[type].exec();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
transferTo(target) {
|
|
91
|
+
Object.values(types_1.DecoratorsQueueStore).forEach((type) => {
|
|
92
|
+
this.stores[type].transferTo(target);
|
|
93
|
+
this.indexes[type].transferTo(target);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
class AomNode {
|
|
98
|
+
constructor(self, base, target, property, origin) {
|
|
99
|
+
this.self = self;
|
|
100
|
+
this.base = base;
|
|
101
|
+
this.target = target;
|
|
102
|
+
this.property = property;
|
|
103
|
+
this.properties = new Map();
|
|
104
|
+
this.statics = new Map();
|
|
105
|
+
this.origins = [];
|
|
106
|
+
this.callstack = new AomCallstack(this);
|
|
107
|
+
if (property) {
|
|
108
|
+
this.root = this.base.instance(target);
|
|
109
|
+
if (origin && !origin.descriptor?.enumerable) {
|
|
110
|
+
this.root._.origins.push(origin);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this.root = this.self;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
apply() {
|
|
118
|
+
this.properties.forEach(($) => {
|
|
119
|
+
$._.callstack.apply();
|
|
120
|
+
});
|
|
121
|
+
this.statics.forEach(($) => {
|
|
122
|
+
$._.callstack.apply();
|
|
123
|
+
});
|
|
124
|
+
this.origins.forEach(({ descriptor }) => {
|
|
125
|
+
this.base.instance(descriptor.value)._.callstack.apply();
|
|
126
|
+
});
|
|
127
|
+
this.callstack.apply();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
class AomCore {
|
|
131
|
+
constructor(base, target, property, origin) {
|
|
132
|
+
this._ = new AomNode(this, base, target, property, origin);
|
|
133
|
+
}
|
|
134
|
+
static instancesMap() {
|
|
135
|
+
const mapSymbol = Symbol.for(`AOM_MAP_${this.name}`);
|
|
136
|
+
if (!this[mapSymbol]) {
|
|
137
|
+
this[mapSymbol] = new WeakMap();
|
|
138
|
+
}
|
|
139
|
+
const map = this[mapSymbol];
|
|
140
|
+
return map;
|
|
141
|
+
}
|
|
142
|
+
static instanceKey(target, property) {
|
|
143
|
+
const constructor = (target instanceof Function ? target : target.constructor);
|
|
144
|
+
let instanceKey;
|
|
145
|
+
if (property && (0, functions_1.isClass)(constructor)) {
|
|
146
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, property);
|
|
147
|
+
if (descriptor && !descriptor.enumerable) {
|
|
148
|
+
instanceKey = descriptor.value;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const constructorInstance = this.instance(constructor);
|
|
152
|
+
let propertiesMap;
|
|
153
|
+
if (target === constructor) {
|
|
154
|
+
propertiesMap = constructorInstance._.statics;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
propertiesMap = constructorInstance._.properties;
|
|
158
|
+
}
|
|
159
|
+
instanceKey = propertiesMap.get(property);
|
|
160
|
+
if (!instanceKey) {
|
|
161
|
+
instanceKey = new this(this, constructor, property);
|
|
162
|
+
propertiesMap.set(property, instanceKey);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
instanceKey = target;
|
|
168
|
+
}
|
|
169
|
+
return instanceKey;
|
|
170
|
+
}
|
|
171
|
+
static checkExists(target, property) {
|
|
172
|
+
const map = this.instancesMap();
|
|
173
|
+
const instanceKey = this.instanceKey(target, property);
|
|
174
|
+
return map.get(instanceKey);
|
|
175
|
+
}
|
|
176
|
+
static instance(target, property) {
|
|
177
|
+
const map = this.instancesMap();
|
|
178
|
+
const instanceKey = this.instanceKey(target, property);
|
|
179
|
+
const constructor = (target instanceof Function ? target : target.constructor);
|
|
180
|
+
let instance = map.get(instanceKey);
|
|
181
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, property);
|
|
182
|
+
const originDescriptor = { target, property, descriptor };
|
|
183
|
+
if (!instance) {
|
|
184
|
+
instance = new this(this, constructor, property, originDescriptor);
|
|
185
|
+
map.set(instanceKey, instance);
|
|
186
|
+
}
|
|
187
|
+
else if (property && instance._.target !== constructor) {
|
|
188
|
+
instance._ = new AomNode(instance, this, constructor, property, originDescriptor);
|
|
189
|
+
}
|
|
190
|
+
return instance;
|
|
191
|
+
}
|
|
192
|
+
static classDecorator(handler, storeFlag = types_1.DecoratorsQueueStore.FIRST) {
|
|
193
|
+
const self = this;
|
|
194
|
+
return function (target) {
|
|
195
|
+
const targetInstance = self.instance(target);
|
|
196
|
+
return targetInstance._.callstack.add([handler, [targetInstance]], storeFlag);
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
static combinedDecorator(handler, storeFlag = types_1.DecoratorsQueueStore.FIRST) {
|
|
200
|
+
const self = this;
|
|
201
|
+
return function (target, property, descriptor) {
|
|
202
|
+
const targetInstance = self.instance(target, property);
|
|
203
|
+
return targetInstance._.callstack.add([handler, [targetInstance, descriptor]], storeFlag);
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
static methodDecorator(handler, storeFlag = types_1.DecoratorsQueueStore.FIRST) {
|
|
207
|
+
const self = this;
|
|
208
|
+
return function (target, property, descriptor) {
|
|
209
|
+
const targetInstance = self.instance(target, property);
|
|
210
|
+
return targetInstance._.callstack.add([handler, [targetInstance, descriptor]], storeFlag);
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
static propertyDecorator(handler, storeFlag = types_1.DecoratorsQueueStore.FIRST) {
|
|
214
|
+
const self = this;
|
|
215
|
+
return function (target, property) {
|
|
216
|
+
const targetInstance = self.instance(target, property);
|
|
217
|
+
return targetInstance._.callstack.add([handler, [targetInstance]], storeFlag);
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
static parameterDecorator(handler, storeFlag = types_1.DecoratorsQueueStore.FIRST) {
|
|
221
|
+
const self = this;
|
|
222
|
+
return function (target, property, parameterIndex) {
|
|
223
|
+
const targetInstance = self.instance(target, property);
|
|
224
|
+
return targetInstance._.callstack.add([handler, [targetInstance, parameterIndex]], storeFlag, parameterIndex);
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
exports.AomCore = AomCore;
|
|
229
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/defines/core.ts"],"names":[],"mappings":";;;AAAA,mCAOiB;AACjB,2CAAsC;AAsCtC,MAAM,iBAAiB;IAYrB,YAAY,SAA0B,EAAE,IAA0B,EAAE,OAAiB;QACnF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAEhB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,CAAC,4BAAoB,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED,GAAG,CAAC,KAAkB,EAAE,KAAc;QAEpC,MAAM,EAAE,IAAI,EAAE,GAAG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O,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QAEhF,CAAC,CAAC;IACJ,CAAC;IAGD,MAAM,CAAC,kBAAkB,CAEvB,OAA+B,EAC/B,YAAkC,4BAAoB,CAAC,KAAK;QAE5D,MAAM,IAAI,GAAG,IAAI,CAAC;QAClB,OAAO,UAAU,MAAmB,EAAE,QAAkB,EAAE,cAAsB;YAE9E,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAEvD,OAAO,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CACnC,CAAC,OAAO,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,EAC3C,SAAS,EACT,cAAc,CACf,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAhND,0BAgNC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/defines/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEhE,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,WAI5C;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE/E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isClass = isClass;
|
|
4
|
+
exports.hasOwnProperty = hasOwnProperty;
|
|
5
|
+
function isClass(value) {
|
|
6
|
+
return (typeof value === "function" && /^class[\s\{]/.test(Function.prototype.toString.call(value)));
|
|
7
|
+
}
|
|
8
|
+
function hasOwnProperty(target, property) {
|
|
9
|
+
return Object.prototype.hasOwnProperty.call(target, property);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/defines/functions.ts"],"names":[],"mappings":";;AAEA,0BAIC;AAED,wCAEC;AARD,SAAgB,OAAO,CAAC,KAAqB;IAC3C,OAAO,CACL,OAAO,KAAK,KAAK,UAAU,IAAI,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAC5F,CAAC;AACJ,CAAC;AAED,SAAgB,cAAc,CAAC,MAAmB,EAAE,QAAkB;IACpE,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/defines/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./functions"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./classes"), exports);
|
|
20
|
+
__exportStar(require("./core"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/defines/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB;AACxB,4CAA0B;AAC1B,yCAAuB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare type ClassConstructor<T extends any = {}> = new (...args: any[]) => T;
|
|
2
|
+
export declare type Constructor = ClassConstructor | Function;
|
|
3
|
+
export declare type Property = string | symbol;
|
|
4
|
+
export declare type InstanceTarget = Constructor | object;
|
|
5
|
+
export declare type CombinedDecorator = <T>(target: Constructor, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<T>) => void;
|
|
6
|
+
export declare enum DecoratorsQueueStore {
|
|
7
|
+
INSTANT = "instant",
|
|
8
|
+
FIRST = "first",
|
|
9
|
+
LAST = "last",
|
|
10
|
+
DELAY = "delay"
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/defines/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,MAAM,gBAAgB,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AACrF,MAAM,CAAC,OAAO,MAAM,WAAW,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAC9D,MAAM,CAAC,OAAO,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/C,MAAM,CAAC,OAAO,MAAM,cAAc,GAAG,WAAW,GAAG,MAAM,CAAC;AAG1D,MAAM,CAAC,OAAO,MAAM,iBAAiB,GAAG,CAAC,CAAC,EACxC,MAAM,EAAE,WAAW,EACnB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAC7B,UAAU,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,KACpC,IAAI,CAAC;AAEV,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAEhB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DecoratorsQueueStore = void 0;
|
|
4
|
+
var DecoratorsQueueStore;
|
|
5
|
+
(function (DecoratorsQueueStore) {
|
|
6
|
+
DecoratorsQueueStore["INSTANT"] = "instant";
|
|
7
|
+
DecoratorsQueueStore["FIRST"] = "first";
|
|
8
|
+
DecoratorsQueueStore["LAST"] = "last";
|
|
9
|
+
DecoratorsQueueStore["DELAY"] = "delay";
|
|
10
|
+
})(DecoratorsQueueStore || (exports.DecoratorsQueueStore = DecoratorsQueueStore = {}));
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/defines/types.ts"],"names":[],"mappings":";;;AAaA,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,2CAAmB,CAAA;IACnB,uCAAe,CAAA;IACf,qCAAa,CAAA;IACb,uCAAe,CAAA;AAEjB,CAAC,EANW,oBAAoB,oCAApB,oBAAoB,QAM/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./defines"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/constants/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAC/D,MAAM,CAAC,MAAM,+BAA+B,GAAG,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class ClassInstanceMap {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.map = new WeakMap();
|
|
4
|
+
}
|
|
5
|
+
set(key, value) {
|
|
6
|
+
this.map.set(key, value);
|
|
7
|
+
return this;
|
|
8
|
+
}
|
|
9
|
+
get(key) {
|
|
10
|
+
return this.map.get(key);
|
|
11
|
+
}
|
|
12
|
+
has(key) {
|
|
13
|
+
return this.map.has(key);
|
|
14
|
+
}
|
|
15
|
+
delete(key) {
|
|
16
|
+
return this.map.delete(key);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=classes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classes.js","sourceRoot":"","sources":["../../../src/defines/classes.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,gBAAgB;IAA7B;QAEU,QAAG,GAAG,IAAI,OAAO,EAAuB,CAAC;IA0BnD,CAAC;IAtBC,GAAG,CAAmB,GAAwB,EAAE,KAAQ;QACtD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAID,GAAG,CAAmB,GAAwB;QAG5C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAkB,CAAC;IAC5C,CAAC;IAGD,GAAG,CAAmB,GAAwB;QAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAGD,MAAM,CAAmB,GAAwB;QAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { DecoratorsQueueStore, } from "./types";
|
|
2
|
+
import { isClass } from "./functions";
|
|
3
|
+
class AomCallstackQueue {
|
|
4
|
+
constructor(callstack, type, indexed) {
|
|
5
|
+
this.callstack = callstack;
|
|
6
|
+
this.queue = [];
|
|
7
|
+
this.fired = [];
|
|
8
|
+
this.type = type;
|
|
9
|
+
this.indexed = indexed;
|
|
10
|
+
this.async = [DecoratorsQueueStore.DELAY].includes(type);
|
|
11
|
+
}
|
|
12
|
+
add(value, index) {
|
|
13
|
+
const { type } = this;
|
|
14
|
+
if ([DecoratorsQueueStore.LAST, DecoratorsQueueStore.DELAY].includes(type)) {
|
|
15
|
+
index >= 0 ? (this.queue[index] = value) : this.queue.push(value);
|
|
16
|
+
}
|
|
17
|
+
else if ([DecoratorsQueueStore.FIRST].includes(type)) {
|
|
18
|
+
index >= 0 ? (this.fired[index] = value) : this.fired.push(value);
|
|
19
|
+
return this.run(value);
|
|
20
|
+
}
|
|
21
|
+
else if (type === DecoratorsQueueStore.INSTANT) {
|
|
22
|
+
return this.run(value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exec() {
|
|
26
|
+
while (this.queue.length) {
|
|
27
|
+
const value = this.queue.shift();
|
|
28
|
+
this.run(value);
|
|
29
|
+
this.fired.push(value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
run([handler, args]) {
|
|
33
|
+
if (this.async) {
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
Reflect.apply(handler, null, args);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return Reflect.apply(handler, null, args);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
transferTo(target) {
|
|
43
|
+
const { type, indexed } = this;
|
|
44
|
+
const replaceContext = (value, index) => {
|
|
45
|
+
const [handler, args] = value;
|
|
46
|
+
args[0] = target;
|
|
47
|
+
return target._.callstack.add([handler, args], type, index);
|
|
48
|
+
};
|
|
49
|
+
if (indexed) {
|
|
50
|
+
const targetIndexedStore = target._.callstack.indexes[type];
|
|
51
|
+
const targetExistsIndexed = targetIndexedStore.queue.length || targetIndexedStore.fired.length;
|
|
52
|
+
if (!targetExistsIndexed) {
|
|
53
|
+
this.fired.forEach((value, index) => replaceContext(value, index));
|
|
54
|
+
this.queue.forEach((value, index) => replaceContext(value, index));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.fired.forEach((value) => replaceContext(value));
|
|
59
|
+
this.queue.forEach((value) => replaceContext(value));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
class AomCallstack {
|
|
64
|
+
constructor(_) {
|
|
65
|
+
this._ = _;
|
|
66
|
+
this.stores = {};
|
|
67
|
+
this.indexes = {};
|
|
68
|
+
Object.values(DecoratorsQueueStore).forEach((type) => {
|
|
69
|
+
this.stores[type] = new AomCallstackQueue(this, type);
|
|
70
|
+
this.indexes[type] = new AomCallstackQueue(this, type, true);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
add(value, storeFlag, index) {
|
|
74
|
+
if (index >= 0) {
|
|
75
|
+
this.indexes[storeFlag].add(value, index);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.stores[storeFlag].add(value);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
apply() {
|
|
82
|
+
Object.values(DecoratorsQueueStore).forEach((type) => {
|
|
83
|
+
this.stores[type].exec();
|
|
84
|
+
this.indexes[type].exec();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
transferTo(target) {
|
|
88
|
+
Object.values(DecoratorsQueueStore).forEach((type) => {
|
|
89
|
+
this.stores[type].transferTo(target);
|
|
90
|
+
this.indexes[type].transferTo(target);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
class AomNode {
|
|
95
|
+
constructor(self, base, target, property, origin) {
|
|
96
|
+
this.self = self;
|
|
97
|
+
this.base = base;
|
|
98
|
+
this.target = target;
|
|
99
|
+
this.property = property;
|
|
100
|
+
this.properties = new Map();
|
|
101
|
+
this.statics = new Map();
|
|
102
|
+
this.origins = [];
|
|
103
|
+
this.callstack = new AomCallstack(this);
|
|
104
|
+
if (property) {
|
|
105
|
+
this.root = this.base.instance(target);
|
|
106
|
+
if (origin && !origin.descriptor?.enumerable) {
|
|
107
|
+
this.root._.origins.push(origin);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.root = this.self;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
apply() {
|
|
115
|
+
this.properties.forEach(($) => {
|
|
116
|
+
$._.callstack.apply();
|
|
117
|
+
});
|
|
118
|
+
this.statics.forEach(($) => {
|
|
119
|
+
$._.callstack.apply();
|
|
120
|
+
});
|
|
121
|
+
this.origins.forEach(({ descriptor }) => {
|
|
122
|
+
this.base.instance(descriptor.value)._.callstack.apply();
|
|
123
|
+
});
|
|
124
|
+
this.callstack.apply();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export class AomCore {
|
|
128
|
+
constructor(base, target, property, origin) {
|
|
129
|
+
this._ = new AomNode(this, base, target, property, origin);
|
|
130
|
+
}
|
|
131
|
+
static instancesMap() {
|
|
132
|
+
const mapSymbol = Symbol.for(`AOM_MAP_${this.name}`);
|
|
133
|
+
if (!this[mapSymbol]) {
|
|
134
|
+
this[mapSymbol] = new WeakMap();
|
|
135
|
+
}
|
|
136
|
+
const map = this[mapSymbol];
|
|
137
|
+
return map;
|
|
138
|
+
}
|
|
139
|
+
static instanceKey(target, property) {
|
|
140
|
+
const constructor = (target instanceof Function ? target : target.constructor);
|
|
141
|
+
let instanceKey;
|
|
142
|
+
if (property && isClass(constructor)) {
|
|
143
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, property);
|
|
144
|
+
if (descriptor && !descriptor.enumerable) {
|
|
145
|
+
instanceKey = descriptor.value;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const constructorInstance = this.instance(constructor);
|
|
149
|
+
let propertiesMap;
|
|
150
|
+
if (target === constructor) {
|
|
151
|
+
propertiesMap = constructorInstance._.statics;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
propertiesMap = constructorInstance._.properties;
|
|
155
|
+
}
|
|
156
|
+
instanceKey = propertiesMap.get(property);
|
|
157
|
+
if (!instanceKey) {
|
|
158
|
+
instanceKey = new this(this, constructor, property);
|
|
159
|
+
propertiesMap.set(property, instanceKey);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
instanceKey = target;
|
|
165
|
+
}
|
|
166
|
+
return instanceKey;
|
|
167
|
+
}
|
|
168
|
+
static checkExists(target, property) {
|
|
169
|
+
const map = this.instancesMap();
|
|
170
|
+
const instanceKey = this.instanceKey(target, property);
|
|
171
|
+
return map.get(instanceKey);
|
|
172
|
+
}
|
|
173
|
+
static instance(target, property) {
|
|
174
|
+
const map = this.instancesMap();
|
|
175
|
+
const instanceKey = this.instanceKey(target, property);
|
|
176
|
+
const constructor = (target instanceof Function ? target : target.constructor);
|
|
177
|
+
let instance = map.get(instanceKey);
|
|
178
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, property);
|
|
179
|
+
const originDescriptor = { target, property, descriptor };
|
|
180
|
+
if (!instance) {
|
|
181
|
+
instance = new this(this, constructor, property, originDescriptor);
|
|
182
|
+
map.set(instanceKey, instance);
|
|
183
|
+
}
|
|
184
|
+
else if (property && instance._.target !== constructor) {
|
|
185
|
+
instance._ = new AomNode(instance, this, constructor, property, originDescriptor);
|
|
186
|
+
}
|
|
187
|
+
return instance;
|
|
188
|
+
}
|
|
189
|
+
static classDecorator(handler, storeFlag = DecoratorsQueueStore.FIRST) {
|
|
190
|
+
const self = this;
|
|
191
|
+
return function (target) {
|
|
192
|
+
const targetInstance = self.instance(target);
|
|
193
|
+
return targetInstance._.callstack.add([handler, [targetInstance]], storeFlag);
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
static combinedDecorator(handler, storeFlag = DecoratorsQueueStore.FIRST) {
|
|
197
|
+
const self = this;
|
|
198
|
+
return function (target, property, descriptor) {
|
|
199
|
+
const targetInstance = self.instance(target, property);
|
|
200
|
+
return targetInstance._.callstack.add([handler, [targetInstance, descriptor]], storeFlag);
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
static methodDecorator(handler, storeFlag = DecoratorsQueueStore.FIRST) {
|
|
204
|
+
const self = this;
|
|
205
|
+
return function (target, property, descriptor) {
|
|
206
|
+
const targetInstance = self.instance(target, property);
|
|
207
|
+
return targetInstance._.callstack.add([handler, [targetInstance, descriptor]], storeFlag);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
static propertyDecorator(handler, storeFlag = DecoratorsQueueStore.FIRST) {
|
|
211
|
+
const self = this;
|
|
212
|
+
return function (target, property) {
|
|
213
|
+
const targetInstance = self.instance(target, property);
|
|
214
|
+
return targetInstance._.callstack.add([handler, [targetInstance]], storeFlag);
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
static parameterDecorator(handler, storeFlag = DecoratorsQueueStore.FIRST) {
|
|
218
|
+
const self = this;
|
|
219
|
+
return function (target, property, parameterIndex) {
|
|
220
|
+
const targetInstance = self.instance(target, property);
|
|
221
|
+
return targetInstance._.callstack.add([handler, [targetInstance, parameterIndex]], storeFlag, parameterIndex);
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/defines/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oBAAoB,GAErB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAsCtC,MAAM,iBAAiB;IAYrB,YAAY,SAA0B,EAAE,IAA0B,EAAE,OAAiB;QACnF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAEhB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAA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AkB;YAEtD,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACvD,OAAO,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QAEhF,CAAC,CAAC;IACJ,CAAC;IAGD,MAAM,CAAC,kBAAkB,CAEvB,OAA+B,EAC/B,YAAkC,oBAAoB,CAAC,KAAK;QAE5D,MAAM,IAAI,GAAG,IAAI,CAAC;QAClB,OAAO,UAAU,MAAmB,EAAE,QAAkB,EAAE,cAAsB;YAE9E,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAEvD,OAAO,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CACnC,CAAC,OAAO,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,EAC3C,SAAS,EACT,cAAc,CACf,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function isClass(value) {
|
|
2
|
+
return (typeof value === "function" && /^class[\s\{]/.test(Function.prototype.toString.call(value)));
|
|
3
|
+
}
|
|
4
|
+
export function hasOwnProperty(target, property) {
|
|
5
|
+
return Object.prototype.hasOwnProperty.call(target, property);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/defines/functions.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,OAAO,CAAC,KAAqB;IAC3C,OAAO,CACL,OAAO,KAAK,KAAK,UAAU,IAAI,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAC5F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAmB,EAAE,QAAkB;IACpE,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/defines/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var DecoratorsQueueStore;
|
|
2
|
+
(function (DecoratorsQueueStore) {
|
|
3
|
+
DecoratorsQueueStore["INSTANT"] = "instant";
|
|
4
|
+
DecoratorsQueueStore["FIRST"] = "first";
|
|
5
|
+
DecoratorsQueueStore["LAST"] = "last";
|
|
6
|
+
DecoratorsQueueStore["DELAY"] = "delay";
|
|
7
|
+
})(DecoratorsQueueStore || (DecoratorsQueueStore = {}));
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/defines/types.ts"],"names":[],"mappings":"AAaA,MAAM,CAAN,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,2CAAmB,CAAA;IACnB,uCAAe,CAAA;IACf,qCAAa,CAAA;IACb,uCAAe,CAAA;AAEjB,CAAC,EANW,oBAAoB,KAApB,oBAAoB,QAM/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./errors";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClassConstructor } from "./types";
|
|
2
|
+
export declare class ClassInstanceMap {
|
|
3
|
+
private map;
|
|
4
|
+
set<T extends object>(key: ClassConstructor<T>, value: T): this;
|
|
5
|
+
get<T extends object>(key: ClassConstructor<T>): T | undefined;
|
|
6
|
+
has<T extends object>(key: ClassConstructor<T>): boolean;
|
|
7
|
+
delete<T extends object>(key: ClassConstructor<T>): boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ClassConstructor, CombinedDecorator, Property, DecoratorsQueueStore, InstanceTarget } from "./types";
|
|
2
|
+
declare type AomHandler<T extends AomCore> = ($: T) => void;
|
|
3
|
+
declare type AomСombinedHandler<T extends AomCore> = ($: T, descriptor?: PropertyDescriptor) => void;
|
|
4
|
+
declare type AomMethodHandler<T extends AomCore> = ($: T, descriptor: PropertyDescriptor) => PropertyDescriptor | void;
|
|
5
|
+
declare type AomPropertyHandler<T extends AomCore> = ($: T) => void;
|
|
6
|
+
declare type AomParameterHandler<T extends AomCore> = ($: T, parameterIndex: number) => void;
|
|
7
|
+
type AomClass<T extends AomCore> = ClassConstructor<T> & typeof AomCore;
|
|
8
|
+
type LazyCall<T extends AomCore> = [
|
|
9
|
+
(AomHandler<T> | AomСombinedHandler<T> | AomMethodHandler<T> | AomPropertyHandler<T> | AomParameterHandler<T>),
|
|
10
|
+
args: [T, ...any]
|
|
11
|
+
];
|
|
12
|
+
type OriginDescriptor = {
|
|
13
|
+
target: InstanceTarget;
|
|
14
|
+
property: Property;
|
|
15
|
+
descriptor: PropertyDescriptor;
|
|
16
|
+
};
|
|
17
|
+
declare class AomCallstackQueue<T extends AomCore> {
|
|
18
|
+
private queue;
|
|
19
|
+
private fired;
|
|
20
|
+
private callstack;
|
|
21
|
+
private type?;
|
|
22
|
+
private async;
|
|
23
|
+
private indexed;
|
|
24
|
+
constructor(callstack: AomCallstack<T>, type: DecoratorsQueueStore, indexed?: boolean);
|
|
25
|
+
add(value: LazyCall<T>, index?: number): any;
|
|
26
|
+
exec(): void;
|
|
27
|
+
run([handler, args]: LazyCall<T>): any;
|
|
28
|
+
transferTo(target: T): void;
|
|
29
|
+
}
|
|
30
|
+
declare class AomCallstack<T extends AomCore> {
|
|
31
|
+
_: AomNode<T>;
|
|
32
|
+
stores: {
|
|
33
|
+
[key in DecoratorsQueueStore]: AomCallstackQueue<T>;
|
|
34
|
+
};
|
|
35
|
+
indexes: {
|
|
36
|
+
[key in DecoratorsQueueStore]: AomCallstackQueue<T>;
|
|
37
|
+
};
|
|
38
|
+
constructor(_: AomNode<T>);
|
|
39
|
+
add(value: LazyCall<T>, storeFlag: DecoratorsQueueStore, index?: number): void;
|
|
40
|
+
apply(): void;
|
|
41
|
+
transferTo(target: T): void;
|
|
42
|
+
}
|
|
43
|
+
declare class AomNode<T extends AomCore> {
|
|
44
|
+
base: AomClass<T>;
|
|
45
|
+
target: ClassConstructor;
|
|
46
|
+
property?: Property;
|
|
47
|
+
currentProperty: T | undefined;
|
|
48
|
+
root: T;
|
|
49
|
+
self: T;
|
|
50
|
+
origins: OriginDescriptor[];
|
|
51
|
+
properties: Map<Property, T>;
|
|
52
|
+
statics: Map<Property, T>;
|
|
53
|
+
callstack: AomCallstack<T>;
|
|
54
|
+
constructor(self: T, base: AomClass<any>, target: ClassConstructor, property?: Property, origin?: OriginDescriptor);
|
|
55
|
+
apply(): void;
|
|
56
|
+
}
|
|
57
|
+
export declare class AomCore {
|
|
58
|
+
_: AomNode<this>;
|
|
59
|
+
constructor(base: AomClass<any>, target: ClassConstructor, property?: Property, origin?: OriginDescriptor);
|
|
60
|
+
private static instancesMap;
|
|
61
|
+
private static instanceKey;
|
|
62
|
+
static checkExists<T extends AomCore, E extends InstanceTarget, K = keyof E>(this: AomClass<T>, target: E, property?: K & Property): T | undefined;
|
|
63
|
+
static instance<T extends AomCore, E extends InstanceTarget, K = keyof E>(this: AomClass<T>, target: E, property?: K & Property): T;
|
|
64
|
+
static classDecorator<T extends AomCore>(this: AomClass<T>, handler: AomHandler<T>, storeFlag?: DecoratorsQueueStore): ClassDecorator;
|
|
65
|
+
static combinedDecorator<T extends AomCore>(this: AomClass<T>, handler: AomСombinedHandler<T>, storeFlag?: DecoratorsQueueStore): CombinedDecorator;
|
|
66
|
+
static methodDecorator<T extends AomCore>(this: AomClass<T>, handler: AomMethodHandler<T>, storeFlag?: DecoratorsQueueStore): MethodDecorator;
|
|
67
|
+
static propertyDecorator<T extends AomCore>(this: AomClass<T>, handler: AomPropertyHandler<T>, storeFlag?: DecoratorsQueueStore): PropertyDecorator;
|
|
68
|
+
static parameterDecorator<T extends AomCore>(this: AomClass<T>, handler: AomParameterHandler<T>, storeFlag?: DecoratorsQueueStore): ParameterDecorator;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare type ClassConstructor<T extends any = {}> = new (...args: any[]) => T;
|
|
2
|
+
export declare type Constructor = ClassConstructor | Function;
|
|
3
|
+
export declare type Property = string | symbol;
|
|
4
|
+
export declare type InstanceTarget = Constructor | object;
|
|
5
|
+
export declare type CombinedDecorator = <T>(target: Constructor, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<T>) => void;
|
|
6
|
+
export declare enum DecoratorsQueueStore {
|
|
7
|
+
INSTANT = "instant",
|
|
8
|
+
FIRST = "first",
|
|
9
|
+
LAST = "last",
|
|
10
|
+
DELAY = "delay"
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./defines";
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.0.1",
|
|
3
|
+
"name": "@aom-js/core",
|
|
4
|
+
"description": "`@aom` meta-framework core code",
|
|
5
|
+
"homepage": "https://github.com/aom-js/main#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/aom-js/main/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/aom-js/main.git",
|
|
12
|
+
"directory": "packages/core"
|
|
13
|
+
},
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"author": "Grigory B. Kholstinnikov (scarych)",
|
|
16
|
+
"dependencies": {},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.14.0",
|
|
19
|
+
"tslib": "^2.8.1",
|
|
20
|
+
"typescript": "^5.8.3"
|
|
21
|
+
},
|
|
22
|
+
"main": "./dist/cjs/index.js",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"module": "./dist/mjs/index.js",
|
|
28
|
+
"types": "./dist/types/index.d.ts",
|
|
29
|
+
"files": [
|
|
30
|
+
"./dist/cjs",
|
|
31
|
+
"./dist/mjs",
|
|
32
|
+
"./dist/types"
|
|
33
|
+
],
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"import": "./dist/mjs/index.js",
|
|
37
|
+
"require": "./dist/cjs/index.js",
|
|
38
|
+
"types": "./dist/types/index.d.ts"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
43
|
+
"clean": "rm -rf dist/",
|
|
44
|
+
"prebuild": "rm -rf dist/",
|
|
45
|
+
"build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.mjs.json && tsc --project tsconfig.build.types.json ",
|
|
46
|
+
"prepare": "npm run build"
|
|
47
|
+
}
|
|
48
|
+
}
|