@apisurf/wireui 0.1.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/LICENSE +15 -0
- package/README.md +157 -0
- package/bin/wireui.mjs +233 -0
- package/dist/nitro.json +17 -0
- package/dist/public/assets/collections-CLHcfRfi.js +1 -0
- package/dist/public/assets/globals-CZiNFGaK.css +1 -0
- package/dist/public/assets/index-D5VFd_3H.js +14 -0
- package/dist/public/assets/kv-table-oB5gcq0i.js +2 -0
- package/dist/public/assets/query-BKAhHNIi.js +19 -0
- package/dist/public/assets/requests._requestId-Bu7E2eoI.js +1 -0
- package/dist/public/assets/routes-DDY2CfzA.js +1 -0
- package/dist/public/assets/runs._runId-CzwtVjYq.js +1 -0
- package/dist/public/assets/scoped-DB8raIWx.js +1 -0
- package/dist/public/assets/split-Br1RX2I4.js +1 -0
- package/dist/public/favicon.svg +1 -0
- package/dist/server/_chunks/ssr-renderer.mjs +26 -0
- package/dist/server/_libs/@tanstack/react-router+[...].mjs +15246 -0
- package/dist/server/_libs/h3+rou3+srvx.mjs +2086 -0
- package/dist/server/_libs/hookable.mjs +41 -0
- package/dist/server/_libs/tanstack__history.mjs +369 -0
- package/dist/server/_libs/ufo.mjs +64 -0
- package/dist/server/_runtime.mjs +35 -0
- package/dist/server/_ssr/api-Dw1Zb_PK.mjs +931 -0
- package/dist/server/_ssr/collections-CqidTQpw.mjs +495 -0
- package/dist/server/_ssr/empty-plugin-adapters-CCuiUfKt.mjs +5 -0
- package/dist/server/_ssr/kv-table-DQUkoItO.mjs +458 -0
- package/dist/server/_ssr/query-D4so9xiY.mjs +416 -0
- package/dist/server/_ssr/requests._requestId-BFukRwqL.mjs +942 -0
- package/dist/server/_ssr/router-CPcgc_kh.mjs +3176 -0
- package/dist/server/_ssr/routes-DaV9vGHn.mjs +375 -0
- package/dist/server/_ssr/runs._runId-Df_LmPHa.mjs +836 -0
- package/dist/server/_ssr/scoped-CnQ56K8h.mjs +42 -0
- package/dist/server/_ssr/split-DWrMIs7K.mjs +115 -0
- package/dist/server/_ssr/ssr.mjs +6827 -0
- package/dist/server/_ssr/start-zk_ZfrWl.mjs +4 -0
- package/dist/server/_tanstack-start-manifest_v-CARKjHfs.mjs +50 -0
- package/dist/server/index.mjs +368 -0
- package/package.json +71 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { __toESM } from "../_runtime.mjs";
|
|
2
|
+
import { require_jsx_runtime, require_react } from "../_libs/@tanstack/react-router+[...].mjs";
|
|
3
|
+
import { Button, Callout, CopyButton, Empty, FilterInput, IconAlert, IconChevronDown, IconChevronRight, IconFile, Segmented, bodyRaw, bodyText, css, cx, faintText, formatBytes, mono, table, truncate } from "./router-CPcgc_kh.mjs";
|
|
4
|
+
//#region node_modules/.nitro/vite/services/ssr/assets/kv-table-DQUkoItO.js
|
|
5
|
+
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
6
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
7
|
+
var syn = {
|
|
8
|
+
key: css({ color: "synKey" }),
|
|
9
|
+
string: css({ color: "synString" }),
|
|
10
|
+
number: css({ color: "synNumber" }),
|
|
11
|
+
bool: css({ color: "synBool" }),
|
|
12
|
+
null: css({ color: "synNull" }),
|
|
13
|
+
punct: css({ color: "synPunct" })
|
|
14
|
+
};
|
|
15
|
+
var tree = css({
|
|
16
|
+
fontFamily: "mono",
|
|
17
|
+
fontSize: "12px",
|
|
18
|
+
lineHeight: "1.65",
|
|
19
|
+
py: "2",
|
|
20
|
+
pl: "6",
|
|
21
|
+
pr: "3",
|
|
22
|
+
whiteSpace: "pre-wrap",
|
|
23
|
+
wordBreak: "break-word"
|
|
24
|
+
});
|
|
25
|
+
function JsonView({ value, initialDepth = 2, command }) {
|
|
26
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
27
|
+
className: tree,
|
|
28
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Node, {
|
|
29
|
+
value,
|
|
30
|
+
depth: 0,
|
|
31
|
+
initialDepth,
|
|
32
|
+
command,
|
|
33
|
+
last: true
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function Node({ name, value, depth, initialDepth, command, last }) {
|
|
38
|
+
const branch = value !== null && typeof value === "object";
|
|
39
|
+
const [open, setOpen] = import_react.useState(depth < initialDepth);
|
|
40
|
+
import_react.useEffect(() => {
|
|
41
|
+
if (command && command.seq > 0) setOpen(command.open);
|
|
42
|
+
}, [command]);
|
|
43
|
+
const label = name !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
44
|
+
className: syn.key,
|
|
45
|
+
children: JSON.stringify(name)
|
|
46
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
47
|
+
className: syn.punct,
|
|
48
|
+
children: ": "
|
|
49
|
+
})] }) : null;
|
|
50
|
+
const comma = last ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
51
|
+
className: syn.punct,
|
|
52
|
+
children: ","
|
|
53
|
+
});
|
|
54
|
+
const indent = { paddingLeft: depth === 0 ? 0 : 16 };
|
|
55
|
+
if (!branch) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
56
|
+
style: indent,
|
|
57
|
+
children: [
|
|
58
|
+
label,
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Scalar, { value }),
|
|
60
|
+
comma
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
const array = Array.isArray(value);
|
|
64
|
+
const entries = array ? value.map((v) => [void 0, v]) : Object.entries(value);
|
|
65
|
+
const [openBrace, closeBrace] = array ? ["[", "]"] : ["{", "}"];
|
|
66
|
+
if (entries.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
67
|
+
style: indent,
|
|
68
|
+
children: [
|
|
69
|
+
label,
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
71
|
+
className: syn.punct,
|
|
72
|
+
children: `${openBrace}${closeBrace}`
|
|
73
|
+
}),
|
|
74
|
+
comma
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
const summary = array ? `${entries.length} item${entries.length === 1 ? "" : "s"}` : `${entries.length} key${entries.length === 1 ? "" : "s"}`;
|
|
78
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
79
|
+
style: indent,
|
|
80
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
81
|
+
role: "button",
|
|
82
|
+
tabIndex: 0,
|
|
83
|
+
onClick: () => setOpen(!open),
|
|
84
|
+
onKeyDown: (e) => {
|
|
85
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
setOpen(!open);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
className: css({
|
|
91
|
+
cursor: "pointer",
|
|
92
|
+
rounded: "xs",
|
|
93
|
+
position: "relative",
|
|
94
|
+
ml: "-14px",
|
|
95
|
+
pl: "14px",
|
|
96
|
+
_hover: { bg: "hover" }
|
|
97
|
+
}),
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
100
|
+
className: css({
|
|
101
|
+
position: "absolute",
|
|
102
|
+
left: "0",
|
|
103
|
+
top: "2px",
|
|
104
|
+
color: "faint",
|
|
105
|
+
display: "inline-flex"
|
|
106
|
+
}),
|
|
107
|
+
children: open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconChevronDown, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconChevronRight, { size: 12 })
|
|
108
|
+
}),
|
|
109
|
+
label,
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
111
|
+
className: syn.punct,
|
|
112
|
+
children: openBrace
|
|
113
|
+
}),
|
|
114
|
+
open ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
116
|
+
className: cx(css({
|
|
117
|
+
color: "faint",
|
|
118
|
+
fontStyle: "italic",
|
|
119
|
+
px: "1"
|
|
120
|
+
})),
|
|
121
|
+
children: summary
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
124
|
+
className: syn.punct,
|
|
125
|
+
children: closeBrace
|
|
126
|
+
}),
|
|
127
|
+
comma
|
|
128
|
+
] })
|
|
129
|
+
]
|
|
130
|
+
}), open ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [entries.map(([key, child], i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Node, {
|
|
131
|
+
name: key,
|
|
132
|
+
value: child,
|
|
133
|
+
depth: depth + 1,
|
|
134
|
+
initialDepth,
|
|
135
|
+
command,
|
|
136
|
+
last: i === entries.length - 1
|
|
137
|
+
}, key ?? i)), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
138
|
+
className: syn.punct,
|
|
139
|
+
children: closeBrace
|
|
140
|
+
}), comma] })] }) : null]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function Scalar({ value }) {
|
|
144
|
+
if (value === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
145
|
+
className: syn.null,
|
|
146
|
+
children: "null"
|
|
147
|
+
});
|
|
148
|
+
if (typeof value === "string") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
149
|
+
className: syn.string,
|
|
150
|
+
children: JSON.stringify(value)
|
|
151
|
+
});
|
|
152
|
+
if (typeof value === "number") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
153
|
+
className: syn.number,
|
|
154
|
+
children: String(value)
|
|
155
|
+
});
|
|
156
|
+
if (typeof value === "boolean") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
157
|
+
className: syn.bool,
|
|
158
|
+
children: String(value)
|
|
159
|
+
});
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
function modesFor(body) {
|
|
163
|
+
if (body.kind === "json") return ["pretty", "raw"];
|
|
164
|
+
if (body.kind === "image") return body.text ? ["preview", "raw"] : ["preview"];
|
|
165
|
+
if (body.kind === "text") return isHtml(body.contentType) ? ["pretty", "preview"] : ["pretty"];
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
function isHtml(contentType) {
|
|
169
|
+
return contentType != null && /html/i.test(contentType);
|
|
170
|
+
}
|
|
171
|
+
var MODE_LABEL = {
|
|
172
|
+
pretty: "Pretty",
|
|
173
|
+
raw: "Raw",
|
|
174
|
+
preview: "Preview"
|
|
175
|
+
};
|
|
176
|
+
function BodyViewer({ body, emptyTitle }) {
|
|
177
|
+
const modes = modesFor(body);
|
|
178
|
+
const [mode, setMode] = import_react.useState(modes[0] ?? "pretty");
|
|
179
|
+
const [command, setCommand] = import_react.useState({
|
|
180
|
+
open: true,
|
|
181
|
+
seq: 0
|
|
182
|
+
});
|
|
183
|
+
const active = modes.includes(mode) ? mode : modes[0] ?? "pretty";
|
|
184
|
+
if (body.kind === "empty") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, {
|
|
185
|
+
title: emptyTitle,
|
|
186
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconFile, { size: 22 }),
|
|
187
|
+
children: body.note
|
|
188
|
+
});
|
|
189
|
+
const copyText = active === "raw" ? bodyRaw(body) : bodyText(body);
|
|
190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
191
|
+
className: css({
|
|
192
|
+
display: "flex",
|
|
193
|
+
flexDir: "column",
|
|
194
|
+
h: "full",
|
|
195
|
+
minH: "0"
|
|
196
|
+
}),
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
199
|
+
className: css({
|
|
200
|
+
display: "flex",
|
|
201
|
+
alignItems: "center",
|
|
202
|
+
gap: "2",
|
|
203
|
+
px: "3",
|
|
204
|
+
py: "1.5",
|
|
205
|
+
borderBottom: "1px solid",
|
|
206
|
+
borderColor: "line",
|
|
207
|
+
flexShrink: 0,
|
|
208
|
+
minW: "0"
|
|
209
|
+
}),
|
|
210
|
+
children: [
|
|
211
|
+
modes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Segmented, {
|
|
212
|
+
items: modes.map((m) => ({
|
|
213
|
+
id: m,
|
|
214
|
+
label: MODE_LABEL[m]
|
|
215
|
+
})),
|
|
216
|
+
value: active,
|
|
217
|
+
onSelect: setMode
|
|
218
|
+
}) : null,
|
|
219
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
220
|
+
title: body.contentType ?? void 0,
|
|
221
|
+
className: cx(mono, faintText, truncate, css({
|
|
222
|
+
fontSize: "11px",
|
|
223
|
+
flex: "1",
|
|
224
|
+
minW: "0"
|
|
225
|
+
})),
|
|
226
|
+
children: [body.contentType ?? "no content-type", body.size != null ? ` · ${formatBytes(body.size)}` : ""]
|
|
227
|
+
}),
|
|
228
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
229
|
+
className: css({
|
|
230
|
+
ml: "auto",
|
|
231
|
+
display: "flex",
|
|
232
|
+
gap: "1.5",
|
|
233
|
+
flexShrink: 0
|
|
234
|
+
}),
|
|
235
|
+
children: [body.kind === "json" && active === "pretty" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
236
|
+
onClick: () => setCommand((c) => ({
|
|
237
|
+
open: true,
|
|
238
|
+
seq: c.seq + 1
|
|
239
|
+
})),
|
|
240
|
+
children: "Expand"
|
|
241
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
242
|
+
onClick: () => setCommand((c) => ({
|
|
243
|
+
open: false,
|
|
244
|
+
seq: c.seq + 1
|
|
245
|
+
})),
|
|
246
|
+
children: "Collapse"
|
|
247
|
+
})] }) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyButton, { text: copyText })]
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BodyNotice, { body }),
|
|
252
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
253
|
+
className: css({
|
|
254
|
+
flex: "1",
|
|
255
|
+
minH: "0",
|
|
256
|
+
overflow: "auto",
|
|
257
|
+
bg: "well"
|
|
258
|
+
}),
|
|
259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BodyContent, {
|
|
260
|
+
body,
|
|
261
|
+
mode: active,
|
|
262
|
+
command
|
|
263
|
+
})
|
|
264
|
+
})
|
|
265
|
+
]
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Why the payload below is not the whole story. A binary body's note is the
|
|
270
|
+
* body itself (it is shown in its place), so only text-ish kinds get one here.
|
|
271
|
+
*/
|
|
272
|
+
function BodyNotice({ body }) {
|
|
273
|
+
const note = body.kind === "binary" ? null : body.note;
|
|
274
|
+
if (!body.truncated && !note) return null;
|
|
275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
276
|
+
className: css({
|
|
277
|
+
px: "3",
|
|
278
|
+
pt: "2",
|
|
279
|
+
flexShrink: 0
|
|
280
|
+
}),
|
|
281
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Callout, {
|
|
282
|
+
tone: "warn",
|
|
283
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAlert, { size: 14 }),
|
|
284
|
+
title: body.truncated ? "Truncated at capture" : "Note",
|
|
285
|
+
children: note ?? `Only the first part of this ${formatBytes(body.size)} payload was stored — raise the capture limit to keep it all.`
|
|
286
|
+
})
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function BodyContent({ body, mode, command }) {
|
|
290
|
+
if (body.kind === "binary") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, {
|
|
291
|
+
title: "Binary payload",
|
|
292
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconFile, { size: 22 }),
|
|
293
|
+
children: body.note
|
|
294
|
+
});
|
|
295
|
+
if (body.kind === "json") return mode === "raw" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Code, {
|
|
296
|
+
text: bodyRaw(body) ?? "",
|
|
297
|
+
wrap: true
|
|
298
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(JsonView, {
|
|
299
|
+
value: body.json,
|
|
300
|
+
command
|
|
301
|
+
});
|
|
302
|
+
if (body.kind === "image") {
|
|
303
|
+
if (mode === "raw") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Code, { text: body.text ?? "" });
|
|
304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
305
|
+
className: css({
|
|
306
|
+
p: "4",
|
|
307
|
+
display: "flex",
|
|
308
|
+
justifyContent: "center",
|
|
309
|
+
bgImage: "linear-gradient(45deg, token(colors.hover) 25%, transparent 25%), linear-gradient(-45deg, token(colors.hover) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, token(colors.hover) 75%), linear-gradient(-45deg, transparent 75%, token(colors.hover) 75%)",
|
|
310
|
+
bgSize: "16px 16px",
|
|
311
|
+
bgPosition: "0 0, 0 8px, 8px -8px, -8px 0",
|
|
312
|
+
minH: "full"
|
|
313
|
+
}),
|
|
314
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
315
|
+
src: body.dataUrl ?? void 0,
|
|
316
|
+
alt: "Response body",
|
|
317
|
+
className: css({
|
|
318
|
+
maxW: "full",
|
|
319
|
+
objectFit: "contain"
|
|
320
|
+
})
|
|
321
|
+
})
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
if (mode === "preview" && body.text != null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("iframe", {
|
|
325
|
+
title: "HTML preview",
|
|
326
|
+
sandbox: "",
|
|
327
|
+
srcDoc: body.text,
|
|
328
|
+
className: css({
|
|
329
|
+
w: "full",
|
|
330
|
+
h: "full",
|
|
331
|
+
border: "none",
|
|
332
|
+
bg: "white"
|
|
333
|
+
})
|
|
334
|
+
});
|
|
335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Code, { text: body.text ?? "" });
|
|
336
|
+
}
|
|
337
|
+
/** Lines past this render on request: a 1 MB log should not freeze the tab. */
|
|
338
|
+
var LINE_CAP = 4e3;
|
|
339
|
+
/** Plain text with line numbers. */
|
|
340
|
+
function Code({ text, wrap = false }) {
|
|
341
|
+
const [all, setAll] = import_react.useState(false);
|
|
342
|
+
const lines = import_react.useMemo(() => text.split("\n"), [text]);
|
|
343
|
+
const shown = all ? lines : lines.slice(0, LINE_CAP);
|
|
344
|
+
const gutter = String(lines.length).length;
|
|
345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
346
|
+
className: cx(mono, css({
|
|
347
|
+
py: "2",
|
|
348
|
+
lineHeight: "1.6"
|
|
349
|
+
}), !wrap && css({
|
|
350
|
+
w: "max-content",
|
|
351
|
+
minW: "full"
|
|
352
|
+
})),
|
|
353
|
+
children: [shown.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
354
|
+
className: css({
|
|
355
|
+
display: "flex",
|
|
356
|
+
px: "3",
|
|
357
|
+
_hover: { bg: "hover" }
|
|
358
|
+
}),
|
|
359
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
360
|
+
className: css({
|
|
361
|
+
color: "faint",
|
|
362
|
+
textAlign: "right",
|
|
363
|
+
pr: "3",
|
|
364
|
+
userSelect: "none",
|
|
365
|
+
flexShrink: 0
|
|
366
|
+
}),
|
|
367
|
+
style: { width: `${gutter + 2}ch` },
|
|
368
|
+
children: i + 1
|
|
369
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
370
|
+
className: cx(css({
|
|
371
|
+
flex: "1",
|
|
372
|
+
minW: "0"
|
|
373
|
+
}), wrap ? css({
|
|
374
|
+
whiteSpace: "pre-wrap",
|
|
375
|
+
wordBreak: "break-all"
|
|
376
|
+
}) : css({ whiteSpace: "pre" })),
|
|
377
|
+
children: line || " "
|
|
378
|
+
})]
|
|
379
|
+
}, i)), !all && lines.length > LINE_CAP ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
380
|
+
className: css({
|
|
381
|
+
px: "3",
|
|
382
|
+
py: "2"
|
|
383
|
+
}),
|
|
384
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
385
|
+
onClick: () => setAll(true),
|
|
386
|
+
children: [
|
|
387
|
+
"Show all ",
|
|
388
|
+
lines.length.toLocaleString("en-US"),
|
|
389
|
+
" lines"
|
|
390
|
+
]
|
|
391
|
+
})
|
|
392
|
+
}) : null]
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function KvTable({ rows, empty, filterable = rows.length > 8, nameLabel = "Key", valueLabel = "Value", extraLabel }) {
|
|
396
|
+
const [filter, setFilter] = import_react.useState("");
|
|
397
|
+
const needle = filter.trim().toLowerCase();
|
|
398
|
+
const visible = needle ? rows.filter((r) => r.name.toLowerCase().includes(needle) || r.value.toLowerCase().includes(needle)) : rows;
|
|
399
|
+
if (rows.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, { title: empty });
|
|
400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
401
|
+
className: css({
|
|
402
|
+
display: "flex",
|
|
403
|
+
flexDir: "column",
|
|
404
|
+
minH: "0"
|
|
405
|
+
}),
|
|
406
|
+
children: [filterable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
407
|
+
className: css({
|
|
408
|
+
px: "3",
|
|
409
|
+
py: "2"
|
|
410
|
+
}),
|
|
411
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterInput, {
|
|
412
|
+
placeholder: `Filter ${rows.length} rows…`,
|
|
413
|
+
value: filter,
|
|
414
|
+
onChange: (e) => setFilter(e.target.value)
|
|
415
|
+
})
|
|
416
|
+
}) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
417
|
+
className: table,
|
|
418
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
419
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
420
|
+
className: css({ w: "32%" }),
|
|
421
|
+
children: nameLabel
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: valueLabel }),
|
|
424
|
+
extraLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: extraLabel }) : null
|
|
425
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", { children: [visible.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
427
|
+
className: cx(mono, css({
|
|
428
|
+
color: "muted",
|
|
429
|
+
verticalAlign: "top",
|
|
430
|
+
wordBreak: "break-all"
|
|
431
|
+
})),
|
|
432
|
+
children: row.name
|
|
433
|
+
}),
|
|
434
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
435
|
+
className: cx(mono, css({
|
|
436
|
+
wordBreak: "break-all",
|
|
437
|
+
whiteSpace: "pre-wrap"
|
|
438
|
+
})),
|
|
439
|
+
children: row.value
|
|
440
|
+
}),
|
|
441
|
+
extraLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: row.extra }) : null
|
|
442
|
+
] }, `${row.name}:${i}`)), visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", {
|
|
443
|
+
colSpan: extraLabel ? 3 : 2,
|
|
444
|
+
className: css({
|
|
445
|
+
color: "faint",
|
|
446
|
+
textAlign: "center"
|
|
447
|
+
}),
|
|
448
|
+
children: [
|
|
449
|
+
"Nothing matches “",
|
|
450
|
+
filter,
|
|
451
|
+
"”."
|
|
452
|
+
]
|
|
453
|
+
}) }) : null] })]
|
|
454
|
+
})]
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
458
|
+
export { BodyViewer, Code, JsonView, KvTable };
|