@silvery/examples 0.17.3 → 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.
Files changed (111) hide show
  1. package/dist/UPNG-ShUlaTDh.mjs +5074 -0
  2. package/dist/__vite-browser-external-2447137e-Bopa5BFR.mjs +4 -0
  3. package/dist/_banner-A70_y2Vi.mjs +43 -0
  4. package/dist/ansi-0VXlUmNn.mjs +16397 -0
  5. package/dist/apng-B0gRaDVT.mjs +3 -0
  6. package/dist/apng-BTRDTfDW.mjs +68 -0
  7. package/dist/apps/aichat/index.mjs +1298 -0
  8. package/dist/apps/app-todo.mjs +138 -0
  9. package/dist/apps/async-data.mjs +203 -0
  10. package/dist/apps/cli-wizard.mjs +338 -0
  11. package/dist/apps/clipboard.mjs +197 -0
  12. package/dist/apps/components.mjs +863 -0
  13. package/dist/apps/data-explorer.mjs +482 -0
  14. package/dist/apps/dev-tools.mjs +396 -0
  15. package/dist/apps/explorer.mjs +697 -0
  16. package/dist/apps/gallery.mjs +765 -0
  17. package/dist/apps/inline-bench.mjs +115 -0
  18. package/dist/apps/kanban.mjs +279 -0
  19. package/dist/apps/layout-ref.mjs +186 -0
  20. package/dist/apps/outline.mjs +202 -0
  21. package/dist/apps/paste-demo.mjs +188 -0
  22. package/dist/apps/scroll.mjs +85 -0
  23. package/dist/apps/search-filter.mjs +286 -0
  24. package/dist/apps/selection.mjs +354 -0
  25. package/dist/apps/spatial-focus-demo.mjs +387 -0
  26. package/dist/apps/task-list.mjs +257 -0
  27. package/dist/apps/terminal-caps-demo.mjs +314 -0
  28. package/dist/apps/terminal.mjs +871 -0
  29. package/dist/apps/text-selection-demo.mjs +253 -0
  30. package/dist/apps/textarea.mjs +177 -0
  31. package/dist/apps/theme.mjs +660 -0
  32. package/dist/apps/transform.mjs +214 -0
  33. package/dist/apps/virtual-10k.mjs +421 -0
  34. package/dist/assets/resvgjs.darwin-arm64-BtufyGW1.node +0 -0
  35. package/dist/backends-Dj-11kZF.mjs +1179 -0
  36. package/dist/backends-U3QwStfO.mjs +3 -0
  37. package/dist/{cli.mjs → bin/cli.mjs} +15 -19
  38. package/dist/chunk-BSw8zbkd.mjs +37 -0
  39. package/dist/components/counter.mjs +47 -0
  40. package/dist/components/hello.mjs +30 -0
  41. package/dist/components/progress-bar.mjs +58 -0
  42. package/dist/components/select-list.mjs +84 -0
  43. package/dist/components/spinner.mjs +56 -0
  44. package/dist/components/text-input.mjs +61 -0
  45. package/dist/components/virtual-list.mjs +50 -0
  46. package/dist/flexily-zero-adapter-ByVzLTFP.mjs +3374 -0
  47. package/dist/gif-B6NGH5gs.mjs +3 -0
  48. package/dist/gif-CfkOF-iG.mjs +71 -0
  49. package/dist/gifenc-BI4ihP_T.mjs +728 -0
  50. package/dist/key-mapping-5oYQdAQE.mjs +3 -0
  51. package/dist/key-mapping-D4LR1go6.mjs +130 -0
  52. package/dist/layout/dashboard.mjs +1203 -0
  53. package/dist/layout/live-resize.mjs +302 -0
  54. package/dist/layout/overflow.mjs +69 -0
  55. package/dist/layout/text-layout.mjs +334 -0
  56. package/dist/node-nsrAOjH4.mjs +1083 -0
  57. package/dist/plugins-CT0DdV_E.mjs +3056 -0
  58. package/dist/resvg-js-Cnk2o49d.mjs +201 -0
  59. package/dist/src-9ZhfQyzD.mjs +814 -0
  60. package/dist/src-CUUOuRH6.mjs +5322 -0
  61. package/dist/src-jO3Zuzjj.mjs +23538 -0
  62. package/dist/usingCtx-CsEf0xO3.mjs +57 -0
  63. package/dist/yoga-adapter-BSQHuMV9.mjs +237 -0
  64. package/package.json +21 -14
  65. package/_banner.tsx +0 -60
  66. package/apps/aichat/components.tsx +0 -469
  67. package/apps/aichat/index.tsx +0 -220
  68. package/apps/aichat/script.ts +0 -460
  69. package/apps/aichat/state.ts +0 -325
  70. package/apps/aichat/types.ts +0 -19
  71. package/apps/app-todo.tsx +0 -201
  72. package/apps/async-data.tsx +0 -196
  73. package/apps/cli-wizard.tsx +0 -332
  74. package/apps/clipboard.tsx +0 -183
  75. package/apps/components.tsx +0 -658
  76. package/apps/data-explorer.tsx +0 -490
  77. package/apps/dev-tools.tsx +0 -395
  78. package/apps/explorer.tsx +0 -731
  79. package/apps/gallery.tsx +0 -653
  80. package/apps/inline-bench.tsx +0 -138
  81. package/apps/kanban.tsx +0 -265
  82. package/apps/layout-ref.tsx +0 -173
  83. package/apps/outline.tsx +0 -160
  84. package/apps/panes/index.tsx +0 -203
  85. package/apps/paste-demo.tsx +0 -185
  86. package/apps/scroll.tsx +0 -80
  87. package/apps/search-filter.tsx +0 -240
  88. package/apps/selection.tsx +0 -346
  89. package/apps/spatial-focus-demo.tsx +0 -372
  90. package/apps/task-list.tsx +0 -271
  91. package/apps/terminal-caps-demo.tsx +0 -317
  92. package/apps/terminal.tsx +0 -784
  93. package/apps/text-selection-demo.tsx +0 -193
  94. package/apps/textarea.tsx +0 -155
  95. package/apps/theme.tsx +0 -515
  96. package/apps/transform.tsx +0 -229
  97. package/apps/virtual-10k.tsx +0 -405
  98. package/apps/vterm-demo/index.tsx +0 -216
  99. package/components/counter.tsx +0 -49
  100. package/components/hello.tsx +0 -38
  101. package/components/progress-bar.tsx +0 -52
  102. package/components/select-list.tsx +0 -54
  103. package/components/spinner.tsx +0 -44
  104. package/components/text-input.tsx +0 -61
  105. package/components/virtual-list.tsx +0 -56
  106. package/dist/cli.d.mts +0 -1
  107. package/dist/cli.mjs.map +0 -1
  108. package/layout/dashboard.tsx +0 -953
  109. package/layout/live-resize.tsx +0 -282
  110. package/layout/overflow.tsx +0 -51
  111. package/layout/text-layout.tsx +0 -283
