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