qcobjects 2.4.107-ts → 2.4.108-ts

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.
Files changed (197) hide show
  1. package/.hintrc +5 -0
  2. package/VERSION +1 -1
  3. package/build/ArrayCollection.js +136 -0
  4. package/build/BackendMicroservice.js +211 -0
  5. package/build/Base64.js +100 -0
  6. package/build/CONFIG.js +85 -0
  7. package/build/Cast.js +53 -0
  8. package/build/Class.js +284 -0
  9. package/build/ClassFactory.js +38 -0
  10. package/build/ComplexStorageCache.js +91 -0
  11. package/build/Component.js +1133 -0
  12. package/build/ComponentFactory.js +113 -0
  13. package/build/ConfigSettings.js +39 -0
  14. package/build/Controller.js +81 -0
  15. package/build/Crypt.js +87 -0
  16. package/build/DDO.js +81 -0
  17. package/build/DOMCreateElement.js +15 -0
  18. package/build/DataStringify.js +22 -0
  19. package/build/DefaultTemplateHandler.js +57 -0
  20. package/build/DocumentLayout.js +20 -0
  21. package/build/Effect.js +46 -0
  22. package/build/Export.js +11 -0
  23. package/build/Import.js +140 -0
  24. package/build/IncrementInstanceID.js +11 -0
  25. package/build/InheritClass.js +194 -0
  26. package/build/LegacyCopy.js +31 -0
  27. package/build/Logger.js +33 -0
  28. package/build/MainProcess.js +549 -0
  29. package/build/NamespaceRef.js +29 -0
  30. package/build/New.js +17 -0
  31. package/build/ObjectName.js +22 -0
  32. package/build/Package.js +67 -0
  33. package/build/PrimaryCollections.js +7 -0
  34. package/build/Processor.js +81 -0
  35. package/build/QCObjects.js +182 -4843
  36. package/build/Ready.js +49 -0
  37. package/build/RegisterClass.js +28 -0
  38. package/build/Service.js +112 -0
  39. package/build/SourceCSS.js +56 -0
  40. package/build/SourceJS.js +73 -0
  41. package/build/Tag.js +77 -0
  42. package/build/Timer.js +30 -0
  43. package/build/Toggle.js +59 -0
  44. package/build/TransitionEffect.js +65 -0
  45. package/build/VO.js +11 -0
  46. package/build/View.js +18 -0
  47. package/build/WidgetsFactory.js +537 -0
  48. package/build/assign.js +32 -0
  49. package/build/asyncLoad.js +43 -0
  50. package/build/basePath.js +32 -0
  51. package/build/captureFalseTouch.js +32 -0
  52. package/build/componentLoader.js +258 -0
  53. package/build/defaultProcessors.js +130 -0
  54. package/build/domain.js +4 -0
  55. package/build/findPackageNodePath.js +47 -0
  56. package/build/getType.js +38 -0
  57. package/build/globalSettings.js +115 -0
  58. package/build/index.d.ts +1045 -0
  59. package/build/index.js +24 -4
  60. package/build/index.mjs +1 -1
  61. package/build/introspection.js +86 -0
  62. package/build/isQCObjects.js +20 -0
  63. package/build/is_a.js +19 -0
  64. package/build/is_forbidden_name.js +15 -0
  65. package/build/is_raw_class.js +7 -0
  66. package/build/loadSDK.js +63 -0
  67. package/build/localStorage.js +19 -0
  68. package/build/make_global.js +24 -0
  69. package/build/mathFunctions.js +7 -0
  70. package/build/platform.js +28 -0
  71. package/build/range.js +17 -0
  72. package/build/routings.js +21 -0
  73. package/build/secretKey.js +5 -0
  74. package/build/serviceLoader.js +300 -0
  75. package/build/shortCode.js +14 -0
  76. package/build/subelements.js +8 -0
  77. package/build/super.js +20 -0
  78. package/build/tag_filter.js +4 -0
  79. package/build/top.js +23 -0
  80. package/build/uniqueID.js +5 -0
  81. package/build/waitUntil.js +31 -0
  82. package/build-esbuild.js +62 -0
  83. package/eslint.config.mjs +87 -0
  84. package/package.json +26 -23
  85. package/public/browser/index.js +6502 -0
  86. package/public/browser/index.js.map +7 -0
  87. package/public/cjs/index.cjs +6586 -0
  88. package/public/cjs/index.cjs.map +7 -0
  89. package/public/esm/index.mjs +6494 -0
  90. package/public/esm/index.mjs.map +7 -0
  91. package/spec/helpers/mock-sdk.helper.ts +5 -0
  92. package/spec/mocks/qcobjects-sdk.mock.ts +1 -0
  93. package/spec/support/jasmine.json +3 -3
  94. package/spec/testsClassFactorySpec.ts +40 -0
  95. package/spec/{testsConfigSpec.js → testsConfigSpec.ts} +2 -2
  96. package/spec/{testsGlobalFeaturesSpec.js → testsGlobalFeaturesSpec.ts} +10 -8
  97. package/spec/{testsSpec.js → testsSpec.ts} +11 -10
  98. package/spec/{testsTypeSpec.js → testsTypeSpec.ts} +5 -3
  99. package/src/ArrayCollection.ts +143 -0
  100. package/src/BackendMicroservice.ts +229 -0
  101. package/src/Base64.ts +92 -0
  102. package/src/CONFIG.ts +96 -0
  103. package/src/Cast.ts +46 -0
  104. package/src/Class.ts +303 -0
  105. package/src/ClassFactory.ts +34 -0
  106. package/src/ComplexStorageCache.ts +97 -0
  107. package/src/Component.ts +1222 -0
  108. package/src/ComponentFactory.ts +122 -0
  109. package/src/ConfigSettings.ts +62 -0
  110. package/src/Controller.ts +90 -0
  111. package/src/Crypt.ts +87 -0
  112. package/src/DDO.ts +93 -0
  113. package/src/DOMCreateElement.ts +12 -0
  114. package/src/DataStringify.ts +19 -0
  115. package/src/DefaultTemplateHandler.ts +55 -0
  116. package/src/DocumentLayout.ts +16 -0
  117. package/src/Effect.ts +56 -0
  118. package/src/Export.ts +8 -0
  119. package/src/Import.ts +135 -0
  120. package/src/IncrementInstanceID.ts +8 -0
  121. package/src/InheritClass.ts +210 -0
  122. package/src/LegacyCopy.ts +27 -0
  123. package/src/Logger.ts +32 -0
  124. package/src/MainProcess.ts +629 -0
  125. package/src/NamespaceRef.ts +26 -0
  126. package/src/New.ts +15 -0
  127. package/src/ObjectName.ts +16 -0
  128. package/src/Package.ts +67 -0
  129. package/src/PrimaryCollections.ts +7 -0
  130. package/src/Processor.ts +93 -0
  131. package/src/QCObjects.ts +100 -0
  132. package/src/Ready.ts +44 -0
  133. package/src/RegisterClass.ts +26 -0
  134. package/src/Service.ts +127 -0
  135. package/src/SourceCSS.ts +59 -0
  136. package/src/SourceJS.ts +76 -0
  137. package/src/Tag.ts +76 -0
  138. package/src/Timer.ts +42 -0
  139. package/src/Toggle.ts +65 -0
  140. package/src/TransitionEffect.ts +80 -0
  141. package/src/VO.ts +8 -0
  142. package/src/View.ts +17 -0
  143. package/src/WidgetsFactory.ts +543 -0
  144. package/src/assign.ts +33 -0
  145. package/src/asyncLoad.ts +42 -0
  146. package/src/basePath.ts +29 -0
  147. package/src/captureFalseTouch.ts +29 -0
  148. package/src/componentLoader.ts +252 -0
  149. package/src/defaultProcessors.ts +145 -0
  150. package/src/domain.ts +1 -0
  151. package/src/findPackageNodePath.ts +43 -0
  152. package/src/getType.ts +36 -0
  153. package/src/globalSettings.ts +118 -0
  154. package/src/index.mts +1 -1
  155. package/src/index.ts +1 -1
  156. package/src/introspection.ts +80 -0
  157. package/src/isQCObjects.ts +19 -0
  158. package/src/is_a.ts +16 -0
  159. package/src/is_forbidden_name.ts +12 -0
  160. package/src/is_raw_class.ts +3 -0
  161. package/src/loadSDK.ts +59 -0
  162. package/src/localStorage.ts +17 -0
  163. package/src/make_global.ts +19 -0
  164. package/src/mathFunctions.ts +3 -0
  165. package/src/platform.ts +30 -0
  166. package/src/range.ts +15 -0
  167. package/src/routings.ts +18 -0
  168. package/src/secretKey.ts +3 -0
  169. package/src/serviceLoader.ts +306 -0
  170. package/src/shortCode.ts +11 -0
  171. package/src/subelements.ts +4 -0
  172. package/src/super.ts +17 -0
  173. package/src/tag_filter.ts +1 -0
  174. package/src/top.ts +111 -0
  175. package/src/types/global/index.d.ts +597 -0
  176. package/src/uniqueID.ts +3 -0
  177. package/src/waitUntil.ts +26 -0
  178. package/tsconfig.d.json +35 -8
  179. package/tsconfig.jasmine.json +39 -0
  180. package/tsconfig.json +46 -12
  181. package/.eslintignore +0 -5
  182. package/.eslintrc.cjs +0 -21
  183. package/.eslintrc.json +0 -24
  184. package/browser/QCObjects.js +0 -2
  185. package/browser/QCObjects.js.map +0 -7
  186. package/browser/chunks/chunk-O2PFFZVJ.js +0 -713
  187. package/browser/chunks/chunk-O2PFFZVJ.js.map +0 -7
  188. package/browser/chunks/chunk-TBLBK5VV.js +0 -713
  189. package/browser/chunks/chunk-TBLBK5VV.js.map +0 -7
  190. package/browser/chunks/chunk-ZYLXOA35.js +0 -713
  191. package/browser/chunks/chunk-ZYLXOA35.js.map +0 -7
  192. package/browser/index.js +0 -2
  193. package/browser/index.js.map +0 -7
  194. package/spec/testsClassFactorySpec.js +0 -41
  195. package/src/QCObjects.js +0 -5247
  196. package/src/index.d.ts +0 -8
  197. package/types/index.d.ts +0 -472
