uilint-react 0.2.138 → 0.2.140
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/SchemaPanel-ClCFV80T.js +664 -0
- package/dist/SchemaPanel-ClCFV80T.js.map +1 -0
- package/dist/core/plugin-system/loader.d.ts.map +1 -1
- package/dist/devtools.js +53 -53
- package/dist/devtools.js.map +1 -1
- package/dist/{index-Cc4gwBce.js → index-i4_wbGZV.js} +369 -355
- package/dist/{index-Cc4gwBce.js.map → index-i4_wbGZV.js.map} +1 -1
- package/dist/index.js +4 -4
- package/dist/ui/components/Schema/SchemaPanel.d.ts.map +1 -1
- package/dist/ui/components/Schema/sections/BadgeSection.d.ts.map +1 -1
- package/dist/ui/components/Schema/sections/CardSection.d.ts.map +1 -1
- package/dist/ui/components/Schema/sections/CodeViewerSection.d.ts.map +1 -1
- package/dist/ui/components/Schema/sections/HeaderSection.d.ts.map +1 -1
- package/dist/ui/components/Schema/sections/ImageSection.d.ts.map +1 -1
- package/dist/ui/components/Schema/sections/ListSection.d.ts.map +1 -1
- package/dist/ui/components/Schema/sections/ProgressSection.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/SchemaPanel-0lLkqa2L.js +0 -893
- package/dist/SchemaPanel-0lLkqa2L.js.map +0 -1
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
import { g as y, j as t, c as C, C as M, a as V, B as v, b as $, d as z, e as D, f as R, h as P } from "./index-i4_wbGZV.js";
|
|
2
|
+
import { isExpressionBinding as I, isDataBinding as k, isConditionalValue as L } from "uilint-core";
|
|
3
|
+
import j from "react";
|
|
4
|
+
function N(e, r) {
|
|
5
|
+
const s = r.split(".");
|
|
6
|
+
let n = e;
|
|
7
|
+
for (const i of s) {
|
|
8
|
+
if (n == null)
|
|
9
|
+
return;
|
|
10
|
+
if (typeof n == "object")
|
|
11
|
+
n = n[i];
|
|
12
|
+
else
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
return n;
|
|
16
|
+
}
|
|
17
|
+
function u(e, r) {
|
|
18
|
+
const s = e.binding;
|
|
19
|
+
let n = N(r.data, s);
|
|
20
|
+
return n === void 0 && (n = N(r.state, s)), n === void 0 && (n = N(r.computed, s)), n;
|
|
21
|
+
}
|
|
22
|
+
function E(e, r) {
|
|
23
|
+
const s = e.expression, n = {
|
|
24
|
+
...r.data,
|
|
25
|
+
...r.state,
|
|
26
|
+
...r.computed
|
|
27
|
+
};
|
|
28
|
+
try {
|
|
29
|
+
const i = Object.keys(n), a = Object.values(n);
|
|
30
|
+
return new Function(...i, `return (${s});`)(...a);
|
|
31
|
+
} catch (i) {
|
|
32
|
+
console.warn(`[SchemaRenderer] Failed to evaluate expression: ${s}`, i);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function g(e, r) {
|
|
37
|
+
return k(e) ? u(e, r) : e;
|
|
38
|
+
}
|
|
39
|
+
function O(e, r) {
|
|
40
|
+
return u(e.condition, r) ? e.true : e.false;
|
|
41
|
+
}
|
|
42
|
+
function H(e, r) {
|
|
43
|
+
return L(e) ? O(e, r) : k(e) ? u(e, r) : e;
|
|
44
|
+
}
|
|
45
|
+
function S(e, r) {
|
|
46
|
+
return I(e) ? !!E(e, r) : !!u(e, r);
|
|
47
|
+
}
|
|
48
|
+
function B(e, r, s) {
|
|
49
|
+
const n = { ...e };
|
|
50
|
+
if (r)
|
|
51
|
+
for (const [i, a] of Object.entries(r))
|
|
52
|
+
n[i] = u({ binding: a }, s);
|
|
53
|
+
return n;
|
|
54
|
+
}
|
|
55
|
+
function T({ section: e, ctx: r }) {
|
|
56
|
+
const s = g(e.text, r), n = g(e.subtitle, r), i = e.icon ? y(e.icon) : null;
|
|
57
|
+
return /* @__PURE__ */ t.jsxs(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: C(
|
|
61
|
+
"flex items-start gap-2 mb-3",
|
|
62
|
+
e.sticky && "sticky top-0 bg-surface py-2 z-10"
|
|
63
|
+
),
|
|
64
|
+
children: [
|
|
65
|
+
i && /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground shrink-0 mt-0.5", children: /* @__PURE__ */ t.jsx(i, { size: 16 }) }),
|
|
66
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
67
|
+
/* @__PURE__ */ t.jsx("h3", { className: "m-0 text-sm font-semibold text-text-primary", children: String(s ?? "") }),
|
|
68
|
+
n && /* @__PURE__ */ t.jsx("p", { className: "mt-1 mb-0 text-xs text-muted-foreground", children: String(n) })
|
|
69
|
+
] })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function A({
|
|
75
|
+
code: e,
|
|
76
|
+
startLine: r = 1,
|
|
77
|
+
highlightLines: s,
|
|
78
|
+
maxHeight: n
|
|
79
|
+
}) {
|
|
80
|
+
const i = e.split(`
|
|
81
|
+
`), a = new Set(s || []);
|
|
82
|
+
return /* @__PURE__ */ t.jsx(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
className: "font-mono text-xs bg-surface rounded border border-border overflow-auto",
|
|
86
|
+
style: { maxHeight: n || 200 },
|
|
87
|
+
children: i.map((o, c) => {
|
|
88
|
+
const m = r + c, d = a.has(m);
|
|
89
|
+
return /* @__PURE__ */ t.jsxs(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
className: `flex ${d ? "bg-accent/15" : "bg-transparent"}`,
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ t.jsx("span", { className: "w-12 pr-2 text-right text-muted-foreground select-none shrink-0 border-r border-border", children: m }),
|
|
95
|
+
/* @__PURE__ */ t.jsx("pre", { className: "m-0 px-2 whitespace-pre-wrap break-all flex-1", children: o || " " })
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
c
|
|
99
|
+
);
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
function w({
|
|
105
|
+
section: e,
|
|
106
|
+
ctx: r,
|
|
107
|
+
onAction: s,
|
|
108
|
+
onFetch: n
|
|
109
|
+
}) {
|
|
110
|
+
const [i, a] = j.useState(null), [o, c] = j.useState(!1), m = e.code;
|
|
111
|
+
j.useEffect(() => {
|
|
112
|
+
if (k(m)) {
|
|
113
|
+
const l = u(m, r);
|
|
114
|
+
a(typeof l == "string" ? l : null);
|
|
115
|
+
} else if ("fetch" in m && n) {
|
|
116
|
+
c(!0);
|
|
117
|
+
const l = m.fetch, p = {};
|
|
118
|
+
l.params.filePath && (p.filePath = u(l.params.filePath, r)), l.params.line && (p.line = u(l.params.line, r)), l.params.contextAbove !== void 0 && (p.contextAbove = l.params.contextAbove), l.params.contextBelow !== void 0 && (p.contextBelow = l.params.contextBelow), n(l.type, p).then((h) => {
|
|
119
|
+
a(typeof h == "string" ? h : JSON.stringify(h, null, 2));
|
|
120
|
+
}).catch((h) => {
|
|
121
|
+
console.error("[CodeViewerSection] Fetch failed:", h), a(`// Error loading code: ${h.message}`);
|
|
122
|
+
}).finally(() => {
|
|
123
|
+
c(!1);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}, [m, r, n]);
|
|
127
|
+
const d = g(e.startLine, r), f = e.highlightLines ? u(e.highlightLines, r) : void 0, b = e.icon ? y(e.icon) : null, x = e.onNavigate ? () => {
|
|
128
|
+
const l = B(
|
|
129
|
+
e.onNavigate.payload,
|
|
130
|
+
e.onNavigate.payloadBindings,
|
|
131
|
+
r
|
|
132
|
+
);
|
|
133
|
+
s(e.onNavigate.type, l);
|
|
134
|
+
} : void 0;
|
|
135
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "mb-3", children: [
|
|
136
|
+
e.label && /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
|
|
137
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
138
|
+
b && /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: /* @__PURE__ */ t.jsx(b, { size: 14 }) }),
|
|
139
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-xs font-medium text-text-secondary", children: e.label })
|
|
140
|
+
] }),
|
|
141
|
+
x && /* @__PURE__ */ t.jsx(
|
|
142
|
+
"button",
|
|
143
|
+
{
|
|
144
|
+
onClick: x,
|
|
145
|
+
className: "bg-transparent border-none p-1 cursor-pointer text-accent text-xs",
|
|
146
|
+
children: "Open in editor"
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
] }),
|
|
150
|
+
o ? /* @__PURE__ */ t.jsx("div", { className: "p-4 text-center text-muted-foreground text-xs bg-surface rounded border border-border", children: "Loading code..." }) : i ? /* @__PURE__ */ t.jsx(
|
|
151
|
+
A,
|
|
152
|
+
{
|
|
153
|
+
code: i,
|
|
154
|
+
startLine: typeof d == "number" ? d : 1,
|
|
155
|
+
highlightLines: f,
|
|
156
|
+
maxHeight: e.maxHeight
|
|
157
|
+
}
|
|
158
|
+
) : /* @__PURE__ */ t.jsx("div", { className: "p-4 text-center text-muted-foreground text-xs bg-surface rounded border border-border", children: "No code available" })
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
function W({
|
|
162
|
+
section: e,
|
|
163
|
+
ctx: r,
|
|
164
|
+
onAction: s,
|
|
165
|
+
onFetch: n
|
|
166
|
+
}) {
|
|
167
|
+
const a = e.mode === "stacked" ? {
|
|
168
|
+
display: "flex",
|
|
169
|
+
flexDirection: "column",
|
|
170
|
+
gap: "1rem",
|
|
171
|
+
marginBottom: "0.75rem"
|
|
172
|
+
} : {
|
|
173
|
+
display: "grid",
|
|
174
|
+
gridTemplateColumns: "1fr 1fr",
|
|
175
|
+
gap: "1rem",
|
|
176
|
+
marginBottom: "0.75rem"
|
|
177
|
+
}, o = {
|
|
178
|
+
type: "code-viewer",
|
|
179
|
+
label: e.source.label,
|
|
180
|
+
icon: e.source.icon,
|
|
181
|
+
code: e.source.code,
|
|
182
|
+
location: e.source.location,
|
|
183
|
+
diffHighlighting: e.computeDiff,
|
|
184
|
+
maxHeight: e.maxHeight
|
|
185
|
+
}, c = {
|
|
186
|
+
type: "code-viewer",
|
|
187
|
+
label: e.target.label,
|
|
188
|
+
icon: e.target.icon,
|
|
189
|
+
code: e.target.code,
|
|
190
|
+
location: e.target.location,
|
|
191
|
+
diffHighlighting: e.computeDiff,
|
|
192
|
+
maxHeight: e.maxHeight
|
|
193
|
+
};
|
|
194
|
+
return /* @__PURE__ */ t.jsxs("div", { style: a, children: [
|
|
195
|
+
/* @__PURE__ */ t.jsx(
|
|
196
|
+
w,
|
|
197
|
+
{
|
|
198
|
+
section: o,
|
|
199
|
+
ctx: r,
|
|
200
|
+
onAction: s,
|
|
201
|
+
onFetch: n
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
/* @__PURE__ */ t.jsx(
|
|
205
|
+
w,
|
|
206
|
+
{
|
|
207
|
+
section: c,
|
|
208
|
+
ctx: r,
|
|
209
|
+
onAction: s,
|
|
210
|
+
onFetch: n
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] });
|
|
214
|
+
}
|
|
215
|
+
function _(e) {
|
|
216
|
+
return e >= 85 ? "error" : e >= 70 ? "warning" : "info";
|
|
217
|
+
}
|
|
218
|
+
function F(e) {
|
|
219
|
+
return e >= 90 ? "Very High" : e >= 75 ? "High" : e >= 60 ? "Moderate" : "Low";
|
|
220
|
+
}
|
|
221
|
+
function J({ section: e, ctx: r }) {
|
|
222
|
+
const s = u(e.value, r), n = C(
|
|
223
|
+
"mb-3",
|
|
224
|
+
e.centered && "flex justify-center"
|
|
225
|
+
);
|
|
226
|
+
switch (e.variant) {
|
|
227
|
+
case "similarity": {
|
|
228
|
+
const a = Math.round((typeof s == "number" ? s : 0) * 100), o = _(a), c = F(a);
|
|
229
|
+
return /* @__PURE__ */ t.jsx("div", { className: n, children: /* @__PURE__ */ t.jsxs(v, { variant: o, children: [
|
|
230
|
+
a,
|
|
231
|
+
"% Match - ",
|
|
232
|
+
c
|
|
233
|
+
] }) });
|
|
234
|
+
}
|
|
235
|
+
case "severity": {
|
|
236
|
+
const i = String(s || "info"), o = {
|
|
237
|
+
error: "error",
|
|
238
|
+
warning: "warning",
|
|
239
|
+
info: "info",
|
|
240
|
+
success: "success"
|
|
241
|
+
}[i] || "info";
|
|
242
|
+
return /* @__PURE__ */ t.jsx("div", { className: n, children: /* @__PURE__ */ t.jsxs(v, { variant: o, children: [
|
|
243
|
+
e.label ? `${e.label}: ` : "",
|
|
244
|
+
i
|
|
245
|
+
] }) });
|
|
246
|
+
}
|
|
247
|
+
case "status": {
|
|
248
|
+
const i = String(s || "unknown"), o = {
|
|
249
|
+
ready: "success",
|
|
250
|
+
indexing: "info",
|
|
251
|
+
error: "error",
|
|
252
|
+
idle: "info",
|
|
253
|
+
loading: "info"
|
|
254
|
+
}[i] || "info";
|
|
255
|
+
return /* @__PURE__ */ t.jsx("div", { className: n, children: /* @__PURE__ */ t.jsxs(v, { variant: o, children: [
|
|
256
|
+
e.label ? `${e.label}: ` : "",
|
|
257
|
+
i
|
|
258
|
+
] }) });
|
|
259
|
+
}
|
|
260
|
+
case "category": {
|
|
261
|
+
const i = String(s || "");
|
|
262
|
+
return /* @__PURE__ */ t.jsx("div", { className: n, children: /* @__PURE__ */ t.jsx(V, { children: i }) });
|
|
263
|
+
}
|
|
264
|
+
case "count": {
|
|
265
|
+
const i = typeof s == "number" ? s : 0;
|
|
266
|
+
return /* @__PURE__ */ t.jsxs("div", { className: n, children: [
|
|
267
|
+
e.label && /* @__PURE__ */ t.jsxs("span", { className: "mr-2 text-xs text-muted-foreground", children: [
|
|
268
|
+
e.label,
|
|
269
|
+
":"
|
|
270
|
+
] }),
|
|
271
|
+
/* @__PURE__ */ t.jsx(M, { count: i })
|
|
272
|
+
] });
|
|
273
|
+
}
|
|
274
|
+
default:
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function U(e) {
|
|
279
|
+
const r = {
|
|
280
|
+
marginBottom: "0.5rem",
|
|
281
|
+
lineHeight: 1.5
|
|
282
|
+
};
|
|
283
|
+
switch (e) {
|
|
284
|
+
case "caption":
|
|
285
|
+
return {
|
|
286
|
+
...r,
|
|
287
|
+
fontSize: "0.75rem",
|
|
288
|
+
color: "var(--uilint-text-muted)"
|
|
289
|
+
};
|
|
290
|
+
case "muted":
|
|
291
|
+
return {
|
|
292
|
+
...r,
|
|
293
|
+
fontSize: "0.875rem",
|
|
294
|
+
color: "var(--uilint-text-muted)"
|
|
295
|
+
};
|
|
296
|
+
case "error":
|
|
297
|
+
return {
|
|
298
|
+
...r,
|
|
299
|
+
fontSize: "0.875rem",
|
|
300
|
+
color: "var(--uilint-error)"
|
|
301
|
+
};
|
|
302
|
+
case "success":
|
|
303
|
+
return {
|
|
304
|
+
...r,
|
|
305
|
+
fontSize: "0.875rem",
|
|
306
|
+
color: "var(--uilint-success)"
|
|
307
|
+
};
|
|
308
|
+
default:
|
|
309
|
+
return {
|
|
310
|
+
...r,
|
|
311
|
+
fontSize: "0.875rem",
|
|
312
|
+
color: "var(--uilint-text-primary)"
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function q({ section: e, ctx: r }) {
|
|
317
|
+
const s = g(e.content, r);
|
|
318
|
+
if (s == null)
|
|
319
|
+
return null;
|
|
320
|
+
const n = U(e.variant);
|
|
321
|
+
return /* @__PURE__ */ t.jsx("p", { style: n, children: String(s) });
|
|
322
|
+
}
|
|
323
|
+
function G(e) {
|
|
324
|
+
switch (e) {
|
|
325
|
+
case "primary":
|
|
326
|
+
return "default";
|
|
327
|
+
case "secondary":
|
|
328
|
+
return "outline";
|
|
329
|
+
case "ghost":
|
|
330
|
+
return "ghost";
|
|
331
|
+
case "danger":
|
|
332
|
+
return "destructive";
|
|
333
|
+
default:
|
|
334
|
+
return "default";
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function K({
|
|
338
|
+
button: e,
|
|
339
|
+
ctx: r,
|
|
340
|
+
onAction: s
|
|
341
|
+
}) {
|
|
342
|
+
if (e.visible && !!!u(e.visible, r))
|
|
343
|
+
return null;
|
|
344
|
+
const n = e.disabled ? !!u(e.disabled, r) : !1;
|
|
345
|
+
let i;
|
|
346
|
+
L(e.label), i = String(H(e.label, r) ?? "");
|
|
347
|
+
const a = e.icon ? y(e.icon) : null, o = () => {
|
|
348
|
+
const c = B(
|
|
349
|
+
e.action.payload,
|
|
350
|
+
e.action.payloadBindings,
|
|
351
|
+
r
|
|
352
|
+
);
|
|
353
|
+
s(e.action.type, c);
|
|
354
|
+
};
|
|
355
|
+
return /* @__PURE__ */ t.jsxs(
|
|
356
|
+
$,
|
|
357
|
+
{
|
|
358
|
+
variant: G(e.variant),
|
|
359
|
+
size: "sm",
|
|
360
|
+
disabled: n,
|
|
361
|
+
onClick: o,
|
|
362
|
+
children: [
|
|
363
|
+
a && /* @__PURE__ */ t.jsx(a, { size: 14, style: { marginRight: "0.25rem" } }),
|
|
364
|
+
i
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
function Q({ section: e, ctx: r, onAction: s }) {
|
|
370
|
+
const n = e.direction !== "column";
|
|
371
|
+
return /* @__PURE__ */ t.jsx(
|
|
372
|
+
"div",
|
|
373
|
+
{
|
|
374
|
+
style: {
|
|
375
|
+
display: "flex",
|
|
376
|
+
flexDirection: n ? "row" : "column",
|
|
377
|
+
gap: "0.5rem",
|
|
378
|
+
marginBottom: "0.75rem",
|
|
379
|
+
...n && { flexWrap: "wrap" }
|
|
380
|
+
},
|
|
381
|
+
children: e.actions.map((i) => /* @__PURE__ */ t.jsx(
|
|
382
|
+
K,
|
|
383
|
+
{
|
|
384
|
+
button: i,
|
|
385
|
+
ctx: r,
|
|
386
|
+
onAction: s
|
|
387
|
+
},
|
|
388
|
+
i.id
|
|
389
|
+
))
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
function X(e) {
|
|
394
|
+
switch (e) {
|
|
395
|
+
case "small":
|
|
396
|
+
return "0.5rem 0";
|
|
397
|
+
case "large":
|
|
398
|
+
return "1.5rem 0";
|
|
399
|
+
default:
|
|
400
|
+
return "1rem 0";
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function Y({ section: e }) {
|
|
404
|
+
const r = X(e.spacing);
|
|
405
|
+
return /* @__PURE__ */ t.jsx(
|
|
406
|
+
"hr",
|
|
407
|
+
{
|
|
408
|
+
style: {
|
|
409
|
+
margin: r,
|
|
410
|
+
border: "none",
|
|
411
|
+
borderTop: "1px solid var(--uilint-border)"
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
function Z({
|
|
417
|
+
section: e,
|
|
418
|
+
ctx: r,
|
|
419
|
+
renderSection: s
|
|
420
|
+
}) {
|
|
421
|
+
const i = S(e.condition, r) ? e.then : e.else;
|
|
422
|
+
return !i || i.length === 0 ? null : /* @__PURE__ */ t.jsx(t.Fragment, { children: i.map((a, o) => /* @__PURE__ */ t.jsx(j.Fragment, { children: s(a, o) }, o)) });
|
|
423
|
+
}
|
|
424
|
+
function ee({ section: e, ctx: r, renderSection: s }) {
|
|
425
|
+
const n = u(e.items, r);
|
|
426
|
+
return !Array.isArray(n) || n.length === 0 ? e.emptyMessage ? /* @__PURE__ */ t.jsx("div", { className: "p-4 text-center text-muted-foreground text-sm", children: e.emptyMessage }) : null : /* @__PURE__ */ t.jsx("div", { className: "mb-3", children: n.map((i, a) => {
|
|
427
|
+
const o = {
|
|
428
|
+
...r,
|
|
429
|
+
data: {
|
|
430
|
+
...r.data,
|
|
431
|
+
item: i,
|
|
432
|
+
itemIndex: a
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
return /* @__PURE__ */ t.jsx("div", { className: "mb-2", children: e.itemLayout.map(
|
|
436
|
+
(c, m) => s(c, m, o)
|
|
437
|
+
) }, a);
|
|
438
|
+
}) });
|
|
439
|
+
}
|
|
440
|
+
function te({ section: e, ctx: r }) {
|
|
441
|
+
const s = u(e.src, r), n = e.highlightRegion ? u(e.highlightRegion, r) : void 0;
|
|
442
|
+
return !s || typeof s != "string" ? null : /* @__PURE__ */ t.jsxs(
|
|
443
|
+
"div",
|
|
444
|
+
{
|
|
445
|
+
className: "relative mb-3 overflow-hidden",
|
|
446
|
+
style: { maxHeight: e.maxHeight },
|
|
447
|
+
children: [
|
|
448
|
+
/* @__PURE__ */ t.jsx(
|
|
449
|
+
"img",
|
|
450
|
+
{
|
|
451
|
+
src: s,
|
|
452
|
+
alt: e.alt || "Image",
|
|
453
|
+
className: "w-full h-auto object-contain rounded border border-border",
|
|
454
|
+
style: { maxHeight: e.maxHeight }
|
|
455
|
+
}
|
|
456
|
+
),
|
|
457
|
+
n && /* @__PURE__ */ t.jsx(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
className: "absolute border-2 border-accent rounded bg-accent/10 pointer-events-none",
|
|
461
|
+
style: {
|
|
462
|
+
left: `${n.x}px`,
|
|
463
|
+
top: `${n.y}px`,
|
|
464
|
+
width: `${n.width}px`,
|
|
465
|
+
height: `${n.height}px`
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
)
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
function re({ section: e, ctx: r, onAction: s }) {
|
|
474
|
+
const n = g(e.title, r), i = g(e.subtitle, r), a = e.thumbnail ? u(e.thumbnail, r) : void 0, o = e.badge ? u(e.badge.value, r) : void 0, c = e.onClick ? () => {
|
|
475
|
+
const m = B(
|
|
476
|
+
e.onClick.payload,
|
|
477
|
+
e.onClick.payloadBindings,
|
|
478
|
+
r
|
|
479
|
+
);
|
|
480
|
+
s(e.onClick.type, m);
|
|
481
|
+
} : void 0;
|
|
482
|
+
return /* @__PURE__ */ t.jsx(
|
|
483
|
+
z,
|
|
484
|
+
{
|
|
485
|
+
className: C("mb-2", c && "cursor-pointer"),
|
|
486
|
+
onClick: c,
|
|
487
|
+
role: c ? "button" : void 0,
|
|
488
|
+
tabIndex: c ? 0 : void 0,
|
|
489
|
+
children: /* @__PURE__ */ t.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
490
|
+
typeof a == "string" && a && /* @__PURE__ */ t.jsx(
|
|
491
|
+
"img",
|
|
492
|
+
{
|
|
493
|
+
src: a,
|
|
494
|
+
alt: "",
|
|
495
|
+
className: "w-12 h-12 rounded object-cover shrink-0"
|
|
496
|
+
}
|
|
497
|
+
),
|
|
498
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ t.jsxs(D, { className: "px-3 pt-3 pb-0", children: [
|
|
499
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex justify-between items-start", children: [
|
|
500
|
+
/* @__PURE__ */ t.jsx(R, { className: "text-sm mb-0", children: String(n ?? "") }),
|
|
501
|
+
e.badge && o !== void 0 && /* @__PURE__ */ t.jsxs(v, { variant: e.badge.variant === "severity" ? "warning" : "info", children: [
|
|
502
|
+
e.badge.label ? `${e.badge.label}: ` : "",
|
|
503
|
+
String(o)
|
|
504
|
+
] })
|
|
505
|
+
] }),
|
|
506
|
+
i && /* @__PURE__ */ t.jsx(P, { className: "text-xs mt-1", children: String(i) })
|
|
507
|
+
] }) })
|
|
508
|
+
] })
|
|
509
|
+
}
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
function ne({ section: e, ctx: r }) {
|
|
513
|
+
const s = g(e.value, r), n = g(e.label, r), i = typeof s == "number" ? Math.min(100, Math.max(0, s)) : 0;
|
|
514
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "mb-3", children: [
|
|
515
|
+
n && /* @__PURE__ */ t.jsx("div", { className: "text-xs text-muted-foreground mb-1", children: String(n) }),
|
|
516
|
+
/* @__PURE__ */ t.jsx("div", { className: "h-1.5 bg-surface rounded-sm overflow-hidden", children: e.indeterminate ? /* @__PURE__ */ t.jsx(
|
|
517
|
+
"div",
|
|
518
|
+
{
|
|
519
|
+
className: "h-full w-[30%] bg-accent rounded-sm",
|
|
520
|
+
style: { animation: "progress-indeterminate 1.5s infinite linear" }
|
|
521
|
+
}
|
|
522
|
+
) : /* @__PURE__ */ t.jsx(
|
|
523
|
+
"div",
|
|
524
|
+
{
|
|
525
|
+
className: "h-full bg-accent rounded-sm transition-[width] duration-300 ease-in-out",
|
|
526
|
+
style: { width: `${i}%` }
|
|
527
|
+
}
|
|
528
|
+
) }),
|
|
529
|
+
!e.indeterminate && typeof s == "number" && /* @__PURE__ */ t.jsxs("div", { className: "text-xs text-muted-foreground mt-1 text-right", children: [
|
|
530
|
+
i,
|
|
531
|
+
"%"
|
|
532
|
+
] })
|
|
533
|
+
] });
|
|
534
|
+
}
|
|
535
|
+
function oe({
|
|
536
|
+
panel: e,
|
|
537
|
+
data: r,
|
|
538
|
+
state: s,
|
|
539
|
+
computed: n = {},
|
|
540
|
+
onAction: i,
|
|
541
|
+
onFetch: a
|
|
542
|
+
}) {
|
|
543
|
+
const o = {
|
|
544
|
+
data: r,
|
|
545
|
+
state: s,
|
|
546
|
+
computed: n
|
|
547
|
+
};
|
|
548
|
+
if (e.loading && S(e.loading.when, o))
|
|
549
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-8 text-center text-muted-foreground", children: [
|
|
550
|
+
/* @__PURE__ */ t.jsx("div", { className: "mb-2 animate-spin", children: /* @__PURE__ */ t.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ t.jsx(
|
|
551
|
+
"circle",
|
|
552
|
+
{
|
|
553
|
+
cx: "12",
|
|
554
|
+
cy: "12",
|
|
555
|
+
r: "10",
|
|
556
|
+
stroke: "currentColor",
|
|
557
|
+
strokeWidth: "2",
|
|
558
|
+
strokeDasharray: "31.4",
|
|
559
|
+
strokeLinecap: "round"
|
|
560
|
+
}
|
|
561
|
+
) }) }),
|
|
562
|
+
/* @__PURE__ */ t.jsx("div", { className: "text-sm", children: e.loading.message || "Loading..." }),
|
|
563
|
+
e.loading.submessage && /* @__PURE__ */ t.jsx("div", { className: "text-xs mt-1", children: e.loading.submessage })
|
|
564
|
+
] });
|
|
565
|
+
if (e.empty && S(e.empty.when, o)) {
|
|
566
|
+
const f = e.empty.icon ? y(e.empty.icon) : null;
|
|
567
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-8 text-center text-muted-foreground", children: [
|
|
568
|
+
f && /* @__PURE__ */ t.jsx("div", { className: "mb-2", children: /* @__PURE__ */ t.jsx(f, { size: 32, strokeWidth: 1.5 }) }),
|
|
569
|
+
/* @__PURE__ */ t.jsx("div", { className: "text-sm", children: e.empty.message }),
|
|
570
|
+
e.empty.submessage && /* @__PURE__ */ t.jsx("div", { className: "text-xs mt-1", children: e.empty.submessage })
|
|
571
|
+
] });
|
|
572
|
+
}
|
|
573
|
+
const c = (d, f, b) => {
|
|
574
|
+
const x = b || o, l = `section-${f}`;
|
|
575
|
+
switch (d.type) {
|
|
576
|
+
case "header":
|
|
577
|
+
return /* @__PURE__ */ t.jsx(T, { section: d, ctx: x }, l);
|
|
578
|
+
case "code-viewer":
|
|
579
|
+
return /* @__PURE__ */ t.jsx(
|
|
580
|
+
w,
|
|
581
|
+
{
|
|
582
|
+
section: d,
|
|
583
|
+
ctx: x,
|
|
584
|
+
onAction: i,
|
|
585
|
+
onFetch: a
|
|
586
|
+
},
|
|
587
|
+
l
|
|
588
|
+
);
|
|
589
|
+
case "code-comparison":
|
|
590
|
+
return /* @__PURE__ */ t.jsx(
|
|
591
|
+
W,
|
|
592
|
+
{
|
|
593
|
+
section: d,
|
|
594
|
+
ctx: x,
|
|
595
|
+
onAction: i,
|
|
596
|
+
onFetch: a
|
|
597
|
+
},
|
|
598
|
+
l
|
|
599
|
+
);
|
|
600
|
+
case "badge":
|
|
601
|
+
return /* @__PURE__ */ t.jsx(J, { section: d, ctx: x }, l);
|
|
602
|
+
case "text":
|
|
603
|
+
return /* @__PURE__ */ t.jsx(q, { section: d, ctx: x }, l);
|
|
604
|
+
case "actions":
|
|
605
|
+
return /* @__PURE__ */ t.jsx(
|
|
606
|
+
Q,
|
|
607
|
+
{
|
|
608
|
+
section: d,
|
|
609
|
+
ctx: x,
|
|
610
|
+
onAction: i
|
|
611
|
+
},
|
|
612
|
+
l
|
|
613
|
+
);
|
|
614
|
+
case "divider":
|
|
615
|
+
return /* @__PURE__ */ t.jsx(Y, { section: d }, l);
|
|
616
|
+
case "conditional":
|
|
617
|
+
return /* @__PURE__ */ t.jsx(
|
|
618
|
+
Z,
|
|
619
|
+
{
|
|
620
|
+
section: d,
|
|
621
|
+
ctx: x,
|
|
622
|
+
renderSection: c
|
|
623
|
+
},
|
|
624
|
+
l
|
|
625
|
+
);
|
|
626
|
+
case "list":
|
|
627
|
+
return /* @__PURE__ */ t.jsx(
|
|
628
|
+
ee,
|
|
629
|
+
{
|
|
630
|
+
section: d,
|
|
631
|
+
ctx: x,
|
|
632
|
+
renderSection: c
|
|
633
|
+
},
|
|
634
|
+
l
|
|
635
|
+
);
|
|
636
|
+
case "image":
|
|
637
|
+
return /* @__PURE__ */ t.jsx(te, { section: d, ctx: x }, l);
|
|
638
|
+
case "card":
|
|
639
|
+
return /* @__PURE__ */ t.jsx(
|
|
640
|
+
re,
|
|
641
|
+
{
|
|
642
|
+
section: d,
|
|
643
|
+
ctx: x,
|
|
644
|
+
onAction: i
|
|
645
|
+
},
|
|
646
|
+
l
|
|
647
|
+
);
|
|
648
|
+
case "progress":
|
|
649
|
+
return /* @__PURE__ */ t.jsx(ne, { section: d, ctx: x }, l);
|
|
650
|
+
default:
|
|
651
|
+
return console.warn(
|
|
652
|
+
`[SchemaPanel] Unknown section type: ${d.type}`
|
|
653
|
+
), null;
|
|
654
|
+
}
|
|
655
|
+
}, m = g(e.title, o);
|
|
656
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-4", children: [
|
|
657
|
+
m && /* @__PURE__ */ t.jsx("h2", { className: "m-0 mb-4 text-base font-semibold text-text-primary", children: String(m) }),
|
|
658
|
+
e.layout.map((d, f) => c(d, f))
|
|
659
|
+
] });
|
|
660
|
+
}
|
|
661
|
+
export {
|
|
662
|
+
oe as SchemaPanel
|
|
663
|
+
};
|
|
664
|
+
//# sourceMappingURL=SchemaPanel-ClCFV80T.js.map
|