DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
feat(shell): 壳层主题对齐 dsh alias token
hairyf2ddeca9c30f6
diff --git a/src/components/logs.tsx b/src/components/logs.tsxindex 55f90565..c828adf3 100644--- a/src/components/logs.tsx+++ b/src/components/logs.tsx@@ -39,7 +39,7 @@ export function Logs({ logs, limit = 100, header, className, bodyClassName }: Lo// 日志行内容可能重复,需以 index 区分 key// eslint-disable-next-line react/no-array-index-key<p key={`${line}-${index}`} className="m-0 flex gap-2 overflow-hidden text-ellipsis whitespace-nowrap text-log-ink">- <span className="shrink-0 text-accent select-none">›</span>+ <span className="shrink-0 text-info select-none">›</span><span className="min-w-0 overflow-hidden text-ellipsis">{formatLogLine(line)}</span></p>))}diff --git a/src/components/panel.tsx b/src/components/panel.tsxindex 5322e88c..9ea7fba4 100644--- a/src/components/panel.tsx+++ b/src/components/panel.tsx@@ -106,9 +106,9 @@ function Progress({ percentage, logs }: PanelProgressProps) {{percentage != null && (<div className="flex items-center gap-3"><div className="h-2 flex-1 overflow-hidden rounded-full bg-panel2" role="progressbar" aria-valuenow={Math.round(percentage)}>- <div className="h-full bg-gradient-to-r from-accent to-accent2 transition-[width] duration-150" style={{ width: `${Math.min(percentage, 100)}%` }} />+ <div className="h-full bg-gradient-to-r from-info to-info-hover transition-[width] duration-150" style={{ width: `${Math.min(percentage, 100)}%` }} /></div>- <span className="min-w-[44px] text-right text-[13px] font-semibold tabular-nums text-accent2">+ <span className="min-w-[44px] text-right text-[13px] font-semibold tabular-nums text-info-hover">{Math.round(percentage)}%</span>diff --git a/src/layout/components/connect-dialog.tsx b/src/layout/components/connect-dialog.tsxindex 6213cf1e..aef04142 100644--- a/src/layout/components/connect-dialog.tsx+++ b/src/layout/components/connect-dialog.tsx@@ -61,7 +61,7 @@ export function ConnectDialog() {key={`${phase}-${index}`}className={cn('rounded-md px-2 py-0.5 text-xs',- index === all.length - 1 && !failed ? 'bg-accent/10 text-accent' : 'bg-panel2 text-muted',+ index === all.length - 1 && !failed ? 'bg-info/10 text-info' : 'bg-panel2 text-muted',)}>{t(`remote.step.${phase}`)}diff --git a/src/layout/components/setup-preinstall.tsx b/src/layout/components/setup-preinstall.tsxindex affabc9b..ba115b21 100644--- a/src/layout/components/setup-preinstall.tsx+++ b/src/layout/components/setup-preinstall.tsx@@ -61,7 +61,7 @@ function PluginCard({ plugin, checked, toUninstall, disabled, onToggle, onOpenReclassName={`h-[124px] gap-1 rounded-lg bg-panel2 p-3 shadow-none transition-colors ${plugin.unsupported ? 'opacity-60' : 'hover:border-line-strong'}`}><div className="flex min-w-0 items-center gap-1.5">- <span className="grid size-6 shrink-0 place-items-center rounded-md bg-accent/10 text-accent">+ <span className="grid size-6 shrink-0 place-items-center rounded-md bg-info/10 text-info"><PlugConnection className="size-3.5" /></span><span className="min-w-0 flex-1 truncate text-[13px] font-medium text-ink">diff --git a/src/styles/main.css b/src/styles/main.cssindex 58e157c3..a470cc46 100644--- a/src/styles/main.css+++ b/src/styles/main.css@@ -10,7 +10,6 @@body,#root {min-height: 100%;- /* background: #fff; */}}@@ -33,23 +32,20 @@}/* 主题变量:默认深色,html[data-theme="light"] 切换到浅色。- 取值与官方 dsw alias token(design-platform.css)逐项一致 */+ 取值与官方 dsw alias token(design-platform.css)逐项一致。+ HeroUI 语义变量同步改写为 dsw 取值——壳层所有 HeroUI 组件(对话框 / 菜单 /+ 输入 / 通知 / 状态标签)都走这套变量,不得落回 HeroUI 默认调色板。 */:root {- --accent: #4176e6; /* state-business-primary (deepseek-500) */- --accent-hover: #4868b2; /* deepseek-600,hover 变深 */- --danger: #f25a5a; /* state-error-primary (red-400) */-+ /* === 壳层自有 token === */--color-canvas: #151517; /* bg-base (bluish-950) */--color-panel: #1b1b1c; /* specific-sidebar-fill (bluish-900) */- --color-panel-2: #2c2c2e; /* bg-layer-2 / 输入控件底 (bluish-850) */+ --color-panel-2: #2c2c2e; /* bg-layer-2 (bluish-850) */--color-panel-hover: #2c2c2e; /* sidebar-nav-item-hover (bluish-850) */- --color-line: rgba(255, 255, 255, 0.12); /* border-l2 */- --color-line-strong: rgba(255, 255, 255, 0.2); /* border-l4 */+ --color-line: rgba(255, 255, 255, 0.12); /* border-l2 #ffffff1f */+ --color-line-strong: rgba(255, 255, 255, 0.2); /* border-l4 #fff3 */--color-ink: #f9fafb; /* label-primary (bluish-50) */- --color-muted: #adb2b8; /* label-tertiary (bluish-400) */- --color-accent: #679efe; /* state-business-primary (deepseek-400) */- --color-accent-2: #4176e6; /* deepseek-500,hover 变深(同 button-info-hover) */- --color-danger: #f25a5a; /* state-error-primary (red-400) */+ --color-info: #7aaaff; /* state-business-primary (deepseek-400) */+ --color-info-hover: #4176e6; /* button-info-hover (deepseek-500) */--color-ok: #22c55e; /* state-success-primary (green-500) */--color-log-bg: #1b1b1c; /* markdown-code-block (bluish-900) */--color-log-ink: #cfd3d6; /* label-secondary (bluish-300) */@@ -61,32 +57,59 @@--color-load-ink: #f9fafb;--color-load-muted: #adb2b8;--color-load-ring: rgba(255, 255, 255, 0.12);- /* 按钮 token:与官方 dsw alias 逐项一致(button-primary-fill/hover、- interactive-bg-*、border-l2),官方按钮为胶囊形中性色,非蓝色 */- --color-btn-fill: #0f1115;- --color-btn-fill-hover: #43454a;- --color-btn-ink: #ffffff;- --color-btn-border: rgba(0, 0, 0, 0.1);- --color-btn-hover: rgba(38, 49, 72, 0.06);- --color-btn-active: rgba(38, 49, 72, 0.1);- --color-btn-danger-hover: rgba(236, 19, 19, 0.05);+ /* 按钮 token:官方 button-primary-fill 为中性反色(深色下白底深字、+ 浅色下深底白字),hover/active 取 official interactive-bg-* */+ --color-btn-fill: #f9fafb; /* button-primary-fill (bluish-50) */+ --color-btn-fill-hover: #ebeef2; /* button-primary-hover (bluish-100) */+ --color-btn-ink: #0f1115; /* label-primary-foreground (bluish-1000) */+ --color-btn-border: rgba(255, 255, 255, 0.12); /* border-l2 */+ --color-btn-hover: rgba(255, 255, 255, 0.08); /* interactive-bg-hover #ffffff14 */+ --color-btn-active: rgba(255, 255, 255, 0.14); /* interactive-bg-active #ffffff24 */+ --color-btn-danger-hover: rgba(242, 90, 90, 0.12); /* interactive-bg-hover-danger #f25a5a26 *//* 壳层导航栏 token:ShellNavBar 按钮 hover/active 覆盖层(浅色主题同下) */--color-nav-hover: rgba(255, 255, 255, 0.08);- --color-nav-active: rgba(255, 255, 255, 0.12);+ --color-nav-active: rgba(255, 255, 255, 0.14);++ /* === HeroUI 语义变量 → dsw alias === */+ --background: var(--color-canvas); /* bg-base */+ --foreground: var(--color-ink); /* label-primary */+ --surface: #232324; /* bg-layer-1 (bluish-875) */+ --surface-secondary: #2c2c2e; /* bg-layer-2 (bluish-850) */+ --surface-tertiary: #353638; /* bg-layer-3 (bluish-800) */+ --overlay: #2c2c2e; /* bg-layer-2(官方 Modal.module.css) */+ --muted: #adb2b8; /* label-tertiary (bluish-400) */+ --default: #353638; /* interactive-bg-hover-solid (bluish-800) */+ --default-foreground: var(--color-ink);+ --accent: #f9fafb; /* brand-primary (bluish-50) */+ --accent-foreground: #0f1115; /* label-primary-foreground (bluish-1000) */+ --field-background: #232324; /* bg-layer-1(官方 Input.module.css) */+ --field-border: var(--color-line-strong); /* border-l4 */+ --field-border-width: 0.5px; /* 官方 Input.module.css 描边 0.5px */+ --success: var(--color-ok); /* state-success-primary */+ --success-foreground: #0f1115;+ --warning: #f59e0b; /* state-warn-primary (amber-500) */+ --warning-foreground: #0f1115;+ --danger: #f25a5a; /* state-error-primary (red-400) */+ --danger-foreground: #ffffff;+ --segment: #353638; /* specific-selector (bluish-800) */+ --segment-foreground: var(--color-ink);+ --border: var(--color-line); /* border-l2 */+ --separator: rgba(255, 255, 255, 0.06); /* border-l1 #ffffff0f */+ --link: var(--color-info); /* alias-link (deepseek-400) */+ --scrollbar-thumb: var(--color-scroll-thumb);+ --backdrop: rgba(0, 0, 0, 0.5); /* bg-mask-1 #00000080 */}html[data-theme="light"] {--color-canvas: #ffffff; /* bg-base (bluish-00) */--color-panel: #f9fafb; /* specific-sidebar-fill (bluish-50) */- --color-panel-2: #f5f6f7; /* selector / module-platform (bluish-60) */+ --color-panel-2: #f5f6f7; /* bg-module-platform / selector (bluish-60) */--color-panel-hover: #f1f3f5; /* sidebar-nav-item-hover (bluish-75) */- --color-line: rgba(0, 0, 0, 0.1); /* border-l2 */- --color-line-strong: rgba(0, 0, 0, 0.16); /* border-l4 */+ --color-line: rgba(0, 0, 0, 0.1); /* border-l2 #0000001a */+ --color-line-strong: rgba(0, 0, 0, 0.16); /* border-l4 #00000029 */--color-ink: #0f1115; /* label-primary (bluish-1000) */- --color-muted: #81858c; /* label-tertiary (bluish-600) */- --color-accent: #4176e6; /* state-business-primary (deepseek-500) */- --color-accent-2: #679efe; /* deepseek-400,hover 变亮(同 button-info-hover) */- --color-danger: #ec1313; /* state-error-primary (red-600) */+ --color-info: #4176e6; /* state-business-primary (deepseek-500) */+ --color-info-hover: #7aaaff; /* button-info-hover (deepseek-400) */--color-ok: #22c55e; /* state-success-primary (green-500) */--color-log-bg: #f9fafb; /* markdown-code-block (bluish-50) */--color-log-ink: #61666b; /* label-secondary (bluish-700) */@@ -98,16 +121,44 @@ html[data-theme="light"] {--color-load-muted: #81858c;--color-load-ring: rgba(0, 0, 0, 0.1);/* 按钮 token:light 主题对应官方 alias 值 */- --color-btn-fill: #f9fafb;- --color-btn-fill-hover: #ebeef2;- --color-btn-ink: #0f1115;- --color-btn-border: rgba(255, 255, 255, 0.12);- --color-btn-hover: rgba(255, 255, 255, 0.08);- --color-btn-active: rgba(255, 255, 255, 0.14);- --color-btn-danger-hover: rgba(242, 90, 90, 0.15);+ --color-btn-fill: #0f1115; /* button-primary-fill (bluish-1000) */+ --color-btn-fill-hover: #43454a; /* button-primary-hover (bluish-750) */+ --color-btn-ink: #ffffff; /* label-primary-foreground (bluish-00) */+ --color-btn-border: rgba(0, 0, 0, 0.1); /* border-l2 */+ --color-btn-hover: rgba(38, 49, 72, 0.06); /* interactive-bg-hover #2631480f */+ --color-btn-active: rgba(38, 49, 72, 0.1); /* interactive-bg-active #2631481a */+ --color-btn-danger-hover: rgba(236, 19, 19, 0.05); /* interactive-bg-hover-danger #ec13130d *//* 壳层导航栏 token:浅色主题对应官方交互覆盖层 */- --color-nav-hover: rgba(0, 0, 0, 0.06);- --color-nav-active: rgba(0, 0, 0, 0.1);+ --color-nav-hover: rgba(38, 49, 72, 0.06);+ --color-nav-active: rgba(38, 49, 72, 0.1);++ /* === HeroUI 语义变量 → dsw alias(浅色下官方无层级色阶,取 bluish-00/50/75) === */+ --background: var(--color-canvas);+ --foreground: var(--color-ink);+ --surface: #ffffff; /* bg-layer-1 (bluish-00) */+ --surface-secondary: #f9fafb; /* bluish-50 */+ --surface-tertiary: #f1f3f5; /* bluish-75 */+ --overlay: #ffffff; /* bg-layer-2 (bluish-00) */+ --muted: #81858c; /* label-tertiary (bluish-600) */+ --default: #f1f3f5; /* interactive-bg-hover-solid (bluish-75) */+ --default-foreground: var(--color-ink);+ --accent: #0f1115; /* brand-primary (bluish-1000) */+ --accent-foreground: #ffffff; /* label-primary-foreground (bluish-00) */+ --field-background: #ffffff; /* bg-layer-1(官方 Input.module.css) */+ --field-border: var(--color-line-strong); /* border-l4 */+ --success: var(--color-ok);+ --success-foreground: #0f1115;+ --warning: #f59e0b; /* state-warn-primary (amber-500) */+ --warning-foreground: #0f1115;+ --danger: #ec1313; /* state-error-primary (red-600) */+ --danger-foreground: #ffffff;+ --segment: #f5f6f7; /* specific-selector (bluish-60) */+ --segment-foreground: var(--color-ink);+ --border: var(--color-line);+ --separator: rgba(0, 0, 0, 0.04); /* border-l1 #0000000a */+ --link: var(--color-info); /* alias-link (deepseek-500) */+ --scrollbar-thumb: var(--color-scroll-thumb);+ --backdrop: rgba(0, 0, 0, 0.24); /* bg-mask-1 #0000003d */}/* spinner 动画:与官方 web shell boot 页(AppRoot.module.css)逐字一致。diff --git a/src/ui/config/debug.tsx b/src/ui/config/debug.tsxindex 5b639a68..8396616a 100644--- a/src/ui/config/debug.tsx+++ b/src/ui/config/debug.tsx@@ -269,7 +269,7 @@ export function ConfigDebug() {<Info term={t('ui.dsh_version')}><span>{info?.dsh_version ?? '-'}</span><If cond={updateInfo}>- <Link className="ml-2 text-[10px] text-accent" onClick={handleShowNewVersion}>+ <Link className="ml-2 text-[10px] text-info" onClick={handleShowNewVersion}>{t('menu.new_version')}<ChevronRight className="scale-75" /></Link>diff --git a/src/ui/dialog/update.tsx b/src/ui/dialog/update.tsxindex 37d111b5..6d8f2732 100644--- a/src/ui/dialog/update.tsx+++ b/src/ui/dialog/update.tsx@@ -79,7 +79,7 @@ export function DesktopUpdateDialog(props: DesktopUpdateDialogProps) {</div><ProgressBar value={downloadProgress} className="w-full"><ProgressBar.Track>- <ProgressBar.Fill className="bg-accent" />+ <ProgressBar.Fill className="bg-info" /></ProgressBar.Track></ProgressBar></div>diff --git a/tailwind.config.js b/tailwind.config.jsindex e3b3ba20..d1e5f147 100644--- a/tailwind.config.js+++ b/tailwind.config.js@@ -13,10 +13,13 @@ export default {'line': 'var(--color-line)','line-strong': 'var(--color-line-strong)','ink': 'var(--color-ink)',- 'muted': 'var(--color-muted)',- 'accent': 'var(--color-accent)',- 'accent2': 'var(--color-accent-2)',- 'danger': 'var(--color-danger)',+ // muted / accent / danger 与 HeroUI 语义变量同名,取值以 HeroUI 为准+ // (HeroUI 的 @theme inline 会把变量内联进工具类,见 src/styles/main.css)+ 'muted': 'var(--muted)',+ 'accent': 'var(--accent)',+ 'danger': 'var(--danger)',+ 'info': 'var(--color-info)',+ 'info-hover': 'var(--color-info-hover)','ok': 'var(--color-ok)','log-bg': 'var(--color-log-bg)','log-ink': 'var(--color-log-ink)',diff --git a/test/shell-theme-alignment.test.ts b/test/shell-theme-alignment.test.tsnew file mode 100644index 00000000..4d411722--- /dev/null+++ b/test/shell-theme-alignment.test.ts@@ -0,0 +1,84 @@+/**+ * shell-theme-alignment.test.ts — 壳层主题与 dsh alias token 的对齐契约。+ *+ * 壳层的 HeroUI 组件(对话框 / 菜单 / 输入 / 通知 / 状态标签)全部读 HeroUI 语义变量+ * (`--background`、`--surface`、`--accent` …),HeroUI 的 `@theme inline` 又把这些变量+ * 内联进 Tailwind 工具类。一旦某个变量漏配,组件就会悄悄落回 HeroUI 默认调色板,而单测+ * 与 E2E 断言颜色都看不出来——所以这里用源码关系把「深浅两套主题都得有显式 dsw 取值」+ * 钉死。取值同源:官方 design-platform.css。+ */+import { readFileSync } from 'node:fs'+import { describe, expect, it } from 'vitest'++const css = readFileSync(new URL('../src/styles/main.css', import.meta.url), 'utf8')+const [darkTheme = '', lightTheme = ''] = css.split(/^html\[data-theme="light"\] \{/m)++const herouiSemanticTokens = [+ 'background',+ 'foreground',+ 'surface',+ 'surface-secondary',+ 'surface-tertiary',+ 'overlay',+ 'muted',+ 'default',+ 'default-foreground',+ 'accent',+ 'accent-foreground',+ 'field-background',+ 'field-border',+ 'success',+ 'success-foreground',+ 'warning',+ 'warning-foreground',+ 'danger',+ 'danger-foreground',+ 'segment',+ 'segment-foreground',+ 'border',+ 'separator',+ 'link',+ 'scrollbar-thumb',+ 'backdrop',+]++function declares(block: string, token: string) {+ return new RegExp(`^\\s*--${token}:`, 'm').test(block)+}++describe('壳层主题对齐 dsh alias token', () => {+ it('每个 HeroUI 语义变量在深色默认块与 light 块里都有显式取值', () => {+ const missing = herouiSemanticTokens.filter(+ token => !declares(darkTheme, token) || !declares(lightTheme, token),+ )+ expect(missing).toEqual([])+ })++ it('--accent 取 dsw brand-primary(深色白、浅色黑),不再复用蓝色业务色', () => {+ expect(darkTheme).toMatch(/^\s*--accent:\s*#f9fafb;/m)+ expect(lightTheme).toMatch(/^\s*--accent:\s*#0f1115;/m)+ expect(darkTheme).toMatch(/^\s*--accent-foreground:\s*#0f1115;/m)+ expect(lightTheme).toMatch(/^\s*--accent-foreground:\s*#ffffff;/m)+ })++ it('输入控件描边取官方 Input.module.css 的 0.5px + border-l4', () => {+ expect(darkTheme).toMatch(/^\s*--field-border-width:\s*0\.5px;/m)+ expect(darkTheme).toMatch(/^\s*--field-border:\s*var\(--color-line-strong\);/m)+ expect(lightTheme).toMatch(/^\s*--field-border:\s*var\(--color-line-strong\);/m)+ })++ it('不再声明与 HeroUI 同名的 --color-accent/--color-muted/--color-danger(会被内联层覆盖成死值)', () => {+ for (const token of ['--color-accent:', '--color-muted:', '--color-danger:']) {+ expect(css).not.toContain(token)+ }+ })++ it('tailwind.config 把同名颜色指向 HeroUI 语义变量,业务蓝改走 info', () => {+ const config = readFileSync(new URL('../tailwind.config.js', import.meta.url), 'utf8')+ expect(config).toContain('\'muted\': \'var(--muted)\'')+ expect(config).toContain('\'accent\': \'var(--accent)\'')+ expect(config).toContain('\'danger\': \'var(--danger)\'')+ expect(config).toContain('\'info\': \'var(--color-info)\'')+ expect(config).toContain('\'info-hover\': \'var(--color-info-hover)\'')+ })+})