DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
style(turnrewind): tighten card typography and pause hover/open-file affordances
hairyf175a38e80d92
diff --git "a/docs/plugins/11.\344\274\230\345\214\226\350\256\241\345\210\222.turnrewind\345\256\236\347\216\260.md" "b/docs/plugins/11.\344\274\230\345\214\226\350\256\241\345\210\222.turnrewind\345\256\236\347\216\260.md"index dccb3729..66f8b086 100644--- "a/docs/plugins/11.\344\274\230\345\214\226\350\256\241\345\210\222.turnrewind\345\256\236\347\216\260.md"+++ "b/docs/plugins/11.\344\274\230\345\214\226\350\256\241\345\210\222.turnrewind\345\256\236\347\216\260.md"@@ -633,3 +633,14 @@ eslint 0 error / 0 warning;`tsc --noEmit` 通过;`pnpm build:plugins` 重新本批验证:eslint **0 error / 0 warning**;`tsc --noEmit` 通过;包内 46 用例、根全量 206 用例全通过;`pnpm build:plugins` 部署成功,产物模块请求仍只有 `react`、`react/jsx-runtime`、`dsh-tauri/client`、`dsh-tauri-ui/client`(`@deepseek-ai/` 0 次)。++### 12.3 验收反馈的第三批(hover 范围、暂缓交互、字号)++| 反馈 | 落地 |+|---|---|+| 多文件的 `__head` 也要有 hover 显示「查看更改」 | 记录为恢复时的硬要求:hover 规则从 `__card--single:hover` 改为**整卡** `&:hover`(一条规则同时覆盖单文件与多文件头部),并写进 `TODO(view-changes-hover)` 注释 |+| hover 效果与「打开文件」暂时全部停用(留 TODO),只显示 `+xx -x` | TSX:`__hint` 标记整体注释;标题回到 `<span>`、清单行回到 `<div>`,`openFile` / `singlePath` 声明一并注释;`ArrowUpRight` 暂时从 import 移除(TODO 里写明恢复要重新引入)。CSSR:hover 换行规则与 `__title--link`、行按钮基座重置分别注释,各自留 `TODO(view-changes-hover)` / `TODO(open-file)`。功能开关不留运行时常量,恢复就是取消注释 |+| 整体字号偏大 | 全卡收小一档:标题 15→13、副行/清单行/「再显示」13、撤销与审核按钮 13/高 28、徽标 12→11、提示行 12、卡片根 13→12;图标块 40→36px、内边距 10/12 → 8/10;运行中提示条同步 14→13、高 30→28 |++本批验证:eslint 0/0;`tsc --noEmit` 通过;包内 **47 用例**、根全量 **207 用例**全通过+(cssr 测试新增「字号收小」用例,并把原 hover 换行断言改为钉住「当前已停用」的状态)。diff --git a/packages/dsh-tauri-turnrewind/README.md b/packages/dsh-tauri-turnrewind/README.mdindex 8cd33bd9..4215cf50 100644--- a/packages/dsh-tauri-turnrewind/README.md+++ b/packages/dsh-tauri-turnrewind/README.md@@ -42,14 +42,14 @@ DSH 桌面端的 **turn 级工作区撤销**:每一轮对话结束时,在对|---|---|| `撤销 ↶` | **真功能**:撤销该轮的文件改动;**撤销成功后按钮消失**,只留「已撤销」徽标 || 「再显示 N 个文件 ⌄」/「收起文件 ⌃」 | 真功能:展开 / 收起(清单默认 3 行,展开后底部仍有「收起文件」可回到 3 行) |-| 单文件标题 / 清单行 | 点击调用框架的 `openFile` **打开该文件**(临时逻辑) || `+` 图标块(文件) | **占位**(无点击处理,`data-placeholder` 标注) |-| 「查看更改 ↗」(单文件 hover) | **占位**(无点击处理);撤销前后都保留这个 hover 效果 |-| `审核` | **暂时整体隐藏**(代码内 `TODO(review-action)` 保留按钮实现) |+| 单文件 / 多文件标题 hover 的「查看更改 ↗」 | **暂时整体停用**(源码 `TODO(view-changes-hover)` 保留实现;恢复时单文件与多文件的 `__head` 都要生效) |+| 单文件标题 / 清单行点击打开文件 | **暂时停用**(源码 `TODO(open-file)` 保留实现;当前卡片只显示 `+xx -x`) |+| `审核` | **暂时整体隐藏**(源码 `TODO(review-action)` 保留按钮实现) |-- 单文件:标题即文件名、不渲染清单;hover 时副行的计数换成「查看更改 ↗」。-- 多文件:标题是文件数、副行是总计(绿 `+N` / 红 `-M`);清单最多三行,其余折叠;行 hover 高亮;本轮删除的文件整行弱化。-- **已撤销的 turn**:只剩「已撤销」徽标与文件名/清单行,不再有撤销按钮与审核(hover 的「查看更改」保留)。+- 单文件:标题即文件名、不渲染清单;多文件:标题是文件数、副行是总计(绿 `+N` / 红 `-M`)。+- 文件清单最多三行,其余折叠;行 hover 高亮;本轮删除(D)的文件整行弱化。+- **已撤销的 turn**:只剩「已撤销」徽标与文件名/清单行,不再有撤销按钮与审核。- 该轮没有任何文件变化 → 不出现卡片。- 撤销成功后同一 turn 不能重复撤销。- 撤销前若发现文件在 turn 结束后又被改动过 → **拒绝执行并列出冲突文件**,不覆盖任何文件。diff --git a/packages/dsh-tauri-turnrewind/src/client/components/running-changes-chip.cssr.ts b/packages/dsh-tauri-turnrewind/src/client/components/running-changes-chip.cssr.tsindex 7e3594ba..315487d1 100644--- a/packages/dsh-tauri-turnrewind/src/client/components/running-changes-chip.cssr.ts+++ b/packages/dsh-tauri-turnrewind/src/client/components/running-changes-chip.cssr.ts@@ -21,15 +21,15 @@ export default b('turnrewind-running', {display: 'inline-flex',alignItems: 'center',gap: '8px',- height: '30px',- padding: '0 12px',+ height: '28px',+ padding: '0 11px',border: '1px solid var(--dsw-alias-border-weak, rgba(127,127,127,0.2))',borderRadius: '10px',background: 'var(--dsw-alias-bg-base, #fff)',boxShadow: 'var(--dsw-shadow-lv2, 0 1px 3px rgba(0,0,0,0.06))',color: 'var(--dsw-alias-label-primary)',- fontSize: '14px',- lineHeight: '20px',+ fontSize: '13px',+ lineHeight: '18px',whiteSpace: 'nowrap',}),e('label', { color: 'var(--dsw-alias-label-primary)' }),diff --git a/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.cssr.test.ts b/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.cssr.test.tsindex a31b8d9a..201e9a31 100644--- a/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.cssr.test.ts+++ b/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.cssr.test.ts@@ -13,19 +13,26 @@ vi.mock('dsh-tauri-ui/client', async () => {describe('turn-changes-card.cssr(视觉对齐官方 deliverables 行)', () => {const css = cardStyle.render()- it('卡片形态:白底 + 14px 圆角 + 40px 图标块 + 「审核」胶囊按钮', () => {+ it('卡片形态:白底 + 14px 圆角 + 36px 图标块 + 「审核」胶囊按钮', () => {expect(css).toMatch(/\.dshp-turnrewind__card\s*\{[^}]*background: var\(--dsw-alias-bg-base/)expect(css).toMatch(/\.dshp-turnrewind__card\s*\{[^}]*border-radius: 14px/)- expect(css).toMatch(/\.dshp-turnrewind__icon\s*\{[^}]*width: 40px/)- expect(css).toMatch(/\.dshp-turnrewind__icon\s*\{[^}]*height: 40px/)+ expect(css).toMatch(/\.dshp-turnrewind__icon\s*\{[^}]*width: 36px/)+ expect(css).toMatch(/\.dshp-turnrewind__icon\s*\{[^}]*height: 36px/)expect(css).toMatch(/\.dshp-turnrewind__review\s*\{[^}]*border-radius: 999px/)expect(css).toMatch(/\.dshp-turnrewind__title\s*\{[^}]*font-weight: 600/)})- it('单文件卡片 hover:计数行隐藏、「查看更改」出现(纯 CSS 切换)', () => {- expect(css).toMatch(/\.dshp-turnrewind__card--single:hover \.dshp-turnrewind__counts\s*\{[^}]*display: none/)- expect(css).toMatch(/\.dshp-turnrewind__card--single:hover \.dshp-turnrewind__hint\s*\{[^}]*display: inline-flex/)- // 非 hover 时提示默认不占位+ it('字号整体收小:标题 13 / 副行 13 / 清单行 13 / 徽标 11', () => {+ expect(css).toMatch(/\.dshp-turnrewind__title\s*\{[^}]*font-size: 13px/)+ expect(css).toMatch(/\.dshp-turnrewind__sub\s*\{[^}]*font-size: 13px/)+ expect(css).toMatch(/\.dshp-turnrewind__file\s*\{[^}]*font-size: 13px/)+ expect(css).toMatch(/\.dshp-turnrewind__badge\s*\{[^}]*font-size: 11px/)+ })++ it('hover「查看更改」当前整体停用:无 hover 换行规则,提示默认不占位', () => {+ // 需求:hover 效果与打开文件暂时全部停用,只显示 +xx -x(恢复见 CSSR 内 TODO 注释)。+ expect(css).not.toMatch(/\.dshp-turnrewind__card--single:hover/)+ expect(css).not.toMatch(/\.dshp-turnrewind__card:hover/)expect(css).toMatch(/\.dshp-turnrewind__hint\s*\{[^}]*display: none/)})diff --git a/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.cssr.ts b/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.cssr.tsindex 859ecec5..7466505e 100644--- a/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.cssr.ts+++ b/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.cssr.ts@@ -14,8 +14,8 @@ const { bem: { b, e, m }, c } = cssr*/export default b('turnrewind', {margin: '2px 0 6px',- fontSize: '13px',- lineHeight: '20px',+ fontSize: '12px',+ lineHeight: '18px',color: 'var(--dsw-alias-label-primary)',}, [e('card', {@@ -25,63 +25,71 @@ export default b('turnrewind', {borderRadius: '14px',background: 'var(--dsw-alias-bg-base, #fff)',overflow: 'hidden',- }, [- m('single', {}, [+ },+ /*+ TODO(view-changes-hover): hover 显示「查看更改」暂时整体停用(需求方要求),+ 卡片当前只显示 +xx -x。恢复时改成**整卡**作用域(`&:hover`),+ 这样单文件与多文件的 __head 都能生效:++ [c('&:hover .dshp-turnrewind__counts', { display: 'none' }),c('&:hover .dshp-turnrewind__hint', { display: 'inline-flex' }),- ]),- ]),+ ],+ */+ ),e('head', {display: 'flex',alignItems: 'center',- gap: '12px',- padding: '10px 12px',+ gap: '10px',+ padding: '8px 10px',}),e('icon', {flex: 'none',display: 'inline-flex',alignItems: 'center',justifyContent: 'center',- width: '40px',- height: '40px',- borderRadius: '10px',+ width: '36px',+ height: '36px',+ borderRadius: '9px',color: 'var(--dsw-alias-label-secondary, var(--dsw-alias-label-primary))',background: 'var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,0.08))',}),e('meta', {display: 'flex',flexDirection: 'column',- gap: '2px',+ gap: '1px',minWidth: 0,}),e('title', {- fontSize: '15px',- lineHeight: '20px',+ fontSize: '13px',+ lineHeight: '18px',fontWeight: '600',overflow: 'hidden',textOverflow: 'ellipsis',whiteSpace: 'nowrap',- }, [- // 单文件时标题本身就是打开入口(<button>):清掉按钮基座,视觉与纯文本一致。- m('link', {- display: 'block',- maxWidth: '100%',- padding: '0',- border: 'none',- background: 'transparent',- font: 'inherit',- textAlign: 'left',- cursor: 'pointer',- color: 'inherit',- }, [- c('&:hover', { color: 'var(--dsw-alias-brand-primary, #2f6feb)' }),- ]),- ]),+ },+ /*+ TODO(open-file): 单文件标题作为打开入口(<button class="__title--link">)时恢复:++ [+ m('link', {+ display: 'block',+ maxWidth: '100%',+ padding: '0',+ border: 'none',+ background: 'transparent',+ font: 'inherit',+ textAlign: 'left',+ color: 'inherit',+ }, [c('&:hover', { color: 'var(--dsw-alias-brand-primary, #2f6feb)' })]),+ ],+ */+ ),e('sub', {display: 'flex',alignItems: 'center',gap: '6px',- fontSize: '14px',+ fontSize: '13px',lineHeight: '18px',minWidth: 0,}),@@ -96,7 +104,7 @@ export default b('turnrewind', {display: 'none',alignItems: 'center',gap: '4px',- fontSize: '14px',+ fontSize: '13px',lineHeight: '18px',color: 'var(--dsw-alias-label-secondary, var(--dsw-alias-label-primary))',whiteSpace: 'nowrap',@@ -104,10 +112,10 @@ export default b('turnrewind', {e('spacer', { flex: '1', minWidth: '8px' }),e('badge', {flex: 'none',- padding: '1px 8px',+ padding: '1px 7px',borderRadius: '999px',- fontSize: '12px',- lineHeight: '18px',+ fontSize: '11px',+ lineHeight: '17px',color: 'var(--dsw-alias-label-secondary, var(--dsw-alias-label-primary))',background: 'var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,0.08))',}),@@ -116,14 +124,14 @@ export default b('turnrewind', {display: 'inline-flex',alignItems: 'center',gap: '4px',- height: '30px',+ height: '28px',padding: '0 8px',border: 'none',borderRadius: '999px',background: 'transparent',fontFamily: 'inherit',- fontSize: '14px',- lineHeight: '20px',+ fontSize: '13px',+ lineHeight: '18px',cursor: 'pointer',color: 'var(--dsw-alias-label-primary)',}, [@@ -133,14 +141,14 @@ export default b('turnrewind', {]),e('review', {flex: 'none',- height: '30px',- padding: '0 14px',+ height: '28px',+ padding: '0 12px',border: '1px solid var(--dsw-alias-border-weak, rgba(127,127,127,0.28))',borderRadius: '999px',background: 'transparent',fontFamily: 'inherit',- fontSize: '14px',- lineHeight: '20px',+ fontSize: '13px',+ lineHeight: '18px',cursor: 'pointer',color: 'var(--dsw-alias-label-primary)',}, [@@ -153,24 +161,21 @@ export default b('turnrewind', {boxSizing: 'border-box',display: 'flex',alignItems: 'center',- gap: '12px',+ gap: '10px',width: '100%',- padding: '8px 12px',- // 临时逻辑:行本身是 <button>(点击打开文件),因此在此清掉按钮基座;- // 若 openFile 缺席则渲染成 <div>,这些重置对它同样无害。- border: 'none',- background: 'transparent',- font: 'inherit',- textAlign: 'left',- color: 'inherit',- fontSize: '14px',- lineHeight: '20px',- cursor: 'pointer',+ padding: '7px 10px',+ fontSize: '13px',+ lineHeight: '18px',}, [c('&:hover', { background: 'var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,0.06))' }),// 本 turn 删除的文件整行弱化:它们已不在工作区里。m('deleted', { color: 'var(--dsw-alias-label-tertiary, var(--dsw-alias-label-secondary))' }),]),+ /*+ TODO(open-file): 清单行改为 <button> 打开文件时,在 `e('file', …)` 里补回按钮基座重置:+ `border: 'none'`、`background: 'transparent'`、`font: 'inherit'`、+ `textAlign: 'left'`、`color: 'inherit'`、`cursor: 'pointer'`。+ */e('file-path', {flex: '1',minWidth: 0,@@ -184,13 +189,13 @@ export default b('turnrewind', {alignItems: 'center',gap: '4px',width: '100%',- padding: '8px 12px',+ padding: '7px 10px',border: 'none',borderTop: '1px solid var(--dsw-alias-border-weak, rgba(127,127,127,0.18))',background: 'transparent',fontFamily: 'inherit',- fontSize: '14px',- lineHeight: '20px',+ fontSize: '13px',+ lineHeight: '18px',textAlign: 'left',cursor: 'pointer',color: 'var(--dsw-alias-label-primary)',@@ -198,10 +203,10 @@ export default b('turnrewind', {c('&:hover', { background: 'var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,0.06))' }),]),e('notice', {- padding: '8px 12px',+ padding: '7px 10px',borderTop: '1px solid var(--dsw-alias-border-weak, rgba(127,127,127,0.18))',- fontSize: '13px',- lineHeight: '19px',+ fontSize: '12px',+ lineHeight: '18px',color: 'var(--dsw-alias-label-secondary, var(--dsw-alias-label-primary))',}, [m('error', { color: 'var(--dsw-alias-state-error-primary, #d93025)' }),diff --git a/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.tsx b/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.tsxindex 19b31a96..b9ad740f 100644--- a/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.tsx+++ b/packages/dsh-tauri-turnrewind/src/client/components/turn-changes-card.tsx@@ -1,6 +1,6 @@import type { ReactElement } from 'react'import type { TurnChangesCardProps } from '../types'-import { ArrowRotateLeft, ArrowUpRight, ChevronDown, ChevronUp, Icon, SquarePlus, useMountStyle } from 'dsh-tauri-ui/client'+import { ArrowRotateLeft, ChevronDown, ChevronUp, Icon, SquarePlus, useMountStyle } from 'dsh-tauri-ui/client'/*** turn-changes-card.tsx — 一轮结束时渲染的变更卡片(视觉对齐官方 deliverables 行)。*@@ -88,11 +88,19 @@ export function TurnChangesCard(props: TurnChangesCardProps): ReactElement | nul? cardTitle(record, name => text('editedOne', { name }), count => text('editedMany', { count })): text('unavailableTitle')- // 打开文件:owner 份额里框架自带 openFile(相对路径按会话 cwd 解析)。- // 临时逻辑(需求方要求):单文件卡片的文件名与多文件清单的每一行都可点击打开,- // 内核若未派发 openFile 则退化为不可点击(不报错、不白屏)。- const openFile = typeof props.openFile === 'function' ? props.openFile : undefined- const singlePath = single ? files[0]?.path : undefined+ /*+ TODO(open-file): 「点击打开文件」暂时停用(需求方要求),当前卡片只展示 +xx -x。+ 恢复步骤:+ 1. 取回框架派发的 openFile(turnTail 的 owner 份额自带,相对路径按会话 cwd 解析);+ 2. 单文件卡片把标题渲染成 <button class="__title--link">、多文件清单把每一行渲染成+ <button class="__file">,onClick 调 openFile(path);+ 3. cssr 里把 __title--link 与 __file 的按钮基座重置/指针样式一并恢复+ (`__file` 现在渲染成 <div>,那些重置已注释)。+ 内核对缺席的 openFile 必须优雅降级(渲染纯文本 / <div>,不报错、不白屏)。++ const openFile = typeof props.openFile === 'function' ? props.openFile : undefined+ const singlePath = single ? files[0]?.path : undefined+ */const onUndo = (): void => {if (gitRequired) {@@ -116,19 +124,7 @@ export function TurnChangesCard(props: TurnChangesCardProps): ReactElement | nul<Icon as={SquarePlus} size={18} /></span><div className="dshp-turnrewind__meta">- {/* 单文件:文件名本身就是打开入口(openFile 缺席时退回纯文本,不报错)。 */}- {single && singlePath !== undefined && openFile !== undefined- ? (- <button- type="button"- className="dshp-turnrewind__title dshp-turnrewind__title--link"- onClick={() => openFile(singlePath)}- title={singlePath}- >- {title}- </button>- )- : <span className="dshp-turnrewind__title" title={title}>{title}</span>}+ <span className="dshp-turnrewind__title" title={title}>{title}</span><span className="dshp-turnrewind__sub">{record !== null? (@@ -141,13 +137,20 @@ export function TurnChangesCard(props: TurnChangesCardProps): ReactElement | nulbinaryLabel={text('binary')}/></span>- {/* 占位:hover 出现「查看更改」,点击无动作(已撤销后同样保留 hover 效果)。 */}- {single && (- <span className="dshp-turnrewind__hint" data-placeholder="view-changes">- {text('viewChanges')}- <Icon as={ArrowUpRight} size={14} />- </span>- )}+ {/*+ TODO(view-changes-hover): hover 显示「查看更改」暂时整体停用(需求方要求),+ 当前只显示 +xx -x。恢复时注意三条:+ 1. 单文件与**多文件**的 __head 都要有该 hover 效果(不再用 single 条件限定);+ 2. 重新从 dsh-tauri-ui/client 引入 ArrowUpRight 图标;+ 3. cssr 里把 `.dshp-turnrewind__card:hover` 下的+ `__counts` 隐藏 / `__hint` 显示两条规则恢复(现在已注释)。+ {single && (+ <span className="dshp-turnrewind__hint" data-placeholder="view-changes">+ {text('viewChanges')}+ <Icon as={ArrowUpRight} size={14} />+ </span>+ )}+ */}</>): (@@ -186,42 +189,28 @@ export function TurnChangesCard(props: TurnChangesCardProps): ReactElement | nul{window.visible.length > 0 && (<div className="dshp-turnrewind__files">- {window.visible.map((file) => {- const rowClassName = `dshp-turnrewind__file${file.status === 'D' ? ' dshp-turnrewind__file--deleted' : ''}`- const rowTitle = `${file.path} ${formatCounts(file, text('binary'))}`- const rowBody = (- <>- <span className="dshp-turnrewind__file-path">{file.path}</span>- <span className="dshp-turnrewind__file-counts">- <ChangeCounts- insertions={file.insertions}- deletions={file.deletions}- binary={file.binary}- binaryLabel={text('binary')}- />- </span>- </>- )- // 临时逻辑:清单行可点击打开文件(owner 份额的 openFile,相对路径按会话 cwd 解析)。- return openFile === undefined- ? (- <div key={file.path} className={rowClassName} data-status={file.status} title={rowTitle}>- {rowBody}- </div>- )- : (- <button- key={file.path}- type="button"- className={rowClassName}- data-status={file.status}- title={rowTitle}- onClick={() => openFile(file.path)}- >- {rowBody}- </button>- )- })}+ {window.visible.map(file => (+ <div+ key={file.path}+ className={`dshp-turnrewind__file${file.status === 'D' ? ' dshp-turnrewind__file--deleted' : ''}`}+ data-status={file.status}+ title={`${file.path} ${formatCounts(file, text('binary'))}`}+ >+ <span className="dshp-turnrewind__file-path">{file.path}</span>+ <span className="dshp-turnrewind__file-counts">+ <ChangeCounts+ insertions={file.insertions}+ deletions={file.deletions}+ binary={file.binary}+ binaryLabel={text('binary')}+ />+ </span>+ </div>+ ))}+ {/*+ TODO(open-file): 清单行改为可点击打开文件时,把上面的 <div> 换成+ <button class="__file" onClick={() => openFile(file.path)}>(见文件顶部 TODO(open-file))。+ */}</div>)}