@@ -0,0 +1,1203 @@
1
+ import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
2
+ import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
3
+ import { useState } from "react";
4
+ import { Box, Muted, Tab, TabList, TabPanel, Tabs, Text, createTerm, render, useApp, useBoxRect, useInput, useInterval } from "silvery";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ //#region layout/dashboard.tsx
7
+ /**
8
+ * Dashboard Example
9
+ *
10
+ * A btop-style responsive dashboard demonstrating:
11
+ * - Multi-pane flexbox layout with round borders
12
+ * - Live-updating metrics with sparklines and progress bars
13
+ * - Responsive 2-column / tabbed layout via useBoxRect()
14
+ * - Semantic theme colors with severity-based color coding
15
+ * - Process table with sorting
16
+ */
17
+ const meta = {
18
+ name: "Dashboard",
19
+ description: "Responsive multi-pane dashboard with live metrics and charts",
20
+ demo: true,
21
+ features: [
22
+ "Box flexGrow",
23
+ "useBoxRect()",
24
+ "responsive",
25
+ "live data",
26
+ "sparklines"
27
+ ]
28
+ };
29
+ const SPARK_CHARS = "▁▂▃▄▅▆▇█";
30
+ function sparkline(values) {
31
+ return values.map((v) => SPARK_CHARS[Math.max(0, Math.min(7, v))] ?? SPARK_CHARS[0]).join("");
32
+ }
33
+ /** Fixed-width inline progress bar string: ████████░░░░ */
34
+ function miniBar(pct, width) {
35
+ const filled = Math.round(pct / 100 * width);
36
+ return "█".repeat(filled) + "░".repeat(width - filled);
37
+ }
38
+ function jitter(base, range) {
39
+ return Math.max(0, Math.min(100, base + (Math.random() - .5) * range));
40
+ }
41
+ function pushHistory(history, value, max = 20) {
42
+ const next = [...history];
43
+ if (next.length >= max) next.shift();
44
+ next.push(value);
45
+ return next;
46
+ }
47
+ function severityColor(pct) {
48
+ if (pct >= 80) return "$error";
49
+ if (pct >= 60) return "$warning";
50
+ return "$success";
51
+ }
52
+ function heatColor(temp) {
53
+ if (temp >= 75) return "$error";
54
+ if (temp >= 60) return "$warning";
55
+ return "$success";
56
+ }
57
+ function createInitialState() {
58
+ return {
59
+ cores: [
60
+ {
61
+ label: "cpu00",
62
+ pct: 12,
63
+ freq: "3.62",
64
+ temp: 39,
65
+ mode: "idle"
66
+ },
67
+ {
68
+ label: "cpu01",
69
+ pct: 28,
70
+ freq: "3.79",
71
+ temp: 42,
72
+ mode: "balanced"
73
+ },
74
+ {
75
+ label: "cpu02",
76
+ pct: 44,
77
+ freq: "4.02",
78
+ temp: 47,
79
+ mode: "steady"
80
+ },
81
+ {
82
+ label: "cpu03",
83
+ pct: 57,
84
+ freq: "4.18",
85
+ temp: 53,
86
+ mode: "steady"
87
+ },
88
+ {
89
+ label: "cpu04",
90
+ pct: 63,
91
+ freq: "4.31",
92
+ temp: 61,
93
+ mode: "warm"
94
+ },
95
+ {
96
+ label: "cpu05",
97
+ pct: 71,
98
+ freq: "4.47",
99
+ temp: 68,
100
+ mode: "boost"
101
+ },
102
+ {
103
+ label: "cpu06",
104
+ pct: 79,
105
+ freq: "4.62",
106
+ temp: 72,
107
+ mode: "boost"
108
+ },
109
+ {
110
+ label: "cpu07",
111
+ pct: 83,
112
+ freq: "4.84",
113
+ temp: 75,
114
+ mode: "boost"
115
+ },
116
+ {
117
+ label: "cpu08",
118
+ pct: 88,
119
+ freq: "5.02",
120
+ temp: 77,
121
+ mode: "turbo"
122
+ },
123
+ {
124
+ label: "cpu09",
125
+ pct: 94,
126
+ freq: "5.21",
127
+ temp: 81,
128
+ mode: "turbo"
129
+ }
130
+ ],
131
+ totalCpu: 67,
132
+ userCpu: 38,
133
+ sysCpu: 12,
134
+ waitCpu: 14,
135
+ load: [
136
+ 4.21,
137
+ 3.88,
138
+ 3.11
139
+ ],
140
+ avgTemp: 71,
141
+ tasks: 287,
142
+ avgFreq: "4.31",
143
+ ctxPerSec: "128k",
144
+ uptime: "12d 06h",
145
+ pkgPct: 67,
146
+ power: 84,
147
+ fan: 1460,
148
+ boostOn: true,
149
+ cpuHistory: [
150
+ 1,
151
+ 2,
152
+ 2,
153
+ 3,
154
+ 2,
155
+ 4,
156
+ 5,
157
+ 4,
158
+ 6,
159
+ 5,
160
+ 4,
161
+ 6,
162
+ 7,
163
+ 6,
164
+ 5,
165
+ 6,
166
+ 7,
167
+ 6,
168
+ 5,
169
+ 4,
170
+ 5,
171
+ 6,
172
+ 5,
173
+ 7,
174
+ 6,
175
+ 5,
176
+ 6,
177
+ 7,
178
+ 7,
179
+ 6,
180
+ 5,
181
+ 4,
182
+ 5,
183
+ 6,
184
+ 5,
185
+ 4
186
+ ],
187
+ memory: {
188
+ ramUsed: 23.7,
189
+ ramTotal: 32,
190
+ cached: 5.9,
191
+ free: 2.4,
192
+ slab: 1.1,
193
+ apps: 17.4,
194
+ wired: 1.8,
195
+ buffers: .612,
196
+ dirty: .212,
197
+ shared: 1.3,
198
+ reclaim: .8,
199
+ swapUsed: 2.1,
200
+ swapTotal: 8,
201
+ history: [
202
+ 4,
203
+ 4,
204
+ 5,
205
+ 5,
206
+ 4,
207
+ 5,
208
+ 6,
209
+ 5,
210
+ 5,
211
+ 6,
212
+ 6,
213
+ 5,
214
+ 6,
215
+ 6,
216
+ 7,
217
+ 6,
218
+ 6,
219
+ 5,
220
+ 6,
221
+ 6,
222
+ 5,
223
+ 5,
224
+ 6,
225
+ 5
226
+ ]
227
+ },
228
+ network: {
229
+ dlRate: 428,
230
+ dlPeak: 612,
231
+ ulRate: 86,
232
+ ulPeak: 143,
233
+ connEst: 184,
234
+ listen: 23,
235
+ syn: 2,
236
+ drops: 0,
237
+ rxPps: "61.2kpps",
238
+ txPps: "19.4kpps",
239
+ retrans: "0.08%",
240
+ rtt: "18ms",
241
+ dlHistory: [
242
+ 1,
243
+ 2,
244
+ 3,
245
+ 5,
246
+ 4,
247
+ 6,
248
+ 5,
249
+ 7,
250
+ 6,
251
+ 4,
252
+ 3,
253
+ 5,
254
+ 6,
255
+ 7,
256
+ 5,
257
+ 4,
258
+ 6,
259
+ 7,
260
+ 6,
261
+ 5,
262
+ 4,
263
+ 6,
264
+ 5,
265
+ 4
266
+ ],
267
+ ulHistory: [
268
+ 0,
269
+ 1,
270
+ 1,
271
+ 2,
272
+ 2,
273
+ 3,
274
+ 2,
275
+ 4,
276
+ 3,
277
+ 2,
278
+ 1,
279
+ 2,
280
+ 3,
281
+ 4,
282
+ 3,
283
+ 2,
284
+ 1,
285
+ 2,
286
+ 3,
287
+ 2,
288
+ 2,
289
+ 3,
290
+ 2,
291
+ 1
292
+ ]
293
+ },
294
+ processes: [
295
+ {
296
+ pid: 31842,
297
+ name: "bun dev --hot src/server.ts",
298
+ cpu: 94.2,
299
+ memp: 3.8,
300
+ mem: "1.22G",
301
+ status: "Running",
302
+ time: "01:42:17",
303
+ io: "24M/s",
304
+ thr: 18
305
+ },
306
+ {
307
+ pid: 27114,
308
+ name: "node /usr/bin/vite --host",
309
+ cpu: 71.4,
310
+ memp: 2.2,
311
+ mem: "716M",
312
+ status: "Running",
313
+ time: "00:18:09",
314
+ io: "12M/s",
315
+ thr: 26
316
+ },
317
+ {
318
+ pid: 918,
319
+ name: "postgres: checkpointer",
320
+ cpu: 12.8,
321
+ memp: 1.4,
322
+ mem: "448M",
323
+ status: "Sleep",
324
+ time: "19:22:41",
325
+ io: "3.1M/s",
326
+ thr: 27
327
+ },
328
+ {
329
+ pid: 1023,
330
+ name: "Code Helper (Renderer)",
331
+ cpu: 9.6,
332
+ memp: 4.8,
333
+ mem: "1.53G",
334
+ status: "Sleep",
335
+ time: "07:13:51",
336
+ io: "1.2M/s",
337
+ thr: 44
338
+ },
339
+ {
340
+ pid: 2241,
341
+ name: "docker-desktop",
342
+ cpu: 8.9,
343
+ memp: 6.3,
344
+ mem: "2.01G",
345
+ status: "Running",
346
+ time: "11:08:04",
347
+ io: "9.4M/s",
348
+ thr: 61
349
+ },
350
+ {
351
+ pid: 1542,
352
+ name: "redis-server *:6379",
353
+ cpu: 6.7,
354
+ memp: .9,
355
+ mem: "289M",
356
+ status: "Sleep",
357
+ time: "02:51:17",
358
+ io: "642K/s",
359
+ thr: 8
360
+ },
361
+ {
362
+ pid: 612,
363
+ name: "tailscaled --tun=userspace-networking",
364
+ cpu: 5.4,
365
+ memp: .4,
366
+ mem: "132M",
367
+ status: "Sleep",
368
+ time: "05:44:22",
369
+ io: "218K/s",
370
+ thr: 19
371
+ },
372
+ {
373
+ pid: 33210,
374
+ name: "bun test --watch",
375
+ cpu: 4.2,
376
+ memp: 1.1,
377
+ mem: "356M",
378
+ status: "Running",
379
+ time: "00:06:38",
380
+ io: "4.6M/s",
381
+ thr: 12
382
+ },
383
+ {
384
+ pid: 1804,
385
+ name: "nginx: worker process",
386
+ cpu: 3.7,
387
+ memp: .2,
388
+ mem: "72M",
389
+ status: "Sleep",
390
+ time: "03:17:09",
391
+ io: "118K/s",
392
+ thr: 5
393
+ },
394
+ {
395
+ pid: 2877,
396
+ name: "Chrome Helper (GPU)",
397
+ cpu: 3.2,
398
+ memp: 2.7,
399
+ mem: "864M",
400
+ status: "Sleep",
401
+ time: "06:29:33",
402
+ io: "2.3M/s",
403
+ thr: 23
404
+ },
405
+ {
406
+ pid: 451,
407
+ name: "kernel_task",
408
+ cpu: 2.8,
409
+ memp: .1,
410
+ mem: "42M",
411
+ status: "Running",
412
+ time: "22:54:48",
413
+ io: "0",
414
+ thr: 179
415
+ },
416
+ {
417
+ pid: 1942,
418
+ name: "syncthing serve --no-browser",
419
+ cpu: 2.1,
420
+ memp: .8,
421
+ mem: "258M",
422
+ status: "Sleep",
423
+ time: "14:05:14",
424
+ io: "884K/s",
425
+ thr: 16
426
+ },
427
+ {
428
+ pid: 7621,
429
+ name: "python scripts/indexer.py --incremental",
430
+ cpu: 1.9,
431
+ memp: 1.9,
432
+ mem: "604M",
433
+ status: "I/O wait",
434
+ time: "00:43:58",
435
+ io: "14M/s",
436
+ thr: 9
437
+ },
438
+ {
439
+ pid: 266,
440
+ name: "systemd-journald",
441
+ cpu: 1.2,
442
+ memp: .1,
443
+ mem: "38M",
444
+ status: "Sleep",
445
+ time: "09:12:44",
446
+ io: "96K/s",
447
+ thr: 3
448
+ },
449
+ {
450
+ pid: 74,
451
+ name: "zsh - bun gen-mockup.ts",
452
+ cpu: .2,
453
+ memp: 0,
454
+ mem: "6M",
455
+ status: "Running",
456
+ time: "00:00:03",
457
+ io: "0",
458
+ thr: 1
459
+ }
460
+ ]
461
+ };
462
+ }
463
+ function tickState(prev) {
464
+ const cores = prev.cores.map((core) => {
465
+ const pct = Math.max(0, Math.min(100, Math.round(jitter(core.pct, 10))));
466
+ return {
467
+ ...core,
468
+ pct
469
+ };
470
+ });
471
+ const totalCpu = Math.round(jitter(prev.totalCpu, 8));
472
+ const cpuHistory = pushHistory(prev.cpuHistory, Math.max(0, Math.min(7, Math.round(totalCpu / 14))), 36);
473
+ const ramPct = Math.round(prev.memory.ramUsed / prev.memory.ramTotal * 100);
474
+ const memHistory = pushHistory(prev.memory.history, Math.max(0, Math.min(7, Math.round(ramPct / 14))), 24);
475
+ const memory = {
476
+ ...prev.memory,
477
+ history: memHistory
478
+ };
479
+ const dlVal = Math.max(0, Math.min(7, Math.round(jitter(5, 4))));
480
+ const ulVal = Math.max(0, Math.min(7, Math.round(jitter(2, 3))));
481
+ const dlHistory = pushHistory(prev.network.dlHistory, dlVal, 24);
482
+ const ulHistory = pushHistory(prev.network.ulHistory, ulVal, 24);
483
+ const network = {
484
+ ...prev.network,
485
+ dlHistory,
486
+ ulHistory
487
+ };
488
+ const processes = prev.processes.map((p) => ({
489
+ ...p,
490
+ cpu: Math.max(0, Number(jitter(p.cpu, 4).toFixed(1)))
491
+ }));
492
+ return {
493
+ ...prev,
494
+ cores,
495
+ totalCpu,
496
+ cpuHistory,
497
+ memory,
498
+ network,
499
+ processes
500
+ };
501
+ }
502
+ function Sep() {
503
+ return /* @__PURE__ */ jsx(Muted, { children: "┄".repeat(50) });
504
+ }
505
+ function LR({ children }) {
506
+ return /* @__PURE__ */ jsx(Box, {
507
+ justifyContent: "space-between",
508
+ wrap: "truncate",
509
+ children
510
+ });
511
+ }
512
+ /** Label-value pair: `Label value` with muted label */
513
+ function LV({ label, value, color }) {
514
+ return /* @__PURE__ */ jsxs(Box, {
515
+ gap: 1,
516
+ children: [/* @__PURE__ */ jsx(Muted, { children: label }), /* @__PURE__ */ jsx(Text, {
517
+ color,
518
+ children: `${value}`
519
+ })]
520
+ });
521
+ }
522
+ function CpuSummary({ state }) {
523
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
524
+ gap: 1,
525
+ wrap: "truncate",
526
+ children: [
527
+ /* @__PURE__ */ jsx(Muted, { children: "Total" }),
528
+ /* @__PURE__ */ jsx(Text, {
529
+ color: severityColor(state.totalCpu),
530
+ children: `${state.totalCpu}%`
531
+ }),
532
+ /* @__PURE__ */ jsx(Text, {
533
+ color: severityColor(state.totalCpu),
534
+ children: miniBar(state.totalCpu, 24)
535
+ })
536
+ ]
537
+ }), /* @__PURE__ */ jsxs(Box, {
538
+ gap: 2,
539
+ wrap: "truncate",
540
+ children: [
541
+ /* @__PURE__ */ jsx(LV, {
542
+ label: "Load",
543
+ value: `${state.load[0].toFixed(2)} ${state.load[1].toFixed(2)} ${state.load[2].toFixed(2)}`
544
+ }),
545
+ /* @__PURE__ */ jsx(LV, {
546
+ label: "Temp",
547
+ value: `${state.avgTemp}\u00B0C`,
548
+ color: heatColor(state.avgTemp)
549
+ }),
550
+ /* @__PURE__ */ jsx(LV, {
551
+ label: "Tasks",
552
+ value: state.tasks
553
+ })
554
+ ]
555
+ })] }), /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
556
+ gap: 2,
557
+ wrap: "truncate",
558
+ children: [
559
+ /* @__PURE__ */ jsx(LV, {
560
+ label: "User",
561
+ value: `${state.userCpu}%`,
562
+ color: severityColor(state.userCpu)
563
+ }),
564
+ /* @__PURE__ */ jsx(LV, {
565
+ label: "Sys",
566
+ value: `${state.sysCpu}%`,
567
+ color: severityColor(state.sysCpu)
568
+ }),
569
+ /* @__PURE__ */ jsx(LV, {
570
+ label: "Wait",
571
+ value: `${state.waitCpu}%`,
572
+ color: severityColor(state.waitCpu)
573
+ })
574
+ ]
575
+ }), /* @__PURE__ */ jsxs(Box, {
576
+ gap: 2,
577
+ wrap: "truncate",
578
+ children: [
579
+ /* @__PURE__ */ jsx(LV, {
580
+ label: "Avg",
581
+ value: `${state.avgFreq}GHz`
582
+ }),
583
+ /* @__PURE__ */ jsx(LV, {
584
+ label: "Ctx/s",
585
+ value: state.ctxPerSec
586
+ }),
587
+ /* @__PURE__ */ jsx(LV, {
588
+ label: "Uptime",
589
+ value: state.uptime
590
+ })
591
+ ]
592
+ })] })] });
593
+ }
594
+ function CpuCore({ core }) {
595
+ return /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
596
+ gap: 1,
597
+ wrap: "truncate",
598
+ children: [
599
+ /* @__PURE__ */ jsx(Muted, { children: core.label }),
600
+ /* @__PURE__ */ jsx(Text, {
601
+ color: severityColor(core.pct),
602
+ children: `${core.pct}%`.padStart(4)
603
+ }),
604
+ /* @__PURE__ */ jsx(Text, {
605
+ color: severityColor(core.pct),
606
+ children: miniBar(core.pct, 24)
607
+ }),
608
+ /* @__PURE__ */ jsx(Muted, { children: `${core.freq}GHz` })
609
+ ]
610
+ }), /* @__PURE__ */ jsxs(Box, {
611
+ gap: 2,
612
+ wrap: "truncate",
613
+ children: [/* @__PURE__ */ jsxs(Box, {
614
+ gap: 1,
615
+ children: [/* @__PURE__ */ jsx(Muted, { children: "temp" }), /* @__PURE__ */ jsx(Text, {
616
+ color: heatColor(core.temp),
617
+ children: `${core.temp}\u00B0C`
618
+ })]
619
+ }), /* @__PURE__ */ jsx(Text, {
620
+ color: severityColor(core.pct),
621
+ children: core.mode
622
+ })]
623
+ })] });
624
+ }
625
+ function CpuFooter({ state }) {
626
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
627
+ gap: 1,
628
+ wrap: "truncate",
629
+ children: [
630
+ /* @__PURE__ */ jsx(Muted, { children: "Pkg" }),
631
+ /* @__PURE__ */ jsx(Text, {
632
+ color: severityColor(state.pkgPct),
633
+ children: `${state.pkgPct}%`
634
+ }),
635
+ /* @__PURE__ */ jsx(Text, {
636
+ color: severityColor(state.pkgPct),
637
+ children: miniBar(state.pkgPct, 24)
638
+ })
639
+ ]
640
+ }), /* @__PURE__ */ jsxs(Box, {
641
+ gap: 2,
642
+ wrap: "truncate",
643
+ children: [
644
+ /* @__PURE__ */ jsx(LV, {
645
+ label: "Power",
646
+ value: `${state.power}W`
647
+ }),
648
+ /* @__PURE__ */ jsx(LV, {
649
+ label: "Fan",
650
+ value: `${state.fan}RPM`
651
+ }),
652
+ /* @__PURE__ */ jsx(LV, {
653
+ label: "Boost",
654
+ value: "on",
655
+ color: "$success"
656
+ })
657
+ ]
658
+ })] }), /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
659
+ gap: 1,
660
+ wrap: "truncate",
661
+ children: [/* @__PURE__ */ jsx(Muted, { children: "History" }), /* @__PURE__ */ jsx(Text, {
662
+ color: "$primary",
663
+ children: sparkline(state.cpuHistory)
664
+ })]
665
+ }), /* @__PURE__ */ jsx(Muted, { children: "60s" })] })] });
666
+ }
667
+ function CpuPanel({ state }) {
668
+ return /* @__PURE__ */ jsxs(Box, {
669
+ flexDirection: "column",
670
+ flexGrow: 1,
671
+ children: [
672
+ /* @__PURE__ */ jsx(CpuSummary, { state }),
673
+ /* @__PURE__ */ jsx(Sep, {}),
674
+ state.cores.map((core) => /* @__PURE__ */ jsx(CpuCore, { core }, core.label)),
675
+ /* @__PURE__ */ jsx(Sep, {}),
676
+ /* @__PURE__ */ jsx(CpuFooter, { state })
677
+ ]
678
+ });
679
+ }
680
+ function MemoryPanel({ memory }) {
681
+ const ramPct = Math.round(memory.ramUsed / memory.ramTotal * 100);
682
+ const swapPct = Math.round(memory.swapUsed / memory.swapTotal * 100);
683
+ const avail = (memory.ramTotal - memory.ramUsed).toFixed(1);
684
+ return /* @__PURE__ */ jsxs(Box, {
685
+ flexDirection: "column",
686
+ flexGrow: 1,
687
+ children: [
688
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
689
+ wrap: "truncate",
690
+ children: [
691
+ /* @__PURE__ */ jsx(Muted, { children: "RAM " }),
692
+ /* @__PURE__ */ jsx(Text, { children: `${memory.ramUsed.toFixed(1)} / ${memory.ramTotal.toFixed(1)} GiB ` }),
693
+ /* @__PURE__ */ jsx(Text, {
694
+ color: severityColor(ramPct),
695
+ children: `${ramPct}% `
696
+ }),
697
+ /* @__PURE__ */ jsx(Text, {
698
+ color: severityColor(ramPct),
699
+ children: miniBar(ramPct, 12)
700
+ })
701
+ ]
702
+ }), /* @__PURE__ */ jsxs(Box, {
703
+ gap: 1,
704
+ wrap: "truncate",
705
+ children: [/* @__PURE__ */ jsx(Muted, { children: "avail" }), /* @__PURE__ */ jsx(Text, { children: `${avail}G` })]
706
+ })] }),
707
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
708
+ gap: 2,
709
+ wrap: "truncate",
710
+ children: [/* @__PURE__ */ jsx(LV, {
711
+ label: "Used",
712
+ value: `${memory.ramUsed.toFixed(1)}G`
713
+ }), /* @__PURE__ */ jsx(LV, {
714
+ label: "Cache",
715
+ value: `${memory.cached.toFixed(1)}G`
716
+ })]
717
+ }), /* @__PURE__ */ jsxs(Box, {
718
+ gap: 2,
719
+ wrap: "truncate",
720
+ children: [/* @__PURE__ */ jsx(LV, {
721
+ label: "Free",
722
+ value: `${memory.free.toFixed(1)}G`
723
+ }), /* @__PURE__ */ jsx(LV, {
724
+ label: "Slab",
725
+ value: `${memory.slab.toFixed(1)}G`
726
+ })]
727
+ })] }),
728
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
729
+ wrap: "truncate",
730
+ children: [
731
+ /* @__PURE__ */ jsx(Muted, { children: "Swap " }),
732
+ /* @__PURE__ */ jsx(Text, { children: `${memory.swapUsed.toFixed(1)} / ${memory.swapTotal.toFixed(1)} GiB ` }),
733
+ /* @__PURE__ */ jsx(Text, {
734
+ color: severityColor(swapPct),
735
+ children: `${swapPct}% `
736
+ }),
737
+ /* @__PURE__ */ jsx(Text, {
738
+ color: severityColor(swapPct),
739
+ children: miniBar(swapPct, 12)
740
+ })
741
+ ]
742
+ }), /* @__PURE__ */ jsxs(Box, {
743
+ gap: 1,
744
+ wrap: "truncate",
745
+ children: [/* @__PURE__ */ jsx(Muted, { children: "zram" }), /* @__PURE__ */ jsx(Text, { children: "off" })]
746
+ })] }),
747
+ /* @__PURE__ */ jsx(Sep, {}),
748
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
749
+ gap: 2,
750
+ wrap: "truncate",
751
+ children: [/* @__PURE__ */ jsx(LV, {
752
+ label: "Apps",
753
+ value: `${memory.apps.toFixed(1)}G`
754
+ }), /* @__PURE__ */ jsx(LV, {
755
+ label: "Wired",
756
+ value: `${memory.wired.toFixed(1)}G`
757
+ })]
758
+ }), /* @__PURE__ */ jsx(LV, {
759
+ label: "Buffers",
760
+ value: "612M"
761
+ })] }),
762
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
763
+ gap: 2,
764
+ wrap: "truncate",
765
+ children: [/* @__PURE__ */ jsx(LV, {
766
+ label: "Dirty",
767
+ value: "212M"
768
+ }), /* @__PURE__ */ jsx(LV, {
769
+ label: "Shared",
770
+ value: `${memory.shared.toFixed(1)}G`
771
+ })]
772
+ }), /* @__PURE__ */ jsx(LV, {
773
+ label: "Reclaim",
774
+ value: `${memory.reclaim.toFixed(1)}G`
775
+ })] }),
776
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
777
+ gap: 1,
778
+ wrap: "truncate",
779
+ children: [/* @__PURE__ */ jsx(Muted, { children: "Trend" }), /* @__PURE__ */ jsx(Text, {
780
+ color: "$primary",
781
+ children: sparkline(memory.history)
782
+ })]
783
+ }), /* @__PURE__ */ jsx(Muted, { children: "30m" })] })
784
+ ]
785
+ });
786
+ }
787
+ function NetworkPanel({ network }) {
788
+ const dlPct = Math.round(network.dlRate / 630 * 100);
789
+ const ulPct = Math.round(network.ulRate / 400 * 100);
790
+ return /* @__PURE__ */ jsxs(Box, {
791
+ flexDirection: "column",
792
+ flexGrow: 1,
793
+ children: [
794
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
795
+ wrap: "truncate",
796
+ children: [
797
+ /* @__PURE__ */ jsx(Muted, { children: "DL " }),
798
+ /* @__PURE__ */ jsx(Text, { children: `${network.dlRate} Mb/s ` }),
799
+ /* @__PURE__ */ jsx(Text, {
800
+ color: severityColor(dlPct),
801
+ children: `${dlPct}% `
802
+ }),
803
+ /* @__PURE__ */ jsx(Text, {
804
+ color: severityColor(dlPct),
805
+ children: miniBar(dlPct, 12)
806
+ })
807
+ ]
808
+ }), /* @__PURE__ */ jsxs(Box, {
809
+ gap: 1,
810
+ wrap: "truncate",
811
+ children: [/* @__PURE__ */ jsx(Muted, { children: "peak" }), /* @__PURE__ */ jsx(Text, { children: `${network.dlPeak}` })]
812
+ })] }),
813
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
814
+ wrap: "truncate",
815
+ children: [
816
+ /* @__PURE__ */ jsx(Muted, { children: "UL " }),
817
+ /* @__PURE__ */ jsx(Text, {
818
+ color: "$info",
819
+ children: `${network.ulRate} Mb/s `
820
+ }),
821
+ /* @__PURE__ */ jsx(Text, {
822
+ color: "$info",
823
+ children: `${ulPct}% `
824
+ }),
825
+ /* @__PURE__ */ jsx(Text, {
826
+ color: "$info",
827
+ children: miniBar(ulPct, 12)
828
+ })
829
+ ]
830
+ }), /* @__PURE__ */ jsxs(Box, {
831
+ gap: 1,
832
+ wrap: "truncate",
833
+ children: [/* @__PURE__ */ jsx(Muted, { children: "peak" }), /* @__PURE__ */ jsx(Text, { children: `${network.ulPeak}` })]
834
+ })] }),
835
+ /* @__PURE__ */ jsx(Sep, {}),
836
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
837
+ gap: 2,
838
+ wrap: "truncate",
839
+ children: [/* @__PURE__ */ jsx(LV, {
840
+ label: "Conn",
841
+ value: `${network.connEst} est`
842
+ }), /* @__PURE__ */ jsx(LV, {
843
+ label: "Listen",
844
+ value: network.listen
845
+ })]
846
+ }), /* @__PURE__ */ jsxs(Box, {
847
+ gap: 2,
848
+ wrap: "truncate",
849
+ children: [/* @__PURE__ */ jsx(LV, {
850
+ label: "SYN",
851
+ value: network.syn
852
+ }), /* @__PURE__ */ jsx(LV, {
853
+ label: "Drops",
854
+ value: network.drops
855
+ })]
856
+ })] }),
857
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
858
+ gap: 2,
859
+ wrap: "truncate",
860
+ children: [/* @__PURE__ */ jsx(LV, {
861
+ label: "Rx",
862
+ value: network.rxPps
863
+ }), /* @__PURE__ */ jsx(LV, {
864
+ label: "Tx",
865
+ value: network.txPps
866
+ })]
867
+ }), /* @__PURE__ */ jsxs(Box, {
868
+ gap: 2,
869
+ wrap: "truncate",
870
+ children: [/* @__PURE__ */ jsx(LV, {
871
+ label: "Retrans",
872
+ value: network.retrans
873
+ }), /* @__PURE__ */ jsx(LV, {
874
+ label: "RTT",
875
+ value: network.rtt
876
+ })]
877
+ })] }),
878
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
879
+ gap: 1,
880
+ wrap: "truncate",
881
+ children: [/* @__PURE__ */ jsx(Muted, { children: "DL" }), /* @__PURE__ */ jsx(Text, {
882
+ color: "$primary",
883
+ children: sparkline(network.dlHistory)
884
+ })]
885
+ }), /* @__PURE__ */ jsx(Muted, { children: "60s" })] }),
886
+ /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
887
+ gap: 1,
888
+ wrap: "truncate",
889
+ children: [/* @__PURE__ */ jsx(Muted, { children: "UL" }), /* @__PURE__ */ jsx(Text, {
890
+ color: "$info",
891
+ children: sparkline(network.ulHistory)
892
+ })]
893
+ }), /* @__PURE__ */ jsx(Muted, { children: "60s" })] })
894
+ ]
895
+ });
896
+ }
897
+ const COL = {
898
+ pid: 6,
899
+ name: 62,
900
+ cpu: 6,
901
+ memp: 6,
902
+ mem: 9,
903
+ status: 10,
904
+ time: 10,
905
+ io: 11,
906
+ thr: 5
907
+ };
908
+ function statusColor(status) {
909
+ switch (status) {
910
+ case "Running": return "$success";
911
+ case "I/O wait": return "$warning";
912
+ default: return "$muted";
913
+ }
914
+ }
915
+ function ProcessHeader() {
916
+ return /* @__PURE__ */ jsxs(Box, {
917
+ wrap: "clip",
918
+ children: [
919
+ /* @__PURE__ */ jsx(Muted, { children: `${"PID".padStart(COL.pid)} ` }),
920
+ /* @__PURE__ */ jsx(Muted, { children: `${"NAME".padEnd(COL.name)} ` }),
921
+ /* @__PURE__ */ jsx(Text, {
922
+ bold: true,
923
+ color: "$primary",
924
+ children: `${"CPU%↓".padStart(COL.cpu)} `
925
+ }),
926
+ /* @__PURE__ */ jsx(Muted, { children: `${"MEM%".padStart(COL.memp)} ` }),
927
+ /* @__PURE__ */ jsx(Muted, { children: `${"MEM".padStart(COL.mem)} ` }),
928
+ /* @__PURE__ */ jsx(Muted, { children: `${"STATUS".padEnd(COL.status)} ` }),
929
+ /* @__PURE__ */ jsx(Muted, { children: `${"TIME".padStart(COL.time)} ` }),
930
+ /* @__PURE__ */ jsx(Muted, { children: `${"IO".padStart(COL.io)} ` }),
931
+ /* @__PURE__ */ jsx(Muted, { children: `${"THR".padStart(COL.thr)}` })
932
+ ]
933
+ });
934
+ }
935
+ function ProcessRow({ proc, isTop }) {
936
+ const cpuColor = severityColor(proc.cpu);
937
+ const ioColor = proc.io === "0" ? "$muted" : "$primary";
938
+ return /* @__PURE__ */ jsxs(Box, {
939
+ wrap: "clip",
940
+ children: [
941
+ /* @__PURE__ */ jsx(Text, { children: `${String(proc.pid).padStart(COL.pid)} ` }),
942
+ /* @__PURE__ */ jsx(Text, {
943
+ bold: isTop,
944
+ children: `${proc.name.padEnd(COL.name).slice(0, COL.name)} `
945
+ }),
946
+ /* @__PURE__ */ jsx(Text, {
947
+ bold: isTop,
948
+ color: cpuColor,
949
+ children: `${proc.cpu.toFixed(1).padStart(5)}% `
950
+ }),
951
+ /* @__PURE__ */ jsx(Text, {
952
+ color: severityColor(proc.memp * 10),
953
+ children: `${proc.memp.toFixed(1).padStart(5)}% `
954
+ }),
955
+ /* @__PURE__ */ jsx(Text, { children: `${proc.mem.padStart(COL.mem)} ` }),
956
+ /* @__PURE__ */ jsx(Text, {
957
+ color: statusColor(proc.status),
958
+ children: `${proc.status.padEnd(COL.status)} `
959
+ }),
960
+ /* @__PURE__ */ jsx(Text, { children: `${proc.time.padStart(COL.time)} ` }),
961
+ /* @__PURE__ */ jsx(Text, {
962
+ color: ioColor,
963
+ children: `${proc.io.padStart(COL.io)} `
964
+ }),
965
+ /* @__PURE__ */ jsx(Text, { children: `${String(proc.thr).padStart(COL.thr)}` })
966
+ ]
967
+ });
968
+ }
969
+ function ProcessFooter({ processes, state }) {
970
+ const running = processes.filter((p) => p.status === "Running").length;
971
+ const iowait = processes.filter((p) => p.status === "I/O wait").length;
972
+ const sleeping = 184 - running - iowait;
973
+ const ramPct = Math.round(state.memory.ramUsed / state.memory.ramTotal * 100);
974
+ return /* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsxs(Box, {
975
+ gap: 2,
976
+ wrap: "truncate",
977
+ children: [
978
+ /* @__PURE__ */ jsx(Muted, { children: "184 processes" }),
979
+ /* @__PURE__ */ jsx(Text, {
980
+ color: "$success",
981
+ children: `${running} running`
982
+ }),
983
+ /* @__PURE__ */ jsx(Muted, { children: `${sleeping} sleeping` }),
984
+ /* @__PURE__ */ jsx(Text, {
985
+ color: "$warning",
986
+ children: `${iowait} iowait`
987
+ })
988
+ ]
989
+ }), /* @__PURE__ */ jsxs(Box, {
990
+ gap: 2,
991
+ wrap: "truncate",
992
+ children: [
993
+ /* @__PURE__ */ jsx(LV, {
994
+ label: "Threads",
995
+ value: "1,942"
996
+ }),
997
+ /* @__PURE__ */ jsx(LV, {
998
+ label: "CPU",
999
+ value: `${state.totalCpu}%`,
1000
+ color: severityColor(state.totalCpu)
1001
+ }),
1002
+ /* @__PURE__ */ jsx(LV, {
1003
+ label: "MEM",
1004
+ value: `${ramPct}%`,
1005
+ color: severityColor(ramPct)
1006
+ }),
1007
+ /* @__PURE__ */ jsx(Text, {
1008
+ color: "$primary",
1009
+ children: `428\u2193`
1010
+ }),
1011
+ /* @__PURE__ */ jsx(Text, {
1012
+ color: "$info",
1013
+ children: `86\u2191`
1014
+ })
1015
+ ]
1016
+ })] });
1017
+ }
1018
+ function ProcessPanel({ state }) {
1019
+ const sorted = [...state.processes].sort((a, b) => b.cpu - a.cpu);
1020
+ return /* @__PURE__ */ jsxs(Box, {
1021
+ flexDirection: "column",
1022
+ flexGrow: 1,
1023
+ children: [
1024
+ /* @__PURE__ */ jsx(ProcessHeader, {}),
1025
+ /* @__PURE__ */ jsx(Sep, {}),
1026
+ sorted.map((proc, i) => /* @__PURE__ */ jsx(ProcessRow, {
1027
+ proc,
1028
+ isTop: i === 0
1029
+ }, proc.pid)),
1030
+ /* @__PURE__ */ jsx(Sep, {}),
1031
+ /* @__PURE__ */ jsx(ProcessFooter, {
1032
+ processes: state.processes,
1033
+ state
1034
+ })
1035
+ ]
1036
+ });
1037
+ }
1038
+ /** Panel with titled first row inside standard border */
1039
+ function Panel({ title, subtitle, children, flexGrow, flexBasis }) {
1040
+ return /* @__PURE__ */ jsxs(Box, {
1041
+ borderStyle: "round",
1042
+ borderColor: "$primary",
1043
+ paddingX: 1,
1044
+ flexDirection: "column",
1045
+ flexGrow,
1046
+ flexBasis,
1047
+ children: [/* @__PURE__ */ jsxs(LR, { children: [/* @__PURE__ */ jsx(Text, {
1048
+ bold: true,
1049
+ color: "$primary",
1050
+ children: ` ${title} `
1051
+ }), subtitle && /* @__PURE__ */ jsx(Muted, { children: ` ${subtitle} ` })] }), children]
1052
+ });
1053
+ }
1054
+ function WideLayout({ state }) {
1055
+ return /* @__PURE__ */ jsxs(Box, {
1056
+ flexDirection: "column",
1057
+ flexGrow: 1,
1058
+ children: [/* @__PURE__ */ jsxs(Box, {
1059
+ flexDirection: "row",
1060
+ gap: 1,
1061
+ children: [/* @__PURE__ */ jsx(Panel, {
1062
+ title: "CPU / Compute",
1063
+ subtitle: "10 logical",
1064
+ flexGrow: 3,
1065
+ flexBasis: 0,
1066
+ children: /* @__PURE__ */ jsx(CpuPanel, { state })
1067
+ }), /* @__PURE__ */ jsxs(Box, {
1068
+ flexDirection: "column",
1069
+ flexGrow: 2,
1070
+ flexBasis: 0,
1071
+ children: [/* @__PURE__ */ jsx(Panel, {
1072
+ title: "Memory",
1073
+ subtitle: `${state.memory.ramTotal.toFixed(0)} GiB`,
1074
+ children: /* @__PURE__ */ jsx(MemoryPanel, { memory: state.memory })
1075
+ }), /* @__PURE__ */ jsx(Panel, {
1076
+ title: "Network",
1077
+ subtitle: "en0 • wifi6",
1078
+ children: /* @__PURE__ */ jsx(NetworkPanel, { network: state.network })
1079
+ })]
1080
+ })]
1081
+ }), /* @__PURE__ */ jsx(Panel, {
1082
+ title: "Processes",
1083
+ subtitle: "sorted by CPU%",
1084
+ children: /* @__PURE__ */ jsx(ProcessPanel, { state })
1085
+ })]
1086
+ });
1087
+ }
1088
+ function NarrowLayout({ state }) {
1089
+ return /* @__PURE__ */ jsx(Box, {
1090
+ flexDirection: "column",
1091
+ flexGrow: 1,
1092
+ children: /* @__PURE__ */ jsxs(Tabs, {
1093
+ defaultValue: "cpu",
1094
+ children: [
1095
+ /* @__PURE__ */ jsx(Box, {
1096
+ justifyContent: "space-between",
1097
+ paddingX: 1,
1098
+ children: /* @__PURE__ */ jsxs(TabList, { children: [
1099
+ /* @__PURE__ */ jsx(Tab, {
1100
+ value: "cpu",
1101
+ children: "CPU"
1102
+ }),
1103
+ /* @__PURE__ */ jsx(Tab, {
1104
+ value: "memory",
1105
+ children: "Memory"
1106
+ }),
1107
+ /* @__PURE__ */ jsx(Tab, {
1108
+ value: "network",
1109
+ children: "Network"
1110
+ }),
1111
+ /* @__PURE__ */ jsx(Tab, {
1112
+ value: "processes",
1113
+ children: "Processes"
1114
+ })
1115
+ ] })
1116
+ }),
1117
+ /* @__PURE__ */ jsx(TabPanel, {
1118
+ value: "cpu",
1119
+ children: /* @__PURE__ */ jsx(Panel, {
1120
+ title: "CPU / Compute",
1121
+ subtitle: "10 logical",
1122
+ children: /* @__PURE__ */ jsx(CpuPanel, { state })
1123
+ })
1124
+ }),
1125
+ /* @__PURE__ */ jsx(TabPanel, {
1126
+ value: "memory",
1127
+ children: /* @__PURE__ */ jsx(Panel, {
1128
+ title: "Memory",
1129
+ subtitle: `${state.memory.ramTotal.toFixed(0)} GiB`,
1130
+ children: /* @__PURE__ */ jsx(MemoryPanel, { memory: state.memory })
1131
+ })
1132
+ }),
1133
+ /* @__PURE__ */ jsx(TabPanel, {
1134
+ value: "network",
1135
+ children: /* @__PURE__ */ jsx(Panel, {
1136
+ title: "Network",
1137
+ subtitle: "en0 • wifi6",
1138
+ children: /* @__PURE__ */ jsx(NetworkPanel, { network: state.network })
1139
+ })
1140
+ }),
1141
+ /* @__PURE__ */ jsx(TabPanel, {
1142
+ value: "processes",
1143
+ children: /* @__PURE__ */ jsx(Panel, {
1144
+ title: "Processes",
1145
+ subtitle: "sorted by CPU%",
1146
+ children: /* @__PURE__ */ jsx(ProcessPanel, { state })
1147
+ })
1148
+ })
1149
+ ]
1150
+ })
1151
+ });
1152
+ }
1153
+ function Dashboard({ static: isStatic } = {}) {
1154
+ const { exit } = useApp();
1155
+ const { width } = useBoxRect();
1156
+ const [state, setState] = useState(createInitialState);
1157
+ const isNarrow = width > 0 && width < 130;
1158
+ useInterval(() => setState((prev) => tickState(prev)), 500, !isStatic);
1159
+ useInput((input, key) => {
1160
+ if (input === "q" || key.escape) exit();
1161
+ });
1162
+ if (isNarrow) return /* @__PURE__ */ jsx(NarrowLayout, { state });
1163
+ return /* @__PURE__ */ jsxs(Box, {
1164
+ flexDirection: "column",
1165
+ flexGrow: 1,
1166
+ children: [/* @__PURE__ */ jsxs(Box, {
1167
+ wrap: "truncate",
1168
+ children: [
1169
+ /* @__PURE__ */ jsx(Text, {
1170
+ bold: true,
1171
+ color: "$primary",
1172
+ children: "Silvery TUI"
1173
+ }),
1174
+ /* @__PURE__ */ jsx(Muted, { children: " system monitor showcase " }),
1175
+ /* @__PURE__ */ jsx(Text, {
1176
+ color: "$primary",
1177
+ children: "devbox-01"
1178
+ }),
1179
+ /* @__PURE__ */ jsx(Muted, { children: "┄".repeat(19) }),
1180
+ /* @__PURE__ */ jsx(Muted, { children: "14:27 UTC [h]help [1]cpu [2]mem [3]net [p]proc [/]filter [q]quit" })
1181
+ ]
1182
+ }), /* @__PURE__ */ jsx(WideLayout, { state })]
1183
+ });
1184
+ }
1185
+ async function main() {
1186
+ try {
1187
+ var _usingCtx$1 = _usingCtx();
1188
+ const term = _usingCtx$1.u(createTerm());
1189
+ const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
1190
+ meta,
1191
+ controls: "h/l tabs Esc/q quit",
1192
+ children: /* @__PURE__ */ jsx(Dashboard, {})
1193
+ }), term);
1194
+ await waitUntilExit();
1195
+ } catch (_) {
1196
+ _usingCtx$1.e = _;
1197
+ } finally {
1198
+ _usingCtx$1.d();
1199
+ }
1200
+ }
1201
+ if (import.meta.main) await main();
1202
+ //#endregion
1203
+ export { Dashboard, main, meta };