feat(ui): H5风格与世界书使用底部选择抽屉

- H5入口:设定页只显示当前风格和已选世界书,单选与多选均从底部抽屉完成

- 交互:独立草稿、确认回填、取消还原、恢复默认、清空选择和焦点返回

- 响应式:桌面保留展开式选择,主设定页和抽屉的提交按钮固定可见

- 验证:类型检查与构建通过,90项浏览器断言覆盖小屏、双主题、键盘和真实保存
This commit is contained in:
湛兮
2026-10-27 12:11:32 +08:00
parent 5adb6eaec3
commit 374ab1c606
2 changed files with 540 additions and 127 deletions
+205 -2
View File
@@ -699,7 +699,7 @@
margin-top: 6px;
}
.dh-profile-form > label,
.dh-settings > label {
.dh-settings-body > label {
display: flex;
flex-direction: column;
gap: 9px;
@@ -858,9 +858,11 @@
background: #ffffff0b;
}
.dh-settings {
display: flex;
flex-direction: column;
width: min(520px, 100%);
max-height: 90dvh;
overflow: auto;
overflow: hidden;
padding: 28px;
background: var(--dh-panel);
border: 1px solid #ffffff1a;
@@ -868,6 +870,7 @@
}
.dh-settings > header {
display: flex;
flex: none;
justify-content: space-between;
margin-bottom: 26px;
}
@@ -1012,6 +1015,197 @@
min-height: 76px;
}
}
/* H5 选择项以底部抽屉编辑草稿,确认后才回填到对话设定。 */
.dh-mobile-choices {
display: none;
}
.dh-overlay.dh-sheet-open {
overflow: hidden;
}
.dh-app .dh-selection-backdrop {
touch-action: none;
}
.dh-selection-layer {
position: fixed;
inset: 0;
z-index: 2;
display: flex;
align-items: flex-end;
justify-content: center;
overscroll-behavior: contain;
}
.dh-selection-backdrop {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
background: #0009 !important;
}
.dh-selection-sheet {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
max-height: 86dvh;
min-height: 0;
overflow: hidden;
background: var(--dh-panel);
border: 1px solid #ffffff1c;
border-bottom: 0;
border-radius: 24px 24px 0 0;
box-shadow: 0 -16px 60px #0005;
animation: dh-sheet-enter 180ms ease-out;
}
.dh-sheet-handle {
flex: none;
width: 34px;
height: 4px;
margin: 10px auto 7px;
background: #ffffff35;
border-radius: 4px;
}
.dh-selection-sheet > header {
display: flex;
flex: none;
align-items: center;
justify-content: space-between;
padding: 10px 20px 18px;
}
.dh-selection-sheet h2 {
font-size: 20px;
font-weight: 600;
}
.dh-selection-sheet header p {
margin-top: 4px;
color: var(--dh-muted);
font-size: 11px;
}
.dh-selection-body {
flex: 1;
min-height: 0;
padding: 0 20px 20px;
overflow-y: auto;
overscroll-behavior: contain;
}
.dh-selection-sheet .dh-style-picker,
.dh-selection-sheet .dh-book-picker {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
.dh-selection-sheet .dh-checkbox {
min-height: 74px;
padding: 14px;
margin: 0 0 10px;
border: 1px solid #ffffff17;
border-radius: 13px;
cursor: pointer;
}
.dh-selection-sheet .dh-checkbox.is-selected {
background: color-mix(in srgb, var(--dh-accent) 9%, var(--dh-panel));
border-color: var(--dh-accent);
}
.dh-selection-sheet .dh-checkbox:focus-within {
outline: 2px solid var(--dh-accent);
outline-offset: 2px;
}
.dh-selection-sheet .dh-checkbox small {
font-size: 11px;
}
.dh-selection-sheet > footer {
display: flex;
flex: none;
gap: 12px;
padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
border-top: 1px solid var(--dh-line);
}
.dh-selection-sheet footer > button {
min-height: 46px;
}
.dh-selection-sheet footer > .dh-primary {
flex: 1;
justify-content: center;
}
.dh-sheet-reset {
min-width: 84px;
color: var(--dh-muted) !important;
font-size: 12px !important;
}
.dh-visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0 !important;
margin: -1px;
overflow: hidden;
white-space: nowrap;
clip-path: inset(50%);
}
@keyframes dh-sheet-enter {
from {
transform: translateY(100%);
}
to {
transform: translateY(0);
}
}
@media (width > 600px) {
.dh-selection-layer {
display: none;
}
}
@media (width <= 600px) {
.dh-desktop-choices {
display: none;
}
.dh-mobile-choices {
display: grid;
gap: 10px;
margin: 0 0 22px;
}
.dh-choice-trigger {
display: flex;
gap: 12px;
align-items: center;
width: 100%;
min-height: 78px;
padding: 15px 14px !important;
text-align: left;
border: 1px solid #ffffff17 !important;
border-radius: 13px;
background: var(--dh-soft) !important;
}
.dh-choice-trigger > svg {
flex: none;
width: 18px;
height: 18px;
color: var(--dh-accent);
}
.dh-choice-trigger > svg:last-child {
width: 16px;
color: var(--dh-muted);
}
.dh-choice-trigger > span {
flex: 1;
min-width: 0;
}
.dh-choice-trigger strong {
display: block;
font-size: 12px;
font-weight: 500;
}
.dh-choice-trigger small {
display: block;
margin-top: 5px;
overflow: hidden;
color: var(--dh-muted);
font-size: 11px;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.dh-checkbox {
display: flex;
gap: 12px;
@@ -1036,7 +1230,16 @@
padding: 0 !important;
margin: -6px 0 22px;
}
.dh-settings-body {
flex: 1;
min-height: 0;
padding: 4px;
overflow-y: auto;
overscroll-behavior: contain;
}
.dh-settings > .dh-primary {
flex: none;
margin-top: 16px;
width: 100%;
}
/* 聊天固定在动态视口内;消息区独立滚动,输入框不会盖住底部消息。 */