qcobjects 2.5.104-beta → 2.5.106-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/VERSION +1 -1
- package/build/Cast.js +4 -2
- package/build/Logger.js +2 -0
- package/build/MainProcess.js +3 -6
- package/build/QCObjects.js +4 -1
- package/build/globalSettings.js +7 -0
- package/build/index.d.ts +179 -172
- package/build/top.js +19 -5
- package/package.json +1 -1
- package/public/browser/QCObjects.js +359 -338
- package/public/browser/QCObjects.js.map +4 -4
- package/public/cjs/QCObjects.cjs +361 -338
- package/public/cjs/QCObjects.cjs.map +4 -4
- package/public/esm/QCObjects.mjs +359 -338
- package/public/esm/QCObjects.mjs.map +4 -4
- package/src/Cast.ts +4 -2
- package/src/Logger.ts +2 -0
- package/src/MainProcess.ts +5 -9
- package/src/QCObjects.ts +1 -0
- package/src/globalSettings.ts +10 -1
- package/src/top.ts +23 -8
package/src/Cast.ts
CHANGED
|
@@ -26,13 +26,15 @@ export const _Cast = function (obj_source: any, obj_dest: any):any {
|
|
|
26
26
|
* @param {Object} obj_source
|
|
27
27
|
* @param {Object} obj_dest
|
|
28
28
|
*/
|
|
29
|
-
export const _CastProps = function (obj_source: any, obj_dest: any):any {
|
|
29
|
+
export const _CastProps = function (obj_source: any, obj_dest: any, _ignoreError:boolean = true):any {
|
|
30
30
|
for (const v in obj_source) {
|
|
31
31
|
if (typeof obj_source[v] !== "undefined" && typeof obj_source[v] !== "function") {
|
|
32
32
|
try {
|
|
33
33
|
obj_dest[v] = obj_source[v];
|
|
34
34
|
} catch (e:any) {
|
|
35
|
-
|
|
35
|
+
if (!_ignoreError){
|
|
36
|
+
logger.debug(`An error ocurred: ${e}.`);
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
39
|
} else if (typeof obj_source[v] === "function") {
|
|
38
40
|
try {
|
package/src/Logger.ts
CHANGED
package/src/MainProcess.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IQCObjectsElement, IQCObjectsShadowedElement } from "types";
|
|
2
|
+
import { _top } from "./top";
|
|
2
3
|
import { _fireAsyncLoad, asyncLoad } from "./asyncLoad";
|
|
3
4
|
import { captureFalseTouch } from "./captureFalseTouch";
|
|
4
|
-
import { _Cast
|
|
5
|
+
import { _Cast } from "./Cast";
|
|
5
6
|
import { Class } from "./Class";
|
|
6
7
|
import { ClassFactory } from "./ClassFactory";
|
|
7
8
|
import { Component } from "./Component";
|
|
@@ -25,7 +26,6 @@ import { _QC_CLASSES, _QC_PACKAGES } from "./PrimaryCollections";
|
|
|
25
26
|
import { _Ready, ready, Ready } from "./Ready";
|
|
26
27
|
import { serviceLoader } from "./serviceLoader";
|
|
27
28
|
import { Tag } from "./Tag";
|
|
28
|
-
import { _top, resetTop } from "./top";
|
|
29
29
|
import { Processor } from "./Processor";
|
|
30
30
|
import { is_a } from "./is_a";
|
|
31
31
|
import { __getType__ } from "./getType";
|
|
@@ -37,6 +37,7 @@ import { waitUntil } from "./waitUntil";
|
|
|
37
37
|
import { subelements } from "./subelements";
|
|
38
38
|
import { GlobalSettings } from "./globalSettings";
|
|
39
39
|
import loadSDK from "./loadSDK";
|
|
40
|
+
import { range } from "./range";
|
|
40
41
|
|
|
41
42
|
(function __qcobjects__(_top: any) {
|
|
42
43
|
if (typeof Object.defineProperty !== "undefined" && typeof _top !== "undefined") {
|
|
@@ -56,10 +57,7 @@ import loadSDK from "./loadSDK";
|
|
|
56
57
|
}
|
|
57
58
|
if (typeof _top.__qcobjects__.loaded === "undefined") {
|
|
58
59
|
_top.__qcobjects__.loaded = true;
|
|
59
|
-
|
|
60
|
-
const global = _top;
|
|
61
|
-
_top.global = global;
|
|
62
|
-
|
|
60
|
+
|
|
63
61
|
if (isBrowser) {
|
|
64
62
|
(Element as unknown as IQCObjectsElement).prototype.subelements = subelements;
|
|
65
63
|
(Document as unknown as IQCObjectsElement).prototype.subelements = subelements;
|
|
@@ -72,7 +70,6 @@ import loadSDK from "./loadSDK";
|
|
|
72
70
|
|
|
73
71
|
logger.debugEnabled = false;
|
|
74
72
|
logger.infoEnabled = true;
|
|
75
|
-
_top.logger = logger;
|
|
76
73
|
|
|
77
74
|
/**
|
|
78
75
|
* Basic Type of all elements
|
|
@@ -381,7 +378,7 @@ import loadSDK from "./loadSDK";
|
|
|
381
378
|
|
|
382
379
|
(String as unknown as any).prototype.list = function ():string[] {
|
|
383
380
|
const __instance = this;
|
|
384
|
-
return
|
|
381
|
+
return range(0, __instance.length - 1).map(function <T>(i:any):T {
|
|
385
382
|
return __instance[i] as T;
|
|
386
383
|
}) as string[];
|
|
387
384
|
};
|
|
@@ -425,7 +422,6 @@ import loadSDK from "./loadSDK";
|
|
|
425
422
|
Export(_methods_);
|
|
426
423
|
Export(GlobalSettings);
|
|
427
424
|
|
|
428
|
-
resetTop(_CastProps(New(GlobalSettings), _top));
|
|
429
425
|
|
|
430
426
|
(function (_top) {
|
|
431
427
|
|
package/src/QCObjects.ts
CHANGED
|
@@ -97,4 +97,5 @@ export { IQCObjectsElement, IQCObjectsShadowedElement } from "types";
|
|
|
97
97
|
export { __to_number } from "./mathFunctions";
|
|
98
98
|
export {_top as global} from "./top";
|
|
99
99
|
export {__make_global__} from "./make_global";
|
|
100
|
+
export {get, set} from "./top";
|
|
100
101
|
export * as QCObjects from "./MainProcess";
|
package/src/globalSettings.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IGlobalSettings } from "types";
|
|
2
2
|
import { CONFIG } from "./CONFIG";
|
|
3
3
|
import { InheritClass } from "./InheritClass";
|
|
4
|
-
import { logger } from "./Logger";
|
|
4
|
+
import { Logger, logger } from "./Logger";
|
|
5
5
|
import { Package } from "./Package";
|
|
6
6
|
import { isBrowser } from "./platform";
|
|
7
7
|
import { serviceLoader } from "./serviceLoader";
|
|
@@ -23,6 +23,15 @@ export class GlobalSettings extends InheritClass implements IGlobalSettings{
|
|
|
23
23
|
return GlobalSettings._instance;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
protected _logger:Logger = new Logger();
|
|
27
|
+
get logger ():Logger {
|
|
28
|
+
return this._logger;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
set logger (value:Logger) {
|
|
32
|
+
this._logger = value;
|
|
33
|
+
}
|
|
34
|
+
|
|
26
35
|
set(name: string, value: any) {
|
|
27
36
|
this._GLOBAL[name] = value;
|
|
28
37
|
}
|
package/src/top.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { IComplexStorageCache, IComponent, IConfigService, IQCObjectsElement } from "types";
|
|
2
2
|
import { buildComponents } from "./ComponentFactory";
|
|
3
|
+
import { _CastProps } from "./Cast";
|
|
4
|
+
import { GlobalSettings } from "./globalSettings";
|
|
3
5
|
|
|
4
6
|
type QCObjects = {
|
|
5
7
|
lastCache?:IComplexStorageCache,
|
|
@@ -89,16 +91,19 @@ type QCObjects = {
|
|
|
89
91
|
} & typeof self & typeof global ;
|
|
90
92
|
|
|
91
93
|
export var _top: QCObjects = (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
)
|
|
94
|
+
(typeof module !== "undefined" && typeof module.exports !== "undefined" && module.exports) ||
|
|
95
|
+
(typeof global !== "undefined" && global) ||
|
|
96
|
+
(typeof globalThis !== "undefined" && globalThis) ||
|
|
97
|
+
(typeof window !== "undefined" && window) ||
|
|
98
|
+
(typeof self !== "undefined" && self) ||
|
|
99
|
+
this
|
|
100
|
+
) as QCObjects;
|
|
97
101
|
(_top as any).lastCache = undefined;
|
|
98
102
|
export let componentsStack:IComponent[] = [];
|
|
99
103
|
|
|
100
|
-
export const resetTop = (
|
|
101
|
-
|
|
104
|
+
export const resetTop = () => {
|
|
105
|
+
const globalSettings = GlobalSettings.instance;
|
|
106
|
+
_top = _CastProps(globalSettings, _top, true);
|
|
102
107
|
};
|
|
103
108
|
|
|
104
109
|
export const buildComponentsStack = () => {
|
|
@@ -108,4 +113,14 @@ export let configService:IConfigService;
|
|
|
108
113
|
export const setConfigService = (_configService:IConfigService) => {
|
|
109
114
|
_top.global.configService = _configService;
|
|
110
115
|
configService = _configService;
|
|
111
|
-
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const set = (name:string, value:any):void => {
|
|
119
|
+
_top[name as never] = value;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const get = (name:string, _defaultValue?:any):any => {
|
|
123
|
+
return _top[name as never] || _defaultValue;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
resetTop();
|