From b7d7f61a2769ead741bf1e7e74c068c72757eb52 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 20 May 2026 23:23:39 +0800 Subject: [PATCH 01/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=EF=BC=9A?= =?UTF-8?q?=E8=B4=A8=E6=84=9F=E7=BB=86=E8=8A=82=E4=B8=8E=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 引入设计 token:space-1..8 / radius-sm..xl / text-xs..2xl - header:替换品牌图标为 SVG(耳机+音符)+ 顶部 hairline;title 用 tabular 字体可读性更好 - 按钮 primary/danger 加 inner highlight + 渐变深浅 + 三态质感(idle/hover/active) - 侧边导航 tabBtn:active 改为左侧 2px 垂直指示条带 scaleY 动画 - 表单:select 加自绘下拉箭头;focus 双层 ring(border + 半透明) - check 项勾选后亮 primary-soft 背景 - 状态卡 overviewCard:左侧 2px accent 条 + tabular-nums 数字 + 标签 uppercase - statusRunning 状态点改为外扩光环动画(更内敛) - 图表:barFill 加细微渐变;hover 行高亮其他行半透明;tabular-nums - 全局滚动条:10px 细圆角,仅 thumb 显示 - preview 占位:斜纹背景 + 单方向扫描线动画 - cache-bust v3 → v4 --- webui/index.html | 14 +- webui/styles.css | 402 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 331 insertions(+), 85 deletions(-) diff --git a/webui/index.html b/webui/index.html index aa48d6a..8b05938 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,16 +15,22 @@ } catch (e) {} })(); - +
- +
抖音挂机控制台
-
设备调度、运行控制与实时观察
+
设备调度 · 运行控制 · 实时观察
@@ -1216,6 +1222,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index d02eba5..aa62c9d 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -54,6 +54,33 @@ --status-muted-ring: 0 0 0 3px rgba(163, 163, 163, 0.16); --status-success-ring: 0 0 0 3px rgba(22, 163, 74, 0.18); --status-danger-ring: 0 0 0 3px rgba(220, 38, 38, 0.18); + + /* Design tokens — spacing / radius / typography scale */ + --space-1: 4px; + --space-2: 8px; + --space-3: 12px; + --space-4: 16px; + --space-5: 20px; + --space-6: 24px; + --space-8: 32px; + --radius-sm: 4px; + --radius-md: 6px; + --radius-lg: 10px; + --radius-xl: 14px; + --text-xs: 11px; + --text-sm: 12px; + --text-base: 13px; + --text-md: 14px; + --text-lg: 16px; + --text-xl: 20px; + --text-2xl: 26px; + --leading-tight: 1.2; + --leading-snug: 1.35; + --leading-normal: 1.5; + --tracking-tight: -0.01em; + --tracking-normal: 0; + --tracking-wide: 0.06em; + --radius: 6px; --radius-lg: 8px; --control-height: 34px; @@ -212,16 +239,27 @@ svg { display: flex; align-items: center; justify-content: space-between; - gap: 16px; - padding: 12px 14px; + gap: var(--space-4); + padding: 12px 16px; border: 1px solid var(--border); background: var(--header-bg); - border-radius: var(--radius); - box-shadow: var(--shadow-soft); - backdrop-filter: blur(12px) saturate(1.1); + border-radius: var(--radius-lg); + box-shadow: var(--shadow); + backdrop-filter: blur(14px) saturate(1.1); animation: surfaceIn var(--motion-slow) both; } +.header::before { + position: absolute; + inset: 0 0 auto; + height: 1px; + content: ""; + pointer-events: none; + border-radius: var(--radius-lg) var(--radius-lg) 0 0; + background: linear-gradient(90deg, transparent, var(--border-strong), transparent); + opacity: 0.6; +} + .brandBlock { display: flex; align-items: center; @@ -234,29 +272,33 @@ svg { overflow: hidden; display: grid; place-items: center; - flex: 0 0 36px; - width: 36px; - height: 36px; + flex: 0 0 38px; + width: 38px; + height: 38px; color: var(--on-primary); - background: var(--primary); - border-radius: var(--radius); - font-size: 15px; - font-weight: 700; + background: linear-gradient(135deg, var(--primary), color-mix(in oklab, var(--primary) 70%, #000 30%)); + border-radius: var(--radius-md); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(94, 106, 210, 0.3); +} + +.brandMark svg { + width: 18px; + height: 18px; } .title { color: var(--text-strong); - font-size: 16px; + font-size: var(--text-lg); font-weight: 600; - line-height: 1.25; - letter-spacing: -0.01em; + line-height: var(--leading-tight); + letter-spacing: var(--tracking-tight); } .subtitle { - margin-top: 4px; + margin-top: 3px; color: var(--muted); - font-size: 12px; - line-height: 1.35; + font-size: var(--text-sm); + line-height: var(--leading-snug); } .header-actions { @@ -337,13 +379,20 @@ svg { .btnPrimary { color: var(--on-primary); border-color: var(--primary); - background: var(--primary); + background: linear-gradient(180deg, color-mix(in oklab, var(--primary) 88%, #fff 12%), var(--primary)); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 1px 2px rgba(94, 106, 210, 0.25); } .btnPrimary:hover { color: var(--on-primary); border-color: var(--primary-hover); background: var(--primary-hover); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 2px 6px rgba(94, 106, 210, 0.32); +} + +.btnPrimary:active { + background: color-mix(in oklab, var(--primary-hover) 90%, #000 10%); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) inset; } .btnSoft { @@ -373,13 +422,20 @@ svg { .btnDanger { color: var(--on-primary); border-color: var(--danger); - background: var(--danger); + background: linear-gradient(180deg, color-mix(in oklab, var(--danger) 88%, #fff 12%), var(--danger)); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 1px 2px rgba(220, 38, 38, 0.22); } .btnDanger:hover { color: var(--on-primary); border-color: var(--danger-hover); background: var(--danger-hover); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 2px 6px rgba(220, 38, 38, 0.3); +} + +.btnDanger:active { + background: color-mix(in oklab, var(--danger-hover) 90%, #000 10%); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) inset; } .btnDangerSoft { @@ -430,29 +486,35 @@ svg { position: relative; overflow: hidden; min-width: 0; - padding: 14px; + padding: 14px 16px; border: 1px solid var(--border); - border-radius: var(--radius); + border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-soft); animation: surfaceIn var(--motion-slow) both; - transition: border-color var(--motion); + transition: border-color var(--motion), box-shadow var(--motion-fast); } -.overviewCard:nth-child(2) { - animation-delay: 30ms; -} - -.overviewCard:nth-child(3) { - animation-delay: 60ms; -} - -.overviewCard:nth-child(4) { - animation-delay: 90ms; +.overviewCard::before { + position: absolute; + left: 0; + top: 14px; + bottom: 14px; + width: 2px; + content: ""; + border-radius: 0 2px 2px 0; + background: var(--border-strong); + opacity: 0.5; + transition: background var(--motion-fast), opacity var(--motion-fast); } .overviewCard:hover { border-color: var(--hover-border); + box-shadow: var(--shadow); +} + +.overviewCard:hover::before { + opacity: 1; } .overviewPrimary { @@ -460,11 +522,18 @@ svg { background: var(--overview-primary-bg); } +.overviewPrimary::before { + background: var(--primary); + opacity: 1; +} + .overviewLabel { color: var(--muted); - font-size: 12px; - font-weight: 500; + font-size: var(--text-xs); + font-weight: 600; line-height: 1.3; + letter-spacing: var(--tracking-wide); + text-transform: uppercase; } .overviewValue { @@ -472,27 +541,30 @@ svg { align-items: center; gap: 8px; min-width: 0; - margin-top: 7px; + margin-top: 8px; color: var(--text-strong); - font-size: 20px; + font-size: var(--text-xl); font-weight: 600; - line-height: 1.2; + line-height: var(--leading-tight); + letter-spacing: var(--tracking-tight); + font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } .overviewMeta { min-height: 18px; - margin-top: 7px; + margin-top: 6px; color: var(--muted); - font-size: 12px; - line-height: 1.35; + font-size: var(--text-sm); + line-height: var(--leading-snug); overflow-wrap: anywhere; } .statusDot { - flex: 0 0 9px; - width: 9px; - height: 9px; + position: relative; + flex: 0 0 8px; + width: 8px; + height: 8px; border-radius: 50%; background: var(--muted-soft); box-shadow: var(--status-muted-ring); @@ -506,7 +578,27 @@ svg { .statusRunning { background: var(--success); box-shadow: var(--status-success-ring); - animation: statusPulse 2s ease-in-out infinite; +} + +.statusRunning::after { + position: absolute; + inset: -4px; + content: ""; + border-radius: 50%; + border: 1px solid var(--success); + opacity: 0.5; + animation: statusRing 1.8s ease-out infinite; +} + +@keyframes statusRing { + 0% { + transform: scale(0.8); + opacity: 0.7; + } + 100% { + transform: scale(1.6); + opacity: 0; + } } .statusIdle { @@ -708,20 +800,35 @@ svg { display: flex; align-items: center; justify-content: flex-start; - gap: 8px; + gap: 9px; width: 100%; min-width: 0; - min-height: 38px; - padding: 0 10px; + min-height: 36px; + padding: 0 10px 0 12px; border: 1px solid transparent; - border-radius: var(--radius); + border-radius: var(--radius-md); color: var(--muted); background: transparent; - font-size: 13px; + font-size: var(--text-base); font-weight: 500; text-align: left; white-space: nowrap; - transition: color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast), border-color var(--motion-fast); + transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast); +} + +.tabBtn::before { + position: absolute; + left: 4px; + top: 50%; + width: 2px; + height: 14px; + margin-top: -7px; + content: ""; + border-radius: 2px; + background: var(--primary); + opacity: 0; + transform: scaleY(0.4); + transition: opacity var(--motion-fast), transform var(--motion-fast); } .tabBtn:hover { @@ -731,9 +838,13 @@ svg { .tabBtn.active { color: var(--text-strong); - border-color: var(--border); background: var(--surface-muted); - box-shadow: inset 2px 0 0 var(--primary); + box-shadow: none; +} + +.tabBtn.active::before { + opacity: 1; + transform: scaleY(1); } .tabIcon { @@ -741,6 +852,12 @@ svg { flex: 0 0 16px; width: 16px; height: 16px; + color: var(--muted-soft); +} + +.tabBtn.active .tabIcon, +.tabBtn:hover .tabIcon { + color: currentColor; } .tabIcon svg { @@ -860,12 +977,12 @@ summary.sectionTitle { min-height: var(--control-height); padding: 0 10px; border: 1px solid var(--border-strong); - border-radius: var(--radius); + border-radius: var(--radius-md); color: var(--text); background: var(--surface); - font-size: 13px; + font-size: var(--text-base); outline: none; - transition: border-color var(--motion-fast), box-shadow var(--motion-fast); + transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast); } .input:hover, @@ -878,7 +995,24 @@ summary.sectionTitle { .small:focus, .logSearchBox:focus { border-color: var(--primary); - box-shadow: var(--focus-ring); + box-shadow: 0 0 0 1px var(--primary), var(--focus-ring); +} + +.input::placeholder, +.small::placeholder, +.logSearchBox::placeholder { + color: var(--muted-soft); +} + +select.input { + appearance: none; + -webkit-appearance: none; + background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), + linear-gradient(135deg, var(--muted) 50%, transparent 50%); + background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; + background-size: 5px 5px, 5px 5px; + background-repeat: no-repeat; + padding-right: 28px; } .textarea { @@ -894,18 +1028,24 @@ summary.sectionTitle { gap: 8px; min-width: 0; min-height: var(--control-height); - padding: 8px 10px; + padding: 7px 10px; border: 1px solid var(--border); - border-radius: var(--radius); + border-radius: var(--radius-md); color: var(--text); background: var(--surface-soft); - font-size: 13px; - line-height: 1.35; + font-size: var(--text-base); + line-height: var(--leading-snug); + transition: border-color var(--motion-fast), background var(--motion-fast); } .check:hover { border-color: var(--hover-border); - background: var(--surface-elevated); + background: var(--surface-muted); +} + +.check:has(input[type="checkbox"]:checked) { + border-color: var(--primary-border); + background: var(--primary-soft); } .check input[type="checkbox"] { @@ -997,18 +1137,22 @@ summary.sectionTitle { .chartBlock { min-width: 0; - padding: 12px; + padding: 14px; border: 1px solid var(--border); - border-radius: var(--radius); + border-radius: var(--radius-md); background: var(--surface-soft); - box-shadow: 0 1px 0 var(--hairline) inset; + transition: border-color var(--motion-fast); +} + +.chartBlock:hover { + border-color: var(--hover-border); } .chartTitle { color: var(--text-strong); - font-size: 13px; + font-size: var(--text-base); font-weight: 550; - line-height: 1.35; + line-height: var(--leading-snug); } .chart { @@ -1028,28 +1172,38 @@ summary.sectionTitle { .barRow { display: grid; - grid-template-columns: minmax(78px, 0.9fr) minmax(80px, 2fr) 42px; + grid-template-columns: minmax(78px, 0.9fr) minmax(80px, 2fr) 48px; align-items: center; - gap: 8px; + gap: 10px; min-width: 0; - min-height: 26px; + min-height: 24px; + transition: opacity var(--motion-fast); } .barRow + .barRow { - margin-top: 8px; + margin-top: 6px; +} + +.barRow:hover { + opacity: 1; +} + +.chartBlock:hover .barRow:not(:hover) { + opacity: 0.55; } .barLabel { min-width: 0; color: var(--text); - font-size: 12px; + font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .barTrack { - height: 8px; + position: relative; + height: 6px; overflow: hidden; border-radius: 99px; background: var(--chart-track); @@ -1058,14 +1212,15 @@ summary.sectionTitle { .barFill { height: 100%; border-radius: 99px; - background: var(--primary); + background: linear-gradient(90deg, color-mix(in oklab, var(--primary) 80%, #fff 20%), var(--primary)); transition: width var(--motion-slow); } .barValue { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; - font-size: 12px; + font-size: var(--text-sm); + font-variant-numeric: tabular-nums; text-align: right; } @@ -1122,18 +1277,54 @@ summary.sectionTitle { margin-top: 14px; overflow: hidden; border: 1px solid var(--border); - border-radius: var(--radius); + border-radius: var(--radius-md); background: var(--preview-bg); transition: border-color var(--motion); } +.preview::after { + position: absolute; + inset: 0; + pointer-events: none; + content: ""; + border-radius: inherit; + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset; +} + .preview:hover { border-color: var(--hover-border); } .preview.isShotEmpty { border-style: dashed; - background: var(--surface-soft); + background: + repeating-linear-gradient(135deg, transparent 0 12px, color-mix(in oklab, var(--border) 50%, transparent) 12px 13px), + var(--surface-soft); +} + +.preview.isShotEmpty::before { + position: absolute; + inset: 0; + content: ""; + pointer-events: none; + background: linear-gradient(180deg, transparent, color-mix(in oklab, var(--primary) 16%, transparent), transparent); + background-size: 100% 200%; + animation: previewScan 2.4s ease-in-out infinite; + mix-blend-mode: plus-lighter; +} + +@keyframes previewScan { + 0% { + background-position: 0 -100%; + opacity: 0; + } + 40% { + opacity: 1; + } + 100% { + background-position: 0 100%; + opacity: 0; + } } .preview img { @@ -1144,6 +1335,7 @@ summary.sectionTitle { opacity: 0; color: transparent; font-size: 0; + transition: opacity var(--motion-slow); } .preview img[src*="screenshot.png"][data-loading="false"] { @@ -1358,16 +1550,37 @@ summary.sectionTitle { min-height: clamp(250px, 32vh, 390px); max-height: clamp(250px, 32vh, 390px); margin: 0; - padding: 12px; + padding: 12px 14px; overflow: auto; border-top: 1px solid var(--log-border); color: var(--log-text); background: var(--log-bg); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; - font-size: 12px; - line-height: 1.55; + font-size: var(--text-sm); + line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; + scrollbar-width: thin; + scrollbar-color: var(--border-strong) transparent; +} + +.log::-webkit-scrollbar { + width: 10px; + height: 10px; +} + +.log::-webkit-scrollbar-track { + background: transparent; +} + +.log::-webkit-scrollbar-thumb { + background: var(--border-strong); + border: 2px solid var(--log-bg); + border-radius: 99px; +} + +.log::-webkit-scrollbar-thumb:hover { + background: var(--hover-border); } .panel.cardLog .log { @@ -1377,7 +1590,34 @@ summary.sectionTitle { .log::selection { color: var(--text-strong); - background: rgba(184, 205, 246, 0.42); + background: color-mix(in oklab, var(--primary) 25%, transparent); +} + +/* Global thin scrollbars */ +* { + scrollbar-width: thin; + scrollbar-color: var(--border-strong) transparent; +} + +*::-webkit-scrollbar { + width: 10px; + height: 10px; +} + +*::-webkit-scrollbar-track { + background: transparent; +} + +*::-webkit-scrollbar-thumb { + background: var(--border-strong); + border: 2px solid transparent; + background-clip: padding-box; + border-radius: 99px; +} + +*::-webkit-scrollbar-thumb:hover { + background: var(--hover-border); + background-clip: padding-box; } @media (max-width: 900px) { From 299ced21c8da0fa38d28d18e3d1fb5ad0ee2e53f Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 20 May 2026 23:33:38 +0800 Subject: [PATCH 02/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E4=BA=8C=E8=BD=AE=EF=BC=9A=E6=95=B0=E6=8D=AE=E8=A1=A8/?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC/=E5=9B=BE=E8=A1=A8/=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - workspaceHeader 加左侧 2px primary accent + uppercase eyebrow - stats 卡片:tabular-nums + uppercase 标签 + 字号统一 text-xl - table:sticky 表头 uppercase + zebra 奇偶行 + hover 高亮 + mono 列灰度 - timeline 图:4 等分水平网格虚线 + Y 轴 0/mid/max 三档 mono 标签 - 空状态:.hint 单独使用时升级为虚线圆框居中占位 + 圆形 dot - 预约卡片:reservationIndex 加圆点 + reservationValue 改 uppercase pill;hover 去 transform,纯 box-shadow 反馈 - cache-bust v4 → v5 --- webui/app.js | 25 +++++- webui/index.html | 4 +- webui/styles.css | 206 +++++++++++++++++++++++++++++++++-------------- 3 files changed, 170 insertions(+), 65 deletions(-) diff --git a/webui/app.js b/webui/app.js index 2bbf5c7..9d2e2e3 100644 --- a/webui/app.js +++ b/webui/app.js @@ -654,12 +654,26 @@ function renderTimeline(containerId, timeline) { axis.setAttribute("fill", "none"); svg.appendChild(axis); + // 水平网格线(4 等分),淡色 dashed + const gridSteps = 4; + for (let i = 1; i <= gridSteps; i++) { + const gy = padT + ((H - padT - padB) * i / gridSteps); + const gline = document.createElementNS("http://www.w3.org/2000/svg", "path"); + gline.setAttribute("d", `M ${padL} ${gy.toFixed(2)} L ${W - padR} ${gy.toFixed(2)}`); + gline.setAttribute("stroke", "var(--border)"); + gline.setAttribute("stroke-opacity", "0.5"); + gline.setAttribute("stroke-dasharray", "2 4"); + gline.setAttribute("fill", "none"); + svg.appendChild(gline); + } + const mkText = (x, y, txt, anchor = "start") => { const el = document.createElementNS("http://www.w3.org/2000/svg", "text"); el.setAttribute("x", String(x)); el.setAttribute("y", String(y)); el.setAttribute("fill", "var(--muted)"); - el.setAttribute("font-size", "11"); + el.setAttribute("font-size", "10"); + el.setAttribute("font-family", "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"); el.setAttribute("text-anchor", anchor); el.textContent = txt; return el; @@ -677,8 +691,13 @@ function renderTimeline(containerId, timeline) { return (H - padB) - (vv / maxY) * h; }; - // y 轴 max 标记 - svg.appendChild(mkText(padL, padT + 10, String(maxY), "start")); + // y 轴刻度(0 / mid / max) + const yMid = Math.round(maxY / 2); + svg.appendChild(mkText(padL - 6, padT + 4, String(maxY), "end")); + if (yMid > 0 && yMid < maxY) { + svg.appendChild(mkText(padL - 6, padT + (H - padT - padB) / 2 + 4, String(yMid), "end")); + } + svg.appendChild(mkText(padL - 6, H - padB + 4, "0", "end")); // x 轴 3 个时间刻度 const fmtShort = (ts) => { diff --git a/webui/index.html b/webui/index.html index 8b05938..a65a695 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1222,6 +1222,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index aa62c9d..8de5576 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -746,38 +746,52 @@ svg { } .workspaceHeader { + position: relative; display: flex; align-items: flex-end; justify-content: space-between; - gap: 16px; + gap: var(--space-4); min-width: 0; - margin-bottom: 12px; - padding: 14px 16px; + margin-bottom: var(--space-3); + padding: var(--space-4) var(--space-5); border: 1px solid var(--border); - border-radius: var(--radius); + border-radius: var(--radius-md); background: var(--surface); } +.workspaceHeader::before { + position: absolute; + left: 0; + top: var(--space-4); + bottom: var(--space-4); + width: 2px; + content: ""; + border-radius: 0 2px 2px 0; + background: var(--primary); +} + .workspaceEyebrow { color: var(--muted); - font-size: 11px; - font-weight: 500; - letter-spacing: 0.06em; + font-size: var(--text-xs); + font-weight: 600; + letter-spacing: var(--tracking-wide); text-transform: uppercase; } .workspaceTitle { margin: 4px 0 0; color: var(--text-strong); - font-size: 20px; - line-height: 1.2; + font-size: var(--text-xl); + font-weight: 600; + line-height: var(--leading-tight); + letter-spacing: var(--tracking-tight); } .workspaceHint { max-width: 360px; color: var(--muted); - font-size: 12px; - line-height: 1.45; + font-size: var(--text-sm); + line-height: var(--leading-snug); text-align: right; } @@ -1064,11 +1078,41 @@ select.input { .hint { min-width: 0; color: var(--muted); - font-size: 12px; - line-height: 1.45; + font-size: var(--text-sm); + line-height: var(--leading-snug); overflow-wrap: anywhere; } +/* Empty-state hint inside table / chart / reservations: dashed framed placeholder */ +.table > .hint:only-child, +.chart > .hint:only-child, +.reservationsContent > .hint:only-child { + display: flex; + align-items: center; + justify-content: center; + gap: 8px; + min-height: 60px; + padding: 16px; + border: 1px dashed var(--border); + border-radius: var(--radius-md); + background: color-mix(in oklab, var(--surface-soft) 60%, transparent); + color: var(--muted-soft); + font-size: var(--text-sm); + text-align: center; +} + +.table > .hint:only-child::before, +.chart > .hint:only-child::before, +.reservationsContent > .hint:only-child::before { + content: ""; + width: 14px; + height: 14px; + border: 1.5px dashed currentColor; + border-radius: 50%; + opacity: 0.6; + flex: 0 0 14px; +} + .divider { height: 1px; margin: 16px 0; @@ -1077,54 +1121,57 @@ select.input { .statsGrid { display: grid; - grid-template-columns: repeat(auto-fit, minmax(154px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; - margin-top: 10px; + margin-top: 12px; } .stat { min-width: 0; - padding: 12px; + padding: 14px; border: 1px solid var(--border); - border-radius: var(--radius); - background: var(--surface-soft); - box-shadow: 0 1px 0 var(--hairline) inset; - transition: border-color var(--motion-fast), transform var(--motion-fast), background var(--motion-fast); + border-radius: var(--radius-md); + background: var(--surface); + transition: border-color var(--motion-fast), background var(--motion-fast); } .stat:hover { border-color: var(--hover-border); - background: var(--surface-elevated); - transform: translateY(-1px); + background: var(--surface-soft); } .statLabel { color: var(--muted); - font-size: 12px; - font-weight: 500; - line-height: 1.35; + font-size: var(--text-xs); + font-weight: 600; + line-height: 1.3; + letter-spacing: var(--tracking-wide); + text-transform: uppercase; } .statValue { min-width: 0; - margin-top: 6px; + margin-top: 8px; color: var(--text-strong); - font-size: 19px; + font-size: var(--text-xl); font-weight: 600; - line-height: 1.25; + line-height: var(--leading-tight); + letter-spacing: var(--tracking-tight); + font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } .statTrace { - font-size: 14px; + font-size: var(--text-md); + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; } .statHint { min-width: 0; - margin-top: 5px; + margin-top: 6px; color: var(--muted); - font-size: 12px; - line-height: 1.35; + font-size: var(--text-sm); + line-height: var(--leading-snug); overflow-wrap: anywhere; } @@ -1227,22 +1274,35 @@ select.input { .table { min-width: 0; overflow: hidden; - margin-top: 10px; + margin-top: 12px; border: 1px solid var(--border); - border-radius: var(--radius); + border-radius: var(--radius-md); background: var(--surface); } .tableRow { display: grid; grid-template-columns: minmax(92px, 0.65fr) minmax(0, 1.7fr) minmax(54px, 0.45fr); - gap: 10px; + gap: 12px; min-width: 0; - padding: 9px 11px; + padding: 10px 14px; border-top: 1px solid var(--border); color: var(--text); - font-size: 12px; - line-height: 1.45; + font-size: var(--text-sm); + line-height: var(--leading-snug); + transition: background var(--motion-fast); +} + +.tableRow:not(.tableHead):hover { + background: var(--surface-soft); +} + +.tableRow:nth-child(odd):not(.tableHead) { + background: color-mix(in oklab, var(--surface-soft) 50%, transparent); +} + +.tableRow:nth-child(odd):not(.tableHead):hover { + background: var(--surface-soft); } .tableRow:first-child { @@ -1254,10 +1314,21 @@ select.input { overflow-wrap: anywhere; } -.tableHead { +.tableRow .mono { + font-variant-numeric: tabular-nums; color: var(--muted); - background: var(--surface-soft); - font-weight: 550; +} + +.tableHead { + position: sticky; + top: 0; + z-index: 1; + color: var(--muted); + background: var(--surface-muted); + font-size: var(--text-xs); + font-weight: 600; + letter-spacing: var(--tracking-wide); + text-transform: uppercase; } .mono { @@ -1362,15 +1433,16 @@ select.input { .reservationsInfo { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); - gap: 6px 10px; + gap: 6px 14px; min-width: 0; - padding: 9px; + padding: 10px 12px; border: 1px solid var(--border); - border-radius: var(--radius); + border-radius: var(--radius-md); background: var(--surface-soft); color: var(--text); - font-size: 12px; - line-height: 1.45; + font-size: var(--text-sm); + line-height: var(--leading-snug); + font-variant-numeric: tabular-nums; } .reservationsInfo > div { @@ -1381,7 +1453,7 @@ select.input { .reservationsList { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); - gap: 8px; + gap: 10px; min-width: 0; max-height: var(--queue-height-desktop); overflow: auto; @@ -1392,15 +1464,14 @@ select.input { min-width: 0; overflow: hidden; border: 1px solid var(--border); - border-radius: var(--radius); + border-radius: var(--radius-md); background: var(--surface); - transition: border-color var(--motion-fast), box-shadow var(--motion), transform var(--motion); + transition: border-color var(--motion-fast), box-shadow var(--motion-fast); } .reservationItem:hover { border-color: var(--hover-border); box-shadow: var(--shadow-soft); - transform: translateY(-1px); } .reservationHeader { @@ -1409,7 +1480,7 @@ select.input { justify-content: space-between; gap: 10px; min-width: 0; - padding: 9px 10px; + padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-soft); } @@ -1419,34 +1490,49 @@ select.input { } .reservationIndex { - color: var(--primary); + display: inline-flex; + align-items: center; + gap: 6px; + color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; - font-size: 12px; + font-size: var(--text-sm); font-weight: 600; } +.reservationIndex::before { + display: inline-block; + width: 6px; + height: 6px; + border-radius: 50%; + background: var(--primary); + content: ""; +} + .reservationValue { max-width: 68%; - padding: 3px 8px; + padding: 3px 9px; overflow: hidden; border: 1px solid var(--warning-border); border-radius: 99px; color: var(--warning); background: var(--warning-soft); - font-size: 12px; - font-weight: 550; + font-size: var(--text-xs); + font-weight: 600; + letter-spacing: var(--tracking-wide); + text-transform: uppercase; text-overflow: ellipsis; white-space: nowrap; } .reservationBody { display: grid; - gap: 5px; + gap: 6px; min-width: 0; - padding: 9px 10px; + padding: 10px 12px; color: var(--text); - font-size: 12px; - line-height: 1.45; + font-size: var(--text-sm); + line-height: var(--leading-snug); + font-variant-numeric: tabular-nums; } .reservationBody > div { From 276235408e64f295d806411697100125616a1347 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:00:25 +0800 Subject: [PATCH 03/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E8=BD=AE=EF=BC=9A=E6=B8=85=E7=90=86=20+=20a11y=20+=20?= =?UTF-8?q?=E6=B7=B1=E8=89=B2=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 清理死变量:surface-elevated、bg-start/mid/end、shadow-hover、shadow-primary*、accent-cyan/emerald、primary-soft-hover*、primary-action-bg - header 动作组:primary 与 secondary 之间加 1px 分割线;btnTheme 加左 margin - summary.sectionTitle 加自绘 chevron icon(mask SVG),open 时旋转 90° - 表单 :focus 改为 :focus-visible(鼠标点击不再触发 ring) - 按钮加 :focus-visible 双层光环(背景 + primary 描边) - 深色主题对比度复查:border 26→2a,border-strong 2e→3a,hover-border 40→4a;surface-muted 1a→1c;primary-soft 1a1d33→1c2040;primary-border 2d3257→353c66;warning/danger soft 系列加亮一档;overview-primary-bg 141414→161620;hairline 0.04→0.06 - cache-bust v5 → v6 --- webui/index.html | 4 +- webui/styles.css | 99 +++++++++++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 46 deletions(-) diff --git a/webui/index.html b/webui/index.html index a65a695..1b84bb9 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1222,6 +1222,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index 8de5576..ea2be23 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -6,7 +6,6 @@ --surface-solid: #ffffff; --surface-soft: #fafafa; --surface-muted: #f4f4f5; - --surface-elevated: #ffffff; --border: #e5e5e5; --border-strong: #d4d4d4; --hairline: rgba(0, 0, 0, 0.04); @@ -29,16 +28,8 @@ --danger-soft: #fef2f2; --danger-border: #fecaca; --on-primary: #ffffff; - --bg-start: #ffffff; - --bg-mid: #ffffff; - --bg-end: #ffffff; --header-bg: rgba(255, 255, 255, 0.85); - --primary-action-bg: rgba(94, 106, 210, 0.06); - --accent-cyan: #06b6d4; - --accent-emerald: #10b981; --hover-border: #a3a3a3; - --primary-soft-hover: #e0e3f5; - --primary-soft-hover-border: #a8b1e8; --danger-soft-hover: #fee2e2; --danger-soft-hover-border: #fca5a5; --overview-primary-bg: #fafafa; @@ -46,10 +37,6 @@ --preview-bg: #fafafa; --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06); --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04); - --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.08); - --shadow-primary: 0 1px 2px rgba(94, 106, 210, 0.2); - --shadow-primary-soft: 0 1px 2px rgba(94, 106, 210, 0.15); - --shadow-danger-soft: 0 1px 2px rgba(220, 38, 38, 0.15); --focus-ring: 0 0 0 3px rgba(94, 106, 210, 0.18); --status-muted-ring: 0 0 0 3px rgba(163, 163, 163, 0.16); --status-success-ring: 0 0 0 3px rgba(22, 163, 74, 0.18); @@ -116,51 +103,38 @@ --surface: #0f0f0f; --surface-solid: #0f0f0f; --surface-soft: #141414; - --surface-muted: #1a1a1a; - --surface-elevated: #161616; - --border: #262626; - --border-strong: #2e2e2e; - --hairline: rgba(255, 255, 255, 0.04); + --surface-muted: #1c1c1c; + --border: #2a2a2a; + --border-strong: #3a3a3a; + --hairline: rgba(255, 255, 255, 0.06); --text: #ededed; --text-strong: #fafafa; --muted: #a1a1aa; --muted-soft: #71717a; --primary: #8b95ff; --primary-hover: #a3acff; - --primary-soft: #1a1d33; - --primary-border: #2d3257; + --primary-soft: #1c2040; + --primary-border: #353c66; --primary-accent-text: #aab5ff; --success: #22c55e; --success-soft: #0f1f15; --warning: #eab308; - --warning-soft: #1f1a0a; - --warning-border: #423a17; + --warning-soft: #221c0a; + --warning-border: #4d4220; --danger: #ef4444; --danger-hover: #f87171; - --danger-soft: #1f1212; - --danger-border: #462020; + --danger-soft: #221414; + --danger-border: #4a2424; --on-primary: #ffffff; - --bg-start: #0a0a0a; - --bg-mid: #0a0a0a; - --bg-end: #0a0a0a; --header-bg: rgba(15, 15, 15, 0.85); - --primary-action-bg: rgba(139, 149, 255, 0.08); - --accent-cyan: #22d3ee; - --accent-emerald: #34d399; - --hover-border: #404040; - --primary-soft-hover: #25294a; - --primary-soft-hover-border: #3d4373; + --hover-border: #4a4a4a; --danger-soft-hover: #2d1818; --danger-soft-hover-border: #5a2828; - --overview-primary-bg: #141414; - --chart-track: #262626; + --overview-primary-bg: #161620; + --chart-track: #2a2a2a; --preview-bg: #0f0f0f; --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3); --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3); - --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 8px 20px rgba(0, 0, 0, 0.4); - --shadow-primary: 0 1px 2px rgba(139, 149, 255, 0.25); - --shadow-primary-soft: 0 1px 2px rgba(139, 149, 255, 0.2); - --shadow-danger-soft: 0 1px 2px rgba(239, 68, 68, 0.2); --focus-ring: 0 0 0 3px rgba(139, 149, 255, 0.25); --status-muted-ring: 0 0 0 3px rgba(113, 113, 122, 0.2); --status-success-ring: 0 0 0 3px rgba(34, 197, 94, 0.2); @@ -305,12 +279,13 @@ svg { display: flex; align-items: center; justify-content: flex-end; - gap: 8px; + gap: 12px; flex-wrap: wrap; min-width: 0; } .actionGroup { + position: relative; display: flex; align-items: center; justify-content: flex-end; @@ -321,11 +296,23 @@ svg { background: transparent; } +.secondaryActions::before { + align-self: stretch; + width: 1px; + margin: 4px 6px 4px 0; + background: var(--border); + content: ""; +} + .primaryActions { border: 0; background: transparent; } +#btnTheme { + margin-left: 4px; +} + .btn { display: inline-flex; align-items: center; @@ -364,6 +351,12 @@ svg { opacity: 0.7; } +.btn:focus-visible, +.tabBtn:focus-visible { + outline: none; + box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary); +} + .btnIcon { display: inline-flex; flex: 0 0 16px; @@ -1005,9 +998,9 @@ summary.sectionTitle { border-color: var(--hover-border); } -.input:focus, -.small:focus, -.logSearchBox:focus { +.input:focus-visible, +.small:focus-visible, +.logSearchBox:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--focus-ring); } @@ -1551,6 +1544,7 @@ details { summary { cursor: pointer; + list-style: none; } summary::-webkit-details-marker { @@ -1558,10 +1552,27 @@ summary::-webkit-details-marker { } summary.sectionTitle { - justify-content: space-between; + justify-content: flex-start; gap: 10px; } +summary.sectionTitle::before { + width: 10px; + height: 10px; + flex: 0 0 10px; + content: ""; + background: currentColor; + -webkit-mask: url("data:image/svg+xml;utf8,") no-repeat center / contain; + mask: url("data:image/svg+xml;utf8,") no-repeat center / contain; + opacity: 0.6; + transition: transform var(--motion-fast), opacity var(--motion-fast); +} + +details[open] > summary.sectionTitle::before { + transform: rotate(90deg); + opacity: 1; +} + .summaryActions { display: inline-flex; align-items: center; From aa5065590acd3817ba4ef2c22880ebdb74d1d727 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:06:34 +0800 Subject: [PATCH 04/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=9B=9B=E8=BD=AE=EF=BC=9A=E8=A1=A8=E5=8D=95=E7=BB=86=E8=8A=82?= =?UTF-8?q?=20+=20=E6=BB=9A=E5=8A=A8=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - inline2 双输入框视觉合并:连体边框、共享圆角、focus 时 z-index 提升 - inline2 内的 span(如 "~")改为正中对齐分隔符 - rowActions 加 border-top + padding-top;primary 按钮自然居前(order: -1) - html scroll-behavior smooth;prefers-reduced-motion 时回退 auto - cache-bust v6 → v7 --- webui/index.html | 4 ++-- webui/styles.css | 58 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/webui/index.html b/webui/index.html index 1b84bb9..3b9a4db 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1222,6 +1222,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index ea2be23..abbb39f 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -154,6 +154,16 @@ body { min-height: 100%; } +html { + scroll-behavior: smooth; +} + +@media (prefers-reduced-motion: reduce) { + html { + scroll-behavior: auto; + } +} + body { margin: 0; font-family: "Inter", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; @@ -958,15 +968,57 @@ summary.sectionTitle { .inline2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 8px; + gap: 0; min-width: 0; + border-radius: var(--radius-md); + isolation: isolate; +} + +.inline2 > .input, +.inline2 > input { + border-radius: 0; + margin-left: -1px; +} + +.inline2 > .input:first-child, +.inline2 > input:first-child { + border-top-left-radius: var(--radius-md); + border-bottom-left-radius: var(--radius-md); + margin-left: 0; +} + +.inline2 > .input:last-child, +.inline2 > input:last-child { + border-top-right-radius: var(--radius-md); + border-bottom-right-radius: var(--radius-md); +} + +.inline2 > .input:focus-visible, +.inline2 > input:focus-visible { + z-index: 1; +} + +.inline2 > span { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 0 6px; + color: var(--muted); + font-size: var(--text-sm); } .rowActions { display: flex; + align-items: center; flex-wrap: wrap; - gap: 8px; - margin-top: 12px; + gap: var(--space-2); + margin-top: var(--space-4); + padding-top: var(--space-3); + border-top: 1px solid var(--border); +} + +.rowActions .btnPrimary { + order: -1; } .label { From 96cba09c49c86b0e2def1140e339cdc5aa196d63 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:22:58 +0800 Subject: [PATCH 05/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E4=BA=94=E8=BD=AE=EF=BC=9A=E4=BA=A4=E4=BA=92=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E4=B8=8E=E5=8A=9F=E8=83=BD=E6=80=A7=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 Toast 通知系统:右下角浮出(移动端横铺底部),4 类(success/error/warn/info)+ 关闭按钮 + 自动消失 + hover 暂停消失 - 关键操作接入 Toast:保存配置 / 加载配置 / 启动失败 / 设备操作(连接/断开/WiFi 启用)成功失败提示 - 日志关键词分类着色:行级 span,自动识别 ERROR/WARN/SUCCESS/DEBUG/INFO(含中英文与 emoji 标记);DocumentFragment 批量渲染保持性能 - 配置面板加跨标签搜索:workspaceHeader 内嵌搜索框,输入即时按 label/hint/key 过滤所有 row 与 sectionTitle,搜索时自动展开所有 panel;空结果显示空状态;带清空按钮 - 首屏统计骨架屏:未到数据前 statValue 显示 shimmer 占位;pollStats 成功后自动移除 - 移动端复查:inline2 在小屏取消连体边框;workspaceHeader 改纵向布局,搜索框占满宽;secondaryActions 分隔线隐藏;btnTheme 推到右侧 - cache-bust v7 → v8 --- webui/app.js | 253 +++++++++++++++++++++++++++++++++---- webui/index.html | 15 ++- webui/styles.css | 318 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 559 insertions(+), 27 deletions(-) diff --git a/webui/app.js b/webui/app.js index 9d2e2e3..f083d0f 100644 --- a/webui/app.js +++ b/webui/app.js @@ -256,6 +256,154 @@ function initTheme() { } } +function ensureToastContainer() { + let c = document.getElementById("toastContainer"); + if (!c) { + c = document.createElement("div"); + c.id = "toastContainer"; + c.className = "toastContainer"; + c.setAttribute("role", "status"); + c.setAttribute("aria-live", "polite"); + document.body.appendChild(c); + } + return c; +} + +function toast(message, kind = "info", { duration = 3500 } = {}) { + if (!message) return; + const container = ensureToastContainer(); + const t = document.createElement("div"); + t.className = `toast toast-${kind}`; + const icon = document.createElement("span"); + icon.className = "toastIcon"; + icon.setAttribute("aria-hidden", "true"); + const ICONS = { + success: '', + error: '', + warn: '', + info: '', + }; + icon.innerHTML = ICONS[kind] || ICONS.info; + const body = document.createElement("div"); + body.className = "toastBody"; + body.textContent = String(message); + const close = document.createElement("button"); + close.className = "toastClose"; + close.type = "button"; + close.setAttribute("aria-label", "关闭"); + close.innerHTML = ''; + t.append(icon, body, close); + container.appendChild(t); + let timer = setTimeout(remove, duration); + function remove() { + if (timer) { clearTimeout(timer); timer = null; } + t.classList.add("isLeaving"); + setTimeout(() => t.remove(), 220); + } + close.addEventListener("click", remove); + t.addEventListener("mouseenter", () => { if (timer) { clearTimeout(timer); timer = null; } }); + t.addEventListener("mouseleave", () => { if (!timer) timer = setTimeout(remove, 1500); }); + return remove; +} + +function initConfigSearch() { + const input = $("configSearch"); + const clear = $("configSearchClear"); + const empty = $("configSearchEmpty"); + if (!input) return; + + // Cache: rows = [.row], with their lower-case search text + parent panel + const rows = Array.from(document.querySelectorAll(".panels .panel .row")); + const rowMeta = rows.map((row) => { + const textParts = []; + row.querySelectorAll(".label, .check span, .hint, span").forEach((el) => { + const t = (el.textContent || "").trim(); + if (t) textParts.push(t); + }); + row.querySelectorAll("input[data-key], select[data-key], textarea[data-key]").forEach((el) => { + if (el.dataset.key) textParts.push(el.dataset.key); + }); + return { row, panel: row.closest(".panel"), text: textParts.join(" ").toLowerCase() }; + }); + + // Section titles: when filtering, hide sections that have no visible row after them + const allSectionTitles = Array.from(document.querySelectorAll(".panels .panel .sectionTitle")); + + const apply = (q) => { + const query = q.trim().toLowerCase(); + if (clear) clear.toggleAttribute("hidden", !query); + + if (!query) { + // Restore all + rowMeta.forEach(({ row }) => row.classList.remove("isSearchHidden")); + allSectionTitles.forEach((s) => s.classList.remove("isSearchHidden")); + document.querySelectorAll(".panel").forEach((p) => p.classList.remove("isSearchAllHidden")); + if (empty) empty.hidden = true; + // Re-apply normal tab visibility (panels may have been forced visible) + const activeTab = document.querySelector(".tabBtn.active[data-target]"); + if (activeTab) { + const target = activeTab.dataset.target; + document.querySelectorAll(".panel[data-panel]").forEach((p) => { + const on = p.dataset.panel === target; + p.toggleAttribute("hidden", !on); + p.classList.toggle("active", on); + }); + } + return; + } + + // While searching: show ALL panels (panels normally hide via [hidden]), then filter rows. + document.querySelectorAll(".panel[data-panel]").forEach((p) => { + p.removeAttribute("hidden"); + p.classList.add("active"); + }); + + let totalVisible = 0; + const visibleByPanel = new Map(); + rowMeta.forEach(({ row, panel, text }) => { + const match = text.includes(query); + row.classList.toggle("isSearchHidden", !match); + if (match) { + totalVisible++; + visibleByPanel.set(panel, (visibleByPanel.get(panel) || 0) + 1); + } + }); + + // Hide section titles that have no visible row in their following sibling group + allSectionTitles.forEach((title) => { + let next = title.nextElementSibling; + let anyVisible = false; + while (next && !next.matches(".sectionTitle")) { + if (next.matches(".row") && !next.classList.contains("isSearchHidden")) { anyVisible = true; break; } + next = next.nextElementSibling; + } + title.classList.toggle("isSearchHidden", !anyVisible); + }); + + // Hide panels that have zero visible rows + document.querySelectorAll(".panel[data-panel]").forEach((p) => { + const visible = visibleByPanel.get(p) || 0; + p.toggleAttribute("hidden", visible === 0); + }); + + if (empty) empty.hidden = totalVisible > 0; + }; + + let debounceTimer; + input.addEventListener("input", () => { + clearTimeout(debounceTimer); + debounceTimer = setTimeout(() => apply(input.value), 80); + }); + + if (clear) { + clear.addEventListener("click", () => { + input.value = ""; + apply(""); + input.focus(); + }); + } +} + function initTabs() { const tabButtons = Array.from(document.querySelectorAll(".tabBtn[data-target]")); const panels = Array.from(document.querySelectorAll(".panel[data-panel]")); @@ -283,43 +431,74 @@ function initTabs() { setActive(defaultTarget); } +function classifyLogLine(line) { + const s = String(line || ""); + if (!s) return ""; + // 错误优先 + if (/\b(ERROR|FATAL|CRITICAL|TRACEBACK|EXCEPTION|FAILED|FAIL\b)\b/i.test(s)) return "logError"; + if (/(失败|错误|异常|未知错误|超时|崩溃)/.test(s)) return "logError"; + if (/❌/.test(s)) return "logError"; + // 警告 + if (/\b(WARN(ING)?)\b/i.test(s)) return "logWarn"; + if (/(警告|注意)/.test(s)) return "logWarn"; + if (/⚠️/.test(s)) return "logWarn"; + // 成功 + if (/\b(SUCCESS|OK|DONE|COMPLETED?)\b/i.test(s)) return "logSuccess"; + if (/(成功|已保存|完成|启动成功)/.test(s)) return "logSuccess"; + if (/(✅|✓)/.test(s)) return "logSuccess"; + // Debug + if (/\b(DEBUG|TRACE)\b/i.test(s)) return "logDebug"; + // INFO 默认 + if (/\b(INFO)\b/i.test(s)) return "logInfo"; + return ""; +} + +function renderLogLineNode(line) { + const cls = classifyLogLine(line); + if (!cls) { + // 普通行:直接文本节点(性能最佳) + return document.createTextNode(String(line ?? "") + "\n"); + } + const span = document.createElement("span"); + span.className = "logLine " + cls; + span.textContent = String(line ?? "") + "\n"; + return span; +} + function appendLog(lines) { const log = $("runLog"); if (!lines || lines.length === 0) return; - + // 记录更新前与底部的距离,用于在非底部时保持视图位置 const distanceFromBottom = log.scrollHeight - log.scrollTop - log.clientHeight; // 是否严格位于底部(仅在几像素内视为底部),避免每次刷新都跳到底部 const wasAtBottom = distanceFromBottom < UI_LIMITS.scrollBottomThresholdPx; - // 性能优化:批量追加文本,减少重排次数 - const newText = lines.join("\n") + "\n"; // 直接追加到 DOM,同时维护 runLogBuffer 以便支持搜索 - const toAppend = lines; - for (const ln of toAppend) runLogBuffer.push(ln); + for (const ln of lines) runLogBuffer.push(ln); // 限制缓冲 if (runLogBuffer.length > runLogMaxLines) runLogBuffer = runLogBuffer.slice(-runLogMaxLines); // 如果当前处于 run search 结果显示状态,则不改变显示(保持搜索结果不被实时追加打断) if (runSearchActive && runLogMode === 'search') { // 仍保持缓冲更新,但不修改 DOM + } else if (runLogFilter) { + // 有过滤器时重渲染整个视图 + renderRunLog(); } else { - // 如果没有过滤器,直接将文本拼接(性能优先) - if (!runLogFilter) { - log.textContent += newText; - } else { - // 有过滤器时重渲染整个视图 - renderRunLog(); - } + // 批量追加:用 fragment + 行级 span 着色 + const frag = document.createDocumentFragment(); + for (const ln of lines) frag.appendChild(renderLogLineNode(ln)); + log.appendChild(frag); } - + // 性能优化:限制日志长度,避免内存溢出(保留最近较多字符以便桌面端查看) const maxLength = UI_LIMITS.runLogMaxChars; if (log.textContent.length > maxLength) { - // 在截断文本时,保留用户原来的距离(除非用户确实在底部) - log.textContent = log.textContent.slice(-maxLength); + // 直接基于缓冲重渲染(截断到最新行) + runLogBuffer = runLogBuffer.slice(-Math.ceil(runLogMaxLines * 0.6)); + renderRunLog(); if (!wasAtBottom) { - // 调整 scrollTop 保持原先距离 const newScrollTop = log.scrollHeight - log.clientHeight - distanceFromBottom; log.scrollTop = Math.max(0, newScrollTop); } @@ -334,12 +513,21 @@ function appendLog(lines) { function renderRunLog() { const el = $("runLog"); if (!el) return; + const renderInto = (lines) => { + el.textContent = ""; + if (!lines.length) return; + const frag = document.createDocumentFragment(); + for (const ln of lines) frag.appendChild(renderLogLineNode(ln)); + el.appendChild(frag); + }; + // 如果处于搜索结果显示状态,优先显示 search 返回的结果 if (runSearchActive && runLogMode === 'search') { const lines = runSearchResultsBuffer || []; const prevScrollBottom = el.scrollHeight - el.scrollTop - el.clientHeight; - el.textContent = lines.join("\n") + (lines.length ? "\n" : ""); - if (prevScrollBottom < UI_LIMITS.scrollBottomThresholdPx) el.scrollTop = el.scrollHeight; else el.scrollTop = Math.max(0, el.scrollHeight - el.clientHeight - prevScrollBottom); + renderInto(lines); + if (prevScrollBottom < UI_LIMITS.scrollBottomThresholdPx) el.scrollTop = el.scrollHeight; + else el.scrollTop = Math.max(0, el.scrollHeight - el.clientHeight - prevScrollBottom); return; } @@ -349,9 +537,9 @@ function renderRunLog() { lines = runLogBuffer.filter(l => String(l || "").toLowerCase().includes(filter)); } const prevScrollBottom = el.scrollHeight - el.scrollTop - el.clientHeight; - el.textContent = lines.join("\n") + (lines.length ? "\n" : ""); - // 尽量保持原来滚动位置;若位于底部则滚到底部 - if (prevScrollBottom < UI_LIMITS.scrollBottomThresholdPx) el.scrollTop = el.scrollHeight; else el.scrollTop = Math.max(0, el.scrollHeight - el.clientHeight - prevScrollBottom); + renderInto(lines); + if (prevScrollBottom < UI_LIMITS.scrollBottomThresholdPx) el.scrollTop = el.scrollHeight; + else el.scrollTop = Math.max(0, el.scrollHeight - el.clientHeight - prevScrollBottom); } function appendRunLogLines(lines) { @@ -902,8 +1090,9 @@ async function loadConfig() { try { const cfg = await apiGet("/api/config"); applyConfigToUI(cfg); - appendLog(["[WEB] 配置已加载"]); + toast("配置已加载", "success"); } catch (e) { + toast("配置加载失败:" + e.message, "error", { duration: 5000 }); appendLog(["[WEB] 配置加载失败: " + e.message]); } } @@ -913,7 +1102,10 @@ async function saveConfig() { try { const cfgUpdate = collectConfigFromUI(); await apiPost("/api/config", cfgUpdate); - appendLog(["[WEB] 配置已保存到 config.json"]); + toast("配置已保存", "success"); + } catch (e) { + toast("保存失败:" + (e?.message || e), "error", { duration: 5000 }); + throw e; } finally { setButtonBusy("btnSave", false); } @@ -929,10 +1121,13 @@ async function postDeviceAction(path, body, successPrefix) { const result = await apiPost(path, body || {}); const msg = result.message || result.output || result.error || "完成"; appendLog([`${successPrefix}: ${msg}`]); + if (!result.error) toast(`${successPrefix}: ${msg}`, "success"); + else toast(`${successPrefix}: ${msg}`, "warn"); if (result.devices) await refreshDevices(); return result; } catch (e) { appendLog([`${successPrefix}失败: ${e?.message || e}`]); + toast(`${successPrefix}失败:${e?.message || e}`, "error", { duration: 5000 }); throw e; } } @@ -1029,13 +1224,15 @@ async function startRun() { if (result && result.ok === false) { const errorMsg = result.error || "未知错误"; appendLog([`[WEB] 启动失败: ${errorMsg}`]); + toast("启动失败:" + (errorMsg === "running" ? "已有进程在运行" : errorMsg), "error", { duration: 5000 }); if (errorMsg === "running") { appendLog([`[WEB] 提示:已有进程在运行中,请先点击"停止"按钮`]); } return; } - + appendLog([`[WEB] 已开始运行:device=${deviceId || UI_COPY.device.autoLabel}`]); + toast(`已开始运行 · ${deviceId || "自动"}`, "success"); // 启动时自动截图 if (deviceId) { @@ -1071,6 +1268,7 @@ async function startRun() { console.error("[WEB] startRun error:", e); const errorMsg = e.message || String(e); appendLog([`[WEB] 启动失败: ${errorMsg}`]); + toast("启动失败:" + errorMsg, "error", { duration: 5000 }); setRunOverview(UI_COPY.runOverview.failed, errorMsg, RUN_TONE.error); // 如果是"running"错误,显示友好提示 if (errorMsg === "running" || (e.status === 409)) { @@ -1392,6 +1590,8 @@ async function pollHighValueRooms() { async function pollStats() { try { const s = await apiGet(`/api/stats?t=${Date.now()}`); + // 数据到位,去掉骨架 + document.querySelectorAll(".stat .statValue.skeleton, .stat .statHint.skeleton").forEach((el) => el.classList.remove("skeleton")); const running = s.running ? "运行中" : "未运行"; setTextIfExists("statRunning", running); setTextIfExists("statPid", s.pid ?? "-"); @@ -1532,6 +1732,11 @@ function startStatsPolling() { window.addEventListener("DOMContentLoaded", async () => { initTheme(); initTabs(); + initConfigSearch(); + // 首屏统计数字加骨架,待第一次 pollStats 成功后移除 + document.querySelectorAll(".stat .statValue").forEach((el) => { + if ((el.textContent || "").trim() === "-") el.classList.add("skeleton"); + }); $("btnRefresh").addEventListener("click", refreshDevices); $("btnLoad").addEventListener("click", async () => { await loadConfig(); }); $("btnSave").addEventListener("click", async () => { await saveConfig(); }); diff --git a/webui/index.html b/webui/index.html index 3b9a4db..7a9e24a 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -186,8 +186,17 @@
Configuration

运行策略工作区

-
配置项按当前标签自然铺排,短页不再继承长页高度。
+
+ + + +
+
@@ -1222,6 +1231,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index abbb39f..5b964e2 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -798,6 +798,89 @@ svg { text-align: right; } +.workspaceSearch { + position: relative; + display: flex; + align-items: center; + width: clamp(220px, 32vw, 360px); +} + +.workspaceSearch input { + width: 100%; + min-height: 32px; + padding: 0 30px 0 30px; + border: 1px solid var(--border-strong); + border-radius: var(--radius-md); + color: var(--text); + background: var(--surface-soft); + font-size: var(--text-sm); + outline: none; + transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast); +} + +.workspaceSearch input::-webkit-search-cancel-button { + display: none; +} + +.workspaceSearch input:hover { + border-color: var(--hover-border); +} + +.workspaceSearch input:focus-visible { + border-color: var(--primary); + background: var(--surface); + box-shadow: 0 0 0 1px var(--primary), var(--focus-ring); +} + +.workspaceSearchIcon { + position: absolute; + left: 9px; + top: 50%; + width: 14px; + height: 14px; + margin-top: -7px; + color: var(--muted-soft); + pointer-events: none; +} + +.workspaceSearchClear { + position: absolute; + right: 6px; + top: 50%; + display: inline-flex; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + margin-top: -10px; + padding: 0; + border: 0; + border-radius: var(--radius-sm); + color: var(--muted-soft); + background: transparent; + cursor: pointer; + transition: color var(--motion-fast), background var(--motion-fast); +} + +.workspaceSearchClear:hover { + color: var(--text); + background: var(--surface-muted); +} + +.row.isSearchHidden, +.sectionTitle.isSearchHidden { + display: none !important; +} + +.configSearchEmpty { + margin: 12px 0; + padding: 24px; + border: 1px dashed var(--border); + border-radius: var(--radius-md); + text-align: center; + color: var(--muted); +} + .sideNav { position: static; display: flex; @@ -1742,6 +1825,71 @@ details[open] > summary.sectionTitle::before { background: color-mix(in oklab, var(--primary) 25%, transparent); } +/* Log line classification colors */ +.logLine { + display: inline; +} + +.logError { + color: var(--danger); +} + +.logWarn { + color: var(--warning); +} + +.logSuccess { + color: var(--success); +} + +.logInfo { + color: var(--text); +} + +.logDebug { + color: var(--muted-soft); +} + +/* ==================== Skeleton placeholders ==================== */ +@keyframes skeletonShimmer { + 0% { background-position: -200% 0; } + 100% { background-position: 200% 0; } +} + +.skeleton { + position: relative; + overflow: hidden; + background: + linear-gradient(90deg, + transparent 0, + color-mix(in oklab, var(--text) 6%, transparent) 50%, + transparent 100%) var(--surface-muted); + background-size: 200% 100%; + background-repeat: no-repeat; + animation: skeletonShimmer 1.6s linear infinite; + border-radius: var(--radius-sm); + color: transparent !important; + user-select: none; + pointer-events: none; +} + +.skeleton * { + visibility: hidden; +} + +.skeletonText { + display: inline-block; + width: var(--skeleton-w, 60%); + height: 0.85em; + vertical-align: middle; +} + +@media (prefers-reduced-motion: reduce) { + .skeleton { + animation: none; + } +} + /* Global thin scrollbars */ * { scrollbar-width: thin; @@ -1769,6 +1917,143 @@ details[open] > summary.sectionTitle::before { background-clip: padding-box; } +/* ==================== Toast ==================== */ +.toastContainer { + position: fixed; + right: 20px; + bottom: 20px; + z-index: 100; + display: flex; + flex-direction: column; + gap: 8px; + max-width: min(420px, calc(100vw - 40px)); + pointer-events: none; +} + +.toast { + display: grid; + grid-template-columns: 18px 1fr auto; + align-items: start; + gap: 10px; + padding: 12px 12px 12px 14px; + border: 1px solid var(--border); + border-radius: var(--radius-md); + background: var(--surface); + color: var(--text); + font-size: var(--text-sm); + line-height: var(--leading-snug); + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08); + pointer-events: auto; + animation: toastIn 200ms cubic-bezier(0.2, 0.7, 0.2, 1); + position: relative; + overflow: hidden; +} + +:root[data-theme="dark"] .toast { + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4); +} + +.toast::before { + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 3px; + content: ""; + background: var(--muted-soft); +} + +.toast-success { + border-color: color-mix(in oklab, var(--success) 30%, var(--border)); +} +.toast-success::before { background: var(--success); } +.toast-success .toastIcon { color: var(--success); } + +.toast-error { + border-color: color-mix(in oklab, var(--danger) 30%, var(--border)); +} +.toast-error::before { background: var(--danger); } +.toast-error .toastIcon { color: var(--danger); } + +.toast-warn { + border-color: color-mix(in oklab, var(--warning) 30%, var(--border)); +} +.toast-warn::before { background: var(--warning); } +.toast-warn .toastIcon { color: var(--warning); } + +.toast-info::before { background: var(--primary); } +.toast-info .toastIcon { color: var(--primary); } + +.toastIcon { + display: inline-flex; + align-items: center; + justify-content: center; + width: 18px; + height: 18px; + margin-top: 1px; +} + +.toastIcon svg { + width: 18px; + height: 18px; +} + +.toastBody { + min-width: 0; + color: var(--text); + overflow-wrap: anywhere; +} + +.toastClose { + display: inline-flex; + align-items: center; + justify-content: center; + width: 22px; + height: 22px; + margin: -2px -2px 0 4px; + padding: 0; + border: 0; + border-radius: var(--radius-sm); + color: var(--muted-soft); + background: transparent; + cursor: pointer; + transition: background var(--motion-fast), color var(--motion-fast); +} + +.toastClose:hover { + color: var(--text); + background: var(--surface-muted); +} + +.toast.isLeaving { + animation: toastOut 220ms ease forwards; +} + +@keyframes toastIn { + from { opacity: 0; transform: translateY(8px); } + to { opacity: 1; transform: translateY(0); } +} + +@keyframes toastOut { + to { opacity: 0; transform: translateY(-4px); } +} + +@media (prefers-reduced-motion: reduce) { + .toast, + .toast.isLeaving { + animation: none; + } +} + +@media (max-width: 640px) { + .toastContainer { + right: 12px; + bottom: 12px; + left: 12px; + max-width: none; + } +} + @media (max-width: 900px) { :root { --page-pad: 14px; @@ -1793,6 +2078,24 @@ details[open] > summary.sectionTitle::before { justify-content: flex-start; } + .secondaryActions::before { + display: none; + } + + #btnTheme { + margin-left: auto; + } + + .workspaceHeader { + align-items: stretch; + flex-direction: column; + gap: var(--space-3); + } + + .workspaceSearch { + width: 100%; + } + .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); } @@ -1929,6 +2232,21 @@ details[open] > summary.sectionTitle::before { grid-template-columns: 1fr; } + .inline2 > .input, + .inline2 > input { + border-radius: var(--radius-md); + margin-left: 0; + } + + .workspaceHeader { + align-items: stretch; + flex-direction: column; + } + + .workspaceSearch { + width: 100%; + } + .statsGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } From 07700c24d909419ea7831c1db2c5a9e5ebcb0288 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:29:48 +0800 Subject: [PATCH 06/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=85=AD=E8=BD=AE=EF=BC=9A=E4=BA=A4=E4=BA=92=E7=B2=BE=E8=87=B4?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 配置搜索加 ⌘K / Ctrl+K 快捷键聚焦 + ESC 清空/失焦;右侧带 kbd 提示徽章(输入或聚焦时自动隐藏;移动端不显示);自动按平台显示 ⌘ 或 Ctrl - 按钮 .isBusy 状态加旋转 spinner(隐藏图标),禁用 pointer-events - 即将开奖预约(剩余 ≤60s)加 isImminent 类:warning 边框 + 微脉动 + value pill 反白;已到时间加 isDue(danger 边框 + 反白) - brand logo 重做:圆角方形容器 + 内嵌播放三角 + 装饰圆点,更具品牌识别度 - 侧边导航 active 指示条改为 sideNav::before 浮动滑块,CSS var 控制 Y/H,切换 tab 时 220ms 滑动;resize/字体加载完成自动重算位置;横向布局自动隐藏 - cache-bust v8 → v9 --- webui/app.js | 67 +++++++++++++++++++- webui/index.html | 14 ++-- webui/styles.css | 162 +++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 217 insertions(+), 26 deletions(-) diff --git a/webui/app.js b/webui/app.js index f083d0f..966d8ae 100644 --- a/webui/app.js +++ b/webui/app.js @@ -402,18 +402,61 @@ function initConfigSearch() { input.focus(); }); } + + // Platform-aware kbd hint label + const isMac = /Mac|iPhone|iPad|iPod/i.test(navigator.platform || navigator.userAgent || ""); + const kbdMod = $("configSearchKbdMod"); + if (kbdMod) kbdMod.textContent = isMac ? "⌘" : "Ctrl"; + + // ⌘K / Ctrl+K to focus, ESC to clear/blur + document.addEventListener("keydown", (e) => { + const mod = isMac ? e.metaKey : e.ctrlKey; + if (mod && e.key.toLowerCase() === "k") { + e.preventDefault(); + input.focus(); + input.select(); + return; + } + if (e.key === "Escape" && document.activeElement === input) { + if (input.value) { + input.value = ""; + apply(""); + } else { + input.blur(); + } + } + }); } function initTabs() { const tabButtons = Array.from(document.querySelectorAll(".tabBtn[data-target]")); const panels = Array.from(document.querySelectorAll(".panel[data-panel]")); + const sideNav = document.querySelector(".sideNav"); if (tabButtons.length === 0 || panels.length === 0) return; + const updateIndicator = (btn) => { + if (!sideNav || !btn || sideNav.offsetParent === null) return; + // 横向布局(移动端 row)下不绘制竖条 + const isRow = getComputedStyle(sideNav).flexDirection !== "column"; + if (isRow) { + sideNav.style.setProperty("--tab-indicator-opacity", "0"); + return; + } + const navRect = sideNav.getBoundingClientRect(); + const btnRect = btn.getBoundingClientRect(); + const top = (btnRect.top - navRect.top) + (btnRect.height - 16) / 2; + sideNav.style.setProperty("--tab-indicator-y", `${top}px`); + sideNav.style.setProperty("--tab-indicator-h", `16px`); + sideNav.style.setProperty("--tab-indicator-opacity", "1"); + }; + const setActive = (target) => { + let activeBtn = null; for (const btn of tabButtons) { const isActive = btn.dataset.target === target; btn.classList.toggle("active", isActive); btn.setAttribute("aria-selected", isActive ? "true" : "false"); + if (isActive) activeBtn = btn; } for (const panel of panels) { const isActive = panel.dataset.panel === target; @@ -421,6 +464,7 @@ function initTabs() { panel.classList.toggle("active", isActive); } document.body.dataset.activePanel = target || ""; + updateIndicator(activeBtn); }; for (const btn of tabButtons) { @@ -429,6 +473,22 @@ function initTabs() { const defaultTarget = tabButtons.find(b => b.classList.contains("active"))?.dataset.target || tabButtons[0].dataset.target; setActive(defaultTarget); + + // 窗口尺寸变化或字体加载完成时重新计算位置 + let resizeTimer; + window.addEventListener("resize", () => { + clearTimeout(resizeTimer); + resizeTimer = setTimeout(() => { + const cur = document.querySelector(".tabBtn.active[data-target]"); + if (cur) updateIndicator(cur); + }, 80); + }); + if (document.fonts && document.fonts.ready) { + document.fonts.ready.then(() => { + const cur = document.querySelector(".tabBtn.active[data-target]"); + if (cur) updateIndicator(cur); + }); + } } function classifyLogLine(line) { @@ -1439,12 +1499,15 @@ async function pollReservations() { reservations.forEach((item, idx) => { const card = document.createElement("div"); card.className = "reservationItem"; - + const now = Date.now() / 1000; const future_ts = item.future_ts || 0; const remain = Math.max(0, Math.floor(future_ts - now)); const remainStr = remain > 0 ? `${Math.floor(remain / 60)}分${remain % 60}秒后` : "已到开奖时间"; - + // 60s 内开奖:高亮提醒 + if (remain > 0 && remain <= 60) card.classList.add("isImminent"); + else if (remain === 0) card.classList.add("isDue"); + card.innerHTML = `
#${idx + 1} diff --git a/webui/index.html b/webui/index.html index 7a9e24a..d6ecc10 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,17 +15,18 @@ } catch (e) {} })(); - +
@@ -191,6 +192,7 @@ + @@ -1231,6 +1233,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index 5b964e2..1f5372b 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -266,8 +266,8 @@ svg { } .brandMark svg { - width: 18px; - height: 18px; + width: 22px; + height: 22px; } .title { @@ -358,7 +358,46 @@ svg { .btn.isBusy { cursor: progress; - opacity: 0.7; + opacity: 0.85; + pointer-events: none; + position: relative; +} + +.btn.isBusy .btnIcon { + visibility: hidden; +} + +.btn.isBusy::before { + position: absolute; + left: 12px; + top: 50%; + width: 14px; + height: 14px; + margin-top: -7px; + content: ""; + border-radius: 50%; + border: 2px solid currentColor; + border-top-color: transparent; + opacity: 0.85; + animation: btnSpin 720ms linear infinite; +} + +.btn.isBusy:not(:has(.btnIcon))::before { + position: relative; + left: 0; + top: 0; + margin: 0 6px 0 0; + display: inline-block; +} + +@keyframes btnSpin { + to { transform: rotate(360deg); } +} + +@media (prefers-reduced-motion: reduce) { + .btn.isBusy::before { + animation-duration: 2s; + } } .btn:focus-visible, @@ -808,7 +847,7 @@ svg { .workspaceSearch input { width: 100%; min-height: 32px; - padding: 0 30px 0 30px; + padding: 0 64px 0 30px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); color: var(--text); @@ -867,6 +906,38 @@ svg { background: var(--surface-muted); } +.workspaceSearchKbd { + position: absolute; + right: 30px; + top: 50%; + transform: translateY(-50%); + display: inline-flex; + align-items: center; + gap: 3px; + height: 18px; + padding: 0 5px; + border: 1px solid var(--border-strong); + border-radius: 4px; + background: var(--surface); + color: var(--muted); + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; + font-size: 10px; + letter-spacing: 0.04em; + pointer-events: none; + transition: opacity var(--motion-fast); +} + +.workspaceSearch:focus-within .workspaceSearchKbd, +.workspaceSearch input:not(:placeholder-shown) ~ .workspaceSearchKbd { + opacity: 0; +} + +@media (max-width: 640px) { + .workspaceSearchKbd { + display: none; + } +} + .row.isSearchHidden, .sectionTitle.isSearchHidden { display: none !important; @@ -895,6 +966,38 @@ svg { box-shadow: 0 1px 0 var(--hairline) inset; } +/* Floating active indicator: a thin vertical bar that slides between tabs. + Position is driven by --tab-indicator-y / --tab-indicator-h CSS vars + updated from JS whenever the active tab changes. */ +.sideNav { + position: relative; + --tab-indicator-y: 6px; + --tab-indicator-h: 14px; + --tab-indicator-opacity: 0; +} + +.sideNav::before { + position: absolute; + left: 4px; + top: var(--tab-indicator-y); + width: 2px; + height: var(--tab-indicator-h); + content: ""; + border-radius: 2px; + background: var(--primary); + opacity: var(--tab-indicator-opacity); + transition: top 220ms cubic-bezier(0.2, 0.7, 0.2, 1), + height 220ms cubic-bezier(0.2, 0.7, 0.2, 1), + opacity var(--motion-fast); + pointer-events: none; +} + +@media (prefers-reduced-motion: reduce) { + .sideNav::before { + transition: opacity var(--motion-fast); + } +} + .tabBtn { position: relative; display: flex; @@ -917,18 +1020,8 @@ svg { } .tabBtn::before { - position: absolute; - left: 4px; - top: 50%; - width: 2px; - height: 14px; - margin-top: -7px; - content: ""; - border-radius: 2px; - background: var(--primary); - opacity: 0; - transform: scaleY(0.4); - transition: opacity var(--motion-fast), transform var(--motion-fast); + /* Disabled: sideNav now owns the floating active indicator. */ + display: none; } .tabBtn:hover { @@ -943,8 +1036,7 @@ svg { } .tabBtn.active::before { - opacity: 1; - transform: scaleY(1); + display: none; } .tabIcon { @@ -1602,6 +1694,40 @@ select.input { box-shadow: var(--shadow-soft); } +.reservationItem.isImminent { + border-color: var(--warning); + background: color-mix(in oklab, var(--warning-soft) 60%, var(--surface)); + animation: imminentPulse 1.6s ease-in-out infinite; +} + +.reservationItem.isImminent .reservationValue { + border-color: var(--warning); + background: var(--warning); + color: var(--on-primary); +} + +.reservationItem.isDue { + border-color: var(--danger); + background: color-mix(in oklab, var(--danger-soft) 50%, var(--surface)); +} + +.reservationItem.isDue .reservationValue { + border-color: var(--danger); + background: var(--danger); + color: var(--on-primary); +} + +@keyframes imminentPulse { + 0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--warning) 35%, transparent); } + 50% { box-shadow: 0 0 0 6px transparent; } +} + +@media (prefers-reduced-motion: reduce) { + .reservationItem.isImminent { + animation: none; + } +} + .reservationHeader { display: flex; align-items: center; From 857b33f4137c515344d009cd46411d66948c2644 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:37:38 +0800 Subject: [PATCH 07/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E4=B8=83=E8=BD=AE=EF=BC=9A=E5=BA=95=E9=83=A8=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=A0=8F=20+=20=E5=AE=9E=E6=97=B6=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 底部 appFooter:左侧连接状态点(idle/ok/error 3 态 + tooltip)+ 文字;右侧版本号 + 构建标识;移动端纵向排列 - API 连接状态实时指示:apiGet/apiPost 拦截成功失败,连续 2 次失败才标 error,避免抖动 - 版本号:尝试拉 /api/version;失败时回退到 cache-bust tag - stat 数字变化时短暂闪 primary 色(statFlash 700ms),通过 setTextIfExists 自动触发 - number input 隐藏原生上下箭头 + tabular-nums 数字 - cache-bust v9 → v10 --- webui/app.js | 117 ++++++++++++++++++++++++++++++++++++++--------- webui/index.html | 15 +++++- webui/styles.css | 87 +++++++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+), 23 deletions(-) diff --git a/webui/app.js b/webui/app.js index 966d8ae..7c54853 100644 --- a/webui/app.js +++ b/webui/app.js @@ -428,6 +428,25 @@ function initConfigSearch() { }); } +function initFooter() { + // 版本号尝试从 /api/version 拿;拿不到就用 cache-bust 标识做 fallback + const verEl = document.getElementById("appFooterVersion"); + const buildEl = document.getElementById("appFooterBuild"); + (async () => { + try { + const data = await apiGet("/api/version"); + if (verEl && data?.version) verEl.textContent = "v" + data.version; + if (buildEl && data?.build) buildEl.textContent = data.build; + } catch (_) { + // fallback:从当前 script 的 cache-bust 提取 + const tag = (document.currentScript?.src || document.querySelector('script[src*="app.js"]')?.src || "") + .split("v=")[1] || ""; + if (verEl) verEl.textContent = tag ? tag.split("-").pop() : "—"; + if (buildEl) buildEl.textContent = "本地"; + } + })(); +} + function initTabs() { const tabButtons = Array.from(document.querySelectorAll(".tabBtn[data-target]")); const panels = Array.from(document.querySelectorAll(".panel[data-panel]")); @@ -698,7 +717,16 @@ function startShotPolling() { function setTextIfExists(id, text) { const el = $(id); if (!el) return; - el.textContent = String(text ?? "-"); + const next = String(text ?? "-"); + // 仅对 statValue 有效:值变化时短暂高亮 + if (el.classList.contains("statValue") && el.textContent !== next && next !== "-") { + el.classList.remove("isFlash"); + // 强制重排让动画重新触发 + void el.offsetWidth; + el.classList.add("isFlash"); + setTimeout(() => el.classList.remove("isFlash"), 700); + } + el.textContent = next; } function setButtonBusy(id, busy) { @@ -985,10 +1013,49 @@ function renderTimeline(containerId, timeline) { root.appendChild(legend); } +// API 连接状态:连续失败 N 次才算 error,避免轻微抖动闪烁 +let _apiFailStreak = 0; +const _apiFailThreshold = 2; +function setConnState(state) { + const dot = document.getElementById("appConnDot"); + const txt = document.getElementById("appConnText"); + if (!dot || !txt) return; + if (state === "ok") { + dot.dataset.state = "ok"; + txt.textContent = "已连接"; + dot.title = "API 通信正常"; + } else if (state === "error") { + dot.dataset.state = "error"; + txt.textContent = "连接异常"; + dot.title = "API 请求连续失败,检查后端是否运行"; + } else { + dot.dataset.state = "idle"; + txt.textContent = "就绪"; + dot.title = "等待首个 API 请求"; + } +} +function notifyApiOk() { + _apiFailStreak = 0; + setConnState("ok"); +} +function notifyApiFail() { + _apiFailStreak++; + if (_apiFailStreak >= _apiFailThreshold) setConnState("error"); +} + async function apiGet(path) { - const res = await fetch(path, { cache: "no-store" }); - if (!res.ok) throw new Error(await res.text()); - return await res.json(); + try { + const res = await fetch(path, { cache: "no-store" }); + if (!res.ok) { + notifyApiFail(); + throw new Error(await res.text()); + } + notifyApiOk(); + return await res.json(); + } catch (e) { + notifyApiFail(); + throw e; + } } // CSRF token 缓存 @@ -1008,24 +1075,31 @@ async function getCsrfToken() { } async function apiPost(path, body) { - const token = await getCsrfToken(); - const res = await fetch(path, { - method: "POST", - headers: { - "Content-Type": "application/json", - "X-CSRF-Token": token, - }, - body: JSON.stringify(body || {}), - }); - const data = await res.json(); - if (!res.ok) { - const errorMsg = data.error || data.message || res.statusText; - const error = new Error(errorMsg); - error.status = res.status; - error.data = data; - throw error; + try { + const token = await getCsrfToken(); + const res = await fetch(path, { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-CSRF-Token": token, + }, + body: JSON.stringify(body || {}), + }); + const data = await res.json(); + if (!res.ok) { + notifyApiFail(); + const errorMsg = data.error || data.message || res.statusText; + const error = new Error(errorMsg); + error.status = res.status; + error.data = data; + throw error; + } + notifyApiOk(); + return data; + } catch (e) { + notifyApiFail(); + throw e; } - return data; } async function refreshDevices() { @@ -1796,6 +1870,7 @@ window.addEventListener("DOMContentLoaded", async () => { initTheme(); initTabs(); initConfigSearch(); + initFooter(); // 首屏统计数字加骨架,待第一次 pollStats 成功后移除 document.querySelectorAll(".stat .statValue").forEach((el) => { if ((el.textContent || "").trim() === "-") el.classList.add("skeleton"); diff --git a/webui/index.html b/webui/index.html index d6ecc10..89a1a65 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1231,8 +1231,19 @@ +
+
+ + 就绪 +
+
+ v— + + — +
+
- + diff --git a/webui/styles.css b/webui/styles.css index 1f5372b..c12fb93 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -1249,6 +1249,20 @@ select.input { padding-right: 28px; } +/* Number inputs: hide native spinner everywhere, keep arrow keys */ +input[type="number"] { + -moz-appearance: textfield; + appearance: textfield; + font-variant-numeric: tabular-nums; +} + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + -webkit-appearance: none; + appearance: none; + margin: 0; +} + .textarea { min-height: 96px; padding: 9px 10px; @@ -1379,6 +1393,22 @@ select.input { letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; + transition: color var(--motion-fast); +} + +.statValue.isFlash { + animation: statFlash 700ms ease-out; +} + +@keyframes statFlash { + 0% { color: var(--primary); } + 100% { color: var(--text-strong); } +} + +@media (prefers-reduced-motion: reduce) { + .statValue.isFlash { + animation: none; + } } .statTrace { @@ -2043,6 +2073,63 @@ details[open] > summary.sectionTitle::before { background-clip: padding-box; } +/* ==================== App footer ==================== */ +.appFooter { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + margin-top: 18px; + padding: 10px 14px; + border-top: 1px solid var(--border); + color: var(--muted); + font-size: var(--text-xs); + letter-spacing: var(--tracking-wide); + text-transform: uppercase; +} + +.appFooterLeft, +.appFooterRight { + display: inline-flex; + align-items: center; + gap: 8px; +} + +.appConnDot { + width: 6px; + height: 6px; + border-radius: 50%; + background: var(--muted-soft); + box-shadow: 0 0 0 3px color-mix(in oklab, var(--muted-soft) 16%, transparent); +} + +.appConnDot[data-state="ok"] { + background: var(--success); + box-shadow: 0 0 0 3px color-mix(in oklab, var(--success) 16%, transparent); +} + +.appConnDot[data-state="error"] { + background: var(--danger); + box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 16%, transparent); + animation: statusPulse 2s ease-in-out infinite; +} + +.appConnText, +.appFooterMeta { + font-variant-numeric: tabular-nums; +} + +.appFooterDivider { + color: var(--muted-soft); +} + +@media (max-width: 640px) { + .appFooter { + flex-direction: column; + align-items: flex-start; + } +} + /* ==================== Toast ==================== */ .toastContainer { position: fixed; From d1f153b3736cb1bd37721591f96d355d5f23101e Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:44:24 +0800 Subject: [PATCH 08/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=85=AB=E8=BD=AE=EF=BC=9A=E5=8F=AF=E5=A4=8D=E5=88=B6=20+=20?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=20+=20=E8=A1=A8=E6=A0=BC=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - statValue 一键复制:PID 和 TraceId hover 显示复制按钮,点击调用 navigator.clipboard,带 toast 反馈与 fallback (textarea + execCommand) - setTextIfExists 改为只更新文本节点,保留子元素(如 .copyBtn 不被覆盖) - 截图区右上角加全屏按钮(hover 显示):调用 requestFullscreen,失败则新窗口打开;左下角浮层显示截图时间戳,毛玻璃背景 - 表格行:默认 ellipsis 截断,hover 时展开为多行换行 - cache-bust v10 → v11 --- webui/app.js | 85 ++++++++++++++++++++++++++++++++++++++-- webui/index.html | 8 +++- webui/styles.css | 100 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+), 6 deletions(-) diff --git a/webui/app.js b/webui/app.js index 7c54853..5c52cd1 100644 --- a/webui/app.js +++ b/webui/app.js @@ -447,6 +447,65 @@ function initFooter() { })(); } +function attachCopyButtons() { + // 给指定 statValue 元素绑定一键复制(hover 显示按钮,点击复制文本) + const ids = ["statPid", "statTraceId"]; + for (const id of ids) { + const el = document.getElementById(id); + if (!el || el.dataset.copyBound === "1") continue; + el.dataset.copyBound = "1"; + el.classList.add("hasCopy"); + const btn = document.createElement("button"); + btn.type = "button"; + btn.className = "copyBtn"; + btn.setAttribute("aria-label", "复制"); + btn.innerHTML = ''; + btn.addEventListener("click", async (e) => { + e.stopPropagation(); + const text = (el.textContent || "").trim(); + if (!text || text === "-") { + toast("暂无可复制内容", "warn", { duration: 1800 }); + return; + } + try { + await navigator.clipboard.writeText(text); + toast("已复制:" + (text.length > 24 ? text.slice(0, 24) + "…" : text), "success", { duration: 1800 }); + } catch (err) { + // fallback for non-secure context + const ta = document.createElement("textarea"); + ta.value = text; + ta.style.position = "fixed"; + ta.style.opacity = "0"; + document.body.appendChild(ta); + ta.select(); + try { document.execCommand("copy"); toast("已复制", "success", { duration: 1800 }); } + catch (_) { toast("复制失败", "error", { duration: 2400 }); } + document.body.removeChild(ta); + } + }); + el.appendChild(btn); + } +} + +function initShotFullscreen() { + const btn = document.getElementById("btnShotFullscreen"); + const img = document.getElementById("liveShot"); + if (!btn || !img) return; + btn.addEventListener("click", () => { + const target = img.closest(".preview") || img; + if (document.fullscreenElement) { + document.exitFullscreen?.(); + } else if (target.requestFullscreen) { + target.requestFullscreen().catch(() => { + // fallback:在新标签打开 + window.open(img.src, "_blank", "noopener"); + }); + } else { + window.open(img.src, "_blank", "noopener"); + } + }); +} + function initTabs() { const tabButtons = Array.from(document.querySelectorAll(".tabBtn[data-target]")); const panels = Array.from(document.querySelectorAll(".panel[data-panel]")); @@ -700,7 +759,13 @@ function startShotPolling() { img.addEventListener("load", () => { img.dataset.loading = "false"; if (preview) preview.classList.remove(UI_CLASS.shotEmpty); - if (status) status.textContent = `已更新:${new Date().toLocaleTimeString()}`; + const ts = new Date().toLocaleTimeString(); + if (status) status.textContent = `已更新:${ts}`; + const tsBadge = document.getElementById("liveShotTs"); + if (tsBadge) { + tsBadge.textContent = ts; + tsBadge.hidden = false; + } }); img.addEventListener("error", () => { img.dataset.loading = "false"; @@ -718,15 +783,25 @@ function setTextIfExists(id, text) { const el = $(id); if (!el) return; const next = String(text ?? "-"); + // 仅取文本节点(跳过子元素如 .copyBtn)来比较和读取当前值 + const getTextOnly = (node) => { + let s = ""; + for (const ch of node.childNodes) if (ch.nodeType === Node.TEXT_NODE) s += ch.textContent; + return s; + }; + const prev = getTextOnly(el); // 仅对 statValue 有效:值变化时短暂高亮 - if (el.classList.contains("statValue") && el.textContent !== next && next !== "-") { + if (el.classList.contains("statValue") && prev !== next && next !== "-") { el.classList.remove("isFlash"); - // 强制重排让动画重新触发 void el.offsetWidth; el.classList.add("isFlash"); setTimeout(() => el.classList.remove("isFlash"), 700); } - el.textContent = next; + // 替换:保留所有非文本子节点(如 .copyBtn),仅更新文本 + for (const ch of Array.from(el.childNodes)) { + if (ch.nodeType === Node.TEXT_NODE) ch.remove(); + } + el.insertBefore(document.createTextNode(next), el.firstChild || null); } function setButtonBusy(id, busy) { @@ -1871,6 +1946,8 @@ window.addEventListener("DOMContentLoaded", async () => { initTabs(); initConfigSearch(); initFooter(); + attachCopyButtons(); + initShotFullscreen(); // 首屏统计数字加骨架,待第一次 pollStats 成功后移除 document.querySelectorAll(".stat .statValue").forEach((el) => { if ((el.textContent || "").trim() === "-") el.classList.add("skeleton"); diff --git a/webui/index.html b/webui/index.html index 89a1a65..205822f 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1154,6 +1154,10 @@
实时截图预览 + +
等待截图
@@ -1244,6 +1248,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index c12fb93..e1d8e78 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -1396,6 +1396,44 @@ input[type="number"]::-webkit-outer-spin-button { transition: color var(--motion-fast); } +.statValue.hasCopy { + position: relative; + padding-right: 28px; +} + +.copyBtn { + position: absolute; + right: 4px; + top: 50%; + transform: translateY(-50%); + display: inline-flex; + align-items: center; + justify-content: center; + width: 22px; + height: 22px; + padding: 0; + border: 1px solid transparent; + border-radius: var(--radius-sm); + background: transparent; + color: var(--muted-soft); + cursor: pointer; + opacity: 0; + transition: opacity var(--motion-fast), color var(--motion-fast), + background var(--motion-fast), border-color var(--motion-fast); +} + +.statValue.hasCopy:hover .copyBtn, +.statValue.hasCopy:focus-within .copyBtn, +.copyBtn:focus-visible { + opacity: 1; +} + +.copyBtn:hover { + color: var(--text); + border-color: var(--border); + background: var(--surface-muted); +} + .statValue.isFlash { animation: statFlash 700ms ease-out; } @@ -1543,6 +1581,17 @@ input[type="number"]::-webkit-outer-spin-button { transition: background var(--motion-fast); } +.tableRow:not(.tableHead) > div:not(:last-child) { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.tableRow:not(.tableHead) > div:not(:last-child):hover { + white-space: normal; + overflow-wrap: anywhere; +} + .tableRow:not(.tableHead):hover { background: var(--surface-soft); } @@ -1659,6 +1708,57 @@ input[type="number"]::-webkit-outer-spin-button { transition: opacity var(--motion-slow); } +.previewTs { + position: absolute; + left: 8px; + bottom: 8px; + z-index: 2; + padding: 3px 7px; + border-radius: 99px; + background: color-mix(in oklab, var(--surface) 70%, transparent); + border: 1px solid var(--border); + color: var(--muted); + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; + font-size: 10px; + font-variant-numeric: tabular-nums; + letter-spacing: 0.02em; + pointer-events: none; + backdrop-filter: blur(8px); +} + +.previewFullscreen { + position: absolute; + right: 8px; + top: 8px; + z-index: 2; + display: inline-flex; + align-items: center; + justify-content: center; + width: 26px; + height: 26px; + padding: 0; + border: 1px solid var(--border); + border-radius: var(--radius-sm); + background: color-mix(in oklab, var(--surface) 70%, transparent); + color: var(--muted); + cursor: pointer; + opacity: 0; + backdrop-filter: blur(8px); + transition: opacity var(--motion-fast), color var(--motion-fast), + background var(--motion-fast), border-color var(--motion-fast); +} + +.preview:hover .previewFullscreen, +.previewFullscreen:focus-visible { + opacity: 1; +} + +.previewFullscreen:hover { + color: var(--text); + border-color: var(--hover-border); + background: var(--surface); +} + .preview img[src*="screenshot.png"][data-loading="false"] { opacity: 1; } From 0a2d67afb4854b21ad69f9663f2ca00c2a463ce5 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:46:31 +0800 Subject: [PATCH 09/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E4=B9=9D=E8=BD=AE=EF=BC=9Aoverview=20=E7=A6=8F=E8=A2=8B?= =?UTF-8?q?=E5=8D=A1=E8=BF=B7=E4=BD=A0=20sparkline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 福袋处理卡片底部加入 22px 高 sparkline,合成 fudai_open_detail + fudai_attend_ok 两条序列为一条折线 - 渐变填充 + 折线双层;用 currentColor 保证主题切换自动跟随;数据少于 2 点时隐藏 - pollStats 触发渲染,与主时间轴同源数据 - cache-bust v11 → v12 --- webui/app.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ webui/index.html | 5 +++-- webui/styles.css | 14 ++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/webui/app.js b/webui/app.js index 5c52cd1..3e35bf2 100644 --- a/webui/app.js +++ b/webui/app.js @@ -1118,6 +1118,63 @@ function notifyApiFail() { if (_apiFailStreak >= _apiFailThreshold) setConnState("error"); } +function renderOverviewSparkline(svgId, timeline) { + const svg = document.getElementById(svgId); + if (!svg) return; + // 把 fudai_open_detail + fudai_attend_ok 两个序列合成一条迷你折线 + const series = (timeline && timeline.series) || {}; + const keys = ["fudai_open_detail", "fudai_attend_ok"]; + const arrs = keys.map((k) => Array.isArray(series[k]) ? series[k] : []); + const len = Math.max(...arrs.map((a) => a.length), 0); + if (len < 2) { + svg.innerHTML = ""; + svg.classList.remove("hasData"); + return; + } + const combined = new Array(len).fill(0); + for (const arr of arrs) { + for (let i = 0; i < arr.length; i++) combined[i] += Number(arr[i]) || 0; + } + const maxY = Math.max(1, ...combined); + // 100x24 viewBox:留 1px 边 + const W = 100, H = 24, padY = 1.5; + const xAt = (i) => (W * i) / (len - 1); + const yAt = (v) => H - padY - ((H - padY * 2) * v) / maxY; + let d = ""; + for (let i = 0; i < len; i++) { + const x = xAt(i).toFixed(2), y = yAt(combined[i]).toFixed(2); + d += (i === 0 ? "M" : " L") + x + " " + y; + } + // 渐变填充区 + const dArea = d + ` L ${W} ${H} L 0 ${H} Z`; + const NS = "http://www.w3.org/2000/svg"; + svg.setAttribute("viewBox", `0 0 ${W} ${H}`); + svg.innerHTML = ""; + // gradient defs + const defs = document.createElementNS(NS, "defs"); + const gid = svgId + "Grad"; + const grad = document.createElementNS(NS, "linearGradient"); + grad.setAttribute("id", gid); + grad.setAttribute("x1", "0"); grad.setAttribute("y1", "0"); + grad.setAttribute("x2", "0"); grad.setAttribute("y2", "1"); + grad.innerHTML = ``; + defs.appendChild(grad); + svg.appendChild(defs); + const area = document.createElementNS(NS, "path"); + area.setAttribute("d", dArea); + area.setAttribute("fill", `url(#${gid})`); + svg.appendChild(area); + const line = document.createElementNS(NS, "path"); + line.setAttribute("d", d); + line.setAttribute("fill", "none"); + line.setAttribute("stroke", "currentColor"); + line.setAttribute("stroke-width", "1.25"); + line.setAttribute("stroke-linecap", "round"); + line.setAttribute("stroke-linejoin", "round"); + svg.appendChild(line); + svg.classList.add("hasData"); +} + async function apiGet(path) { try { const res = await fetch(path, { cache: "no-store" }); @@ -1912,6 +1969,7 @@ async function pollStats() { }; renderTimeline("chartTimeline", agg.timeline); + renderOverviewSparkline("topFudaiSparkline", agg.timeline); renderBars("chartSkipReason", agg.skip_reason || {}, reasonName); renderBars("chartSwitchReason", agg.switch_reason || {}, switchName); renderBars("chartValueBuckets", agg.value_buckets || {}); diff --git a/webui/index.html b/webui/index.html index 205822f..9d34664 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -116,6 +116,7 @@
福袋处理
0 / 0
打开详情 / 成功参与
+
日志缓存
@@ -1248,6 +1249,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index e1d8e78..f9dd96a 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -602,6 +602,20 @@ svg { overflow-wrap: anywhere; } +.overviewSpark { + display: block; + width: 100%; + height: 22px; + margin-top: 8px; + color: var(--primary); + opacity: 0; + transition: opacity var(--motion); +} + +.overviewSpark.hasData { + opacity: 0.8; +} + .statusDot { position: relative; flex: 0 0 8px; From 8b8e3129e5bf9a5f9a6037ee4b9de2b22bebef27 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:48:56 +0800 Subject: [PATCH 10/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E8=BD=AE=EF=BC=9A=E4=BA=A4=E4=BA=92=E7=BB=88=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - header 滚动时加 isScrolled 类:阴影提一档显得"浮起",区分内容区 - 键盘快捷键:⌘S/Ctrl+S 保存配置,⌘Enter/Ctrl+Enter 启动运行;尊重按钮 disabled 状态 - 通用 tooltip 系统:[data-tooltip] + 可选 data-tooltip-pos="bottom",带小箭头与毛玻璃;移动端禁用避免触摸浮悬 - btnTheme / btnShotFullscreen / 复制按钮 全部接入 tooltip - cache-bust v12 → v13 --- webui/app.js | 37 ++++++++++++++++++++ webui/index.html | 8 ++--- webui/styles.css | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 4 deletions(-) diff --git a/webui/app.js b/webui/app.js index 3e35bf2..dc7dc37 100644 --- a/webui/app.js +++ b/webui/app.js @@ -459,6 +459,8 @@ function attachCopyButtons() { btn.type = "button"; btn.className = "copyBtn"; btn.setAttribute("aria-label", "复制"); + btn.setAttribute("data-tooltip", "复制"); + btn.setAttribute("data-tooltip-pos", "bottom"); btn.innerHTML = ''; btn.addEventListener("click", async (e) => { e.stopPropagation(); @@ -487,6 +489,39 @@ function attachCopyButtons() { } } +function initKeyboardShortcuts() { + const isMac = /Mac|iPhone|iPad|iPod/i.test(navigator.platform || navigator.userAgent || ""); + document.addEventListener("keydown", (e) => { + const mod = isMac ? e.metaKey : e.ctrlKey; + if (!mod) return; + const key = e.key.toLowerCase(); + // ⌘S / Ctrl+S → 保存配置 + if (key === "s") { + e.preventDefault(); + const btn = document.getElementById("btnSave"); + if (btn && !btn.disabled) btn.click(); + return; + } + // ⌘Enter / Ctrl+Enter → 启动运行 + if (key === "enter") { + e.preventDefault(); + const btn = document.getElementById("btnStart"); + if (btn && !btn.disabled) btn.click(); + return; + } + }); +} + +function initHeaderScroll() { + const header = document.querySelector(".header"); + if (!header) return; + const onScroll = () => { + header.classList.toggle("isScrolled", window.scrollY > 8); + }; + window.addEventListener("scroll", onScroll, { passive: true }); + onScroll(); +} + function initShotFullscreen() { const btn = document.getElementById("btnShotFullscreen"); const img = document.getElementById("liveShot"); @@ -2006,6 +2041,8 @@ window.addEventListener("DOMContentLoaded", async () => { initFooter(); attachCopyButtons(); initShotFullscreen(); + initHeaderScroll(); + initKeyboardShortcuts(); // 首屏统计数字加骨架,待第一次 pollStats 成功后移除 document.querySelectorAll(".stat .statValue").forEach((el) => { if ((el.textContent || "").trim() === "-") el.classList.add("skeleton"); diff --git a/webui/index.html b/webui/index.html index 9d34664..bd0a727 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -86,7 +86,7 @@ 保存配置 -
@@ -1249,6 +1249,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index f9dd96a..8f5fa7f 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -231,6 +231,15 @@ svg { box-shadow: var(--shadow); backdrop-filter: blur(14px) saturate(1.1); animation: surfaceIn var(--motion-slow) both; + transition: box-shadow var(--motion), border-color var(--motion); +} + +.header.isScrolled { + box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08), 0 1px 0 var(--border) inset; +} + +:root[data-theme="dark"] .header.isScrolled { + box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.04) inset; } .header::before { @@ -2160,6 +2169,87 @@ details[open] > summary.sectionTitle::before { } } +/* ==================== Tooltip (data-tooltip) ==================== */ +[data-tooltip] { + position: relative; +} + +[data-tooltip]::before, +[data-tooltip]::after { + position: absolute; + left: 50%; + bottom: calc(100% + 8px); + transform: translateX(-50%) translateY(2px); + pointer-events: none; + opacity: 0; + transition: opacity 120ms ease, transform 120ms ease; + z-index: 50; +} + +[data-tooltip]::before { + content: attr(data-tooltip); + padding: 5px 8px; + border: 1px solid var(--border); + border-radius: var(--radius-sm); + background: var(--surface); + color: var(--text); + font-size: var(--text-xs); + font-weight: 500; + letter-spacing: 0; + text-transform: none; + white-space: nowrap; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); + backdrop-filter: blur(8px); +} + +:root[data-theme="dark"] [data-tooltip]::before { + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); +} + +[data-tooltip]::after { + content: ""; + width: 8px; + height: 8px; + bottom: calc(100% + 4px); + border: 1px solid var(--border); + border-top: 0; + border-left: 0; + background: var(--surface); + transform: translateX(-50%) rotate(45deg); +} + +[data-tooltip]:hover::before, +[data-tooltip]:hover::after, +[data-tooltip]:focus-visible::before, +[data-tooltip]:focus-visible::after { + opacity: 1; + transform: translateX(-50%) translateY(0); +} + +[data-tooltip]:hover::after, +[data-tooltip]:focus-visible::after { + transform: translateX(-50%) rotate(45deg); +} + +/* Position bottom (below the trigger) */ +[data-tooltip][data-tooltip-pos="bottom"]::before, +[data-tooltip][data-tooltip-pos="bottom"]::after { + bottom: auto; + top: calc(100% + 8px); +} + +[data-tooltip][data-tooltip-pos="bottom"]::after { + top: calc(100% + 4px); + border: 1px solid var(--border); + border-bottom: 0; + border-right: 0; +} + +@media (max-width: 640px) { + [data-tooltip]::before, + [data-tooltip]::after { display: none; } +} + /* Global thin scrollbars */ * { scrollbar-width: thin; From cdaa9e4c6956950fdbf5c72978b1c7316f545f56 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:53:33 +0800 Subject: [PATCH 11/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=B8=80=E8=BD=AE=EF=BC=9A=E4=BF=A1=E6=81=AF=E5=B1=82?= =?UTF-8?q?=E7=BA=A7=E4=B8=8E=E8=A7=86=E8=A7=89=E9=87=8D=E9=9F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - overview hero metric 字号 20→26px (text-2xl),紧字距,更接近 Vercel/Linear 的指标卡 - overviewLabel 改 10px uppercase,padding 提至 16/18px - stats 第一行(运行/PID/运行时长)拆为 statsGridHero + .statHero 大卡,与下方密集网格区分主次 - cardTitle 图标改 chip 风:26×26 圆角填充容器,primary-soft 底 + primary-border 描边 - sectionTitle 加左侧 4px primary 圆点 accent;cardTitle/summary 上的 sectionTitle 不显示 - cache-bust v13 → v14 --- webui/index.html | 15 ++++++---- webui/styles.css | 78 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 75 insertions(+), 18 deletions(-) diff --git a/webui/index.html b/webui/index.html index bd0a727..ce28b56 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -534,19 +534,22 @@
福袋中奖内容(最近10条)
-
-
+
+
运行状态
-
-
+
PID
-
-
+
运行时长
-
+
+ +
日志行数
-
@@ -1249,6 +1252,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index 8f5fa7f..5a1712d 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -537,7 +537,7 @@ svg { position: relative; overflow: hidden; min-width: 0; - padding: 14px 16px; + padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); @@ -549,8 +549,8 @@ svg { .overviewCard::before { position: absolute; left: 0; - top: 14px; - bottom: 14px; + top: 16px; + bottom: 16px; width: 2px; content: ""; border-radius: 0 2px 2px 0; @@ -580,24 +580,24 @@ svg { .overviewLabel { color: var(--muted); - font-size: var(--text-xs); + font-size: 10px; font-weight: 600; line-height: 1.3; - letter-spacing: var(--tracking-wide); + letter-spacing: 0.08em; text-transform: uppercase; } .overviewValue { display: flex; - align-items: center; + align-items: baseline; gap: 8px; min-width: 0; - margin-top: 8px; + margin-top: 10px; color: var(--text-strong); - font-size: var(--text-xl); + font-size: var(--text-2xl); font-weight: 600; - line-height: var(--leading-tight); - letter-spacing: var(--tracking-tight); + line-height: 1.1; + letter-spacing: -0.015em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } @@ -783,7 +783,7 @@ svg { .cardTitle { display: flex; align-items: center; - gap: 9px; + gap: 10px; min-width: 0; padding-bottom: 12px; border-bottom: 1px solid var(--border); @@ -791,6 +791,25 @@ svg { font-size: 15px; font-weight: 600; line-height: 1.25; + letter-spacing: var(--tracking-tight); +} + +.cardTitle .sectionIcon { + display: inline-flex; + align-items: center; + justify-content: center; + flex: 0 0 26px; + width: 26px; + height: 26px; + border: 1px solid var(--primary-border); + border-radius: var(--radius-sm); + background: var(--primary-soft); + color: var(--primary); +} + +.cardTitle .sectionIcon svg { + width: 14px; + height: 14px; } .sectionIcon { @@ -1113,7 +1132,7 @@ svg { align-items: center; gap: 8px; min-width: 0; - margin: 20px 0 10px; + margin: 22px 0 12px; padding: 6px 0 8px; color: var(--muted); font-size: 11px; @@ -1124,6 +1143,21 @@ svg { border-bottom: 1px solid var(--border); } +.sectionTitle::before { + width: 4px; + height: 4px; + flex: 0 0 4px; + border-radius: 50%; + background: var(--primary); + content: ""; + opacity: 0.7; +} + +.cardTitle.sectionTitle::before, +summary.sectionTitle::before { + display: none; +} + .panel > .sectionTitle:first-child { margin-top: 0; } @@ -1383,6 +1417,26 @@ input[type="number"]::-webkit-outer-spin-button { margin-top: 12px; } +.statsGridHero { + grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); + gap: 12px; + margin-bottom: 4px; +} + +.statHero { + padding: 18px 20px; + border-color: var(--border-strong); +} + +.statHero .statLabel { + font-size: 11px; +} + +.statHero .statValue { + font-size: var(--text-2xl); + letter-spacing: -0.015em; +} + .stat { min-width: 0; padding: 14px; From 3295cb3d6f086fce07da0fdcc10454d9863fc577 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:55:41 +0800 Subject: [PATCH 12/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=BA=8C=E8=BD=AE=EF=BC=9A=E8=B4=A8=E6=84=9F=E6=89=93?= =?UTF-8?q?=E7=A3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - brandMark 改为三档 OKLCH 渐变 + 高光 radial-gradient + hover 微浮起 - tabBtn hover 与 active 用 surface-muted ↔ primary-soft 混合,更稳的层级感 - footer 连接点 ok 状态加涟漪扩散动画(footerRipple) - logSection: 圆角 v-md / hover border 提亮 / logHeader 渐变背景 / logTitle 加 4px 圆点 / logHeaderActions select 自绘箭头适配紧凑高度 - cache-bust v14 → v15 --- webui/index.html | 4 +-- webui/styles.css | 84 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/webui/index.html b/webui/index.html index ce28b56..00d583c 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1252,6 +1252,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index 5a1712d..c49e2e9 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -269,9 +269,24 @@ svg { width: 38px; height: 38px; color: var(--on-primary); - background: linear-gradient(135deg, var(--primary), color-mix(in oklab, var(--primary) 70%, #000 30%)); + background: linear-gradient(135deg, var(--primary-hover), var(--primary) 55%, color-mix(in oklab, var(--primary) 65%, #000 35%)); border-radius: var(--radius-md); - box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(94, 106, 210, 0.3); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 1px 2px rgba(94, 106, 210, 0.32); + transition: transform var(--motion), box-shadow var(--motion); +} + +.brandMark::after { + position: absolute; + inset: 0; + content: ""; + pointer-events: none; + background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 55%); + opacity: 0.7; +} + +.brandBlock:hover .brandMark { + transform: translateY(-1px); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 4px 10px rgba(94, 106, 210, 0.35); } .brandMark svg { @@ -1045,11 +1060,11 @@ svg { display: flex; align-items: center; justify-content: flex-start; - gap: 9px; + gap: 10px; width: 100%; min-width: 0; min-height: 36px; - padding: 0 10px 0 12px; + padding: 0 12px 0 14px; border: 1px solid transparent; border-radius: var(--radius-md); color: var(--muted); @@ -1058,6 +1073,7 @@ svg { font-weight: 500; text-align: left; white-space: nowrap; + letter-spacing: var(--tracking-tight); transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast); } @@ -1068,12 +1084,12 @@ svg { .tabBtn:hover { color: var(--text); - background: var(--surface-muted); + background: color-mix(in oklab, var(--surface-muted) 80%, var(--primary-soft) 20%); } .tabBtn.active { color: var(--text-strong); - background: var(--surface-muted); + background: color-mix(in oklab, var(--surface-muted) 60%, var(--primary-soft) 40%); box-shadow: none; } @@ -2066,9 +2082,13 @@ details[open] > summary.sectionTitle::before { min-width: 0; overflow: hidden; border: 1px solid var(--border); - border-radius: var(--radius); + border-radius: var(--radius-md); background: var(--surface); - box-shadow: 0 1px 0 var(--hairline) inset; + transition: border-color var(--motion-fast); +} + +.logSection:hover { + border-color: var(--hover-border); } .logHeader { @@ -2077,16 +2097,30 @@ details[open] > summary.sectionTitle::before { justify-content: space-between; gap: 10px; min-width: 0; - padding: 10px; + padding: 10px 12px; border-bottom: 1px solid var(--border); - background: var(--surface-soft); + background: linear-gradient(180deg, var(--surface-soft), var(--surface)); } .logTitle { + display: inline-flex; + align-items: center; + gap: 8px; color: var(--text-strong); font-size: 13px; font-weight: 600; white-space: nowrap; + letter-spacing: var(--tracking-tight); +} + +.logTitle::before { + width: 4px; + height: 4px; + flex: 0 0 4px; + border-radius: 50%; + background: var(--primary); + content: ""; + opacity: 0.7; } .logHeaderActions { @@ -2094,16 +2128,22 @@ details[open] > summary.sectionTitle::before { align-items: center; justify-content: flex-end; flex-wrap: wrap; - gap: 7px; + gap: 6px; min-width: 0; } .logHeaderActions .small { width: auto; - min-height: 30px; + min-height: 28px; + padding: 0 10px; font-size: 12px; } +.logHeaderActions select.small { + background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; + padding-right: 24px; +} + .logSearchBox { width: 230px; min-height: 30px; @@ -2354,6 +2394,7 @@ details[open] > summary.sectionTitle::before { } .appConnDot { + position: relative; width: 6px; height: 6px; border-radius: 50%; @@ -2366,12 +2407,31 @@ details[open] > summary.sectionTitle::before { box-shadow: 0 0 0 3px color-mix(in oklab, var(--success) 16%, transparent); } +.appConnDot[data-state="ok"]::after { + position: absolute; + inset: -4px; + content: ""; + border-radius: 50%; + border: 1px solid var(--success); + opacity: 0.5; + animation: footerRipple 2.4s ease-out infinite; +} + .appConnDot[data-state="error"] { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 16%, transparent); animation: statusPulse 2s ease-in-out infinite; } +@keyframes footerRipple { + 0% { transform: scale(0.8); opacity: 0.6; } + 100% { transform: scale(2.0); opacity: 0; } +} + +@media (prefers-reduced-motion: reduce) { + .appConnDot[data-state="ok"]::after { animation: none; } +} + .appConnText, .appFooterMeta { font-variant-numeric: tabular-nums; From a40ddc308300798c0e87daeec55bf55b883f75e1 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 00:58:54 +0800 Subject: [PATCH 13/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=B8=89=E8=BD=AE=EF=BC=9A=E5=8A=A8=E6=95=88=E3=80=81?= =?UTF-8?q?=E8=AF=AD=E4=B9=89=E7=9D=80=E8=89=B2=E4=B8=8E=E5=B8=AE=E5=8A=A9?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - panel 切换动画:active 加 fadeIn (220ms) 替换无差别 surfaceIn,tab 切换更有反馈 - statValue 加 stateOk/stateMuted/stateError 语义着色:运行中显示 success 色(hero metric),未运行用 muted - 预约卡倒计时实时刷新:startReservationsCountdownTick 每秒 tick,更新 .reservationRemain 文字 + isImminent/isDue 类,无需等 stats 轮询 - ? 快捷键弹出帮助 overlay:列出 ⌘K/⌘S/⌘Enter/Esc/?;ESC 或点击遮罩关闭;带毛玻璃 + scale 进出动画;输入框聚焦时不拦截 - cache-bust v15 → v16 --- webui/app.js | 89 +++++++++++++++++++++++++- webui/index.html | 4 +- webui/styles.css | 163 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 252 insertions(+), 4 deletions(-) diff --git a/webui/app.js b/webui/app.js index dc7dc37..5634299 100644 --- a/webui/app.js +++ b/webui/app.js @@ -541,6 +541,84 @@ function initShotFullscreen() { }); } +function initShortcutsHelp() { + const isMac = /Mac|iPhone|iPad|iPod/i.test(navigator.platform || navigator.userAgent || ""); + const mod = isMac ? "⌘" : "Ctrl"; + let overlay = null; + const ITEMS = [ + { keys: [mod, "K"], desc: "聚焦配置搜索" }, + { keys: [mod, "S"], desc: "保存配置" }, + { keys: [mod, "Enter"], desc: "开始运行" }, + { keys: ["Esc"], desc: "清空搜索 / 关闭弹层" }, + { keys: ["?"], desc: "显示此帮助" }, + ]; + const open = () => { + if (overlay) return; + overlay = document.createElement("div"); + overlay.className = "shortcutsOverlay"; + overlay.innerHTML = ` + + `; + document.body.appendChild(overlay); + requestAnimationFrame(() => overlay.classList.add("isVisible")); + overlay.addEventListener("click", (e) => { + if (e.target === overlay || e.target.closest(".shortcutsClose")) close(); + }); + }; + const close = () => { + if (!overlay) return; + overlay.classList.remove("isVisible"); + const ref = overlay; + setTimeout(() => { try { ref.remove(); } catch (_) {} }, 160); + overlay = null; + }; + document.addEventListener("keydown", (e) => { + // 输入框聚焦时不拦截 ? 字符 + const inField = /^(INPUT|TEXTAREA|SELECT)$/i.test(document.activeElement?.tagName || ""); + if (e.key === "?" && !inField && !e.metaKey && !e.ctrlKey) { + e.preventDefault(); + overlay ? close() : open(); + return; + } + if (e.key === "Escape" && overlay) { + e.preventDefault(); + close(); + } + }); +} + +function startReservationsCountdownTick() { + // 每秒 tick 更新预约卡倒计时与高亮类,无需等待 stats 轮询 + setInterval(() => { + const items = document.querySelectorAll(".reservationItem[data-future-ts]"); + if (!items.length) return; + const now = Date.now() / 1000; + items.forEach((card) => { + const fut = Number(card.dataset.futureTs) || 0; + if (!fut) return; + const remain = Math.max(0, Math.floor(fut - now)); + const remainEl = card.querySelector(".reservationRemain"); + if (remainEl) { + remainEl.textContent = remain > 0 + ? `${Math.floor(remain / 60)}分${remain % 60}秒后` + : "已到开奖时间"; + } + card.classList.toggle("isImminent", remain > 0 && remain <= 60); + card.classList.toggle("isDue", remain === 0); + }); + }, 1000); +} + function initTabs() { const tabButtons = Array.from(document.querySelectorAll(".tabBtn[data-target]")); const panels = Array.from(document.querySelectorAll(".panel[data-panel]")); @@ -1748,6 +1826,8 @@ async function pollReservations() { // 60s 内开奖:高亮提醒 if (remain > 0 && remain <= 60) card.classList.add("isImminent"); else if (remain === 0) card.classList.add("isDue"); + // 把 future_ts 存到卡片,供倒计时 tick 实时刷新 + if (future_ts) card.dataset.futureTs = String(future_ts); card.innerHTML = `
@@ -1757,7 +1837,7 @@ async function pollReservations() {
内容:${escapeHtml(item.content || '-')}
开奖时间:${item.future_str || '-'}
-
剩余时间:${remainStr}
+
剩余时间:${remainStr}
发现位置:${item.pos_seen || 0}
直播间(清洗后):${escapeHtml(item.room_title || '-')}
直播间原文:${escapeHtml(item.room_title_raw || '-')}
@@ -1898,6 +1978,11 @@ async function pollStats() { document.querySelectorAll(".stat .statValue.skeleton, .stat .statHint.skeleton").forEach((el) => el.classList.remove("skeleton")); const running = s.running ? "运行中" : "未运行"; setTextIfExists("statRunning", running); + const runningEl = document.getElementById("statRunning"); + if (runningEl) { + runningEl.classList.toggle("stateOk", !!s.running); + runningEl.classList.toggle("stateMuted", !s.running); + } setTextIfExists("statPid", s.pid ?? "-"); setTextIfExists("statUptime", fmtDuration(s.uptime_seconds)); setTextIfExists("statLogLen", s.log_len ?? "-"); @@ -2043,6 +2128,8 @@ window.addEventListener("DOMContentLoaded", async () => { initShotFullscreen(); initHeaderScroll(); initKeyboardShortcuts(); + initShortcutsHelp(); + startReservationsCountdownTick(); // 首屏统计数字加骨架,待第一次 pollStats 成功后移除 document.querySelectorAll(".stat .statValue").forEach((el) => { if ((el.textContent || "").trim() === "-") el.classList.add("skeleton"); diff --git a/webui/index.html b/webui/index.html index 00d583c..0857616 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1252,6 +1252,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index c49e2e9..2f5104b 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -1132,7 +1132,21 @@ svg { border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); - animation: surfaceIn var(--motion-slow) both; +} + +.panel.active { + animation: panelFadeIn 220ms cubic-bezier(0.2, 0.7, 0.2, 1); +} + +@keyframes panelFadeIn { + from { opacity: 0; transform: translateY(4px); } + to { opacity: 1; transform: translateY(0); } +} + +@media (prefers-reduced-motion: reduce) { + .panel.active { + animation: none; + } } .panel.cardLog { @@ -1489,6 +1503,18 @@ input[type="number"]::-webkit-outer-spin-button { transition: color var(--motion-fast); } +.statValue.stateOk { + color: var(--success); +} + +.statValue.stateMuted { + color: var(--muted); +} + +.statValue.stateError { + color: var(--danger); +} + .statValue.hasCopy { position: relative; padding-right: 28px; @@ -2371,6 +2397,141 @@ details[open] > summary.sectionTitle::before { background-clip: padding-box; } +/* ==================== Shortcuts help overlay ==================== */ +.shortcutsOverlay { + position: fixed; + inset: 0; + z-index: 90; + display: flex; + align-items: center; + justify-content: center; + padding: 24px; + background: color-mix(in oklab, var(--bg) 70%, transparent); + backdrop-filter: blur(6px); + opacity: 0; + transition: opacity 160ms ease; +} + +.shortcutsOverlay.isVisible { + opacity: 1; +} + +.shortcutsCard { + width: min(420px, 100%); + border: 1px solid var(--border); + border-radius: var(--radius-lg); + background: var(--surface); + box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.1); + overflow: hidden; + transform: translateY(8px) scale(0.98); + transition: transform 200ms cubic-bezier(0.2, 0.7, 0.2, 1); +} + +:root[data-theme="dark"] .shortcutsCard { + box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.5); +} + +.shortcutsOverlay.isVisible .shortcutsCard { + transform: translateY(0) scale(1); +} + +.shortcutsHeader { + display: flex; + align-items: center; + justify-content: space-between; + padding: 12px 14px 10px; + border-bottom: 1px solid var(--border); + background: var(--surface-soft); +} + +.shortcutsTitle { + font-size: 13px; + font-weight: 600; + color: var(--text-strong); + letter-spacing: var(--tracking-tight); +} + +.shortcutsClose { + display: inline-flex; + align-items: center; + justify-content: center; + width: 24px; + height: 24px; + padding: 0; + border: 0; + border-radius: var(--radius-sm); + color: var(--muted); + background: transparent; + cursor: pointer; + transition: color var(--motion-fast), background var(--motion-fast); +} + +.shortcutsClose:hover { + color: var(--text); + background: var(--surface-muted); +} + +.shortcutsList { + display: grid; + gap: 2px; + padding: 8px; +} + +.shortcutsRow { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + padding: 8px 10px; + border-radius: var(--radius-sm); + font-size: var(--text-sm); + color: var(--text); +} + +.shortcutsRow:hover { + background: var(--surface-soft); +} + +.shortcutsDesc { + color: var(--text); +} + +.shortcutsKeys { + display: inline-flex; + align-items: center; + gap: 4px; +} + +.shortcutsKeys kbd { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 22px; + height: 22px; + padding: 0 6px; + border: 1px solid var(--border-strong); + border-bottom-width: 2px; + border-radius: 5px; + background: var(--surface); + color: var(--text-strong); + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; + font-size: 11px; + letter-spacing: 0.04em; +} + +.shortcutsPlus { + color: var(--muted-soft); + font-size: 10px; + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; +} + +@media (prefers-reduced-motion: reduce) { + .shortcutsOverlay, + .shortcutsCard { + transition: none; + } +} + /* ==================== App footer ==================== */ .appFooter { display: flex; From 16042d7fd2102ade19c57cb5f78349a822728be8 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 01:09:31 +0800 Subject: [PATCH 14/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E5=9B=9B=E8=BD=AE=EF=BC=9A=E8=BF=87=E6=B8=A1=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E4=B8=8E=E7=A7=BB=E5=8A=A8=E7=AB=AF=E6=94=B6=E6=95=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 主题切换平滑:body 加 200ms color/background 过渡;切换时给 :root 临时加 isThemeSwitching,对所有 chrome 表面(header / card / panel / btn 等 18 类)启用 200ms 过渡;260ms 后移除避免长期影响 - 首屏 .app 容器淡入:220ms fadeIn + 微移 - 移动端 (<640) 收敛:subtitle 隐藏(保留 brandMark + title);footer appConnText 隐藏只留状态点 - cache-bust v16 → v17 --- webui/app.js | 2 ++ webui/index.html | 4 ++-- webui/styles.css | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/webui/app.js b/webui/app.js index 5634299..45d15a9 100644 --- a/webui/app.js +++ b/webui/app.js @@ -240,7 +240,9 @@ function initTheme() { btn.addEventListener("click", () => { const next = root.getAttribute("data-theme") === "dark" ? "light" : "dark"; try { localStorage.setItem("ui-theme", next); } catch (_) {} + root.classList.add("isThemeSwitching"); apply(next); + setTimeout(() => root.classList.remove("isThemeSwitching"), 260); }); } diff --git a/webui/index.html b/webui/index.html index 0857616..92d02a8 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1252,6 +1252,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index 2f5104b..389a540 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -172,6 +172,31 @@ body { letter-spacing: -0.005em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; + transition: color 200ms ease, background-color 200ms ease; +} + +/* When toggling theme, briefly enable transitions on common chrome surfaces. + The .isThemeSwitching class is added by JS for ~250ms during the toggle. */ +:root.isThemeSwitching .header, +:root.isThemeSwitching .card, +:root.isThemeSwitching .panel, +:root.isThemeSwitching .overviewCard, +:root.isThemeSwitching .stat, +:root.isThemeSwitching .btn, +:root.isThemeSwitching .input, +:root.isThemeSwitching .check, +:root.isThemeSwitching .tabBtn, +:root.isThemeSwitching .table, +:root.isThemeSwitching .tableRow, +:root.isThemeSwitching .logSection, +:root.isThemeSwitching .log, +:root.isThemeSwitching .preview, +:root.isThemeSwitching .reservationItem, +:root.isThemeSwitching .chartBlock, +:root.isThemeSwitching .toast, +:root.isThemeSwitching .appFooter, +:root.isThemeSwitching .workspaceHeader { + transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease !important; } @keyframes surfaceIn { @@ -214,6 +239,16 @@ svg { width: min(var(--page-max), 100%); margin: 0 auto; padding: var(--page-pad); + animation: appFadeIn 220ms ease both; +} + +@keyframes appFadeIn { + from { opacity: 0; transform: translateY(2px); } + to { opacity: 1; transform: translateY(0); } +} + +@media (prefers-reduced-motion: reduce) { + .app { animation: none; } } .header { @@ -2841,6 +2876,14 @@ details[open] > summary.sectionTitle::before { --overview-gap: 8px; } + .subtitle { + display: none; + } + + .appConnText { + display: none; + } + .app { padding: var(--page-pad); } From 94e8d37d18d5d070eb2a1d2b8c18f7afe583d8b2 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 01:18:12 +0800 Subject: [PATCH 15/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=BA=94=E8=BD=AE=EF=BC=9A=E8=AE=BE=E5=A4=87=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E7=8A=B6=E6=80=81=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - decorateDeviceSelect: 把 #device select 包裹进 .deviceSelectWrap,在右侧自定义箭头之前插入状态点 - 状态点:选中具体设备或自动模式下有在线设备 → 绿色 ok;无设备 → 灰色 idle;refreshDevices/change 时更新 - cache-bust v17 → v18 --- webui/app.js | 26 ++++++++++++++++++++++++++ webui/index.html | 4 ++-- webui/styles.css | 28 ++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/webui/app.js b/webui/app.js index 45d15a9..29e07d5 100644 --- a/webui/app.js +++ b/webui/app.js @@ -1370,6 +1370,32 @@ async function refreshDevices() { $("adbStatus").textContent = data.adb ? `adb: ${data.adb}` : "未找到 adb.exe(请安装 platform-tools)"; deviceOverviewState = { devices, adb: data.adb || "" }; updateDeviceOverview(); + + // 选中后在外层包装上反映状态点 + decorateDeviceSelect(); + sel.addEventListener("change", decorateDeviceSelect); +} + +function decorateDeviceSelect() { + const sel = document.getElementById("device"); + if (!sel) return; + const wrap = sel.closest(".deviceSelectWrap") || (() => { + const w = document.createElement("div"); + w.className = "deviceSelectWrap"; + sel.parentNode.insertBefore(w, sel); + w.appendChild(sel); + const dot = document.createElement("span"); + dot.className = "deviceSelectDot"; + dot.setAttribute("aria-hidden", "true"); + w.appendChild(dot); + return w; + })(); + const dot = wrap.querySelector(".deviceSelectDot"); + const hasDevices = (deviceOverviewState.devices || []).length > 0; + const selected = sel.value; + // 选中具体设备 → 绿;选 auto + 有在线设备 → 绿;无设备 → 灰 + const ok = !!(selected || hasDevices); + if (dot) dot.dataset.state = ok ? "ok" : "idle"; } function getConfigBoundElements() { diff --git a/webui/index.html b/webui/index.html index 92d02a8..ce56e02 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1252,6 +1252,6 @@
- + diff --git a/webui/styles.css b/webui/styles.css index 389a540..a10ea1a 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -2324,6 +2324,34 @@ details[open] > summary.sectionTitle::before { } } +/* Device select wrapper with status dot */ +.deviceSelectWrap { + position: relative; + display: block; +} + +.deviceSelectWrap select { + padding-right: 40px; +} + +.deviceSelectDot { + position: absolute; + right: 28px; + top: 50%; + transform: translateY(-50%); + width: 6px; + height: 6px; + border-radius: 50%; + background: var(--muted-soft); + box-shadow: 0 0 0 2px color-mix(in oklab, var(--muted-soft) 16%, transparent); + pointer-events: none; +} + +.deviceSelectDot[data-state="ok"] { + background: var(--success); + box-shadow: 0 0 0 2px color-mix(in oklab, var(--success) 16%, transparent); +} + /* ==================== Tooltip (data-tooltip) ==================== */ [data-tooltip] { position: relative; From 51d8d53a2b902c74f68a3df271f9c1196d66dfc1 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 08:49:21 +0800 Subject: [PATCH 16/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E5=85=AD=E8=BD=AE=EF=BC=9A=E6=BB=9A=E5=8A=A8=E9=A1=B6?= =?UTF-8?q?=E6=8C=89=E9=92=AE=20/=20=E8=BF=9E=E4=BD=93=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=BB=84=20/=20=E5=9B=BE=E8=A1=A8=20hover=20/=20=E5=BE=BD?= =?UTF-8?q?=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 滚动 floating 按钮:scrollY > 240 时右下方显示,毛玻璃圆形,平滑滚回顶部;移动端调高避让 toast - WiFi ADB 操作改 .btnGroup 连体组合:共享圆角、中间无双边、focus z-index 抬起 - timeline 图加 hover 十字线 + tooltip:crosshair 跟随光标 snap 到最近 bin,浮层显示该 bin 的所有系列与时间,无事件显示空状态 - tabBtn[data-badge] 数字徽章:active 时反色 primary;预约数据更新时同步预约 tab 的徽章 - cache-bust v18 → v19 --- webui/app.js | 96 ++++++++++++++++++++++++++++++- webui/index.html | 16 ++++-- webui/styles.css | 144 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 248 insertions(+), 8 deletions(-) diff --git a/webui/app.js b/webui/app.js index 29e07d5..a7ea931 100644 --- a/webui/app.js +++ b/webui/app.js @@ -516,11 +516,17 @@ function initKeyboardShortcuts() { function initHeaderScroll() { const header = document.querySelector(".header"); - if (!header) return; + const scrollTop = document.getElementById("btnScrollTop"); const onScroll = () => { - header.classList.toggle("isScrolled", window.scrollY > 8); + if (header) header.classList.toggle("isScrolled", window.scrollY > 8); + if (scrollTop) scrollTop.toggleAttribute("hidden", window.scrollY < 240); }; window.addEventListener("scroll", onScroll, { passive: true }); + if (scrollTop) { + scrollTop.addEventListener("click", () => { + window.scrollTo({ top: 0, behavior: "smooth" }); + }); + } onScroll(); } @@ -599,6 +605,14 @@ function initShortcutsHelp() { }); } +function updateTabBadge(target, count) { + const btn = document.querySelector(`.tabBtn[data-target="${target}"]`); + if (!btn) return; + const n = Math.max(0, Number(count) || 0); + if (n > 0) btn.setAttribute("data-badge", n > 99 ? "99+" : String(n)); + else btn.removeAttribute("data-badge"); +} + function startReservationsCountdownTick() { // 每秒 tick 更新预约卡倒计时与高亮类,无需等待 stats 轮询 setInterval(() => { @@ -1195,11 +1209,85 @@ function renderTimeline(containerId, timeline) { svg.appendChild(p); } + // Crosshair hover layer:垂直线 + 当前 bin 的 dot 圆 + tooltip + const NS = "http://www.w3.org/2000/svg"; + const crossLine = document.createElementNS(NS, "line"); + crossLine.setAttribute("y1", String(padT)); + crossLine.setAttribute("y2", String(H - padB)); + crossLine.setAttribute("stroke", "var(--text)"); + crossLine.setAttribute("stroke-opacity", "0.25"); + crossLine.setAttribute("stroke-dasharray", "2 3"); + crossLine.setAttribute("pointer-events", "none"); + crossLine.setAttribute("visibility", "hidden"); + svg.appendChild(crossLine); + // 容器(外层 root)作为相对定位锚点 + root.style.position = "relative"; + + const tip = document.createElement("div"); + tip.className = "timelineTip"; + tip.hidden = true; + root.appendChild(tip); + + const fmtTimeOf = (i) => { + if (!startTs || !binSec) return ""; + try { return new Date((startTs + i * binSec) * 1000).toLocaleTimeString(); } catch { return ""; } + }; + const SERIES_LABEL = { + fudai_open_detail: "打开详情", + fudai_attend_ok: "参与成功", + fudai_attend_fail: "参与失败", + fudai_result_win: "中奖", + fudai_result_no_win: "未中奖", + fudai_skip: "跳过", + switch_room: "切换直播间", + }; + + const onMove = (ev) => { + const rect = svg.getBoundingClientRect(); + const xRatio = (ev.clientX - rect.left) / rect.width; + if (xRatio < 0 || xRatio > 1) return; + const xCoord = padL + (W - padL - padR) * xRatio; + // 找最近的 bin + let i = Math.round(((xCoord - padL) / Math.max(1, W - padL - padR)) * (bins - 1)); + if (i < 0) i = 0; else if (i >= bins) i = bins - 1; + const xOnAxis = xAt(i); + crossLine.setAttribute("x1", String(xOnAxis)); + crossLine.setAttribute("x2", String(xOnAxis)); + crossLine.setAttribute("visibility", "visible"); + + // 生成 tip 内容 + const lines = []; + let total = 0; + for (const k of TIMELINE_SERIES_KEYS) { + const arr = Array.isArray(series[k]) ? series[k] : []; + const v = Number(arr[i]) || 0; + total += v; + if (v > 0) lines.push(`${SERIES_LABEL[k] || k}${v}`); + } + if (total === 0) lines.push(`无事件`); + tip.innerHTML = `
${fmtTimeOf(i)}
${lines.join("")}
`; + tip.hidden = false; + + // tip 位置:根据当前 svg 实际宽度比例换算到 root 内 px + const actualX = (xOnAxis / W) * rect.width; + let leftPx = actualX + 8; + if (leftPx + 160 > rect.width) leftPx = actualX - 168; + if (leftPx < 0) leftPx = 4; + tip.style.left = `${Math.max(0, leftPx)}px`; + tip.style.top = `${rect.height * 0.06}px`; + }; + const onLeave = () => { + crossLine.setAttribute("visibility", "hidden"); + tip.hidden = true; + }; + svg.addEventListener("mousemove", onMove); + svg.addEventListener("mouseleave", onLeave); + root.appendChild(svg); const legend = document.createElement("div"); legend.className = "hint"; - legend.textContent = "图例:实线/虚线区分同色不同事件"; + legend.textContent = "图例:实线/虚线区分同色不同事件 · 鼠标悬停查看明细"; root.appendChild(legend); } @@ -1831,6 +1919,8 @@ async function pollReservations() { `; container.appendChild(info); + updateTabBadge("reservations", reservations.length); + if (reservations.length === 0) { const hint = document.createElement("div"); hint.className = "hint"; diff --git a/webui/index.html b/webui/index.html index ce56e02..da42991 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -224,9 +224,11 @@
- - - +
+ + + +
先用 USB 设备启用 TCP/IP,再按 IP 连接。
@@ -1252,6 +1254,10 @@
- + + + diff --git a/webui/styles.css b/webui/styles.css index a10ea1a..29c5749 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -1155,6 +1155,24 @@ svg { text-overflow: ellipsis; } +.tabBtn[data-badge]:not([data-badge="0"])::after { + margin-left: auto; + padding: 1px 6px; + border-radius: 99px; + background: var(--surface-muted); + color: var(--muted); + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; + font-size: 10px; + font-variant-numeric: tabular-nums; + line-height: 1.4; + content: attr(data-badge); +} + +.tabBtn.active[data-badge]:not([data-badge="0"])::after { + background: var(--primary); + color: var(--on-primary); +} + .panels { min-width: 0; max-width: var(--panel-max); @@ -1659,6 +1677,63 @@ input[type="number"]::-webkit-outer-spin-button { display: block; } +.timelineTip { + position: absolute; + z-index: 5; + display: grid; + gap: 6px; + min-width: 140px; + max-width: 200px; + padding: 8px 10px; + border: 1px solid var(--border); + border-radius: var(--radius-sm); + background: var(--surface); + box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12); + color: var(--text); + font-size: var(--text-xs); + font-variant-numeric: tabular-nums; + pointer-events: none; + backdrop-filter: blur(8px); +} + +:root[data-theme="dark"] .timelineTip { + box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55); +} + +.timelineTipTime { + color: var(--muted); + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; + font-size: 10px; + letter-spacing: 0.04em; +} + +.timelineTipBody { + display: grid; + grid-template-columns: 1fr auto; + align-items: center; + gap: 4px 10px; +} + +.timelineTipBody span { + display: inline-flex; + align-items: center; + gap: 6px; + color: var(--text); +} + +.timelineTipBody b { + color: var(--text-strong); + font-weight: 600; + text-align: right; +} + +.timelineDotMark { + display: inline-block; + width: 8px; + height: 8px; + border-radius: 2px; +} + .barRow { display: grid; grid-template-columns: minmax(78px, 0.9fr) minmax(80px, 2fr) 48px; @@ -2324,6 +2399,75 @@ details[open] > summary.sectionTitle::before { } } +/* Connected button group: shared border, no doubled middle border */ +.btnGroup { + display: inline-flex; + align-items: stretch; + isolation: isolate; +} + +.btnGroup > .btn { + border-radius: 0; + margin-left: -1px; +} + +.btnGroup > .btn:first-child { + border-top-left-radius: var(--radius-md); + border-bottom-left-radius: var(--radius-md); + margin-left: 0; +} + +.btnGroup > .btn:last-child { + border-top-right-radius: var(--radius-md); + border-bottom-right-radius: var(--radius-md); +} + +.btnGroup > .btn:hover, +.btnGroup > .btn:focus-visible { + z-index: 1; +} + +/* Scroll-to-top floating button */ +.scrollTopBtn { + position: fixed; + right: 20px; + bottom: 70px; + z-index: 70; + display: inline-flex; + align-items: center; + justify-content: center; + width: 36px; + height: 36px; + padding: 0; + border: 1px solid var(--border); + border-radius: 50%; + background: color-mix(in oklab, var(--surface) 80%, transparent); + color: var(--muted); + cursor: pointer; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); + backdrop-filter: blur(10px); + transition: opacity 180ms ease, transform 180ms ease, color var(--motion-fast), + border-color var(--motion-fast), background var(--motion-fast); +} + +.scrollTopBtn[hidden] { + display: none !important; +} + +.scrollTopBtn:hover { + color: var(--text); + border-color: var(--hover-border); + background: var(--surface); + transform: translateY(-2px); +} + +@media (max-width: 640px) { + .scrollTopBtn { + right: 12px; + bottom: 80px; + } +} + /* Device select wrapper with status dot */ .deviceSelectWrap { position: relative; From 632951d00419787eecbb05e7c9a43aeaa7add09a Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 08:52:39 +0800 Subject: [PATCH 17/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=B8=83=E8=BD=AE=EF=BC=9Asticky=20=E7=AB=A0=E8=8A=82?= =?UTF-8?q?=20/=20=E8=AF=AD=E4=B9=89=E7=9D=80=E8=89=B2=20/=20=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E8=AE=A1=E6=95=B0=20/=20=E7=A9=BA=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - sectionTitle 改 sticky 在长 panel 内吸附顶部,背景渐变 + 6px 模糊;cardTitle/summary 不变 - 福袋统计语义着色:参与成功/中奖 → success;失败 → error;未中奖 → muted;通过 .stateOk/.stateError/.stateWarn/.stateMuted 类切换 - 配置搜索右侧加实时匹配计数徽章("X 项");搜索清空时隐藏 - 空状态占位升级:从单色边框圆点 → 28px 聊天泡 SVG icon (currentColor mask) + 双行布局,更显设计 - cache-bust v19 → v20 --- webui/app.js | 19 +++++++++++++++++ webui/index.html | 5 +++-- webui/styles.css | 53 ++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 67 insertions(+), 10 deletions(-) diff --git a/webui/app.js b/webui/app.js index a7ea931..af6a12d 100644 --- a/webui/app.js +++ b/webui/app.js @@ -334,6 +334,7 @@ function initConfigSearch() { const apply = (q) => { const query = q.trim().toLowerCase(); if (clear) clear.toggleAttribute("hidden", !query); + const countBadge = document.getElementById("configSearchCount"); if (!query) { // Restore all @@ -341,6 +342,7 @@ function initConfigSearch() { allSectionTitles.forEach((s) => s.classList.remove("isSearchHidden")); document.querySelectorAll(".panel").forEach((p) => p.classList.remove("isSearchAllHidden")); if (empty) empty.hidden = true; + if (countBadge) countBadge.hidden = true; // Re-apply normal tab visibility (panels may have been forced visible) const activeTab = document.querySelector(".tabBtn.active[data-target]"); if (activeTab) { @@ -389,6 +391,10 @@ function initConfigSearch() { }); if (empty) empty.hidden = totalVisible > 0; + if (countBadge) { + countBadge.hidden = false; + countBadge.textContent = `${totalVisible} 项`; + } }; let debounceTimer; @@ -2130,6 +2136,19 @@ async function pollStats() { setTextIfExists("statFudaiAttendFail", getC("fudai_attend_fail")); setTextIfExists("statFudaiNoWin", getC("fudai_result_no_win")); setTextIfExists("statFudaiWin", getC("fudai_result_win")); + // 福袋统计语义着色 + const colorize = (id, kind, n) => { + const el = document.getElementById(id); + if (!el) return; + el.classList.toggle("stateOk", kind === "ok" && n > 0); + el.classList.toggle("stateError", kind === "error" && n > 0); + el.classList.toggle("stateWarn", kind === "warn" && n > 0); + el.classList.toggle("stateMuted", kind === "muted" && n > 0); + }; + colorize("statFudaiAttendOk", "ok", getC("fudai_attend_ok")); + colorize("statFudaiWin", "ok", getC("fudai_result_win")); + colorize("statFudaiAttendFail", "error", getC("fudai_attend_fail")); + colorize("statFudaiNoWin", "muted", getC("fudai_result_no_win")); setTextIfExists("topFudaiState", UI_COPY.overview.fudaiState(getC("fudai_open_detail"), getC("fudai_attend_ok"))); setTextIfExists("topFudaiMeta", UI_COPY.overview.fudaiMeta(getC("fudai_seen"), getC("fudai_result_win"))); diff --git a/webui/index.html b/webui/index.html index da42991..cae8912 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -193,6 +193,7 @@ + - + diff --git a/webui/styles.css b/webui/styles.css index 29c5749..402b389 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -1019,6 +1019,25 @@ svg { transition: opacity var(--motion-fast); } +.workspaceSearchCount { + position: absolute; + right: 30px; + top: 50%; + transform: translateY(-50%); + padding: 1px 7px; + border-radius: 99px; + background: var(--primary-soft); + color: var(--primary-accent-text); + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; + font-size: 10px; + font-variant-numeric: tabular-nums; + pointer-events: none; +} + +.workspaceSearchCount[hidden] { + display: none; +} + .workspaceSearch:focus-within .workspaceSearchKbd, .workspaceSearch input:not(:placeholder-shown) ~ .workspaceSearchKbd { opacity: 0; @@ -1224,6 +1243,18 @@ svg { text-transform: uppercase; line-height: 1.3; border-bottom: 1px solid var(--border); + position: sticky; + top: 64px; + z-index: 4; + background: linear-gradient(180deg, var(--surface) 70%, color-mix(in oklab, var(--surface) 0%, transparent)); + backdrop-filter: blur(6px); +} + +.cardTitle.sectionTitle, +summary.sectionTitle { + position: static; + background: transparent; + backdrop-filter: none; } .sectionTitle::before { @@ -1462,11 +1493,12 @@ input[type="number"]::-webkit-outer-spin-button { .chart > .hint:only-child, .reservationsContent > .hint:only-child { display: flex; + flex-direction: column; align-items: center; justify-content: center; gap: 8px; - min-height: 60px; - padding: 16px; + min-height: 80px; + padding: 24px 16px; border: 1px dashed var(--border); border-radius: var(--radius-md); background: color-mix(in oklab, var(--surface-soft) 60%, transparent); @@ -1479,12 +1511,13 @@ input[type="number"]::-webkit-outer-spin-button { .chart > .hint:only-child::before, .reservationsContent > .hint:only-child::before { content: ""; - width: 14px; - height: 14px; - border: 1.5px dashed currentColor; - border-radius: 50%; - opacity: 0.6; - flex: 0 0 14px; + width: 28px; + height: 28px; + flex: 0 0 28px; + background-color: currentColor; + -webkit-mask: url("data:image/svg+xml;utf8,") no-repeat center / contain; + mask: url("data:image/svg+xml;utf8,") no-repeat center / contain; + opacity: 0.55; } .divider { @@ -1568,6 +1601,10 @@ input[type="number"]::-webkit-outer-spin-button { color: var(--danger); } +.statValue.stateWarn { + color: var(--warning); +} + .statValue.hasCopy { position: relative; padding-right: 28px; From f16eadbd75616dccc325fa81a6604cf7bb1f54b0 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 08:58:25 +0800 Subject: [PATCH 18/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E5=85=AB=E8=BD=AE=EF=BC=9A=E5=90=8E=E7=AB=AF=20/api/v?= =?UTF-8?q?ersion=20+=20=E9=A2=84=E7=BA=A6=E5=8D=A1=20hover=20accent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 后端 gui/web_gui.py 新增 GET /api/version:返回 {name, version, build},前端 footer 自动从 cache-bust fallback 切换为真实版本号 - 预约卡 .reservationItem hover 时左侧浮现 2px primary accent 条;isImminent / isDue 状态下不显示(避免与 warning/danger 边框冲突) - 高价值直播间共用 reservationItem 视觉,自动获得相同 hover accent - cache-bust v20 → v21 --- gui/web_gui.py | 10 ++++++++++ webui/index.html | 4 ++-- webui/styles.css | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/gui/web_gui.py b/gui/web_gui.py index 2e34710..37569a4 100644 --- a/gui/web_gui.py +++ b/gui/web_gui.py @@ -1738,6 +1738,16 @@ class Handler(BaseHTTPRequestHandler): # 提供 CSRF token 给前端 if u.path == "/api/csrf-token": return self._send_json({"token": _CSRF_TOKEN}) + if u.path == "/api/version": + try: + from version import APP_VERSION, APP_BUILD_DATE, APP_NAME + except Exception: + APP_VERSION, APP_BUILD_DATE, APP_NAME = "?", "?", "douyin_guaji" + return self._send_json({ + "name": APP_NAME, + "version": str(APP_VERSION).lstrip("Vv"), + "build": APP_BUILD_DATE, + }) if u.path == "/api/devices": adb = find_adb_executable() return self._send_json({"adb": adb, "devices": list_adb_devices(adb)}) diff --git a/webui/index.html b/webui/index.html index cae8912..9100389 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -1259,6 +1259,6 @@ - + diff --git a/webui/styles.css b/webui/styles.css index 402b389..245290a 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -2077,6 +2077,7 @@ input[type="number"]::-webkit-outer-spin-button { } .reservationItem { + position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--border); @@ -2085,11 +2086,33 @@ input[type="number"]::-webkit-outer-spin-button { transition: border-color var(--motion-fast), box-shadow var(--motion-fast); } +.reservationItem::before { + position: absolute; + left: 0; + top: 10px; + bottom: 10px; + width: 2px; + content: ""; + border-radius: 0 2px 2px 0; + background: var(--primary); + opacity: 0; + transition: opacity var(--motion-fast); +} + .reservationItem:hover { border-color: var(--hover-border); box-shadow: var(--shadow-soft); } +.reservationItem:hover::before { + opacity: 0.65; +} + +.reservationItem.isImminent::before, +.reservationItem.isDue::before { + display: none; +} + .reservationItem.isImminent { border-color: var(--warning); background: color-mix(in oklab, var(--warning-soft) 60%, var(--surface)); From cea5f1df45a37955ab32e111cac719d7db96b02c Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 09:02:55 +0800 Subject: [PATCH 19/29] =?UTF-8?q?=E7=B2=BE=E4=BF=AE=20WebUI=20=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=B9=9D=E8=BD=AE=EF=BC=9Asticky=20elevation=20+=20to?= =?UTF-8?q?ggle=20switch=20+=20=E6=AD=A5=E8=BF=9B=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - sectionTitle sticky 真贴顶时(IntersectionObserver + sentinel rootMargin -65px)加 .isStuck 类,浮起 0 6px 12px 阴影 - 关键开关升级为 toggle switch:.check.isToggle 把 input[type=checkbox] 渲染成 32×18 滑块(slider 配 14×14 圆点 + 0.18 阴影);3 个总控开关接入:infinite_loop_enabled / yanghao_enabled / yanghao_enable_actions / yanghao_only - fmtDuration 改 mono 格式:HH:MM:SS / MM:SS(padStart),适配 tabular-nums - 自绘 number stepper:所有 .input[type=number] 自动包 .numStepperWrap,hover/focus 时右侧浮现 ▲▼ 微按钮(18×12 双按钮组),调用 stepUp/stepDown + 派发 input/change;inline2 内不加避免连体冲突 - cache-bust v21 → v22 --- webui/app.js | 64 ++++++++++++++++++++++-- webui/index.html | 12 ++--- webui/styles.css | 123 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 190 insertions(+), 9 deletions(-) diff --git a/webui/app.js b/webui/app.js index af6a12d..225fdb3 100644 --- a/webui/app.js +++ b/webui/app.js @@ -555,6 +555,23 @@ function initShotFullscreen() { }); } +function initStickySectionShadow() { + // 当 .sectionTitle 真正贴住 sticky top 时加 .isStuck 类 + const titles = Array.from(document.querySelectorAll(".sectionTitle")) + .filter((el) => !el.matches(".cardTitle, summary, summary *")); + if (!titles.length || !("IntersectionObserver" in window)) return; + const io = new IntersectionObserver( + (entries) => { + for (const e of entries) { + // intersectionRatio < 1 && top 已到达 sentinel:贴住状态 + e.target.classList.toggle("isStuck", e.intersectionRatio < 1 && e.boundingClientRect.top <= 65); + } + }, + { threshold: [1], rootMargin: "-65px 0px 0px 0px" } + ); + titles.forEach((t) => io.observe(t)); +} + function initShortcutsHelp() { const isMac = /Mac|iPhone|iPad|iPod/i.test(navigator.platform || navigator.userAgent || ""); const mod = isMac ? "⌘" : "Ctrl"; @@ -843,6 +860,44 @@ function renderActionsLog() { el.scrollTop = el.scrollHeight; } +function attachNumberSteppers() { + // 给所有 .input[type=number] 包裹 .numStepperWrap + 添加 +/- 按钮 + const SVG_UP = ''; + const SVG_DOWN = ''; + document.querySelectorAll('input.input[type="number"]').forEach((input) => { + if (input.dataset.stepperBound === "1") return; + if (input.closest(".inline2")) return; // inline2 内不加,避免连体边框冲突 + input.dataset.stepperBound = "1"; + const wrap = document.createElement("div"); + wrap.className = "numStepperWrap"; + input.parentNode.insertBefore(wrap, input); + wrap.appendChild(input); + const btns = document.createElement("span"); + btns.className = "numStepperBtns"; + const up = document.createElement("button"); + up.type = "button"; + up.tabIndex = -1; + up.className = "numStepperBtn"; + up.setAttribute("aria-label", "增加"); + up.innerHTML = SVG_UP; + const down = document.createElement("button"); + down.type = "button"; + down.tabIndex = -1; + down.className = "numStepperBtn"; + down.setAttribute("aria-label", "减少"); + down.innerHTML = SVG_DOWN; + btns.append(up, down); + wrap.appendChild(btns); + const fire = (dir) => { + try { dir > 0 ? input.stepUp() : input.stepDown(); } catch (_) {} + input.dispatchEvent(new Event("input", { bubbles: true })); + input.dispatchEvent(new Event("change", { bubbles: true })); + }; + up.addEventListener("click", (e) => { e.preventDefault(); fire(1); }); + down.addEventListener("click", (e) => { e.preventDefault(); fire(-1); }); + }); +} + function fmtTime(ts) { if (!ts) return "-"; try { @@ -857,9 +912,10 @@ function fmtDuration(seconds) { const h = Math.floor(s / 3600); const m = Math.floor((s % 3600) / 60); const sec = s % 60; - if (h > 0) return `${h}小时${m}分${sec}秒`; - if (m > 0) return `${m}分${sec}秒`; - return `${sec}秒`; + const pad = (n) => String(n).padStart(2, "0"); + // mono 格式:HH:MM:SS(>1h)/ MM:SS(其他),方便 tabular-nums 对齐 + if (h > 0) return `${pad(h)}:${pad(m)}:${pad(sec)}`; + return `${pad(m)}:${pad(sec)}`; } function pollShot() { @@ -2266,6 +2322,8 @@ window.addEventListener("DOMContentLoaded", async () => { initHeaderScroll(); initKeyboardShortcuts(); initShortcutsHelp(); + initStickySectionShadow(); + attachNumberSteppers(); startReservationsCountdownTick(); // 首屏统计数字加骨架,待第一次 pollStats 成功后移除 document.querySelectorAll(".stat .statValue").forEach((el) => { diff --git a/webui/index.html b/webui/index.html index 9100389..d2891a4 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@ } catch (e) {} })(); - +
@@ -253,7 +253,7 @@
-