Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(ui): align HeroUI radii and backdrops with dsh (#845)

Mao Mr24a5479ffb4a
diff --git a/src/components/item.tsx b/src/components/item.tsx
index acf9e414..c322582f 100644
--- a/src/components/item.tsx
+++ b/src/components/item.tsx
@@ -2,16 +2,6 @@ import type { MouseEventHandler, ReactNode } from 'react'
import { Card } from '@heroui/react'
import { cn } from 'tailwind-variants'
-/**
- * 通用列表项:统一 HeroUI「卡片行」骨架(Card + Card.Content 两栏布局),
- * 供各配置面板(plugin / core / profile)与预装插件列表共用,
- * 避免到处重复写 `<Card className="rounded-md bg-panel2 py-3"><Card.Content />`。
- *
- * - left:行左侧主内容(min-w-0,允许截断)
- * - right:行右侧操作区(shrink-0,勾选框 / 按钮 / 状态 chip 等)
- * - footer:主行之后的附加内容(如 ui/config/core 的「本地核心更新」入口)
- * - onClick:传入则整行可点击并显示手型光标
- */
export interface ItemProps {
left?: ReactNode
right?: ReactNode
@@ -23,7 +13,7 @@ export interface ItemProps {
export function Item({ left, right, footer, onClick, className }: ItemProps) {
return (
<Card
- className={cn('rounded-md bg-panel2 py-3', onClick && 'cursor-pointer', className)}
+ className={cn('bg-panel2 py-3', onClick && 'cursor-pointer', className)}
onClick={onClick}
>
<Card.Content className="flex flex-col gap-1.5">
diff --git a/src/components/modal.tsx b/src/components/modal.tsx
index c3b8a91c..15872fff 100644
--- a/src/components/modal.tsx
+++ b/src/components/modal.tsx
@@ -36,10 +36,10 @@ export function Modal(props: ModalProps) {
{props.description}
</AlertDialog.Body>
<AlertDialog.Footer>
- <Button className="rounded-md" variant="tertiary" onPress={disclosure.cancel}>
+ <Button variant="tertiary" onPress={disclosure.cancel}>
{props.cancelText || t('buttons.cancel')}
</Button>
- <Button className="rounded-md" variant={buttonVariant} onPress={disclosure.confirm}>
+ <Button variant={buttonVariant} onPress={disclosure.confirm}>
{props.confirmText || t('buttons.confirm')}
</Button>
</AlertDialog.Footer>
diff --git a/src/components/primitives.ts b/src/components/primitives.ts
index de926c2f..5e411df9 100644
--- a/src/components/primitives.ts
+++ b/src/components/primitives.ts
@@ -1,16 +1,11 @@
import { tv } from 'tailwind-variants'
-// ==================== 按钮 ====================
-// 仅保留给 loadable / setup 加载页使用的按钮样式(其余组件已全部改用 HeroUI)。
-// 对应官方 ui-primitives Button 的两档几何:
-// md(h36 / 圆角 18px 胶囊 / 14px 字号)与 sm(h28 / 圆角 14px 胶囊 / 12px 字号)。
-// 颜色沿用官方 dsw alias token(bg-btn-fill / interactive-bg-* 等)。
export const button = tv({
base: 'inline-flex cursor-pointer items-center justify-center gap-1 transition-colors disabled:cursor-not-allowed disabled:opacity-40',
variants: {
size: {
- sm: 'h-7 rounded-[14px] px-2.5 text-xs',
- md: 'h-9 rounded-[18px] px-3.5 text-sm leading-[22px]',
+ sm: 'h-7 rounded-sm px-2.5 text-xs',
+ md: 'h-9 rounded-md px-3.5 text-sm leading-[22px]',
},
tone: {
primary: 'bg-btn-fill text-btn-ink hover:bg-btn-fill-hover',
diff --git a/src/layout/components/connect-dialog.tsx b/src/layout/components/connect-dialog.tsx
index 84baae76..8036f301 100644
--- a/src/layout/components/connect-dialog.tsx
+++ b/src/layout/components/connect-dialog.tsx
@@ -73,19 +73,18 @@ export function ConnectDialog({ remote }: { remote: Remote }) {
</Modal.Body>
<Modal.Footer>
<If cond={failed}>
- <Button className="rounded-md" variant="tertiary" onPress={() => remote.dismissConnect()}>
+ <Button variant="tertiary" onPress={() => remote.dismissConnect()}>
{t('buttons.close')}
</Button>
- <Button className="rounded-md" variant="primary" onPress={handleRetry}>
+ <Button variant="primary" onPress={handleRetry}>
{t('remote.connect.retry')}
</Button>
</If>
<If cond={!failed}>
- <Button className="rounded-md" variant="tertiary" onPress={() => remote.dismissConnect()}>
+ <Button variant="tertiary" onPress={() => remote.dismissConnect()}>
{t('buttons.close')}
</Button>
<Button
- className="rounded-md"
variant="secondary"
data-testid="connect-cancel"
onPress={() => pendingId !== null && remote.disconnect(pendingId)}
diff --git a/src/layout/components/navbar.tsx b/src/layout/components/navbar.tsx
index 361021ef..25b4f26c 100644
--- a/src/layout/components/navbar.tsx
+++ b/src/layout/components/navbar.tsx
@@ -464,7 +464,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
>
<If cond={onToggleSidebar != null && tauriEnabled}>
<Button
- className="rounded-lg size-7"
+ className="size-7"
isIconOnly
size="sm"
variant="ghost"
@@ -486,7 +486,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
时禁用而不是留着点了没反应的死按钮,与左侧侧边栏开关同一取舍)。 */}
<Dropdown>
<Button
- className="rounded-lg h-6 text-[12.5px] px-1.5"
+ className="h-6 text-[12.5px] px-1.5"
size="sm"
variant="ghost"
aria-label={t('menu.file')}
@@ -494,10 +494,9 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
>
{t('menu.file')}
</Button>
- <Dropdown.Popover className="rounded-md min-w-55" data-testid="dsh-navbar-menu-popover">
+ <Dropdown.Popover className="min-w-55" data-testid="dsh-navbar-menu-popover">
<Dropdown.Menu>
<Dropdown.Item
- className="rounded-md"
id="new-window"
data-testid="dsh-navbar-item-new-window"
textValue={t('menu.new_window')}
@@ -506,7 +505,6 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
<Label>{t('menu.new_window')}</Label>
</Dropdown.Item>
<Dropdown.Item
- className="rounded-md"
id="new-chat"
data-testid="dsh-navbar-item-new-chat"
isDisabled={onNewChat == null}
@@ -516,7 +514,6 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
<ShortcutLabel label={t('menu.new_chat')} hint={shortcutHint(shortcutRows, 'session.new')} />
</Dropdown.Item>
<Dropdown.Item
- className="rounded-md"
id="open-folder"
data-testid="dsh-navbar-item-open-folder"
isDisabled={onOpenFolder == null}
@@ -526,7 +523,6 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
<ShortcutLabel label={t('menu.open_folder')} hint={shortcutHint(shortcutRows, 'workspace.add')} />
</Dropdown.Item>
<Dropdown.Item
- className="rounded-md"
id="close"
data-testid="dsh-navbar-item-close"
textValue={t('menu.close')}
@@ -535,7 +531,6 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
<Label>{t('menu.close')}</Label>
</Dropdown.Item>
<Dropdown.Item
- className="rounded-md"
id="quit"
data-testid="dsh-navbar-item-quit"
textValue={t('menu.quit')}
@@ -548,7 +543,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
</Dropdown>
<Dropdown>
<Button
- className="rounded-lg h-6 text-[12.5px] px-1.5"
+ className="h-6 text-[12.5px] px-1.5"
size="sm"
variant="ghost"
aria-label={t('menu.view')}
@@ -556,14 +551,13 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
>
{t('menu.view')}
</Button>
- <Dropdown.Popover className="rounded-md min-w-55" data-testid="dsh-navbar-menu-popover">
+ <Dropdown.Popover className="min-w-55" data-testid="dsh-navbar-menu-popover">
<Dropdown.Menu>
<Dropdown.Section>
{DSH_VIEW_COMMANDS.map(item => (
<Dropdown.Item
key={item.command}
id={item.command}
- className="rounded-md"
isDisabled={onViewCommand == null || !shortcutRows.some(row => row.id === item.command && row.available === true)}
textValue={t(item.label)}
onAction={() => onViewCommand?.(item.command)}
@@ -573,13 +567,13 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
))}
</Dropdown.Section>
<Dropdown.Section>
- <Dropdown.Item id="zoom-in" className="rounded-md" textValue={t('menu.zoom_in')} onAction={() => store.setting.zoom('increase')}>
+ <Dropdown.Item id="zoom-in" textValue={t('menu.zoom_in')} onAction={() => store.setting.zoom('increase')}>
<ShortcutLabel label={t('menu.zoom_in')} hint="Ctrl + +" />
</Dropdown.Item>
- <Dropdown.Item id="zoom-out" className="rounded-md" textValue={t('menu.zoom_out')} onAction={() => store.setting.zoom('decrease')}>
+ <Dropdown.Item id="zoom-out" textValue={t('menu.zoom_out')} onAction={() => store.setting.zoom('decrease')}>
<ShortcutLabel label={t('menu.zoom_out')} hint="Ctrl + -" />
</Dropdown.Item>
- <Dropdown.Item id="zoom-reset" className="rounded-md" textValue={t('menu.actual_size')} onAction={() => store.setting.zoom('reset')}>
+ <Dropdown.Item id="zoom-reset" textValue={t('menu.actual_size')} onAction={() => store.setting.zoom('reset')}>
<ShortcutLabel label={t('menu.actual_size')} hint="Ctrl + 0" />
</Dropdown.Item>
</Dropdown.Section>
@@ -589,7 +583,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
<Dropdown isOpen={runMenuOpen} onOpenChange={setRunMenuOpen}>
{' '}
<Button
- className="rounded-lg h-6 text-[12.5px] px-1.5"
+ className="h-6 text-[12.5px] px-1.5"
size="sm"
variant="ghost"
aria-label={t('menu.run')}
@@ -597,12 +591,11 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
>
{t('menu.run')}
</Button>
- <Dropdown.Popover className="rounded-md min-w-55" data-testid="dsh-navbar-menu-popover">
+ <Dropdown.Popover className="min-w-55" data-testid="dsh-navbar-menu-popover">
<Dropdown.Menu>
{CONFIG_TABS.map(item => (
<Dropdown.Item
key={item.id}
- className="rounded-md"
id={item.id}
data-testid={`dsh-navbar-item-${item.id}`}
textValue={t(item.labelKey)}
@@ -622,7 +615,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
onPointerUp={event => event.stopPropagation()}
>
<Button
- className="rounded-md size-6 hover:bg-background-tertiary"
+ className="size-6 hover:bg-background-tertiary"
isIconOnly
size="sm"
variant="ghost"
@@ -642,7 +635,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
</Dropdown>
<Dropdown>
<Button
- className="rounded-lg h-6 text-[12.5px] px-1.5"
+ className="h-6 text-[12.5px] px-1.5"
size="sm"
variant="ghost"
aria-label={t('app.help')}
@@ -650,10 +643,9 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
>
{t('app.help')}
</Button>
- <Dropdown.Popover className="rounded-md min-w-55" data-testid="dsh-navbar-menu-popover">
+ <Dropdown.Popover className="min-w-55" data-testid="dsh-navbar-menu-popover">
<Dropdown.Menu>
<Dropdown.Item
- className="rounded-md"
id="keyboard-shortcuts"
data-testid="dsh-navbar-item-keyboard-shortcuts"
isDisabled={onOpenShortcuts == null}
@@ -663,7 +655,6 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
<ShortcutLabel label={t('menu.keyboard_shortcuts')} hint={shortcutHint(shortcutRows, 'shortcuts.open')} />
</Dropdown.Item>
<Dropdown.Item
- className="rounded-md"
id="copy-run-logs"
data-testid="dsh-navbar-item-copy-run-logs"
textValue={t('menu.run_logs')}
@@ -672,7 +663,6 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
<Label>{t('menu.run_logs')}</Label>
</Dropdown.Item>
<Dropdown.Item
- className="rounded-md"
id="check-update"
data-testid="dsh-navbar-item-check-update"
textValue={t('menu.check_update')}
@@ -686,7 +676,6 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
</span>
</Dropdown.Item>
<Dropdown.Item
- className="rounded-md"
id="about"
data-testid="dsh-navbar-item-about"
textValue={t('menu.about')}
@@ -695,7 +684,6 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
<Label>{t('menu.about')}</Label>
</Dropdown.Item>
<Dropdown.Item
- className="rounded-md"
id="documentation"
data-testid="dsh-navbar-item-documentation"
textValue={t('menu.documentation')}
@@ -753,7 +741,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
<If cond={!IS_MACOS}>
<Button
- className="rounded-lg size-7"
+ className="size-7"
isIconOnly
size="sm"
variant="ghost"
@@ -764,7 +752,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
</Button>
<Button
- className="rounded-lg size-7"
+ className="size-7"
isIconOnly
size="sm"
variant="ghost"
@@ -779,7 +767,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
</Button>
<Button
- className="rounded-lg size-7 transition-colors enabled:hover:bg-danger/16 enabled:hover:text-danger"
+ className="size-7 transition-colors enabled:hover:bg-danger/16 enabled:hover:text-danger"
isIconOnly
size="sm"
variant="ghost"
diff --git a/src/layout/components/remote-switcher.tsx b/src/layout/components/remote-switcher.tsx
index 58f5e0d6..a003b13f 100644
--- a/src/layout/components/remote-switcher.tsx
+++ b/src/layout/components/remote-switcher.tsx
@@ -55,7 +55,7 @@ export function RemoteSwitcher({ onChange, visible = true, onManage, onSync }: {
<ConnectDialog remote={remote} />
<Dropdown>
<Button
- className="rounded-lg h-7 text-[12.5px] px-1.5 ml-1 gap-1.5"
+ className="h-7 text-[12.5px] px-1.5 ml-1 gap-1.5"
size="sm"
variant="ghost"
aria-label={t('remote.switcher')}
@@ -70,16 +70,15 @@ export function RemoteSwitcher({ onChange, visible = true, onManage, onSync }: {
/>
</If>
</Button>
- <Dropdown.Popover className="rounded-lg w-72!">
+ <Dropdown.Popover className="w-72!">
<Dropdown.Menu>
<If cond={!available}>
- <Dropdown.Item className="rounded-md" id="remote-degraded" isDisabled textValue={t('remote.degraded')}>
+ <Dropdown.Item id="remote-degraded" isDisabled textValue={t('remote.degraded')}>
<Description className="text-warning">{t('remote.degraded')}</Description>
</Dropdown.Item>
</If>
<Dropdown.Section aria-label={t('remote.section_local')}>
<Dropdown.Item
- className="rounded-md"
id="remote-local"
textValue={t('remote.local')}
onAction={() => { remote.backToLocal() }}
@@ -99,7 +98,7 @@ export function RemoteSwitcher({ onChange, visible = true, onManage, onSync }: {
</Dropdown.Section>
<Dropdown.Section aria-label={t('remote.section_machines')}>
<If cond={machines.length === 0}>
- <Dropdown.Item className="rounded-md" id="remote-empty" isDisabled textValue={t('remote.empty')}>
+ <Dropdown.Item id="remote-empty" isDisabled textValue={t('remote.empty')}>
<Description>{t('remote.empty')}</Description>
</Dropdown.Item>
</If>
@@ -110,7 +109,6 @@ export function RemoteSwitcher({ onChange, visible = true, onManage, onSync }: {
return (
<Dropdown.Item
key={machine.id}
- className="rounded-md"
id={`remote-${machine.id}`}
textValue={machine.name}
isDisabled={!available || pendingId !== null}
@@ -165,7 +163,6 @@ export function RemoteSwitcher({ onChange, visible = true, onManage, onSync }: {
{/* 活动远端连接的一键断开(视图先回本地,再向引擎发断开) */}
<If cond={activeId !== null}>
<Dropdown.Item
- className="rounded-md"
id="remote-disconnect-active"
textValue={t('remote.disconnect_active')}
onAction={() => {
@@ -180,7 +177,6 @@ export function RemoteSwitcher({ onChange, visible = true, onManage, onSync }: {
</Dropdown.Item>
</If>
<Dropdown.Item
- className="rounded-md"
id="remote-manage"
isDisabled={onManage == null}
textValue={t('remote.manage')}
@@ -192,7 +188,6 @@ export function RemoteSwitcher({ onChange, visible = true, onManage, onSync }: {
</span>
</Dropdown.Item>
<Dropdown.Item
- className="rounded-md"
id="remote-sync"
isDisabled={onSync == null}
textValue={t('remote.sync')}
diff --git a/src/layout/components/setup-preinstall.tsx b/src/layout/components/setup-preinstall.tsx
index d66a7646..184300c6 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, onOpenRe
return (
<Card
- className={`h-[124px] gap-1 rounded-lg bg-panel2 p-3 shadow-none transition-colors ${plugin.unsupported ? 'opacity-60' : 'hover:border-line-strong'}`}
+ className={`h-[124px] gap-1 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-info/10 text-info">
@@ -108,7 +108,7 @@ function PluginCard({ plugin, checked, toUninstall, disabled, onToggle, onOpenRe
isIconOnly
size="sm"
variant="ghost"
- className="size-6 shrink-0 rounded-md text-muted"
+ className="size-6 shrink-0 text-muted"
aria-label={t('preinstall.open_repo', { name: plugin.name })}
onPress={() => onOpenRepo(plugin.id)}
>
@@ -157,7 +157,7 @@ function LogPanel({ logs }: { logs: readonly string[] }) {
size="sm"
variant="ghost"
isIconOnly
- className="size-6 shrink-0 rounded-md"
+ className="size-6 shrink-0"
aria-label={t('buttons.copy')}
onPress={copyLogs}
>
@@ -351,7 +351,7 @@ export function PreinstallSetup() {
{preinstall.loadError}
</p>
<Button
- className="h-8 rounded-md"
+ className="h-8"
size="sm"
variant="primary"
onPress={() => void store.preinstall.load()}
@@ -397,14 +397,14 @@ export function PreinstallSetup() {
{/* 操作区:有变更 → 弱「跳过」+ 主「确认」;无变更 → 主按钮独占「跳过」,避免重复入口 */}
<div className="flex items-center justify-end gap-2">
<If cond={hasChanges}>
- <Button className="h-8 rounded-md" size="sm" variant="tertiary" data-testid="dsh-setup-preinstall-skip" onPress={handleSkip} isDisabled={installing}>
+ <Button className="h-8" size="sm" variant="tertiary" data-testid="dsh-setup-preinstall-skip" onPress={handleSkip} isDisabled={installing}>
{t('preinstall.skip')}
</Button>
</If>
<If cond={!hasChanges}>
<Then>
<Button
- className="h-8 rounded-md"
+ className="h-8"
size="sm"
variant="primary"
data-testid="dsh-setup-preinstall-skip"
@@ -416,7 +416,7 @@ export function PreinstallSetup() {
</Then>
<Else>
<Button
- className="h-8 rounded-md"
+ className="h-8"
size="sm"
variant="primary"
onPress={handleConfirm}
@@ -443,11 +443,11 @@ export function PreinstallSetup() {
</div>
<LogPanel logs={preinstall.logs} />
<div className="flex items-center justify-end gap-2">
- <Button className="h-8 rounded-md" size="sm" variant="tertiary" onPress={handleSkip} isDisabled={installing}>
+ <Button className="h-8" size="sm" variant="tertiary" onPress={handleSkip} isDisabled={installing}>
{t('preinstall.skip')}
</Button>
<Button
- className="h-8 rounded-md"
+ className="h-8"
size="sm"
variant="primary"
onPress={handleConfirm}
@@ -518,11 +518,11 @@ export function PreinstallSetup() {
<LogPanel logs={preinstall.logs} />
<div className="flex items-center justify-end gap-2">
- <Button className="h-8 rounded-md" size="sm" variant="tertiary" onPress={handleSkip} isDisabled={granting}>
+ <Button className="h-8" size="sm" variant="tertiary" onPress={handleSkip} isDisabled={granting}>
{t('preinstall.skip')}
</Button>
<Button
- className="h-8 rounded-md"
+ className="h-8"
size="sm"
variant="primary"
onPress={() => void handleGrant(approvals)}
@@ -552,7 +552,7 @@ export function PreinstallSetup() {
{/* 取消安装:网络抖动/限流(429)时可能长时间卡在重试,给用户退出入口 */}
<div className="flex items-center justify-center">
<Button
- className="h-8 rounded-md"
+ className="h-8"
size="sm"
variant="tertiary"
onPress={() => void manager.cancel()}
diff --git a/src/styles/main.css b/src/styles/main.css
index ffb4e3f7..599b0113 100644
--- a/src/styles/main.css
+++ b/src/styles/main.css
@@ -21,11 +21,51 @@
-webkit-app-region: drag;
}
-/* 主题变量:默认深色,html[data-theme="light"] 切换到浅色。
- 取值与官方 dsw alias token(design-platform.css)逐项一致。
- HeroUI 只改写品牌主色 --accent,其余语义变量保持官方默认(官方 variables.css
- 已按 data-theme 提供明暗两套取值)。 */
+@theme inline {
+ --radius-xl: calc(var(--radius) * 1.25);
+ --radius-2xl: calc(var(--radius) * 1.5);
+ --radius-3xl: calc(var(--radius) * 1.75);
+ --radius-4xl: calc(var(--radius) * 2);
+}
+
+@layer components {
+ .button {
+ border-radius: var(--radius-md);
+ }
+
+ .button--sm,
+ .tooltip,
+ .close-button {
+ border-radius: var(--radius-sm);
+ }
+
+ .button--lg,
+ .card,
+ .dropdown__popover,
+ .select__popover,
+ .popover,
+ .toast {
+ border-radius: var(--radius-lg);
+ }
+
+ .menu-item,
+ .list-box-item {
+ border-radius: var(--radius-md);
+ }
+
+ .checkbox__control {
+ border-radius: var(--radius-xs);
+ }
+
+ .checkbox__control::before {
+ border-radius: inherit;
+ }
+}
+
:root {
+ --radius: 16px;
+ --field-radius: 12px;
+ --backdrop: rgba(0, 0, 0, 0.5);
/* === 壳层自有 token === */
--color-canvas: #151517; /* bg-base (bluish-950) */
--color-panel: #1b1b1c; /* specific-sidebar-fill (bluish-900) */
@@ -66,6 +106,7 @@
}
html[data-theme="light"] {
+ --backdrop: rgba(0, 0, 0, 0.24);
--color-canvas: #ffffff; /* bg-base (bluish-00) */
--color-panel: #f9fafb; /* specific-sidebar-fill (bluish-50) */
--color-panel-2: #f5f6f7; /* bg-module-platform / selector (bluish-60) */
diff --git a/src/ui/config/backup.tsx b/src/ui/config/backup.tsx
index e28658de..710993b7 100644
--- a/src/ui/config/backup.tsx
+++ b/src/ui/config/backup.tsx
@@ -146,7 +146,7 @@ export function ConfigBackup({ onBack }: ConfigBackupProps) {
return (
<div className="space-y-3 pl-4">
- <Button variant="tertiary" className="h-8 rounded-md" onPress={onBack}>
+ <Button variant="tertiary" className="h-8" onPress={onBack}>
<ArrowLeft className="size-3.5" />
<span>{t('backup.back_to_profiles')}</span>
</Button>
@@ -156,7 +156,6 @@ export function ConfigBackup({ onBack }: ConfigBackupProps) {
<div className="flex flex-col gap-3">
<Button
variant="primary"
- className="rounded-md"
isDisabled={busy}
onPress={handleCreate}
>
@@ -217,7 +216,7 @@ export function ConfigBackup({ onBack }: ConfigBackupProps) {
<Button
size="sm"
variant="tertiary"
- className="h-7 rounded-md"
+ className="h-7"
isDisabled={busy}
onPress={() => handleRestore(backup.timestamp)}
>
@@ -229,14 +228,14 @@ export function ConfigBackup({ onBack }: ConfigBackupProps) {
<Button
size="sm"
variant="tertiary"
- className="h-7 rounded-md"
+ className="h-7"
isDisabled={busy}
onPress={() => handleRestoreAsNew(backup.timestamp)}
>
{restoring ? t('backup.restoring') : t('backup.restore_as_new')}
</Button>
<Chip
- className={`rounded-md${deleting ? ' cursor-not-allowed opacity-50' : ' cursor-pointer'}`}
+ className={deleting ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'}
variant="primary"
color="danger"
size="sm"
diff --git a/src/ui/config/components/close-action.tsx b/src/ui/config/components/close-action.tsx
index 737a2716..1158f549 100644
--- a/src/ui/config/components/close-action.tsx
+++ b/src/ui/config/components/close-action.tsx
@@ -44,15 +44,15 @@ export function ConfigCloseAction() {
className="w-[140px]"
aria-label={t('ui.close_action')}
>
- <Select.Trigger className="rounded-md min-h-8! h-8 py-0 items-center">
+ <Select.Trigger className="min-h-8! h-8 py-0 items-center">
<Select.Value />
<Select.Indicator />
</Select.Trigger>
- <Select.Popover className="rounded-md">
+ <Select.Popover>
<ListBox>
{CLOSE_ACTION_OPTIONS.map(action => (
<ListBox.Item
- className="rounded-md min-h-8!"
+ className="min-h-8!"
id={action}
key={action}
textValue={t(CLOSE_ACTION_LABEL_KEYS[action])}
diff --git a/src/ui/config/core.tsx b/src/ui/config/core.tsx
index da058a65..9d0bb607 100644
--- a/src/ui/config/core.tsx
+++ b/src/ui/config/core.tsx
@@ -327,7 +327,7 @@ export function ConfigCore() {
<Button
size="sm"
variant="tertiary"
- className="h-7 shrink-0 rounded-md text-xs"
+ className="h-7 shrink-0 text-xs"
isDisabled={busy || refreshing}
aria-label={t('core.refresh')}
onPress={onRefresh}
@@ -400,7 +400,7 @@ export function ConfigCore() {
<Button
size="sm"
variant="tertiary"
- className="h-6 w-6 shrink-0 rounded-md p-0"
+ className="h-6 w-6 shrink-0 p-0"
isDisabled={busy}
aria-label={t('core.open_dir')}
onClick={(event) => {
@@ -441,7 +441,7 @@ export function ConfigCore() {
<Button
size="sm"
variant="tertiary"
- className="h-7 rounded-md text-xs"
+ className="h-7 text-xs"
isDisabled={busy}
onClick={(event) => {
event.stopPropagation()
@@ -457,7 +457,7 @@ export function ConfigCore() {
<Button
size="sm"
variant="tertiary"
- className="h-7 rounded-md text-xs"
+ className="h-7 text-xs"
isDisabled={busy}
onClick={(event) => {
event.stopPropagation()
@@ -473,7 +473,7 @@ export function ConfigCore() {
<Button
size="sm"
variant="tertiary"
- className="h-7 rounded-md text-xs"
+ className="h-7 text-xs"
isDisabled={busy}
onClick={(event) => {
event.stopPropagation()
diff --git a/src/ui/config/debug.tsx b/src/ui/config/debug.tsx
index 6bdb2273..47763edc 100644
--- a/src/ui/config/debug.tsx
+++ b/src/ui/config/debug.tsx
@@ -208,14 +208,12 @@ export function ConfigDebug() {
variant="secondary"
value={info?.service_url ?? '-'}
aria-label={t('ui.service_url')}
- className="font-mono text-xs flex-1 rounded-md"
+ className="font-mono text-xs flex-1"
/>
<Button
size="sm"
variant="ghost"
isIconOnly
- className="rounded-md"
-
onPress={() => onCopyServiceUrl()}
aria-label={t('buttons.copy')}
>
@@ -224,7 +222,6 @@ export function ConfigDebug() {
<Button
size="sm"
variant="ghost"
- className="rounded-md"
isIconOnly
onPress={store.harness.openBrowser}
isDisabled={busyAction !== null}
@@ -240,7 +237,7 @@ export function ConfigDebug() {
<Button
size="sm"
variant="tertiary"
- className="flex-1 rounded-md"
+ className="flex-1"
onPress={store.harness.restart}
isDisabled={busyAction !== null}
>
@@ -250,7 +247,7 @@ export function ConfigDebug() {
<Button
size="sm"
variant="danger"
- className="flex-1 rounded-md"
+ className="flex-1"
onPress={store.harness.shutdown}
isDisabled={busyAction !== null}
>
@@ -287,7 +284,7 @@ export function ConfigDebug() {
size="sm"
variant="ghost"
isIconOnly
- className="size-6 min-w-6 rounded-md"
+ className="size-6 min-w-6"
aria-label={t('app.reveal_dir')}
onPress={() => onRevealDataDir()}
>
@@ -343,13 +340,13 @@ export function ConfigDebug() {
variant="secondary"
value={String(port)}
onChange={e => setPortInput(Number(e.target.value))}
- className="w-24 h-8 rounded-md [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
+ className="w-24 h-8 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
aria-label={t('ui.port')}
/>
<Button
size="sm"
variant="primary"
- className="rounded-md h-8"
+ className="h-8"
onPress={() => onSavePort(port)}
>
{t('buttons.save')}
@@ -365,13 +362,13 @@ export function ConfigDebug() {
value={heapValue}
placeholder={t('ui.heap_limit_auto')}
onChange={e => setHeapInput(e.target.value)}
- className="w-24 h-8 rounded-md [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
+ className="w-24 h-8 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
aria-label={t('ui.heap_limit')}
/>
<Button
size="sm"
variant="primary"
- className="rounded-md h-8"
+ className="h-8"
onPress={() => onSaveHeap(parsedHeap)}
>
{t('buttons.save')}
@@ -387,14 +384,14 @@ export function ConfigDebug() {
className="w-[80px]"
aria-label={t('ui.language')}
>
- <Select.Trigger data-testid="dsh-config-language-select" className="rounded-md min-h-8! h-8 py-0 items-center">
+ <Select.Trigger data-testid="dsh-config-language-select" className="min-h-8! h-8 py-0 items-center">
<Select.Value />
<Select.Indicator />
</Select.Trigger>
- <Select.Popover className="rounded-md">
+ <Select.Popover>
<ListBox>
- <ListBox.Item data-testid="dsh-config-language-option-zh" className="rounded-md min-h-8!" id="zh-CN" textValue={t('ui.languages.zh')}>{t('ui.languages.zh')}</ListBox.Item>
- <ListBox.Item data-testid="dsh-config-language-option-en" className="rounded-md min-h-8!" id="en-US" textValue={t('ui.languages.en')}>{t('ui.languages.en')}</ListBox.Item>
+ <ListBox.Item data-testid="dsh-config-language-option-zh" className="min-h-8!" id="zh-CN" textValue={t('ui.languages.zh')}>{t('ui.languages.zh')}</ListBox.Item>
+ <ListBox.Item data-testid="dsh-config-language-option-en" className="min-h-8!" id="en-US" textValue={t('ui.languages.en')}>{t('ui.languages.en')}</ListBox.Item>
</ListBox>
</Select.Popover>
</Select>
@@ -408,15 +405,15 @@ export function ConfigDebug() {
className="w-[80px]"
aria-label={t('ui.zoom')}
>
- <Select.Trigger className="rounded-md min-h-8! h-8 py-0 items-center">
+ <Select.Trigger className="min-h-8! h-8 py-0 items-center">
<Select.Value />
<Select.Indicator />
</Select.Trigger>
- <Select.Popover className="rounded-md">
+ <Select.Popover>
<ListBox>
{ZOOM_OPTIONS.map(zoomFactor => (
<ListBox.Item
- className="rounded-md min-h-8!"
+ className="min-h-8!"
id={String(zoomFactor)}
key={zoomFactor}
textValue={`${Math.round(zoomFactor * 100)}%`}
diff --git a/src/ui/config/plugin.tsx b/src/ui/config/plugin.tsx
index 060f09b7..cbfd8a30 100644
--- a/src/ui/config/plugin.tsx
+++ b/src/ui/config/plugin.tsx
@@ -22,7 +22,6 @@ import { toast } from '@/utils/toast'
/** 操作 chip 的样式变体:busy 时禁止点击并降低透明度,否则可点击。 */
const actionChip = tv({
- base: 'rounded-md',
variants: {
busy: {
true: 'cursor-not-allowed opacity-50',
@@ -392,7 +391,7 @@ export function ConfigPlugin() {
isIconOnly
size="sm"
variant="ghost"
- className="size-6 shrink-0 rounded-md text-danger"
+ className="size-6 shrink-0 text-danger"
aria-label={t('plugins.abnormal_tooltip')}
>
<CircleExclamation />
@@ -580,7 +579,6 @@ export function ConfigPlugin() {
<Button
size="sm"
variant="primary"
- className="rounded-md"
onPress={store.preinstall.open}
isDisabled={store.preinstall.installing}
>
@@ -602,7 +600,7 @@ export function ConfigPlugin() {
<div className="flex items-center gap-2 px-1">
<Input
variant="secondary"
- className="h-8 flex-1 rounded-md font-mono text-xs"
+ className="h-8 flex-1 font-mono text-xs"
placeholder={t('plugins.install_placeholder')}
aria-label={t('plugins.install_placeholder')}
value={installRef}
@@ -615,7 +613,7 @@ export function ConfigPlugin() {
<Button
size="sm"
variant="tertiary"
- className="h-8 shrink-0 rounded-md"
+ className="h-8 shrink-0"
isDisabled={installRef.trim() === ''}
onPress={() => void onInstall()}
>
diff --git a/src/ui/config/profile.tsx b/src/ui/config/profile.tsx
index 41f94a28..2cdda045 100644
--- a/src/ui/config/profile.tsx
+++ b/src/ui/config/profile.tsx
@@ -400,7 +400,6 @@ export function ConfigProfile() {
</Checkbox.Content>
</Checkbox>
<Chip
- className="rounded-md"
size="sm"
onClick={(event) => {
event.stopPropagation()
@@ -410,7 +409,7 @@ export function ConfigProfile() {
{t('backup.manage')}
</Chip>
<Chip
- className={`rounded-md${busy ? ' cursor-not-allowed opacity-50' : ' cursor-pointer'}`}
+ className={busy ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'}
color="accent"
size="sm"
onClick={(event) => {
@@ -422,7 +421,7 @@ export function ConfigProfile() {
{t('profiles.clone')}
</Chip>
<Chip
- className={`rounded-md${busy ? ' cursor-not-allowed opacity-50' : ' cursor-pointer'}`}
+ className={busy ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'}
variant="primary"
color="danger"
size="sm"
@@ -452,7 +451,7 @@ export function ConfigProfile() {
<Input
autoFocus
variant="secondary"
- className="h-8 flex-1 rounded-md"
+ className="h-8 flex-1"
placeholder={t('profiles.name_placeholder')}
value={name}
onChange={e => setName(e.target.value)}
@@ -461,13 +460,13 @@ export function ConfigProfile() {
commitCreate()
}}
/>
- <Button size="sm" variant="tertiary" className="h-8 rounded-md" onPress={cancelCreate}>
+ <Button size="sm" variant="tertiary" className="h-8" onPress={cancelCreate}>
{t('profiles.create_cancel')}
</Button>
<Button
size="sm"
variant="primary"
- className="h-8 rounded-md"
+ className="h-8"
isDisabled={!name.trim() || createNameHint !== null || busy}
onPress={commitCreate}
>
@@ -486,7 +485,7 @@ export function ConfigProfile() {
<Button
onClick={startCreate}
variant="tertiary"
- className="flex w-full rounded-md"
+ className="flex w-full"
isDisabled={busy}
>
<Plus className="size-3.5" />
@@ -520,7 +519,7 @@ export function ConfigProfile() {
<Input
autoFocus
variant="secondary"
- className="h-8 rounded-md w-full my-2"
+ className="h-8 w-full my-2"
placeholder={t('profiles.clone_name_placeholder')}
value={cloneName}
onChange={e => setCloneName(e.target.value)}
@@ -542,11 +541,10 @@ export function ConfigProfile() {
)}
</AlertDialog.Body>
<AlertDialog.Footer>
- <Button className="rounded-md" variant="tertiary" onPress={() => setCloning(null)}>
+ <Button variant="tertiary" onPress={() => setCloning(null)}>
{t('profiles.clone_cancel')}
</Button>
<Button
- className="rounded-md"
variant="primary"
isDisabled={!cloneName.trim() || cloneNameHint !== null || busy}
onPress={commitClone}
diff --git a/src/ui/dialog/about.tsx b/src/ui/dialog/about.tsx
index 356478e7..d7e39804 100644
--- a/src/ui/dialog/about.tsx
+++ b/src/ui/dialog/about.tsx
@@ -53,7 +53,7 @@ export function DesktopAboutDialog(props: DesktopAboutDialogProps) {
<Button
variant="ghost"
size="sm"
- className="rounded-md h-8"
+ className="h-8"
onPress={() => {
if (about?.repo)
void invoke('open_external_url', { url: about.repo })
diff --git a/src/ui/dialog/core-upgrade-profile.tsx b/src/ui/dialog/core-upgrade-profile.tsx
index 3871a976..2e751c38 100644
--- a/src/ui/dialog/core-upgrade-profile.tsx
+++ b/src/ui/dialog/core-upgrade-profile.tsx
@@ -70,16 +70,15 @@ export function CoreUpgradeProfileDialog(props: CoreUpgradeProfileDialogProps) {
</TextField>
</AlertDialog.Body>
<AlertDialog.Footer className="justify-end">
- <Chip className="rounded-md cursor-pointer" color="warning" variant="soft" onClick={() => disclosure.confirm({ mode: 'ignore' })}>
+ <Chip className="cursor-pointer" color="warning" variant="soft" onClick={() => disclosure.confirm({ mode: 'ignore' })}>
<TriangleExclamationFill width={12} />
{t('core.breaking_ignore')}
</Chip>
<div className="flex flex-row items-center gap-2">
- <Button className="rounded-md" variant="tertiary" onPress={disclosure.cancel}>
+ <Button variant="tertiary" onPress={disclosure.cancel}>
{t('buttons.cancel')}
</Button>
<Button
- className="rounded-md"
variant="primary"
isDisabled={!profileId}
onPress={confirmProfile}
diff --git a/src/ui/dialog/update-core.tsx b/src/ui/dialog/update-core.tsx
index 0b036a1f..8fd1d482 100644
--- a/src/ui/dialog/update-core.tsx
+++ b/src/ui/dialog/update-core.tsx
@@ -113,7 +113,7 @@ export function DownloadCoreDialog(props: DownloadCoreDialogProps) {
</AlertDialog.Body>
<AlertDialog.Footer>
<If cond={error}>
- <Button className="rounded-md" variant="tertiary" onPress={disclosure.cancel}>
+ <Button variant="tertiary" onPress={disclosure.cancel}>
{t('core.download_close')}
</Button>
</If>
diff --git a/src/ui/dialog/update.tsx b/src/ui/dialog/update.tsx
index 6d8f2732..75e371ac 100644
--- a/src/ui/dialog/update.tsx
+++ b/src/ui/dialog/update.tsx
@@ -88,14 +88,12 @@ export function DesktopUpdateDialog(props: DesktopUpdateDialogProps) {
<AlertDialog.Footer>
<Button
variant="tertiary"
- className="rounded-md"
onPress={disclosure.cancel}
>
{t('update.later')}
</Button>
<Button
variant="primary"
- className="rounded-md"
isDisabled={updateInfo == null}
onPress={handlePrimary}
>
diff --git a/src/ui/plugin/recovery.tsx b/src/ui/plugin/recovery.tsx
index e21e88f1..d93479e0 100644
--- a/src/ui/plugin/recovery.tsx
+++ b/src/ui/plugin/recovery.tsx
@@ -87,7 +87,7 @@ export function Recovery({ fullScreen = false }: { fullScreen?: boolean }) {
<div
className={fullScreen
? 'flex h-full w-full items-center justify-center overflow-auto bg-canvas p-6'
- : 'fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4'}
+ : 'fixed inset-0 z-50 flex items-center justify-center bg-backdrop p-4'}
>
<div className={`w-full ${fullScreen ? 'max-w-[640px]' : 'max-w-[560px]'}`}>
{/* 运行期弹窗必须是**不透明**面板:`bg-panel2/40` 只有 40% 不透明度,页面内容会直接
@@ -140,7 +140,6 @@ export function Recovery({ fullScreen = false }: { fullScreen?: boolean }) {
仅传「确有快照」的 id,无快照的插件保持不动(还原会 SNAPSHOT_NOT_FOUND) */}
<If cond={restorableIds.length > 0}>
<Button
- className="rounded-md"
variant="primary"
onPress={() => store.recovery.restoreAndRedetect(restorableIds)}
>
@@ -151,7 +150,6 @@ export function Recovery({ fullScreen = false }: { fullScreen?: boolean }) {
</Button>
</If>
<Button
- className="rounded-md"
variant="danger"
onPress={() => store.recovery.recoverAndRedetect(info.plugins)}
>
@@ -160,16 +158,16 @@ export function Recovery({ fullScreen = false }: { fullScreen?: boolean }) {
{recovery.busy ? t('recovery.removing') : primaryLabel}
</span>
</Button>
- <Button className="rounded-md" variant="tertiary" onPress={() => store.harness.restart()}>
+ <Button variant="tertiary" onPress={() => store.harness.restart()}>
{t('recovery.restart')}
</Button>
- <Button className="rounded-md" variant="ghost" onPress={() => store.harness.enterSafeMode()}>
+ <Button variant="ghost" onPress={() => store.harness.enterSafeMode()}>
<span className="flex items-center gap-1">
<ShieldCheck className="size-4" />
{t('buttons.safe_mode')}
</span>
</Button>
- <Button className="rounded-md" variant="ghost" onPress={() => store.recovery.dismissRecovery()}>
+ <Button variant="ghost" onPress={() => store.recovery.dismissRecovery()}>
{t('recovery.dismiss')}
</Button>
</div>
diff --git a/test/shell-heroui-theme.test.ts b/test/shell-heroui-theme.test.ts
new file mode 100644
index 00000000..3465e207
--- /dev/null
+++ b/test/shell-heroui-theme.test.ts
@@ -0,0 +1,144 @@
+import type { Rule } from 'postcss'
+import { globSync } from 'node:fs'
+import { parse } from 'postcss'
+import ts from 'typescript'
+import { describe, expect, it } from 'vitest'
+import { button } from '../src/components/primitives'
+import { readSource } from './setup/read-source'
+
+const css = parse(readSource('src/styles/main.css'))
+
+function declarations(selector: string): Record<string, string> {
+ const values: Record<string, string> = {}
+ css.walkRules(selector, (rule) => {
+ rule.walkDecls(({ prop, value }) => {
+ values[prop] = value
+ })
+ })
+ return values
+}
+
+function heroRadiusOverrides(path: string): string[] {
+ const source = ts.createSourceFile(path, readSource(path), ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX)
+ const imports = new Set<string>()
+ const overrides: string[] = []
+ for (const node of source.statements) {
+ if (!ts.isImportDeclaration(node) || !ts.isStringLiteral(node.moduleSpecifier) || node.moduleSpecifier.text !== '@heroui/react')
+ continue
+ const bindings = node.importClause?.namedBindings
+ if (bindings && ts.isNamedImports(bindings)) {
+ for (const specifier of bindings.elements)
+ imports.add(specifier.name.text)
+ }
+ }
+ function visit(node: ts.Node) {
+ if (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) {
+ const name = node.tagName.getText(source).split('.')[0]
+ if (imports.has(name)) {
+ for (const attribute of node.attributes.properties) {
+ if (ts.isJsxAttribute(attribute) && attribute.name.getText(source) === 'className') {
+ const text = attribute.initializer?.getText(source) ?? ''
+ if (/\brounded(?:\b|-)/.test(text))
+ overrides.push(`${node.tagName.getText(source)}: ${text}`)
+ }
+ }
+ }
+ }
+ ts.forEachChild(node, visit)
+ }
+ visit(source)
+ return overrides
+}
+
+describe('壳层 HeroUI 通过官方主题机制对齐 dsh', () => {
+ it('半径基准使 xs/sm/md/lg 分别为 4/8/12/16px,输入框为 12px', () => {
+ expect(declarations(':root')).toMatchObject({
+ '--radius': '16px',
+ '--field-radius': '12px',
+ })
+ })
+
+ it('主题扩展将大圆角映射到 dsh 的 20/24/28/32px', () => {
+ const radii: Record<string, string> = {}
+ css.walkAtRules('theme', (rule) => {
+ expect(rule.params).toBe('inline')
+ rule.walkDecls(({ prop, value }) => {
+ radii[prop] = value
+ })
+ })
+ expect(radii).toEqual({
+ '--radius-xl': 'calc(var(--radius) * 1.25)',
+ '--radius-2xl': 'calc(var(--radius) * 1.5)',
+ '--radius-3xl': 'calc(var(--radius) * 1.75)',
+ '--radius-4xl': 'calc(var(--radius) * 2)',
+ })
+ })
+
+ it.each([
+ ['.button', 'var(--radius-md)'],
+ ['.button--sm', 'var(--radius-sm)'],
+ ['.button--lg', 'var(--radius-lg)'],
+ ['.card', 'var(--radius-lg)'],
+ ['.dropdown__popover', 'var(--radius-lg)'],
+ ['.select__popover', 'var(--radius-lg)'],
+ ['.popover', 'var(--radius-lg)'],
+ ['.toast', 'var(--radius-lg)'],
+ ['.menu-item', 'var(--radius-md)'],
+ ['.list-box-item', 'var(--radius-md)'],
+ ['.tooltip', 'var(--radius-sm)'],
+ ['.close-button', 'var(--radius-sm)'],
+ ['.checkbox__control', 'var(--radius-xs)'],
+ ['.checkbox__control::before', 'inherit'],
+ ])('%s 的 BEM 全局定制仅设置圆角 %s', (selector, radius) => {
+ const rules: Rule[] = []
+ css.walkRules((rule) => {
+ const parent = rule.parent
+ if (parent?.type === 'atrule' && parent.name === 'layer' && parent.params === 'components' && rule.selectors.includes(selector))
+ rules.push(rule)
+ })
+ expect(rules).toHaveLength(1)
+ expect(rules[0].nodes?.map(node => node.toString())).toEqual([`border-radius: ${radius}`])
+ })
+
+ it('标签沿用 HeroUI 默认胶囊,不添加重复的 BEM 圆角定制', () => {
+ expect(declarations('.chip')).toEqual({})
+ })
+
+ it('蒙版使用 dsh bg-mask-1:深色黑色 50%、浅色黑色 24%', () => {
+ expect(declarations(':root')['--backdrop']).toBe('rgba(0, 0, 0, 0.5)')
+ expect(declarations('html[data-theme="light"]')['--backdrop']).toBe('rgba(0, 0, 0, 0.24)')
+ })
+
+ it('原生运行期恢复蒙版复用 HeroUI backdrop,不再硬编码 40%', () => {
+ const recovery = readSource('src/ui/plugin/recovery.tsx')
+ expect(recovery).toContain('fixed inset-0 z-50 flex items-center justify-center bg-backdrop p-4')
+ expect(recovery).not.toContain('bg-black/40')
+ })
+
+ it('所有壳层 HeroUI 组件都不再用 rounded 工具类覆盖主题', () => {
+ const paths = globSync('src/**/*.tsx', { cwd: new URL('../', import.meta.url) })
+ .filter(path => !path.endsWith('.test.tsx'))
+ expect(paths.length).toBeGreaterThan(0)
+ const overrides = paths.flatMap(path => heroRadiusOverrides(path).map(override => `${path}: ${override}`))
+ expect(overrides).toEqual([])
+ })
+
+ it('操作 Chip 样式变体不再携带隐藏圆角覆盖', () => {
+ const plugin = readSource('src/ui/config/plugin.tsx')
+ const actionChip = plugin.slice(plugin.indexOf('const actionChip = tv('), plugin.indexOf('const QUEUED_ACTIONS'))
+ expect(actionChip).toContain('cursor-not-allowed opacity-50')
+ expect(actionChip).toContain('cursor-pointer')
+ expect(actionChip).not.toMatch(/\brounded(?:\b|-)/)
+ })
+
+ it.each(['sm', 'md'] as const)('加载页原生 %s 按钮共享官方主题圆角,不保留硬编码胶囊半径', (size) => {
+ const classes = button({ size }).split(/\s+/)
+ expect(classes.filter(className => className.startsWith('rounded'))).toEqual([`rounded-${size}`])
+ expect(readSource('src/components/primitives.ts')).not.toContain('rounded-[')
+ })
+
+ it('加载页原生按钮不重复声明内联圆角', () => {
+ expect(readSource('src/layout/components/loadable.tsx')).not.toContain('borderRadius')
+ expect(readSource('src/layout/components/setup.tsx')).not.toContain('borderRadius')
+ })
+})
diff --git a/test/shell-theme-alignment.test.ts b/test/shell-theme-alignment.test.ts
index 1ce69f06..14c6017d 100644
--- a/test/shell-theme-alignment.test.ts
+++ b/test/shell-theme-alignment.test.ts
@@ -1,11 +1,3 @@
-/**
- * shell-theme-alignment.test.ts — 壳层主题与 dsh alias token 的对齐契约。
- *
- * HeroUI 的 `@theme inline` 会把语义变量(`--accent`、`--surface` …)内联进 Tailwind
- * 工具类,所以壳层只需改写品牌主色 `--accent`:HeroUI 官方 variables.css 已按
- * `data-theme` 提供明暗两套取值,多写反而会让组件外观偏离官方。这里把「只改
- * accent、其余语义变量一律不覆盖」钉死。取值同源:官方 design-platform.css。
- */
import { describe, expect, it } from 'vitest'
import { readSource } from './setup/read-source'
@@ -37,7 +29,6 @@ const herouiSemanticTokens = [
'separator',
'link',
'scrollbar-thumb',
- 'backdrop',
]
function declares(block: string, token: string) {
@@ -52,7 +43,7 @@ describe('壳层主题对齐 dsh alias token', () => {
expect(lightTheme).toMatch(/^\s*--accent-foreground:\s*#ffffff;/m)
})
- it('除 brand-primary 外不覆盖任何 HeroUI 语义变量,保持官方明暗取值', () => {
+ it('除品牌主色和蒙版外不覆盖 HeroUI 语义变量,保持官方明暗取值', () => {
const overridden = herouiSemanticTokens.filter(
token => declares(darkTheme, token) || declares(lightTheme, token),
)