精修 WebUI 第十轮:交互终章

- header 滚动时加 isScrolled 类:阴影提一档显得"浮起",区分内容区
- 键盘快捷键:⌘S/Ctrl+S 保存配置,⌘Enter/Ctrl+Enter 启动运行;尊重按钮 disabled 状态
- 通用 tooltip 系统:[data-tooltip] + 可选 data-tooltip-pos="bottom",带小箭头与毛玻璃;移动端禁用避免触摸浮悬
- btnTheme / btnShotFullscreen / 复制按钮 全部接入 tooltip
- cache-bust v12 → v13
This commit is contained in:
Codex committed 2026-05-21 09:29:38 +08:00
1 parent 0a2d67afb4
commit 8b8e3129e5
3 files changed
+131 -4

No files matched your search

+90
View File
@@ -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;