gonia 0.0.2 → 0.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.
@@ -1,4 +1,5 @@
1
1
  import { directive } from '../types.js';
2
+ import { effect } from '../reactivity.js';
2
3
  /**
3
4
  * Set element's innerHTML from an expression.
4
5
  *
@@ -14,6 +15,8 @@ import { directive } from '../types.js';
14
15
  * ```
15
16
  */
16
17
  export const html = function html($expr, $element, $eval) {
17
- $element.innerHTML = String($eval($expr) ?? '');
18
+ effect(() => {
19
+ $element.innerHTML = String($eval($expr) ?? '');
20
+ });
18
21
  };
19
22
  directive('g-html', html);
@@ -1,4 +1,5 @@
1
1
  import { directive } from '../types.js';
2
+ import { effect } from '../reactivity.js';
2
3
  /**
3
4
  * Toggle element visibility based on an expression.
4
5
  *
@@ -13,7 +14,9 @@ import { directive } from '../types.js';
13
14
  * ```
14
15
  */
15
16
  export const show = function show($expr, $element, $eval) {
16
- const value = $eval($expr);
17
- $element.style.display = value ? '' : 'none';
17
+ effect(() => {
18
+ const value = $eval($expr);
19
+ $element.style.display = value ? '' : 'none';
20
+ });
18
21
  };
19
22
  directive('g-show', show);
@@ -1,4 +1,5 @@
1
1
  import { directive } from '../types.js';
2
+ import { effect } from '../reactivity.js';
2
3
  /**
3
4
  * Set element's text content from an expression.
4
5
  *
@@ -13,6 +14,8 @@ import { directive } from '../types.js';
13
14
  * ```
14
15
  */
15
16
  export const text = function text($expr, $element, $eval) {
16
- $element.textContent = String($eval($expr) ?? '');
17
+ effect(() => {
18
+ $element.textContent = String($eval($expr) ?? '');
19
+ });
17
20
  };
18
21
  directive('g-text', text);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gonia",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "A lightweight, SSR-first reactive UI library with declarative directives",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "https://github.com/monokrome/cubist.js"
19
+ "url": "https://github.com/monokrome/gonia"
20
20
  },
21
21
  "files": [
22
22
  "dist",