@xoong/core 0.0.36 → 0.0.39

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": "@xoong/core",
3
- "version": "0.0.36",
3
+ "version": "0.0.39",
4
4
  "description": "xoong core: signals, Light DOM custom elements, html templates. Zero dependencies.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/html.js CHANGED
@@ -14,7 +14,7 @@
14
14
  * @event=${fn} : event listener.
15
15
  * An attribute value must be exactly one expression (no mixing text and `${}`).
16
16
  */
17
- import { effect } from './signals.js';
17
+ import { effect, untracked } from './signals.js';
18
18
 
19
19
  const MARK = '__xo_';
20
20
  const cache = new WeakMap();
@@ -120,7 +120,7 @@ function bindAttr(el, part, value, disposers) {
120
120
  else if (v == null || v === false) el.removeAttribute(name);
121
121
  else el.setAttribute(name, v === true ? '' : String(v));
122
122
  };
123
- if (typeof value === 'function') disposers.push(effect(() => apply(value())));
123
+ if (typeof value === 'function') disposers.push(effect(() => { const v = value(); untracked(() => apply(v)); })); // only `value` is tracked: what a child element reads while it connects must not subscribe this binding
124
124
  else apply(value);
125
125
  }
126
126
 
@@ -139,7 +139,7 @@ function bindChild(marker, value, disposers) {
139
139
  appendValue(frag, v, inner);
140
140
  end.before(frag);
141
141
  };
142
- if (typeof value === 'function') disposers.push(effect(() => put(value())));
142
+ if (typeof value === 'function') disposers.push(effect(() => { const v = value(); untracked(() => put(v)); })); // same: inserting content connects child elements
143
143
  else put(value);
144
144
  disposers.push(clear);
145
145
  }
package/src/syntax.js CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  /** Attributes understood inside <xo-view>. */
8
- export const XO_ATTRIBUTES = ['xo-each', 'xo-if', 'xo-click', 'xo-submit', 'xo-body', 'xo-keep', 'xo-param', 'xo-refresh', 'xo-optimistic', 'xo-select', 'xo-selected', 'xo-with', 'xo-confirm', 'xo-notice', 'xo-add', 'xo-remove', 'xo-move', 'xo-drag', 'xo-t'];
8
+ export const XO_ATTRIBUTES = ['xo-each', 'xo-if', 'xo-click', 'xo-submit', 'xo-body', 'xo-keep', 'xo-param', 'xo-refresh', 'xo-optimistic', 'xo-select', 'xo-selected', 'xo-with', 'xo-confirm', 'xo-notice', 'xo-then', 'xo-add', 'xo-remove', 'xo-move', 'xo-drag', 'xo-t'];
9
9
 
10
10
  /** Custom elements shipped by xoong. */
11
11
  export const XO_ELEMENTS = ['xo-view'];
@@ -16,4 +16,4 @@ export const XO_UI_ELEMENTS = ['xo-table', 'xo-form', 'xo-dialog', 'xo-toast', '
16
16
 
17
17
  /** Attributes and elements of @xoong/controls and @xoong/richtext. */
18
18
  export const XO_CONTROL_ATTRIBUTES = ['xo-tab', 'xo-menu-trigger', 'xo-tooltip'];
19
- export const XO_CONTROL_ELEMENTS = ['xo-tabs', 'xo-menu', 'xo-combobox', 'xo-tags', 'xo-richtext', 'xo-carousel', 'xo-switch', 'xo-date', 'xo-time', 'xo-slider', 'xo-stepper', 'xo-password', 'xo-copy'];
19
+ export const XO_CONTROL_ELEMENTS = ['xo-tabs', 'xo-menu', 'xo-combobox', 'xo-tags', 'xo-richtext', 'xo-carousel', 'xo-switch', 'xo-date', 'xo-time', 'xo-slider', 'xo-stepper', 'xo-password', 'xo-copy', 'xo-image'];