@seed-ship/mcp-ui-solid 1.0.36 → 1.0.38
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/dist/components/GenerativeUIErrorBoundary.cjs +18 -35
- package/dist/components/GenerativeUIErrorBoundary.cjs.map +1 -1
- package/dist/components/GenerativeUIErrorBoundary.js +19 -36
- package/dist/components/GenerativeUIErrorBoundary.js.map +1 -1
- package/dist/components/StreamingUIRenderer.cjs +103 -192
- package/dist/components/StreamingUIRenderer.cjs.map +1 -1
- package/dist/components/StreamingUIRenderer.js +104 -193
- package/dist/components/StreamingUIRenderer.js.map +1 -1
- package/dist/components/UIResourceRenderer.cjs +140 -349
- package/dist/components/UIResourceRenderer.cjs.map +1 -1
- package/dist/components/UIResourceRenderer.d.ts.map +1 -1
- package/dist/components/UIResourceRenderer.js +142 -351
- package/dist/components/UIResourceRenderer.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UIResourceRenderer.tsx +7 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +2 -2
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ssr, ssrHydrationKey, escape, ssrStyle, createComponent, ssrAttribute } from "solid-js/web";
|
|
2
2
|
import purify from "../node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.js";
|
|
3
|
-
import { For, Show, createSignal,
|
|
3
|
+
import { For, Show, createSignal, createEffect, createMemo } from "solid-js";
|
|
4
4
|
import { validateComponent, DEFAULT_RESOURCE_LIMITS } from "../services/validation.js";
|
|
5
5
|
import { GenerativeUIErrorBoundary } from "./GenerativeUIErrorBoundary.js";
|
|
6
6
|
import { marked as k } from "../node_modules/.pnpm/marked@16.4.2/node_modules/marked/lib/marked.esm.js";
|
|
7
|
-
var _tmpl$ =
|
|
7
|
+
var _tmpl$ = ["<div", ' class="absolute inset-0 flex items-center justify-center"><div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"></div></div>'], _tmpl$2 = ["<div", ' class="absolute inset-0 flex items-center justify-center p-4"><div class="text-center"><p class="text-red-600 dark:text-red-400 text-sm font-medium">Chart Error</p><p class="text-gray-600 dark:text-gray-400 text-xs mt-1">', "</p></div></div>"], _tmpl$3 = ["<h3", ' class="text-sm font-semibold text-gray-900 dark:text-white mb-3">', "</h3>"], _tmpl$4 = ["<div", ' class="w-full h-full p-4"><!--$-->', '<!--/--><div class="w-full h-full"><img', ' alt="Chart visualization" class="w-full h-auto max-h-[300px] object-contain"></div></div>'], _tmpl$5 = ["<div", ' class="relative w-full h-full min-h-[300px] bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"], _tmpl$6 = ["<div", ' class="mt-3 flex items-center justify-between text-xs text-gray-500 dark:text-gray-400"><span>Showing <!--$-->', "<!--/--> - <!--$-->", "<!--/--> of <!--$-->", "<!--/--></span></div>"], _tmpl$7 = ["<div", ' class="w-full h-full bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden"><div class="p-4"><!--$-->', '<!--/--><div class="overflow-x-auto"><table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700 border-separate border-spacing-0"><thead class="bg-gray-50 dark:bg-gray-900/50"><tr>', '</tr></thead><tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">', "</tbody></table></div><!--$-->", "<!--/--></div></div>"], _tmpl$8 = ["<th", ' scope="col" class="px-6 py-3 text-left text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-200 dark:border-gray-700 first:pl-6 last:pr-6" style="', '">', "</th>"], _tmpl$9 = ["<tr", ' class="', '">', "</tr>"], _tmpl$0 = ["<td", ' class="px-6 py-4 text-sm text-gray-700 dark:text-gray-200 whitespace-normal break-words leading-relaxed first:pl-6 last:pr-6"><div>', "</div></td>"], _tmpl$1 = ["<span", ' class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400">', "</span>"], _tmpl$10 = ["<div", ' class="mt-3 flex items-center"><span class="', '"><!--$-->', "<!--/--> <!--$-->", "<!--/-->%</span></div>"], _tmpl$11 = ["<p", ' class="mt-2 text-xs text-gray-500 dark:text-gray-400">', "</p>"], _tmpl$12 = ["<div", ' class="w-full h-full bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4"><div class="flex flex-col h-full justify-between"><div><p class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide">', '</p><div class="mt-2 flex items-baseline"><p class="text-2xl font-semibold text-gray-900 dark:text-white">', "</p><!--$-->", "<!--/--></div></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div></div>"], _tmpl$13 = ["<div", ' class="w-full h-full bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4"><div class="', '">', "</div></div>"], _tmpl$14 = ["<div", ' class="px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900"><h3 class="text-sm font-semibold text-gray-900 dark:text-white">', "</h3></div>"], _tmpl$15 = ["<div", ' class="w-full h-full bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden flex flex-col"><!--$-->', "<!--/--><iframe", ' class="w-full border-0 flex-1" style="', '" sandbox="allow-scripts allow-same-origin allow-popups allow-forms" loading="lazy"></iframe></div>'], _tmpl$16 = ["<div", ' class="p-3 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"><p class="text-sm text-gray-600 dark:text-gray-400 text-center">', "</p></div>"], _tmpl$17 = ["<div", ' class="w-full h-full bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden flex flex-col"><div class="flex-1 flex items-center justify-center p-4 bg-gray-50 dark:bg-gray-900 min-h-[200px]"><a', ' target="_blank" rel="noopener noreferrer" class="cursor-zoom-in"><img', ' class="max-w-full max-h-[500px] object-contain rounded shadow-sm hover:opacity-95 transition-opacity" loading="lazy"></a></div><!--$-->', "<!--/--></div>"], _tmpl$18 = ["<p", ' class="text-xs text-gray-500 dark:text-gray-400 truncate">', "</p>"], _tmpl$19 = ["<a", ' target="_blank" rel="noopener noreferrer" class="flex items-center gap-3 p-4 bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors group h-full"><div class="p-2 bg-blue-50 dark:bg-blue-900/30 rounded-full text-blue-600 dark:text-blue-400 group-hover:bg-blue-100 dark:group-hover:bg-blue-900/50 shrink-0 transition-colors"><svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></div><div class="flex-1 min-w-0"><h4 class="text-sm font-medium text-gray-900 dark:text-white truncate group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">', "</h4><!--$-->", '<!--/--></div><svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 text-gray-400 group-hover:text-gray-600 dark:group-hover:text-gray-300 shrink-0 transition-colors" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg></a>'], _tmpl$20 = ["<div", ' class="w-full h-full bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4"><p class="text-sm font-medium text-red-900 dark:text-red-100">Validation Error</p><p class="text-xs text-red-700 dark:text-red-300 mt-1">', "</p></div>"], _tmpl$21 = ["<span", ">", "</span>"], _tmpl$22 = ["<a", ' rel="noopener noreferrer" class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></a>"], _tmpl$23 = ["<button", "", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></button>"], _tmpl$24 = ["<div", ' class="', '"><div class="grid gap-4" style="', '">', "</div></div>"], _tmpl$25 = ["<div", ' style="', '">', "</div>"];
|
|
8
8
|
function ChartRenderer(props) {
|
|
9
9
|
const [iframeUrl, setIframeUrl] = createSignal();
|
|
10
10
|
const [isLoading, setIsLoading] = createSignal(true);
|
|
11
11
|
const [error, setError] = createSignal();
|
|
12
|
-
|
|
12
|
+
createEffect(() => {
|
|
13
13
|
const chartParams = props.component.params;
|
|
14
|
+
if (!chartParams) return;
|
|
14
15
|
const chartConfig = {
|
|
15
16
|
type: chartParams.type,
|
|
16
17
|
data: chartParams.data,
|
|
@@ -25,168 +26,99 @@ function ChartRenderer(props) {
|
|
|
25
26
|
setIframeUrl(url);
|
|
26
27
|
setIsLoading(false);
|
|
27
28
|
});
|
|
28
|
-
return (()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
get children() {
|
|
59
|
-
var _el$8 = getNextElement(_tmpl$3);
|
|
60
|
-
insert(_el$8, () => props.component.params.title);
|
|
61
|
-
return _el$8;
|
|
62
|
-
}
|
|
63
|
-
}), _el$10, _co$);
|
|
64
|
-
_el$0.addEventListener("error", () => {
|
|
65
|
-
var _a;
|
|
66
|
-
setError("Failed to load chart");
|
|
67
|
-
(_a = props.onError) == null ? void 0 : _a.call(props, {
|
|
68
|
-
type: "render",
|
|
69
|
-
message: "Chart rendering failed",
|
|
70
|
-
componentId: props.component.id
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
effect(() => setAttribute(_el$0, "src", iframeUrl()));
|
|
74
|
-
return _el$7;
|
|
75
|
-
}
|
|
76
|
-
}), _el$16, _co$4);
|
|
77
|
-
return _el$;
|
|
78
|
-
})();
|
|
29
|
+
return ssr(_tmpl$5, ssrHydrationKey(), escape(createComponent(Show, {
|
|
30
|
+
get when() {
|
|
31
|
+
return isLoading();
|
|
32
|
+
},
|
|
33
|
+
get children() {
|
|
34
|
+
return ssr(_tmpl$, ssrHydrationKey());
|
|
35
|
+
}
|
|
36
|
+
})), escape(createComponent(Show, {
|
|
37
|
+
get when() {
|
|
38
|
+
return error();
|
|
39
|
+
},
|
|
40
|
+
get children() {
|
|
41
|
+
return ssr(_tmpl$2, ssrHydrationKey(), escape(error()));
|
|
42
|
+
}
|
|
43
|
+
})), escape(createComponent(Show, {
|
|
44
|
+
get when() {
|
|
45
|
+
return iframeUrl() && !error();
|
|
46
|
+
},
|
|
47
|
+
get children() {
|
|
48
|
+
return ssr(_tmpl$4, ssrHydrationKey(), escape(createComponent(Show, {
|
|
49
|
+
get when() {
|
|
50
|
+
return props.component.params.title;
|
|
51
|
+
},
|
|
52
|
+
get children() {
|
|
53
|
+
return ssr(_tmpl$3, ssrHydrationKey(), escape(props.component.params.title));
|
|
54
|
+
}
|
|
55
|
+
})), ssrAttribute("src", escape(iframeUrl(), true), false));
|
|
56
|
+
}
|
|
57
|
+
})));
|
|
79
58
|
}
|
|
80
59
|
function TableRenderer(props) {
|
|
81
60
|
const tableParams = props.component.params;
|
|
82
|
-
return (()
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
61
|
+
return ssr(_tmpl$7, ssrHydrationKey(), escape(createComponent(Show, {
|
|
62
|
+
get when() {
|
|
63
|
+
return tableParams.title;
|
|
64
|
+
},
|
|
65
|
+
get children() {
|
|
66
|
+
return ssr(_tmpl$3, ssrHydrationKey(), escape(tableParams.title));
|
|
67
|
+
}
|
|
68
|
+
})), escape(createComponent(For, {
|
|
69
|
+
get each() {
|
|
70
|
+
return tableParams.columns;
|
|
71
|
+
},
|
|
72
|
+
children: (column) => ssr(_tmpl$8, ssrHydrationKey(), ssrStyle(column.width ? {
|
|
73
|
+
width: column.width
|
|
74
|
+
} : {}), escape(column.label))
|
|
75
|
+
})), escape(createComponent(For, {
|
|
76
|
+
get each() {
|
|
77
|
+
return tableParams.rows.slice(0, DEFAULT_RESOURCE_LIMITS.maxTableRows);
|
|
78
|
+
},
|
|
79
|
+
children: (row, i) => ssr(_tmpl$9, ssrHydrationKey(), `hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${i() % 2 === 0 ? "bg-white dark:bg-gray-800" : "bg-gray-50/30 dark:bg-gray-800/50"}`, escape(createComponent(For, {
|
|
95
80
|
get each() {
|
|
96
81
|
return tableParams.columns;
|
|
97
82
|
},
|
|
98
|
-
children: (column) => (()
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
var _el$43 = getNextElement(_tmpl$9);
|
|
113
|
-
insert(_el$43, createComponent(For, {
|
|
114
|
-
get each() {
|
|
115
|
-
return tableParams.columns;
|
|
116
|
-
},
|
|
117
|
-
children: (column) => (() => {
|
|
118
|
-
var _el$44 = getNextElement(_tmpl$0), _el$45 = _el$44.firstChild;
|
|
119
|
-
effect(() => setProperty(_el$45, "innerHTML", typeof row[column.key] === "string" && (row[column.key].includes("[") || row[column.key].includes("**") || row[column.key].includes("`")) ? purify.sanitize(k.parse(row[column.key], {
|
|
120
|
-
async: false
|
|
121
|
-
}), {
|
|
122
|
-
ADD_ATTR: ["target", "rel"]
|
|
123
|
-
}) : row[column.key] || "-"));
|
|
124
|
-
return _el$44;
|
|
125
|
-
})()
|
|
126
|
-
}));
|
|
127
|
-
effect(() => className(_el$43, `hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${i() % 2 === 0 ? "bg-white dark:bg-gray-800" : "bg-gray-50/30 dark:bg-gray-800/50"}`));
|
|
128
|
-
return _el$43;
|
|
129
|
-
})()
|
|
130
|
-
}));
|
|
131
|
-
insert(_el$18, createComponent(Show, {
|
|
132
|
-
get when() {
|
|
133
|
-
return tableParams.pagination;
|
|
134
|
-
},
|
|
135
|
-
get children() {
|
|
136
|
-
var _el$25 = getNextElement(_tmpl$6), _el$26 = _el$25.firstChild, _el$27 = _el$26.firstChild, _el$32 = _el$27.nextSibling, [_el$33, _co$5] = getNextMarker(_el$32.nextSibling), _el$28 = _el$33.nextSibling, _el$34 = _el$28.nextSibling, [_el$35, _co$6] = getNextMarker(_el$34.nextSibling), _el$30 = _el$35.nextSibling, _el$36 = _el$30.nextSibling, [_el$37, _co$7] = getNextMarker(_el$36.nextSibling);
|
|
137
|
-
insert(_el$26, () => tableParams.pagination.currentPage * tableParams.pagination.pageSize + 1, _el$33, _co$5);
|
|
138
|
-
insert(_el$26, () => Math.min((tableParams.pagination.currentPage + 1) * tableParams.pagination.pageSize, tableParams.pagination.totalRows), _el$35, _co$6);
|
|
139
|
-
insert(_el$26, () => tableParams.pagination.totalRows, _el$37, _co$7);
|
|
140
|
-
return _el$25;
|
|
141
|
-
}
|
|
142
|
-
}), _el$41, _co$9);
|
|
143
|
-
return _el$17;
|
|
144
|
-
})();
|
|
83
|
+
children: (column) => ssr(_tmpl$0, ssrHydrationKey(), typeof row[column.key] === "string" && (row[column.key].includes("[") || row[column.key].includes("**") || row[column.key].includes("`")) ? purify.sanitize(k.parse(row[column.key], {
|
|
84
|
+
async: false
|
|
85
|
+
}), {
|
|
86
|
+
ADD_ATTR: ["target", "rel"]
|
|
87
|
+
}) : row[column.key] || "-")
|
|
88
|
+
})))
|
|
89
|
+
})), escape(createComponent(Show, {
|
|
90
|
+
get when() {
|
|
91
|
+
return tableParams.pagination;
|
|
92
|
+
},
|
|
93
|
+
get children() {
|
|
94
|
+
return ssr(_tmpl$6, ssrHydrationKey(), escape(tableParams.pagination.currentPage) * escape(tableParams.pagination.pageSize) + 1, escape(Math.min((tableParams.pagination.currentPage + 1) * tableParams.pagination.pageSize, tableParams.pagination.totalRows)), escape(tableParams.pagination.totalRows));
|
|
95
|
+
}
|
|
96
|
+
})));
|
|
145
97
|
}
|
|
146
98
|
function MetricRenderer(props) {
|
|
147
99
|
const metricParams = props.component.params;
|
|
148
|
-
return (()
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
var _c$ = memo(() => metricParams.trend.direction === "up");
|
|
171
|
-
return () => _c$() ? "�" : metricParams.trend.direction === "down" ? "�" : "�";
|
|
172
|
-
})(), _el$60, _co$1);
|
|
173
|
-
insert(_el$56, () => Math.abs(metricParams.trend.value), _el$62, _co$10);
|
|
174
|
-
effect(() => className(_el$56, `text-sm font-medium ${metricParams.trend.direction === "up" ? "text-green-600 dark:text-green-400" : metricParams.trend.direction === "down" ? "text-red-600 dark:text-red-400" : "text-gray-600 dark:text-gray-400"}`));
|
|
175
|
-
return _el$55;
|
|
176
|
-
}
|
|
177
|
-
}), _el$65, _co$11);
|
|
178
|
-
insert(_el$47, createComponent(Show, {
|
|
179
|
-
get when() {
|
|
180
|
-
return metricParams.subtitle;
|
|
181
|
-
},
|
|
182
|
-
get children() {
|
|
183
|
-
var _el$63 = getNextElement(_tmpl$11);
|
|
184
|
-
insert(_el$63, () => metricParams.subtitle);
|
|
185
|
-
return _el$63;
|
|
186
|
-
}
|
|
187
|
-
}), _el$67, _co$12);
|
|
188
|
-
return _el$46;
|
|
189
|
-
})();
|
|
100
|
+
return ssr(_tmpl$12, ssrHydrationKey(), escape(metricParams.title), escape(metricParams.value), escape(createComponent(Show, {
|
|
101
|
+
get when() {
|
|
102
|
+
return metricParams.unit;
|
|
103
|
+
},
|
|
104
|
+
get children() {
|
|
105
|
+
return ssr(_tmpl$1, ssrHydrationKey(), escape(metricParams.unit));
|
|
106
|
+
}
|
|
107
|
+
})), escape(createComponent(Show, {
|
|
108
|
+
get when() {
|
|
109
|
+
return metricParams.trend;
|
|
110
|
+
},
|
|
111
|
+
get children() {
|
|
112
|
+
return ssr(_tmpl$10, ssrHydrationKey(), `text-sm font-medium ${metricParams.trend.direction === "up" ? "text-green-600 dark:text-green-400" : metricParams.trend.direction === "down" ? "text-red-600 dark:text-red-400" : "text-gray-600 dark:text-gray-400"}`, metricParams.trend.direction === "up" ? "�" : metricParams.trend.direction === "down" ? "�" : "�", escape(Math.abs(metricParams.trend.value)));
|
|
113
|
+
}
|
|
114
|
+
})), escape(createComponent(Show, {
|
|
115
|
+
get when() {
|
|
116
|
+
return metricParams.subtitle;
|
|
117
|
+
},
|
|
118
|
+
get children() {
|
|
119
|
+
return ssr(_tmpl$11, ssrHydrationKey(), escape(metricParams.subtitle));
|
|
120
|
+
}
|
|
121
|
+
})));
|
|
190
122
|
}
|
|
191
123
|
function TextRenderer(props) {
|
|
192
124
|
const textParams = props.component.params;
|
|
@@ -198,99 +130,43 @@ function TextRenderer(props) {
|
|
|
198
130
|
}
|
|
199
131
|
return textParams.content;
|
|
200
132
|
});
|
|
201
|
-
return (()
|
|
202
|
-
var _el$68 = getNextElement(_tmpl$13), _el$69 = _el$68.firstChild;
|
|
203
|
-
effect((_p$) => {
|
|
204
|
-
var _v$ = `prose prose-sm dark:prose-invert max-w-none ${textParams.className || ""}`, _v$2 = htmlContent();
|
|
205
|
-
_v$ !== _p$.e && className(_el$69, _p$.e = _v$);
|
|
206
|
-
_v$2 !== _p$.t && setProperty(_el$69, "innerHTML", _p$.t = _v$2);
|
|
207
|
-
return _p$;
|
|
208
|
-
}, {
|
|
209
|
-
e: void 0,
|
|
210
|
-
t: void 0
|
|
211
|
-
});
|
|
212
|
-
return _el$68;
|
|
213
|
-
})();
|
|
133
|
+
return ssr(_tmpl$13, ssrHydrationKey(), `prose prose-sm dark:prose-invert max-w-none ${escape(textParams.className, true) || ""}`, htmlContent());
|
|
214
134
|
}
|
|
215
135
|
function IframeRenderer(props) {
|
|
216
136
|
const params = props.component.params;
|
|
217
|
-
return (()
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
insert(_el$72, () => params.title);
|
|
226
|
-
return _el$71;
|
|
227
|
-
}
|
|
228
|
-
}), _el$75, _co$13);
|
|
229
|
-
effect((_p$) => {
|
|
230
|
-
var _v$3 = params.url, _v$4 = params.title || "Embedded content", _v$5 = `height: ${params.height || "400px"}; min-height: 300px;`;
|
|
231
|
-
_v$3 !== _p$.e && setAttribute(_el$73, "src", _p$.e = _v$3);
|
|
232
|
-
_v$4 !== _p$.t && setAttribute(_el$73, "title", _p$.t = _v$4);
|
|
233
|
-
_p$.a = style(_el$73, _v$5, _p$.a);
|
|
234
|
-
return _p$;
|
|
235
|
-
}, {
|
|
236
|
-
e: void 0,
|
|
237
|
-
t: void 0,
|
|
238
|
-
a: void 0
|
|
239
|
-
});
|
|
240
|
-
return _el$70;
|
|
241
|
-
})();
|
|
137
|
+
return ssr(_tmpl$15, ssrHydrationKey(), escape(createComponent(Show, {
|
|
138
|
+
get when() {
|
|
139
|
+
return params.title;
|
|
140
|
+
},
|
|
141
|
+
get children() {
|
|
142
|
+
return ssr(_tmpl$14, ssrHydrationKey(), escape(params.title));
|
|
143
|
+
}
|
|
144
|
+
})), ssrAttribute("src", escape(params.url, true), false) + ssrAttribute("title", escape(params.title, true) || "Embedded content", false), ssrStyle(`height: ${params.height || "400px"}; min-height: 300px;`));
|
|
242
145
|
}
|
|
243
146
|
function ImageRenderer(props) {
|
|
244
147
|
const params = props.component.params;
|
|
245
|
-
return (()
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
insert(_el$81, () => params.caption);
|
|
254
|
-
return _el$80;
|
|
255
|
-
}
|
|
256
|
-
}), _el$83, _co$14);
|
|
257
|
-
effect((_p$) => {
|
|
258
|
-
var _v$6 = params.url, _v$7 = params.url, _v$8 = params.alt || "Image";
|
|
259
|
-
_v$6 !== _p$.e && setAttribute(_el$78, "href", _p$.e = _v$6);
|
|
260
|
-
_v$7 !== _p$.t && setAttribute(_el$79, "src", _p$.t = _v$7);
|
|
261
|
-
_v$8 !== _p$.a && setAttribute(_el$79, "alt", _p$.a = _v$8);
|
|
262
|
-
return _p$;
|
|
263
|
-
}, {
|
|
264
|
-
e: void 0,
|
|
265
|
-
t: void 0,
|
|
266
|
-
a: void 0
|
|
267
|
-
});
|
|
268
|
-
return _el$76;
|
|
269
|
-
})();
|
|
148
|
+
return ssr(_tmpl$17, ssrHydrationKey(), ssrAttribute("href", escape(params.url, true), false), ssrAttribute("src", escape(params.url, true), false) + ssrAttribute("alt", escape(params.alt, true) || "Image", false), escape(createComponent(Show, {
|
|
149
|
+
get when() {
|
|
150
|
+
return params.caption;
|
|
151
|
+
},
|
|
152
|
+
get children() {
|
|
153
|
+
return ssr(_tmpl$16, ssrHydrationKey(), escape(params.caption));
|
|
154
|
+
}
|
|
155
|
+
})));
|
|
270
156
|
}
|
|
271
157
|
function LinkRenderer(props) {
|
|
272
158
|
const params = props.component.params;
|
|
273
|
-
return (()
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
get children() {
|
|
282
|
-
var _el$88 = getNextElement(_tmpl$18);
|
|
283
|
-
insert(_el$88, () => params.description);
|
|
284
|
-
return _el$88;
|
|
285
|
-
}
|
|
286
|
-
}), _el$90, _co$15);
|
|
287
|
-
effect(() => setAttribute(_el$84, "href", params.url));
|
|
288
|
-
runHydrationEvents();
|
|
289
|
-
return _el$84;
|
|
290
|
-
})();
|
|
159
|
+
return ssr(_tmpl$19, ssrHydrationKey() + ssrAttribute("href", escape(params.url, true), false), escape(params.label) || escape(params.url), escape(createComponent(Show, {
|
|
160
|
+
get when() {
|
|
161
|
+
return params.description;
|
|
162
|
+
},
|
|
163
|
+
get children() {
|
|
164
|
+
return ssr(_tmpl$18, ssrHydrationKey(), escape(params.description));
|
|
165
|
+
}
|
|
166
|
+
})));
|
|
291
167
|
}
|
|
292
168
|
function ComponentRenderer(props) {
|
|
293
|
-
var _a;
|
|
169
|
+
var _a, _b, _c;
|
|
294
170
|
const validation = validateComponent(props.component);
|
|
295
171
|
if (!validation.valid) {
|
|
296
172
|
(_a = props.onError) == null ? void 0 : _a.call(props, {
|
|
@@ -299,14 +175,7 @@ function ComponentRenderer(props) {
|
|
|
299
175
|
componentId: props.component.id,
|
|
300
176
|
details: validation.errors
|
|
301
177
|
});
|
|
302
|
-
return (()
|
|
303
|
-
var _el$91 = getNextElement(_tmpl$20), _el$92 = _el$91.firstChild, _el$93 = _el$92.nextSibling;
|
|
304
|
-
insert(_el$93, () => {
|
|
305
|
-
var _a2, _b;
|
|
306
|
-
return ((_b = (_a2 = validation.errors) == null ? void 0 : _a2[0]) == null ? void 0 : _b.message) || "Unknown validation error";
|
|
307
|
-
});
|
|
308
|
-
return _el$91;
|
|
309
|
-
})();
|
|
178
|
+
return ssr(_tmpl$20, ssrHydrationKey(), escape((_c = (_b = validation.errors) == null ? void 0 : _b[0]) == null ? void 0 : _c.message) || "Unknown validation error");
|
|
310
179
|
}
|
|
311
180
|
return createComponent(GenerativeUIErrorBoundary, {
|
|
312
181
|
get componentId() {
|
|
@@ -420,89 +289,30 @@ function ComponentRenderer(props) {
|
|
|
420
289
|
}
|
|
421
290
|
function ActionRenderer(props) {
|
|
422
291
|
const params = props.component.params;
|
|
423
|
-
|
|
424
|
-
onMount(() => {
|
|
425
|
-
if (typeof window !== "undefined") {
|
|
426
|
-
dispatchAction = (toolName, toolParams) => {
|
|
427
|
-
const event = new CustomEvent("mcp-action", {
|
|
428
|
-
detail: {
|
|
429
|
-
toolName,
|
|
430
|
-
params: toolParams
|
|
431
|
-
},
|
|
432
|
-
bubbles: true
|
|
433
|
-
});
|
|
434
|
-
window.dispatchEvent(event);
|
|
435
|
-
};
|
|
436
|
-
}
|
|
292
|
+
createEffect(() => {
|
|
437
293
|
});
|
|
438
|
-
const handleClick = (e) => {
|
|
439
|
-
if (params.action === "tool-call" && params.toolName) {
|
|
440
|
-
e.preventDefault();
|
|
441
|
-
dispatchAction == null ? void 0 : dispatchAction(params.toolName, params.params || {});
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
294
|
if (params.type === "link" || params.action === "link") {
|
|
445
|
-
return (()
|
|
446
|
-
|
|
447
|
-
_el$94.$$click = handleClick;
|
|
448
|
-
insert(_el$94, createComponent(Show, {
|
|
449
|
-
get when() {
|
|
450
|
-
return params.icon;
|
|
451
|
-
},
|
|
452
|
-
get children() {
|
|
453
|
-
var _el$95 = getNextElement(_tmpl$21);
|
|
454
|
-
insert(_el$95, () => params.icon);
|
|
455
|
-
return _el$95;
|
|
456
|
-
}
|
|
457
|
-
}), _el$97, _co$16);
|
|
458
|
-
insert(_el$94, () => params.label, _el$99, _co$17);
|
|
459
|
-
effect((_p$) => {
|
|
460
|
-
var _v$9 = params.url || "#", _v$0 = params.url ? "_blank" : void 0, _v$1 = `inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors
|
|
461
|
-
${params.variant === "primary" ? "bg-blue-600 text-white hover:bg-blue-700" : params.variant === "outline" ? "border border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800" : "text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"}`;
|
|
462
|
-
_v$9 !== _p$.e && setAttribute(_el$94, "href", _p$.e = _v$9);
|
|
463
|
-
_v$0 !== _p$.t && setAttribute(_el$94, "target", _p$.t = _v$0);
|
|
464
|
-
_v$1 !== _p$.a && className(_el$94, _p$.a = _v$1);
|
|
465
|
-
return _p$;
|
|
466
|
-
}, {
|
|
467
|
-
e: void 0,
|
|
468
|
-
t: void 0,
|
|
469
|
-
a: void 0
|
|
470
|
-
});
|
|
471
|
-
runHydrationEvents();
|
|
472
|
-
return _el$94;
|
|
473
|
-
})();
|
|
474
|
-
}
|
|
475
|
-
return (() => {
|
|
476
|
-
var _el$100 = getNextElement(_tmpl$23), _el$102 = _el$100.firstChild, [_el$103, _co$18] = getNextMarker(_el$102.nextSibling), _el$104 = _el$103.nextSibling, [_el$105, _co$19] = getNextMarker(_el$104.nextSibling);
|
|
477
|
-
_el$100.$$click = handleClick;
|
|
478
|
-
insert(_el$100, createComponent(Show, {
|
|
295
|
+
return ssr(_tmpl$22, ssrHydrationKey() + ssrAttribute("href", escape(params.url, true) || "#", false) + ssrAttribute("target", params.url ? "_blank" : escape(void 0, true), false), `inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors
|
|
296
|
+
${params.variant === "primary" ? "bg-blue-600 text-white hover:bg-blue-700" : params.variant === "outline" ? "border border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800" : "text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"}`, escape(createComponent(Show, {
|
|
479
297
|
get when() {
|
|
480
298
|
return params.icon;
|
|
481
299
|
},
|
|
482
300
|
get children() {
|
|
483
|
-
|
|
484
|
-
insert(_el$101, () => params.icon);
|
|
485
|
-
return _el$101;
|
|
301
|
+
return ssr(_tmpl$21, ssrHydrationKey(), escape(params.icon));
|
|
486
302
|
}
|
|
487
|
-
}),
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
var _v$10 = params.action === "submit" ? "submit" : "button", _v$11 = params.disabled, _v$12 = `inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500
|
|
303
|
+
})), escape(params.label));
|
|
304
|
+
}
|
|
305
|
+
return ssr(_tmpl$23, ssrHydrationKey() + ssrAttribute("type", params.action === "submit" ? "submit" : "button", false), ssrAttribute("disabled", params.disabled, true), `inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500
|
|
491
306
|
${params.variant === "primary" ? "bg-blue-600 text-white hover:bg-blue-700 shadow-sm" : params.variant === "secondary" ? "bg-gray-100 text-gray-900 hover:bg-gray-200 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-600" : params.variant === "outline" ? "border border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800" : params.variant === "danger" ? "bg-red-600 text-white hover:bg-red-700" : "bg-transparent text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800"}
|
|
492
307
|
${params.disabled ? "opacity-50 cursor-not-allowed" : ""}
|
|
493
|
-
${params.size === "sm" ? "px-3 py-1.5 text-xs" : params.size === "lg" ? "px-6 py-3 text-base" : ""}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
a: void 0
|
|
502
|
-
});
|
|
503
|
-
runHydrationEvents();
|
|
504
|
-
return _el$100;
|
|
505
|
-
})();
|
|
308
|
+
${params.size === "sm" ? "px-3 py-1.5 text-xs" : params.size === "lg" ? "px-6 py-3 text-base" : ""}`, escape(createComponent(Show, {
|
|
309
|
+
get when() {
|
|
310
|
+
return params.icon;
|
|
311
|
+
},
|
|
312
|
+
get children() {
|
|
313
|
+
return ssr(_tmpl$21, ssrHydrationKey(), escape(params.icon));
|
|
314
|
+
}
|
|
315
|
+
})), escape(params.label));
|
|
506
316
|
}
|
|
507
317
|
const UIResourceRenderer = (props) => {
|
|
508
318
|
const layout = () => {
|
|
@@ -532,37 +342,18 @@ const UIResourceRenderer = (props) => {
|
|
|
532
342
|
} = component.position;
|
|
533
343
|
return `grid-column: ${colStart} / span ${colSpan}; grid-row: ${rowStart ? `${rowStart} / span ${rowSpan}` : "auto"}`;
|
|
534
344
|
};
|
|
535
|
-
return (()
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return props.onError;
|
|
547
|
-
}
|
|
548
|
-
}));
|
|
549
|
-
effect((_$p) => style(_el$108, getGridStyleString(component), _$p));
|
|
550
|
-
return _el$108;
|
|
551
|
-
})()
|
|
552
|
-
}));
|
|
553
|
-
effect((_p$) => {
|
|
554
|
-
var _v$13 = `w-full ${props.class || ""}`, _v$14 = gridContainerStyle();
|
|
555
|
-
_v$13 !== _p$.e && className(_el$106, _p$.e = _v$13);
|
|
556
|
-
_p$.t = style(_el$107, _v$14, _p$.t);
|
|
557
|
-
return _p$;
|
|
558
|
-
}, {
|
|
559
|
-
e: void 0,
|
|
560
|
-
t: void 0
|
|
561
|
-
});
|
|
562
|
-
return _el$106;
|
|
563
|
-
})();
|
|
345
|
+
return ssr(_tmpl$24, ssrHydrationKey(), `w-full ${escape(props.class, true) || ""}`, ssrStyle(gridContainerStyle()), escape(createComponent(For, {
|
|
346
|
+
get each() {
|
|
347
|
+
return layout().components;
|
|
348
|
+
},
|
|
349
|
+
children: (component) => ssr(_tmpl$25, ssrHydrationKey(), ssrStyle(getGridStyleString(component)), escape(createComponent(ComponentRenderer, {
|
|
350
|
+
component,
|
|
351
|
+
get onError() {
|
|
352
|
+
return props.onError;
|
|
353
|
+
}
|
|
354
|
+
})))
|
|
355
|
+
})));
|
|
564
356
|
};
|
|
565
|
-
delegateEvents(["click"]);
|
|
566
357
|
export {
|
|
567
358
|
UIResourceRenderer
|
|
568
359
|
};
|