@@ -0,0 +1,549 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const asyncLoad_1 = require("./asyncLoad");
7
+ const captureFalseTouch_1 = require("./captureFalseTouch");
8
+ const Cast_1 = require("./Cast");
9
+ const Class_1 = require("./Class");
10
+ const ClassFactory_1 = require("./ClassFactory");
11
+ const Component_1 = require("./Component");
12
+ const ComponentFactory_1 = require("./ComponentFactory");
13
+ const componentLoader_1 = require("./componentLoader");
14
+ const CONFIG_1 = require("./CONFIG");
15
+ const DataStringify_1 = require("./DataStringify");
16
+ const defaultProcessors_1 = require("./defaultProcessors");
17
+ const Export_1 = require("./Export");
18
+ const Import_1 = require("./Import");
19
+ const introspection_1 = require("./introspection");
20
+ const isQCObjects_1 = require("./isQCObjects");
21
+ const Logger_1 = require("./Logger");
22
+ const mathFunctions_1 = require("./mathFunctions");
23
+ const NamespaceRef_1 = require("./NamespaceRef");
24
+ const New_1 = require("./New");
25
+ const ObjectName_1 = require("./ObjectName");
26
+ const Package_1 = require("./Package");
27
+ const platform_1 = require("./platform");
28
+ const PrimaryCollections_1 = require("./PrimaryCollections");
29
+ const Ready_1 = require("./Ready");
30
+ const serviceLoader_1 = require("./serviceLoader");
31
+ const Tag_1 = require("./Tag");
32
+ const top_1 = require("./top");
33
+ const Processor_1 = require("./Processor");
34
+ const is_a_1 = require("./is_a");
35
+ const getType_1 = require("./getType");
36
+ const shortCode_1 = require("./shortCode");
37
+ const DOMCreateElement_1 = require("./DOMCreateElement");
38
+ const ComplexStorageCache_1 = require("./ComplexStorageCache");
39
+ const super_1 = require("./super");
40
+ const waitUntil_1 = require("./waitUntil");
41
+ const subelements_1 = require("./subelements");
42
+ const globalSettings_1 = require("./globalSettings");
43
+ const loadSDK_1 = __importDefault(require("./loadSDK"));
44
+ (function __qcobjects__(_top) {
45
+ if (typeof Object.defineProperty !== "undefined" && typeof _top !== "undefined") {
46
+ try {
47
+ Object.defineProperty(_top, "__qcobjects__", {
48
+ enumerable: true,
49
+ configurable: false,
50
+ writable: false,
51
+ value: __qcobjects__,
52
+ });
53
+ }
54
+ catch (e) {
55
+ Logger_1.logger.debug(`An error ocurred: ${e}`);
56
+ if (typeof _top.__qcobjects__ !== "undefined") {
57
+ _top.__qcobjects__.loaded = true;
58
+ }
59
+ }
60
+ }
61
+ if (typeof _top.__qcobjects__.loaded === "undefined") {
62
+ _top.__qcobjects__.loaded = true;
63
+ const global = _top;
64
+ _top.global = global;
65
+ if (platform_1.isBrowser) {
66
+ Element.prototype.subelements = subelements_1.subelements;
67
+ Document.prototype.subelements = subelements_1.subelements;
68
+ HTMLElement.prototype.subelements = subelements_1.subelements;
69
+ if (typeof ShadowRoot !== "undefined") {
70
+ ShadowRoot.prototype.subelements = subelements_1.subelements;
71
+ }
72
+ }
73
+ Logger_1.logger.debugEnabled = false;
74
+ Logger_1.logger.infoEnabled = true;
75
+ _top.logger = Logger_1.logger;
76
+ /**
77
+ * Basic Type of all elements
78
+ */
79
+ if (platform_1.isBrowser) {
80
+ Element.prototype.find = function (tag) {
81
+ const _self = this;
82
+ const _oo = [];
83
+ const _tags = document.subelements(tag);
84
+ _tags.map((_tt, _t) => {
85
+ if ((typeof _tags[_t] !== "undefined") && _tags[_t].parentNode.tagName === _self.parentNode.tagName) {
86
+ _oo.push((0, Cast_1._Cast)(_tt, (new Object())));
87
+ }
88
+ return _tt;
89
+ });
90
+ return _oo;
91
+ };
92
+ }
93
+ if (platform_1.isBrowser) {
94
+ Element.prototype.append = function QC_Append(child) {
95
+ if ((0, isQCObjects_1.isQCObjects_Object)(child) || typeof child.body !== "undefined") {
96
+ this.appendChild(child.body);
97
+ }
98
+ else {
99
+ this.appendChild(child);
100
+ }
101
+ };
102
+ /**
103
+ * A replacement for direct using of innerHTML
104
+ * use: [element].render('content') where 'content' is the string corresponding
105
+ * to the DOM to insert in the element
106
+ **/
107
+ Element.prototype.render = function QC_Render(content) {
108
+ const _self = this;
109
+ const _appendVDOM = (_self, content) => {
110
+ if (typeof document.implementation.createHTMLDocument !== "undefined") {
111
+ const doc = document.implementation.createHTMLDocument("");
112
+ doc.body.innerHTML = content;
113
+ doc.body.subelements("*").map((element) => {
114
+ return _self.append(element);
115
+ });
116
+ }
117
+ };
118
+ if (typeof this.innerHTML !== "undefined") {
119
+ try {
120
+ this.innerHTML += content;
121
+ }
122
+ catch (e) {
123
+ Logger_1.logger.debug(`An error ocurred: ${e}`);
124
+ _appendVDOM(_self, content);
125
+ }
126
+ }
127
+ else {
128
+ _appendVDOM(_self, content);
129
+ }
130
+ };
131
+ }
132
+ (0, Export_1.Export)(waitUntil_1.waitUntil);
133
+ (0, Export_1.Export)(super_1._super_);
134
+ (0, Export_1.Export)(ComplexStorageCache_1.ComplexStorageCache);
135
+ (0, Export_1.Export)(ClassFactory_1.ClassFactory);
136
+ (0, Export_1.Export)(DOMCreateElement_1._DOMCreateElement);
137
+ (0, Export_1.Export)(shortCode_1.shortCode);
138
+ (0, Export_1.Export)(getType_1.__getType__);
139
+ (0, Export_1.Export)(is_a_1.is_a);
140
+ (0, Package_1.Package)("com.qcobjects", [Processor_1.Processor]);
141
+ if (platform_1.isBrowser) {
142
+ /**
143
+ * Adds a Cast functionality to every Element of DOM
144
+ */
145
+ Element.prototype.Cast = function QC_Cast(_o) {
146
+ const _self = this;
147
+ return (0, Cast_1._Cast)(_self, _o);
148
+ };
149
+ }
150
+ if (platform_1.isBrowser) {
151
+ window.onload = Ready_1._Ready;
152
+ if (platform_1.is_phonegap) {
153
+ document.addEventListener("deviceready", Ready_1._Ready, captureFalseTouch_1.captureFalseTouch);
154
+ }
155
+ }
156
+ else {
157
+ global.onload = Ready_1._Ready;
158
+ }
159
+ if (platform_1.isBrowser) {
160
+ window.addEventListener("popstate", function (popStateEvent) {
161
+ popStateEvent.stopImmediatePropagation();
162
+ popStateEvent.stopPropagation();
163
+ Component_1.Component.route()
164
+ .catch((e) => { throw new Error(`An error ocurred when trying to load initial routes. ${e}`); });
165
+ });
166
+ }
167
+ (0, Export_1.Export)(serviceLoader_1.serviceLoader);
168
+ (0, Export_1.Export)(componentLoader_1.componentLoader);
169
+ (0, Export_1.Export)(ComponentFactory_1.ComponentURI);
170
+ (0, Export_1.Export)(ObjectName_1.ObjectName);
171
+ (0, Export_1.Export)(DataStringify_1._DataStringify);
172
+ (0, Export_1.Export)(isQCObjects_1.isQCObjects_Class);
173
+ (0, Export_1.Export)(isQCObjects_1.isQCObjects_Object);
174
+ (0, Export_1.Export)(NamespaceRef_1.NamespaceRef);
175
+ /**
176
+ * Array math functions
177
+ */
178
+ // eslint-disable-next-line no-unused-vars
179
+ Array.prototype.unique = function () {
180
+ return this.filter(function (value, index, self) {
181
+ return self.indexOf(value) === index;
182
+ });
183
+ };
184
+ Array.unique = function (a) {
185
+ return a.unique();
186
+ };
187
+ (introspection_1._protected_code_)(Array.unique);
188
+ (introspection_1._protected_code_)(Array.prototype.unique);
189
+ Array.prototype.table = function () {
190
+ console.table(this);
191
+ };
192
+ Array.table = function (a) {
193
+ a.table();
194
+ return;
195
+ };
196
+ (introspection_1._protected_code_)(Array.table);
197
+ (introspection_1._protected_code_)(Array.prototype.table);
198
+ Array.prototype.sum = function () {
199
+ return this.reduce(function (prev, current) {
200
+ return ((0, mathFunctions_1.__to_number)(prev)) + ((0, mathFunctions_1.__to_number)(current));
201
+ }, 0);
202
+ };
203
+ Array.sum = function (a) {
204
+ return a.sum();
205
+ };
206
+ (introspection_1._protected_code_)(Array.sum);
207
+ (introspection_1._protected_code_)(Array.prototype.sum);
208
+ Array.prototype.avg = function () {
209
+ return (this.length < 1) ? (0) : (this.reduce(function (prev, current) {
210
+ return ((((0, mathFunctions_1.__to_number)(prev)) + ((0, mathFunctions_1.__to_number)(current))) / 2);
211
+ }));
212
+ };
213
+ Array.avg = function (a) {
214
+ return a.avg();
215
+ };
216
+ (introspection_1._protected_code_)(Array.avg);
217
+ (introspection_1._protected_code_)(Array.prototype.avg);
218
+ Array.prototype.min = function () {
219
+ return this.reduce(function (prev, current) {
220
+ return ((0, mathFunctions_1.__to_number)(prev) <= (0, mathFunctions_1.__to_number)(current)) ? (prev) : (current);
221
+ }, Infinity);
222
+ };
223
+ Array.min = function (a) {
224
+ return a.min();
225
+ };
226
+ (introspection_1._protected_code_)(Array.min);
227
+ (introspection_1._protected_code_)(Array.prototype.min);
228
+ Array.prototype.max = function () {
229
+ return this.reduce(function (prev, current) {
230
+ return ((0, mathFunctions_1.__to_number)(prev) >= (0, mathFunctions_1.__to_number)(current)) ? (prev) : (current);
231
+ }, 0);
232
+ };
233
+ Array.max = function (a) {
234
+ return a.max();
235
+ };
236
+ (introspection_1._protected_code_)(Array.max);
237
+ (introspection_1._protected_code_)(Array.prototype.max);
238
+ Array.prototype.sortBy = function (propName, sortAsc = true) {
239
+ const sort_function = (sortAsc) ? (function (prev, current) {
240
+ return current[propName] < prev[propName] ? 1 : -1;
241
+ }) : (function (prev, current) {
242
+ return current[propName] > prev[propName] ? 1 : -1;
243
+ });
244
+ return this.sort(sort_function);
245
+ };
246
+ Array.sortBy = function (a, propName, sortAsc = true) {
247
+ return a.sortBy(propName, sortAsc);
248
+ };
249
+ (introspection_1._protected_code_)(Array.sortBy);
250
+ (introspection_1._protected_code_)(Array.prototype.sortBy);
251
+ /**
252
+ * Extends the Array prototype to include a method that creates a matrix (2D array)
253
+ * with specified dimensions and fill value.
254
+ *
255
+ * @param {number} _length - The number of rows in the matrix.
256
+ * @param {any} [_fillValue=0] - The value to fill the matrix with (default is 0).
257
+ * @returns {Array<Array<any>>} A 2D array (matrix) filled with the specified value.
258
+ *
259
+ * @example
260
+ * // Create a 3x3 matrix filled with zeros
261
+ * const matrix = [].matrix(3);
262
+ * console.log(matrix);
263
+ * // Output: [0, 0, 0]
264
+ *
265
+ * @example
266
+ * // Create a 2x4 matrix filled with a specific value
267
+ * const matrix = [].matrix(2, 5);
268
+ * console.log(matrix);
269
+ * // Output: [5, 5]
270
+ *
271
+ * @example
272
+ * // Create a 4x2 matrix filled with null values
273
+ * const matrix = [].matrix(4, null);
274
+ * console.log(matrix);
275
+ * // Output: [null, null, null, null]
276
+ */
277
+ Array.prototype.matrix = function (_length, _fillValue = 0) {
278
+ // eslint-disable-next-line no-unused-vars
279
+ const x_func = function (x = undefined) {
280
+ return _fillValue;
281
+ };
282
+ return Array.from({
283
+ length: _length
284
+ }, x_func);
285
+ };
286
+ /**
287
+ * Creates a matrix (2D array) from a given array.
288
+ *
289
+ * This function extends the Array constructor by adding a static method
290
+ * that generates a matrix with specified dimensions and fill value.
291
+ *
292
+ * @function
293
+ * @param {Array} a - The input array used to generate the matrix.
294
+ * @param {number} _length - The length of the matrix (number of rows).
295
+ * @param {number} [_fillValue=0] - The value to fill the matrix with (default is 0).
296
+ * @returns {Array} A 2D array (matrix) created from the input parameters.
297
+ *
298
+ * @example
299
+ * const myMatrix = Array.matrix(2, 5);
300
+ * // myMatrix will be [5, 5, 5]
301
+ */
302
+ Array.matrix = function (a, _length, _fillValue = 0) {
303
+ return a.matrix(_length, _fillValue);
304
+ };
305
+ (introspection_1._protected_code_)(Array.matrix);
306
+ (introspection_1._protected_code_)(Array.prototype.matrix);
307
+ Array.prototype.matrix2d = function (_length, _fillValue = 0) {
308
+ // eslint-disable-next-line no-unused-vars
309
+ const y_func = function (y) {
310
+ return _fillValue;
311
+ };
312
+ // eslint-disable-next-line no-unused-vars
313
+ const x_func = function (x) {
314
+ return Array.from({
315
+ length: _length
316
+ }, y_func);
317
+ };
318
+ return Array.from({
319
+ length: _length
320
+ }, x_func);
321
+ };
322
+ Array.matrix2d = function (a, _length, _fillValue = 0) {
323
+ return a.matrix2d(_length, _fillValue);
324
+ };
325
+ (introspection_1._protected_code_)(Array.matrix2d);
326
+ (introspection_1._protected_code_)(Array.prototype.matrix2d);
327
+ Array.prototype.matrix3d = function (_length, _fillValue = 0) {
328
+ // eslint-disable-next-line no-unused-vars
329
+ const y_func = function (y) {
330
+ return Array.from({
331
+ length: _length
332
+ }, function () {
333
+ return _fillValue;
334
+ });
335
+ };
336
+ // eslint-disable-next-line no-unused-vars
337
+ const x_func = function (x) {
338
+ return Array.from({
339
+ length: _length
340
+ }, y_func);
341
+ };
342
+ return Array.from({
343
+ length: _length
344
+ }, x_func);
345
+ };
346
+ Array.matrix3d = function (a, _length, _fillValue = 0) {
347
+ return a.matrix3d(_length, _fillValue);
348
+ };
349
+ (introspection_1._protected_code_)(Array.matrix3d);
350
+ (introspection_1._protected_code_)(Array.prototype.matrix3d);
351
+ String.prototype.list = function () {
352
+ const __instance = this;
353
+ return _top.range(0, __instance.length - 1).map(function (i) {
354
+ return __instance[i];
355
+ });
356
+ };
357
+ (introspection_1._protected_code_)(String.prototype.list);
358
+ /**
359
+ * End of array math functions
360
+ */
361
+ (0, defaultProcessors_1.setDefaultProcessors)();
362
+ /**
363
+ * Load every component tag declared in the body
364
+ **/
365
+ (0, Ready_1.Ready)(function () {
366
+ if (!CONFIG_1.CONFIG.get("useSDK")) {
367
+ globalSettings_1.GlobalSettings.__start__()
368
+ .catch((e) => {
369
+ throw Error(e);
370
+ });
371
+ }
372
+ });
373
+ /*
374
+ Public variables and functions
375
+ */
376
+ (0, Export_1.Export)(Export_1.Export); /* exports the same Export function once */
377
+ (0, Export_1.Export)(Import_1.Import);
378
+ (0, Export_1.Export)(Package_1.Package);
379
+ (0, Export_1.Export)(Class_1.Class);
380
+ (0, Export_1.Export)(New_1.New);
381
+ (0, Export_1.Export)(Tag_1.Tag);
382
+ (0, Export_1.Export)(Ready_1.Ready);
383
+ (0, Export_1.Export)(Ready_1.ready);
384
+ (0, Export_1.Export)(platform_1.isBrowser);
385
+ (0, Export_1.Export)(introspection_1._methods_);
386
+ (0, Export_1.Export)(globalSettings_1.GlobalSettings);
387
+ (0, top_1.resetTop)((0, Cast_1._CastProps)((0, New_1.New)(globalSettings_1.GlobalSettings), _top));
388
+ (function (_top) {
389
+ Object.defineProperty(_top, "PackagesNameList", {
390
+ // eslint-disable-next-line no-unused-vars
391
+ set(val) {
392
+ Logger_1.logger.debug("PackagesNameList is readonly");
393
+ },
394
+ get() {
395
+ const _get_packages_names = function (_packages) {
396
+ let _keys = [];
397
+ for (const _k of Object.keys(_packages)) {
398
+ if (typeof _packages[_k] !== "undefined" &&
399
+ typeof _packages[_k] !== "function" &&
400
+ Object.hasOwn(_packages[_k], "length") &&
401
+ _packages[_k].length > 0) {
402
+ _keys.push(_k);
403
+ _keys = _keys.concat(_get_packages_names(_packages[_k]));
404
+ }
405
+ }
406
+ return _keys;
407
+ };
408
+ return _get_packages_names(PrimaryCollections_1._QC_PACKAGES);
409
+ }
410
+ });
411
+ Object.defineProperty(_top, "PackagesList", {
412
+ // eslint-disable-next-line no-unused-vars
413
+ set(value) {
414
+ Logger_1.logger.debug("PackagesList is readonly");
415
+ },
416
+ get() {
417
+ return _top.PackagesNameList.map(function (packagename) {
418
+ const _classesList = (0, Package_1.Package)(packagename);
419
+ let _ret_ = undefined;
420
+ if (_classesList) {
421
+ _ret_ = {
422
+ packageName: packagename,
423
+ classesList: _classesList.filter(function (_packageClass) {
424
+ return (0, isQCObjects_1.isQCObjects_Class)(_packageClass);
425
+ })
426
+ };
427
+ }
428
+ return _ret_;
429
+ }).filter(function (_p) {
430
+ return typeof _p !== "undefined";
431
+ });
432
+ }
433
+ });
434
+ Object.defineProperty(_top, "ClassesList", {
435
+ // eslint-disable-next-line no-unused-vars
436
+ set(value) {
437
+ Logger_1.logger.debug("ClassesList is readonly");
438
+ },
439
+ get() {
440
+ let _classesList = [];
441
+ _top.PackagesList.map(function (_package_element) {
442
+ _classesList = _classesList.concat(_package_element.classesList.map(function (_class_element) {
443
+ return {
444
+ packageName: _package_element.packageName,
445
+ className: _package_element.packageName + "." + _class_element.__definition.__classType,
446
+ classFactory: _class_element
447
+ };
448
+ }));
449
+ return _package_element;
450
+ });
451
+ return _classesList;
452
+ }
453
+ });
454
+ Object.defineProperty(_top, "ClassesNameList", {
455
+ // eslint-disable-next-line no-unused-vars
456
+ set(value) {
457
+ Logger_1.logger.debug("ClassesNameList is readonly");
458
+ },
459
+ get() {
460
+ return _top.ClassesList.map(function (_class_element) {
461
+ return _class_element.className;
462
+ });
463
+ }
464
+ });
465
+ if (platform_1.isBrowser) {
466
+ // use of GLOBAL word is deprecated in node.js
467
+ // this is only for compatibility purpose with old versions of QCObjects in browsers
468
+ (0, Class_1.Class)("GLOBAL", PrimaryCollections_1._QC_CLASSES.global); // case insensitive for compatibility con old versions;
469
+ (0, Export_1.Export)((0, ClassFactory_1.ClassFactory)("GLOBAL"));
470
+ }
471
+ (0, Export_1.Export)(global);
472
+ (0, loadSDK_1.default)();
473
+ })(_top);
474
+ if (platform_1.isBrowser) {
475
+ (0, asyncLoad_1.asyncLoad)(function () {
476
+ (0, Ready_1.Ready)(function () {
477
+ /*
478
+ * scroll management custom events
479
+ * usage: document.addEventListener('percentY90',function(e){console.log(e.detail.percentY)});
480
+ * possible events: scrollpercent, defaultscroll, percentY0, percentY25, percentY50, percentY75, percentY90
481
+ */
482
+ (function (_top) {
483
+ let ticking = false;
484
+ const scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);
485
+ const scrollWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth);
486
+ function scrollDispatcher(event) {
487
+ const percentY = Math.round(_top.scrollY * 100 / scrollHeight);
488
+ const percentX = Math.round(_top.scrollX * 100 / scrollWidth);
489
+ const scrollPercentEventEvent = new CustomEvent("scrollpercent", {
490
+ detail: {
491
+ percentX,
492
+ percentY
493
+ }
494
+ });
495
+ event.target.dispatchEvent(scrollPercentEventEvent);
496
+ let secondaryEventName = "defaultscroll";
497
+ const __valid_scrolls__ = [0, 5, 10, 25, 50, 75, 90, 95, 100];
498
+ __valid_scrolls__.filter(function (p) {
499
+ return p === percentY;
500
+ }).map(function (pY) {
501
+ secondaryEventName = "percentY" + percentY.toString();
502
+ const secondaryCustomEvent = new CustomEvent(secondaryEventName, {
503
+ detail: {
504
+ percentX,
505
+ percentY
506
+ }
507
+ });
508
+ event.target.dispatchEvent(secondaryCustomEvent);
509
+ return pY;
510
+ });
511
+ }
512
+ document.addEventListener("scroll", function (event) {
513
+ if (!ticking) {
514
+ requestAnimationFrame(function () {
515
+ scrollDispatcher(event);
516
+ ticking = false;
517
+ });
518
+ ticking = true;
519
+ }
520
+ });
521
+ })(_top);
522
+ });
523
+ }, []);
524
+ }
525
+ if (!platform_1.isBrowser) {
526
+ if (typeof _top.global !== "undefined" && Object.hasOwn(_top.global, "_fireAsyncLoad")) {
527
+ asyncLoad_1._fireAsyncLoad.call(_top);
528
+ }
529
+ if (typeof _top.global !== "undefined" && Object.hasOwn(_top.global, "onload")) {
530
+ _top.global.onload.call(_top);
531
+ }
532
+ }
533
+ /* Freezing Object && Object.prototype to prevent prototype pollution risks */
534
+ (function (isBrowser) {
535
+ const __freeze__ = function () {
536
+ Object.freeze(Object.prototype);
537
+ Object.freeze(Object);
538
+ };
539
+ if (isBrowser && CONFIG_1.CONFIG.get("secureObjects", false)) {
540
+ (0, Ready_1.Ready)(function () {
541
+ __freeze__();
542
+ });
543
+ }
544
+ else if (CONFIG_1.CONFIG.get("secureObjects", false)) {
545
+ __freeze__();
546
+ }
547
+ })(platform_1.isBrowser);
548
+ }
549
+ })(top_1._top);
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NamespaceRef = void 0;
4
+ const isQCObjects_1 = require("./isQCObjects");
5
+ const Package_1 = require("./Package");
6
+ /**
7
+ * Declare Namespace
8
+ *
9
+ * @param {String} packageName
10
+ * @param {Object} package
11
+ */
12
+ const NamespaceRef = function (namespace) {
13
+ const packageInstance = (0, Package_1.Package)(namespace) || [];
14
+ const classes = packageInstance.filter((c) => (0, isQCObjects_1.isQCObjects_Class)(c)).map((c) => {
15
+ return {
16
+ [c.__definition.__classType]: c
17
+ };
18
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
19
+ }).reduce((a, b) => { return Object.assign(a, b); });
20
+ return namespace.split(".").map(c => {
21
+ return {
22
+ [c]: classes
23
+ };
24
+ }).reverse().reduce((a, b) => {
25
+ b[Object.keys(b).join(".")] = a;
26
+ return b;
27
+ });
28
+ };
29
+ exports.NamespaceRef = NamespaceRef;
package/build/New.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Creates an object from a Class definition
4
+ *
5
+ * @param {QC_Object} o
6
+ * @param {Object} args
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.New = void 0;
10
+ const New = function (__class__, args = {}) {
11
+ args = (arguments.length > 1) ? (args) : ({});
12
+ return (typeof __class__ === "undefined") ? (new Object()) : (new __class__(args));
13
+ };
14
+ exports.New = New;
15
+ exports.New.prototype.toString = function () {
16
+ return "New(QCObjectsClassName, args) { [QCObjects native code] }";
17
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectName = void 0;
4
+ /**
5
+ * Returns the object or function name
6
+ *
7
+ * @param Object or function
8
+ */
9
+ const ObjectName = function (o) {
10
+ let ret = "";
11
+ if (typeof o === "function" && Object.hasOwn(o, "name") && o.name !== "") {
12
+ ret = o.name;
13
+ }
14
+ else if (typeof o !== "undefined" && typeof o.constructor === "function" && o.constructor.name !== "") {
15
+ ret = o.constructor.name;
16
+ }
17
+ else if (typeof o !== "undefined" && typeof o.constructor === "object") {
18
+ ret = o.constructor.toString().replace(/\[(.*?)\]/g, "$1").split(" ").slice(1).join("");
19
+ }
20
+ return ret;
21
+ };
22
+ exports.ObjectName = ObjectName;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Package = void 0;
4
+ const InheritClass_1 = require("./InheritClass");
5
+ const is_raw_class_1 = require("./is_raw_class");
6
+ const PrimaryCollections_1 = require("./PrimaryCollections");
7
+ const RegisterClass_1 = require("./RegisterClass");
8
+ /**
9
+ * Defines a package for Class classification
10
+ *
11
+ * @param {Object} namespace
12
+ * @param {Object} classes
13
+ */
14
+ const Package = function (namespace, classes = []) {
15
+ if (Object.hasOwn(PrimaryCollections_1._QC_PACKAGES, namespace) &&
16
+ typeof PrimaryCollections_1._QC_PACKAGES[namespace] !== "undefined" &&
17
+ Object.hasOwn(PrimaryCollections_1._QC_PACKAGES[namespace], "length") &&
18
+ PrimaryCollections_1._QC_PACKAGES[namespace].length > 0 &&
19
+ typeof classes !== "undefined" &&
20
+ Object.hasOwn(classes, "length") &&
21
+ classes.length > 0) {
22
+ classes.filter(function (_c1) {
23
+ return (0, is_raw_class_1.__is_raw_class__)(_c1);
24
+ }).map((_class_) => {
25
+ if (typeof _class_.__definition === "undefined") {
26
+ _class_.__definition = {};
27
+ }
28
+ _class_.__definition.__namespace = namespace;
29
+ _class_.__namespace = namespace;
30
+ return _class_;
31
+ });
32
+ PrimaryCollections_1._QC_PACKAGES[namespace] = PrimaryCollections_1._QC_PACKAGES[namespace].concat(classes);
33
+ }
34
+ else if (typeof classes !== "undefined") {
35
+ if (typeof classes === "object" && Object.hasOwn(classes, "length")) {
36
+ classes.filter(function (_c1) {
37
+ return (0, is_raw_class_1.__is_raw_class__)(_c1);
38
+ }).map((_class_) => {
39
+ if (typeof _class_.__definition === "undefined") {
40
+ _class_.__definition = {};
41
+ }
42
+ _class_.__definition.__namespace = namespace;
43
+ _class_.__namespace = namespace;
44
+ return _class_;
45
+ });
46
+ }
47
+ else if (classes.prototype instanceof InheritClass_1.InheritClass) {
48
+ if (typeof classes.__definition === "undefined") {
49
+ classes.__definition = {};
50
+ }
51
+ classes.__definition.__namespace = namespace;
52
+ classes.__namespace = namespace;
53
+ }
54
+ PrimaryCollections_1._QC_PACKAGES[namespace] = classes;
55
+ }
56
+ if (Object.hasOwn(PrimaryCollections_1._QC_PACKAGES, namespace)) {
57
+ PrimaryCollections_1._QC_PACKAGES[namespace].map((_class_) => {
58
+ (0, RegisterClass_1.__register_class__)(_class_, namespace);
59
+ return _class_;
60
+ });
61
+ }
62
+ return ((Object.hasOwn(PrimaryCollections_1._QC_PACKAGES, namespace)) ? (PrimaryCollections_1._QC_PACKAGES[namespace]) : (undefined));
63
+ };
64
+ exports.Package = Package;
65
+ exports.Package.prototype.toString = function () {
66
+ return "Package(namespace, classes) { [QCObjects native code] }";
67
+ };