Skip to content

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

feat(pet): align tool buttons with official secondary button and gravity-ui icons

hairyf1ee6522b8d16
diff --git a/packages/dsh-tauri-pet/src/client/components/icons.tsx b/packages/dsh-tauri-pet/src/client/components/icons.tsx
new file mode 100644
index 00000000..db67eb87
--- /dev/null
+++ b/packages/dsh-tauri-pet/src/client/components/icons.tsx
@@ -0,0 +1,49 @@
+import type { ReactElement, ReactNode, SVGProps } from 'react'
+
+/**
+ * components/icons.tsx — gravity-ui 图标(Gravity UI 风格,currentColor)。
+ *
+ * 与 dsh-tauri-panel-scheduler / dsh-tauri-panel-extension 一致:图标是纯 SVG
+ * path,取自 gravity-ui 上游并固化进源码,免去 client bundle 对额外运行时包的
+ * 解析(@gravity-ui/icons 未在 dsh-tauri-tsdown 的 `dshClientInline` 内联列表
+ * 中,直接 import 会在 ModuleLoader 查表失败)。
+ * 图标源: https://github.com/gravity-ui/icons/blob/main/svgs/<name>.svg
+ * License: MIT, © 2022 YANDEX LLC.
+ */
+
+export type IconProps = SVGProps<SVGSVGElement> & { size?: number }
+
+/** 共享 16×16 描边外壳;`size` 控制渲染尺寸,其余 SVG 属性透传。 */
+function IconShell({ size = 16, children, ...rest }: IconProps & { children: ReactNode }): ReactElement {
+ return (
+ <svg {...rest} xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 16 16" fill="none" aria-hidden="true">
+ {children}
+ </svg>
+ )
+}
+
+/**
+ * Gravity UI Icons `plus.svg`.
+ * Source: https://github.com/gravity-ui/icons/blob/main/svgs/plus.svg
+ * License: MIT, © 2022 YANDEX LLC.
+ */
+export function IconPlus(props: IconProps): ReactElement {
+ return (
+ <IconShell {...props}>
+ <path fill="currentColor" fillRule="evenodd" d="M8 1.75a.75.75 0 0 1 .75.75v4.75h4.75a.75.75 0 0 1 0 1.5H8.75v4.75a.75.75 0 0 1-1.5 0V8.75H2.5a.75.75 0 0 1 0-1.5h4.75V2.5A.75.75 0 0 1 8 1.75" clipRule="evenodd" />
+ </IconShell>
+ )
+}
+
+/**
+ * Gravity UI Icons `arrow-down-to-line.svg`.
+ * Source: https://github.com/gravity-ui/icons/blob/main/svgs/arrow-down-to-line.svg
+ * License: MIT, © 2022 YANDEX LLC.
+ */
+export function IconImport(props: IconProps): ReactElement {
+ return (
+ <IconShell {...props}>
+ <path fill="currentColor" fillRule="evenodd" d="M8.53 11.78a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 0 1 1.06-1.06l1.22 1.22V1.75a.75.75 0 0 1 1.5 0v7.69l1.22-1.22a.75.75 0 1 1 1.06 1.06zM1.75 13.5a.75.75 0 0 0 0 1.5h12.5a.75.75 0 0 0 0-1.5z" clipRule="evenodd" />
+ </IconShell>
+ )
+}
diff --git a/packages/dsh-tauri-pet/src/client/components/pet-settings.tsx b/packages/dsh-tauri-pet/src/client/components/pet-settings.tsx
index 87426aa0..1e219a60 100644
--- a/packages/dsh-tauri-pet/src/client/components/pet-settings.tsx
+++ b/packages/dsh-tauri-pet/src/client/components/pet-settings.tsx
@@ -15,6 +15,7 @@ import {
showPet,
} from '../service/pet'
import { beginPetStatusFetch, commitPetStatusFetch, getPetUiSnapshot, setPetStatus, subscribePetUi } from '../store'
+import { IconImport, IconPlus } from './icons'
interface PetCardProps {
actionLabel: string
@@ -286,7 +287,7 @@ export function PetSettings(props: PetSettingsProps): ReactElement {
? (
<>
<button type="button" className="dshpet-toolBtn" disabled={busy} onClick={() => { void createPet() }}>
- <span aria-hidden="true">+</span>
+ <IconPlus />
{text('create')}
</button>
<button type="button" className="dshpet-toolBtn" disabled={busy} onClick={() => { void toggleVisibility() }}>
@@ -296,7 +297,7 @@ export function PetSettings(props: PetSettingsProps): ReactElement {
)
: (
<label className="dshpet-toolBtn" aria-disabled={busy}>
- <span aria-hidden="true">↓</span>
+ <IconImport />
{text('import')}
<input
type="file"
diff --git a/packages/dsh-tauri-pet/src/client/styles/index.ts b/packages/dsh-tauri-pet/src/client/styles/index.ts
index 08b946d2..c65dc1fa 100644
--- a/packages/dsh-tauri-pet/src/client/styles/index.ts
+++ b/packages/dsh-tauri-pet/src/client/styles/index.ts
@@ -104,48 +104,62 @@ const style = c([
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
- gap: '12px',
+ gap: '16px',
flexWrap: 'wrap',
+ margin: '4px 0 14px',
+ borderBottom: '1px solid var(--dsw-alias-border-l2)',
}),
- c('.dshpet-tabList', { display: 'flex', alignItems: 'center', gap: '4px' }),
+ c('.dshpet-tabList', { display: 'flex', alignItems: 'center', gap: '16px' }),
c('.dshpet-tabBtn', {
appearance: 'none',
- background: '0 0',
+ background: 'transparent',
+ color: 'var(--dsw-alias-label-secondary)',
+ font: 'inherit',
+ fontSize: '13px',
+ lineHeight: '1.5',
border: '0',
+ borderBottom: '2px solid transparent',
cursor: 'pointer',
- padding: '6px 12px',
- borderRadius: '8px',
- fontSize: '13px',
- lineHeight: '20px',
- color: 'var(--dsw-alias-label-secondary, var(--dsw-alias-label-primary))',
+ padding: '8px 0',
}, [
- c('&:hover', { background: 'var(--dsw-alias-bg-layer-1)' }),
+ c('&:hover', { color: 'var(--dsw-alias-label-primary)' }),
]),
c('.dshpet-tabBtn.dshpet-tabBtnActive', {
- background: 'var(--dsw-alias-bg-layer-1)',
+ borderBottomColor: 'currentColor',
color: 'var(--dsw-alias-label-primary)',
- fontWeight: '600',
+ fontWeight: '650',
}),
c('.dshpet-tabTools', { display: 'flex', alignItems: 'center', gap: '6px' }),
+ // —— 工具栏按钮:复刻官方 `.zGbnIq_secondaryButton`(36px 胶囊 secondary)——
+ // 值取自官方 ModelsSection `.secondaryButton`(见 docs/plugins/插件样式对照.done.md §4.4),
+ // 与 dsh-tauri-panel-scheduler 的 K.btn 几何一致;令牌驱动浅/深色自适应。
c('.dshpet-toolBtn', {
appearance: 'none',
- background: '0 0',
- border: '1px solid var(--dsw-alias-border-weak, rgba(127,127,127,0.2))',
+ boxSizing: 'border-box',
+ height: '36px',
+ font: 'inherit',
cursor: 'pointer',
- display: 'inline-flex',
+ border: '.5px solid var(--dsw-alias-border-l3)',
+ borderRadius: '18px',
+ justifyContent: 'center',
alignItems: 'center',
- gap: '6px',
- padding: '5px 10px',
- borderRadius: '8px',
- fontSize: '12px',
- lineHeight: '18px',
- color: 'var(--dsw-alias-label-secondary, var(--dsw-alias-label-primary))',
+ gap: '4px',
+ padding: '0 14px',
+ fontSize: '14px',
+ lineHeight: '22px',
+ display: 'inline-flex',
+ whiteSpace: 'nowrap',
+ color: 'var(--dsw-alias-label-primary)',
+ background: 'transparent',
}, [
- c('&:hover:not(:disabled)', {
- background: 'var(--dsw-alias-bg-layer-1)',
- color: 'var(--dsw-alias-label-primary)',
+ c('&:not(:disabled):hover', {
+ background: 'var(--dsw-alias-interactive-bg-hover-solid)',
+ }),
+ c('&:disabled', { opacity: '.4', cursor: 'default' }),
+ c('&:focus-visible', {
+ boxShadow: '0 0 0 2px var(--dsw-alias-border-l3)',
+ outline: 'none',
}),
- c('&:disabled', { opacity: '0.4', cursor: 'default' }),
]),
c('.dshpet-tabDesc', {
margin: '0',
@@ -191,12 +205,12 @@ const style = c([
borderRadius: '10px',
background: 'var(--dsw-alias-bg-layer-1)',
overflow: 'hidden',
+ objectFit: 'cover',
}),
c('.dshpet-cardThumb > img', {
display: 'block',
width: '100%',
height: '100%',
- objectFit: 'contain',
}),
c('.dshpet-cardThumbSprite', {
position: 'relative',