@webmcp-auto-ui/ui 2.5.18 → 2.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmcp-auto-ui/ui",
3
- "version": "2.5.18",
3
+ "version": "2.5.19",
4
4
  "description": "Svelte 5 UI components — primitives, widgets, window manager",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",
@@ -151,13 +151,30 @@
151
151
  if (!isVanillaRenderer || !vanillaContainer) return;
152
152
  // Clear previous content
153
153
  vanillaContainer.innerHTML = '';
154
- // Call the vanilla renderer with proxy-free data, capture optional cleanup
155
- const cleanup = (customRenderer as (container: HTMLElement, data: Record<string, unknown>) => void | (() => void))(
156
- vanillaContainer, plainData,
157
- );
158
- // Return teardown for $effect
154
+
155
+ let cleanup: (() => void) | void;
156
+ let cancelled = false;
157
+
158
+ try {
159
+ const result = (customRenderer as (container: HTMLElement, data: Record<string, unknown>) => void | (() => void) | Promise<void | (() => void)>)(
160
+ vanillaContainer, plainData,
161
+ );
162
+ if (result && typeof (result as Promise<unknown>).then === 'function') {
163
+ (result as Promise<void | (() => void)>).then(
164
+ (c) => { if (!cancelled) cleanup = c ?? undefined; },
165
+ ).catch((err) => { console.error('[WidgetRenderer] async render failed:', err); });
166
+ } else {
167
+ cleanup = result as (() => void) | void;
168
+ }
169
+ } catch (err) {
170
+ console.error('[WidgetRenderer] sync render failed:', err);
171
+ }
172
+
159
173
  return () => {
160
- cleanup?.();
174
+ cancelled = true;
175
+ if (typeof cleanup === 'function') {
176
+ try { cleanup(); } catch (err) { console.error('[WidgetRenderer] cleanup failed:', err); }
177
+ }
161
178
  };
162
179
  });
163
180