ziko 2.0.0-beta.14 → 2.0.0-beta.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziko",
3
- "version": "2.0.0-beta.14",
3
+ "version": "2.0.0-beta.15",
4
4
  "description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
5
5
  "keywords": [
6
6
  "front-end",
@@ -62,12 +62,17 @@ export async function __addItem__(adder, pusher, item, referenceNode = null, ind
62
62
  if (["number", "string"].includes(typeof item)) item = text(item);
63
63
  if (typeof item === "function" && isStateGetter(item)) {
64
64
  const getter = item();
65
- item = text(getter.value);
66
- getter._subscribe(
67
- (newValue) => { item.element.textContent = newValue; },
68
- item
69
- );
70
- }
65
+ item = getter.value;
66
+
67
+ getter._subscribe((newValue) => {
68
+ if (newValue?.isUIElement?.()) {
69
+ item.element.replaceWith(newValue.element);
70
+ item = newValue;
71
+ } else {
72
+ item.element.textContent = newValue;
73
+ }
74
+ });
75
+ }
71
76
  if (typeof globalThis?.Node === "function" && item instanceof globalThis.Node)
72
77
  item = new this.constructor(item);
73
78
  if (item instanceof Promise) item = await item;