@davidcal/frosth 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Frosth - Yet another UI framework
2
2
 
3
- **Latest version**: v1.0.1
3
+ **Latest version**: v1.0.3
4
4
 
5
5
  ## Motivation
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davidcal/frosth",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Async-first CRUD-last UI framework that treats encapsulation as a solved problem.",
5
5
  "type": "module",
6
6
  "main": "./src/sigew.js",
@@ -21,6 +21,10 @@ class Self {
21
21
  }
22
22
  }
23
23
 
24
+ _create_child(run_effect, options) {
25
+ return create_self(this, run_effect, options);
26
+ }
27
+
24
28
  create_effect(callback) {
25
29
  let child;
26
30
 
package/src/h.js CHANGED
@@ -27,7 +27,14 @@ export const h = (s, tag, props, children) => {
27
27
  });
28
28
  } else {
29
29
  s.create_effect((s) => {
30
- el.setAttribute(key, props[key](s));
30
+ const prop$ = props[key](s);
31
+
32
+ if (prop$ === undefined) {
33
+ el.removeAttribute(key);
34
+ return;
35
+ }
36
+
37
+ el.setAttribute(key, prop$);
31
38
  });
32
39
  }
33
40
  }
package/src/render.js CHANGED
@@ -20,11 +20,13 @@ const render_diff = (s, prev, next, target) => {
20
20
  return prev_map.get(item);
21
21
  }
22
22
 
23
- const item_self = create_self(s);
23
+ const item_self = s._create_child();
24
24
  const fragment = create_fragment(target);
25
25
  const new_state = { prev: [] };
26
26
 
27
- render(item_self, fragment, item(item_self), new_state);
27
+ item_self.create_effect((s) => {
28
+ render(s._create_child(), fragment, item(s), new_state);
29
+ });
28
30
 
29
31
  return { item, item_self, fragment, state: new_state };
30
32
  });
@@ -33,8 +35,6 @@ const render_diff = (s, prev, next, target) => {
33
35
  };
34
36
 
35
37
  export const render = async (s, target, installed, state) => {
36
- console.log("rendering", installed, typeof installed);
37
-
38
38
  if (typeof installed === "string") {
39
39
  target.textContent = installed;
40
40