qcobjects 2.5.115-beta → 2.5.117-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.
@@ -1,5 +1,5 @@
1
1
  import { IQCObjectsElement, IQCObjectsShadowedElement } from "types";
2
- import { _top, set } from "./top";
2
+ import { _top } from "./top";
3
3
  import { _fireAsyncLoad, asyncLoad } from "./asyncLoad";
4
4
  import { captureFalseTouch } from "./captureFalseTouch";
5
5
  import { _Cast } from "./Cast";
@@ -21,8 +21,7 @@ import { NamespaceRef } from "./NamespaceRef";
21
21
  import { New } from "./New";
22
22
  import { ObjectName } from "./ObjectName";
23
23
  import { Package } from "./Package";
24
- import { is_phonegap, isBrowser } from "./platform";
25
- import { _QC_CLASSES, _QC_PACKAGES } from "./PrimaryCollections";
24
+ import { is_phonegap, isBrowser } from "./platform";
26
25
  import { _Ready, ready, Ready } from "./Ready";
27
26
  import { serviceLoader } from "./serviceLoader";
28
27
  import { Tag } from "./Tag";
@@ -40,593 +39,485 @@ import loadSDK from "./loadSDK";
40
39
  import { range } from "./range";
41
40
 
42
41
  (function __qcobjects__(_top: any) {
43
- if (typeof Object.defineProperty !== "undefined" && typeof _top !== "undefined") {
44
- try {
45
- Object.defineProperty(_top, "__qcobjects__", {
46
- enumerable: true,
47
- configurable: false,
48
- writable: false,
49
- value: __qcobjects__,
50
- });
51
- } catch (e:any) {
52
- logger.debug(`An error ocurred: ${e}`);
53
- if (typeof _top.__qcobjects__ !== "undefined") {
54
- _top.__qcobjects__.loaded = true;
55
- }
42
+ if (typeof Object.defineProperty !== "undefined" && typeof _top !== "undefined") {
43
+ try {
44
+ Object.defineProperty(_top, "__qcobjects__", {
45
+ enumerable: true,
46
+ configurable: false,
47
+ writable: false,
48
+ value: __qcobjects__,
49
+ });
50
+ } catch (e: any) {
51
+ logger.debug(`An error ocurred: ${e}`);
52
+ if (typeof _top.__qcobjects__ !== "undefined") {
53
+ _top.__qcobjects__.loaded = true;
56
54
  }
57
55
  }
58
- if (typeof _top.__qcobjects__.loaded === "undefined") {
59
- _top.__qcobjects__.loaded = true;
60
-
61
- if (isBrowser) {
62
- (Element as unknown as IQCObjectsElement).prototype.subelements = subelements;
63
- (Document as unknown as IQCObjectsElement).prototype.subelements = subelements;
64
- (HTMLElement as unknown as IQCObjectsElement).prototype.subelements = subelements;
65
- if (typeof ShadowRoot !== "undefined") {
66
- (ShadowRoot as unknown as IQCObjectsShadowedElement).prototype.subelements = subelements;
67
- }
56
+ }
57
+ if (typeof _top.__qcobjects__.loaded === "undefined") {
58
+ _top.__qcobjects__.loaded = true;
59
+
60
+ if (isBrowser) {
61
+ (Element as unknown as IQCObjectsElement).prototype.subelements = subelements;
62
+ (Document as unknown as IQCObjectsElement).prototype.subelements = subelements;
63
+ (HTMLElement as unknown as IQCObjectsElement).prototype.subelements = subelements;
64
+ if (typeof ShadowRoot !== "undefined") {
65
+ (ShadowRoot as unknown as IQCObjectsShadowedElement).prototype.subelements = subelements;
68
66
  }
69
-
70
-
71
- logger.debugEnabled = false;
72
- logger.infoEnabled = true;
73
-
67
+ }
68
+
69
+
70
+ logger.debugEnabled = false;
71
+ logger.infoEnabled = true;
72
+
73
+ /**
74
+ * Basic Type of all elements
75
+ */
76
+ if (isBrowser) {
77
+ (Element as unknown as IQCObjectsElement).prototype.find = function (tag: string): IQCObjectsElement[] {
78
+ const _self = this;
79
+ const _oo: IQCObjectsElement[] = [];
80
+ const _tags = (document as unknown as IQCObjectsElement).subelements(tag);
81
+ _tags.map((_tt, _t) => {
82
+ if ((typeof _tags[_t] !== "undefined") && (_tags[_t].parentNode as Element).tagName === _self.parentNode.tagName) {
83
+ _oo.push(_Cast(_tt, (new Object())));
84
+ }
85
+ return _tt;
86
+ });
87
+ return _oo;
88
+ };
89
+ }
90
+
91
+ if (isBrowser) {
92
+ Element.prototype.append = function QC_Append(child) {
93
+ if (isQCObjects_Object(child) || typeof (child as any).body !== "undefined") {
94
+ this.appendChild((child as any).body);
95
+ } else {
96
+ this.appendChild(child as any);
97
+ }
98
+ };
99
+
74
100
  /**
75
- * Basic Type of all elements
76
- */
77
- if (isBrowser) {
78
- (Element as unknown as IQCObjectsElement).prototype.find = function (tag: string): IQCObjectsElement[] {
79
- const _self = this;
80
- const _oo:IQCObjectsElement[] = [];
81
- const _tags = (document as unknown as IQCObjectsElement).subelements(tag);
82
- _tags.map( (_tt, _t) => {
83
- if ((typeof _tags[_t] !== "undefined") && (_tags[_t].parentNode as Element).tagName === _self.parentNode.tagName) {
84
- _oo.push(_Cast(_tt, (new Object())));
85
- }
86
- return _tt;
87
- });
88
- return _oo;
89
- };
90
- }
91
-
92
- if (isBrowser) {
93
- Element.prototype.append = function QC_Append(child) {
94
- if (isQCObjects_Object(child) || typeof (child as any).body !== "undefined") {
95
- this.appendChild((child as any).body);
96
- } else {
97
- this.appendChild(child as any);
101
+ * A replacement for direct using of innerHTML
102
+ * use: [element].render('content') where 'content' is the string corresponding
103
+ * to the DOM to insert in the element
104
+ **/
105
+ (Element as unknown as IQCObjectsElement).prototype.render = function QC_Render(content: string) {
106
+ const _self = this;
107
+ const _appendVDOM = (_self: any, content: string): any => {
108
+ if (typeof document.implementation.createHTMLDocument !== "undefined") {
109
+ const doc = document.implementation.createHTMLDocument("");
110
+ doc.body.innerHTML = content;
111
+ (doc.body as unknown as IQCObjectsElement).subelements("*").map((element): any => {
112
+ return _self.append(element);
113
+ });
98
114
  }
99
115
  };
100
-
101
- /**
102
- * A replacement for direct using of innerHTML
103
- * use: [element].render('content') where 'content' is the string corresponding
104
- * to the DOM to insert in the element
105
- **/
106
- (Element as unknown as IQCObjectsElement).prototype.render = function QC_Render(content:string) {
107
- const _self = this;
108
- const _appendVDOM = (_self:any, content:string):any => {
109
- if (typeof document.implementation.createHTMLDocument !== "undefined") {
110
- const doc = document.implementation.createHTMLDocument("");
111
- doc.body.innerHTML = content;
112
- (doc.body as unknown as IQCObjectsElement).subelements("*").map( (element):any => {
113
- return _self.append(element);
114
- });
115
- }
116
- };
117
- if (typeof this.innerHTML !== "undefined") {
118
- try {
119
- this.innerHTML += content;
120
- } catch (e:any) {
121
- logger.debug(`An error ocurred: ${e}`);
122
- _appendVDOM(_self, content);
123
- }
124
- } else {
116
+ if (typeof this.innerHTML !== "undefined") {
117
+ try {
118
+ this.innerHTML += content;
119
+ } catch (e: any) {
120
+ logger.debug(`An error ocurred: ${e}`);
125
121
  _appendVDOM(_self, content);
126
122
  }
127
- };
128
- }
129
-
130
-
131
-
132
- Export(waitUntil);
133
- Export(_super_);
134
- Export(ComplexStorageCache);
135
- Export(ClassFactory);
136
- Export(_DOMCreateElement);
137
- Export(shortCode);
138
- Export(__getType__);
139
- Export(is_a);
140
- Package("com.qcobjects", [Processor]);
141
-
142
-
143
-
144
-
145
- if (isBrowser) {
146
- /**
147
- * Adds a Cast functionality to every Element of DOM
148
- */
149
- (Element as unknown as IQCObjectsElement).prototype.Cast = function QC_Cast<T>(_o: T): T {
150
- const _self: any = this;
151
- return _Cast(_self, _o) as T;
152
- };
153
- }
154
-
155
-
156
-
157
- if (isBrowser) {
158
- window.onload = _Ready;
159
- if (is_phonegap) {
160
- document.addEventListener("deviceready", _Ready, captureFalseTouch as any);
123
+ } else {
124
+ _appendVDOM(_self, content);
161
125
  }
162
- } else {
163
- global.onload = _Ready;
164
- }
165
-
166
- if (isBrowser) {
167
- window.addEventListener("popstate", function (popStateEvent) {
168
- popStateEvent.stopImmediatePropagation();
169
- popStateEvent.stopPropagation();
170
- Component.route()
171
- .catch((e:any) => {throw new Error (`An error ocurred when trying to load initial routes. ${e}`);});
172
- });
173
- }
174
-
175
-
176
-
177
- Export(serviceLoader);
178
- Export(componentLoader);
179
- Export(ComponentURI);
180
- Export(ObjectName);
181
- Export(_DataStringify);
182
- Export(isQCObjects_Class);
183
- Export(isQCObjects_Object);
184
- Export(NamespaceRef);
185
-
126
+ };
127
+ }
128
+
129
+
130
+
131
+ Export(waitUntil);
132
+ Export(_super_);
133
+ Export(ComplexStorageCache);
134
+ Export(ClassFactory);
135
+ Export(_DOMCreateElement);
136
+ Export(shortCode);
137
+ Export(__getType__);
138
+ Export(is_a);
139
+ Package("com.qcobjects", [Processor]);
140
+
141
+
142
+
143
+
144
+ if (isBrowser) {
186
145
  /**
187
- * Array math functions
146
+ * Adds a Cast functionality to every Element of DOM
188
147
  */
189
- // eslint-disable-next-line no-unused-vars
190
- (Array as any).prototype.unique = function <T>(this: T[]): T[]{
191
- return this.filter(function (value:any, index:any, self:any) {
192
- return self.indexOf(value) === index;
193
- });
148
+ (Element as unknown as IQCObjectsElement).prototype.Cast = function QC_Cast<T>(_o: T): T {
149
+ const _self: any = this;
150
+ return _Cast(_self, _o) as T;
194
151
  };
195
- (Array as any).unique = function <T>(a: Array<T>): T[] {
196
- return (a as any).unique() as T[];
197
- };
198
- (_protected_code_)((Array as any).unique);
199
- (_protected_code_)((Array as any).prototype.unique);
200
- (Array as any).prototype.table = function ():void {
201
- console.table(this);
202
- };
203
- (Array as any).table = function (a:any):void {
204
- a.table();
205
- return;
206
- };
207
- (_protected_code_)((Array as any).table);
208
- (_protected_code_)((Array as any).prototype.table);
209
- (Array as any).prototype.sum = function ():number {
210
- return this.reduce(function (prev:any, current:any) {
211
- return (__to_number(prev)) + (__to_number(current));
212
- }, 0) as number;
213
- };
214
- (Array as any).sum = function (a:any):number {
215
- return a.sum() as number;
216
- };
217
- (_protected_code_)((Array as any).sum);
218
- (_protected_code_)((Array as any).prototype.sum);
219
- (Array as any).prototype.avg = function ():number {
220
- return (this.length < 1) ? (0) : (this.reduce(function (prev:any, current:any) {
221
- return (((__to_number(prev)) + (__to_number(current))) / 2);
222
- })) as number;
223
- };
224
- (Array as any).avg = function (a:any):number {
225
- return a.avg() as number;
226
- };
227
- (_protected_code_)((Array as any).avg);
228
- (_protected_code_)((Array as any).prototype.avg);
229
- (Array as any).prototype.min = function ():number {
230
- return this.reduce(function (prev:number, current:number) {
231
- return (__to_number(prev) <= __to_number(current)) ? (prev) : (current);
232
- }, Infinity) as number;
233
- };
234
- (Array as any).min = function (a:any):number {
235
- return a.min() as number;
236
- };
237
- (_protected_code_)((Array as any).min);
238
- (_protected_code_)((Array as any).prototype.min);
239
- (Array as any).prototype.max = function ():number {
240
- return this.reduce(function (prev:number, current:number) {
241
- return (__to_number(prev) >= __to_number(current)) ? (prev) : (current);
242
- }, 0) as number;
243
- };
244
- (Array as any).max = function (a:any):number {
245
- return a.max() as number;
246
- };
247
- (_protected_code_)((Array as any).max);
248
- (_protected_code_)((Array as any).prototype.max);
249
- (Array as any).prototype.sortBy = function (propName:string, sortAsc = true):Array<any>[] {
250
- const sort_function = (sortAsc) ? (
251
- function (prev:any, current:any) {
252
- return current[propName] < prev[propName] ? 1 : -1;
253
- }
254
- ) : (
255
- function (prev:any, current:any) {
256
- return current[propName] > prev[propName] ? 1 : -1;
257
- }
258
- );
259
- return this.sort(sort_function) as Array<any>[];
152
+ }
153
+
154
+
155
+
156
+ if (isBrowser) {
157
+ window.onload = _Ready;
158
+ if (is_phonegap) {
159
+ document.addEventListener("deviceready", _Ready, captureFalseTouch as any);
160
+ }
161
+ } else {
162
+ global.onload = _Ready;
163
+ }
164
+
165
+ if (isBrowser) {
166
+ window.addEventListener("popstate", function (popStateEvent) {
167
+ popStateEvent.stopImmediatePropagation();
168
+ popStateEvent.stopPropagation();
169
+ Component.route()
170
+ .catch((e: any) => { throw new Error(`An error ocurred when trying to load initial routes. ${e}`); });
171
+ });
172
+ }
173
+
174
+
175
+
176
+ Export(serviceLoader);
177
+ Export(componentLoader);
178
+ Export(ComponentURI);
179
+ Export(ObjectName);
180
+ Export(_DataStringify);
181
+ Export(isQCObjects_Class);
182
+ Export(isQCObjects_Object);
183
+ Export(NamespaceRef);
184
+
185
+ /**
186
+ * Array math functions
187
+ */
188
+ // eslint-disable-next-line no-unused-vars
189
+ (Array as any).prototype.unique = function <T>(this: T[]): T[] {
190
+ return this.filter(function (value: any, index: any, self: any) {
191
+ return self.indexOf(value) === index;
192
+ });
193
+ };
194
+ (Array as any).unique = function <T>(a: Array<T>): T[] {
195
+ return (a as any).unique() as T[];
196
+ };
197
+ (_protected_code_)((Array as any).unique);
198
+ (_protected_code_)((Array as any).prototype.unique);
199
+ (Array as any).prototype.table = function (): void {
200
+ console.table(this);
201
+ };
202
+ (Array as any).table = function (a: any): void {
203
+ a.table();
204
+ return;
205
+ };
206
+ (_protected_code_)((Array as any).table);
207
+ (_protected_code_)((Array as any).prototype.table);
208
+ (Array as any).prototype.sum = function (): number {
209
+ return this.reduce(function (prev: any, current: any) {
210
+ return (__to_number(prev)) + (__to_number(current));
211
+ }, 0) as number;
212
+ };
213
+ (Array as any).sum = function (a: any): number {
214
+ return a.sum() as number;
215
+ };
216
+ (_protected_code_)((Array as any).sum);
217
+ (_protected_code_)((Array as any).prototype.sum);
218
+ (Array as any).prototype.avg = function (): number {
219
+ return (this.length < 1) ? (0) : (this.reduce(function (prev: any, current: any) {
220
+ return (((__to_number(prev)) + (__to_number(current))) / 2);
221
+ })) as number;
222
+ };
223
+ (Array as any).avg = function (a: any): number {
224
+ return a.avg() as number;
225
+ };
226
+ (_protected_code_)((Array as any).avg);
227
+ (_protected_code_)((Array as any).prototype.avg);
228
+ (Array as any).prototype.min = function (): number {
229
+ return this.reduce(function (prev: number, current: number) {
230
+ return (__to_number(prev) <= __to_number(current)) ? (prev) : (current);
231
+ }, Infinity) as number;
232
+ };
233
+ (Array as any).min = function (a: any): number {
234
+ return a.min() as number;
235
+ };
236
+ (_protected_code_)((Array as any).min);
237
+ (_protected_code_)((Array as any).prototype.min);
238
+ (Array as any).prototype.max = function (): number {
239
+ return this.reduce(function (prev: number, current: number) {
240
+ return (__to_number(prev) >= __to_number(current)) ? (prev) : (current);
241
+ }, 0) as number;
242
+ };
243
+ (Array as any).max = function (a: any): number {
244
+ return a.max() as number;
245
+ };
246
+ (_protected_code_)((Array as any).max);
247
+ (_protected_code_)((Array as any).prototype.max);
248
+ (Array as any).prototype.sortBy = function (propName: string, sortAsc = true): Array<any>[] {
249
+ const sort_function = (sortAsc) ? (
250
+ function (prev: any, current: any) {
251
+ return current[propName] < prev[propName] ? 1 : -1;
252
+ }
253
+ ) : (
254
+ function (prev: any, current: any) {
255
+ return current[propName] > prev[propName] ? 1 : -1;
256
+ }
257
+ );
258
+ return this.sort(sort_function) as Array<any>[];
259
+ };
260
+ (Array as any).sortBy = function (a: any, propName: string, sortAsc = true): Array<any>[] {
261
+ return a.sortBy(propName, sortAsc) as Array<any>[];
262
+ };
263
+ (_protected_code_)((Array as any).sortBy);
264
+ (_protected_code_)((Array as any).prototype.sortBy);
265
+
266
+ /**
267
+ * Extends the Array prototype to include a method that creates a matrix (2D array)
268
+ * with specified dimensions and fill value.
269
+ *
270
+ * @param {number} _length - The number of rows in the matrix.
271
+ * @param {any} [_fillValue=0] - The value to fill the matrix with (default is 0).
272
+ * @returns {Array<Array<any>>} A 2D array (matrix) filled with the specified value.
273
+ *
274
+ * @example
275
+ * // Create a 3x3 matrix filled with zeros
276
+ * const matrix = [].matrix(3);
277
+ * console.log(matrix);
278
+ * // Output: [0, 0, 0]
279
+ *
280
+ * @example
281
+ * // Create a 2x4 matrix filled with a specific value
282
+ * const matrix = [].matrix(2, 5);
283
+ * console.log(matrix);
284
+ * // Output: [5, 5]
285
+ *
286
+ * @example
287
+ * // Create a 4x2 matrix filled with null values
288
+ * const matrix = [].matrix(4, null);
289
+ * console.log(matrix);
290
+ * // Output: [null, null, null, null]
291
+ */
292
+ (Array as any).prototype.matrix = function (_length: number, _fillValue = 0) {
293
+ // eslint-disable-next-line no-unused-vars
294
+ const x_func = function (x = undefined) {
295
+ return _fillValue;
260
296
  };
261
- (Array as any).sortBy = function (a:any, propName:string, sortAsc = true):Array<any>[] {
262
- return a.sortBy(propName, sortAsc) as Array<any>[];
297
+ return Array.from({
298
+ length: _length
299
+ }, x_func);
300
+ };
301
+
302
+ /**
303
+ * Creates a matrix (2D array) from a given array.
304
+ *
305
+ * This function extends the Array constructor by adding a static method
306
+ * that generates a matrix with specified dimensions and fill value.
307
+ *
308
+ * @function
309
+ * @param {Array} a - The input array used to generate the matrix.
310
+ * @param {number} _length - The length of the matrix (number of rows).
311
+ * @param {number} [_fillValue=0] - The value to fill the matrix with (default is 0).
312
+ * @returns {Array} A 2D array (matrix) created from the input parameters.
313
+ *
314
+ * @example
315
+ * const myMatrix = Array.matrix(2, 5);
316
+ * // myMatrix will be [5, 5, 5]
317
+ */
318
+ (Array as any).matrix = function <T>(a: any, _length: number, _fillValue = 0): T[] {
319
+ return a.matrix(_length, _fillValue) as T[];
320
+ };
321
+
322
+ (_protected_code_)((Array as any).matrix);
323
+ (_protected_code_)((Array as any).prototype.matrix);
324
+
325
+
326
+ (Array as any).prototype.matrix2d = function (_length: number, _fillValue = 0) {
327
+ // eslint-disable-next-line no-unused-vars
328
+ const y_func = function (y: any) {
329
+ return _fillValue;
263
330
  };
264
- (_protected_code_)((Array as any).sortBy);
265
- (_protected_code_)((Array as any).prototype.sortBy);
266
-
267
- /**
268
- * Extends the Array prototype to include a method that creates a matrix (2D array)
269
- * with specified dimensions and fill value.
270
- *
271
- * @param {number} _length - The number of rows in the matrix.
272
- * @param {any} [_fillValue=0] - The value to fill the matrix with (default is 0).
273
- * @returns {Array<Array<any>>} A 2D array (matrix) filled with the specified value.
274
- *
275
- * @example
276
- * // Create a 3x3 matrix filled with zeros
277
- * const matrix = [].matrix(3);
278
- * console.log(matrix);
279
- * // Output: [0, 0, 0]
280
- *
281
- * @example
282
- * // Create a 2x4 matrix filled with a specific value
283
- * const matrix = [].matrix(2, 5);
284
- * console.log(matrix);
285
- * // Output: [5, 5]
286
- *
287
- * @example
288
- * // Create a 4x2 matrix filled with null values
289
- * const matrix = [].matrix(4, null);
290
- * console.log(matrix);
291
- * // Output: [null, null, null, null]
292
- */
293
- (Array as any).prototype.matrix = function (_length:number, _fillValue = 0) {
294
- // eslint-disable-next-line no-unused-vars
295
- const x_func = function (x = undefined) {
296
- return _fillValue;
297
- };
331
+ // eslint-disable-next-line no-unused-vars
332
+ const x_func = function (x: any) {
298
333
  return Array.from({
299
334
  length: _length
300
- }, x_func);
335
+ }, y_func);
301
336
  };
302
-
303
- /**
304
- * Creates a matrix (2D array) from a given array.
305
- *
306
- * This function extends the Array constructor by adding a static method
307
- * that generates a matrix with specified dimensions and fill value.
308
- *
309
- * @function
310
- * @param {Array} a - The input array used to generate the matrix.
311
- * @param {number} _length - The length of the matrix (number of rows).
312
- * @param {number} [_fillValue=0] - The value to fill the matrix with (default is 0).
313
- * @returns {Array} A 2D array (matrix) created from the input parameters.
314
- *
315
- * @example
316
- * const myMatrix = Array.matrix(2, 5);
317
- * // myMatrix will be [5, 5, 5]
318
- */
319
- (Array as any).matrix = function <T>(a:any, _length:number, _fillValue = 0):T[] {
320
- return a.matrix(_length, _fillValue) as T[];
321
- };
322
-
323
- (_protected_code_)((Array as any).matrix);
324
- (_protected_code_)((Array as any).prototype.matrix);
325
-
326
-
327
- (Array as any).prototype.matrix2d = function (_length:number, _fillValue = 0) {
328
- // eslint-disable-next-line no-unused-vars
329
- const y_func = function (y:any) {
330
- return _fillValue;
331
- };
332
- // eslint-disable-next-line no-unused-vars
333
- const x_func = function (x:any) {
334
- return Array.from({
335
- length: _length
336
- }, y_func);
337
- };
337
+ return Array.from({
338
+ length: _length
339
+ }, x_func);
340
+ };
341
+ (Array as any).matrix2d = function <T>(a: any, _length: number, _fillValue = 0): T[][] {
342
+ return a.matrix2d(_length, _fillValue) as T[][];
343
+ };
344
+
345
+ (_protected_code_)((Array as any).matrix2d);
346
+ (_protected_code_)((Array as any).prototype.matrix2d);
347
+
348
+ (Array as any).prototype.matrix3d = function (_length: number, _fillValue = 0) {
349
+ // eslint-disable-next-line no-unused-vars
350
+ const y_func = function (y: any) {
338
351
  return Array.from({
339
352
  length: _length
340
- }, x_func);
341
- };
342
- (Array as any).matrix2d = function <T>(a:any, _length:number, _fillValue = 0):T[][] {
343
- return a.matrix2d(_length, _fillValue) as T[][];
353
+ }, function () {
354
+ return _fillValue;
355
+ });
344
356
  };
345
-
346
- (_protected_code_)((Array as any).matrix2d);
347
- (_protected_code_)((Array as any).prototype.matrix2d);
348
-
349
- (Array as any).prototype.matrix3d = function (_length:number, _fillValue = 0) {
350
- // eslint-disable-next-line no-unused-vars
351
- const y_func = function (y:any) {
352
- return Array.from({
353
- length: _length
354
- }, function () {
355
- return _fillValue;
356
- });
357
- };
358
- // eslint-disable-next-line no-unused-vars
359
- const x_func = function (x:any) {
360
- return Array.from({
361
- length: _length
362
- }, y_func);
363
- };
357
+ // eslint-disable-next-line no-unused-vars
358
+ const x_func = function (x: any) {
364
359
  return Array.from({
365
360
  length: _length
366
- }, x_func);
361
+ }, y_func);
367
362
  };
368
-
369
- (Array as any).matrix3d = function <T>(a:any, _length:number, _fillValue = 0):T[][][] {
370
- return a.matrix3d(_length, _fillValue) as T[][][];
371
- };
372
-
373
-
374
- (_protected_code_)((Array as any).matrix3d);
375
- (_protected_code_)((Array as any).prototype.matrix3d);
376
-
377
-
378
-
379
- (String as unknown as any).prototype.list = function ():string[] {
380
- const __instance = this;
381
- return range(0, __instance.length - 1).map(function <T>(i:any):T {
382
- return __instance[i] as T;
383
- }) as string[];
384
- };
385
- (_protected_code_)((String as unknown as any).prototype.list);
386
-
387
-
388
-
389
- /**
390
- * End of array math functions
391
- */
392
-
393
-
394
-
395
- setDefaultProcessors();
396
-
397
-
398
- /**
399
- * Load every component tag declared in the body
400
- **/
401
- Ready(function () {
402
- if (!CONFIG.get("useSDK")) {
403
- GlobalSettings.__start__()
404
- .catch ((e:any) => {
405
- throw Error (e);
363
+ return Array.from({
364
+ length: _length
365
+ }, x_func);
366
+ };
367
+
368
+ (Array as any).matrix3d = function <T>(a: any, _length: number, _fillValue = 0): T[][][] {
369
+ return a.matrix3d(_length, _fillValue) as T[][][];
370
+ };
371
+
372
+
373
+ (_protected_code_)((Array as any).matrix3d);
374
+ (_protected_code_)((Array as any).prototype.matrix3d);
375
+
376
+
377
+
378
+ (String as unknown as any).prototype.list = function (): string[] {
379
+ const __instance = this;
380
+ return range(0, __instance.length - 1).map(function <T>(i: any): T {
381
+ return __instance[i] as T;
382
+ }) as string[];
383
+ };
384
+ (_protected_code_)((String as unknown as any).prototype.list);
385
+
386
+
387
+
388
+ /**
389
+ * End of array math functions
390
+ */
391
+
392
+
393
+
394
+ setDefaultProcessors();
395
+
396
+
397
+ /**
398
+ * Load every component tag declared in the body
399
+ **/
400
+ Ready(function () {
401
+ if (!CONFIG.get("useSDK")) {
402
+ GlobalSettings.__start__()
403
+ .catch((e: any) => {
404
+ throw Error(e);
406
405
  });
407
- }
408
- });
409
-
410
- /*
411
- Public variables and functions
412
- */
413
- Export(Export); /* exports the same Export function once */
414
- Export(Import);
415
- Export(Package);
416
- Export(Class);
417
- Export(New);
418
- Export(Tag);
419
- Export(Ready);
420
- Export(ready);
421
- Export(isBrowser);
422
- Export(_methods_);
423
- Export(GlobalSettings);
424
-
425
-
426
- (function (_top) {
427
-
428
- Object.defineProperty(_top, "PackagesNameList", {
429
- // eslint-disable-next-line no-unused-vars
430
- set(val) {
431
- logger.debug("PackagesNameList is readonly");
432
-
433
- },
434
- get() {
435
- const _get_packages_names = function <T>(_packages:any):T[] {
436
- let _keys:any[] = [];
437
- for (const _k of Object.keys(_packages)) {
438
- if (
439
- typeof _packages[_k] !== "undefined" &&
440
- typeof _packages[_k] !== "function" &&
441
- Object.hasOwn(_packages[_k], "length") &&
442
- _packages[_k].length > 0
443
- ) {
444
- _keys.push(_k);
445
- _keys = _keys.concat(_get_packages_names(_packages[_k]));
446
- }
447
- }
448
- return _keys as T[];
449
- };
450
- return _get_packages_names(_QC_PACKAGES);
451
- }
452
- });
453
-
454
- Object.defineProperty(_top, "PackagesList", {
455
- // eslint-disable-next-line no-unused-vars
456
- set(value) {
457
- logger.debug("PackagesList is readonly");
458
-
459
- },
460
- get():any {
461
- return _top.PackagesNameList.map(function <T>(packagename:string):T {
462
- const _classesList:any[] = Package(packagename) as any[];
463
- let _ret_:any = undefined;
464
- if (_classesList) {
465
- _ret_= {
466
- packageName: packagename,
467
- classesList: _classesList.filter(function (_packageClass:any):boolean {
468
- return isQCObjects_Class(_packageClass);
469
- })
470
- };
471
- }
472
- return _ret_ as T;
473
- }).filter(function (_p:any):boolean {
474
- return typeof _p !== "undefined";
475
- });
476
- }
477
- });
478
-
479
- Object.defineProperty(_top, "ClassesList", {
480
- // eslint-disable-next-line no-unused-vars
481
- set(value) {
482
- logger.debug("ClassesList is readonly");
483
-
484
- },
485
- get():any {
486
- let _classesList:any[] = [];
487
- _top.PackagesList.map(function <T>(_package_element:any):T {
488
- _classesList = _classesList.concat(_package_element.classesList.map(
489
- function (_class_element:any) {
490
- return {
491
- packageName: _package_element.packageName,
492
- className: _package_element.packageName + "." + _class_element.__definition.__classType,
493
- classFactory: _class_element
494
- };
495
- }
496
- ));
497
- return _package_element as T;
498
- });
499
-
500
- return _classesList;
501
- }
502
- });
503
-
504
- Object.defineProperty(_top, "ClassesNameList", {
505
- // eslint-disable-next-line no-unused-vars
506
- set(value) {
507
- logger.debug("ClassesNameList is readonly");
508
-
509
- },
510
- get():any {
511
- return _top.ClassesList.map(function <T>(_class_element:any):T {
512
- return _class_element.className as T;
513
- });
514
- }
515
- });
516
-
517
- if (isBrowser) {
518
- // use of GLOBAL word is deprecated in node.js
519
- // this is only for compatibility purpose with old versions of QCObjects in browsers
520
- Class("GLOBAL", (_QC_CLASSES as any).global); // case insensitive for compatibility con old versions;
521
- Export(ClassFactory("GLOBAL"));
522
- }
406
+ }
407
+ });
523
408
 
524
- if (isBrowser && typeof window !== "undefined"){
525
- set("global", window);
526
- } else if (typeof global !== "undefined" ){
527
- set("global", global);
528
- } else if (typeof globalThis !== "undefined") {
529
- set("global", globalThis);
530
- }
531
-
532
- loadSDK();
533
- })(_top);
534
-
535
- if (isBrowser) {
536
- asyncLoad(function ():any {
537
- Ready(function () {
538
-
539
- /*
540
- * scroll management custom events
541
- * usage: document.addEventListener('percentY90',function(e){console.log(e.detail.percentY)});
542
- * possible events: scrollpercent, defaultscroll, percentY0, percentY25, percentY50, percentY75, percentY90
543
- */
544
-
545
- (function (_top) {
546
- let ticking = false;
547
- const scrollHeight = Math.max(
548
- document.body.scrollHeight, document.documentElement.scrollHeight,
549
- document.body.offsetHeight, document.documentElement.offsetHeight,
550
- document.body.clientHeight, document.documentElement.clientHeight
551
- );
552
-
553
- const scrollWidth = Math.max(
554
- document.body.scrollWidth, document.documentElement.scrollWidth,
555
- document.body.offsetWidth, document.documentElement.offsetWidth,
556
- document.body.clientWidth, document.documentElement.clientWidth
557
- );
558
-
559
- function scrollDispatcher(event:any) {
560
- const percentY = Math.round(_top.scrollY * 100 / scrollHeight);
561
- const percentX = Math.round(_top.scrollX * 100 / scrollWidth);
562
- const scrollPercentEventEvent = new CustomEvent("scrollpercent", {
409
+ /*
410
+ Public variables and functions
411
+ */
412
+ Export(Export); /* exports the same Export function once */
413
+ Export(Import);
414
+ Export(Package);
415
+ Export(Class);
416
+ Export(New);
417
+ Export(Tag);
418
+ Export(Ready);
419
+ Export(ready);
420
+ Export(isBrowser);
421
+ Export(_methods_);
422
+ Export(GlobalSettings);
423
+
424
+
425
+ (loadSDK)();
426
+
427
+ if (isBrowser) {
428
+ asyncLoad(function (): any {
429
+ Ready(function () {
430
+
431
+ /*
432
+ * scroll management custom events
433
+ * usage: document.addEventListener('percentY90',function(e){console.log(e.detail.percentY)});
434
+ * possible events: scrollpercent, defaultscroll, percentY0, percentY25, percentY50, percentY75, percentY90
435
+ */
436
+
437
+ (function (_top) {
438
+ let ticking = false;
439
+ const scrollHeight = Math.max(
440
+ document.body.scrollHeight, document.documentElement.scrollHeight,
441
+ document.body.offsetHeight, document.documentElement.offsetHeight,
442
+ document.body.clientHeight, document.documentElement.clientHeight
443
+ );
444
+
445
+ const scrollWidth = Math.max(
446
+ document.body.scrollWidth, document.documentElement.scrollWidth,
447
+ document.body.offsetWidth, document.documentElement.offsetWidth,
448
+ document.body.clientWidth, document.documentElement.clientWidth
449
+ );
450
+
451
+ function scrollDispatcher(event: any) {
452
+ const percentY = Math.round(_top.scrollY * 100 / scrollHeight);
453
+ const percentX = Math.round(_top.scrollX * 100 / scrollWidth);
454
+ const scrollPercentEventEvent = new CustomEvent("scrollpercent", {
455
+ detail: {
456
+ percentX,
457
+ percentY
458
+ }
459
+ });
460
+ event.target.dispatchEvent(scrollPercentEventEvent);
461
+ let secondaryEventName = "defaultscroll";
462
+ const __valid_scrolls__ = [0, 5, 10, 25, 50, 75, 90, 95, 100];
463
+ __valid_scrolls__.filter(function (p) {
464
+ return p === percentY;
465
+ }).map(function <T>(pY: T): T {
466
+ secondaryEventName = "percentY" + percentY.toString();
467
+ const secondaryCustomEvent = new CustomEvent(secondaryEventName, {
563
468
  detail: {
564
469
  percentX,
565
470
  percentY
566
471
  }
567
472
  });
568
- event.target.dispatchEvent(scrollPercentEventEvent);
569
- let secondaryEventName = "defaultscroll";
570
- const __valid_scrolls__ = [0, 5, 10, 25, 50, 75, 90, 95, 100];
571
- __valid_scrolls__.filter(function (p) {
572
- return p === percentY;
573
- }).map(function <T>(pY:T):T {
574
- secondaryEventName = "percentY" + percentY.toString();
575
- const secondaryCustomEvent = new CustomEvent(secondaryEventName, {
576
- detail: {
577
- percentX,
578
- percentY
579
- }
580
- });
581
- event.target.dispatchEvent(secondaryCustomEvent);
582
- return pY;
473
+ event.target.dispatchEvent(secondaryCustomEvent);
474
+ return pY;
475
+ });
476
+
477
+ }
478
+
479
+ document.addEventListener("scroll", function (event) {
480
+
481
+ if (!ticking) {
482
+ requestAnimationFrame(function () {
483
+ scrollDispatcher(event);
484
+ ticking = false;
583
485
  });
584
-
486
+
487
+ ticking = true;
585
488
  }
586
-
587
- document.addEventListener("scroll", function (event) {
588
-
589
- if (!ticking) {
590
- requestAnimationFrame(function () {
591
- scrollDispatcher(event);
592
- ticking = false;
593
- });
594
-
595
- ticking = true;
596
- }
597
- });
598
-
599
- })(_top);
600
-
601
- });
602
- }, []);
489
+ });
490
+
491
+ })(_top);
492
+
493
+ });
494
+ }, []);
495
+ }
496
+
497
+ if (!isBrowser) {
498
+ if (typeof _top.global !== "undefined" && Object.hasOwn(_top.global, "_fireAsyncLoad")) {
499
+ _fireAsyncLoad.call(_top);
603
500
  }
604
-
605
- if (!isBrowser) {
606
- if (typeof _top.global !== "undefined" && Object.hasOwn(_top.global, "_fireAsyncLoad")) {
607
- _fireAsyncLoad.call(_top);
608
- }
609
- if (typeof _top.global !== "undefined" && Object.hasOwn(_top.global, "onload")) {
610
- _top.global.onload.call(_top);
611
- }
501
+ if (typeof _top.global !== "undefined" && Object.hasOwn(_top.global, "onload")) {
502
+ _top.global.onload.call(_top);
612
503
  }
613
-
614
-
615
- /* Freezing Object && Object.prototype to prevent prototype pollution risks */
616
- (function (isBrowser) {
617
- const __freeze__ = function () {
618
- Object.freeze(Object.prototype);
619
- Object.freeze(Object);
620
- };
621
- if (isBrowser && CONFIG.get("secureObjects", false)) {
622
- Ready(function () {
623
- __freeze__();
624
- });
625
- } else if (CONFIG.get("secureObjects", false)) {
626
- __freeze__();
627
- }
628
- })(isBrowser);
629
504
  }
630
-
631
- })(_top);
632
-
505
+
506
+
507
+ /* Freezing Object && Object.prototype to prevent prototype pollution risks */
508
+ (function (isBrowser) {
509
+ const __freeze__ = function () {
510
+ Object.freeze(Object.prototype);
511
+ Object.freeze(Object);
512
+ };
513
+ if (isBrowser && CONFIG.get("secureObjects", false)) {
514
+ Ready(function () {
515
+ __freeze__();
516
+ });
517
+ } else if (CONFIG.get("secureObjects", false)) {
518
+ __freeze__();
519
+ }
520
+ })(isBrowser);
521
+ }
522
+
523
+ })(_top);