qcobjects 2.5.108-beta → 2.5.110-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/DOMCreateElement.js +35 -3
- package/build/_import_.js +26 -0
- package/build/findPackageNodePath.js +5 -2
- package/build/index.cjs +25 -2
- package/build/platform.js +8 -2
- package/build-esbuild.js +8 -1
- package/package.json +2 -1
- package/postbuild.js +10 -0
- package/public/browser/QCObjects.js +70 -9
- package/public/browser/QCObjects.js.map +4 -4
- package/public/cjs/QCObjects.cjs +70 -9
- package/public/cjs/QCObjects.cjs.map +4 -4
- package/public/esm/QCObjects.mjs +68 -7
- package/public/esm/QCObjects.mjs.map +4 -4
- package/public/types/index.d.ts +8 -1
- package/src/DOMCreateElement.ts +36 -2
- package/src/_import_.ts +27 -0
- package/src/findPackageNodePath.ts +2 -2
- package/src/platform.ts +9 -2
- package/src/index.cts +0 -2
- package/src/index.mts +0 -2
package/public/esm/QCObjects.mjs
CHANGED
|
@@ -78,11 +78,40 @@ var init_PrimaryCollections = __esm({
|
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
+
// src/_import_.ts
|
|
82
|
+
async function _import_(name) {
|
|
83
|
+
logger.debug(`Importing ${name}...`);
|
|
84
|
+
function isPackage(name2) {
|
|
85
|
+
logger.debug(`Validating if ${name2} is a package name...`);
|
|
86
|
+
return !name2.startsWith(".") && !name2.startsWith("/") && !name2.includes("/");
|
|
87
|
+
}
|
|
88
|
+
__name(isPackage, "isPackage");
|
|
89
|
+
try {
|
|
90
|
+
const hasExtension = /\.[^/\\]+$/.test(name);
|
|
91
|
+
if (!hasExtension && !isPackage(name)) {
|
|
92
|
+
logger.debug(`${name} does not have an extension and is not a package. Adding js extension.`);
|
|
93
|
+
name += ".js";
|
|
94
|
+
}
|
|
95
|
+
const m = await import(name);
|
|
96
|
+
return m;
|
|
97
|
+
} catch (error) {
|
|
98
|
+
logger.warn(`Failed to load module: ${error}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
var init_import = __esm({
|
|
102
|
+
"src/_import_.ts"() {
|
|
103
|
+
"use strict";
|
|
104
|
+
init_Logger();
|
|
105
|
+
__name(_import_, "_import_");
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
81
109
|
// src/platform.ts
|
|
82
110
|
var isDeno, isBrowser, isNodeCommonJS, deno_require, _require_, is_phonegap;
|
|
83
111
|
var init_platform = __esm({
|
|
84
112
|
"src/platform.ts"() {
|
|
85
113
|
"use strict";
|
|
114
|
+
init_import();
|
|
86
115
|
init_Logger();
|
|
87
116
|
isDeno = typeof window !== "undefined" && "Deno" in window;
|
|
88
117
|
isBrowser = typeof window !== "undefined" && typeof window.self !== "undefined" && window === window.self && !isDeno;
|
|
@@ -93,7 +122,11 @@ var init_platform = __esm({
|
|
|
93
122
|
return isDeno ? deno_require(name) : ((name2) => {
|
|
94
123
|
let r;
|
|
95
124
|
try {
|
|
96
|
-
|
|
125
|
+
_import_(name2).then((m) => {
|
|
126
|
+
r = m && m.default || m;
|
|
127
|
+
}).catch((e) => {
|
|
128
|
+
logger.warn(`An error ocurred: ${e}`);
|
|
129
|
+
});
|
|
97
130
|
} catch (e) {
|
|
98
131
|
logger.debug(`An error ocurred importing module. ${e}`);
|
|
99
132
|
r = { export: {} };
|
|
@@ -232,20 +265,48 @@ var init_Cast = __esm({
|
|
|
232
265
|
});
|
|
233
266
|
|
|
234
267
|
// src/DOMCreateElement.ts
|
|
235
|
-
var _DOMCreateElement;
|
|
268
|
+
var _DOMCreateElement, ComplexTypeCall, _DOMCreateComplexElement;
|
|
236
269
|
var init_DOMCreateElement = __esm({
|
|
237
270
|
"src/DOMCreateElement.ts"() {
|
|
238
271
|
"use strict";
|
|
239
272
|
init_platform();
|
|
240
|
-
_DOMCreateElement = /* @__PURE__ */ __name(function(elementName) {
|
|
273
|
+
_DOMCreateElement = /* @__PURE__ */ __name(function(elementName, props, children) {
|
|
241
274
|
let _ret_;
|
|
242
275
|
if (isBrowser) {
|
|
243
|
-
_ret_ =
|
|
276
|
+
_ret_ = _DOMCreateComplexElement(elementName, props, children);
|
|
244
277
|
} else {
|
|
245
278
|
_ret_ = {};
|
|
246
279
|
}
|
|
247
280
|
return _ret_;
|
|
248
281
|
}, "_DOMCreateElement");
|
|
282
|
+
ComplexTypeCall = /* @__PURE__ */ __name((_type, { props, children }) => {
|
|
283
|
+
return _type({ props, children });
|
|
284
|
+
}, "ComplexTypeCall");
|
|
285
|
+
_DOMCreateComplexElement = /* @__PURE__ */ __name((_type, props, children) => {
|
|
286
|
+
if (typeof _type !== "string") {
|
|
287
|
+
return ComplexTypeCall(_type, { props, children });
|
|
288
|
+
}
|
|
289
|
+
const element = document.createElement(_type);
|
|
290
|
+
if (props) {
|
|
291
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
292
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
293
|
+
element.setAttribute(key, value.toString());
|
|
294
|
+
} else if (typeof value === "function" && key.toLowerCase().startsWith("on")) {
|
|
295
|
+
element.addEventListener(key.slice(2).toLowerCase(), value.bind(element));
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
if (Array.isArray(children)) {
|
|
300
|
+
children.filter((child) => child instanceof Node).forEach((child) => {
|
|
301
|
+
element.appendChild(child);
|
|
302
|
+
});
|
|
303
|
+
} else if (children instanceof Node) {
|
|
304
|
+
element.appendChild(children);
|
|
305
|
+
} else if (typeof children === "string") {
|
|
306
|
+
element.innerHTML = children;
|
|
307
|
+
}
|
|
308
|
+
return element;
|
|
309
|
+
}, "_DOMCreateComplexElement");
|
|
249
310
|
}
|
|
250
311
|
});
|
|
251
312
|
|
|
@@ -2213,9 +2274,9 @@ var init_componentLoader = __esm({
|
|
|
2213
2274
|
} else {
|
|
2214
2275
|
logger.debug("Loading the component as a local file in server...");
|
|
2215
2276
|
const _directLoad = /* @__PURE__ */ __name(function() {
|
|
2216
|
-
const
|
|
2277
|
+
const fs2 = _require_("fs");
|
|
2217
2278
|
logger.debug("SENDING THE NORMAL REQUEST ");
|
|
2218
|
-
|
|
2279
|
+
fs2.readFile(component2.url, _componentLoaded);
|
|
2219
2280
|
}, "_directLoad");
|
|
2220
2281
|
if (component2.cached) {
|
|
2221
2282
|
logger.debug("USING CACHE FOR COMPONENT: " + component2.name);
|
|
@@ -4264,6 +4325,7 @@ var init_Tag = __esm({
|
|
|
4264
4325
|
});
|
|
4265
4326
|
|
|
4266
4327
|
// src/findPackageNodePath.ts
|
|
4328
|
+
import fs from "node:fs";
|
|
4267
4329
|
var findPackageNodePath;
|
|
4268
4330
|
var init_findPackageNodePath = __esm({
|
|
4269
4331
|
"src/findPackageNodePath.ts"() {
|
|
@@ -4275,7 +4337,6 @@ var init_findPackageNodePath = __esm({
|
|
|
4275
4337
|
findPackageNodePath = /* @__PURE__ */ __name(function(packagename) {
|
|
4276
4338
|
let sdkPath = null;
|
|
4277
4339
|
if (!isBrowser) {
|
|
4278
|
-
const fs = _require_("fs");
|
|
4279
4340
|
try {
|
|
4280
4341
|
let sdkPaths = [
|
|
4281
4342
|
`${CONFIG.get("projectPath")}${CONFIG.get("relativeImportPath")}`,
|