qcobjects 2.5.124-beta → 2.5.133-beta
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/Dockerfile +3 -3
- package/VERSION +1 -1
- package/build/ArrayCollection.js +2 -2
- package/build/Base64.js +14 -12
- package/build/ComponentFactory.js +2 -2
- package/build/DataStringify.js +1 -1
- package/build/DefaultTemplateHandler.js +5 -5
- package/build/ObjectName.js +1 -1
- package/build/QCObjects.js +0 -1
- package/build/Ready.js +3 -3
- package/build/WidgetsFactory.js +2 -2
- package/build/asyncLoad.js +3 -3
- package/build/basePath.js +6 -11
- package/build/index.js +1 -1
- package/build/introspection.js +1 -1
- package/build/is_a.js +1 -1
- package/build/is_forbidden_name.js +1 -1
- package/build/is_raw_class.js +1 -1
- package/build/loadSDK.js +2 -2
- package/build/make_global.js +1 -1
- package/build/range.js +1 -1
- package/build/routings.js +2 -2
- package/build/shortCode.js +1 -1
- package/build/waitUntil.js +2 -2
- package/build-esbuild.js +5 -6
- package/eslint.config.mjs +1 -1
- package/package.json +17 -9
- package/public/browser/QCObjects.js +127 -136
- package/public/browser/QCObjects.js.map +4 -4
- package/public/cjs/{QCObjects.cjs → index.cjs} +141 -242
- package/public/cjs/index.cjs.map +7 -0
- package/public/esm/{QCObjects.mjs → index.mjs} +229 -231
- package/public/esm/index.mjs.map +7 -0
- package/public/types/index.d.ts +99 -108
- package/public/types/index.d.ts.map +1 -0
- package/spec/helpers/mock-sdk.helper.ts +0 -3
- package/spec/testsClassFactorySpec.ts +1 -1
- package/spec/testsConfigSpec.ts +1 -1
- package/src/ArrayCollection.ts +7 -7
- package/src/BackendMicroservice.ts +14 -13
- package/src/Base64.ts +87 -87
- package/src/CONFIG.ts +3 -3
- package/src/Class.ts +1 -1
- package/src/ClassFactory.ts +1 -1
- package/src/ComplexStorageCache.ts +5 -5
- package/src/Component.ts +19 -19
- package/src/ComponentFactory.ts +4 -4
- package/src/Controller.ts +7 -7
- package/src/Crypt.ts +16 -16
- package/src/DDO.ts +2 -2
- package/src/DOMCreateElement.ts +9 -9
- package/src/DataStringify.ts +14 -14
- package/src/DefaultTemplateHandler.ts +45 -45
- package/src/Effect.ts +7 -7
- package/src/Export.ts +6 -6
- package/src/IncrementInstanceID.ts +1 -1
- package/src/InheritClass.ts +26 -26
- package/src/Logger.ts +4 -4
- package/src/MainProcess.ts +1 -1
- package/src/ObjectName.ts +1 -1
- package/src/PrimaryCollections.ts +2 -2
- package/src/Processor.ts +20 -20
- package/src/QCObjects.ts +1 -2
- package/src/Ready.ts +4 -4
- package/src/Service.ts +8 -8
- package/src/SourceCSS.ts +42 -42
- package/src/SourceJS.ts +8 -8
- package/src/Tag.ts +4 -4
- package/src/Timer.ts +2 -2
- package/src/Toggle.ts +2 -2
- package/src/TransitionEffect.ts +3 -4
- package/src/View.ts +2 -1
- package/src/WidgetsFactory.ts +3 -3
- package/src/assign.ts +1 -0
- package/src/asyncLoad.ts +5 -5
- package/src/basePath.ts +7 -14
- package/src/captureFalseTouch.ts +1 -1
- package/src/componentLoader.ts +1 -1
- package/src/defaultProcessors.ts +3 -3
- package/src/globalSettings.ts +24 -24
- package/src/index.cts +1 -1
- package/src/index.mts +1 -1
- package/src/index.ts +1 -1
- package/src/introspection.ts +78 -78
- package/src/is_a.ts +12 -12
- package/src/is_forbidden_name.ts +11 -12
- package/src/is_raw_class.ts +3 -3
- package/src/loadSDK.ts +2 -2
- package/src/make_global.ts +1 -1
- package/src/range.ts +12 -12
- package/src/routings.ts +3 -3
- package/src/secretKey.ts +1 -1
- package/src/serviceLoader.ts +1 -1
- package/src/shortCode.ts +9 -9
- package/src/top.ts +4 -4
- package/src/types/global/index.d.ts +4 -5
- package/src/uniqueID.ts +1 -1
- package/src/waitUntil.ts +2 -2
- package/tsconfig.d.json +30 -4
- package/tsconfig.jasmine.json +30 -5
- package/tsconfig.json +18 -2
- package/build/index.cjs +0 -7
- package/build/index.mjs +0 -2
- package/public/cjs/QCObjects.cjs.map +0 -7
- package/public/esm/QCObjects.mjs.map +0 -7
package/src/Crypt.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ICrypt } from "
|
|
1
|
+
import { _ICrypt } from "types";
|
|
2
2
|
import { Base64 } from "./Base64";
|
|
3
3
|
import { _DataStringify } from "./DataStringify";
|
|
4
4
|
import { InheritClass } from "./InheritClass";
|
|
@@ -6,7 +6,7 @@ import { Package } from "./Package";
|
|
|
6
6
|
import { _secretKey } from "./secretKey";
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
export class _Crypt extends InheritClass implements _ICrypt{
|
|
9
|
+
export class _Crypt extends InheritClass implements _ICrypt {
|
|
10
10
|
string: string = "";
|
|
11
11
|
key: string = "";
|
|
12
12
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -17,19 +17,19 @@ export class _Crypt extends InheritClass implements _ICrypt{
|
|
|
17
17
|
decrypt(_string_: string, key: string): string {
|
|
18
18
|
throw new Error("Method not implemented.");
|
|
19
19
|
}
|
|
20
|
-
last_string= "";
|
|
21
|
-
last_key= "";
|
|
22
|
-
construct= false;
|
|
23
|
-
_new_(o: { string?: string; key: string; }) {
|
|
20
|
+
last_string = "";
|
|
21
|
+
last_key = "";
|
|
22
|
+
construct = false;
|
|
23
|
+
_new_(o: { string?: string; key: string; }):void {
|
|
24
24
|
const string = o.string;
|
|
25
|
-
let key:string = (Object.hasOwn(o, "key")) ? (o.key) : ("");
|
|
25
|
+
let key: string = (Object.hasOwn(o, "key")) ? (o.key) : ("");
|
|
26
26
|
this.__new__(o);
|
|
27
27
|
key = (key === "") ? (this.__instanceID.toString()) : (key);
|
|
28
28
|
this.last_key = key;
|
|
29
29
|
this.last_string = string as string;
|
|
30
30
|
this.construct = true;
|
|
31
31
|
}
|
|
32
|
-
_encrypt():string {
|
|
32
|
+
_encrypt(): string {
|
|
33
33
|
const string = this.string;
|
|
34
34
|
const key = this.key;
|
|
35
35
|
let result = "";
|
|
@@ -44,7 +44,7 @@ export class _Crypt extends InheritClass implements _ICrypt{
|
|
|
44
44
|
this.last_string = Base64.encode(result);
|
|
45
45
|
return this.last_string;
|
|
46
46
|
}
|
|
47
|
-
_decrypt():string {
|
|
47
|
+
_decrypt(): string {
|
|
48
48
|
let string = this.string;
|
|
49
49
|
const key = this.key;
|
|
50
50
|
let result = "";
|
|
@@ -60,15 +60,15 @@ export class _Crypt extends InheritClass implements _ICrypt{
|
|
|
60
60
|
|
|
61
61
|
this.last_string = result;
|
|
62
62
|
return this.last_string;
|
|
63
|
-
}
|
|
64
|
-
static encrypt(string:string, key:string):string {
|
|
63
|
+
}
|
|
64
|
+
static encrypt(string: string, key: string): string {
|
|
65
65
|
const crypt = new _Crypt({
|
|
66
66
|
string,
|
|
67
67
|
key: (key !== "") ? (key) : ("12345678ABC")
|
|
68
68
|
});
|
|
69
69
|
return crypt._encrypt();
|
|
70
|
-
}
|
|
71
|
-
static decrypt(string:string, key:string) {
|
|
70
|
+
}
|
|
71
|
+
static decrypt(string: string, key: string):string {
|
|
72
72
|
const crypt = new _Crypt({
|
|
73
73
|
string,
|
|
74
74
|
key: (key !== "") ? (key) : ("12345678ABC")
|
|
@@ -77,11 +77,11 @@ export class _Crypt extends InheritClass implements _ICrypt{
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export const _CryptObject = function (o:any):string {
|
|
80
|
+
export const _CryptObject = function (o: any): string {
|
|
81
81
|
return _Crypt.encrypt(_DataStringify(o), _secretKey);
|
|
82
82
|
};
|
|
83
|
-
export const _DecryptObject = function (s:string):any {
|
|
83
|
+
export const _DecryptObject = function (s: string): any {
|
|
84
84
|
return (s === "") ? ({}) : (JSON.parse(_Crypt.decrypt(s, _secretKey)));
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
Package(
|
|
87
|
+
Package("com.qcobjects", [_Crypt]);
|
package/src/DDO.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TDDOParams } from "
|
|
1
|
+
import { TDDOParams } from "types";
|
|
2
2
|
import { Export } from "./Export";
|
|
3
3
|
import { InheritClass } from "./InheritClass";
|
|
4
4
|
import { logger } from "./Logger";
|
|
@@ -52,7 +52,7 @@ export class DDO extends InheritClass {
|
|
|
52
52
|
name,
|
|
53
53
|
fget,
|
|
54
54
|
fset
|
|
55
|
-
}:TDDOParams) {
|
|
55
|
+
}:TDDOParams):void {
|
|
56
56
|
const ddoInstance = this;
|
|
57
57
|
var name = (typeof name === "undefined") ? (ObjectName(ddoInstance)) : (name);
|
|
58
58
|
|
package/src/DOMCreateElement.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { IQCObjectsElement } from "
|
|
1
|
+
import { IQCObjectsElement } from "types";
|
|
2
2
|
import { isBrowser } from "./platform";
|
|
3
3
|
|
|
4
|
-
export const _DOMCreateElement = function (elementName:string, props?:any[], children?:any):IQCObjectsElement {
|
|
4
|
+
export const _DOMCreateElement = function (elementName: string, props?: any[], children?: any): IQCObjectsElement {
|
|
5
5
|
let _ret_;
|
|
6
6
|
if (isBrowser) {
|
|
7
|
-
|
|
7
|
+
_ret_ = _DOMCreateComplexElement(elementName, props, children) as unknown as IQCObjectsElement;
|
|
8
8
|
} else {
|
|
9
|
-
|
|
9
|
+
_ret_ = {} as IQCObjectsElement;
|
|
10
10
|
}
|
|
11
11
|
return _ret_;
|
|
12
|
-
|
|
12
|
+
};
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
const ComplexTypeCall = (_type:Function, {props, children}:{props?:any[], children?:any}):IQCObjectsElement => {
|
|
16
|
-
return _type({props, children}) as IQCObjectsElement;
|
|
15
|
+
const ComplexTypeCall = (_type: Function, { props, children }: { props?: any[], children?: any }): IQCObjectsElement => {
|
|
16
|
+
return _type({ props, children }) as IQCObjectsElement;
|
|
17
17
|
};
|
|
18
|
-
export const _DOMCreateComplexElement = (_type:string|Function, props?:any[], children?:any) => {
|
|
18
|
+
export const _DOMCreateComplexElement = (_type: string | Function, props?: any[], children?: any): HTMLElement | IQCObjectsElement => {
|
|
19
19
|
|
|
20
20
|
if (typeof _type !== "string") {
|
|
21
|
-
return ComplexTypeCall(_type, {props,children});
|
|
21
|
+
return ComplexTypeCall(_type, { props, children });
|
|
22
22
|
}
|
|
23
23
|
const element = document.createElement(_type);
|
|
24
24
|
|
package/src/DataStringify.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { _LegacyCopy } from "./LegacyCopy";
|
|
2
2
|
|
|
3
|
-
export const _DataStringify =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
seen.add(value);
|
|
3
|
+
export const _DataStringify = (data: any): string => {
|
|
4
|
+
const getCircularReplacer = function () {
|
|
5
|
+
const seen = new WeakSet();
|
|
6
|
+
let _level = 0;
|
|
7
|
+
return function (key: string, value: any): any {
|
|
8
|
+
if (typeof value === "object" && value !== null) {
|
|
9
|
+
if (seen.has(value)) {
|
|
10
|
+
_level += 1;
|
|
11
|
+
return (_level <= 3) ? (_LegacyCopy(value)) : (null);
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
seen.add(value);
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
17
16
|
};
|
|
18
|
-
return JSON.stringify(data, getCircularReplacer());
|
|
19
17
|
};
|
|
18
|
+
return JSON.stringify(data, getCircularReplacer());
|
|
19
|
+
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { DefaultTemplateHandlerParams } from "
|
|
1
|
+
import { DefaultTemplateHandlerParams, IComponent } from "types";
|
|
2
2
|
import { logger } from "./Logger";
|
|
3
3
|
import { GlobalProcessor as Processor } from "./Processor";
|
|
4
4
|
import { RegisterClass } from "./RegisterClass";
|
|
5
5
|
|
|
6
6
|
export class DefaultTemplateHandler {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
template = "";
|
|
8
|
+
__definition = {};
|
|
9
|
+
static __definition = {};
|
|
10
|
+
component?: IComponent;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
constructor({ component, template }: DefaultTemplateHandlerParams) {
|
|
13
|
+
this.component = component;
|
|
14
|
+
this.template = template;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
17
|
+
assign(data: any): string {
|
|
18
|
+
const templateInstance = this;
|
|
19
|
+
if (typeof templateInstance.component === "undefined") {
|
|
20
|
+
throw new Error("DefaultTemplateHandler.assign: component is undefined");
|
|
21
|
+
}
|
|
22
|
+
if (typeof templateInstance.component.processorHandler === "undefined") {
|
|
23
|
+
throw new Error("DefaultTemplateHandler.assign: component.processorHandler is undefined");
|
|
24
|
+
}
|
|
25
|
+
const processorHandler = templateInstance.component.processorHandler;
|
|
26
|
+
processorHandler.component = templateInstance.component;
|
|
27
|
+
let parsedAssignmentText = (typeof templateInstance.template !== "undefined") ? (templateInstance.template) : ("");
|
|
28
|
+
if (typeof data === "object") {
|
|
29
|
+
[...Object.keys(data)].map((k): any => {
|
|
30
|
+
let _value = data[k];
|
|
31
|
+
if (typeof _value === "string" || typeof _value === "number" || (!isNaN(_value))) {
|
|
32
|
+
try {
|
|
33
|
+
_value = Processor.processObject.bind(processorHandler).call(processorHandler, _value, templateInstance.component);
|
|
34
|
+
parsedAssignmentText = parsedAssignmentText.replace((new RegExp(`{{${k}}}`, "g")), _value);
|
|
35
|
+
} catch (e: any) {
|
|
36
|
+
logger.warn(`${templateInstance.component?.name} could not parse processors.`);
|
|
37
|
+
throw Error(`${templateInstance.component?.name} could not parse processors. Reason: ${e.message}`);
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
parsedAssignmentText = Processor.processObject.call(processorHandler, parsedAssignmentText, templateInstance.component);
|
|
47
|
-
} catch (e:any) {
|
|
48
|
-
logger.warn(`${templateInstance.component.name} could not parse processors.`);
|
|
49
|
-
throw Error(`${templateInstance.component.name} could not parse processors. Reason: ${e.message}`);
|
|
50
|
-
}
|
|
51
|
-
return parsedAssignmentText;
|
|
39
|
+
}
|
|
40
|
+
return k;
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
logger.debug(`${templateInstance.component?.name}.data is not an object`);
|
|
52
44
|
}
|
|
53
|
-
|
|
45
|
+
try {
|
|
46
|
+
parsedAssignmentText = Processor.processObject.call(processorHandler, parsedAssignmentText, templateInstance.component);
|
|
47
|
+
} catch (e: any) {
|
|
48
|
+
logger.warn(`${templateInstance.component?.name} could not parse processors.`);
|
|
49
|
+
throw Error(`${templateInstance.component?.name} could not parse processors. Reason: ${e.message}`);
|
|
50
|
+
}
|
|
51
|
+
return parsedAssignmentText;
|
|
54
52
|
}
|
|
55
|
-
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
RegisterClass(DefaultTemplateHandler, "com.qcobjects");
|
package/src/Effect.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { IEffect, TEffectParams } from "
|
|
1
|
+
import { IEffect, TEffectParams } from "types";
|
|
2
2
|
import { InheritClass } from "./InheritClass";
|
|
3
3
|
import { Package } from "./Package";
|
|
4
4
|
import { _methods_, _protected_code_ } from "./introspection";
|
|
5
5
|
import { ClassFactory } from "./ClassFactory";
|
|
6
6
|
|
|
7
|
-
class Effect extends InheritClass implements IEffect{
|
|
7
|
+
class Effect extends InheritClass implements IEffect {
|
|
8
8
|
// eslint-disable-next-line no-unused-vars
|
|
9
|
-
done
|
|
9
|
+
done(...args: any[]): any {
|
|
10
10
|
throw new Error("Method not implemented.");
|
|
11
11
|
};
|
|
12
12
|
// eslint-disable-next-line no-unused-vars
|
|
13
|
-
apply(...args: any[]) {
|
|
13
|
+
apply(...args: any[]): void {
|
|
14
14
|
throw new Error("Method not implemented.");
|
|
15
15
|
}
|
|
16
16
|
duration = 1000;
|
|
@@ -20,7 +20,7 @@ class Effect extends InheritClass implements IEffect{
|
|
|
20
20
|
timing,
|
|
21
21
|
draw,
|
|
22
22
|
duration
|
|
23
|
-
}: TEffectParams) {
|
|
23
|
+
}: TEffectParams): void {
|
|
24
24
|
const _self: this = this;
|
|
25
25
|
|
|
26
26
|
const start = performance.now();
|
|
@@ -57,9 +57,9 @@ Package("com.qcobjects.effects.base", [
|
|
|
57
57
|
Effect
|
|
58
58
|
]);
|
|
59
59
|
|
|
60
|
-
(_methods_)(ClassFactory("Effect")).map(
|
|
60
|
+
(_methods_)(ClassFactory("Effect")).map((__c__): any => {
|
|
61
61
|
(_protected_code_)(__c__);
|
|
62
62
|
return __c__;
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
export {Effect};
|
|
65
|
+
export { Effect };
|
package/src/Export.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __make_global__ } from "./make_global";
|
|
2
2
|
|
|
3
|
-
export const Export = function (f:any) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export const Export = function (f: any):void {
|
|
4
|
+
return __make_global__(f);
|
|
5
|
+
};
|
|
6
|
+
Export.prototype.toString = function () {
|
|
7
|
+
return "Export(function or symbol) { [QCObjects native code] }";
|
|
8
|
+
};
|
package/src/InheritClass.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IInheritClass, type IQCObjectsElement, type TBody } from "
|
|
1
|
+
import { type IInheritClass, type IQCObjectsElement, type TBody } from "types";
|
|
2
2
|
import { logger } from "./Logger";
|
|
3
3
|
import { __instanceID, IncrementInstanceID } from "./IncrementInstanceID";
|
|
4
4
|
import { _CastProps, _Cast } from "./Cast";
|
|
@@ -25,25 +25,25 @@ export class InheritClass implements IInheritClass {
|
|
|
25
25
|
|
|
26
26
|
constructor(_o_?: any) {
|
|
27
27
|
|
|
28
|
-
if (typeof _o_ !== "undefined" && typeof _o_.__definition !== "undefined"){
|
|
28
|
+
if (typeof _o_ !== "undefined" && typeof _o_.__definition !== "undefined") {
|
|
29
29
|
this.__definition = {
|
|
30
30
|
...(_o_.__definition)
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const self:this = this;
|
|
35
|
-
if (typeof _o_ !== "undefined" && _o_ !== null){
|
|
34
|
+
const self: this = this;
|
|
35
|
+
if (typeof _o_ !== "undefined" && _o_ !== null) {
|
|
36
36
|
Object.keys(_o_)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
.filter(function (k) {
|
|
38
|
+
return isNaN(k as any) && !["__instanceID", "__classType", "__definition"].includes(k);
|
|
39
|
+
})
|
|
40
|
+
.forEach(function (key) {
|
|
41
|
+
if (typeof self[key] === "function") {
|
|
42
|
+
self[key] = _o_[key].bind(self);
|
|
43
|
+
} else {
|
|
44
|
+
self[key] = _o_[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
IncrementInstanceID();
|
|
@@ -82,7 +82,7 @@ export class InheritClass implements IInheritClass {
|
|
|
82
82
|
} else {
|
|
83
83
|
self.body = {};
|
|
84
84
|
}
|
|
85
|
-
} catch (e:any) {
|
|
85
|
+
} catch (e: any) {
|
|
86
86
|
logger.debug(`An error ocurred: ${e}.`);
|
|
87
87
|
self.body = {};
|
|
88
88
|
}
|
|
@@ -136,37 +136,37 @@ export class InheritClass implements IInheritClass {
|
|
|
136
136
|
|
|
137
137
|
__namespace?: string | undefined;
|
|
138
138
|
|
|
139
|
-
__new__(_o_: any) {
|
|
139
|
+
__new__(_o_: any): void {
|
|
140
140
|
_CastProps(_o_, this);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
// eslint-disable-next-line no-unused-vars
|
|
144
|
-
_new_(_o_?: any) { }
|
|
144
|
+
_new_(_o_?: any): void { }
|
|
145
145
|
|
|
146
146
|
static getParentClass(): any {
|
|
147
147
|
return Object.getPrototypeOf(this.prototype.constructor);
|
|
148
148
|
}
|
|
149
|
-
getParentClass():any {
|
|
149
|
+
getParentClass(): any {
|
|
150
150
|
return (this.constructor as typeof InheritClass).getParentClass();
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
|
|
154
154
|
static getClass(): any {
|
|
155
155
|
return Object.getPrototypeOf(this.constructor);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
getClass(): any {
|
|
159
159
|
return (this.constructor as typeof InheritClass).getClass();
|
|
160
|
-
}
|
|
160
|
+
}
|
|
161
161
|
|
|
162
162
|
css(_css: any): any {
|
|
163
163
|
if (typeof this.body !== "undefined" && typeof this?.body !== "string" && typeof (this?.body as HTMLElement)?.style !== "undefined") {
|
|
164
164
|
logger.debug("body style");
|
|
165
|
-
if (this.body){
|
|
165
|
+
if (this.body) {
|
|
166
166
|
(this.body as any).style = _Cast(_css, (this?.body as HTMLElement)?.style);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
return (typeof this.body !== "string")? (this?.body as HTMLElement)?.style :{};
|
|
169
|
+
return (typeof this.body !== "string") ? (this?.body as HTMLElement)?.style : {};
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
hierarchy(): any {
|
|
@@ -175,7 +175,7 @@ export class InheritClass implements IInheritClass {
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
|
|
178
|
-
append(_child?: any) {
|
|
178
|
+
append(_child?: any): void {
|
|
179
179
|
const child: any = _child || this.body;
|
|
180
180
|
logger.debug("append: start");
|
|
181
181
|
if (is_a(child, "Component")) {
|
|
@@ -186,11 +186,11 @@ export class InheritClass implements IInheritClass {
|
|
|
186
186
|
logger.debug("append element");
|
|
187
187
|
if (arguments.length > 0) {
|
|
188
188
|
logger.debug("append to element");
|
|
189
|
-
if (typeof this.body !== "string"){
|
|
189
|
+
if (typeof this.body !== "string") {
|
|
190
190
|
if (typeof (this.body as IQCObjectsElement)?.append !== "undefined") {
|
|
191
191
|
(this?.body as IQCObjectsElement)?.append(child);
|
|
192
192
|
} else {
|
|
193
|
-
throw Error
|
|
193
|
+
throw Error("body.append is undefined. That means the body is not well formed.");
|
|
194
194
|
}
|
|
195
195
|
} else {
|
|
196
196
|
this.append(child);
|
|
@@ -208,7 +208,7 @@ export class InheritClass implements IInheritClass {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
attachIn(tag: any) {
|
|
211
|
+
attachIn(tag: any): void {
|
|
212
212
|
if (isBrowser) {
|
|
213
213
|
const tags = (document as any).subelements(tag);
|
|
214
214
|
for (let i = 0, j = tags.length; i < j; i++) {
|
package/src/Logger.ts
CHANGED
|
@@ -5,13 +5,13 @@ export class Logger {
|
|
|
5
5
|
debugEnabled = true;
|
|
6
6
|
infoEnabled = true;
|
|
7
7
|
warnEnabled = true;
|
|
8
|
-
debug(message:string) {
|
|
8
|
+
debug(message: string): void {
|
|
9
9
|
if (this.debugEnabled) {
|
|
10
10
|
console.log("\x1b[35m%s\x1b[0m", `[DEBUG][${performance.now().toLocaleString()}] ${message}`);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
info(message:string) {
|
|
14
|
+
info(message: string): void {
|
|
15
15
|
let color;
|
|
16
16
|
if (this.infoEnabled) {
|
|
17
17
|
if (isBrowser) {
|
|
@@ -23,12 +23,12 @@ export class Logger {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
warn(message:string) {
|
|
26
|
+
warn(message: string): void {
|
|
27
27
|
if (this.warnEnabled) {
|
|
28
28
|
console.warn("\x1b[31m%s\x1b[0m", `[WARN][${performance.now().toLocaleString()}] ${message}`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const logger = new Logger();
|
|
33
|
+
export const logger: Logger = new Logger();
|
|
34
34
|
Export(logger);
|
package/src/MainProcess.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IQCObjectsElement, IQCObjectsShadowedElement } from "
|
|
1
|
+
import { IQCObjectsElement, IQCObjectsShadowedElement } from "types";
|
|
2
2
|
import { _top } from "./top";
|
|
3
3
|
import { _fireAsyncLoad, asyncLoad } from "./asyncLoad";
|
|
4
4
|
import { captureFalseTouch } from "./captureFalseTouch";
|
package/src/ObjectName.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T_QC_CLASSES, T_QC_PACKAGES } from "
|
|
1
|
+
import { T_QC_CLASSES, T_QC_PACKAGES } from "types";
|
|
2
2
|
import { __getType__ } from "./getType";
|
|
3
3
|
import { __make_global__ } from "./make_global";
|
|
4
4
|
|
|
@@ -92,7 +92,7 @@ export const getClassesNamesList = (): any[] => {
|
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
export const set_QC_PACKAGE = (packageName: string, _qc_packages: any[]) => {
|
|
95
|
+
export const set_QC_PACKAGE = (packageName: string, _qc_packages: any[]):void => {
|
|
96
96
|
_QC_PACKAGES[packageName] = _qc_packages;
|
|
97
97
|
};
|
|
98
98
|
|
package/src/Processor.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {type IComponent, type IProcessor } from "
|
|
1
|
+
import { type IComponent, type IProcessor } from "types";
|
|
2
2
|
import { CONFIG } from "./CONFIG";
|
|
3
3
|
import { InheritClass } from "./InheritClass";
|
|
4
4
|
import { New } from "./New";
|
|
@@ -7,51 +7,51 @@ import { Component } from "./Component";
|
|
|
7
7
|
import { Package } from "./Package";
|
|
8
8
|
|
|
9
9
|
export class Processor extends InheritClass implements IProcessor {
|
|
10
|
-
protected static _instance:IProcessor | undefined;
|
|
11
|
-
constructor({ component, processors }: { component: IComponent | null, processors?:any }) {
|
|
10
|
+
protected static _instance: IProcessor | undefined;
|
|
11
|
+
constructor({ component, processors }: { component: IComponent | null, processors?: any }) {
|
|
12
12
|
super({ component });
|
|
13
|
-
if (typeof processors !== "undefined"){
|
|
14
|
-
this.processors = Object.assign
|
|
13
|
+
if (typeof processors !== "undefined") {
|
|
14
|
+
this.processors = Object.assign(processors, Processor.instance.processors);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
processors:any = {
|
|
19
|
-
"config"(component: Component, arg: string):string {
|
|
18
|
+
processors: any = {
|
|
19
|
+
"config"(component: Component, arg: string): string {
|
|
20
20
|
return CONFIG.get(arg, "") as string;
|
|
21
21
|
},
|
|
22
|
-
"ENV"(component: Component, arg: string):string {
|
|
22
|
+
"ENV"(component: Component, arg: string): string {
|
|
23
23
|
return (typeof process !== "undefined") ? (process.env[arg] as string) : ("");
|
|
24
24
|
},
|
|
25
|
-
"global"(component: Component, arg: string):string {
|
|
25
|
+
"global"(component: Component, arg: string): string {
|
|
26
26
|
return (typeof _top !== "undefined") ? ((_top as any)[arg] as string) : ("");
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
static get instance
|
|
31
|
-
if (typeof Processor._instance === "undefined"){
|
|
32
|
-
Processor._instance = new Processor({component:null});
|
|
30
|
+
static get instance(): IProcessor {
|
|
31
|
+
if (typeof Processor._instance === "undefined") {
|
|
32
|
+
Processor._instance = new Processor({ component: null });
|
|
33
33
|
}
|
|
34
34
|
return Processor._instance;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
setProcessor(_proc_: Function) {
|
|
37
|
+
setProcessor(_proc_: Function):void {
|
|
38
38
|
if (typeof _proc_ === "function" && _proc_.name !== "") {
|
|
39
39
|
this.processors[_proc_.name] = _proc_;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
component!: IComponent|null;
|
|
43
|
+
component!: IComponent | null;
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
execute(component: IComponent, processorName: string, args: string): string {
|
|
47
47
|
const processorHandler = (typeof component !== "undefined" && component !== null) ? (component.processorHandler) : (this);
|
|
48
48
|
return processorHandler?.processors[processorName].bind(processorHandler).apply(processorHandler, [component, args?.split(",")]) as string;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
process(template: string, component: IComponent | null = null):string {
|
|
52
52
|
const processorHandler = (component !== null) ? (component.processorHandler) : (New(Processor, { component: null }));
|
|
53
53
|
if (typeof template === "string") {
|
|
54
|
-
Object.keys(processorHandler.processors).map(
|
|
54
|
+
Object.keys(processorHandler.processors).map((funcName) => {
|
|
55
55
|
return [...template.matchAll(new RegExp("\\$" + funcName + "\\((.*)\\).*", "g"))].map(
|
|
56
56
|
function (procesorMatch) {
|
|
57
57
|
const match0 = `$${funcName}(${procesorMatch[1]})`;
|
|
@@ -64,14 +64,14 @@ export class Processor extends InheritClass implements IProcessor {
|
|
|
64
64
|
return template;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
processObject(obj: any, component: IComponent | null = null): any {
|
|
68
68
|
let __instance__: IProcessor | undefined = (component === null) ? (this) : (component.processorHandler);
|
|
69
69
|
if (typeof __instance__ === "undefined") {
|
|
70
70
|
__instance__ = new Processor({ component });
|
|
71
71
|
}
|
|
72
72
|
if (typeof obj === "object") {
|
|
73
73
|
Object.keys(obj).map(
|
|
74
|
-
|
|
74
|
+
(_k) => {
|
|
75
75
|
if (typeof obj[_k] === "object" && !Object.hasOwn(obj[_k], "call")) {
|
|
76
76
|
obj[_k] = __instance__?.processObject.bind(__instance__)(obj[_k], component as IComponent);
|
|
77
77
|
} else if (typeof obj[_k] === "string") {
|
|
@@ -88,6 +88,6 @@ export class Processor extends InheritClass implements IProcessor {
|
|
|
88
88
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
export const GlobalProcessor:IProcessor = Processor.instance;
|
|
91
|
+
export const GlobalProcessor: IProcessor = Processor.instance;
|
|
92
92
|
|
|
93
93
|
Package("com.qcobjects", [Processor]);
|
package/src/QCObjects.ts
CHANGED
|
@@ -95,9 +95,8 @@ export { DDO } from "./DDO";
|
|
|
95
95
|
export { Toggle } from "./Toggle";
|
|
96
96
|
export { findPackageNodePath } from "./findPackageNodePath";
|
|
97
97
|
export { getDocumentLayout } from "./DocumentLayout";
|
|
98
|
-
export { IQCObjectsElement, IQCObjectsShadowedElement } from "
|
|
98
|
+
export { IQCObjectsElement, IQCObjectsShadowedElement } from "types";
|
|
99
99
|
export { __to_number } from "./mathFunctions";
|
|
100
100
|
export {_top as global} from "./top";
|
|
101
101
|
export {__make_global__} from "./make_global";
|
|
102
102
|
export {get, set} from "./top";
|
|
103
|
-
export default {};
|