Skip to content

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

feat(ui): 建立以 0.1.7 官方为源的组件层,并加仅 dev 可见的「UI 组件」面板

hairyff47c7b0f8b64
diff --git a/packages/dsh-tauri-ui/src/client/components/add-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/add-button.cssr.ts
new file mode 100644
index 00000000..8cd20deb
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/add-button.cssr.ts
@@ -0,0 +1,29 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { primaryFill, primaryFg, primaryHover } = sharedStyles
+
+// 官方 `addButton` 是 `variant="primary" size="sm"`:几何取 Button base + `sm`,主色取 `primary`(其 `color` 覆盖 base 的 label-primary)。
+export default b('add-button', {
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ gap: '4px',
+ boxSizing: 'border-box',
+ height: '32px',
+ padding: '0 12px',
+ border: 'none',
+ borderRadius: '16px',
+ background: primaryFill,
+ color: primaryFg,
+ fontSize: '13px',
+ lineHeight: '20px',
+ cursor: 'pointer',
+}, [
+ c('&:hover:not(:disabled)', { background: primaryHover }),
+ c('&:disabled', {
+ cursor: 'not-allowed',
+ opacity: '0.4',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/add-button.tsx b/packages/dsh-tauri-ui/src/client/components/add-button.tsx
new file mode 100644
index 00000000..24fe3907
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/add-button.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { AddButtonProps } from './add-button.types'
+import { compact } from 'dsh-tauri/client'
+import { ADD_BUTTON_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import addButtonStyle from './add-button.cssr'
+
+export function AddButton({ icon, className, children, ...rest }: AddButtonProps): ReactElement {
+ useMountStyle(addButtonStyle, ADD_BUTTON_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-add-button', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/add-button.types.ts b/packages/dsh-tauri-ui/src/client/components/add-button.types.ts
new file mode 100644
index 00000000..8f009cd8
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/add-button.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface AddButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.cssr.ts b/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.cssr.ts
new file mode 100644
index 00000000..c514f6cd
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.cssr.ts
@@ -0,0 +1,39 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b, e } } = cssr
+const { dimmed, focusRing, hover, secondary } = sharedStyles
+
+export default b('composer-trigger-chip', {
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+ minWidth: '0',
+ maxWidth: '220px',
+ height: '28px',
+ padding: '0 4px 0 8px',
+ border: 'none',
+ borderRadius: '24px',
+ outline: 'none',
+ background: 'transparent',
+ color: secondary,
+ fontSize: '13px',
+ lineHeight: '20px',
+ fontWeight: '500',
+ cursor: 'pointer',
+}, [
+ c('&:hover:not(:disabled)', { background: hover }),
+ c('&:focus-visible', { ...focusRing }),
+ c('&:disabled', {
+ color: dimmed,
+ cursor: 'default',
+ }),
+ e('chevron', {
+ display: 'inline-flex',
+ flex: '0 0 auto',
+ color: 'var(--dsw-alias-label-caption)',
+ transition: 'transform 120ms ease',
+ }, [
+ c('&[data-open=\'true\']', { transform: 'rotate(180deg)' }),
+ ]),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.tsx b/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.tsx
new file mode 100644
index 00000000..a2e396d6
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.tsx
@@ -0,0 +1,19 @@
+import type { ReactElement } from 'react'
+import type { ComposerTriggerChipProps } from './composer-trigger-chip.types'
+import { compact } from 'dsh-tauri/client'
+import { COMPOSER_TRIGGER_CHIP_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import composerTriggerChipStyle from './composer-trigger-chip.cssr'
+
+export function ComposerTriggerChip({ icon, chevron, open, className, children, ...rest }: ComposerTriggerChipProps): ReactElement {
+ useMountStyle(composerTriggerChipStyle, COMPOSER_TRIGGER_CHIP_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-composer-trigger-chip', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ {chevron === undefined
+ ? null
+ : <span className="dshp-composer-trigger-chip__chevron" data-open={open === true ? 'true' : undefined}>{chevron}</span>}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.types.ts b/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.types.ts
new file mode 100644
index 00000000..1d3cd884
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.types.ts
@@ -0,0 +1,7 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface ComposerTriggerChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+ chevron?: ReactNode
+ open?: boolean
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/danger-outline-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/danger-outline-button.cssr.ts
new file mode 100644
index 00000000..fdae1167
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/danger-outline-button.cssr.ts
@@ -0,0 +1,30 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { error } = sharedStyles
+
+// 上游 `.danger` 是 token 重绑:本地覆盖 --dsw-alias-interactive-bg-hover,让 outline 基类的 hover 洗色变红。
+export default b('danger-outline-button', {
+ 'display': 'inline-flex',
+ 'alignItems': 'center',
+ 'justifyContent': 'center',
+ 'gap': '4px',
+ 'boxSizing': 'border-box',
+ 'height': '36px',
+ 'padding': '0 14px',
+ 'border': `0.5px solid color-mix(in srgb, ${error} 30%, transparent)`,
+ 'borderRadius': '18px',
+ 'background': 'transparent',
+ 'color': error,
+ 'fontSize': '14px',
+ 'lineHeight': '22px',
+ 'cursor': 'pointer',
+ '--dsw-alias-interactive-bg-hover': `color-mix(in srgb, ${error} 8%, transparent)`,
+}, [
+ c('&:hover:not(:disabled)', { background: 'var(--dsw-alias-interactive-bg-hover)' }),
+ c('&:disabled', {
+ cursor: 'not-allowed',
+ opacity: '0.4',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/danger-outline-button.tsx b/packages/dsh-tauri-ui/src/client/components/danger-outline-button.tsx
new file mode 100644
index 00000000..97623940
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/danger-outline-button.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { DangerOutlineButtonProps } from './danger-outline-button.types'
+import { compact } from 'dsh-tauri/client'
+import { DANGER_OUTLINE_BUTTON_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import dangerOutlineButtonStyle from './danger-outline-button.cssr'
+
+export function DangerOutlineButton({ icon, className, children, ...rest }: DangerOutlineButtonProps): ReactElement {
+ useMountStyle(dangerOutlineButtonStyle, DANGER_OUTLINE_BUTTON_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-danger-outline-button', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/danger-outline-button.types.ts b/packages/dsh-tauri-ui/src/client/components/danger-outline-button.types.ts
new file mode 100644
index 00000000..714da55e
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/danger-outline-button.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface DangerOutlineButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/help-icon-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/help-icon-button.cssr.ts
new file mode 100644
index 00000000..ad76f6f7
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/help-icon-button.cssr.ts
@@ -0,0 +1,29 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { brand, secondary, tertiary } = sharedStyles
+
+export default b('help-icon-button', {
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ flex: 'none',
+ width: '24px',
+ height: '24px',
+ padding: '0',
+ border: '0',
+ borderRadius: '6px',
+ background: 'none',
+ color: tertiary,
+ cursor: 'pointer',
+}, [
+ c('&:hover, &:focus-visible, &[aria-expanded=\'true\']', {
+ background: 'var(--dsw-alias-bg-layer-4)',
+ color: secondary,
+ }),
+ c('&:focus-visible', {
+ outline: `2px solid ${brand}`,
+ outlineOffset: '1px',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/help-icon-button.tsx b/packages/dsh-tauri-ui/src/client/components/help-icon-button.tsx
new file mode 100644
index 00000000..8dd109d0
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/help-icon-button.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { HelpIconButtonProps } from './help-icon-button.types'
+import { compact } from 'dsh-tauri/client'
+import { HELP_ICON_BUTTON_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import helpIconButtonStyle from './help-icon-button.cssr'
+
+export function HelpIconButton({ icon, className, children, ...rest }: HelpIconButtonProps): ReactElement {
+ useMountStyle(helpIconButtonStyle, HELP_ICON_BUTTON_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-help-icon-button', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/help-icon-button.types.ts b/packages/dsh-tauri-ui/src/client/components/help-icon-button.types.ts
new file mode 100644
index 00000000..338d9b35
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/help-icon-button.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface HelpIconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/index.ts b/packages/dsh-tauri-ui/src/client/components/index.ts
index d3010696..b2f8cf6f 100644
--- a/packages/dsh-tauri-ui/src/client/components/index.ts
+++ b/packages/dsh-tauri-ui/src/client/components/index.ts
@@ -1,11 +1,43 @@
+export * from './add-button'
+export type * from './add-button.types'
export * from './checkbox'
export type * from './checkbox.types'
+export * from './composer-trigger-chip'
+export type * from './composer-trigger-chip.types'
+export * from './danger-outline-button'
+export type * from './danger-outline-button.types'
+export * from './help-icon-button'
+export type * from './help-icon-button.types'
export * from './icon'
export type * from './icon'
export * from './icons'
export * from './menu-select'
+export * from './message-icon-action'
+export type * from './message-icon-action.types'
export * from './model-extras'
+export * from './model-icon-button'
+export type * from './model-icon-button.types'
+export * from './new-session-button'
+export type * from './new-session-button.types'
+export * from './official'
export * from './panel-page'
+export * from './registry'
+export * from './round-icon-button'
+export type * from './round-icon-button.types'
+export * from './row-icon-button'
+export type * from './row-icon-button.types'
+export * from './search-icon-button'
+export type * from './search-icon-button.types'
+export * from './seat-chip'
+export type * from './seat-chip.types'
export * from './segmented-control'
export type * from './segmented-control.types'
+export * from './settings-selector'
+export type * from './settings-selector.types'
export { circleTreeSvg, clockSvg, FishMark, IconPlaceholder, PanelLeftOutline } from './special-icons'
+export * from './status-tag'
+export type * from './status-tag.types'
+export * from './toolbar-icon-button'
+export type * from './toolbar-icon-button.types'
+export * from './version-tag'
+export type * from './version-tag.types'
diff --git a/packages/dsh-tauri-ui/src/client/components/message-icon-action.cssr.ts b/packages/dsh-tauri-ui/src/client/components/message-icon-action.cssr.ts
new file mode 100644
index 00000000..8b522bd0
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/message-icon-action.cssr.ts
@@ -0,0 +1,28 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { hover, secondary, tertiary } = sharedStyles
+
+export default b('message-icon-action', {
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: 'calc(28px + var(--dsh-content-font-delta, 0px))',
+ height: 'calc(28px + var(--dsh-content-font-delta, 0px))',
+ padding: '6px',
+ border: 'none',
+ borderRadius: '28px',
+ background: 'transparent',
+ color: tertiary,
+ cursor: 'pointer',
+}, [
+ c('&:hover:not(:disabled)', {
+ background: hover,
+ color: secondary,
+ }),
+ c('&:disabled', {
+ cursor: 'default',
+ opacity: '0.4',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/message-icon-action.tsx b/packages/dsh-tauri-ui/src/client/components/message-icon-action.tsx
new file mode 100644
index 00000000..80b56339
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/message-icon-action.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { MessageIconActionProps } from './message-icon-action.types'
+import { compact } from 'dsh-tauri/client'
+import { MESSAGE_ICON_ACTION_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import messageIconActionStyle from './message-icon-action.cssr'
+
+export function MessageIconAction({ icon, className, children, ...rest }: MessageIconActionProps): ReactElement {
+ useMountStyle(messageIconActionStyle, MESSAGE_ICON_ACTION_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-message-icon-action', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/message-icon-action.types.ts b/packages/dsh-tauri-ui/src/client/components/message-icon-action.types.ts
new file mode 100644
index 00000000..8b277431
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/message-icon-action.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface MessageIconActionProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/model-icon-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/model-icon-button.cssr.ts
new file mode 100644
index 00000000..f12e59d8
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/model-icon-button.cssr.ts
@@ -0,0 +1,29 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { focusRing, hover, primary, tertiary } = sharedStyles
+
+export default b('model-icon-button', {
+ boxSizing: 'border-box',
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '28px',
+ height: '28px',
+ border: 'none',
+ borderRadius: '6px',
+ background: 'transparent',
+ color: tertiary,
+ cursor: 'pointer',
+}, [
+ c('&:hover:not(:disabled)', {
+ background: hover,
+ color: primary,
+ }),
+ c('&:disabled', {
+ cursor: 'default',
+ opacity: '0.4',
+ }),
+ c('&:focus-visible', { ...focusRing }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/model-icon-button.tsx b/packages/dsh-tauri-ui/src/client/components/model-icon-button.tsx
new file mode 100644
index 00000000..5ada1a52
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/model-icon-button.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { ModelIconButtonProps } from './model-icon-button.types'
+import { compact } from 'dsh-tauri/client'
+import { MODEL_ICON_BUTTON_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import modelIconButtonStyle from './model-icon-button.cssr'
+
+export function ModelIconButton({ icon, className, children, ...rest }: ModelIconButtonProps): ReactElement {
+ useMountStyle(modelIconButtonStyle, MODEL_ICON_BUTTON_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-model-icon-button', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/model-icon-button.types.ts b/packages/dsh-tauri-ui/src/client/components/model-icon-button.types.ts
new file mode 100644
index 00000000..7bb72f4b
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/model-icon-button.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface ModelIconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/new-session-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/new-session-button.cssr.ts
new file mode 100644
index 00000000..6775f23c
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/new-session-button.cssr.ts
@@ -0,0 +1,33 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { borderL3, primary } = sharedStyles
+
+export default b('new-session-button', {
+ display: 'flex',
+ flex: 'none',
+ alignItems: 'center',
+ justifyContent: 'center',
+ gap: '6px',
+ boxSizing: 'border-box',
+ width: '100%',
+ height: '38px',
+ padding: '8px 16px',
+ font: 'inherit',
+ fontSize: '14px',
+ fontWeight: '500',
+ lineHeight: '22px',
+ color: primary,
+ background: 'var(--dsw-alias-button-elevated-fill)',
+ border: `0.5px solid ${borderL3}`,
+ borderRadius: '12px',
+ cursor: 'pointer',
+ overflow: 'hidden',
+}, [
+ c('&:hover:not(:disabled)', { background: 'var(--dsw-alias-button-floating-hover)' }),
+ c('&:disabled', {
+ cursor: 'not-allowed',
+ opacity: '0.5',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/new-session-button.tsx b/packages/dsh-tauri-ui/src/client/components/new-session-button.tsx
new file mode 100644
index 00000000..a766090a
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/new-session-button.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { NewSessionButtonProps } from './new-session-button.types'
+import { compact } from 'dsh-tauri/client'
+import { NEW_SESSION_BUTTON_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import newSessionButtonStyle from './new-session-button.cssr'
+
+export function NewSessionButton({ icon, className, children, ...rest }: NewSessionButtonProps): ReactElement {
+ useMountStyle(newSessionButtonStyle, NEW_SESSION_BUTTON_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-new-session-button', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/new-session-button.types.ts b/packages/dsh-tauri-ui/src/client/components/new-session-button.types.ts
new file mode 100644
index 00000000..73f7dd8d
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/new-session-button.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface NewSessionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/official.tsx b/packages/dsh-tauri-ui/src/client/components/official.tsx
index 4dcc2941..a458b5b7 100644
--- a/packages/dsh-tauri-ui/src/client/components/official.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/official.tsx
@@ -1,33 +1,113 @@
+/**
+ * 官方 `@deepseek-ai/dsh-client-ui-primitives` 的直通转发层。
+ *
+ * 只转发 **0.1.5-rc.1 与 0.1.7-alpha.1 都导出** 的成员(判定依据见 `registry.ts` 的
+ * `availableAt`):两代内核拿到同一个官方实现,本包不复制样式,也不制造版本漂移。
+ *
+ * 仅 0.1.7 才有的组件必须在本目录 refork(`checkbox`、`segmented-control` 就是先例),
+ * 否则在 0.1.5 内核上取到 `undefined` 并触发 React #130(`Element type is invalid …`)。
+ *
+ * 不在此转发官方 icons 桶:两代导出名不同(`IconXxx16` → `IconXxxRegular`),图标
+ * 统一走 `@gravity-ui/icons`(见 `icons.tsx`)。也不转发 `ReferenceIcon` / `LinkIcon`:
+ * 0.1.7 已删除这两个名字,改为 `ReferenceIcon{Regular,Medium}` / `LinkIcon{Regular,Medium}`。
+ */
+
export {
BrandWordmark,
Button,
+ classifyFileType,
+ classifyLinkPath,
+ CodeBlock,
ConnectionIndicator,
+ DEFAULT_DIFF_MAX_LINES,
+ DEFAULT_READ_MAX_LINES,
+ DEFAULT_SEARCH_MAX_LINES,
+ DEFAULT_TERMINAL_MAX_LINES,
+ DiffBlock,
+ diffTotals,
DisclosureRow,
+ extractMarkdownPlainText,
+ fileExtension,
+ fileSizeText,
+ FileTypeIcon,
FISH_LOGO_PATH,
FISH_LOGO_VIEWBOX,
FishLogo,
HoverCard,
Input,
+ JsonBlock,
+ JsonTree,
+ MarkdownText,
Menu,
Modal,
+ OnboardingSurface,
Pill,
+ projectUserText,
+ rankByName,
+ ReadBlock,
+ relativeTime,
+ RiskConfirmation,
+ SearchBlock,
StateDot,
Switch,
Tag,
+ TerminalBlock,
Toast,
Tooltip,
+ WebBlock,
+ writeClipboard,
} from '@deepseek-ai/dsh-client-ui-primitives'
export type {
+ AnchoredPositionOptions,
BrandWordmarkProps,
ButtonVariant,
+ CodeBlockProps,
ConnectionIndicatorState,
+ DiffBlockLabels,
+ DiffBlockProps,
+ DiffHunk,
DisclosureRowProps,
+ FileType,
+ FileTypeIconProps,
+ FileTypeKind,
+ FileTypeProjectContext,
+ JsonTreeLabels,
+ JsonTreeProps,
+ LinkIconKind,
+ LinkIconProps,
+ MarkdownCodeLabels,
+ MarkdownFileMentions,
+ MarkdownLabels,
+ MarkdownPathImages,
+ MarkdownPlainTextMode,
+ MarkdownPlainTextOptions,
MenuEntry,
MenuItem,
MenuLabel,
MenuSeparator,
+ ReadBlockLabels,
+ ReadBlockLine,
+ ReadBlockProps,
+ ReferenceIconKind,
+ ReferenceIconProps,
+ RelativeTime,
+ RelativeTimeUnit,
+ RiskConfirmationProps,
+ SearchBlockLabels,
+ SearchBlockLineMatch,
+ SearchBlockProps,
+ SearchFileGroup,
+ SearchMatchesBlockProps,
+ SearchPathsBlockProps,
StateDotState,
TagTone,
+ TerminalBlockLabels,
+ TerminalBlockProps,
TooltipSide,
+ WebBlockLabels,
+ WebBlockProps,
+ WebFetchBlockProps,
+ WebSearchBlockProps,
+ WebSourceView,
} from '@deepseek-ai/dsh-client-ui-primitives'
diff --git a/packages/dsh-tauri-ui/src/client/components/round-icon-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/round-icon-button.cssr.ts
new file mode 100644
index 00000000..107fc9e0
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/round-icon-button.cssr.ts
@@ -0,0 +1,28 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { hover, secondary } = sharedStyles
+
+export default b('round-icon-button', {
+ position: 'relative',
+ flex: 'none',
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '28px',
+ height: '28px',
+ border: 'none',
+ borderRadius: '50%',
+ cornerShape: 'round',
+ padding: '0',
+ background: 'transparent',
+ cursor: 'pointer',
+ color: secondary,
+}, [
+ c('&:hover:not(:disabled)', { background: hover }),
+ c('&:disabled', {
+ cursor: 'default',
+ opacity: '0.5',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/round-icon-button.tsx b/packages/dsh-tauri-ui/src/client/components/round-icon-button.tsx
new file mode 100644
index 00000000..1cf4bb11
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/round-icon-button.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { RoundIconButtonProps } from './round-icon-button.types'
+import { compact } from 'dsh-tauri/client'
+import { ROUND_ICON_BUTTON_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import roundIconButtonStyle from './round-icon-button.cssr'
+
+export function RoundIconButton({ icon, className, children, ...rest }: RoundIconButtonProps): ReactElement {
+ useMountStyle(roundIconButtonStyle, ROUND_ICON_BUTTON_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-round-icon-button', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/round-icon-button.types.ts b/packages/dsh-tauri-ui/src/client/components/round-icon-button.types.ts
new file mode 100644
index 00000000..568e869c
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/round-icon-button.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface RoundIconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/row-icon-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/row-icon-button.cssr.ts
new file mode 100644
index 00000000..306d7589
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/row-icon-button.cssr.ts
@@ -0,0 +1,26 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { primary, tertiary } = sharedStyles
+
+export default b('row-icon-button', {
+ flex: 'none',
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '16px',
+ height: '16px',
+ border: 'none',
+ borderRadius: '4px',
+ padding: '0',
+ background: 'transparent',
+ cursor: 'pointer',
+ color: tertiary,
+}, [
+ c('&:hover:not(:disabled)', { color: primary }),
+ c('&:disabled', {
+ cursor: 'default',
+ opacity: '0.5',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/row-icon-button.tsx b/packages/dsh-tauri-ui/src/client/components/row-icon-button.tsx
new file mode 100644
index 00000000..b37b0525
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/row-icon-button.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { RowIconButtonProps } from './row-icon-button.types'
+import { compact } from 'dsh-tauri/client'
+import { ROW_ICON_BUTTON_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import rowIconButtonStyle from './row-icon-button.cssr'
+
+export function RowIconButton({ icon, className, children, ...rest }: RowIconButtonProps): ReactElement {
+ useMountStyle(rowIconButtonStyle, ROW_ICON_BUTTON_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-row-icon-button', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/row-icon-button.types.ts b/packages/dsh-tauri-ui/src/client/components/row-icon-button.types.ts
new file mode 100644
index 00000000..df2be515
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/row-icon-button.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface RowIconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/search-icon-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/search-icon-button.cssr.ts
new file mode 100644
index 00000000..1fb60a4b
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/search-icon-button.cssr.ts
@@ -0,0 +1,22 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { hover } = sharedStyles
+
+export default b('search-icon-button', {
+ display: 'inline-flex',
+ flex: 'none',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '28px',
+ height: '28px',
+ padding: 0,
+ border: 'none',
+ borderRadius: '50%',
+ background: 'transparent',
+ color: 'inherit',
+ cursor: 'pointer',
+}, [
+ c('&:hover', { background: hover }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/search-icon-button.tsx b/packages/dsh-tauri-ui/src/client/components/search-icon-button.tsx
new file mode 100644
index 00000000..c1b97973
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/search-icon-button.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { SearchIconButtonProps } from './search-icon-button.types'
+import { compact } from 'dsh-tauri/client'
+import { SEARCH_ICON_BUTTON_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import searchIconButtonStyle from './search-icon-button.cssr'
+
+export function SearchIconButton({ icon, className, children, ...rest }: SearchIconButtonProps): ReactElement {
+ useMountStyle(searchIconButtonStyle, SEARCH_ICON_BUTTON_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-search-icon-button', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/search-icon-button.types.ts b/packages/dsh-tauri-ui/src/client/components/search-icon-button.types.ts
new file mode 100644
index 00000000..abd36022
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/search-icon-button.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface SearchIconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/seat-chip.cssr.ts b/packages/dsh-tauri-ui/src/client/components/seat-chip.cssr.ts
new file mode 100644
index 00000000..63705372
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/seat-chip.cssr.ts
@@ -0,0 +1,35 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b, e } } = cssr
+const { hover, primary } = sharedStyles
+
+export default b('seat-chip', {
+ display: 'inline-flex',
+ alignItems: 'center',
+ gap: '4px',
+ minWidth: '0',
+ maxWidth: 'min(100%, 240px)',
+ minHeight: '28px',
+ padding: '0 8px',
+ border: 'none',
+ borderRadius: '16px',
+ background: 'transparent',
+ color: primary,
+ fontSize: '13px',
+ lineHeight: '20px',
+ fontWeight: '500',
+ whiteSpace: 'nowrap',
+ cursor: 'pointer',
+}, [
+ c('&:not(:disabled):hover, &[aria-expanded=\'true\']', { background: hover }),
+ c('&:disabled', {
+ cursor: 'default',
+ color: 'var(--dsw-alias-label-quaternary)',
+ }),
+ e('chevron', {
+ display: 'inline-flex',
+ flex: '0 0 auto',
+ color: 'var(--dsw-alias-label-caption)',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/seat-chip.tsx b/packages/dsh-tauri-ui/src/client/components/seat-chip.tsx
new file mode 100644
index 00000000..e9760b8c
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/seat-chip.tsx
@@ -0,0 +1,17 @@
+import type { ReactElement } from 'react'
+import type { SeatChipProps } from './seat-chip.types'
+import { compact } from 'dsh-tauri/client'
+import { SEAT_CHIP_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import seatChipStyle from './seat-chip.cssr'
+
+export function SeatChip({ icon, chevron, className, children, ...rest }: SeatChipProps): ReactElement {
+ useMountStyle(seatChipStyle, SEAT_CHIP_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-seat-chip', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ {chevron === undefined ? null : <span className="dshp-seat-chip__chevron">{chevron}</span>}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/seat-chip.types.ts b/packages/dsh-tauri-ui/src/client/components/seat-chip.types.ts
new file mode 100644
index 00000000..f1d3aecf
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/seat-chip.types.ts
@@ -0,0 +1,6 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface SeatChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+ chevron?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/settings-selector.cssr.ts b/packages/dsh-tauri-ui/src/client/components/settings-selector.cssr.ts
new file mode 100644
index 00000000..848ed0f3
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/settings-selector.cssr.ts
@@ -0,0 +1,29 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b, e } } = cssr
+const { hover, modulePlatform, primary } = sharedStyles
+
+export default b('settings-selector', {
+ display: 'inline-flex',
+ alignItems: 'center',
+ gap: '12px',
+ height: '36px',
+ padding: '0 14px',
+ border: 'none',
+ borderRadius: '18px',
+ background: modulePlatform,
+ font: 'inherit',
+ fontSize: '14px',
+ lineHeight: '22px',
+ color: primary,
+ cursor: 'pointer',
+}, [
+ c('&:hover:not(:disabled)', { background: hover }),
+ c('&:disabled', { cursor: 'default' }),
+ e('chevron', {
+ display: 'inline-flex',
+ flex: '0 0 auto',
+ color: 'var(--dsw-alias-label-caption)',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/settings-selector.tsx b/packages/dsh-tauri-ui/src/client/components/settings-selector.tsx
new file mode 100644
index 00000000..115dbbda
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/settings-selector.tsx
@@ -0,0 +1,17 @@
+import type { ReactElement } from 'react'
+import type { SettingsSelectorProps } from './settings-selector.types'
+import { compact } from 'dsh-tauri/client'
+import { SETTINGS_SELECTOR_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import settingsSelectorStyle from './settings-selector.cssr'
+
+export function SettingsSelector({ icon, chevron, className, children, ...rest }: SettingsSelectorProps): ReactElement {
+ useMountStyle(settingsSelectorStyle, SETTINGS_SELECTOR_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-settings-selector', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ {chevron === undefined ? null : <span className="dshp-settings-selector__chevron">{chevron}</span>}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/settings-selector.types.ts b/packages/dsh-tauri-ui/src/client/components/settings-selector.types.ts
new file mode 100644
index 00000000..d602d0cb
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/settings-selector.types.ts
@@ -0,0 +1,6 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface SettingsSelectorProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+ chevron?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/status-tag.cssr.ts b/packages/dsh-tauri-ui/src/client/components/status-tag.cssr.ts
new file mode 100644
index 00000000..0592d25d
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/status-tag.cssr.ts
@@ -0,0 +1,32 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { borderL4, business, error, tertiary } = sharedStyles
+
+// 上游 `.statusTag` 挂在 `<Tag tone="info">`(beta)/ `tone="danger"`(problem)上,是色调胶囊而非品牌实心,故按 tone 复刻调色板。
+export default b('status-tag', {
+ display: 'inline-flex',
+ alignItems: 'center',
+ height: '18px',
+ padding: '0 7px',
+ borderRadius: '999px',
+ cornerShape: 'round',
+ fontSize: '10px',
+ lineHeight: '1',
+ fontWeight: '500',
+ whiteSpace: 'nowrap',
+}, [
+ c('&[data-tone=\'outline\']', {
+ border: `0.5px solid ${borderL4}`,
+ color: tertiary,
+ }),
+ c('&[data-tone=\'info\']', {
+ background: `color-mix(in srgb, ${business} 10%, transparent)`,
+ color: business,
+ }),
+ c('&[data-tone=\'danger\']', {
+ background: `color-mix(in srgb, ${error} 10%, transparent)`,
+ color: error,
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/status-tag.tsx b/packages/dsh-tauri-ui/src/client/components/status-tag.tsx
new file mode 100644
index 00000000..da41c514
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/status-tag.tsx
@@ -0,0 +1,15 @@
+import type { ReactElement } from 'react'
+import type { StatusTagProps } from './status-tag.types'
+import { compact } from 'dsh-tauri/client'
+import { STATUS_TAG_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import statusTagStyle from './status-tag.cssr'
+
+export function StatusTag({ tone = 'outline', className, children, ...rest }: StatusTagProps): ReactElement {
+ useMountStyle(statusTagStyle, STATUS_TAG_STYLE_ID)
+ return (
+ <span className={compact(['dshp-status-tag', className]).join(' ')} data-tone={tone} {...rest}>
+ {children}
+ </span>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/status-tag.types.ts b/packages/dsh-tauri-ui/src/client/components/status-tag.types.ts
new file mode 100644
index 00000000..c96165d4
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/status-tag.types.ts
@@ -0,0 +1,7 @@
+import type { HTMLAttributes } from 'react'
+
+export type StatusTagTone = 'outline' | 'info' | 'danger'
+
+export interface StatusTagProps extends HTMLAttributes<HTMLSpanElement> {
+ tone?: StatusTagTone
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.cssr.ts
new file mode 100644
index 00000000..33fd6146
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.cssr.ts
@@ -0,0 +1,32 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { brand, hover, secondary } = sharedStyles
+
+export default b('toolbar-icon-button', {
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ flex: 'none',
+ width: '28px',
+ height: '28px',
+ border: '0',
+ borderRadius: '28px',
+ background: 'transparent',
+ color: 'var(--dsw-alias-label-caption)',
+ cursor: 'pointer',
+}, [
+ c('&:hover:not(:disabled)', {
+ background: hover,
+ color: secondary,
+ }),
+ c('&:disabled', {
+ opacity: '0.5',
+ cursor: 'default',
+ }),
+ c('&:focus-visible', {
+ outline: `2px solid ${brand}`,
+ outlineOffset: '1px',
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.tsx b/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.tsx
new file mode 100644
index 00000000..f855ac3d
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.tsx
@@ -0,0 +1,16 @@
+import type { ReactElement } from 'react'
+import type { ToolbarIconButtonProps } from './toolbar-icon-button.types'
+import { compact } from 'dsh-tauri/client'
+import { TOOLBAR_ICON_BUTTON_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import toolbarIconButtonStyle from './toolbar-icon-button.cssr'
+
+export function ToolbarIconButton({ icon, className, children, ...rest }: ToolbarIconButtonProps): ReactElement {
+ useMountStyle(toolbarIconButtonStyle, TOOLBAR_ICON_BUTTON_STYLE_ID)
+ return (
+ <button type="button" className={compact(['dshp-toolbar-icon-button', className]).join(' ')} {...rest}>
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.types.ts b/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.types.ts
new file mode 100644
index 00000000..ba8be670
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.types.ts
@@ -0,0 +1,5 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export interface ToolbarIconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ icon?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/version-tag.cssr.ts b/packages/dsh-tauri-ui/src/client/components/version-tag.cssr.ts
new file mode 100644
index 00000000..50d92525
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/version-tag.cssr.ts
@@ -0,0 +1,29 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b } } = cssr
+const { borderL4, modulePlatform, secondary, tertiary } = sharedStyles
+
+// 上游 `versionTag` 用 `tone="neutral"`(平台灰填充),故以 neutral 为默认色;outline 保留为可选色调。
+export default b('version-tag', {
+ display: 'inline-flex',
+ alignItems: 'center',
+ flex: 'none',
+ padding: '1px 8px',
+ borderRadius: '999px',
+ cornerShape: 'round',
+ fontSize: '11px',
+ lineHeight: '17px',
+ fontWeight: '500',
+ whiteSpace: 'nowrap',
+ fontVariantNumeric: 'tabular-nums',
+}, [
+ c('&[data-tone=\'outline\']', {
+ border: `0.5px solid ${borderL4}`,
+ color: tertiary,
+ }),
+ c('&[data-tone=\'neutral\']', {
+ background: modulePlatform,
+ color: secondary,
+ }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/version-tag.tsx b/packages/dsh-tauri-ui/src/client/components/version-tag.tsx
new file mode 100644
index 00000000..75e374e6
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/version-tag.tsx
@@ -0,0 +1,15 @@
+import type { ReactElement } from 'react'
+import type { VersionTagProps } from './version-tag.types'
+import { compact } from 'dsh-tauri/client'
+import { VERSION_TAG_STYLE_ID } from '../constants'
+import { useMountStyle } from '../hooks/use-mount-style'
+import versionTagStyle from './version-tag.cssr'
+
+export function VersionTag({ tone = 'neutral', className, children, ...rest }: VersionTagProps): ReactElement {
+ useMountStyle(versionTagStyle, VERSION_TAG_STYLE_ID)
+ return (
+ <span className={compact(['dshp-version-tag', className]).join(' ')} data-tone={tone} {...rest}>
+ {children}
+ </span>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/version-tag.types.ts b/packages/dsh-tauri-ui/src/client/components/version-tag.types.ts
new file mode 100644
index 00000000..037473b2
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/version-tag.types.ts
@@ -0,0 +1,7 @@
+import type { HTMLAttributes } from 'react'
+
+export type VersionTagTone = 'outline' | 'neutral'
+
+export interface VersionTagProps extends HTMLAttributes<HTMLSpanElement> {
+ tone?: VersionTagTone
+}
diff --git a/packages/dsh-tauri-ui/src/client/constants/index.ts b/packages/dsh-tauri-ui/src/client/constants/index.ts
index a707d4fa..1db192e9 100644
--- a/packages/dsh-tauri-ui/src/client/constants/index.ts
+++ b/packages/dsh-tauri-ui/src/client/constants/index.ts
@@ -38,6 +38,19 @@ export const MESSAGE_ICON_ACTION_STYLE_ID = 'dsh-tauri-ui-message-icon-action-st
export const SETTINGS_SELECTOR_STYLE_ID = 'dsh-tauri-ui-settings-selector-styles'
export const VERSION_TAG_STYLE_ID = 'dsh-tauri-ui-version-tag-styles'
export const STATUS_TAG_STYLE_ID = 'dsh-tauri-ui-status-tag-styles'
+export const MODEL_ICON_BUTTON_STYLE_ID = 'dsh-tauri-ui-model-icon-button-styles'
+export const ROUND_ICON_BUTTON_STYLE_ID = 'dsh-tauri-ui-round-icon-button-styles'
+
+/**
+ * 仅 dev 构建挂载的「UI 组件」调试面板。
+ *
+ * 面板入口排在 IM(40)之后;是否挂载由宿主命令 `is_dev_build` 决定——插件侧没有
+ * 可用的构建期开关(`dsh-tauri-tsdown` 无条件把 `process.env.NODE_ENV` 定成
+ * `'production'`,也不替换 `import.meta.env`)。
+ */
+export const UI_COMPONENTS_PANEL_ID = 'dsh-tauri-ui-components'
+export const UI_COMPONENTS_PANEL_ORDER = 50
+export const UI_COMPONENTS_STYLE_ID = 'dsh-tauri-ui-components-styles'
/** 接管后的英雄区工作区选择控件(官方 chip 由样式隐藏,见 `components/hero-workspace.cssr.ts`)。 */
export const HERO_WORKSPACE_CHIP_CLASS = 'dshp-hero-workspace'
@@ -77,6 +90,7 @@ export const SECTIONS_EFFECT = `${PLUGIN_ID}: settings sections projection`
export const SETTINGS_EFFECT = `${PLUGIN_ID}: settings panel`
export const OBSTRUCTIONS_EFFECT = `${PLUGIN_ID}: settings obstructions`
export const IM_PANEL_EFFECT = `${PLUGIN_ID}: im panel`
+export const UI_COMPONENTS_EFFECT = `${PLUGIN_ID}: ui components panel`
export const HERO_WORKSPACE_EFFECT = `${PLUGIN_ID}: hero workspace picker`
export const NEW_SESSION_EFFECT = `${PLUGIN_ID}: sidebar new session`
export const UNGROUPED_NEW_SESSION_EFFECT = `${PLUGIN_ID}: sidebar ungrouped new session`
diff --git a/packages/dsh-tauri-ui/src/client/index.ts b/packages/dsh-tauri-ui/src/client/index.ts
index 69967d13..b8c01e41 100644
--- a/packages/dsh-tauri-ui/src/client/index.ts
+++ b/packages/dsh-tauri-ui/src/client/index.ts
@@ -1,8 +1,9 @@
import type {} from '@deepseek-ai/dsh-client-ui-layout/client'
import type { ClientContext } from 'dsh-tauri/client'
import { PLUGIN_ID } from '../shared/constants'
-import { HERO_WORKSPACE_EFFECT, IM_PANEL_EFFECT, LOCALE_EFFECT, NEW_SESSION_EFFECT, OBSTRUCTIONS_EFFECT, SEAT_EFFECT, SECTIONS_EFFECT, SETTINGS_EFFECT, STYLES_EFFECT, UNGROUPED_NEW_SESSION_EFFECT } from './constants'
+import { HERO_WORKSPACE_EFFECT, IM_PANEL_EFFECT, LOCALE_EFFECT, NEW_SESSION_EFFECT, OBSTRUCTIONS_EFFECT, SEAT_EFFECT, SECTIONS_EFFECT, SETTINGS_EFFECT, STYLES_EFFECT, UI_COMPONENTS_EFFECT, UNGROUPED_NEW_SESSION_EFFECT } from './constants'
import { locale } from './locales'
+import { registerUiComponentsPanel } from './register/components-playground'
import { composerResumeFeature } from './register/composer-resume'
import { heroWorkspaceFeature } from './register/hero-workspace'
import { registerImPanel } from './register/im-panel'
@@ -51,4 +52,5 @@ export function apply(ctx: ClientContext): void {
ctx.effect(ungroupedNewSessionFeature, UNGROUPED_NEW_SESSION_EFFECT)
ctx.effect(composerResumeFeature, COMPOSER_RESUME_EFFECT)
ctx.effect(registerImPanel, IM_PANEL_EFFECT)
+ ctx.effect(registerUiComponentsPanel, UI_COMPONENTS_EFFECT)
}
diff --git a/packages/dsh-tauri-ui/src/client/locales/index.ts b/packages/dsh-tauri-ui/src/client/locales/index.ts
index 39b85e81..7f5534f6 100644
--- a/packages/dsh-tauri-ui/src/client/locales/index.ts
+++ b/packages/dsh-tauri-ui/src/client/locales/index.ts
@@ -9,6 +9,8 @@ export const locale = defineLocale(PLUGIN_ID, {
noResults: '没有匹配的设置项',
resumeTask: '继续任务',
im: 'IM',
+ uiComponents: 'UI 组件',
+ uiComponentsHint: '官方组件与 refork 组件的样式对照,仅 dev 构建可见。',
chooseWorkspace: '选择工作区',
ungrouped: '未分组',
addWorkspace: '添加工作区…',
@@ -57,6 +59,8 @@ export const locale = defineLocale(PLUGIN_ID, {
noResults: 'No matching settings',
resumeTask: 'Resume task',
im: 'IM',
+ uiComponents: 'UI components',
+ uiComponentsHint: 'Style comparison of official and reforked components. Dev builds only.',
chooseWorkspace: 'Choose workspace',
ungrouped: 'Ungrouped',
addWorkspace: 'Add workspace…',
diff --git a/packages/dsh-tauri-ui/src/client/register/components-playground.tsx b/packages/dsh-tauri-ui/src/client/register/components-playground.tsx
new file mode 100644
index 00000000..265240a4
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/register/components-playground.tsx
@@ -0,0 +1,38 @@
+import type { ClientContext } from 'dsh-tauri/client'
+import { definePanel, defineRegister, invoke } from 'dsh-tauri/client'
+import { Icon } from '../components/icon'
+import { Puzzle } from '../components/icons'
+import { PanelPage } from '../components/panel-page'
+import { UI_COMPONENTS_PANEL_ID, UI_COMPONENTS_PANEL_ORDER } from '../constants'
+import { locale } from '../locales'
+import { UiComponentsPanel } from '../ui/components-playground/ui-components'
+
+/**
+ * 仅 dev 构建挂载的「UI 组件」面板。
+ *
+ * 插件侧没有可用的构建期开关(`dsh-tauri-tsdown` 无条件把 `process.env.NODE_ENV`
+ * 定成 `'production'`,也不替换 `import.meta.env`),因此向宿主问 `is_dev_build`;
+ * 命令不可用(旧宿主或非桌面宿主)时按 release 处理,宁可不显示也不误发调试入口。
+ */
+export const registerUiComponentsPanel = defineRegister<ClientContext>((controller, ctx) => {
+ // 同一 profile 也服务普通浏览器标签:只有桌面 iframe 有宿主命令可问。
+ if (typeof window === 'undefined' || window.parent === window)
+ return
+
+ invoke<boolean>('is_dev_build')
+ .then((dev) => {
+ if (!dev)
+ return
+ const panel = definePanel(ctx, {
+ id: UI_COMPONENTS_PANEL_ID,
+ order: UI_COMPONENTS_PANEL_ORDER,
+ label: () => locale.text('uiComponents'),
+ icon: props => <Icon as={Puzzle} size={props.size} />,
+ render: () => <PanelPage><UiComponentsPanel /></PanelPage>,
+ })
+ controller.add(panel.dispose)
+ })
+ .catch((error: unknown) => {
+ console.warn('[dsh-tauri-ui] is_dev_build unavailable; UI components panel stays hidden', error)
+ })
+})
diff --git a/packages/dsh-tauri-ui/src/client/ui/components-playground/ui-components.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/components-playground/ui-components.cssr.ts
new file mode 100644
index 00000000..dab3dbb1
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/ui/components-playground/ui-components.cssr.ts
@@ -0,0 +1,106 @@
+import { styles as sharedStyles } from '../../constants/theme'
+import { cssr } from '../../utils/cssr'
+
+const { c, bem: { b, e } } = cssr
+const { borderL2, layer1, layer3, primary, secondary, tertiary } = sharedStyles
+
+export default b('ui-components', {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '22px',
+ width: '100%',
+ minWidth: 0,
+ color: primary,
+}, [
+ e('section', {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '10px',
+ minWidth: 0,
+ }),
+ e('title', {
+ fontSize: '13px',
+ fontWeight: '600',
+ lineHeight: '20px',
+ color: primary,
+ }),
+ e('hint', {
+ fontSize: '12px',
+ lineHeight: '1.5',
+ color: tertiary,
+ }),
+ e('row', {
+ display: 'flex',
+ flexWrap: 'wrap',
+ alignItems: 'center',
+ gap: '10px',
+ }),
+ e('grid', {
+ display: 'grid',
+ gridTemplateColumns: 'repeat(auto-fill, minmax(260px, 1fr))',
+ gap: '10px',
+ }),
+ e('card', {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '8px',
+ minWidth: 0,
+ padding: '12px',
+ border: `0.5px solid ${borderL2}`,
+ borderRadius: '10px',
+ background: layer1,
+ }),
+ e('cardHead', {
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ gap: '8px',
+ }),
+ e('name', {
+ fontSize: '12px',
+ fontWeight: '600',
+ lineHeight: '18px',
+ color: primary,
+ }),
+ e('badge', {
+ flex: 'none',
+ padding: '0 6px',
+ fontSize: '10px',
+ lineHeight: '16px',
+ color: secondary,
+ background: layer3,
+ borderRadius: '999px',
+ }),
+ e('meta', {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '2px',
+ fontSize: '11px',
+ lineHeight: '16px',
+ color: tertiary,
+ }),
+ e('code', {
+ fontFamily: 'monospace',
+ fontSize: '11px',
+ lineHeight: '16px',
+ color: secondary,
+ wordBreak: 'break-all',
+ }),
+ e('sample', {
+ display: 'flex',
+ flexWrap: 'wrap',
+ alignItems: 'center',
+ gap: '8px',
+ minHeight: '48px',
+ padding: '10px',
+ background: layer3,
+ borderRadius: '8px',
+ }),
+ e('stack', {
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'flex-start',
+ gap: '8px',
+ }),
+ c('.dshp-ui-components__sample > *', { flex: 'none' }),
+])
diff --git a/packages/dsh-tauri-ui/src/client/ui/components-playground/ui-components.tsx b/packages/dsh-tauri-ui/src/client/ui/components-playground/ui-components.tsx
new file mode 100644
index 00000000..d283606c
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/ui/components-playground/ui-components.tsx
@@ -0,0 +1,155 @@
+import type { ReactElement } from 'react'
+import type { UiComponentEntry } from '../../components/registry'
+import { useState } from 'react'
+import { AddButton } from '../../components/add-button'
+import { ComposerTriggerChip } from '../../components/composer-trigger-chip'
+import { DangerOutlineButton } from '../../components/danger-outline-button'
+import { HelpIconButton } from '../../components/help-icon-button'
+import { Icon } from '../../components/icon'
+import { ChevronDown, Comments, Gear, Magnifier, Person, Plus, Puzzle, TrashBin } from '../../components/icons'
+import { MessageIconAction } from '../../components/message-icon-action'
+import { ModelIconButton } from '../../components/model-icon-button'
+import { NewSessionButton } from '../../components/new-session-button'
+import { Button, Input, Pill, Switch, Tag } from '../../components/official'
+import { UI_COMPONENT_REGISTRY } from '../../components/registry'
+import { RoundIconButton } from '../../components/round-icon-button'
+import { RowIconButton } from '../../components/row-icon-button'
+import { SearchIconButton } from '../../components/search-icon-button'
+import { SeatChip } from '../../components/seat-chip'
+import { SettingsSelector } from '../../components/settings-selector'
+import { StatusTag } from '../../components/status-tag'
+import { ToolbarIconButton } from '../../components/toolbar-icon-button'
+import { VersionTag } from '../../components/version-tag'
+import { UI_COMPONENTS_STYLE_ID } from '../../constants'
+import { useMountStyle } from '../../hooks/use-mount-style'
+import uiComponentsStyle from './ui-components.cssr'
+
+const BUTTON_VARIANTS = ['primary', 'outline', 'ghost', 'toolbar'] as const
+const BUTTON_SIZES = ['md', 'sm'] as const
+const TAG_TONES = ['outline', 'solid', 'neutral', 'quiet', 'success', 'info', 'warning', 'danger'] as const
+
+function SourceCard({ entry }: { entry: UiComponentEntry }): ReactElement {
+ const { source } = entry
+ return (
+ <div className="dshp-ui-components__card">
+ <div className="dshp-ui-components__cardHead">
+ <span className="dshp-ui-components__name">{entry.title}</span>
+ <span className="dshp-ui-components__badge">{source.kind}</span>
+ </div>
+ <div className="dshp-ui-components__meta">
+ <span>{`映射组件:${source.component}`}</span>
+ <span className="dshp-ui-components__code">{source.package}</span>
+ <span>{`版本:${source.availableAt.join(' / ')}`}</span>
+ {source.mappedClass === undefined
+ ? null
+ : <span>{`官方类名:.${source.mappedClass}`}</span>}
+ <span className="dshp-ui-components__code">{source.upstreamPath}</span>
+ </div>
+ </div>
+ )
+}
+
+export function UiComponentsPanel(): ReactElement {
+ useMountStyle(uiComponentsStyle, UI_COMPONENTS_STYLE_ID)
+ const [checked, setChecked] = useState(true)
+ const [activePill, setActivePill] = useState('alpha')
+ const [query, setQuery] = useState('')
+
+ return (
+ <div className="dshp-ui-components">
+ <section className="dshp-ui-components__section">
+ <span className="dshp-ui-components__title">官方转发(reexport)</span>
+ <span className="dshp-ui-components__hint">
+ 两代内核都导出,直接转发官方实现,样式由官方 CSS Modules 提供。
+ </span>
+ <div className="dshp-ui-components__sample">
+ {BUTTON_SIZES.map(size => BUTTON_VARIANTS.map(variant => (
+ <Button key={`${size}-${variant}`} size={size} variant={variant}>
+ {`${variant} / ${size}`}
+ </Button>
+ )))}
+ </div>
+ <div className="dshp-ui-components__sample">
+ <Button icon={<Plus />} variant="primary">带图标</Button>
+ <Button icon={<TrashBin />} variant="ghost">带图标</Button>
+ {TAG_TONES.map(tone => <Tag key={tone} tone={tone}>{tone}</Tag>)}
+ <Pill active={activePill === 'alpha'} onClick={() => setActivePill('alpha')}>alpha</Pill>
+ <Pill active={activePill === 'beta'} onClick={() => setActivePill('beta')}>beta</Pill>
+ <Switch checked={checked} label="开关" onChange={setChecked} />
+ <Input
+ icon={<Magnifier />}
+ placeholder="搜索"
+ value={query}
+ onChange={event => setQuery(event.target.value)}
+ />
+ </div>
+ </section>
+
+ <section className="dshp-ui-components__section">
+ <span className="dshp-ui-components__title">refork 组件</span>
+ <span className="dshp-ui-components__hint">
+ 官方只在 0.1.7 有实现或未导出,按官方 CSS 在本地重写;映射见下方表格。
+ </span>
+ <div className="dshp-ui-components__sample">
+ <div className="dshp-ui-components__stack">
+ <NewSessionButton icon={<Plus width={16} height={16} />}>新建会话</NewSessionButton>
+ <AddButton icon={<Plus width={16} height={16} />}>添加模型</AddButton>
+ <DangerOutlineButton icon={<TrashBin width={16} height={16} />}>删除</DangerOutlineButton>
+ <NewSessionButton disabled icon={<Plus width={16} height={16} />}>禁用态</NewSessionButton>
+ </div>
+ <SearchIconButton aria-label="搜索" icon={<Magnifier width={16} height={16} />} />
+ <ToolbarIconButton aria-label="工具栏" icon={<Gear width={16} height={16} />} />
+ <ModelIconButton aria-label="模型" icon={<Puzzle width={16} height={16} />} />
+ <RoundIconButton aria-label="圆形" icon={<Plus width={16} height={16} />} />
+ <RowIconButton aria-label="行内" icon={<TrashBin width={16} height={16} />} />
+ <HelpIconButton aria-label="帮助" icon={<Person width={16} height={16} />} />
+ <MessageIconAction aria-label="消息动作" icon={<Comments width={16} height={16} />} />
+ </div>
+ <div className="dshp-ui-components__sample">
+ <SeatChip chevron={<ChevronDown width={12} height={12} />} icon={<Person width={14} height={14} />}>
+ 默认
+ </SeatChip>
+ <ComposerTriggerChip
+ chevron={<ChevronDown width={12} height={12} />}
+ icon={<Gear width={14} height={14} />}
+ open
+ >
+ 默认权限
+ </ComposerTriggerChip>
+ <ComposerTriggerChip chevron={<ChevronDown width={12} height={12} />} icon={<Gear width={14} height={14} />}>
+ 收起态
+ </ComposerTriggerChip>
+ <SettingsSelector chevron={<ChevronDown width={12} height={12} />}>跟随系统</SettingsSelector>
+ <VersionTag>1.0.0</VersionTag>
+ <VersionTag tone="neutral">1.0.0</VersionTag>
+ <StatusTag tone="outline">outline</StatusTag>
+ <StatusTag tone="info">info</StatusTag>
+ <StatusTag tone="danger">danger</StatusTag>
+ </div>
+ </section>
+
+ <section className="dshp-ui-components__section">
+ <span className="dshp-ui-components__title">{`映射表(${UI_COMPONENT_REGISTRY.length})`}</span>
+ <span className="dshp-ui-components__hint">
+ kind = reexport 表示直接转发官方;refork 表示按官方 CSS 在本地重写。
+ </span>
+ <div className="dshp-ui-components__grid">
+ {UI_COMPONENT_REGISTRY.map(entry => <SourceCard key={entry.id} entry={entry} />)}
+ </div>
+ </section>
+
+ <section className="dshp-ui-components__section">
+ <span className="dshp-ui-components__title">图标</span>
+ <span className="dshp-ui-components__hint">
+ 官方 icons 桶两代导出名不同,统一走 @gravity-ui/icons,经 dsh-tauri-ui/client 转发。
+ </span>
+ <div className="dshp-ui-components__sample">
+ <Icon as={Plus} size={20} />
+ <Icon as={TrashBin} size={20} />
+ <Icon as={Magnifier} size={20} />
+ <Icon as={Gear} size={20} />
+ </div>
+ </section>
+ </div>
+ )
+}
diff --git a/src/hooks/use-invoke-iframe.ts b/src/hooks/use-invoke-iframe.ts
index a21b5632..1dfe160d 100644
--- a/src/hooks/use-invoke-iframe.ts
+++ b/src/hooks/use-invoke-iframe.ts
@@ -33,6 +33,8 @@ interface InvokeBridgeRequest {
* 防止 iframe 内其他插件借道桥执行任意 Tauri command(越权)。
*/
const ALLOWED_INVOKE_CMDS = new Set([
+ // 只读布尔量,供 dsh-tauri-ui 决定是否挂载仅 dev 可见的调试面板。
+ 'is_dev_build',
'get_pet_status',
'set_pet_enabled',
'set_active_pet',