@seed-ship/mcp-ui-solid 1.0.2
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 +36 -0
- package/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/StreamingUIRenderer-DQ1WoVV6.cjs +5 -0
- package/dist/StreamingUIRenderer-DQ1WoVV6.cjs.map +1 -0
- package/dist/StreamingUIRenderer-oyg_cKKl.js +757 -0
- package/dist/StreamingUIRenderer-oyg_cKKl.js.map +1 -0
- package/dist/components.cjs +2 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.js +7 -0
- package/dist/components.js.map +1 -0
- package/dist/hooks.cjs +2 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.js +5 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +296 -0
- package/dist/index.js.map +1 -0
- package/dist/types.cjs +2 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/useStreamingUI-BL0nh13E.js +187 -0
- package/dist/useStreamingUI-BL0nh13E.js.map +1 -0
- package/dist/useStreamingUI-CXmvpRhz.cjs +3 -0
- package/dist/useStreamingUI-CXmvpRhz.cjs.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,757 @@
|
|
|
1
|
+
import { delegateEvents as V, createComponent as s, memo as S, template as u, insert as l, addEventListener as J, effect as b, style as F, className as T, setStyleProperty as E, setAttribute as Q, use as Z } from "solid-js/web";
|
|
2
|
+
import { createSignal as k, ErrorBoundary as ee, Show as v, For as I, onMount as te } from "solid-js";
|
|
3
|
+
import { c as re, u as ne } from "./useStreamingUI-BL0nh13E.js";
|
|
4
|
+
const R = {
|
|
5
|
+
maxDataPoints: 1e3,
|
|
6
|
+
maxTableRows: 100,
|
|
7
|
+
maxPayloadSize: 50 * 1024,
|
|
8
|
+
// 50KB
|
|
9
|
+
renderTimeout: 5e3
|
|
10
|
+
// 5 seconds
|
|
11
|
+
};
|
|
12
|
+
function ae(e) {
|
|
13
|
+
const t = [];
|
|
14
|
+
return (e.colStart < 1 || e.colStart > 12) && t.push({
|
|
15
|
+
path: "position.colStart",
|
|
16
|
+
message: "Column start must be between 1 and 12",
|
|
17
|
+
code: "INVALID_GRID_COL_START"
|
|
18
|
+
}), (e.colSpan < 1 || e.colSpan > 12) && t.push({
|
|
19
|
+
path: "position.colSpan",
|
|
20
|
+
message: "Column span must be between 1 and 12",
|
|
21
|
+
code: "INVALID_GRID_COL_SPAN"
|
|
22
|
+
}), e.colStart + e.colSpan - 1 > 12 && t.push({
|
|
23
|
+
path: "position",
|
|
24
|
+
message: "Column start + span exceeds grid width (12)",
|
|
25
|
+
code: "GRID_OVERFLOW"
|
|
26
|
+
}), e.rowStart !== void 0 && e.rowStart < 1 && t.push({
|
|
27
|
+
path: "position.rowStart",
|
|
28
|
+
message: "Row start must be >= 1",
|
|
29
|
+
code: "INVALID_GRID_ROW_START"
|
|
30
|
+
}), e.rowSpan !== void 0 && e.rowSpan < 1 && t.push({
|
|
31
|
+
path: "position.rowSpan",
|
|
32
|
+
message: "Row span must be >= 1",
|
|
33
|
+
code: "INVALID_GRID_ROW_SPAN"
|
|
34
|
+
}), {
|
|
35
|
+
valid: t.length === 0,
|
|
36
|
+
errors: t.length > 0 ? t : void 0
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function le(e, t = R) {
|
|
40
|
+
const r = [], o = e.data.datasets.reduce(
|
|
41
|
+
(a, n) => a + n.data.length,
|
|
42
|
+
0
|
|
43
|
+
);
|
|
44
|
+
o > t.maxDataPoints && r.push({
|
|
45
|
+
path: "params.data",
|
|
46
|
+
message: `Chart exceeds max data points: ${o} > ${t.maxDataPoints}`,
|
|
47
|
+
code: "RESOURCE_LIMIT_EXCEEDED"
|
|
48
|
+
});
|
|
49
|
+
const i = e.data.labels.length;
|
|
50
|
+
for (const [a, n] of e.data.datasets.entries())
|
|
51
|
+
n.data.length !== i && r.push({
|
|
52
|
+
path: `params.data.datasets[${a}]`,
|
|
53
|
+
message: `Dataset length mismatch: expected ${i}, got ${n.data.length}`,
|
|
54
|
+
code: "DATA_LENGTH_MISMATCH"
|
|
55
|
+
});
|
|
56
|
+
for (const [a, n] of e.data.datasets.entries())
|
|
57
|
+
for (const [d, c] of n.data.entries())
|
|
58
|
+
(typeof c != "number" || !Number.isFinite(c)) && r.push({
|
|
59
|
+
path: `params.data.datasets[${a}].data[${d}]`,
|
|
60
|
+
message: `Invalid data value: ${c} (must be finite number)`,
|
|
61
|
+
code: "INVALID_DATA_TYPE"
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
valid: r.length === 0,
|
|
65
|
+
errors: r.length > 0 ? r : void 0
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function ie(e, t = R) {
|
|
69
|
+
const r = [];
|
|
70
|
+
e.rows.length > t.maxTableRows && r.push({
|
|
71
|
+
path: "params.rows",
|
|
72
|
+
message: `Table exceeds max rows: ${e.rows.length} > ${t.maxTableRows}`,
|
|
73
|
+
code: "RESOURCE_LIMIT_EXCEEDED"
|
|
74
|
+
}), e.columns.length === 0 && r.push({
|
|
75
|
+
path: "params.columns",
|
|
76
|
+
message: "Table must have at least one column",
|
|
77
|
+
code: "EMPTY_COLUMNS"
|
|
78
|
+
});
|
|
79
|
+
const o = /* @__PURE__ */ new Set();
|
|
80
|
+
for (const [i, a] of e.columns.entries())
|
|
81
|
+
o.has(a.key) && r.push({
|
|
82
|
+
path: `params.columns[${i}]`,
|
|
83
|
+
message: `Duplicate column key: ${a.key}`,
|
|
84
|
+
code: "DUPLICATE_COLUMN_KEY"
|
|
85
|
+
}), o.add(a.key);
|
|
86
|
+
for (const [i, a] of e.rows.entries())
|
|
87
|
+
for (const n of e.columns)
|
|
88
|
+
n.key in a || r.push({
|
|
89
|
+
path: `params.rows[${i}]`,
|
|
90
|
+
message: `Missing column key: ${n.key}`,
|
|
91
|
+
code: "MISSING_COLUMN_DATA"
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
valid: r.length === 0,
|
|
95
|
+
errors: r.length > 0 ? r : void 0
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function oe(e, t = R) {
|
|
99
|
+
const r = JSON.stringify(e).length;
|
|
100
|
+
return r > t.maxPayloadSize ? {
|
|
101
|
+
valid: !1,
|
|
102
|
+
errors: [
|
|
103
|
+
{
|
|
104
|
+
path: "component",
|
|
105
|
+
message: `Payload size exceeds limit: ${r} > ${t.maxPayloadSize} bytes`,
|
|
106
|
+
code: "PAYLOAD_TOO_LARGE"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
} : { valid: !0 };
|
|
110
|
+
}
|
|
111
|
+
function L(e, t = R) {
|
|
112
|
+
const r = [], o = ae(e.position);
|
|
113
|
+
o.valid || r.push(...o.errors || []);
|
|
114
|
+
const i = oe(e, t);
|
|
115
|
+
switch (i.valid || r.push(...i.errors || []), e.type) {
|
|
116
|
+
case "chart":
|
|
117
|
+
const a = le(e.params, t);
|
|
118
|
+
a.valid || r.push(...a.errors || []);
|
|
119
|
+
break;
|
|
120
|
+
case "table":
|
|
121
|
+
const n = ie(e.params, t);
|
|
122
|
+
n.valid || r.push(...n.errors || []);
|
|
123
|
+
break;
|
|
124
|
+
case "metric":
|
|
125
|
+
const d = e.params;
|
|
126
|
+
(!d.title || !d.value) && r.push({
|
|
127
|
+
path: "params",
|
|
128
|
+
message: "Metric must have title and value",
|
|
129
|
+
code: "INVALID_METRIC"
|
|
130
|
+
});
|
|
131
|
+
break;
|
|
132
|
+
case "text":
|
|
133
|
+
e.params.content || r.push({
|
|
134
|
+
path: "params",
|
|
135
|
+
message: "Text component must have content",
|
|
136
|
+
code: "INVALID_TEXT"
|
|
137
|
+
});
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
r.push({
|
|
141
|
+
path: "type",
|
|
142
|
+
message: `Unknown component type: ${e.type}`,
|
|
143
|
+
code: "UNKNOWN_COMPONENT_TYPE"
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
valid: r.length === 0,
|
|
148
|
+
errors: r.length > 0 ? r : void 0
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function tt(e, t = R) {
|
|
152
|
+
var o;
|
|
153
|
+
const r = [];
|
|
154
|
+
e.components.length === 0 && r.push({
|
|
155
|
+
path: "components",
|
|
156
|
+
message: "Layout must have at least one component",
|
|
157
|
+
code: "EMPTY_LAYOUT"
|
|
158
|
+
}), e.components.length > 12 && r.push({
|
|
159
|
+
path: "components",
|
|
160
|
+
message: `Layout exceeds max components: ${e.components.length} > 12`,
|
|
161
|
+
code: "TOO_MANY_COMPONENTS"
|
|
162
|
+
});
|
|
163
|
+
for (const [i, a] of e.components.entries()) {
|
|
164
|
+
const n = L(a, t);
|
|
165
|
+
n.valid || r.push(
|
|
166
|
+
...((o = n.errors) == null ? void 0 : o.map((d) => ({
|
|
167
|
+
...d,
|
|
168
|
+
path: `components[${i}].${d.path}`
|
|
169
|
+
}))) || []
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
return e.grid.columns !== 12 && r.push({
|
|
173
|
+
path: "grid.columns",
|
|
174
|
+
message: "Grid must have 12 columns (Bootstrap-like)",
|
|
175
|
+
code: "INVALID_GRID_COLUMNS"
|
|
176
|
+
}), {
|
|
177
|
+
valid: r.length === 0,
|
|
178
|
+
errors: r.length > 0 ? r : void 0
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
var se = /* @__PURE__ */ u('<p class="text-xs text-yellow-600 dark:text-yellow-400 mt-2 font-mono">'), de = /* @__PURE__ */ u('<button class="mt-3 text-xs font-medium text-yellow-800 dark:text-yellow-200 hover:text-yellow-900 dark:hover:text-yellow-100 underline">Retry Rendering'), ce = /* @__PURE__ */ u('<div class="w-full h-full bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4"><div class="flex items-start gap-3"><div class=flex-shrink-0><svg class="w-5 h-5 text-yellow-600 dark:text-yellow-400"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg></div><div class="flex-1 min-w-0"><p class="text-sm font-medium text-yellow-900 dark:text-yellow-100">Component Failed to Render</p><p class="text-xs text-yellow-700 dark:text-yellow-300 mt-1">Type: <!> | ID: <!>...');
|
|
182
|
+
const z = re("generative-ui");
|
|
183
|
+
function ue(e) {
|
|
184
|
+
return (() => {
|
|
185
|
+
var t = ce(), r = t.firstChild, o = r.firstChild, i = o.nextSibling, a = i.firstChild, n = a.nextSibling, d = n.firstChild, c = d.nextSibling, h = c.nextSibling, m = h.nextSibling;
|
|
186
|
+
return m.nextSibling, l(n, () => e.componentType, c), l(n, () => e.componentId.slice(0, 8), m), l(i, s(v, {
|
|
187
|
+
get when() {
|
|
188
|
+
return !1;
|
|
189
|
+
},
|
|
190
|
+
get children() {
|
|
191
|
+
var g = se();
|
|
192
|
+
return l(g, () => e.error.message), g;
|
|
193
|
+
}
|
|
194
|
+
}), null), l(i, s(v, {
|
|
195
|
+
get when() {
|
|
196
|
+
return e.allowRetry;
|
|
197
|
+
},
|
|
198
|
+
get children() {
|
|
199
|
+
var g = de();
|
|
200
|
+
return J(g, "click", e.onRetry, !0), g;
|
|
201
|
+
}
|
|
202
|
+
}), null), t;
|
|
203
|
+
})();
|
|
204
|
+
}
|
|
205
|
+
const Y = (e) => {
|
|
206
|
+
const [t, r] = k(0), [o] = k(performance.now()), i = (n) => {
|
|
207
|
+
var m;
|
|
208
|
+
const c = performance.now() - o(), h = {
|
|
209
|
+
componentId: e.componentId,
|
|
210
|
+
componentType: e.componentType,
|
|
211
|
+
errorMessage: n.message,
|
|
212
|
+
errorStack: n.stack,
|
|
213
|
+
renderDuration: c,
|
|
214
|
+
retryCount: t(),
|
|
215
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
216
|
+
userAgent: navigator.userAgent,
|
|
217
|
+
viewport: {
|
|
218
|
+
width: window.innerWidth,
|
|
219
|
+
height: window.innerHeight
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
z.error(`Component render failed: ${e.componentType}`, h), (m = e.onError) == null || m.call(e, {
|
|
223
|
+
type: "render",
|
|
224
|
+
message: n.message,
|
|
225
|
+
componentId: e.componentId,
|
|
226
|
+
details: h
|
|
227
|
+
});
|
|
228
|
+
}, a = () => {
|
|
229
|
+
const n = t() + 1;
|
|
230
|
+
z.info(`Retrying component render: ${e.componentType}`, {
|
|
231
|
+
componentId: e.componentId,
|
|
232
|
+
retryCount: n
|
|
233
|
+
}), r(n);
|
|
234
|
+
};
|
|
235
|
+
return s(ee, {
|
|
236
|
+
fallback: (n) => (i(n), e.fallback ? e.fallback(n, e.allowRetry ? a : void 0) : s(ue, {
|
|
237
|
+
error: n,
|
|
238
|
+
get componentId() {
|
|
239
|
+
return e.componentId;
|
|
240
|
+
},
|
|
241
|
+
get componentType() {
|
|
242
|
+
return e.componentType;
|
|
243
|
+
},
|
|
244
|
+
get allowRetry() {
|
|
245
|
+
return e.allowRetry;
|
|
246
|
+
},
|
|
247
|
+
onRetry: a
|
|
248
|
+
})),
|
|
249
|
+
get children() {
|
|
250
|
+
return t(), S(() => e.children);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
V(["click"]);
|
|
255
|
+
var me = /* @__PURE__ */ u('<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">'), ge = /* @__PURE__ */ u('<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">'), j = /* @__PURE__ */ u('<h3 class="text-sm font-semibold text-gray-900 dark:text-white mb-3">'), he = /* @__PURE__ */ u('<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">'), ve = /* @__PURE__ */ u('<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">'), fe = /* @__PURE__ */ u('<div class="mt-3 flex items-center justify-between text-xs text-gray-500 dark:text-gray-400"><span>Showing <!> - <!> of '), xe = /* @__PURE__ */ u('<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"><thead class="bg-gray-50 dark:bg-gray-900"><tr></tr></thead><tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">'), pe = /* @__PURE__ */ u('<th scope=col class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">'), $e = /* @__PURE__ */ u('<tr class="hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">'), ye = /* @__PURE__ */ u('<td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100 whitespace-nowrap">'), _e = /* @__PURE__ */ u('<span class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400">'), be = /* @__PURE__ */ u('<div class="mt-3 flex items-center"><span> <!>%'), we = /* @__PURE__ */ u('<p class="mt-2 text-xs text-gray-500 dark:text-gray-400">'), Ce = /* @__PURE__ */ u('<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">'), Se = /* @__PURE__ */ u('<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>'), ke = /* @__PURE__ */ u('<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">'), Ie = /* @__PURE__ */ u('<div><div class="grid gap-4">'), Re = /* @__PURE__ */ u("<div>");
|
|
256
|
+
function Ee(e) {
|
|
257
|
+
const [t, r] = k(), [o, i] = k(!0), [a, n] = k();
|
|
258
|
+
return te(() => {
|
|
259
|
+
const d = e.component.params, c = {
|
|
260
|
+
type: d.type,
|
|
261
|
+
data: d.data,
|
|
262
|
+
options: {
|
|
263
|
+
...d.options,
|
|
264
|
+
responsive: !0,
|
|
265
|
+
maintainAspectRatio: !1
|
|
266
|
+
}
|
|
267
|
+
}, m = `https://quickchart.io/chart?c=${encodeURIComponent(JSON.stringify(c))}&width=500&height=300&devicePixelRatio=2`;
|
|
268
|
+
r(m), i(!1);
|
|
269
|
+
}), (() => {
|
|
270
|
+
var d = ve();
|
|
271
|
+
return l(d, s(v, {
|
|
272
|
+
get when() {
|
|
273
|
+
return o();
|
|
274
|
+
},
|
|
275
|
+
get children() {
|
|
276
|
+
return me();
|
|
277
|
+
}
|
|
278
|
+
}), null), l(d, s(v, {
|
|
279
|
+
get when() {
|
|
280
|
+
return a();
|
|
281
|
+
},
|
|
282
|
+
get children() {
|
|
283
|
+
var c = ge(), h = c.firstChild, m = h.firstChild, g = m.nextSibling;
|
|
284
|
+
return l(g, a), c;
|
|
285
|
+
}
|
|
286
|
+
}), null), l(d, s(v, {
|
|
287
|
+
get when() {
|
|
288
|
+
return S(() => !!t())() && !a();
|
|
289
|
+
},
|
|
290
|
+
get children() {
|
|
291
|
+
var c = he(), h = c.firstChild, m = h.firstChild;
|
|
292
|
+
return l(c, s(v, {
|
|
293
|
+
get when() {
|
|
294
|
+
return e.component.params.title;
|
|
295
|
+
},
|
|
296
|
+
get children() {
|
|
297
|
+
var g = j();
|
|
298
|
+
return l(g, () => e.component.params.title), g;
|
|
299
|
+
}
|
|
300
|
+
}), h), m.addEventListener("error", () => {
|
|
301
|
+
var g;
|
|
302
|
+
n("Failed to load chart"), (g = e.onError) == null || g.call(e, {
|
|
303
|
+
type: "render",
|
|
304
|
+
message: "Chart rendering failed",
|
|
305
|
+
componentId: e.component.id
|
|
306
|
+
});
|
|
307
|
+
}), b(() => Q(m, "src", t())), c;
|
|
308
|
+
}
|
|
309
|
+
}), null), d;
|
|
310
|
+
})();
|
|
311
|
+
}
|
|
312
|
+
function Te(e) {
|
|
313
|
+
const t = e.component.params;
|
|
314
|
+
return (() => {
|
|
315
|
+
var r = xe(), o = r.firstChild, i = o.firstChild, a = i.firstChild, n = a.firstChild, d = n.firstChild, c = n.nextSibling;
|
|
316
|
+
return l(o, s(v, {
|
|
317
|
+
get when() {
|
|
318
|
+
return t.title;
|
|
319
|
+
},
|
|
320
|
+
get children() {
|
|
321
|
+
var h = j();
|
|
322
|
+
return l(h, () => t.title), h;
|
|
323
|
+
}
|
|
324
|
+
}), i), l(d, s(I, {
|
|
325
|
+
get each() {
|
|
326
|
+
return t.columns;
|
|
327
|
+
},
|
|
328
|
+
children: (h) => (() => {
|
|
329
|
+
var m = pe();
|
|
330
|
+
return l(m, () => h.label), b((g) => F(m, h.width ? {
|
|
331
|
+
width: h.width
|
|
332
|
+
} : {}, g)), m;
|
|
333
|
+
})()
|
|
334
|
+
})), l(c, s(I, {
|
|
335
|
+
get each() {
|
|
336
|
+
return t.rows.slice(0, R.maxTableRows);
|
|
337
|
+
},
|
|
338
|
+
children: (h) => (() => {
|
|
339
|
+
var m = $e();
|
|
340
|
+
return l(m, s(I, {
|
|
341
|
+
get each() {
|
|
342
|
+
return t.columns;
|
|
343
|
+
},
|
|
344
|
+
children: (g) => (() => {
|
|
345
|
+
var y = ye();
|
|
346
|
+
return l(y, () => h[g.key] || "-"), y;
|
|
347
|
+
})()
|
|
348
|
+
})), m;
|
|
349
|
+
})()
|
|
350
|
+
})), l(o, s(v, {
|
|
351
|
+
get when() {
|
|
352
|
+
return t.pagination;
|
|
353
|
+
},
|
|
354
|
+
get children() {
|
|
355
|
+
var h = fe(), m = h.firstChild, g = m.firstChild, y = g.nextSibling, f = y.nextSibling, p = f.nextSibling;
|
|
356
|
+
return p.nextSibling, l(m, () => t.pagination.currentPage * t.pagination.pageSize + 1, y), l(m, () => Math.min((t.pagination.currentPage + 1) * t.pagination.pageSize, t.pagination.totalRows), p), l(m, () => t.pagination.totalRows, null), h;
|
|
357
|
+
}
|
|
358
|
+
}), null), r;
|
|
359
|
+
})();
|
|
360
|
+
}
|
|
361
|
+
function De(e) {
|
|
362
|
+
const t = e.component.params;
|
|
363
|
+
return (() => {
|
|
364
|
+
var r = Ce(), o = r.firstChild, i = o.firstChild, a = i.firstChild, n = a.nextSibling, d = n.firstChild;
|
|
365
|
+
return l(a, () => t.title), l(d, () => t.value), l(n, s(v, {
|
|
366
|
+
get when() {
|
|
367
|
+
return t.unit;
|
|
368
|
+
},
|
|
369
|
+
get children() {
|
|
370
|
+
var c = _e();
|
|
371
|
+
return l(c, () => t.unit), c;
|
|
372
|
+
}
|
|
373
|
+
}), null), l(o, s(v, {
|
|
374
|
+
get when() {
|
|
375
|
+
return t.trend;
|
|
376
|
+
},
|
|
377
|
+
get children() {
|
|
378
|
+
var c = be(), h = c.firstChild, m = h.firstChild, g = m.nextSibling;
|
|
379
|
+
return g.nextSibling, l(h, (() => {
|
|
380
|
+
var y = S(() => t.trend.direction === "up");
|
|
381
|
+
return () => (y() || t.trend.direction === "down", "�");
|
|
382
|
+
})(), m), l(h, () => Math.abs(t.trend.value), g), b(() => T(h, `text-sm font-medium ${t.trend.direction === "up" ? "text-green-600 dark:text-green-400" : t.trend.direction === "down" ? "text-red-600 dark:text-red-400" : "text-gray-600 dark:text-gray-400"}`)), c;
|
|
383
|
+
}
|
|
384
|
+
}), null), l(o, s(v, {
|
|
385
|
+
get when() {
|
|
386
|
+
return t.subtitle;
|
|
387
|
+
},
|
|
388
|
+
get children() {
|
|
389
|
+
var c = we();
|
|
390
|
+
return l(c, () => t.subtitle), c;
|
|
391
|
+
}
|
|
392
|
+
}), null), r;
|
|
393
|
+
})();
|
|
394
|
+
}
|
|
395
|
+
function Le(e) {
|
|
396
|
+
const t = e.component.params;
|
|
397
|
+
return (() => {
|
|
398
|
+
var r = Se(), o = r.firstChild;
|
|
399
|
+
return b((i) => {
|
|
400
|
+
var a = `prose prose-sm dark:prose-invert max-w-none ${t.className || ""}`, n = t.content;
|
|
401
|
+
return a !== i.e && T(o, i.e = a), n !== i.t && (o.innerHTML = i.t = n), i;
|
|
402
|
+
}, {
|
|
403
|
+
e: void 0,
|
|
404
|
+
t: void 0
|
|
405
|
+
}), r;
|
|
406
|
+
})();
|
|
407
|
+
}
|
|
408
|
+
function Pe(e) {
|
|
409
|
+
var r;
|
|
410
|
+
const t = L(e.component);
|
|
411
|
+
return t.valid ? s(Y, {
|
|
412
|
+
get componentId() {
|
|
413
|
+
return e.component.id;
|
|
414
|
+
},
|
|
415
|
+
get componentType() {
|
|
416
|
+
return e.component.type;
|
|
417
|
+
},
|
|
418
|
+
get onError() {
|
|
419
|
+
return e.onError;
|
|
420
|
+
},
|
|
421
|
+
allowRetry: !0,
|
|
422
|
+
get children() {
|
|
423
|
+
return [s(v, {
|
|
424
|
+
get when() {
|
|
425
|
+
return e.component.type === "chart";
|
|
426
|
+
},
|
|
427
|
+
get children() {
|
|
428
|
+
return s(Ee, {
|
|
429
|
+
get component() {
|
|
430
|
+
return e.component;
|
|
431
|
+
},
|
|
432
|
+
get onError() {
|
|
433
|
+
return e.onError;
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}), s(v, {
|
|
438
|
+
get when() {
|
|
439
|
+
return e.component.type === "table";
|
|
440
|
+
},
|
|
441
|
+
get children() {
|
|
442
|
+
return s(Te, {
|
|
443
|
+
get component() {
|
|
444
|
+
return e.component;
|
|
445
|
+
},
|
|
446
|
+
get onError() {
|
|
447
|
+
return e.onError;
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
}), s(v, {
|
|
452
|
+
get when() {
|
|
453
|
+
return e.component.type === "metric";
|
|
454
|
+
},
|
|
455
|
+
get children() {
|
|
456
|
+
return s(De, {
|
|
457
|
+
get component() {
|
|
458
|
+
return e.component;
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}), s(v, {
|
|
463
|
+
get when() {
|
|
464
|
+
return e.component.type === "text";
|
|
465
|
+
},
|
|
466
|
+
get children() {
|
|
467
|
+
return s(Le, {
|
|
468
|
+
get component() {
|
|
469
|
+
return e.component;
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
})];
|
|
474
|
+
}
|
|
475
|
+
}) : ((r = e.onError) == null || r.call(e, {
|
|
476
|
+
type: "validation",
|
|
477
|
+
message: "Component validation failed",
|
|
478
|
+
componentId: e.component.id,
|
|
479
|
+
details: t.errors
|
|
480
|
+
}), (() => {
|
|
481
|
+
var o = ke(), i = o.firstChild, a = i.nextSibling;
|
|
482
|
+
return l(a, () => {
|
|
483
|
+
var n, d;
|
|
484
|
+
return ((d = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : d.message) || "Unknown validation error";
|
|
485
|
+
}), o;
|
|
486
|
+
})());
|
|
487
|
+
}
|
|
488
|
+
const rt = (e) => {
|
|
489
|
+
const t = () => "type" in e.content ? {
|
|
490
|
+
id: "single-component",
|
|
491
|
+
components: [e.content],
|
|
492
|
+
grid: {
|
|
493
|
+
columns: 12,
|
|
494
|
+
gap: "1rem"
|
|
495
|
+
}
|
|
496
|
+
} : e.content, r = (o) => {
|
|
497
|
+
const {
|
|
498
|
+
colStart: i,
|
|
499
|
+
colSpan: a,
|
|
500
|
+
rowStart: n,
|
|
501
|
+
rowSpan: d = 1
|
|
502
|
+
} = o.position;
|
|
503
|
+
return {
|
|
504
|
+
"grid-column": `${i} / span ${a}`,
|
|
505
|
+
"grid-row": n ? `${n} / span ${d}` : "auto"
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
return (() => {
|
|
509
|
+
var o = Ie(), i = o.firstChild;
|
|
510
|
+
return l(i, s(I, {
|
|
511
|
+
get each() {
|
|
512
|
+
return t().components;
|
|
513
|
+
},
|
|
514
|
+
children: (a) => (() => {
|
|
515
|
+
var n = Re();
|
|
516
|
+
return l(n, s(Pe, {
|
|
517
|
+
component: a,
|
|
518
|
+
get onError() {
|
|
519
|
+
return e.onError;
|
|
520
|
+
}
|
|
521
|
+
})), b((d) => F(n, r(a), d)), n;
|
|
522
|
+
})()
|
|
523
|
+
})), b((a) => {
|
|
524
|
+
var n = `w-full ${e.class || ""}`, d = `repeat(${t().grid.columns}, 1fr)`, c = t().grid.gap;
|
|
525
|
+
return n !== a.e && T(o, a.e = n), d !== a.t && E(i, "grid-template-columns", a.t = d), c !== a.a && E(i, "gap", a.a = c), a;
|
|
526
|
+
}, {
|
|
527
|
+
e: void 0,
|
|
528
|
+
t: void 0,
|
|
529
|
+
a: void 0
|
|
530
|
+
}), o;
|
|
531
|
+
})();
|
|
532
|
+
};
|
|
533
|
+
var Ae = /* @__PURE__ */ u('<div class="w-full bg-error-subtle border border-border-error rounded-lg p-4"><p class="text-sm font-medium text-error-primary">Validation Error</p><p class="text-xs text-text-secondary mt-1">'), Me = /* @__PURE__ */ u('<h3 class="text-sm font-semibold text-text-primary">'), Ne = /* @__PURE__ */ u('<span class="text-sm text-text-secondary">'), Oe = /* @__PURE__ */ u('<div class=mt-2><p class="text-2xl font-semibold text-text-primary">'), Ue = /* @__PURE__ */ u('<div class="w-full bg-surface-secondary border border-border-subtle rounded-lg p-4"><div class="flex items-center gap-2 mb-2"><span class="text-xs font-medium text-text-tertiary uppercase"></span></div><div class="mt-3 text-xs text-text-tertiary">Component ID: <!>...'), Ge = /* @__PURE__ */ u('<span class="text-sm text-text-secondary"> / '), ze = /* @__PURE__ */ u('<div class=mt-2><div class="h-1 w-full overflow-hidden rounded-full bg-surface-tertiary"><div class="animate-progress-indeterminate h-full w-1/3 bg-brand-primary">'), Ve = /* @__PURE__ */ u('<div class="mb-4 rounded-lg border border-border-subtle bg-surface-secondary p-4"><div class="mb-2 flex items-center justify-between"><span class="text-sm font-medium text-text-primary"></span></div><div class="h-2 w-full overflow-hidden rounded-full bg-surface-tertiary"><div class="h-full bg-brand-primary transition-all duration-300 ease-out">'), Fe = /* @__PURE__ */ u('<button type=button class="mt-3 rounded-md bg-error-primary px-3 py-1.5 text-sm font-medium text-white hover:bg-error-hover">Retry'), Ye = /* @__PURE__ */ u('<div class="mb-4 rounded-lg border border-border-error bg-error-subtle p-4"><div class="mb-2 flex items-center gap-2"><svg class="h-5 w-5 text-error-primary"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span class="font-medium text-error-primary"></span></div><p class="text-sm text-text-secondary">'), je = /* @__PURE__ */ u('<div><div class="font-medium text-text-primary">Cost</div><div>$'), Be = /* @__PURE__ */ u('<div><div class="font-medium text-text-primary">Cached</div><div class=text-success-primary>Yes'), Ke = /* @__PURE__ */ u('<div class="mt-6 rounded-lg border border-border-subtle bg-surface-secondary p-4 text-sm text-text-secondary"><div class="grid grid-cols-2 gap-4 md:grid-cols-4"><div><div class="font-medium text-text-primary">Provider</div><div></div></div><div><div class="font-medium text-text-primary">Model</div><div></div></div><div><div class="font-medium text-text-primary">Execution Time</div><div>ms</div></div><div><div class="font-medium text-text-primary">TTFB</div><div>ms'), We = /* @__PURE__ */ u('<div><div class="grid grid-cols-12 gap-4">'), He = /* @__PURE__ */ u("<div>"), qe = /* @__PURE__ */ u('<div class="col-span-12 md:col-span-6 lg:col-span-4"><div class="animate-pulse rounded-lg border border-border-subtle bg-surface-secondary p-4"><div class="mb-4 h-6 w-1/2 rounded bg-surface-tertiary"></div><div class=space-y-3><div class="h-4 rounded bg-surface-tertiary"></div><div class="h-4 w-5/6 rounded bg-surface-tertiary"></div><div class="h-4 w-4/6 rounded bg-surface-tertiary"></div></div><div class="mt-4 h-32 rounded bg-surface-tertiary">');
|
|
534
|
+
function Xe(e) {
|
|
535
|
+
var o;
|
|
536
|
+
const t = L(e.component);
|
|
537
|
+
if (!t.valid)
|
|
538
|
+
return (o = e.onError) == null || o.call(e, {
|
|
539
|
+
type: "validation",
|
|
540
|
+
message: "Component validation failed",
|
|
541
|
+
componentId: e.component.id,
|
|
542
|
+
details: t.errors
|
|
543
|
+
}), (() => {
|
|
544
|
+
var i = Ae(), a = i.firstChild, n = a.nextSibling;
|
|
545
|
+
return l(n, () => {
|
|
546
|
+
var d, c;
|
|
547
|
+
return ((c = (d = t.errors) == null ? void 0 : d[0]) == null ? void 0 : c.message) || "Unknown validation error";
|
|
548
|
+
}), i;
|
|
549
|
+
})();
|
|
550
|
+
const r = e.component.params;
|
|
551
|
+
return s(Y, {
|
|
552
|
+
get componentId() {
|
|
553
|
+
return e.component.id;
|
|
554
|
+
},
|
|
555
|
+
get componentType() {
|
|
556
|
+
return e.component.type;
|
|
557
|
+
},
|
|
558
|
+
get onError() {
|
|
559
|
+
return e.onError;
|
|
560
|
+
},
|
|
561
|
+
allowRetry: !1,
|
|
562
|
+
get children() {
|
|
563
|
+
var i = Ue(), a = i.firstChild, n = a.firstChild, d = a.nextSibling, c = d.firstChild, h = c.nextSibling;
|
|
564
|
+
return h.nextSibling, l(n, () => e.component.type), l(i, s(v, {
|
|
565
|
+
get when() {
|
|
566
|
+
return r == null ? void 0 : r.title;
|
|
567
|
+
},
|
|
568
|
+
get children() {
|
|
569
|
+
var m = Me();
|
|
570
|
+
return l(m, () => r.title), m;
|
|
571
|
+
}
|
|
572
|
+
}), d), l(i, s(v, {
|
|
573
|
+
get when() {
|
|
574
|
+
return S(() => e.component.type === "metric")() && (r == null ? void 0 : r.value);
|
|
575
|
+
},
|
|
576
|
+
get children() {
|
|
577
|
+
var m = Oe(), g = m.firstChild;
|
|
578
|
+
return l(g, () => r.value), l(m, s(v, {
|
|
579
|
+
get when() {
|
|
580
|
+
return r.unit;
|
|
581
|
+
},
|
|
582
|
+
get children() {
|
|
583
|
+
var y = Ne();
|
|
584
|
+
return l(y, () => r.unit), y;
|
|
585
|
+
}
|
|
586
|
+
}), null), m;
|
|
587
|
+
}
|
|
588
|
+
}), d), l(d, () => e.component.id.slice(0, 8), h), i;
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
function nt(e) {
|
|
593
|
+
const {
|
|
594
|
+
components: t,
|
|
595
|
+
isLoading: r,
|
|
596
|
+
isStreaming: o,
|
|
597
|
+
error: i,
|
|
598
|
+
progress: a,
|
|
599
|
+
metadata: n,
|
|
600
|
+
startStreaming: d
|
|
601
|
+
} = ne({
|
|
602
|
+
query: e.query,
|
|
603
|
+
spaceIds: e.spaceIds,
|
|
604
|
+
sessionId: e.sessionId,
|
|
605
|
+
options: e.options,
|
|
606
|
+
onComplete: e.onComplete,
|
|
607
|
+
onError: e.onError,
|
|
608
|
+
onComponentReceived: e.onComponentReceived
|
|
609
|
+
}), [c, h] = k(/* @__PURE__ */ new Set()), m = (g) => {
|
|
610
|
+
h((y) => /* @__PURE__ */ new Set([...y, g])), setTimeout(() => {
|
|
611
|
+
h((y) => {
|
|
612
|
+
const f = new Set(y);
|
|
613
|
+
return f.delete(g), f;
|
|
614
|
+
});
|
|
615
|
+
}, 500);
|
|
616
|
+
};
|
|
617
|
+
return (() => {
|
|
618
|
+
var g = We(), y = g.firstChild;
|
|
619
|
+
return l(g, s(v, {
|
|
620
|
+
get when() {
|
|
621
|
+
return S(() => e.showProgress !== !1)() && (r() || o());
|
|
622
|
+
},
|
|
623
|
+
get children() {
|
|
624
|
+
var f = Ve(), p = f.firstChild, _ = p.firstChild, w = p.nextSibling, C = w.firstChild;
|
|
625
|
+
return l(_, () => a().message), l(p, s(v, {
|
|
626
|
+
get when() {
|
|
627
|
+
return a().totalCount !== null;
|
|
628
|
+
},
|
|
629
|
+
get children() {
|
|
630
|
+
var x = Ge(), D = x.firstChild;
|
|
631
|
+
return l(x, () => a().receivedCount, D), l(x, () => a().totalCount, null), x;
|
|
632
|
+
}
|
|
633
|
+
}), null), l(f, s(v, {
|
|
634
|
+
get when() {
|
|
635
|
+
return S(() => a().totalCount === null)() && o();
|
|
636
|
+
},
|
|
637
|
+
get children() {
|
|
638
|
+
return ze();
|
|
639
|
+
}
|
|
640
|
+
}), null), b((x) => E(C, "width", a().totalCount !== null ? `${a().receivedCount / a().totalCount * 100}%` : "0%")), f;
|
|
641
|
+
}
|
|
642
|
+
}), y), l(g, s(v, {
|
|
643
|
+
get when() {
|
|
644
|
+
return i();
|
|
645
|
+
},
|
|
646
|
+
get children() {
|
|
647
|
+
var f = Ye(), p = f.firstChild, _ = p.firstChild, w = _.nextSibling, C = p.nextSibling;
|
|
648
|
+
return l(w, () => {
|
|
649
|
+
var x;
|
|
650
|
+
return (x = i()) == null ? void 0 : x.error;
|
|
651
|
+
}), l(C, () => {
|
|
652
|
+
var x;
|
|
653
|
+
return (x = i()) == null ? void 0 : x.message;
|
|
654
|
+
}), l(f, s(v, {
|
|
655
|
+
get when() {
|
|
656
|
+
var x;
|
|
657
|
+
return (x = i()) == null ? void 0 : x.recoverable;
|
|
658
|
+
},
|
|
659
|
+
get children() {
|
|
660
|
+
var x = Fe();
|
|
661
|
+
return x.$$click = () => d(), x;
|
|
662
|
+
}
|
|
663
|
+
}), null), f;
|
|
664
|
+
}
|
|
665
|
+
}), y), l(y, s(I, {
|
|
666
|
+
get each() {
|
|
667
|
+
return t();
|
|
668
|
+
},
|
|
669
|
+
children: (f) => (() => {
|
|
670
|
+
var p = He();
|
|
671
|
+
return Z(() => m(f.id), p), l(p, s(Xe, {
|
|
672
|
+
component: f,
|
|
673
|
+
get onError() {
|
|
674
|
+
return e.onRenderError;
|
|
675
|
+
}
|
|
676
|
+
})), b((_) => {
|
|
677
|
+
var w = `
|
|
678
|
+
col-span-${f.position.colSpan}
|
|
679
|
+
${c().has(f.id) ? "animate-fade-in-up" : ""}
|
|
680
|
+
`, C = f.position.colStart, x = f.position.colStart + f.position.colSpan;
|
|
681
|
+
return w !== _.e && T(p, _.e = w), C !== _.t && E(p, "grid-column-start", _.t = C), x !== _.a && E(p, "grid-column-end", _.a = x), _;
|
|
682
|
+
}, {
|
|
683
|
+
e: void 0,
|
|
684
|
+
t: void 0,
|
|
685
|
+
a: void 0
|
|
686
|
+
}), p;
|
|
687
|
+
})()
|
|
688
|
+
}), null), l(y, s(v, {
|
|
689
|
+
get when() {
|
|
690
|
+
return S(() => !!o())() && a().totalCount !== null;
|
|
691
|
+
},
|
|
692
|
+
get children() {
|
|
693
|
+
return s(I, {
|
|
694
|
+
get each() {
|
|
695
|
+
return Array.from({
|
|
696
|
+
length: a().totalCount - a().receivedCount
|
|
697
|
+
});
|
|
698
|
+
},
|
|
699
|
+
children: () => s(Je, {})
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
}), null), l(g, s(v, {
|
|
703
|
+
get when() {
|
|
704
|
+
return S(() => e.showMetadata !== !1)() && n();
|
|
705
|
+
},
|
|
706
|
+
get children() {
|
|
707
|
+
var f = Ke(), p = f.firstChild, _ = p.firstChild, w = _.firstChild, C = w.nextSibling, x = _.nextSibling, D = x.firstChild, B = D.nextSibling, P = x.nextSibling, K = P.firstChild, A = K.nextSibling, W = A.firstChild, M = P.nextSibling, H = M.firstChild, N = H.nextSibling, q = N.firstChild;
|
|
708
|
+
return l(C, () => {
|
|
709
|
+
var $;
|
|
710
|
+
return ($ = n()) == null ? void 0 : $.provider;
|
|
711
|
+
}), l(B, () => {
|
|
712
|
+
var $;
|
|
713
|
+
return ($ = n()) == null ? void 0 : $.model;
|
|
714
|
+
}), l(A, () => {
|
|
715
|
+
var $;
|
|
716
|
+
return ($ = n()) == null ? void 0 : $.executionTimeMs;
|
|
717
|
+
}, W), l(p, s(v, {
|
|
718
|
+
get when() {
|
|
719
|
+
var $;
|
|
720
|
+
return (($ = n()) == null ? void 0 : $.costUSD) !== void 0;
|
|
721
|
+
},
|
|
722
|
+
get children() {
|
|
723
|
+
var $ = je(), X = $.firstChild, O = X.nextSibling;
|
|
724
|
+
return O.firstChild, l(O, () => {
|
|
725
|
+
var U, G;
|
|
726
|
+
return (G = (U = n()) == null ? void 0 : U.costUSD) == null ? void 0 : G.toFixed(4);
|
|
727
|
+
}, null), $;
|
|
728
|
+
}
|
|
729
|
+
}), M), l(N, () => {
|
|
730
|
+
var $;
|
|
731
|
+
return ($ = n()) == null ? void 0 : $.firstTokenMs;
|
|
732
|
+
}, q), l(p, s(v, {
|
|
733
|
+
get when() {
|
|
734
|
+
var $;
|
|
735
|
+
return ($ = n()) == null ? void 0 : $.cached;
|
|
736
|
+
},
|
|
737
|
+
get children() {
|
|
738
|
+
return Be();
|
|
739
|
+
}
|
|
740
|
+
}), null), f;
|
|
741
|
+
}
|
|
742
|
+
}), null), b(() => T(g, `streaming-ui-renderer ${e.class || ""}`)), g;
|
|
743
|
+
})();
|
|
744
|
+
}
|
|
745
|
+
function Je() {
|
|
746
|
+
return qe();
|
|
747
|
+
}
|
|
748
|
+
V(["click"]);
|
|
749
|
+
export {
|
|
750
|
+
R as D,
|
|
751
|
+
Y as G,
|
|
752
|
+
nt as S,
|
|
753
|
+
rt as U,
|
|
754
|
+
tt as a,
|
|
755
|
+
L as v
|
|
756
|
+
};
|
|
757
|
+
//# sourceMappingURL=StreamingUIRenderer-oyg_cKKl.js.map
|