qcobjects 2.5.109-beta → 2.5.111-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.
@@ -265,20 +265,48 @@ var init_Cast = __esm({
265
265
  });
266
266
 
267
267
  // src/DOMCreateElement.ts
268
- var _DOMCreateElement;
268
+ var _DOMCreateElement, ComplexTypeCall, _DOMCreateComplexElement;
269
269
  var init_DOMCreateElement = __esm({
270
270
  "src/DOMCreateElement.ts"() {
271
271
  "use strict";
272
272
  init_platform();
273
- _DOMCreateElement = /* @__PURE__ */ __name(function(elementName) {
273
+ _DOMCreateElement = /* @__PURE__ */ __name(function(elementName, props, children) {
274
274
  let _ret_;
275
275
  if (isBrowser) {
276
- _ret_ = document.createElement(elementName);
276
+ _ret_ = _DOMCreateComplexElement(elementName, props, children);
277
277
  } else {
278
278
  _ret_ = {};
279
279
  }
280
280
  return _ret_;
281
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");
282
310
  }
283
311
  });
284
312