@webmcp-auto-ui/ui 2.5.11 → 2.5.14
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
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
name: string;
|
|
12
12
|
servers?: ConnectedServerInfo[];
|
|
13
13
|
onserverclick?: (url: string) => void;
|
|
14
|
+
onclick?: () => void;
|
|
14
15
|
class?: string;
|
|
15
16
|
}
|
|
16
|
-
let { connecting, connected, name, servers = [], onserverclick, class: cls = '' }: Props = $props();
|
|
17
|
+
let { connecting, connected, name, servers = [], onserverclick, onclick, class: cls = '' }: Props = $props();
|
|
17
18
|
|
|
18
19
|
let dropdownOpen = $state(false);
|
|
19
20
|
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
class="text-[10px] text-teal font-mono cursor-pointer hover:underline select-none"
|
|
46
47
|
onclick={toggleDropdown}
|
|
47
48
|
>
|
|
48
|
-
multi-
|
|
49
|
+
multi-server ({servers.length})
|
|
49
50
|
</span>
|
|
50
51
|
|
|
51
52
|
{#if dropdownOpen}
|
|
@@ -61,14 +62,26 @@
|
|
|
61
62
|
>
|
|
62
63
|
<span class="w-1.5 h-1.5 rounded-full bg-teal flex-shrink-0"></span>
|
|
63
64
|
<span class="truncate flex-1">{server.name}</span>
|
|
64
|
-
<span class="text-text2 text-[10px] flex-shrink-0">{server.toolCount}
|
|
65
|
+
<span class="text-text2 text-[10px] flex-shrink-0">{server.toolCount} tools</span>
|
|
65
66
|
</button>
|
|
66
67
|
{/each}
|
|
68
|
+
{#if onclick}
|
|
69
|
+
<button
|
|
70
|
+
class="w-full flex items-center gap-2 px-3 py-1.5 text-left font-mono text-xs text-accent hover:bg-surface2 transition-colors border-t border-border"
|
|
71
|
+
onclick={(e) => { e.stopPropagation(); dropdownOpen = false; onclick?.(); }}
|
|
72
|
+
>
|
|
73
|
+
Browse recipes
|
|
74
|
+
</button>
|
|
75
|
+
{/if}
|
|
67
76
|
</div>
|
|
68
77
|
{/if}
|
|
69
78
|
{:else}
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
80
|
+
<span
|
|
81
|
+
class="text-[10px] text-text2 font-mono {connected && onclick ? 'cursor-pointer hover:underline' : ''}"
|
|
82
|
+
onclick={() => { if (connected) onclick?.(); }}
|
|
83
|
+
>
|
|
84
|
+
{connecting ? 'connecting\u2026' : connected ? name : 'not connected'}
|
|
72
85
|
</span>
|
|
73
86
|
{/if}
|
|
74
87
|
</div>
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
onconnect?: (url: string) => void;
|
|
15
15
|
onconnectall?: () => void;
|
|
16
16
|
ondisconnect?: (url: string) => void;
|
|
17
|
+
recipeCountByServer?: Record<string, number>;
|
|
18
|
+
onrecipeclick?: (url: string) => void;
|
|
19
|
+
toolCountByServer?: Record<string, number>;
|
|
20
|
+
ontoolclick?: (url: string) => void;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
let {
|
|
@@ -23,6 +27,10 @@
|
|
|
23
27
|
onconnect,
|
|
24
28
|
onconnectall,
|
|
25
29
|
ondisconnect,
|
|
30
|
+
recipeCountByServer,
|
|
31
|
+
onrecipeclick,
|
|
32
|
+
toolCountByServer,
|
|
33
|
+
ontoolclick,
|
|
26
34
|
}: Props = $props();
|
|
27
35
|
|
|
28
36
|
const allConnected = $derived(
|
|
@@ -65,6 +73,25 @@
|
|
|
65
73
|
<div class="flex-1 min-w-0 flex flex-col">
|
|
66
74
|
<span class="font-mono text-xs font-medium text-text1">{server.name}</span>
|
|
67
75
|
<span class="text-[10px] text-text2 truncate">{server.description}</span>
|
|
76
|
+
{#if connected && (recipeCountByServer?.[server.url] || toolCountByServer?.[server.url])}
|
|
77
|
+
<span class="flex items-center gap-1.5 mt-0.5">
|
|
78
|
+
{#if recipeCountByServer?.[server.url]}
|
|
79
|
+
<button class="text-[10px] font-mono text-accent hover:underline"
|
|
80
|
+
onclick={(e) => { e.stopPropagation(); onrecipeclick?.(server.url); }}>
|
|
81
|
+
{recipeCountByServer[server.url]} recipes
|
|
82
|
+
</button>
|
|
83
|
+
{/if}
|
|
84
|
+
{#if recipeCountByServer?.[server.url] && toolCountByServer?.[server.url]}
|
|
85
|
+
<span class="text-[10px] text-text2">·</span>
|
|
86
|
+
{/if}
|
|
87
|
+
{#if toolCountByServer?.[server.url]}
|
|
88
|
+
<button class="text-[10px] font-mono text-accent hover:underline"
|
|
89
|
+
onclick={(e) => { e.stopPropagation(); ontoolclick?.(server.url); }}>
|
|
90
|
+
{toolCountByServer[server.url]} tools
|
|
91
|
+
</button>
|
|
92
|
+
{/if}
|
|
93
|
+
</span>
|
|
94
|
+
{/if}
|
|
68
95
|
</div>
|
|
69
96
|
|
|
70
97
|
<!-- action -->
|
|
@@ -137,6 +137,10 @@
|
|
|
137
137
|
customRenderer ? undefined : NATIVE_MAP[type],
|
|
138
138
|
);
|
|
139
139
|
|
|
140
|
+
// Deep-clone data to strip Svelte 5 $state proxies — third-party libs
|
|
141
|
+
// (Chart.js, Cytoscape, etc.) use Object.defineProperty which conflicts.
|
|
142
|
+
const plainData: Record<string, unknown> = $derived(JSON.parse(JSON.stringify(data)));
|
|
143
|
+
|
|
140
144
|
// ── Vanilla renderer container + lifecycle ────────────
|
|
141
145
|
let vanillaContainer: HTMLElement | undefined = $state(undefined);
|
|
142
146
|
|
|
@@ -144,9 +148,9 @@
|
|
|
144
148
|
if (!isVanillaRenderer || !vanillaContainer) return;
|
|
145
149
|
// Clear previous content
|
|
146
150
|
vanillaContainer.innerHTML = '';
|
|
147
|
-
// Call the vanilla renderer, capture optional cleanup
|
|
151
|
+
// Call the vanilla renderer with proxy-free data, capture optional cleanup
|
|
148
152
|
const cleanup = (customRenderer as (container: HTMLElement, data: Record<string, unknown>) => void | (() => void))(
|
|
149
|
-
vanillaContainer,
|
|
153
|
+
vanillaContainer, plainData,
|
|
150
154
|
);
|
|
151
155
|
// Return teardown for $effect
|
|
152
156
|
return () => {
|
|
@@ -217,9 +221,9 @@
|
|
|
217
221
|
{#if isVanillaRenderer}
|
|
218
222
|
<div bind:this={vanillaContainer} class="vanilla-container w-full h-full overflow-auto p-2"></div>
|
|
219
223
|
{:else if customRenderer}
|
|
220
|
-
<svelte:component this={customRenderer as Component<any>} {
|
|
224
|
+
<svelte:component this={customRenderer as Component<any>} data={plainData} {id} />
|
|
221
225
|
{:else if nativeEntry}
|
|
222
|
-
<svelte:component this={nativeEntry.component} {...nativeEntry.props(
|
|
226
|
+
<svelte:component this={nativeEntry.component} {...nativeEntry.props(plainData, emit)} />
|
|
223
227
|
{:else}
|
|
224
228
|
<div class="p-3 font-mono text-xs text-text2">[{type}]</div>
|
|
225
229
|
{/if}
|