feat(ui): 文件二级页面间距规整(8px 网格)+ 浮窗默认尺寸改手机竖屏比例

- 文件页 chrome 行统一:路径行与树搜索行同为 41px 高(路径输入框改
  border-box 28px 总高)、gap 统一 6px、内边距统一 6px 8px
- 树体侧距 6→8px 对齐 chrome 行;markdown 预览 10/14→12/16(与错误
  文案块一致);CodeMirror scroller 新增同款 12/16 内边距(预览/编辑
  切换文字位置不跳);截断横幅 12→8px
- 浮窗默认尺寸 480×360 → 390×780(1:2 手机竖屏比例),创建时先按
  视口减 24px 钳制再居中,矮视口得到更矮的窗而非溢出
- 测试/文档同步:state/free-window 预期重算(含 clampMove 回推的
  y=24 语义)、e2e 断言宽度上界、AGENTS §7.5 与设计文档
This commit is contained in:
Menghuan1918
2026-08-24 00:59:27 +08:00
parent f648b0c006
commit d15645bf23
7 changed files with 59 additions and 36 deletions
+12 -5
View File
@@ -876,7 +876,7 @@ body[data-dsh-sidebar-dragging] .bottomPanel {
overflow-y: auto;
/* Deep trees truncate their labels instead of scrolling horizontally. */
overflow-x: hidden;
padding: 2px 6px 8px;
padding: 4px 8px 8px;
}
/* One tree row: the app's session-row cell (34px, radius 8, inset, hover
@@ -1196,7 +1196,7 @@ body[data-dsh-sidebar-dragging] .bottomPanel {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 8px;
padding: 6px 8px;
border-bottom: 1px solid var(--dsw-alias-border-l1);
}
@@ -1215,6 +1215,7 @@ body[data-dsh-sidebar-dragging] .bottomPanel {
.editorPathInput {
flex: 1;
min-width: 0;
box-sizing: border-box;
height: 28px;
padding: 0 10px;
border: 1px solid var(--dsw-alias-border-l1);
@@ -1297,7 +1298,7 @@ body[data-dsh-sidebar-dragging] .bottomPanel {
flex: none;
display: flex;
align-items: center;
gap: 4px;
gap: 6px;
padding: 6px 8px;
border-bottom: 1px solid var(--dsw-alias-border-l1);
}
@@ -1430,7 +1431,7 @@ body[data-dsh-sidebar-dragging] .bottomPanel {
.editorBanner {
flex: none;
padding: 4px 12px;
padding: 4px 8px;
font: var(--dsw-font-xxxs-11);
color: var(--dsw-alias-state-warn-label);
background: var(--dsw-alias-state-warn-tertiary);
@@ -1633,6 +1634,12 @@ body[data-dsh-sidebar-dragging] .bottomPanel {
height: 100%;
}
/* Code lines get the same 12/16 inset as the markdown preview, so toggling
preview/edit never jumps the text's resting position. */
.editorCm :global(.cm-scroller) {
padding: 12px 16px;
}
.editorCm :global(.cm-editor.cm-focused) {
outline: none;
}
@@ -1688,7 +1695,7 @@ body[data-dsh-sidebar-dragging] .bottomPanel {
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 10px 14px;
padding: 12px 16px;
font: var(--dsw-font-xs-13);
}
+16 -7
View File
@@ -120,9 +120,12 @@ export const BOTTOM_DEFAULT = 220
* header plus some content), the ceiling is the viewport. */
export const FLOAT_MIN_W = 320
export const FLOAT_MIN_H = 200
/** Geometry a fresh free window starts with (clamped to the viewport). */
export const FLOAT_DEFAULT_W = 480
export const FLOAT_DEFAULT_H = 360
/** Geometry a fresh free window starts with: a phone-like portrait ratio
* (390×780 ≈ 1:2). The creation path additionally caps the size to the
* viewport (minus a 24px margin), so a short viewport gets a shorter —
* not overflowing — window instead of an exact ratio. */
export const FLOAT_DEFAULT_W = 390
export const FLOAT_DEFAULT_H = 780
let nextIdCounter = 0
/** Unique pane/tab id within one state instance. */
@@ -777,11 +780,17 @@ export function floatTab(state: SidebarState, tabId: string, x: number, y: numbe
if (leaf.tabs.length === 0) emptied = true
})
if (emptied) node = removeLeafAt(node, source.id)
// Phone-ratio default, capped to the viewport before centering so the
// clamped position never leaves the window's bottom past the fold.
const vw = viewportW()
const vh = viewportH()
const width = Math.min(FLOAT_DEFAULT_W, Math.max(FLOAT_MIN_W, vw - 24))
const height = Math.min(FLOAT_DEFAULT_H, Math.max(FLOAT_MIN_H, vh - 24))
const window = clampFloatGeometry(
x - FLOAT_DEFAULT_W / 2,
y - FLOAT_DEFAULT_H / 2,
FLOAT_DEFAULT_W,
FLOAT_DEFAULT_H,
x - width / 2,
y - height / 2,
width,
height,
)
const next: SidebarState = {
...state,