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