tmux-weblink 1.2.0 → 1.2.1
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/lib/pages/shell.js +26 -53
- package/package.json +1 -1
package/dist/lib/pages/shell.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cssVarsStyle as
|
|
1
|
+
import{cssVarsStyle as g}from"../theme.js";import{commandbarCSS as f,commandbarHTML as u,commandbarScript as v}from"../commandbar.js";import{newSessionModalCSS as h,newSessionModalHTML as y,newSessionModalScript as k,reducedMotion as w}from"../shared-layout.js";import{icon as n}from"../icons.js";import{getSystemStatus as S}from"../system-monitor.js";function E(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function a(o="var(--panel-accent)"){return`box-shadow: 0 0 0 2px ${o}; outline: none;`}function j(o){const{theme:e,commandbarEnabled:t,commandbarSessions:l,fsRoots:d,terminalCfg:p,renderer:i,scrollback:c}=o,s=S(),b=s.memory.percent,r=s.cpu.loadAvg[0],x=`
|
|
2
2
|
*, *::before, *::after { box-sizing: border-box; }
|
|
3
3
|
html, body {
|
|
4
4
|
background: var(--page-bg); color: var(--page-fg);
|
|
@@ -25,30 +25,12 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
25
25
|
|
|
26
26
|
/* \u2500\u2500 System status in header \u2500\u2500 */
|
|
27
27
|
.sys-status {
|
|
28
|
-
display: flex; align-items: center;
|
|
28
|
+
display: flex; align-items: center;
|
|
29
29
|
font-size: 11px; font-family: var(--font-mono);
|
|
30
|
-
color: var(--
|
|
30
|
+
color: color-mix(in srgb, var(--page-fg) 55%, transparent);
|
|
31
|
+
cursor: default;
|
|
31
32
|
margin: 0 12px;
|
|
32
|
-
|
|
33
|
-
.sys-status .mem-bar {
|
|
34
|
-
width: 40px; height: 6px;
|
|
35
|
-
background: color-mix(in srgb, var(--panel-muted) 20%, transparent);
|
|
36
|
-
border-radius: 3px; overflow: hidden;
|
|
37
|
-
}
|
|
38
|
-
.sys-status .mem-bar-fill {
|
|
39
|
-
height: 100%; border-radius: 3px;
|
|
40
|
-
transition: width 0.5s ease;
|
|
41
|
-
}
|
|
42
|
-
.sys-status .mem-bar-fill.low { background: var(--panel-success, #16a34a); }
|
|
43
|
-
.sys-status .mem-bar-fill.mid { background: #eab308; }
|
|
44
|
-
.sys-status .mem-bar-fill.high { background: #ef4444; }
|
|
45
|
-
.sys-status .mem-text { min-width: 3ch; text-align: right; }
|
|
46
|
-
.sys-status .cpu-text { color: color-mix(in srgb, var(--panel-muted) 70%, transparent); }
|
|
47
|
-
@media (max-width: 720px) {
|
|
48
|
-
.sys-status .cpu-text { display: none; }
|
|
49
|
-
}
|
|
50
|
-
@media (max-width: 540px) {
|
|
51
|
-
.sys-status { display: none; }
|
|
33
|
+
white-space: nowrap;
|
|
52
34
|
}
|
|
53
35
|
|
|
54
36
|
/* \u2500\u2500 App layout \u2500\u2500 */
|
|
@@ -91,7 +73,7 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
91
73
|
}
|
|
92
74
|
.sidebar-footer .mode-btn:hover { color: var(--panel-accent); background: color-mix(in srgb, var(--panel-accent) 8%, transparent); }
|
|
93
75
|
.sidebar-footer .mode-btn.active { color: var(--panel-accent); background: color-mix(in srgb, var(--panel-accent) 10%, transparent); }
|
|
94
|
-
.sidebar-footer .mode-btn:focus-visible { ${
|
|
76
|
+
.sidebar-footer .mode-btn:focus-visible { ${a()} }
|
|
95
77
|
|
|
96
78
|
/* \u2500\u2500 Sidebar session mode \u2500\u2500 */
|
|
97
79
|
.session-item {
|
|
@@ -113,7 +95,7 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
113
95
|
}
|
|
114
96
|
.session-item:hover .session-edit-btn { display: flex; align-items: center; }
|
|
115
97
|
.session-edit-btn:hover { color: var(--panel-accent); background: color-mix(in srgb, var(--panel-accent) 8%, transparent); }
|
|
116
|
-
.session-edit-btn:focus-visible { ${
|
|
98
|
+
.session-edit-btn:focus-visible { ${a()} }
|
|
117
99
|
|
|
118
100
|
.sidebar-section-label {
|
|
119
101
|
font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em;
|
|
@@ -130,7 +112,7 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
130
112
|
color: var(--panel-accent); border-color: var(--panel-accent);
|
|
131
113
|
background: color-mix(in srgb, var(--panel-accent) 6%, transparent);
|
|
132
114
|
}
|
|
133
|
-
.new-session-sidebar-btn:focus-visible { ${
|
|
115
|
+
.new-session-sidebar-btn:focus-visible { ${a()} }
|
|
134
116
|
.new-session-sidebar-btn svg { width: 16px; height: 16px; fill: currentColor; }
|
|
135
117
|
|
|
136
118
|
/* \u2500\u2500 Sidebar files mode \u2500\u2500 */
|
|
@@ -204,7 +186,7 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
204
186
|
color: var(--page-fg); transition: opacity 0.15s; text-decoration: none;
|
|
205
187
|
}
|
|
206
188
|
.btn:hover { opacity: 0.85; }
|
|
207
|
-
.btn:focus-visible { ${
|
|
189
|
+
.btn:focus-visible { ${a()} }
|
|
208
190
|
.btn.primary { background: var(--panel-accent); border-color: var(--panel-accent); color: var(--panel-accent-on); font-weight: 500; }
|
|
209
191
|
.btn.primary:hover { opacity: 0.9; }
|
|
210
192
|
.btn.danger { color: #b91c1c; border-color: color-mix(in srgb, #b91c1c 30%, transparent); }
|
|
@@ -356,16 +338,16 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
356
338
|
.file-roots-list li svg { width: 20px; height: 20px; flex-shrink: 0; fill: var(--panel-accent); }
|
|
357
339
|
|
|
358
340
|
/* \u2500\u2500 Commandbar \u2500\u2500 */
|
|
359
|
-
${t?
|
|
360
|
-
${
|
|
361
|
-
${
|
|
341
|
+
${t?f():""}
|
|
342
|
+
${w()}
|
|
343
|
+
${h()}
|
|
362
344
|
@media (max-width: 640px) {
|
|
363
345
|
.app-layout { flex-direction: column; }
|
|
364
346
|
.sidebar { flex: 0 0 auto; border-right: none; border-bottom: 1px solid var(--panel-border); transition: max-height 0.2s; }
|
|
365
347
|
.sidebar.collapsed .sidebar-content { display: none; }
|
|
366
348
|
.sidebar.collapsed { max-height: 48px; overflow: hidden; }
|
|
367
349
|
}
|
|
368
|
-
`,
|
|
350
|
+
`,z=JSON.stringify(e.terminal).replace(/</g,"\\u003c"),m=JSON.stringify({terminal:p,scrollback:c,theme:e.terminal,renderer:i,fsRoots:d,commandbarEnabled:t}).replace(/</g,"\\u003c");return`<!DOCTYPE html>
|
|
369
351
|
<html lang="en">
|
|
370
352
|
<head>
|
|
371
353
|
<meta charset="UTF-8" />
|
|
@@ -373,8 +355,8 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
373
355
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
374
356
|
<title>tmux-weblink</title>
|
|
375
357
|
<style>
|
|
376
|
-
${
|
|
377
|
-
${
|
|
358
|
+
${g(e.shell)}
|
|
359
|
+
${x}
|
|
378
360
|
</style>
|
|
379
361
|
</head>
|
|
380
362
|
<body>
|
|
@@ -398,14 +380,10 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
398
380
|
|
|
399
381
|
<header class="fixed-header">
|
|
400
382
|
<div class="brand"><a href="/">tmux<span>-weblink</span></a></div>
|
|
401
|
-
<div class="sys-status" id="sys-status">
|
|
402
|
-
<span class="mem-text" id="sys-mem-text">--</span>
|
|
403
|
-
<span class="mem-bar"><span class="mem-bar-fill" id="sys-mem-bar" style="width:0%"></span></span>
|
|
404
|
-
<span class="cpu-text" id="sys-cpu-text">--</span>
|
|
405
|
-
</div>
|
|
406
383
|
<div class="header-actions">
|
|
407
384
|
${t?`<button class="header-btn" id="cmdbar-btn" title="Search" aria-label="Search">${n("search")}</button>`:""}
|
|
408
385
|
</div>
|
|
386
|
+
<div class="sys-status" id="sys-status">RAM ${b}% / CPU ${r<10?r.toFixed(1):Math.round(r)}</div>
|
|
409
387
|
</header>
|
|
410
388
|
|
|
411
389
|
<div class="app-layout">
|
|
@@ -471,7 +449,7 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
471
449
|
<hr class="settings-divider" />
|
|
472
450
|
<div class="settings-item">
|
|
473
451
|
<span>Terminal renderer</span>
|
|
474
|
-
<span style="font-size:var(--text-xs);color:var(--panel-muted)">${
|
|
452
|
+
<span style="font-size:var(--text-xs);color:var(--panel-muted)">${i==="ghostty"?"Ghostty":"xterm.js"}</span>
|
|
475
453
|
</div>
|
|
476
454
|
<hr class="settings-divider" />
|
|
477
455
|
<div style="padding:4px 0">
|
|
@@ -505,21 +483,21 @@ import{cssVarsStyle as b}from"../theme.js";import{commandbarCSS as m,commandbarH
|
|
|
505
483
|
})();
|
|
506
484
|
</script>
|
|
507
485
|
|
|
508
|
-
${
|
|
509
|
-
${t?
|
|
486
|
+
${y()}
|
|
487
|
+
${t?u():""}
|
|
510
488
|
|
|
511
489
|
<script>
|
|
512
|
-
window.__TMUX_WEB_SHELL__ = ${
|
|
490
|
+
window.__TMUX_WEB_SHELL__ = ${m};
|
|
513
491
|
</script>
|
|
514
492
|
<script type="module">
|
|
515
493
|
await import('/assets/shell-client.js');
|
|
516
|
-
${t?
|
|
494
|
+
${t?v(l,[]):""}
|
|
517
495
|
// Wrapper: refresh sidebar list, then open session
|
|
518
496
|
window.__onSessionCreated = async function(name) {
|
|
519
497
|
await window.__refreshSidebar();
|
|
520
498
|
window.__openSession(name);
|
|
521
499
|
};
|
|
522
|
-
${
|
|
500
|
+
${k("__onSessionCreated")}
|
|
523
501
|
</script>
|
|
524
502
|
<script>
|
|
525
503
|
// Sync app-layout height to visual viewport so mobile keyboard doesn't overlap
|
|
@@ -534,18 +512,13 @@ ${h("__onSessionCreated")}
|
|
|
534
512
|
</script>
|
|
535
513
|
<script>
|
|
536
514
|
(function(){
|
|
537
|
-
var
|
|
538
|
-
|
|
539
|
-
var cpuText = document.getElementById('sys-cpu-text');
|
|
540
|
-
if (!memText) return;
|
|
515
|
+
var el = document.getElementById('sys-status');
|
|
516
|
+
if (!el) return;
|
|
541
517
|
function poll(){
|
|
542
518
|
fetch('/api/system/status').then(function(r){ return r.json(); }).then(function(s){
|
|
543
519
|
var p = s.memory.percent;
|
|
544
|
-
memText.textContent = p + '%';
|
|
545
|
-
memBar.style.width = p + '%';
|
|
546
|
-
memBar.className = 'mem-bar-fill ' + (p >= 85 ? 'high' : p >= 70 ? 'mid' : 'low');
|
|
547
520
|
var load = s.cpu.loadAvg[0];
|
|
548
|
-
|
|
521
|
+
el.textContent = 'RAM ' + p + '% / CPU ' + (load < 10 ? load.toFixed(1) : Math.round(load));
|
|
549
522
|
}).catch(function(){});
|
|
550
523
|
}
|
|
551
524
|
poll();
|
|
@@ -553,4 +526,4 @@ ${h("__onSessionCreated")}
|
|
|
553
526
|
})();
|
|
554
527
|
</script>
|
|
555
528
|
</body>
|
|
556
|
-
</html>`}export{
|
|
529
|
+
</html>`}export{j as renderShell};
|