@silvery/examples 0.17.4 → 0.17.5
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/_banner-A70_y2Vi.mjs +43 -0
- package/dist/{ansi-CCE2pVS0.mjs → ansi-0VXlUmNn.mjs} +7 -7
- package/dist/apng-B0gRaDVT.mjs +3 -0
- package/dist/{apng-HhhBjRGt.mjs → apng-BTRDTfDW.mjs} +2 -2
- package/dist/apps/aichat/index.mjs +69 -70
- package/dist/apps/app-todo.mjs +19 -20
- package/dist/apps/async-data.mjs +40 -41
- package/dist/apps/cli-wizard.mjs +51 -52
- package/dist/apps/clipboard.mjs +26 -27
- package/dist/apps/components.mjs +189 -190
- package/dist/apps/data-explorer.mjs +52 -53
- package/dist/apps/dev-tools.mjs +39 -40
- package/dist/apps/explorer.mjs +73 -74
- package/dist/apps/gallery.mjs +61 -62
- package/dist/apps/inline-bench.mjs +1 -1
- package/dist/apps/kanban.mjs +22 -23
- package/dist/apps/layout-ref.mjs +27 -28
- package/dist/apps/outline.mjs +35 -36
- package/dist/apps/paste-demo.mjs +33 -34
- package/dist/apps/scroll.mjs +11 -12
- package/dist/apps/search-filter.mjs +23 -24
- package/dist/apps/selection.mjs +30 -31
- package/dist/apps/spatial-focus-demo.mjs +32 -33
- package/dist/apps/task-list.mjs +25 -26
- package/dist/apps/terminal-caps-demo.mjs +30 -31
- package/dist/apps/terminal.mjs +157 -158
- package/dist/apps/text-selection-demo.mjs +62 -63
- package/dist/apps/textarea.mjs +21 -22
- package/dist/apps/theme.mjs +142 -143
- package/dist/apps/transform.mjs +25 -26
- package/dist/apps/virtual-10k.mjs +52 -53
- package/dist/{backends-Bahh9mKN.mjs → backends-Dj-11kZF.mjs} +1 -1
- package/dist/backends-U3QwStfO.mjs +3 -0
- package/dist/components/counter.mjs +6 -7
- package/dist/components/hello.mjs +5 -6
- package/dist/components/progress-bar.mjs +10 -11
- package/dist/components/select-list.mjs +8 -9
- package/dist/components/spinner.mjs +10 -11
- package/dist/components/text-input.mjs +8 -9
- package/dist/components/virtual-list.mjs +7 -8
- package/dist/{flexily-zero-adapter-UB-ra8fR.mjs → flexily-zero-adapter-ByVzLTFP.mjs} +1 -1
- package/dist/gif-B6NGH5gs.mjs +3 -0
- package/dist/{gif-BtnXuxLF.mjs → gif-CfkOF-iG.mjs} +2 -2
- package/dist/layout/dashboard.mjs +197 -198
- package/dist/layout/live-resize.mjs +44 -45
- package/dist/layout/overflow.mjs +16 -17
- package/dist/layout/text-layout.mjs +67 -68
- package/dist/{plugins-D1KtkT4a.mjs → plugins-CT0DdV_E.mjs} +12 -13
- package/dist/{src-BTEVGpd9.mjs → src-jO3Zuzjj.mjs} +3 -3
- package/dist/{yoga-adapter-BVtQ5OJR.mjs → yoga-adapter-BSQHuMV9.mjs} +1 -1
- package/package.json +4 -2
- package/dist/_banner-DLPxCqVy.mjs +0 -44
- package/dist/apng-mwUQbTTF.mjs +0 -3
- package/dist/backends-CCtCDQ94.mjs +0 -3
- package/dist/gif-BZaqPPVX.mjs +0 -3
- package/dist/jsx-runtime-dMs_8fNu.mjs +0 -241
- /package/dist/{UPNG-Cy7ViL8f.mjs → UPNG-ShUlaTDh.mjs} +0 -0
- /package/dist/{__vite-browser-external-2447137e-BML7CYau.mjs → __vite-browser-external-2447137e-Bopa5BFR.mjs} +0 -0
- /package/dist/{gifenc-CLRW41dk.mjs → gifenc-BI4ihP_T.mjs} +0 -0
- /package/dist/{node-NuJ94BWl.mjs → node-nsrAOjH4.mjs} +0 -0
- /package/dist/{resvg-js-C_8Wps1F.mjs → resvg-js-Cnk2o49d.mjs} +0 -0
- /package/dist/{src-CzfRafCQ.mjs → src-9ZhfQyzD.mjs} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as ExampleBanner } from "../_banner-DLPxCqVy.mjs";
|
|
2
|
+
import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
|
|
4
3
|
import { useCallback, useDeferredValue, useMemo, useState } from "react";
|
|
5
4
|
import { Box, Divider, Kbd, Lead, ListView, Muted, Text, TextInput, createTerm, render, useApp, useBoxRect, useInput } from "silvery";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/data-explorer.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Data Explorer — Process Table Example
|
|
@@ -24,7 +24,6 @@ import { Box, Divider, Kbd, Lead, ListView, Muted, Text, TextInput, createTerm,
|
|
|
24
24
|
* Esc - Exit search / quit
|
|
25
25
|
* q - Quit (when not searching)
|
|
26
26
|
*/
|
|
27
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
28
27
|
const meta = {
|
|
29
28
|
name: "Data Explorer",
|
|
30
29
|
description: "Process explorer table with search, ListView, and responsive column widths",
|
|
@@ -183,9 +182,9 @@ function useColumns(totalWidth) {
|
|
|
183
182
|
}
|
|
184
183
|
function TableHeader({ width }) {
|
|
185
184
|
const cols = useColumns(width);
|
|
186
|
-
return /* @__PURE__ */
|
|
185
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
187
186
|
paddingX: 1,
|
|
188
|
-
children: /* @__PURE__ */
|
|
187
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
189
188
|
bold: true,
|
|
190
189
|
color: "$muted",
|
|
191
190
|
children: [
|
|
@@ -208,29 +207,29 @@ function ProcessRow({ proc, isSelected, width }) {
|
|
|
208
207
|
const cpuColor = proc.cpu > 80 ? "$error" : proc.cpu > 40 ? "$warning" : "$success";
|
|
209
208
|
const memColor = proc.mem > 40 ? "$warning" : "$muted";
|
|
210
209
|
const displayName = proc.name.length > cols.nameW - 1 ? proc.name.slice(0, cols.nameW - 2) + "…" : proc.name;
|
|
211
|
-
return /* @__PURE__ */
|
|
210
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
212
211
|
paddingX: 1,
|
|
213
212
|
backgroundColor: isSelected ? "$primary" : void 0,
|
|
214
213
|
children: [
|
|
215
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ jsx(Text, {
|
|
216
215
|
color: isSelected ? "$primary-fg" : "$muted",
|
|
217
216
|
children: String(proc.pid).padEnd(cols.pidW)
|
|
218
217
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ jsx(Text, {
|
|
220
219
|
bold: isSelected,
|
|
221
220
|
color: isSelected ? "$primary-fg" : void 0,
|
|
222
221
|
children: displayName.padEnd(cols.nameW)
|
|
223
222
|
}),
|
|
224
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
225
224
|
color: isSelected ? "$primary-fg" : cpuColor,
|
|
226
225
|
children: [proc.cpu.toFixed(1).padStart(cols.cpuW - 1), "%"]
|
|
227
226
|
}),
|
|
228
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
229
228
|
color: isSelected ? "$primary-fg" : memColor,
|
|
230
229
|
children: [proc.mem.toFixed(1).padStart(cols.memW - 1), "%"]
|
|
231
230
|
}),
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
232
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
234
233
|
color: isSelected ? "$primary-fg" : STATUS_COLORS[proc.status],
|
|
235
234
|
children: [
|
|
236
235
|
STATUS_ICONS[proc.status],
|
|
@@ -238,16 +237,16 @@ function ProcessRow({ proc, isSelected, width }) {
|
|
|
238
237
|
proc.status.padEnd(cols.statusW - 2)
|
|
239
238
|
]
|
|
240
239
|
}),
|
|
241
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ jsx(Text, {
|
|
242
241
|
color: isSelected ? "$primary-fg" : "$muted",
|
|
243
242
|
children: proc.user.padEnd(cols.userW)
|
|
244
243
|
}),
|
|
245
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ jsx(Text, {
|
|
246
245
|
color: isSelected ? "$primary-fg" : "$muted",
|
|
247
246
|
children: String(proc.threads).padStart(cols.threadsW)
|
|
248
247
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
249
|
+
/* @__PURE__ */ jsx(Text, {
|
|
251
250
|
color: isSelected ? "$primary-fg" : "$muted",
|
|
252
251
|
children: proc.uptime.padStart(cols.uptimeW)
|
|
253
252
|
})
|
|
@@ -270,23 +269,23 @@ function SummaryBar({ processes, query }) {
|
|
|
270
269
|
totalMem: totalMem.toFixed(1)
|
|
271
270
|
};
|
|
272
271
|
}, [processes]);
|
|
273
|
-
return /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
274
273
|
paddingX: 1,
|
|
275
274
|
gap: 2,
|
|
276
275
|
children: [
|
|
277
|
-
/* @__PURE__ */
|
|
276
|
+
/* @__PURE__ */ jsx(Text, {
|
|
278
277
|
bold: true,
|
|
279
278
|
children: processes.length
|
|
280
279
|
}),
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ jsx(Muted, { children: "processes" }),
|
|
281
|
+
/* @__PURE__ */ jsx(Text, {
|
|
283
282
|
color: "$success",
|
|
284
283
|
bold: true,
|
|
285
284
|
children: stats.running
|
|
286
285
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
/* @__PURE__ */
|
|
286
|
+
/* @__PURE__ */ jsx(Muted, { children: "running" }),
|
|
287
|
+
/* @__PURE__ */ jsx(Muted, { children: "|" }),
|
|
288
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
290
289
|
color: "$primary",
|
|
291
290
|
children: [
|
|
292
291
|
"CPU: ",
|
|
@@ -294,7 +293,7 @@ function SummaryBar({ processes, query }) {
|
|
|
294
293
|
"%"
|
|
295
294
|
]
|
|
296
295
|
}),
|
|
297
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
298
297
|
color: "$warning",
|
|
299
298
|
children: [
|
|
300
299
|
"MEM: ",
|
|
@@ -302,7 +301,7 @@ function SummaryBar({ processes, query }) {
|
|
|
302
301
|
"%"
|
|
303
302
|
]
|
|
304
303
|
}),
|
|
305
|
-
query && /* @__PURE__ */
|
|
304
|
+
query && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Muted, { children: "|" }), /* @__PURE__ */ jsxs(Text, {
|
|
306
305
|
dim: true,
|
|
307
306
|
children: [
|
|
308
307
|
"filter: \"",
|
|
@@ -316,13 +315,13 @@ function SummaryBar({ processes, query }) {
|
|
|
316
315
|
/** Inner component that reads the flex container's height */
|
|
317
316
|
function ProcessListArea({ processes, cursor, width }) {
|
|
318
317
|
const { height } = useBoxRect();
|
|
319
|
-
return /* @__PURE__ */
|
|
318
|
+
return /* @__PURE__ */ jsx(ListView, {
|
|
320
319
|
items: processes,
|
|
321
320
|
height,
|
|
322
321
|
estimateHeight: 1,
|
|
323
322
|
scrollTo: cursor,
|
|
324
323
|
overscan: 5,
|
|
325
|
-
renderItem: (proc, index) => /* @__PURE__ */
|
|
324
|
+
renderItem: (proc, index) => /* @__PURE__ */ jsx(ProcessRow, {
|
|
326
325
|
proc,
|
|
327
326
|
isSelected: index === cursor,
|
|
328
327
|
width
|
|
@@ -380,21 +379,21 @@ function DataExplorer() {
|
|
|
380
379
|
halfPage,
|
|
381
380
|
query
|
|
382
381
|
]));
|
|
383
|
-
return /* @__PURE__ */
|
|
382
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
384
383
|
flexDirection: "column",
|
|
385
384
|
flexGrow: 1,
|
|
386
385
|
children: [
|
|
387
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ jsx(SummaryBar, {
|
|
388
387
|
processes: filtered,
|
|
389
388
|
query: deferredQuery
|
|
390
389
|
}),
|
|
391
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ jsx(Box, {
|
|
392
391
|
paddingX: 1,
|
|
393
|
-
children: searchMode ? /* @__PURE__ */
|
|
392
|
+
children: searchMode ? /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsxs(Text, {
|
|
394
393
|
color: "$primary",
|
|
395
394
|
bold: true,
|
|
396
395
|
children: ["/", " "]
|
|
397
|
-
}), /* @__PURE__ */
|
|
396
|
+
}), /* @__PURE__ */ jsx(TextInput, {
|
|
398
397
|
value: query,
|
|
399
398
|
onChange: (v) => {
|
|
400
399
|
setQuery(v);
|
|
@@ -403,57 +402,57 @@ function DataExplorer() {
|
|
|
403
402
|
onSubmit: handleSearchSubmit,
|
|
404
403
|
prompt: "",
|
|
405
404
|
isActive: searchMode
|
|
406
|
-
})] }) : query ? /* @__PURE__ */
|
|
405
|
+
})] }) : query ? /* @__PURE__ */ jsxs(Muted, { children: [
|
|
407
406
|
"filter: ",
|
|
408
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ jsx(Text, {
|
|
409
408
|
bold: true,
|
|
410
409
|
children: query
|
|
411
410
|
}),
|
|
412
411
|
" (backspace to clear, / to edit)"
|
|
413
|
-
] }) : /* @__PURE__ */
|
|
412
|
+
] }) : /* @__PURE__ */ jsxs(Muted, { children: [
|
|
414
413
|
"Press ",
|
|
415
|
-
/* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ jsx(Kbd, { children: "/" }),
|
|
416
415
|
" to search"
|
|
417
416
|
] })
|
|
418
417
|
}),
|
|
419
|
-
/* @__PURE__ */
|
|
420
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ jsx(TableHeader, { width }),
|
|
419
|
+
/* @__PURE__ */ jsx(Box, {
|
|
421
420
|
paddingX: 1,
|
|
422
|
-
children: /* @__PURE__ */
|
|
421
|
+
children: /* @__PURE__ */ jsx(Divider, {})
|
|
423
422
|
}),
|
|
424
|
-
/* @__PURE__ */
|
|
423
|
+
/* @__PURE__ */ jsx(Box, {
|
|
425
424
|
flexGrow: 1,
|
|
426
425
|
flexDirection: "column",
|
|
427
|
-
children: filtered.length > 0 ? /* @__PURE__ */
|
|
426
|
+
children: filtered.length > 0 ? /* @__PURE__ */ jsx(ProcessListArea, {
|
|
428
427
|
processes: filtered,
|
|
429
428
|
cursor: effectiveCursor,
|
|
430
429
|
width
|
|
431
|
-
}) : /* @__PURE__ */
|
|
430
|
+
}) : /* @__PURE__ */ jsx(Box, {
|
|
432
431
|
paddingX: 1,
|
|
433
432
|
justifyContent: "center",
|
|
434
|
-
children: /* @__PURE__ */
|
|
433
|
+
children: /* @__PURE__ */ jsxs(Lead, { children: [
|
|
435
434
|
"No processes match \"",
|
|
436
435
|
deferredQuery,
|
|
437
436
|
"\""
|
|
438
437
|
] })
|
|
439
438
|
})
|
|
440
439
|
}),
|
|
441
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
442
441
|
paddingX: 1,
|
|
443
442
|
justifyContent: "space-between",
|
|
444
|
-
children: [/* @__PURE__ */
|
|
445
|
-
/* @__PURE__ */
|
|
443
|
+
children: [/* @__PURE__ */ jsxs(Muted, { children: [
|
|
444
|
+
/* @__PURE__ */ jsx(Kbd, { children: "j/k" }),
|
|
446
445
|
" navigate ",
|
|
447
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ jsx(Kbd, { children: "d/u" }),
|
|
448
447
|
" half-page ",
|
|
449
|
-
/* @__PURE__ */
|
|
448
|
+
/* @__PURE__ */ jsx(Kbd, { children: "g/G" }),
|
|
450
449
|
" start/end ",
|
|
451
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ jsx(Kbd, { children: "/" }),
|
|
452
451
|
" search ",
|
|
453
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
454
453
|
" ",
|
|
455
454
|
"quit"
|
|
456
|
-
] }), /* @__PURE__ */
|
|
455
|
+
] }), /* @__PURE__ */ jsxs(Muted, { children: [
|
|
457
456
|
effectiveCursor + 1,
|
|
458
457
|
"/",
|
|
459
458
|
filtered.length
|
|
@@ -466,10 +465,10 @@ async function main() {
|
|
|
466
465
|
try {
|
|
467
466
|
var _usingCtx$1 = _usingCtx();
|
|
468
467
|
const term = _usingCtx$1.u(createTerm());
|
|
469
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
468
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
470
469
|
meta,
|
|
471
470
|
controls: "j/k navigate d/u half-page g/G start/end / search Esc/q quit",
|
|
472
|
-
children: /* @__PURE__ */
|
|
471
|
+
children: /* @__PURE__ */ jsx(DataExplorer, {})
|
|
473
472
|
}), term);
|
|
474
473
|
await waitUntilExit();
|
|
475
474
|
} catch (_) {
|
package/dist/apps/dev-tools.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as ExampleBanner } from "../_banner-DLPxCqVy.mjs";
|
|
2
|
+
import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
|
|
4
3
|
import { useCallback, useMemo, useState } from "react";
|
|
5
4
|
import { Box, Divider, ListView, Muted, Strong, Text, createTerm, render, useApp, useBoxRect, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/dev-tools.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Dev Tools — Log Viewer Example
|
|
@@ -26,7 +26,6 @@ import { Box, Divider, ListView, Muted, Strong, Text, createTerm, render, useApp
|
|
|
26
26
|
* c - Clear all logs
|
|
27
27
|
* q or Esc - Quit
|
|
28
28
|
*/
|
|
29
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
30
29
|
const meta = {
|
|
31
30
|
name: "Dev Tools",
|
|
32
31
|
description: "Log viewer with severity levels, ListView, and keyboard-driven log injection",
|
|
@@ -147,20 +146,20 @@ function formatTime(date) {
|
|
|
147
146
|
function LogRow({ entry, isSelected }) {
|
|
148
147
|
const badge = LEVEL_BADGES[entry.level];
|
|
149
148
|
const color = LEVEL_COLORS[entry.level];
|
|
150
|
-
if (isSelected) return /* @__PURE__ */
|
|
149
|
+
if (isSelected) return /* @__PURE__ */ jsxs(Box, {
|
|
151
150
|
paddingX: 1,
|
|
152
151
|
backgroundColor: "$primary",
|
|
153
152
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
155
154
|
color: "$primary-fg",
|
|
156
155
|
children: [formatTime(entry.timestamp), " "]
|
|
157
156
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ jsx(Text, {
|
|
159
158
|
color: "$primary-fg",
|
|
160
159
|
bold: true,
|
|
161
160
|
children: badge
|
|
162
161
|
}),
|
|
163
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
164
163
|
color: "$primary-fg",
|
|
165
164
|
children: [
|
|
166
165
|
" [",
|
|
@@ -168,27 +167,27 @@ function LogRow({ entry, isSelected }) {
|
|
|
168
167
|
"] "
|
|
169
168
|
]
|
|
170
169
|
}),
|
|
171
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ jsx(Text, {
|
|
172
171
|
color: "$primary-fg",
|
|
173
172
|
bold: true,
|
|
174
173
|
children: entry.message
|
|
175
174
|
})
|
|
176
175
|
]
|
|
177
176
|
});
|
|
178
|
-
return /* @__PURE__ */
|
|
177
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
179
178
|
paddingX: 1,
|
|
180
179
|
children: [
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ jsxs(Muted, { children: [formatTime(entry.timestamp), " "] }),
|
|
181
|
+
/* @__PURE__ */ jsx(Strong, {
|
|
183
182
|
color,
|
|
184
183
|
children: badge
|
|
185
184
|
}),
|
|
186
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
187
186
|
" [",
|
|
188
187
|
entry.source.padEnd(9),
|
|
189
188
|
"] "
|
|
190
189
|
] }),
|
|
191
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ jsx(Text, { children: entry.message })
|
|
192
191
|
]
|
|
193
192
|
});
|
|
194
193
|
}
|
|
@@ -203,10 +202,10 @@ function LevelCounts({ entries }) {
|
|
|
203
202
|
for (const e of entries) c[e.level]++;
|
|
204
203
|
return c;
|
|
205
204
|
}, [entries]);
|
|
206
|
-
return /* @__PURE__ */
|
|
205
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
207
206
|
gap: 2,
|
|
208
207
|
children: [
|
|
209
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ jsxs(Strong, {
|
|
210
209
|
color: "$muted",
|
|
211
210
|
children: [
|
|
212
211
|
LEVEL_BADGES.DEBUG,
|
|
@@ -214,7 +213,7 @@ function LevelCounts({ entries }) {
|
|
|
214
213
|
counts.DEBUG
|
|
215
214
|
]
|
|
216
215
|
}),
|
|
217
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ jsxs(Strong, {
|
|
218
217
|
color: "$primary",
|
|
219
218
|
children: [
|
|
220
219
|
LEVEL_BADGES.INFO,
|
|
@@ -222,7 +221,7 @@ function LevelCounts({ entries }) {
|
|
|
222
221
|
counts.INFO
|
|
223
222
|
]
|
|
224
223
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
224
|
+
/* @__PURE__ */ jsxs(Strong, {
|
|
226
225
|
color: "$warning",
|
|
227
226
|
children: [
|
|
228
227
|
LEVEL_BADGES.WARN,
|
|
@@ -230,7 +229,7 @@ function LevelCounts({ entries }) {
|
|
|
230
229
|
counts.WARN
|
|
231
230
|
]
|
|
232
231
|
}),
|
|
233
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ jsxs(Strong, {
|
|
234
233
|
color: "$error",
|
|
235
234
|
children: [
|
|
236
235
|
LEVEL_BADGES.ERROR,
|
|
@@ -244,13 +243,13 @@ function LevelCounts({ entries }) {
|
|
|
244
243
|
/** Inner component that reads the flex container's height via useBoxRect */
|
|
245
244
|
function LogListArea({ entries, cursor }) {
|
|
246
245
|
const { height } = useBoxRect();
|
|
247
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ jsx(ListView, {
|
|
248
247
|
items: entries,
|
|
249
248
|
height,
|
|
250
249
|
estimateHeight: 1,
|
|
251
250
|
scrollTo: cursor,
|
|
252
251
|
overscan: 5,
|
|
253
|
-
renderItem: (entry, index) => /* @__PURE__ */
|
|
252
|
+
renderItem: (entry, index) => /* @__PURE__ */ jsx(LogRow, {
|
|
254
253
|
entry,
|
|
255
254
|
isSelected: index === cursor
|
|
256
255
|
}, entry.id)
|
|
@@ -320,55 +319,55 @@ function DevTools() {
|
|
|
320
319
|
exit,
|
|
321
320
|
addEntry
|
|
322
321
|
]));
|
|
323
|
-
return /* @__PURE__ */
|
|
322
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
324
323
|
flexDirection: "column",
|
|
325
324
|
flexGrow: 1,
|
|
326
325
|
padding: 1,
|
|
327
326
|
children: [
|
|
328
|
-
/* @__PURE__ */
|
|
327
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
329
328
|
justifyContent: "space-between",
|
|
330
329
|
backgroundColor: "$surfacebg",
|
|
331
|
-
children: [/* @__PURE__ */
|
|
330
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
332
331
|
gap: 2,
|
|
333
|
-
children: [/* @__PURE__ */
|
|
332
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
334
333
|
bold: true,
|
|
335
334
|
color: "$primary",
|
|
336
335
|
children: ["▸", " Log Viewer"]
|
|
337
|
-
}), /* @__PURE__ */
|
|
338
|
-
}), /* @__PURE__ */
|
|
336
|
+
}), /* @__PURE__ */ jsx(LevelCounts, { entries })]
|
|
337
|
+
}), /* @__PURE__ */ jsxs(Box, {
|
|
339
338
|
gap: 1,
|
|
340
339
|
children: [
|
|
341
|
-
autoScroll && /* @__PURE__ */
|
|
340
|
+
autoScroll && /* @__PURE__ */ jsx(Text, {
|
|
342
341
|
backgroundColor: "$success",
|
|
343
342
|
color: "$success-fg",
|
|
344
343
|
bold: true,
|
|
345
344
|
children: " LIVE "
|
|
346
345
|
}),
|
|
347
|
-
/* @__PURE__ */
|
|
346
|
+
/* @__PURE__ */ jsx(Strong, {
|
|
348
347
|
color: "$primary",
|
|
349
348
|
children: cursor + 1
|
|
350
349
|
}),
|
|
351
|
-
/* @__PURE__ */
|
|
350
|
+
/* @__PURE__ */ jsxs(Muted, { children: ["/ ", entries.length] })
|
|
352
351
|
]
|
|
353
352
|
})]
|
|
354
353
|
}),
|
|
355
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
356
355
|
paddingX: 1,
|
|
357
356
|
children: [
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ jsxs(Muted, { children: ["Time ", " "] }),
|
|
358
|
+
/* @__PURE__ */ jsxs(Muted, { children: ["Lvl", " "] }),
|
|
359
|
+
/* @__PURE__ */ jsxs(Muted, { children: ["[Source ]", " "] }),
|
|
360
|
+
/* @__PURE__ */ jsx(Muted, { children: "Message" })
|
|
362
361
|
]
|
|
363
362
|
}),
|
|
364
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ jsx(Box, {
|
|
365
364
|
paddingX: 1,
|
|
366
|
-
children: /* @__PURE__ */
|
|
365
|
+
children: /* @__PURE__ */ jsx(Divider, {})
|
|
367
366
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ jsx(Box, {
|
|
369
368
|
flexGrow: 1,
|
|
370
369
|
flexDirection: "column",
|
|
371
|
-
children: /* @__PURE__ */
|
|
370
|
+
children: /* @__PURE__ */ jsx(LogListArea, {
|
|
372
371
|
entries,
|
|
373
372
|
cursor
|
|
374
373
|
})
|
|
@@ -380,10 +379,10 @@ async function main() {
|
|
|
380
379
|
try {
|
|
381
380
|
var _usingCtx$1 = _usingCtx();
|
|
382
381
|
const term = _usingCtx$1.u(createTerm());
|
|
383
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
382
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
384
383
|
meta,
|
|
385
384
|
controls: "j/k navigate g/G start/end d/i/w/e add log c clear Esc/q quit",
|
|
386
|
-
children: /* @__PURE__ */
|
|
385
|
+
children: /* @__PURE__ */ jsx(DevTools, {})
|
|
387
386
|
}), term);
|
|
388
387
|
await waitUntilExit();
|
|
389
388
|
} catch (_) {
|