精修 WebUI 第十九轮:sticky elevation + toggle switch + 步进按钮

- 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
This commit is contained in:
Codex committed 2026-05-21 09:29:38 +08:00
1 parent f16eadbd75
commit cea5f1df45
3 files changed
+190 -9

No files matched your search

+123
View File
@@ -1248,6 +1248,23 @@ svg {
z-index: 4;
background: linear-gradient(180deg, var(--surface) 70%, color-mix(in oklab, var(--surface) 0%, transparent));
backdrop-filter: blur(6px);
transition: box-shadow var(--motion-fast);
}
/* When sticky-pinned (top:64px is reached), elevate with a subtle shadow */
.sectionTitle:not(.cardTitle):not(summary) {
/* Use scroll-aware shadow via @supports trick: sticky elements show shadow when stuck */
box-shadow: 0 0 0 0 transparent;
}
@supports (position: sticky) {
.sectionTitle.isStuck {
box-shadow: 0 6px 12px -8px rgba(0, 0, 0, 0.12), 0 1px 0 var(--border);
}
}
:root[data-theme="dark"] .sectionTitle.isStuck {
box-shadow: 0 6px 12px -8px rgba(0, 0, 0, 0.5), 0 1px 0 var(--border);
}
.cardTitle.sectionTitle,
@@ -1434,6 +1451,66 @@ input[type="number"]::-webkit-outer-spin-button {
margin: 0;
}
/* Custom number stepper: wraps an input with .numStepperWrap, +/- buttons appear on hover/focus */
.numStepperWrap {
position: relative;
display: block;
}
.numStepperWrap > input[type="number"] {
padding-right: 32px;
}
.numStepperBtns {
position: absolute;
right: 4px;
top: 50%;
transform: translateY(-50%);
display: inline-flex;
flex-direction: column;
gap: 1px;
opacity: 0;
transition: opacity var(--motion-fast);
pointer-events: none;
}
.numStepperWrap:hover .numStepperBtns,
.numStepperWrap:focus-within .numStepperBtns {
opacity: 1;
pointer-events: auto;
}
.numStepperBtn {
display: inline-flex;
align-items: center;
justify-content: center;
width: 18px;
height: 12px;
padding: 0;
border: 1px solid var(--border);
border-radius: 3px;
color: var(--muted);
background: var(--surface);
cursor: pointer;
transition: color var(--motion-fast), border-color var(--motion-fast), background var(--motion-fast);
}
.numStepperBtn:hover {
color: var(--text);
border-color: var(--hover-border);
background: var(--surface-muted);
}
.numStepperBtn:active {
background: var(--primary-soft);
color: var(--primary-accent-text);
}
.numStepperBtn svg {
width: 8px;
height: 8px;
}
.textarea {
min-height: 96px;
padding: 9px 10px;
@@ -1475,6 +1552,52 @@ input[type="number"]::-webkit-outer-spin-button {
accent-color: var(--primary);
}
/* Toggle switch variant: add class .check.isToggle, the checkbox renders as a sliding switch.
Apply by toggling .isToggle on existing .check labels. */
.check.isToggle {
cursor: pointer;
user-select: none;
}
.check.isToggle input[type="checkbox"] {
appearance: none;
-webkit-appearance: none;
position: relative;
flex: 0 0 32px;
width: 32px;
height: 18px;
border-radius: 999px;
background: var(--border-strong);
cursor: pointer;
transition: background var(--motion-fast);
}
.check.isToggle input[type="checkbox"]::after {
position: absolute;
left: 2px;
top: 2px;
content: "";
width: 14px;
height: 14px;
border-radius: 50%;
background: var(--surface);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
transition: transform var(--motion-fast), background var(--motion-fast);
}
.check.isToggle input[type="checkbox"]:checked {
background: var(--primary);
}
.check.isToggle input[type="checkbox"]:checked::after {
transform: translateX(14px);
}
.check.isToggle input[type="checkbox"]:focus-visible {
outline: none;
box-shadow: 0 0 0 3px var(--focus-ring, rgba(94, 106, 210, 0.18));
}
.check span {
min-width: 0;
overflow-wrap: anywhere;