@adia-ai/web-components 0.7.18 → 0.7.19

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog — @adia-ai/web-components
2
2
 
3
+ ## [0.7.19] — 2026-06-10
4
+
5
+ ### Fixed
6
+ - **`icon-ui` — glyphs always paint on the standalone import path.** Importing `components/icon` directly (or a demo page loading only `./icon.js`) never loaded `core/icons-phosphor.js`, so the weight-loader map stayed empty and every `getIcon()` returned `''` — **silently** (the not-ready guard suppressed the warning): blank icons, zero console errors. Two fixes: `icon.js` now imports the Phosphor loader as a side-effect (the barrel paths already did), and `icon.class.js` gains a signal-reactive retry (`#rev` bumped by `whenIconRegistryReady`, aborted symmetrically in `disconnected()`) so elements that connect *after* the loaders install — e.g. fetched-and-injected demo markup — re-render once the registry is ready. Production (barrel-served) was never affected; the docs/demo single-component path was. Regression probe: `scripts/dev/icon-paint-probe.mjs`. `dist/web-components.min.js` (and the web-modules kitchen-sink bundle) regenerated to carry the fix.
7
+
3
8
  ## [0.7.18] — 2026-06-09
4
9
 
5
10
  ### Changed
@@ -11,8 +11,8 @@
11
11
  * @see ../../USAGE.md#registration--auto-vs-explicit
12
12
  */
13
13
 
14
- import { UIElement, signal, html } from '../../core/element.js';
15
- import { getIcon } from '../../core/icons.js';
14
+ import { UIElement } from '../../core/element.js';
15
+ import { getIcon, whenIconRegistryReady } from '../../core/icons.js';
16
16
 
17
17
  export class UIIcon extends UIElement {
18
18
  static properties = {
@@ -23,12 +23,42 @@ export class UIIcon extends UIElement {
23
23
  weight: { type: String, default: 'regular', reflect: true },
24
24
  };
25
25
 
26
+ // Incremented when the icon registry becomes ready so the reactive
27
+ // render() re-runs automatically after the loader map arrives.
28
+ // Declared as a private field (not a static property) to keep it out
29
+ // of the attribute reflection loop — it is a purely internal trigger.
30
+ #rev = this.signal(0);
31
+
32
+ // Abort controller for the registry-ready subscription. Cancelled on
33
+ // disconnectedCallback so elements removed before the registry resolves
34
+ // do not attempt a render on a detached host.
35
+ #readyCtrl = null;
36
+
26
37
  connected() {
27
38
  this.setAttribute('role', this.label ? 'img' : 'presentation');
28
39
  if (!this.label) this.setAttribute('aria-hidden', 'true');
40
+
41
+ // Subscribe to the registry-ready promise ONCE per connect cycle.
42
+ // When installIconLoaders() fires (could be before or after connect),
43
+ // bump #rev so the reactive render() reruns and picks up the SVG.
44
+ // Guard: if the registry was already ready (e.g. warm page reload),
45
+ // the .then() fires in a microtask — still safe, just a no-op repaint.
46
+ this.#readyCtrl = new AbortController();
47
+ const ctrl = this.#readyCtrl;
48
+ whenIconRegistryReady.then(() => {
49
+ if (!ctrl.signal.aborted) this.#rev.value++;
50
+ });
51
+ }
52
+
53
+ disconnected() {
54
+ this.#readyCtrl?.abort();
55
+ this.#readyCtrl = null;
29
56
  }
30
57
 
31
58
  render() {
59
+ // Read #rev so this render() is tracked as a dependent of the registry
60
+ // arrival. The value itself is not used — the read is the tracking hook.
61
+ void this.#rev.value;
32
62
  if (this.label) this.setAttribute('aria-label', this.label);
33
63
  const svg = getIcon(this.name, this.weight || 'regular');
34
64
  if (svg && this.innerHTML !== svg) this.innerHTML = svg;
@@ -12,6 +12,17 @@
12
12
  import { defineIfFree } from '../../core/register.js';
13
13
  import { UIIcon } from './icon.class.js';
14
14
 
15
+ // Side-effect: wires the full @phosphor-icons/core asset tree into the icon
16
+ // registry so that any Phosphor name resolves without pre-registration.
17
+ // icon-ui is a glyph renderer — the icon loader is required for it to paint.
18
+ // The barrel (components/index.js) and core barrel both carry this import
19
+ // already; this import ensures standalone usage of the icon component
20
+ // (e.g. `import '@adia-ai/web-components/components/icon'`) also works.
21
+ // Apps with bundle-size SLOs that manage their own icon registration should
22
+ // import the class subpath directly and call installIconLoaders() themselves:
23
+ // import { UIIcon } from '@adia-ai/web-components/components/icon/class';
24
+ import '../../core/icons-phosphor.js';
25
+
15
26
  defineIfFree('icon-ui', UIIcon);
16
27
 
17
28
  export { UIIcon };